diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..eb9a5d910 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,18 @@ +*Please use the search functionality before reporting an issue. Also take a look at the closed issues!* + +#### Issue description: + + +#### Steps to reproduce: +1. +2. +3. + +#### Version (make sure you are on the latest version before reporting): +**Forge:** +**Mekanism:** +**Other relevant version:** + +#### If a (crash)log is relevant for this issue, link it here: (_It's almost always relevant_) + +[gist/pastebin/etc link here] \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..e85a72828 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +language: java +jdk: + - oraclejdk8 +before_cache: + - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock + - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ + - rm -f $HOME/.gradle/caches/minecraft/deobfedDeps/providedDummy.jar + - rm -f $HOME/.gradle/caches/minecraft/deobfedDeps/compileDummy.jar +cache: + directories: + - $HOME/.gradle/caches/ + - $HOME/.gradle/wrapper/ +before_install: + - chmod +x gradlew +install: + - ./gradlew setupCIWorkspace +script: + - ./gradlew check diff --git a/README.md b/README.md index 025e35dbb..6fff6d5dc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# Mekanism for Minecraft 1.10 # +[![Build Status](https://travis-ci.org/aidancbrady/Mekanism.svg?branch=master)](https://travis-ci.org/aidancbrady/Mekanism) + +# Mekanism for Minecraft 1.11 # [**Official Website**](http://aidancbrady.com/mekanism/) @@ -19,7 +21,7 @@ Licenses are not really my friend -- strict closed source software really drives THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -**Copyright © 2016 Aidan Brady** +**Copyright © 2017 Aidan Brady** # Developers & Credits # @@ -27,6 +29,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI **Co-developer:** unpairedbracket -**Artwork:** Cheapshot, Archadia +**Artwork:** CyanideX, Cheapshot, Archadia -**Contributors:** micdoodle +**Contributors:** micdoodle, Bluexin, thommy101, JaSpr diff --git a/build.gradle b/build.gradle index f55bc56ca..029b88844 100644 --- a/build.gradle +++ b/build.gradle @@ -35,11 +35,27 @@ repositories { } maven { name 'amadornes' - url "http://maven.amadornes.com/" + url 'http://maven.amadornes.com/' } maven { name 'prog' - url "http://dvs1.progwml6.com/files/maven" + url 'http://dvs1.progwml6.com/files/maven' + } + maven { + name 'tesla' + url 'http://maven.epoxide.org' + } + maven { + name 'curseforge' + url 'https://minecraft.curseforge.com/api/maven/' + } + maven { + name 'opencomputers' + url 'http://maven.cil.li/' + } + maven { + name 'hwyla' + url 'http://tehnut.info/maven' } } @@ -68,8 +84,12 @@ minecraft { } dependencies { - deobfCompile "MCMultiPart:MCMultiPart-experimental:${config.mcmp_version}:universal" + deobfCompile "MCMultiPart2:MCMultiPart-exp:${config.mcmp_version}" deobfCompile "mezz.jei:jei_${config.minecraft_version}:${config.jei_version}" + compile "net.darkhax.tesla:Tesla:${config.tesla_version}" + compile "inventory-tweaks:InventoryTweaks:${config.invtweak_version}:api" + compile "li.cil.oc:OpenComputers:MC${config.minecraft_version}-${config.opencomputers_version}:api" + deobfCompile "mcp.mobius.waila:Hwyla:${config.hwyla_version}" } processResources diff --git a/build.properties b/build.properties index 44459176e..d9f5301e5 100644 --- a/build.properties +++ b/build.properties @@ -1,6 +1,10 @@ -minecraft_version=1.10.2 -mappings_version=snapshot_20160627 -forge_version=12.18.1.2014 -mcmp_version=2.0.0_88 -jei_version=3.7.6.231 -mod_version=9.2.2 +minecraft_version=1.11.2 +mappings_version=snapshot_20161220 +forge_version=13.20.0.2304 +mcmp_version=2.0.0_19 +jei_version=4.2.9.247 +mod_version=9.3.2 +tesla_version=1.11-1.3.0.52 +invtweak_version=1.62+beta.89 +opencomputers_version=1.7.0.24 +hwyla_version=1.8.13-B26_1.11 diff --git a/src/api/java/buildcraft/api/IDoubleRegistry.java b/src/api/java/buildcraft/api/IDoubleRegistry.java deleted file mode 100755 index 3c5db9254..000000000 --- a/src/api/java/buildcraft/api/IDoubleRegistry.java +++ /dev/null @@ -1,10 +0,0 @@ -package buildcraft.api; - -import java.util.Map.Entry; -import java.util.Set; - -public interface IDoubleRegistry extends ISimpleRegistry { - void registerDefinition(T definition); - - Set> getDefinitions(); -} diff --git a/src/api/java/buildcraft/api/ISimpleRegistry.java b/src/api/java/buildcraft/api/ISimpleRegistry.java deleted file mode 100755 index 9227214f4..000000000 --- a/src/api/java/buildcraft/api/ISimpleRegistry.java +++ /dev/null @@ -1,12 +0,0 @@ -package buildcraft.api; - -interface ISimpleRegistry { - /** @param uniqueTag The tag to look up. Can be null. - * @return The unique definition associated with the unique tag, or null if the tag was not mapped */ - T getDefinition(String uniqueTag); - - /** @param definition The definition to look up. Can be null. - * @return The unique to for that definition. Will never be null, but will be an empty string if the definition did - * not exist. */ - String getTag(T definition); -} diff --git a/src/api/java/buildcraft/api/ITripleRegistry.java b/src/api/java/buildcraft/api/ITripleRegistry.java deleted file mode 100755 index ea29b613c..000000000 --- a/src/api/java/buildcraft/api/ITripleRegistry.java +++ /dev/null @@ -1,30 +0,0 @@ -package buildcraft.api; - -import java.util.Set; - -import org.apache.commons.lang3.tuple.Triple; - -import net.minecraft.item.Item; - -public interface ITripleRegistry extends ISimpleRegistry { - /** @return An unmodifiable set containing all the current mappings of the registry */ - Set> getDefinitions(); - - // Specifics - - /** @param definition The pipe definition to look up. Can be null. - * @return The item the has been mapped to the definition, or null if the definition was not mapped */ - Item getItem(T definition); - - /** @param item The item to look up the definition of. Can be null. - * @return The definition associated with that item, or null if the item was not mapped. */ - T getDefinition(Item item); - - /** @param item The item to look up the tag of. Can be null. - * @return The unique tag associated with that item, or null if the item was not mapped. */ - String getUniqueTag(Item item); - - /** @param tag The tag to look up the item with. - * @return The item associated with that tag, or null if the tag was not mapped. */ - Item getItem(String tag); -} diff --git a/src/api/java/buildcraft/api/ObjectDefinition.java b/src/api/java/buildcraft/api/ObjectDefinition.java deleted file mode 100755 index 54c9bd127..000000000 --- a/src/api/java/buildcraft/api/ObjectDefinition.java +++ /dev/null @@ -1,32 +0,0 @@ -package buildcraft.api; - -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModContainer; - -/* Note that neither this class (Or any of its subtypes) overrides equals or hash code, despite it being used as a key - * in a hash table. This is to speed up comparisons as no two ObjectDefinitions instances should be created with the - * same values. */ -public class ObjectDefinition { - /** A globally unique tag for the pipe */ - public final String globalUniqueTag; - /** A mod unique tag for the pipe. WARNING: this should only be used to register other mod-unique things, such as - * the pipe or gate item. For general use, use {@link #globalUniqueTag} */ - public final String modUniqueTag; - - protected static String getCurrentMod() { - ModContainer container = Loader.instance().activeModContainer(); - if (container == null) { - throw new IllegalStateException("Objects MUST be created inside a mod"); - } - return container.getModId(); - } - - private ObjectDefinition(String mod, String modUniqueTag) { - this.globalUniqueTag = mod + ":" + modUniqueTag; - this.modUniqueTag = modUniqueTag; - } - - public ObjectDefinition(String tag) { - this(getCurrentMod(), tag); - } -} diff --git a/src/api/java/buildcraft/api/blocks/CustomPaintHelper.java b/src/api/java/buildcraft/api/blocks/CustomPaintHelper.java new file mode 100755 index 000000000..2517af2bb --- /dev/null +++ b/src/api/java/buildcraft/api/blocks/CustomPaintHelper.java @@ -0,0 +1,115 @@ +package buildcraft.api.blocks; + +import java.util.List; +import java.util.Map; + +import javax.annotation.Nullable; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; + +import buildcraft.api.core.BCDebugging; +import buildcraft.api.core.BCLog; + +/** Provides a simple way to paint a single block, iterating through all {@link ICustomPaintHandler}'s that are + * registered for the block. */ +public enum CustomPaintHelper { + INSTANCE; + + /* If you want to test your class-based rotation registration then add the system property + * "-Dbuildcraft.api.rotation.debug.class=true" to your launch. */ + private static final boolean DEBUG = BCDebugging.shouldDebugLog("api.painting"); + + private final Map> handlers = Maps.newIdentityHashMap(); + private final List allHandlers = Lists.newArrayList(); + + /** Registers a handler that will be called LAST for ALL blocks, if all other paint handlers have returned PASS or + * none are registered for that block. */ + public void registerHandlerForAll(ICustomPaintHandler handler) { + if (DEBUG) { + BCLog.logger.info("[api.painting] Adding a paint handler for ALL blocks (" + handler.getClass() + ")"); + } + allHandlers.add(handler); + } + + /** Register's a paint handler for every class of a given block. */ + public void registerHandlerForAll(Class blockClass, ICustomPaintHandler handler) { + for (Block block : Block.REGISTRY) { + Class foundClass = block.getClass(); + if (blockClass.isAssignableFrom(foundClass)) { + if (DEBUG) { + BCLog.logger.info("[api.painting] Found an assignable block " + block.getRegistryName() + " (" + foundClass + ") for " + blockClass); + } + registerHandlerInternal(block, handler); + } + } + } + + public void registerHandler(Block block, ICustomPaintHandler handler) { + if (registerHandlerInternal(block, handler)) { + if (DEBUG) { + BCLog.logger.info("[api.painting] Setting a paint handler for block " + block.getRegistryName() + "(" + handler.getClass() + ")"); + } + } else if (DEBUG) { + BCLog.logger.info("[api.painting] Adding another paint handler for block " + block.getRegistryName() + "(" + handler.getClass() + ")"); + } + } + + private boolean registerHandlerInternal(Block block, ICustomPaintHandler handler) { + if (!handlers.containsKey(block)) { + List forBlock = Lists.newArrayList(); + forBlock.add(handler); + handlers.put(block, forBlock); + return true; + } else { + handlers.get(block).add(handler); + return false; + } + } + + /** Attempts to paint a block at the given position. Basically iterates through all registered paint handlers. */ + public EnumActionResult attemptPaintBlock(World world, BlockPos pos, IBlockState state, Vec3d hitPos, @Nullable EnumFacing hitSide, @Nullable EnumDyeColor paint) { + Block block = state.getBlock(); + if (block instanceof ICustomPaintHandler) { + return ((ICustomPaintHandler) block).attemptPaint(world, pos, state, hitPos, hitSide, paint); + } + List custom = handlers.get(block); + if (custom == null || custom.isEmpty()) { + return defaultAttemptPaint(world, pos, state, hitPos, hitSide, paint); + } + for (ICustomPaintHandler handler : custom) { + EnumActionResult result = handler.attemptPaint(world, pos, state, hitPos, hitSide, paint); + if (result != EnumActionResult.PASS) { + return result; + } + } + return defaultAttemptPaint(world, pos, state, hitPos, hitSide, paint); + } + + private EnumActionResult defaultAttemptPaint(World world, BlockPos pos, IBlockState state, Vec3d hitPos, EnumFacing hitSide, @Nullable EnumDyeColor paint) { + for (ICustomPaintHandler handler : allHandlers) { + EnumActionResult result = handler.attemptPaint(world, pos, state, hitPos, hitSide, paint); + if (result != EnumActionResult.PASS) { + return result; + } + } + if (paint == null) { + return EnumActionResult.FAIL; + } + Block b = state.getBlock(); + if (b.recolorBlock(world, pos, hitSide, paint)) { + return EnumActionResult.SUCCESS; + } else { + return EnumActionResult.FAIL; + } + } +} diff --git a/src/api/java/buildcraft/api/blocks/CustomRotationHelper.java b/src/api/java/buildcraft/api/blocks/CustomRotationHelper.java new file mode 100755 index 000000000..235c0de11 --- /dev/null +++ b/src/api/java/buildcraft/api/blocks/CustomRotationHelper.java @@ -0,0 +1,76 @@ +package buildcraft.api.blocks; + +import java.util.List; +import java.util.Map; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +import buildcraft.api.core.BCDebugging; +import buildcraft.api.core.BCLog; + +public enum CustomRotationHelper { + INSTANCE; + + /* If you want to test your class-based rotation registration then add the system property + * "-Dbuildcraft.api.rotation.debug.class=true" to your launch. */ + private static final boolean DEBUG = BCDebugging.shouldDebugLog("api.rotation"); + + private final Map> handlers = Maps.newIdentityHashMap(); + + public void registerHandlerForAll(Class blockClass, ICustomRotationHandler handler) { + for (Block block : Block.REGISTRY) { + Class foundClass = block.getClass(); + if (blockClass.isAssignableFrom(foundClass)) { + if (DEBUG) { + BCLog.logger.info("[api.rotation] Found an assignable block " + block.getRegistryName() + " (" + foundClass + ") for " + blockClass); + } + registerHandlerInternal(block, handler); + } + } + } + + public void registerHandler(Block block, ICustomRotationHandler handler) { + if (registerHandlerInternal(block, handler)) { + if (DEBUG) { + BCLog.logger.info("[api.rotation] Setting a rotation handler for block " + block.getRegistryName()); + } + } else if (DEBUG) { + BCLog.logger.info("[api.rotation] Adding another rotation handler for block " + block.getRegistryName()); + } + } + + private boolean registerHandlerInternal(Block block, ICustomRotationHandler handler) { + if (!handlers.containsKey(block)) { + List forBlock = Lists.newArrayList(); + forBlock.add(handler); + handlers.put(block, forBlock); + return true; + } else { + handlers.get(block).add(handler); + return false; + } + } + + public EnumActionResult attemptRotateBlock(World world, BlockPos pos, IBlockState state, EnumFacing sideWrenched) { + Block block = state.getBlock(); + if (block instanceof ICustomRotationHandler) { + return ((ICustomRotationHandler) block).attemptRotation(world, pos, state, sideWrenched); + } + if (!handlers.containsKey(block)) return EnumActionResult.PASS; + for (ICustomRotationHandler handler : handlers.get(block)) { + EnumActionResult result = handler.attemptRotation(world, pos, state, sideWrenched); + if (result != EnumActionResult.PASS) { + return result; + } + } + return EnumActionResult.PASS; + } +} diff --git a/src/api/java/buildcraft/api/blocks/ICustomPaintHandler.java b/src/api/java/buildcraft/api/blocks/ICustomPaintHandler.java new file mode 100755 index 000000000..fd79c910a --- /dev/null +++ b/src/api/java/buildcraft/api/blocks/ICustomPaintHandler.java @@ -0,0 +1,31 @@ +package buildcraft.api.blocks; + +import javax.annotation.Nullable; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; + +/** Provides a way to paint blocks from any position. You can either implement this on a block, or register an instance + * for a block with {@link CustomPaintHelper} */ +public interface ICustomPaintHandler { + /** Attempts to paint the given block. This can also only paint a specific part of the block (as the hit position is + * given). + * + * @param world The world that the block is contained within. + * @param pos The position of the block. + * @param state The current state of the block. + * @param hitPos The absolute hit position of the paintbrush, relative the world's origin. + * @param hitSide The side of the block that was hit. + * @param paintColour The paint colour to attempt to paint with, null if the paint should be cleared (so if this was + * a stained glass block, and null was passed, this would set it to a normal, clear, non-stained glass + * block. + * @return The result of attempting to paint. SUCCESS means that you changed the block from before to a new value, + * FAIL means you COULD have handled the block, but it was already painted to that colour, or PASS if you + * have no idea how to handle the block in question. */ + EnumActionResult attemptPaint(World world, BlockPos pos, IBlockState state, Vec3d hitPos, @Nullable EnumFacing hitSide, @Nullable EnumDyeColor paintColour); +} diff --git a/src/api/java/buildcraft/api/blocks/ICustomRotationHandler.java b/src/api/java/buildcraft/api/blocks/ICustomRotationHandler.java new file mode 100755 index 000000000..9076f8fd0 --- /dev/null +++ b/src/api/java/buildcraft/api/blocks/ICustomRotationHandler.java @@ -0,0 +1,11 @@ +package buildcraft.api.blocks; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +public interface ICustomRotationHandler { + EnumActionResult attemptRotation(World world, BlockPos pos, IBlockState state, EnumFacing sideWrenched); +} diff --git a/src/api/java/buildcraft/api/blocks/package-info.java b/src/api/java/buildcraft/api/blocks/package-info.java new file mode 100755 index 000000000..c3bc6eac1 --- /dev/null +++ b/src/api/java/buildcraft/api/blocks/package-info.java @@ -0,0 +1,8 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|blocks") +package buildcraft.api.blocks; + +import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/blueprints/BlueprintDeployer.java b/src/api/java/buildcraft/api/blueprints/BlueprintDeployer.java new file mode 100755 index 000000000..dad91b98f --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/BlueprintDeployer.java @@ -0,0 +1,30 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.blueprints; + +import java.io.File; + +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +/** This class is provided as a utility class for third-party mods that would like to easily deploy structures that are + * written in blueprints. It does not offer control on material that needs to get in, or how the structure is deployed, + * but allows to create contents of a blueprint in one cycle. Note that these functionalities will only work if + * BuildCraft is installed. */ +public abstract class BlueprintDeployer { + + /** The deployed instantiated by BuildCraft. This is set by the BuildCraft builder mod. Mods that want to work with + * BuildCraft not installed should check for this value to be not null. */ + public static BlueprintDeployer instance; + + /** Deploy the contents of the blueprints as if the builder was located at {pos} facing the direction dir. */ + public abstract void deployBlueprint(World world, BlockPos pos, EnumFacing facing, File file); + + /** Deploy the contents of the byte array as if the builder was located at {pos} facing the direction dir. */ + + public abstract void deployBlueprintFromFileStream(World world, BlockPos pos, EnumFacing dir, byte[] data); + +} diff --git a/src/api/java/buildcraft/api/blueprints/BuilderAPI.java b/src/api/java/buildcraft/api/blueprints/BuilderAPI.java new file mode 100755 index 000000000..ac15b474b --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/BuilderAPI.java @@ -0,0 +1,16 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.blueprints; + +public final class BuilderAPI { + public static ISchematicRegistry schematicRegistry; + public static ISchematicHelper schematicHelper; + + private static final long MJ = 1000 * 1000; + public static final long BREAK_POWER = 16 * MJ;// micro Mj + public static final long BUILD_POWER = 24 * MJ;// micro Mj + + private BuilderAPI() {} +} diff --git a/src/api/java/buildcraft/api/blueprints/BuildingPermission.java b/src/api/java/buildcraft/api/blueprints/BuildingPermission.java new file mode 100755 index 000000000..8661240c4 --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/BuildingPermission.java @@ -0,0 +1,21 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.blueprints; + +/** Schematics recorded in the blueprints can restrict situations where a blueprint can be used. A same schematic class + * can have different permissions depending on its contents. It's particularly useful when fixing a schematic, if + * blueprints that saved the previous version should not be built because of a bug (such as dupe bug on inventories). */ +public enum BuildingPermission { + /** No restrictions, blueprints using this schematic are good in all contexts. */ + ALL, + + /** This blueprints containing this schematic can only be used in creative. Maybe the block can't be crafted in + * survival in the first place, or the content of the schematic is known to have dupe bugs. */ + CREATIVE_ONLY, + + /** Blueprints containing this schematic should not be built. This is typically used when a critical problems have + * been fixed, but older versions of the schematic are too badly broken to be retreived. */ + NONE, +} diff --git a/src/api/java/buildcraft/api/blueprints/IBuilderContext.java b/src/api/java/buildcraft/api/blueprints/IBuilderContext.java new file mode 100755 index 000000000..e5eb8900b --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/IBuilderContext.java @@ -0,0 +1,22 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.blueprints; + +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; + +import buildcraft.api.core.IBox; + +/** This interface provide contextual information when building or initializing blueprint slots. */ +public interface IBuilderContext { + + Vec3d rotatePositionLeft(Vec3d pos); + + IBox surroundingBox(); + + World world(); + + MappingRegistry getMappingRegistry(); +} diff --git a/src/api/java/buildcraft/api/blueprints/ISchematicHelper.java b/src/api/java/buildcraft/api/blueprints/ISchematicHelper.java new file mode 100755 index 000000000..7327f2e20 --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/ISchematicHelper.java @@ -0,0 +1,7 @@ +package buildcraft.api.blueprints; + +import net.minecraft.item.ItemStack; + +public interface ISchematicHelper { + boolean isEqualItem(ItemStack a, ItemStack b); +} diff --git a/src/api/java/buildcraft/api/blueprints/ISchematicRegistry.java b/src/api/java/buildcraft/api/blueprints/ISchematicRegistry.java new file mode 100755 index 000000000..503c315d5 --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/ISchematicRegistry.java @@ -0,0 +1,19 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.blueprints; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; + +public interface ISchematicRegistry { + void registerSchematicBlock(Block block, Class clazz, Object... params); + + void registerSchematicBlock(IBlockState state, Class clazz, Object... params); + + void registerSchematicEntity(Class entityClass, Class schematicClass, Object... params); + + boolean isSupported(IBlockState state); +} diff --git a/src/api/java/buildcraft/api/blueprints/ITileBuilder.java b/src/api/java/buildcraft/api/blueprints/ITileBuilder.java new file mode 100755 index 000000000..2c06f64c3 --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/ITileBuilder.java @@ -0,0 +1,13 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.blueprints; + +import net.minecraft.inventory.IInventory; + +public interface ITileBuilder extends IInventory { + + boolean isBuildingMaterialSlot(int i); + +} diff --git a/src/api/java/buildcraft/api/blueprints/MappingNotFoundException.java b/src/api/java/buildcraft/api/blueprints/MappingNotFoundException.java new file mode 100755 index 000000000..f84cee627 --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/MappingNotFoundException.java @@ -0,0 +1,13 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.blueprints; + +public class MappingNotFoundException extends Exception { + private static final long serialVersionUID = 1L; + + public MappingNotFoundException(String msg) { + super(msg); + } +} diff --git a/src/api/java/buildcraft/api/blueprints/MappingRegistry.java b/src/api/java/buildcraft/api/blueprints/MappingRegistry.java new file mode 100755 index 000000000..d2d9b9060 --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/MappingRegistry.java @@ -0,0 +1,422 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.blueprints; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map.Entry; + +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.ListMultimap; + +import org.apache.logging.log4j.Level; + +import net.minecraft.block.Block; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagByte; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagShort; +import net.minecraft.util.ResourceLocation; + +import net.minecraftforge.common.util.Constants; +import net.minecraftforge.fml.common.FMLModContainer; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.ModContainer; +import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent; +import net.minecraftforge.fml.common.registry.GameRegistry; + +import buildcraft.api.core.BCLog; + +public class MappingRegistry { + + public HashMap blockToId = new HashMap(); + public ArrayList idToBlock = new ArrayList(); + + public HashMap itemToId = new HashMap(); + public ArrayList idToItem = new ArrayList(); + + public HashMap, Integer> entityToId = new HashMap, Integer>(); + public ArrayList> idToEntity = new ArrayList>(); + + private void registerItem(Item item) { + if (item == null) throw new IllegalArgumentException("Cannot register a null item!"); + if (!itemToId.containsKey(item)) { + idToItem.add(item); + itemToId.put(item, idToItem.size() - 1); + } + } + + private void registerBlock(Block block) { + if (block == null) throw new IllegalArgumentException("Cannot register a null block!"); + if (!blockToId.containsKey(block)) { + idToBlock.add(block); + blockToId.put(block, idToBlock.size() - 1); + } + } + + private void registerEntity(Class entityClass) { + if (entityClass == null) throw new IllegalArgumentException("Cannot register a null entityClass!"); + if (!entityToId.containsKey(entityClass)) { + idToEntity.add(entityClass); + entityToId.put(entityClass, idToEntity.size() - 1); + } + } + + public Item getItemForId(int id) throws MappingNotFoundException { + if (id >= idToItem.size()) { + throw new MappingNotFoundException("no item mapping at position " + id); + } + + Item result = idToItem.get(id); + + if (result == null) { + throw new MappingNotFoundException("no item mapping at position " + id); + } else { + return result; + } + } + + public int getIdForItem(Item item) { + if (item == null) throw new NullPointerException("item"); + if (!itemToId.containsKey(item)) { + registerItem(item); + } + + return itemToId.get(item); + } + + public int itemIdToRegistry(int id) { + Item item = Item.getItemById(id); + + return getIdForItem(item); + } + + public ResourceLocation itemIdToWorld(int id) throws MappingNotFoundException { + Item item = getItemForId(id); + + return Item.REGISTRY.getNameForObject(item); + } + + public Block getBlockForId(int id) throws MappingNotFoundException { + if (id >= idToBlock.size()) { + throw new MappingNotFoundException("no block mapping at position " + id); + } + + Block result = idToBlock.get(id); + + if (result == null) { + throw new MappingNotFoundException("no block mapping at position " + id); + } else { + return result; + } + } + + public int getIdForBlock(Block block) { + if (!blockToId.containsKey(block)) { + registerBlock(block); + } + + return blockToId.get(block); + } + + public int blockIdToRegistry(int id) { + Block block = Block.getBlockById(id); + + return getIdForBlock(block); + } + + public ResourceLocation blockIdToWorld(int id) throws MappingNotFoundException { + Block block = getBlockForId(id); + + return Block.REGISTRY.getNameForObject(block); + } + + public Class getEntityForId(int id) throws MappingNotFoundException { + if (id >= idToEntity.size()) { + throw new MappingNotFoundException("no entity mapping at position " + id); + } + + Class result = idToEntity.get(id); + + if (result == null) { + throw new MappingNotFoundException("no entity mapping at position " + id); + } else { + return result; + } + } + + public int getIdForEntity(Class entity) { + if (!entityToId.containsKey(entity)) { + registerEntity(entity); + } + + return entityToId.get(entity); + } + + /** Relocates a stack nbt from the registry referential to the world referential. */ + public void stackToWorld(NBTTagCompound nbt) throws MappingNotFoundException { + if (nbt.hasKey("id", Constants.NBT.TAG_SHORT)) { + Item item = getItemForId(nbt.getShort("id")); + nbt.setString("id", (item.getRegistryName().toString())); + } + } + + // versions before 1.8 saved stacks with an Item ID as a short + private boolean isOldStackLayout(NBTTagCompound nbt) { + return nbt.hasKey("id") && nbt.hasKey("Count") && nbt.hasKey("Damage") && nbt.getTag("id") instanceof NBTTagShort && nbt.getTag( + "Count") instanceof NBTTagByte && nbt.getTag("Damage") instanceof NBTTagShort; + } + + public void scanAndTranslateStacksToWorld(NBTTagCompound nbt) throws MappingNotFoundException { + // First, check if this nbt is itself a stack + + if (isOldStackLayout(nbt)) { + stackToWorld(nbt); + } + + // Then, look at the nbt compound contained in this nbt (even if it's a + // stack) and checks for stacks in it. + for (String key : (Collection) nbt.getKeySet()) { + if (nbt.getTag(key) instanceof NBTTagCompound) { + try { + scanAndTranslateStacksToWorld(nbt.getCompoundTag(key)); + } catch (MappingNotFoundException e) { + nbt.removeTag(key); + } + } + + if (nbt.getTag(key) instanceof NBTTagList) { + NBTTagList list = (NBTTagList) nbt.getTag(key); + + if (list.getTagType() == Constants.NBT.TAG_COMPOUND) { + for (int i = list.tagCount() - 1; i >= 0; --i) { + try { + scanAndTranslateStacksToWorld(list.getCompoundTagAt(i)); + } catch (MappingNotFoundException e) { + list.removeTag(i); + } + } + } + } + } + } + + public void write(NBTTagCompound nbt) { + NBTTagList blocksMapping = new NBTTagList(); + + for (Block b : idToBlock) { + NBTTagCompound sub = new NBTTagCompound(); + if (b != null) { + Object obj = Block.REGISTRY.getNameForObject(b); + if (obj == null) { + BCLog.logger.error("Block " + b.getUnlocalizedName() + " (" + b.getClass().getName() + + ") does not have a registry name! This is a bug!"); + } else { + String name = obj.toString(); + if (name == null || name.length() == 0) { + BCLog.logger.error("Block " + b.getUnlocalizedName() + " (" + b.getClass().getName() + + ") has an empty registry name! This is a bug!"); + } else { + sub.setString("name", name); + } + } + } else { + throw new IllegalArgumentException("Found a null block!"); + } + blocksMapping.appendTag(sub); + } + + nbt.setTag("blocksMapping", blocksMapping); + + NBTTagList itemsMapping = new NBTTagList(); + + for (Item i : idToItem) { + NBTTagCompound sub = new NBTTagCompound(); + if (i != null) { + ResourceLocation obj = Item.REGISTRY.getNameForObject(i); + if (obj == null) { + BCLog.logger.error("Item " + i.getUnlocalizedName() + " (" + i.getClass().getName() + + ") does not have a registry name! This is a bug!"); + } else { + String name = obj.toString(); + if (name == null || name.length() == 0) { + BCLog.logger.error("Item " + i.getUnlocalizedName() + " (" + i.getClass().getName() + + ") has an empty registry name! This is a bug!"); + } else { + sub.setString("name", name); + } + } + } else { + throw new IllegalArgumentException("Found a null item!"); + } + itemsMapping.appendTag(sub); + } + + nbt.setTag("itemsMapping", itemsMapping); + + NBTTagList entitiesMapping = new NBTTagList(); + + for (Class e : idToEntity) { + NBTTagCompound sub = new NBTTagCompound(); + sub.setString("name", e.getCanonicalName()); + entitiesMapping.appendTag(sub); + } + + nbt.setTag("entitiesMapping", entitiesMapping); + + // System.out.println("[W] idToItem size : " + idToItem.size()); + // for (Item i : idToItem) { + // System.out.println("- " + (i != null ? i.toString() : "null")); + // } + } + + private Object getMissingMappingFromFML(boolean isBlock, String name, int i) { + ResourceLocation location = new ResourceLocation(name); + String modName = name.split(":")[0]; + if (Loader.isModLoaded(modName)) { + try { + FMLMissingMappingsEvent.MissingMapping mapping = new FMLMissingMappingsEvent.MissingMapping(isBlock ? GameRegistry.Type.BLOCK + : GameRegistry.Type.ITEM, location, i); + ListMultimap missingMapping = ArrayListMultimap.create(); + missingMapping.put(modName, mapping); + FMLMissingMappingsEvent event = new FMLMissingMappingsEvent(missingMapping); + for (ModContainer container : Loader.instance().getModList()) { + if (container instanceof FMLModContainer) { + event.applyModContainer(container); + ((FMLModContainer) container).handleModStateEvent(event); + if (mapping.getAction() != FMLMissingMappingsEvent.Action.DEFAULT) { + break; + } + } + } + if (mapping.getAction() == FMLMissingMappingsEvent.Action.REMAP) { + return mapping.getTarget(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + return null; + } + + public void read(NBTTagCompound nbt) { + NBTTagList blocksMapping = nbt.getTagList("blocksMapping", Constants.NBT.TAG_COMPOUND); + + for (int i = 0; i < blocksMapping.tagCount(); ++i) { + NBTTagCompound sub = blocksMapping.getCompoundTagAt(i); + if (!sub.hasKey("name")) { + // Keeping the order correct + idToBlock.add(null); + BCLog.logger.log(Level.WARN, "Can't load a block - corrupt blueprint!"); + continue; + } + String name = sub.getString("name"); + ResourceLocation location = new ResourceLocation(name); + Block b = null; + + if (!Block.REGISTRY.containsKey(location) && name.contains(":")) { + b = (Block) getMissingMappingFromFML(true, name, i); + if (b != null) { + BCLog.logger.info("Remapped " + name + " to " + Block.REGISTRY.getNameForObject(b)); + } + } + + if (b == null && Block.REGISTRY.containsKey(location)) { + b = (Block) Block.REGISTRY.getObject(location); + } + + if (b != null) { + registerBlock(b); + } else { + // Keeping the order correct + idToBlock.add(null); + BCLog.logger.log(Level.WARN, "Can't load block " + name); + } + } + + NBTTagList itemsMapping = nbt.getTagList("itemsMapping", Constants.NBT.TAG_COMPOUND); + + for (int i = 0; i < itemsMapping.tagCount(); ++i) { + NBTTagCompound sub = itemsMapping.getCompoundTagAt(i); + if (!sub.hasKey("name")) { + // Keeping the order correct + idToItem.add(null); + BCLog.logger.log(Level.WARN, "Can't load an item - corrupt blueprint!"); + continue; + } + + String name = sub.getString("name"); + ResourceLocation location = new ResourceLocation(name); + Item item = null; + + if (!Item.REGISTRY.containsKey(location) && name.contains(":")) { + item = (Item) getMissingMappingFromFML(false, name, i); + if (item != null) { + BCLog.logger.info("Remapped " + name + " to " + Item.REGISTRY.getNameForObject(item)); + } + } + + if (item == null && Item.REGISTRY.containsKey(location)) { + item = (Item) Item.REGISTRY.getObject(location); + } + + if (item != null) { + registerItem(item); + } else { + // Keeping the order correct + idToItem.add(null); + BCLog.logger.log(Level.WARN, "Can't load item " + name); + } + } + + NBTTagList entitiesMapping = nbt.getTagList("entitiesMapping", Constants.NBT.TAG_COMPOUND); + + for (int i = 0; i < entitiesMapping.tagCount(); ++i) { + NBTTagCompound sub = entitiesMapping.getCompoundTagAt(i); + String name = sub.getString("name"); + Class e = null; + + try { + e = (Class) Class.forName(name); + } catch (ClassNotFoundException e1) { + e1.printStackTrace(); + } + + if (e != null) { + registerEntity(e); + } else { + // Keeping the order correct + idToEntity.add(null); + BCLog.logger.log(Level.WARN, "Can't load entity " + name); + } + } + + // System.out.println("[R] idToItem size : " + idToItem.size()); + // for (Item i : idToItem) { + // System.out.println("- " + (i != null ? i.toString() : "null")); + // } + } + + public void addToCrashReport(CrashReportCategory cat) { + cat.addCrashSection("Item Map Count", itemToId.size()); + for (Entry e : itemToId.entrySet()) { + cat.addCrashSection(" - ID " + e.getValue(), Item.REGISTRY.getNameForObject(e.getKey())); + } + + cat.addCrashSection("Block Map Count", blockToId.size()); + for (Entry e : blockToId.entrySet()) { + cat.addCrashSection(" - ID " + e.getValue(), Block.REGISTRY.getNameForObject(e.getKey())); + } + + cat.addCrashSection("Entity Map Count", entityToId.size()); + for (Entry, Integer> e : entityToId.entrySet()) { + cat.addCrashSection(" - ID " + e.getValue(), e.getKey()); + } + } +} diff --git a/src/api/java/buildcraft/api/blueprints/Schematic.java b/src/api/java/buildcraft/api/blueprints/Schematic.java new file mode 100755 index 000000000..a0bb497b9 --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/Schematic.java @@ -0,0 +1,196 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.blueprints; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; + +import buildcraft.api.core.IInvSlot; + +/** A schematic is a piece of a blueprint. It allows to stock blocks or entities to blueprints, and can have a state + * that moves from a blueprint referential to a world referential. Although default schematic behavior will be OK for a + * lot of objects, specific blocks and entities may be associated with a dedicated schematic class, which will be + * instantiated automatically. + * + * Schematic perform "id translation" in case the block ids between a blueprint and the world installation are + * different. Mapping is done through the builder context. + * + * Detailed documentation on the schematic behavior can be found on + * http://www.mod-buildcraft.com/wiki/doku.php?id=builder_support + * + * Example of schematics for minecraft blocks are available in the package buildcraft.core.schematics. */ +// is being replaced by a different schematic implementation +// a simalir styled one to this might be made ontop of the other one though +public abstract class Schematic { + /** Blocks are build in various stages, in order to make sure that a block can indeed be placed, and that it's + * unlikely to disturb other blocks. */ + public enum BuildingStage { + /** Standalone blocks do not change once placed. */ + STANDALONE, + + /** Expanding blocks will grow and may disturb other block locations, like liquids. */ + EXPANDING + } + + /** This is called to verify whether the required item is equal to the supplied item. + * + * Primarily rely on this for checking metadata/NBT - the item ID itself might have been filtered out by previously + * running code. */ + public boolean isItemMatchingRequirement(ItemStack suppliedStack, ItemStack requiredStack) { + return BuilderAPI.schematicHelper.isEqualItem(suppliedStack, requiredStack); + } + + /** This is called each time an item matches a requirement. By default, it will increase damage of items that can be + * damaged by the amount of the requirement, and remove the intended amount of items that can't be damaged. + * + * Client may override this behavior. Note that this subprogram may be called twice with the same parameters, once + * with a copy of requirements and stack to check if the entire requirements can be fulfilled, and once with the + * real inventory. Implementer is responsible for updating req (with the remaining requirements if any) and slot + * (after usage). + * + * returns what was used (similar to req, but created from slot, so that any NBT based differences are drawn from + * the correct source) */ + public ItemStack useItem(IBuilderContext context, ItemStack req, IInvSlot slot) { + ItemStack stack = slot.getStackInSlot(); + ItemStack result = stack.copy(); + + if (stack.isItemStackDamageable()) { + if (req.getItemDamage() + stack.getItemDamage() <= stack.getMaxDamage()) { + stack.setItemDamage(req.getItemDamage() + stack.getItemDamage()); + result.setItemDamage(req.getItemDamage()); + req.setCount(0); + } + + if (stack.getItemDamage() >= stack.getMaxDamage()) { + slot.decreaseStackInSlot(1); + } + } else { + if (stack.getCount() >= req.getCount()) { + result.setCount(req.getCount()); + stack.setCount(stack.getCount() - req.getCount()); + req.setCount(0); + } else { + req.setCount(req.getCount() - stack.getCount()); + stack.setCount(0); + } + } + + if (stack.getCount() == 0) { + stack.setCount(1); + if (stack.getItem().hasContainerItem(stack)) { + ItemStack newStack = stack.getItem().getContainerItem(stack); + slot.setStackInSlot(newStack); + } else { + slot.setStackInSlot(null); + } + } + + return result; + } + + /** Perform a 90 degree rotation to the slot. */ + public void rotateLeft(IBuilderContext context) { + + } + + /** Applies translations to all positions in the schematic to center in the blueprint referential */ + public void translateToBlueprint(Vec3d transform) { + + } + + /** Apply translations to all positions in the schematic to center in the builder referential */ + public void translateToWorld(Vec3d transform) {} + + /** Translates blocks and item ids to the blueprint referential */ + public void idsToBlueprint(MappingRegistry registry) {} + + /** Translates blocks and item ids to the world referential */ + public void idsToWorld(MappingRegistry registry) {} + + /** Initializes a schematic for blueprint according to an objet placed on {x, y, z} on the world. For blocks, block + * and meta fields will be initialized automatically. */ + public void initializeFromObjectAt(IBuilderContext context, BlockPos pos) {} + + /** Places the block in the world, at the location specified in the slot, using the stack in parameters */ + public void placeInWorld(IBuilderContext context, BlockPos pos, NonNullList stacks) {} + + /** Write specific requirements coming from the world to the blueprint. */ + public void storeRequirements(IBuilderContext context, BlockPos pos) {} + + /** Returns the requirements needed to build this block. When the requirements are met, they will be removed all at + * once from the builder, before calling writeToWorld. */ + public void getRequirementsForPlacement(IBuilderContext context, NonNullList requirements) {} + + /** Returns the amount of energy required to build this slot, depends on the stacks selected for the build. */ + public int getEnergyRequirement(NonNullList stacksUsed) { + int result = 0; + + if (stacksUsed != null) { + for (ItemStack s : stacksUsed) { + result += s.getCount() ;//* BuilderAPI.BUILD_ENERGY; + } + } + + return result; + } + + /** Returns the flying stacks to display in the builder animation. */ + public NonNullList getStacksToDisplay(NonNullList stackConsumed) { + return stackConsumed; + } + + /** Return the stage where this schematic has to be built. */ + public BuildingStage getBuildStage() { + return BuildingStage.STANDALONE; + } + + /** Return true if the block on the world correspond to the block stored in the blueprint at the location given by + * the slot. By default, this subprogram is permissive and doesn't take into account metadata. + * + * Post processing will be called on these blocks. */ + public boolean isAlreadyBuilt(IBuilderContext context, BlockPos pos) { + return true; + } + + /** Return true if the block should not be placed to the world. Requirements will not be asked on such a block, and + * building will not be called. + * + * Post processing will be called on these blocks. */ + public boolean doNotBuild() { + return false; + } + + /** Return true if the schematic should not be used at all. This is computed straight after readFromNBT can be used + * to deactivate schematics in which an inconsistency is detected. It will be considered as a block of air instead. + * + * Post processing will *not* be called on these blocks. */ + public boolean doNotUse() { + return false; + } + + /** Return the maximium building permission for blueprint containing this schematic. */ + public BuildingPermission getBuildingPermission() { + return BuildingPermission.ALL; + } + + /** Called on a block when the blueprint has finished to place all the blocks. This may be useful to adjust variable + * depending on surrounding blocks that may not be there already at initial building. */ + public void postProcessing(IBuilderContext context, BlockPos pos) {} + + /** Saves this schematic to the blueprint NBT. */ + public void writeSchematicToNBT(NBTTagCompound nbt, MappingRegistry registry) {} + + /** Loads this schematic from the blueprint NBT. */ + public void readSchematicFromNBT(NBTTagCompound nbt, MappingRegistry registry) {} + + /** Returns the number of cycles to wait after building this schematic. Tiles and entities typically require more + * wait, around 5 cycles. */ + public int buildTime() { + return 1; + } +} diff --git a/src/api/java/buildcraft/api/blueprints/SchematicBlock.java b/src/api/java/buildcraft/api/blueprints/SchematicBlock.java new file mode 100755 index 000000000..fe3af0acf --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/SchematicBlock.java @@ -0,0 +1,193 @@ +/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.blueprints; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockFalling; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.state.IBlockState; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.NonNullList; +import net.minecraft.util.Rotation; +import net.minecraft.util.math.BlockPos; + +import net.minecraftforge.common.util.Constants; +import net.minecraftforge.fluids.BlockFluidBase; + +import buildcraft.api.core.BCLog; + +public class SchematicBlock extends SchematicBlockBase { + public IBlockState state = null; + public BuildingPermission defaultPermission = BuildingPermission.ALL; + + /** This field contains requirements for a given block when stored in the blueprint. Modders can either rely on this + * list or compute their own int Schematic. */ + public NonNullList storedRequirements = NonNullList.create(); + + private boolean doNotUse = false; + + @Override + public void getRequirementsForPlacement(IBuilderContext context, NonNullList requirements) { + if (state != null) { + if (storedRequirements.size() != 0) { + requirements.addAll(storedRequirements); + } else { + requirements.add(getItemStack(state)); + } + } + } + + @Override + public boolean isAlreadyBuilt(IBuilderContext context, BlockPos pos) { + IBlockState placed = context.world().getBlockState(pos); + if (state == placed) return true; + if (state.getBlock() != placed.getBlock()) return false; + // This fixes bugs with blocks like stairs that return extra properties that were not visible from the meta. + if (state.getBlock().getMetaFromState(state) == placed.getBlock().getMetaFromState(placed)) return true; + return false; + } + + @Override + public void placeInWorld(IBuilderContext context, BlockPos pos, NonNullList stacks) { + super.placeInWorld(context, pos, stacks); + + this.setBlockInWorld(context, pos); + } + + @Override + public void storeRequirements(IBuilderContext context, BlockPos pos) { + super.storeRequirements(context, pos); + + if (state != null) { + storedRequirements = NonNullList.create(); + List drops = state.getBlock().getDrops(context.world(), pos, state, 0); + if (drops != null) { + storedRequirements.addAll(drops); + } + } + } + + @Override + public void writeSchematicToNBT(NBTTagCompound nbt, MappingRegistry registry) { + super.writeSchematicToNBT(nbt, registry); + + writeBlockToNBT(nbt, registry); + writeRequirementsToNBT(nbt, registry); + } + + @Override + public void readSchematicFromNBT(NBTTagCompound nbt, MappingRegistry registry) { + super.readSchematicFromNBT(nbt, registry); + + readBlockFromNBT(nbt, registry); + if (!doNotUse()) { + readRequirementsFromNBT(nbt, registry); + } + } + + /** Get a list of relative block coordinates which have to be built before this block can be placed. */ + public Set getPrerequisiteBlocks(IBuilderContext context) { + Set indexes = new HashSet(); + if (state.getBlock() instanceof BlockFalling) { + indexes.add(new BlockPos(0, -1, 0)); + } + return indexes; + } + + @Override + public BuildingStage getBuildStage() { + if (state.getBlock() instanceof BlockFluidBase || state.getBlock() instanceof BlockLiquid) { + return BuildingStage.EXPANDING; + } else { + return BuildingStage.STANDALONE; + } + } + + @Override + public BuildingPermission getBuildingPermission() { + return defaultPermission; + } + + // Utility functions + protected void setBlockInWorld(IBuilderContext context, BlockPos pos) { + context.world().setBlockState(pos, state, 3); + } + + @Override + public boolean doNotUse() { + return doNotUse; + } + + protected void readBlockFromNBT(NBTTagCompound nbt, MappingRegistry registry) { + try { + Block block = registry.getBlockForId(nbt.getInteger("blockId")); + state = block.getStateFromMeta(nbt.getInteger("blockMeta")); + } catch (MappingNotFoundException e) { + BCLog.logger.info(e); + doNotUse = true; + } + } + + protected void readRequirementsFromNBT(NBTTagCompound nbt, MappingRegistry registry) { + storedRequirements = NonNullList.create(); + if (nbt.hasKey("rq")) { + NBTTagList rq = nbt.getTagList("rq", Constants.NBT.TAG_COMPOUND); + + for (int i = 0; i < rq.tagCount(); ++i) { + try { + NBTTagCompound sub = rq.getCompoundTagAt(i); + registry.stackToWorld(sub); + storedRequirements.add(new ItemStack(sub)); + } catch (MappingNotFoundException e) { + defaultPermission = BuildingPermission.CREATIVE_ONLY; + } catch (Throwable t) { + t.printStackTrace(); + defaultPermission = BuildingPermission.CREATIVE_ONLY; + } + } + } + } + + protected void writeBlockToNBT(NBTTagCompound nbt, MappingRegistry registry) { + nbt.setInteger("blockId", registry.getIdForBlock(state.getBlock())); + nbt.setInteger("blockMeta", state.getBlock().getMetaFromState(state)); + } + + protected void writeRequirementsToNBT(NBTTagCompound nbt, MappingRegistry registry) { + if (storedRequirements.size() > 0) { + NBTTagList rq = new NBTTagList(); + + for (ItemStack stack : storedRequirements) { + if (stack.isEmpty() || stack.getItem() == null) throw new IllegalStateException("Found a null requirement! " + getClass()); + NBTTagCompound sub = new NBTTagCompound(); + stack.writeToNBT(sub); + rq.appendTag(sub); + } + + nbt.setTag("rq", rq); + } + } + + protected ItemStack getItemStack(IBlockState state, int quantity) { + return new ItemStack(state.getBlock(), quantity, state.getBlock().damageDropped(state)); + } + + protected ItemStack getItemStack(IBlockState state) { + return getItemStack(state, 1); + } + + // Pretty much all blocks (that rotate) rotate this way now + @Override + public void rotateLeft(IBuilderContext context) { + // FIXME: This might be the wrong way + state = state.withRotation(Rotation.CLOCKWISE_90); + } +} diff --git a/src/api/java/buildcraft/api/blueprints/SchematicBlockBase.java b/src/api/java/buildcraft/api/blueprints/SchematicBlockBase.java new file mode 100755 index 000000000..69f18a2eb --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/SchematicBlockBase.java @@ -0,0 +1,9 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.blueprints; + +public abstract class SchematicBlockBase extends Schematic { + +} diff --git a/src/api/java/buildcraft/api/blueprints/SchematicEntity.java b/src/api/java/buildcraft/api/blueprints/SchematicEntity.java new file mode 100755 index 000000000..5d856c71d --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/SchematicEntity.java @@ -0,0 +1,193 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.blueprints; + +import java.util.Collections; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagDouble; +import net.minecraft.nbt.NBTTagFloat; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.Vec3d; + +import net.minecraftforge.common.util.Constants; + +public class SchematicEntity extends Schematic { + public Class entity; + + /** This tree contains additional data to be stored in the blueprint. By default, it will be initialized from + * Schematic.readFromWord with the standard readNBT function of the corresponding tile (if any) and will be loaded + * from BptBlock.writeToWorld using the standard writeNBT function. */ + public NBTTagCompound entityNBT = new NBTTagCompound(); + + /** This field contains requirements for a given block when stored in the blueprint. Modders can either rely on this + * list or compute their own int Schematic. */ + public NonNullList storedRequirements = NonNullList.withSize(0, null); + public BuildingPermission defaultPermission = BuildingPermission.ALL; + + @Override + public void getRequirementsForPlacement(IBuilderContext context, NonNullList requirements) { + requirements.addAll(storedRequirements); + } + + public void writeToWorld(IBuilderContext context) { + Entity e = EntityList.createEntityFromNBT(entityNBT, context.world()); + context.world().spawnEntity(e); + } + + public void readFromWorld(IBuilderContext context, Entity entity) { + entity.writeToNBTOptional(entityNBT); + } + + @Override + public void translateToBlueprint(Vec3d transform) { + NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6); + Vec3d pos = new Vec3d(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); + pos = pos.add(transform); + entityNBT.setTag("Pos", this.newDoubleNBTList(pos.xCoord, pos.yCoord, pos.zCoord)); + } + + @Override + public void translateToWorld(Vec3d transform) { + NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6); + Vec3d pos = new Vec3d(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); + pos = pos.add(transform); + + entityNBT.setTag("Pos", this.newDoubleNBTList(pos.xCoord, pos.yCoord, pos.zCoord)); + } + + @Override + public void idsToBlueprint(MappingRegistry registry) {} + + @Override + public void idsToWorld(MappingRegistry registry) { + try { + registry.scanAndTranslateStacksToWorld(entityNBT); + } catch (MappingNotFoundException e) { + entityNBT = new NBTTagCompound(); + } + } + + @Override + public void rotateLeft(IBuilderContext context) { + NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6); + Vec3d pos = new Vec3d(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); + pos = context.rotatePositionLeft(pos); + entityNBT.setTag("Pos", this.newDoubleNBTList(pos.xCoord, pos.yCoord, pos.zCoord)); + + nbttaglist = entityNBT.getTagList("Rotation", 5); + float yaw = nbttaglist.getFloatAt(0); + yaw += 90; + entityNBT.setTag("Rotation", this.newFloatNBTList(yaw, nbttaglist.getFloatAt(1))); + } + + @Override + public void writeSchematicToNBT(NBTTagCompound nbt, MappingRegistry registry) { + super.writeSchematicToNBT(nbt, registry); + + nbt.setInteger("entityId", registry.getIdForEntity(entity)); + nbt.setTag("entity", entityNBT); + + NBTTagList rq = new NBTTagList(); + + for (ItemStack stack : storedRequirements) { + NBTTagCompound sub = new NBTTagCompound(); + stack.writeToNBT(stack.writeToNBT(sub)); + sub.setInteger("id", registry.getIdForItem(stack.getItem())); + rq.appendTag(sub); + } + + nbt.setTag("rq", rq); + } + + @Override + public void readSchematicFromNBT(NBTTagCompound nbt, MappingRegistry registry) { + super.readSchematicFromNBT(nbt, registry); + + entityNBT = nbt.getCompoundTag("entity"); + + NBTTagList rq = nbt.getTagList("rq", Constants.NBT.TAG_COMPOUND); + + NonNullList rqs = NonNullList.create(); + + for (int i = 0; i < rq.tagCount(); ++i) { + try { + NBTTagCompound sub = rq.getCompoundTagAt(i); + + if (sub.getInteger("id") >= 0) { + // Maps the id in the blueprint to the id in the world + sub.setInteger("id", Item.REGISTRY.getIDForObject(registry.getItemForId(sub.getInteger("id")))); + + rqs.add(new ItemStack(sub)); + } else { + defaultPermission = BuildingPermission.CREATIVE_ONLY; + } + } catch (Throwable t) { + t.printStackTrace(); + defaultPermission = BuildingPermission.CREATIVE_ONLY; + } + } + + storedRequirements = rqs; + } + + protected NBTTagList newDoubleNBTList(double... par1ArrayOfDouble) { + NBTTagList nbttaglist = new NBTTagList(); + double[] adouble = par1ArrayOfDouble; + int i = par1ArrayOfDouble.length; + + for (int j = 0; j < i; ++j) { + double d1 = adouble[j]; + nbttaglist.appendTag(new NBTTagDouble(d1)); + } + + return nbttaglist; + } + + protected NBTTagList newFloatNBTList(float... par1ArrayOfFloat) { + NBTTagList nbttaglist = new NBTTagList(); + float[] afloat = par1ArrayOfFloat; + int i = par1ArrayOfFloat.length; + + for (int j = 0; j < i; ++j) { + float f1 = afloat[j]; + nbttaglist.appendTag(new NBTTagFloat(f1)); + } + + return nbttaglist; + } + + public boolean isAlreadyBuilt(IBuilderContext context) { + NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6); + Vec3d newPosition = new Vec3d(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); + + for (Object o : context.world().loadedEntityList) { + Entity e = (Entity) o; + + Vec3d existingPositon = new Vec3d(e.posX, e.posY, e.posZ); + + if (existingPositon.distanceTo(newPosition) <= 0.1) { + return true; + } + } + + return false; + } + + @Override + public int buildTime() { + return 5; + } + + @Override + public BuildingPermission getBuildingPermission() { + return defaultPermission; + } +} diff --git a/src/api/java/buildcraft/api/blueprints/SchematicFactory.java b/src/api/java/buildcraft/api/blueprints/SchematicFactory.java new file mode 100755 index 000000000..878b15714 --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/SchematicFactory.java @@ -0,0 +1,51 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.blueprints; + +import java.util.HashMap; + +import net.minecraft.nbt.NBTTagCompound; + +public abstract class SchematicFactory { + + private static final HashMap> factories = new HashMap>(); + + private static final HashMap, SchematicFactory> schematicToFactory = + new HashMap, SchematicFactory>(); + + protected abstract S loadSchematicFromWorldNBT(NBTTagCompound nbt, MappingRegistry registry) throws MappingNotFoundException; + + public void saveSchematicToWorldNBT(NBTTagCompound nbt, S object, MappingRegistry registry) { + nbt.setString("factoryID", getClass().getCanonicalName()); + } + + public static Schematic createSchematicFromWorldNBT(NBTTagCompound nbt, MappingRegistry registry) throws MappingNotFoundException { + String factoryName = nbt.getString("factoryID"); + + if (factories.containsKey(factoryName)) { + return factories.get(factoryName).loadSchematicFromWorldNBT(nbt, registry); + } else { + return null; + } + } + + public static void registerSchematicFactory(Class clas, SchematicFactory factory) { + schematicToFactory.put(clas, factory); + factories.put(factory.getClass().getCanonicalName(), factory); + } + + public static SchematicFactory getFactory(Class clas) { + Class superClass = clas.getSuperclass(); + + if (schematicToFactory.containsKey(clas)) { + return schematicToFactory.get(clas); + } else if (superClass != null) { + return getFactory(superClass); + } else { + return null; + } + } + +} diff --git a/src/api/java/buildcraft/api/blueprints/SchematicFluid.java b/src/api/java/buildcraft/api/blueprints/SchematicFluid.java new file mode 100755 index 000000000..f044bf021 --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/SchematicFluid.java @@ -0,0 +1,83 @@ +/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.blueprints; + +import net.minecraft.block.BlockLiquid; +import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.BlockPos; + +import net.minecraftforge.fluids.FluidStack; + +@Deprecated +public class SchematicFluid extends SchematicBlock { + + private final ItemStack fluidItem; + + public SchematicFluid(FluidStack fluidStack) { + this.fluidItem = new ItemStack(fluidStack.getFluid().getBlock(), 1); + } + + @Override + public void getRequirementsForPlacement(IBuilderContext context, NonNullList requirements) { + if (getLevel() == 0) { + requirements.add(fluidItem); + } + } + + @Override + public void storeRequirements(IBuilderContext context, BlockPos pos) { + // cancel requirements reading + } + + @Override + public boolean isAlreadyBuilt(IBuilderContext context, BlockPos pos) { + if (getLevel() == 0) { + return state == context.world().getBlockState(pos) && (context.world().getBlockState(pos).getValue(BlockLiquid.LEVEL)) == 0; + } else { + return state == context.world().getBlockState(pos); + } + } + + @Override + public void rotateLeft(IBuilderContext context) { + + } + + @Override + public boolean doNotBuild() { + return getLevel() != 0; + } + + @Override + public void placeInWorld(IBuilderContext context, BlockPos pos, NonNullList stacks) { + if (getLevel() == 0) { + context.world().setBlockState(pos, state, 3); + } + } + + @Override + public void postProcessing(IBuilderContext context, BlockPos pos) { + if (getLevel() != 0) { + context.world().setBlockState(pos, state, 3); + } + } + + @Override + public NonNullList getStacksToDisplay(NonNullList stackConsumed) { + NonNullList result = NonNullList.create(); + result.add(fluidItem); + return result; + } + + @Override + public int getEnergyRequirement(NonNullList stacksUsed) { + return 1;// * BuilderAPI.BUILD_ENERGY; + } + + public int getLevel() { + return state.getValue(BlockLiquid.LEVEL); + } +} diff --git a/src/api/java/buildcraft/api/blueprints/SchematicMask.java b/src/api/java/buildcraft/api/blueprints/SchematicMask.java new file mode 100755 index 000000000..3d811bce4 --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/SchematicMask.java @@ -0,0 +1,83 @@ +/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.blueprints; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.WorldServer; + +import buildcraft.api.core.BuildCraftAPI; + +public class SchematicMask extends SchematicBlockBase { + /** True of the block should be a solid block (stone, grass or a furnace) and false if it shouldn't (flowers, air or + * vines) */ + public boolean isConcrete = true; + + public SchematicMask() { + + } + + public SchematicMask(boolean isConcrete) { + this.isConcrete = isConcrete; + } + + @Override + public void placeInWorld(IBuilderContext context, BlockPos pos, NonNullList stacks) { + if (isConcrete) { + if (stacks.size() == 0 || !BuildCraftAPI.isSoftBlock(context.world(), pos)) { + return; + } else { + ItemStack stack = stacks.get(0); + EntityPlayer player = BuildCraftAPI.fakePlayerProvider.getBuildCraftPlayer((WorldServer) context.world()); + + // force the block to be air block, in case it's just a soft + // block which replacement is not straightforward + context.world().setBlockToAir(pos); + + // Find nearest solid surface to place on + EnumFacing solidFace = null; + for (EnumFacing face : EnumFacing.values()) { + BlockPos offset = pos.offset(face); + if (!BuildCraftAPI.isSoftBlock(context.world(), offset)) { + solidFace = face; + break; + } + } + ItemBlock itemBlock = (ItemBlock) stack.getItem(); + + IBlockState state = itemBlock.block.getStateForPlacement(context.world(), pos, solidFace, 0, 0, 0, stack.getMetadata(), player, EnumHand.MAIN_HAND); + itemBlock.placeBlockAt(stack, player, context.world(), pos, solidFace, 0, 0, 0, state); + } + } else { + context.world().setBlockToAir(pos); + } + } + + @Override + public boolean isAlreadyBuilt(IBuilderContext context, BlockPos pos) { + if (isConcrete) { + return !BuildCraftAPI.getWorldProperty("replaceable").get(context.world(), pos); + } else { + return BuildCraftAPI.getWorldProperty("replaceable").get(context.world(), pos); + } + } + + @Override + public void writeSchematicToNBT(NBTTagCompound nbt, MappingRegistry registry) { + nbt.setBoolean("isConcrete", isConcrete); + } + + @Override + public void readSchematicFromNBT(NBTTagCompound nbt, MappingRegistry registry) { + isConcrete = nbt.getBoolean("isConcrete"); + } +} diff --git a/src/api/java/buildcraft/api/blueprints/SchematicTile.java b/src/api/java/buildcraft/api/blueprints/SchematicTile.java new file mode 100755 index 000000000..318e27eb3 --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/SchematicTile.java @@ -0,0 +1,109 @@ +/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.blueprints; + +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.BlockPos; + +public class SchematicTile extends SchematicBlock { + + /** This tree contains additional data to be stored in the blueprint. By default, it will be initialized from + * Schematic.readFromWord with the standard readNBT function of the corresponding tile (if any) and will be loaded + * from BptBlock.writeToWorld using the standard writeNBT function. */ + public NBTTagCompound tileNBT = new NBTTagCompound(); + + @Override + public void idsToBlueprint(MappingRegistry registry) {} + + @Override + public void idsToWorld(MappingRegistry registry) { + try { + registry.scanAndTranslateStacksToWorld(tileNBT); + } catch (MappingNotFoundException e) { + tileNBT = new NBTTagCompound(); + } + } + + public void onNBTLoaded() { + + } + + /** Places the block in the world, at the location specified in the slot. */ + @Override + public void placeInWorld(IBuilderContext context, BlockPos pos, NonNullList stacks) { + super.placeInWorld(context, pos, stacks); + + if (state.getBlock().hasTileEntity(state)) { + tileNBT.setInteger("x", pos.getX()); + tileNBT.setInteger("y", pos.getY()); + tileNBT.setInteger("z", pos.getZ()); + TileEntity tile = TileEntity.create(context.world(), tileNBT); + if (tile != null) { + tile.setWorld(context.world()); + context.world().setTileEntity(pos, tile); + } + } + } + + @Override + public void initializeFromObjectAt(IBuilderContext context, BlockPos pos) { + super.initializeFromObjectAt(context, pos); + + if (state.getBlock().hasTileEntity(state)) { + TileEntity tile = context.world().getTileEntity(pos); + + if (tile != null) { + tile.writeToNBT(tileNBT); + } + + tileNBT = tileNBT.copy(); + onNBTLoaded(); + } + } + + @Override + public void storeRequirements(IBuilderContext context, BlockPos pos) { + super.storeRequirements(context, pos); + + if (state.getBlock().hasTileEntity(state)) { + TileEntity tile = context.world().getTileEntity(pos); + + if (tile instanceof IInventory) { + IInventory inv = (IInventory) tile; + + for (int i = 0; i < inv.getSizeInventory(); ++i) { + ItemStack stack = inv.getStackInSlot(i); + if (!stack.isEmpty()) { + storedRequirements.add(stack); + } + } + } + } + } + + @Override + public void writeSchematicToNBT(NBTTagCompound nbt, MappingRegistry registry) { + super.writeSchematicToNBT(nbt, registry); + + nbt.setTag("blockCpt", tileNBT); + } + + @Override + public void readSchematicFromNBT(NBTTagCompound nbt, MappingRegistry registry) { + super.readSchematicFromNBT(nbt, registry); + + tileNBT = nbt.getCompoundTag("blockCpt"); + onNBTLoaded(); + } + + @Override + public int buildTime() { + return 5; + } +} diff --git a/src/api/java/buildcraft/api/blueprints/package-info.java b/src/api/java/buildcraft/api/blueprints/package-info.java new file mode 100755 index 000000000..3b3632424 --- /dev/null +++ b/src/api/java/buildcraft/api/blueprints/package-info.java @@ -0,0 +1,8 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +@API(apiVersion = "1.5", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|blueprints") +package buildcraft.api.blueprints; + +import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/boards/IRedstoneBoard.java b/src/api/java/buildcraft/api/boards/IRedstoneBoard.java new file mode 100755 index 000000000..2aa375e92 --- /dev/null +++ b/src/api/java/buildcraft/api/boards/IRedstoneBoard.java @@ -0,0 +1,12 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.boards; + +public interface IRedstoneBoard { + + void updateBoard(T container); + + RedstoneBoardNBT getNBTHandler(); +} diff --git a/src/api/java/buildcraft/api/boards/RedstoneBoardNBT.java b/src/api/java/buildcraft/api/boards/RedstoneBoardNBT.java new file mode 100755 index 000000000..0ced64a8b --- /dev/null +++ b/src/api/java/buildcraft/api/boards/RedstoneBoardNBT.java @@ -0,0 +1,45 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.boards; + +import java.util.List; +import java.util.Random; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import net.minecraftforge.common.util.Constants; + +public abstract class RedstoneBoardNBT { + + private static Random rand = new Random(); + + public abstract String getID(); + + public abstract void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced); + + public abstract String getDisplayName(); + + public abstract IRedstoneBoard create(NBTTagCompound nbt, T object); + + public abstract String getItemModelLocation(); + + public void createBoard(NBTTagCompound nbt) { + nbt.setString("id", getID()); + } + + public int getParameterNumber(NBTTagCompound nbt) { + if (!nbt.hasKey("parameters")) { + return 0; + } else { + return nbt.getTagList("parameters", Constants.NBT.TAG_COMPOUND).tagCount(); + } + } + + public float nextFloat(int difficulty) { + return 1F - (float) Math.pow(rand.nextFloat(), 1F / difficulty); + } +} diff --git a/src/api/java/buildcraft/api/boards/RedstoneBoardRegistry.java b/src/api/java/buildcraft/api/boards/RedstoneBoardRegistry.java new file mode 100755 index 000000000..edfe79cb5 --- /dev/null +++ b/src/api/java/buildcraft/api/boards/RedstoneBoardRegistry.java @@ -0,0 +1,32 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.boards; + +import java.util.Collection; + +import net.minecraft.nbt.NBTTagCompound; + +public abstract class RedstoneBoardRegistry { + + public static RedstoneBoardRegistry instance; + + /** Register a redstone board type. + * + * @param redstoneBoardNBT The RedstoneBoardNBT instance containing the board information. + * @param microJoules MJ price of the board, in micro MJ. */ + public abstract void registerBoardType(RedstoneBoardNBT redstoneBoardNBT, long microJoules); + + public abstract void setEmptyRobotBoard(RedstoneBoardRobotNBT redstoneBoardNBT); + + public abstract RedstoneBoardRobotNBT getEmptyRobotBoard(); + + public abstract RedstoneBoardNBT getRedstoneBoard(NBTTagCompound nbt); + + public abstract RedstoneBoardNBT getRedstoneBoard(String id); + + public abstract Collection> getAllBoardNBTs(); + + public abstract long getPowerCost(RedstoneBoardNBT board); +} diff --git a/src/api/java/buildcraft/api/boards/RedstoneBoardRobot.java b/src/api/java/buildcraft/api/boards/RedstoneBoardRobot.java new file mode 100755 index 000000000..b0ed0638f --- /dev/null +++ b/src/api/java/buildcraft/api/boards/RedstoneBoardRobot.java @@ -0,0 +1,29 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.boards; + +import buildcraft.api.robots.AIRobot; +import buildcraft.api.robots.EntityRobotBase; + +public abstract class RedstoneBoardRobot extends AIRobot implements IRedstoneBoard { + + public RedstoneBoardRobot(EntityRobotBase iRobot) { + super(iRobot); + } + + @Override + public abstract RedstoneBoardRobotNBT getNBTHandler(); + + @Override + public final void updateBoard(EntityRobotBase container) { + + } + + @Override + public boolean canLoadFromNBT() { + return true; + } + +} diff --git a/src/api/java/buildcraft/api/boards/RedstoneBoardRobotNBT.java b/src/api/java/buildcraft/api/boards/RedstoneBoardRobotNBT.java new file mode 100755 index 000000000..4a4161b19 --- /dev/null +++ b/src/api/java/buildcraft/api/boards/RedstoneBoardRobotNBT.java @@ -0,0 +1,23 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.boards; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; + +import buildcraft.api.robots.EntityRobotBase; + +public abstract class RedstoneBoardRobotNBT extends RedstoneBoardNBT { + + @Override + public RedstoneBoardRobot create(NBTTagCompound nbt, EntityRobotBase robot) { + return create(robot); + } + + public abstract RedstoneBoardRobot create(EntityRobotBase robot); + + public abstract ResourceLocation getRobotTexture(); + +} diff --git a/src/api/java/buildcraft/api/boards/package-info.java b/src/api/java/buildcraft/api/boards/package-info.java new file mode 100755 index 000000000..6253f5b79 --- /dev/null +++ b/src/api/java/buildcraft/api/boards/package-info.java @@ -0,0 +1,8 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +@API(apiVersion = "2.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|boards") +package buildcraft.api.boards; + +import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/APIHelper.java b/src/api/java/buildcraft/api/core/APIHelper.java similarity index 90% rename from src/api/java/buildcraft/api/APIHelper.java rename to src/api/java/buildcraft/api/core/APIHelper.java index dd47dcc7c..9d8613201 100755 --- a/src/api/java/buildcraft/api/APIHelper.java +++ b/src/api/java/buildcraft/api/core/APIHelper.java @@ -1,4 +1,8 @@ -package buildcraft.api; +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.core; import java.util.Arrays; @@ -7,8 +11,6 @@ import org.apache.commons.lang3.StringUtils; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.LoaderState; -import buildcraft.api.core.BCLog; - public class APIHelper { public static T getInstance(String clsName, Class baseVersion) { return getNamedInstance(clsName, "INSTANCE", baseVersion); diff --git a/src/api/java/buildcraft/api/core/BCDebugging.java b/src/api/java/buildcraft/api/core/BCDebugging.java new file mode 100755 index 000000000..3badeb901 --- /dev/null +++ b/src/api/java/buildcraft/api/core/BCDebugging.java @@ -0,0 +1,112 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.core; + +import java.util.Locale; + +import net.minecraft.world.World; + +/** Provides a way to quickly enable or disable certain debug conditions via VM arguments or whether the client/server + * is in a dev environment */ +public class BCDebugging { + public enum DebugStatus { + NONE, + ENABLE, + LOGGING_ONLY, + ALL; + } + + enum DebugLevel { + LOG, + COMPLEX; + + final String name = name().toLowerCase(Locale.ROOT); + boolean isAllOn; + } + + private static final DebugStatus DEBUG_STATUS; + + static { + // Basically we enable debugging for the dev-environment, and disable everything for normal players. + // However if you provide VM arguments then the behaviour changes somewhat: + // (VM argument is "-Dbuildcraft.debug=...") + // - "enable" Enables debugging even if you are not in a dev environment + // - "disable" Disables ALL debugging (and doesn't output any messages even in the dev environment) + // - "log" Major debug options are turned on. Registry setup + API usage etc + // - "all" All possible debug options are turned on. Lots of spam. Not recommended. + + String value = System.getProperty("buildcraft.debug"); + if ("enable".equals(value)) DEBUG_STATUS = DebugStatus.ENABLE; + else if ("all".equals(value)) DEBUG_STATUS = DebugStatus.ALL; + else if ("disable".equals(value)) { + // let people disable the messages if they are in a dev environment but don't want messages. + DEBUG_STATUS = DebugStatus.NONE; + } else if ("log".equals(value)) { + // Some debugging options are more than just logging, so we will differentiate between them + DEBUG_STATUS = DebugStatus.LOGGING_ONLY; + } else if (World.class.getName().contains("World")) { + // Dev environment + DEBUG_STATUS = DebugStatus.ENABLE; + } else { + // Most likely a built jar - don't spam people with info they probably don't need + DEBUG_STATUS = DebugStatus.NONE; + } + + if (DEBUG_STATUS == DebugStatus.ALL) { + BCLog.logger.info("[debugger] Debugging automatically enabled for ALL of buildcraft. Prepare for log spam."); + } else if (DEBUG_STATUS == DebugStatus.LOGGING_ONLY) { + BCLog.logger.info("[debugger] Debugging automatically enabled for some non-spammy parts of buildcraft."); + } else if (DEBUG_STATUS == DebugStatus.ENABLE) { + BCLog.logger.info("[debugger] Debugging not automatically enabled for all of buildcraft. Logging all possible debug options."); + BCLog.logger.info(" To enable it for only logging messages add \"-Dbuildcraft.debug=log\" to your launch VM arguments"); + BCLog.logger.info(" To enable it for ALL debugging \"-Dbuildcraft.debug=all\" to your launch VM arguments"); + BCLog.logger.info(" To remove this message and all future ones add \"-Dbuildcraft.debug=disable\" to your launch VM arguments"); + } + + DebugLevel.COMPLEX.isAllOn = DEBUG_STATUS == DebugStatus.ALL; + DebugLevel.LOG.isAllOn = DEBUG_STATUS == DebugStatus.ALL || DEBUG_STATUS == DebugStatus.LOGGING_ONLY; + } + + public static boolean shouldDebugComplex(String string) { + return shouldDebug(string, DebugLevel.COMPLEX); + } + + public static boolean shouldDebugLog(String string) { + return shouldDebug(string, DebugLevel.LOG); + } + + private static boolean shouldDebug(String option, DebugLevel type) { + String prop = getProp(option); + String actual = System.getProperty(prop); + if ("false".equals(actual)) { + BCLog.logger.info("[debugger] Debugging manually disabled for \"" + option + "\" (" + type + ")."); + return false; + } else if ("true".equals(actual)) { + BCLog.logger.info("[debugger] Debugging enabled for \"" + option + "\" (" + type + ")."); + return true; + } + if (type.isAllOn) { + BCLog.logger.info("[debugger] Debugging automatically enabled for \"" + option + "\" (" + type + ")."); + return true; + } + if ("complex".equals(actual) || type.name.equals(actual)) { + BCLog.logger.info("[debugger] Debugging enabled for \"" + option + "\" (" + type + ")."); + return true; + } else { + StringBuilder log = new StringBuilder(); + log.append("[debugger] To enable debugging for "); + log.append(option); + log.append(" add the option \"-D"); + log.append(prop); + log.append("=true\" to your launch config as a VM argument (" + type + ")."); + BCLog.logger.info(log); + } + return false; + } + + private static String getProp(String string) { + return "buildcraft." + string + ".debug"; + } +} diff --git a/src/api/java/buildcraft/api/core/EnumPipePart.java b/src/api/java/buildcraft/api/core/EnumPipePart.java index a805d3ef6..13b1ffc3f 100755 --- a/src/api/java/buildcraft/api/core/EnumPipePart.java +++ b/src/api/java/buildcraft/api/core/EnumPipePart.java @@ -1,17 +1,17 @@ package buildcraft.api.core; -import io.netty.buffer.ByteBuf; - import java.util.Locale; import java.util.Map; +import com.google.common.collect.Maps; + import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagByte; +import net.minecraft.nbt.NBTPrimitive; import net.minecraft.nbt.NBTTagString; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; -import com.google.common.collect.Maps; +import io.netty.buffer.ByteBuf; public enum EnumPipePart implements IStringSerializable, INetworkLoadable_BC8 { DOWN(EnumFacing.DOWN), @@ -24,6 +24,7 @@ public enum EnumPipePart implements IStringSerializable, INetworkLoadable_BC8 facingMap = Maps.newEnumMap(EnumFacing.class); private static final Map nameMap = Maps.newHashMap(); private static final int MAX_VALUES = values().length; @@ -47,12 +48,12 @@ public enum EnumPipePart implements IStringSerializable, INetworkLoadable_BC8= MAX_VALUES) return EnumPipePart.CENTER; - return values()[meta]; + return VALUES[meta]; } private EnumPipePart(EnumFacing face) { @@ -100,7 +101,7 @@ public enum EnumPipePart implements IStringSerializable, INetworkLoadable_BC8 6) return CENTER; return values()[ord]; } diff --git a/src/api/java/buildcraft/api/core/IBCFakePlayer.java b/src/api/java/buildcraft/api/core/IBCFakePlayer.java index bef600f2b..893547214 100755 --- a/src/api/java/buildcraft/api/core/IBCFakePlayer.java +++ b/src/api/java/buildcraft/api/core/IBCFakePlayer.java @@ -4,11 +4,22 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.core; -import java.lang.ref.WeakReference; +import com.mojang.authlib.GameProfile; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.WorldServer; +import net.minecraftforge.common.util.FakePlayer; + public interface IBCFakePlayer { - WeakReference getBuildCraftPlayer(WorldServer world); + + /** Returns the generic buildcraft fake player. Note that you shouldn't use this anymore, as you should store the + * UUID of the real player who created the block or entity that calls this. */ + @Deprecated + FakePlayer getBuildCraftPlayer(WorldServer world); + + /** @param world + * @param profile The owner's profile. + * @return A fake player that can be used IN THE CURRENT METHOD CONTEXT ONLY! This will cause problems if this + * player is left around as it holds a reference to the world object. */ + FakePlayer getFakePlayer(WorldServer world, GameProfile profile); } diff --git a/src/api/java/buildcraft/api/core/IBox.java b/src/api/java/buildcraft/api/core/IBox.java index 56007e382..2c6a4a3bb 100755 --- a/src/api/java/buildcraft/api/core/IBox.java +++ b/src/api/java/buildcraft/api/core/IBox.java @@ -14,6 +14,4 @@ public interface IBox extends IZone { BlockPos min(); BlockPos max(); - - void createLaserData(); } diff --git a/src/api/java/buildcraft/api/core/IBuildCraftMod.java b/src/api/java/buildcraft/api/core/IBuildCraftMod.java index c287088b1..d7774c99e 100755 --- a/src/api/java/buildcraft/api/core/IBuildCraftMod.java +++ b/src/api/java/buildcraft/api/core/IBuildCraftMod.java @@ -2,6 +2,7 @@ package buildcraft.api.core; import net.minecraftforge.common.config.Property; +@Deprecated public interface IBuildCraftMod { Property getOption(String name); } diff --git a/src/api/java/buildcraft/api/core/IFluidHandlerAdv.java b/src/api/java/buildcraft/api/core/IFluidHandlerAdv.java new file mode 100755 index 000000000..aba2d8a64 --- /dev/null +++ b/src/api/java/buildcraft/api/core/IFluidHandlerAdv.java @@ -0,0 +1,18 @@ +package buildcraft.api.core; + +import javax.annotation.Nullable; + +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.capability.IFluidHandler; + +/** A version of {@link IFluidHandler} that can drain a fluid that a fluid filter accepts. */ +public interface IFluidHandlerAdv extends IFluidHandler { + /** Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler. + * + * @param filter A filter to filter the possible fluids that can be extracted. + * @param maxDrain The maximum amount of fluid to drain + * @param doDrain If false, drain will only be simulated. + * @return FluidStack representing the Fluid and amount that was (or would have been, if simulated) drained. */ + @Nullable + FluidStack drain(IFluidFilter filter, int maxDrain, boolean doDrain); +} diff --git a/src/api/java/buildcraft/api/core/IIconProvider.java b/src/api/java/buildcraft/api/core/IIconProvider.java deleted file mode 100755 index 0583835a0..000000000 --- a/src/api/java/buildcraft/api/core/IIconProvider.java +++ /dev/null @@ -1,14 +0,0 @@ -package buildcraft.api.core; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public interface IIconProvider { - public TextureAtlasSprite getIcon(int iconIndex); - - @SideOnly(Side.CLIENT) - public void registerIcons(TextureMap iconRegister); -} diff --git a/src/api/java/buildcraft/api/core/INetworkLoadable_BC8.java b/src/api/java/buildcraft/api/core/INetworkLoadable_BC8.java index de0f99e95..42d0d2469 100755 --- a/src/api/java/buildcraft/api/core/INetworkLoadable_BC8.java +++ b/src/api/java/buildcraft/api/core/INetworkLoadable_BC8.java @@ -2,6 +2,7 @@ package buildcraft.api.core; import io.netty.buffer.ByteBuf; +@Deprecated public interface INetworkLoadable_BC8 { T readFromByteBuf(ByteBuf buf); diff --git a/src/api/java/buildcraft/api/core/IStackFilter.java b/src/api/java/buildcraft/api/core/IStackFilter.java index ef4f55883..815861c44 100755 --- a/src/api/java/buildcraft/api/core/IStackFilter.java +++ b/src/api/java/buildcraft/api/core/IStackFilter.java @@ -4,11 +4,17 @@ * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.core; +import javax.annotation.Nonnull; + import net.minecraft.item.ItemStack; /** This interface provides a convenient means of dealing with entire classes of items without having to specify each * item individually. */ public interface IStackFilter { - boolean matches(ItemStack stack); + /** Check to see if a given stack matches this filter. + * + * @param stack The stack to test. stack.isEmpty will always return false. + * @return True if it does match, false otherwise. */ + boolean matches(@Nonnull ItemStack stack); } diff --git a/src/api/java/buildcraft/api/core/Identifier.java b/src/api/java/buildcraft/api/core/Identifier.java deleted file mode 100755 index c74e8df1b..000000000 --- a/src/api/java/buildcraft/api/core/Identifier.java +++ /dev/null @@ -1,234 +0,0 @@ -package buildcraft.api.core; - -import java.util.Map; -import java.util.UUID; - -import com.google.common.base.Supplier; - -import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** Identifies an in world tile entity or movable entity. Feel free to extend this class if your tile entity contains - * multiple identifiable {@link IPowerConnection}. Just make sure to register it with - * {@link #registerType(String, Supplier)} to make loading work. - *

- * Created on 1 Jan 2016 by AlexIIL */ -public abstract class Identifier { - private static Map> registeredIdentifiers; - - static { - registeredIdentifiers.put("mincraft:tile", new Supplier() { - @Override - public Identifier get() { - return new Tile(0, null); - } - }); - registeredIdentifiers.put("mincraft:entity", new Supplier() { - @Override - public Identifier get() { - return new MovableEntity(0, null); - } - }); - } - - protected final int dimId; - - public static void registerType(String type, Supplier constructor) { - if (constructor == null) throw new NullPointerException("constructor"); - if (constructor.get() == null) throw new NullPointerException("constructor.get()"); - registeredIdentifiers.put(type, constructor); - } - - public static Identifier getFor(Object obj) { - if (obj == null) throw new NullPointerException("obj"); - if (obj instanceof TileEntity) { - return Tile.create((TileEntity) obj); - } - if (obj instanceof Entity) { - return MovableEntity.create((Entity) obj); - } - if (obj instanceof NBTTagCompound) { - NBTTagCompound nbt = (NBTTagCompound) obj; - String type = nbt.getString("type"); - if (!registeredIdentifiers.containsKey(type)) return null; - return registeredIdentifiers.get(type).get().load(nbt.getCompoundTag("data")); - } - throw new IllegalArgumentException("Unknown type " + obj.getClass()); - } - - public static NBTTagCompound save(Identifier ident) { - NBTTagCompound tag = new NBTTagCompound(); - tag.setString("type", ident.typeId()); - tag.setTag("data", ident.save()); - return tag; - } - - private Identifier(int dimId) { - this.dimId = dimId; - } - - public abstract Object getByIdentifier(MinecraftServer server); - - public abstract boolean isLoaded(MinecraftServer server); - - protected abstract Identifier load(NBTTagCompound tag); - - protected abstract NBTTagCompound save(); - - public abstract String typeId(); - - @SideOnly(Side.CLIENT) - public abstract Object getByIdentifierClient(); - - @SideOnly(Side.CLIENT) - public abstract boolean isLoadedClient(); - - public static class Tile extends Identifier { - private final BlockPos pos; - - public static Tile create(TileEntity tile) { - if (tile.getWorld() == null) throw new NullPointerException("tile.getWorld() for the tile " + tile.getClass()); - if (tile.getPos() == null) throw new NullPointerException("tile.getPos() for the tile " + tile.getClass()); - return new Tile(tile.getWorld().provider.getDimension(), tile.getPos()); - } - - private Tile(int dimId, BlockPos pos) { - super(dimId); - this.pos = pos; - } - - @Override - public Tile load(NBTTagCompound tag) { - int dimId = tag.getInteger("dimId"); - int[] arr = tag.getIntArray("pos"); - if (arr.length == 0) return null; - return new Tile(dimId, new BlockPos(arr[0], arr[1], arr[2])); - } - - @Override - protected NBTTagCompound save() { - NBTTagCompound tag = new NBTTagCompound(); - tag.setInteger("dimId", dimId); - tag.setIntArray("pos", new int[] { pos.getX(), pos.getY(), pos.getZ() }); - return tag; - } - - @Override - public String typeId() { - return "minecraft:tile"; - } - - @Override - public TileEntity getByIdentifier(MinecraftServer server) { - World world = server.worldServerForDimension(dimId); - if (world == null) return null; - return world.getTileEntity(pos); - } - - @Override - public boolean isLoaded(MinecraftServer server) { - World world = server.worldServerForDimension(dimId); - if (world == null) return false; - return world.getTileEntity(pos) != null; - } - - @Override - @SideOnly(Side.CLIENT) - public TileEntity getByIdentifierClient() { - World world = Minecraft.getMinecraft().theWorld; - if (world == null || world.provider.getDimension() != dimId) return null; - return world.getTileEntity(pos); - } - - @Override - @SideOnly(Side.CLIENT) - public boolean isLoadedClient() { - World world = Minecraft.getMinecraft().theWorld; - if (world == null || world.provider.getDimension() != dimId) return false; - return world.getTileEntity(pos) != null; - } - - } - - public static class MovableEntity extends Identifier { - private final UUID uniqueId; - - public static MovableEntity create(Entity ent) { - if (ent.getEntityWorld() == null) throw new NullPointerException("ent.getEntityWorld() for the entity " + ent.getClass()); - if (ent.getPersistentID() == null) throw new NullPointerException("ent.getPersistentID() for the entity " + ent.getClass()); - return new MovableEntity(ent.getEntityWorld().provider.getDimension(), ent.getPersistentID()); - } - - private MovableEntity(int dimId, UUID uniqueId) { - super(dimId); - this.uniqueId = uniqueId; - } - - private Entity get(World world) { - for (Entity entity : world.loadedEntityList) { - if (entity.getPersistentID().equals(uniqueId)) { - return entity; - } - } - return null; - } - - @Override - public Entity getByIdentifier(MinecraftServer server) { - World world = server.worldServerForDimension(dimId); - if (world == null || world.provider.getDimension() != dimId) return null; - return get(world); - } - - @Override - public boolean isLoaded(MinecraftServer server) { - World world = server.worldServerForDimension(dimId); - if (world == null || world.provider.getDimension() != dimId) return false; - return get(world) != null; - } - - @Override - @SideOnly(Side.CLIENT) - public Entity getByIdentifierClient() { - World world = Minecraft.getMinecraft().theWorld; - if (world == null || world.provider.getDimension() != dimId) return null; - return get(world); - } - - @Override - @SideOnly(Side.CLIENT) - public boolean isLoadedClient() { - World world = Minecraft.getMinecraft().theWorld; - if (world == null || world.provider.getDimension() != dimId) return false; - return get(world) != null; - } - - @Override - protected MovableEntity load(NBTTagCompound tag) { - int dimId = tag.getInteger("dimId"); - UUID uuid = UUID.fromString(tag.getString("uuid")); - return new MovableEntity(dimId, uuid); - } - - @Override - protected NBTTagCompound save() { - NBTTagCompound tag = new NBTTagCompound(); - tag.setInteger("dimId", dimId); - tag.setString("uuid", uniqueId.toString()); - return tag; - } - - @Override - public String typeId() { - return "minecraft:entity"; - } - } -} diff --git a/src/api/java/buildcraft/api/core/SafeTimeTracker.java b/src/api/java/buildcraft/api/core/SafeTimeTracker.java index 9390d87e7..30593bef0 100755 --- a/src/api/java/buildcraft/api/core/SafeTimeTracker.java +++ b/src/api/java/buildcraft/api/core/SafeTimeTracker.java @@ -6,6 +6,7 @@ package buildcraft.api.core; import net.minecraft.world.World; +/** Provides a way of tracking time in the world, without requiring manual ticking. */ public class SafeTimeTracker { private long lastMark = Long.MIN_VALUE; @@ -32,6 +33,7 @@ public class SafeTimeTracker { randomRange = random; } + /** Return true if the internal delay has passed since last time marked was called successfully. */ public boolean markTimeIfDelay(World world) { return markTimeIfDelay(world, internalDelay); } diff --git a/src/api/java/buildcraft/api/core/StackKey.java b/src/api/java/buildcraft/api/core/StackKey.java index 3d2037ee2..d8c2c44cc 100755 --- a/src/api/java/buildcraft/api/core/StackKey.java +++ b/src/api/java/buildcraft/api/core/StackKey.java @@ -9,7 +9,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; /** This class is used whenever stacks needs to be stored as keys. */ @@ -55,7 +54,7 @@ public final class StackKey { } public static StackKey fluid(Fluid fluid) { - return new StackKey(new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME)); + return new StackKey(new FluidStack(fluid, 1000)); } public static StackKey fluid(FluidStack fluidStack) { diff --git a/src/api/java/buildcraft/api/core/package-info.java b/src/api/java/buildcraft/api/core/package-info.java index f0b642a91..dde5377cc 100755 --- a/src/api/java/buildcraft/api/core/package-info.java +++ b/src/api/java/buildcraft/api/core/package-info.java @@ -2,7 +2,7 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "2.1", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core") +@API(apiVersion = "2.2", owner = "buildcraftlib", provides = "BuildCraftAPI|core") package buildcraft.api.core; import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/crops/CropManager.java b/src/api/java/buildcraft/api/crops/CropManager.java new file mode 100755 index 000000000..97879829f --- /dev/null +++ b/src/api/java/buildcraft/api/crops/CropManager.java @@ -0,0 +1,86 @@ +package buildcraft.api.crops; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public final class CropManager { + private static List handlers = new ArrayList(); + private static ICropHandler defaultHandler; + + private CropManager() { + + } + + public static void registerHandler(ICropHandler cropHandler) { + handlers.add(cropHandler); + } + + public static void setDefaultHandler(ICropHandler cropHandler) { + defaultHandler = cropHandler; + } + + public static ICropHandler getDefaultHandler() { + return defaultHandler; + } + + public static boolean isSeed(ItemStack stack) { + for (ICropHandler cropHandler : handlers) { + if (cropHandler.isSeed(stack)) { + return true; + } + } + return defaultHandler.isSeed(stack); + } + + public static boolean canSustainPlant(World world, ItemStack seed, BlockPos pos) { + for (ICropHandler cropHandler : handlers) { + if (cropHandler.isSeed(seed) && cropHandler.canSustainPlant(world, seed, pos)) { + return true; + } + } + return defaultHandler.isSeed(seed) && defaultHandler.canSustainPlant(world, seed, pos); + } + + /** Attempts to plant the crop given by the seed into the world. Also checks to make sure that + * {@link ICropHandler#isSeed(ItemStack)} is true, and + * {@link ICropHandler#canSustainPlant(World, ItemStack, BlockPos)} is true for the position. */ + public static boolean plantCrop(World world, EntityPlayer player, ItemStack seed, BlockPos pos) { + for (ICropHandler cropHandler : handlers) { + if (cropHandler.isSeed(seed) && cropHandler.canSustainPlant(world, seed, pos) && cropHandler.plantCrop(world, player, seed, pos)) { + return true; + } + } + if (defaultHandler.isSeed(seed) && defaultHandler.canSustainPlant(world, seed, pos)) { + return defaultHandler.plantCrop(world, player, seed, pos); + } + return false; + } + + public static boolean isMature(IBlockAccess blockAccess, IBlockState state, BlockPos pos) { + for (ICropHandler cropHandler : handlers) { + if (cropHandler.isMature(blockAccess, state, pos)) { + return true; + } + } + return defaultHandler.isMature(blockAccess, state, pos); + } + + public static boolean harvestCrop(World world, BlockPos pos, NonNullList drops) { + IBlockState state = world.getBlockState(pos); + for (ICropHandler cropHandler : handlers) { + if (cropHandler.isMature(world, state, pos)) { + return cropHandler.harvestCrop(world, pos, drops); + } + } + return defaultHandler.isMature(world, state, pos) && defaultHandler.harvestCrop(world, pos, drops); + } + +} diff --git a/src/api/java/buildcraft/api/crops/ICropHandler.java b/src/api/java/buildcraft/api/crops/ICropHandler.java new file mode 100755 index 000000000..6b2324ac8 --- /dev/null +++ b/src/api/java/buildcraft/api/crops/ICropHandler.java @@ -0,0 +1,55 @@ +package buildcraft.api.crops; + +import com.mojang.authlib.GameProfile; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public interface ICropHandler { + + /** Check if an item is a seed. + * + * @param stack + * @return true if the item can be planted. */ + boolean isSeed(ItemStack stack); + + /** Check if the item can be planted. You can assume canSustainPlant() will only be called if isSeed() returned + * true. + * + * @param world + * @param seed + * @param pos + * @return true if the item can be planted at pos. */ + boolean canSustainPlant(World world, ItemStack seed, BlockPos pos); + + /** Plant the item in the block. You can assume plantCrop() will only be called if canSustainPlant() returned true. + * + * @param world + * @param player + * @param seed + * @param pos + * @return true if the item was planted at pos. */ + boolean plantCrop(World world, EntityPlayer player, ItemStack seed, BlockPos pos); + + /** Check if a crop is mature and can be harvested. + * + * @param blockAccess + * @param state + * @param pos + * @return true if the block at pos is mature and can be harvested. */ + boolean isMature(IBlockAccess blockAccess, IBlockState state, BlockPos pos); + + /** Harvest the crop. You can assume harvestCrop() will only be called if isMature() returned true. + * + * @param world + * @param pos + * @param drops a list to return the harvest's drops. + * @return true if the block was successfully harvested. */ + boolean harvestCrop(World world, BlockPos pos, NonNullList drops); + +} diff --git a/src/api/java/buildcraft/api/package-info.java b/src/api/java/buildcraft/api/crops/package-info.java similarity index 74% rename from src/api/java/buildcraft/api/package-info.java rename to src/api/java/buildcraft/api/crops/package-info.java index 640f52a7d..803ce050a 100755 --- a/src/api/java/buildcraft/api/package-info.java +++ b/src/api/java/buildcraft/api/crops/package-info.java @@ -2,7 +2,7 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.0", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core") -package buildcraft.api; +@API(apiVersion = "1.1", owner = "BuildCraftAPI|Core", provides = "BuildCraftAPI|crops") +package buildcraft.api.crops; import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/enums/EnumDecoratedBlock.java b/src/api/java/buildcraft/api/enums/EnumDecoratedBlock.java index 0956fa11e..f161e2ba8 100755 --- a/src/api/java/buildcraft/api/enums/EnumDecoratedBlock.java +++ b/src/api/java/buildcraft/api/enums/EnumDecoratedBlock.java @@ -9,7 +9,10 @@ public enum EnumDecoratedBlock implements IStringSerializable { BLUEPRINT(10), TEMPLATE(10), PAPER(10), - LEATHER(10); + LEATHER(10), + LASER_BACK(0); + + public static final EnumDecoratedBlock[] VALUES = values(); public final int lightValue; @@ -21,4 +24,11 @@ public enum EnumDecoratedBlock implements IStringSerializable { public String getName() { return name().toLowerCase(Locale.ROOT); } + + public static EnumDecoratedBlock fromMeta(int meta) { + if (meta < 0 || meta >= VALUES.length) { + return EnumDecoratedBlock.DESTROY; + } + return VALUES[meta]; + } } diff --git a/src/api/java/buildcraft/api/enums/EnumLaserTableType.java b/src/api/java/buildcraft/api/enums/EnumLaserTableType.java index cc8b41e7d..dbf99a5c7 100755 --- a/src/api/java/buildcraft/api/enums/EnumLaserTableType.java +++ b/src/api/java/buildcraft/api/enums/EnumLaserTableType.java @@ -1,21 +1,13 @@ package buildcraft.api.enums; -import net.minecraft.block.state.IBlockState; import net.minecraft.util.IStringSerializable; -import buildcraft.api.properties.BuildCraftProperties; - public enum EnumLaserTableType implements IStringSerializable { ASSEMBLY_TABLE, ADVANCED_CRAFTING_TABLE, INTEGRATION_TABLE, CHARGING_TABLE, - PROGRAMMING_TABLE, - STAMPING_TABLE; - - public static EnumLaserTableType getType(IBlockState state) { - return (EnumLaserTableType) state.getValue(BuildCraftProperties.LASER_TABLE_TYPE); - } + PROGRAMMING_TABLE; @Override public String getName() { diff --git a/src/api/java/buildcraft/api/enums/EnumEnergyStage.java b/src/api/java/buildcraft/api/enums/EnumPowerStage.java similarity index 76% rename from src/api/java/buildcraft/api/enums/EnumEnergyStage.java rename to src/api/java/buildcraft/api/enums/EnumPowerStage.java index 319b80440..0a88baecd 100755 --- a/src/api/java/buildcraft/api/enums/EnumEnergyStage.java +++ b/src/api/java/buildcraft/api/enums/EnumPowerStage.java @@ -4,7 +4,7 @@ import java.util.Locale; import net.minecraft.util.IStringSerializable; -public enum EnumEnergyStage implements IStringSerializable { +public enum EnumPowerStage implements IStringSerializable { BLUE, GREEN, YELLOW, @@ -12,7 +12,7 @@ public enum EnumEnergyStage implements IStringSerializable { OVERHEAT, BLACK; - public static final EnumEnergyStage[] VALUES = values(); + public static final EnumPowerStage[] VALUES = values(); private final String modelName = name().toLowerCase(Locale.ROOT); diff --git a/src/api/java/buildcraft/api/enums/EnumSpring.java b/src/api/java/buildcraft/api/enums/EnumSpring.java index 85eed2ca0..478b5cae8 100755 --- a/src/api/java/buildcraft/api/enums/EnumSpring.java +++ b/src/api/java/buildcraft/api/enums/EnumSpring.java @@ -1,5 +1,7 @@ package buildcraft.api.enums; +import java.util.Locale; + import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.IStringSerializable; @@ -14,6 +16,7 @@ public enum EnumSpring implements IStringSerializable { public final int tickRate, chance; public IBlockState liquidBlock; public boolean canGen = true; + private final String lowerCaseName = name().toLowerCase(Locale.ROOT); private EnumSpring(int tickRate, int chance, IBlockState liquidBlock) { this.tickRate = tickRate; @@ -27,6 +30,6 @@ public enum EnumSpring implements IStringSerializable { @Override public String getName() { - return this.name(); + return lowerCaseName; } } diff --git a/src/api/java/buildcraft/api/events/BlockInteractionEvent.java b/src/api/java/buildcraft/api/events/BlockInteractionEvent.java new file mode 100755 index 000000000..4a4d8b7bd --- /dev/null +++ b/src/api/java/buildcraft/api/events/BlockInteractionEvent.java @@ -0,0 +1,22 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.events; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; + +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; + +@Cancelable +public class BlockInteractionEvent extends Event { + public final EntityPlayer player; + public final IBlockState state; + + public BlockInteractionEvent(EntityPlayer player, IBlockState state) { + this.player = player; + this.state = state; + } +} diff --git a/src/api/java/buildcraft/api/events/BlockPlacedDownEvent.java b/src/api/java/buildcraft/api/events/BlockPlacedDownEvent.java new file mode 100755 index 000000000..22a8a74fa --- /dev/null +++ b/src/api/java/buildcraft/api/events/BlockPlacedDownEvent.java @@ -0,0 +1,25 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.events; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.math.BlockPos; + +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; + +@Cancelable +public class BlockPlacedDownEvent extends Event { + public final EntityPlayer player; + public final IBlockState state; + public final BlockPos pos; + + public BlockPlacedDownEvent(EntityPlayer player, BlockPos pos, IBlockState state) { + this.player = player; + this.state = state; + this.pos = pos; + } +} diff --git a/src/api/java/buildcraft/api/events/PipePlacedEvent.java b/src/api/java/buildcraft/api/events/PipePlacedEvent.java new file mode 100755 index 000000000..3664a57d2 --- /dev/null +++ b/src/api/java/buildcraft/api/events/PipePlacedEvent.java @@ -0,0 +1,24 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.events; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.util.math.BlockPos; + +import net.minecraftforge.fml.common.eventhandler.Event; + +public class PipePlacedEvent extends Event { + public EntityPlayer player; + public Item pipeType; + public BlockPos pos; + + public PipePlacedEvent(EntityPlayer player, Item pipeType, BlockPos pos) { + this.player = player; + this.pipeType = pipeType; + this.pos = pos; + } + +} diff --git a/src/api/java/buildcraft/api/events/RobotEvent.java b/src/api/java/buildcraft/api/events/RobotEvent.java new file mode 100755 index 000000000..9b12b64d2 --- /dev/null +++ b/src/api/java/buildcraft/api/events/RobotEvent.java @@ -0,0 +1,53 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.events; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; + +import buildcraft.api.robots.EntityRobotBase; + +public abstract class RobotEvent extends Event { + public final EntityRobotBase robot; + + public RobotEvent(EntityRobotBase robot) { + this.robot = robot; + } + + @Cancelable + public static class Place extends RobotEvent { + public final EntityPlayer player; + + public Place(EntityRobotBase robot, EntityPlayer player) { + super(robot); + this.player = player; + } + } + + @Cancelable + public static class Interact extends RobotEvent { + public final EntityPlayer player; + public final ItemStack item; + + public Interact(EntityRobotBase robot, EntityPlayer player, ItemStack item) { + super(robot); + this.player = player; + this.item = item; + } + } + + @Cancelable + public static class Dismantle extends RobotEvent { + public final EntityPlayer player; + + public Dismantle(EntityRobotBase robot, EntityPlayer player) { + super(robot); + this.player = player; + } + } +} diff --git a/src/api/java/buildcraft/api/events/RobotPlacementEvent.java b/src/api/java/buildcraft/api/events/RobotPlacementEvent.java new file mode 100755 index 000000000..b0abc44d8 --- /dev/null +++ b/src/api/java/buildcraft/api/events/RobotPlacementEvent.java @@ -0,0 +1,22 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.events; + +import net.minecraft.entity.player.EntityPlayer; + +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; + +@Cancelable +public class RobotPlacementEvent extends Event { + public EntityPlayer player; + public String robotProgram; + + public RobotPlacementEvent(EntityPlayer player, String robotProgram) { + this.player = player; + this.robotProgram = robotProgram; + } + +} diff --git a/src/api/java/buildcraft/api/events/package-info.java b/src/api/java/buildcraft/api/events/package-info.java new file mode 100755 index 000000000..06cd25fea --- /dev/null +++ b/src/api/java/buildcraft/api/events/package-info.java @@ -0,0 +1,8 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +@API(apiVersion = "2.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|events") +package buildcraft.api.events; + +import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/facades/FacadeAPI.java b/src/api/java/buildcraft/api/facades/FacadeAPI.java new file mode 100755 index 000000000..b3e214ea8 --- /dev/null +++ b/src/api/java/buildcraft/api/facades/FacadeAPI.java @@ -0,0 +1,9 @@ +package buildcraft.api.facades; + +public final class FacadeAPI { + public static IFacadeItem facadeItem; + + private FacadeAPI() { + + } +} diff --git a/src/api/java/buildcraft/api/facades/FacadeType.java b/src/api/java/buildcraft/api/facades/FacadeType.java new file mode 100755 index 000000000..c88d89ff4 --- /dev/null +++ b/src/api/java/buildcraft/api/facades/FacadeType.java @@ -0,0 +1,14 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.facades; + +public enum FacadeType { + Basic, + Phased; + + public static FacadeType fromOrdinal(int ordinal) { + return ordinal == 1 ? Phased : Basic; + } +} diff --git a/src/api/java/buildcraft/api/facades/IFacadeItem.java b/src/api/java/buildcraft/api/facades/IFacadeItem.java new file mode 100755 index 000000000..1fe981a3b --- /dev/null +++ b/src/api/java/buildcraft/api/facades/IFacadeItem.java @@ -0,0 +1,16 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.facades; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.item.ItemStack; + +public interface IFacadeItem { + FacadeType getFacadeType(ItemStack facade); + + ItemStack getFacadeForBlock(IBlockState state); + + IBlockState[] getBlockStatesForFacade(ItemStack facade); +} diff --git a/src/api/java/buildcraft/api/facades/package-info.java b/src/api/java/buildcraft/api/facades/package-info.java new file mode 100755 index 000000000..2c79167b3 --- /dev/null +++ b/src/api/java/buildcraft/api/facades/package-info.java @@ -0,0 +1,8 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +@API(apiVersion = "1.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|facades") +package buildcraft.api.facades; + +import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/filler/FillerManager.java b/src/api/java/buildcraft/api/filler/FillerManager.java new file mode 100755 index 000000000..03567c45a --- /dev/null +++ b/src/api/java/buildcraft/api/filler/FillerManager.java @@ -0,0 +1,13 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.filler; + +public final class FillerManager { + + public static IFillerRegistry registry; + + /** Deactivate constructor */ + private FillerManager() {} +} diff --git a/src/api/java/buildcraft/api/filler/IFillerPattern.java b/src/api/java/buildcraft/api/filler/IFillerPattern.java new file mode 100755 index 000000000..db52b51f0 --- /dev/null +++ b/src/api/java/buildcraft/api/filler/IFillerPattern.java @@ -0,0 +1,12 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.filler; + +import buildcraft.api.statements.IStatement; + +/** A type of statement that is used for filler patterns. */ +public interface IFillerPattern extends IStatement { + // Object getBlockOverlay(); +} diff --git a/src/api/java/buildcraft/api/filler/IFillerRegistry.java b/src/api/java/buildcraft/api/filler/IFillerRegistry.java new file mode 100755 index 000000000..f9e588f62 --- /dev/null +++ b/src/api/java/buildcraft/api/filler/IFillerRegistry.java @@ -0,0 +1,19 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.filler; + +import java.util.Collection; + +public interface IFillerRegistry { + void addPattern(IFillerPattern pattern); + + IFillerPattern getPattern(String patternName); + + IFillerPattern getNextPattern(IFillerPattern currentPattern); + + IFillerPattern getPreviousPattern(IFillerPattern currentPattern); + + Collection getPatterns(); +} diff --git a/src/api/java/buildcraft/api/filler/package-info.java b/src/api/java/buildcraft/api/filler/package-info.java new file mode 100755 index 000000000..3e9d907de --- /dev/null +++ b/src/api/java/buildcraft/api/filler/package-info.java @@ -0,0 +1,8 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +@API(apiVersion = "4.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|filler") +package buildcraft.api.filler; + +import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/fuels/ICoolantManager.java b/src/api/java/buildcraft/api/fuels/ICoolantManager.java index 849bf1acf..fb535c438 100755 --- a/src/api/java/buildcraft/api/fuels/ICoolantManager.java +++ b/src/api/java/buildcraft/api/fuels/ICoolantManager.java @@ -6,7 +6,10 @@ package buildcraft.api.fuels; import java.util.Collection; +import net.minecraft.item.ItemStack; + import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; import buildcraft.api.core.StackKey; @@ -17,7 +20,7 @@ public interface ICoolantManager { ISolidCoolant addSolidCoolant(ISolidCoolant solidCoolant); - ISolidCoolant addSolidCoolant(StackKey solid, StackKey liquid, float multiplier); + ISolidCoolant addSolidCoolant(ItemStack solid, FluidStack fluid, float multiplier); Collection getCoolants(); @@ -25,5 +28,5 @@ public interface ICoolantManager { ICoolant getCoolant(Fluid fluid); - ISolidCoolant getSolidCoolant(StackKey solid); + ISolidCoolant getSolidCoolant(ItemStack solid); } diff --git a/src/api/java/buildcraft/api/fuels/IFuel.java b/src/api/java/buildcraft/api/fuels/IFuel.java index a2590c608..65891f75a 100755 --- a/src/api/java/buildcraft/api/fuels/IFuel.java +++ b/src/api/java/buildcraft/api/fuels/IFuel.java @@ -9,7 +9,9 @@ import net.minecraftforge.fluids.Fluid; public interface IFuel { Fluid getFluid(); + /** @return The number of ticks that a single bucket (1000mb) of this fuel will burn for. */ int getTotalBurningTime(); - int getPowerPerCycle(); + /** @return The amount (in micro mj) of power that this fuel will give off in 1 tick. */ + long getPowerPerCycle(); } diff --git a/src/api/java/buildcraft/api/fuels/IFuelManager.java b/src/api/java/buildcraft/api/fuels/IFuelManager.java index 367818270..137882139 100755 --- a/src/api/java/buildcraft/api/fuels/IFuelManager.java +++ b/src/api/java/buildcraft/api/fuels/IFuelManager.java @@ -12,9 +12,9 @@ import net.minecraftforge.fluids.FluidStack; public interface IFuelManager { IFuel addFuel(IFuel fuel); - IFuel addFuel(Fluid fluid, int powerPerCycle, int totalBurningTime); + IFuel addFuel(Fluid fluid, long powerPerCycle, int totalBurningTime); - IDirtyFuel addDirtyFuel(Fluid fuel, int powerPerCycle, int totalBurningTime, FluidStack residue); + IDirtyFuel addDirtyFuel(Fluid fuel, long powerPerCycle, int totalBurningTime, FluidStack residue); Collection getFuels(); diff --git a/src/api/java/buildcraft/api/gates/IGate.java b/src/api/java/buildcraft/api/gates/IGate.java new file mode 100755 index 000000000..2d9302c3c --- /dev/null +++ b/src/api/java/buildcraft/api/gates/IGate.java @@ -0,0 +1,28 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.gates; + +import java.util.List; + +import buildcraft.api.statements.IStatement; +import buildcraft.api.statements.IStatementParameter; +import buildcraft.api.statements.StatementSlot; +import buildcraft.api.statements.containers.ISidedStatementContainer; +import buildcraft.api.transport.pipe.IPipeHolder; + +public interface IGate extends ISidedStatementContainer { + + IPipeHolder getPipeHolder(); + + List getTriggers(); + + List getActions(); + + List getActiveActions(); + + List getTriggerParameters(int slot); + + List getActionParameters(int slot); +} diff --git a/src/api/java/buildcraft/api/gates/package-info.java b/src/api/java/buildcraft/api/gates/package-info.java new file mode 100755 index 000000000..b86ad48bd --- /dev/null +++ b/src/api/java/buildcraft/api/gates/package-info.java @@ -0,0 +1,8 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +@API(apiVersion = "4.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|gates") +package buildcraft.api.gates; + +import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/items/IList.java b/src/api/java/buildcraft/api/items/IList.java index 4e9c1bc17..1456d2468 100755 --- a/src/api/java/buildcraft/api/items/IList.java +++ b/src/api/java/buildcraft/api/items/IList.java @@ -1,7 +1,9 @@ package buildcraft.api.items; +import javax.annotation.Nonnull; + import net.minecraft.item.ItemStack; public interface IList extends INamedItem { - boolean matches(ItemStack stackList, ItemStack item); + boolean matches(@Nonnull ItemStack stackList, @Nonnull ItemStack item); } diff --git a/src/api/java/buildcraft/api/items/IMapLocation.java b/src/api/java/buildcraft/api/items/IMapLocation.java index e7b2299b9..b10adecd0 100755 --- a/src/api/java/buildcraft/api/items/IMapLocation.java +++ b/src/api/java/buildcraft/api/items/IMapLocation.java @@ -2,6 +2,8 @@ package buildcraft.api.items; import java.util.List; +import javax.annotation.Nonnull; + import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; @@ -22,7 +24,7 @@ public interface IMapLocation extends INamedItem { public final int meta = ordinal(); - public static MapLocationType getFromStack(ItemStack stack) { + public static MapLocationType getFromStack(@Nonnull ItemStack stack) { int dam = stack.getItemDamage(); if (dam < 0 || dam >= values().length) { return MapLocationType.CLEAN; @@ -30,7 +32,7 @@ public interface IMapLocation extends INamedItem { return values()[dam]; } - public void setToStack(ItemStack stack) { + public void setToStack(@Nonnull ItemStack stack) { stack.setItemDamage(meta); } } @@ -39,29 +41,29 @@ public interface IMapLocation extends INamedItem { * * @param stack * @return The point representing the map location. */ - BlockPos getPoint(ItemStack stack); + BlockPos getPoint(@Nonnull ItemStack stack); /** This function can be used for SPOT and AREA types. * * @param stack * @return The box representing the map location. */ - IBox getBox(ItemStack stack); + IBox getBox(@Nonnull ItemStack stack); /** This function can be used for SPOT, AREA and ZONE types. The PATH type needs to be handled separately. * * @param stack * @return An IZone representing the map location - also an instance of IBox for SPOT and AREA types. */ - IZone getZone(ItemStack stack); + IZone getZone(@Nonnull ItemStack stack); /** This function can be used for SPOT and PATH types. * * @param stack * @return A list of BlockPoses representing the path the Map Location stores. */ - List getPath(ItemStack stack); + List getPath(@Nonnull ItemStack stack); /** This function can be used for SPOT types only. * * @param stack * @return The side of the spot. */ - EnumFacing getPointSide(ItemStack stack); + EnumFacing getPointSide(@Nonnull ItemStack stack); } diff --git a/src/api/java/buildcraft/api/items/INamedItem.java b/src/api/java/buildcraft/api/items/INamedItem.java index 4080dae2f..87c342075 100755 --- a/src/api/java/buildcraft/api/items/INamedItem.java +++ b/src/api/java/buildcraft/api/items/INamedItem.java @@ -1,9 +1,11 @@ package buildcraft.api.items; +import javax.annotation.Nonnull; + import net.minecraft.item.ItemStack; public interface INamedItem { - String getName(ItemStack stack); + String getName(@Nonnull ItemStack stack); - boolean setName(ItemStack stack, String name); + boolean setName(@Nonnull ItemStack stack, String name); } diff --git a/src/api/java/buildcraft/api/library/ILibraryTypeHandler.java b/src/api/java/buildcraft/api/library/ILibraryTypeHandler.java new file mode 100755 index 000000000..8616d10fe --- /dev/null +++ b/src/api/java/buildcraft/api/library/ILibraryTypeHandler.java @@ -0,0 +1,18 @@ +package buildcraft.api.library; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public interface ILibraryTypeHandler { + boolean isHandler(ItemStack stack, boolean store); + + String getFileExtension(); + + int getTextColor(); + + String getName(ItemStack stack); + + ItemStack load(ItemStack stack, NBTTagCompound compound); + + boolean store(ItemStack stack, NBTTagCompound compound); +} diff --git a/src/api/java/buildcraft/api/library/LibraryAPI.java b/src/api/java/buildcraft/api/library/LibraryAPI.java new file mode 100755 index 000000000..b3b1e84f8 --- /dev/null +++ b/src/api/java/buildcraft/api/library/LibraryAPI.java @@ -0,0 +1,30 @@ +package buildcraft.api.library; + +import java.util.HashSet; +import java.util.Set; + +@Deprecated +public final class LibraryAPI { + private static final Set handlers = new HashSet(); + + private LibraryAPI() { + + } + + public static Set getHandlerSet() { + return handlers; + } + + public static void registerHandler(LibraryTypeHandler handler) { + handlers.add(handler); + } + + public static LibraryTypeHandler getHandlerFor(String extension) { + for (LibraryTypeHandler h : handlers) { + if (h.isInputExtension(extension)) { + return h; + } + } + return null; + } +} diff --git a/src/api/java/buildcraft/api/library/LibraryTypeHandler.java b/src/api/java/buildcraft/api/library/LibraryTypeHandler.java new file mode 100755 index 000000000..08db4f6f3 --- /dev/null +++ b/src/api/java/buildcraft/api/library/LibraryTypeHandler.java @@ -0,0 +1,31 @@ +package buildcraft.api.library; + +import net.minecraft.item.ItemStack; + +@Deprecated +public abstract class LibraryTypeHandler { + public enum HandlerType { + LOAD, + STORE + } + + private final String extension; + + public LibraryTypeHandler(String extension) { + this.extension = extension; + } + + public abstract boolean isHandler(ItemStack stack, HandlerType type); + + public boolean isInputExtension(String ext) { + return extension.equals(ext); + } + + public String getOutputExtension() { + return extension; + } + + public abstract int getTextColor(); + + public abstract String getName(ItemStack stack); +} diff --git a/src/api/java/buildcraft/api/library/LibraryTypeHandlerByteArray.java b/src/api/java/buildcraft/api/library/LibraryTypeHandlerByteArray.java new file mode 100755 index 000000000..c7c5e2317 --- /dev/null +++ b/src/api/java/buildcraft/api/library/LibraryTypeHandlerByteArray.java @@ -0,0 +1,13 @@ +package buildcraft.api.library; + +import net.minecraft.item.ItemStack; + +public abstract class LibraryTypeHandlerByteArray extends LibraryTypeHandler { + public LibraryTypeHandlerByteArray(String extension) { + super(extension); + } + + public abstract ItemStack load(ItemStack stack, byte[] data); + + public abstract byte[] store(ItemStack stack); +} diff --git a/src/api/java/buildcraft/api/library/LibraryTypeHandlerNBT.java b/src/api/java/buildcraft/api/library/LibraryTypeHandlerNBT.java new file mode 100755 index 000000000..a656ff7c7 --- /dev/null +++ b/src/api/java/buildcraft/api/library/LibraryTypeHandlerNBT.java @@ -0,0 +1,14 @@ +package buildcraft.api.library; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public abstract class LibraryTypeHandlerNBT extends LibraryTypeHandler { + public LibraryTypeHandlerNBT(String extension) { + super(extension); + } + + public abstract ItemStack load(ItemStack stack, NBTTagCompound nbt); + + public abstract boolean store(ItemStack stack, NBTTagCompound nbt); +} diff --git a/src/api/java/buildcraft/api/library/package-info.java b/src/api/java/buildcraft/api/library/package-info.java new file mode 100755 index 000000000..e41a0dc0f --- /dev/null +++ b/src/api/java/buildcraft/api/library/package-info.java @@ -0,0 +1,8 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +@API(apiVersion = "2.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|library") +package buildcraft.api.library; + +import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/lists/ListMatchHandler.java b/src/api/java/buildcraft/api/lists/ListMatchHandler.java new file mode 100755 index 000000000..339176ed9 --- /dev/null +++ b/src/api/java/buildcraft/api/lists/ListMatchHandler.java @@ -0,0 +1,28 @@ +package buildcraft.api.lists; + +import javax.annotation.Nonnull; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; + +public abstract class ListMatchHandler { + public enum Type { + TYPE, + MATERIAL, + CLASS + } + + public abstract boolean matches(Type type, @Nonnull ItemStack stack, @Nonnull ItemStack target, boolean precise); + + public abstract boolean isValidSource(Type type, @Nonnull ItemStack stack); + + /** Get custom client examples. + * + * @param type + * @param stack + * @return A List (even empty!) if the examples satisfy this handler, null if iteration and .matches should be used + * instead. */ + public NonNullList getClientExamples(Type type, @Nonnull ItemStack stack) { + return null; + } +} diff --git a/src/api/java/buildcraft/api/lists/ListRegistry.java b/src/api/java/buildcraft/api/lists/ListRegistry.java new file mode 100755 index 000000000..1f3655244 --- /dev/null +++ b/src/api/java/buildcraft/api/lists/ListRegistry.java @@ -0,0 +1,26 @@ +package buildcraft.api.lists; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import net.minecraft.item.Item; + +public final class ListRegistry { + public static final List> itemClassAsType = new ArrayList>(); + private static final List handlers = new ArrayList(); + + private ListRegistry() { + + } + + public static void registerHandler(ListMatchHandler h) { + if (h != null) { + handlers.add(h); + } + } + + public static List getHandlers() { + return Collections.unmodifiableList(handlers); + } +} diff --git a/src/api/java/buildcraft/api/lists/package-info.java b/src/api/java/buildcraft/api/lists/package-info.java new file mode 100755 index 000000000..603c33587 --- /dev/null +++ b/src/api/java/buildcraft/api/lists/package-info.java @@ -0,0 +1,8 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|lists") +package buildcraft.api.lists; + +import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/mj/ILaserTarget.java b/src/api/java/buildcraft/api/mj/ILaserTarget.java new file mode 100755 index 000000000..26adb399c --- /dev/null +++ b/src/api/java/buildcraft/api/mj/ILaserTarget.java @@ -0,0 +1,26 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.mj; + +/** This interface should be defined by any Tile which wants to receive power from BuildCraft lasers. + * + * The respective Block MUST implement ILaserTargetBlock! */ +public interface ILaserTarget { + + /** Returns true if the target currently needs power. For example, if the Advanced Crafting Table has work to do. + * + * @return true if needs power */ + boolean requiresLaserPower(); + + /** Transfers power from the laser to the target. + * + * @param microJoules The number of micro Minecraft Joules to accept */ + void receiveLaserPower(long microJoules); + + /** Return true if the Tile Entity object is no longer a valid target. For example, if its been invalidated. + * + * @return true if no longer a valid target object */ + boolean isInvalidTarget(); +} diff --git a/src/api/java/buildcraft/api/mj/ILaserTargetBlock.java b/src/api/java/buildcraft/api/mj/ILaserTargetBlock.java new file mode 100755 index 000000000..3e511f7d5 --- /dev/null +++ b/src/api/java/buildcraft/api/mj/ILaserTargetBlock.java @@ -0,0 +1,12 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.mj; + +/** This is a marker interface for laser targets. Implement it on your Block. + * + * It is used by BuildCraft Lasers for optimization purposes. */ +public interface ILaserTargetBlock { + +} diff --git a/src/api/java/buildcraft/api/mj/IMjConnector.java b/src/api/java/buildcraft/api/mj/IMjConnector.java new file mode 100755 index 000000000..3c5f997a3 --- /dev/null +++ b/src/api/java/buildcraft/api/mj/IMjConnector.java @@ -0,0 +1,15 @@ +package buildcraft.api.mj; + +import javax.annotation.Nonnull; + +/** Signifies that this should visibly connect to other Mj handling entities/tiles. This should NEVER be the tile + * entity, but an encapsulated class that refers back to it. Use {@link buildcraft.api.mj.MjAPI#CAP_CONNECTOR} to access + * this. */ +public interface IMjConnector { + /** Checks to see if this connector can connect to the other connector. By default this should check that the other + * connector is the same power system. + * + * @param other + * @return */ + boolean canConnect(@Nonnull IMjConnector other); +} diff --git a/src/api/java/buildcraft/api/mj/IMjEffectManager.java b/src/api/java/buildcraft/api/mj/IMjEffectManager.java new file mode 100755 index 000000000..c7fb899b0 --- /dev/null +++ b/src/api/java/buildcraft/api/mj/IMjEffectManager.java @@ -0,0 +1,15 @@ +package buildcraft.api.mj; + +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; + +/** Various effects for showing power loss visibly, and for large amounts of power, causes some damage to nearby + * entities. */ +public interface IMjEffectManager { + void createPowerLossEffect(World world, Vec3d center, long microJoulesLost); + + void createPowerLossEffect(World world, Vec3d center, EnumFacing direction, long microJoulesLost); + + void createPowerLossEffect(World world, Vec3d center, Vec3d direction, long microJoulesLost); +} diff --git a/src/api/java/buildcraft/api/mj/IMjPassiveProvider.java b/src/api/java/buildcraft/api/mj/IMjPassiveProvider.java new file mode 100755 index 000000000..55b33c685 --- /dev/null +++ b/src/api/java/buildcraft/api/mj/IMjPassiveProvider.java @@ -0,0 +1,11 @@ +package buildcraft.api.mj; + +/** Designates a machine that provides power passively- it does not attempt to manually output its power (like an + * engine). Power can be extracted from this by powered wooden kinesis pipes, for example. */ +public interface IMjPassiveProvider extends IMjConnector { + /** Attempts to extract power from this provider + * + * @param simulate + * @return Either 0, min, max, or a value between min and max. */ + long extractPower(long min, long max, boolean simulate); +} diff --git a/src/api/java/buildcraft/api/mj/IMjReadable.java b/src/api/java/buildcraft/api/mj/IMjReadable.java new file mode 100755 index 000000000..616592263 --- /dev/null +++ b/src/api/java/buildcraft/api/mj/IMjReadable.java @@ -0,0 +1,8 @@ +package buildcraft.api.mj; + +/** Indicates an MJ consumer that has readable information. */ +public interface IMjReadable extends IMjConnector { + long getStored(); + + long getCapacity(); +} diff --git a/src/api/java/buildcraft/api/mj/IMjReceiver.java b/src/api/java/buildcraft/api/mj/IMjReceiver.java new file mode 100755 index 000000000..fe9eadd0b --- /dev/null +++ b/src/api/java/buildcraft/api/mj/IMjReceiver.java @@ -0,0 +1,19 @@ +package buildcraft.api.mj; + +/** Designates a machine that can receive power. */ +public interface IMjReceiver extends IMjConnector { + /** @return The number of microjoules that this receiver currently wants, and can accept. */ + long getPowerRequested(); + + /** Receives power. You are encouraged to either: + *

    + *
  • Use up all power immediately, or when you next tick. + *
  • Store all power in something like an {@link MjBattery} for later usage. + *
  • Refuse all power (if you have no more work to do or your {@link MjBattery} is full). + *
+ * + * @param microJoules The number of micro joules to add. + * @param simulate If true then just pretend you received power- don't actually change any of your internal state. + * @return The excess power. */ + long receivePower(long microJoules, boolean simulate); +} diff --git a/src/api/java/buildcraft/api/mj/IMjRedstoneReceiver.java b/src/api/java/buildcraft/api/mj/IMjRedstoneReceiver.java new file mode 100755 index 000000000..11eb5de63 --- /dev/null +++ b/src/api/java/buildcraft/api/mj/IMjRedstoneReceiver.java @@ -0,0 +1,4 @@ +package buildcraft.api.mj; + +/** Designates that a receiver can receive redstone power (cheap, free, small amounts) */ +public interface IMjRedstoneReceiver extends IMjReceiver {} diff --git a/src/api/java/buildcraft/api/mj/MjAPI.java b/src/api/java/buildcraft/api/mj/MjAPI.java new file mode 100755 index 000000000..8bf317e1f --- /dev/null +++ b/src/api/java/buildcraft/api/mj/MjAPI.java @@ -0,0 +1,184 @@ +package buildcraft.api.mj; + +import java.text.DecimalFormat; +import java.util.concurrent.Callable; + +import javax.annotation.Nonnull; + +import net.minecraft.nbt.NBTBase; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; + +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityInject; +import net.minecraftforge.common.capabilities.CapabilityManager; + +import buildcraft.api.core.APIHelper; + +public class MjAPI { + + // ################################ + // + // Useful constants (Public API) + // + // ################################ + + /** A single minecraft joule, in micro joules (the power system base unit) */ + public static final long ONE_MINECRAFT_JOULE = 1 * 1000L * 1000L; + /** The same as {@link #ONE_MINECRAFT_JOULE}, but a shorter field name */ + public static final long MJ = ONE_MINECRAFT_JOULE; + + /** The decimal format used to display values of MJ to the player. Note that this */ + public static final DecimalFormat MJ_DISPLAY_FORMAT = new DecimalFormat("###0.##"); + + public static final IMjEffectManager EFFECT_MANAGER = APIHelper.getInstance("", IMjEffectManager.class, NullaryEffectManager.INSTANCE); + + // ############### + // + // Capabilities + // + // ############### + + @Nonnull + public static final Capability CAP_CONNECTOR; + + @Nonnull + public static final Capability CAP_RECEIVER; + + @Nonnull + public static final Capability CAP_REDSTONE_RECEIVER; + + @Nonnull + public static final Capability CAP_READABLE; + + @Nonnull + public static final Capability CAP_PASSIVE_PROVIDER; + + // ############### + // + // Helpful methods + // + // ############### + + /** Formats a given MJ value to a player-oriented string. Note that this does not append "MJ" to the value. */ + public static String formatMj(long microMj) { + return formatMjInternal(microMj / (double) MJ); + } + + /** Formats a given MJ value to a player-oriented string. Note that this DOES append "*MJ" to the value. This does + * however shorten it down to a small length, and displays "µ", "m", "K" or "M" or "G" before the MJ depending on + * how big or small the value is. */ + public static String formatMjShort(long microJoules) { + if (microJoules == 0) { + return "0 Mj"; + } + long limit = 1; + final long nextUnitCap = 800; + if (microJoules < nextUnitCap * limit) {// micro MJ + return formatMjInternal(microJoules) + " µMJ"; + } + limit *= 1000; + if (microJoules < nextUnitCap * limit) { // milli MJ + return formatMjInternal(microJoules / (double) limit) + " mMJ"; + } + limit *= 1000; + if (microJoules < nextUnitCap * limit) { // MJ + return formatMjInternal(microJoules / (double) limit) + " MJ"; + } + limit *= 1000; + if (microJoules < nextUnitCap * limit) {// kilo MJ + return formatMjInternal(microJoules / (double) limit) + " KMJ"; + } + limit *= 1000; + if (microJoules < nextUnitCap * limit) {// mega MJ + return formatMjInternal(microJoules / (double) limit) + " MMJ"; + } + limit *= 1000; + return formatMjInternal(microJoules / (double) limit) + " GMJ"; + } + + // ######################################## + // + // Null based classes + // + // ######################################## + + public enum NullaryEffectManager implements IMjEffectManager { + INSTANCE; + @Override public void createPowerLossEffect(World world, Vec3d center, long microJoulesLost) {} + @Override public void createPowerLossEffect(World world, Vec3d center, EnumFacing direction, long microJoulesLost) {} + @Override public void createPowerLossEffect(World world, Vec3d center, Vec3d direction, long microJoulesLost) {} + } + // @formatter:on + + // #################### + // + // Internal API logic + // + // ################### + + // Private fields for the registrations -- this allows us to make the actual fields @Nonnull as we check later + @CapabilityInject(IMjConnector.class) + private static final Capability CAP_CONNECTOR_FIRST = null; + + @CapabilityInject(IMjReceiver.class) + private static final Capability CAP_RECEIVER_FIRST = null; + + @CapabilityInject(IMjRedstoneReceiver.class) + private static final Capability CAP_REDSTONE_RECEIVER_FIRST = null; + + @CapabilityInject(IMjReadable.class) + private static final Capability CAP_READABLE_FIRST = null; + + @CapabilityInject(IMjPassiveProvider.class) + private static final Capability CAP_PASSIVE_PROVIDER_FIRST = null; + + static { + registerCapability(IMjConnector.class); + registerCapability(IMjReceiver.class); + registerCapability(IMjRedstoneReceiver.class); + registerCapability(IMjReadable.class); + registerCapability(IMjPassiveProvider.class); + + CAP_CONNECTOR = ensureRegistration(CAP_CONNECTOR_FIRST, IMjConnector.class); + CAP_RECEIVER = ensureRegistration(CAP_RECEIVER_FIRST, IMjReceiver.class); + CAP_REDSTONE_RECEIVER = ensureRegistration(CAP_REDSTONE_RECEIVER_FIRST, IMjRedstoneReceiver.class); + CAP_READABLE = ensureRegistration(CAP_READABLE_FIRST, IMjReadable.class); + CAP_PASSIVE_PROVIDER = ensureRegistration(CAP_PASSIVE_PROVIDER_FIRST, IMjPassiveProvider.class); + } + + private static void registerCapability(Class clazz) { + CapabilityManager.INSTANCE.register(clazz, new VoidStorage(), new Callable() { + // No lambda because of java 6... :( + @Override + public T call() throws Exception { + throw new IllegalStateException("You must create your own instances!"); + } + }); + } + + @Nonnull + private static Capability ensureRegistration(Capability cap, Class clazz) { + if (cap == null) { + throw new Error("Capability registration failed for " + clazz); + } + return cap; + } + + private static class VoidStorage implements Capability.IStorage { + @Override + public NBTBase writeNBT(Capability capability, T instance, EnumFacing side) { + throw new IllegalStateException("You must create your own instances!"); + } + + @Override + public void readNBT(Capability capability, T instance, EnumFacing side, NBTBase nbt) { + throw new IllegalStateException("You must create your own instances!"); + } + } + + private static String formatMjInternal(double val) { + return MJ_DISPLAY_FORMAT.format(val); + } +} diff --git a/src/api/java/buildcraft/api/mj/MjBattery.java b/src/api/java/buildcraft/api/mj/MjBattery.java new file mode 100755 index 000000000..ca86ce1f3 --- /dev/null +++ b/src/api/java/buildcraft/api/mj/MjBattery.java @@ -0,0 +1,116 @@ +package buildcraft.api.mj; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; + +import net.minecraftforge.common.util.INBTSerializable; + +import io.netty.buffer.ByteBuf; + +/** Provides a basic implementation of a simple battery. Note that you should call {@link #tick(World, BlockPos)} or + * {@link #tick(World, Vec3d)} every tick to allow for losing excess power. */ +public class MjBattery implements INBTSerializable { + private final long capacity; + private long microJoules = 0; + + public MjBattery(long capacity) { + this.capacity = capacity; + } + + @Override + public NBTTagCompound serializeNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setLong("stored", microJoules); + return nbt; + } + + @Override + public void deserializeNBT(NBTTagCompound nbt) { + microJoules = nbt.getLong("stored"); + } + + public void writeToBuffer(ByteBuf buffer) { + buffer.writeLong(microJoules); + } + + public void readFromBuffer(ByteBuf buffer) { + microJoules = buffer.readLong(); + } + + public long addPower(long microJoulesToAdd, boolean simulate) { + if (!simulate) { + this.microJoules += microJoulesToAdd; + } + return 0; + } + + /** Attempts to add power, but only if this is not already full. + * + * @param microJoulesToAdd The power to add. + * @return The excess power. */ + public long addPowerChecking(long microJoulesToAdd, boolean simulate) { + if (isFull()) { + return microJoulesToAdd; + } else { + return addPower(microJoulesToAdd, simulate); + } + } + + public long extractAll() { + return extractPower(0, microJoules); + } + + /** Attempts to extract exactly the given amount of power. + * + * @param power The amount of power to extract. + * @return True if the power was removed, false if not. */ + public boolean extractPower(long power) { + return extractPower(power, power) > 0; + } + + public long extractPower(long min, long max) { + if (microJoules < min) return 0; + long extracting = Math.min(microJoules, max); + microJoules -= extracting; + return extracting; + } + + public boolean isFull() { + return microJoules >= capacity; + } + + public long getStored() { + return microJoules; + } + + public long getCapacity() { + return capacity; + } + + public void tick(World world, BlockPos position) { + tick(world, new Vec3d(position.getX() + 0.5, position.getY() + 0.5, position.getZ() + 0.5)); + } + + public void tick(World world, Vec3d position) { + if (microJoules > capacity * 2) { + losePower(world, position); + } + } + + protected void losePower(World world, Vec3d position) { + long diff = microJoules - capacity * 2; + long lost = ceilDivide(diff, 32); + microJoules -= lost; + MjAPI.EFFECT_MANAGER.createPowerLossEffect(world, position, lost); + } + + private static long ceilDivide(long val, long by) { + return (val / by) + (val % by == 0 ? 0 : 1); + } + + public String getDebugString() { + return MjAPI.formatMj(microJoules) + " / " + MjAPI.formatMj(capacity) + " MJ"; + } +} diff --git a/src/api/java/buildcraft/api/mj/MjCapabilityHelper.java b/src/api/java/buildcraft/api/mj/MjCapabilityHelper.java new file mode 100755 index 000000000..41f78747d --- /dev/null +++ b/src/api/java/buildcraft/api/mj/MjCapabilityHelper.java @@ -0,0 +1,57 @@ +package buildcraft.api.mj; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import net.minecraft.util.EnumFacing; + +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ICapabilityProvider; + +/** Provides a quick way to return all types of a single {@link IMjConnector} for all the different capabilities. */ +public class MjCapabilityHelper implements ICapabilityProvider { + + @Nonnull + private final IMjConnector connector; + + @Nullable + private final IMjReceiver receiver; + + @Nullable + private final IMjRedstoneReceiver rsReceiver; + + @Nullable + private final IMjReadable readable; + + @Nullable + private final IMjPassiveProvider provider; + + public MjCapabilityHelper(@Nonnull IMjConnector mj) { + this.connector = mj; + this.receiver = mj instanceof IMjReceiver ? (IMjReceiver) mj : null; + this.rsReceiver = mj instanceof IMjRedstoneReceiver ? (IMjRedstoneReceiver) mj : null; + this.readable = mj instanceof IMjReadable ? (IMjReadable) mj : null; + this.provider = mj instanceof IMjPassiveProvider ? (IMjPassiveProvider) mj : null; + } + + @Override + public boolean hasCapability(Capability capability, EnumFacing facing) { + if (capability == MjAPI.CAP_CONNECTOR) return true; + if (capability == MjAPI.CAP_RECEIVER) return receiver != null; + if (capability == MjAPI.CAP_REDSTONE_RECEIVER) return rsReceiver != null; + if (capability == MjAPI.CAP_READABLE) return readable != null; + if (capability == MjAPI.CAP_PASSIVE_PROVIDER) return provider != null; + return false; + } + + @Override + public T getCapability(Capability capability, EnumFacing facing) { + if (capability == MjAPI.CAP_CONNECTOR) return (T) connector; + if (capability == MjAPI.CAP_RECEIVER) return (T) receiver; + if (capability == MjAPI.CAP_REDSTONE_RECEIVER) return (T) rsReceiver; + if (capability == MjAPI.CAP_READABLE) return (T) readable; + if (capability == MjAPI.CAP_PASSIVE_PROVIDER) return (T) provider; + return null; + } + +} diff --git a/src/api/java/buildcraft/api/mj/package-info.java b/src/api/java/buildcraft/api/mj/package-info.java new file mode 100755 index 000000000..c2670e4cf --- /dev/null +++ b/src/api/java/buildcraft/api/mj/package-info.java @@ -0,0 +1,26 @@ +/** Contains the Minecraft Joule API (shortened to Mj), reborn. + *

+ * MJ is stored in the long type, as micro Mj - so you need a long storing a value of 1 million to have a single MJ. All + * power should be passed around in code as micro Mj (10 ^ -6 of an Mj), but shown to the player as full MJ - so divided by 1 + * million. + *

+ * A single MJ as a constant is available in {@link buildcraft.api.mj.MjAPI#ONE_MINECRAFT_JOULE}, and two player + * formatter's ( {@link buildcraft.api.mj.MjAPI#formatMj(long)}, and {@link buildcraft.api.mj.MjAPI#formatMjShort(long)} + *

+ *

Capability's

+ *

+ * MJ should be exposed from tile entities and entities via the forge capability system as one of the following types: + *

    + *
  • {@link buildcraft.api.mj.IMjConnector} for *anything* that can (potentially) connect to any other Mj type. All + * other types extend this. You should expose this with the capability + * {@link buildcraft.api.mj.MjAPI#CAP_CONNECTOR}
  • + *
  • {@link buildcraft.api.mj.IMjReadable} for something that has an internal battery. This is used for adding gate + * triggers. This should be exposed with the capability {@link buildcraft.api.mj.MjAPI#CAP_READABLE}
  • + *
  • {@link buildcraft.api.mj.IMjReceiver} for something that receives power. This should be exposed with the + * capability {@link buildcraft.api.mj.MjAPI#CAP_RECEIVER}
  • + *
+ * Note that you *must* expose the base interface types as capabilities as well as the top type so if you have an + * instance of {@link buildcraft.api.mj.IMjReceiver} then you must return it for both of the capability's + * {@link buildcraft.api.mj.MjAPI#CAP_CONNECTOR} and {@link buildcraft.api.mj.MjAPI#CAP_RECEIVER}. A simple way to do + * this is provided in {@link buildcraft.api.mj.MjCapabilityHelper}. */ +package buildcraft.api.mj; diff --git a/src/api/java/buildcraft/api/permission/IOwner.java b/src/api/java/buildcraft/api/permission/IOwner.java new file mode 100755 index 000000000..0fa178d2b --- /dev/null +++ b/src/api/java/buildcraft/api/permission/IOwner.java @@ -0,0 +1,24 @@ +package buildcraft.api.permission; + +import java.util.UUID; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.MinecraftServer; + +/** Defines an owner -- this is an actual player in the world, or an offline player. */ +public interface IOwner { + /** Gets the player, if they actually exist on the server */ + @Nullable + EntityPlayer getPlayer(MinecraftServer server); + + /** Gets the player's UUID */ + @Nonnull + UUID getPlayerUUID(); + + /** Gets the player's name. */ + @Nonnull + String getPlayerName(); +} diff --git a/src/api/java/buildcraft/api/permission/IPlayerOwned.java b/src/api/java/buildcraft/api/permission/IPlayerOwned.java new file mode 100755 index 000000000..b6c4350bb --- /dev/null +++ b/src/api/java/buildcraft/api/permission/IPlayerOwned.java @@ -0,0 +1,8 @@ +package buildcraft.api.permission; + +import com.mojang.authlib.GameProfile; + +/** Defines an entity or tile that is owned by a specific player. */ +public interface IPlayerOwned { + GameProfile getOwner(); +} diff --git a/src/api/java/buildcraft/api/power/IEngine.java b/src/api/java/buildcraft/api/power/IEngine.java new file mode 100755 index 000000000..c25037cc4 --- /dev/null +++ b/src/api/java/buildcraft/api/power/IEngine.java @@ -0,0 +1,26 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.power; + +import net.minecraft.util.EnumFacing; + +/** Engines should implement this interface if they want to support BuildCraft's behaviour of passing power between + * engines without using receivePower() (which has other issues). */ +public interface IEngine { + /** Returns true if the engine wants to receive power from another engine on this side. + * + * @param side + * @return */ + boolean canReceiveFromEngine(EnumFacing side); + + /** Receives power from an engine. + * + * @param microJoules The number of micro joules to add. + * @param simulate If true then just pretend you received power- don't actually change any of your internal state. + * @return True if all the power was accepted, false if not. + * + * @see buildcraft.api.mj.IMjReceiver#receivePower(long, boolean) */ + boolean receivePower(long microJoules, boolean simulate); +} diff --git a/src/api/java/buildcraft/api/power/IRedstoneEngine.java b/src/api/java/buildcraft/api/power/IRedstoneEngine.java new file mode 100755 index 000000000..3fc534d45 --- /dev/null +++ b/src/api/java/buildcraft/api/power/IRedstoneEngine.java @@ -0,0 +1,7 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.power; + +public interface IRedstoneEngine {} diff --git a/src/api/java/buildcraft/api/power/package-info.java b/src/api/java/buildcraft/api/power/package-info.java new file mode 100755 index 000000000..c20c3ee4c --- /dev/null +++ b/src/api/java/buildcraft/api/power/package-info.java @@ -0,0 +1,8 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +@API(apiVersion = "1.3", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|power") +package buildcraft.api.power; + +import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/properties/BuildCraftProperties.java b/src/api/java/buildcraft/api/properties/BuildCraftProperties.java index e689a6e1a..d7f883b7b 100755 --- a/src/api/java/buildcraft/api/properties/BuildCraftProperties.java +++ b/src/api/java/buildcraft/api/properties/BuildCraftProperties.java @@ -18,7 +18,7 @@ public final class BuildCraftProperties { public static final BuildCraftProperty ENGINE_TYPE = BuildCraftProperty.create("type", EnumEngineType.class); public static final BuildCraftProperty LASER_TABLE_TYPE = BuildCraftProperty.create("type", EnumLaserTableType.class); public static final BuildCraftProperty MACHINE_STATE = BuildCraftProperty.create("state", EnumMachineState.class); - public static final BuildCraftProperty ENERGY_STAGE = BuildCraftProperty.create("stage", EnumEnergyStage.class); + public static final BuildCraftProperty ENERGY_STAGE = BuildCraftProperty.create("stage", EnumPowerStage.class); public static final BuildCraftProperty BLUEPRINT_TYPE = BuildCraftProperty.create("blueprint_type", EnumBlueprintType.class); public static final BuildCraftProperty DECORATED_BLOCK = BuildCraftProperty.create("decoration_type", EnumDecoratedBlock.class); @@ -29,6 +29,7 @@ public final class BuildCraftProperties { public static final BuildCraftProperty MOVING = BuildCraftProperty.create("moving", false); public static final BuildCraftProperty LED_DONE = BuildCraftProperty.create("led_done", false); public static final BuildCraftProperty ACTIVE = BuildCraftProperty.create("active", false); + public static final BuildCraftProperty VALID = BuildCraftProperty.create("valid", false); public static final BuildCraftProperty CONNECTED_UP = BuildCraftProperty.create("connected_up", false); public static final BuildCraftProperty CONNECTED_DOWN = BuildCraftProperty.create("connected_down", false); diff --git a/src/api/java/buildcraft/api/properties/BuildCraftProperty.java b/src/api/java/buildcraft/api/properties/BuildCraftProperty.java index b768d251a..f13f82c5b 100755 --- a/src/api/java/buildcraft/api/properties/BuildCraftProperty.java +++ b/src/api/java/buildcraft/api/properties/BuildCraftProperty.java @@ -60,7 +60,7 @@ public class BuildCraftProperty> extends PropertyHelper< /** first and last are both inclusive values (use 0, 12, 3 to create an array of [0, 3, 6, 9, 12]) */ public static BuildCraftProperty create(String name, int first, int last, int difference) { int actualDiff = Math.abs(difference); - int number = MathHelper.floor_float(Math.abs(first - last) / (float) actualDiff + 1); + int number = MathHelper.floor(Math.abs(first - last) / (float) actualDiff + 1); Integer[] array = new Integer[number]; int addedDiff = actualDiff * (first > last ? -1 : 1); int current = first; diff --git a/src/api/java/buildcraft/api/recipes/AssemblyRecipe.java b/src/api/java/buildcraft/api/recipes/AssemblyRecipe.java new file mode 100755 index 000000000..0baba21c0 --- /dev/null +++ b/src/api/java/buildcraft/api/recipes/AssemblyRecipe.java @@ -0,0 +1,109 @@ +package buildcraft.api.recipes; + +import java.io.IOException; +import java.util.Iterator; + +import com.google.common.collect.ImmutableSet; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.PacketBuffer; +import net.minecraft.util.NonNullList; + +import net.minecraftforge.common.util.Constants; + +/** Provides an immutable assembly recipe */ +public final class AssemblyRecipe { + public final long requiredMicroJoules; + public final ImmutableSet requiredStacks; + public final ItemStack output; + + public AssemblyRecipe(long requiredMicroJoules, ImmutableSet requiredStacks, ItemStack output) { + this.requiredMicroJoules = requiredMicroJoules; + this.requiredStacks = requiredStacks; + this.output = output; + } + + public AssemblyRecipe(NBTTagCompound nbt) { + requiredMicroJoules = nbt.getLong("required_micro_joules"); + NBTTagList requiredStacksTag = nbt.getTagList("required_stacks", Constants.NBT.TAG_COMPOUND); + NonNullList requiredStacksArray = NonNullList.withSize(requiredStacksTag.tagCount(), ItemStack.EMPTY); + for(int i = 0; i < requiredStacksTag.tagCount(); i++) { + requiredStacksArray.set(i, new ItemStack(requiredStacksTag.getCompoundTagAt(i))); + } + requiredStacks = ImmutableSet.copyOf(requiredStacksArray); + output = new ItemStack(nbt.getCompoundTag("output")); + } + + public AssemblyRecipe(PacketBuffer buffer) throws IOException { + requiredMicroJoules = buffer.readLong(); + int count = buffer.readInt(); + NonNullList requiredStacksArray = NonNullList.withSize(count, ItemStack.EMPTY); + for(int i = 0; i < count; i++) { + requiredStacksArray.set(i, buffer.readItemStack()); + } + requiredStacks = ImmutableSet.copyOf(requiredStacksArray); + output = buffer.readItemStack(); + } + + public NBTTagCompound writeToNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setLong("required_micro_joules", requiredMicroJoules); + NBTTagList requiredStacksTag = new NBTTagList(); + for(ItemStack requiredStack : requiredStacks) { + requiredStacksTag.appendTag(requiredStack.serializeNBT()); + } + nbt.setTag("required_stacks", requiredStacksTag); + nbt.setTag("output", output.serializeNBT()); + return nbt; + } + + public void writeToBuffer(PacketBuffer buffer) { + buffer.writeLong(requiredMicroJoules); + buffer.writeInt(requiredStacks.size()); + requiredStacks.forEach(buffer::writeItemStack); + buffer.writeItemStack(output); + } + + @Override + public boolean equals(Object o) { + if(this == o) { + return true; + } + if(o == null || getClass() != o.getClass()) { + return false; + } + + AssemblyRecipe that = (AssemblyRecipe) o; + + if(requiredMicroJoules != that.requiredMicroJoules) { + return false; + } + if(requiredStacks != null && that.requiredStacks != null) { + Iterator iterator1 = requiredStacks.iterator(); + Iterator iterator2 = that.requiredStacks.iterator(); + while(iterator1.hasNext()) { + if (!iterator2.hasNext()) { + return false; + } + ItemStack o1 = iterator1.next(); + ItemStack o2 = iterator2.next(); + if (!ItemStack.areItemStacksEqual(o1, o2)) { + return false; + } + } + return !iterator2.hasNext() && output != null ? ItemStack.areItemStacksEqual(output, that.output) : that.output == null; + } else { + return requiredStacks == null && that.requiredStacks == null && output != null ? ItemStack.areItemStacksEqual(output, that.output) : that.output == null; + } + } + + @Override + public int hashCode() { + int result = (int) (requiredMicroJoules ^ (requiredMicroJoules >>> 32)); + result = 31 * result + (requiredStacks != null ? requiredStacks.hashCode() : 0); + result = 31 * result + (output != null ? output.hashCode() : 0); + return result; + } +} diff --git a/src/api/java/buildcraft/api/recipes/BuildcraftRecipeRegistry.java b/src/api/java/buildcraft/api/recipes/BuildcraftRecipeRegistry.java new file mode 100755 index 000000000..fd0838ab5 --- /dev/null +++ b/src/api/java/buildcraft/api/recipes/BuildcraftRecipeRegistry.java @@ -0,0 +1,14 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.recipes; + +public final class BuildcraftRecipeRegistry { + + public static IAssemblyRecipeRegistry assemblyRecipes; + public static IIntegrationRecipeRegistry integrationRecipes; + public static IComplexRefineryRecipeManager complexRefinery; + + private BuildcraftRecipeRegistry() {} +} diff --git a/src/api/java/buildcraft/api/recipes/IAssemblyRecipeProvider.java b/src/api/java/buildcraft/api/recipes/IAssemblyRecipeProvider.java new file mode 100755 index 000000000..4e051d78d --- /dev/null +++ b/src/api/java/buildcraft/api/recipes/IAssemblyRecipeProvider.java @@ -0,0 +1,20 @@ +package buildcraft.api.recipes; + +import java.util.List; + +import javax.annotation.Nonnull; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; + +/** Provides a way of registering complex recipes without needing to register every possible variant. If you want the + * recipes to be viewable in JEI and the guide book then you will *also* need to implement the bc lib class + * IAssemblyRecipeViewable. */ +public interface IAssemblyRecipeProvider { + + /** Should return a list of all the valid recipes given the input items. The list may be empty, but must not be + * null. Note that this will *most likely* be slow to check everything, so you should cache the return value and + * re-use it when you can. */ + @Nonnull + List getRecipesFor(@Nonnull NonNullList possibleIn); +} diff --git a/src/api/java/buildcraft/api/recipes/IAssemblyRecipeRegistry.java b/src/api/java/buildcraft/api/recipes/IAssemblyRecipeRegistry.java new file mode 100755 index 000000000..9665f40d7 --- /dev/null +++ b/src/api/java/buildcraft/api/recipes/IAssemblyRecipeRegistry.java @@ -0,0 +1,19 @@ +package buildcraft.api.recipes; + +import java.util.Iterator; + +import javax.annotation.Nonnull; + +public interface IAssemblyRecipeRegistry extends IAssemblyRecipeProvider { + void addRecipe(@Nonnull AssemblyRecipe recipe); + + void addRecipeProvider(@Nonnull IAssemblyRecipeProvider provider); + + /** Gets all of the simple recipes that are registered. Note that you *can* use the returned iterator's + * {@link Iterator#remove()} method to remove recipes from this registry. */ + Iterable getAllRecipes(); + + /** Gets all of the complex recipe providers that are registered. Note that you *can* use the returned iterator's + * {@link Iterator#remove()} method to remove providers from this registry. */ + Iterable getAllRecipeProviders(); +} diff --git a/src/api/java/buildcraft/api/recipes/IComplexRefineryRecipeManager.java b/src/api/java/buildcraft/api/recipes/IComplexRefineryRecipeManager.java new file mode 100755 index 000000000..5623b5eaa --- /dev/null +++ b/src/api/java/buildcraft/api/recipes/IComplexRefineryRecipeManager.java @@ -0,0 +1,66 @@ +package buildcraft.api.recipes; + +import java.util.Set; + +import com.google.common.base.Predicate; + +import net.minecraftforge.fluids.FluidStack; + +public interface IComplexRefineryRecipeManager { + IHeatableRecipe createHeatingRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo, int ticks); + + IHeatableRecipe addHeatableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo, int ticks, boolean replaceExisting); + + ICoolableRecipe createCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo, int ticks); + + ICoolableRecipe addCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo, int ticks, boolean replaceExisting); + + IDistilationRecipe createDistilationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, int ticks); + + IDistilationRecipe addDistilationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, int ticks, boolean replaceExisting); + + IComplexRefineryRegistry getHeatableRegistry(); + + IComplexRefineryRegistry getCoolableRegistry(); + + IComplexRefineryRegistry getDistilationRegistry(); + + public interface IComplexRefineryRegistry { + /** @return an unmodifiable set containing all of the distilation recipies that satisfy the given predicate. All + * of the recipe objects are guarenteed to never be null. */ + Set getRecipes(Predicate toReturn); + + /** @return an unmodifiable set containing all of the distilation recipies. */ + Set getAllRecipes(); + + R getRecipeForInput(FluidStack fluid); + + Set removeRecipes(Predicate toRemove); + + R addRecipe(R recipe, boolean replaceExisting); + } + + public interface IComplexRefineryRecipe { + int ticks(); + + FluidStack in(); + } + + public interface IHeatExchangerRecipe extends IComplexRefineryRecipe { + FluidStack out(); + + int heatFrom(); + + int heatTo(); + } + + public interface IHeatableRecipe extends IHeatExchangerRecipe {} + + public interface ICoolableRecipe extends IHeatExchangerRecipe {} + + public interface IDistilationRecipe extends IComplexRefineryRecipe { + FluidStack outGas(); + + FluidStack outLiquid(); + } +} diff --git a/src/api/java/buildcraft/api/recipes/IIntegrationRecipeProvider.java b/src/api/java/buildcraft/api/recipes/IIntegrationRecipeProvider.java new file mode 100755 index 000000000..77b1cfc22 --- /dev/null +++ b/src/api/java/buildcraft/api/recipes/IIntegrationRecipeProvider.java @@ -0,0 +1,20 @@ +package buildcraft.api.recipes; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; + +/** Provides a way of registering complex recipes without needing to register every possible variant. If you want the + * recipes to be viewable in JEI and the guide book then you will *also* need to implement the bc lib class + * IIntegrationRecipeViewable. */ +public interface IIntegrationRecipeProvider { + /** Gets an integration recipe for the given ingredients. + * + * @param target The center itemstack. + * @param toIntegrate A list of stacks to try to integrate to the + * @return */ + @Nullable + IntegrationRecipe getRecipeFor(@Nonnull ItemStack target, @Nonnull NonNullList toIntegrate); +} diff --git a/src/api/java/buildcraft/api/recipes/IIntegrationRecipeRegistry.java b/src/api/java/buildcraft/api/recipes/IIntegrationRecipeRegistry.java new file mode 100755 index 000000000..7e4c55b72 --- /dev/null +++ b/src/api/java/buildcraft/api/recipes/IIntegrationRecipeRegistry.java @@ -0,0 +1,17 @@ +package buildcraft.api.recipes; + +import java.util.Iterator; + +public interface IIntegrationRecipeRegistry extends IIntegrationRecipeProvider { + void addRecipe(IntegrationRecipe recipe); + + void addRecipeProvider(IIntegrationRecipeProvider provider); + + /** Gets all of the simple recipes that are registered. Note that you *can* use the returned iterator's + * {@link Iterator#remove()} method to remove recipes from this registry. */ + Iterable getAllRecipes(); + + /** Gets all of the complex recipe providers that are registered. Note that you *can* use the returned iterator's + * {@link Iterator#remove()} method to remove providers from this registry. */ + Iterable getAllRecipeProviders(); +} diff --git a/src/api/java/buildcraft/api/recipes/IntegrationRecipe.java b/src/api/java/buildcraft/api/recipes/IntegrationRecipe.java new file mode 100755 index 000000000..afaac2dd8 --- /dev/null +++ b/src/api/java/buildcraft/api/recipes/IntegrationRecipe.java @@ -0,0 +1,120 @@ +package buildcraft.api.recipes; + +import java.io.IOException; +import java.util.Iterator; + +import javax.annotation.Nonnull; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.PacketBuffer; +import net.minecraft.util.NonNullList; + +import net.minecraftforge.common.util.Constants; + +public final class IntegrationRecipe { + public final long requiredMicroJoules; + public final @Nonnull ItemStack target; + public final NonNullList toIntegrate; + public final ItemStack output; + + public IntegrationRecipe(long requiredMicroJoules, @Nonnull ItemStack target, NonNullList toIntegrate, ItemStack output) { + this.requiredMicroJoules = requiredMicroJoules; + this.target = target; + this.toIntegrate = toIntegrate; + this.output = output; + } + + public IntegrationRecipe(NBTTagCompound nbt) { + requiredMicroJoules = nbt.getLong("required_micro_joules"); + target = new ItemStack(nbt.getCompoundTag("target")); + NBTTagList toIntegrateTag = nbt.getTagList("to_integrate", Constants.NBT.TAG_COMPOUND); + toIntegrate = NonNullList.withSize(toIntegrateTag.tagCount(), ItemStack.EMPTY); + for (int i = 0; i < toIntegrateTag.tagCount(); i++) { + toIntegrate.set(i, new ItemStack(toIntegrateTag.getCompoundTagAt(i))); + } + output = new ItemStack(nbt.getCompoundTag("output")); + } + + public IntegrationRecipe(PacketBuffer buffer) throws IOException { + requiredMicroJoules = buffer.readLong(); + ItemStack stack = buffer.readItemStack(); + if (stack == null) throw new NullPointerException("stack");// should never happen + target = stack; + int count = buffer.readInt(); + toIntegrate = NonNullList.withSize(count, ItemStack.EMPTY); + for (int i = 0; i < count; i++) { + toIntegrate.set(i, buffer.readItemStack()); + } + output = buffer.readItemStack(); + } + + public NBTTagCompound writeToNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setLong("required_micro_joules", requiredMicroJoules); + nbt.setTag("target", target.serializeNBT()); + NBTTagList toIntegrateTag = new NBTTagList(); + for (ItemStack toIntegrateElement : toIntegrate) { + toIntegrateTag.appendTag(toIntegrateElement.serializeNBT()); + } + nbt.setTag("to_integrate", toIntegrateTag); + nbt.setTag("output", output.serializeNBT()); + return nbt; + } + + public void writeToBuffer(PacketBuffer buffer) { + buffer.writeLong(requiredMicroJoules); + buffer.writeItemStack(target); + buffer.writeInt(toIntegrate.size()); + for (ItemStack stack : toIntegrate) { + buffer.writeItemStack(stack); + } + buffer.writeItemStack(output); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + IntegrationRecipe that = (IntegrationRecipe) o; + + if (requiredMicroJoules != that.requiredMicroJoules) { + return false; + } + if (!ItemStack.areItemStacksEqual(target, that.target)) { + return false; + } + if (toIntegrate != null && that.toIntegrate != null) { + Iterator iterator1 = toIntegrate.iterator(); + Iterator iterator2 = that.toIntegrate.iterator(); + while (iterator1.hasNext()) { + if (!iterator2.hasNext()) { + return false; + } + ItemStack o1 = iterator1.next(); + ItemStack o2 = iterator2.next(); + if (!ItemStack.areItemStacksEqual(o1, o2)) { + return false; + } + } + return !iterator2.hasNext() && output != null ? ItemStack.areItemStacksEqual(output, that.output) : that.output == null; + } else { + return toIntegrate == null && that.toIntegrate == null && output != null ? ItemStack.areItemStacksEqual(output, that.output) : that.output == null; + } + } + + @Override + public int hashCode() { + int result = (int) (requiredMicroJoules ^ (requiredMicroJoules >>> 32)); + result = 31 * result + (target != null ? target.hashCode() : 0); + result = 31 * result + (toIntegrate != null ? toIntegrate.hashCode() : 0); + result = 31 * result + (output != null ? output.hashCode() : 0); + return result; + } +} diff --git a/src/api/java/buildcraft/api/recipes/package-info.java b/src/api/java/buildcraft/api/recipes/package-info.java new file mode 100755 index 000000000..f8cc9942a --- /dev/null +++ b/src/api/java/buildcraft/api/recipes/package-info.java @@ -0,0 +1,8 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +@API(apiVersion = "3.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|recipes") +package buildcraft.api.recipes; + +import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/robots/AIRobot.java b/src/api/java/buildcraft/api/robots/AIRobot.java new file mode 100755 index 000000000..0fad58245 --- /dev/null +++ b/src/api/java/buildcraft/api/robots/AIRobot.java @@ -0,0 +1,222 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.robots; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import buildcraft.api.mj.MjAPI; + +public class AIRobot { + public EntityRobotBase robot; + + private AIRobot delegateAI; + private AIRobot parentAI; + + private boolean success; + + public AIRobot(EntityRobotBase iRobot) { + robot = iRobot; + success = true; + } + + public void start() { + + } + + public void preempt(AIRobot ai) { + + } + + public void update() { + // Update should always handle terminate. Some AI are not using update + // at all, their code being in start() and end(). In these case, + // calling update is a malfunction, the ai should be terminated. + terminate(); + } + + public void end() { + + } + + /** This gets called when a delegate AI ends work naturally. + * + * @param ai The delegate AI which ended work. */ + public void delegateAIEnded(AIRobot ai) { + + } + + /** This gets called when a delegate AI is forcibly aborted. + * + * @param ai The delegate AI which was aborted. */ + public void delegateAIAborted(AIRobot ai) { + + } + + public void writeSelfToNBT(NBTTagCompound nbt) { + + } + + public void loadSelfFromNBT(NBTTagCompound nbt) { + + } + + public boolean success() { + return success; + } + + protected void setSuccess(boolean iSuccess) { + success = iSuccess; + } + + public long getPowerCost() { + return MjAPI.MJ / 10; + } + + public boolean canLoadFromNBT() { + return false; + } + + /** Tries to receive items in parameters, return items that are left after the operation. */ + public ItemStack receiveItem(ItemStack stack) { + return stack; + } + + public final void terminate() { + abortDelegateAI(); + end(); + + if (parentAI != null) { + parentAI.delegateAI = null; + parentAI.delegateAIEnded(this); + } + } + + public final void abort() { + abortDelegateAI(); + + try { + end(); + + if (parentAI != null) { + parentAI.delegateAI = null; + parentAI.delegateAIAborted(this); + } + } catch (Throwable e) { + e.printStackTrace(); + delegateAI = null; + + if (parentAI != null) { + parentAI.delegateAI = null; + } + } + } + + public final void cycle() { + try { + preempt(delegateAI); + + if (delegateAI != null) { + delegateAI.cycle(); + } else { + robot.getBattery().extractPower(1, getPowerCost()); + update(); + } + } catch (Throwable e) { + e.printStackTrace(); + abort(); + } + } + + public final void startDelegateAI(AIRobot ai) { + abortDelegateAI(); + delegateAI = ai; + ai.parentAI = this; + delegateAI.start(); + } + + public final void abortDelegateAI() { + if (delegateAI != null) { + delegateAI.abort(); + } + } + + public final AIRobot getActiveAI() { + if (delegateAI != null) { + return delegateAI.getActiveAI(); + } else { + return this; + } + } + + public final AIRobot getDelegateAI() { + return delegateAI; + } + + public final void writeToNBT(NBTTagCompound nbt) { + nbt.setString("aiName", RobotManager.getAIRobotName(getClass())); + + NBTTagCompound data = new NBTTagCompound(); + writeSelfToNBT(data); + nbt.setTag("data", data); + + if (delegateAI != null && delegateAI.canLoadFromNBT()) { + NBTTagCompound sub = new NBTTagCompound(); + + delegateAI.writeToNBT(sub); + nbt.setTag("delegateAI", sub); + } + } + + public final void loadFromNBT(NBTTagCompound nbt) { + loadSelfFromNBT(nbt.getCompoundTag("data")); + + if (nbt.hasKey("delegateAI")) { + NBTTagCompound sub = nbt.getCompoundTag("delegateAI"); + + try { + Class aiRobotClass; + if (sub.hasKey("class")) { + // Migration support for 6.4.x + aiRobotClass = RobotManager.getAIRobotByLegacyClassName(sub.getString("class")); + } else { + aiRobotClass = RobotManager.getAIRobotByName(sub.getString("aiName")); + } + if (aiRobotClass != null) { + delegateAI = (AIRobot) aiRobotClass.getConstructor(EntityRobotBase.class).newInstance(robot); + delegateAI.parentAI = this; + + if (delegateAI.canLoadFromNBT()) { + delegateAI.loadFromNBT(sub); + } + } + } catch (Throwable e) { + e.printStackTrace(); + } + } + } + + public static AIRobot loadAI(NBTTagCompound nbt, EntityRobotBase robot) { + AIRobot ai = null; + + try { + Class aiRobotClass; + if (nbt.hasKey("class")) { + // Migration support for 6.4.x + aiRobotClass = RobotManager.getAIRobotByLegacyClassName(nbt.getString("class")); + } else { + aiRobotClass = RobotManager.getAIRobotByName(nbt.getString("aiName")); + } + if (aiRobotClass != null) { + ai = (AIRobot) aiRobotClass.getConstructor(EntityRobotBase.class).newInstance(robot); + ai.loadFromNBT(nbt); + } + } catch (Throwable e) { + e.printStackTrace(); + } + + return ai; + } +} diff --git a/src/api/java/buildcraft/api/robots/DockingStation.java b/src/api/java/buildcraft/api/robots/DockingStation.java new file mode 100755 index 000000000..28ecb0830 --- /dev/null +++ b/src/api/java/buildcraft/api/robots/DockingStation.java @@ -0,0 +1,225 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents + * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ +package buildcraft.api.robots; + +import net.minecraft.inventory.IInventory; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +import net.minecraftforge.fluids.capability.IFluidHandler; + +import buildcraft.api.core.BCLog; +import buildcraft.api.core.EnumPipePart; +import buildcraft.api.statements.StatementSlot; +import buildcraft.api.transport.IInjectable; + +public abstract class DockingStation { + public EnumFacing side; + public World world; + + private long robotTakingId = EntityRobotBase.NULL_ROBOT_ID; + private EntityRobotBase robotTaking; + + private boolean linkIsMain = false; + + private BlockPos pos; + + public DockingStation(BlockPos iIndex, EnumFacing iSide) { + pos = iIndex; + side = iSide; + } + + public DockingStation() {} + + public boolean isMainStation() { + return linkIsMain; + } + + public BlockPos getPos() { + return pos; + } + + public EnumFacing side() { + return side; + } + + public EntityRobotBase robotTaking() { + if (robotTakingId == EntityRobotBase.NULL_ROBOT_ID) { + return null; + } else if (robotTaking == null) { + robotTaking = RobotManager.registryProvider.getRegistry(world).getLoadedRobot(robotTakingId); + } + + return robotTaking; + } + + public void invalidateRobotTakingEntity() { + robotTaking = null; + } + + public long linkedId() { + return robotTakingId; + } + + public boolean takeAsMain(EntityRobotBase robot) { + if (robotTakingId == EntityRobotBase.NULL_ROBOT_ID) { + IRobotRegistry registry = RobotManager.registryProvider.getRegistry(world); + linkIsMain = true; + robotTaking = robot; + robotTakingId = robot.getRobotId(); + registry.registryMarkDirty(); + robot.setMainStation(this); + registry.take(this, robot.getRobotId()); + + return true; + } else { + return robotTakingId == robot.getRobotId(); + } + } + + public boolean take(EntityRobotBase robot) { + if (robotTaking == null) { + IRobotRegistry registry = RobotManager.registryProvider.getRegistry(world); + linkIsMain = false; + robotTaking = robot; + robotTakingId = robot.getRobotId(); + registry.registryMarkDirty(); + registry.take(this, robot.getRobotId()); + + return true; + } else { + return robot.getRobotId() == robotTakingId; + } + } + + public void release(EntityRobotBase robot) { + if (robotTaking == robot && !linkIsMain) { + IRobotRegistry registry = RobotManager.registryProvider.getRegistry(world); + unsafeRelease(robot); + registry.registryMarkDirty(); + registry.release(this, robot.getRobotId()); + } + } + + /** Same a release but doesn't clear the registry (presumably called from the registry). */ + public void unsafeRelease(EntityRobotBase robot) { + if (robotTaking == robot) { + linkIsMain = false; + robotTaking = null; + robotTakingId = EntityRobotBase.NULL_ROBOT_ID; + } + } + + public void writeToNBT(NBTTagCompound nbt) { + nbt.setIntArray("pos", new int[] { getPos().getX(), getPos().getY(), getPos().getZ() }); + nbt.setByte("side", (byte) side.ordinal()); + nbt.setBoolean("isMain", linkIsMain); + nbt.setLong("robotId", robotTakingId); + } + + public void readFromNBT(NBTTagCompound nbt) { + if (nbt.hasKey("index")) { + // For compatibility with older versions of minecraft and buildcraft + NBTTagCompound indexNBT = nbt.getCompoundTag("index"); + int x = indexNBT.getInteger("i"); + int y = indexNBT.getInteger("j"); + int z = indexNBT.getInteger("k"); + pos = new BlockPos(x, y, z); + } else { + int[] array = nbt.getIntArray("pos"); + if (array.length == 3) { + pos = new BlockPos(array[0], array[1], array[2]); + } else if (array.length != 0) { + BCLog.logger.warn("Found an integer array that wwas not the right length! (" + array + ")"); + } else { + BCLog.logger.warn("Did not find any integer positions! This is a bug!"); + } + } + side = EnumFacing.values()[nbt.getByte("side")]; + linkIsMain = nbt.getBoolean("isMain"); + robotTakingId = nbt.getLong("robotId"); + } + + public boolean isTaken() { + return robotTakingId != EntityRobotBase.NULL_ROBOT_ID; + } + + public long robotIdTaking() { + return robotTakingId; + } + + public BlockPos index() { + return pos; + } + + @Override + public String toString() { + return "{" + pos + ", " + side + " :" + robotTakingId + "}"; + } + + public boolean linkIsDocked() { + if (robotTaking() != null) { + return robotTaking().getDockingStation() == this; + } else { + return false; + } + } + + public boolean canRelease() { + return !isMainStation() && !linkIsDocked(); + } + + public boolean isInitialized() { + return true; + } + + public abstract Iterable getActiveActions(); + + public IInjectable getItemOutput() { + return null; + } + + public EnumPipePart getItemOutputSide() { + return EnumPipePart.CENTER; + } + + public IInventory getItemInput() { + return null; + } + + public EnumPipePart getItemInputSide() { + return EnumPipePart.CENTER; + } + + public IFluidHandler getFluidOutput() { + return null; + } + + public EnumPipePart getFluidOutputSide() { + return EnumPipePart.CENTER; + } + + public IFluidHandler getFluidInput() { + return null; + } + + public EnumPipePart getFluidInputSide() { + return EnumPipePart.CENTER; + } + + public boolean providesPower() { + return false; + } + + public IRequestProvider getRequestProvider() { + return null; + } + + public void onChunkUnload() { + + } +} diff --git a/src/api/java/buildcraft/api/robots/EntityRobotBase.java b/src/api/java/buildcraft/api/robots/EntityRobotBase.java new file mode 100755 index 000000000..0e6439d04 --- /dev/null +++ b/src/api/java/buildcraft/api/robots/EntityRobotBase.java @@ -0,0 +1,86 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.robots; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +import net.minecraftforge.items.IItemHandler; + +import buildcraft.api.boards.RedstoneBoardRobot; +import buildcraft.api.core.IFluidHandlerAdv; +import buildcraft.api.core.IZone; +import buildcraft.api.mj.MjAPI; +import buildcraft.api.mj.MjBattery; + +public abstract class EntityRobotBase extends EntityLiving implements IItemHandler, IFluidHandlerAdv { + + public static final long MAX_POWER = 5000 * MjAPI.MJ; + public static final long SAFETY_POWER = MAX_POWER / 5; + public static final long SHUTDOWN_POWER = 0; + public static final long NULL_ROBOT_ID = Long.MAX_VALUE; + + public EntityRobotBase(World par1World) { + super(par1World); + } + + public abstract void setItemInUse(ItemStack stack); + + public abstract void setItemActive(boolean b); + + public abstract boolean isMoving(); + + public abstract DockingStation getLinkedStation(); + + public abstract RedstoneBoardRobot getBoard(); + + public abstract void aimItemAt(float yaw, float pitch); + + public abstract void aimItemAt(BlockPos pos); + + public abstract float getAimYaw(); + + public abstract float getAimPitch(); + + public long getPower() { + return getBattery().getStored(); + } + + public abstract MjBattery getBattery(); + + public abstract DockingStation getDockingStation(); + + public abstract void dock(DockingStation station); + + public abstract void undock(); + + public abstract IZone getZoneToWork(); + + public abstract IZone getZoneToLoadUnload(); + + public abstract boolean containsItems(); + + public abstract boolean hasFreeSlot(); + + public abstract void unreachableEntityDetected(Entity entity); + + public abstract boolean isKnownUnreachable(Entity entity); + + public abstract long getRobotId(); + + public abstract IRobotRegistry getRegistry(); + + public abstract void releaseResources(); + + public abstract void onChunkUnload(); + + public abstract ItemStack receiveItem(TileEntity tile, ItemStack stack); + + public abstract void setMainStation(DockingStation station); +} diff --git a/src/api/java/buildcraft/api/robots/IDockingStationProvider.java b/src/api/java/buildcraft/api/robots/IDockingStationProvider.java new file mode 100755 index 000000000..0cbd3c3b8 --- /dev/null +++ b/src/api/java/buildcraft/api/robots/IDockingStationProvider.java @@ -0,0 +1,6 @@ +package buildcraft.api.robots; + +/** By default, this can be either an IPipePluggable or a TileEntity. */ +public interface IDockingStationProvider { + DockingStation getStation(); +} diff --git a/src/api/java/buildcraft/api/robots/IRequestProvider.java b/src/api/java/buildcraft/api/robots/IRequestProvider.java new file mode 100755 index 000000000..2e56148a8 --- /dev/null +++ b/src/api/java/buildcraft/api/robots/IRequestProvider.java @@ -0,0 +1,32 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.robots; + +import net.minecraft.item.ItemStack; + +/** Provide requests of items that need to be fulfilled. + * + * Requests are organized as an linear array, where null entries mark slots without a requests. A request in a slot, or + * the amount of slots, is allowed to change before a call to {@link #offerItem(int, ItemStack)}, but it is not + * recommended that this is frequent, since the request delivery won't fail until it is offered the previous request. */ +public interface IRequestProvider { + /** Return the total number of request slots available from this provider. + * + * @return */ + int getRequestsCount(); + + /** Return a stack with the request in the slot. + * + * @param slot + * @return the request in the slot, or null if there's no request. */ + ItemStack getRequest(int slot); + + /** Fulfill the request in slot with the stack given and return any excess. + * + * @param slot + * @param stack + * @return any excess that was not used to fulfill the request. */ + ItemStack offerItem(int slot, ItemStack stack); +} diff --git a/src/api/java/buildcraft/api/robots/IRobotOverlayItem.java b/src/api/java/buildcraft/api/robots/IRobotOverlayItem.java new file mode 100755 index 000000000..fa39ee1a1 --- /dev/null +++ b/src/api/java/buildcraft/api/robots/IRobotOverlayItem.java @@ -0,0 +1,14 @@ +package buildcraft.api.robots; + +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.item.ItemStack; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public interface IRobotOverlayItem { + boolean isValidRobotOverlay(ItemStack stack); + + @SideOnly(Side.CLIENT) + void renderRobotOverlay(ItemStack stack, TextureManager textureManager); +} diff --git a/src/api/java/buildcraft/api/robots/IRobotRegistry.java b/src/api/java/buildcraft/api/robots/IRobotRegistry.java new file mode 100755 index 000000000..96360f564 --- /dev/null +++ b/src/api/java/buildcraft/api/robots/IRobotRegistry.java @@ -0,0 +1,56 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.robots; + +import java.util.Collection; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; + +public interface IRobotRegistry { + + long getNextRobotId(); + + void registerRobot(EntityRobotBase robot); + + void killRobot(EntityRobotBase robot); + + void unloadRobot(EntityRobotBase robot); + + EntityRobotBase getLoadedRobot(long id); + + boolean isTaken(ResourceId resourceId); + + long robotIdTaking(ResourceId resourceId); + + EntityRobotBase robotTaking(ResourceId resourceId); + + boolean take(ResourceId resourceId, EntityRobotBase robot); + + boolean take(ResourceId resourceId, long robotId); + + void release(ResourceId resourceId); + + void releaseResources(EntityRobotBase robot); + + DockingStation getStation(BlockPos pos, EnumFacing side); + + Collection getStations(); + + void registerStation(DockingStation station); + + void removeStation(DockingStation station); + + void take(DockingStation station, long robotId); + + void release(DockingStation station, long robotId); + + void writeToNBT(NBTTagCompound nbt); + + void readFromNBT(NBTTagCompound nbt); + + void registryMarkDirty(); +} diff --git a/src/api/java/buildcraft/api/robots/IRobotRegistryProvider.java b/src/api/java/buildcraft/api/robots/IRobotRegistryProvider.java new file mode 100755 index 000000000..001249453 --- /dev/null +++ b/src/api/java/buildcraft/api/robots/IRobotRegistryProvider.java @@ -0,0 +1,7 @@ +package buildcraft.api.robots; + +import net.minecraft.world.World; + +public interface IRobotRegistryProvider { + IRobotRegistry getRegistry(World world); +} diff --git a/src/api/java/buildcraft/api/robots/ResourceId.java b/src/api/java/buildcraft/api/robots/ResourceId.java new file mode 100755 index 000000000..539503a0f --- /dev/null +++ b/src/api/java/buildcraft/api/robots/ResourceId.java @@ -0,0 +1,39 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.robots; + +import net.minecraft.nbt.NBTTagCompound; + +public abstract class ResourceId { + + protected ResourceId() {} + + public void writeToNBT(NBTTagCompound nbt) { + nbt.setString("resourceName", RobotManager.getResourceIdName(getClass())); + } + + protected void readFromNBT(NBTTagCompound nbt) {} + + public static ResourceId load(NBTTagCompound nbt) { + try { + Class cls; + if (nbt.hasKey("class")) { + // Migration support for 6.4.x + cls = RobotManager.getResourceIdByLegacyClassName(nbt.getString("class")); + } else { + cls = RobotManager.getResourceIdByName(nbt.getString("resourceName")); + } + + ResourceId id = (ResourceId) cls.newInstance(); + id.readFromNBT(nbt); + + return id; + } catch (Throwable e) { + e.printStackTrace(); + } + + return null; + } +} diff --git a/src/api/java/buildcraft/api/robots/ResourceIdBlock.java b/src/api/java/buildcraft/api/robots/ResourceIdBlock.java new file mode 100755 index 000000000..4e89a5826 --- /dev/null +++ b/src/api/java/buildcraft/api/robots/ResourceIdBlock.java @@ -0,0 +1,71 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents + * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ +package buildcraft.api.robots; + +import org.apache.commons.lang3.builder.HashCodeBuilder; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; + +import buildcraft.api.core.EnumPipePart; + +public class ResourceIdBlock extends ResourceId { + + public BlockPos pos = new BlockPos(0, 0, 0); + public EnumPipePart side = EnumPipePart.CENTER; + + public ResourceIdBlock() { + + } + + public ResourceIdBlock(int x, int y, int z) { + pos = new BlockPos(x, y, z); + } + + public ResourceIdBlock(BlockPos iIndex) { + pos = iIndex; + } + + public ResourceIdBlock(TileEntity tile) { + pos = tile.getPos(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || obj.getClass() != getClass()) { + return false; + } + + ResourceIdBlock compareId = (ResourceIdBlock) obj; + + return pos.equals(compareId.pos) && side == compareId.side; + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(pos.hashCode()).append(side != null ? side.ordinal() : 0).build(); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + int[] arr = new int[] { pos.getX(), pos.getY(), pos.getZ() }; + nbt.setIntArray("pos", arr); + + nbt.setTag("side", side.writeToNBT()); + } + + @Override + protected void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + int[] arr = nbt.getIntArray("pos"); + pos = new BlockPos(arr[0], arr[1], arr[2]); + + side = EnumPipePart.readFromNBT(nbt.getTag("side")); + } +} diff --git a/src/api/java/buildcraft/api/robots/ResourceIdRequest.java b/src/api/java/buildcraft/api/robots/ResourceIdRequest.java new file mode 100755 index 000000000..d224b8e76 --- /dev/null +++ b/src/api/java/buildcraft/api/robots/ResourceIdRequest.java @@ -0,0 +1,54 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents + * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ +package buildcraft.api.robots; + +import org.apache.commons.lang3.builder.HashCodeBuilder; + +import net.minecraft.nbt.NBTTagCompound; + +import buildcraft.api.core.EnumPipePart; + +public class ResourceIdRequest extends ResourceIdBlock { + + private int slot; + + public ResourceIdRequest() { + + } + + public ResourceIdRequest(DockingStation station, int slot) { + pos = station.index(); + side = EnumPipePart.fromFacing(station.side()); + this.slot = slot; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) return false; + if (!super.equals(obj)) return false; + ResourceIdRequest compareId = (ResourceIdRequest) obj; + + return slot == compareId.slot; + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(super.hashCode()).append(slot).build(); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + nbt.setInteger("localId", slot); + } + + @Override + protected void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + slot = nbt.getInteger("localId"); + } +} diff --git a/src/api/java/buildcraft/api/robots/RobotManager.java b/src/api/java/buildcraft/api/robots/RobotManager.java new file mode 100755 index 000000000..aa59fc4d7 --- /dev/null +++ b/src/api/java/buildcraft/api/robots/RobotManager.java @@ -0,0 +1,114 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents + * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ +package buildcraft.api.robots; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import buildcraft.api.core.BCLog; + +public abstract class RobotManager { + public static IRobotRegistryProvider registryProvider; + public static ArrayList> aiRobots = new ArrayList>(); + + static { + aiRobotsByNames = new HashMap>(); + aiRobotsNames = new HashMap, String>(); + aiRobotsByLegacyClassNames = new HashMap>(); + resourceIdNames = new HashMap, String>(); + resourceIdByNames = new HashMap>(); + resourceIdLegacyClassNames = new HashMap>(); + dockingStationNames = new HashMap, String>(); + dockingStationByNames = new HashMap>(); + + registerResourceId(ResourceIdBlock.class, "resourceIdBlock", "buildcraft.core.robots.ResourceIdBlock"); + registerResourceId(ResourceIdRequest.class, "resourceIdRequest", "buildcraft.core.robots.ResourceIdRequest"); + } + + private static Map, String> aiRobotsNames; + private static Map> aiRobotsByNames; + private static Map> aiRobotsByLegacyClassNames; + + private static Map, String> resourceIdNames; + private static Map> resourceIdByNames; + private static Map> resourceIdLegacyClassNames; + + private static Map, String> dockingStationNames; + private static Map> dockingStationByNames; + + public static void registerAIRobot(Class aiRobot, String name) { + registerAIRobot(aiRobot, name, null); + } + + public static void registerAIRobot(Class aiRobot, String name, String legacyClassName) { + if (aiRobotsByNames.containsKey(name)) { + BCLog.logger.info("Overriding " + aiRobotsByNames.get(name).getName() + " with " + aiRobot.getName()); + } + + // Check if NBT-load constructor is present + try { + aiRobot.getConstructor(EntityRobotBase.class); + } catch (NoSuchMethodException e) { + throw new RuntimeException("AI class " + aiRobot.getName() + " lacks NBT load construtor! This is a bug!"); + } + + aiRobots.add(aiRobot); + aiRobotsByNames.put(name, aiRobot); + aiRobotsNames.put(aiRobot, name); + if (legacyClassName != null) { + aiRobotsByLegacyClassNames.put(legacyClassName, aiRobot); + } + } + + public static Class getAIRobotByName(String aiRobotName) { + return aiRobotsByNames.get(aiRobotName); + } + + public static String getAIRobotName(Class aiRobotClass) { + return aiRobotsNames.get(aiRobotClass); + } + + public static Class getAIRobotByLegacyClassName(String aiRobotLegacyClassName) { + return aiRobotsByLegacyClassNames.get(aiRobotLegacyClassName); + } + + public static void registerResourceId(Class resourceId, String name) { + registerResourceId(resourceId, name, null); + } + + public static void registerResourceId(Class resourceId, String name, String legacyClassName) { + resourceIdByNames.put(name, resourceId); + resourceIdNames.put(resourceId, name); + if (legacyClassName != null) { + resourceIdLegacyClassNames.put(legacyClassName, resourceId); + } + } + + public static Class getResourceIdByName(String resourceIdName) { + return resourceIdByNames.get(resourceIdName); + } + + public static String getResourceIdName(Class resouceIdClass) { + return resourceIdNames.get(resouceIdClass); + } + + public static Class getResourceIdByLegacyClassName(String resourceIdLegacyClassName) { + return resourceIdLegacyClassNames.get(resourceIdLegacyClassName); + } + + public static void registerDockingStation(Class dockingStation, String name) { + dockingStationByNames.put(name, dockingStation); + dockingStationNames.put(dockingStation, name); + } + + public static Class getDockingStationByName(String dockingStationTypeName) { + return dockingStationByNames.get(dockingStationTypeName); + } + + public static String getDockingStationName(Class dockingStation) { + return dockingStationNames.get(dockingStation); + } +} diff --git a/src/api/java/buildcraft/api/robots/package-info.java b/src/api/java/buildcraft/api/robots/package-info.java new file mode 100755 index 000000000..4fd622b34 --- /dev/null +++ b/src/api/java/buildcraft/api/robots/package-info.java @@ -0,0 +1,8 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +@API(apiVersion = "3.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|robotics") +package buildcraft.api.robots; + +import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/statements/IAction.java b/src/api/java/buildcraft/api/statements/IAction.java new file mode 100755 index 000000000..2cd0c359f --- /dev/null +++ b/src/api/java/buildcraft/api/statements/IAction.java @@ -0,0 +1,6 @@ +package buildcraft.api.statements; + +/** Marker interface that designates a class as being an action. Note that you *must* implement ONE of the following + * interfaces to be recognised as an action: {@link IActionInternal}, {@link IActionInternalSided}, or + * {@link IActionExternal} */ +public interface IAction extends IStatement {} diff --git a/src/api/java/buildcraft/api/statements/IActionExternal.java b/src/api/java/buildcraft/api/statements/IActionExternal.java new file mode 100755 index 000000000..9086612ca --- /dev/null +++ b/src/api/java/buildcraft/api/statements/IActionExternal.java @@ -0,0 +1,12 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.statements; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; + +public interface IActionExternal extends IAction { + void actionActivate(TileEntity target, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); +} diff --git a/src/api/java/buildcraft/api/statements/IActionInternal.java b/src/api/java/buildcraft/api/statements/IActionInternal.java new file mode 100755 index 000000000..1ec5260f3 --- /dev/null +++ b/src/api/java/buildcraft/api/statements/IActionInternal.java @@ -0,0 +1,10 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.statements; + +public interface IActionInternal extends IAction { + + void actionActivate(IStatementContainer source, IStatementParameter[] parameters); +} diff --git a/src/api/java/buildcraft/api/statements/IActionInternalSided.java b/src/api/java/buildcraft/api/statements/IActionInternalSided.java new file mode 100755 index 000000000..0ae3d70d3 --- /dev/null +++ b/src/api/java/buildcraft/api/statements/IActionInternalSided.java @@ -0,0 +1,7 @@ +package buildcraft.api.statements; + +import net.minecraft.util.EnumFacing; + +public interface IActionInternalSided extends IAction { + void actionActivate(EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); +} diff --git a/src/api/java/buildcraft/api/statements/IActionProvider.java b/src/api/java/buildcraft/api/statements/IActionProvider.java new file mode 100755 index 000000000..fa550ff83 --- /dev/null +++ b/src/api/java/buildcraft/api/statements/IActionProvider.java @@ -0,0 +1,20 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.statements; + +import java.util.Collection; + +import javax.annotation.Nonnull; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; + +public interface IActionProvider { + void addInternalActions(Collection actions, IStatementContainer container); + + void addInternalSidedActions(Collection actions, IStatementContainer container, @Nonnull EnumFacing side); + + void addExternalActions(Collection actions, @Nonnull EnumFacing side, TileEntity tile); +} diff --git a/src/api/java/buildcraft/api/statements/IActionReceptor.java b/src/api/java/buildcraft/api/statements/IActionReceptor.java new file mode 100755 index 000000000..34155b86a --- /dev/null +++ b/src/api/java/buildcraft/api/statements/IActionReceptor.java @@ -0,0 +1,9 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.statements; + +public interface IActionReceptor { + void actionActivated(IStatement statement, IStatementParameter[] parameters); +} diff --git a/src/api/java/buildcraft/api/statements/IActionSingle.java b/src/api/java/buildcraft/api/statements/IActionSingle.java new file mode 100755 index 000000000..861e37eb2 --- /dev/null +++ b/src/api/java/buildcraft/api/statements/IActionSingle.java @@ -0,0 +1,6 @@ +package buildcraft.api.statements; + +public interface IActionSingle extends IAction { + /** @return True if this action should only be fired for the first tick of it being active. */ + boolean singleActionTick(); +} diff --git a/src/api/java/buildcraft/api/statements/IGuiSlot.java b/src/api/java/buildcraft/api/statements/IGuiSlot.java new file mode 100755 index 000000000..c7386dd69 --- /dev/null +++ b/src/api/java/buildcraft/api/statements/IGuiSlot.java @@ -0,0 +1,20 @@ +package buildcraft.api.statements; + +import net.minecraft.client.renderer.texture.TextureAtlasSprite; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public interface IGuiSlot { + /** Every parameter needs a unique tag, it should be in the format of "<modid>:<name>". + * + * @return the unique id */ + String getUniqueTag(); + + /** Return the parameter description in the UI */ + String getDescription(); + + /** @return A sprite to show in a GUI, or null if this should not render a sprite. */ + @SideOnly(Side.CLIENT) + TextureAtlasSprite getGuiSprite(); +} diff --git a/src/api/java/buildcraft/api/statements/IOverrideDefaultStatements.java b/src/api/java/buildcraft/api/statements/IOverrideDefaultStatements.java new file mode 100755 index 000000000..cb2dc78e1 --- /dev/null +++ b/src/api/java/buildcraft/api/statements/IOverrideDefaultStatements.java @@ -0,0 +1,13 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.statements; + +import java.util.List; + +public interface IOverrideDefaultStatements { + List overrideTriggers(); + + List overrideActions(); +} diff --git a/src/api/java/buildcraft/api/statements/IStatement.java b/src/api/java/buildcraft/api/statements/IStatement.java new file mode 100755 index 000000000..70c20836e --- /dev/null +++ b/src/api/java/buildcraft/api/statements/IStatement.java @@ -0,0 +1,26 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.statements; + +/** Designates some sort of statement. Most of the time you should implement {@link ITriggerExternal}, + * {@link ITriggerInternal}, {@link IActionExternal} or {@link IActionInternal} though. */ +public interface IStatement extends IGuiSlot { + + /** Return the maximum number of parameter this statement can have, 0 if none. */ + int maxParameters(); + + /** Return the minimum number of parameter this statement can have, 0 if none. */ + int minParameters(); + + /** Create parameters for the statement. */ + IStatementParameter createParameter(int index); + + /** This returns the statement after a left rotation. Used in particular in blueprints orientation. */ + IStatement rotateLeft(); + + /** This returns a group of related statements. For example "redstone signal input" should probably return an array + * of "RS_SIGNAL_ON" and "RS_SIGNAL_OFF". It is recommended to return an array containing this object. */ + IStatement[] getPossible(); +} diff --git a/src/api/java/buildcraft/api/statements/IStatementContainer.java b/src/api/java/buildcraft/api/statements/IStatementContainer.java new file mode 100755 index 000000000..2e7652fd8 --- /dev/null +++ b/src/api/java/buildcraft/api/statements/IStatementContainer.java @@ -0,0 +1,15 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.statements; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; + +/** This is implemented by objects containing Statements, such as Gates and TileEntities. */ +public interface IStatementContainer { + TileEntity getTile(); + + TileEntity getNeighbourTile(EnumFacing side); +} diff --git a/src/api/java/buildcraft/api/statements/IStatementParameter.java b/src/api/java/buildcraft/api/statements/IStatementParameter.java new file mode 100755 index 000000000..8e15b9c46 --- /dev/null +++ b/src/api/java/buildcraft/api/statements/IStatementParameter.java @@ -0,0 +1,33 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.statements; + +import javax.annotation.Nonnull; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public interface IStatementParameter extends IGuiSlot { + + /** @return An itemstack to render for this parameter, or {@link ItemStack#EMPTY} if this should not render an + * itemstack. */ + @Nonnull + ItemStack getItemStack(); + + /** Return true if you handled the mouse click and do not want all possible values to be shown, or false if you + * did nothing and wish to show all possible values. + * + * @see #getPossible(IStatementContainer, IStatement)*/ + boolean onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse); + + void readFromNBT(NBTTagCompound compound); + + void writeToNBT(NBTTagCompound compound); + + /** This returns the parameter after a left rotation. Used in particular in blueprints orientation. */ + IStatementParameter rotateLeft(); + + IStatementParameter[] getPossible(IStatementContainer source, IStatement stmt); +} diff --git a/src/api/java/buildcraft/api/statements/ITrigger.java b/src/api/java/buildcraft/api/statements/ITrigger.java new file mode 100755 index 000000000..cdb65c971 --- /dev/null +++ b/src/api/java/buildcraft/api/statements/ITrigger.java @@ -0,0 +1,6 @@ +package buildcraft.api.statements; + +/** Marker interface that designates a class as being a trigger. Note that you *must* implement ONE of the following + * interfaces to be recognised as a trigger: {@link ITriggerInternal}, {@link ITriggerInternalSided}, or + * {@link ITriggerExternal} */ +public interface ITrigger extends IStatement {} diff --git a/src/api/java/buildcraft/api/statements/ITriggerExternal.java b/src/api/java/buildcraft/api/statements/ITriggerExternal.java new file mode 100755 index 000000000..87a848fef --- /dev/null +++ b/src/api/java/buildcraft/api/statements/ITriggerExternal.java @@ -0,0 +1,14 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.statements; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; + +public interface ITriggerExternal extends ITrigger { + + boolean isTriggerActive(TileEntity target, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); + +} diff --git a/src/api/java/buildcraft/api/statements/ITriggerExternalOverride.java b/src/api/java/buildcraft/api/statements/ITriggerExternalOverride.java new file mode 100755 index 000000000..5b8ce9ee2 --- /dev/null +++ b/src/api/java/buildcraft/api/statements/ITriggerExternalOverride.java @@ -0,0 +1,16 @@ +package buildcraft.api.statements; + +import net.minecraft.util.EnumFacing; + +/** This interface can be used by tiles to override external trigger behaviour. + * + * Please use wisely. */ +public interface ITriggerExternalOverride { + public enum Result { + TRUE, + FALSE, + IGNORE + } + + Result override(EnumFacing side, IStatementContainer source, ITriggerExternal trigger, IStatementParameter[] parameters); +} diff --git a/src/api/java/buildcraft/api/statements/ITriggerInternal.java b/src/api/java/buildcraft/api/statements/ITriggerInternal.java new file mode 100755 index 000000000..8ca49961d --- /dev/null +++ b/src/api/java/buildcraft/api/statements/ITriggerInternal.java @@ -0,0 +1,11 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.statements; + +public interface ITriggerInternal extends ITrigger { + + boolean isTriggerActive(IStatementContainer source, IStatementParameter[] parameters); + +} diff --git a/src/api/java/buildcraft/api/statements/ITriggerInternalSided.java b/src/api/java/buildcraft/api/statements/ITriggerInternalSided.java new file mode 100755 index 000000000..73459f004 --- /dev/null +++ b/src/api/java/buildcraft/api/statements/ITriggerInternalSided.java @@ -0,0 +1,7 @@ +package buildcraft.api.statements; + +import net.minecraft.util.EnumFacing; + +public interface ITriggerInternalSided extends ITrigger { + boolean isTriggerActive(EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); +} diff --git a/src/api/java/buildcraft/api/statements/ITriggerProvider.java b/src/api/java/buildcraft/api/statements/ITriggerProvider.java new file mode 100755 index 000000000..8f3bf0317 --- /dev/null +++ b/src/api/java/buildcraft/api/statements/ITriggerProvider.java @@ -0,0 +1,21 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.statements; + +import java.util.Collection; + +import javax.annotation.Nonnull; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; + +public interface ITriggerProvider { + void addInternalTriggers(Collection triggers, IStatementContainer container); + + void addInternalSidedTriggers(Collection triggers, IStatementContainer container, @Nonnull EnumFacing side); + + /** Returns the list of triggers available to a gate next to the given block. */ + void addExternalTriggers(Collection triggers, @Nonnull EnumFacing side, TileEntity tile); +} diff --git a/src/api/java/buildcraft/api/statements/StatementManager.java b/src/api/java/buildcraft/api/statements/StatementManager.java new file mode 100755 index 000000000..61266e583 --- /dev/null +++ b/src/api/java/buildcraft/api/statements/StatementManager.java @@ -0,0 +1,144 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.statements; + +import java.util.*; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; + +import buildcraft.api.core.BCLog; + +public final class StatementManager { + + public static Map statements = new HashMap(); + public static Map> parameters = new HashMap>(); + private static List triggerProviders = new LinkedList(); + private static List actionProviders = new LinkedList(); + + static { + registerParameterClass(StatementParameterItemStack.class); + } + + /** Deactivate constructor */ + private StatementManager() {} + + public static void registerTriggerProvider(ITriggerProvider provider) { + if (provider != null && !triggerProviders.contains(provider)) { + triggerProviders.add(provider); + } + } + + public static void registerActionProvider(IActionProvider provider) { + if (provider != null && !actionProviders.contains(provider)) { + actionProviders.add(provider); + } + } + + public static void registerStatement(IStatement statement) { + statements.put(statement.getUniqueTag(), statement); + } + + public static void registerParameterClass(Class param) { + parameters.put(createParameter(param).getUniqueTag(), param); + } + + public static List getExternalTriggers(EnumFacing side, TileEntity entity) { + if (entity instanceof IOverrideDefaultStatements) { + List result = ((IOverrideDefaultStatements) entity).overrideTriggers(); + if (result != null) { + return result; + } + } + + LinkedHashSet triggers = new LinkedHashSet(); + + for (ITriggerProvider provider : triggerProviders) { + provider.addExternalTriggers(triggers, side, entity); + } + + return new ArrayList(triggers); + } + + public static List getExternalActions(EnumFacing side, TileEntity entity) { + if (entity instanceof IOverrideDefaultStatements) { + List result = ((IOverrideDefaultStatements) entity).overrideActions(); + if (result != null) { + return result; + } + } + + LinkedHashSet actions = new LinkedHashSet(); + + for (IActionProvider provider : actionProviders) { + provider.addExternalActions(actions, side, entity); + } + + return new ArrayList(actions); + } + + public static List getInternalTriggers(IStatementContainer container) { + LinkedHashSet triggers = new LinkedHashSet(); + + for (ITriggerProvider provider : triggerProviders) { + provider.addInternalTriggers(triggers, container); + } + + return new ArrayList(triggers); + } + + public static List getInternalActions(IStatementContainer container) { + LinkedHashSet actions = new LinkedHashSet(); + + for (IActionProvider provider : actionProviders) { + provider.addInternalActions(actions, container); + } + + return new ArrayList(actions); + } + + public static List getInternalSidedTriggers(IStatementContainer container, EnumFacing side) { + LinkedHashSet triggers = new LinkedHashSet(); + + for (ITriggerProvider provider : triggerProviders) { + provider.addInternalSidedTriggers(triggers, container, side); + } + + return new ArrayList(triggers); + } + + public static List getInternalSidedActions(IStatementContainer container, EnumFacing side) { + LinkedHashSet actions = new LinkedHashSet(); + + for (IActionProvider provider : actionProviders) { + provider.addInternalSidedActions(actions, container, side); + } + + return new ArrayList(actions); + } + + public static IStatementParameter createParameter(String kind) { + return createParameter(parameters.get(kind)); + } + + private static IStatementParameter createParameter(Class param) { + if (param == null) { + return null; + } + + try { + return param.newInstance(); + } catch (InstantiationException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (Error error) { + BCLog.logErrorAPI(error, IStatementParameter.class); + throw error; + } + + return null; + } +} diff --git a/src/api/java/buildcraft/api/statements/StatementMouseClick.java b/src/api/java/buildcraft/api/statements/StatementMouseClick.java new file mode 100755 index 000000000..c39ed336f --- /dev/null +++ b/src/api/java/buildcraft/api/statements/StatementMouseClick.java @@ -0,0 +1,23 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.statements; + +public final class StatementMouseClick { + private int button; + private boolean shift; + + public StatementMouseClick(int button, boolean shift) { + this.button = button; + this.shift = shift; + } + + public boolean isShift() { + return shift; + } + + public int getButton() { + return button; + } +} diff --git a/src/api/java/buildcraft/api/statements/StatementParameterItemStack.java b/src/api/java/buildcraft/api/statements/StatementParameterItemStack.java new file mode 100755 index 000000000..5ed9c4088 --- /dev/null +++ b/src/api/java/buildcraft/api/statements/StatementParameterItemStack.java @@ -0,0 +1,108 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.statements; + +import java.util.Objects; + +import javax.annotation.Nonnull; + +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class StatementParameterItemStack implements IStatementParameter { + // needed because ItemStack.EMPTY doesn't have @Nonnull applied to it :/ + @Nonnull + private static final ItemStack EMPTY_STACK; + + static { + ItemStack stack = ItemStack.EMPTY; + if (stack == null) throw new Error("Somehow ItemStack.EMPTY was null!"); + EMPTY_STACK = stack; + } + + @Nonnull + protected ItemStack stack = EMPTY_STACK; + + @Override + public TextureAtlasSprite getGuiSprite() { + return null; + } + + @Override + public ItemStack getItemStack() { + return stack; + } + + @Override + public boolean onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse) { + if (stack != null) { + this.stack = stack.copy(); + this.stack.setCount(1); + } else { + this.stack = EMPTY_STACK; + } + return true; + } + + @Override + public void writeToNBT(NBTTagCompound compound) { + if (!stack.isEmpty()) { + NBTTagCompound tagCompound = new NBTTagCompound(); + stack.writeToNBT(tagCompound); + compound.setTag("stack", tagCompound); + } + } + + @Override + public void readFromNBT(NBTTagCompound compound) { + ItemStack read = new ItemStack(compound.getCompoundTag("stack")); + if (read.isEmpty()) { + stack = EMPTY_STACK; + } else { + stack = read; + } + } + + @Override + public boolean equals(Object object) { + if (object instanceof StatementParameterItemStack) { + StatementParameterItemStack param = (StatementParameterItemStack) object; + + return ItemStack.areItemStacksEqual(stack, param.stack) && ItemStack.areItemStackTagsEqual(stack, param.stack); + } else { + return false; + } + } + + @Override + public int hashCode() { + return Objects.hashCode(stack); + } + + @Override + public String getDescription() { + if (stack.isEmpty()) { + return ""; + } else { + return stack.getDisplayName(); + } + } + + @Override + public String getUniqueTag() { + return "buildcraft:stack"; + } + + @Override + public IStatementParameter rotateLeft() { + return this; + } + + @Override + public IStatementParameter[] getPossible(IStatementContainer source, IStatement stmt) { + return null; + } +} diff --git a/src/api/java/buildcraft/api/statements/StatementSlot.java b/src/api/java/buildcraft/api/statements/StatementSlot.java new file mode 100755 index 000000000..b3306b4bd --- /dev/null +++ b/src/api/java/buildcraft/api/statements/StatementSlot.java @@ -0,0 +1,45 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents + * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ +package buildcraft.api.statements; + +import java.util.Arrays; +import java.util.Objects; + +import buildcraft.api.core.EnumPipePart; + +public class StatementSlot { + public IStatement statement; + public IStatementParameter[] parameters; + public EnumPipePart part = EnumPipePart.CENTER; + + @Override + public boolean equals(Object o) { + if (!(o instanceof StatementSlot)) { + return false; + } + StatementSlot s = (StatementSlot) o; + if (s.statement != statement || parameters.length != s.parameters.length) { + return false; + } + for (int i = 0; i < parameters.length; i++) { + IStatementParameter p1 = parameters[i]; + IStatementParameter p2 = s.parameters[i]; + if (p1 == null) { + if (p2 != null) return false; + continue; + } + if (p2 == null) return false; + if (!(p1.equals(p2))) { + return false; + } + } + return true; + } + + @Override + public int hashCode() { + return Objects.hash(statement, Arrays.deepHashCode(parameters)); + } +} diff --git a/src/api/java/buildcraft/api/statements/containers/IRedstoneStatementContainer.java b/src/api/java/buildcraft/api/statements/containers/IRedstoneStatementContainer.java new file mode 100755 index 000000000..1d7989aa0 --- /dev/null +++ b/src/api/java/buildcraft/api/statements/containers/IRedstoneStatementContainer.java @@ -0,0 +1,17 @@ +package buildcraft.api.statements.containers; + +import net.minecraft.util.EnumFacing; + +public interface IRedstoneStatementContainer { + /** Get the redstone input from a given side. + * + * @param side The side - use "null" for maximum input. + * @return The redstone input, from 0 to 15. */ + int getRedstoneInput(EnumFacing side); + + /** Set the redstone input for a given side. + * + * @param side The side - use "null" for all sides. + * @return Whether the set was successful. */ + boolean setRedstoneOutput(EnumFacing side, int value); +} diff --git a/src/api/java/buildcraft/api/statements/containers/ISidedStatementContainer.java b/src/api/java/buildcraft/api/statements/containers/ISidedStatementContainer.java new file mode 100755 index 000000000..b65ace45a --- /dev/null +++ b/src/api/java/buildcraft/api/statements/containers/ISidedStatementContainer.java @@ -0,0 +1,10 @@ +package buildcraft.api.statements.containers; + +import net.minecraft.util.EnumFacing; + +import buildcraft.api.statements.IStatementContainer; + +/** Created by asie on 3/14/15. */ +public interface ISidedStatementContainer extends IStatementContainer { + EnumFacing getSide(); +} diff --git a/src/api/java/buildcraft/api/statements/package-info.java b/src/api/java/buildcraft/api/statements/package-info.java new file mode 100755 index 000000000..7dd2c74e6 --- /dev/null +++ b/src/api/java/buildcraft/api/statements/package-info.java @@ -0,0 +1,8 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +@API(apiVersion = "1.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|statements") +package buildcraft.api.statements; + +import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/tablet/ITablet.java b/src/api/java/buildcraft/api/tablet/ITablet.java new file mode 100755 index 000000000..e88a4cf36 --- /dev/null +++ b/src/api/java/buildcraft/api/tablet/ITablet.java @@ -0,0 +1,19 @@ +package buildcraft.api.tablet; + +import net.minecraft.nbt.NBTTagCompound; + +import net.minecraftforge.fml.relauncher.Side; + +public interface ITablet { + Side getSide(); + + void refreshScreen(TabletBitmap data); + + int getScreenWidth(); + + int getScreenHeight(); + + void launchProgram(String name); + + void sendMessage(NBTTagCompound compound); +} diff --git a/src/api/java/buildcraft/api/tablet/TabletAPI.java b/src/api/java/buildcraft/api/tablet/TabletAPI.java new file mode 100755 index 000000000..529862790 --- /dev/null +++ b/src/api/java/buildcraft/api/tablet/TabletAPI.java @@ -0,0 +1,20 @@ +package buildcraft.api.tablet; + +import java.util.HashMap; +import java.util.Map; + +public final class TabletAPI { + private static final Map programs = new HashMap(); + + private TabletAPI() { + + } + + public static void registerProgram(TabletProgramFactory factory) { + programs.put(factory.getName(), factory); + } + + public static TabletProgramFactory getProgram(String name) { + return programs.get(name); + } +} diff --git a/src/api/java/buildcraft/api/tablet/TabletBitmap.java b/src/api/java/buildcraft/api/tablet/TabletBitmap.java new file mode 100755 index 000000000..82b236b9f --- /dev/null +++ b/src/api/java/buildcraft/api/tablet/TabletBitmap.java @@ -0,0 +1,55 @@ +package buildcraft.api.tablet; + +public class TabletBitmap { + public final int width, height; + protected int[] data; + + public TabletBitmap(int width, int height) { + this.width = width; + this.height = height; + this.data = new int[width * height]; + } + + public TabletBitmap(ITablet tablet) { + this(tablet.getScreenWidth(), tablet.getScreenHeight()); + } + + public int[] getData() { + return data; + } + + public int get(int x, int y) { + if (x < 0 || y < 0 || x >= width || y >= height) { + return 0; + } + return data[y * width + x]; + } + + public void set(int x, int y, int shade) { + if (x < 0 || y < 0 || x >= width || y >= height) { + return; + } + data[y * width + x] = shade; + } + + public void set(int x, int y, TabletBitmap bitmap) { + for (int i = 0; i < bitmap.height; i++) { + if (i >= height) { + break; + } + for (int h = 0; h < bitmap.width; h++) { + if (h >= width) { + break; + } + + set(x + h, y + i, bitmap.get(h, i)); + } + } + } + + public TabletBitmap duplicate() { + TabletBitmap cloned = new TabletBitmap(this.width, this.height); + cloned.data = this.data.clone(); + return cloned; + } +} diff --git a/src/api/java/buildcraft/api/tablet/TabletProgram.java b/src/api/java/buildcraft/api/tablet/TabletProgram.java new file mode 100755 index 000000000..ea098f47c --- /dev/null +++ b/src/api/java/buildcraft/api/tablet/TabletProgram.java @@ -0,0 +1,17 @@ +package buildcraft.api.tablet; + +import net.minecraft.nbt.NBTTagCompound; + +public abstract class TabletProgram { + public void tick(float time) { + + } + + public boolean hasEnded() { + return false; + } + + public void receiveMessage(NBTTagCompound compound) { + + } +} diff --git a/src/api/java/buildcraft/api/tablet/TabletProgramFactory.java b/src/api/java/buildcraft/api/tablet/TabletProgramFactory.java new file mode 100755 index 000000000..8f3bb414c --- /dev/null +++ b/src/api/java/buildcraft/api/tablet/TabletProgramFactory.java @@ -0,0 +1,19 @@ +package buildcraft.api.tablet; + +public abstract class TabletProgramFactory { + /** Create an instance of the tablet program specified by this Factory. + * + * Both parameters are mutable and can be edited freely; however, the NBTTagCompound will only be synchronized after + * you leave the program. + * + * Please note that the program runs client-side SOLELY. For server-side queries, you must implement a custom + * communications protocol. + * + * @param tablet + * @return An instance of the TabletProgram. */ + public abstract TabletProgram create(ITablet tablet); + + public abstract String getName(); + + public abstract TabletBitmap getIcon(); +} diff --git a/src/api/java/buildcraft/api/tablet/TabletTicker.java b/src/api/java/buildcraft/api/tablet/TabletTicker.java new file mode 100755 index 000000000..33656fb80 --- /dev/null +++ b/src/api/java/buildcraft/api/tablet/TabletTicker.java @@ -0,0 +1,36 @@ +package buildcraft.api.tablet; + +/** Utility class for capturing tablet ticks every X seconds. */ +public class TabletTicker { + private final float tickTime; + private float time = 0.0F; + private int ticked = 0; + + public TabletTicker(float tickTime) { + this.tickTime = tickTime; + } + + public void add(float time) { + this.time += time; + + while (this.time >= tickTime) { + this.time -= tickTime; + ticked++; + } + } + + public int getTicks() { + return ticked; + } + + public boolean tick() { + boolean oldTicked = ticked > 0; + ticked = 0; + return oldTicked; + } + + public void reset() { + ticked = 0; + time = 0; + } +} diff --git a/src/api/java/buildcraft/api/tablet/package-info.java b/src/api/java/buildcraft/api/tablet/package-info.java new file mode 100755 index 000000000..cc87d8657 --- /dev/null +++ b/src/api/java/buildcraft/api/tablet/package-info.java @@ -0,0 +1,8 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|tablet") +package buildcraft.api.tablet; + +import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/tiles/IControllable.java b/src/api/java/buildcraft/api/tiles/IControllable.java new file mode 100755 index 000000000..633d1fc28 --- /dev/null +++ b/src/api/java/buildcraft/api/tiles/IControllable.java @@ -0,0 +1,37 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.tiles; + +/** This interface should be implemented by any Tile Entity which wishes to have non-redstone automation (for example, + * BuildCraft Gates, but also other mods which implement it, e.g. OpenComputers). */ +public interface IControllable { + public enum Mode { + Unknown, + On, + Off, + Mode, + Loop; + + public static final Mode[] VALUES = values(); + public static final Mode[] VALID_VALUES = { On, Off, Loop }; + } + + /** Get the current control mode of the Tile Entity. + * + * @return */ + Mode getControlMode(); + + /** Set the mode of the Tile Entity. + * + * @param mode */ + void setControlMode(Mode mode); + + /** Check if a given control mode is accepted. If you query IControllable tiles, you MUST check with + * acceptsControlMode first. + * + * @param mode + * @return True if this control mode is accepted. */ + boolean acceptsControlMode(Mode mode); +} diff --git a/src/api/java/buildcraft/api/tiles/IDebuggable.java b/src/api/java/buildcraft/api/tiles/IDebuggable.java new file mode 100755 index 000000000..4e5cb3d5d --- /dev/null +++ b/src/api/java/buildcraft/api/tiles/IDebuggable.java @@ -0,0 +1,17 @@ +package buildcraft.api.tiles; + +import java.util.List; + +import net.minecraft.util.EnumFacing; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public interface IDebuggable { + /** Get the debug information from a tile entity as a list of strings, used for the F3 debug menu. The left and + * right parameters correspond to the sides of the F3 screen. + * + * @param side The side the block was clicked on, may be null if we don't know, or is the "centre" side */ + @SideOnly(Side.CLIENT) + void getDebugInfo(List left, List right, EnumFacing side); +} diff --git a/src/api/java/buildcraft/api/tiles/IHasWork.java b/src/api/java/buildcraft/api/tiles/IHasWork.java new file mode 100755 index 000000000..fa8719644 --- /dev/null +++ b/src/api/java/buildcraft/api/tiles/IHasWork.java @@ -0,0 +1,14 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.tiles; + +/** This interface should be implemented by any Tile Entity which carries out work (crafting, ore processing, mining, et + * cetera). */ +public interface IHasWork { + /** Check if the Tile Entity is currently doing any work. + * + * @return True if the Tile Entity is doing work. */ + boolean hasWork(); +} diff --git a/src/api/java/buildcraft/api/tiles/IHeatable.java b/src/api/java/buildcraft/api/tiles/IHeatable.java new file mode 100755 index 000000000..1af6d6b59 --- /dev/null +++ b/src/api/java/buildcraft/api/tiles/IHeatable.java @@ -0,0 +1,26 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.tiles; + +/** This interface should be implemented by Tile Entities which have an internal heat value. */ +public interface IHeatable { + /** @return The minimum heat value, in degrees. */ + double getMinHeatValue(); + + /** @return The preferred heat value, in degrees. */ + double getIdealHeatValue(); + + /** @return The maxmimum heat value, in degrees. */ + double getMaxHeatValue(); + + /** @return The current heat value, in degrees. */ + double getCurrentHeatValue(); + + /** Set the heat of the tile. + * + * @param value Heat value, in degrees. + * @return The heat the tile has after the set. */ + double setHeatValue(double value); +} diff --git a/src/api/java/buildcraft/api/tiles/ITileAreaProvider.java b/src/api/java/buildcraft/api/tiles/ITileAreaProvider.java new file mode 100755 index 000000000..89a7c1456 --- /dev/null +++ b/src/api/java/buildcraft/api/tiles/ITileAreaProvider.java @@ -0,0 +1,10 @@ +package buildcraft.api.tiles; + +import net.minecraft.util.math.BlockPos; + +import buildcraft.api.core.IAreaProvider; + +/** Used for more fine-grained control of whether or not a machine connects to the provider here. */ +public interface ITileAreaProvider extends IAreaProvider { + boolean isValidFromLocation(BlockPos pos); +} diff --git a/src/api/java/buildcraft/api/tiles/package-info.java b/src/api/java/buildcraft/api/tiles/package-info.java new file mode 100755 index 000000000..d4c217fc3 --- /dev/null +++ b/src/api/java/buildcraft/api/tiles/package-info.java @@ -0,0 +1,8 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +@API(apiVersion = "1.2", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|tiles") +package buildcraft.api.tiles; + +import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/tools/IToolWrench.java b/src/api/java/buildcraft/api/tools/IToolWrench.java index 74aaa7e6e..9201b5560 100755 --- a/src/api/java/buildcraft/api/tools/IToolWrench.java +++ b/src/api/java/buildcraft/api/tools/IToolWrench.java @@ -4,30 +4,29 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.tools; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.math.BlockPos; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.RayTraceResult; /*** Implement this interface on subclasses of Item to have that item work as a wrench for buildcraft */ public interface IToolWrench { - /*** Called to ensure that the wrench can be used. To get the ItemStack that is used, check - * player.inventory.getCurrentItem() + /*** Called to ensure that the wrench can be used. * * @param player - The player doing the wrenching - * @param pos - The coordinates for the block being wrenched + * @param hand - Which hand was holding the wrench + * @param wrench - The item stack that holds the wrench + * @param rayTrace - The object that is being wrenched * * @return true if wrenching is allowed, false if not */ - boolean canWrench(EntityPlayer player, BlockPos pos); + boolean canWrench(EntityPlayer player, EnumHand hand, ItemStack wrench, RayTraceResult rayTrace); - /*** Callback after the wrench has been used. This can be used to decrease durability or for other purposes. To get - * the ItemStack that was used, check player.inventory.getCurrentItem() + /*** Callback after the wrench has been used. This can be used to decrease durability or for other purposes. * * @param player - The player doing the wrenching - * @param pos - The position of the block being wrenched */ - void wrenchUsed(EntityPlayer player, BlockPos pos); - - boolean canWrench(EntityPlayer player, Entity entity); - - void wrenchUsed(EntityPlayer player, Entity entity); + * @param hand - Which hand was holding the wrench + * @param wrench - The item stack that holds the wrench + * @param rayTrace - The object that is being wrenched */ + void wrenchUsed(EntityPlayer player, EnumHand hand, ItemStack wrench, RayTraceResult rayTrace); } diff --git a/src/api/java/buildcraft/api/transport/EnumWirePart.java b/src/api/java/buildcraft/api/transport/EnumWirePart.java new file mode 100755 index 000000000..6b9e983d2 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/EnumWirePart.java @@ -0,0 +1,80 @@ +package buildcraft.api.transport; + +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumFacing.AxisDirection; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.Vec3d; + +public enum EnumWirePart { + EAST_UP_SOUTH(true, true, true), + EAST_UP_NORTH(true, true, false), + EAST_DOWN_SOUTH(true, false, true), + EAST_DOWN_NORTH(true, false, false), + WEST_UP_SOUTH(false, true, true), + WEST_UP_NORTH(false, true, false), + WEST_DOWN_SOUTH(false, false, true), + WEST_DOWN_NORTH(false, false, false); + + public static final EnumWirePart[] VALUES = values(); + + public final AxisDirection x, y, z; + + /** The bounding box for rendering a wire or selecting an already-placed wire. */ + public final AxisAlignedBB boundingBox; + + /** The bounding box that is used when adding pipe wire to a pipe */ + public final AxisAlignedBB boundingBoxPossible; + + EnumWirePart(boolean x, boolean y, boolean z) { + this.x = x ? AxisDirection.POSITIVE : AxisDirection.NEGATIVE; + this.y = y ? AxisDirection.POSITIVE : AxisDirection.NEGATIVE; + this.z = z ? AxisDirection.POSITIVE : AxisDirection.NEGATIVE; + double x1 = this.x.getOffset() * (5 / 16.0) + 0.5; + double y1 = this.y.getOffset() * (5 / 16.0) + 0.5; + double z1 = this.z.getOffset() * (5 / 16.0) + 0.5; + double x2 = this.x.getOffset() * (4 / 16.0) + 0.5; + double y2 = this.y.getOffset() * (4 / 16.0) + 0.5; + double z2 = this.z.getOffset() * (4 / 16.0) + 0.5; + this.boundingBox = new AxisAlignedBB(x1, y1, z1, x2, y2, z2); + + Vec3d center = new Vec3d(0.5, 0.5, 0.5); + Vec3d edge = new Vec3d(x ? 0.75 : 0.25, y ? 0.75 : 0.25, z ? 0.75 : 0.25); + this.boundingBoxPossible = new AxisAlignedBB(center.xCoord, center.yCoord, center.zCoord, edge.xCoord, edge.yCoord, edge.zCoord); + } + + public AxisDirection getDirection(EnumFacing.Axis axis) { + switch (axis) { + case X: + return x; + case Y: + return y; + case Z: + return z; + } + return null; + } + + public static EnumWirePart get(int x, int y, int z) { + return get(// + (x % 2 + 2) % 2 == 1,// + (y % 2 + 2) % 2 == 1,// + (z % 2 + 2) % 2 == 1 // + ); + } + + public static EnumWirePart get(boolean x, boolean y, boolean z) { + if (x) { + if (y) { + return z ? EAST_UP_SOUTH : EAST_UP_NORTH; + } else { + return z ? EAST_DOWN_SOUTH : EAST_DOWN_NORTH; + } + } else { + if (y) { + return z ? WEST_UP_SOUTH : WEST_UP_NORTH; + } else { + return z ? WEST_DOWN_SOUTH : WEST_DOWN_NORTH; + } + } + } +} diff --git a/src/api/java/buildcraft/api/transport/IInjectable.java b/src/api/java/buildcraft/api/transport/IInjectable.java new file mode 100755 index 000000000..0292ae2ef --- /dev/null +++ b/src/api/java/buildcraft/api/transport/IInjectable.java @@ -0,0 +1,28 @@ +package buildcraft.api.transport; + +import javax.annotation.Nonnull; + +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; + +/** Interface for pipes to implement if they can accept items in a similar fashion to BC pipes. */ +// TODO: Forge Capability! +public interface IInjectable { + /** Tests to see if this pipe can accept items from the given direction. Useless to call this if you are going to + * call {@link #injectItem(ItemStack, boolean, EnumFacing, EnumDyeColor, double)} straight after. */ + boolean canInjectItems(EnumFacing from); + + /** Offers an ItemStack for addition to the pipe. Will be rejected if the pipe doesn't accept items from that side. + * This should never be called on the client side! Implementors are free to throw an exception if be called on the + * client side. + * + * @param stack ItemStack offered for addition. Do not manipulate this! + * @param doAdd If false no actual addition should take place. Implementors should simulate. + * @param from Orientation the ItemStack is offered from. + * @param color The color of the item to be added to the pipe, or null for no color. + * @param speed The speed of the item to be added (in blocks per tick) or {@code <=0} if a default should be used. + * @return The left over stack that was not accepted. */ + @Nonnull + ItemStack injectItem(@Nonnull ItemStack stack, boolean doAdd, EnumFacing from, EnumDyeColor color, double speed); +} diff --git a/src/api/java/buildcraft/api/transport/IItemPluggable.java b/src/api/java/buildcraft/api/transport/IItemPluggable.java new file mode 100755 index 000000000..f18df6344 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/IItemPluggable.java @@ -0,0 +1,22 @@ +package buildcraft.api.transport; + +import javax.annotation.Nonnull; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; + +import buildcraft.api.transport.pipe.IPipeHolder; +import buildcraft.api.transport.pluggable.PipePluggable; + +/** Designates an item that can be placed onto a pipe as a {@link PipePluggable}. */ +public interface IItemPluggable { + /** Called when this item is placed onto a pipe holder. This can return null if this item does not make a valid + * pluggable. Note that if you return a non-null pluggable then it will *definatly* be added to the pipe, and you + * are responsible for making all the effects yourself (like the sound effect). + * + * @param stack The stack that holds this item + * @param holder The pipe holder + * @param side The side that the pluggable should be placed on + * @return A pluggable to place onto the pipe */ + PipePluggable onPlace(@Nonnull ItemStack stack, IPipeHolder holder, EnumFacing side); +} diff --git a/src/api/java/buildcraft/api/transport/IStripesActivator.java b/src/api/java/buildcraft/api/transport/IStripesActivator.java new file mode 100755 index 000000000..a0dd7c878 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/IStripesActivator.java @@ -0,0 +1,16 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.transport; + +import javax.annotation.Nonnull; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; + +public interface IStripesActivator { + boolean sendItem(@Nonnull ItemStack itemStack, EnumFacing from); + + void dropItem(@Nonnull ItemStack itemStack, EnumFacing from); +} diff --git a/src/api/java/buildcraft/api/transport/IStripesHandlerBlock.java b/src/api/java/buildcraft/api/transport/IStripesHandlerBlock.java new file mode 100755 index 000000000..888cac43e --- /dev/null +++ b/src/api/java/buildcraft/api/transport/IStripesHandlerBlock.java @@ -0,0 +1,18 @@ +package buildcraft.api.transport; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +public interface IStripesHandlerBlock { + + /** @param world + * @param pos + * @param direction + * @param player + * @param activator + * @return True if this broke a block, false otherwise (note that this handler MUST NOT return false if it has + * changed the world in any way) */ + boolean handle(World world, BlockPos pos, EnumFacing direction, EntityPlayer player, IStripesActivator activator); +} diff --git a/src/api/java/buildcraft/api/transport/IStripesHandlerItem.java b/src/api/java/buildcraft/api/transport/IStripesHandlerItem.java new file mode 100755 index 000000000..6512be8cb --- /dev/null +++ b/src/api/java/buildcraft/api/transport/IStripesHandlerItem.java @@ -0,0 +1,30 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.transport; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +public interface IStripesHandlerItem { + + /** Called to handle the given {@link ItemStack} within the world. Note that the player's inventory will be empty, + * except that the target stack will be set into its {@link EnumHand#MAIN_HAND}. Any items left in the players + * inventory will be returned back through the activator with + * {@link IStripesActivator#sendItem(ItemStack, EnumFacing)} + * + * @param world + * @param pos + * @param direction + * @param stack The {@link ItemStack} being used + * @param player + * @param activator + * @return True if this used the item, false otherwise (note that this handler MUST NOT return false if it has + * changed the world in any way) */ + boolean handle(World world, BlockPos pos, EnumFacing direction, ItemStack stack, EntityPlayer player, IStripesActivator activator); +} diff --git a/src/api/java/buildcraft/api/transport/IStripesRegistry.java b/src/api/java/buildcraft/api/transport/IStripesRegistry.java new file mode 100755 index 000000000..73e881993 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/IStripesRegistry.java @@ -0,0 +1,36 @@ +package buildcraft.api.transport; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +public interface IStripesRegistry { + + /** Adds a handler with a {@link HandlerPriority} of {@linkplain HandlerPriority#NORMAL NORMAL} */ + void addHandler(IStripesHandlerItem handler); + + void addHandler(IStripesHandlerItem handler, HandlerPriority priority); + + /** Adds a handler with a {@link HandlerPriority} of {@linkplain HandlerPriority#NORMAL NORMAL} */ + void addHandler(IStripesHandlerBlock handler); + + void addHandler(IStripesHandlerBlock handler, HandlerPriority priority); + + /** @param pos The position of the stripes pipe. + * @return True if a handler handled the itemstack, false otherwise (and so nothing has been done) */ + boolean handleItem(World world, BlockPos pos, EnumFacing direction, ItemStack stack, EntityPlayer player, IStripesActivator activator); + + /** @return True if a handler broke a block, false otherwise (and so nothing has been done) */ + boolean handleBlock(World world, BlockPos pos, EnumFacing direction, EntityPlayer player, IStripesActivator activator); + + // TODO: Ensure that this method really will work better than an integer for priorities. + public enum HandlerPriority { + HIGHEST, + HIGH, + NORMAL, + LOW, + LOWEST + } +} diff --git a/src/api/java/buildcraft/api/transport/IWireManager.java b/src/api/java/buildcraft/api/transport/IWireManager.java new file mode 100755 index 000000000..942c3ab58 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/IWireManager.java @@ -0,0 +1,24 @@ +package buildcraft.api.transport; + +import net.minecraft.item.EnumDyeColor; + +import buildcraft.api.transport.pipe.IPipeHolder; + +public interface IWireManager { + + IPipeHolder getHolder(); + + void updateBetweens(boolean recursive); + + EnumDyeColor getColorOfPart(EnumWirePart part); + + EnumDyeColor removePart(EnumWirePart part); + + boolean addPart(EnumWirePart part, EnumDyeColor colour); + + boolean hasPartOfColor(EnumDyeColor color); + + boolean isPowered(EnumWirePart part); + + boolean isAnyPowered(EnumDyeColor color); +} diff --git a/src/api/java/buildcraft/api/transport/WireNode.java b/src/api/java/buildcraft/api/transport/WireNode.java new file mode 100755 index 000000000..5430b6438 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/WireNode.java @@ -0,0 +1,61 @@ +package buildcraft.api.transport; + +import java.util.EnumMap; +import java.util.Map; + +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumFacing.AxisDirection; +import net.minecraft.util.math.BlockPos; + +public class WireNode { + public final BlockPos pos; + public final EnumWirePart part; + private final int hash; + + public WireNode(BlockPos pos, EnumWirePart part) { + this.pos = pos; + this.part = part; + hash = pos.hashCode() * 31 + part.hashCode(); + } + + @Override + public int hashCode() { + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + WireNode other = (WireNode) obj; + return part == other.part // + && pos.equals(other.pos); + } + + @Override + public String toString() { + return "(" + pos.getX() + ", " + pos.getY() + ", " + pos.getZ() + ", " + part + ")"; + } + + public WireNode offset(EnumFacing face) { + int nx = (part.x == AxisDirection.POSITIVE ? 1 : 0) + face.getFrontOffsetX(); + int ny = (part.y == AxisDirection.POSITIVE ? 1 : 0) + face.getFrontOffsetY(); + int nz = (part.z == AxisDirection.POSITIVE ? 1 : 0) + face.getFrontOffsetZ(); + EnumWirePart nPart = EnumWirePart.get(nx, ny, nz); + if (nx < 0 || ny < 0 || nz < 0 || nx > 1 || ny > 1 || nz > 1) { + return new WireNode(pos.offset(face), nPart); + } else { + return new WireNode(pos, nPart); + } + } + + public Map getAllPossibleConnections() { + Map map = new EnumMap<>(EnumFacing.class); + + for (EnumFacing face : EnumFacing.VALUES) { + map.put(face, offset(face)); + } + return map; + } +} diff --git a/src/api/java/buildcraft/api/transport/package-info.java b/src/api/java/buildcraft/api/transport/package-info.java new file mode 100755 index 000000000..004c271a1 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/package-info.java @@ -0,0 +1,8 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +@API(apiVersion = "5.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|transport") +package buildcraft.api.transport; + +import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/transport/pipe/ICustomPipeConnection.java b/src/api/java/buildcraft/api/transport/pipe/ICustomPipeConnection.java new file mode 100755 index 000000000..ded7b2e22 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/ICustomPipeConnection.java @@ -0,0 +1,13 @@ +package buildcraft.api.transport.pipe; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +public interface ICustomPipeConnection { + /** @return How long the connecting pipe should extend for, in addition to its normal 4/16f connection. Values less + * than or equal to -4/16 indicate that the pipe will not connect at all, and will render as it it was not + * connected. */ + public float getExtension(World world, BlockPos pos, EnumFacing face, IBlockState state); +} diff --git a/src/api/java/buildcraft/api/transport/pipe/IFlowFluid.java b/src/api/java/buildcraft/api/transport/pipe/IFlowFluid.java new file mode 100755 index 000000000..25bc329ca --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/IFlowFluid.java @@ -0,0 +1,25 @@ +package buildcraft.api.transport.pipe; + +import net.minecraft.util.EnumFacing; + +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.capability.IFluidHandler; + +import buildcraft.api.core.IFluidFilter; + +public interface IFlowFluid { + /** @param millibuckets + * @param from + * @param filter The fluidstack that the extracted fluid must match, or null for any fluid. + * @return The fluidstack extracted and inserted into the pipe. */ + FluidStack tryExtractFluid(int millibuckets, EnumFacing from, FluidStack filter); + + /** Advanced version of {@link #tryExtractFluid(int, EnumFacing, FluidStack)}. Note that this only works for + * instances of {@link IFluidHandler} that ALSO extends IFluidHandlerAdv + * + * @param millibuckets + * @param from + * @param filter A filter to try and match fluids. + * @return The fluidstack extracted and inserted into the pipe. */ + FluidStack tryExtractFluidAdv(int millibuckets, EnumFacing from, IFluidFilter filter); +} diff --git a/src/api/java/buildcraft/api/transport/pipe/IFlowItems.java b/src/api/java/buildcraft/api/transport/pipe/IFlowItems.java new file mode 100755 index 000000000..91a8b3afa --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/IFlowItems.java @@ -0,0 +1,32 @@ +package buildcraft.api.transport.pipe; + +import javax.annotation.Nonnull; + +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; + +import buildcraft.api.core.IStackFilter; +import buildcraft.api.transport.IInjectable; + +public interface IFlowItems extends IInjectable { + /** Attempts to extract items from the inventory connected to this pipe on the given side. + * + * @param count The maximum number of items to extract + * @param from The direction to extract from. + * @param colour The colour that extracted items should be painted. + * @param filter The filter to determine what can be extracted. + * @return The number of items extracted. */ + int tryExtractItems(int count, EnumFacing from, EnumDyeColor colour, IStackFilter filter); + + /** Inserts an item directly into the centre of this pipe, going in the given direction. This should ONLY be called + * from an instance of {@link PipeBehaviour}, as otherwise it can lead to problems. (For example crashing if a pipe + * contains an item that the pipe behaviour doesn't expect). + * + * @param stack ItemStack offered for addition. Do not manipulate this! + * @param from Orientation the ItemStack should pretend to be coming from. + * @param colour The colour of the item to be added to the pipe, or null for no colour. + * @param speed The speed of the item to be added (in blocks per tick) or {@code <=0} if a default should be + * used. */ + void insertItemsForce(@Nonnull ItemStack stack, EnumFacing from, EnumDyeColor colour, double speed); +} diff --git a/src/api/java/buildcraft/api/transport/pipe/IFlowPower.java b/src/api/java/buildcraft/api/transport/pipe/IFlowPower.java new file mode 100755 index 000000000..051d0ad1c --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/IFlowPower.java @@ -0,0 +1,17 @@ +package buildcraft.api.transport.pipe; + +import net.minecraft.util.EnumFacing; + +import buildcraft.api.mj.IMjPassiveProvider; + +public interface IFlowPower { + /** Makes this pipe reconfigure itself, possibly due to the addition of new modules. */ + void reconfigure(); + + /** Attempts to extract power from the {@link IMjPassiveProvider} connected to this pipe on the given side. + * + * @param maxPower The Maximum amount of power that can be extracted. + * @param from The side (of this pipe) to take power from. + * @return The amount of power extracted. */ + long tryExtractPower(long maxPower, EnumFacing from); +} diff --git a/src/api/java/buildcraft/api/transport/pipe/IItemPipe.java b/src/api/java/buildcraft/api/transport/pipe/IItemPipe.java new file mode 100755 index 000000000..fbff67747 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/IItemPipe.java @@ -0,0 +1,7 @@ +package buildcraft.api.transport.pipe; + +/** To be implemented by the real item pipe in Transport mod, but leaves knowledge for classes that do not have direct + * dependency on transport. */ +public interface IItemPipe { + PipeDefinition getDefiniton(); +} diff --git a/src/api/java/buildcraft/api/transport/pipe/IPipe.java b/src/api/java/buildcraft/api/transport/pipe/IPipe.java new file mode 100755 index 000000000..2a7a15c30 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/IPipe.java @@ -0,0 +1,36 @@ +package buildcraft.api.transport.pipe; + +import net.minecraft.item.EnumDyeColor; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; + +import net.minecraftforge.common.capabilities.ICapabilityProvider; + +public interface IPipe extends ICapabilityProvider { + IPipeHolder getHolder(); + + PipeDefinition getDefinition(); + + PipeBehaviour getBehaviour(); + + PipeFlow getFlow(); + + EnumDyeColor getColour(); + + void setColour(EnumDyeColor colour); + + void markForUpdate(); + + TileEntity getConnectedTile(EnumFacing side); + + IPipe getConnectedPipe(EnumFacing side); + + boolean isConnected(EnumFacing side); + + ConnectedType getConnectedType(EnumFacing side); + + public enum ConnectedType { + TILE, + PIPE; + } +} diff --git a/src/api/java/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java b/src/api/java/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java new file mode 100755 index 000000000..f981c9ea2 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java @@ -0,0 +1,11 @@ +package buildcraft.api.transport.pipe; + +import net.minecraft.client.renderer.VertexBuffer; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public interface IPipeBehaviourRenderer { + void render(B behaviour, double x, double y, double z, float partialTicks, VertexBuffer vb); +} diff --git a/src/api/java/buildcraft/api/transport/pipe/IPipeConnection.java b/src/api/java/buildcraft/api/transport/pipe/IPipeConnection.java new file mode 100755 index 000000000..55a514286 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/IPipeConnection.java @@ -0,0 +1,26 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.api.transport.pipe; + +import net.minecraft.util.EnumFacing; + +@Deprecated +// TODO: Test to see if this is necessary! (Or perhaps make it a capability) +public interface IPipeConnection { + + enum ConnectOverride { + + CONNECT, + DISCONNECT, + DEFAULT + } + + /** Allows you to override pipe connection logic. + * + * @param type + * @param with + * @return CONNECT to force a connection, DISCONNECT to force no connection, and DEFAULT to let the pipe decide. */ + ConnectOverride overridePipeConnection(Object/*IPipeTile.PipeType*/ type, EnumFacing with); +} diff --git a/src/api/java/buildcraft/api/transport/pipe/IPipeFlowRenderer.java b/src/api/java/buildcraft/api/transport/pipe/IPipeFlowRenderer.java new file mode 100755 index 000000000..787f9e99d --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/IPipeFlowRenderer.java @@ -0,0 +1,12 @@ +package buildcraft.api.transport.pipe; + +import net.minecraft.client.renderer.VertexBuffer; + +public interface IPipeFlowRenderer { + /** @param flow The flow to render + * @param x + * @param y + * @param z + * @param vb The (optional) vertex buffer that you can render into. Note that you can still do GL stuff. */ + void render(F flow, double x, double y, double z, float partialTicks, VertexBuffer vb); +} diff --git a/src/api/java/buildcraft/api/transport/pipe/IPipeHolder.java b/src/api/java/buildcraft/api/transport/pipe/IPipeHolder.java new file mode 100755 index 000000000..5ce5173b4 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/IPipeHolder.java @@ -0,0 +1,95 @@ +package buildcraft.api.transport.pipe; + +import com.mojang.authlib.GameProfile; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +import buildcraft.api.statements.containers.IRedstoneStatementContainer; +import buildcraft.api.transport.IWireManager; +import buildcraft.api.transport.pluggable.PipePluggable; + +/** Designates a tile that can contain a pipe, up to 6 sided pluggables. */ +public interface IPipeHolder extends IRedstoneStatementContainer { + World getPipeWorld(); + + BlockPos getPipePos(); + + TileEntity getPipeTile(); + + IPipe getPipe(); + + PipePluggable getPluggable(EnumFacing side); + + TileEntity getNeighbouringTile(EnumFacing side); + + IPipe getNeighbouringPipe(EnumFacing side); + + IWireManager getWireManager(); + + GameProfile getOwner(); + + /** @return True if at least 1 handler received this event, false if not. */ + boolean fireEvent(PipeEvent event); + + void scheduleRenderUpdate(); + + /** @param parts The parts that want to send a network update. */ + void scheduleNetworkUpdate(PipeMessageReceiver... parts); + + /** Schedules a GUI network update, that is only the players who currently have a pipe element open in a GUI will be + * updated. + * + * @param parts The parts that want to send a network update. */ + void scheduleNetworkGuiUpdate(PipeMessageReceiver... parts); + + /** Sends a custom message from a pluggable or pipe centre to the server/client (depending on which side this is + * currently on). */ + void sendMessage(PipeMessageReceiver to, IWriter writer); + + void sendGuiMessage(PipeMessageReceiver to, IWriter writer); + + /** Called on the server whenever a gui container object is opened. */ + void onPlayerOpen(EntityPlayer player); + + /** Called on the server whenever a gui container object is closed. */ + void onPlayerClose(EntityPlayer player); + + public enum PipeMessageReceiver { + BEHAVIOUR(null), + FLOW(null), + PLUGGABLE_DOWN(EnumFacing.DOWN), + PLUGGABLE_UP(EnumFacing.UP), + PLUGGABLE_NORTH(EnumFacing.NORTH), + PLUGGABLE_SOUTH(EnumFacing.SOUTH), + PLUGGABLE_WEST(EnumFacing.WEST), + PLUGGABLE_EAST(EnumFacing.EAST), + WIRES(null); + // Wires are updated differently (they never use this API) + + public static final PipeMessageReceiver[] VALUES = values(); + public static final PipeMessageReceiver[] PLUGGABLES = new PipeMessageReceiver[6]; + + static { + for (PipeMessageReceiver type : VALUES) { + if (type.face != null) { + PLUGGABLES[type.face.ordinal()] = type; + } + } + } + + public final EnumFacing face; + + PipeMessageReceiver(EnumFacing face) { + this.face = face; + } + } + + public interface IWriter { + void write(PacketBuffer buffer); + } +} diff --git a/src/api/java/buildcraft/api/transport/pipe/IPipeRegistry.java b/src/api/java/buildcraft/api/transport/pipe/IPipeRegistry.java new file mode 100755 index 000000000..23672c6bf --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/IPipeRegistry.java @@ -0,0 +1,17 @@ +package buildcraft.api.transport.pipe; + +import net.minecraft.util.ResourceLocation; + +public interface IPipeRegistry { + PipeDefinition getDefinition(ResourceLocation identifier); + + IItemPipe registerPipeAndItem(PipeDefinition definition); + + void registerPipe(PipeDefinition definition); + + void setItemForPipe(PipeDefinition definition, IItemPipe item); + + IItemPipe getItemForPipe(PipeDefinition definition); + + Iterable getAllRegisteredPipes(); +} diff --git a/src/api/java/buildcraft/api/transport/pipe/PipeApi.java b/src/api/java/buildcraft/api/transport/pipe/PipeApi.java new file mode 100755 index 000000000..f401dc48f --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/PipeApi.java @@ -0,0 +1,52 @@ +package buildcraft.api.transport.pipe; + +import java.util.IdentityHashMap; +import java.util.Map; + +import buildcraft.api.transport.IStripesRegistry; +import buildcraft.api.transport.pluggable.IPluggableRegistry; + +/** The central holding class for all pipe related registers and methods. */ +public final class PipeApi { + public static IPipeRegistry pipeRegistry; + public static IPluggableRegistry pluggableRegistry; + public static IStripesRegistry stripeRegistry; + public static PipeFlowType flowStructure; + public static PipeFlowType flowItems; + public static PipeFlowType flowFluids; + public static PipeFlowType flowPower; + + /** The default transfer information used if a pipe definition has not been registered. Note that this is replaced + * by BuildCraft Transport to config-defined values. */ + public static FluidTransferInfo transferInfoDefault = new FluidTransferInfo(20, 10); + + public static final Map fluidTransferData = new IdentityHashMap<>(); + + public static FluidTransferInfo getFluidTransferInfo(PipeDefinition def) { + FluidTransferInfo info = fluidTransferData.get(def); + if (info == null) { + return transferInfoDefault; + } else { + return info; + } + } + + public static class FluidTransferInfo { + /** Controls the maximum amount of fluid that can be transfered around and out of a pipe per tick. Note that + * this does not affect the flow rate coming into the pipe. */ + public final int transferPerTick; + + /** Controls how long the pipe should delay incoming fluids by. Minimum value is 1, because of the way that + * fluids are handled internally. This value is multiplied by the fluids viscosity, and divided by 100 to give + * the actual delay. */ + public final double transferDelayMultiplier; + + public FluidTransferInfo(int transferPerTick, int transferDelay) { + this.transferPerTick = transferPerTick; + if (transferDelay <= 0) { + transferDelay = 1; + } + this.transferDelayMultiplier = transferDelay; + } + } +} diff --git a/src/api/java/buildcraft/api/transport/pipe/PipeApiClient.java b/src/api/java/buildcraft/api/transport/pipe/PipeApiClient.java new file mode 100755 index 000000000..04650bfb2 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/PipeApiClient.java @@ -0,0 +1,26 @@ +package buildcraft.api.transport.pipe; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import buildcraft.api.transport.pluggable.IPlugDynamicRenderer; +import buildcraft.api.transport.pluggable.IPluggableStaticBaker; +import buildcraft.api.transport.pluggable.PipePluggable; +import buildcraft.api.transport.pluggable.PluggableModelKey; + +@SideOnly(Side.CLIENT) +public enum PipeApiClient { + INSTANCE; + + public static IClientRegistry registry; + + public interface IClientRegistry { + void registerRenderer(Class flowClass, IPipeFlowRenderer renderer); + + void registerRenderer(Class behaviourClass, IPipeBehaviourRenderer renderer); + +

void registerRenderer(Class plugClass, IPlugDynamicRenderer

renderer); + +

void registerBaker(Class keyClass, IPluggableStaticBaker

renderer); + } +} diff --git a/src/api/java/buildcraft/api/transport/pipe/PipeBehaviour.java b/src/api/java/buildcraft/api/transport/pipe/PipeBehaviour.java new file mode 100755 index 000000000..624d75b99 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/PipeBehaviour.java @@ -0,0 +1,67 @@ +package buildcraft.api.transport.pipe; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.RayTraceResult; + +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; +import net.minecraftforge.fml.relauncher.Side; + +import buildcraft.api.core.EnumPipePart; + +public abstract class PipeBehaviour implements ICapabilityProvider { + public final IPipe pipe; + + public PipeBehaviour(IPipe pipe) { + this.pipe = pipe; + } + + public PipeBehaviour(IPipe pipe, NBTTagCompound nbt) { + this.pipe = pipe; + } + + public NBTTagCompound writeToNbt() { + NBTTagCompound nbt = new NBTTagCompound(); + + return nbt; + } + + public void writePayload(PacketBuffer buffer, Side side) {} + + public void readPayload(PacketBuffer buffer, Side side, MessageContext ctx) {} + + public int getTextureIndex(EnumFacing face) { + return 0; + } + + // Event handling + + public boolean canConnect(EnumFacing face, PipeBehaviour other) { + return true; + } + + public boolean canConnect(EnumFacing face, TileEntity oTile) { + return true; + } + + public boolean onPipeActivate(EntityPlayer player, RayTraceResult trace, float hitX, float hitY, float hitZ, EnumPipePart part) { + return false; + } + + public void onTick() {} + + @Override + public boolean hasCapability(Capability capability, EnumFacing facing) { + return false; + } + + @Override + public T getCapability(Capability capability, EnumFacing facing) { + return null; + } +} diff --git a/src/api/java/buildcraft/api/transport/pipe/PipeConnectionAPI.java b/src/api/java/buildcraft/api/transport/pipe/PipeConnectionAPI.java new file mode 100755 index 000000000..336ce551a --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/PipeConnectionAPI.java @@ -0,0 +1,51 @@ +package buildcraft.api.transport.pipe; + +import java.util.Map; + +import com.google.common.collect.Maps; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +/** Use this class to register blocks with custom block sizes so that pipes can connect to them properly. Note that you + * do not need to register a custom pipe connection if your block implements ICustomPipeConnection. The registered + * version does not override your own implementation. */ +public final class PipeConnectionAPI { + private static final Map connections = Maps.newHashMap(); + private static final ICustomPipeConnection NOTHING = new ICustomPipeConnection() { + @Override + public float getExtension(World world, BlockPos pos, EnumFacing face, IBlockState state) { + return 0; + } + }; + + /** Register a block with a custom connection. Useful if you don't own the block class or are adding it for some-one + * else. + * + * @param block The block instance + * @param connection The connection instance */ + public static void registerConnection(Block block, ICustomPipeConnection connection) { + connections.put(block, connection); + } + + /** Ensures that a particular block will always have the default connection, no matter what the bounding box the the + * block is. */ + public static void registerConnectionAsNothing(Block block) { + connections.put(block, NOTHING); + } + + /** Gets the current custom connection that the block uses. Will be null if nothing has been set. */ + public static ICustomPipeConnection getCustomConnection(Block block) { + if (block instanceof ICustomPipeConnection) { + return (ICustomPipeConnection) block; + } + ICustomPipeConnection connection = connections.get(block); + if (connection != null) { + return connection; + } + return null; + } +} diff --git a/src/api/java/buildcraft/api/transport/pipe/PipeDefinition.java b/src/api/java/buildcraft/api/transport/pipe/PipeDefinition.java new file mode 100755 index 000000000..845d6b70b --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/PipeDefinition.java @@ -0,0 +1,159 @@ +package buildcraft.api.transport.pipe; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; + +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.ModContainer; + +public final class PipeDefinition { + public final ResourceLocation identifier; + public final IPipeCreator logicConstructor; + public final IPipeLoader logicLoader; + public final PipeFlowType flowType; + public final String[] textures; + public final int itemTextureTop, itemTextureCenter, itemTextureBottom; + + public PipeDefinition(PipeDefinitionBuilder builder) { + this.identifier = builder.identifier; + this.textures = new String[builder.textureSuffixes.length]; + for (int i = 0; i < textures.length; i++) { + textures[i] = builder.texturePrefix + builder.textureSuffixes[i]; + } + this.logicConstructor = builder.logicConstructor; + this.logicLoader = builder.logicLoader; + this.flowType = builder.flowType; + this.itemTextureTop = builder.itemTextureTop; + this.itemTextureCenter = builder.itemTextureCenter; + this.itemTextureBottom = builder.itemTextureBottom; + } + + @FunctionalInterface + public interface IPipeCreator { + PipeBehaviour createBehaviour(IPipe t); + } + + @FunctionalInterface + public interface IPipeLoader { + PipeBehaviour loadBehaviour(IPipe t, NBTTagCompound u); + } + + public static class PipeDefinitionBuilder { + public ResourceLocation identifier; + public String texturePrefix; + public String[] textureSuffixes = { "" }; + public IPipeCreator logicConstructor; + public IPipeLoader logicLoader; + public PipeFlowType flowType; + public int itemTextureTop = 0; + public int itemTextureCenter = 0; + public int itemTextureBottom = 0; + + public PipeDefinitionBuilder() {} + + public PipeDefinitionBuilder(ResourceLocation identifier, IPipeCreator logicConstructor, IPipeLoader logicLoader, PipeFlowType flowType) { + this.identifier = identifier; + this.logicConstructor = logicConstructor; + this.logicLoader = logicLoader; + this.flowType = flowType; + } + + public PipeDefinitionBuilder idTexPrefix(String both) { + return id(both).texPrefix(both); + } + + public PipeDefinitionBuilder idTex(String both) { + return id(both).tex(both); + } + + private static String getActiveModId() { + ModContainer mod = Loader.instance().activeModContainer(); + if (mod == null) { + throw new IllegalStateException("Cannot interact with PipeDefinition outside of an activly scoped mod!"); + } + return mod.getModId(); + } + + public PipeDefinitionBuilder id(String post) { + identifier = new ResourceLocation(getActiveModId(), post); + return this; + } + + public PipeDefinitionBuilder tex(String prefix, String... suffixes) { + return texPrefix(prefix).texSuffixes(suffixes); + } + + /** Sets the texture prefix to be: [current_mod_id]:pipes/[prefix] where [current_mod_id] is the + * modid of the currently loaded mod, and [prefix] is the string parameter given. + * + * @return this */ + public PipeDefinitionBuilder texPrefix(String prefix) { + return texPrefixDirect(getActiveModId() + ":pipes/" + prefix); + } + + /** Sets the {@link #texturePrefix} to the input string, without any additions or changes (unlike + * {@link #texPrefix(String)}) + * + * @return this */ + public PipeDefinitionBuilder texPrefixDirect(String prefix) { + texturePrefix = prefix; + return this; + } + + /** Sets {@link #textureSuffixes} to the given array, or to {""} if the argument list is empty or + * null. + * + * @return this. */ + public PipeDefinitionBuilder texSuffixes(String... suffixes) { + if (suffixes == null || suffixes.length == 0) { + textureSuffixes = new String[] { "" }; + } else { + textureSuffixes = suffixes; + } + return this; + } + + public PipeDefinitionBuilder itemTex(int all) { + itemTextureTop = all; + itemTextureCenter = all; + itemTextureBottom = all; + return this; + } + + public PipeDefinitionBuilder itemTex(int top, int center, int bottom) { + itemTextureTop = top; + itemTextureCenter = center; + itemTextureBottom = bottom; + return this; + } + + public PipeDefinitionBuilder logic(IPipeCreator creator, IPipeLoader loader) { + logicConstructor = creator; + logicLoader = loader; + return this; + } + + public PipeDefinitionBuilder flowItem() { + return flow(PipeApi.flowItems); + } + + public PipeDefinitionBuilder flowFluid() { + return flow(PipeApi.flowFluids); + } + + public PipeDefinitionBuilder flowPower() { + return flow(PipeApi.flowPower); + } + + public PipeDefinitionBuilder flow(PipeFlowType flow) { + flowType = flow; + return this; + } + + public PipeDefinition define() { + PipeDefinition def = new PipeDefinition(this); + PipeApi.pipeRegistry.registerPipe(def); + return def; + } + } +} diff --git a/src/api/java/buildcraft/api/transport/pipe/PipeEvent.java b/src/api/java/buildcraft/api/transport/pipe/PipeEvent.java new file mode 100755 index 000000000..a5c41062c --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/PipeEvent.java @@ -0,0 +1,28 @@ +package buildcraft.api.transport.pipe; + +/** The base class for all pipe events. Some event classes can be cancelled with {@link #cancel()}, however this will + * only have an effect if {@link #canBeCancelled} is true. Refer to indervidual classes for information on what*/ +public abstract class PipeEvent { + public final boolean canBeCancelled; + public final IPipeHolder holder; + private boolean canceled = false; + + public PipeEvent(IPipeHolder holder) { + this(false, holder); + } + + protected PipeEvent(boolean canBeCancelled, IPipeHolder holder) { + this.canBeCancelled = canBeCancelled; + this.holder = holder; + } + + public void cancel() { + if (canBeCancelled) { + canceled = true; + } + } + + public boolean isCanceled() { + return canceled; + } +} diff --git a/src/api/java/buildcraft/api/transport/pipe/PipeEventActionActivate.java b/src/api/java/buildcraft/api/transport/pipe/PipeEventActionActivate.java new file mode 100755 index 000000000..ea6b37acc --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/PipeEventActionActivate.java @@ -0,0 +1,18 @@ +package buildcraft.api.transport.pipe; + +import buildcraft.api.core.EnumPipePart; +import buildcraft.api.statements.IAction; +import buildcraft.api.statements.IStatementParameter; + +public class PipeEventActionActivate extends PipeEvent { + public final IAction action; + public final IStatementParameter[] params; + public final EnumPipePart part; + + public PipeEventActionActivate(IPipeHolder holder, IAction action, IStatementParameter[] params, EnumPipePart part) { + super(holder); + this.action = action; + this.params = params; + this.part = part; + } +} diff --git a/src/api/java/buildcraft/api/transport/pipe/PipeEventFluid.java b/src/api/java/buildcraft/api/transport/pipe/PipeEventFluid.java new file mode 100755 index 000000000..f31714203 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/PipeEventFluid.java @@ -0,0 +1,130 @@ +package buildcraft.api.transport.pipe; + +import java.util.Arrays; +import java.util.Collection; +import java.util.EnumSet; + +import com.google.common.collect.Lists; + +import net.minecraft.util.EnumFacing; + +import net.minecraftforge.fluids.FluidStack; + +public abstract class PipeEventFluid extends PipeEvent { + + public final IFlowFluid flow; + + protected PipeEventFluid(IPipeHolder holder, IFlowFluid flow) { + super(holder); + this.flow = flow; + } + + protected PipeEventFluid(boolean canBeCancelled, IPipeHolder holder, IFlowFluid flow) { + super(canBeCancelled, holder); + this.flow = flow; + } + + public static class SideCheck extends PipeEventFluid { + public final FluidStack fluid; + + /** The priorities of each side. Stored inversely to the values given, so a higher priority will have a lower + * value than a lower priority. */ + private final int[] priority = new int[6]; + private final EnumSet allowed = EnumSet.allOf(EnumFacing.class); + + public SideCheck(IPipeHolder holder, IFlowFluid flow, FluidStack fluid) { + super(holder, flow); + this.fluid = fluid; + } + + /** Checks to see if a side if allowed. Note that this may return true even though a later handler might + * disallow a side, so you should only use this to skip checking a side (for example a diamond pipe might not + * check the filters for a specific side if its already been disallowed) */ + public boolean isAllowed(EnumFacing side) { + return allowed.contains(side); + } + + /** Disallows the specific side(s) from being a destination for the item. If no sides are allowed, then the + * fluid will stay in the current pipe section. */ + public void disallow(EnumFacing... sides) { + for (EnumFacing side : sides) { + allowed.remove(side); + } + } + + public void disallowAll(Collection sides) { + allowed.removeAll(sides); + } + + public void disallowAllExcept(EnumFacing... sides) { + allowed.retainAll(Lists.newArrayList(sides)); + } + + public void disallowAllExcept(Collection sides) { + allowed.retainAll(sides); + } + + public void disallowAll() { + allowed.clear(); + } + + public void increasePriority(EnumFacing side) { + increasePriority(side, 1); + } + + public void increasePriority(EnumFacing side, int by) { + priority[side.ordinal()] -= by; + } + + public void decreasePriority(EnumFacing side) { + decreasePriority(side, 1); + } + + public void decreasePriority(EnumFacing side, int by) { + increasePriority(side, -by); + } + + public EnumSet getOrder() { + if (allowed.isEmpty()) { + return EnumSet.noneOf(EnumFacing.class); + } + if (allowed.size() == 1) { + return allowed; + } + outer_loop: while (true) { + int val = priority[0]; + for (int i = 1; i < priority.length; i++) { + if (priority[i] != val) { + break outer_loop; + } + } + // No need to work out the order when all destinations have the same priority + return allowed; + } + + int[] ordered = Arrays.copyOf(priority, 6); + Arrays.sort(ordered); + int last = 0; + for (int i = 0; i < 6; i++) { + int current = ordered[i]; + if (i != 0 && current == last) { + continue; + } + last = current; + EnumSet set = EnumSet.noneOf(EnumFacing.class); + for (EnumFacing face : EnumFacing.VALUES) { + if (allowed.contains(face)) { + if (priority[face.ordinal()] == current) { + set.add(face); + } + } + } + if (set.size() > 0) { + return set; + } + } + return EnumSet.noneOf(EnumFacing.class); + } + } + +} diff --git a/src/api/java/buildcraft/api/transport/pipe/PipeEventHandler.java b/src/api/java/buildcraft/api/transport/pipe/PipeEventHandler.java new file mode 100755 index 000000000..1ef3667a6 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/PipeEventHandler.java @@ -0,0 +1,29 @@ +package buildcraft.api.transport.pipe; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** Designates a method that will receive a pipe event. The method must be public and take a single parameter that + * extends {@link PipeEvent}.
+ * An example is:
+ * + @PipeEventHandler
+ public void sideCheck(PipeEventItem.SideCheck sideCheck) {
+ // Logic ommited
+ } + * + *
*/ +@Retention(RUNTIME) +@Target(METHOD) +public @interface PipeEventHandler { + /** Designates the priority that the handler will be given. All handlers in vanilla BuildCraft use + * {@link PipeEventPriority#NORMAL}, so this is given for other pipe mods to fire before or after all BC logic has + * taken place. */ + PipeEventPriority priority() default PipeEventPriority.NORMAL; + + /** If true then the event handler will be called even if an event has already been cancelled. */ + boolean receiveCancelled() default false; +} diff --git a/src/api/java/buildcraft/api/transport/pipe/PipeEventItem.java b/src/api/java/buildcraft/api/transport/pipe/PipeEventItem.java new file mode 100755 index 000000000..6e1d44820 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/PipeEventItem.java @@ -0,0 +1,349 @@ +package buildcraft.api.transport.pipe; + +import java.util.*; + +import javax.annotation.Nonnull; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; + +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; + +public abstract class PipeEventItem extends PipeEvent { + + public final IFlowItems flow; + + protected PipeEventItem(IPipeHolder holder, IFlowItems flow) { + super(holder); + this.flow = flow; + } + + protected PipeEventItem(boolean canBeCancelled, IPipeHolder holder, IFlowItems flow) { + super(canBeCancelled, holder); + this.flow = flow; + } + + // ################ + // + // Misc events + // + // ################ + + /** Fires whenever item insertion is attempted. The item might have been extracted by the pipe behaviour, inserted + * by another pipe or even a different kind of tile. Note that you have no way of telling what caused this event. */ + public static class TryInsert extends PipeEventItem { + public final EnumDyeColor colour; + public final EnumFacing from; + /** The itemstack that is attempting to be inserted. NEVER CHANGE THIS! */ + @Nonnull + public final ItemStack attempting; + /** The count of items that are being accepted into this pipe. Starts off at the stack count of + * {@link #attempting} */ + public int accepted; + + public TryInsert(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, EnumFacing from, @Nonnull ItemStack attempting) { + super(true, holder, flow); + this.colour = colour; + this.from = from; + this.attempting = attempting; + this.accepted = attempting.getCount(); + } + + /** Stops the item from being accepted. */ + @Override + public void cancel() { + super.cancel(); + } + } + + public static abstract class ReachDest extends PipeEventItem { + public EnumDyeColor colour; + @Nonnull + private ItemStack stack; + + public ReachDest(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, @Nonnull ItemStack stack) { + super(holder, flow); + this.colour = colour; + this.stack = stack; + } + + @Nonnull + public ItemStack getStack() { + return this.stack; + } + + public void setStack(ItemStack stack) { + if (stack == null) { + throw new NullPointerException("stack"); + } else { + this.stack = stack; + } + } + } + + /** Fired after {@link TryInsert} (if some items were allowed in) to modify the incoming itemstack or its colour. */ + public static class OnInsert extends ReachDest { + public final EnumFacing from; + + public OnInsert(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, @Nonnull ItemStack stack, EnumFacing from) { + super(holder, flow, colour, stack); + this.from = from; + } + } + + /** Fired whenever an item reaches the centre of a pipe. Note that you *can* change the itemstack or the colour. */ + public static class ReachCenter extends ReachDest { + public final EnumFacing from; + + public ReachCenter(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, @Nonnull ItemStack stack, EnumFacing from) { + super(holder, flow, colour, stack); + this.from = from; + } + } + + /** Fired whenever an item reaches the end of a pipe. Note that you *can* change the itemstack or the colour. */ + public static class ReachEnd extends ReachDest { + public final EnumFacing to; + + public ReachEnd(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, @Nonnull ItemStack stack, EnumFacing to) { + super(holder, flow, colour, stack); + this.to = to; + } + } + + // ############################ + // + // Destination related + // + // ############################ + + /** Fired after {@link ReachCenter} to determine what sides are the items NOT allowed to go to, and the order of + * priority for the allowed sides. */ + public static class SideCheck extends PipeEventItem { + public final EnumDyeColor colour; + public final EnumFacing from; + @Nonnull + public final ItemStack stack; + + /** The priorities of each side. Stored inversely to the values given, so a higher priority will have a lower + * value than a lower priority. */ + private final int[] priority = new int[6]; + private final EnumSet allowed = EnumSet.allOf(EnumFacing.class); + + public SideCheck(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, EnumFacing from, @Nonnull ItemStack stack) { + super(holder, flow); + this.colour = colour; + this.from = from; + this.stack = stack; + } + + /** Checks to see if a side if allowed. Note that this may return true even though a later handler might + * disallow a side, so you should only use this to skip checking a side (for example a diamond pipe might not + * check the filters for a specific side if its already been disallowed) */ + public boolean isAllowed(EnumFacing side) { + return allowed.contains(side); + } + + /** Disallows the specific side(s) from being a destination for the item. If no sides are allowed, then + * {@link TryBounce} will be fired to test if the item can bounce back. */ + public void disallow(EnumFacing... sides) { + for (EnumFacing side : sides) { + allowed.remove(side); + } + } + + public void disallowAll(Collection sides) { + allowed.removeAll(sides); + } + + public void disallowAllExcept(EnumFacing... sides) { + allowed.retainAll(Lists.newArrayList(sides)); + } + + public void disallowAll() { + allowed.clear(); + } + + public void increasePriority(EnumFacing side) { + increasePriority(side, 1); + } + + public void increasePriority(EnumFacing side, int by) { + priority[side.ordinal()] -= by; + } + + public void decreasePriority(EnumFacing side) { + decreasePriority(side, 1); + } + + public void decreasePriority(EnumFacing side, int by) { + increasePriority(side, -by); + } + + public List> getOrder() { + // Skip the calculations if the size is simple + switch (allowed.size()) { + case 0: + return ImmutableList.of(); + case 1: + return ImmutableList.of(allowed); + } + outer_loop: while (true) { + int val = priority[0]; + for (int i = 1; i < priority.length; i++) { + if (priority[i] != val) { + break outer_loop; + } + } + // No need to work out the order when all destinations have the same priority + return ImmutableList.of(allowed); + } + + int[] ordered = Arrays.copyOf(priority, 6); + Arrays.sort(ordered); + int last = 0; + List> list = Lists.newArrayList(); + for (int i = 0; i < 6; i++) { + int current = ordered[i]; + if (i != 0 && current == last) { + continue; + } + last = current; + EnumSet set = EnumSet.noneOf(EnumFacing.class); + for (EnumFacing face : EnumFacing.VALUES) { + if (allowed.contains(face)) { + if (priority[face.ordinal()] == current) { + set.add(face); + } + } + } + if (set.size() > 0) { + list.add(set); + } + } + return list; + } + } + + /** Fired after {@link SideCheck} (if all sides were disallowed) to see if the item is allowed to bounce back to + * where it was inserted. */ + public static class TryBounce extends PipeEventItem { + public final EnumDyeColor colour; + public final EnumFacing from; + @Nonnull + public final ItemStack stack; + public boolean canBounce = false; + + public TryBounce(IPipeHolder holder, IFlowItems flow, EnumDyeColor colour, EnumFacing from, @Nonnull ItemStack stack) { + super(holder, flow); + this.colour = colour; + this.from = from; + this.stack = stack; + } + } + + public static class Drop extends PipeEventItem { + @Nonnull + private ItemStack stack; + + public Drop(IPipeHolder holder, IFlowItems flow, @Nonnull ItemStack stack) { + super(holder, flow); + this.stack = stack; + } + + @Nonnull + public ItemStack getStack() { + return this.stack; + } + + public void setStack(ItemStack stack) { + if (stack == null) { + throw new NullPointerException("stack"); + } else { + this.stack = stack; + } + } + } + + /** Base class for {@link Split} and {@link FindDest}. Do not listen to this directly! */ + public static abstract class OrderedEvent extends PipeEventItem { + public final List> orderedDestinations; + + public OrderedEvent(IPipeHolder holder, IFlowItems flow, List> orderedDestinations) { + super(holder, flow); + this.orderedDestinations = orderedDestinations; + } + + public ImmutableList generateRandomOrder() { + ImmutableList.Builder builder = ImmutableList.builder(); + for (EnumSet set : orderedDestinations) { + List faces = new ArrayList<>(set); + Collections.shuffle(faces); + builder.addAll(faces); + } + return builder.build(); + } + } + + /** Fired after {@link SideCheck} (if at least one valid side was found) or after {@link TryBounce} if no valid + * sides were detected, but it was allowed to bounce back. This event is for splitting up (or modifying) the input + * itemstack. This is most helpful for implementing full round-robin behaviour, or diamond-pipe based splitting. If + * you need to generate a random facing for each one then use {@link OrderedEvent#generateRandomOrder()}. */ + public static class Split extends OrderedEvent { + public final List items = new ArrayList<>(); + + public Split(IPipeHolder holder, IFlowItems flow, List> order, ItemEntry toSplit) { + super(holder, flow, order); + items.add(toSplit); + } + } + + /** Fired after {@link Split}. This event is for assigning a destination to each {@link ItemEntry} in + * {@link Split#items}. If you need to generate a random facing for each one then use + * {@link OrderedEvent#generateRandomOrder()}. */ + public static class FindDest extends OrderedEvent { + public final ImmutableList items; + + public FindDest(IPipeHolder holder, IFlowItems flow, List> orderedDestinations, ImmutableList items) { + super(holder, flow, orderedDestinations); + this.items = items; + } + } + + /** Fired after {@link FindDest}. */ + public static class ModifySpeed extends PipeEventItem { + public final ItemEntry item; + public final double currentSpeed; + public double targetSpeed = 0; + public double maxSpeedChange = 0; + + public ModifySpeed(IPipeHolder holder, IFlowItems flow, ItemEntry item, double initSpeed) { + super(holder, flow); + this.item = item; + currentSpeed = initSpeed; + } + + public void modifyTo(double target, double maxDelta) { + targetSpeed = target; + maxSpeedChange = maxDelta; + } + } + + /** Mostly immutable holding class for item stacks. */ + public static class ItemEntry { + public final EnumDyeColor colour; + @Nonnull + public final ItemStack stack; + public final EnumFacing from; + /** An list of the destinations to try, in order. */ + public List to; + + public ItemEntry(EnumDyeColor colour, @Nonnull ItemStack stack, EnumFacing from) { + this.colour = colour; + this.stack = stack; + this.from = from; + } + } +} diff --git a/src/api/java/buildcraft/api/transport/pipe/PipeEventPower.java b/src/api/java/buildcraft/api/transport/pipe/PipeEventPower.java new file mode 100755 index 000000000..1a91c517c --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/PipeEventPower.java @@ -0,0 +1,73 @@ +package buildcraft.api.transport.pipe; + +import buildcraft.api.mj.MjAPI; + +public abstract class PipeEventPower extends PipeEvent { + public final IFlowPower flow; + + protected PipeEventPower(IPipeHolder holder, IFlowPower flow) { + super(holder); + this.flow = flow; + } + + protected PipeEventPower(boolean canBeCancelled, IPipeHolder holder, IFlowPower flow) { + super(canBeCancelled, holder); + this.flow = flow; + } + + public static class Configure extends PipeEventPower { + private long maxPower = 10 * MjAPI.MJ; + /** The percentage resistance of the power pipe (as in, percentage of current power going through the pipe). + * Should be a number between 0 and {@link MjAPI#MJ} */ + private long powerResistance = -1; + /** The absolute loss of the power pipe. Negative numbers mean that this field will be populated from a default, + * or by {@link #powerResistance} if it is set. This is capped at the value given in {@link #getMaxPower()} */ + private long powerLoss = -1; + private boolean receiver = false; + + public Configure(IPipeHolder holder, IFlowPower flow) { + super(holder, flow); + } + + public long getMaxPower() { + return this.maxPower; + } + + public void setMaxPower(long maxPower) { + this.maxPower = maxPower; + } + + /** The absolute loss of the power pipe. Negative numbers mean that this field will be populated from a default, + * or by {@link #powerResistance} if it is set. This is capped at the value given in {@link #getMaxPower()} */ + public long getPowerLoss() { + return this.powerLoss; + } + + /** The absolute loss of the power pipe. Negative numbers mean that this field will be populated from a default, + * or by {@link #powerResistance} if it is set. This is capped at the value given in {@link #getMaxPower()} */ + public void setPowerLoss(long powerLoss) { + this.powerLoss = powerLoss; + } + + /** The percentage resistance of the power pipe (percentage of current power going through the pipe that will be + * lost). Should be a number between 0 and {@link MjAPI#MJ} */ + public long getPowerResistance() { + return this.powerResistance; + } + + /** The percentage resistance of the power pipe (percentage of current power going through the pipe that will be + * lost). Should be a number between 0 and {@link MjAPI#MJ} */ + public void setPowerResistance(long powerResistance) { + this.powerResistance = powerResistance; + } + + public boolean isReceiver() { + return this.receiver; + } + + /** Sets this pipe to be one that receives power from external sources. */ + public void setReceiver(boolean receiver) { + this.receiver = receiver; + } + } +} diff --git a/src/api/java/buildcraft/api/transport/pipe/PipeEventPriority.java b/src/api/java/buildcraft/api/transport/pipe/PipeEventPriority.java new file mode 100755 index 000000000..cedaaa83f --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/PipeEventPriority.java @@ -0,0 +1,7 @@ +package buildcraft.api.transport.pipe; + +public enum PipeEventPriority { + PRE, + NORMAL, + POST; +} diff --git a/src/api/java/buildcraft/api/transport/pipe/PipeEventStatement.java b/src/api/java/buildcraft/api/transport/pipe/PipeEventStatement.java new file mode 100755 index 000000000..5d96cafc2 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/PipeEventStatement.java @@ -0,0 +1,66 @@ +package buildcraft.api.transport.pipe; + +import java.util.Collection; + +import javax.annotation.Nonnull; + +import net.minecraft.util.EnumFacing; + +import buildcraft.api.statements.IActionInternal; +import buildcraft.api.statements.IActionInternalSided; +import buildcraft.api.statements.ITriggerInternal; +import buildcraft.api.statements.ITriggerInternalSided; + +public abstract class PipeEventStatement extends PipeEvent { + public PipeEventStatement(IPipeHolder holder) { + super(holder); + } + + /** Fired when a pipe should add internal triggers to the list of all possible triggers */ + public static class AddTriggerInternal extends PipeEventStatement { + public final Collection triggers; + + public AddTriggerInternal(IPipeHolder holder, Collection triggers) { + super(holder); + this.triggers = triggers; + } + } + + /** Fired when a pipe should add internal sided triggers to the list of all possible triggers */ + public static class AddTriggerInternalSided extends PipeEventStatement { + public final Collection triggers; + + @Nonnull + public final EnumFacing side; + + public AddTriggerInternalSided(IPipeHolder holder, Collection triggers, @Nonnull EnumFacing side) { + super(holder); + this.triggers = triggers; + this.side = side; + } + } + + /** Fired when a pipe should add internal actions to the list of all possible actions */ + public static class AddActionInternal extends PipeEventStatement { + public final Collection actions; + + public AddActionInternal(IPipeHolder holder, Collection actions) { + super(holder); + this.actions = actions; + } + } + + /** Fired when a pipe should add internal actions to the list of all possible actions */ + public static class AddActionInternalSided extends PipeEventStatement { + public final Collection actions; + + @Nonnull + public final EnumFacing side; + + public AddActionInternalSided(IPipeHolder holder, Collection actions, @Nonnull EnumFacing side) { + super(holder); + this.actions = actions; + this.side = side; + } + } +} diff --git a/src/api/java/buildcraft/api/transport/pipe/PipeFlow.java b/src/api/java/buildcraft/api/transport/pipe/PipeFlow.java new file mode 100755 index 000000000..d35e34a22 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/PipeFlow.java @@ -0,0 +1,82 @@ +package buildcraft.api.transport.pipe; + +import java.io.IOException; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.RayTraceResult; + +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.fml.relauncher.Side; + +import buildcraft.api.core.EnumPipePart; +import buildcraft.api.transport.pipe.IPipeHolder.IWriter; +import buildcraft.api.transport.pipe.IPipeHolder.PipeMessageReceiver; + +public abstract class PipeFlow implements ICapabilityProvider { + /** The ID for completely refreshing the state of this flow. */ + public static final int NET_ID_FULL_STATE = 0; + /** The ID for updating what has changed since the last NET_ID_FULL_STATE or NET_ID_UPDATE has been sent. */ + // Wait, what? How is that a good idea or even sensible to make updates work this way? + public static final int NET_ID_UPDATE = 1; + + public final IPipe pipe; + + public PipeFlow(IPipe pipe) { + this.pipe = pipe; + } + + public PipeFlow(IPipe pipe, NBTTagCompound nbt) { + this.pipe = pipe; + } + + public NBTTagCompound writeToNbt() { + return new NBTTagCompound(); + } + + /** Writes a payload with the specified id. Standard ID's are NET_ID_FULL_STATE and NET_ID_UPDATE. */ + public void writePayload(int id, PacketBuffer buffer, Side side) {} + + /** Reads a payload with the specified id. Standard ID's are NET_ID_FULL_STATE and NET_ID_UPDATE. */ + public void readPayload(int id, PacketBuffer buffer, Side side) throws IOException {} + + public void sendPayload(int id) { + final Side side = pipe.getHolder().getPipeWorld().isRemote ? Side.CLIENT : Side.SERVER; + sendCustomPayload(id, (buf) -> writePayload(id, buf, side)); + } + + public final void sendCustomPayload(int id, IWriter writer) { + pipe.getHolder().sendMessage(PipeMessageReceiver.FLOW, new IWriter() { + @Override + public void write(PacketBuffer buffer) { + buffer.writeBoolean(true); + buffer.writeShort(id); + writer.write(buffer); + } + }); + } + + public abstract boolean canConnect(EnumFacing face, PipeFlow other); + + public abstract boolean canConnect(EnumFacing face, TileEntity oTile); + + public void onTick() {} + + public boolean onFlowActivate(EntityPlayer player, RayTraceResult trace, float hitX, float hitY, float hitZ, EnumPipePart part) { + return false; + } + + @Override + public final boolean hasCapability(Capability capability, EnumFacing facing) { + return getCapability(capability, facing) != null; + } + + @Override + public T getCapability(Capability capability, EnumFacing facing) { + return null; + } +} diff --git a/src/api/java/buildcraft/api/transport/pipe/PipeFlowType.java b/src/api/java/buildcraft/api/transport/pipe/PipeFlowType.java new file mode 100755 index 000000000..290517012 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pipe/PipeFlowType.java @@ -0,0 +1,23 @@ +package buildcraft.api.transport.pipe; + +import net.minecraft.nbt.NBTTagCompound; + +public final class PipeFlowType { + public final IFlowCreator creator; + public final IFlowLoader loader; + + public PipeFlowType(IFlowCreator creator, IFlowLoader loader) { + this.creator = creator; + this.loader = loader; + } + + @FunctionalInterface + public interface IFlowCreator { + PipeFlow createFlow(IPipe t); + } + + @FunctionalInterface + public interface IFlowLoader { + PipeFlow loadFlow(IPipe t, NBTTagCompound u); + } +} diff --git a/src/api/java/buildcraft/api/transport/pluggable/IFacadePluggable.java b/src/api/java/buildcraft/api/transport/pluggable/IFacadePluggable.java new file mode 100755 index 000000000..a3ad9f329 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pluggable/IFacadePluggable.java @@ -0,0 +1,11 @@ +package buildcraft.api.transport.pluggable; + +import net.minecraft.block.state.IBlockState; + +public interface IFacadePluggable { + IBlockState getCurrentState(); + + boolean isTransparent(); + + boolean isHollow(); +} diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPlugDynamicRenderer.java b/src/api/java/buildcraft/api/transport/pluggable/IPlugDynamicRenderer.java new file mode 100755 index 000000000..916f4fe69 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pluggable/IPlugDynamicRenderer.java @@ -0,0 +1,7 @@ +package buildcraft.api.transport.pluggable; + +import net.minecraft.client.renderer.VertexBuffer; + +public interface IPlugDynamicRenderer

{ + void render(P plug, double x, double y, double z, float partialTicks, VertexBuffer vb); +} diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPluggableRegistry.java b/src/api/java/buildcraft/api/transport/pluggable/IPluggableRegistry.java new file mode 100755 index 000000000..300b575bf --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pluggable/IPluggableRegistry.java @@ -0,0 +1,9 @@ +package buildcraft.api.transport.pluggable; + +import net.minecraft.util.ResourceLocation; + +public interface IPluggableRegistry { + void register(PluggableDefinition definition); + + PluggableDefinition getDefinition(ResourceLocation identifier); +} diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPluggableStaticBaker.java b/src/api/java/buildcraft/api/transport/pluggable/IPluggableStaticBaker.java new file mode 100755 index 000000000..a3f001214 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pluggable/IPluggableStaticBaker.java @@ -0,0 +1,13 @@ +package buildcraft.api.transport.pluggable; + +import java.util.List; + +import net.minecraft.client.renderer.block.model.BakedQuad; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public interface IPluggableStaticBaker { + List bake(K key); +} diff --git a/src/api/java/buildcraft/api/transport/pluggable/PipePluggable.java b/src/api/java/buildcraft/api/transport/pluggable/PipePluggable.java new file mode 100755 index 000000000..a1b180519 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pluggable/PipePluggable.java @@ -0,0 +1,104 @@ +package buildcraft.api.transport.pluggable; + +import java.io.IOException; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.PacketBuffer; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.RayTraceResult; + +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; +import net.minecraftforge.fml.relauncher.Side; + +import buildcraft.api.transport.pipe.IPipeHolder; +import buildcraft.api.transport.pipe.IPipeHolder.PipeMessageReceiver; + +public abstract class PipePluggable { + public final PluggableDefinition definition; + public final IPipeHolder holder; + public final EnumFacing side; + + public PipePluggable(PluggableDefinition definition, IPipeHolder holder, EnumFacing side) { + this.definition = definition; + this.holder = holder; + this.side = side; + } + + public NBTTagCompound writeToNbt() { + NBTTagCompound nbt = new NBTTagCompound(); + return nbt; + } + + /** Writes the payload that will be passed into + * {@link PluggableDefinition#loadFromBuffer(IPipeHolder, EnumFacing, PacketBuffer)} on the client. (This is called + * on the server and sent to the client). Note that this will be called *instead* of write and read payload. */ + public void writeCreationPayload(PacketBuffer buffer) { + + } + + public void writePayload(PacketBuffer buffer, Side side) { + + } + + public void readPayload(PacketBuffer buffer, Side side, MessageContext ctx) throws IOException { + + } + + public final void scheduleNetworkUpdate() { + holder.scheduleNetworkUpdate(PipeMessageReceiver.PLUGGABLES[side.ordinal()]); + } + + public void onTick() {} + + /** @return A bounding box that will be used for collisions and raytracing. */ + public abstract AxisAlignedBB getBoundingBox(); + + /** @return True if the pipe cannot connect outwards (it is blocked), or False if this does not block the pipe. */ + public boolean isBlocking() { + return false; + } + + /** Gets the value of a specified capability key, or null if the given capability is not supported at the call time. + * This is effectively {@link ICapabilityProvider}, but where + * {@link ICapabilityProvider#hasCapability(Capability, EnumFacing)} will return true when this returns a non-null + * value. */ + public T getCapability(@Nonnull Capability cap) { + return null; + } + + /** Called whenever this pluggable is removed from the pipe. + * + * @param toDrop A list containing all the items to drop (so you should add your items to this list) */ + public void onRemove(NonNullList toDrop) { + ItemStack stack = getPickStack(); + if (!stack.isEmpty()) { + toDrop.add(stack); + } + } + + /** Called whenever this pluggable is picked by the player (similar to Block.getPickBlock) + * + * @return The stack that should be picked, or ItemStack.EMPTY if no stack can be picked from this pluggable. */ + public ItemStack getPickStack() { + return ItemStack.EMPTY; + } + + public boolean onPluggableActivate(EntityPlayer player, RayTraceResult trace, float hitX, float hitY, float hitZ) { + return false; + } + + @Nullable + public PluggableModelKey getModelRenderKey(BlockRenderLayer layer) { + return null; + } +} diff --git a/src/api/java/buildcraft/api/transport/pluggable/PluggableDefinition.java b/src/api/java/buildcraft/api/transport/pluggable/PluggableDefinition.java new file mode 100755 index 000000000..f6e371c3d --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pluggable/PluggableDefinition.java @@ -0,0 +1,69 @@ +package buildcraft.api.transport.pluggable; + +import javax.annotation.Nullable; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.PacketBuffer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; + +import buildcraft.api.transport.pipe.IPipeHolder; + +public final class PluggableDefinition { + public final ResourceLocation identifier; + + public final IPluggableNetLoader loader; + public final IPluggableNbtReader reader; + + @Nullable + public final IPluggableCreator creator; + + public PluggableDefinition(ResourceLocation identifier, IPluggableNbtReader reader, IPluggableNetLoader loader) { + this.identifier = identifier; + this.reader = reader; + this.loader = loader; + this.creator = null; + } + + public PluggableDefinition(ResourceLocation identifier, IPluggableCreator creator) { + this.identifier = identifier; + this.reader = creator; + this.loader = creator; + this.creator = creator; + } + + public PipePluggable readFromNbt(IPipeHolder holder, EnumFacing side, NBTTagCompound nbt) { + return reader.readFromNbt(this, holder, side, nbt); + } + + public PipePluggable loadFromBuffer(IPipeHolder holder, EnumFacing side, PacketBuffer buffer) { + return loader.loadFromBuffer(this, holder, side, buffer); + } + + // FIXME: J8 API usage + J8 default interfaces + + @FunctionalInterface + public interface IPluggableNbtReader { + PipePluggable readFromNbt(PluggableDefinition definition, IPipeHolder holder, EnumFacing side, NBTTagCompound nbt); + } + + @FunctionalInterface + public interface IPluggableNetLoader { + PipePluggable loadFromBuffer(PluggableDefinition definition, IPipeHolder holder, EnumFacing side, PacketBuffer buffer); + } + + @FunctionalInterface + public interface IPluggableCreator extends IPluggableNbtReader, IPluggableNetLoader { + @Override + default PipePluggable loadFromBuffer(PluggableDefinition definition, IPipeHolder holder, EnumFacing side, PacketBuffer buffer) { + return createSimplePluggable(definition, holder, side); + } + + @Override + default PipePluggable readFromNbt(PluggableDefinition definition, IPipeHolder holder, EnumFacing side, NBTTagCompound nbt) { + return createSimplePluggable(definition, holder, side); + } + + PipePluggable createSimplePluggable(PluggableDefinition definition, IPipeHolder holder, EnumFacing side); + } +} diff --git a/src/api/java/buildcraft/api/transport/pluggable/PluggableModelKey.java b/src/api/java/buildcraft/api/transport/pluggable/PluggableModelKey.java new file mode 100755 index 000000000..7c832c195 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pluggable/PluggableModelKey.java @@ -0,0 +1,38 @@ +package buildcraft.api.transport.pluggable; + +import java.util.Objects; + +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; + +public abstract class PluggableModelKey { + public final BlockRenderLayer layer; + public final EnumFacing side; + private final int hash; + + public PluggableModelKey(BlockRenderLayer layer, EnumFacing side) { + if (layer != BlockRenderLayer.CUTOUT && layer != BlockRenderLayer.TRANSLUCENT) { + throw new IllegalArgumentException("Can only use CUTOUT or TRANSLUCENT at the moment (was " + layer + ")"); + } + if (side == null) throw new NullPointerException("side"); + this.layer = layer; + this.side = side; + this.hash = Objects.hash(layer, side); + } + + @Override + public boolean equals(Object obj) { + if (obj == this) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + PluggableModelKey other = (PluggableModelKey) obj; + if (layer != other.layer) return false; + if (side != other.side) return false; + return true; + } + + @Override + public int hashCode() { + return hash; + } +} diff --git a/src/api/java/ic2/api/crops/BaseSeed.class b/src/api/java/ic2/api/crops/BaseSeed.class index 988c7c665..47efa3131 100644 Binary files a/src/api/java/ic2/api/crops/BaseSeed.class and b/src/api/java/ic2/api/crops/BaseSeed.class differ diff --git a/src/api/java/ic2/api/crops/BaseSeed.java b/src/api/java/ic2/api/crops/BaseSeed.java index 8770bcfcf..5f5f4446d 100644 --- a/src/api/java/ic2/api/crops/BaseSeed.java +++ b/src/api/java/ic2/api/crops/BaseSeed.java @@ -14,14 +14,20 @@ public class BaseSeed { * @param statResistance plant resistance stat * @param stackSize for internal usage only */ - public BaseSeed(CropCard crop, int size, int statGrowth, int statGain, int statResistance, int stackSize) { - super(); + public BaseSeed(CropCard crop, int size, int statGrowth, int statGain, int statResistance) { this.crop = crop; this.size = size; this.statGrowth = statGrowth; this.statGain = statGain; this.statResistance = statResistance; - this.stackSize = stackSize; + } + + /** + * @deprecated use the other constructor instead + */ + @Deprecated + public BaseSeed(CropCard crop, int size, int statGrowth, int statGain, int statResistance, int stackSize) { + this(crop, size, statGrowth, statGain, statResistance); } /** @@ -48,9 +54,4 @@ public class BaseSeed { * Plant resistance stat. */ public int statResistance; - - /** - * For internal usage only. - */ - public int stackSize; } diff --git a/src/api/java/ic2/api/crops/CropCard.class b/src/api/java/ic2/api/crops/CropCard.class index ed102068e..dab248f4b 100644 Binary files a/src/api/java/ic2/api/crops/CropCard.class and b/src/api/java/ic2/api/crops/CropCard.class differ diff --git a/src/api/java/ic2/api/crops/CropCard.java b/src/api/java/ic2/api/crops/CropCard.java index 347803a8d..60350036e 100644 --- a/src/api/java/ic2/api/crops/CropCard.java +++ b/src/api/java/ic2/api/crops/CropCard.java @@ -1,8 +1,6 @@ package ic2.api.crops; -import java.util.ArrayList; import java.util.List; -import java.util.Locale; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -21,40 +19,48 @@ public abstract class CropCard { } /** - * Plant name for identifying this crop within your mod. + * Plant id for identifying this crop within your mod. + *
+ * The id has to be unique within the mod and is used for saving. + *
+ * By default this id will be also used to determine {@link #getUnlocalizedName()} and {@link #getTexturesLocation()}. * - * The name has to be unique within the mod and is used for saving. - * By default this name will be also used to determine displayKey() and registerSprites(). + * @note changing the id or owner will cause existing crops in users' worlds to disappear. * - * @note changing name or owner will cause existing crops in users' worlds to disappear. - * - * @return Plant name + * @return Plant id */ - public abstract String getName(); + public abstract String getId(); /** - * Determine the mod id owning this crop. + * Determine the mod owning this crop. * * The owner serves as a name space. With every mod using a different owner, a mod only has to - * make sure it doesn't have conflicts with name() in itself. - * It's recommended to hard code this to your mod id as specified in the @Mod annotation. - * Do not use IC2's mod id here. + * make sure it doesn't have getId() conflicts within itself. The identifier has to be lower + * case to ensure compatibility with future versions. + *
+ * It's recommended to hard code this to your lower case mod id as specified in the @Mod + * annotation, as {@link #getUnlocalizedName()} will use it by default. + *
+ * Do not use IC2's mod id here. * - * @note changing name or owner will cause existing crops in users' worlds to disappear. + * @note changing the id or owner will cause existing crops in users' worlds to disappear. + * + * @return owning mod identifier, lower case. */ public abstract String getOwner(); /** * Translation key for display to the player. * - * It's highly recommended to specify a valid key from your language file here, e.g. add - * "yourmod.crop.yourCropName = Your crop's name" to the language file, override name() to - * return "yourCropName" and override displayName() to return "yourmod.crop."+name(). + * It's recommended to specify a valid key from your language file here. + *
+ * e.g. Add "yourmod.crop.yourCropName = Your crop's name" to the language file, + * override {@link #getId()} to return "yourCropName" and override {@link #getOwner()} to return "yourmod". * * @return Unlocalized name. */ - public String getDisplayName() { - return getName(); // return the raw name for backwards compatibility + public String getUnlocalizedName() { + return getOwner() + ".crop." + getId(); //Good enough default } /** @@ -81,14 +87,14 @@ public abstract class CropCard { if (i == 0) { String s = att[0]; if (att.length >= 2) { - s+=", "+att[1]; - if (att.length >= 3) s+=","; + s += ", " + att[1]; + if (att.length >= 3) s += ","; } return s; } if (att.length < 3) return ""; String s = att[2]; - if (att.length >= 4) s+=", "+att[3]; + if (att.length >= 4) s += ", " + att[3]; return s; } @@ -102,7 +108,7 @@ public abstract class CropCard { } /** - * Object containing the crop properties info - See ic2.api.crops.CropProperties for more info. + * Object containing the crop properties info - See {@link CropProperties} for more info. */ public abstract CropProperties getProperties(); @@ -113,13 +119,13 @@ public abstract class CropCard { * @return Attributes as an array of strings */ public String[] getAttributes() { - return new String[] {}; + return new String[0]; } /** * Determine the max crop size. * - * Currently only used for texture allocation. + * Currently used for texture allocation, growth and harvesting control (by default). */ public abstract int getMaxSize(); @@ -266,9 +272,9 @@ public abstract class CropCard { public float dropSeedChance(ICropTile crop) { if (crop.getCurrentSize() == 1) return 0; float base = 0.5F; - if (crop.getCurrentSize() == 2) base/=2F; + if (crop.getCurrentSize() == 2) base /= 2F; for (int i = 0; i < getProperties().getTier(); i++) { - base*=0.8; + base *= 0.8; } return base; } @@ -291,7 +297,7 @@ public abstract class CropCard { * @param crop reference to ICropTile */ public void onNeighbourChange(ICropTile crop) { - // + // NO-OP } /** @@ -303,7 +309,7 @@ public abstract class CropCard { return false; } - /*** + /** * Get the emitted redstone signal strength. * * @return The redstone signal strength. @@ -361,8 +367,7 @@ public abstract class CropCard { * @return Whether the plant spreads weed */ public boolean isWeed(ICropTile cropTile) { - return cropTile.getCurrentSize() >= 2 && - (cropTile.getCrop() == Crops.weed || cropTile.getStatGrowth() >= 24); + return cropTile.getCurrentSize() >= 2 && (cropTile.getCrop() == Crops.weed || cropTile.getStatGrowth() >= 24); } /** @@ -371,22 +376,8 @@ public abstract class CropCard { * @return The crop world object. */ public World getWorld(ICropTile cropTile) { - return cropTile.getWorld(); + return cropTile.getWorldObj(); } - /** - * Retrieve the crop's unlocalized name. - * @return Unlocalized name - */ - public String getUnlocalizedName() { - return "crop." + getName() + ".name"; - } - - public List getModelLocation() { - List ret = new ArrayList(); - for (int i = 1; i <= getMaxSize(); i++) { - ret.add(new ResourceLocation(getOwner().toLowerCase(Locale.ENGLISH), "blocks/crop/"+getName()+"_"+i)); - } - return ret; - } + public abstract List getTexturesLocation(); } diff --git a/src/api/java/ic2/api/crops/CropProperties.class b/src/api/java/ic2/api/crops/CropProperties.class index 31cd7c24f..11cd6c540 100644 Binary files a/src/api/java/ic2/api/crops/CropProperties.class and b/src/api/java/ic2/api/crops/CropProperties.class differ diff --git a/src/api/java/ic2/api/crops/CropSoilType.class b/src/api/java/ic2/api/crops/CropSoilType.class new file mode 100644 index 000000000..fd7b99366 Binary files /dev/null and b/src/api/java/ic2/api/crops/CropSoilType.class differ diff --git a/src/api/java/ic2/api/crops/CropSoilType.java b/src/api/java/ic2/api/crops/CropSoilType.java new file mode 100644 index 000000000..1a8dddf50 --- /dev/null +++ b/src/api/java/ic2/api/crops/CropSoilType.java @@ -0,0 +1,42 @@ +package ic2.api.crops; + +import javax.annotation.Nonnull; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; + +/** + * List of possible blocks to be used as soil for a crop. + * @author estebes + */ +public enum CropSoilType { + //DIRT(Blocks.DIRT), + FARMLAND(Blocks.FARMLAND), + MYCELIUM(Blocks.MYCELIUM), + SAND(Blocks.SAND), + SOULSAND(Blocks.SOUL_SAND); + + private CropSoilType(@Nonnull Block block) { + this.block = block; + } + + public Block getBlock() { + return this.block; + } + + /** + * Check if a block can be used as soil. + * @param block the block + * @return true if the block is a possible crop soil + */ + public static boolean contais(Block block) { + for (CropSoilType aux : CropSoilType.values()) { + if (aux.getBlock() == block) { + return true; + } + } + return false; + } + + private final Block block; +} diff --git a/src/api/java/ic2/api/crops/Crops.class b/src/api/java/ic2/api/crops/Crops.class index 8e10c6268..a97ba790f 100644 Binary files a/src/api/java/ic2/api/crops/Crops.class and b/src/api/java/ic2/api/crops/Crops.class differ diff --git a/src/api/java/ic2/api/crops/ExampleCropCard.class b/src/api/java/ic2/api/crops/ExampleCropCard.class new file mode 100644 index 000000000..774eb7d4e Binary files /dev/null and b/src/api/java/ic2/api/crops/ExampleCropCard.class differ diff --git a/src/api/java/ic2/api/crops/ExampleCropCard.java b/src/api/java/ic2/api/crops/ExampleCropCard.java new file mode 100644 index 000000000..2fc522066 --- /dev/null +++ b/src/api/java/ic2/api/crops/ExampleCropCard.java @@ -0,0 +1,53 @@ +package ic2.api.crops; + +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +import java.util.ArrayList; +import java.util.List; + +/** + * CropCard example + * @author estebes + */ +public class ExampleCropCard extends CropCard { + @Override + public String getId() { + return "example"; + } + + @Override + public String getOwner() { + return "myaddon"; + } + + /** + * See {@link CropProperties} for more info. + */ + @Override + public CropProperties getProperties() { + return new CropProperties(1, 0, 4, 0, 0, 2); + } + + @Override + public int getMaxSize() { + return 5; + } + + @Override + public ItemStack getGain(ICropTile crop) { + return new ItemStack(Items.DIAMOND, 1); + } + + @Override + public List getTexturesLocation() { + List ret = new ArrayList(getMaxSize()); + + for (int size = 1; size <= getMaxSize(); size++) { + ret.add(new ResourceLocation("myaddon", "blocks/crop/" + getId() + "_" + size)); + } + + return ret; + } +} diff --git a/src/api/java/ic2/api/crops/ICropTile.class b/src/api/java/ic2/api/crops/ICropTile.class index cc8c4eb01..adb43df8e 100644 Binary files a/src/api/java/ic2/api/crops/ICropTile.class and b/src/api/java/ic2/api/crops/ICropTile.class differ diff --git a/src/api/java/ic2/api/crops/ICropTile.java b/src/api/java/ic2/api/crops/ICropTile.java index 8df7968d6..21357bc7c 100644 --- a/src/api/java/ic2/api/crops/ICropTile.java +++ b/src/api/java/ic2/api/crops/ICropTile.java @@ -8,10 +8,12 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import ic2.api.info.ILocatable; + /** * Interface implemented by the crop tile entity. */ -public interface ICropTile { +public interface ICropTile extends ILocatable { /** * Get the crop. * @@ -91,14 +93,14 @@ public interface ICropTile { * * @return Crop nutrient storage */ - public int getStorageNutrient(); + public int getStorageNutrients(); /** * Set the crop's nutrient storage. * - * @param storageNutrient Crop nutrient storage + * @param nutrients Crop nutrient storage */ - public void setStorageNutrient(int storageNutrient); + public void setStorageNutrients(int nutrients); /** * Get the crop's hydration storage. @@ -111,9 +113,9 @@ public interface ICropTile { /** * Set the crop's water storage. * - * @param storageWater Crop water storage + * @param water Crop water storage */ - public void setStorageWater(int storageWater); + public void setStorageWater(int water); /** * Get the crop's Weed-Ex storage. @@ -125,9 +127,9 @@ public interface ICropTile { /** * Set the crop's Weed-Ex storage. * - * @param storageWeedEX Crop Weed-Ex storage + * @param weedEX Crop Weed-Ex storage */ - public void setStorageWeedEX(int storageWeedEX); + public void setStorageWeedEX(int weedEX); /** * Get the crop's plant scan level. @@ -169,7 +171,7 @@ public interface ICropTile { * * @return Crop humidity level */ - public int getHumidity(); + public int getTerrainHumidity(); /** * Get the crop's nutrient level. @@ -180,7 +182,7 @@ public interface ICropTile { * * @return Crop nutrient level */ - public int getNutrients(); + public int getTerrainNutrients(); /** * Get the crop's air quality. @@ -191,20 +193,25 @@ public interface ICropTile { * * @return Crop air quality */ - public int getAirQuality(); + public int getTerrainAirQuality(); /** * Get the crop's world. + * @deprecated This method causes a MethodNotFoundException in a obfuscated environment. + * Use {@link #getWorldObj()} instead * * @return Crop world */ + @Deprecated public World getWorld(); /** * Get the crop's location. + * @deprecated Use {@link #getPosition()} instead. * * @return Crop location */ + @Deprecated public BlockPos getLocation(); /** diff --git a/src/api/java/ic2/api/crops/package-info.class b/src/api/java/ic2/api/crops/package-info.class deleted file mode 100644 index 3ca3f3754..000000000 Binary files a/src/api/java/ic2/api/crops/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/crops/package-info.java b/src/api/java/ic2/api/crops/package-info.java deleted file mode 100644 index 6d4a180d1..000000000 --- a/src/api/java/ic2/api/crops/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.crops; -import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/ic2/api/energy/IEnergyNet.class b/src/api/java/ic2/api/energy/IEnergyNet.class index 1880b7d3e..7c4869363 100644 Binary files a/src/api/java/ic2/api/energy/IEnergyNet.class and b/src/api/java/ic2/api/energy/IEnergyNet.class differ diff --git a/src/api/java/ic2/api/energy/IEnergyNet.java b/src/api/java/ic2/api/energy/IEnergyNet.java index fc2dc58a0..4c79aa746 100644 --- a/src/api/java/ic2/api/energy/IEnergyNet.java +++ b/src/api/java/ic2/api/energy/IEnergyNet.java @@ -1,9 +1,13 @@ package ic2.api.energy; +import java.io.PrintStream; + +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import ic2.api.energy.tile.IEnergyTile; +import ic2.api.info.ILocatable; /** * Interface representing the methods provided by the global EnergyNet class. @@ -44,6 +48,11 @@ public interface IEnergyNet { */ IEnergyTile getSubTile(World world, BlockPos pos); + void addTile(T tile); + void addTile(T tile); + + void removeTile(IEnergyTile tile); + World getWorld(IEnergyTile tile); BlockPos getPos(IEnergyTile tile); @@ -58,6 +67,8 @@ public interface IEnergyNet { */ NodeStats getNodeStats(IEnergyTile tile); + boolean dumpDebugInfo(World world, BlockPos pos, PrintStream console, PrintStream chat); + /** * Determine the typical power used by the specific tier, e.g. 128 eu/t for tier 2. * @@ -73,4 +84,7 @@ public interface IEnergyNet { * @return tier */ int getTierFromPower(double power); + + void registerEventReceiver(IEnergyNetEventReceiver receiver); + void unregisterEventReceiver(IEnergyNetEventReceiver receiver); } diff --git a/src/api/java/ic2/api/energy/IEnergyNetEventReceiver.class b/src/api/java/ic2/api/energy/IEnergyNetEventReceiver.class new file mode 100644 index 000000000..c39d5b09a Binary files /dev/null and b/src/api/java/ic2/api/energy/IEnergyNetEventReceiver.class differ diff --git a/src/api/java/ic2/api/energy/IEnergyNetEventReceiver.java b/src/api/java/ic2/api/energy/IEnergyNetEventReceiver.java new file mode 100644 index 000000000..420eb10ff --- /dev/null +++ b/src/api/java/ic2/api/energy/IEnergyNetEventReceiver.java @@ -0,0 +1,20 @@ +package ic2.api.energy; + +import ic2.api.energy.tile.IEnergyTile; + +/** + * Interface for handlers being invoked after energy net changes. + * + *

Normally it's enough to listen for the neighbor update, which also happens, but using this + * mechanism allows listening to events that are not adjacent. Mechanisms that inject energy over + * a distance or provide compatibility with 3rd party energy may benefit from it. + * + *

The events will be fired after validation and only for successful changes. + * + *

WARNING: The events may (and will) be invoked from arbitrary threads. It's up to the + * implementation of IEnergyNetEventReceiver to properly synchronize them. + */ +public interface IEnergyNetEventReceiver { + void onAdd(IEnergyTile tile); + void onRemove(IEnergyTile tile); +} diff --git a/src/api/java/ic2/api/energy/event/package-info.class b/src/api/java/ic2/api/energy/event/package-info.class deleted file mode 100644 index 1b070c88f..000000000 Binary files a/src/api/java/ic2/api/energy/event/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/event/package-info.java b/src/api/java/ic2/api/energy/event/package-info.java deleted file mode 100644 index 25ed85d13..000000000 --- a/src/api/java/ic2/api/energy/event/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.energy.event; -import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/ic2/api/energy/package-info.class b/src/api/java/ic2/api/energy/package-info.class deleted file mode 100644 index 68a0db695..000000000 Binary files a/src/api/java/ic2/api/energy/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/package-info.java b/src/api/java/ic2/api/energy/package-info.java deleted file mode 100644 index 26bd21e31..000000000 --- a/src/api/java/ic2/api/energy/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.energy; -import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/ic2/api/energy/prefab/BasicEnergyTe$Sink.class b/src/api/java/ic2/api/energy/prefab/BasicEnergyTe$Sink.class new file mode 100644 index 000000000..566fb3c53 Binary files /dev/null and b/src/api/java/ic2/api/energy/prefab/BasicEnergyTe$Sink.class differ diff --git a/src/api/java/ic2/api/energy/prefab/BasicEnergyTe$Source.class b/src/api/java/ic2/api/energy/prefab/BasicEnergyTe$Source.class new file mode 100644 index 000000000..69a0e5df6 Binary files /dev/null and b/src/api/java/ic2/api/energy/prefab/BasicEnergyTe$Source.class differ diff --git a/src/api/java/ic2/api/energy/prefab/BasicEnergyTe.class b/src/api/java/ic2/api/energy/prefab/BasicEnergyTe.class new file mode 100644 index 000000000..c94b587ce Binary files /dev/null and b/src/api/java/ic2/api/energy/prefab/BasicEnergyTe.class differ diff --git a/src/api/java/ic2/api/energy/prefab/BasicEnergyTe.java b/src/api/java/ic2/api/energy/prefab/BasicEnergyTe.java new file mode 100644 index 000000000..6bd775a65 --- /dev/null +++ b/src/api/java/ic2/api/energy/prefab/BasicEnergyTe.java @@ -0,0 +1,104 @@ +package ic2.api.energy.prefab; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +/** + * BasicEnergyTe.Sink and BasicEnergyTe.Source allow integrating tile entities into the energy net + * by using them as the super class. + * + *

They implement the necessary forwards to make BasicSink/BasicSource work, provided the sub + * classes always call those forwards when overriding them. + * + *

If it's not desirable to use BasicEnergyTe, the delegates like BasicSink can also be used + * directly, provided they receive the forwards like implemented here. + * + *

Example usage, machine with 10k EU buffer, tier 2, 50 EU/tick, 100 tick process time: + *


+ * public class MyMachine extends BasicEnergyTe.Sink implements ITickable {
+ *     public MyMachine() {
+ *         super(10000, 2);
+ *     }
+ *
+ *     {@literal @}Override
+ *     public void readFromNBT(NBTTagCompound nbt) {
+ *         super.readFromNbt(nbt); // important: keep super call
+ *
+ *         this.progess = nbt.getInteger("progress");
+ *     }
+ *
+ *     {@literal @}Override
+ *     public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
+ *         nbt = super.writeToNBT(nbt); // important: keep super call
+ *
+ *         nbt.setInteger("progress", progress);
+ *
+ *         return nbt;
+ *     }
+ *
+ *     {@literal @}Override
+ *     public void update() {
+ *         if (hasWork() && getEnergyBuffer().useEnergy(50) && ++progress >= 100) {
+ *             progress = 0;
+ *             doWork();
+ *         }
+ *     }
+ *
+ *     private int progress;
+ * }
+ * 
+ */ +public class BasicEnergyTe extends TileEntity { + public static class Sink extends BasicEnergyTe { + public Sink(int capacity, int tier) { + energyBuffer = new BasicSink(this, capacity, tier); + } + } + + public static class Source extends BasicEnergyTe { + public Source(int capacity, int tier) { + energyBuffer = new BasicSource(this, capacity, tier); + } + } + + protected BasicEnergyTe() { } + + public T getEnergyBuffer() { + return energyBuffer; + } + + // forwards >> + + @Override + public void onLoad() { + energyBuffer.onLoad(); + } + + @Override + public void invalidate() { + super.invalidate(); + + energyBuffer.invalidate(); + } + + @Override + public void onChunkUnload() { + energyBuffer.onChunkUnload(); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + energyBuffer.readFromNBT(nbt); + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { + return energyBuffer.writeToNBT(super.writeToNBT(nbt)); + } + + // << forwards + + protected T energyBuffer; +} diff --git a/src/api/java/ic2/api/energy/prefab/BasicEnergyTile.class b/src/api/java/ic2/api/energy/prefab/BasicEnergyTile.class new file mode 100644 index 000000000..66d017eef Binary files /dev/null and b/src/api/java/ic2/api/energy/prefab/BasicEnergyTile.class differ diff --git a/src/api/java/ic2/api/energy/prefab/BasicEnergyTile.java b/src/api/java/ic2/api/energy/prefab/BasicEnergyTile.java new file mode 100644 index 000000000..fc913bafe --- /dev/null +++ b/src/api/java/ic2/api/energy/prefab/BasicEnergyTile.java @@ -0,0 +1,309 @@ +package ic2.api.energy.prefab; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +import net.minecraftforge.common.MinecraftForge; + +import ic2.api.energy.event.EnergyTileLoadEvent; +import ic2.api.energy.event.EnergyTileUnloadEvent; +import ic2.api.energy.tile.IEnergyTile; +import ic2.api.info.ILocatable; +import ic2.api.info.Info; +import ic2.api.item.ElectricItem; + +/** + * Common functionality for BasicSink and BasicSource. + */ +abstract class BasicEnergyTile implements ILocatable, IEnergyTile { + // ********************************** + // *** Methods for use by the mod *** + // ********************************** + + /** + * Constructor for a new BasicSink delegate. + * + * @param parent TileEntity represented by this energy sink. + * @param capacity Maximum amount of eu to store. + * @param tier IC2 tier, 1 = LV, 2 = MV, ... + */ + protected BasicEnergyTile(TileEntity parent, double capacity) { + this((Object) parent, capacity); + } + + protected BasicEnergyTile(ILocatable parent, double capacity) { + this((Object) parent, capacity); + } + + private BasicEnergyTile(Object locationProvider, double capacity) { + this.locationProvider = locationProvider; + this.capacity = capacity; + } + + protected BasicEnergyTile(World world, BlockPos pos, double capacity) { + if (world == null) throw new NullPointerException("null world"); + if (pos == null) throw new NullPointerException("null pos"); + + this.locationProvider = null; + this.world = world; + this.pos = pos; + this.capacity = capacity; + } + + // in-world te forwards >> + + /** + * Forward for the base TileEntity's update(), used for creating the energy net link. + * Either update or onLoad have to be used. + */ + public void update() { + if (!addedToEnet) onLoad(); + } + + /** + * Notification that the base TileEntity is loaded, used for creating the energy net link. + * Either update or onLoad have to be used. + */ + public void onLoad() { + if (!addedToEnet + && !getWorldObj().isRemote + && Info.isIc2Available()) { + MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); + + addedToEnet = true; + } + } + + /** + * Forward for the base TileEntity's invalidate(), used for destroying the energy net link. + * Both invalidate and onChunkUnload have to be used. + */ + public void invalidate() { + onChunkUnload(); + } + + /** + * Forward for the base TileEntity's onChunkUnload(), used for destroying the energy net link. + * Both invalidate and onChunkUnload have to be used. + */ + public void onChunkUnload() { + if (addedToEnet + && !getWorldObj().isRemote + && Info.isIc2Available()) { + MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); + + addedToEnet = false; + } + } + + /** + * Forward for the base TileEntity's readFromNBT(), used for loading the state. + * + * @param tag Compound tag as supplied by TileEntity.readFromNBT() + */ + public void readFromNBT(NBTTagCompound tag) { + NBTTagCompound data = tag.getCompoundTag(getNbtTagName()); + energyStored = data.getDouble("energy"); + } + + /** + * Forward for the base TileEntity's writeToNBT(), used for saving the state. + * + * @param tag Compound tag as supplied by TileEntity.writeToNBT() + */ + public NBTTagCompound writeToNBT(NBTTagCompound tag) { + NBTTagCompound data = new NBTTagCompound(); + + data.setDouble("energy", energyStored); + tag.setTag(getNbtTagName(), data); + + return tag; + } + + // << in-world te forwards + // methods for using this adapter >> + + /** + * Get the maximum amount of energy this sink can hold in its buffer. + * + * @return Capacity in EU. + */ + public double getCapacity() { + return capacity; + } + + /** + * Set the maximum amount of energy this sink can hold in its buffer. + * + * @param capacity1 Capacity in EU. + */ + public void setCapacity(double capacity) { + this.capacity = capacity; + } + + /** + * Determine the energy stored in this buffer. + * + * @return amount in EU, may be above capacity + */ + public double getEnergyStored() { + return energyStored; + } + + /** + * Set the stored energy to the specified amount. + * + * This is intended for server -> client synchronization, e.g. to display the stored energy in + * a GUI through getEnergyStored(). + * + * @param amount + */ + public void setEnergyStored(double amount) { + energyStored = amount; + } + + /** + * Determine the free capacity in this buffer. + * + * @return amount in EU + */ + public double getFreeCapacity() { + return capacity - energyStored; + } + + /** + * Add some energy to the output buffer. + * + * @param amount maximum amount of energy to add + * @return amount added/used, NOT remaining + */ + public double addEnergy(double amount) { + if (getWorldObj().isRemote) return 0; + if (amount > capacity - energyStored) amount = capacity - energyStored; + + energyStored += amount; + + return amount; + } + + /** + * Determine if the specified amount of energy is available. + * + * @param amount in EU + * @return true if the amount is available + */ + public boolean canUseEnergy(double amount) { + return energyStored >= amount; + } + + /** + * Use the specified amount of energy, if available. + * + * @param amount amount to use + * @return true if the amount was available + */ + public boolean useEnergy(double amount) { + if (!canUseEnergy(amount) || getWorldObj().isRemote) return false; + + energyStored -= amount; + + return true; + } + + /** + * Charge the supplied ItemStack from this energy buffer. + * + * @param stack ItemStack to charge (null is ignored) + * @return true if energy was transferred + */ + public boolean charge(ItemStack stack) { + if (stack == null || !Info.isIc2Available() || getWorldObj().isRemote) return false; + + double amount = ElectricItem.manager.charge(stack, energyStored, Math.max(getSinkTier(), getSourceTier()), false, false); + + energyStored -= amount; + + return amount > 0; + } + + /** + * Discharge the supplied ItemStack into this energy buffer. + * + * @param stack ItemStack to discharge (null is ignored) + * @param limit Transfer limit, values <= 0 will use the battery's limit + * @return true if energy was transferred + */ + public boolean discharge(ItemStack stack, double limit) { + if (stack == null || !Info.isIc2Available() || getWorldObj().isRemote) return false; + + double amount = capacity - energyStored; + if (amount <= 0) return false; + + if (limit > 0 && limit < amount) amount = limit; + + amount = ElectricItem.manager.discharge(stack, amount, Math.max(getSinkTier(), getSourceTier()), limit > 0, true, false); + + energyStored += amount; + + return amount > 0; + } + + // << methods for using this adapter + + // ****************************** + // *** Methods for use by ic2 *** + // ****************************** + + // ILocatable >> + + @Override + public World getWorldObj() { + if (world == null) initLocation(); + + return world; + } + + @Override + public BlockPos getPosition() { + if (pos == null) initLocation(); + + return pos; + } + + private void initLocation() { + if (locationProvider instanceof ILocatable) { + ILocatable provider = (ILocatable) locationProvider; + world = provider.getWorldObj(); + pos = provider.getPosition(); + } else if (locationProvider instanceof TileEntity) { + TileEntity provider = (TileEntity) locationProvider; + world = provider.getWorld(); + pos = provider.getPos(); + } else { + throw new IllegalStateException("no/incompatible location provider"); + } + } + + // << ILocatable + + protected abstract String getNbtTagName(); + + protected int getSinkTier() { + return 0; + } + + protected int getSourceTier() { + return 0; + } + + private final Object locationProvider; + protected World world; + protected BlockPos pos; + + protected double capacity; + protected double energyStored; + protected boolean addedToEnet; +} diff --git a/src/api/java/ic2/api/energy/prefab/BasicSink.class b/src/api/java/ic2/api/energy/prefab/BasicSink.class index 35d58ecb5..32434a7ee 100644 Binary files a/src/api/java/ic2/api/energy/prefab/BasicSink.class and b/src/api/java/ic2/api/energy/prefab/BasicSink.class differ diff --git a/src/api/java/ic2/api/energy/prefab/BasicSink.java b/src/api/java/ic2/api/energy/prefab/BasicSink.java index 70c29fb63..1e1614058 100644 --- a/src/api/java/ic2/api/energy/prefab/BasicSink.java +++ b/src/api/java/ic2/api/energy/prefab/BasicSink.java @@ -1,65 +1,63 @@ package ic2.api.energy.prefab; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.ITickable; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.FMLCommonHandler; - -import ic2.api.energy.event.EnergyTileLoadEvent; -import ic2.api.energy.event.EnergyTileUnloadEvent; import ic2.api.energy.tile.IEnergyEmitter; import ic2.api.energy.tile.IEnergySink; -import ic2.api.info.Info; -import ic2.api.item.ElectricItem; +import ic2.api.info.ILocatable; /** - * BasicSink is a simple adapter to provide an ic2 energy sink. + * BasicSink is a simple delegate to provide an ic2 energy sink. * - * It's designed to be attached to a tile entity as a delegate. Functionally BasicSink acts as a + *

It's designed to be attached to a tile entity as a delegate. Functionally BasicSink acts as a * one-time configurable input energy buffer, thus providing a common use case for machines. * - * Sub-classing BasicSink instead of using it as a delegate works as well, but isn't recommended. - * The delegate can be extended with additional functionality through a sub class though. + *

A simpler alternative is to use {@link BasicSinkTe.Sink}, which requires injecting into the + * type hierarchy (using it as a super class). BasicSink however can be added to any class without + * inheritance, but needs some forwards for keeping its state and registering with the energy net. * - * The constraints set by BasicSink like the strict tank-like energy buffering should provide a + *

The constraints set by BasicSink like the strict tank-like energy buffering should provide a * more easy to use and stable interface than using IEnergySink directly while aiming for * optimal performance. * - * Using BasicSink involves the following steps: - * - create a BasicSink instance in your TileEntity, typically in a field - * - forward invalidate, onChunkUnload, readFromNBT, writeToNBT and updateEntity to the BasicSink + *

Using BasicSink involves the following steps:

    + *
  • create a BasicSink instance in your TileEntity, typically in a field + *
  • forward onLoad (or update), invalidate, onChunkUnload, readFromNBT and writeToNBT to the BasicSink * instance. - * If you have other means of determining when the tile entity is fully loaded, notify onLoaded - * that way instead of forwarding updateEntity. - * - call useEnergy whenever appropriate. canUseEnergy determines if enough energy is available + *
  • call useEnergy whenever appropriate. canUseEnergy determines if enough energy is available * without consuming the energy. - * - optionally use getEnergyStored to display the output buffer charge level - * - optionally use setEnergyStored to sync the stored energy to the client (e.g. in the Container) + *
  • optionally use getEnergyStored to display the output buffer charge level + *
  • optionally use setEnergyStored to sync the stored energy to the client (e.g. in the Container)
* - * Example implementation code: - * @code{.java} + *

Example implementation code: + *


  * public class SomeTileEntity extends TileEntity {
  *     // new basic energy sink, 1000 EU buffer, tier 1 (32 EU/t, LV)
  *     private BasicSink ic2EnergySink = new BasicSink(this, 1000, 1);
  *
- *     @Override
+ *     {@literal @}Override
+ *     public void onLoad() {
+ *         ic2EnergySink.onLoad(); // notify the energy sink
+ *         ...
+ *     }
+ *
+ *     {@literal @}Override
  *     public void invalidate() {
  *         ic2EnergySink.invalidate(); // notify the energy sink
  *         ...
  *         super.invalidate(); // this is important for mc!
  *     }
  *
- *     @Override
+ *     {@literal @}Override
  *     public void onChunkUnload() {
  *         ic2EnergySink.onChunkUnload(); // notify the energy sink
  *         ...
  *     }
  *
- *     @Override
+ *     {@literal @}Override
  *     public void readFromNBT(NBTTagCompound tag) {
  *         super.readFromNBT(tag);
  *
@@ -67,7 +65,7 @@ import ic2.api.item.ElectricItem;
  *         ...
  *     }
  *
- *     @Override
+ *     {@literal @}Override
  *     public void writeToNBT(NBTTagCompound tag) {
  *         super.writeToNBT(tag);
  *
@@ -75,10 +73,8 @@ import ic2.api.item.ElectricItem;
  *         ...
  *     }
  *
- *     @Override
+ *     {@literal @}Override
  *     public void update() {
- *         ic2EnergySink.update(); // notify the energy sink
- *         ...
  *         if (ic2EnergySink.useEnergy(5)) { // use 5 eu from the sink's buffer this tick
  *             ... // do something with the energy
  *         }
@@ -87,257 +83,43 @@ import ic2.api.item.ElectricItem;
  *
  *     ...
  * }
- * @endcode
+ * 
*/ -public class BasicSink extends TileEntity implements IEnergySink, ITickable { - // ********************************** - // *** Methods for use by the mod *** - // ********************************** - +public class BasicSink extends BasicEnergyTile implements IEnergySink { /** * Constructor for a new BasicSink delegate. * - * @param parent1 TileEntity represented by this energy sink. - * @param capacity1 Maximum amount of eu to store. - * @param tier1 IC2 tier, 1 = LV, 2 = MV, ... + * @param parent TileEntity represented by this energy sink. + * @param capacity Maximum amount of eu to store. + * @param tier IC2 tier, 1 = LV, 2 = MV, ... */ - public BasicSink(TileEntity parent1, int capacity1, int tier1) { - this.parent = parent1; - this.capacity = capacity1; - this.tier = tier1; + public BasicSink(TileEntity parent, double capacity, int tier) { + super(parent, capacity); + + this.tier = tier; } - // in-world te forwards >> + public BasicSink(ILocatable parent, double capacity, int tier) { + super(parent, capacity); - /** - * Forward for the base TileEntity's update(), used for creating the energy net link. - * Either updateEntity or onLoaded have to be used. - */ - @Override - public void update() { - if (!addedToEnet) onLoaded(); + this.tier = tier; } - /** - * Notification that the base TileEntity finished loaded, for advanced uses. - * Either updateEntity or onLoaded have to be used. - */ - public void onLoaded() { - if (!addedToEnet && - !parent.getWorld().isRemote && - Info.isIc2Available()) { - worldObj = parent.getWorld(); - pos = parent.getPos(); + public BasicSink(World world, BlockPos pos, double capacity, int tier) { + super(world, pos, capacity); - MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); - - addedToEnet = true; - } - } - - /** - * Forward for the base TileEntity's invalidate(), used for destroying the energy net link. - * Both invalidate and onChunkUnload have to be used. - */ - @Override - public void invalidate() { - super.invalidate(); - - onChunkUnload(); - } - - /** - * Forward for the base TileEntity's onChunkUnload(), used for destroying the energy net link. - * Both invalidate and onChunkUnload have to be used. - */ - @Override - public void onChunkUnload() { - if (addedToEnet && - Info.isIc2Available()) { - MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); - - addedToEnet = false; - } - } - - /** - * Forward for the base TileEntity's readFromNBT(), used for loading the state. - * - * @param tag Compound tag as supplied by TileEntity.readFromNBT() - */ - @Override - public void readFromNBT(NBTTagCompound tag) { - super.readFromNBT(tag); - - NBTTagCompound data = tag.getCompoundTag("IC2BasicSink"); - - energyStored = data.getDouble("energy"); - } - - /** - * Forward for the base TileEntity's writeToNBT(), used for saving the state. - * - * @param tag Compound tag as supplied by TileEntity.writeToNBT() - */ - @Override - public NBTTagCompound writeToNBT(NBTTagCompound tag) { - try { - super.writeToNBT(tag); - } catch (RuntimeException e) { - // happens if this is a delegate, ignore - } - - NBTTagCompound data = new NBTTagCompound(); - - data.setDouble("energy", energyStored); - - tag.setTag("IC2BasicSink", data); - - return tag; - } - - // << in-world te forwards - // methods for using this adapter >> - - /** - * Get the maximum amount of energy this sink can hold in its buffer. - * - * @return Capacity in EU. - */ - public int getCapacity() { - return capacity; - } - - /** - * Set the maximum amount of energy this sink can hold in its buffer. - * - * @param capacity1 Capacity in EU. - */ - public void setCapacity(int capacity1) { - this.capacity = capacity1; - } - - /** - * Get the IC2 energy tier for this sink. - * - * @return IC2 Tier. - */ - public int getTier() { - return tier; + this.tier = tier; } /** * Set the IC2 energy tier for this sink. * - * @param tier1 IC2 Tier. + * @param tier IC2 Tier. */ - public void setTier(int tier1) { - this.tier = tier1; + public void setSinkTier(int tier) { + this.tier = tier; } - /** - * Determine the energy stored in the sink's input buffer. - * - * @return amount in EU, may be above capacity - */ - public double getEnergyStored() { - return energyStored; - } - - /** - * Set the stored energy to the specified amount. - * - * This is intended for server -> client synchronization, e.g. to display the stored energy in - * a GUI through getEnergyStored(). - * - * @param amount - */ - public void setEnergyStored(double amount) { - energyStored = amount; - } - - /** - * Determine if the specified amount of energy is available. - * - * @param amount in EU - * @return true if the amount is available - */ - public boolean canUseEnergy(double amount) { - return energyStored >= amount; - } - - /** - * Use the specified amount of energy, if available. - * - * @param amount amount to use - * @return true if the amount was available - */ - public boolean useEnergy(double amount) { - if (canUseEnergy(amount) && !FMLCommonHandler.instance().getEffectiveSide().isClient()) { - energyStored -= amount; - - return true; - } - return false; - } - - /** - * Discharge the supplied ItemStack into this sink's energy buffer. - * - * @param stack ItemStack to discharge (null is ignored) - * @param limit Transfer limit, values <= 0 will use the battery's limit - * @return true if energy was transferred - */ - public boolean discharge(ItemStack stack, int limit) { - if (stack == null || !Info.isIc2Available()) return false; - - double amount = capacity - energyStored; - if (amount <= 0) return false; - - if (limit > 0 && limit < amount) amount = limit; - - amount = ElectricItem.manager.discharge(stack, amount, tier, limit > 0, true, false); - - energyStored += amount; - - return amount > 0; - } - - // << methods for using this adapter - - // backwards compatibility (ignore these) >> - - @Deprecated - public void onupdate() { - update(); - } - - @Deprecated - public void onInvalidate() { - invalidate(); - } - - @Deprecated - public void onOnChunkUnload() { - onChunkUnload(); - } - - @Deprecated - public void onReadFromNbt(NBTTagCompound tag) { - readFromNBT(tag); - } - - @Deprecated - public void onWriteToNbt(NBTTagCompound tag) { - writeToNBT(tag); - } - - // << backwards compatibility - - // ****************************** - // *** Methods for use by ic2 *** - // ****************************** - // energy net interface >> @Override @@ -364,11 +146,10 @@ public class BasicSink extends TileEntity implements IEnergySink, ITickable { // << energy net interface + @Override + protected String getNbtTagName() { + return "IC2BasicSink"; + } - public final TileEntity parent; - - protected int capacity; protected int tier; - protected double energyStored; - protected boolean addedToEnet; } diff --git a/src/api/java/ic2/api/energy/prefab/BasicSinkSource.class b/src/api/java/ic2/api/energy/prefab/BasicSinkSource.class new file mode 100644 index 000000000..d81177d46 Binary files /dev/null and b/src/api/java/ic2/api/energy/prefab/BasicSinkSource.class differ diff --git a/src/api/java/ic2/api/energy/prefab/BasicSinkSource.java b/src/api/java/ic2/api/energy/prefab/BasicSinkSource.java new file mode 100644 index 000000000..3936ca843 --- /dev/null +++ b/src/api/java/ic2/api/energy/prefab/BasicSinkSource.java @@ -0,0 +1,114 @@ +package ic2.api.energy.prefab; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +import ic2.api.energy.EnergyNet; +import ic2.api.energy.tile.IEnergySink; +import ic2.api.energy.tile.IEnergySource; +import ic2.api.info.ILocatable; + +/** + * Combination of BasicSink and BasicSource, see their respective documentation for details. + * + *

A subclass still has to implement acceptsEnergyFrom and emitsEnergyTo. + */ +public abstract class BasicSinkSource extends BasicEnergyTile implements IEnergySink, IEnergySource { + public BasicSinkSource(TileEntity parent, double capacity, int sinkTier, int sourceTier) { + super(parent, capacity); + + this.sinkTier = sinkTier; + this.sourceTier = sourceTier; + double power = EnergyNet.instance.getPowerFromTier(sourceTier); + + if (getCapacity() < power) setCapacity(power); + } + + public BasicSinkSource(ILocatable parent, double capacity, int sinkTier, int sourceTier) { + super(parent, capacity); + + this.sinkTier = sinkTier; + this.sourceTier = sourceTier; + double power = EnergyNet.instance.getPowerFromTier(sourceTier); + + if (getCapacity() < power) setCapacity(power); + } + + public BasicSinkSource(World world, BlockPos pos, double capacity, int sinkTier, int sourceTier) { + super(world, pos, capacity); + + this.sinkTier = sinkTier; + this.sourceTier = sourceTier; + double power = EnergyNet.instance.getPowerFromTier(sourceTier); + + if (getCapacity() < power) setCapacity(power); + } + + /** + * Set the IC2 energy tier for this sink. + * + * @param tier IC2 Tier. + */ + public void setSinkTier(int tier) { + this.sinkTier = tier; + } + + /** + * Set the IC2 energy tier for this source. + * + * @param tier IC2 Tier. + */ + public void setSourceTier(int tier) { + double power = EnergyNet.instance.getPowerFromTier(tier); + + if (getCapacity() < power) setCapacity(power); + + this.sourceTier = tier; + } + + // energy net interface >> + + @Override + public double getDemandedEnergy() { + return Math.max(0, capacity - energyStored); + } + + @Override + public double injectEnergy(EnumFacing directionFrom, double amount, double voltage) { + energyStored += amount; + + return 0; + } + + @Override + public int getSinkTier() { + return sinkTier; + } + + @Override + public double getOfferedEnergy() { + return energyStored; + } + + @Override + public void drawEnergy(double amount) { + energyStored -= amount; + } + + @Override + public int getSourceTier() { + return sourceTier; + } + + // << energy net interface + + @Override + protected String getNbtTagName() { + return "IC2BasicSinkSource"; + } + + protected int sinkTier; + protected int sourceTier; +} diff --git a/src/api/java/ic2/api/energy/prefab/BasicSource.class b/src/api/java/ic2/api/energy/prefab/BasicSource.class index 1ac62875a..aec40ce5d 100644 Binary files a/src/api/java/ic2/api/energy/prefab/BasicSource.class and b/src/api/java/ic2/api/energy/prefab/BasicSource.class differ diff --git a/src/api/java/ic2/api/energy/prefab/BasicSource.java b/src/api/java/ic2/api/energy/prefab/BasicSource.java index 9715cd4bd..9efba8de7 100644 --- a/src/api/java/ic2/api/energy/prefab/BasicSource.java +++ b/src/api/java/ic2/api/energy/prefab/BasicSource.java @@ -1,66 +1,64 @@ package ic2.api.energy.prefab; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.ITickable; - -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import ic2.api.energy.EnergyNet; -import ic2.api.energy.event.EnergyTileLoadEvent; -import ic2.api.energy.event.EnergyTileUnloadEvent; import ic2.api.energy.tile.IEnergyAcceptor; import ic2.api.energy.tile.IEnergySource; -import ic2.api.info.Info; -import ic2.api.item.ElectricItem; +import ic2.api.info.ILocatable; /** - * BasicSource is a simple adapter to provide an ic2 energy source. + * BasicSource is a simple delegate to add an ic2 energy source. * - * It's designed to be attached to a tile entity as a delegate. Functionally BasicSource acts as a + *

It's designed to be attached to a tile entity as a delegate. Functionally BasicSource acts as a * one-time configurable output energy buffer, thus providing a common use case for generators. * - * Sub-classing BasicSource instead of using it as a delegate works as well, but isn't recommended. - * The delegate can be extended with additional functionality through a sub class though. + *

A simpler alternative is to use {@link BasicSinkTe.Source}, which requires injecting into the + * type hierarchy (using it as a super class). BasicSource however can be added to any class without + * inheritance, but needs some forwards for keeping its state and registering with the energy net. * - * The constraints set by BasicSource like the strict tank-like energy buffering should provide a + *

The constraints set by BasicSource like the strict tank-like energy buffering should provide a * more easy to use and stable interface than using IEnergySource directly while aiming for * optimal performance. * - * Using BasicSource involves the following steps: - * - create a BasicSource instance in your TileEntity, typically in a field - * - forward invalidate, onChunkUnload, readFromNBT, writeToNBT and updateEntity to the BasicSource + *

Using BasicSource involves the following steps:

    + *
  • create a BasicSource instance in your TileEntity, typically in a field + *
  • forward onLoad (or update), invalidate, onChunkUnload, readFromNBT ans writeToNBT to the BasicSource * instance. - * If you have other means of determining when the tile entity is fully loaded, notify onLoaded - * that way instead of forwarding updateEntity. - * - call addEnergy whenever appropriate, using getFreeCapacity may determine if e.g. the generator + *
  • call addEnergy whenever appropriate, using getFreeCapacity may determine if e.g. the generator * should run - * - optionally use getEnergyStored to display the output buffer charge level - * - optionally use setEnergyStored to sync the stored energy to the client (e.g. in the Container) + *
  • optionally use getEnergyStored to display the output buffer charge level + *
  • optionally use setEnergyStored to sync the stored energy to the client (e.g. in the Container)
* - * Example implementation code: - * @code{.java} + *

Example implementation code: + *


  * public class SomeTileEntity extends TileEntity {
  *     // new basic energy source, 1000 EU buffer, tier 1 (32 EU/t, LV)
  *     private BasicSource ic2EnergySource = new BasicSource(this, 1000, 1);
  *
- *     @Override
+ *     {@literal @}Override
+ *     public void onLoad() {
+ *         ic2EnergySource.onLoad(); // notify the energy source
+ *         ...
+ *     }
+ *
+ *     {@literal @}Override
  *     public void invalidate() {
  *         ic2EnergySource.invalidate(); // notify the energy source
  *         ...
  *         super.invalidate(); // this is important for mc!
  *     }
  *
- *     @Override
+ *     {@literal @}Override
  *     public void onChunkUnload() {
  *         ic2EnergySource.onChunkUnload(); // notify the energy source
  *         ...
  *     }
  *
- *     @Override
+ *     {@literal @}Override
  *     public void readFromNBT(NBTTagCompound tag) {
  *         super.readFromNBT(tag);
  *
@@ -68,7 +66,7 @@ import ic2.api.item.ElectricItem;
  *         ...
  *     }
  *
- *     @Override
+ *     {@literal @}Override
  *     public void writeToNBT(NBTTagCompound tag) {
  *         super.writeToNBT(tag);
  *
@@ -76,23 +74,17 @@ import ic2.api.item.ElectricItem;
  *         ...
  *     }
  *
- *     @Override
+ *     {@literal @}Override
  *     public void update() {
- *         ic2EnergySource.update(); // notify the energy source
- *         ...
  *         ic2EnergySource.addEnergy(5); // add 5 eu to the source's buffer this tick
  *         ...
  *     }
  *
  *     ...
  * }
- * @endcode
+ * 
*/ -public class BasicSource extends TileEntity implements IEnergySource, ITickable { - // ********************************** - // *** Methods for use by the mod *** - // ********************************** - +public class BasicSource extends BasicEnergyTile implements IEnergySource { /** * Constructor for a new BasicSource delegate. * @@ -100,134 +92,31 @@ public class BasicSource extends TileEntity implements IEnergySource, ITickable * @param capacity1 Maximum amount of eu to store. * @param tier1 IC2 tier, 1 = LV, 2 = MV, ... */ - public BasicSource(TileEntity parent1, double capacity1, int tier1) { - double power = EnergyNet.instance.getPowerFromTier(tier1); + public BasicSource(TileEntity parent, double capacity, int tier) { + super(parent, capacity); - this.parent = parent1; - this.capacity = capacity1 < power ? power : capacity1; - this.tier = tier1; - this.power = power; + this.tier = tier; + double power = EnergyNet.instance.getPowerFromTier(tier); + + if (getCapacity() < power) setCapacity(power); } - // in-world te forwards >> + public BasicSource(ILocatable parent, double capacity, int tier) { + super(parent, capacity); - /** - * Forward for the base TileEntity's update(), used for creating the energy net link. - * Either updateEntity or onLoaded have to be used. - */ - @Override - public void update() { - if (!addedToEnet) onLoaded(); + this.tier = tier; + double power = EnergyNet.instance.getPowerFromTier(tier); + + if (getCapacity() < power) setCapacity(power); } - /** - * Notification that the base TileEntity finished loading, for advanced uses. - * Either updateEntity or onLoaded have to be used. - */ - public void onLoaded() { - if (!addedToEnet && - !parent.getWorld().isRemote && - Info.isIc2Available()) { - worldObj = parent.getWorld(); - pos = parent.getPos(); + public BasicSource(World world, BlockPos pos, double capacity, int tier) { + super(world, pos, capacity); - MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); + this.tier = tier; + double power = EnergyNet.instance.getPowerFromTier(tier); - addedToEnet = true; - } - } - - /** - * Forward for the base TileEntity's invalidate(), used for destroying the energy net link. - * Both invalidate and onChunkUnload have to be used. - */ - @Override - public void invalidate() { - super.invalidate(); - - onChunkUnload(); - } - - /** - * Forward for the base TileEntity's onChunkUnload(), used for destroying the energy net link. - * Both invalidate and onChunkUnload have to be used. - */ - @Override - public void onChunkUnload() { - if (addedToEnet && - Info.isIc2Available()) { - MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); - - addedToEnet = false; - } - } - - /** - * Forward for the base TileEntity's readFromNBT(), used for loading the state. - * - * @param tag Compound tag as supplied by TileEntity.readFromNBT() - */ - @Override - public void readFromNBT(NBTTagCompound tag) { - super.readFromNBT(tag); - - NBTTagCompound data = tag.getCompoundTag("IC2BasicSource"); - - energyStored = data.getDouble("energy"); - } - - /** - * Forward for the base TileEntity's writeToNBT(), used for saving the state. - * - * @param tag Compound tag as supplied by TileEntity.writeToNBT() - */ - @Override - public NBTTagCompound writeToNBT(NBTTagCompound tag) { - try { - super.writeToNBT(tag); - } catch (RuntimeException e) { - // happens if this is a delegate, ignore - } - - NBTTagCompound data = new NBTTagCompound(); - - data.setDouble("energy", energyStored); - - tag.setTag("IC2BasicSource", data); - - return tag; - } - - // << in-world te forwards - // methods for using this adapter >> - - /** - * Get the maximum amount of energy this source can hold in its buffer. - * - * @return Capacity in EU. - */ - public double getCapacity() { - return capacity; - } - - /** - * Set the maximum amount of energy this source can hold in its buffer. - * - * @param capacity1 Capacity in EU. - */ - public void setCapacity(double capacity1) { - if (capacity1 < power) capacity1 = power; - - this.capacity = capacity1; - } - - /** - * Get the IC2 energy tier for this source. - * - * @return IC2 Tier. - */ - public int getTier() { - return tier; + if (getCapacity() < power) setCapacity(power); } /** @@ -235,112 +124,14 @@ public class BasicSource extends TileEntity implements IEnergySource, ITickable * * @param tier1 IC2 Tier. */ - public void setTier(int tier1) { - double power = EnergyNet.instance.getPowerFromTier(tier1); + public void setSourceTier(int tier) { + double power = EnergyNet.instance.getPowerFromTier(tier); - if (capacity < power) capacity = power; + if (getCapacity() < power) setCapacity(power); - this.tier = tier1; - this.power = power; + this.tier = tier; } - - /** - * Determine the energy stored in the source's output buffer. - * - * @return amount in EU - */ - public double getEnergyStored() { - return energyStored; - } - - /** - * Set the stored energy to the specified amount. - * - * This is intended for server -> client synchronization, e.g. to display the stored energy in - * a GUI through getEnergyStored(). - * - * @param amount - */ - public void setEnergyStored(double amount) { - energyStored = amount; - } - - /** - * Determine the free capacity in the source's output buffer. - * - * @return amount in EU - */ - public double getFreeCapacity() { - return capacity - energyStored; - } - - /** - * Add some energy to the output buffer. - * - * @param amount maximum amount of energy to add - * @return amount added/used, NOT remaining - */ - public double addEnergy(double amount) { - if (FMLCommonHandler.instance().getEffectiveSide().isClient()) return 0; - if (amount > capacity - energyStored) amount = capacity - energyStored; - - energyStored += amount; - - return amount; - } - - /** - * Charge the supplied ItemStack from this source's energy buffer. - * - * @param stack ItemStack to charge (null is ignored) - * @return true if energy was transferred - */ - public boolean charge(ItemStack stack) { - if (stack == null || !Info.isIc2Available()) return false; - - double amount = ElectricItem.manager.charge(stack, energyStored, tier, false, false); - - energyStored -= amount; - - return amount > 0; - } - - // << methods for using this adapter - - // backwards compatibility (ignore these) >> - - @Deprecated - public void onupdate() { - update(); - } - - @Deprecated - public void onInvalidate() { - invalidate(); - } - - @Deprecated - public void onOnChunkUnload() { - onChunkUnload(); - } - - @Deprecated - public void onReadFromNbt(NBTTagCompound tag) { - readFromNBT(tag); - } - - @Deprecated - public void onWriteToNbt(NBTTagCompound tag) { - writeToNBT(tag); - } - - // << backwards compatibility - - // ****************************** - // *** Methods for use by ic2 *** - // ****************************** - // energy net interface >> @Override @@ -350,7 +141,7 @@ public class BasicSource extends TileEntity implements IEnergySource, ITickable @Override public double getOfferedEnergy() { - return Math.min(energyStored, power); + return energyStored; } @Override @@ -365,12 +156,10 @@ public class BasicSource extends TileEntity implements IEnergySource, ITickable // << energy net interface + @Override + protected String getNbtTagName() { + return "IC2BasicSource"; + } - public final TileEntity parent; - - protected double capacity; protected int tier; - protected double power; - protected double energyStored; - protected boolean addedToEnet; } diff --git a/src/api/java/ic2/api/energy/prefab/package-info.class b/src/api/java/ic2/api/energy/prefab/package-info.class deleted file mode 100644 index 59b4c1ff8..000000000 Binary files a/src/api/java/ic2/api/energy/prefab/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/prefab/package-info.java b/src/api/java/ic2/api/energy/prefab/package-info.java deleted file mode 100644 index f640ee1de..000000000 --- a/src/api/java/ic2/api/energy/prefab/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.energy.prefab; -import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/ic2/api/energy/tile/IChargingSlot.class b/src/api/java/ic2/api/energy/tile/IChargingSlot.class new file mode 100644 index 000000000..761910731 Binary files /dev/null and b/src/api/java/ic2/api/energy/tile/IChargingSlot.class differ diff --git a/src/api/java/ic2/api/energy/tile/IChargingSlot.java b/src/api/java/ic2/api/energy/tile/IChargingSlot.java new file mode 100644 index 000000000..2238326ea --- /dev/null +++ b/src/api/java/ic2/api/energy/tile/IChargingSlot.java @@ -0,0 +1,16 @@ +package ic2.api.energy.tile; + +/** + * Represents a slot (or set of slots) that can have electric items in them to be charged + * + * @author Chocohead + */ +public interface IChargingSlot { + /** + * Called when the energy component is ticked to fill the slots + * + * @param amount The amount of energy available for the slot(s) + * @return The amount of energy used charging the items in the slot(s) + */ + public double charge(double amount); +} \ No newline at end of file diff --git a/src/api/java/ic2/api/energy/tile/IColoredEnergyTile.class b/src/api/java/ic2/api/energy/tile/IColoredEnergyTile.class new file mode 100644 index 000000000..b364517df Binary files /dev/null and b/src/api/java/ic2/api/energy/tile/IColoredEnergyTile.class differ diff --git a/src/api/java/ic2/api/energy/tile/IColoredEnergyTile.java b/src/api/java/ic2/api/energy/tile/IColoredEnergyTile.java new file mode 100644 index 000000000..2ad9c42c8 --- /dev/null +++ b/src/api/java/ic2/api/energy/tile/IColoredEnergyTile.java @@ -0,0 +1,21 @@ +package ic2.api.energy.tile; + +import net.minecraft.item.EnumDyeColor; +import net.minecraft.util.EnumFacing; + +/** + * Interface, that allows Blocks to be colored and have their connectivity based on that color. + * This allows for any Energy Tile to be colored. (Conductors, Sinks, Sources) + * @author Aroma1997 + */ +public interface IColoredEnergyTile extends IEnergyTile { + + /** + * This is to get a Energy Tile's color for the given side. Mainly used for checking connectivity. + * @param side The side you want to get the color from. + * @return The color of the Energy Tile at the given side or null, if it's uncolored. + */ + EnumDyeColor getColor(EnumFacing side); + + +} diff --git a/src/api/java/ic2/api/energy/tile/IDischargingSlot.class b/src/api/java/ic2/api/energy/tile/IDischargingSlot.class new file mode 100644 index 000000000..06518bd86 Binary files /dev/null and b/src/api/java/ic2/api/energy/tile/IDischargingSlot.class differ diff --git a/src/api/java/ic2/api/energy/tile/IDischargingSlot.java b/src/api/java/ic2/api/energy/tile/IDischargingSlot.java new file mode 100644 index 000000000..64ea69bd8 --- /dev/null +++ b/src/api/java/ic2/api/energy/tile/IDischargingSlot.java @@ -0,0 +1,17 @@ +package ic2.api.energy.tile; + +/** + * Represents a slot (or set of slots) that can have electric items in them to be discharged + * + * @author Chocohead + */ +public interface IDischargingSlot { + /** + * Called when the energy component is ticked to empty the slots + * + * @param space The amount of free space for energy that can be stored + * @param ignoreLimit Whether to ignore the discharge limit of the item in the slot(s) + * @return The amount of energy discharged from the items in the slot(s) + */ + public double discharge(double space, boolean ignoreLimit); +} \ No newline at end of file diff --git a/src/api/java/ic2/api/energy/tile/IEnergySource.java b/src/api/java/ic2/api/energy/tile/IEnergySource.java index 44b952a56..03c1ebd0f 100644 --- a/src/api/java/ic2/api/energy/tile/IEnergySource.java +++ b/src/api/java/ic2/api/energy/tile/IEnergySource.java @@ -2,25 +2,27 @@ package ic2.api.energy.tile; /** * Allows a tile entity (mostly a generator) to emit energy. - * + * * See ic2/api/energy/usage.txt for an overall description of the energy net api. */ public interface IEnergySource extends IEnergyEmitter { /** - * Energy output provided by the source this tick. - * This is typically Math.min(stored energy, max output/tick). - * + * Maximum energy output provided by the source this tick, typically the stored energy. + * + *

The value will be limited to the source tier's power multiplied with the packet count + * (see {@link IMultiEnergySource}, default 1). + * * @note Modifying the energy net from this method is disallowed. - * + * * @return Energy offered this tick */ double getOfferedEnergy(); /** * Draw energy from this source's buffer. - * - * If the source doesn't have a buffer, this is a no-op. - * + * + *

If the source doesn't have a buffer, this may be a no-op. + * * @param amount amount of EU to draw, may be negative */ void drawEnergy(double amount); @@ -28,7 +30,7 @@ public interface IEnergySource extends IEnergyEmitter { /** * Determine the tier of this energy source. * 1 = LV, 2 = MV, 3 = HV, 4 = EV etc. - * + * * @note Modifying the energy net from this method is disallowed. * * @return tier of this energy source diff --git a/src/api/java/ic2/api/energy/tile/IOverloadHandler.java b/src/api/java/ic2/api/energy/tile/IOverloadHandler.java index db2f39caf..ebaeb9e83 100644 --- a/src/api/java/ic2/api/energy/tile/IOverloadHandler.java +++ b/src/api/java/ic2/api/energy/tile/IOverloadHandler.java @@ -9,9 +9,9 @@ public interface IOverloadHandler { * Called when overloaded. This will override the default explosion. * The default explosion will therefore NOT happen, when you return true here. * If you return false, you can use this as a onExplode hook, but still let the default explosion happen. - * @note Would set the block to air and cause an explosion of power 2.5 by default + * @note Will set the block to air and cause an explosion of power 2.5 if false is returned * @param tier The tier of power, that was injected into the energy sink, that caused it to explode. - * @return Whether you the default explosion should be cancelled. + * @return Whether the default explosion should be cancelled. */ boolean onOverload(int tier); } \ No newline at end of file diff --git a/src/api/java/ic2/api/energy/tile/package-info.class b/src/api/java/ic2/api/energy/tile/package-info.class deleted file mode 100644 index 8f2d38743..000000000 Binary files a/src/api/java/ic2/api/energy/tile/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/energy/tile/package-info.java b/src/api/java/ic2/api/energy/tile/package-info.java deleted file mode 100644 index 565a16e14..000000000 --- a/src/api/java/ic2/api/energy/tile/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.energy.tile; -import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/ic2/api/energy/usage.txt b/src/api/java/ic2/api/energy/usage.txt index e3c9de817..bad72a93d 100644 --- a/src/api/java/ic2/api/energy/usage.txt +++ b/src/api/java/ic2/api/energy/usage.txt @@ -89,6 +89,10 @@ An energy conductor has to post the following events: Additionally the interface IEnergyConductor has to be implemented. +-- general --- +Optionally, you can implement the interface IColoredEnergyTile, which allows for some basic color-based +connectivity. This can be used for IEnergyConductors, but is not limited to them. + ------------------------------ -- Energy Network Delegates -- diff --git a/src/api/java/ic2/api/event/TeBlockFinalCallEvent.class b/src/api/java/ic2/api/event/TeBlockFinalCallEvent.class new file mode 100644 index 000000000..98ae85734 Binary files /dev/null and b/src/api/java/ic2/api/event/TeBlockFinalCallEvent.class differ diff --git a/src/api/java/ic2/api/event/TeBlockFinalCallEvent.java b/src/api/java/ic2/api/event/TeBlockFinalCallEvent.java new file mode 100644 index 000000000..3b1958d4f --- /dev/null +++ b/src/api/java/ic2/api/event/TeBlockFinalCallEvent.java @@ -0,0 +1,20 @@ +package ic2.api.event; + +import net.minecraftforge.fml.common.eventhandler.Event; + +import ic2.api.info.ITeBlock; + +/** This event is a notification for an internal event you might will to subscribe to if you're using ITeBlock, hence it is empty. + *

+ * For more information such as why this event exists, when it's posted, and how to react to it properly, see {@link ITeBlock}. + *

+ * + * @see ITeBlock + * + * @since IC2 2.6.67 + * @version 1.0 + * + * @author Chocohead + */ +public final class TeBlockFinalCallEvent extends Event { +} \ No newline at end of file diff --git a/src/api/java/ic2/api/event/package-info.class b/src/api/java/ic2/api/event/package-info.class deleted file mode 100644 index c1ce15887..000000000 Binary files a/src/api/java/ic2/api/event/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/event/package-info.java b/src/api/java/ic2/api/event/package-info.java deleted file mode 100644 index 71ba156af..000000000 --- a/src/api/java/ic2/api/event/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.event; -import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/ic2/api/info/ILocatable.class b/src/api/java/ic2/api/info/ILocatable.class new file mode 100644 index 000000000..9f77e09d6 Binary files /dev/null and b/src/api/java/ic2/api/info/ILocatable.class differ diff --git a/src/api/java/ic2/api/info/ILocatable.java b/src/api/java/ic2/api/info/ILocatable.java new file mode 100644 index 000000000..47bc34428 --- /dev/null +++ b/src/api/java/ic2/api/info/ILocatable.java @@ -0,0 +1,24 @@ +package ic2.api.info; + +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +/** + * Interface for things, that have a location. + * The function names are the way they are, because of obfuscation issues. + * See https://github.com/md-5/SpecialSource/issues/12 + * @author Aroma1997 + */ +public interface ILocatable { + + /** + * @return the position of the object. + */ + BlockPos getPosition(); + + /** + * @return the world of this object. + */ + World getWorldObj(); + +} diff --git a/src/api/java/ic2/api/info/ITeBlock.class b/src/api/java/ic2/api/info/ITeBlock.class new file mode 100644 index 000000000..5de8990ad Binary files /dev/null and b/src/api/java/ic2/api/info/ITeBlock.class differ diff --git a/src/api/java/ic2/api/info/ITeBlock.java b/src/api/java/ic2/api/info/ITeBlock.java new file mode 100644 index 000000000..7fc6665a4 --- /dev/null +++ b/src/api/java/ic2/api/info/ITeBlock.java @@ -0,0 +1,317 @@ +package ic2.api.info; + +import net.minecraft.block.material.Material; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.ResourceLocation; + +import net.minecraftforge.common.MinecraftForge; + +import ic2.api.event.TeBlockFinalCallEvent; +import ic2.api.item.ITeBlockSpecialItem; +import ic2.api.tile.IWrenchable; + +/** First of all, yes this class is empty. It's public documentation for the actual internal interface ITeBlock. Use the internal one not this! + *

+ * You may be asking, why would an internal interface need documenting? Well, the answer is so people can use TileEntityBlock. + * That class is the base for all IC2 tile entities, so by being able to use that you're level to IC2. + * Many methods are protected in there too, as they're only designed to be called by BlockTileEntity (which is the block all IC2 tile entities will be on), + * by being able to extend it means all those methods you can now extend and be confident they will be called correctly. + *

+ *

+ * Because it allows effectively level control to IC2 itself, this gives you near total control of your tile entities: + *

+ * You can pick whether each of your tile entity items show up in creative, and the order in which they do.
+ * There is a proper separation between each registered ITeBlock by resource location, rather than everything being inserted into a single enum. + * You also receive your own instance of BlockTileEntity and ItemBlockTileEntity rather than having to use IC2's own one.
+ * All the language keys and blockstate file are in your own assets (which you can, and in fact have to, pick). + * You can have custom item models with non-standard model locations. + *
+ * The event allows you to properly register your own version of TeBlock in a way that will be as fully supported as is physically possible. + * It's not in the actual API itself as it's heavily dependent on internal classes, so you have this instead. + * This is also probably the most documented thing in the entire IC2 API. I'm too kind really. ;) + *

+ *
+ *

+ * So that's all well and good, but what you really want is an example of how to do it properly. Good idea, let's go. + *


+ *import net.minecraftforge.common.MinecraftForge;
+ *import net.minecraftforge.fml.common.Mod;
+ *import net.minecraftforge.fml.common.Mod.EventHandler;
+ *import net.minecraftforge.fml.common.event.FMLConstructionEvent;
+ *import net.minecraftforge.fml.common.event.FMLInitializationEvent;
+ *import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+ *
+ *import ic2.api.event.TeBlockFinalCallEvent;
+ *import ic2.core.block.TeBlockRegistry;
+ *
+ *{@literal @}Mod(modId="ExampleIC2Addon")
+ *public class ExampleIC2Addon {
+ *	{@literal @}EventHandler
+ *	public void start(FMLConstructionEvent event) {
+ *		MinecraftForge.EVENT_BUS.register(this);
+ *	}
+ *
+ *	{@literal @}SubscribeEvent
+ *	public void register(TeBlockFinalCallEvent event) {
+ *		TeBlockRegistry.addAll(MyTeBlock.class, MyTeBlock.IDENTITY);
+ *
+ *		MinecraftForge.EVENT_BUS.unregister(this);
+ *	}
+ *
+ *	{@literal @}EventHandler
+ *	public void init(FMLInitializationEvent event) {
+ *		MyTeBlock.buildDummies();
+ *	}
+ *}
+ *
+ *
+ *import net.minecraft.block.material.Material;
+ *import net.minecraft.creativetab.CreativeTabs;
+ *import net.minecraft.item.EnumRarity;
+ *import net.minecraft.item.ItemStack;
+ *import net.minecraft.tileentity.TileEntity;
+ *import net.minecraft.util.EnumFacing;
+ *import net.minecraft.util.ResourceLocation;
+ *
+ *import ic2.core.block.BlockTileEntity;
+ *import ic2.core.block.ITeBlock;
+ *import ic2.core.block.TileEntityBlock;
+ *import ic2.core.item.block.ItemBlockTileEntity;
+ *import ic2.core.ref.TeBlock.DefaultDrop;
+ *import ic2.core.ref.TeBlock.HarvestTool;
+ *import ic2.core.ref.TeBlock.ITePlaceHandler;
+ *import ic2.core.util.Util;
+ *
+ *public enum MyTeBlock implements ITeBlock {
+ *	my_machine_name(MyMachineTileEntity.class, 0, false, Util.noFacings, false, HarvestTool.Pickaxe, DefaultDrop.Machine, 5, 10, EnumRarity.UNCOMMON, Material.IRON, false);
+ *
+ *	private MyTeBlock(Class teClass, int ID,
+ *			boolean hasActive, Set{@literal <}EnumFacing{@literal >} possibleFacings, boolean canBeWrenched,
+ *			HarvestTool tool, DefaultDrop drop,
+ *			float hardness, float explosionResistance, EnumRarity rarity, Material material, boolean isTransparent) {
+ *		this.teClass = teClass;
+ *		this.ID = ID;
+ *		this.hasActive = hasActive;
+ *		this.possibleFacings = possibleFacings;
+ *		this.canBeWrenched = canBeWrenched;
+ *		this.tool = tool;
+ *		this.drop = drop;
+ *		this.hardness = hardness;
+ *		this.explosionResistance = explosionResistance;
+ *		this.rarity = rarity;
+ *		this.material = material;
+ *		this.isTransparent = isTransparent;
+ *
+ *		TileEntity.addMapping(block.teClass, IDENTITY.getResourceDomain() + ':' + block.getName());
+ *	}
+ *
+ *	{@literal @}Override
+ *	public boolean hasItem() {
+ *		return teClass != null && itemMeta != -1;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public String getName() {
+ *		return name();
+ *	}
+ *
+ *	{@literal @}Override
+ *	public ResourceLocation getIdentifier() {
+ *		return IDENTITY;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public Class getTeClass() {
+ *		return teClass;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public boolean hasActive() {
+ *		return hasActive;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public int getId() {
+ *		return ID;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public float getHardness() {
+ *		return hardness;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public HarvestTool getHarvestTool() {
+ *		return tool;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public DefaultDrop getDefaultDrop() {
+ *		return drop;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public float getExplosionResistance() {
+ *		return explosionResistance;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public boolean allowWrenchRotating() {
+ *		return canBeWrenched;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public Set{@literal <}EnumFacing{@literal >} getSupportedFacings() {
+ *		return possibleFacings;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public EnumRarity getRarity() {
+ *		return rarity;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public Material getMaterial() {
+ *		return material;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public boolean isTransparent() {
+ *		return isTransparent;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public void setPlaceHandler(ITePlaceHandler handler) {
+ *		this.placeHandler = handler;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public ITePlaceHandler getPlaceHandler() {
+ *		return placeHandler;
+ *	}
+ *
+ *	public static void buildDummies() {
+ *		for (MyTeBlock block : values()) {
+ *			//System.out.printf("Building %s (with teClass %s)%n", block.getName(), block.teClass);
+ *			if (block.teClass != null) {
+ *				try {
+ *					block.dummyTe = block.teClass.newInstance();
+ *				} catch (Exception e) {
+ *					e.printStackTrace();
+ *				}
+ *			}
+ *		}
+ *	}
+ *
+ *	{@literal @}Override
+ *	public TileEntityBlock getDummyTe() {
+ *		return dummyTe;
+ *	}
+ *
+ *	private final Class teClass;
+ *	private final int ID;
+ *	private final boolean hasActive;
+ *	private final Set{@literal <}EnumFacing{@literal >} possibleFacings;
+ *	private final boolean canBeWrenched;
+ *	private final HarvestTool tool;
+ *	private final DefaultDrop drop;
+ *	private final float hardness;
+ *	private final float explosionResistance;
+ *	private final EnumRarity rarity;
+ *	private final Material material;
+ *	private final boolean isTransparent;
+ *	private TileEntityBlock dummyTe;
+ *	private ITePlaceHandler placeHandler;
+ *
+ *	public static final ResourceLocation IDENTITY = new ResourceLocation("ExampleIC2Addon", "machines");
+ *}
+ *  
+ * And that's it, you now have my_machine_name registered with the MyMachineTileEntity tile entity class, + * the language key to translate it's name being ExampleIC2Addon.machines.my_machine_name and + * the blockstate being in machines.json file in your mod's assets. + *

+ *
+ *

+ * But hang on, what are all the parameters of our new enum and what does ITeBlock do with them? What are dummy tile entities for? + * Don't worry, it's quite simple (once you know it at least). + *

+ *

+ * First we'll start on what {@link TeBlockFinalCallEvent} is. It's posted on the {@link MinecraftForge#EVENT_BUS} just before the blocks are built, + * after which point any further attempts to register ITeBlocks will fail, as we can't inject them late due to the model generating. + * It is best to hook into this to register your ITeBlocks, as it will be guaranteed to be posted at the right time. + *

+ * In terms of ITeBlock, there's quite a bit of information it needs in order to function. We'll go through each parameter (or getter method most cases too) in turn: + *

    + *
  • name: The name the new tile entity. This is important as the localisation and resource names depend on it, as well as some network syncing code.
  • + *
  • teClass: The class of your tile entity, it must extend TileEntityBlock otherwise it would miss critical methods to work. + * If extending that is a problem then using ITeBlock isn't what you should be doing.
  • + *
  • itemMeta: The ID of the new instance. This is utterly critical, as it's the thing used to detect which ITeBlock an item is. + * That's very important as the tile entity class is worked out by the ID when a block's being placed in ItemBlockTileEntity. + * Changing this will cause everyone's items to change and there is no stopping that if you do. + * The ID you pick should start at 0, and go up to {@link Short#MAX_VALUE}. + * Use -1 if the tile entity doesn't have an item form (or is placed using an item other than ItemBlockTileEntity).
  • + *
  • identifier: The resource location associated with the ITeBlock. + * The language keys, translations and internal mappings all use this, so it's best to store it as a static final variable and use that. + *
  • hasActive: If the tile entity has an active state too, which is based off whether TileEntityBlock#getActive() returns true or not. + * The models for that will be at name_active, you can check te.json for an example if you wish.
  • + *
  • supportedFacings: A set of EnumFacings that the block can face, used for rotating by the wrench for example. + * IC2 has some useful constants relating to that in Util (allFacings, horizontalFacings, downSideFacings and noFacings).
  • + *
  • allowWrenchRotating: Whether the tile entity can be rotated with a wrench (for {@link IWrenchable}).
  • + *
  • harvestTool: The tool used to harvest the tile entity, currently only None, Pickaxe, Shovel and Axe. + * More can be added on request, but support has to be specifically added, so there's no nice way via EnumHelper unfortunately.
  • + *
  • defaultDrop: The item(s) that will drop when the block is broken using the correct tool. Currently only Self, None, Generator, Machine, and AdvMachine. + * Like harvestTool, more can be added upon request.
  • + *
  • hardness: The hardness the block should have with the tile entity, IC2 normally uses 5.
  • + *
  • explosionResistance: The explosionResistance the block should have with the tile entity, IC2 normally uses 10.
  • + *
  • rarity: The EnumRarity that the item will have for the tile entity.
  • + *
  • material: The {@link Material} that the block representing the tile entity should have. Maximum of 8 different ones per ITeBlock registration.
  • + *
  • isTransparent: Whether the block should be rendered with {@link BlockRenderLayer#CUTOUT} or {@link BlockRenderLayer#SOLID} + * (which controls whether transparency can be in the texture).
  • + *
  • placeHandler: Custom placement logic, used for things like Reactor Chambers within IC2 itself. + * Returning null for this uses the default logic (placing like a normal block).
  • + *
  • dummyTe: An instance of the tile entity never registered to the world (don't try doing that) used for getting additional information about the Tile Entity. + * Mostly an internal thing, only exposed in case your Tile Entity uses a special constructor.
  • + *
+ * IMPORTANT THINGS TO NOTE + *
+ *
Getting your instance of BlockTileEntity and ItemBlockTileEntity
+ *
For BlockTileEntity, use {@link TeBlockRegistry#get(ResourceLocation)}.
+ * For ItemBlockTileEntity, use {@link BlockTileEntity#getItem()}.
+ *
Using a custom item model for your ITeBlock
+ *
Implement ITeBlockSpecialItem along with ITeBlock, then the item model will be what's provided rather than the block model.
+ *
The default implementation for adding ITeBlocks to creative
+ *
The default logic adds all registered ITeBlocks that return true for {@link ic2.core.ref.TeBlock#hasItem()}.
+ *
+ * More will be added to this list if questions keep re-occurring, or are about a suitably important topic. + *

+ *
+ *

+ * There, that should be everything you need to utilise ITeBlock to add your own tile entities using IC2's very flexible framework. + * I'll be happy to answer any questions you have on it, your best bet is to ask me (Chocohead) on the IC2 forums, + * although if you post in the support section other people might be able to help before I see your post. + * I'll certainly take suggestions too, this is mostly just based on what IC2 uses/needs, so there might well be things missed that might be useful. + *
+ * Goodness I spent too long on this again... + *

+ * + * + * @see {@link TeBlockFinalCallEvent} for the event you'll need to subscribe to. + * @see {@link ic2.core.ref.TeBlock} for how all the IC2 implements {@link ITeBlock}. + * @see {@link ic2.core.ref.TeBlock.HarvestTool} for the currently available tools (you'll need this for adding new tile entities). + * @see {@link ic2.core.ref.TeBlock.DefaultDrop} for the currently available drops (you'll need this for adding new tile entities too). + * @see {@link ic2.core.block.ITeBlock.ITeBlockCreativeRegisterer} for customising what blocks are added to creative past the default implementation + * @see {@link ic2.core.ref.TeBlock.ITePlaceHandler} for making your own block placement handler (example in {@link ic2.core.item.ItemHandlers#reactorChamberPlace}). + * @see {@link ic2.core.util.Util} for the useful facings you might want for supportedFacings. + * @see {@link ic2.core.block.TileEntityBlock} for the base tile entity. + * @see {@link ic2.core.block.BlockTileEntity} for the base block (you'll never need to construct this yourself). + * @see {@link ic2.core.item.block.ItemBlockTileEntity} for the base item (you shouldn't need to construct this yourself either). + * @see {@link ITeBlockSpecialItem} for the interface used to have a custom item location. + * + * + * @since IC2 2.7.14 + * @version 2.0 + * + * @author Chocohead + */ +public interface ITeBlock { +} \ No newline at end of file diff --git a/src/api/java/ic2/api/info/Info.class b/src/api/java/ic2/api/info/Info.class index 54987885d..9682d4754 100644 Binary files a/src/api/java/ic2/api/info/Info.class and b/src/api/java/ic2/api/info/Info.class differ diff --git a/src/api/java/ic2/api/info/Info.java b/src/api/java/ic2/api/info/Info.java index 8d3884216..619e04e53 100644 --- a/src/api/java/ic2/api/info/Info.java +++ b/src/api/java/ic2/api/info/Info.java @@ -25,7 +25,7 @@ public class Info { public static boolean isIc2Available() { if (ic2Available != null) return ic2Available; - boolean loaded = Loader.isModLoaded("IC2"); + boolean loaded = Loader.isModLoaded(MOD_ID); if (Loader.instance().hasReachedState(LoaderState.CONSTRUCTING)) { ic2Available = loaded; @@ -34,5 +34,6 @@ public class Info { return loaded; } + public static String MOD_ID = "ic2"; private static Boolean ic2Available = null; } \ No newline at end of file diff --git a/src/api/java/ic2/api/info/package-info.class b/src/api/java/ic2/api/info/package-info.class deleted file mode 100644 index 6cd21d416..000000000 Binary files a/src/api/java/ic2/api/info/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/info/package-info.java b/src/api/java/ic2/api/info/package-info.java deleted file mode 100644 index ecd40e27d..000000000 --- a/src/api/java/ic2/api/info/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.info; -import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/ic2/api/item/HudMode.class b/src/api/java/ic2/api/item/HudMode.class new file mode 100644 index 000000000..200362d96 Binary files /dev/null and b/src/api/java/ic2/api/item/HudMode.class differ diff --git a/src/api/java/ic2/api/item/HudMode.java b/src/api/java/ic2/api/item/HudMode.java new file mode 100644 index 000000000..d78c60210 --- /dev/null +++ b/src/api/java/ic2/api/item/HudMode.java @@ -0,0 +1,37 @@ +package ic2.api.item; + +public enum HudMode { + DISABLED("ic2.hud.disabled"), BASIC("ic2.hud.basic"), EXTENDED("ic2.hud.extended"), ADVANCED("ic2.hud.advanced"); + + private HudMode(String key) { + translationKey = key; + } + + private final String translationKey; + + public boolean shouldDisplay() { + return this != DISABLED; + } + + public boolean hasTooltip() { + return this == EXTENDED || this == ADVANCED; + } + + public String getTranslationKey() { + return translationKey; + } + + public int getID() { + return ordinal(); + } + + public static HudMode getFromID(int ID) { + return VALUES[ID % VALUES.length]; + } + + public static int getMaxMode() { + return VALUES.length - 1; + } + + private static final HudMode[] VALUES = values(); +} \ No newline at end of file diff --git a/src/api/java/ic2/api/item/IC2Items.class b/src/api/java/ic2/api/item/IC2Items.class index a68e242fd..95a0eb820 100644 Binary files a/src/api/java/ic2/api/item/IC2Items.class and b/src/api/java/ic2/api/item/IC2Items.class differ diff --git a/src/api/java/ic2/api/item/IC2Items.java b/src/api/java/ic2/api/item/IC2Items.java index 5240178f7..cee186861 100644 --- a/src/api/java/ic2/api/item/IC2Items.java +++ b/src/api/java/ic2/api/item/IC2Items.java @@ -5,6 +5,8 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; +import ic2.api.info.Info; + /** * Provides access to IC2 blocks and items. @@ -17,7 +19,7 @@ import net.minecraftforge.fml.common.ModContainer; * * Getting the associated Block/Item for an ItemStack x: Blocks: * ((ItemBlock)x.getItem).getBlock() Items: x.getItem() - * Alternatively, you can direwctly call IC2Items.instance.getItem(name) or IC2Items.instance.getBlock(name) + * Alternatively, you can directly call IC2Items.instance.getItem(name) or IC2Items.instance.getBlock(name) * * It is recommended, that you keep a reference to the Items you get here. * @@ -75,7 +77,7 @@ public final class IC2Items { public static void setInstance(IItemAPI api) { ModContainer mc = Loader.instance().activeModContainer(); - if (mc == null || !"IC2".equals(mc.getModId())) { + if (mc == null || !Info.MOD_ID.equals(mc.getModId())) { throw new IllegalAccessError("invoked from "+mc); } @@ -159,6 +161,7 @@ dust,small_obsidian Tiny Pile of Obsidian Dust dust,small_silver Tiny Pile of Silver Dust dust,small_sulfur Tiny Pile of Sulfur Dust dust,small_tin Tiny Pile of Tin Dust +dust,tin_hydrated Hydrated Tin Dust ingot: ingot,alloy Mixed Metal Ingot @@ -224,6 +227,7 @@ misc_resource,iridium_shard Iridium Shard misc_resource,matter UU-Matter misc_resource,resin Sticky Resin misc_resource,slag Slag +misc_resource,iodine Iodine block_cutting_blade: block_cutting_blade,iron Block Cutting Blade (Iron) @@ -267,6 +271,8 @@ crafting,steel_rotor_blade Steel Rotor Blade crafting,carbon_rotor_blade Carbon Rotor Blade crafting,steam_turbine_blade Steam Turbine Blade crafting,steam_turbine Steam Turbine +crafting,jetpack_attachment_plate Jetpack Attachment Plate +crafting,coin Industrial Credit crystal_memory: crystal_memory Crystal Memory @@ -283,7 +289,7 @@ crop_res,hops Hops crop_res,weed Weed terra_wart: -terra_wart item.terra_wart +terra_wart Terra Wart re_battery: re_battery RE-Battery @@ -363,6 +369,9 @@ neutron_reflector Neutron Reflector thick_neutron_reflector: thick_neutron_reflector Thick Neutron Reflector +iridium_reflector: +iridium_reflector Iridium Neutron Reflector + rsh_condensator: rsh_condensator RSH-Condensator @@ -425,6 +434,7 @@ debug_item Debug Item foam_sprayer: foam_sprayer CF Sprayer +foam_sprayer,ic2construction_foam CF Sprayer forge_hammer: forge_hammer Forge Hammer @@ -435,6 +445,9 @@ frequency_transmitter Frequency Transmitter meter: meter EU-Reader +remote: +remote Dynamite-O-Mote + tool_box: tool_box Tool Box @@ -456,9 +469,15 @@ mug,cold_coffee Cold Coffee mug,dark_coffee Dark Coffee mug,coffee Coffee +crop_stick: +crop_stick Crop + cropnalyzer: cropnalyzer Cropnalyzer +crop_seed_bag: +crop_seed_bag * Seeds + weeding_trowel: weeding_trowel Weeding Trowel @@ -563,8 +582,11 @@ upgrade,transformer Transformer Upgrade upgrade,energy_storage Energy Storage Upgrade upgrade,redstone_inverter Redstone Signal Inverter Upgrade upgrade,ejector Ejector Upgrade +upgrade,advanced_ejector Advanced Ejector Upgrade upgrade,pulling Pulling Upgrade +upgrade,advanced_pulling Advanced Pulling Upgrade upgrade,fluid_ejector Fluid Ejector Upgrade +upgrade,fluid_pulling Fluid Pulling Upgrade advanced_batpack: advanced_batpack Adv.Batpack @@ -652,6 +674,9 @@ static_boots Static Boots filled_tin_can: filled_tin_can (Filled) Tin Can +iodine_tablet: +iodine_tablet Iodine Tablet + rotor_wood: rotor_wood Kinetic Gearbox Rotor (Wood) @@ -664,6 +689,12 @@ rotor_carbon Kinetic Gearbox Rotor (Carbon) rotor_steel: rotor_steel Kinetic Gearbox Rotor (Steel) +dynamite: +dynamite Dynamite + +dynamite_sticky: +dynamite_sticky Sticky Dynamite + ================================================= Blocks: @@ -752,6 +783,13 @@ te,hv_transformer HV-Transformer te,ev_transformer EV-Transformer te,tank Tank te,chunk_loader Chunk Loader +te,item_buffer_2 Compact Item Buffer +te,rci_rsh Reactor Coolant Injector (RSH) +te,rci_lzh Reactor Coolant Injector (LZH) +te,creative_generator Creative Generator +te,steam_repressurizer Steam Re-Pressurizer +te,industrial_workbench Industrial Workbench +te,batch_crafter Batch Crafter resource: resource,basalt Basalt @@ -793,7 +831,9 @@ fence: fence,iron Iron Fence sheet: +sheet,resin Resin Sheet sheet,rubber Rubber Sheet +sheet,wool Wool Sheet glass: glass,reinforced Reinforced Glass diff --git a/src/api/java/ic2/api/item/IElectricItemManager.java b/src/api/java/ic2/api/item/IElectricItemManager.java index 74964a24d..3c890d88f 100644 --- a/src/api/java/ic2/api/item/IElectricItemManager.java +++ b/src/api/java/ic2/api/item/IElectricItemManager.java @@ -94,7 +94,7 @@ public interface IElectricItemManager { * * @param stack electric item's stack * @param amount amount of energy to discharge in EU - * @param entity entity holding the item + * @param entity entity holding the item, may be null * @return true if the operation succeeded */ boolean use(ItemStack stack, double amount, EntityLivingBase entity); diff --git a/src/api/java/ic2/api/item/IItemAPI.class b/src/api/java/ic2/api/item/IItemAPI.class index 12684eb4b..18bc079bd 100644 Binary files a/src/api/java/ic2/api/item/IItemAPI.class and b/src/api/java/ic2/api/item/IItemAPI.class differ diff --git a/src/api/java/ic2/api/item/IItemAPI.java b/src/api/java/ic2/api/item/IItemAPI.java index ba6dc0a42..9b72459d0 100644 --- a/src/api/java/ic2/api/item/IItemAPI.java +++ b/src/api/java/ic2/api/item/IItemAPI.java @@ -1,6 +1,7 @@ package ic2.api.item; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -11,6 +12,17 @@ import net.minecraft.item.ItemStack; */ public interface IItemAPI { + /** + * Get the default blockstate for a specific block name and variant.
+ * For machines etc, you might want to make your detection a bit more fuzzy, + * because the BlockState also contains properties like the facing and the active + * state of a machine. + * @param name The name of the block. + * @param variant The variant of the block. + * @return The default state of the block with that variant. + */ + IBlockState getBlockState(String name, String variant); + /** * Get an ItemStack for a specific item name. * diff --git a/src/api/java/ic2/api/item/IItemHudInfo.class b/src/api/java/ic2/api/item/IItemHudInfo.class index 82e7f8297..4602f697b 100644 Binary files a/src/api/java/ic2/api/item/IItemHudInfo.class and b/src/api/java/ic2/api/item/IItemHudInfo.class differ diff --git a/src/api/java/ic2/api/item/IItemHudInfo.java b/src/api/java/ic2/api/item/IItemHudInfo.java index 35194f366..112d69102 100644 --- a/src/api/java/ic2/api/item/IItemHudInfo.java +++ b/src/api/java/ic2/api/item/IItemHudInfo.java @@ -2,23 +2,32 @@ package ic2.api.item; import java.util.List; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +/** + * An interface to allow the applied {@link Item} to override the overlay HUD text (which otherwise defaults to it's tooltip). + * + * @author Thunderdark + */ public interface IItemHudInfo { - /* - Add Info to Nano- and Quantum-Suit Helm Hud - for stack - - @Override - public List getHudInfo(ItemStack stack) { - List info = new LinkedList(); - info.add("i am a Cool Item"); - info.add("and have Cool info"); - return info; - } - - + /** + *

Adds info to {@link IItemHudProvider}s for the given stack. + * Return an empty list not null if no info is given.

+ * + *

+	 *	{@literal @}override
+	 *	public List{@literal <}String{@literal >} getHudInfo(ItemStack stack, boolean advanced) {
+	 *		List{@literal <}String{@literal >} info = new LinkedList{@literal <}String{@literal >}();
+	 *		info.add("I am a cool item");
+	 *		info.add("and have cool info.");
+	 * 		return info;
+	 * 	}
+	 *	
+ * + * @param stack The stack to get information for + * @param advanced Whether the HUD is in extended or advanced display mode + * @return A list of strings to draw in the overlay */ - - public List getHudInfo(ItemStack stack); -} + public List getHudInfo(ItemStack stack, boolean advanced); +} \ No newline at end of file diff --git a/src/api/java/ic2/api/item/IItemHudProvider$IItemHudBarProvider.class b/src/api/java/ic2/api/item/IItemHudProvider$IItemHudBarProvider.class new file mode 100644 index 000000000..f8ee4fcbd Binary files /dev/null and b/src/api/java/ic2/api/item/IItemHudProvider$IItemHudBarProvider.class differ diff --git a/src/api/java/ic2/api/item/IItemHudProvider.class b/src/api/java/ic2/api/item/IItemHudProvider.class new file mode 100644 index 000000000..98e3cc056 Binary files /dev/null and b/src/api/java/ic2/api/item/IItemHudProvider.class differ diff --git a/src/api/java/ic2/api/item/IItemHudProvider.java b/src/api/java/ic2/api/item/IItemHudProvider.java new file mode 100644 index 000000000..baeb68306 --- /dev/null +++ b/src/api/java/ic2/api/item/IItemHudProvider.java @@ -0,0 +1,46 @@ +package ic2.api.item; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +/** + * An interface to show that an {@link Item} can display the HUD overlay if worn. + * + * @author Chocohead + */ +public interface IItemHudProvider { + /** + * Whether the given stack should display the HUD overlay. + * + * @param stack The stack currently being worn + * @return Whether the HUD overlay should be drawn + */ + boolean doesProvideHUD(ItemStack stack); + + /** + * Gets the current {@link HudMode} of the worn stack (probably stored as NBT) + * + * @param stack The stack currently being worn + * @return The HUD overlay mode + */ + HudMode getHudMode(ItemStack stack); + + /** + *

Override the percent shown by the HUD overlay for the applied item.

+ * + *

By default, {@link IElectricItem}s have the percentage charged shown, + * damageable items have their {@link Item#getDurabilityForDisplay(ItemStack)} values shown + * and items that don't apply to either aren't shown at all.

+ * + * @author Chocohead + */ + public static interface IItemHudBarProvider { + /** + * Get the percent to show in the overlay HUD for the given stack. + * + * @param stack The stack to get the percent for. + * @return A number between 0 and 100, less than 0 will not render the item at all. + */ + int getBarPercent(ItemStack stack); + } +} \ No newline at end of file diff --git a/src/api/java/ic2/api/item/ITeBlockSpecialItem.class b/src/api/java/ic2/api/item/ITeBlockSpecialItem.class new file mode 100644 index 000000000..5d2b1a280 Binary files /dev/null and b/src/api/java/ic2/api/item/ITeBlockSpecialItem.class differ diff --git a/src/api/java/ic2/api/item/ITeBlockSpecialItem.java b/src/api/java/ic2/api/item/ITeBlockSpecialItem.java new file mode 100644 index 000000000..7d9ca63eb --- /dev/null +++ b/src/api/java/ic2/api/item/ITeBlockSpecialItem.java @@ -0,0 +1,35 @@ +package ic2.api.item; + +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.item.ItemStack; + +import ic2.api.info.ITeBlock; + +/** + * Change the default icon for an {@link ITeBlock} by implementing this. + * + * @since IC2 2.6.85 + * @version 1.0 + * + * @see {@link ITeBlock} for more information + * + * @author Chocohead + */ +public interface ITeBlockSpecialItem { + /** + * Should the model be delegated to the {@link ITeBlock} or the default used? + * + * @param stack The itemstack being rendered + * @return Whether the {@link ITeBlock} will return an {@link ModelResourceLocation} + */ + boolean doesOverrideDefault(ItemStack stack); + + /** + * The {@link ModelResourceLocation} for the given stack. + * Will still use the default even if {@link #doesOverrideDefault(ItemStack)} returns true if this returns null. + * + * @param stack The itemstack being rendered + * @return The model location to be used + */ + ModelResourceLocation getModelLocation(ItemStack stack); +} \ No newline at end of file diff --git a/src/api/java/ic2/api/item/package-info.class b/src/api/java/ic2/api/item/package-info.class deleted file mode 100644 index 69fb7c313..000000000 Binary files a/src/api/java/ic2/api/item/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/item/package-info.java b/src/api/java/ic2/api/item/package-info.java deleted file mode 100644 index e02ec6e11..000000000 --- a/src/api/java/ic2/api/item/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.item; -import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/ic2/api/network/IGrowingBuffer.class b/src/api/java/ic2/api/network/IGrowingBuffer.class new file mode 100644 index 000000000..416349df7 Binary files /dev/null and b/src/api/java/ic2/api/network/IGrowingBuffer.class differ diff --git a/src/api/java/ic2/api/network/IGrowingBuffer.java b/src/api/java/ic2/api/network/IGrowingBuffer.java new file mode 100644 index 000000000..6b2353d57 --- /dev/null +++ b/src/api/java/ic2/api/network/IGrowingBuffer.java @@ -0,0 +1,36 @@ +package ic2.api.network; + +import java.io.DataInput; +import java.io.DataOutput; + +public interface IGrowingBuffer extends DataInput, DataOutput { + /** + * Write a number of variable size to the buffer + * + * @param i The number to write + */ + void writeVarInt(int i); + + /** + * Write a string directly to the buffer, + * opposed to {@link DataOutput#writeUTF(String)} that properly encodes Unicode characters first + * + * @param s The string to write + */ + void writeString(String s); + + /** + * Read a number of variable size to the buffer + * + * @return The variably sized number stored on the buffer + */ + int readVarInt(); + + /** + * Read a string directly from the buffer, + * opposed to {@link DataInput#readUTF()} that properly decodes Unicode characters first + * + * @return The string stored on the buffer + */ + String readString(); +} \ No newline at end of file diff --git a/src/api/java/ic2/api/network/INetworkCustomEncoder.class b/src/api/java/ic2/api/network/INetworkCustomEncoder.class new file mode 100644 index 000000000..64885fcfb Binary files /dev/null and b/src/api/java/ic2/api/network/INetworkCustomEncoder.class differ diff --git a/src/api/java/ic2/api/network/INetworkCustomEncoder.java b/src/api/java/ic2/api/network/INetworkCustomEncoder.java new file mode 100644 index 000000000..86885139c --- /dev/null +++ b/src/api/java/ic2/api/network/INetworkCustomEncoder.java @@ -0,0 +1,36 @@ +package ic2.api.network; + +import java.io.IOException; + +/** + * Allow extensions to {@link ic2.core.network.DataEncoder} for encoding custom data types not already handled by IC2. + * Register this to DataEncoder itself using #addNetworkEncoder(Class, INetworkCustomEncoder). + * + * @author Chocohead + */ +public interface INetworkCustomEncoder { + /** + * Encode the given instance into the buffer + * + * @param buffer The network buffer + * @param instance The instance being encoded + * + * @throws IOException Because {@link ic2.core.network.DataEncoder#encode(IGrowingBuffer, Object, boolean)} does. + */ + void encode(IGrowingBuffer buffer, Object instance) throws IOException; + + /** + * @param buffer The network buffer + * + * @return The instance the information on the network represents + * + * @throws IOException Because {@link ic2.core.network.DataEncoder#decode(IGrowingBuffer, ic2.core.network.DataEncoder.EncodedType)} does. + */ + Object decode(IGrowingBuffer buffer) throws IOException; + + /** + * @return false the type accesses the world or otherwise requires to be run on the main thread, + * true if it doesn't. + */ + boolean isThreadSafe(); +} \ No newline at end of file diff --git a/src/api/java/ic2/api/network/INetworkManager.class b/src/api/java/ic2/api/network/INetworkManager.class index d0fd9c34a..aee59174e 100644 Binary files a/src/api/java/ic2/api/network/INetworkManager.class and b/src/api/java/ic2/api/network/INetworkManager.class differ diff --git a/src/api/java/ic2/api/network/INetworkManager.java b/src/api/java/ic2/api/network/INetworkManager.java index bef3c59d0..81a55f778 100644 --- a/src/api/java/ic2/api/network/INetworkManager.java +++ b/src/api/java/ic2/api/network/INetworkManager.java @@ -25,4 +25,6 @@ public interface INetworkManager { void initiateClientItemEvent(ItemStack stack, int event); + void sendInitialData(TileEntity te); + } diff --git a/src/api/java/ic2/api/network/NetworkHelper.class b/src/api/java/ic2/api/network/NetworkHelper.class index 665d98507..87e27c3be 100644 Binary files a/src/api/java/ic2/api/network/NetworkHelper.class and b/src/api/java/ic2/api/network/NetworkHelper.class differ diff --git a/src/api/java/ic2/api/network/NetworkHelper.java b/src/api/java/ic2/api/network/NetworkHelper.java index a2f71256d..9e7bcfea1 100644 --- a/src/api/java/ic2/api/network/NetworkHelper.java +++ b/src/api/java/ic2/api/network/NetworkHelper.java @@ -9,6 +9,8 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.relauncher.Side; +import ic2.api.info.Info; + /** * Provides methods to initiate events and synchronize tile entity fields in SMP. * @@ -20,6 +22,10 @@ import net.minecraftforge.fml.relauncher.Side; * which is needed by the clients outside the GUI, such as rendering the block, playing sounds or * producing effects. Anything which is only visible inside the GUI should be synchronized through * the Container class associated to the GUI in Container.updateProgressBar(). + * + * All methods in this class use the current effective side to determine the Network Manager to use. + * If you do not want it to use the effective side, use {@link #getNetworkManager(Side)} to get the + * Network Manager for a specific side. */ public final class NetworkHelper { // server -> client @@ -93,6 +99,15 @@ public final class NetworkHelper { getNetworkManager(FMLCommonHandler.instance().getEffectiveSide()).initiateItemEvent(player, stack, event, limitRange); } + /** + * Send initial TileEntity data to the clients. Requires the te to implement + * {@link INetworkDataProvider}. + * @param te The te to send the initial data for. + */ + public static void sendInitialData(TileEntity te) { + getNetworkManager(FMLCommonHandler.instance().getEffectiveSide()).sendInitialData(te); + } + // client -> server @@ -145,7 +160,7 @@ public final class NetworkHelper { */ public static void setInstance(INetworkManager server, INetworkManager client) { ModContainer mc = Loader.instance().activeModContainer(); - if (mc == null || !"IC2".equals(mc.getModId())) { + if (mc == null || !Info.MOD_ID.equals(mc.getModId())) { throw new IllegalAccessError(); } serverInstance = server; diff --git a/src/api/java/ic2/api/network/package-info.class b/src/api/java/ic2/api/network/package-info.class deleted file mode 100644 index c2d4dd55b..000000000 Binary files a/src/api/java/ic2/api/network/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/network/package-info.java b/src/api/java/ic2/api/network/package-info.java deleted file mode 100644 index f31d2033e..000000000 --- a/src/api/java/ic2/api/network/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.network; -import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/ic2/api/package-info.class b/src/api/java/ic2/api/package-info.class deleted file mode 100644 index 70b3064f5..000000000 Binary files a/src/api/java/ic2/api/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/package-info.java b/src/api/java/ic2/api/package-info.java deleted file mode 100644 index 51f09d297..000000000 --- a/src/api/java/ic2/api/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api; -import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/ic2/api/reactor/IBaseReactorComponent.class b/src/api/java/ic2/api/reactor/IBaseReactorComponent.class new file mode 100644 index 000000000..2c33a15c6 Binary files /dev/null and b/src/api/java/ic2/api/reactor/IBaseReactorComponent.class differ diff --git a/src/api/java/ic2/api/reactor/IBaseReactorComponent.java b/src/api/java/ic2/api/reactor/IBaseReactorComponent.java new file mode 100644 index 000000000..7e5383b9e --- /dev/null +++ b/src/api/java/ic2/api/reactor/IBaseReactorComponent.java @@ -0,0 +1,21 @@ +package ic2.api.reactor; + +import net.minecraft.item.ItemStack; + +/** + * Items implementing this class will not get spilled out of the reactor, when they are in one. + * @author Aroma1997 + */ +public interface IBaseReactorComponent { + + /** + * This is to determine if the given Item can be put into a reactor.
+ * Items already in the reactor won't get spilled out. This only gets called, + * when placing the item in. + * @param stack The given reactor component. + * @param reactor The specific reactor to place the item in. + * @return If the item is accepted in the reactor. + */ + boolean canBePlacedIn(ItemStack stack, IReactor reactor); + +} diff --git a/src/api/java/ic2/api/reactor/IReactor.class b/src/api/java/ic2/api/reactor/IReactor.class index f711174e2..7878499fb 100644 Binary files a/src/api/java/ic2/api/reactor/IReactor.class and b/src/api/java/ic2/api/reactor/IReactor.class differ diff --git a/src/api/java/ic2/api/reactor/IReactor.java b/src/api/java/ic2/api/reactor/IReactor.java index 7f2cefc93..963cfa951 100644 --- a/src/api/java/ic2/api/reactor/IReactor.java +++ b/src/api/java/ic2/api/reactor/IReactor.java @@ -2,13 +2,13 @@ package ic2.api.reactor; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; + +import ic2.api.info.ILocatable; /** * Interface implemented nuclear reactors, expected to be a {@link TileEntity}, but does not have to be. */ -public interface IReactor { +public interface IReactor extends ILocatable { /** * Return the tile entity representing the reactor core. *
@@ -18,24 +18,6 @@ public interface IReactor { */ public TileEntity getCoreTe(); - /** - * Return the reactor's current world instance (it's position can be acquired using {@link #getReactorPos()}. - *
- * Should be the same world as {@link #getCoreTe()} returns if it's not null. - * - * @return The reactor's world object - */ - public World getReactorWorld(); //getWorld has obfuscation issues (https://github.com/md-5/SpecialSource/issues/12) - - /** - * Return the reactor's current position in the world ({@link #getReactorWorld()}. - *
- * Should be the same position as {@link #getCoreTe()} returns if it's not null. - * - * @return The reactor's current position - */ - public BlockPos getReactorPos(); //As would getPos - /** * Get the reactor's heat. * diff --git a/src/api/java/ic2/api/reactor/IReactorComponent.class b/src/api/java/ic2/api/reactor/IReactorComponent.class index cf1b0fb7a..8a7a6fccd 100644 Binary files a/src/api/java/ic2/api/reactor/IReactorComponent.class and b/src/api/java/ic2/api/reactor/IReactorComponent.class differ diff --git a/src/api/java/ic2/api/reactor/IReactorComponent.java b/src/api/java/ic2/api/reactor/IReactorComponent.java index 4b934e0c0..7916cc17b 100644 --- a/src/api/java/ic2/api/reactor/IReactorComponent.java +++ b/src/api/java/ic2/api/reactor/IReactorComponent.java @@ -10,7 +10,7 @@ import net.minecraft.item.ItemStack; * All IC2 ReactorComponents implement and use this Interface * */ -public interface IReactorComponent { +public interface IReactorComponent extends IBaseReactorComponent { /** * Called by reactor upon iterating through it's inventory (every cycle). * Perform all necessary calculation/interaction here diff --git a/src/api/java/ic2/api/reactor/package-info.class b/src/api/java/ic2/api/reactor/package-info.class deleted file mode 100644 index d27d5e085..000000000 Binary files a/src/api/java/ic2/api/reactor/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/reactor/package-info.java b/src/api/java/ic2/api/reactor/package-info.java deleted file mode 100644 index b500c3d34..000000000 --- a/src/api/java/ic2/api/reactor/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.reactor; -import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/ic2/api/recipe/IBasicMachineRecipeManager.class b/src/api/java/ic2/api/recipe/IBasicMachineRecipeManager.class new file mode 100644 index 000000000..31608e783 Binary files /dev/null and b/src/api/java/ic2/api/recipe/IBasicMachineRecipeManager.class differ diff --git a/src/api/java/ic2/api/recipe/IBasicMachineRecipeManager.java b/src/api/java/ic2/api/recipe/IBasicMachineRecipeManager.java new file mode 100644 index 000000000..86e725c0e --- /dev/null +++ b/src/api/java/ic2/api/recipe/IBasicMachineRecipeManager.java @@ -0,0 +1,13 @@ +package ic2.api.recipe; + +import java.util.Collection; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public interface IBasicMachineRecipeManager extends IMachineRecipeManager, ItemStack> { + boolean addRecipe(IRecipeInput input, NBTTagCompound metadata, boolean replace, ItemStack... outputs); + + @Deprecated + RecipeOutput getOutputFor(ItemStack input, boolean adjustInput); +} diff --git a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$Input.class b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$Input.class index 89a9b2f17..4b88cdf18 100644 Binary files a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$Input.class and b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$Input.class differ diff --git a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$RawInput.class b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$RawInput.class new file mode 100644 index 000000000..f7edd9fed Binary files /dev/null and b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$RawInput.class differ diff --git a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.class b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.class index 7372a12c7..fc1013660 100644 Binary files a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.class and b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.class differ diff --git a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java index 415b3c38c..6471e475e 100644 --- a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java +++ b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java @@ -1,51 +1,57 @@ package ic2.api.recipe; -import java.util.Map; - import net.minecraft.item.ItemStack; -public interface ICannerBottleRecipeManager { +import ic2.api.recipe.ICannerBottleRecipeManager.Input; +import ic2.api.recipe.ICannerBottleRecipeManager.RawInput; + +public interface ICannerBottleRecipeManager extends IMachineRecipeManager { /** * Adds a recipe to the machine. - * + * * @param container Container to be filled * @param fill Item to fill into the container * @param output Filled container + * @return */ - public void addRecipe(IRecipeInput container, IRecipeInput fill, ItemStack output); + boolean addRecipe(IRecipeInput container, IRecipeInput fill, ItemStack output, boolean replace); + + @Deprecated + void addRecipe(IRecipeInput container, IRecipeInput fill, ItemStack output); /** * Gets the recipe output for the given input. - * + * * @param container Container to be filled * @param fill Item to fill into the container * @param adjustInput modify the input according to the recipe's requirements * @param acceptTest allow either container or fill to be null to see if either of them is part of a recipe * @return Recipe output, or null if none */ - public RecipeOutput getOutputFor(ItemStack container, ItemStack fill, boolean adjustInput, boolean acceptTest); - - /** - * Gets a list of recipes. - * - * You're a mad evil scientist if you ever modify this. - * - * @return List of recipes - */ - public Map getRecipes(); - + @Deprecated + RecipeOutput getOutputFor(ItemStack container, ItemStack fill, boolean adjustInput, boolean acceptTest); public static class Input { - public Input(IRecipeInput container1, IRecipeInput fill1) { - this.container = container1; - this.fill = fill1; + public Input(IRecipeInput container, IRecipeInput fill) { + this.container = container; + this.fill = fill; } - public boolean matches(ItemStack container1, ItemStack fill1) { - return this.container.matches(container1) && this.fill.matches(fill1); + public boolean matches(ItemStack container, ItemStack fill) { + return this.container.matches(container) && this.fill.matches(fill); } public final IRecipeInput container; public final IRecipeInput fill; } + + public static class RawInput { + public RawInput(ItemStack container, ItemStack fill) { + this.container = container; + this.fill = fill; + } + + public final ItemStack container; + public final ItemStack fill; + } } diff --git a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$Input.class b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$Input.class index 309dd5d11..8a00f0bcc 100644 Binary files a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$Input.class and b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$Input.class differ diff --git a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$RawInput.class b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$RawInput.class new file mode 100644 index 000000000..6d01f5efd Binary files /dev/null and b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$RawInput.class differ diff --git a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.class b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.class index f32226dce..73118021f 100644 Binary files a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.class and b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.class differ diff --git a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.java b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.java index 5eba1b68e..f87a860be 100644 --- a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.java +++ b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.java @@ -1,54 +1,56 @@ package ic2.api.recipe; -import java.util.Map; - import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -public interface ICannerEnrichRecipeManager { +import ic2.api.recipe.ICannerEnrichRecipeManager.Input; +import ic2.api.recipe.ICannerEnrichRecipeManager.RawInput; + +public interface ICannerEnrichRecipeManager extends IMachineRecipeManager { /** * Adds a recipe to the machine. - * + * * @param input Fluid input * @param additive Item to enrich the fluid with * @param output Output fluid */ + @Deprecated public void addRecipe(FluidStack input, IRecipeInput additive, FluidStack output); /** * Gets the recipe output for the given input. - * + * * @param input Fluid input * @param additive Item to enrich the fluid with * @param adjustInput modify the input according to the recipe's requirements * @param acceptTest allow input or additive to be null to see if either of them is part of a recipe * @return Recipe output, or null if none, output fluid in nbt */ + @Deprecated public RecipeOutput getOutputFor(FluidStack input, ItemStack additive, boolean adjustInput, boolean acceptTest); - /** - * Gets a list of recipes. - * - * You're a mad evil scientist if you ever modify this. - * - * @return List of recipes - */ - public Map getRecipes(); - - public static class Input { - public Input(FluidStack fluid1, IRecipeInput additive1) { - this.fluid = fluid1; - this.additive = additive1; + public Input(FluidStack fluid, IRecipeInput additive) { + this.fluid = fluid; + this.additive = additive; } - public boolean matches(FluidStack fluid1, ItemStack additive1) { - return (this.fluid == null || this.fluid.isFluidEqual(fluid1)) && - this.additive.matches(additive1); + public boolean matches(FluidStack fluid, ItemStack additive) { + return this.fluid.isFluidEqual(fluid) && this.additive.matches(additive); } public final FluidStack fluid; public final IRecipeInput additive; } + + public static class RawInput { + public RawInput(FluidStack fluid, ItemStack additive) { + this.fluid = fluid; + this.additive = additive; + } + + public final FluidStack fluid; + public final ItemStack additive; + } } diff --git a/src/api/java/ic2/api/recipe/ICraftingRecipeManager$AttributeContainer.class b/src/api/java/ic2/api/recipe/ICraftingRecipeManager$AttributeContainer.class new file mode 100644 index 000000000..26f2e3b87 Binary files /dev/null and b/src/api/java/ic2/api/recipe/ICraftingRecipeManager$AttributeContainer.class differ diff --git a/src/api/java/ic2/api/recipe/ICraftingRecipeManager.class b/src/api/java/ic2/api/recipe/ICraftingRecipeManager.class index 877dcf4e7..abf33e484 100644 Binary files a/src/api/java/ic2/api/recipe/ICraftingRecipeManager.class and b/src/api/java/ic2/api/recipe/ICraftingRecipeManager.class differ diff --git a/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java b/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java index 756eaf634..7ff754571 100644 --- a/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java +++ b/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java @@ -4,23 +4,42 @@ import net.minecraft.item.ItemStack; /** * Recipe manager interface for crafting recipes. - * + * * @author Richard */ public interface ICraftingRecipeManager { /** * Adds a shaped crafting recipe. - * + * * @param output Recipe output * @param input Recipe input format */ public void addRecipe(ItemStack output, Object... input); - + /** * Adds a shapeless crafting recipe. - * + * * @param output Recipe output * @param input Recipe input */ public void addShapelessRecipe(ItemStack output, Object... input); -} + + /** + * Attribute container to pass additional information to AdvRecipe and AdvShapelessRecipe + * + * @author Chocohead + */ + public static class AttributeContainer { + public final boolean hidden; + public final boolean consuming; + + /** + * @param hidden Whether the recipe is hidden from JEI by default + * @param consuming Whether containers should be consumed or returned empty + */ + public AttributeContainer(boolean hidden, boolean consuming) { + this.hidden = hidden; + this.consuming = consuming; + } + } +} \ No newline at end of file diff --git a/src/api/java/ic2/api/recipe/IElectrolyzerRecipeManager$ElectrolyzerOutput.class b/src/api/java/ic2/api/recipe/IElectrolyzerRecipeManager$ElectrolyzerOutput.class new file mode 100644 index 000000000..e0fe95255 Binary files /dev/null and b/src/api/java/ic2/api/recipe/IElectrolyzerRecipeManager$ElectrolyzerOutput.class differ diff --git a/src/api/java/ic2/api/recipe/IElectrolyzerRecipeManager$ElectrolyzerRecipe.class b/src/api/java/ic2/api/recipe/IElectrolyzerRecipeManager$ElectrolyzerRecipe.class new file mode 100644 index 000000000..8896a87a8 Binary files /dev/null and b/src/api/java/ic2/api/recipe/IElectrolyzerRecipeManager$ElectrolyzerRecipe.class differ diff --git a/src/api/java/ic2/api/recipe/IElectrolyzerRecipeManager.class b/src/api/java/ic2/api/recipe/IElectrolyzerRecipeManager.class new file mode 100644 index 000000000..a41162e9a Binary files /dev/null and b/src/api/java/ic2/api/recipe/IElectrolyzerRecipeManager.class differ diff --git a/src/api/java/ic2/api/recipe/IElectrolyzerRecipeManager.java b/src/api/java/ic2/api/recipe/IElectrolyzerRecipeManager.java new file mode 100644 index 000000000..3b2917c57 --- /dev/null +++ b/src/api/java/ic2/api/recipe/IElectrolyzerRecipeManager.java @@ -0,0 +1,120 @@ +package ic2.api.recipe; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.ParametersAreNonnullByDefault; + +import org.apache.commons.lang3.tuple.Pair; + +import net.minecraft.util.EnumFacing; + +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + +/** + * Electrolyzer recipe manager, similar to {@link ISemiFluidFuelManager} and {@link IFermenterRecipeManager}, + * but more sided to fit how the Electrolyzer now works + * + * @author Chocohead + */ +public interface IElectrolyzerRecipeManager extends ILiquidAcceptManager { + /** + * Add a new recipe to the electrolyzer. + * + * @param input The name of the fluid being electrolyzed + * @param inputAmount The amount of input fluid used per operation (in millibuckets) + * @param EUaTick The EU used per tick + * @param outputs The output fluids, with a given direction for the tank to fill + */ + void addRecipe(@Nonnull String input, int inputAmount, int EUaTick, @Nonnull ElectrolyzerOutput... outputs); + + /** + * Add a new recipe to the electrolyzer. + * + * @param input The name of the fluid being electrolyzed + * @param inputAmount The amount of input fluid used per operation (in millibuckets) + * @param EUaTick The EU used per tick + * @param ticksNeeded The number of ticks each operation takes, will default to 200 if not given + * @param outputs The output fluids, with a given direction for the tank to fill + */ + void addRecipe(@Nonnull String input, int inputAmount, int EUaTick, int ticksNeeded, @Nonnull ElectrolyzerOutput... outputs); + + /** + * Get an electrolyzer recipe for the given fluid + * + * @param Input fluid + * @return The found recipe or null if no recipe is found + */ + ElectrolyzerRecipe getElectrolysisInformation(Fluid fluid); + + /** + * Get the {@link ElectrolyzerOutput}s for the given input fluid + * + * @param Input fluid + * @return Outputs and tank directions + */ + ElectrolyzerOutput[] getOutput(Fluid input); + + /** + * Gets the whole current fluid mappings + * @return The current fluid map + */ + Map getRecipeMap(); + + @ParametersAreNonnullByDefault + public static final class ElectrolyzerOutput { + /** + * @param fluidName The name of the output fluid + * @param fluidAmount The amount of the fluid produced per operation (in millibuckets) + * @param tankDirection The direction relative to the electrolyzer that the output tank should be + */ + public ElectrolyzerOutput(String fluidName, int fluidAmount, EnumFacing tankDirection) { + this.fluidName = fluidName; + this.fluidAmount = fluidAmount; + this.tankDirection = tankDirection; + } + + public FluidStack getOutput() { + return FluidRegistry.getFluid(fluidName) == null ? null : new FluidStack(FluidRegistry.getFluid(this.fluidName), this.fluidAmount); + } + + public Pair getFullOutput() { + return Pair.of(getOutput(), tankDirection); + } + + public final String fluidName; + public final int fluidAmount; + public final EnumFacing tankDirection; + } + + public static final class ElectrolyzerRecipe { + public ElectrolyzerRecipe(int inputAmount, int EUaTick, int ticksNeeded, ElectrolyzerOutput... outputs) { + this.inputAmount = inputAmount; + this.EUaTick = EUaTick; + this.ticksNeeded = ticksNeeded; + this.outputs = validateOutputs(outputs); + } + + private ElectrolyzerOutput[] validateOutputs(ElectrolyzerOutput[] outputs) { + if (outputs.length < 1 || outputs.length > 5) { + throw new RuntimeException("Cannot have "+outputs.length+" outputs of an Electrolzer recipe, must be between 1 and 5"); + } + Set directions = new HashSet(outputs.length * 2, 0.5F); + for (ElectrolyzerOutput output : outputs) { + if (!directions.add(output.tankDirection)) { + throw new RuntimeException("Duplicate direction in Electrolzer outputs ("+output.tankDirection+')'); + } + } + return outputs; + } + + public final int inputAmount; + public final int EUaTick; + public final int ticksNeeded; + public final ElectrolyzerOutput[] outputs; + } +} \ No newline at end of file diff --git a/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager$Output.class b/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager$Output.class new file mode 100644 index 000000000..24704809b Binary files /dev/null and b/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager$Output.class differ diff --git a/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager.class b/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager.class new file mode 100644 index 000000000..722df6032 Binary files /dev/null and b/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager.class differ diff --git a/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager.java b/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager.java new file mode 100644 index 000000000..d301b41a5 --- /dev/null +++ b/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager.java @@ -0,0 +1,25 @@ +package ic2.api.recipe; + +import java.util.Collection; + +import net.minecraft.item.ItemStack; + +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + +import ic2.api.recipe.IEmptyFluidContainerRecipeManager.Output; +import ic2.api.util.FluidContainerOutputMode; + +public interface IEmptyFluidContainerRecipeManager extends IMachineRecipeManager { + MachineRecipeResult apply(ItemStack input, Fluid requiredFluid, FluidContainerOutputMode outputMode, boolean acceptTest); + + public static class Output { + public Output(Collection container, FluidStack fluid) { + this.container = container; + this.fluid = fluid; + } + + public final Collection container; + public final FluidStack fluid; + } +} diff --git a/src/api/java/ic2/api/recipe/IFermenterRecipeManager$FermentationProperty.class b/src/api/java/ic2/api/recipe/IFermenterRecipeManager$FermentationProperty.class index cb375fc2b..4b8138fe0 100644 Binary files a/src/api/java/ic2/api/recipe/IFermenterRecipeManager$FermentationProperty.class and b/src/api/java/ic2/api/recipe/IFermenterRecipeManager$FermentationProperty.class differ diff --git a/src/api/java/ic2/api/recipe/IFermenterRecipeManager.class b/src/api/java/ic2/api/recipe/IFermenterRecipeManager.class index 78c4f28f8..450f09a43 100644 Binary files a/src/api/java/ic2/api/recipe/IFermenterRecipeManager.class and b/src/api/java/ic2/api/recipe/IFermenterRecipeManager.class differ diff --git a/src/api/java/ic2/api/recipe/IFermenterRecipeManager.java b/src/api/java/ic2/api/recipe/IFermenterRecipeManager.java index a7b7907ab..87fcba699 100644 --- a/src/api/java/ic2/api/recipe/IFermenterRecipeManager.java +++ b/src/api/java/ic2/api/recipe/IFermenterRecipeManager.java @@ -13,11 +13,11 @@ import net.minecraftforge.fluids.FluidStack; */ public interface IFermenterRecipeManager extends ILiquidAcceptManager { /** - * Add a new fluid to the fermenter. + * Add a new recipe to the fermenter. * * @param input The name of the fluid to ferment - * @param inputAmount The amount of input fluid used per operation - * @param ticks The total amount of heat needed to convert the input into the output + * @param inputAmount The amount of input fluid used per operation (in millibuckets) + * @param heat The total amount of heat needed to convert the input into the output * @param output The name of the fluid that is being fermented into * @param outputAmount The amount of output fluid produced per operation */ @@ -44,7 +44,7 @@ public interface IFermenterRecipeManager extends ILiquidAcceptManager { */ Map getRecipeMap(); - public static class FermentationProperty { + public static final class FermentationProperty { public FermentationProperty(int inputAmount, int heat, String output, int outputAmount) { this.inputAmount = inputAmount; this.heat = heat; diff --git a/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager$Input.class b/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager$Input.class new file mode 100644 index 000000000..9f813eba2 Binary files /dev/null and b/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager$Input.class differ diff --git a/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager.class b/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager.class new file mode 100644 index 000000000..42ddd10a7 Binary files /dev/null and b/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager.class differ diff --git a/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager.java b/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager.java new file mode 100644 index 000000000..840fed83e --- /dev/null +++ b/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager.java @@ -0,0 +1,24 @@ +package ic2.api.recipe; + +import java.util.Collection; + +import net.minecraft.item.ItemStack; + +import net.minecraftforge.fluids.FluidStack; + +import ic2.api.recipe.IFillFluidContainerRecipeManager.Input; +import ic2.api.util.FluidContainerOutputMode; + +public interface IFillFluidContainerRecipeManager extends IMachineRecipeManager, Input> { + MachineRecipeResult, Input> apply(Input input, FluidContainerOutputMode outputMode, boolean acceptTest); + + public static class Input { + public Input(ItemStack container, FluidStack fluid) { + this.container = container; + this.fluid = fluid; + } + + public final ItemStack container; + public final FluidStack fluid; + } +} diff --git a/src/api/java/ic2/api/recipe/IFluidRecipeManager$RecipeIoContainerFluid.class b/src/api/java/ic2/api/recipe/IFluidRecipeManager$RecipeIoContainerFluid.class deleted file mode 100644 index d2fad7753..000000000 Binary files a/src/api/java/ic2/api/recipe/IFluidRecipeManager$RecipeIoContainerFluid.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/IFluidRecipeManager.class b/src/api/java/ic2/api/recipe/IFluidRecipeManager.class deleted file mode 100644 index a6f3a2d4e..000000000 Binary files a/src/api/java/ic2/api/recipe/IFluidRecipeManager.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/IFluidRecipeManager.java b/src/api/java/ic2/api/recipe/IFluidRecipeManager.java deleted file mode 100644 index 7cc662429..000000000 --- a/src/api/java/ic2/api/recipe/IFluidRecipeManager.java +++ /dev/null @@ -1,60 +0,0 @@ -package ic2.api.recipe; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import net.minecraftforge.fluids.FluidStack; - - -/** - * Recipe manager interface for machines that will probably never be added. - * - * @author estebes, Player - */ -public interface IFluidRecipeManager { - /** - * Adds a recipe to the machine. - * - * @param input Fluid input - * @param output Output fluid - */ - public boolean addRecipe(IRecipeInput input, NBTTagCompound metadata, boolean replace, FluidStack... output); - - /** - * Gets the recipe output for the given input. - * - * @param input Fluid input - * @param adjustInput modify the input according to the recipe's requirements - * @return Recipe output, or null if none, output fluid in nbt - */ - public RecipeOutputFluid getOutputFor(ItemStack input, boolean adjustInput); - - /** - * Get all registered recipes (optional operation). - * - * The method is only available if {@link #isIterable()} is true. - * You're a mad evil scientist if you ever modify this. - * - * @return Iterable of all recipes registered to the manager. - * @throws UnsupportedOperationException if {@link #isIterable()} is false. - */ - public Iterable getRecipes(); - - /** - * Determine whether the recipes can be iterated. - * - * @return true if {@link #getRecipes()} is implemented, false otherwise. - */ - public boolean isIterable(); - - - public static class RecipeIoContainerFluid { - public RecipeIoContainerFluid(IRecipeInput input, RecipeOutputFluid output) { - this.input = input; - this.output = output; - } - - public final IRecipeInput input; - public final RecipeOutputFluid output; - } -} diff --git a/src/api/java/ic2/api/recipe/IMachineRecipeManager$RecipeIoContainer.class b/src/api/java/ic2/api/recipe/IMachineRecipeManager$RecipeIoContainer.class deleted file mode 100644 index 0d21f7ada..000000000 Binary files a/src/api/java/ic2/api/recipe/IMachineRecipeManager$RecipeIoContainer.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/IMachineRecipeManager.class b/src/api/java/ic2/api/recipe/IMachineRecipeManager.class index 35823e21f..c3832b7e6 100644 Binary files a/src/api/java/ic2/api/recipe/IMachineRecipeManager.class and b/src/api/java/ic2/api/recipe/IMachineRecipeManager.class differ diff --git a/src/api/java/ic2/api/recipe/IMachineRecipeManager.java b/src/api/java/ic2/api/recipe/IMachineRecipeManager.java index efa62cc88..7126ad6b5 100644 --- a/src/api/java/ic2/api/recipe/IMachineRecipeManager.java +++ b/src/api/java/ic2/api/recipe/IMachineRecipeManager.java @@ -1,6 +1,5 @@ package ic2.api.recipe; -import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; /** @@ -8,7 +7,7 @@ import net.minecraft.nbt.NBTTagCompound; * * @author Player, RichardG */ -public interface IMachineRecipeManager { +public interface IMachineRecipeManager { /** * Adds a recipe to the machine. * @@ -19,21 +18,23 @@ public interface IMachineRecipeManager { * @note Replace is only as reliable as IRecipeInput.getInputs(). * * @param input Recipe input + * @param output Recipe outputs, zero or more depending on the machine. * @param metadata Meta data for additional recipe properties, may be null. * @param replace Replace conflicting existing recipes, not recommended, may be ignored. - * @param outputs Recipe outputs, zero or more depending on the machine. * @return true on success, false otherwise, e.g. on conflicts. */ - public boolean addRecipe(IRecipeInput input, NBTTagCompound metadata, boolean replace, ItemStack... outputs); + boolean addRecipe(RI input, RO output, NBTTagCompound metadata, boolean replace); /** - * Gets the recipe output for the given input. + * Gets the recipe result for the given input. * - * @param input Recipe input - * @param adjustInput modify the input according to the recipe's requirements - * @return Recipe output, or null if none + * @param input Recipe input (not modified) + * @param acceptTest If true the manager will accept partially missing ingredients or + * ingredients with insufficient quantities. This is primarily used to check whether a + * slot/tank/etc can accept the input while trying to supply a machine with resources. + * @return Recipe result, or null if none */ - public RecipeOutput getOutputFor(ItemStack input, boolean adjustInput); + MachineRecipeResult apply(I input, boolean acceptTest); /** * Get all registered recipes (optional operation). @@ -44,23 +45,12 @@ public interface IMachineRecipeManager { * @return Iterable of all recipes registered to the manager. * @throws UnsupportedOperationException if {@link #isIterable()} is false. */ - public Iterable getRecipes(); + Iterable> getRecipes(); /** * Determine whether the recipes can be iterated. * * @return true if {@link #getRecipes()} is implemented, false otherwise. */ - public boolean isIterable(); - - - public static class RecipeIoContainer { - public RecipeIoContainer(IRecipeInput input, RecipeOutput output) { - this.input = input; - this.output = output; - } - - public final IRecipeInput input; - public final RecipeOutput output; - } + boolean isIterable(); } diff --git a/src/api/java/ic2/api/recipe/IRecipeInput.java b/src/api/java/ic2/api/recipe/IRecipeInput.java index 0c842d639..dd49f757a 100644 --- a/src/api/java/ic2/api/recipe/IRecipeInput.java +++ b/src/api/java/ic2/api/recipe/IRecipeInput.java @@ -4,10 +4,15 @@ import java.util.List; import net.minecraft.item.ItemStack; +/** + * Interface for recipe ingredient matchers. + * + * See {@link Recipes#inputFactory} for some default factory methods. + */ public interface IRecipeInput { /** * Check if subject matches this recipe input, ignoring the amount. - * + * * @param subject ItemStack to check * @return true if it matches the requirement */ @@ -15,16 +20,16 @@ public interface IRecipeInput { /** * Determine the minimum input stack size. - * + * * @return input amount required */ int getAmount(); /** * List all possible inputs (best effort). - * - * The stack size is undefined, use getAmount to get the correct one. - * + * + * The stack size has to match getAmount(). + * * @return list of inputs, may be incomplete */ List getInputs(); diff --git a/src/api/java/ic2/api/recipe/IRecipeInputFactory.class b/src/api/java/ic2/api/recipe/IRecipeInputFactory.class new file mode 100644 index 000000000..b6e90226b Binary files /dev/null and b/src/api/java/ic2/api/recipe/IRecipeInputFactory.class differ diff --git a/src/api/java/ic2/api/recipe/IRecipeInputFactory.java b/src/api/java/ic2/api/recipe/IRecipeInputFactory.java new file mode 100644 index 000000000..f802ebb2f --- /dev/null +++ b/src/api/java/ic2/api/recipe/IRecipeInputFactory.java @@ -0,0 +1,17 @@ +package ic2.api.recipe; + +import net.minecraft.item.ItemStack; + +import net.minecraftforge.fluids.Fluid; + +public interface IRecipeInputFactory { + IRecipeInput forStack(ItemStack stack); + IRecipeInput forStack(ItemStack stack, int amount); + IRecipeInput forOreDict(String name); + IRecipeInput forOreDict(String name, int amount); + IRecipeInput forOreDict(String name, int amount, int metaOverride); + IRecipeInput forFluidContainer(Fluid fluid); + IRecipeInput forFluidContainer(Fluid fluid, int amount); + IRecipeInput forAny(IRecipeInput... options); + IRecipeInput forAny(Iterable options); +} diff --git a/src/api/java/ic2/api/recipe/IScrapboxManager.class b/src/api/java/ic2/api/recipe/IScrapboxManager.class index 2aa3304f1..80cf6ffd4 100644 Binary files a/src/api/java/ic2/api/recipe/IScrapboxManager.class and b/src/api/java/ic2/api/recipe/IScrapboxManager.class differ diff --git a/src/api/java/ic2/api/recipe/IScrapboxManager.java b/src/api/java/ic2/api/recipe/IScrapboxManager.java index 41b694dcc..f379e8dab 100644 --- a/src/api/java/ic2/api/recipe/IScrapboxManager.java +++ b/src/api/java/ic2/api/recipe/IScrapboxManager.java @@ -4,7 +4,7 @@ import java.util.Map; import net.minecraft.item.ItemStack; -public interface IScrapboxManager { +public interface IScrapboxManager extends IBasicMachineRecipeManager { void addDrop(ItemStack drop, float rawChance); ItemStack getDrop(ItemStack input, boolean adjustInput); diff --git a/src/api/java/ic2/api/recipe/ISemiFluidFuelManager$BurnProperty.class b/src/api/java/ic2/api/recipe/ISemiFluidFuelManager$BurnProperty.class index e1aba6db9..890fd21cd 100644 Binary files a/src/api/java/ic2/api/recipe/ISemiFluidFuelManager$BurnProperty.class and b/src/api/java/ic2/api/recipe/ISemiFluidFuelManager$BurnProperty.class differ diff --git a/src/api/java/ic2/api/recipe/ISemiFluidFuelManager.class b/src/api/java/ic2/api/recipe/ISemiFluidFuelManager.class index 562181cd5..3d867b887 100644 Binary files a/src/api/java/ic2/api/recipe/ISemiFluidFuelManager.class and b/src/api/java/ic2/api/recipe/ISemiFluidFuelManager.class differ diff --git a/src/api/java/ic2/api/recipe/ISemiFluidFuelManager.java b/src/api/java/ic2/api/recipe/ISemiFluidFuelManager.java index 87c34270d..f9313d1d2 100644 --- a/src/api/java/ic2/api/recipe/ISemiFluidFuelManager.java +++ b/src/api/java/ic2/api/recipe/ISemiFluidFuelManager.java @@ -8,7 +8,7 @@ import net.minecraftforge.fluids.Fluid; public interface ISemiFluidFuelManager extends ILiquidAcceptManager { /** * Add a new fluid to the semi fluid generator. - * + * * @param fluidName the fluid to burn * @param amount amount of fluid to consume per tick * @param power amount of energy generated per tick @@ -20,10 +20,10 @@ public interface ISemiFluidFuelManager extends ILiquidAcceptManager { Map getBurnProperties(); - public static class BurnProperty { - public BurnProperty(int amount1, double power1) { - this.amount = amount1; - this.power = power1; + public static final class BurnProperty { + public BurnProperty(int amount, double power) { + this.amount = amount; + this.power = power; } public final int amount; diff --git a/src/api/java/ic2/api/recipe/MachineRecipe.class b/src/api/java/ic2/api/recipe/MachineRecipe.class new file mode 100644 index 000000000..d8e05cb51 Binary files /dev/null and b/src/api/java/ic2/api/recipe/MachineRecipe.class differ diff --git a/src/api/java/ic2/api/recipe/MachineRecipe.java b/src/api/java/ic2/api/recipe/MachineRecipe.java new file mode 100644 index 000000000..af24cb654 --- /dev/null +++ b/src/api/java/ic2/api/recipe/MachineRecipe.java @@ -0,0 +1,35 @@ +package ic2.api.recipe; + +import net.minecraft.nbt.NBTTagCompound; + +public class MachineRecipe { + public MachineRecipe(I input, O output) { + this(input, output, null); + } + + public MachineRecipe(I input, O output, NBTTagCompound meta) { + this.input = input; + this.output = output; + this.meta = meta; + } + + public I getInput() { + return input; + } + + public O getOutput() { + return output; + } + + public NBTTagCompound getMetaData() { + return meta; + } + + public MachineRecipeResult getResult(AI adjustedInput) { + return new MachineRecipeResult(this, adjustedInput); + } + + private final I input; + private final O output; + private final NBTTagCompound meta; +} diff --git a/src/api/java/ic2/api/recipe/MachineRecipeResult.class b/src/api/java/ic2/api/recipe/MachineRecipeResult.class new file mode 100644 index 000000000..09bb88f04 Binary files /dev/null and b/src/api/java/ic2/api/recipe/MachineRecipeResult.class differ diff --git a/src/api/java/ic2/api/recipe/MachineRecipeResult.java b/src/api/java/ic2/api/recipe/MachineRecipeResult.java new file mode 100644 index 000000000..9ed1a6f02 --- /dev/null +++ b/src/api/java/ic2/api/recipe/MachineRecipeResult.java @@ -0,0 +1,23 @@ +package ic2.api.recipe; + +public class MachineRecipeResult { + public MachineRecipeResult(MachineRecipe recipe, I adjustedInput) { + this.recipe = recipe; + this.adjustedInput = adjustedInput; + } + + public MachineRecipe getRecipe() { + return recipe; + } + + public RO getOutput() { + return recipe.getOutput(); + } + + public I getAdjustedInput() { + return adjustedInput; + } + + private final MachineRecipe recipe; + private final I adjustedInput; +} diff --git a/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.class b/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.class deleted file mode 100644 index eb5042a08..000000000 Binary files a/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.java b/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.java deleted file mode 100644 index 3c05ed758..000000000 --- a/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.java +++ /dev/null @@ -1,64 +0,0 @@ -package ic2.api.recipe; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidContainerItem; - -import ic2.api.item.IC2Items; - -public class RecipeInputFluidContainer implements IRecipeInput { - public RecipeInputFluidContainer(Fluid fluid) { - this(fluid, Fluid.BUCKET_VOLUME); - } - - public RecipeInputFluidContainer(Fluid fluid, int amount) { - this.fluid = fluid; - this.amount = amount; - } - - @Override - public boolean matches(ItemStack subject) { - FluidStack fs = FluidContainerRegistry.getFluidForFilledItem(subject); - - if (fs == null && subject.getItem() instanceof IFluidContainerItem) { - IFluidContainerItem item = (IFluidContainerItem)subject.getItem(); - fs = item.getFluid(subject); - } - - // match amount precisely to avoid having to deal with leftover - return fs == null && fluid == null || - fs != null && fs.getFluid() == fluid && fs.amount >= amount; - } - - @Override - public int getAmount() { - return amount; - } - - @Override - public List getInputs() { - List ret = new ArrayList(); - - for (FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (data.fluid.getFluid() == fluid) ret.add(data.filledContainer); - } - ret.add(IC2Items.getItem("fluid_cell", fluid.getName())); - - return ret; - } - - @Override - public String toString() { - return "RInputFluidContainer<"+amount+"x"+fluid.getName()+">"; - } - - public final Fluid fluid; - public final int amount; -} diff --git a/src/api/java/ic2/api/recipe/RecipeInputItemStack.class b/src/api/java/ic2/api/recipe/RecipeInputItemStack.class deleted file mode 100644 index c956c06d8..000000000 Binary files a/src/api/java/ic2/api/recipe/RecipeInputItemStack.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/RecipeInputItemStack.java b/src/api/java/ic2/api/recipe/RecipeInputItemStack.java deleted file mode 100644 index 84f86ea12..000000000 --- a/src/api/java/ic2/api/recipe/RecipeInputItemStack.java +++ /dev/null @@ -1,47 +0,0 @@ -package ic2.api.recipe; - -import java.util.Arrays; -import java.util.List; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.oredict.OreDictionary; - -public class RecipeInputItemStack implements IRecipeInput { - public RecipeInputItemStack(ItemStack aInput) { - this(aInput, aInput.stackSize); - } - - public RecipeInputItemStack(ItemStack aInput, int aAmount) { - if (aInput.getItem() == null) throw new IllegalArgumentException("Invalid item stack specfied"); - - input = aInput.copy(); // Never forget to copy. - amount = aAmount; - } - - @Override - public boolean matches(ItemStack subject) { - return subject.getItem() == input.getItem() && - (subject.getItemDamage() == input.getItemDamage() || input.getItemDamage() == OreDictionary.WILDCARD_VALUE); - } - - @Override - public int getAmount() { - return amount; - } - - @Override - public List getInputs() { - return Arrays.asList(input); - } - - @Override - public String toString() { - ItemStack stack = input.copy(); - input.stackSize = amount; - return "RInputItemStack<"+stack+">"; - } - - public final ItemStack input; - public final int amount; -} diff --git a/src/api/java/ic2/api/recipe/RecipeInputOreDict.class b/src/api/java/ic2/api/recipe/RecipeInputOreDict.class deleted file mode 100644 index e7a3a2db3..000000000 Binary files a/src/api/java/ic2/api/recipe/RecipeInputOreDict.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/RecipeInputOreDict.java b/src/api/java/ic2/api/recipe/RecipeInputOreDict.java deleted file mode 100644 index e6e4695d0..000000000 --- a/src/api/java/ic2/api/recipe/RecipeInputOreDict.java +++ /dev/null @@ -1,104 +0,0 @@ -package ic2.api.recipe; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import net.minecraftforge.oredict.OreDictionary; - -public class RecipeInputOreDict implements IRecipeInput { - public RecipeInputOreDict(String input1) { - this(input1, 1); - } - - public RecipeInputOreDict(String input1, int amount1) { - this(input1, amount1, null); - } - - public RecipeInputOreDict(String input1, int amount1, Integer meta) { - this.input = input1; - this.amount = amount1; - this.meta = meta; - } - - @Override - public boolean matches(ItemStack subject) { - List inputs = getOres(); - boolean useOreStackMeta = (meta == null); - Item subjectItem = subject.getItem(); - int subjectMeta = subject.getItemDamage(); - - for (ItemStack oreStack : inputs) { - Item oreItem = oreStack.getItem(); - if (oreItem == null) continue; // ignore invalid - - int metaRequired = useOreStackMeta ? oreStack.getItemDamage() : meta; - - if (subjectItem == oreItem && - (subjectMeta == metaRequired || metaRequired == OreDictionary.WILDCARD_VALUE)) { - return true; - } - } - - return false; - } - - @Override - public int getAmount() { - return amount; - } - - @Override - public List getInputs() { - List ores = getOres(); - - // check if we have to filter the list first - boolean hasInvalidEntries = false; - - for (ItemStack stack : ores) { - if (stack.getItem() == null) { - hasInvalidEntries = true; - break; - } - } - - if (!hasInvalidEntries) return ores; - - List ret = new ArrayList(ores.size()); - - for (ItemStack stack : ores) { - if (stack.getItem() != null) ret.add(stack); // ignore invalid - } - - return Collections.unmodifiableList(ret); - } - - @Override - public String toString() { - if (meta == null) { - return "RInputOreDict<"+amount+"x"+input+">"; - } else { - return "RInputOreDict<"+amount+"x"+input+"@"+meta+">"; - } - } - - private List getOres() { - if (ores != null) return ores; - - // cache the ore list by making use of the fact that forge always uses the same list, - // unless it's EMPTY_LIST, which should never happen. - List ret = OreDictionary.getOres(input); - - if (ret != OreDictionary.EMPTY_LIST) ores = ret; - - return ret; - } - - public final String input; - public final int amount; - public final Integer meta; - private List ores; -} diff --git a/src/api/java/ic2/api/recipe/RecipeOutput.class b/src/api/java/ic2/api/recipe/RecipeOutput.class index a2a19b3b1..0c83c13a1 100644 Binary files a/src/api/java/ic2/api/recipe/RecipeOutput.class and b/src/api/java/ic2/api/recipe/RecipeOutput.class differ diff --git a/src/api/java/ic2/api/recipe/RecipeOutput.java b/src/api/java/ic2/api/recipe/RecipeOutput.java index 80ad5fb5c..0f2fe1cba 100644 --- a/src/api/java/ic2/api/recipe/RecipeOutput.java +++ b/src/api/java/ic2/api/recipe/RecipeOutput.java @@ -7,6 +7,7 @@ import java.util.List; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +@Deprecated public final class RecipeOutput { public RecipeOutput(NBTTagCompound metadata1, List items1) { assert !items1.contains(null); diff --git a/src/api/java/ic2/api/recipe/RecipeOutputFluid.class b/src/api/java/ic2/api/recipe/RecipeOutputFluid.class deleted file mode 100644 index ef597f4dd..000000000 Binary files a/src/api/java/ic2/api/recipe/RecipeOutputFluid.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/RecipeOutputFluid.java b/src/api/java/ic2/api/recipe/RecipeOutputFluid.java deleted file mode 100644 index 750492245..000000000 --- a/src/api/java/ic2/api/recipe/RecipeOutputFluid.java +++ /dev/null @@ -1,57 +0,0 @@ -package ic2.api.recipe; - -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import net.minecraft.nbt.NBTTagCompound; - -import net.minecraftforge.fluids.FluidStack; - -/** - * @author estebes - */ -public class RecipeOutputFluid { - public RecipeOutputFluid(NBTTagCompound metadata, List outputs) { - assert !outputs.contains(null); - - this.metadata = metadata; - this.outputs = outputs; - } - - public RecipeOutputFluid(NBTTagCompound metadata, FluidStack... outputs) { - this(metadata, Arrays.asList(outputs)); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof RecipeOutputFluid) { - RecipeOutputFluid ro = (RecipeOutputFluid) obj; - - if (outputs.size() == ro.outputs.size() && - (metadata == null && ro.metadata == null || metadata != null && ro.metadata != null && metadata.equals(ro.metadata))) { - Iterator itA = outputs.iterator(); - Iterator itB = ro.outputs.iterator(); - - while (itA.hasNext() && itB.hasNext()) { - FluidStack stackA = itA.next(); - FluidStack stackB = itB.next(); - - if (stackA.isFluidStackIdentical(stackB)) return false; - } - - return true; - } - } - - return false; - } - - @Override - public String toString() { - return "ROutput<"+outputs+","+metadata+">"; - } - - public final List outputs; - public final NBTTagCompound metadata; -} diff --git a/src/api/java/ic2/api/recipe/Recipes.class b/src/api/java/ic2/api/recipe/Recipes.class index 135ea928e..1921c1c5b 100644 Binary files a/src/api/java/ic2/api/recipe/Recipes.class and b/src/api/java/ic2/api/recipe/Recipes.class differ diff --git a/src/api/java/ic2/api/recipe/Recipes.java b/src/api/java/ic2/api/recipe/Recipes.java index 50fc6e6fb..c6cc0d753 100644 --- a/src/api/java/ic2/api/recipe/Recipes.java +++ b/src/api/java/ic2/api/recipe/Recipes.java @@ -1,41 +1,158 @@ package ic2.api.recipe; +import net.minecraft.item.ItemStack; /** * General recipe registry. * - * @author Richard + *

IMachineRecipeManager.addRecipe takes a metadata parameter, the expected contents are specified + * below as "recipe meta". The metadata NBT itself should be null for "no recipe meta" or a + * NBTTagCompound with keys matching the names and value types mentioned below. + * + *

Example: Compressor recipe, Sand -> Glass: + *

{@code
+ * Recipes.compressor.addRecipe(new RecipeInputItemStack(new ItemStack(Blocks.SAND)), null, false, new ItemStack(Blocks.GLASS));
+ * }
+ * + *

Example: Metal former rolling recipe, Platinum ingot (oredict) -> Platinum plate: + *

{@code
+ * Recipes.metalformerRolling.addRecipe(new RecipeInputOreDict("ingotPlatinum"), null, false, myPlatinumPlateStack)
+ * }
+ * + *

Example: Mass fabricator amplifier, nether stars amplifying 1M EU: + *

{@code
+ * NBTTagCompound meta = new NBTTagCompound();
+ * meta.setInteger("amplification", 1000000);
+ * Recipes.matterAmplifier.addRecipe(new RecipeInputItemStack(new ItemStack(Items.NETHER_STAR)), meta, false);
+ * }
+ * */ public class Recipes { - public static IMachineRecipeManager furnace; - public static IMachineRecipeManager macerator; - public static IMachineRecipeManager extractor; - public static IMachineRecipeManager compressor; - public static IMachineRecipeManager centrifuge; - public static IMachineRecipeManager blockcutter; - public static IMachineRecipeManager blastfurnace; - public static IMachineRecipeManager recycler; - public static IMachineRecipeManager metalformerExtruding; - public static IMachineRecipeManager metalformerCutting; - public static IMachineRecipeManager metalformerRolling; - public static IMachineRecipeManager oreWashing; + /** + * Convenience factory for various recipe input variants. + */ + public static IRecipeInputFactory inputFactory; + + /** + * Recipe manager for furnace recipes. + * + *

Recipe meta: + *

    + *
  • float experience: experience per smelt operation + *
+ */ + public static IMachineRecipeManager furnace; + + /** + * Recipe manager for macerator recipes. + * + *

No recipe meta. + */ + public static IBasicMachineRecipeManager macerator; + + /** + * Recipe manager for extractor recipes. + * + *

No recipe meta. + */ + public static IBasicMachineRecipeManager extractor; + + /** + * Recipe manager for compressor recipes. + * + *

No recipe meta. + */ + public static IBasicMachineRecipeManager compressor; + + /** + * Recipe manager for thermal centrifuge recipes. + * + *

Recipe meta: + *

    + *
  • int minHeat: minimum heat level required + *
+ */ + public static IBasicMachineRecipeManager centrifuge; + + /** + * Recipe manager for blast cutter recipes. + * + *

Recipe meta: + *

    + *
  • int hardness: minimum blade hardness (3=iron, 6=steel, 9=diamond) + *
+ */ + public static IBasicMachineRecipeManager blockcutter; + + /** + * Recipe manager for blast furnace recipes. + * + *

Recipe meta: + *

    + *
  • int fluid: input fluid amount per cycle (in mB) + *
  • int duration: process duration (in ticks) + *
+ */ + public static IBasicMachineRecipeManager blastfurnace; + + /** + * Recipe manager for recycler recipes. + * + *

No recipe meta. + * + * @note the implementation is currently immutable, any non-blacklisted item will be accepted, + * chance checking is up to the caller. + */ + public static IBasicMachineRecipeManager recycler; + + /** + * Recipe manager for metal former extrusion mode recipes. + * + *

No recipe meta. + */ + public static IBasicMachineRecipeManager metalformerExtruding; + + /** + * Recipe manager for metal former cutting mode recipes. + * + *

No recipe meta. + */ + public static IBasicMachineRecipeManager metalformerCutting; + + /** + * Recipe manager for metal former rolling mode recipes. + * + *

No recipe meta. + */ + public static IBasicMachineRecipeManager metalformerRolling; + + /** + * Recipe manager for ore washing plant recipes. + * + *

Recipe meta: + *

    + *
  • int amount: input fluid amount per cycle (in mB) + *
+ */ + public static IBasicMachineRecipeManager oreWashing; public static ICannerBottleRecipeManager cannerBottle; public static ICannerEnrichRecipeManager cannerEnrich; + public static IElectrolyzerRecipeManager electrolyzer; public static IFermenterRecipeManager fermenter; /** - * Reference amplifier values: + * Recipe manager for uu mass fabricator (matter gen) recipes. * - * 5000: Scrap - * 45000: Scrapbox + *

No recipe meta. * - * As Parameter for the Amplification Value you have to use the NBTTagCompound - * - * NBTTagCompound nbt = new NBTTagCompound(); - * nbt.setInteger("amplification", aValue); - * matterAmplifier.addRecipe(yourStack, nbt); + *

Reference values: + *

    + *
  • 5000: Scrap + *
  • 45000: Scrapbox + *
*/ - public static IMachineRecipeManager matterAmplifier; + public static IMachineRecipeManager matterAmplifier; + /** * Reference scrap box chance values: * @@ -67,4 +184,7 @@ public class Recipes { * Opposite of {@link #liquidCooldownManager}. This is for Liquids that can be heated up again. */ public static ILiquidHeatExchangerManager liquidHeatupManager; + + public static IEmptyFluidContainerRecipeManager emptyFluidContainer; + public static IFillFluidContainerRecipeManager fillFluidContainer; } diff --git a/src/api/java/ic2/api/recipe/package-info.class b/src/api/java/ic2/api/recipe/package-info.class deleted file mode 100644 index 8a795bbdb..000000000 Binary files a/src/api/java/ic2/api/recipe/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/recipe/package-info.java b/src/api/java/ic2/api/recipe/package-info.java deleted file mode 100644 index 54b01a44e..000000000 --- a/src/api/java/ic2/api/recipe/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.recipe; -import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/ic2/api/tile/RotorRegistry.class b/src/api/java/ic2/api/tile/RotorRegistry.class index 329ff28ad..45357043a 100644 Binary files a/src/api/java/ic2/api/tile/RotorRegistry.class and b/src/api/java/ic2/api/tile/RotorRegistry.class differ diff --git a/src/api/java/ic2/api/tile/RotorRegistry.java b/src/api/java/ic2/api/tile/RotorRegistry.java index dd652f2cc..132f0f9f5 100644 --- a/src/api/java/ic2/api/tile/RotorRegistry.java +++ b/src/api/java/ic2/api/tile/RotorRegistry.java @@ -8,6 +8,8 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.relauncher.SideOnly; +import ic2.api.info.Info; + /** * Helper class for registering {@link IRotorProvider}s to provide the default windmill renderer */ @@ -28,7 +30,7 @@ public class RotorRegistry { */ public static void setInstance(IRotorRegistry i) { ModContainer mc = Loader.instance().activeModContainer(); - if (mc == null || !"IC2".equals(mc.getModId())) { + if (mc == null || !Info.MOD_ID.equals(mc.getModId())) { throw new IllegalAccessError("Only IC2 can set the instance"); } else { INSTANCE = i; diff --git a/src/api/java/ic2/api/tile/package-info.class b/src/api/java/ic2/api/tile/package-info.class deleted file mode 100644 index 9cd6bac26..000000000 Binary files a/src/api/java/ic2/api/tile/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/tile/package-info.java b/src/api/java/ic2/api/tile/package-info.java deleted file mode 100644 index 17bcde171..000000000 --- a/src/api/java/ic2/api/tile/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.tile; -import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/ic2/api/upgrade/IAugmentationUpgrade.class b/src/api/java/ic2/api/upgrade/IAugmentationUpgrade.class new file mode 100644 index 000000000..98e28e1f5 Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IAugmentationUpgrade.class differ diff --git a/src/api/java/ic2/api/upgrade/IAugmentationUpgrade.java b/src/api/java/ic2/api/upgrade/IAugmentationUpgrade.java new file mode 100644 index 000000000..4a0ff0a89 --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IAugmentationUpgrade.java @@ -0,0 +1,20 @@ +package ic2.api.upgrade; + +import net.minecraft.item.ItemStack; + +/** + * An interface to mark an item as an {@link UpgradableProperty#Augmentable} type upgrade + * + * @author Player, Chocohead + */ +public interface IAugmentationUpgrade extends IUpgradeItem { + /** + * Gets the augmentation of the upgrade on the given {@link IUpgradableBlock} + * + * @param stack The upgrade stack + * @param parent The block being augmented + * + * @return The augmentation applied + */ + int getAugmentation(ItemStack stack, IUpgradableBlock parent); +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/IEnergyStorageUpgrade.class b/src/api/java/ic2/api/upgrade/IEnergyStorageUpgrade.class new file mode 100644 index 000000000..a2a1a3099 Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IEnergyStorageUpgrade.class differ diff --git a/src/api/java/ic2/api/upgrade/IEnergyStorageUpgrade.java b/src/api/java/ic2/api/upgrade/IEnergyStorageUpgrade.java new file mode 100644 index 000000000..9c9a9e63a --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IEnergyStorageUpgrade.java @@ -0,0 +1,30 @@ +package ic2.api.upgrade; + +import net.minecraft.item.ItemStack; + +/** + * An interface to mark an item as an {@link UpgradableProperty#EnergyStorage} type upgrade + * + * @author Player, Chocohead + */ +public interface IEnergyStorageUpgrade extends IUpgradeItem { + /** + * A raw value that is added to the {@link IUpgradableBlock}'s energy storage + * + * @param stack The upgrade stack + * @param parent The block storing energy + * + * @return The raw change in energy storage to be applied + */ + int getExtraEnergyStorage(ItemStack stack, IUpgradableBlock parent); + + /** + * A multiplier value that the {@link IUpgradableBlock}'s energy storage is affected by + * + * @param stack The upgrade stack + * @param parent The block storing energy + * + * @return The multiplier to be applied to be energy storage + */ + double getEnergyStorageMultiplier(ItemStack stack, IUpgradableBlock parent); +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/IFluidConsumingUpgrade.class b/src/api/java/ic2/api/upgrade/IFluidConsumingUpgrade.class new file mode 100644 index 000000000..cc9dcfa8d Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IFluidConsumingUpgrade.class differ diff --git a/src/api/java/ic2/api/upgrade/IFluidConsumingUpgrade.java b/src/api/java/ic2/api/upgrade/IFluidConsumingUpgrade.java new file mode 100644 index 000000000..f798452f4 --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IFluidConsumingUpgrade.java @@ -0,0 +1,10 @@ +package ic2.api.upgrade; + +/** + * An interface to mark an item as an {@link UpgradableProperty#FluidConsuming} type upgrade + * + * @author Player, Chocohead + */ +public interface IFluidConsumingUpgrade extends IUpgradeItem { + +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/IFluidProducingUpgrade.class b/src/api/java/ic2/api/upgrade/IFluidProducingUpgrade.class new file mode 100644 index 000000000..2142df906 Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IFluidProducingUpgrade.class differ diff --git a/src/api/java/ic2/api/upgrade/IFluidProducingUpgrade.java b/src/api/java/ic2/api/upgrade/IFluidProducingUpgrade.java new file mode 100644 index 000000000..f310a90f5 --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IFluidProducingUpgrade.java @@ -0,0 +1,10 @@ +package ic2.api.upgrade; + +/** + * An interface to mark an item as an {@link UpgradableProperty#FluidProducing} type upgrade + * + * @author Player, Chocohead + */ +public interface IFluidProducingUpgrade extends IUpgradeItem { + +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/IFullUpgrade.class b/src/api/java/ic2/api/upgrade/IFullUpgrade.class new file mode 100644 index 000000000..2e3ed4f98 Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IFullUpgrade.class differ diff --git a/src/api/java/ic2/api/upgrade/IFullUpgrade.java b/src/api/java/ic2/api/upgrade/IFullUpgrade.java new file mode 100644 index 000000000..207786220 --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IFullUpgrade.java @@ -0,0 +1,12 @@ +package ic2.api.upgrade; + +/** + * An interface to mark an item supporting all {@link UpgradableProperty} type upgrades + * + * @author Player, Chocohead + */ +public interface IFullUpgrade extends IAugmentationUpgrade, IEnergyStorageUpgrade, IFluidConsumingUpgrade, + IFluidProducingUpgrade, IItemConsumingUpgrade, IItemProducingUpgrade, IProcessingUpgrade, + IRedstoneSensitiveUpgrade, ITransformerUpgrade { + +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.class b/src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.class new file mode 100644 index 000000000..b571d1dab Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.class differ diff --git a/src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.java b/src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.java new file mode 100644 index 000000000..0a7216bc9 --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.java @@ -0,0 +1,10 @@ +package ic2.api.upgrade; + +/** + * An interface to mark an item as an {@link UpgradableProperty#ItemConsuming} type upgrade + * + * @author Player, Chocohead + */ +public interface IItemConsumingUpgrade extends IUpgradeItem { + +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/IItemProducingUpgrade.class b/src/api/java/ic2/api/upgrade/IItemProducingUpgrade.class new file mode 100644 index 000000000..e28bf01b6 Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IItemProducingUpgrade.class differ diff --git a/src/api/java/ic2/api/upgrade/IItemProducingUpgrade.java b/src/api/java/ic2/api/upgrade/IItemProducingUpgrade.java new file mode 100644 index 000000000..85a3b9929 --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IItemProducingUpgrade.java @@ -0,0 +1,10 @@ +package ic2.api.upgrade; + +/** + * An interface to mark an item as an {@link UpgradableProperty#ItemProducing} type upgrade + * + * @author Player, Chocohead + */ +public interface IItemProducingUpgrade extends IUpgradeItem { + +} diff --git a/src/api/java/ic2/api/upgrade/IProcessingUpgrade.class b/src/api/java/ic2/api/upgrade/IProcessingUpgrade.class new file mode 100644 index 000000000..38402e890 Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IProcessingUpgrade.class differ diff --git a/src/api/java/ic2/api/upgrade/IProcessingUpgrade.java b/src/api/java/ic2/api/upgrade/IProcessingUpgrade.java new file mode 100644 index 000000000..694b4687e --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IProcessingUpgrade.java @@ -0,0 +1,50 @@ +package ic2.api.upgrade; + +import net.minecraft.item.ItemStack; + +/** + * An interface to mark an item as an {@link UpgradableProperty#Processing} type upgrade + * + * @author Player, Chocohead + */ +public interface IProcessingUpgrade extends IUpgradeItem { + /** + * A raw value that the process time is affected by (in ticks) + * + * @param stack The upgrade stack + * @param parent The {@link IUpgradableBlock} receiving the change + * + * @return The raw change in process to be applied + */ + int getExtraProcessTime(ItemStack stack, IUpgradableBlock parent); + + /** + * A multiplier value that the process time is affected by + * + * @param stack The upgrade stack + * @param parent The {@link IUpgradableBlock} receiving the change + * + * @return The multiplier to be applied to be progress + */ + double getProcessTimeMultiplier(ItemStack stack, IUpgradableBlock parent); + + /** + * A raw value that is added to the {@link IUpgradableBlock}'s energy demand + * + * @param stack The upgrade stack + * @param parent The block consuming energy + * + * @return The raw change in energy demand to be applied + */ + int getExtraEnergyDemand(ItemStack stack, IUpgradableBlock parent); + + /** + * A multiplier value that the {@link IUpgradableBlock}'s energy demand is affected by + * + * @param stack The upgrade stack + * @param parent The block consuming energy + * + * @return The multiplier to be applied to be energy demand + */ + double getEnergyDemandMultiplier(ItemStack stack, IUpgradableBlock parent); +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/IRedstoneSensitiveUpgrade.class b/src/api/java/ic2/api/upgrade/IRedstoneSensitiveUpgrade.class new file mode 100644 index 000000000..9a215c5d7 Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IRedstoneSensitiveUpgrade.class differ diff --git a/src/api/java/ic2/api/upgrade/IRedstoneSensitiveUpgrade.java b/src/api/java/ic2/api/upgrade/IRedstoneSensitiveUpgrade.java new file mode 100644 index 000000000..7c06a5afe --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IRedstoneSensitiveUpgrade.java @@ -0,0 +1,31 @@ +package ic2.api.upgrade; + +import net.minecraft.item.ItemStack; + +/** + * An interface to mark an item as an {@link UpgradableProperty#RedstoneSensitive} type upgrade + * + * @author Player, Chocohead + */ +public interface IRedstoneSensitiveUpgrade extends IUpgradeItem { + /** + * Whether the upgrade modifies the given {@link IUpgradableBlock}'s redstone input + * + * @param stack The upgrade stack + * @param parent The block being modified + * + * @return Whether the redstone input should be changed (and thus {@link #getRedstoneInput(ItemStack, IUpgradableBlock, int)} be called) + */ + boolean modifiesRedstoneInput(ItemStack stack, IUpgradableBlock parent); + + /** + * Change the redstone input given the {@link IUpgradableBlock}'s initial input value + * + * @param stack The upgrade stack + * @param parent The block receiving the redstone signal + * @param externalInput The initial redstone signal + * + * @return The new redstone signal + */ + int getRedstoneInput(ItemStack stack, IUpgradableBlock parent, int externalInput); +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/ITransformerUpgrade.class b/src/api/java/ic2/api/upgrade/ITransformerUpgrade.class new file mode 100644 index 000000000..2d52de1f9 Binary files /dev/null and b/src/api/java/ic2/api/upgrade/ITransformerUpgrade.class differ diff --git a/src/api/java/ic2/api/upgrade/ITransformerUpgrade.java b/src/api/java/ic2/api/upgrade/ITransformerUpgrade.java new file mode 100644 index 000000000..e6e2146cd --- /dev/null +++ b/src/api/java/ic2/api/upgrade/ITransformerUpgrade.java @@ -0,0 +1,20 @@ +package ic2.api.upgrade; + +import net.minecraft.item.ItemStack; + +/** + * An interface to mark an item as an {@link UpgradableProperty#Transformer} type upgrade + * + * @author Player, Chocohead + */ +public interface ITransformerUpgrade extends IUpgradeItem { + /** + * Gets the additional tier that the given {@link IUpgradableBlock} can take + * + * @param stack The upgrade stack + * @param parent The block receiving energy + * + * @return The value to tier the tier by + */ + int getExtraTier(ItemStack stack, IUpgradableBlock parent); +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/IUpgradableBlock.class b/src/api/java/ic2/api/upgrade/IUpgradableBlock.class new file mode 100644 index 000000000..d533b246c Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IUpgradableBlock.class differ diff --git a/src/api/java/ic2/api/upgrade/IUpgradableBlock.java b/src/api/java/ic2/api/upgrade/IUpgradableBlock.java new file mode 100644 index 000000000..766761873 --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IUpgradableBlock.java @@ -0,0 +1,29 @@ +package ic2.api.upgrade; + +import java.util.Set; + +/** + * An interface to mark a block as supporting {@link IUpgradeItem}s + * + * @author Player + */ +public interface IUpgradableBlock { + /** + * @return The energy the block current has + */ + double getEnergy(); + + /** + * Attempt to use the given amount of energy + * + * @param amount The amount of energy to be used + * + * @return Whether the energy was successfully used + */ + boolean useEnergy(double amount); + + /** + * @return The set of {@link UpgradableProperty}s that the block supports + */ + Set getUpgradableProperties(); +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/IUpgradeItem.class b/src/api/java/ic2/api/upgrade/IUpgradeItem.class new file mode 100644 index 000000000..6432181d3 Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IUpgradeItem.class differ diff --git a/src/api/java/ic2/api/upgrade/IUpgradeItem.java b/src/api/java/ic2/api/upgrade/IUpgradeItem.java new file mode 100644 index 000000000..09e16a30b --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IUpgradeItem.java @@ -0,0 +1,44 @@ +package ic2.api.upgrade; + +import java.util.Collection; +import java.util.Set; + +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +/** + * An interface to mark an item as an upgrade for {@link IUpgradableBlock}s + * + * @author Player, Chocohead + */ +public interface IUpgradeItem { + /** + * Checks if the upgrade is valid for the given {@link UpgradableProperty} types + * + * @param stack The upgrade stack being checked + * @param types The list of types being tested + * + * @return Whether the upgrade is valid + */ + boolean isSuitableFor(ItemStack stack, Set types); + + /** + * Called every time the given {@link IUpgradableBlock} ticks + * + * @param stack The upgrade stack being ticked + * @param parent The parent block being ticked + * + * @return Whether to call {@link TileEntity#markDirty()} due to a stack changing + */ + boolean onTick(ItemStack stack, IUpgradableBlock parent); + + /** + * Called when the given {@link IUpgradableBlock} finishes processing + * + * @param stack The upgrade stack + * @param parent The parent finishing processing + * @param output The list of output products from the process, read only! + * @return final output + */ + Collection onProcessEnd(ItemStack stack, IUpgradableBlock parent, Collection output); +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/UpgradableProperty.class b/src/api/java/ic2/api/upgrade/UpgradableProperty.class new file mode 100644 index 000000000..7f5149878 Binary files /dev/null and b/src/api/java/ic2/api/upgrade/UpgradableProperty.class differ diff --git a/src/api/java/ic2/api/upgrade/UpgradableProperty.java b/src/api/java/ic2/api/upgrade/UpgradableProperty.java new file mode 100644 index 000000000..17c575cf6 --- /dev/null +++ b/src/api/java/ic2/api/upgrade/UpgradableProperty.java @@ -0,0 +1,45 @@ +package ic2.api.upgrade; + +/** + * The possible properties an {@link IUpgradableBlock} can support + * + * @author Player + */ +public enum UpgradableProperty { + /** + * A block that processes something, taking upgrade process time + energy demand into account + */ + Processing, + /** + * A simple count based upgrade property, e.g. extra range + */ + Augmentable, + /** + * A block that is sensitive to redstone state/changes + */ + RedstoneSensitive, + /** + * A block that can have it's tier changed + */ + Transformer, + /** + * A block that can have the amount of energy it stores changed + */ + EnergyStorage, + /** + * A block that consumes items + */ + ItemConsuming, + /** + * A block that produces items + */ + ItemProducing, + /** + * A block that consumes fluids + */ + FluidConsuming, + /** + * A block that produces fluids + */ + FluidProducing, +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/UpgradeRegistry.class b/src/api/java/ic2/api/upgrade/UpgradeRegistry.class new file mode 100644 index 000000000..9059b9d15 Binary files /dev/null and b/src/api/java/ic2/api/upgrade/UpgradeRegistry.class differ diff --git a/src/api/java/ic2/api/upgrade/UpgradeRegistry.java b/src/api/java/ic2/api/upgrade/UpgradeRegistry.java new file mode 100644 index 000000000..8f6bed650 --- /dev/null +++ b/src/api/java/ic2/api/upgrade/UpgradeRegistry.java @@ -0,0 +1,38 @@ +package ic2.api.upgrade; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import net.minecraft.item.ItemStack; + +/** + * The registry that contains all known {@link IUpgradeItem}s + * + * @author Player + */ +public class UpgradeRegistry { + /** + * Register an upgrade itemstack to the registry + * + * @param stack The upgrade to register + * + * @return The stack that has been registered + */ + public static ItemStack register(ItemStack stack) { + if (!(stack.getItem() instanceof IUpgradeItem)) throw new IllegalArgumentException("The stack must represent an IUpgradeItem."); + + upgrades.add(stack); + + return stack; + } + + /** + * @return An unmodifiable list of registered upgrades + */ + public static Iterable getUpgrades() { + return Collections.unmodifiableCollection(upgrades); + } + + private static final List upgrades = new ArrayList(); +} diff --git a/src/api/java/ic2/api/util/FluidContainerOutputMode.class b/src/api/java/ic2/api/util/FluidContainerOutputMode.class new file mode 100644 index 000000000..43c42ccb6 Binary files /dev/null and b/src/api/java/ic2/api/util/FluidContainerOutputMode.class differ diff --git a/src/api/java/ic2/api/util/FluidContainerOutputMode.java b/src/api/java/ic2/api/util/FluidContainerOutputMode.java new file mode 100644 index 000000000..89812956b --- /dev/null +++ b/src/api/java/ic2/api/util/FluidContainerOutputMode.java @@ -0,0 +1,18 @@ +package ic2.api.util; + +public enum FluidContainerOutputMode { + EmptyFullToOutput(true), // move only completely filled/drained containers to output + AnyToOutput(true), // move any containers to output if they changed + InPlacePreferred(false), // adjust the input stack if possible (size == 1) + InPlace(false); // always adjust the input stack + + private FluidContainerOutputMode(boolean outputEmptyFull) { + this.outputEmptyFull = outputEmptyFull; + } + + public boolean isOutputEmptyFull() { + return outputEmptyFull; + } + + private final boolean outputEmptyFull; +} \ No newline at end of file diff --git a/src/api/java/ic2/api/util/package-info.class b/src/api/java/ic2/api/util/package-info.class deleted file mode 100644 index 6aa78d24c..000000000 Binary files a/src/api/java/ic2/api/util/package-info.class and /dev/null differ diff --git a/src/api/java/ic2/api/util/package-info.java b/src/api/java/ic2/api/util/package-info.java deleted file mode 100644 index 8fe79432f..000000000 --- a/src/api/java/ic2/api/util/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.util; -import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/invtweaks/api/IItemTree.java b/src/api/java/invtweaks/api/IItemTree.java deleted file mode 100755 index 5b6c0a805..000000000 --- a/src/api/java/invtweaks/api/IItemTree.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -import java.util.Collection; -import java.util.List; -import java.util.Random; - -public interface IItemTree { - public void registerOre(String category, String name, String oreName, int order); - - boolean matches(List items, String keyword); - - boolean isKeywordValid(String keyword); - - Collection getAllCategories(); - - IItemTreeCategory getRootCategory(); - - IItemTreeCategory getCategory(String keyword); - - boolean isItemUnknown(String id, int damage); - - List getItems(String id, int damage); - - List getItems(String name); - - IItemTreeItem getRandomItem(Random r); - - boolean containsItem(String name); - - boolean containsCategory(String name); - - void setRootCategory(IItemTreeCategory category); - - IItemTreeCategory addCategory(String parentCategory, String newCategory) throws NullPointerException; - - void addCategory(String parentCategory, IItemTreeCategory newCategory) throws NullPointerException; - - IItemTreeItem addItem(String parentCategory, String name, String id, int damage, int order) - throws NullPointerException; - - void addItem(String parentCategory, IItemTreeItem newItem) throws NullPointerException; - - int getKeywordDepth(String keyword); - - int getKeywordOrder(String keyword); -} diff --git a/src/api/java/invtweaks/api/IItemTreeCategory.java b/src/api/java/invtweaks/api/IItemTreeCategory.java deleted file mode 100755 index f1b5e9554..000000000 --- a/src/api/java/invtweaks/api/IItemTreeCategory.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -import java.util.Collection; -import java.util.List; - -public interface IItemTreeCategory { - boolean contains(IItemTreeItem item); - - void addCategory(IItemTreeCategory category); - - void addItem(IItemTreeItem item); - - Collection getSubCategories(); - - Collection> getItems(); - - String getName(); - - int getCategoryOrder(); - - int findCategoryOrder(String keyword); - - int findKeywordDepth(String keyword); -} diff --git a/src/api/java/invtweaks/api/IItemTreeItem.java b/src/api/java/invtweaks/api/IItemTreeItem.java deleted file mode 100755 index 2b6ae2db5..000000000 --- a/src/api/java/invtweaks/api/IItemTreeItem.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -public interface IItemTreeItem extends Comparable { - String getName(); - - String getId(); - - int getDamage(); - - int getOrder(); -} diff --git a/src/api/java/invtweaks/api/IItemTreeListener.java b/src/api/java/invtweaks/api/IItemTreeListener.java deleted file mode 100755 index 73a5815d5..000000000 --- a/src/api/java/invtweaks/api/IItemTreeListener.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -import java.util.EventListener; - -public interface IItemTreeListener extends EventListener { - void onTreeLoaded(IItemTree tree); -} diff --git a/src/api/java/invtweaks/api/InvTweaksAPI.java b/src/api/java/invtweaks/api/InvTweaksAPI.java deleted file mode 100755 index 6bdb84a93..000000000 --- a/src/api/java/invtweaks/api/InvTweaksAPI.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -import invtweaks.api.container.ContainerSection; -import net.minecraft.item.ItemStack; - -/** - * Interface to access functions exposed by Inventory Tweaks - *

- * The main @Mod instance of the mod implements this interface, so a refernce to it can - * be obtained via @Instance("inventorytweaks") or methods in net.minecraftforge.fml.common.Loader - *

- * All of these functions currently have no effect if called on a dedicated server. - */ -public interface InvTweaksAPI { - /** - * Add a listener for ItemTree load events - * - * @param listener - */ - void addOnLoadListener(IItemTreeListener listener); - - /** - * Remove a listener for ItemTree load events - * - * @param listener - * @return true if the listener was previously added - */ - boolean removeOnLoadListener(IItemTreeListener listener); - - /** - * Toggle sorting shortcut state. - * - * @param enabled - */ - void setSortKeyEnabled(boolean enabled); - - /** - * Toggle sorting shortcut supression. - * Unlike setSortKeyEnabled, this flag is automatically cleared when GUIs are closed. - * - * @param enabled - */ - void setTextboxMode(boolean enabled); - - /** - * Compare two items using the default (non-rule based) algorithm, - * sutable for an implementation of Comparator<ItemStack>. - * - * @param i - * @param j - * @return A value with a sign representing the relative order of the item stacks - */ - int compareItems(ItemStack i, ItemStack j); - - /** - * Initiate a sort as if the player had clicked on a sorting button or pressed the sort key. - * - * @param section - * @param method - */ - void sort(ContainerSection section, SortingMethod method); -} diff --git a/src/api/java/invtweaks/api/SortingMethod.java b/src/api/java/invtweaks/api/SortingMethod.java deleted file mode 100755 index 895b1713d..000000000 --- a/src/api/java/invtweaks/api/SortingMethod.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -public enum SortingMethod { - /** Standard 'r' sorting for generic inventories */ - DEFAULT, - /** Sort method creating vertical columns of items. - * Used for chests only, requires container to have a valid row size for correct results. - */ - VERTICAL, - /** Sort method creating horizontal rows of items. - * Used for chests only, requires container to have a valid row size for correct results. - */ - HORIZONTAL, - /** Sort method for player inventory. - * Applies to extra player-specified sorting rules for the main inventory. - * Will always operate on main inventory. - */ - INVENTORY, - /** Attempts to even the number of items in each stack of the same type of item, without moving full stacks. - * Used in crafting grid sorting. - */ - EVEN_STACKS, -} diff --git a/src/api/java/invtweaks/api/container/ChestContainer.java b/src/api/java/invtweaks/api/container/ChestContainer.java deleted file mode 100755 index e505829c1..000000000 --- a/src/api/java/invtweaks/api/container/ChestContainer.java +++ /dev/null @@ -1,38 +0,0 @@ -package invtweaks.api.container; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * A marker for containers that have a chest-like persistant storage component. Enables the Inventroy Tweaks sorting - * buttons for this container. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface ChestContainer { - // Set to true if the Inventory Tweaks sorting buttons should be shown for this container. - boolean showButtons() default true; - - // Size of a chest row - int rowSize() default 9; - - // Uses 'large chest' mode for sorting buttons - // (Renders buttons vertically down the right side of the GUI) - boolean isLargeChest() default false; - - // Annotation for method to get size of a chest row if it is not a fixed size for this container class - // Signature int func() - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.METHOD) - public @interface RowSizeCallback { - } - - // Annotation for method to get size of a chest row if it is not a fixed size for this container class - // Signature int func() - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.METHOD) - public @interface IsLargeCallback { - } -} diff --git a/src/api/java/invtweaks/api/container/ContainerSection.java b/src/api/java/invtweaks/api/container/ContainerSection.java deleted file mode 100755 index 83c2e08a4..000000000 --- a/src/api/java/invtweaks/api/container/ContainerSection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api.container; - -/** - * Names for specific parts of containers. For unknown container types (such as mod containers), only INVENTORY and - * CHEST sections are available. - */ -public enum ContainerSection { - /** - * The player's inventory - */ - INVENTORY, - /** - * The player's inventory (only the hotbar) - */ - INVENTORY_HOTBAR, - /** - * The player's inventory (all except the hotbar) - */ - INVENTORY_NOT_HOTBAR, - /** - * The chest or dispenser contents. Also used for unknown container contents. - */ - CHEST, - /** - * The crafting input - */ - CRAFTING_IN, - /** - * The crafting input, for containters that store it internally - */ - CRAFTING_IN_PERSISTENT, - /** - * The crafting output - */ - CRAFTING_OUT, - /** - * The armor slots - */ - ARMOR, - /** - * The furnace input - */ - FURNACE_IN, - /** - * The furnace output - */ - FURNACE_OUT, - /** - * The furnace fuel - */ - FURNACE_FUEL, - /** - * The enchantment table slot - */ - ENCHANTMENT, - /** - * The three bottles slots in brewing tables - * NOTE: Do not use without also using BREWING_INGREDIENT. - */ - BREWING_BOTTLES, - /** - * The top slot in brewing tables - * NOTE: Do not use without also using BREWING_BOTTLES. - */ - BREWING_INGREDIENT -} diff --git a/src/api/java/invtweaks/api/container/ContainerSectionCallback.java b/src/api/java/invtweaks/api/container/ContainerSectionCallback.java deleted file mode 100755 index 379206b37..000000000 --- a/src/api/java/invtweaks/api/container/ContainerSectionCallback.java +++ /dev/null @@ -1,16 +0,0 @@ -package invtweaks.api.container; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * A marker for a method to call which returns the set of ContainerSections for this container. - *

- * Signature of the method should be Map> func() - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface ContainerSectionCallback { -} diff --git a/src/api/java/invtweaks/api/container/IgnoreContainer.java b/src/api/java/invtweaks/api/container/IgnoreContainer.java deleted file mode 100755 index 86e8aea12..000000000 --- a/src/api/java/invtweaks/api/container/IgnoreContainer.java +++ /dev/null @@ -1,15 +0,0 @@ -package invtweaks.api.container; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Use this annotation to override inherited annotation properties and mark a Container as unsortable. - * This effect is inherited as well. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface IgnoreContainer { -} diff --git a/src/api/java/invtweaks/api/container/InventoryContainer.java b/src/api/java/invtweaks/api/container/InventoryContainer.java deleted file mode 100755 index d5a45b912..000000000 --- a/src/api/java/invtweaks/api/container/InventoryContainer.java +++ /dev/null @@ -1,20 +0,0 @@ -package invtweaks.api.container; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * A marker for containers that need special treatment, such as crafting inputs or alternate player inventory positions, - * but do not have a chest-like component. - *

- * Does not enable the Inventory Tweaks sorting buttons for this container. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface InventoryContainer { - // Set to true if the Inventory Tweaks options button should be shown for this container. - // (For instance, if you are replacing a vanilla container such as the player's inventory) - boolean showOptions() default true; -} diff --git a/src/api/java/li/cil/oc/api/API.java b/src/api/java/li/cil/oc/api/API.java deleted file mode 100755 index c5f8c08e4..000000000 --- a/src/api/java/li/cil/oc/api/API.java +++ /dev/null @@ -1,53 +0,0 @@ -package li.cil.oc.api; - -import com.typesafe.config.Config; -import li.cil.oc.api.detail.DriverAPI; -import li.cil.oc.api.detail.FileSystemAPI; -import li.cil.oc.api.detail.ItemAPI; -import li.cil.oc.api.detail.MachineAPI; -import li.cil.oc.api.detail.ManualAPI; -import li.cil.oc.api.detail.NanomachinesAPI; -import li.cil.oc.api.detail.NetworkAPI; - -/** - * Central reference for the API. - *

- * Don't use this class directly, prefer using the other classes in this - * package instead. This class is initialized by OpenComputers in the - * pre-init phase, so it should not be used before the init phase. - */ -public class API { - public static final String ID_OWNER = "OpenComputers|Core"; - public static final String VERSION = "6.0.0-alpha"; - - // ----------------------------------------------------------------------- // - - /** - * The loaded config. - */ - public static Config config = null; - - /** - * Whether OpenComputers uses power. - *

- * This is set in the init phase, so do not rely it before the post-init phase. - */ - public static boolean isPowerEnabled = false; - - // ----------------------------------------------------------------------- // - // Prefer using the static methods in the respective classes in this package - // over accessing these instances directly. - - public static DriverAPI driver = null; - public static FileSystemAPI fileSystem = null; - public static ItemAPI items = null; - public static MachineAPI machine = null; - public static ManualAPI manual = null; - public static NanomachinesAPI nanomachines = null; - public static NetworkAPI network = null; - - // ----------------------------------------------------------------------- // - - private API() { - } -} diff --git a/src/api/java/li/cil/oc/api/CreativeTab.java b/src/api/java/li/cil/oc/api/CreativeTab.java deleted file mode 100755 index 2454256fe..000000000 --- a/src/api/java/li/cil/oc/api/CreativeTab.java +++ /dev/null @@ -1,20 +0,0 @@ -package li.cil.oc.api; - -import net.minecraft.creativetab.CreativeTabs; - -/** - * Allows access to the creative tab used by OpenComputers. - */ -public final class CreativeTab { - /** - * The creative tab used by OpenComputers. - *

- * Changed to the actual tab if OC is present. Preferably you do - * not try to access this anyway when OpenComputers isn't - * present (don't ship the API in your mod), so don't rely on this! - */ - public static CreativeTabs instance = CreativeTabs.REDSTONE; - - private CreativeTab() { - } -} diff --git a/src/api/java/li/cil/oc/api/Driver.java b/src/api/java/li/cil/oc/api/Driver.java deleted file mode 100755 index a89570253..000000000 --- a/src/api/java/li/cil/oc/api/Driver.java +++ /dev/null @@ -1,282 +0,0 @@ -package li.cil.oc.api; - -import li.cil.oc.api.driver.Block; -import li.cil.oc.api.driver.Converter; -import li.cil.oc.api.driver.EnvironmentProvider; -import li.cil.oc.api.driver.InventoryProvider; -import li.cil.oc.api.driver.Item; -import li.cil.oc.api.driver.SidedBlock; -import li.cil.oc.api.network.EnvironmentHost; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -import java.util.Collection; - -/** - * This API allows registering new drivers with the mod. - *

- * Drivers are used to make items and third-party blocks available in the mod's - * component network, and optionally to user programs. If you implement a new - * block that should interact with the mod's component network it is enough to - * have it implement {@link li.cil.oc.api.network.Environment} - no driver is - * needed in that case. - *

- * Note that these methods should not be called in the pre-init phase, - * since the {@link li.cil.oc.api.API#driver} may not have been initialized - * at that time. Only start calling these methods in the init phase or later. - * - * @see Network - * @see SidedBlock - * @see Item - */ -public final class Driver { - /** - * Registers a new block driver. - *

- * Whenever the neighboring blocks of an Adapter block change, it checks if - * there exists a driver for the changed block, and if it is configured to - * interface that block type connects it to the component network. - *

- * This must be called in the init phase, not the pre- or post-init - * phases. - * - * @param driver the driver to register. - * @deprecated Use {@link SidedBlock} instead. - */ - @Deprecated // TODO Remove in OC 1.7 - public static void add(final Block driver) { - if (API.driver != null) - API.driver.add(driver); - } - - /** - * Registers a new side-aware block driver. - *

- * Whenever the neighboring blocks of an Adapter block change, it checks if - * there exists a driver for the changed block, and if it is configured to - * interface that block type connects it to the component network. - *

- * This must be called in the init phase, not the pre- or post-init - * phases. - * - * @param driver the driver to register. - */ - public static void add(final SidedBlock driver) { - if (API.driver != null) - API.driver.add(driver); - } - - /** - * Registers a new item driver. - *

- * Item components can inserted into a computers component slots. They have - * to specify their type, to determine into which slots they can fit. - *

- * This must be called in the init phase, not the pre- or post-init - * phases. - * - * @param driver the driver to register. - */ - public static void add(final Item driver) { - if (API.driver != null) - API.driver.add(driver); - } - - /** - * Registers a new type converter. - *

- * Type converters are used to automatically convert values returned from - * callbacks to a "simple" format that can be pushed to any architecture. - *

- * This must be called in the init phase, not the pre- or post-init - * phases. - * - * @param converter the converter to register. - */ - public static void add(final Converter converter) { - if (API.driver != null) - API.driver.add(converter); - } - - /** - * Register a new environment provider. - *

- * Environment providers are used for mapping item stacks to the type of - * environment that will be created by the stack, either by it being - * placed in the world and acting as a block component, or by being - * placed in an component inventory and created by the item's driver. - * - * @param provider the provider to register. - */ - public static void add(final EnvironmentProvider provider) { - if (API.driver != null) - API.driver.add(provider); - } - - /** - * Register a new inventory provider. - *

- * Inventory providers are used for accessing item inventories using - * the inventory controller upgrade, for example. - * - * @param provider the provider to register. - */ - public static void add(final InventoryProvider provider) { - if (API.driver != null) - API.driver.add(provider); - } - - /** - * Looks up a driver for the block at the specified position in the - * specified world. - *

- * Note that several drivers for a single block can exist. Because of this - * block drivers are always encapsulated in a 'compound' driver, which is - * what will be returned here. In other words, you should will not - * get actual instances of drivers registered via {@link #add(li.cil.oc.api.driver.Block)}. - * - * @param world the world containing the block. - * @param pos the position of the block. - * @return a driver for the block, or null if there is none. - * @deprecated Use {@link #driverFor(World, BlockPos, EnumFacing)}, - * passing null if the side is to be ignored. - */ - @Deprecated // TODO Remove in OC 1.7 - public static Block driverFor(World world, BlockPos pos) { - if (API.driver != null) - return API.driver.driverFor(world, pos); - return null; - } - - /** - * Looks up a driver for the block at the specified position in the - * specified world. - *

- * Note that several drivers for a single block can exist. Because of this - * block drivers are always encapsulated in a 'compound' driver, which is - * what will be returned here. In other words, you should will not - * get actual instances of drivers registered via {@link #add(li.cil.oc.api.driver.Block)}. - * - * @param world the world containing the block. - * @param pos the position of the block. - * @return a driver for the block, or null if there is none. - */ - public static SidedBlock driverFor(World world, BlockPos pos, EnumFacing side) { - if (API.driver != null) - return API.driver.driverFor(world, pos, side); - return null; - } - - /** - * Looks up a driver for the specified item stack. - *

- * Note that unlike for blocks, there can always only be one item driver - * per item. If there are multiple ones, the first one that was registered - * will be used. - * - * @param stack the item stack to get a driver for. - * @param host the type that will host the environment created by returned driver. - * @return a driver for the item, or null if there is none. - */ - public static Item driverFor(ItemStack stack, Class host) { - if (API.driver != null) - return API.driver.driverFor(stack, host); - return null; - } - - /** - * Looks up a driver for the specified item stack. - *

- * Note that unlike for blocks, there can always only be one item driver - * per item. If there are multiple ones, the first one that was registered - * will be used. - *

- * This is a context-agnostic variant used mostly for "house-keeping" - * stuff, such as querying slot types and tier. - * - * @param stack the item stack to get a driver for. - * @return a driver for the item, or null if there is none. - */ - public static Item driverFor(ItemStack stack) { - if (API.driver != null) - return API.driver.driverFor(stack); - return null; - } - - /** - * Looks up the environment associated with the specified item stack. - *

- * This will use the registered {@link EnvironmentProvider}s to find - * an environment type for the specified item stack. If none can be - * found, returns null. - * - * @param stack the item stack to get the environment type for. - * @return the type of environment associated with the stack, or null. - */ - public static Class environmentFor(ItemStack stack) { - if (API.driver != null) - return API.driver.environmentFor(stack); - return null; - } - - /** - * Get an inventory implementation providing access to an item inventory. - *

- * This will use the registered {@link InventoryProvider}s to find an - * inventory implementation providing access to the specified stack. - * If none can be found, returns null. - *

- * Note that the specified player may be null, but will usually - * be the fake player of the agent making use of this API. - * - * @param stack the item stack to get the inventory access for. - * @param player the player holding the item. May be null. - * @return the inventory implementation interfacing the stack, or null. - */ - public static IInventory inventoryFor(ItemStack stack, EntityPlayer player) { - if (API.driver != null) - return API.driver.inventoryFor(stack, player); - return null; - } - - /** - * Get a list of all registered block drivers. - *

- * This is intended to allow checking for particular drivers using more - * customized logic. - *

- * The returned collection is read-only. - * - * @return the list of all registered block drivers. - */ - public static Collection blockDrivers() { - if (API.driver != null) - return API.driver.blockDrivers(); - return null; - } - - /** - * Get a list of all registered item drivers. - *

- * This is intended to allow checking for particular drivers using more - * customized logic. - *

- * The returned collection is read-only. - * - * @return the list of all registered item drivers. - */ - public static Collection itemDrivers() { - if (API.driver != null) - return API.driver.itemDrivers(); - return null; - } - - // ----------------------------------------------------------------------- // - - private Driver() { - } -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/FileSystem.java b/src/api/java/li/cil/oc/api/FileSystem.java deleted file mode 100755 index 49557d0cf..000000000 --- a/src/api/java/li/cil/oc/api/FileSystem.java +++ /dev/null @@ -1,279 +0,0 @@ -package li.cil.oc.api; - -import li.cil.oc.api.network.EnvironmentHost; -import li.cil.oc.api.fs.Label; -import li.cil.oc.api.network.ManagedEnvironment; - -/** - * This class provides factory methods for creating file systems that are - * compatible with the built-in file system driver. - *

- * File systems created this way and wrapped in a managed environment via - * {@link #asManagedEnvironment} or its overloads will appear as - * filesystem components in the component network. Note that the - * component's visibility is set to Neighbors per default. If you wish - * to change the file system's visibility (e.g. like the disk drive does) you - * must cast the environment's node to {@link li.cil.oc.api.network.Component} - * and set the visibility to the desired value. - *

- * Note that these methods should not be called in the pre-init phase, - * since the {@link li.cil.oc.api.API#fileSystem} may not have been initialized - * at that time. Only start calling these methods in the init phase or later. - */ -public final class FileSystem { - /** - * Creates a new file system based on the location of a class. - *

- * This can be used to wrap a folder in the assets folder of your mod's JAR. - * The actual path is built like this: - *

"/assets/" + domain + "/" + root
- *

- * If the class is located in a JAR file, this will create a read-only file - * system based on that JAR file. If the class file is located in the native - * file system, this will create a read-only file system first trying from - * the actual location of the class file, and failing that by searching the - * class path (i.e. it'll look for a path constructed as described above). - *

- * If the specified path cannot be located, the creation fails and this - * returns null. - * - * @param clazz the class whose containing JAR to wrap. - * @param domain the domain, usually your mod's ID. - * @param root an optional subdirectory. - * @return a file system wrapping the specified folder. - */ - public static li.cil.oc.api.fs.FileSystem fromClass(final Class clazz, final String domain, final String root) { - if (API.fileSystem != null) - return API.fileSystem.fromClass(clazz, domain, root); - return null; - } - - /** - * Creates a new writable file system in the save folder. - *

- * This will create a folder, if necessary, and create a writable virtual - * file system based in that folder. The actual path is based in a sub- - * folder of the save folder. The actual path is built like this: - *

"saves/" + WORLD_NAME + "/opencomputers/" + root
- * The first part may differ, in particular for servers. - *

- * Usually the name will be the address of the node used to represent the - * file system. - *

- * Note that by default file systems are "buffered", meaning that any - * changes made to them are only saved to disk when the world is saved. This - * ensured that the file system contents do not go "out of sync" when the - * game crashes, but introduces additional memory overhead, since all files - * in the file system have to be kept in memory. - * - * @param root the name of the file system. - * @param capacity the amount of space in bytes to allow being used. - * @param buffered whether data should only be written to disk when saving. - * @return a file system wrapping the specified folder. - */ - public static li.cil.oc.api.fs.FileSystem fromSaveDirectory(final String root, final long capacity, final boolean buffered) { - if (API.fileSystem != null) - return API.fileSystem.fromSaveDirectory(root, capacity, buffered); - return null; - } - - /** - * Same as {@link #fromSaveDirectory(String, long, boolean)} with the - * buffered parameter being true, i.e. will always create a - * buffered file system. - * - * @param root the name of the file system. - * @param capacity the amount of space in bytes to allow being used. - * @return a file system wrapping the specified folder. - */ - public static li.cil.oc.api.fs.FileSystem fromSaveDirectory(final String root, final long capacity) { - return fromSaveDirectory(root, capacity, true); - } - - /** - * Creates a new writable file system that resides in memory. - *

- * Any contents created and written on this file system will be lost when - * the node is removed from the network. - *

- * This is used for computers' /tmp mount, for example. - * - * @param capacity the capacity of the file system. - * @return a file system residing in memory. - */ - public static li.cil.oc.api.fs.FileSystem fromMemory(final long capacity) { - if (API.fileSystem != null) - return API.fileSystem.fromMemory(capacity); - return null; - } - - /** - * Wrap a file system retrieved via one of the from??? methods to - * make it read-only. - * - * @param fileSystem the file system to wrap. - * @return the specified file system wrapped to be read-only. - */ - public static li.cil.oc.api.fs.FileSystem asReadOnly(final li.cil.oc.api.fs.FileSystem fileSystem) { - if (API.fileSystem != null) - return API.fileSystem.asReadOnly(fileSystem); - return null; - } - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * This can be useful for providing some data if you don't wish to implement - * your own driver. Which will probably be most of the time. If you need - * more control over the node, implement your own, and connect this one to - * it. In that case you will have to forward any disk driver messages to the - * node, though. - *

- * The container parameter is used to give the file system some physical - * relation to the world, for example this is used by hard drives to send - * the disk event notifications to the client that are used to play disk - * access sounds. - *

- * The container may be null, if no such context can be provided. - *

- * The access sound is the name of the sound effect to play when the file - * system is accessed, for example by listing a directory or reading from - * a file. It may be null to create a silent file system. - *

- * The speed multiplier controls how fast read and write operations on the - * file system are. It must be a value in [1,6], and controls the access - * speed, with the default being one. - * For reference, floppies are using the default, hard drives scale with - * their tiers, i.e. a tier one hard drive uses speed two, tier three uses - * speed four. - * - * @param fileSystem the file system to wrap. - * @param label the label of the file system. - * @param host the tile entity containing the file system. - * @param accessSound the name of the sound effect to play when the file - * system is accessed. This has to be the fully - * qualified resource name, e.g. - * opencomputers:floppy_access. - * @param speed the speed multiplier for this file system. - * @return the network node wrapping the file system. - */ - public static ManagedEnvironment asManagedEnvironment(final li.cil.oc.api.fs.FileSystem fileSystem, final Label label, final EnvironmentHost host, final String accessSound, int speed) { - if (API.fileSystem != null) - return API.fileSystem.asManagedEnvironment(fileSystem, label, host, accessSound, speed); - return null; - } - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * Creates a file system with the a read-only label and the specified - * access sound and file system speed. - * - * @param fileSystem the file system to wrap. - * @param label the label of the file system. - * @param host the tile entity containing the file system. - * @param accessSound the name of the sound effect to play when the file - * system is accessed. This has to be the fully - * qualified resource name, e.g. - * opencomputers:floppy_access. - * @param speed the speed multiplier for this file system. - * @return the network node wrapping the file system. - */ - public static ManagedEnvironment asManagedEnvironment(final li.cil.oc.api.fs.FileSystem fileSystem, final String label, final EnvironmentHost host, final String accessSound, int speed) { - if (API.fileSystem != null) - return API.fileSystem.asManagedEnvironment(fileSystem, label, host, accessSound, speed); - return null; - } - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * Creates a file system with the specified label and the specified access - * sound, using the default file system speed. - * - * @param fileSystem the file system to wrap. - * @param label the label of the file system. - * @param host the tile entity containing the file system. - * @param accessSound the name of the sound effect to play when the file - * system is accessed. This has to be the fully - * qualified resource name, e.g. - * opencomputers:floppy_access. - * @return the network node wrapping the file system. - */ - public static ManagedEnvironment asManagedEnvironment(final li.cil.oc.api.fs.FileSystem fileSystem, final Label label, final EnvironmentHost host, final String accessSound) { - return asManagedEnvironment(fileSystem, label, host, accessSound, 1); - } - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * Creates a file system with a read-only label and the specified access - * sound, using the default file system speed. - * - * @param fileSystem the file system to wrap. - * @param label the read-only label of the file system. - * @param host the tile entity containing the file system. - * @param accessSound the name of the sound effect to play when the file - * system is accessed. This has to be the fully - * qualified resource name, e.g. - * opencomputers:floppy_access. - * @return the network node wrapping the file system. - */ - public static ManagedEnvironment asManagedEnvironment(final li.cil.oc.api.fs.FileSystem fileSystem, final String label, final EnvironmentHost host, final String accessSound) { - return asManagedEnvironment(fileSystem, label, host, accessSound, 1); - } - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * Creates a file system with the specified label, without an environment - * and access sound, using the default file system speed. - * - * @param fileSystem the file system to wrap. - * @param label the label of the file system. - * @return the network node wrapping the file system. - */ - public static ManagedEnvironment asManagedEnvironment(final li.cil.oc.api.fs.FileSystem fileSystem, final Label label) { - return asManagedEnvironment(fileSystem, label, null, null, 1); - } - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * Creates a file system with a read-only label, without an environment and - * access sound, using the default file system speed. - * - * @param fileSystem the file system to wrap. - * @param label the read-only label of the file system. - * @return the network node wrapping the file system. - */ - public static ManagedEnvironment asManagedEnvironment(final li.cil.oc.api.fs.FileSystem fileSystem, final String label) { - return asManagedEnvironment(fileSystem, label, null, null, 1); - } - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * Creates an unlabeled file system (i.e. the label can neither be read nor - * written), without an environment and access sound, using the default - * file system speed. - * - * @param fileSystem the file system to wrap. - * @return the network node wrapping the file system. - */ - public static ManagedEnvironment asManagedEnvironment(final li.cil.oc.api.fs.FileSystem fileSystem) { - return asManagedEnvironment(fileSystem, (Label) null, null, null, 1); - } - - // ----------------------------------------------------------------------- // - - private FileSystem() { - } -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/IMC.java b/src/api/java/li/cil/oc/api/IMC.java deleted file mode 100755 index e1632093b..000000000 --- a/src/api/java/li/cil/oc/api/IMC.java +++ /dev/null @@ -1,362 +0,0 @@ -package li.cil.oc.api; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.fml.common.event.FMLInterModComms; -import org.apache.commons.lang3.tuple.Pair; - -/** - * This is a pure utility class to more comfortably register things that can - * only be registered using IMC. - *

- * Use this if you have some kind of abstraction layer in place anyway, and can - * safely use the API without class not found exceptions and such, and don't - * want to put together the IMC messages manually. - *

- * This also servers to document of all IMC messages OpenComputers handles. - *

- * Feel free to copy these functions into your own code, just please don't - * copy this class while keeping the package name, to avoid conflicts if this - * class gets updated. - */ -public final class IMC { - /** - * Register a callback that is used as a filter for assembler templates. - * Any templates that require a base item that is rejected by any - * registered filter will be disabled. For example, if a filter rejects the - * computer case item stacks, robots can not be assembled. - *

- * Signature of callbacks must be: - *

-     * boolean callback(ItemStack stack)
-     * 
- *

- * Callbacks must be declared as packagePath.className.methodName. - * For example: com.example.Integration.callbackMethod. - * - * @param callback the callback to register as a filtering method. - */ - public static void registerAssemblerFilter(String callback) { - FMLInterModComms.sendMessage(MOD_ID, "registerAssemblerFilter", callback); - } - - /** - * Register a new template for the assembler. - *

- * Signature of callbacks must be: - *

-     * boolean select(ItemStack stack)
-     * Object[] validate(IInventory inventory)
-     * Object[] assemble(IInventory inventory)
-     * 
- * Values in the array returned by validate must be one of the following: - *
-     * // Valid or not.
-     * new Object[]{Boolean}
-     * // Valid or not, text for progess bar.
-     * new Object[]{Boolean, IChatComponent}
-     * // Valid or not, text for progess bar, warnings for start button tooltip (one per line).
-     * new Object[]{Boolean, IChatComponent, IChatComponent[]}
-     * 
- * Values in the array returned by assemble must be one of the following: - *
-     * // The assembled device.
-     * new Object[]{ItemStack}
-     * // The assembled device and energy cost (which also determines assembly duration).
-     * new Object[]{ItemStack, Number}
-     * 
- *

- * Callbacks must be declared as packagePath.className.methodName. - * For example: com.example.Integration.callbackMethod. - * - * @param name the name of the device created using the - * template. Optional, only used in logging. - * @param select callback used to determine if the template - * applies to a base item. For example, the robot - * template returns true from this if the passed - * item stack is a computer case. - * @param validate callback used to determine if the template - * configuration is valid. Once a template is - * valid assembly can be started, but not before. - * @param assemble callback used to apply a template and create a - * device from it. - * @param host the class of the device being assembled, i.e. - * the host class for the components being - * installed in the device. Used for filtering - * eligible components. See {@link #blacklistHost}. - * @param containerTiers the tiers of the container slots provided by the - * template. The length determines the number of - * containers. Maximum number is three. - * @param upgradeTiers the tiers of the upgrade slots provided by the - * template. The length determines the number of - * upgrades. Maximum number is nine. - * @param componentSlots the types and tiers of component slots provided by - * this template. May contain null entries - * to skip slots (slots are ordered top-to-bottom, - * left-to-right). For example, a robot template - * with only two card slots will pass null - * for the third component slot. Up to nine. - */ - public static void registerAssemblerTemplate(String name, String select, String validate, String assemble, Class host, int[] containerTiers, int[] upgradeTiers, Iterable> componentSlots) { - final NBTTagCompound nbt = new NBTTagCompound(); - if (name != null) { - nbt.setString("name", name); - } - nbt.setString("select", select); - nbt.setString("validate", validate); - nbt.setString("assemble", assemble); - if (host != null) { - nbt.setString("hostClass", host.getName()); - } - - final NBTTagList containersNbt = new NBTTagList(); - if (containerTiers != null) { - for (int tier : containerTiers) { - final NBTTagCompound slotNbt = new NBTTagCompound(); - slotNbt.setInteger("tier", tier); - containersNbt.appendTag(slotNbt); - } - } - if (containersNbt.tagCount() > 0) { - nbt.setTag("containerSlots", containersNbt); - } - - final NBTTagList upgradesNbt = new NBTTagList(); - if (upgradeTiers != null) { - for (int tier : upgradeTiers) { - final NBTTagCompound slotNbt = new NBTTagCompound(); - slotNbt.setInteger("tier", tier); - upgradesNbt.appendTag(slotNbt); - } - } - if (upgradesNbt.tagCount() > 0) { - nbt.setTag("upgradeSlots", upgradesNbt); - } - - final NBTTagList componentsNbt = new NBTTagList(); - if (componentSlots != null) { - for (Pair slot : componentSlots) { - if (slot == null) { - componentsNbt.appendTag(new NBTTagCompound()); - } else { - final NBTTagCompound slotNbt = new NBTTagCompound(); - slotNbt.setString("type", slot.getLeft()); - slotNbt.setInteger("tier", slot.getRight()); - componentsNbt.appendTag(slotNbt); - } - } - } - if (componentsNbt.tagCount() > 0) { - nbt.setTag("componentSlots", componentsNbt); - } - - FMLInterModComms.sendMessage(MOD_ID, "registerAssemblerTemplate", nbt); - } - - /** - * Register a new template for the disassembler. - *

- * The disassemble callback gets passed the item stack to - * disassemble, and a list of inferred ingredients (based on crafting - * recipes). This is useful for not having to compute those yourself when - * you just want to add a number of items from an internal inventory to - * the output (e.g. for servers it's the components in the server). - *

- * Signature of callbacks must be: - *

-     * boolean select(ItemStack stack)
-     * ItemStack[] disassemble(ItemStack stack, ItemStack[] ingredients)
-     * 
- *

- * Callbacks must be declared as packagePath.className.methodName. - * For example: com.example.Integration.callbackMethod. - * - * @param name the name of the handler (e.g. name of the item - * being handled). Optional, only used in logging. - * @param select callback used to determine if the template - * applies to an item. - * @param disassemble callback used to apply a template and extract - * ingredients from an item. - */ - public static void registerDisassemblerTemplate(String name, String select, String disassemble) { - final NBTTagCompound nbt = new NBTTagCompound(); - if (name != null) { - nbt.setString("name", name); - } - nbt.setString("select", select); - nbt.setString("disassemble", disassemble); - - FMLInterModComms.sendMessage(MOD_ID, "registerDisassemblerTemplate", nbt); - } - - /** - * Register a callback for providing tool durability information. - *

- * If your provider does not handle a tool/item, return Double.NaN - * to indicate that another provider should be queried. The first value - * that isn't NaN will be used as the durability. - *

- * The returned value must be the relative durability of the tool, - * in a range of [0,1], with 0 being broken, 1 being new/fully repaired. - *

- * Signature of callbacks must be: - *

-     * double callback(ItemStack stack)
-     * 
- *

- * Callbacks must be declared as packagePath.className.methodName. - * For example: com.example.Integration.callbackMethod. - * - * @param callback the callback to register as a durability provider. - */ - public static void registerToolDurabilityProvider(String callback) { - FMLInterModComms.sendMessage(MOD_ID, "registerToolDurabilityProvider", callback); - } - - /** - * Register a callback handling a wrench tool. - *

- * These are used when determining whether an item is a wrench tool, when - * interacting with certain blocks while the player is holding such an item, - * for example to avoid rotating blocks when opening their GUI. - *

- * The returned value must be true if the wrench was used/usable, - * false otherwise. - *

- * Signature of callbacks must be: - *

-     * boolean callback(EntityPlayer player, BlockPos pos, boolean changeDurability)
-     * 
- *

- * Callbacks must be declared as packagePath.className.methodName. - * For example: com.example.Integration.callbackMethod. - * - * @param callback the callback to register as a wrench tool handler. - */ - public static void registerWrenchTool(String callback) { - FMLInterModComms.sendMessage(MOD_ID, "registerWrenchTool", callback); - } - - /** - * Register a callback for checking if an item is a wrench. - *

- * This is used to determine whether certain item stacks are wrench items, - * which is used, for example, when "itemizing" a drone. - *

- * The returned value must true if the item stack is a wrench, - * false otherwise. - *

- * Signature of callbacks must be: - *

-     * boolean callback(ItemStack stack)
-     * 
- *

- * Callbacks must be declared as packagePath.className.methodName. - * For example: com.example.Integration.callbackMethod. - * - * @param callback the callback to register as a wrench tool tester. - */ - public static void registerWrenchToolCheck(String callback) { - FMLInterModComms.sendMessage(MOD_ID, "registerWrenchToolCheck", callback); - } - - /** - * Register a handler for items that can be charged. - *

- * This is used by the charger to determine whether items can be charged - * by it (canCharge) and to actually charge them (charge). - *

- * Note that OpenComputers comes with a few built-in handlers for third- - * party charged items, such as Redstone Flux and IndustrialCraft 2. - *

- * Signature of callbacks must be: - *

-     * boolean canCharge(ItemStack stack)
-     * double charge(ItemStack stack, double amount, boolean simulate)
-     * 
- *

- * Callbacks must be declared as packagePath.className.methodName. - * For example: com.example.Integration.callbackMethod. - * - * @param name the name of the energy system/item type handled. - * @param canCharge the callback to register for checking chargeability. - * @param charge the callback to register for charging items. - */ - public static void registerItemCharge(String name, String canCharge, String charge) { - final NBTTagCompound nbt = new NBTTagCompound(); - nbt.setString("name", name); - nbt.setString("canCharge", canCharge); - nbt.setString("charge", charge); - FMLInterModComms.sendMessage(MOD_ID, "registerItemCharge", nbt); - } - - /** - * Register a provider for ink usable in the 3D printer. - *

- * Default providers in OpenComputers are one for the ink cartridges as - * well as one for arbitrary dyes (via the OreDictionary). - *

- * Use this to make other items usable as ink in the 3D printer. Return a - * value larger than zero to indicate you handled the provided item stack, - * with the value being the amount of ink provided by the stack. - *

- * Signature of callbacks must be: - *

-     * int callback(ItemStack stack)
-     * 
- *

- * Callbacks must be declared as packagePath.className.methodName. - * For example: com.example.Integration.callbackMethod. - * - * @param callback the callback to register as an ink provider. - */ - public static void registerInkProvider(String callback) { - FMLInterModComms.sendMessage(MOD_ID, "registerInkProvider", callback); - } - - /** - * Blacklist a ComputerCraft peripheral from being wrapped by OpenComputers' - * built-in driver for ComputerCraft peripherals. - *

- * Use this if you provide a driver for something that is a peripheral and - * wish to avoid conflicts in the registered callbacks, for example. - * - * @param peripheral the class of the peripheral to blacklist. - */ - public static void blacklistPeripheral(Class peripheral) { - FMLInterModComms.sendMessage(MOD_ID, "blacklistPeripheral", peripheral.getName()); - } - - /** - * Blacklist an item for a specified host. - *

- * This can be used to prevent certain components to be installed in select - * devices, via the devices class. For example, this is used to prevent - * components that would not be functional in certain devices to be - * installed in those devices, such as graphics cards in micro-controllers. - *

- * The host class is the class of the environment the component would be - * installed in, e.g. {@link li.cil.oc.api.internal.Tablet}. - * - * @param name the name of the component being blacklisted. - * @param host the class of the host to blacklist the component for. - * @param stack the item stack representing the blacklisted component. - */ - public static void blacklistHost(String name, Class host, ItemStack stack) { - final NBTTagCompound nbt = new NBTTagCompound(); - nbt.setString("name", name); - nbt.setString("host", host.getName()); - final NBTTagCompound stackNbt = new NBTTagCompound(); - stack.writeToNBT(stackNbt); - nbt.setTag("item", stackNbt); - FMLInterModComms.sendMessage(MOD_ID, "blacklistHost", nbt); - } - - // ----------------------------------------------------------------------- // - - private static final String MOD_ID = "OpenComputers"; - - private IMC() { - } -} diff --git a/src/api/java/li/cil/oc/api/Items.java b/src/api/java/li/cil/oc/api/Items.java deleted file mode 100755 index 81a10bc2f..000000000 --- a/src/api/java/li/cil/oc/api/Items.java +++ /dev/null @@ -1,101 +0,0 @@ -package li.cil.oc.api; - -import li.cil.oc.api.detail.ItemInfo; -import net.minecraft.item.EnumDyeColor; -import net.minecraft.item.ItemStack; - -import java.util.concurrent.Callable; - -/** - * Access to item definitions for all blocks and items provided by - * OpenComputers. - */ -public final class Items { - /** - * Get a descriptor object for the block or item with the specified name. - *

- * The names are the same as the ones used in the recipe files. An info - * object can be used to retrieve both the block and item instance of the - * item, if available. It can also be used to create a new item stack of - * the item. - *

- * Note that these methods should not be called in the pre-init phase, - * since the {@link li.cil.oc.api.API#items} may not have been initialized - * at that time. Only start calling these methods in the init phase or later. - * - * @param name the name of the item to get the descriptor for. - * @return the descriptor for the item with the specified name, or - * null if there is no such item. - */ - public static ItemInfo get(String name) { - if (API.items != null) - return API.items.get(name); - return null; - } - - /** - * Get a descriptor object for the block or item represented by the - * specified item stack. - * - * @param stack the stack to get the descriptor for. - * @return the descriptor for the specified item stack, or null - * if the stack is not a valid OpenComputers item or block. - */ - public static ItemInfo get(ItemStack stack) { - if (API.items != null) - return API.items.get(stack); - return null; - } - - /** - * Register a single loot floppy disk. - *

- * The disk will be listed in the creative tab of OpenComputers. - *

- * The specified factory callable will be used to generate a new file - * system when the loot disk is used as a component. The specified name - * will be used as the label for the loot disk, as well as the identifier - * to select the corresponding factory method, so choose wisely. - *

- * To use some directory in your mod JAR as the directory provided by the - * loot disk, use {@link FileSystem#fromClass} in your callable. - * - * @param name the label and identifier to use for the loot disk. - * @param color the color of the disk, as a Minecraft color. - * @param factory the callable to call for creating file system instances. - * @return an item stack representing the registered loot disk, to allow - * adding a recipe for your loot disk, for example. - */ - public static ItemStack registerFloppy(String name, EnumDyeColor color, Callable factory) { - if (API.items != null) - return API.items.registerFloppy(name, color, factory); - return null; - } - - /** - * Register a single custom EEPROM. - *

- * The EEPROM will be listed in the creative tab of OpenComputers. - *

- * The EEPROM will be initialized with the specified code and data byte - * arrays. For script code (e.g. a Lua script) use String.getBytes("UTF-8"). - * You can omit any of the arguments by passing null. - * - * @param name the label of the EEPROM. - * @param code the code section of the EEPROM. - * @param data the data section of the EEPROM. - * @param readonly whether the code section is read-only. - * @return an item stack representing the registered EEPROM, to allow - * adding a recipe for your custom BIOS, for example. - */ - public static ItemStack registerEEPROM(String name, byte[] code, byte[] data, boolean readonly) { - if (API.items != null) - return API.items.registerEEPROM(name, code, data, readonly); - return null; - } - - // ----------------------------------------------------------------------- // - - private Items() { - } -} diff --git a/src/api/java/li/cil/oc/api/Machine.java b/src/api/java/li/cil/oc/api/Machine.java deleted file mode 100755 index ddb412d59..000000000 --- a/src/api/java/li/cil/oc/api/Machine.java +++ /dev/null @@ -1,85 +0,0 @@ -package li.cil.oc.api; - -import li.cil.oc.api.machine.Architecture; -import li.cil.oc.api.machine.MachineHost; - -import java.util.Collection; -import java.util.Collections; - -/** - * This API is intended for people who would like to implement custom computer - * blocks or anything else hosting a computer. - *

- * It also allows registering new {@link li.cil.oc.api.machine.Architecture}s, - * which are implementations of specific languages (e.g. assembler). The built- - * in ones are available as static fields in this class. - *

- * Note that registration of architectures is optional and only intended as a - * convenience feature to make architectures usable via the built-in CPUs. - *

- * Note that these methods should not be called in the pre-init phase, - * since the {@link li.cil.oc.api.API#machine} may not have been initialized - * at that time. Only start calling these methods in the init phase or later. - */ -public final class Machine { - /** - * Register an architecture that can be used to create new machines. - *

- * Registering an architecture will make it possible to configure CPUs to - * run that architecture. This allows providing architectures without - * implementing a custom CPU item. - * - * @param architecture the architecture to register. - */ - public static void add(Class architecture) { - if (API.machine != null) - API.machine.add(architecture); - } - - /** - * A list of all registered architectures. - */ - public static Collection> architectures() { - if (API.machine != null) - return API.machine.architectures(); - return Collections.emptyList(); - } - - /** - * Get the name of the specified architecture. - * - * @param architecture the architecture to get the name for. - * @return the name of the specified architecture. - */ - public static String getArchitectureName(Class architecture) { - if (API.machine != null) - return API.machine.getArchitectureName(architecture); - return null; - } - - /** - * Creates a new machine for the specified host. - *

- * You are responsible for calling update and save / load functions on the - * machine for it to work correctly. - * - * @param host the owner object of the machine, providing context. - * @return the newly created machine. - */ - public static li.cil.oc.api.machine.Machine create(MachineHost host) { - if (API.machine != null) - return API.machine.create(host); - return null; - } - - // ----------------------------------------------------------------------- // - - private Machine() { - } - - /** - * The built-in Lua architecture. This will be set to the native Lua - * implementation when possible, to the LuaJ fallback, otherwise. - */ - public static Class LuaArchitecture = null; -} diff --git a/src/api/java/li/cil/oc/api/Manual.java b/src/api/java/li/cil/oc/api/Manual.java deleted file mode 100755 index 5096202c7..000000000 --- a/src/api/java/li/cil/oc/api/Manual.java +++ /dev/null @@ -1,183 +0,0 @@ -package li.cil.oc.api; - -import li.cil.oc.api.manual.ContentProvider; -import li.cil.oc.api.manual.ImageProvider; -import li.cil.oc.api.manual.ImageRenderer; -import li.cil.oc.api.manual.PathProvider; -import li.cil.oc.api.manual.TabIconRenderer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -/** - * This API allows interfacing with the in-game manual of OpenComputers. - *

- * It allows opening the manual at a desired specific page, as well as - * registering custom tabs and content callback handlers. - *

- * Note: this is a client side only API. It will do nothing on - * dedicated servers (i.e. API.manual will be null). - */ -public class Manual { - /** - * Register a tab to be displayed next to the manual. - *

- * These are intended to link to index pages, and for the time being there - * a relatively low number of tabs that can be displayed, so I'd ask you to - * only register as many tabs as actually, technically *needed*. Which will - * usually be one, for your main index page. - * - * @param renderer the renderer used to render the icon on your tab. - * @param tooltip the unlocalized tooltip of the tab, or null. - * @param path the path to the page to open when the tab is clicked. - */ - public static void addTab(TabIconRenderer renderer, String tooltip, String path) { - if (API.manual != null) - API.manual.addTab(renderer, tooltip, path); - } - - /** - * Register a path provider. - *

- * Path providers are used to find documentation entries for item stacks - * and blocks in the world. - * - * @param provider the provider to register. - */ - public static void addProvider(PathProvider provider) { - if (API.manual != null) - API.manual.addProvider(provider); - } - - /** - * Register a content provider. - *

- * Content providers are used to resolve paths to page content, if the - * standard system (using Minecraft's resource loading facilities) fails. - *

- * This can be useful for providing dynamic content, for example. - * - * @param provider the provider to register. - */ - public static void addProvider(ContentProvider provider) { - if (API.manual != null) - API.manual.addProvider(provider); - } - - /** - * Register an image provider. - *

- * Image providers are used to render custom content in a page. These are - * selected via the standard image tag of Markdown, based on the prefix of - * the image URL, i.e. ![tooltip](prefix:data) will select the - * image provider registered for the prefix prefix, and pass to - * it the argument data, then use the returned renderer to draw - * an element in the place of the tag. The provided prefix is expected to - * be without the colon (:). - *

- * Custom providers are only selected if a prefix is matched, otherwise - * it'll treat it as a relative path to an image to load via Minecraft's - * resource providing facilities, and display that. - * - * @param prefix the prefix on which to use the provider. - * @param provider the provider to register. - */ - public static void addProvider(String prefix, ImageProvider provider) { - if (API.manual != null) - API.manual.addProvider(prefix, provider); - } - - /** - * Get the image renderer for the specified image path. - *

- * This will look for {@link ImageProvider}s registered for a prefix in the - * specified path. If there is no match, or the matched content provider - * does not provide a renderer, this will return null. - * - * @param path the path to the image to get the renderer for. - * @return the custom renderer for that path. - */ - public static ImageRenderer imageFor(String path) { - if (API.manual != null) - return API.manual.imageFor(path); - return null; - } - - // ----------------------------------------------------------------------- // - - /** - * Look up the documentation path for the specified item stack. - * - * @param stack the stack to find the documentation path for. - * @return the path to the page, null if none is known. - */ - public static String pathFor(ItemStack stack) { - if (API.manual != null) - return API.manual.pathFor(stack); - return null; - } - - /** - * Look up the documentation for the specified block in the world. - * - * @param world the world containing the block. - * @param pos the position of the block. - * @return the path to the page, null if none is known. - */ - public static String pathFor(World world, BlockPos pos) { - if (API.manual != null) - return API.manual.pathFor(world, pos); - return null; - } - - /** - * Get the content of the documentation page at the specified location. - * - * @param path the path of the page to get the content of. - * @return the content of the page, or null if none exists. - */ - public static Iterable contentFor(String path) { - if (API.manual != null) - return API.manual.contentFor(path); - return null; - } - - // ----------------------------------------------------------------------- // - - /** - * Open the manual for the specified player. - *

- * If you wish to display a specific page, call {@link #navigate(String)} - * after this function returns, with the path to the page to show. - * - * @param player the player to open the manual for. - */ - public static void openFor(EntityPlayer player) { - if (API.manual != null) - API.manual.openFor(player); - } - - /** - * Reset the history of the manual. - */ - public static void reset() { - if (API.manual != null) - API.manual.reset(); - } - - /** - * Navigate to a page in the manual. - * - * @param path the path to navigate to. - */ - public static void navigate(String path) { - if (API.manual != null) - API.manual.navigate(path); - } - - // ----------------------------------------------------------------------- // - - private Manual() { - } -} diff --git a/src/api/java/li/cil/oc/api/Nanomachines.java b/src/api/java/li/cil/oc/api/Nanomachines.java deleted file mode 100755 index afa239b8d..000000000 --- a/src/api/java/li/cil/oc/api/Nanomachines.java +++ /dev/null @@ -1,100 +0,0 @@ -package li.cil.oc.api; - -import li.cil.oc.api.nanomachines.BehaviorProvider; -import li.cil.oc.api.nanomachines.Controller; -import net.minecraft.entity.player.EntityPlayer; - -import java.util.Collections; - -/** - * This API allows interfacing with nanomachines. - *

- * It allows registering custom behavior providers as well as querying for all - * presently registered providers and getting a controller for a player. - */ -public class Nanomachines { - /** - * Register a new behavior provider. - *

- * When a controller is reconfigured it will draw behaviors from all - * registered providers and build a new random connection graph to - * those behaviors. - * - * @param provider the provider to add. - */ - public static void addProvider(BehaviorProvider provider) { - if (API.nanomachines != null) - API.nanomachines.addProvider(provider); - } - - /** - * Get a list of all currently registered providers. - * - * @return the list of all currently registered providers. - */ - public static Iterable getProviders() { - if (API.nanomachines != null) - return API.nanomachines.getProviders(); - return Collections.emptyList(); - } - - /** - * Check whether a player has a nanomachine controller installed. - * - * @param player the player to check for. - * @return true if the player has a controller, false otherwise. - */ - public static boolean hasController(EntityPlayer player) { - if (API.nanomachines != null) - return API.nanomachines.hasController(player); - return false; - } - - /** - * Get the nanomachine controller of the specified player. - *

- * If the player has a controller installed, this will initialize the - * controller if it has not already been loaded. If the player has no - * controller, this will return null. - * - * @param player the player to get the controller for. - * @return the controller for the specified player. - */ - public static Controller getController(EntityPlayer player) { - if (API.nanomachines != null) - return API.nanomachines.getController(player); - return null; - } - - /** - * Install a controller for the specified player if it doesn't already - * have one. - *

- * This will also initialize the controller if it has not already been - * initialized. - * - * @param player the player to install a nanomachine controller for. - */ - public static Controller installController(EntityPlayer player) { - if (API.nanomachines != null) - return API.nanomachines.installController(player); - return null; - } - - /** - * Uninstall a controller from the specified player if it has one. - *

- * This will disable all active behaviors before disposing the controller. - * - * @param player the player to uninstall a nanomachine controller from. - */ - public static void uninstallController(EntityPlayer player) { - if (API.nanomachines != null) - API.nanomachines.uninstallController(player); - } - - // ----------------------------------------------------------------------- // - - private Nanomachines() { - } -} diff --git a/src/api/java/li/cil/oc/api/Network.java b/src/api/java/li/cil/oc/api/Network.java deleted file mode 100755 index 5db80f8e5..000000000 --- a/src/api/java/li/cil/oc/api/Network.java +++ /dev/null @@ -1,246 +0,0 @@ -package li.cil.oc.api; - -import li.cil.oc.api.detail.Builder; -import li.cil.oc.api.network.Environment; -import li.cil.oc.api.network.Node; -import li.cil.oc.api.network.Packet; -import li.cil.oc.api.network.Visibility; -import li.cil.oc.api.network.WirelessEndpoint; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; - -/** - * This class provides factories for networks and nodes. - *

- * The first two functions provided provided by this API are to allow existing - * environments - implemented in a tile entity for example - to join an existing - * network or create new ones. The third one is used to create nodes that may - * then be connected to an existing network. It is not possible to create - * networks that do not belong to at least one tile entity or node. - *

- * It is important to understand that component networks only exist on the - * server side. It is impossible to create nodes, and therefore networks, on - * the client side. This is to enforce a clear distinction of where the actual - * logic lies - since user code only runs on the server. - *

- * Note that these methods should not be called in the pre-init phase, - * since the {@link li.cil.oc.api.API#network} may not have been initialized - * at that time. Only start calling these methods in the init phase or later. - */ -public final class Network { - /** - * Convenience overload for {@link #joinOrCreateNetwork(IBlockAccess, BlockPos)}. - *

- * If the tile entity implements {@link Environment} its one node will be - * connected to any existing adjacent tile entity nodes. If none exist a - * new network with the specified tile entity's node as its sole entry. - *

- * If the tile entity is a {@link li.cil.oc.api.network.SidedEnvironment} - * the same rules as for simple environments apply, except that the - * respective for each side is used when connecting, and each side's node - * is added to its own new network, if necessary. - * - * @param tileEntity the tile entity to initialize. - */ - public static void joinOrCreateNetwork(final TileEntity tileEntity) { - if (API.network != null) - API.network.joinOrCreateNetwork(tileEntity); - } - - /** - * Tries to add network node(s) at the specified coordinates to adjacent - * networks. - * - * @param world the world containing the location to connect. - * @param pos the position at which to update the network. - */ - public static void joinOrCreateNetwork(final IBlockAccess world, final BlockPos pos) { - if (API.network != null) - API.network.joinOrCreateNetwork(world, pos); - } - - /** - * Creates a new network with the specified node as its initial node. - *

- * This can be used to create networks that are not bound to any tile - * entity. For example, this is used to create the internal networks of - * robots. - * - * @param node the node to create the network for. - * @throws IllegalArgumentException if the node already is in a network. - */ - public static void joinNewNetwork(final Node node) { - if (API.network != null) - API.network.joinNewNetwork(node); - } - - // ----------------------------------------------------------------------- // - - /** - * Makes a wireless endpoint join the wireless network defined by the mod. - *

- * OpenComputers tracks endpoints to which to send wireless packets sent - * via the {@link #sendWirelessPacket(WirelessEndpoint, double, Packet)} - * method. The packets will only be sent to endpoints registered - * with the network. - *

- * Important: when your endpoint is removed from the world, - * you must ensure it is also removed from the network! - * - * @param endpoint the endpoint to register with the network. - */ - public static void joinWirelessNetwork(final WirelessEndpoint endpoint) { - if (API.network != null) - API.network.joinWirelessNetwork(endpoint); - } - - /** - * Updates a wireless endpoint in the wireless network. - *

- * This is more efficient than removing and then adding the node again, as - * it only performs the update if the position significantly changed since - * the last time the position was updated (more than 0.5 along any axis). - *

- * Calling this for an endpoint that was not added before does nothing. - * - * @param endpoint the endpoint for which to update the position. - */ - public static void updateWirelessNetwork(final WirelessEndpoint endpoint) { - if (API.network != null) - API.network.updateWirelessNetwork(endpoint); - } - - /** - * Removes a wireless endpoint from the wireless network. - *

- * This must be called when an endpoint becomes invalid, otherwise it will - * remain in the network! - *

- * Calling this for an endpoint that was not added before does nothing. - * - * @param endpoint the endpoint to remove from the wireless network. - */ - public static void leaveWirelessNetwork(final WirelessEndpoint endpoint) { - if (API.network != null) - API.network.leaveWirelessNetwork(endpoint); - } - - /** - * Removes a wireless endpoint from the wireless network of a specific dimension. - *

- * This may be useful if the dimension of an endpoint changed and you can only - * react to that change (e.g. a player changing dimensions). - *

- * Calling this for an endpoint that was not added before does nothing. - * - * @param endpoint the endpoint to remove from the wireless network. - * @param dimension the dimension with the wireless network to remove the endpoint from. - */ - public static void leaveWirelessNetwork(final WirelessEndpoint endpoint, final int dimension) { - if (API.network != null) - API.network.leaveWirelessNetwork(endpoint, dimension); - } - - /** - * Sends a packet via the wireless network. - *

- * This will look for all other registered wireless endpoints in range of - * the sender and submit the packets to them. Whether another end point is - * reached depends on the distance and potential obstacles between the - * sender and the receiver (harder blocks require a stronger signal to be - * penetrated). - * - * @param source the endpoint that is sending the message. - * @param strength the signal strength with which to send the packet. - * @param packet the packet to send. - */ - public static void sendWirelessPacket(final WirelessEndpoint source, final double strength, final Packet packet) { - if (API.network != null) - API.network.sendWirelessPacket(source, strength, packet); - } - - // ----------------------------------------------------------------------- // - - /** - * Factory function for creating new nodes. - *

- * Use this to create a node for your environment (e.g. tile entity). This - * will return a builder that can be used to further specialize the node, - * making it either a component node (for callbacks), a connector node - * (for power interaction) or both. - *

- * Example use: - *

-     * class YourThing extends TileEntity implements Environment {
-     *     private ComponentConnector node_ =
-     *         api.Network.newNode(this, Visibility.Network).
-     *             withComponent("your_thing").
-     *             withConnector(32).
-     *             create();
-     *
-     *     public Node node() { return node_; }
-     *
-     *     // ...
-     * }
-     * 
- *

- * Note that the reachability specified here is the general - * availability of the created node to other nodes in the network. Special - * rules apply to components, which have a visibility that is used - * to control how they can be reached from computers. For example, network - * cards have a reachability of Visibility.Network, to - * allow them to communicate with each other, but a visibility of - * Visibility.Neighbors to avoid other computers in the network - * to see the card (i.e. only the user programs running on the computer the - * card installed in can see interact with it). - * - * @param host the environment the node is created for. - * @param reachability the reachability of the node. - * @return a new node builder. - */ - public static Builder.NodeBuilder newNode(final Environment host, final Visibility reachability) { - if (API.network != null) - return API.network.newNode(host, reachability); - return null; - } - - /** - * Creates a new network packet as it would be sent or received by a - * network card. - *

- * These packets can be forwarded by switches and access points. For wired - * transmission they must be sent over a node's send method, with the - * message name being network.message. - * - * @param source the address of the sending node. - * @param destination the address of the destination, or null - * for a broadcast. - * @param port the port to send the packet to. - * @param data the payload of the packet. - * @return the new packet. - */ - public static Packet newPacket(final String source, final String destination, final int port, final Object[] data) { - if (API.network != null) - return API.network.newPacket(source, destination, port, data); - return null; - } - - /** - * Re-creates a network packet from a previously stored state. - * - * @param nbt the tag to load the packet from. - * @return the loaded packet. - */ - public static Packet newPacket(final NBTTagCompound nbt) { - if (API.network != null) - return API.network.newPacket(nbt); - return null; - } - - // ----------------------------------------------------------------------- // - - private Network() { - } -} diff --git a/src/api/java/li/cil/oc/api/Persistable.java b/src/api/java/li/cil/oc/api/Persistable.java deleted file mode 100755 index 8ad2b2a45..000000000 --- a/src/api/java/li/cil/oc/api/Persistable.java +++ /dev/null @@ -1,25 +0,0 @@ -package li.cil.oc.api; - -import net.minecraft.nbt.NBTTagCompound; - -/** - * An object that can be persisted to an NBT tag and restored back from it. - */ -public interface Persistable { - /** - * Restores a previous state of the object from the specified NBT tag. - * - * @param nbt the tag to read the state from. - */ - void load(NBTTagCompound nbt); - - /** - * Saves the current state of the object into the specified NBT tag. - *

- * This should write the state in such a way that it can be restored when - * {@link #load} is called with that tag. - * - * @param nbt the tag to save the state to. - */ - void save(NBTTagCompound nbt); -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/README.md b/src/api/java/li/cil/oc/api/README.md deleted file mode 100755 index f6a454afa..000000000 --- a/src/api/java/li/cil/oc/api/README.md +++ /dev/null @@ -1,85 +0,0 @@ -The API can be used to either interact with existing implementations in OpenComputers or to implement your own extensions for OpenComputers. - -Extending OpenComputers -======================== - -Making a tile entity available as a component / peripheral --------------------------------------------------- -If you simply wish to expose a couple of methods that can be called from a computer if your tile entity's block is 'connected' to the computer, you can use the `SimpleComponent` interface. This interface serves as a marker for OpenComputers to know it has to inject code that converts your tile entity into a component using its class transformer. It is an interface instead of an annotation to allow stripping it, removing any dependencies on OpenComputers. Here is an example implementation: -```java -@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers") -public class TileEntityMyFancyThing extends TileEntity - implements SimpleComponent -{ - @Override - public String getComponentName() { - return "fancy_thing"; - } - - @Callback - @Optional.Method(modid = "OpenComputers") - public Object[] greet(Context context, Arguments args) { - return new Object[]{String.format("Hello, %s!", args.checkString(0))}; - } -} -``` - -The `getComponentName` determines with which name the tile entity will be available to computers. The `Callback` annotation tells OpenComputers to make the annotated method available to the computer. See the documentation on the `Callback` annotation for more information, in particular how it can be used to manipulate the call behavior (synchronized to the main thread vs. in the thread driving the calling computer). - -So to call the greeter method, in Lua you'd do this: -```lua -print(component.fancy_thing.greet("Steve")) -- prints "Hello, Steve!" -```` - -More control ------------- -If you really need more control over how how your tile entity interacts with OpenComputer's internal network, you will have to implement the `Environment` interface on your tile entity. There's a basic implementation in the prefab package, named `TileEntityEnvironment`. Doing so will give you access to the `Node` that connects to the component network, and you must take care of the construction of the node itself (using the factory method in `api.Network`). This allows you to make the node a `Connector` node, which will allow you to draw internal power from OpenComputers or feed energy into it. You will also be able to send messages over the component network, see the `send...` methods in the `Node` interface. See the documentation on those interfaces to get a better idea on how they work together. - -Making a third-party block available as component / peripheral --------------------------------------------------------------- -Blocks from other mods, i.e. blocks where you have no control over the tile entity implementation, can be accessed using the Adapter block as long as there is a driver available that supports the block. If there are multiple drivers they are automatically merged. Please see the [integration][] package for examples, and consider contributing any block drivers you write. Thank you! - -Making items available as components ------------------------------------- -To make items usable as components in computers, such as cards or hard drives, you have to provide a driver for that item. This means you have to implement the `driver.Item` interface on a class and register an instance of it via the `api.Driver` registry. You can base your item drivers on the `DriverItem` prefab. Please see the example project on Github for a working example, and read the documentation of the driver interface for more information. - -FileSystem API -============== -If you'd like to make some files/scripts you ship with your mod available to a computer, you can do so by wrapping those files using an OpenComputers file system. Use the factory methods in `api.FileSystem` to wrap the location your files are stored at in a file system, use the `asManagedEnvironment` methods to wrap it in a node that can be attached to the component network. For example, in an environment of a tile entity or created by an item driver you could do this in the `onConnect` method whenever a computer is connected (i.e. `node.host() instanceof Context`). Code-wise it may look something like this: -```java -public class TileEntityWithFileSystem extends TileEntityEnvironment { - private final Node fileSystem; - - public TileEntityWithFileSystem() { - node = Network.newNode(this, Visibility.Network).create(); - fileSystem = FileSystem.asManagedEnvironment(FileSystem.fromClass(getClass, "yourmodid/lua"), "my_files"); - } - - @Override - public void onConnect(final Node node) { - if (node.host() instanceof Context) { - // Attach our file system to new computers we get connected to. - // Note that this is also called for all already present computers - // when we're added to an already existing network, so we don't - // have to loop through the existing nodes manually. - node.connect(fileSystem); - } - } - - @Override - public void onDisconnect(final Node node) { - if (node.host() instanceof Context) { - // Remove our file systems when we get disconnected from a - // computer. - node.disconnect(fileSystem); - } else if (node == this.node) { - // Remove the file system if we are disconnected, because in that - // case this method is only called once. - fileSystem.node.remove(); - } - } -} -``` - - -[integration]: https://github.com/MightyPirates/OpenComputers/tree/master-MC1.7.10/src/main/scala/li/cil/oc/integration \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/component/Keyboard.java b/src/api/java/li/cil/oc/api/component/Keyboard.java deleted file mode 100755 index d679c03d5..000000000 --- a/src/api/java/li/cil/oc/api/component/Keyboard.java +++ /dev/null @@ -1,17 +0,0 @@ -package li.cil.oc.api.component; - -/** - * Not meant to be implemented. - * - * @deprecated Use li.cil.oc.api.internal.Keyboard instead. - */ -@Deprecated -public interface Keyboard extends li.cil.oc.api.internal.Keyboard { - /** - * Not meant to be implemented. - * - * @deprecated Use li.cil.oc.api.internal.Keyboard.UsabilityChecker instead. - */ - interface UsabilityChecker extends li.cil.oc.api.internal.Keyboard.UsabilityChecker { - } -} diff --git a/src/api/java/li/cil/oc/api/component/RackBusConnectable.java b/src/api/java/li/cil/oc/api/component/RackBusConnectable.java deleted file mode 100755 index 352c9ee3d..000000000 --- a/src/api/java/li/cil/oc/api/component/RackBusConnectable.java +++ /dev/null @@ -1,25 +0,0 @@ -package li.cil.oc.api.component; - -import li.cil.oc.api.network.Environment; -import li.cil.oc.api.network.Packet; - -/** - * Use this interface on environments that may receive network messages from a - * bus in a rack. - *

- * Specifically, this is checked on environments in servers installed in racks. - * The server will collect the first three environments of components in it - * implement this interface, and provide their nodes to the rack via the - * {@link RackMountable#getConnectableAt(int)} method. This in turn will allow them - * to be 'connected' to the buses, so that they can receive network messages - * arriving on the respective side of the rack. - */ -public interface RackBusConnectable extends Environment { - /** - * Called to inject a network packet that arrived on the bus this - * environment is connected to in the hosting rack. - * - * @param packet the packet to handle. - */ - void receivePacket(Packet packet); -} diff --git a/src/api/java/li/cil/oc/api/component/RackMountable.java b/src/api/java/li/cil/oc/api/component/RackMountable.java deleted file mode 100755 index efe405744..000000000 --- a/src/api/java/li/cil/oc/api/component/RackMountable.java +++ /dev/null @@ -1,74 +0,0 @@ -package li.cil.oc.api.component; - -import li.cil.oc.api.network.Analyzable; -import li.cil.oc.api.network.ComponentHost; -import li.cil.oc.api.network.ManagedEnvironment; -import li.cil.oc.api.util.StateAware; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumHand; - -/** - * Use this interface on environments provided by drivers for items that can - * be installed in a server rack. - *

- * The provided environment can be used for updating the part in its installed - * state. The nodes provided by the getters in this interface are used to - * access nodes provided by the environment (e.g. multiple "interfacing" - * nodes for a switch), and connect the nodes to the corresponding buses as - * defined by the rack's configuration. - *

- * Note: mountables may implement the {@link ComponentHost} interface and - * {@link IInventory}. In this case, if they contain a redstone card and have - * a state of State.IsWorking the rack will visually connect to - * redstone, for example. Same goes for abstract bus cards, and potentially - * more things in the future. - *

- * Furthermore, implementing {@link Analyzable} will allow specifying more - * information when the analyzer is used on the mountable while it's in a rack. - */ -public interface RackMountable extends ManagedEnvironment, StateAware { - /** - * Returns some data describing the state of the mountable. - *

- * This is called on the server side to synchronize data to the client after - * the rack's {@link li.cil.oc.api.internal.Rack#markChanged(int)} - * method has been called for the slot this mountable is in. It will there - * be passed on with the render event to allow state specific rendering of - * the mountable in the rack. - * - * @return the data to synchronize to the clients. - */ - NBTTagCompound getData(); - - /** - * The number of connectables exposed by the environment. - *

- * Node that only the first three will ever be used. - */ - int getConnectableCount(); - - /** - * Returns the node at the specified index. - */ - RackBusConnectable getConnectableAt(int index); - - /** - * This gets called when the server rack is activated by a player, and - * hits the space occupied by this mountable. - *

- * As per usual, keep in mind that the hit coordinates are comparatively - * imprecise on the server side, since they'll have been sent in a - * pointlessly compressed fashion (because MC is a dummy like that). - * - * @param player the player activating the mountable. - * @param hand the hand the player used. - * @param heldItem the item held in that hand. - * @param hitX the relative x coordinate of the activation on the mountable. - * @param hitY the relative y coordinate of the activation on the mountable. - * @return whether the activation was handled (e.g. GUI opened). - */ - boolean onActivate(EntityPlayer player, EnumHand hand, ItemStack heldItem, float hitX, float hitY); -} diff --git a/src/api/java/li/cil/oc/api/component/TextBuffer.java b/src/api/java/li/cil/oc/api/component/TextBuffer.java deleted file mode 100755 index a997a00ba..000000000 --- a/src/api/java/li/cil/oc/api/component/TextBuffer.java +++ /dev/null @@ -1,16 +0,0 @@ -package li.cil.oc.api.component; - -import li.cil.oc.api.Persistable; -import li.cil.oc.api.network.ManagedEnvironment; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** - * Not meant to be implemented. - * - * @deprecated Use li.cil.oc.api.internal.TextBuffer instead. - */ -@Deprecated -public interface TextBuffer extends li.cil.oc.api.internal.TextBuffer { -} diff --git a/src/api/java/li/cil/oc/api/component/package-info.java b/src/api/java/li/cil/oc/api/component/package-info.java deleted file mode 100755 index 61c8d8958..000000000 --- a/src/api/java/li/cil/oc/api/component/package-info.java +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This package contains interfaces to be implemented on components. - *

- * This will allow OpenComputers to provide some more advanced integration - * with your components. - */ -@net.minecraftforge.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Component", - apiVersion = API.VERSION) -package li.cil.oc.api.component; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/detail/Builder.java b/src/api/java/li/cil/oc/api/detail/Builder.java deleted file mode 100755 index 10affbbac..000000000 --- a/src/api/java/li/cil/oc/api/detail/Builder.java +++ /dev/null @@ -1,150 +0,0 @@ -package li.cil.oc.api.detail; - -import li.cil.oc.api.network.Component; -import li.cil.oc.api.network.ComponentConnector; -import li.cil.oc.api.network.Connector; -import li.cil.oc.api.network.Node; -import li.cil.oc.api.network.Visibility; - -/** - * Used for building {@link Node}s via {@link li.cil.oc.api.Network#newNode}. - * - * @param the type of the node created by this builder. - */ -public interface Builder { - /** - * Finalizes the construction of the node. - *

- * This performs the actual creation of the node, initializes it to the - * settings defined by the current builder and returns it. - * - * @return the final node. - */ - T create(); - - /** - * Builder for basic nodes. These nodes merely allow network access and - * take on no special role. - */ - public static interface NodeBuilder extends Builder { - /** - * Makes the node a component. - *

- * Nodes that are components can be accessed from computers, methods - * declared in them marked using the {@link li.cil.oc.api.machine.Callback} annotation can - * be invoked from computers that can see the component. - * - * @param name the name of the component. - * @param visibility the visibility of the component. - * @return a builder for a node that is also a component. - * @see li.cil.oc.api.network.Component - */ - ComponentBuilder withComponent(String name, Visibility visibility); - - /** - * Makes the node a component. - *

- * Like {@link #withComponent(String, Visibility)}, but with a default - * visibility set to the reachability of the node. - * - * @param name the name of the component. - * @return a builder for a node that is also a component. - * @see li.cil.oc.api.network.Component - */ - ComponentBuilder withComponent(String name); - - /** - * Makes the node a connector. - *

- * A connector node can feed power into the network and extract power - * from the network. This is used both for passive energy drain (such - * as running screens and computers) and for active power consumption - * (such as wireless message sending or robot actions). - * - * @param bufferSize the size of the local energy buffer. - * @return a builder for a node that is also a connector. - * @see li.cil.oc.api.network.Connector - */ - ConnectorBuilder withConnector(double bufferSize); - - /** - * Makes the node a connector. - *

- * Like {@link #withConnector(double)}, but with a default buffer size - * of zero. - * - * @return a builder for a node that is also a connector. - * @see li.cil.oc.api.network.Connector - */ - ConnectorBuilder withConnector(); - } - - /** - * Builder for component nodes. These node can be interacted with from - * computers in the same network, that can see the component. - */ - public static interface ComponentBuilder extends Builder { - /** - * Makes the node a connector. - *

- * A connector node can feed power into the network and extract power - * from the network. This is used both for passive energy drain (such - * as running screens and computers) and for active power consumption - * (such as wireless message sending or robot actions). - * - * @param bufferSize the size of the local energy buffer. - * @return a builder for a node that is also a connector. - * @see li.cil.oc.api.network.Connector - */ - ComponentConnectorBuilder withConnector(double bufferSize); - - /** - * Makes the node a connector. - *

- * Like {@link #withConnector(double)}, but with a default buffer size - * of zero. - * - * @return a builder for a node that is also a connector. - * @see li.cil.oc.api.network.Connector - */ - ComponentConnectorBuilder withConnector(); - } - - /** - * Builder for connector nodes. These nodes can interact with the energy - * stored in the network, i.e. increase or reduce it. - */ - public static interface ConnectorBuilder extends Builder { - /** - * Makes the node a component. - *

- * Nodes that are components can be accessed from computers, methods - * declared in them marked using the {@link li.cil.oc.api.machine.Callback} annotation can - * be invoked from computers that can see the component. - * - * @param name the name of the component. - * @param visibility the visibility of the component. - * @return a builder for a node that is also a component. - * @see li.cil.oc.api.network.Component - */ - ComponentConnectorBuilder withComponent(String name, Visibility visibility); - - /** - * Makes the node a component. - *

- * Like {@link #withComponent(String, Visibility)}, but with a default - * visibility set to the reachability of the node. - * - * @param name the name of the component. - * @return a builder for a node that is also a component. - * @see li.cil.oc.api.network.Component - */ - ComponentConnectorBuilder withComponent(String name); - } - - /** - * Builder for nodes that are both component and connector node. - */ - public static interface ComponentConnectorBuilder extends Builder { - } -} diff --git a/src/api/java/li/cil/oc/api/detail/DriverAPI.java b/src/api/java/li/cil/oc/api/detail/DriverAPI.java deleted file mode 100755 index 1bdab9120..000000000 --- a/src/api/java/li/cil/oc/api/detail/DriverAPI.java +++ /dev/null @@ -1,211 +0,0 @@ -package li.cil.oc.api.detail; - -import li.cil.oc.api.driver.Block; -import li.cil.oc.api.driver.Converter; -import li.cil.oc.api.driver.EnvironmentProvider; -import li.cil.oc.api.driver.InventoryProvider; -import li.cil.oc.api.driver.Item; -import li.cil.oc.api.driver.SidedBlock; -import li.cil.oc.api.network.EnvironmentHost; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -import java.util.Collection; - -public interface DriverAPI { - /** - * Registers a new driver for a block component. - *

- * Whenever the neighboring blocks of an Adapter block change, it checks if - * there exists a driver for the changed block, and if it is configured to - * interface that block type connects it to the component network. - *

- * This must be called in the init phase, not the pre- or post-init - * phases. - * - * @param driver the driver for a block component. - * @deprecated Use {@link SidedBlock} instead. - */ - @Deprecated // TODO Remove in OC 1.7 - void add(Block driver); - - /** - * Registers a new side-aware block driver. - *

- * Whenever the neighboring blocks of an Adapter block change, it checks if - * there exists a driver for the changed block, and if it is configured to - * interface that block type connects it to the component network. - *

- * This must be called in the init phase, not the pre- or post-init - * phases. - * - * @param driver the driver to register. - */ - void add(SidedBlock driver); - - /** - * Registers a new driver for an item component. - *

- * Item components can inserted into a computers component slots. They have - * to specify their type, to determine into which slots they can fit. - *

- * This must be called in the init phase, not the pre- or post-init - * phases. - * - * @param driver the driver for an item component. - */ - void add(Item driver); - - /** - * Registers a new type converter. - *

- * Type converters are used to automatically convert values returned from - * callbacks to a "simple" format that can be pushed to any architecture. - *

- * This must be called in the init phase, not the pre- or post-init - * phases. - * - * @param converter the converter to register. - */ - void add(Converter converter); - - /** - * Register a new environment provider. - *

- * Environment providers are used for mapping item stacks to the type of - * environment that will be created by the stack, either by it being - * placed in the world and acting as a block component, or by being - * placed in an component inventory and created by the item's driver. - * - * @param provider the provider to register. - */ - void add(EnvironmentProvider provider); - - /** - * Register a new inventory provider. - *

- * Inventory providers are used for accessing item inventories using - * the inventory controller upgrade, for example. - * - * @param provider the provider to register. - */ - void add(InventoryProvider provider); - - /** - * Looks up a driver for the block at the specified position in the - * specified world. - *

- * Note that several drivers for a single block can exist. Because of this - * block drivers are always encapsulated in a 'compound' driver, which is - * what will be returned here. In other words, you should will not - * get actual instances of drivers registered via {@link #add(li.cil.oc.api.driver.Block)}. - * - * @param world the world containing the block. - * @param pos the position of the block. - * @return a driver for the block, or null if there is none. - * @deprecated Use {@link #driverFor(World, BlockPos, EnumFacing)}, - * passing null if the side is to be ignored. - */ - @Deprecated // TODO Remove in OC 1.7 - Block driverFor(World world, BlockPos pos); - - /** - * Looks up a driver for the block at the specified position in the - * specified world. - *

- * Note that several drivers for a single block can exist. Because of this - * block drivers are always encapsulated in a 'compound' driver, which is - * what will be returned here. In other words, you should will not - * get actual instances of drivers registered via {@link #add(li.cil.oc.api.driver.Block)}. - * - * @param world the world containing the block. - * @param pos the position of the block. - * @param side the side of the block. - * @return a driver for the block, or null if there is none. - */ - SidedBlock driverFor(World world, BlockPos pos, EnumFacing side); - - /** - * Looks up a driver for the specified item stack. - *

- * Note that unlike for blocks, there can always only be one item driver - * per item. If there are multiple ones, the first one that was registered - * will be used. - * - * @param stack the item stack to get a driver for. - * @param host the type that will host the environment created by returned driver. - * @return a driver for the item, or null if there is none. - */ - Item driverFor(ItemStack stack, Class host); - - /** - * Looks up a driver for the specified item stack. - *

- * Note that unlike for blocks, there can always only be one item driver - * per item. If there are multiple ones, the first one that was registered - * will be used. - *

- * This is a context-agnostic variant used mostly for "house-keeping" - * stuff, such as querying slot types and tier. - * - * @param stack the item stack to get a driver for. - * @return a driver for the item, or null if there is none. - */ - Item driverFor(ItemStack stack); - - /** - * Looks up the environment associated with the specified item stack. - *

- * This will use the registered {@link EnvironmentProvider}s to find - * an environment type for the specified item stack. If none can be - * found, returns null. - * - * @param stack the item stack to get the environment type for. - * @return the type of environment associated with the stack, or null. - */ - Class environmentFor(ItemStack stack); - - /** - * Get an inventory implementation providing access to an item inventory. - *

- * This will use the registered {@link InventoryProvider}s to find an - * inventory implementation providing access to the specified stack. - * If none can be found, returns null. - *

- * Note that the specified player may be null, but will usually - * be the fake player of the agent making use of this API. - * - * @param stack the item stack to get the inventory access for. - * @param player the player holding the item. May be null. - * @return the inventory implementation interfacing the stack, or null. - */ - IInventory inventoryFor(ItemStack stack, EntityPlayer player); - - /** - * Get a list of all registered block drivers. - *

- * This is intended to allow checking for particular drivers using more - * customized logic. - *

- * The returned collection is read-only. - * - * @return the list of all registered block drivers. - */ - Collection blockDrivers(); - - /** - * Get a list of all registered item drivers. - *

- * This is intended to allow checking for particular drivers using more - * customized logic. - *

- * The returned collection is read-only. - * - * @return the list of all registered item drivers. - */ - Collection itemDrivers(); -} diff --git a/src/api/java/li/cil/oc/api/detail/FileSystemAPI.java b/src/api/java/li/cil/oc/api/detail/FileSystemAPI.java deleted file mode 100755 index fa58c3b1a..000000000 --- a/src/api/java/li/cil/oc/api/detail/FileSystemAPI.java +++ /dev/null @@ -1,167 +0,0 @@ -package li.cil.oc.api.detail; - -import li.cil.oc.api.network.EnvironmentHost; -import li.cil.oc.api.fs.FileSystem; -import li.cil.oc.api.fs.Label; -import li.cil.oc.api.network.ManagedEnvironment; - -public interface FileSystemAPI { - /** - * Creates a new file system based on the location of a class. - *

- * This can be used to wrap a folder in the assets folder of your mod's JAR. - * The actual path is built like this: - *

"/assets/" + domain + "/" + root
- *

- * If the class is located in a JAR file, this will create a read-only file - * system based on that JAR file. If the class file is located in the native - * file system, this will create a read-only file system first trying from - * the actual location of the class file, and failing that by searching the - * class path (i.e. it'll look for a path constructed as described above). - *

- * If the specified path cannot be located, the creation fails and this - * returns null. - * - * @param clazz the class whose containing JAR to wrap. - * @param domain the domain, usually your mod's ID. - * @param root an optional subdirectory. - * @return a file system wrapping the specified folder. - */ - FileSystem fromClass(Class clazz, String domain, String root); - - /** - * Creates a new writable file system in the save folder. - *

- * This will create a folder, if necessary, and create a writable virtual - * file system based in that folder. The actual path is based in a sub- - * folder of the save folder. The actual path is built like this: - *

"saves/" + WORLD_NAME + "/opencomputers/" + root
- * The first part may differ, in particular for servers. - *

- * Usually the name will be the address of the node used to represent the - * file system. - *

- * Note that by default file systems are "buffered", meaning that any - * changes made to them are only saved to disk when the world is saved. This - * ensured that the file system contents do not go "out of sync" when the - * game crashes, but introduces additional memory overhead, since all files - * in the file system have to be kept in memory. - * - * @param root the name of the file system. - * @param capacity the amount of space in bytes to allow being used. - * @param buffered whether data should only be written to disk when saving. - * @return a file system wrapping the specified folder. - */ - FileSystem fromSaveDirectory(String root, long capacity, boolean buffered); - - /** - * Creates a new writable file system that resides in memory. - *

- * Any contents created and written on this file system will be lost when - * the node is removed from the network. - *

- * This is used for computers' /tmp mount, for example. - * - * @param capacity the capacity of the file system. - * @return a file system residing in memory. - */ - FileSystem fromMemory(long capacity); - - /** - * Wrap a file system retrieved via one of the from??? methods to - * make it read-only. - * - * @param fileSystem the file system to wrap. - * @return the specified file system wrapped to be read-only. - */ - FileSystem asReadOnly(final FileSystem fileSystem); - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * This can be useful for providing some data if you don't wish to implement - * your own driver. Which will probably be most of the time. If you need - * more control over the node, implement your own, and connect this one to - * it. In that case you will have to forward any disk driver messages to the - * node, though. - *

- * The container parameter is used to give the file system some physical - * relation to the world, for example this is used by hard drives to send - * the disk event notifications to the client that are used to play disk - * access sounds. - *

- * The container may be null, if no such context can be provided. - *

- * The access sound is the name of the sound effect to play when the file - * system is accessed, for example by listing a directory or reading from - * a file. It may be null to create a silent file system. - *

- * The speed multiplier controls how fast read and write operations on the - * file system are. It must be a value in [1,6], and controls the access - * speed, with the default being one. - * For reference, floppies are using the default, hard drives scale with - * their tiers, i.e. a tier one hard drive uses speed two, tier three uses - * speed four. - * - * @param fileSystem the file system to wrap. - * @param label the label of the file system. - * @param host the tile entity containing the file system. - * @param accessSound the name of the sound effect to play when the file - * system is accessed. This has to be the fully - * qualified resource name, e.g. - * opencomputers:floppy_access. - * @param speed the speed multiplier for this file system. - * @return the network node wrapping the file system. - */ - ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, Label label, EnvironmentHost host, String accessSound, int speed); - - /** - * Creates a network node that makes the specified file system available via - * the common file system driver. - *

- * Creates a file system with the a read-only label and the specified - * access sound and file system speed. - * - * @param fileSystem the file system to wrap. - * @param label the read-only label of the file system. - * @param host the tile entity containing the file system. - * @param accessSound the name of the sound effect to play when the file - * system is accessed. This has to be the fully - * qualified resource name, e.g. - * opencomputers:floppy_access. - * @param speed the speed multiplier for this file system. - * @return the network node wrapping the file system. - */ - ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, String label, EnvironmentHost host, String accessSound, int speed); - - /** - * @deprecated Don't use this directly, use the wrapper in {@link li.cil.oc.api.FileSystem}. - */ - @Deprecated - ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, Label label, EnvironmentHost host, String accessSound); - - /** - * @deprecated Don't use this directly, use the wrapper in {@link li.cil.oc.api.FileSystem}. - */ - @Deprecated - ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, String label, EnvironmentHost host, String accessSound); - - /** - * @deprecated Don't use this directly, use the wrapper in {@link li.cil.oc.api.FileSystem}. - */ - @Deprecated - ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, Label label); - - /** - * @deprecated Don't use this directly, use the wrapper in {@link li.cil.oc.api.FileSystem}. - */ - @Deprecated - ManagedEnvironment asManagedEnvironment(FileSystem fileSystem, String label); - - /** - * @deprecated Don't use this directly, use the wrapper in {@link li.cil.oc.api.FileSystem}. - */ - @Deprecated - ManagedEnvironment asManagedEnvironment(FileSystem fileSystem); -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/detail/ItemAPI.java b/src/api/java/li/cil/oc/api/detail/ItemAPI.java deleted file mode 100755 index 358472c48..000000000 --- a/src/api/java/li/cil/oc/api/detail/ItemAPI.java +++ /dev/null @@ -1,76 +0,0 @@ -package li.cil.oc.api.detail; - -import li.cil.oc.api.FileSystem; -import net.minecraft.item.EnumDyeColor; -import net.minecraft.item.ItemStack; - -import java.util.concurrent.Callable; - -public interface ItemAPI { - /** - * Get a descriptor object for the block or item with the specified name. - *

- * The names are the same as the ones used in the recipe files. An info - * object can be used to retrieve both the block and item instance of the - * item, if available. It can also be used to create a new item stack of - * the item. - * - * @param name the name of the item to get the descriptor for. - * @return the descriptor for the item with the specified name, or - * null if there is no such item. - */ - ItemInfo get(String name); - - /** - * Get a descriptor object for the block or item represented by the - * specified item stack. - * - * @param stack the stack to get the descriptor for. - * @return the descriptor for the specified item stack, or null - * if the stack is not a valid OpenComputers item or block. - */ - ItemInfo get(ItemStack stack); - - /** - * Register a single loot floppy disk. - *

- * The disk will be listed in the creative tab of OpenComputers. - *

- * The specified factory callable will be used to generate a new file - * system when the loot disk is used as a component. The specified name - * will be used as the label for the loot disk, as well as the identifier - * to select the corresponding factory method, so choose wisely. - *

- * To use some directory in your mod JAR as the directory provided by the - * loot disk, use {@link FileSystem#fromClass} in your callable. - *

- * Call this in the init phase or later, not in pre-init. - * - * @param name the label and identifier to use for the loot disk. - * @param color the color of the disk, as a Minecraft color. - * @param factory the callable to call for creating file system instances. - * @return an item stack representing the registered loot disk, to allow - * adding a recipe for your loot disk, for example. - */ - ItemStack registerFloppy(String name, EnumDyeColor color, Callable factory); - - /** - * Register a single custom EEPROM. - *

- * The EEPROM will be listed in the creative tab of OpenComputers. - *

- * The EEPROM will be initialized with the specified code and data byte - * arrays. For script code (e.g. a Lua script) use String.getBytes("UTF-8"). - * You can omit any of the arguments by passing null. - *

- * Call this in the init phase or later, not in pre-init. - * - * @param name the label of the EEPROM. - * @param code the code section of the EEPROM. - * @param data the data section of the EEPROM. - * @param readonly whether the code section is read-only. - * @return an item stack representing the registered EEPROM, to allow - * adding a recipe for your custom BIOS, for example. - */ - ItemStack registerEEPROM(String name, byte[] code, byte[] data, boolean readonly); -} diff --git a/src/api/java/li/cil/oc/api/detail/ItemInfo.java b/src/api/java/li/cil/oc/api/detail/ItemInfo.java deleted file mode 100755 index 4decd85a5..000000000 --- a/src/api/java/li/cil/oc/api/detail/ItemInfo.java +++ /dev/null @@ -1,50 +0,0 @@ -package li.cil.oc.api.detail; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public interface ItemInfo { - /** - * The name of this item descriptor. - *

- * This is the name that yields this instance when passed to - * {@link li.cil.oc.api.Items#get(String)}. Useful for reverse-lookup when - * retrieving the descriptor via an item stack. - * - * @return the name of this item descriptor. - */ - String name(); - - /** - * Returns the block type of the represented item. In case the item is not - * a block this will return null. - *

- * Note that OpenComputers represents most of its items using just a few - * actual Block instances, so descriptors for different blocks may - * return the same object here. - * - * @return the block type of the represented block. - */ - Block block(); - - /** - * Returns the item type of the represented item. In case the item is a - * blocks this will return null. - *

- * Note that OpenComputers represents most of its items using just a few - * actual Item instances, so descriptors for different items may - * return the same object here. - * - * @return the item type of the represented item. - */ - Item item(); - - /** - * Creates a new item stack of the item represended by this descriptor. - * - * @param size the size of the item stack to create. - * @return the created item stack. - */ - ItemStack createItemStack(int size); -} diff --git a/src/api/java/li/cil/oc/api/detail/MachineAPI.java b/src/api/java/li/cil/oc/api/detail/MachineAPI.java deleted file mode 100755 index 458f7cd03..000000000 --- a/src/api/java/li/cil/oc/api/detail/MachineAPI.java +++ /dev/null @@ -1,51 +0,0 @@ -package li.cil.oc.api.detail; - -import li.cil.oc.api.machine.Architecture; -import li.cil.oc.api.machine.Machine; -import li.cil.oc.api.machine.MachineHost; - -import java.util.Collection; - -public interface MachineAPI { - /** - * Register an architecture that can be used to create new machines. - *

- * Note that although registration is optional, it is strongly recommended - * to allow {@link #architectures()} to be useful. - * - * @param architecture the architecture to register. - * @throws IllegalArgumentException if the specified architecture is invalid. - */ - void add(Class architecture); - - /** - * A list of all registered architectures. - *

- * Note that registration is optional, although automatic when calling - * {@link #create(li.cil.oc.api.machine.MachineHost)} with a not yet - * registered architecture. What this means is that unless a mod providing - * a custom architecture also registers it, you may not see it in this list - * until it also created a new machine using that architecture. - */ - Collection> architectures(); - - /** - * Get the name of the specified architecture. - * - * @param architecture the architecture to get the name for. - * @return the name of the specified architecture. - */ - String getArchitectureName(Class architecture); - - /** - * Creates a new machine for the specified host. - *

- * You are responsible for calling update and save / load functions on the - * machine for it to work correctly. - * - * @param host the owner object of the machine, providing context. - * @return the newly created machine. - * @throws IllegalArgumentException if the specified architecture is invalid. - */ - Machine create(MachineHost host); -} diff --git a/src/api/java/li/cil/oc/api/detail/ManualAPI.java b/src/api/java/li/cil/oc/api/detail/ManualAPI.java deleted file mode 100755 index 605955472..000000000 --- a/src/api/java/li/cil/oc/api/detail/ManualAPI.java +++ /dev/null @@ -1,135 +0,0 @@ -package li.cil.oc.api.detail; - -import li.cil.oc.api.manual.ContentProvider; -import li.cil.oc.api.manual.ImageProvider; -import li.cil.oc.api.manual.ImageRenderer; -import li.cil.oc.api.manual.PathProvider; -import li.cil.oc.api.manual.TabIconRenderer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -public interface ManualAPI { - /** - * Register a tab to be displayed next to the manual. - *

- * These are intended to link to index pages, and for the time being there - * a relatively low number of tabs that can be displayed, so I'd ask you to - * only register as many tabs as actually, technically *needed*. Which will - * usually be one, for your main index page. - * - * @param renderer the renderer used to render the icon on your tab. - * @param tooltip the unlocalized tooltip of the tab, or null. - * @param path the path to the page to open when the tab is clicked. - */ - void addTab(TabIconRenderer renderer, String tooltip, String path); - - /** - * Register a path provider. - *

- * Path providers are used to find documentation entries for item stacks - * and blocks in the world. - * - * @param provider the provider to register. - */ - void addProvider(PathProvider provider); - - /** - * Register a content provider. - *

- * Content providers are used to resolve paths to page content, if the - * standard system (using Minecraft's resource loading facilities) fails. - *

- * This can be useful for providing dynamic content, for example. - * - * @param provider the provider to register. - */ - void addProvider(ContentProvider provider); - - /** - * Register an image provider. - *

- * Image providers are used to render custom content in a page. These are - * selected via the standard image tag of Markdown, based on the prefix of - * the image URL, i.e. ![tooltip](prefix:data) will select the - * image provider registered for the prefix prefix, and pass to - * it the argument data, then use the returned renderer to draw - * an element in the place of the tag. - *

- * Custom providers are only selected if a prefix is matched, otherwise - * it'll treat it as a relative path to an image to load via Minecraft's - * resource providing facilities, and display that. - * - * @param prefix the prefix on which to use the provider. - * @param provider the provider to register. - */ - void addProvider(String prefix, ImageProvider provider); - - // ----------------------------------------------------------------------- // - - /** - * Look up the documentation path for the specified item stack. - * - * @param stack the stack to find the documentation path for. - * @return the path to the page, null if none is known. - */ - String pathFor(ItemStack stack); - - /** - * Look up the documentation for the specified block in the world. - * - * @param world the world containing the block. - * @param pos the position of the block. - * @return the path to the page, null if none is known. - */ - String pathFor(World world, BlockPos pos); - - /** - * Get the content of the documentation page at the specified location. - *

- * The provided path may contain the special variable %LANGUAGE%, - * which will be resolved to the currently set language, falling back to - * en_US. - * - * @param path the path of the page to get the content of. - * @return the content of the page, or null if none exists. - */ - Iterable contentFor(String path); - - /** - * Get the image renderer for the specified image path. - *

- * This will look for {@link ImageProvider}s registered for a prefix in the - * specified path. If there is no match, or the matched content provider - * does not provide a renderer, this will return null. - * - * @param path the path to the image to get the renderer for. - * @return the custom renderer for that path. - */ - ImageRenderer imageFor(String path); - - // ----------------------------------------------------------------------- // - - /** - * Open the manual for the specified player. - *

- * If you wish to display a specific page, call {@link #navigate(String)} - * after this function returns, with the path to the page to show. - * - * @param player the player to open the manual for. - */ - void openFor(EntityPlayer player); - - /** - * Reset the history of the manual. - */ - void reset(); - - /** - * Navigate to a page in the manual. - * - * @param path the path to navigate to. - */ - void navigate(String path); -} diff --git a/src/api/java/li/cil/oc/api/detail/NanomachinesAPI.java b/src/api/java/li/cil/oc/api/detail/NanomachinesAPI.java deleted file mode 100755 index 4a85f5fcf..000000000 --- a/src/api/java/li/cil/oc/api/detail/NanomachinesAPI.java +++ /dev/null @@ -1,66 +0,0 @@ -package li.cil.oc.api.detail; - -import li.cil.oc.api.nanomachines.BehaviorProvider; -import li.cil.oc.api.nanomachines.Controller; -import net.minecraft.entity.player.EntityPlayer; - -public interface NanomachinesAPI { - /** - * Register a new behavior provider. - *

- * When a controller is reconfigured it will draw behaviors from all - * registered providers and build a new random connection graph to - * those behaviors. - * - * @param provider the provider to add. - */ - void addProvider(BehaviorProvider provider); - - /** - * Get a list of all currently registered providers. - * - * @return the list of all currently registered providers. - */ - Iterable getProviders(); - - /** - * Check whether a player has a nanomachine controller installed. - * - * @param player the player to check for. - * @return true if the player has a controller, false otherwise. - */ - boolean hasController(EntityPlayer player); - - /** - * Get the nanomachine controller of the specified player. - *

- * If the player has a controller installed, this will initialize the - * controller if it has not already been loaded. If the player has no - * controller, this will return null. - * - * @param player the player to get the controller for. - * @return the controller for the specified player. - */ - Controller getController(EntityPlayer player); - - /** - * Install a controller for the specified player if it doesn't already - * have one. - *

- * This will also initialize the controller if it has not already been - * initialized. - * - * @param player the player to install a nanomachine controller for. - * @return the controller for the specified player. - */ - Controller installController(EntityPlayer player); - - /** - * Uninstall a controller from the specified player if it has one. - *

- * This will disable all active behaviors before disposing the controller. - * - * @param player the player to uninstall a nanomachine controller from. - */ - void uninstallController(EntityPlayer player); -} diff --git a/src/api/java/li/cil/oc/api/detail/NetworkAPI.java b/src/api/java/li/cil/oc/api/detail/NetworkAPI.java deleted file mode 100755 index 967f4f1fd..000000000 --- a/src/api/java/li/cil/oc/api/detail/NetworkAPI.java +++ /dev/null @@ -1,186 +0,0 @@ -package li.cil.oc.api.detail; - -import li.cil.oc.api.network.Environment; -import li.cil.oc.api.network.Node; -import li.cil.oc.api.network.Packet; -import li.cil.oc.api.network.Visibility; -import li.cil.oc.api.network.WirelessEndpoint; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; - -public interface NetworkAPI { - /** - * Convenience overload for {@link #joinOrCreateNetwork(IBlockAccess, BlockPos)}. - *

- * If the tile entity implements {@link Environment} its one node will be - * connected to any existing adjacent tile entity nodes. If none exist a - * new network with the specified tile entity's node as its sole entry. - *

- * If the tile entity is a {@link li.cil.oc.api.network.SidedEnvironment} - * the same rules as for simple environments apply, except that the - * respective for each side is used when connecting, and each side's node - * is added to its own new network, if necessary. - * - * @param tileEntity the tile entity to initialize. - */ - void joinOrCreateNetwork(TileEntity tileEntity); - - /** - * Tries to add network node(s) at the specified coordinates to adjacent - * networks. - * - * @param world the world containing the location to connect. - * @param pos the position at which to update the network. - */ - void joinOrCreateNetwork(IBlockAccess world, BlockPos pos); - - /** - * Creates a new network with the specified node as its initial node. - *

- * This can be used to create networks that are not bound to any tile - * entity. For example, this is used to create the internal networks of - * robots. - * - * @param node the node to create the network for. - * @throws IllegalArgumentException if the node already is in a network. - */ - void joinNewNetwork(Node node); - - // ----------------------------------------------------------------------- // - - /** - * Makes a wireless endpoint join the wireless network defined by the mod. - *

- * OpenComputers tracks endpoints to which to send wireless packets sent - * via the {@link #sendWirelessPacket(WirelessEndpoint, double, Packet)} - * method. The packets will only be sent to endpoints registered - * with the network. - *

- * Important: when your endpoint is removed from the world, - * you must ensure it is also removed from the network! - * - * @param endpoint the endpoint to register with the network. - */ - void joinWirelessNetwork(WirelessEndpoint endpoint); - - /** - * Updates a wireless endpoint in the wireless network. - *

- * This is more efficient than removing and then adding the node again, as - * it only performs the update if the position significantly changed since - * the last time the position was updated (more than 0.5 along any axis). - *

- * Calling this for an endpoint that was not added before does nothing. - * - * @param endpoint the endpoint for which to update the position. - */ - void updateWirelessNetwork(WirelessEndpoint endpoint); - - /** - * Removes a wireless endpoint from the wireless network. - *

- * This must be called when an endpoint becomes invalid, otherwise it will - * remain in the network! - *

- * Calling this for an endpoint that was not added before does nothing. - * - * @param endpoint the endpoint to remove from the wireless network. - */ - void leaveWirelessNetwork(WirelessEndpoint endpoint); - - /** - * Removes a wireless endpoint from the wireless network of a specific dimension. - *

- * This may be useful if the dimension of an endpoint changed and you can only - * react to that change (e.g. a player changing dimensions). - *

- * Calling this for an endpoint that was not added before does nothing. - * - * @param endpoint the endpoint to remove from the wireless network. - * @param dimension the dimension with the wireless network to remove the endpoint from. - */ - void leaveWirelessNetwork(WirelessEndpoint endpoint, int dimension); - - /** - * Sends a packet via the wireless network. - *

- * This will look for all other registered wireless endpoints in range of - * the sender and submit the packets to them. Whether another end point is - * reached depends on the distance and potential obstacles between the - * sender and the receiver (harder blocks require a stronger signal to be - * penetrated). - * - * @param source the endpoint that is sending the message. - * @param strength the signal strength with which to send the packet. - * @param packet the packet to send. - */ - void sendWirelessPacket(WirelessEndpoint source, double strength, Packet packet); - - // ----------------------------------------------------------------------- // - - /** - * Factory function for creating new nodes. - *

- * Use this to create a node for your environment (e.g. tile entity). This - * will return a builder that can be used to further specialize the node, - * making it either a component node (for callbacks), a connector node - * (for power interaction) or both. - *

- * Example use: - *

-     * class YourThing extends TileEntity implements Environment {
-     *     private ComponentConnector node_ =
-     *         api.Network.newNode(this, Visibility.Network).
-     *             withComponent("your_thing").
-     *             withConnector(32).
-     *             create();
-     *
-     *     public Node node() { return node_; }
-     *
-     *     // ...
-     * }
-     * 
- *

- * Note that the reachability specified here is the general - * availability of the created node to other nodes in the network. Special - * rules apply to components, which have a visibility that is used - * to control how they can be reached from computers. For example, network - * cards have a reachability of Visibility.Network, to - * allow them to communicate with each other, but a visibility of - * Visibility.Neighbors to avoid other computers in the network - * to see the card (i.e. only the user programs running on the computer the - * card installed in can see interact with it). - * - * @param host the environment the node is created for. - * @param reachability the reachability of the node. - * @return a new node builder. - */ - Builder.NodeBuilder newNode(Environment host, Visibility reachability); - - /** - * Creates a new network packet as it would be sent or received by a - * network card. - *

- * These packets can be forwarded by switches and access points. For wired - * transmission they must be sent over a node's send method, with the - * message name being network.message. - * - * @param source the address of the sending node. - * @param destination the address of the destination, or null - * for a broadcast. - * @param port the port to send the packet to. - * @param data the payload of the packet. - * @return the new packet. - */ - Packet newPacket(String source, String destination, int port, Object[] data); - - /** - * Re-creates a network packet from a previously stored state. - * - * @param nbt the tag to load the packet from. - * @return the loaded packet. - */ - Packet newPacket(NBTTagCompound nbt); -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/detail/package-info.java b/src/api/java/li/cil/oc/api/detail/package-info.java deleted file mode 100755 index d33ae2f40..000000000 --- a/src/api/java/li/cil/oc/api/detail/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * This package contains implementation detail interfaces. You will not have to - * interact with these interfaces directly (except for the Builder), - * and you particularly should not implement these interfaces yourself. - */ -package li.cil.oc.api.detail; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/driver/Block.java b/src/api/java/li/cil/oc/api/driver/Block.java deleted file mode 100755 index c30d7d544..000000000 --- a/src/api/java/li/cil/oc/api/driver/Block.java +++ /dev/null @@ -1,63 +0,0 @@ -package li.cil.oc.api.driver; - -import li.cil.oc.api.network.ManagedEnvironment; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -/** - * Interface for block component drivers. - *

- * This driver type is used for components that are blocks, i.e. that can be - * placed in the world, but cannot be modified to or don't want to have their - * {@link net.minecraft.tileentity.TileEntity} implement one of the interfaces - * for environments ({@link li.cil.oc.api.network.Environment} or - * {@link li.cil.oc.api.network.SidedEnvironment}). - *

- * A block driver is used by Adapter blocks to check its neighbors and - * whether those neighbors should be treated as components or not. If a driver - * is present, it will be used to create a {@link ManagedEnvironment} that is - * managed by the adapter. - *

- * Note that it is possible to write one driver that supports as many different - * blocks as you wish. I'd recommend writing one per device (type), though, to - * keep things modular. - * - * @deprecated Use {@link SidedBlock} instead, ignoring the side argument if - * the side doesn't matter. - */ -@Deprecated // TODO Remove in OC 1.7 -public interface Block { - /** - * Used to determine the block types this driver handles. - *

- * This is used to determine which driver to use for a block placed next to - * an Adapter block. Note that the return value should not change - * over time; if it does, though, an already installed component will not - * be removed, since this value is only checked when scanning blocks. You - * can force this by sending a neighbor block change notification. - * - * @param world the world in which the block to check lives. - * @param pos the position coordinate of the block to check. - * @return true if the block is supported; false otherwise. - */ - boolean worksWith(World world, BlockPos pos); - - /** - * Create a new managed environment interfacing the specified block. - *

- * This is used to connect the component to the component network when it - * is detected next to an Adapter. Components that are not part of - * the component network probably don't make much sense (can't think of any - * uses at this time), but you may still opt to not implement this - i.e. - * it is safe to return null here. - *

- * This is expected to return a new instance each time it is - * called. The created instance's life cycle is managed by the - * Adapter block that caused its creation. - * - * @param world the world containing the block to get the environment for. - * @param pos the position of the block to get the environment for. - * @return the environment for the block at that location. - */ - ManagedEnvironment createEnvironment(World world, BlockPos pos); -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/driver/Converter.java b/src/api/java/li/cil/oc/api/driver/Converter.java deleted file mode 100755 index 8eccc321c..000000000 --- a/src/api/java/li/cil/oc/api/driver/Converter.java +++ /dev/null @@ -1,30 +0,0 @@ -package li.cil.oc.api.driver; - -import java.util.Map; - -/** - * A converter is a callback that can be used to transparently convert Java - * types to something that can be pushed to a machine's architecture. - *

- * Note that converters operating on the same object type may override each - * other when using the same keys in the resulting Map. The order in - * which converters are called depends on the order they were registered in. - */ -public interface Converter { - /** - * Converts a type to a Map. - *

- * The keys and values in the resulting map will be converted in turn. - * If after those conversions the map still contains unsupported values, - * they will not be retained. - *

- * The conversion result should be placed into the the passed map, i.e. the - * map will represent the original object. For example, if the value had a - * field name, add a key name to the map with the value - * of that field. - * - * @param value the value to convert. - * @param output the map conversion results are accumulated into. - */ - void convert(Object value, Map output); -} diff --git a/src/api/java/li/cil/oc/api/driver/EnvironmentAware.java b/src/api/java/li/cil/oc/api/driver/EnvironmentAware.java deleted file mode 100755 index 10493e6cc..000000000 --- a/src/api/java/li/cil/oc/api/driver/EnvironmentAware.java +++ /dev/null @@ -1,40 +0,0 @@ -package li.cil.oc.api.driver; - -import li.cil.oc.api.network.Environment; -import net.minecraft.item.ItemStack; - -/** - * This interface can be added to either item or block drivers. - *

- * It is used to statically query the type of environment that would be created - * for the block or item represented by an item stack. This is used to provide - * automatically generated ingame help in the NEI usage screen, for example. - *

- * For item drivers this will usually be pretty simple to implement, assuming - * the driver only ever generates one type of environment - just return the - * class of it and you're done. - *

- * For block drivers there is a bit more work involved, since you have to check - * if the item is the item block that corresponds to the supported block type. - * This should usually not be an issue either, though. - * - * @deprecated Use an {@link EnvironmentProvider} instead. - */ -@Deprecated -public interface EnvironmentAware { - /** - * Get the type of environment that would be created for the specified - * block or item. - *

- * Note that for block drivers this is called for any type of item stack. - *

- * For item drivers this is only called if {@link Item#worksWith(net.minecraft.item.ItemStack)} - * returns true. - * - * @param stack the item stack representing a block or item to get the - * related environment type for. - * @return the type of environment this driver would produce, or - * null if the block or item is not supported. - */ - Class providedEnvironment(ItemStack stack); -} diff --git a/src/api/java/li/cil/oc/api/driver/EnvironmentHost.java b/src/api/java/li/cil/oc/api/driver/EnvironmentHost.java deleted file mode 100755 index 6597dc9d1..000000000 --- a/src/api/java/li/cil/oc/api/driver/EnvironmentHost.java +++ /dev/null @@ -1,7 +0,0 @@ -package li.cil.oc.api.driver; - -/** - * @deprecated Use li.cil.oc.api.network.EnvironmentHost directly. - */ -public interface EnvironmentHost extends li.cil.oc.api.network.EnvironmentHost { -} diff --git a/src/api/java/li/cil/oc/api/driver/EnvironmentProvider.java b/src/api/java/li/cil/oc/api/driver/EnvironmentProvider.java deleted file mode 100755 index 842c1b33b..000000000 --- a/src/api/java/li/cil/oc/api/driver/EnvironmentProvider.java +++ /dev/null @@ -1,29 +0,0 @@ -package li.cil.oc.api.driver; - -import net.minecraft.item.ItemStack; - -/** - * Environment providers allow OpenComputers to resolve item stacks to the - * environments generated by the block or item component of the stack. - *

- * This is mainly used in OpenComputers' NEI usage handler for displaying - * a component's API. - */ -public interface EnvironmentProvider { - /** - * Get the environment provided by the specified stack. - *

- * For blocks this will usually be the tile entity. In particular, for - * {@link li.cil.oc.api.network.SimpleComponent}s this allows returning - * an arbitrary class type instead of an environment type, since the - * {@link li.cil.oc.api.network.Environment} interface will be injected - * by the class transformer at runtime. - *

- * For items this will be the type of the environment returned by the - * item driver's {@link Item#createEnvironment} method. - * - * @param stack the stack to get the environment type for. - * @return the environment type for the specified stack. - */ - Class getEnvironment(ItemStack stack); -} diff --git a/src/api/java/li/cil/oc/api/driver/InventoryProvider.java b/src/api/java/li/cil/oc/api/driver/InventoryProvider.java deleted file mode 100755 index 4308b454a..000000000 --- a/src/api/java/li/cil/oc/api/driver/InventoryProvider.java +++ /dev/null @@ -1,42 +0,0 @@ -package li.cil.oc.api.driver; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; - -/** - * Inventory providers are used to access contents of item inventories. - *

- * In OpenComputers an example for this would be servers, in other mods - * this can be backpacks and the like. Inventory providers are used to - * allow agents (robots, drones) to interact with such inventories using - * the inventory controller upgrade, for example. - *

- * Implementations returned by {@link #getInventory} should save changes - * back to the item stack when {@link IInventory#markDirty()} is called. - * Return null if the specified stack is not supported. - */ -public interface InventoryProvider { - /** - * Checks whether this provider works for the specified item stack. - * - * @param stack the item stack to check for. - * @param player the player holding the item, may be null. - * @return true if the stack is supported, false otherwise. - */ - boolean worksWith(ItemStack stack, EntityPlayer player); - - /** - * Get an inventory implementation that allows interfacing with the - * item inventory represented by the specified item stack. - *

- * Note that the specified player may be null, but will - * usually be the fake player of the agent using the - * inventory controller upgrade to access the item inventory. - * - * @param stack the item stack to get the inventory for. - * @param player the player holding the item, may be null. - * @return the inventory representing the contents, or null. - */ - IInventory getInventory(ItemStack stack, EntityPlayer player); -} diff --git a/src/api/java/li/cil/oc/api/driver/Item.java b/src/api/java/li/cil/oc/api/driver/Item.java deleted file mode 100755 index 5f95e3de3..000000000 --- a/src/api/java/li/cil/oc/api/driver/Item.java +++ /dev/null @@ -1,114 +0,0 @@ -package li.cil.oc.api.driver; - -import li.cil.oc.api.network.ManagedEnvironment; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -/** - * Interface for item component drivers. - *

- * This driver type is used for components that are items, i.e. that can be - * inserted into computers and robots. An example for this are internal drives, - * memory and graphic cards. - *

- * When trying to add an item to a computer the list of registered drivers is - * queried using the drivers' worksWith functions. The first driver - * that replies positively and whose check against the slot type is successful, - * i.e. for which the slot matches the slot it should be inserted into, - * will be used as the component's driver and the component will be added. If no - * driver is found the item will be rejected and cannot be installed. - *

- * Note that it is possible to write one driver that supports as many different - * items as you wish. I'd recommend writing one per device (type), though, to - * keep things modular. - */ -public interface Item { - /** - * Used to determine the item types this driver handles. - *

- * This is used to determine which driver to use for an item when it should - * be installed in a computer. Note that the return value should not change - * over time; if it does, though, an already installed component will not - * be ejected, since this value is only checked when adding components. - *

- * This is a context-agnostic variant used mostly for "house-keeping" - * stuff, such as querying slot types and tier. - * - * @param stack the item to check. - * @return true if the item is supported; false otherwise. - */ - boolean worksWith(ItemStack stack); - - /** - * Create a new managed environment interfacing the specified item. - *

- * This is used to connect the component to the component network when it is - * added to a computer, for example. The only kind of component that does - * not need to be connected to the component network is probably memory, and - * there's a built-in driver for that. You may still opt to not implement - * this - i.e. it is safe to return null here. - *

- * Keep in mind that the host's location may change if the owner is - * a robot. This is important if you cache the location somewhere. For - * example, the wireless network card checks in a robot movement event - * handler for position changes to update the index structure used for - * receiver look-up. - *

- * This is expected to return a new instance each time it is - * called. The created instance's life cycle is managed by the host - * that caused its creation. - * - * @param stack the item stack for which to get the environment. - * @param host the host the environment will be managed by. - * @return the environment for that item. - */ - ManagedEnvironment createEnvironment(ItemStack stack, li.cil.oc.api.network.EnvironmentHost host); - - /** - * The slot type of the specified item this driver supports. - *

- * This is used to determine into which slot of a computer the components - * this driver supports may go. This will only be called if a previous call - * to {@link #worksWith} with the same stack returned true. - * - * @param stack the item stack to get the slot type for. - * @return the slot type of the specified item. - * @see li.cil.oc.api.driver.item.Slot - */ - String slot(ItemStack stack); - - /** - * The tier of the specified item this driver supports. - *

- * This is used to determine into which slot of a computer the components - * this driver supports may go. This will only be called if a previous call - * to {@link #worksWith} with the same stack returned true. - *

- * Important: tiers are zero-indexed. - * - * @param stack the item stack to get the tier for. - * @return the tier of the specified item. - */ - int tier(ItemStack stack); - - /** - * Get the tag compound based on the item stack to use for persisting the - * environment associated with the specified item stack. - *

- * This is only used if the item has an environment. This must always be a - * child tag of the item stack's own tag compound, it will not be saved - * otherwise. Use this in the unlikely case that the default name collides - * with something. The built-in components use a child tag-compound with - * the name oc:data, which will also be used if this returns - * null. - *

- * This tag will be passed to the environment's save and - * load methods when appropriate (world save / load and when - * removed from their hosting inventory). - * - * @param stack the item to get the child tag from. - * @return the tag to use for saving and loading, or null to use - * the default tag oc:data. - */ - NBTTagCompound dataTag(ItemStack stack); -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/driver/MethodWhitelist.java b/src/api/java/li/cil/oc/api/driver/MethodWhitelist.java deleted file mode 100755 index 3798d2c5d..000000000 --- a/src/api/java/li/cil/oc/api/driver/MethodWhitelist.java +++ /dev/null @@ -1,36 +0,0 @@ -package li.cil.oc.api.driver; - -import net.minecraft.util.math.BlockPos; - -/** - * This interface can be implemented by environments to enforce a method - * whitelist. - *

- * When drivers are collected for a block, they are combined into a compound - * driver. This compound driver will in turn generate a compound environment - * that wraps the contributing environments. Which in turn results in the - * block's component containing the list of methods from all drivers that apply - * to the block. - *

- * In some scenarios you may not want this to happen. Instead, only a select - * list of methods should be shown for a block - for example, you may want to - * suppress inventory functionality if your TileEntity implements IInventory. - *

- * To do so, implement this interface in the environment that you - * return from your driver's {@link SidedBlock#createEnvironment(net.minecraft.world.World, BlockPos, net.minecraft.util.EnumFacing)} - * method, and provide the names of the allowed methods from {@link #whitelistedMethods()}. - *

- * Important: if multiple drivers apply to a single block that each - * provide a whitelist, the list of allowed methods is the intersection of the - * different whitelists! - */ -public interface MethodWhitelist { - /** - * The list of methods allowed to be exposed for blocks this driver is used - * for. Note that the names must exactly match the names of the - * methods they allow. - * - * @return the list of allowed methods. - */ - String[] whitelistedMethods(); -} diff --git a/src/api/java/li/cil/oc/api/driver/NamedBlock.java b/src/api/java/li/cil/oc/api/driver/NamedBlock.java deleted file mode 100755 index a80ee22d8..000000000 --- a/src/api/java/li/cil/oc/api/driver/NamedBlock.java +++ /dev/null @@ -1,38 +0,0 @@ -package li.cil.oc.api.driver; - -import net.minecraft.util.math.BlockPos; - -/** - * This interface can be added to environments generated by block - * drivers to provide a 'preferred name' in case the driver is merged with - * other block drivers (interface based drivers such as for IInventory). - *

- * This was previously to be implemented on the driver itself, but that has been - * deprecated. Implement it in the environment returned from the block driver's - * {@link SidedBlock#createEnvironment(net.minecraft.world.World, BlockPos, net.minecraft.util.EnumFacing)} - * method instead. - */ -public interface NamedBlock { - /** - * The preferred name, in case the driver is merged with others. - * - * @return the preferred name. - */ - String preferredName(); - - /** - * This is used to determine which name to use in case multiple - * environments with this interface are merged. - *

- * If multiple named environments are merged the name of the environment - * with the highest priority is selected. Negative values are - * allowed. The recommended default value is therefore zero. - *

- * If multiple environments with the same priority exist, the - * result is unspecified. It will usually result in the environment - * of the driver that was registered first. - * - * @return the priority with which to use this name. - */ - int priority(); -} diff --git a/src/api/java/li/cil/oc/api/driver/SidedBlock.java b/src/api/java/li/cil/oc/api/driver/SidedBlock.java deleted file mode 100755 index ff6d87e71..000000000 --- a/src/api/java/li/cil/oc/api/driver/SidedBlock.java +++ /dev/null @@ -1,71 +0,0 @@ -package li.cil.oc.api.driver; - -import li.cil.oc.api.network.ManagedEnvironment; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -/** - * Interface for side-aware block component drivers. - *

- * This driver type is used for components that are blocks, i.e. that can be - * placed in the world, but cannot be modified to or don't want to have their - * {@link net.minecraft.tileentity.TileEntity} implement one of the interfaces - * for environments ({@link li.cil.oc.api.network.Environment} or - * {@link li.cil.oc.api.network.SidedEnvironment}). - *

- * A block driver is used by Adapter blocks to check its neighbors and - * whether those neighbors should be treated as components or not. If a driver - * is present, it will be used to create a {@link ManagedEnvironment} that is - * managed by the adapter. - *

- * Note that it is possible to write one driver that supports as many different - * blocks as you wish. I'd recommend writing one per device (type), though, to - * keep things modular. - *

- * Note that side-aware block drivers are queried before regular block drivers, - * because they are more specific. - */ -public interface SidedBlock { - /** - * Used to determine the block types this driver handles. - *

- * This is used to determine which driver to use for a block placed next to - * an Adapter block. Note that the return value should not change - * over time; if it does, though, an already installed component will not - * be removed, since this value is only checked when scanning blocks. You - * can force this by sending a neighbor block change notification. - *

- * The side is relative to the block, i.e. "south" is the side of the block - * facing south. - * - * @param world the world in which the block to check lives. - * @param pos the position coordinate of the block to check. - * @param side the side of the block to check. - * @return true if the block is supported; false otherwise. - */ - boolean worksWith(World world, BlockPos pos, EnumFacing side); - - /** - * Create a new managed environment interfacing the specified block. - *

- * This is used to connect the component to the component network when it - * is detected next to an Adapter. Components that are not part of - * the component network probably don't make much sense (can't think of any - * uses at this time), but you may still opt to not implement this - i.e. - * it is safe to return null here. - *

- * This is expected to return a new instance each time it is - * called. The created instance's life cycle is managed by the - * Adapter block that caused its creation. - *

- * The side is relative to the block, i.e. "south" is the side of the block - * facing south. - * - * @param world the world containing the block to get the environment for. - * @param pos the position coordinate of the block to check. - * @param side the side of the block to check. - * @return the environment for the block at that location. - */ - ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacing side); -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/driver/item/CallBudget.java b/src/api/java/li/cil/oc/api/driver/item/CallBudget.java deleted file mode 100755 index e407b419c..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/CallBudget.java +++ /dev/null @@ -1,30 +0,0 @@ -package li.cil.oc.api.driver.item; - -import net.minecraft.item.ItemStack; - -/** - * Common functionality provided by parts that influence a machine's speed. - *

- * By default, this is implemented by OpenComputers' {@link Processor}s and - * {@link Memory}. - *

- * The actual call budget of a machine is set to the average of - * the specified call budget of all present components. - *

- * A processor and memory implementation may choose not to implement this - * interface. If no component providing a call budget it present in a machine, - * a value of 1.0 will be used, i.e. the "default" speed modifier. - */ -public interface CallBudget { - /** - * The budget for direct calls provided by the specified component. - *

- * For reference, the default budgets for OpenComputers' processors are - * 0.5, 1.0 and 1.5 for tier one, two and three, respectively. This means - * you can consider it a multiplier for the machine's operation speed. - * - * @param stack the stack representing the part to get the call budget for. - * @return the budget for direct calls per tick provided. - */ - double getCallBudget(ItemStack stack); -} diff --git a/src/api/java/li/cil/oc/api/driver/item/Chargeable.java b/src/api/java/li/cil/oc/api/driver/item/Chargeable.java deleted file mode 100755 index 38e7cbe61..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/Chargeable.java +++ /dev/null @@ -1,36 +0,0 @@ -package li.cil.oc.api.driver.item; - -import net.minecraft.item.ItemStack; - -/** - * This interface can be implemented on items that go into a charger. - *

- * This provides a generic way of charging items, even such that are not - * components. Doing it this way enables items to provide another environment, - * that is unrelated to charging, such as tablets providing their file system, - * while in the charger. - */ -public interface Chargeable { - /** - * Whether the specified item stack can be charged. - *

- * This is primarily meant to filter meta item subitems that are not meant - * to be chargeable. - * - * @param stack the stack to check for. - * @return whether the specified item stack is chargeable. - */ - boolean canCharge(ItemStack stack); - - /** - * Called when checking if an item can be charged or should be charged. - *

- * To discharge an item, pass a negative value. - * - * @param stack the item to charge. - * @param amount the amount to inject into the item. - * @param simulate whether to only simulate injection. - * @return the remainder of the energy that could not be injected/extracted. - */ - double charge(ItemStack stack, double amount, boolean simulate); -} diff --git a/src/api/java/li/cil/oc/api/driver/item/Container.java b/src/api/java/li/cil/oc/api/driver/item/Container.java deleted file mode 100755 index 23ae14119..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/Container.java +++ /dev/null @@ -1,39 +0,0 @@ -package li.cil.oc.api.driver.item; - -import li.cil.oc.api.driver.Item; -import net.minecraft.item.ItemStack; - -/** - * May be implemented by drivers for robot upgrades that act as hotswap bays, - * i.e. which can be installed into the 'dynamic' slots, and provide on-the-fly - * changeable upgrade slots (i.e. which can be changed in the robot GUI, - * without disassembling and re-assembling the robot). - *

- * These drivers will not be queried for environments. The reported tier is the - * maximum tier supported in the dynamic slot they provide. - */ -public interface Container extends Item { - /** - * The type of slot provided as the dynamic slot. This will usually be - * for other upgrades, but may be for any type of item component. - *

- * While the driver's own type implicitly has to be 'Container' and could - * therefore be used instead, this makes the intention more clear. - * - * @param stack the item stack to get the provided slot type for. - * @return the slot type provided by that dynamic slot upgrade. - * @see li.cil.oc.api.driver.item.Slot - */ - String providedSlot(ItemStack stack); - - /** - * The maximum item tier of the items that can be placed into the slot - * provided by the specified container. - *

- * This will usually be equal to the container's tier. - * - * @param stack the item stack to the the supported tier for. - * @return the maximum tier supported by that dynamic slot upgrade. - */ - int providedTier(ItemStack stack); -} diff --git a/src/api/java/li/cil/oc/api/driver/item/HostAware.java b/src/api/java/li/cil/oc/api/driver/item/HostAware.java deleted file mode 100755 index 097e46adf..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/HostAware.java +++ /dev/null @@ -1,28 +0,0 @@ -package li.cil.oc.api.driver.item; - -import li.cil.oc.api.network.EnvironmentHost; -import li.cil.oc.api.driver.Item; -import net.minecraft.item.ItemStack; - -/** - * This interface can be added to item drivers to allow them to be picky - * about their supported host environment. - *

- * This is useful for drivers for components that should only go into certain - * environments, such as robot specific upgrades. - */ -public interface HostAware extends Item { - /** - * Used to determine the item types this driver handles. - *

- * This is used to determine which driver to use for an item when it should - * be installed in a computer. Note that the return value should not change - * over time; if it does, though, an already installed component will not - * be ejected, since this value is only checked when adding components. - * - * @param stack the item to check. - * @param host the type of host the environment would live in. - * @return true if the item is supported; false otherwise. - */ - boolean worksWith(ItemStack stack, Class host); -} diff --git a/src/api/java/li/cil/oc/api/driver/item/Inventory.java b/src/api/java/li/cil/oc/api/driver/item/Inventory.java deleted file mode 100755 index 2e0eff061..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/Inventory.java +++ /dev/null @@ -1,21 +0,0 @@ -package li.cil.oc.api.driver.item; - -import li.cil.oc.api.driver.Item; -import net.minecraft.item.ItemStack; - -/** - * This interface marks drivers for robot upgrades that provide inventory - * space to the robot. Note that this is only queried upon robot assembly, - * after that the inventory is fixed! This in particular means that there - * can be no hot-swappable inventories - at least none that are represented - * in the GUI. - */ -public interface Inventory extends Item { - /** - * The additional amount of inventory space the specified item provides. - * - * @param stack the item to get the provided inventory space for. - * @return the provided inventory space. - */ - int inventoryCapacity(ItemStack stack); -} diff --git a/src/api/java/li/cil/oc/api/driver/item/Memory.java b/src/api/java/li/cil/oc/api/driver/item/Memory.java deleted file mode 100755 index 3cd72a8f5..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/Memory.java +++ /dev/null @@ -1,27 +0,0 @@ -package li.cil.oc.api.driver.item; - -import li.cil.oc.api.driver.Item; -import net.minecraft.item.ItemStack; - -/** - * Use this interface to implement item drivers extending the memory of a computer. - *

- * Note that the item must be installed in the actual computer's inventory to - * work. If it is installed in an external inventory the computer will not - * recognize the memory. - */ -public interface Memory extends Item { - /** - * The amount of RAM this component provides, as a generic scaling factor. - *

- * This factor has to be interpreted by each individual architecture to fit - * its own memory needs. The actual values returned here should roughly be - * equivalent to the item's tier. For example, the built-in memory modules - * provide defaults of 192 for tier one, 256 for tier 1.5, 384 for tier 2, etc. - * Mind that those values may be changed in the config file. - * - * @param stack the item to get the provided memory for. - * @return the amount of memory the specified component provides. - */ - double amount(ItemStack stack); -} diff --git a/src/api/java/li/cil/oc/api/driver/item/MutableProcessor.java b/src/api/java/li/cil/oc/api/driver/item/MutableProcessor.java deleted file mode 100755 index 04cc07634..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/MutableProcessor.java +++ /dev/null @@ -1,27 +0,0 @@ -package li.cil.oc.api.driver.item; - -import li.cil.oc.api.machine.Architecture; -import net.minecraft.item.ItemStack; - -/** - * May be implemented in processor drivers of processors that can be reconfigured. - *

- * This is the case for OC's built-in CPUs, for example, which can be reconfigured - * to any registered architecture. It a CPU has such a driver, it may also be - * reconfigured by the machine it is running in (e.g. in the Lua case via - * computer.setArchitecture). - */ -public interface MutableProcessor extends Processor { - /** - * Get a list of all architectures supported by this processor. - */ - java.util.Collection> allArchitectures(); - - /** - * Set the architecture to use for the specified processor. - * - * @param stack the processor to set the architecture for. - * @param architecture the architecture to use on the processor. - */ - void setArchitecture(ItemStack stack, Class architecture); -} diff --git a/src/api/java/li/cil/oc/api/driver/item/Processor.java b/src/api/java/li/cil/oc/api/driver/item/Processor.java deleted file mode 100755 index f222b66cc..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/Processor.java +++ /dev/null @@ -1,37 +0,0 @@ -package li.cil.oc.api.driver.item; - -import li.cil.oc.api.driver.Item; -import li.cil.oc.api.machine.Architecture; -import net.minecraft.item.ItemStack; - -/** - * Use this interface to implement item drivers extending the number of - * components a server can control. - *

- * Note that the item must be installed in the actual server's inventory to - * work. If it is installed in an external inventory the server will not - * recognize the memory. - */ -public interface Processor extends Item { - /** - * The additional number of components supported if this processor is - * installed in the server. - * - * @param stack the processor to get the number of supported components for. - * @return the number of additionally supported components. - */ - int supportedComponents(ItemStack stack); - - /** - * The architecture of this CPU. - *

- * This usually controls which architecture is created for a machine the - * CPU is installed in (this is true for all computers built into OC, such - * as computer cases, server racks and robots, it my not be true for third- - * party computers). - * - * @param stack the stack representing the CPU to get the architecture for. - * @return the type of this CPU's architecture. - */ - Class architecture(ItemStack stack); -} diff --git a/src/api/java/li/cil/oc/api/driver/item/Slot.java b/src/api/java/li/cil/oc/api/driver/item/Slot.java deleted file mode 100755 index bc631dc51..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/Slot.java +++ /dev/null @@ -1,23 +0,0 @@ -package li.cil.oc.api.driver.item; - -/** - * Reference list of slot types in OpenComputers. - */ -public final class Slot { - public static final String None = "none"; - public static final String Any = "any"; - - public static final String Card = "card"; - public static final String ComponentBus = "component_bus"; - public static final String Container = "container"; - public static final String CPU = "cpu"; - public static final String Floppy = "floppy"; - public static final String HDD = "hdd"; - public static final String Memory = "memory"; - public static final String RackMountable = "rack_mountable"; - public static final String Tablet = "tablet"; - public static final String Upgrade = "upgrade"; - - private Slot() { - } -} diff --git a/src/api/java/li/cil/oc/api/driver/item/UpgradeRenderer.java b/src/api/java/li/cil/oc/api/driver/item/UpgradeRenderer.java deleted file mode 100755 index 87bc9f1ad..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/UpgradeRenderer.java +++ /dev/null @@ -1,95 +0,0 @@ -package li.cil.oc.api.driver.item; - -import li.cil.oc.api.event.RobotRenderEvent; -import li.cil.oc.api.internal.Robot; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.util.Set; - -/** - * This interface can be implemented by items to allow custom rendering of - * upgrades installed in robots. - *

- * Upgrades installed in a robot can have an external representation. This is - * achieved by implementing this interface on an item that serves as a - * renderable upgrade. When the robot is rendered, each equipped upgrade is - * checked for this interface, and if present, the {@link #render} method - * is called. - *

- * Note that these methods are only ever called on the client side. - */ -public interface UpgradeRenderer { - /** - * Returns which mount point this renderer wants to render the specified - * upgrade in. - *

- * This method is used to determine which upgrade is rendered where, and is - * called for every installed, renderable upgrade. The available mount - * point names are defined in {@link MountPointName}, with the two special - * values None and Any. - *

- * None means that the upgrade should not be rendered at all. This - * can be the case when there is no slot remaining that the upgrade may be - * rendered in. Returning null is equivalent to returning None. - *

- * Any means that the upgrade doesn't really care where it's being - * rendered. Mount points not assigned by another upgrade preferring to be - * rendered in it will be assigned to such upgrades in the order they are - * installed in the robot. - *

- * Returning a mount point not in the list of available mount points will - * be equivalent to returning None. - * - * @param stack the item stack of the upgrade to render. - * @param robot the robot the upgrade is rendered on. - * @param availableMountPoints the mount points available for rendering in. - * @return the mount point to reserve for the upgrade. - */ - String computePreferredMountPoint(ItemStack stack, Robot robot, Set availableMountPoints); - - /** - * Render the specified upgrade on a robot. - *

- * The GL state has not been adjusted to the mount points position, so - * that you can perform rotations without having to revert the translation. - * It is your responsibility to position the rendered model to fit the - * specified mount point. The state will be such that the origin is the - * center of the robot. This is what the offset of the mount-point is - * relative to. - *

- * If the stack cannot be rendered, the renderer should indicate so in - * {@link #computePreferredMountPoint}, otherwise it will still consume a mount - * point. - *

- * You usually won't need the robot parameter, but in case you do - * need some contextual information, this should provide you with anything - * you could need. - * - * @param stack the item stack of the upgrade to render. - * @param mountPoint the mount-point to render the upgrade at. - * @param robot the robot the upgrade is rendered on. - * @param pt partial tick time, e.g. for animations. - */ - void render(ItemStack stack, RobotRenderEvent.MountPoint mountPoint, Robot robot, float pt); - - /** - * Mount point names for {@link #computePreferredMountPoint}. - */ - final class MountPointName { - public static final String None = "none"; - public static final String Any = "any"; - - public static final String TopLeft = "top_left"; - public static final String TopRight = "top_right"; - public static final String TopBack = "top_back"; - public static final String BottomLeft = "bottom_left"; - public static final String BottomRight = "bottom_right"; - public static final String BottomBack = "bottom_back"; - public static final String BottomFront = "bottom_front"; - - private MountPointName() { - } - } -} diff --git a/src/api/java/li/cil/oc/api/driver/item/package-info.java b/src/api/java/li/cil/oc/api/driver/item/package-info.java deleted file mode 100755 index 24a730120..000000000 --- a/src/api/java/li/cil/oc/api/driver/item/package-info.java +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This package contains item driver related interfaces. - *

- * These interfaces allow specializing item drivers to provide static data, - * that is without creating an actual environment. - */ -@net.minecraftforge.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Driver|Item", - apiVersion = API.VERSION) -package li.cil.oc.api.driver.item; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/driver/package-info.java b/src/api/java/li/cil/oc/api/driver/package-info.java deleted file mode 100755 index 7a3ee423c..000000000 --- a/src/api/java/li/cil/oc/api/driver/package-info.java +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This package contains driver related interfaces. - *

- * Drivers are used to add items and third party blocks to the internal network, - * which is mostly used to make components wrapping them available to computers. - */ -@net.minecraftforge.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Driver", - apiVersion = API.VERSION) -package li.cil.oc.api.driver; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/event/FileSystemAccessEvent.java b/src/api/java/li/cil/oc/api/event/FileSystemAccessEvent.java deleted file mode 100755 index 4a649f7ea..000000000 --- a/src/api/java/li/cil/oc/api/event/FileSystemAccessEvent.java +++ /dev/null @@ -1,175 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.network.Node; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.fml.common.eventhandler.Cancelable; -import net.minecraftforge.fml.common.eventhandler.Event; - -/** - * Events for handling file system access and representing it on the client. - *

- * This is used to play file system access sounds and render disk activity - * indicators on some containers (e.g. disk drive, computer, server). - *

- * Use this to implement rendering of disk access indicators on you own - * containers / computers / drive bays. - *

- * Canceling this event is provided to allow registering higher priority - * event handlers that override default behavior. - */ -@Cancelable -public class FileSystemAccessEvent extends Event { - protected String sound; - - protected World world; - - protected double x; - - protected double y; - - protected double z; - - protected TileEntity tileEntity; - - protected NBTTagCompound data; - - /** - * Constructor for tile entity hosted file systems. - * - * @param sound the name of the sound effect to play. - * @param tileEntity the tile entity hosting the file system. - * @param data the additional data. - */ - protected FileSystemAccessEvent(String sound, TileEntity tileEntity, NBTTagCompound data) { - this.sound = sound; - this.world = tileEntity.getWorld(); - this.x = tileEntity.getPos().getX() + 0.5; - this.y = tileEntity.getPos().getY() + 0.5; - this.z = tileEntity.getPos().getZ() + 0.5; - this.tileEntity = tileEntity; - this.data = data; - } - - /** - * Constructor for arbitrarily hosted file systems. - * - * @param sound the name of the sound effect to play. - * @param world the world the file system lives in. - * @param x the x coordinate of the file system's container. - * @param y the y coordinate of the file system's container. - * @param z the z coordinate of the file system's container. - * @param data the additional data. - */ - protected FileSystemAccessEvent(String sound, World world, double x, double y, double z, NBTTagCompound data) { - this.sound = sound; - this.world = world; - this.x = x; - this.y = y; - this.z = z; - this.tileEntity = null; - this.data = data; - } - - /** - * The name of the sound effect to play for the file system. - */ - public String getSound() { - return sound; - } - - /** - * The world the file system lives in. - */ - public World getWorld() { - return world; - } - - /** - * The x coordinate of the file system's container. - */ - public double getX() { - return x; - } - - /** - * The y coordinate of the file system's container. - */ - public double getY() { - return y; - } - - /** - * The z coordinate of the file system's container. - */ - public double getZ() { - return z; - } - - /** - * The tile entity hosting the file system. - *

- * Important: this can be null, which is usually the - * case when the container is an entity or item. - */ - public TileEntity getTileEntity() { - return tileEntity; - } - - /** - * Addition custom data, this is used to transmit the number of the server - * in a server rack the file system lives in, for example. - */ - public NBTTagCompound getData() { - return data; - } - - public static final class Server extends FileSystemAccessEvent { - private Node node; - - public Server(String sound, TileEntity tileEntity, Node node) { - super(sound, tileEntity, new NBTTagCompound()); - this.node = node; - } - - public Server(String sound, World world, double x, double y, double z, Node node) { - super(sound, world, x, y, z, new NBTTagCompound()); - this.node = node; - } - - /** - * The node of the file system that signalled activity. - */ - public Node getNode() { - return node; - } - } - - public static final class Client extends FileSystemAccessEvent { - /** - * Constructor for tile entity hosted file systems. - * - * @param sound the name of the sound effect to play. - * @param tileEntity the tile entity hosting the file system. - * @param data the additional data. - */ - public Client(String sound, TileEntity tileEntity, NBTTagCompound data) { - super(sound, tileEntity, data); - } - - /** - * Constructor for arbitrarily hosted file systems. - * - * @param sound the name of the sound effect to play. - * @param world the world the file system lives in. - * @param x the x coordinate of the file system's container. - * @param y the y coordinate of the file system's container. - * @param z the z coordinate of the file system's container. - * @param data the additional data. - */ - public Client(String sound, World world, double x, double y, double z, NBTTagCompound data) { - super(sound, world, x, y, z, data); - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/GeolyzerEvent.java b/src/api/java/li/cil/oc/api/event/GeolyzerEvent.java deleted file mode 100755 index 1dc586556..000000000 --- a/src/api/java/li/cil/oc/api/event/GeolyzerEvent.java +++ /dev/null @@ -1,118 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.network.EnvironmentHost; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fml.common.eventhandler.Cancelable; -import net.minecraftforge.fml.common.eventhandler.Event; - -import java.util.HashMap; -import java.util.Map; - -/** - * This event is fired by the geolyzer block/upgrade. - *

- * When cancelling this event, the respective method will bail and report - * that the operation failed. - */ -@Cancelable -public abstract class GeolyzerEvent extends Event { - /** - * The container of the geolyzer component. This can either be the - * geolyzer block, or something with the geolyzer upgrade (a robot). - */ - public final EnvironmentHost host; - - /** - * The options the operation was invoked with. - */ - public final Map options; - - protected GeolyzerEvent(EnvironmentHost host, Map options) { - this.host = host; - this.options = options; - } - - /** - * Long-distance scan, getting quantified information about blocks around - * the geolyzer. By default this will yield a (noisy) listing of the - * hardness of the blocks. - *

- * The bounds are guaranteed to not define a volume larger than 64. - * Resulting data should be written to the {@link #data} array such that - * index = x + z*w + y*w*d, with w = maxX - minX - * and d = maxZ - minZ (h meaning height, d - * meaning depth). - */ - public static class Scan extends GeolyzerEvent { - /** - * The relative minimal x coordinate of the box being scanned (inclusive). - */ - public final int minX; - - /** - * The relative minimal y coordinate of the box being scanned (inclusive). - */ - public final int minY; - - /** - * The relative minimal z coordinate of the box being scanned (inclusive). - */ - public final int minZ; - - /** - * The relative maximal x coordinate of the box being scanned (inclusive). - */ - public final int maxX; - - /** - * The relative maximal y coordinate of the box being scanned (inclusive). - */ - public final int maxY; - - /** - * The relative maximal z coordinate of the box being scanned (inclusive). - */ - public final int maxZ; - - /** - * The data for the column of blocks being scanned, which is an - * interval around the geolyzer itself, with the geolyzer block - * being at index 32. - */ - public final float[] data = new float[64]; - - public Scan(EnvironmentHost host, Map options, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { - super(host, options); - this.minX = minX; - this.minY = minY; - this.minZ = minZ; - this.maxX = maxX; - this.maxY = maxY; - this.maxZ = maxZ; - } - } - - /** - * Zero-range scan, getting in-depth information about blocks directly - * adjacent to the geolyzer. By default this will yield the block's - * name, metadata, hardness and harvest information. - */ - public static class Analyze extends GeolyzerEvent { - /** - * The position of the block to scan. - *

- * Note: get the world via the host if you need it. - */ - public final BlockPos pos; - - /** - * The retrieved data for the block being scanned. - */ - public final Map data = new HashMap(); - - public Analyze(EnvironmentHost host, Map options, BlockPos pos) { - super(host, options); - this.pos = pos; - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/NetworkActivityEvent.java b/src/api/java/li/cil/oc/api/event/NetworkActivityEvent.java deleted file mode 100755 index 918f31fe6..000000000 --- a/src/api/java/li/cil/oc/api/event/NetworkActivityEvent.java +++ /dev/null @@ -1,158 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.network.Node; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.fml.common.eventhandler.Event; - -/** - * Events for handling network activity and representing it on the client. - *

- * This is used to render network activity - * indicators on some containers (e.g. computer, server). - *

- * Use this to implement rendering of disk access indicators on you own - * containers / computers / drive bays. - *

- * Canceling this event is provided to allow registering higher priority - * event handlers that override default behavior. - */ -public class NetworkActivityEvent extends Event { - protected World world; - - protected double x; - - protected double y; - - protected double z; - - protected TileEntity tileEntity; - - protected NBTTagCompound data; - - /** - * Constructor for tile entity hosted network cards. - * - * @param tileEntity the tile entity hosting the network card. - * @param data the additional data. - */ - protected NetworkActivityEvent(TileEntity tileEntity, NBTTagCompound data) { - this.world = tileEntity.getWorld(); - this.x = tileEntity.getPos().getX() + 0.5; - this.y = tileEntity.getPos().getY() + 0.5; - this.z = tileEntity.getPos().getZ() + 0.5; - this.tileEntity = tileEntity; - this.data = data; - } - - /** - * Constructor for arbitrarily hosted network cards. - * - * @param world the world the network card lives in. - * @param x the x coordinate of the network card's container. - * @param y the y coordinate of the network card's container. - * @param z the z coordinate of the network card's container. - * @param data the additional data. - */ - protected NetworkActivityEvent(World world, double x, double y, double z, NBTTagCompound data) { - this.world = world; - this.x = x; - this.y = y; - this.z = z; - this.tileEntity = null; - this.data = data; - } - - /** - * The world the network card lives in. - */ - public World getWorld() { - return world; - } - - /** - * The x coordinate of the network card's container. - */ - public double getX() { - return x; - } - - /** - * The y coordinate of the network card's container. - */ - public double getY() { - return y; - } - - /** - * The z coordinate of the network card's container. - */ - public double getZ() { - return z; - } - - /** - * The tile entity hosting the network card. - *

- * Important: this can be null, which is usually the - * case when the container is an entity or item. - */ - public TileEntity getTileEntity() { - return tileEntity; - } - - /** - * Addition custom data, this is used to transmit the number of the server - * in a server rack the network card lives in, for example. - */ - public NBTTagCompound getData() { - return data; - } - - public static final class Server extends NetworkActivityEvent { - private Node node; - - public Server(TileEntity tileEntity, Node node) { - super(tileEntity, new NBTTagCompound()); - this.node = node; - } - - public Server(World world, double x, double y, double z, Node node) { - super(world, x, y, z, new NBTTagCompound()); - this.node = node; - } - - /** - * The node of the network card that signalled activity. - */ - public Node getNode() { - return node; - } - } - - public static final class Client extends NetworkActivityEvent { - /** - * Constructor for tile entity hosted network card. - * - * @param tileEntity the tile entity hosting the network card. - * @param data the additional data. - */ - public Client(TileEntity tileEntity, NBTTagCompound data) { - super(tileEntity, data); - } - - /** - * Constructor for arbitrarily hosted network card. - * - * @param world the world the file system lives in. - * @param x the x coordinate of the network card's container. - * @param y the y coordinate of the network card's container. - * @param z the z coordinate of the network card's container. - * @param data the additional data. - */ - public Client(World world, double x, double y, double z, NBTTagCompound data) { - super(world, x, y, z, data); - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/RackMountableRenderEvent.java b/src/api/java/li/cil/oc/api/event/RackMountableRenderEvent.java deleted file mode 100755 index 2c3a8c6c0..000000000 --- a/src/api/java/li/cil/oc/api/event/RackMountableRenderEvent.java +++ /dev/null @@ -1,182 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.component.RackMountable; -import li.cil.oc.api.internal.Rack; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.VertexBuffer; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.common.eventhandler.Cancelable; -import net.minecraftforge.fml.common.eventhandler.Event; -import org.lwjgl.opengl.GL11; - -/** - * Fired to allow rendering a custom overlay for {@link li.cil.oc.api.component.RackMountable}s. - *

- * When this event is fired, the GL state is set up such that the origin is - * the top left corner of the mountable the event was fired for. It's the - * event handler's responsibility to not render outside the are of the - * mountable (unless that's explicitly what they're going for, of course). - */ -public abstract class RackMountableRenderEvent extends Event { - /** - * The rack that house the mountable this event is fired for. - */ - public final Rack rack; - - /** - * The index of the mountable in the rack the event is fired for. - */ - public final int mountable; - - /** - * Some additional data made available by the mountable. May be null. - * - * @see RackMountable#getData() - */ - public final NBTTagCompound data; - - public RackMountableRenderEvent(Rack rack, int mountable, NBTTagCompound data) { - this.rack = rack; - this.mountable = mountable; - this.data = data; - } - - /** - * Fired when the static rack model is rendered. - *

- * Code here runs inside a ISimpleBlockRenderingHandler, so functionality - * is limited to what's possible in there. This is primarily meant to allow setting - * a custom override texture (renderer.setOverrideBlockTexture) for the - * mountables front. - *

- * The bounds will be set up before this call, so you may adjust those, if you wish. - */ - @Cancelable - public static class Block extends RackMountableRenderEvent { - /** - * The front-facing side, i.e. where the mountable is visible on the rack. - */ - public final EnumFacing side; - - /** - * Texture to use for the front of the mountable. - */ - private TextureAtlasSprite frontTextureOverride; - - public Block(final Rack rack, final int mountable, final NBTTagCompound data, final EnumFacing side) { - super(rack, mountable, data); - this.side = side; - } - - /** - * The texture currently set to use for the front of the mountable, or null. - */ - public TextureAtlasSprite getFrontTextureOverride() { - return frontTextureOverride; - } - - /** - * Set the texture to use for the front of the mountable. - * - * @param texture the texture to use. - */ - public void setFrontTextureOverride(final TextureAtlasSprite texture) { - frontTextureOverride = texture; - } - } - - /** - * Fired when the dynamic rack model is rendered. - *

- * Code here runs inside a TileEntitySpecialRenderer, so go nuts. This is - * primarily meant to allow rendering custom overlays, such as LEDs. The GL state - * will have been adjusted such that rendering a one by one quad starting at the - * origin will fill the full front face of the rack (i.e. rotation and translation - * have already been applied). - *

- * If you wish to have something glowing (like LEDs), you'll have to disable - * lighting yourself (and enable it again afterwards!). - *

- * Use the {@link #renderOverlay(ResourceLocation)} to render a slice from a - * texture in the vertical area occupied by the mountable. - */ - public static class TileEntity extends RackMountableRenderEvent { - /** - * The vertical low and high texture coordinates for the mountable's slot. - *

- * This is purely for convenience; they're computed as (2/16)+i*(3/16). - */ - public final float v0, v1; - - public TileEntity(final Rack rack, final int mountable, final NBTTagCompound data, final float v0, final float v1) { - super(rack, mountable, data); - this.v0 = v0; - this.v1 = v1; - } - - /** - * Utility method for rendering a texture as the front-side overlay. - * - * @param texture the texture to use to render the overlay. - */ - public void renderOverlay(final ResourceLocation texture) { - renderOverlay(texture, 0, 1); - } - - /** - * Utility method for rendering a texture as the front-side overlay - * over a specified horizontal area. - * - * @param texture the texture to use to render the overlay. - * @param u0 the lower end of the vertical area to render at. - * @param u1 the upper end of the vertical area to render at. - */ - public void renderOverlay(final ResourceLocation texture, final float u0, final float u1) { - Minecraft.getMinecraft().getTextureManager().bindTexture(texture); - final Tessellator t = Tessellator.getInstance(); - final VertexBuffer r = t.getBuffer(); - r.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); - r.pos(u0, v1, 0).tex(u0, v1).endVertex(); - r.pos(u1, v1, 0).tex(u1, v1).endVertex(); - r.pos(u1, v0, 0).tex(u1, v0).endVertex(); - r.pos(u0, v0, 0).tex(u0, v0).endVertex(); - t.draw(); - } - - /** - * Utility method for rendering an atlas texture as the front-side overlay. - * - * @param texture the atlas texture to use to render the overlay. - */ - public void renderOverlayFromAtlas(final ResourceLocation texture) { - renderOverlayFromAtlas(texture, 0, 1); - } - - /** - * Utility method for rendering an atlas texture as the front-side overlay - * over a specified horizontal area. - * - * @param texture the atlas texture to use to render the overlay. - * @param u0 the lower end of the vertical area to render at. - * @param u1 the upper end of the vertical area to render at. - */ - public void renderOverlayFromAtlas(final ResourceLocation texture, final float u0, final float u1) { - Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); - final TextureAtlasSprite icon = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(texture.toString()); - final Tessellator t = Tessellator.getInstance(); - final VertexBuffer r = t.getBuffer(); - r.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); - r.pos(u0, v1, 0).tex(icon.getInterpolatedU(u0 * 16), icon.getInterpolatedV(v1 * 16)).endVertex(); - r.pos(u1, v1, 0).tex(icon.getInterpolatedU(u1 * 16), icon.getInterpolatedV(v1 * 16)).endVertex(); - r.pos(u1, v0, 0).tex(icon.getInterpolatedU(u1 * 16), icon.getInterpolatedV(v0 * 16)).endVertex(); - r.pos(u0, v0, 0).tex(icon.getInterpolatedU(u0 * 16), icon.getInterpolatedV(v0 * 16)).endVertex(); - t.draw(); - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotAnalyzeEvent.java b/src/api/java/li/cil/oc/api/event/RobotAnalyzeEvent.java deleted file mode 100755 index b1497ab40..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotAnalyzeEvent.java +++ /dev/null @@ -1,21 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.internal.Agent; -import net.minecraft.entity.player.EntityPlayer; - -/** - * Fired when an analyzer is used on a robot. - *

- * Use this to echo additional information for custom components. - */ -public class RobotAnalyzeEvent extends RobotEvent { - /** - * The player that used the analyzer. - */ - public final EntityPlayer player; - - public RobotAnalyzeEvent(Agent agent, EntityPlayer player) { - super(agent); - this.player = player; - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotAttackEntityEvent.java b/src/api/java/li/cil/oc/api/event/RobotAttackEntityEvent.java deleted file mode 100755 index 55a750188..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotAttackEntityEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.internal.Agent; -import net.minecraft.entity.Entity; -import net.minecraftforge.fml.common.eventhandler.Cancelable; - -public class RobotAttackEntityEvent extends RobotEvent { - /** - * The entity that the robot will attack. - */ - public final Entity target; - - protected RobotAttackEntityEvent(Agent agent, Entity target) { - super(agent); - this.target = target; - } - - /** - * Fired when a robot is about to attack an entity. - *

- * Canceling this event will prevent the attack. - */ - @Cancelable - public static class Pre extends RobotAttackEntityEvent { - public Pre(Agent agent, Entity target) { - super(agent, target); - } - } - - /** - * Fired after a robot has attacked an entity. - */ - public static class Post extends RobotAttackEntityEvent { - public Post(Agent agent, Entity target) { - super(agent, target); - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotBreakBlockEvent.java b/src/api/java/li/cil/oc/api/event/RobotBreakBlockEvent.java deleted file mode 100755 index 5e11343aa..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotBreakBlockEvent.java +++ /dev/null @@ -1,78 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.internal.Agent; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.fml.common.eventhandler.Cancelable; - -public abstract class RobotBreakBlockEvent extends RobotEvent { - protected RobotBreakBlockEvent(Agent agent) { - super(agent); - } - - /** - * Fired when a robot is about to break a block. - *

- * Canceling this event will prevent the block from getting broken. - */ - @Cancelable - public static class Pre extends RobotBreakBlockEvent { - /** - * The world in which the block will be broken. - */ - public final World world; - - /** - * The coordinates at which the block will be broken. - */ - public final BlockPos pos; - - /** - * The time it takes to break the block. - */ - private double breakTime; - - public Pre(Agent agent, World world, BlockPos pos, double breakTime) { - super(agent); - this.world = world; - this.pos = pos; - this.breakTime = breakTime; - } - - /** - * Sets the time it should take the robot to break the block. - *

- * Note that the robot will still break the block instantly, but the - * robot's execution is paused for the specified amount of time. - * - * @param breakTime the time in seconds the break operation takes. - */ - public void setBreakTime(double breakTime) { - this.breakTime = Math.max(0.05, breakTime); - } - - /** - * Gets the time that it will take to break the block. - * - * @see #setBreakTime(double) - */ - public double getBreakTime() { - return breakTime; - } - } - - /** - * Fired after a robot broke a block. - */ - public static class Post extends RobotBreakBlockEvent { - /** - * The amount of experience the block that was broken generated (e.g. certain ores). - */ - public final double experience; - - public Post(Agent agent, double experience) { - super(agent); - this.experience = experience; - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotEvent.java b/src/api/java/li/cil/oc/api/event/RobotEvent.java deleted file mode 100755 index a8672a04b..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotEvent.java +++ /dev/null @@ -1,18 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.internal.Agent; -import net.minecraftforge.fml.common.eventhandler.Event; - -/** - * Base class for events generated by robots. - */ -public abstract class RobotEvent extends Event { - /** - * The robot for which this event was fired. - */ - public final Agent agent; - - protected RobotEvent(Agent agent) { - this.agent = agent; - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotExhaustionEvent.java b/src/api/java/li/cil/oc/api/event/RobotExhaustionEvent.java deleted file mode 100755 index ac906ef61..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotExhaustionEvent.java +++ /dev/null @@ -1,19 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.internal.Agent; - -/** - * Fired when a robot performed an action that would cause exhaustion for a - * player. Used for the experience upgrade, for example. - */ -public class RobotExhaustionEvent extends RobotEvent { - /** - * The amount of exhaustion that was generated. - */ - public final double exhaustion; - - public RobotExhaustionEvent(Agent agent, double exhaustion) { - super(agent); - this.exhaustion = exhaustion; - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotMoveEvent.java b/src/api/java/li/cil/oc/api/event/RobotMoveEvent.java deleted file mode 100755 index d1c8f7096..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotMoveEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.internal.Agent; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.fml.common.eventhandler.Cancelable; - -public abstract class RobotMoveEvent extends RobotEvent { - /** - * The direction in which the robot will be moving. - */ - public final EnumFacing direction; - - protected RobotMoveEvent(Agent agent, EnumFacing direction) { - super(agent); - this.direction = direction; - } - - /** - * Fired when a robot is about to move. - *

- * Canceling the event will prevent the robot from moving. - */ - @Cancelable - public static class Pre extends RobotMoveEvent { - public Pre(Agent agent, EnumFacing direction) { - super(agent, direction); - } - } - - /** - * Fired after a robot moved. - */ - public static class Post extends RobotMoveEvent { - public Post(Agent agent, EnumFacing direction) { - super(agent, direction); - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotPlaceBlockEvent.java b/src/api/java/li/cil/oc/api/event/RobotPlaceBlockEvent.java deleted file mode 100755 index 36cb5e60f..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotPlaceBlockEvent.java +++ /dev/null @@ -1,52 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.internal.Agent; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.fml.common.eventhandler.Cancelable; - -public abstract class RobotPlaceBlockEvent extends RobotEvent { - /** - * The item that is used to place the block. - */ - public final ItemStack stack; - - /** - * The world in which the block will be placed. - */ - public final World world; - - /** - * The coordinates at which the block will be placed. - */ - public final BlockPos pos; - - protected RobotPlaceBlockEvent(Agent agent, ItemStack stack, World world, BlockPos pos) { - super(agent); - this.stack = stack; - this.world = world; - this.pos = pos; - } - - /** - * Fired when a robot is about to place a block. - *

- * Canceling this event will prevent the block from being placed. - */ - @Cancelable - public static class Pre extends RobotPlaceBlockEvent { - public Pre(Agent agent, ItemStack stack, World world, BlockPos pos) { - super(agent, stack, world, pos); - } - } - - /** - * Fired after a robot placed a block. - */ - public static class Post extends RobotPlaceBlockEvent { - public Post(Agent agent, ItemStack stack, World world, BlockPos pos) { - super(agent, stack, world, pos); - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotPlaceInAirEvent.java b/src/api/java/li/cil/oc/api/event/RobotPlaceInAirEvent.java deleted file mode 100755 index 81a4b8f18..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotPlaceInAirEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.internal.Agent; - -/** - * This event is fired when a robot tries to place a block and has no point of - * reference, i.e. the place would have to be placed in "thin air". Per default - * this fails (because players can't do this, either). - *

- * This is primarily intended for the 'Angel Upgrade', but it might be useful - * for other upgrades, too. - */ -public class RobotPlaceInAirEvent extends RobotEvent { - private boolean isAllowed = false; - - public RobotPlaceInAirEvent(Agent agent) { - super(agent); - } - - /** - * Whether the placement is allowed. Defaults to false. - */ - public boolean isAllowed() { - return isAllowed; - } - - /** - * Set whether the placement is allowed, can be used to allow robots to - * place blocks in thin air. - */ - public void setAllowed(boolean value) { - this.isAllowed = value; - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotRenderEvent.java b/src/api/java/li/cil/oc/api/event/RobotRenderEvent.java deleted file mode 100755 index 4b20d0364..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotRenderEvent.java +++ /dev/null @@ -1,81 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.driver.item.UpgradeRenderer; -import li.cil.oc.api.internal.Agent; -import li.cil.oc.api.internal.Robot; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.common.eventhandler.Cancelable; -import org.lwjgl.util.vector.Vector3f; -import org.lwjgl.util.vector.Vector4f; - -import java.util.Set; - -/** - * Fired directly before the robot's chassis is rendered. - *

- * If this event is canceled, the chassis will not be rendered. - * Component items' item renderers will still be invoked, at the possibly - * modified mount points. - *

- * Important: the robot instance may be null in this event, in - * case the render pass is for rendering the robot in an inventory. - */ -@Cancelable -public class RobotRenderEvent extends RobotEvent { - /** - * Points on the robot at which component models may be rendered. - *

- * By convention, components should be rendered in order of their slots, - * meaning that some components may not be rendered at all, if there are - * not enough mount points. - *

- * The equipped tool is rendered at a fixed position, this list does not - * contain a mount point for it. - */ - public final MountPoint[] mountPoints; - - public RobotRenderEvent(Agent agent, MountPoint[] mountPoints) { - super(agent); - this.mountPoints = mountPoints; - } - - /** - * Describes points on the robot model at which components are "mounted", - * i.e. where component models may be rendered. - */ - public static class MountPoint { - /** - * The position of the mount point, relative to the robot's center. - * For the purposes of this offset, the robot is always facing south, - * i.e. the positive Z axis is 'forward'. - *

- * Note that the rotation is applied before the translation. - */ - public final Vector3f offset = new Vector3f(0, 0, 0); - - /** - * The orientation of the mount point specified by the angle and the - * vector to rotate around. The rotation is applied in one - * GL11.glRotate() call. Note that the W component of the - * vector is the rotation. - *

- * Note that the rotation is applied before the translation. - */ - public final Vector4f rotation = new Vector4f(0, 0, 0, 0); - - /** - * The mount point's reference name. - *

- * This is what's used in {@link UpgradeRenderer#computePreferredMountPoint(ItemStack, Robot, Set)}. - */ - public final String name; - - public MountPoint() { - name = null; - } - - public MountPoint(String name) { - this.name = name; - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/RobotUsedToolEvent.java b/src/api/java/li/cil/oc/api/event/RobotUsedToolEvent.java deleted file mode 100755 index d907379ac..000000000 --- a/src/api/java/li/cil/oc/api/event/RobotUsedToolEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -package li.cil.oc.api.event; - -import li.cil.oc.api.internal.Agent; -import net.minecraft.item.ItemStack; - -public class RobotUsedToolEvent extends RobotEvent { - /** - * The tool that was used, before and after use. - */ - public final ItemStack toolBeforeUse, toolAfterUse; - - protected double damageRate; - - protected RobotUsedToolEvent(Agent agent, ItemStack toolBeforeUse, ItemStack toolAfterUse, double damageRate) { - super(agent); - this.toolBeforeUse = toolBeforeUse; - this.toolAfterUse = toolAfterUse; - this.damageRate = damageRate; - } - - /** - * The rate at which the used tool should lose durability, where one means - * it loses durability at full speed, zero means it doesn't lose durability - * at all. - *

- * This value is in an interval of [0, 1]. - */ - public double getDamageRate() { - return damageRate; - } - - /** - * Fired when a robot used a tool and is about to apply the damage rate to - * partially undo the durability loss. This step is used to compute the - * rate at which the tool should lose durability, which is used by the - * experience upgrade, for example. - */ - public static class ComputeDamageRate extends RobotUsedToolEvent { - public ComputeDamageRate(Agent agent, ItemStack toolBeforeUse, ItemStack toolAfterUse, double damageRate) { - super(agent, toolBeforeUse, toolAfterUse, damageRate); - } - - /** - * Set the rate at which the tool actually gets damaged. - *

- * This will be clamped to an iterval of [0, 1]. - * - * @param damageRate the new damage rate. - */ - public void setDamageRate(double damageRate) { - this.damageRate = Math.max(0, Math.min(1, damageRate)); - } - } - - /** - * Fired when a robot used a tool and the previously fired damage rate - * computation returned a value smaller than one. The callbacks of this - * method are responsible for applying the inverse damage the tool took. - * The toolAfterUse item stack represents the actual tool, any - * changes must be applied to that variable. The toolBeforeUse - * item stack is passed for reference, to compute the actual amount of - * durability that was lost. This may be required for tools where the - * durability is stored in the item's NBT tag. - */ - public static class ApplyDamageRate extends RobotUsedToolEvent { - public ApplyDamageRate(Agent agent, ItemStack toolBeforeUse, ItemStack toolAfterUse, double damageRate) { - super(agent, toolBeforeUse, toolAfterUse, damageRate); - } - } -} diff --git a/src/api/java/li/cil/oc/api/event/package-info.java b/src/api/java/li/cil/oc/api/event/package-info.java deleted file mode 100755 index 7fe9fe75e..000000000 --- a/src/api/java/li/cil/oc/api/event/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Events dispatched by OpenComputers to allow other mods to hook into some - * of its functionality. - */ -@net.minecraftforge.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Event", - apiVersion = API.VERSION) -package li.cil.oc.api.event; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/fs/FileSystem.java b/src/api/java/li/cil/oc/api/fs/FileSystem.java deleted file mode 100755 index a9af47466..000000000 --- a/src/api/java/li/cil/oc/api/fs/FileSystem.java +++ /dev/null @@ -1,246 +0,0 @@ -package li.cil.oc.api.fs; - -import li.cil.oc.api.Persistable; - -import java.io.FileNotFoundException; - -/** - * Interface for file system driver compatible file systems. - *

- * See {@link li.cil.oc.api.FileSystem} for factory methods. - *

- * Note that all paths passed here are assumed to be absolute in the underlying - * file system implementation, meaning they do not contain any "." or "..", and - * are relative to the root of the file system. When wrapping a file system in - * a node with the provided factory functions this is automatically ensured. If - * you call any of the functions of a file system directly it is your - * responsibility to ensure the path has been cleaned up. - */ -public interface FileSystem extends Persistable { - /** - * Whether this file system is read-only. - *

- * This is used to allow programs to check whether a file system can be - * written to without trying to open a file for writing. Note that this is - * merely used as an indicator. All mutating accessors should be implemented - * accordingly to enforce true read-only logic (i.e. {@link #open} should - * not allow opening files in write or append mode, {@link #makeDirectory} - * and such should do nothing/return false/throw an exception). - */ - boolean isReadOnly(); - - /** - * The total storage capacity of the file system, in bytes. - *

- * For read-only systems this should return zero, for writable file systems - * that do not enforce a storage limit this should be a negative value. - * - * @return the total storage space of this file system. - */ - long spaceTotal(); - - /** - * The used storage capacity of the file system, in bytes. - * - * @return the used storage space of this file system. - */ - long spaceUsed(); - - // ----------------------------------------------------------------------- // - - /** - * Tests if a file or directory exists at the specified path. - *

- * This function should never throw. - * - * @param path the path to check at. - * @return true if the path points to a file or directory; - * false otherwise. - */ - boolean exists(String path); - - /** - * Gets the size of a file. - *

- * For files this should return the actual length of the file, in bytes. For - * folders this should return zero. - *

- * If the path is invalid this should return zero. It should never throw. - * - * @param path the path to get the size for. - * @return the size of the object at the specified path. - */ - long size(String path); - - /** - * Tests whether the object at the specified path is a directory. - *

- * If the path is invalid (i.e. there is neither a file nor a directory at - * the specified location) this should also return false. It should never - * throw. - * - * @param path the path to the object to check. - * @return true if the object is a directory; false otherwise. - */ - boolean isDirectory(String path); - - /** - * Gets the timestamp of the last time the file at the specified path was - * written to. - *

- * For folders this should be the time they were created. - *

- * If the path is invalid (i.e. there is neither a file nor a directory at - * the specified location) this should return zero. It should never throw. - *

- * For read-only systems this may be zero for all queries. - * - * @param path the path to the object to get the last modified time of. - * @return the time the object was last modified. - */ - long lastModified(String path); - - /** - * Gets a list of all items in the specified folder. - *

- * This must return the actual object names in the specified parent folder, - * not their full path. For example, for a file at /home/test, when - * doing list("/home/") this should return ["test"], - * not ["/home/test"]. - *

- * Sub-folders should be returned with a trailing slash, to indicate that - * they are folders. - *

- * If the folder is empty this should return an empty array. - * - * @param path the path to the folder to get the contents of. - * @return an array with the names of all objects in that folder; - * null if the specified object does not exist or is not a - * folder. - */ - String[] list(String path); - - // ----------------------------------------------------------------------- // - - /** - * Deletes a file or folder. - *

- * This only has to support deleting single files and empty folders. If a - * directory is non-empty this may return false. If the target - * object does not exists it should return false. - *

- * This is only available for writable file systems. For read-only systems - * it should always return false. - * - * @param path the path to the object to delete. - * @return true if the object was successfully deleted; - * false otherwise. - */ - boolean delete(String path); - - /** - * Create the specified directory. - *

- * This should always only create a single directory. If the parent - * directory does not exists it should return false. If the target - * object already exists it should also return false. - *

- * This is only available for writable file systems. For read-only systems - * it should always return false. - * - * @param path the path to the directory to create. - * @return true if the directory was created; false otherwise. - */ - boolean makeDirectory(String path); - - /** - * Moves / renames a file or folder. - *

- * This is only available for writable file systems. For read-only systems - * it should always return false. - * - * @param from the name of the file or folder to move. - * @param to the location to move the file or folder to. - * @return true if the object was renamed; - * false otherwise. - * @throws FileNotFoundException if the source is not a file or folder. - */ - boolean rename(String from, String to) throws FileNotFoundException; - - /** - * Sets the time a file or folder was supposedly last modified. - *

- * This is not available to the user side via the file system driver. It is - * intended to be used when initializing a file system to a set of known - * modification times (for example, this is used when creating a virtual - * file system from a set of real files). - *

- * Read-only file systems may ignore this request. - * - * @param path the path of the object for which to set the modification time. - * @param time the time the object was supposedly last modified. - * @return true if the modification time was adjusted; - * false otherwise. - */ - boolean setLastModified(String path, long time); - - // ----------------------------------------------------------------------- // - - /** - * Opens a file for reading or writing. - *

- * This should create some internal handle to the file, based on the mode - * specified. A unique ID corresponding to that handle should be returned. - * This ID can be used in {@link #getHandle} to get an abstract wrapper for - * the handle, and to allow interaction with the file. - *

- * It is the responsibility of the file system to restore all handles to - * their previous state when it is reloaded (game loaded for example). - *

- * Important: you should return a random value as the handle, to - * reduce the chance for conflicts. For example, a file system may be used - * in a compound of file systems (e.g. for the ROM of machines), in which - * case it is essential that the handles from different sub file - * systems do not overlap. - * - * @param path the path to the file to open. - * @param mode the mode in which to open the file. - * @return the handle to the opened file. - * @throws FileNotFoundException if the object is not a file, or - * the file cannot be opened in the - * specified mode. - */ - int open(String path, Mode mode) throws FileNotFoundException; - - /** - * Gets a wrapper for a file previously opened using {@link #open}. - *

- * The wrapper allows interaction with the underlying file (stream) based - * on the mode it was opened in. See {@link Handle} for more details. - *

- * If there is no such handle, this should return null, but never - * throw. - * - * @param handle the ID of the handle to get the wrapper for. - * @return the wrapper for that handle ID; null if there is no - * handle with the specified ID. - */ - Handle getHandle(int handle); - - /** - * Called when the file system is destroyed. - *

- * This should close any open real file handles (e.g. all open I/O streams), - * but keep any internal state that may have to be persisted, for example - * for floppy disks (which are removed before they are saved so they don't - * save any open handles). - *

- * When the filesystem is made available as a network node created via - * one of the factory functions in {@link li.cil.oc.api.FileSystem} this - * will be called whenever the node is disconnected from its network. If - * the node was used to represent an item (which will be the usual use-case, - * I imagine) this means the item was removed from its container (e.g. hard - * drive from a computer) or the container was unloaded. - */ - void close(); -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/fs/Handle.java b/src/api/java/li/cil/oc/api/fs/Handle.java deleted file mode 100755 index 759ebbfda..000000000 --- a/src/api/java/li/cil/oc/api/fs/Handle.java +++ /dev/null @@ -1,66 +0,0 @@ -package li.cil.oc.api.fs; - -import java.io.IOException; - -/** - * Represents a handle to a file opened from a {@link FileSystem}. - */ -public interface Handle { - /** - * The current position in the file. - */ - long position(); - - /** - * The total length of the file. - */ - long length(); - - /** - * Closes the handle. - *

- * For example, if there is an underlying stream, this should close that - * stream. Any future calls to {@link #read} or {@link #write} should throw - * an IOException after this function was called. - */ - void close(); - - /** - * Tries to read as much data from the file as fits into the specified - * array. - *

- * For files opened in write or append mode this should always throw an - * exception. - * - * @param into the buffer to read the data into. - * @return the number of bytes read; -1 if there are no more bytes (EOF). - * @throws IOException if the file was opened in writing mode or an - * I/O error occurred or the file was already - * closed. - */ - int read(byte[] into) throws IOException; - - /** - * Jump to the specified position in the file, if possible. - *

- * For files opened in write or append mode this should always throw an - * exception. - * - * @param to the position in the file to jump to. - * @return the resulting position in the file. - * @throws IOException if the file was opened in write mode. - */ - long seek(long to) throws IOException; - - /** - * Tries to write all the data from the specified array into the file. - *

- * For files opened in read mode this should always throw an exception. - * - * @param value the data to write into the file. - * @throws IOException if the file was opened in read-only mode, or - * another I/O error occurred (no more space, - * for example), or the file was already closed. - */ - void write(byte[] value) throws IOException; -} diff --git a/src/api/java/li/cil/oc/api/fs/Label.java b/src/api/java/li/cil/oc/api/fs/Label.java deleted file mode 100755 index 4256c80ff..000000000 --- a/src/api/java/li/cil/oc/api/fs/Label.java +++ /dev/null @@ -1,31 +0,0 @@ -package li.cil.oc.api.fs; - -import li.cil.oc.api.Persistable; - -/** - * Used by file system components to get and set the file system's label. - * - * @see li.cil.oc.api.FileSystem#asManagedEnvironment - */ -public interface Label extends Persistable { - /** - * Get the current value of this label. - *

- * May be null if no label is set. - * - * @return the current label. - */ - String getLabel(); - - /** - * Set the new value of this label. - *

- * May be set to null to clear the label. - *

- * May throw an exception if the label is read-only. - * - * @param value the new label. - * @throws IllegalArgumentException if the label is read-only. - */ - void setLabel(String value); -} diff --git a/src/api/java/li/cil/oc/api/fs/Mode.java b/src/api/java/li/cil/oc/api/fs/Mode.java deleted file mode 100755 index ef819f797..000000000 --- a/src/api/java/li/cil/oc/api/fs/Mode.java +++ /dev/null @@ -1,23 +0,0 @@ -package li.cil.oc.api.fs; - -/** - * Possible file modes. - *

- * This is used when opening files from a {@link FileSystem}. - */ -public enum Mode { - /** - * Open a file in reading mode. - */ - Read, - - /** - * Open a file in writing mode, overwriting existing contents. - */ - Write, - - /** - * Open a file in append mode, writing new data after existing contents. - */ - Append -} diff --git a/src/api/java/li/cil/oc/api/fs/package-info.java b/src/api/java/li/cil/oc/api/fs/package-info.java deleted file mode 100755 index d1e3c5f2f..000000000 --- a/src/api/java/li/cil/oc/api/fs/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This package contains interfaces used by the file system implementation. - *

- * This allows it to add custom file systems that will behave the same as the - * existing ones, particularly that can be used the same from a machine as any - * other. In the case of Lua, for example, this means it can be mounted like - * any other file system, and interacted with without further special handling. - *

- * You will usually not need to implement these interfaces! - *

- * Consider using the factory methods in {@link li.cil.oc.api.FileSystem} to - * create file systems and wrapper nodes for these file systems (i.e. nodes - * that can be added as component nodes to the network, so they can be used - * from computers). - */ -@net.minecraftforge.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|FileSystem", - apiVersion = API.VERSION) -package li.cil.oc.api.fs; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/internal/Adapter.java b/src/api/java/li/cil/oc/api/internal/Adapter.java deleted file mode 100755 index c4526ebc7..000000000 --- a/src/api/java/li/cil/oc/api/internal/Adapter.java +++ /dev/null @@ -1,30 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.network.Environment; -import net.minecraft.inventory.IInventory; - -/** - * This interface is implemented as a marker by adapters. - *

- * This is implemented by adapter tile entities, which also serve as its - * components' environment. That means you can use this to check for - * adapters by using either: - *

- *     if (tileEntity instanceof Adapter) {
- * 
- * or - *
- *     if (node.host() instanceof Adapter) {
- * 
- *

- * This can also be used by {@link li.cil.oc.api.driver.item.HostAware} item - * drivers to check if the provided environment class is an adapter by checking - * for assignability, which allows for items that make no sense in adapters to - * deny being placed into them, for example. - *

- * The only purpose is to allow identifying tile entities as adapters - * via the API, i.e. without having to link against internal classes. This - * also means that you should not implement this. - */ -public interface Adapter extends Environment, IInventory { -} diff --git a/src/api/java/li/cil/oc/api/internal/Agent.java b/src/api/java/li/cil/oc/api/internal/Agent.java deleted file mode 100755 index 6f78c196b..000000000 --- a/src/api/java/li/cil/oc/api/internal/Agent.java +++ /dev/null @@ -1,91 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.machine.MachineHost; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; - -import java.util.UUID; - -/** - * General marker interface for autonomous agents such as robots and drones. - */ -public interface Agent extends MachineHost, Rotatable { - /** - * The equipment inventory of this agent. - *

- * For example, for the robot this is the tool slot as well as slots - * provided by containers installed in the robot, if any. - *

- * If an agent has no equipment slots this will be a zero-sized inventory. - */ - IInventory equipmentInventory(); - - /** - * The main inventory of this agent, which it (usually) also can - * interact with on its own. - *

- * If an agent has no inventory slots this will be a zero-sized inventory. - */ - IInventory mainInventory(); - - /** - * Provides access to the tanks of the agent. - *

- * If an agent has no tanks this will be a zero-sized multi-tank. - */ - MultiTank tank(); - - /** - * Gets the index of the currently selected slot in the agent's inventory. - */ - int selectedSlot(); - - /** - * Set the index of the currently selected slot. - */ - void setSelectedSlot(int index); - - /** - * Get the index of the currently selected tank. - */ - int selectedTank(); - - /** - * Set the index of the currently selected tank. - */ - void setSelectedTank(int index); - - /** - * Returns the fake player used to represent the agent as an entity for - * certain actions that require one. - *

- * This will automatically be positioned and rotated to represent the - * agent's current position and rotation in the world. Use this to trigger - * events involving the agent that require a player entity. - *

- * Note that this may be the common OpenComputers fake player. - * - * @return the fake player for the agent. - */ - EntityPlayer player(); - - /** - * Get the name of this agent. - */ - String name(); - - /** - * Set the name of the agent. - */ - void setName(String name); - - /** - * The name of the player owning this agent, e.g. the player that placed it. - */ - String ownerName(); - - /** - * The UUID of the player owning this agent, e.g. the player that placed it. - */ - UUID ownerUUID(); -} diff --git a/src/api/java/li/cil/oc/api/internal/Case.java b/src/api/java/li/cil/oc/api/internal/Case.java deleted file mode 100755 index 22fc98da3..000000000 --- a/src/api/java/li/cil/oc/api/internal/Case.java +++ /dev/null @@ -1,22 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.machine.MachineHost; -import li.cil.oc.api.network.Environment; -import li.cil.oc.api.network.EnvironmentHost; -import net.minecraft.inventory.IInventory; - -/** - * This interface is implemented as a marker by computer cases. - *

- * This is implemented by computer case tile entities. That means you can - * use this to check for computer cases by using: - *

- *     if (tileEntity instanceof Case) {
- * 
- *

- * The only purpose is to allow identifying tile entities as computer cases - * via the API, i.e. without having to link against internal classes. This - * also means that you should not implement this. - */ -public interface Case extends Environment, EnvironmentHost, MachineHost, Colored, Rotatable, Tiered, IInventory { -} diff --git a/src/api/java/li/cil/oc/api/internal/Colored.java b/src/api/java/li/cil/oc/api/internal/Colored.java deleted file mode 100755 index 6e1d75a25..000000000 --- a/src/api/java/li/cil/oc/api/internal/Colored.java +++ /dev/null @@ -1,37 +0,0 @@ -package li.cil.oc.api.internal; - -/** - * This interface is implemented by tile entities that can be colored by - * players, such as screens, computer cases and cables. - *

- * Colors are in the common RRGGBB format. - *

- * This interface is not meant to be implemented, just used. - */ -public interface Colored { - /** - * Get the current color value. - * - * @return the current color value. - */ - int getColor(); - - /** - * Set the color value. - * - * @param value the new color value. - */ - void setColor(int value); - - /** - * Whether the color of the implementing object controls how it can connect - * to other objects. If this is true for both involved - * objects, silver/light gray objects connect to any other object, but - * objects of otherwise different color do not connect to each other. If - * this is false for either of the two objects, they may - * always connect to each other. - * - * @return whether the color influences this object's connectivity. - */ - boolean controlsConnectivity(); -} diff --git a/src/api/java/li/cil/oc/api/internal/Database.java b/src/api/java/li/cil/oc/api/internal/Database.java deleted file mode 100755 index ac9b66cf8..000000000 --- a/src/api/java/li/cil/oc/api/internal/Database.java +++ /dev/null @@ -1,57 +0,0 @@ -package li.cil.oc.api.internal; - -import net.minecraft.item.ItemStack; - -/** - * This interface is implemented by the database component. - *

- * This allows getting actual item stack instances as referenced by callers - * of other components' callbacks, without having to push a full representation - * of an item stacks' NBT data to the VM (which can be both a memory and a - * security issue). - *

- * To use this, you'll usually want to accept an address and either an index - * or a hash in your component's callback function, the address being that of - * a database component in the same network as your component. Alternatively - * you can omit requiring an address and just loop through the other nodes on - * the network to look for one those that have a Database as host. - */ -public interface Database { - /** - * The number of slots in this database. - */ - int size(); - - /** - * Get an item stack stored in the specified slot of this database. - *

- * This will return null if there is no entry for the specified - * slot. If there is an entry, this will return a copy of that - * item stack, so it is safe to modify the returned stack. - * - * @param slot the slot of the item stack. - * @return the item stack stored in that slot. - */ - ItemStack getStackInSlot(int slot); - - /** - * Set the contents of a slot in the database upgrade. - *

- * Use this to change the configuration of a database upgrade. - * - * @param slot the slot to configure. - * @param stack the stack to configure the slot to, null to clear. - */ - void setStackInSlot(int slot, ItemStack stack); - - /** - * Get an item stack with the specified hash stored in this database. - *

- * This will return a negative value if there is no entry with a matching - * hash. - * - * @param hash the hash of the item stack. - * @return the index of item stack with the specified hash. - */ - int findStackWithHash(String hash); -} diff --git a/src/api/java/li/cil/oc/api/internal/Drone.java b/src/api/java/li/cil/oc/api/internal/Drone.java deleted file mode 100755 index 45a9aba3d..000000000 --- a/src/api/java/li/cil/oc/api/internal/Drone.java +++ /dev/null @@ -1,42 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.network.EnvironmentHost; -import net.minecraft.util.math.Vec3d; - -/** - * This interface is implemented as a marker by drones. - *

- * This is implemented by drones entities. That means you can use this to check - * for drones by using: - *

- *     if (entity instanceof Drone) {
- * 
- *

- * The only purpose is to allow identifying entities as drones via the API, - * i.e. without having to link against internal classes. This also means - * that you should not implement this. - */ -public interface Drone extends Agent, EnvironmentHost, Rotatable, Tiered { - /** - * Get the current target coordinates of the drone. - */ - Vec3d getTarget(); - - /** - * Set the new target coordinates of the drone. - *

- * Note that the actual value used will use a reduced accuracy. This is - * to avoid jitter on the client and floating point inaccuracies to - * accumulate. - */ - void setTarget(Vec3d value); - - /** - * Get the drones velocity vector. - *

- * Note that this is really just the underlying entity's motionX/Y/Z, - * so you can cast this to {@link net.minecraft.entity.Entity} and use that - * instead, if you'd like. - */ - Vec3d getVelocity(); -} diff --git a/src/api/java/li/cil/oc/api/internal/Keyboard.java b/src/api/java/li/cil/oc/api/internal/Keyboard.java deleted file mode 100755 index 7fdbf325a..000000000 --- a/src/api/java/li/cil/oc/api/internal/Keyboard.java +++ /dev/null @@ -1,47 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.Persistable; -import li.cil.oc.api.network.Environment; -import net.minecraft.entity.player.EntityPlayer; - -/** - * This interface is implemented by the keyboard component, to allow more - * flexible use of it. - *

- * You can obtain an instance of the keyboard component via the item driver - * of the keyboard block, for example: - *

- *     final ItemStack stack = li.cil.oc.api.Items.get("keyboard").createItemStack(1);
- *     final Keyboard keyboard = (Keyboard) li.cil.oc.api.Driver.driverFor(stack).createEnvironment(stack, this);
- * 
- */ -public interface Keyboard extends Environment, Persistable { - /** - * Sets a custom usability override. - *

- * Instead of the default check, which is based on the component's owner's - * position, the specified callback will be queried for usability checks - * instead. - *

- * Pass null here to unset a previously set override. - * - * @param callback the usability checker to use. - */ - void setUsableOverride(UsabilityChecker callback); - - /** - * Contract interface that has to implemented for usability check overrides. - * - * @see #setUsableOverride(Keyboard.UsabilityChecker) - */ - interface UsabilityChecker { - /** - * Whether the specified keyboard is usable by the specified player. - * - * @param keyboard the keyboard to check for. - * @param player the player to check for. - * @return whether the keyboard is usable by the player. - */ - boolean isUsableByPlayer(Keyboard keyboard, EntityPlayer player); - } -} diff --git a/src/api/java/li/cil/oc/api/internal/Microcontroller.java b/src/api/java/li/cil/oc/api/internal/Microcontroller.java deleted file mode 100755 index 6a9fcff13..000000000 --- a/src/api/java/li/cil/oc/api/internal/Microcontroller.java +++ /dev/null @@ -1,21 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.network.EnvironmentHost; -import li.cil.oc.api.machine.MachineHost; -import li.cil.oc.api.network.Environment; - -/** - * This interface is implemented as a marker by microcontrollers. - *

- * This is implemented by microcontroller tile entities. That means you can - * use this to check for microcontrollers by using: - *

- *     if (tileEntity instanceof Microcontroller) {
- * 
- *

- * The only purpose is to allow identifying tile entities as microcontrollers - * via the API, i.e. without having to link against internal classes. This - * also means that you should not implement this. - */ -public interface Microcontroller extends Environment, EnvironmentHost, MachineHost, Rotatable, Tiered { -} diff --git a/src/api/java/li/cil/oc/api/internal/MultiTank.java b/src/api/java/li/cil/oc/api/internal/MultiTank.java deleted file mode 100755 index efaaed984..000000000 --- a/src/api/java/li/cil/oc/api/internal/MultiTank.java +++ /dev/null @@ -1,25 +0,0 @@ -package li.cil.oc.api.internal; - -import net.minecraftforge.fluids.IFluidTank; - -/** - * Implemented by objects with multiple internal tanks. - *

- * This is specifically for containers where the side does not matter when - * accessing the internal tanks, only the index of the tank; unlike with the - * {@link net.minecraftforge.fluids.IFluidHandler} interface. - */ -public interface MultiTank { - /** - * The number of tanks currently installed. - */ - int tankCount(); - - /** - * Get the installed fluid tank with the specified index. - * - * @param index the index of the tank to get. - * @return the tank with the specified index. - */ - IFluidTank getFluidTank(int index); -} diff --git a/src/api/java/li/cil/oc/api/internal/Rack.java b/src/api/java/li/cil/oc/api/internal/Rack.java deleted file mode 100755 index 46aa88d3b..000000000 --- a/src/api/java/li/cil/oc/api/internal/Rack.java +++ /dev/null @@ -1,64 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.component.RackMountable; -import li.cil.oc.api.network.EnvironmentHost; -import li.cil.oc.api.network.SidedEnvironment; -import net.minecraft.inventory.IInventory; -import net.minecraft.nbt.NBTTagCompound; - -/** - * This interface is implemented by the rack tile entity. - *

- * It particularly allows {@link RackMountable}s installed in the rack to flag - * themselves as having changed, so their data gets resent to clients. - *

- * Server racks do not serve as environment for the computer nodes of - * servers. That's what the {@link li.cil.oc.api.internal.Server}s are for, - * which are mountables that can be placed in the rack. - *

- * Another purpose is to allow identifying tile entities as racks via the API, - * i.e. without having to link against internal classes. This also means that - * you should not implement this. - */ -public interface Rack extends SidedEnvironment, EnvironmentHost, Rotatable, IInventory { - /** - * Determine the index of the specified mountable. - * - * @param mountable the mountable in this rack to get the index of. - * @return the index in the rack, or -1 if it's not in the rack. - */ - int indexOfMountable(RackMountable mountable); - - /** - * The mountable in the specified slot. - *

- * This can be null, for example when there is no mountable installed - * in that slot. - * - * @param slot the slot in which to get the mountable. - * @return the mountable currently hosted in the specified slot. - */ - RackMountable getMountable(int slot); - - /** - * Get the last data state provided by the mountable in the specified slot. - *

- * This is also available on the client. This may be null. - * - * @param slot the slot of the mountable to get the data for. - * @return the data of the mountable in that slot, or null. - */ - NBTTagCompound getMountableData(int slot); - - /** - * Mark the mountable in the specified slot as changed. - *

- * This will cause the mountable's {@link RackMountable#getData()} method - * to be called in the next tick and the updated data to be sent to the - * clients, where it can be used for state based rendering of the mountable - * for example. - * - * @param slot the slot of the mountable to queue for updating. - */ - void markChanged(int slot); -} diff --git a/src/api/java/li/cil/oc/api/internal/Robot.java b/src/api/java/li/cil/oc/api/internal/Robot.java deleted file mode 100755 index b618deadb..000000000 --- a/src/api/java/li/cil/oc/api/internal/Robot.java +++ /dev/null @@ -1,81 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.network.EnvironmentHost; -import li.cil.oc.api.network.Environment; -import net.minecraft.inventory.ISidedInventory; -import net.minecraftforge.fluids.IFluidHandler; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** - * This interface allows interaction with robots. - *

- * It is intended to be used by components when installed in a robot. In that - * case, the robot in question is the tile entity passed to item driver when - * asked to create the component's environment. - *

- * A robot's inventory contains component items and items in the actual - * inventory. The physical layout in the underlying 'real' inventory is as - * follows: - *

    - *
  • Tool
  • - *
  • equipmentInventory.getSizeInventory hot-swappable components.
  • - *
  • mainInventory.getSizeInventory internal inventory slots.
  • - *
  • componentCount hard-wired components.
  • - *
- * Note that there may be no hot-swappable (or even built-in) components or - * no inventory, depending on the configuration of the robot. The hard-wired - * components cannot be changed (removed/replaced). - *

- * This interface is not meant to be implemented, just used. - */ -public interface Robot extends Agent, Environment, EnvironmentHost, Tiered, ISidedInventory, IFluidHandler { - /** - * The number of built-in components in this robot. - */ - int componentCount(); - - /** - * Get the environment for the component in the specified slot. - *

- * This operates on the underlying, real inventory, as described in the - * comment on top of this class. - *

- * This will return null for slots that do not contain components, - * or components that do not have an environment (on the calling side). - * - * @param index the index of the slot from which to get the environment. - * @return the environment for that slot, or null. - */ - Environment getComponentInSlot(int index); - - /** - * Sends the state of the item in the specified slot to the client - * if it is an upgrade. - *

- * Use this to update the state of an upgrade in that slot for rendering - * purposes (e.g. this is used by the generator upgrade to update the - * active state so the renderer knows which texture to use). - *

- * This is necessary because inventories are not synchronized by default, - * only if a player is currently 'looking into' the inventory (opened the - * GUI of the inventory). - *

- * The component will be saved to its item's NBT tag compound, as it would - * be when the game is saved, and then the item is re-sent to the client. - * Keep the number of calls to this function low, since each call causes a - * network packet to be sent. - */ - void synchronizeSlot(int slot); - - /** - * This essentially returns whether the robot is currently running or not. - *

- * This is explicitly meant for client side use, to allow upgrade renderers - * to know whether to resume animations or not, based on whether the robot - * is currently powered on or not. - */ - @SideOnly(Side.CLIENT) - boolean shouldAnimate(); -} - diff --git a/src/api/java/li/cil/oc/api/internal/Rotatable.java b/src/api/java/li/cil/oc/api/internal/Rotatable.java deleted file mode 100755 index 68f1cab0e..000000000 --- a/src/api/java/li/cil/oc/api/internal/Rotatable.java +++ /dev/null @@ -1,61 +0,0 @@ -package li.cil.oc.api.internal; - -import net.minecraft.util.EnumFacing; - -/** - * This interface is implemented by the computer case and robot tile entities - * to allow item components to query the orientation of their host, i.e. to - * allow getting the facing of the tile entity passed to their drivers' - * {@link li.cil.oc.api.driver.Item#createEnvironment(net.minecraft.item.ItemStack, li.cil.oc.api.network.EnvironmentHost)} - * method. - *

- * This interface is not meant to be implemented, just used. - */ -public interface Rotatable { - /** - * The current facing of a tile entity implementing this interface. - *

- * Intended to be used to query the orientation of an item components' host. - * For example: - *

-     * class SomeDriver implements li.cil.oc.api.driver.Item {
-     *     // ...
-     *     ManagedEnvironment createEnvironment(ItemStack stack, TileEntity tileentity) {
-     *         if (tileentity instanceof Rotatable) {
-     *             ForgeDirection facing = ((Rotatable)tileentity).facing();
-     *             // Do something with facing.
-     *         }
-     *     }
-     * }
-     * 
- * - * @return the current facing. - */ - EnumFacing facing(); - - /** - * Converts a facing relative to the block's local coordinate - * system to a global orientation, using south as the standard - * orientation. - *

- * For example, if the block is facing east, calling this with south will - * return east, calling it with west will return south and so on. - * - * @param value the value to translate. - * @return the translated orientation. - */ - EnumFacing toGlobal(EnumFacing value); - - /** - * Converts a global orientation to a facing relative to the - * block's local coordinate system, using south as the standard - * orientation. - *

- * For example, if the block is facing east, calling this with south will - * return east, calling it with west will return north and so on. - * - * @param value the value to translate. - * @return the translated orientation. - */ - EnumFacing toLocal(EnumFacing value); -} diff --git a/src/api/java/li/cil/oc/api/internal/Server.java b/src/api/java/li/cil/oc/api/internal/Server.java deleted file mode 100755 index 8bf8ffac8..000000000 --- a/src/api/java/li/cil/oc/api/internal/Server.java +++ /dev/null @@ -1,34 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.component.RackMountable; -import li.cil.oc.api.machine.MachineHost; -import li.cil.oc.api.network.EnvironmentHost; - -/** - * This interface is implemented as a marker by servers in racks. - *

- * This is implemented by servers in server racks, which serve as their - * computer components' environment. That means you can use this to check for - * servers by using either: - *

- *     if (node.host() instanceof Server) {
- * 
- *

- * You can get a reference to a server either via the above cast, or via a - * {@link li.cil.oc.api.internal.Rack#getMountable(int)}. - *

- * The only purpose is to allow identifying node environments as servers - * via the API, i.e. without having to link against internal classes. This - * also means that you should not implement this. - */ -public interface Server extends EnvironmentHost, MachineHost, Tiered, RackMountable { - /** - * The server rack this server is in. - */ - Rack rack(); - - /** - * The slot of the server rack this server is in. - */ - int slot(); -} diff --git a/src/api/java/li/cil/oc/api/internal/Tablet.java b/src/api/java/li/cil/oc/api/internal/Tablet.java deleted file mode 100755 index e042685ac..000000000 --- a/src/api/java/li/cil/oc/api/internal/Tablet.java +++ /dev/null @@ -1,38 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.network.EnvironmentHost; -import li.cil.oc.api.machine.MachineHost; -import net.minecraft.entity.player.EntityPlayer; - -/** - * This interface is implemented as a marker by tablets. - *

- * This is implemented by the class containing tablets' logic implementation, - * which is not the tablet item! The tablet class serves as its - * computer components' environment. That means you can use this to check for - * tablets by using - *

- *     if (node.host() instanceof Tablet) {
- * 
- *

- * This can also be used by {@link li.cil.oc.api.driver.item.HostAware} item - * drivers to check if the provided environment class is a tablet by checking - * for assignability, which allows for items that make no sense in tablets to - * deny being placed into them in the assembler, for example. - *

- * The only purpose is to allow identifying tile entities as tablets - * via the API, i.e. without having to link against internal classes. This - * also means that you should not implement this. - */ -public interface Tablet extends EnvironmentHost, MachineHost, Rotatable { - /** - * Returns the player last holding the tablet. - *

- * Note that this value may change over the lifetime of a tablet instance. - * The player may also already have dropped the tablet - this value will - * not be set to null in that case! - * - * @return the player last holding the tablet. - */ - EntityPlayer player(); -} diff --git a/src/api/java/li/cil/oc/api/internal/TextBuffer.java b/src/api/java/li/cil/oc/api/internal/TextBuffer.java deleted file mode 100755 index 2c7d3bcc1..000000000 --- a/src/api/java/li/cil/oc/api/internal/TextBuffer.java +++ /dev/null @@ -1,608 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.Persistable; -import li.cil.oc.api.network.ManagedEnvironment; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** - * This interface implements functionality for displaying and manipulating - * text, like screens and robots. An implementation can be obtained via the - * screens' item driver. - *

- * This allows re-using the built-in screen logic in third-party code without - * access to the internals of OC. - *

- * To get an instance of the buffer component, use its item driver, e.g.: - *

- *     final ItemStack stack = li.cil.oc.api.Items.get("screen1").createItemStack(1);
- *     final TextBuffer buffer = (TextBuffer) li.cil.oc.api.Driver.driverFor(stack).createEnvironment(stack, this);
- * 
- */ -public interface TextBuffer extends ManagedEnvironment, Persistable { - /** - * Controls how much energy the buffer will consume per tick. - *

- * This is not necessarily the actual amount consumed per tick, - * instead it is a base value that cost is based on, incorporating a few - * other factors. This is the cost a tier one screen will consume if every - * character is lit (non-black). Larger buffers (i.e. buffers with a higher - * maximum resolution) cost proportionally more. - *

- * Note that this amount of energy is not necessarily subtracted each tick, - * instead every n ticks, n times the amount of energy it costs to run the - * buffer will be consumed, where n is configurable in the OC config. - *

- * This defaults to OC's built-in default value. - * - * @param value the base energy cost per tick. - * @see #getEnergyCostPerTick() - */ - void setEnergyCostPerTick(double value); - - /** - * Get the energy cost per tick. - * - * @return the base energy cost per tick. - * @see #setEnergyCostPerTick(double) - */ - double getEnergyCostPerTick(); - - /** - * Set whether the buffer is powered on. - *

- * For example, screens can be powered on and off by sending a redstone - * pulse into them, in addition to their component API. - * - * @param value whether the buffer should be on or not. - * @see #getPowerState() - */ - void setPowerState(boolean value); - - /** - * Get the current power state. - * - * @return whether the buffer is powered on. - * @see #setPowerState(boolean) - */ - boolean getPowerState(); - - /** - * Sets the maximum resolution supported by this buffer. - * - * @param width the maximum horizontal resolution, in characters. - * @param height the maximum vertical resolution, in characters. - */ - void setMaximumResolution(int width, int height); - - /** - * Get the maximum horizontal size of the buffer. - */ - int getMaximumWidth(); - - /** - * Get the maximum vertical size of the buffer. - */ - int getMaximumHeight(); - - /** - * Set the 'aspect ratio' of the buffer. - *

- * Not to be confused with the maximum resolution of the buffer, this - * refers to the 'physical' size of the buffer's container. For multi- - * block screens, for example, this is the number of horizontal and - * vertical blocks. - * - * @param width the horizontal size of the physical representation. - * @param height the vertical size of the physical representation. - */ - void setAspectRatio(double width, double height); - - /** - * Get the aspect ratio of the buffer. - *

- * Note that this is in fact width / height. - * - * @see #setAspectRatio(double, double) - */ - double getAspectRatio(); - - /** - * Set the buffer's active resolution. - * - * @param width the horizontal resolution. - * @param height the vertical resolution. - * @return true if the resolution changed. - */ - boolean setResolution(int width, int height); - - /** - * Get the current horizontal resolution. - * - * @see #setResolution(int, int) - */ - int getWidth(); - - /** - * Get the current vertical resolution. - * - * @see #setResolution(int, int) - */ - int getHeight(); - - /** - * Set the buffer's active viewport resolution. - *

- * This cannot exceed the current buffer resolution. - * - * @param width the horizontal resolution. - * @param height the vertical resolution. - * @return true if the resolution changed. - * @see #setResolution(int, int) - */ - boolean setViewport(int width, int height); - - /** - * Get the current horizontal viewport resolution. - * - * @see #setViewport(int, int) - */ - int getViewportWidth(); - - /** - * Get the current vertical viewport resolution. - * - * @see #setViewport(int, int) - */ - int getViewportHeight(); - - /** - * Sets the maximum color depth supported by this buffer. - *

- * Note that this is the maximum supported depth, lower depths - * will be supported, too. So when setting this to four bit, one bit will - * be supported, too. When setting this to eight bit, four and one bit - * will be supported, also. - * - * @param depth the maximum color depth of the buffer. - */ - void setMaximumColorDepth(ColorDepth depth); - - /** - * Get the maximum color depth supported. - */ - ColorDepth getMaximumColorDepth(); - - /** - * Set the active color depth for this buffer. - * - * @param depth the new color depth. - * @return true if the color depth changed. - */ - boolean setColorDepth(ColorDepth depth); - - /** - * Get the active color depth of this buffer. - */ - ColorDepth getColorDepth(); - - /** - * Set the color of the active color palette at the specified index. - *

- * This will error if the current depth does not have a palette (one bit). - * - * @param index the index at which to set the color. - * @param color the color to set for the specified index. - */ - void setPaletteColor(int index, int color); - - /** - * Get the color in the active color palette at the specified index. - *

- * This will error if the current depth does not have a palette (one bit). - * - * @param index the index at which to get the color. - * @return the color in the active palette at the specified index. - */ - int getPaletteColor(int index); - - /** - * Set the active foreground color, not using a palette. - * - * @param color the new foreground color. - * @see #setForegroundColor(int, boolean) - */ - void setForegroundColor(int color); - - /** - * Set the active foreground color. - *

- * If the value is not from the palette, the actually stored value may - * differ from the specified one, as it is converted to the buffer's - * current color depth. - *

- * For palette-only color formats (four bit) the best fit from the palette - * is chosen, if the value is not from the palette. - * - * @param color the color or palette index. - * @param isFromPalette trueif color specifies a palette index. - */ - void setForegroundColor(int color, boolean isFromPalette); - - /** - * The active foreground color. - */ - int getForegroundColor(); - - /** - * true if the foreground color is from the color palette, meaning - * the value returned from {@link #getForegroundColor()} is the color - * palette index. - */ - boolean isForegroundFromPalette(); - - /** - * Set the active background color, not using a palette. - * - * @param color the new background color. - * @see #setBackgroundColor(int, boolean) - */ - void setBackgroundColor(int color); - - /** - * Set the active background color. - *

- * If the value is not from the palette, the actually stored value may - * differ from the specified one, as it is converted to the buffer's - * current color depth. - *

- * For palette-only color formats (four bit) the best fit from the palette - * is chosen, if the value is not from the palette. - * - * @param color the color or palette index. - * @param isFromPalette trueif color specifies a palette index. - */ - void setBackgroundColor(int color, boolean isFromPalette); - - /** - * The active background color. - */ - int getBackgroundColor(); - - /** - * true if the background color is from the color palette, meaning - * the value returned from {@link #getBackgroundColor()} is the color - * palette index. - */ - boolean isBackgroundFromPalette(); - - /** - * Copy a portion of the text buffer. - *

- * This will copy the area's text and colors. - * - * @param column the starting horizontal index of the area to copy. - * @param row the starting vertical index of the area to copy. - * @param width the width of the area to copy. - * @param height the height of the area to copy. - * @param horizontalTranslation the horizontal offset, relative to the starting column to copy the are to. - * @param verticalTranslation the vertical offset, relative to the starting row to copy the are to. - */ - void copy(int column, int row, int width, int height, int horizontalTranslation, int verticalTranslation); - - /** - * Fill a portion of the text buffer. - *

- * This will set the area's colors to the currently active ones. - * - * @param column the starting horizontal index of the area to fill. - * @param row the starting vertical index of the area to fill. - * @param width the width of the area to fill. - * @param height the height of the area to fill. - * @param value the character to fill the area with. - */ - void fill(int column, int row, int width, int height, char value); - - /** - * Write a string into the text buffer. - *

- * This will apply the currently active colors to the changed area. - * - * @param column the starting horizontal index to write at. - * @param row the starting vertical index to write at. - * @param value the string to write. - * @param vertical true if the string should be written vertically instead of horizontally. - */ - void set(int column, int row, String value, boolean vertical); - - /** - * Get the character in the text buffer at the specified location. - * - * @param column the horizontal index. - * @param row the vertical index. - * @return the character at that index. - */ - char get(int column, int row); - - /** - * Get the foreground color of the text buffer at the specified location. - *

- * Important: this may be a palette index. - * - * @param column the horizontal index. - * @param row the vertical index. - * @return the foreground color at that index. - */ - int getForegroundColor(int column, int row); - - /** - * Whether the foreground color of the text buffer at the specified - * location if from the color palette. - * - * @param column the horizontal index. - * @param row the vertical index. - * @return whether the foreground at that index is from the palette. - */ - boolean isForegroundFromPalette(int column, int row); - - /** - * Get the background color of the text buffer at the specified location. - *

- * Important: this may be a palette index. - * - * @param column the horizontal index. - * @param row the vertical index. - * @return the background color at that index. - */ - int getBackgroundColor(int column, int row); - - /** - * Whether the background color of the text buffer at the specified - * location if from the color palette. - * - * @param column the horizontal index. - * @param row the vertical index. - * @return whether the background at that index is from the palette. - */ - boolean isBackgroundFromPalette(int column, int row); - - /** - * Overwrites a portion of the text in raw mode. - *

- * This will copy the given char array into the buffer, starting at the - * specified column and row. The array is expected to be indexed row- - * first, i.e. the first dimension is the vertical axis, the second - * the horizontal. - *

- * Important: this performs no checks as to whether something - * actually changed. It will always send the changed patch to clients. - * It will also not crop the specified array to the actually used range. - * In other words, this is not intended to be exposed as-is to user code, - * it should always be called with validated, and, as necessary, cropped - * values. - * - * @param column the horizontal index. - * @param row the vertical index. - * @param text the text to write. - */ - void rawSetText(int column, int row, char[][] text); - - /** - * Overwrites a portion of the foreground color information in raw mode. - *

- * This will convert the specified RGB data (in 0xRRGGBB format) - * to the internal, packed representation and copy it into the buffer, - * starting at the specified column and row. The array is expected to be - * indexed row-first, i.e. the first dimension is the vertical axis, the - * second the horizontal. - *

- * Important: this performs no checks as to whether something - * actually changed. It will always send the changed patch to clients. - * It will also not crop the specified array to the actually used range. - * In other words, this is not intended to be exposed as-is to user code, - * it should always be called with validated, and, as necessary, cropped - * values. - * - * @param column the horizontal index. - * @param row the vertical index. - * @param color the foreground color data to write. - */ - void rawSetForeground(int column, int row, int[][] color); - - /** - * Overwrites a portion of the background color information in raw mode. - *

- * This will convert the specified RGB data (in 0xRRGGBB format) - * to the internal, packed representation and copy it into the buffer, - * starting at the specified column and row. The array is expected to be - * indexed row-first, i.e. the first dimension is the vertical axis, the - * second the horizontal. - *

- * Important: this performs no checks as to whether something - * actually changed. It will always send the changed patch to clients. - * It will also not crop the specified array to the actually used range. - * In other words, this is not intended to be exposed as-is to user code, - * it should always be called with validated, and, as necessary, cropped - * values. - * - * @param column the horizontal index. - * @param row the vertical index. - * @param color the background color data to write. - */ - void rawSetBackground(int column, int row, int[][] color); - - // ----------------------------------------------------------------------- // - - /** - * Renders the text displayed on the buffer. - *

- * You are responsible for setting up the actual context and applying any - * transformations necessary to properly position and scale the text before - * calling this. The text should be rendered on a black background. - *

- * You can use this to either render the text in a GUI or in the world. - * - * @return true if the displayed content changed since the last - * call to this method. - */ - @SideOnly(Side.CLIENT) - boolean renderText(); - - /** - * The natural width of the rendered text. - *

- * This is the width of the complete text buffer, in pixels. In other - * words, this is the width of the buffer in chars times the actual width - * of a single char in pixels. - * - * @return the total width of the rendered buffer, in pixels. - */ - @SideOnly(Side.CLIENT) - int renderWidth(); - - /** - * The natural height of the rendered text. - *

- * This is the height of the complete text buffer, in pixels. In other - * words, this is the height of the buffer in chars times the actual height - * of a single char in pixels. - * - * @return the total height of the rendered buffer, in pixels. - */ - @SideOnly(Side.CLIENT) - int renderHeight(); - - /** - * Set whether the contents of the buffer should currently be rendered. - *

- * Note that this is automatically overwritten when the buffer's power - * state changes, i.e. when it runs out of power or gets back power. - * - * @param enabled whether the text buffer should be rendered. - */ - @SideOnly(Side.CLIENT) - void setRenderingEnabled(boolean enabled); - - /** - * Gets whether the contents of the buffer should currently be rendered. - * - * @see #setRenderingEnabled(boolean) - */ - @SideOnly(Side.CLIENT) - boolean isRenderingEnabled(); - - // ----------------------------------------------------------------------- // - - /** - * Signals a key down event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will trigger a message that will be picked up by - * keyboards, which will then cause a signal in attached machines. - * - * @param character the character of the pressed key. - * @param code the key code of the pressed key. - * @param player the player that pressed the key. Pass null on the client side. - */ - void keyDown(char character, int code, EntityPlayer player); - - /** - * Signals a key up event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will trigger a message that will be picked up by - * keyboards, which will then cause a signal in attached machines. - * - * @param character the character of the released key. - * @param code the key code of the released key. - * @param player the player that released the key. Pass null on the client side. - */ - void keyUp(char character, int code, EntityPlayer player); - - /** - * Signals a clipboard paste event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will trigger a message that will be picked up by - * keyboards, which will then cause a signal in attached machines. - * - * @param value the text that was pasted. - * @param player the player that pasted the text. Pass null on the client side. - */ - void clipboard(String value, EntityPlayer player); - - /** - * Signals a mouse button down event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will cause a signal in attached machines. - * - * @param x the horizontal coordinate of the mouse, in characters. - * @param y the vertical coordinate of the mouse, in characters. - * @param button the button of the mouse that was pressed. - * @param player the player that pressed the mouse button. Pass null on the client side. - */ - void mouseDown(double x, double y, int button, EntityPlayer player); - - /** - * Signals a mouse drag event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will cause a signal in attached machines. - * - * @param x the horizontal coordinate of the mouse, in characters. - * @param y the vertical coordinate of the mouse, in characters. - * @param button the button of the mouse that is pressed. - * @param player the player that moved the mouse. Pass null on the client side. - */ - void mouseDrag(double x, double y, int button, EntityPlayer player); - - /** - * Signals a mouse button release event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will cause a signal in attached machines. - * - * @param x the horizontal coordinate of the mouse, in characters. - * @param y the vertical coordinate of the mouse, in characters. - * @param button the button of the mouse that was released. - * @param player the player that released the mouse button. Pass null on the client side. - */ - void mouseUp(double x, double y, int button, EntityPlayer player); - - /** - * Signals a mouse wheel scroll event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will cause a signal in attached machines. - * - * @param x the horizontal coordinate of the mouse, in characters. - * @param y the vertical coordinate of the mouse, in characters. - * @param delta indicates the direction of the mouse scroll. - * @param player the player that scrolled the mouse wheel. Pass null on the client side. - */ - void mouseScroll(double x, double y, int delta, EntityPlayer player); - - // ----------------------------------------------------------------------- // - - /** - * Used when setting a buffer's maximum color depth. - */ - enum ColorDepth { - /** - * Monochrome color, black and white. - */ - OneBit, - - /** - * 16 color palette, defaults to Minecraft colors. - */ - FourBit, - - /** - * 240 colors, 16 color palette, defaults to grayscale. - */ - EightBit - } -} diff --git a/src/api/java/li/cil/oc/api/internal/Tiered.java b/src/api/java/li/cil/oc/api/internal/Tiered.java deleted file mode 100755 index 4e2cfc1c6..000000000 --- a/src/api/java/li/cil/oc/api/internal/Tiered.java +++ /dev/null @@ -1,18 +0,0 @@ -package li.cil.oc.api.internal; - -/** - * This is implemented by most things that are tiered in some way. - *

- * For example, this is implemented by screens, computer cases, robots and - * drones as well as microcontrollers. If you want you can add tier specific - * behavior this way. - */ -public interface Tiered { - /** - * The zero-based tier of this... thing. - *

- * For example, a tier one screen will return 0 here, a tier three screen - * will return 2. - */ - int tier(); -} diff --git a/src/api/java/li/cil/oc/api/internal/Wrench.java b/src/api/java/li/cil/oc/api/internal/Wrench.java deleted file mode 100755 index f1584824a..000000000 --- a/src/api/java/li/cil/oc/api/internal/Wrench.java +++ /dev/null @@ -1,29 +0,0 @@ -package li.cil.oc.api.internal; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -/** - * Implemented on items that are wrench-like tools. - */ -public interface Wrench { - /** - * Called when the wrench is used. - *

- * This is called in two scenarios, once when testing whether the wrench - * can be used on a certain block, in which case the simulate - * argument will be true, and once when actually used on a block, - * in which case the simulate argument will be false, - * allowing the tool to damage itself, for example. - *

- * This is usually called from blocks' activation logic. - * - * @param player the player using the tool - * @param world the world containing the block the wrench is used on. - * @param pos the position of the block. - * @param simulate whether to simulate the usage. - * @return whether the wrench can be used on the block. - */ - boolean useWrenchOnBlock(EntityPlayer player, World world, BlockPos pos, boolean simulate); -} diff --git a/src/api/java/li/cil/oc/api/internal/package-info.java b/src/api/java/li/cil/oc/api/internal/package-info.java deleted file mode 100755 index ad700a273..000000000 --- a/src/api/java/li/cil/oc/api/internal/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This package provides interfaces that are implemented by OC internal - * classes so that they can be checked for and used by type checking and - * casting to these interfaces. - *

- * For example, to determine whether a tile entity is a robot, you can - * do an instanceof with the {@link li.cil.oc.api.internal.Robot} - * interface - and cast to it if you wish to access some of the provided - * functionality. - *

- * The other main use-case is in {@link li.cil.oc.api.driver.item.HostAware} - * drivers, where these interfaces can be used to check if the item can be - * used inside the specified environment (where the environment class may - * be assignable to one of the interfaces in this package). - */ -@net.minecraftforge.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Internal", - apiVersion = API.VERSION) -package li.cil.oc.api.internal; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/machine/Architecture.java b/src/api/java/li/cil/oc/api/machine/Architecture.java deleted file mode 100755 index 0bf190b44..000000000 --- a/src/api/java/li/cil/oc/api/machine/Architecture.java +++ /dev/null @@ -1,183 +0,0 @@ -package li.cil.oc.api.machine; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import java.lang.annotation.*; - -/** - * This interface abstracts away any language specific details for the Machine. - *

- * This allows the introduction of other languages, e.g. computers that run - * assembly or some other language interpreter. The two architectures included - * in OpenComputers are the native Lua architecture (using native LuaC) and the - * Java Lua architecture (using LuaJ). - */ -public interface Architecture { - /** - * Used to check if the machine is fully initialized. If this is false no - * signals for detected components will be generated. Avoids duplicate - * signals if component_added signals are generated in the - * language's startup script, for already present components (see Lua's - * init.lua script). - *

- * This is also used to check whether limits on direct calls should be - * enforced or not - this allows a quick boot phase in the language's - * kernel logic before switching to business-as-usual. - * - * @return whether the machine is fully initialized. - */ - boolean isInitialized(); - - /** - * This is called when the amount of memory in the machine may have changed. - * This is usually triggered by the owner when its composition changes. For - * example this is called from computer cases' onInventoryChanged method. - *

- * The amount of memory should be computed from the list of components given. - * The architecture should immediately apply the new memory size - * - * @param components the components to use for computing the total memory. - * @return whether any memory is present at all. - */ - boolean recomputeMemory(Iterable components); - - /** - * Called when a machine starts up. Used to (re-)initialize the underlying - * architecture logic. For example, for Lua this creates a new Lua state. - *

- * This also sets up any built-in APIs for the underlying language, such as - * querying available memory, listing and interacting with components and so - * on. If this returns false the machine fails to start. - *

- * Note that the owning machine has not necessarily been connected to a - * network when this is called, in case this is called from the machine's - * load logic. Use {@link #onConnect()} for additional initialization that - * depends on a node network (such as connecting a ROM file system). - * - * @return whether the architecture was initialized successfully. - */ - boolean initialize(); - - /** - * Called when a machine stopped. Used to clean up any handles, memory and - * so on. For example, for Lua this destroys the Lua state. - */ - void close(); - - /** - * Performs a synchronized call initialized in a previous call to - * {@link #runThreaded(boolean)}. - *

- * This method is invoked from the main server thread, meaning it is safe - * to interact with the world without having to perform manual - * synchronization. - *

- * This method is expected to leave the architecture in a state so it is - * prepared to next be called with runThreaded(true). For example, - * the Lua architecture will leave the results of the synchronized call on - * the stack so they can be further processed in the next call to - * runThreaded. - */ - void runSynchronized(); - - /** - * Continues execution of the machine. The first call may be used to - * initialize the machine (e.g. for Lua we load the libraries in the first - * call so that the computers boot faster). After that the architecture - * should return true from {@link #isInitialized()}. - *

- * The resumed state is either a return from a synchronized call, when a - * synchronized call has been completed (via runSynchronized), or - * a normal yield in all other cases (sleep, interrupt, boot, ...). - *

- * This is expected to return within a very short time, usually. For example, - * in Lua this returns as soon as the state yields, and returns at the latest - * when the Settings.timeout is reached (in which case it forces the state - * to crash). - *

- * This is expected to consume a single signal if one is present and return. - * If returning from a synchronized call this should consume no signal. - * - * @param isSynchronizedReturn whether the architecture is resumed from an - * earlier synchronized call. In the case of - * Lua this means the results of the call are - * now on the stack, for example. - * @return the result of the execution. Used to determine the new state. - */ - ExecutionResult runThreaded(boolean isSynchronizedReturn); - - /** - * Called when a new signal is queued in the hosting {@link Machine}. - *

- * Depending on how you structure your architecture, you may not need this - * callback. For example, the Lua architectures simply pull the next signal - * from the queue whenever {@link #runThreaded} is called again. However, - * if you'd like to react to signals in a more timely manner, you can - * react to this while you are in a {@link #runThreaded} call, - * which is what it is intended to be used for. - *

- * Keep in mind that this may be called from any random thread, since - * {@link Context#signal} does not require being called from a specific - * thread. - */ - void onSignal(); - - /** - * Called when the owning machine was connected to the component network. - *

- * This can be useful for connecting custom file systems (read only memory) - * in case {@link #initialize()} was called from the machine's load logic - * (where it was not yet connected to the network). - */ - void onConnect(); - - /** - * Restores the state of this architecture as previously saved in - * {@link #save(NBTTagCompound)}. The architecture should be in the same - * state it was when it was saved after this, so it can be resumed from - * whatever state the owning machine was in when it was saved. - * - * @param nbt the tag compound to save to. - */ - void load(NBTTagCompound nbt); - - /** - * Saves the architecture for later restoration, e.g. across games or chunk - * unloads. Used to persist a machine's execution state. For native Lua this - * uses the Eris library to persist the main coroutine, for example. - *

- * Note that the tag compound is shared with the Machine. - * - * @param nbt the tag compound to save to. - */ - void save(NBTTagCompound nbt); - - /** - * Architectures can be annotated with this to provide a nice display name. - *

- * This is used when the name of an architecture has to be displayed to the - * user, such as when cycling architectures on a CPU. - */ - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.TYPE) - @interface Name { - String value(); - } - - /** - * Architectures flagged with this annotation can potentially run without - * any additional memory installed in the computer. - *

- * Use this to allow assembly of devices such as microcontrollers without - * any memory being installed in them while your architecture is being - * used by the CPU being installed. Note to actually make the machine - * start up you only need to always return true from - * {@link #recomputeMemory}. - */ - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.TYPE) - @Inherited - @interface NoMemoryRequirements { - } -} diff --git a/src/api/java/li/cil/oc/api/machine/Arguments.java b/src/api/java/li/cil/oc/api/machine/Arguments.java deleted file mode 100755 index a5a1c992c..000000000 --- a/src/api/java/li/cil/oc/api/machine/Arguments.java +++ /dev/null @@ -1,339 +0,0 @@ -package li.cil.oc.api.machine; - -import net.minecraft.item.ItemStack; - -import java.util.Map; - -/** - * This interface provides access to arguments passed to a {@link Callback}. - *

- * It allows checking for the presence of arguments in a uniform manner, taking - * care of proper type checking based on what can be passed along by Lua. - *

- * Note that integer values fetched this way are actually double values that - * have been truncated. So if a Lua program passes 1.9 and you do a - * checkInteger you'll get a 1. - *

- * The indexes passed to the various functions start at zero, i.e. to get the - * first argument you would use checkAny(0). This is worth mentioning - * because Lua starts its indexes at one. - */ -public interface Arguments extends Iterable { - /** - * The total number of arguments that were passed to the function. - */ - int count(); - - /** - * Get whatever is at the specified index. - *

- * Throws an error if there are too few arguments. - *

- * The returned object will be one of the following, based on the conversion - * performed internally: - *

    - *
  • null if the Lua value was nil.
  • - *
  • java.lang.Boolean if the Lua value was a boolean.
  • - *
  • java.lang.Double if the Lua value was a number.
  • - *
  • byte[] if the Lua value was a string.
  • - *
- * - * @param index the index from which to get the argument. - * @return the raw value at that index. - * @throws IllegalArgumentException if there is no argument at that index. - */ - Object checkAny(int index); - - /** - * Try to get a boolean value at the specified index. - *

- * Throws an error if there are too few arguments. - * - * @param index the index from which to get the argument. - * @return the boolean value at the specified index. - * @throws IllegalArgumentException if there is no argument at that index, - * or if the argument is not a boolean. - */ - boolean checkBoolean(int index); - - /** - * Try to get an integer value at the specified index. - *

- * Throws an error if there are too few arguments. - * - * @param index the index from which to get the argument. - * @return the integer value at the specified index. - * @throws IllegalArgumentException if there is no argument at that index, - * or if the argument is not a number. - */ - int checkInteger(int index); - - /** - * Try to get a double value at the specified index. - *

- * Throws an error if there are too few arguments. - * - * @param index the index from which to get the argument. - * @return the double value at the specified index. - * @throws IllegalArgumentException if there is no argument at that index, - * or if the argument is not a number. - */ - double checkDouble(int index); - - /** - * Try to get a string value at the specified index. - *

- * Throws an error if there are too few arguments. - *

- * This will actually check for a byte array and convert it to a string - * using UTF-8 encoding. - * - * @param index the index from which to get the argument. - * @return the boolean value at the specified index. - * @throws IllegalArgumentException if there is no argument at that index, - * or if the argument is not a string. - */ - String checkString(int index); - - /** - * Try to get a byte array at the specified index. - *

- * Throws an error if there are too few arguments. - * - * @param index the index from which to get the argument. - * @return the byte array at the specified index. - * @throws IllegalArgumentException if there is no argument at that index, - * or if the argument is not a byte array. - */ - byte[] checkByteArray(int index); - - /** - * Try to get a table at the specified index. - *

- * Throws an error if there are too few arguments. - * - * @param index the index from which to get the argument. - * @return the table at the specified index. - * @throws IllegalArgumentException if there is no argument at that index, - * or if the argument is not a table. - */ - Map checkTable(int index); - - /** - * Try to get an item stack representation at the specified index. - *

- * This is a utility method provided to convert tables to item stacks, with - * the tables being of a compatible format to that of tables generated by - * the built-in item stack converter. In particular, this takes care of - * restoring NBT data attached to the item stack. - *

- * Throws an error if there are too few arguments. - *

- * Important: usually you will not want to be using this. Some - * items require NBT information to fully describe them, and by default - * this information is not returned to underlying architectures when - * item stacks are returned from callbacks. This means the scripts can - * usually not provide this full information, so the roundtrip callback-> - * script->callback will be incomplete. - *

- * Instead, please make use of the {@link li.cil.oc.api.internal.Database} - * component to get complete item stack descriptors. - * - * @param index the index from which to get the argument. - * @return the item stack at the specified index. - */ - ItemStack checkItemStack(int index); - - /** - * Get whatever is at the specified index. - *

- * Return the specified default value if there is no such element, behaves - * like {@link #checkAny(int)} otherwise. - *

- * The returned object will be one of the following, based on the conversion - * performed internally: - *

    - *
  • null if the Lua value was nil.
  • - *
  • java.lang.Boolean if the Lua value was a boolean.
  • - *
  • java.lang.Double if the Lua value was a number.
  • - *
  • byte[] if the Lua value was a string.
  • - *
- * - * @param index the index from which to get the argument. - * @return the raw value at that index. - */ - Object optAny(int index, Object def); - - /** - * Try to get a boolean value at the specified index. - *

- * Return the specified default value if there is no such element, behaves - * like {@link #checkBoolean(int)} otherwise. - * - * @param index the index from which to get the argument. - * @return the boolean value at the specified index. - * @throws IllegalArgumentException if the argument exists and is not a boolean. - */ - boolean optBoolean(int index, boolean def); - - /** - * Try to get an integer value at the specified index. - *

- * Return the specified default value if there is no such element, behaves - * like {@link #checkInteger(int)} otherwise. - * - * @param index the index from which to get the argument. - * @return the integer value at the specified index. - * @throws IllegalArgumentException if the argument exists but is not a number. - */ - int optInteger(int index, int def); - - /** - * Try to get a double value at the specified index. - *

- * Return the specified default value if there is no such element, behaves - * like {@link #checkDouble(int)} otherwise. - * - * @param index the index from which to get the argument. - * @return the double value at the specified index. - * @throws IllegalArgumentException if the argument exists and is not a number. - */ - double optDouble(int index, double def); - - /** - * Try to get a string value at the specified index. - *

- * Return the specified default value if there is no such element, behaves - * like {@link #checkString(int)} otherwise. - *

- * This will actually check for a byte array and convert it to a string - * using UTF-8 encoding. - * - * @param index the index from which to get the argument. - * @return the boolean value at the specified index. - * @throws IllegalArgumentException if the argument exists and is not a string. - */ - String optString(int index, String def); - - /** - * Try to get a byte array at the specified index. - *

- * Return the specified default value if there is no such element, behaves - * like {@link #checkByteArray(int)} otherwise. - * - * @param index the index from which to get the argument. - * @return the byte array at the specified index. - * @throws IllegalArgumentException if the argument exists and is not a byte array. - */ - byte[] optByteArray(int index, byte[] def); - - /** - * Try to get a table at the specified index. - *

- * Return the specified default value if there is no such element, behaves - * like {@link #checkTable(int)} otherwise. - * - * @param index the index from which to get the argument. - * @return the table at the specified index. - * @throws IllegalArgumentException if the argument exists and is not a table. - */ - Map optTable(int index, Map def); - - /** - * Try to get an item stack at the specified index. - *

- * Return the specified default value if there is no such element, behaves - * like {@link #checkItemStack(int)} otherwise. - * - * @param index the index from which to get the argument. - * @return the item stack at the specified index. - * @throws IllegalArgumentException if the argument exists and is not an item stack. - */ - ItemStack optItemStack(int index, ItemStack def); - - /** - * Tests whether the argument at the specified index is a boolean value. - *

- * This will return false if there is no argument at the specified - * index, i.e. if there are too few arguments. - * - * @param index the index to check. - * @return true if the argument is a boolean; false otherwise. - */ - boolean isBoolean(int index); - - /** - * Tests whether the argument at the specified index is an integer value. - *

- * This will return false if there is no argument at the specified - * index, i.e. if there are too few arguments. - * - * @param index the index to check. - * @return true if the argument is an integer; false otherwise. - */ - boolean isInteger(int index); - - /** - * Tests whether the argument at the specified index is a double value. - *

- * This will return false if there is no argument at the specified - * index, i.e. if there are too few arguments. - * - * @param index the index to check. - * @return true if the argument is a double; false otherwise. - */ - boolean isDouble(int index); - - /** - * Tests whether the argument at the specified index is a string value. - *

- * This will return false if there is no argument at the specified - * index, i.e. if there are too few arguments. - * - * @param index the index to check. - * @return true if the argument is a string; false otherwise. - */ - boolean isString(int index); - - /** - * Tests whether the argument at the specified index is a byte array. - *

- * This will return false if there is no argument at the specified - * index, i.e. if there are too few arguments. - * - * @param index the index to check. - * @return true if the argument is a byte array; false otherwise. - */ - boolean isByteArray(int index); - - /** - * Tests whether the argument at the specified index is a table. - *

- * This will return false if there is no argument at the specified - * index, i.e. if there are too few arguments. - * - * @param index the index to check. - * @return true if the argument is a table; false otherwise. - */ - boolean isTable(int index); - - /** - * Tests whether the argument at the specified index is an item stack. - *

- * This will return false if there is no argument at the specified - * index, i.e. if there are too few arguments. - * - * @param index the index to check. - * @return true if the argument is an item stack; false otherwise. - */ - boolean isItemStack(int index); - - /** - * Converts the argument list to a standard Java array, converting byte - * arrays to strings automatically, since this is usually what others - * want - if you need the actual raw byte arrays, don't use this method! - * - * @return an array containing all arguments. - */ - Object[] toArray(); -} diff --git a/src/api/java/li/cil/oc/api/machine/Callback.java b/src/api/java/li/cil/oc/api/machine/Callback.java deleted file mode 100755 index 6c67d1662..000000000 --- a/src/api/java/li/cil/oc/api/machine/Callback.java +++ /dev/null @@ -1,147 +0,0 @@ -package li.cil.oc.api.machine; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * This annotation can be used for methods in an {@link li.cil.oc.api.network.Environment} to mark - * them for exposure to computers. - *

- * Any method exposed like this can be enumerated and called from a computer - * that can see the node of the environment. - *

- * Note that methods annotated with this interface must have the following - * signature: - *

- *     Object[] f(Context context, Arguments arguments) throws Exception;
- * 
- *

- * The method may return null in case it doesn't wish return anything, - * which is functionally equivalent to returning an empty array. - *

- * To raise an error from your callback, simply throw an exception. The - * convention for Lua is to return (null, "reason") for 'soft' errors, i.e. - * errors that are no fault of the caller. For example, passing invalid - * arguments will generate an exception, requesting information and the lookup - * of said information failing should not. - * - * @see Context - * @see li.cil.oc.api.machine.Arguments - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface Callback { - /** - * The name under which to make the callback available. - *

- * This defaults to the name of the annotated method if left empty. - */ - String value() default ""; - - /** - * Whether this function may be called directly from the computer's executor - * thread instead of from the server thread. - *

- * You will have to ensure anything your callback does is thread safe when - * setting this to true. Use this for minor lookups, for example. - * This is mainly intended to allow functions to perform faster than when - * called 'synchronously' (where the call takes at least one server tick). - *

- * Keep in mind that the node {@link li.cil.oc.api.network.Network} is not thread safe! - * Be sure you know what you're doing if you're working with a node's - * network in a direct callback. - *

- * An exception to that rule is {@link li.cil.oc.api.network.Connector#changeBuffer(double)}, - * which is synchronized, so you can consume/produce power in direct calls. - */ - boolean direct() default false; - - /** - * The maximum number of direct calls that may be performed on this - * component in a single tick on a tier two computer. - *

- * This can be used to throttle call speed. For example, this is used by - * graphics cards to limit the amount of net traffic can be generated by - * updating the screen they are bound to. - *

- * You should generally apply a limit if the callback allocates persisting - * memory (i.e. memory that isn't freed once the call returns), sends - * network messages, or uses any other kind of resource for which it'd be - * bad if it were to be used from user programs in an unchecked, unregulated - * manner. - *

- * Note that the limit does not apply when the method is invoked - * via a direct call to {@link li.cil.oc.api.network.Component#invoke(String, Context, Object...)} - * from the host side. Also, this limit is per-computer, so the method may - * be invoked more often than this per tick, if different computers call it. - *

- * Note that the interpretation of this value changed a bit in OC 1.4. - * Before, it was the actual number of calls that could be performed on - * the component per tick. Now it's more of a general cost value: for each - * direct call a computer makes, 1/limit is subtracted from the - * computer's call budget. This budget may vary between computers, for - * example, tier three computers have a higher call budget than tier two - * computers. - */ - int limit() default Integer.MAX_VALUE; - - /** - * A documentation string that is made available to the computers the - * component this callback belongs to is connected to. This allows for - * ingame documentation of callbacks. - *

- * You may want to give a short description of what a method does here, but - * more importantly you should document the expected parameters and return - * type here. - *

- * Important: the recommended format is either
- * function(arg:type[, optionArg:type]):resultType -- Description.
- * or
- * function(arg:type[, optionArg:type]):resultType; Description.
- * where the argument list can be of any format (as long as it doesn't contain - * further braces), and the return type is optional. These two formats are - * recognized by OC's NEI component documentation plugin. If you use a - * different format, the doc string will be used as-is. - */ - String doc() default ""; - - /** - * Whether this callback should work like a getter. - *

- * Callbacks that are getters do not appear as methods on a component's - * proxy. Instead they are accessed as fields, for example in Lua via the - * proxy's __index metamethod, with its only parameter being the - * accessed key. - *

- * Note: if you wish to have a field that is read/write, that is you need - * both a getter and a setter, you have to implement them in the same - * method. This a limitation due to callback names being unique. You can - * differentiate between contexts by checking the number of arguments. - *

- * Important: this only works in environments (for components), - * it does not work for userdata (Value objects). For - * userdata, use the apply method instead. - */ - boolean getter() default false; - - /** - * Whether this callback should work like a setter. - *

- * Callbacks that are setters do not appear as methods on a component's - * proxy. Instead they are accessed as fields, for example in Lua via the - * proxy's __newindex metamethod, with its only two parameters - * being the accessed key and the new value. - *

- * Note: if you wish to have a field that is read/write, that is you need - * both a getter and a setter, you have to implement them in the same - * method. This a limitation due to callback names being unique. You can - * differentiate between contexts by checking the number of arguments. - *

- * Important: this only works in environments (for components), - * it does not work for userdata (Value objects). For - * userdata, use the unapply method instead. - */ - boolean setter() default false; -} diff --git a/src/api/java/li/cil/oc/api/machine/Context.java b/src/api/java/li/cil/oc/api/machine/Context.java deleted file mode 100755 index b92aa7509..000000000 --- a/src/api/java/li/cil/oc/api/machine/Context.java +++ /dev/null @@ -1,185 +0,0 @@ -package li.cil.oc.api.machine; - -import li.cil.oc.api.network.Node; - -/** - * This is used to provide some context to {@link li.cil.oc.api.machine.Callback}s, i.e. the - * computer from which the callback was called. - */ -public interface Context { - /** - * The node through which the computer is attached to the component network. - */ - Node node(); - - /** - * Tests whether a player is allowed to use the computer. - *

- * If enabled in the server's configuration, computers can be owned by - * players. This means that only players that are in a computer's user list - * may interact with it, i.e. only players in the user list may: - *

    - *
  • Trigger input via a keyboard.
  • - *
  • Change the computer's inventory.
  • - *
  • Break the computer block.
  • - *
- *

- * There are three exceptions to this rule: - *

    - *
  • Operators are always allowed the above actions.
  • - *
  • If the user list is empty then all players are - * allowed the above actions.
  • - *
  • In single player mode the player is always allowed the above - * actions.
  • - *
- *

- * Use this to check whether you should signal something to the computer, - * for example. Note that for signals triggered via network messages there - * is a computer.checked_signal message, that expects an - * EntityPlayer as the first argument and performs this check - * before pushing the signal. - * - * @param player the name of the player to check for. - * @return whether the player with the specified name may use the computer. - */ - boolean canInteract(String player); - - /** - * Whether the computer is currently in a running state, i.e. it is neither - * paused, stopping or stopped. - *

- * The computer thread may or may not be running while the computer is in - * this state. The computer will accept signals while in this state. - */ - boolean isRunning(); - - /** - * Whether the computer is currently in a paused state. - *

- * The computer thread is not running while the computer is in this state. - * The computer will accept signals while in this state. - */ - boolean isPaused(); - - /** - * Starts the computer. - *

- * The computer will enter a starting state, in which it will start - * accepting signals. The computer will start executing in the next server - * tick. - *

- * If this is called while the computer is in a paused state it will set the - * remaining pause time to zero, but it will not immediately resume - * the computer. The computer will continue with what it did before it was - * paused in the next server tick. - *

- * If this is called while the computer is in a non-paused and non-stopped - * state it will do nothing and return false. - * - * @return true if the computer switched to a running state. - */ - boolean start(); - - /** - * Pauses the computer for the specified duration. - *

- * If this is called from a direct callback the computer will only - * pause after the current task has completed, possibly leading to no pause - * at all. If this is called from a non-direct callback the - * computer will be paused for the specified duration before the call - * returns. Use this to add artificial delays, e.g. for expensive or - * powerful operations (say, scanning blocks surrounding a computer). - *

- * Important: if this is called from the server thread while - * the executor thread is running this will block until the - * computer finishes its current task. The pause will be applied after that. - * This is usually a bad thing to do, since it may lag the game, but can be - * handy to synchronize the computer thread to the server thread. For - * example, this is used when saving screens, which are controlled mostly - * via direct callbacks.
- * However, if the computer is already in a paused state - * and the call would not lead to a longer pause this will immediately - * return false, without blocking. - *

- * Note that the computer still accepts signals while in paused state, so - * it is generally better to avoid long pauses, to avoid a signal queue - * overflow, which would lead to some signals being dropped. - *

- * Also note that the time left to spend paused is stored in game ticks, so - * the time resolution is actually quite limited. - *

- * If this is called while the computer is in a paused, stopping or stopped - * state this will do nothing and return false. - * - * @param seconds the number of seconds to pause the computer for. - * @return true if the computer switched to the paused state. - */ - boolean pause(double seconds); - - /** - * Stops the computer. - *

- * The computer will enter a stopping state, in which it will not - * accept new signals. It will be fully stopped in the next server tick. It - * is not possible to return to a running state from a stopping state. If - * start is called while in a stopping state the computer will be rebooted. - *

- * If this is called from a callback, the callback will still finish, but - * its result will be discarded. If this is called from the server thread - * while the executor thread is running the computer in the background, it - * will finish its current work and the computer will be stopped in some - * future server tick after it has completed. - *

- * If this is called while the computer is in a stopping or stopped state - * this will do nothing and return false. - * - * @return true if the computer switched to the stopping state. - */ - boolean stop(); - - /** - * This method allows dynamic costs for direct calls. - *

- * It will update the budget for direct calls in the current context, and - * throw a {@link LimitReachedException} that should not be caught - * by the callback function. It will be handled in the calling code and - * take care of switching states as necessary. - *

- * Call this from a method with @Callback(direct = true) and - * no limit set to use dynamic costs. If a limit is set, it will - * always be deduced from the budget in addition to this. - *

- * When called from a non-direct / synchronous callback this does nothing. - * - * @param callCost the cost of the direct call being performed. - */ - void consumeCallBudget(double callCost); - - /** - * Push a signal into the computer. - *

- * Signals are processed sequentially by the computer, and are queued in a - * queue with limited length. If the queue is full and the signal could not - * be pushed this will return false. - *

- * Note that only a limited amount of types is supported for arguments: - *

    - *
  • null and Scala's Unit and None (all appear - * as nil on the Lua side, for example)
  • - *
  • Boolean values.
  • - *
  • Numeric types (byte, short, int, long, float, double).
  • - *
  • Strings.
  • - *
  • Byte arrays (which appear as strings on the Lua side, e.g.).
  • - *
  • Maps if and only if both keys and values are strings.
  • - *
  • NBTTagCompounds.
  • - *
- * If an unsupported type is specified the method will enqueue nothing - * instead, resulting in a nil on the Lua side, e.g., and log a - * warning. - * - * @param name the name of the signal to push. - * @param args additional arguments to pass along with the signal. - * @return true if the signal was queued; false otherwise. - */ - boolean signal(String name, Object... args); -} diff --git a/src/api/java/li/cil/oc/api/machine/ExecutionResult.java b/src/api/java/li/cil/oc/api/machine/ExecutionResult.java deleted file mode 100755 index b538c05d9..000000000 --- a/src/api/java/li/cil/oc/api/machine/ExecutionResult.java +++ /dev/null @@ -1,66 +0,0 @@ -package li.cil.oc.api.machine; - -/** - * Used by the Machine to determine the result of a call to - * {@link Architecture#runThreaded(boolean)}. - *

- * Do not implement this interface, only use the predefined internal classes. - */ -public abstract class ExecutionResult { - /** - * Indicates the machine may sleep for the specified number of ticks. This - * is merely considered a suggestion. If signals are in the queue or are - * pushed to the queue while sleeping, the sleep will be interrupted and - * {@link Architecture#runThreaded(boolean)} will be called so that the next - * signal is pushed. - */ - public static final class Sleep extends ExecutionResult { - /** - * The number of ticks to sleep. - */ - public final int ticks; - - public Sleep(int ticks) { - this.ticks = ticks; - } - } - - /** - * Indicates tha the computer should shutdown or reboot. - */ - public static final class Shutdown extends ExecutionResult { - /** - * Whether to reboot. If false the computer will stop. - */ - public final boolean reboot; - - public Shutdown(boolean reboot) { - this.reboot = reboot; - } - } - - /** - * Indicates that a synchronized call should be performed. The architecture - * is expected to be in a state that allows the next call to be to - * {@link Architecture#runSynchronized()} instead of - * {@link Architecture#runThreaded(boolean)}. This is used to perform calls - * from the server's main thread, to avoid threading issues when interacting - * with other objects in the world. - */ - public static final class SynchronizedCall extends ExecutionResult { - } - - /** - * Indicates that an error occurred and the computer should crash. - */ - public static final class Error extends ExecutionResult { - /** - * The error message. - */ - public final String message; - - public Error(String message) { - this.message = message; - } - } -} diff --git a/src/api/java/li/cil/oc/api/machine/LimitReachedException.java b/src/api/java/li/cil/oc/api/machine/LimitReachedException.java deleted file mode 100755 index 69d46eab6..000000000 --- a/src/api/java/li/cil/oc/api/machine/LimitReachedException.java +++ /dev/null @@ -1,8 +0,0 @@ -package li.cil.oc.api.machine; - -/** - * Used to signal that the direct call limit for the current server tick has - * been reached in {@link Machine#invoke(String, String, Object[])}. - */ -public class LimitReachedException extends Exception { -} diff --git a/src/api/java/li/cil/oc/api/machine/Machine.java b/src/api/java/li/cil/oc/api/machine/Machine.java deleted file mode 100755 index b7270f76c..000000000 --- a/src/api/java/li/cil/oc/api/machine/Machine.java +++ /dev/null @@ -1,309 +0,0 @@ -package li.cil.oc.api.machine; - -import li.cil.oc.api.network.ManagedEnvironment; - -import java.util.Map; - -/** - * This interface allows interacting with a Machine obtained via the factory - * method {@link li.cil.oc.api.Machine#create(MachineHost)}. - */ -@SuppressWarnings("unused") -public interface Machine extends ManagedEnvironment, Context { - /** - * The owner of the machine, usually a tile entity hosting the machine. - * - * @return the owner of the machine. - */ - MachineHost host(); - - /** - * This must be called from the host when something relevant to the - * machine changes, such as a change in the amount of available memory. - */ - void onHostChanged(); - - /** - * The underlying architecture of the machine. - *

- * This is what actually evaluates code running on the machine, where the - * machine class itself serves as a scheduler. - *

- * This may be null, for example when the hosting computer has - * no CPU installed. - * - * @return the architecture of this machine. - */ - Architecture architecture(); - - /** - * The list of components attached to this machine. - *

- * This maps address to component type/name. Note that the list may not - * immediately reflect changes after components were added to the network, - * since such changes are cached in an internal list of 'added components' - * that are processed in the machine's update logic (i.e. server tick). - *

- * This list is kept up-to-date automatically, do not mess with it. - * - * @return the list of attached components. - */ - Map components(); - - /** - * The number of connected components. - *

- * This number can differ from components().size(), since this is - * the number of actually connected components, which is used to - * determine whether the component limit has been exceeded, for example. It - * takes into account components added but not processed, yet (see also - * {@link #components()}). - * - * @return the number of connected components. - */ - int componentCount(); - - /** - * The maximum number of components this machine can currently support. - *

- * This is automatically recomputed based on the hosts internal components - * whenever the host calls {@link li.cil.oc.api.machine.Machine#onHostChanged()}. - * - * @return the maximum number of components supported. - */ - int maxComponents(); - - /** - * Gets the amount of energy this machine consumes per tick when it is - * running. - * - * @return the energy consumed per tick by the machine. - */ - double getCostPerTick(); - - /** - * Sets the amount of energy this machine consumes per tick when it is - * running. - * - * @param value the energy consumed per tick by the machine. - */ - void setCostPerTick(double value); - - /** - * The address of the file system that holds the machine's temporary files - * (tmpfs). This may return null if either the creation of the file - * system failed, or if the size of the tmpfs has been set to zero in the - * config. - *

- * Use this in a custom architecture to allow code do differentiate the - * tmpfs from other file systems, for example. - * - * @return the address of the tmpfs component, or null. - */ - String tmpAddress(); - - /** - * A string with the last error message. - *

- * The error string is set either when the machine crashes (see the - * {@link #crash(String)} method), or when it fails to start (which, - * technically, is also a crash). - *

- * When the machine started, this is reset to null. - * - * @return the last error message, or null. - */ - String lastError(); - - /** - * The current world time. This is updated each tick and provides a thread - * safe way to access the world time for architectures. - *

- * This is equivalent to owner().world().getWorldTime(). - * - * @return the current world time. - */ - long worldTime(); - - /** - * The time that has passed since the machine was started, in seconds. - *

- * Note that this is actually measured in world time, so the resolution is - * pretty limited. This is done to avoid 'time skips' when leaving the game - * and coming back later, resuming a persisted machine. - */ - double upTime(); - - /** - * The time spent running the underlying architecture in execution threads, - * i.e. the time spent in {@link Architecture#runThreaded(boolean)} since - * the machine was last started, in seconds. - */ - double cpuTime(); - - // ----------------------------------------------------------------------- // - - /** - * Play a sound using the machine's built-in speaker. - *

- * This is what's used to emit beep codes when an error occurs while trying - * to start the computer, for example, and what's used for playing sounds - * when computer.beep is called. - *

- * Be responsible in how you limit calls to this, as each call will cause - * a packet to be sent to all nearby clients, and will cause the receiving - * clients to generate the required sound sample on-the-fly. It is - * therefore recommended to not call this too frequently, and to limit the - * length of the sound to something relatively short (not longer than a few - * seconds at most). - *

- * The audio will be played at the machine's host's location. - * - * @param frequency the frequency of the tone to generate. - * @param duration the duration of the tone to generate, in milliseconds. - */ - void beep(short frequency, short duration); - - /** - * Utility method for playing beep codes. - *

- * The underlying functionality is similar to that of {@link #beep(short, short)}, - * except that this will play tones at a fixed frequency, and two different - * durations - in a pattern as defined in the passed string. - *

- * This is useful for generating beep codes, such as for boot errors. It - * has the advantage of only generating a single network packet, and - * generating a single, longer sound sample for the full pattern. As such - * the same considerations should be made as for {@link #beep(short, short)}, - * i.e. prefer not to use overly long patterns. - *

- * The passed pattern must consist of dots (.) and dashes (-), - * where a dot is short tone, and a dash is a long tone. - *

- * The audio will be played at the machine's host's location. - * - * @param pattern the beep pattern to play. - */ - void beep(String pattern); - - /** - * Crashes the computer. - *

- * This is exactly the same as {@link Context#stop()}, except that it also - * sets the error message in the machine. This message can be seen when the - * Analyzer is used on computer cases, for example. - * - * @param message the message to set. - * @return true if the computer switched to the stopping state. - */ - boolean crash(String message); - - /** - * Tries to pop a signal from the queue and returns it. - *

- * Signals are stored in a FIFO queue of limited size. This method is / must - * be called by architectures regularly to process the queue. - * - * @return a signal or null if the queue was empty. - */ - Signal popSignal(); - - /** - * Get a list of all methods and their annotations of the specified object. - *

- * The specified object can be either a {@link li.cil.oc.api.machine.Value} - * or a {@link li.cil.oc.api.network.Environment}. This is useful for - * custom architectures, to allow providing a list of callback methods to - * evaluated programs. - * - * @param value the value to get the method listing for. - * @return the methods that can be called on the object. - */ - Map methods(Object value); - - /** - * Makes the machine call a component callback. - *

- * This is intended to be used from architectures, but may be useful in - * other scenarios, too. It will make the machine call the method with the - * specified name on the attached component with the specified address. - *

- * This will perform a visibility check, ensuring the component can be seen - * from the machine. It will also ensure that the direct call limit for - * individual callbacks is respected. - * - * @param address the address of the component to call the method on. - * @param method the name of the method to call. - * @param args the list of arguments to pass to the callback. - * @return a list of results returned by the callback, or null. - * @throws LimitReachedException when the called method supports direct - * calling, but the number of calls in this - * tick has exceeded the allowed limit. - * @throws IllegalArgumentException if there is no such component. - * @throws Exception if the callback throws an exception. - */ - Object[] invoke(String address, String method, Object[] args) throws Exception; - - /** - * Makes the machine call a value callback. - *

- * This is intended to be used from architectures, but may be useful in - * other scenarios, too. It will make the machine call the method with the - * specified name on the specified value. - *

- * This will will ensure that the direct call limit for individual - * callbacks is respected. - * - * @param value the value to call the method on. - * @param method the name of the method to call. - * @param args the list of arguments to pass to the callback. - * @return a list of results returned by the callback, or null. - * @throws LimitReachedException when the called method supports direct - * calling, but the number of calls in this - * tick has exceeded the allowed limit. - * @throws IllegalArgumentException if there is no such component. - * @throws Exception if the callback throws an exception. - */ - Object[] invoke(Value value, String method, Object[] args) throws Exception; - - // ----------------------------------------------------------------------- // - - /** - * The list of users registered on this machine. - *

- * This list is used for {@link Context#canInteract(String)}. Exposed for - * informative purposes only, for example to expose it to user code. Note - * that the returned array is a copy of the internal representation of the - * user list. Changing it has no influence on the actual list. - * - * @return the list of registered users. - */ - String[] users(); - - /** - * Add a player to the machine's list of users, by username. - *

- * This requires for the player to be online. - * - * @param name the name of the player to add as a user. - * @throws Exception if - *

    - *
  • There are already too many users.
  • - *
  • The player is already registered.
  • - *
  • The provided name is too long.
  • - *
  • The player is not online.
  • - *
- */ - void addUser(String name) throws Exception; - - /** - * Removes a player as a user from this machine, by username. - *

- * Unlike when adding players, the player does not have to be - * online to be removed from the list. - * - * @param name the name of the player to remove. - * @return whether the player was removed from the user list. - */ - boolean removeUser(String name); -} diff --git a/src/api/java/li/cil/oc/api/machine/MachineHost.java b/src/api/java/li/cil/oc/api/machine/MachineHost.java deleted file mode 100755 index a5077334b..000000000 --- a/src/api/java/li/cil/oc/api/machine/MachineHost.java +++ /dev/null @@ -1,58 +0,0 @@ -package li.cil.oc.api.machine; - -import li.cil.oc.api.network.EnvironmentHost; -import li.cil.oc.api.network.Environment; -import li.cil.oc.api.network.Node; -import net.minecraft.item.ItemStack; - -/** - * This interface has to be implemented by 'hosts' of machine instances. - *

- * It provides some context for the machine, in particular which world it is - * running in, to allow querying the time of day, for example. - */ -public interface MachineHost extends EnvironmentHost { - /** - * The machine currently hosted. - */ - Machine machine(); - - /** - * List of all components that are built into this machine directly. - *

- * This is used to find CPUs, component buses and memory. - */ - Iterable internalComponents(); - - /** - * Get the slot a component with the specified address is in. - *

- * This is intended to allow determining the slot of item - * components sitting in computers. For other components this returns - * negative values. - * - * @param address the address of the component to get the slot for. - * @return the index of the slot the component is in. - */ - int componentSlot(String address); - - /** - * This is called on the owner when the machine's {@link Environment#onConnect(Node)} - * method gets called. This can be useful for reacting to network events - * when the owner does not have its own node (for example, computer cases - * expose their machine's node as their own node). This callback allows it - * to connect its components (graphics cards and the like) when it is - * connected to a node network (when added to the world, for example). - * - * @param node the node that was connected to the network. - */ - void onMachineConnect(Node node); - - /** - * Like {@link #onMachineConnect(Node)}, except that this is called whenever - * the machine's {@link Environment#onDisconnect(Node)} method is called. - * - * @param node the node that was disconnected from the network. - */ - void onMachineDisconnect(Node node); -} diff --git a/src/api/java/li/cil/oc/api/machine/Signal.java b/src/api/java/li/cil/oc/api/machine/Signal.java deleted file mode 100755 index f74581c67..000000000 --- a/src/api/java/li/cil/oc/api/machine/Signal.java +++ /dev/null @@ -1,19 +0,0 @@ -package li.cil.oc.api.machine; - -/** - * A single signal that was queued on a machine. - *

- * This interface is not intended to be implemented, it only serves as a return - * type for {@link Machine#popSignal()}. - */ -public interface Signal { - /** - * The name of the signal. - */ - String name(); - - /** - * The list of arguments for the signal. - */ - Object[] args(); -} diff --git a/src/api/java/li/cil/oc/api/machine/Value.java b/src/api/java/li/cil/oc/api/machine/Value.java deleted file mode 100755 index 929f7a9c4..000000000 --- a/src/api/java/li/cil/oc/api/machine/Value.java +++ /dev/null @@ -1,77 +0,0 @@ -package li.cil.oc.api.machine; - -import li.cil.oc.api.Persistable; - -/** - * A value object can be pushed to a machine like a primitive value. - *

- * This is the only non-primitive type that can be pushed to machines, allowing - * for much more advanced interaction, since the methods on this value can be - * called from Lua directly. This is similar to component callbacks, but at the - * same time very different, because these objects can be pushed as results - * from callbacks, therefore outliving their component, for example. - *

- * There are a few limitations too keep in mind: - *

    - *
  • Values must have a default constructor for loading.
  • - *
  • Values must be persistable (implement save/load).
  • - *
- *

- * Callbacks can be defined in a manner similar to environments, e.g. using the - * {@link Callback} annotation. - */ -public interface Value extends Persistable { - /** - * This is called when the code running on a machine tries to index this - * value. - * - * @param context the context from which the method is called, usually the - * instance of the computer running the script that made - * the call. - * @param arguments the arguments passed to the method. - * @return the current value at the specified index, or null. - */ - Object apply(Context context, Arguments arguments); - - /** - * This is called when the code running on a machine tries to assign a new - * value at the specified index of this value. - *

- * Does nothing if the value is not indexable. - * - * @param context the context from which the method is called, usually the - * instance of the computer running the script that made - * the call. - * @param arguments the arguments passed to the method. - */ - void unapply(Context context, Arguments arguments); - - /** - * This is called when the code running on a machine tries to call this - * value as a function. - *

- * If this value is not callable, throws an exception. - * - * @param context the context from which the method is called, usually the - * instance of the computer running the script that made - * the call. - * @param arguments the arguments passed to the method. - * @return the result of the call. - * @throws java.lang.RuntimeException if this value is not callable. - */ - Object[] call(Context context, Arguments arguments); - - /** - * This is called when the object's representation in the machine it was - * pushed to is garbage collected. - *

- * Important: be aware of the consequences of pushing the same - * object to multiple machines. You should usually not do that, - * but if you do, realize this method may be called by either machine. - * - * @param context the context from which the method is called, usually the - * instance of the computer running the script that just - * garbage collected the object. - */ - void dispose(Context context); -} diff --git a/src/api/java/li/cil/oc/api/machine/package-info.java b/src/api/java/li/cil/oc/api/machine/package-info.java deleted file mode 100755 index 97807dcc8..000000000 --- a/src/api/java/li/cil/oc/api/machine/package-info.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This package provides low level machine access. - *

- * Using the {@link li.cil.oc.api.Machine} class, you can create new machine - * instances, i.e. essentially computer "cores", that will run code. This allows - * you to implement your own computer blocks. Or robots. Or whatever you come up - * with. - *

- * The interfaces in here also allow you to implement an arbitrary new - * {@link li.cil.oc.api.machine.Architecture}, which can then be used when - * creating a new {@link li.cil.oc.api.machine.Machine} using the factory - * methods in {@link li.cil.oc.api.Machine}. An architecture could be a custom - * language interpreter, or a full blown hardware emulator for old microchips. - *

- * There are also a couple of interfaces in here that are not meant to be - * implemented, but merely to allow accessing some mod internals in a regulated - * fashion, such as {@link li.cil.oc.api.internal.Robot}. - */ -@net.minecraftforge.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Machine", - apiVersion = API.VERSION) -package li.cil.oc.api.machine; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/manual/ContentProvider.java b/src/api/java/li/cil/oc/api/manual/ContentProvider.java deleted file mode 100755 index f36b45440..000000000 --- a/src/api/java/li/cil/oc/api/manual/ContentProvider.java +++ /dev/null @@ -1,29 +0,0 @@ -package li.cil.oc.api.manual; - -/** - * This interface allows implementation of content providers for the manual. - *

- * Content providers can be used to provide possibly dynamic page content for - * arbitrary paths. Note that content providers have lower priority - * than content found in resource packs, i.e. content providers will only be - * queried for missing pages, so to speak. - *

- * - * @see li.cil.oc.api.prefab.ResourceContentProvider - */ -public interface ContentProvider { - /** - * Called to get the content of a path pointed to by the specified path. - *

- * This should provide an iterable over the lines of a Markdown document - * (with the formatting provided by the in-game manual, which is a small - * subset of "normal" Markdown). - *

- * If this provider cannot provide the requested path, it should return - * null to indicate so, allowing other providers to be queried. - * - * @param path the path to the manual page we're looking for. - * @return the content of the document at that path, or null. - */ - Iterable getContent(String path); -} diff --git a/src/api/java/li/cil/oc/api/manual/ImageProvider.java b/src/api/java/li/cil/oc/api/manual/ImageProvider.java deleted file mode 100755 index 4bdb12fb4..000000000 --- a/src/api/java/li/cil/oc/api/manual/ImageProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -package li.cil.oc.api.manual; - -/** - * This allows implementing custom image providers for rendering custom content - * in manual pages. Each provider can be registered for one or more prefixes, - * and will be selected based on the prefix it was registered with. It is - * expected to return an image renderer, which essentially represents the - * area it will render to. - */ -public interface ImageProvider { - /** - * Gets an image renderer for the specified data. - *

- * The data passed here will be part of the image URL following the prefix - * that the provider was registered with. So for example, if the provider - * was registered for the prefix custom, and the image to be - * rendered in the Markdown document was [blah](custom:the data], - * then the string passed where would be the data. - *

- * If there is no appropriate image renderer (for example, for the built-in - * item stack renderers: if the item definition is invalid), this should - * return null, it should never throw an exception. - * - * @param data the data part of the image definition. - * @return the image renderer for the data. - */ - ImageRenderer getImage(String data); -} diff --git a/src/api/java/li/cil/oc/api/manual/ImageRenderer.java b/src/api/java/li/cil/oc/api/manual/ImageRenderer.java deleted file mode 100755 index 2dcad21f7..000000000 --- a/src/api/java/li/cil/oc/api/manual/ImageRenderer.java +++ /dev/null @@ -1,47 +0,0 @@ -package li.cil.oc.api.manual; - -/** - * This allows implementing custom image renderers. - *

- * Image renderers are used to draw custom areas in a manual page, defined as - * an image with a special URL, matching the prefix of a registered image - * provider. A renderer will then be used to draw something at the position - * of the image tag. - *

- * Built-in image renderers are item, block and oredict. - */ -public interface ImageRenderer { - /** - * The width of the area this renderer uses. - *

- * This is used to offset the OpenGL state properly before calling - * {@link #render(int, int)}, to correctly align the image horizontally. - * - * @return the width of the rendered image. - */ - int getWidth(); - - /** - * The height of the area this renderer uses. - *

- * This is used to offset the OpenGL state properly before calling - * {@link #render(int, int)}, as well as to know where to resume rendering - * other content below the image. - * - * @return the height of the rendered image. - */ - int getHeight(); - - /** - * Render the image, with specified maximum width. - *

- * This should render the image as is, the OpenGL state will be set up - * such that you can start drawing at (0,0,*), and render up to - * (getWidth,getHeight,*), i.e. translation and scaling are taken care - * of for you. - * - * @param mouseX the X position of the mouse relative to the element. - * @param mouseY the Y position of the mouse relative to the element. - */ - void render(int mouseX, int mouseY); -} diff --git a/src/api/java/li/cil/oc/api/manual/InteractiveImageRenderer.java b/src/api/java/li/cil/oc/api/manual/InteractiveImageRenderer.java deleted file mode 100755 index cad23de5a..000000000 --- a/src/api/java/li/cil/oc/api/manual/InteractiveImageRenderer.java +++ /dev/null @@ -1,35 +0,0 @@ -package li.cil.oc.api.manual; - -/** - * Allows implementing advanced image renderers that react to mouse input and - * specify customized tooltips. - *

- * This way you can e.g. disable the default tooltip and render a more advanced - * one, or render a small GUI on a page. - */ -public interface InteractiveImageRenderer extends ImageRenderer { - /** - * Get a custom tooltip for this image renderer. - *

- * This can be used to override the original tooltip of an image. - * - * @param tooltip the original tooltip of the element. - * @return the tooltip to use for the element. - */ - String getTooltip(String tooltip); - - /** - * Called when the mouse is clicked while over this image renderer. - *

- * This only fires for left-clicks, because right-clicks are reserved for - * navigating back in the manual. - *

- * If this returns false and the element is a link, the link will - * be followed. If it returns true, it will not. - * - * @param mouseX the X coordinate of the mouse, relative to the element. - * @param mouseY the Y coordinate of the mouse, relative to the element. - * @return whether the click was handled. - */ - boolean onMouseClick(int mouseX, int mouseY); -} diff --git a/src/api/java/li/cil/oc/api/manual/PathProvider.java b/src/api/java/li/cil/oc/api/manual/PathProvider.java deleted file mode 100755 index 4f796f2b2..000000000 --- a/src/api/java/li/cil/oc/api/manual/PathProvider.java +++ /dev/null @@ -1,44 +0,0 @@ -package li.cil.oc.api.manual; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -/** - * Allows providing paths for item stacks and blocks in the world. - *

- * This is used for generating NEI usage pages with a button opening the manual - * on the page at the specified path, or for opening the manual when held in - * hand and sneak-activating a block in the world. - *

- * This way you can easily make entries in your documentation available the - * same way OpenComputers does it itself. - *

- * Note that you can use the special variable %LANGUAGE% in your - * paths, for language agnostic paths. These will be resolved to the currently - * set language, falling back to en_US, during actual content lookup. - */ -public interface PathProvider { - /** - * Get the path to the documentation page for the provided item stack. - *

- * Return null if there is no known page for this item, allowing - * other providers to be queried. - * - * @param stack the stack to get the documentation path to. - * @return the path to the page, null if none is known. - */ - String pathFor(ItemStack stack); - - /** - * Get the path to the documentation page for the provided block. - *

- * Return null if there is no known page for this item, allowing - * other providers to be queried. - * - * @param world the world containing the block. - * @param pos the position coordinate of the block. - * @return the path to the page, null if none is known. - */ - String pathFor(World world, BlockPos pos); -} diff --git a/src/api/java/li/cil/oc/api/manual/TabIconRenderer.java b/src/api/java/li/cil/oc/api/manual/TabIconRenderer.java deleted file mode 100755 index ee7af3a74..000000000 --- a/src/api/java/li/cil/oc/api/manual/TabIconRenderer.java +++ /dev/null @@ -1,26 +0,0 @@ -package li.cil.oc.api.manual; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** - * Allows defining a renderer for a manual tab. - *

- * Each renderer instance represents the single graphic it is drawing. To - * provide different graphics for different tabs you'll need to create - * multiple tab renderer instances. - *

- * - * @see li.cil.oc.api.prefab.ItemStackTabIconRenderer - * @see li.cil.oc.api.prefab.TextureTabIconRenderer - */ -public interface TabIconRenderer { - /** - * Called when icon of a tab should be rendered. - *

- * This should render something in a 16x16 area. The OpenGL state has been - * adjusted so that drawing starts at (0,0,0), and should go to (16,16,0). - */ - @SideOnly(Side.CLIENT) - void render(); -} diff --git a/src/api/java/li/cil/oc/api/manual/package-info.java b/src/api/java/li/cil/oc/api/manual/package-info.java deleted file mode 100755 index 1cdeae847..000000000 --- a/src/api/java/li/cil/oc/api/manual/package-info.java +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This package contains manual related interfaces. - *

- * The manual represents the in-game documentation of OpenComputers and any - * other mod that may choose to add its documentation to it, such as addon - * mods. - */ -@net.minecraftforge.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Manual", - apiVersion = API.VERSION) -package li.cil.oc.api.manual; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/nanomachines/Behavior.java b/src/api/java/li/cil/oc/api/nanomachines/Behavior.java deleted file mode 100755 index b532e253f..000000000 --- a/src/api/java/li/cil/oc/api/nanomachines/Behavior.java +++ /dev/null @@ -1,52 +0,0 @@ -package li.cil.oc.api.nanomachines; - -/** - * Implemented by single behaviors. - *

- * If you need a reference to the player this behavior applies to (which you'll - * probably usually want to have), pass it along from {@link BehaviorProvider#createBehaviors}. - */ -public interface Behavior { - /** - * A short name / description of this behavior. - *

- * You can not use commas (,) or double quotes (") - * in the returned string. If you do, they'll automatically be replaced with - * underscores. - *

- * This is entirely optional and may even return null. It is made - * accessible via the controller's wireless protocol, to allow better - * automating reconfigurations / determining input mappings. In some cases - * you may not wish to make this possible, in those cases return null - * or a random string. - *

- * Again, you can return whatever you like here, it's not used in mod internal - * logic, but only provided to ingame devices as a hint to make configuring - * nanomachines a little easier. - * - * @return the name to provide for this behavior, if any. - */ - String getNameHint(); - - /** - * Called when this behavior becomes active because all its required inputs - * are now satisfied. - *

- * Use this to initialize permanent effects. - */ - void onEnable(); - - /** - * Called when this behavior becomes inactive. - *

- * Use this to remove permanent effects. - * - * @param reason the reason the behavior is being disabled. - */ - void onDisable(DisableReason reason); - - /** - * Called each tick while this behavior is active. - */ - void update(); -} diff --git a/src/api/java/li/cil/oc/api/nanomachines/BehaviorProvider.java b/src/api/java/li/cil/oc/api/nanomachines/BehaviorProvider.java deleted file mode 100755 index 4e0ecf952..000000000 --- a/src/api/java/li/cil/oc/api/nanomachines/BehaviorProvider.java +++ /dev/null @@ -1,66 +0,0 @@ -package li.cil.oc.api.nanomachines; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; - -/** - * Implemented by providers for behaviors. - *

- * You may implement one provider for each of your behaviors, or one provider - * for all of your behaviors; it really doesn't matter. This just allows for - * some logical grouping of behaviors, where desired. - *

- * Each behavior provider must be capable or serializing the behaviors it - * creates, and re-create the behavior from its serialized form. It will - * not be given any hints as to whether a provided tag was originally - * produced by it, so you should add a sufficiently unique marker to the - * output NBT to allow identification later on. I recommend generating a - * UUID once, and using that. This is necessary to both save and restore - * neural connection state between saves without breaking the state when - * new behaviors are added, as well as to send states to the client. - */ -public interface BehaviorProvider { - /** - * Create all behaviors valid for the specified player. - *

- * Note that this is only called on the server side when reconfiguring - * nanomachines. If you have a behavior that actually acts client-only, - * you still need to return it here, as it will be synchronized to the - * client using {@link #writeToNBT} and {@link #readFromNBT}. - * - * @param player the player the behaviors should be created for. - * @return list of new behaviors, may be null. - */ - Iterable createBehaviors(EntityPlayer player); - - /** - * Write a behavior to NBT. - *

- * This will only be called for behaviors originally created by this provider. - *

- * This will only be called on the server. All behaviors not saved will be - * lost when loading again, they will not be regenerated using - * {@link #createBehaviors}, so make sure to save all your behaviors. - * - * @param behavior the behavior to serialize. - * @return the serialized representation of the specified behavior. - */ - NBTTagCompound writeToNBT(Behavior behavior); - - /** - * Restore a behavior from NBT. - *

- * You are not guaranteed that his nbt belongs to a behavior - * created by this provider! If the NBT cannot be handled, return - * null. - *

- * This is called both on the server and the client; on the server it - * is called when restoring a saved player, on the client when - * synchronizing a configuration. - * - * @param player the player the behaviors should be created for. - * @param nbt the tag to restore the behavior from. - * @return the restored behavior, or null if unhandled. - */ - Behavior readFromNBT(EntityPlayer player, NBTTagCompound nbt); -} diff --git a/src/api/java/li/cil/oc/api/nanomachines/Controller.java b/src/api/java/li/cil/oc/api/nanomachines/Controller.java deleted file mode 100755 index b8c52abdc..000000000 --- a/src/api/java/li/cil/oc/api/nanomachines/Controller.java +++ /dev/null @@ -1,129 +0,0 @@ -package li.cil.oc.api.nanomachines; - -/** - * The nanomachine controller is responsible for keeping track of the current - * layout of neural connections (i.e. how nanomachine "inputs" connect to - * behaviors, directly or indirectly). - *

- * Each input can connect to one or more nodes. A node can either be a - * behavior, or an indirect connection, which in turn is connected to one - * or more behaviors (there is at maximum one layer of indirection). Each - * indirection may trigger one or more behaviors, but may also require one - * or more inputs to activate its outputs. - *

- * Each node, input or indirection, will only connect to one or two other - * nodes, to keep randomization at a somewhat manageable level, but to still - * allow for some optimization by re-rolling the connections. - *

- * This interface is not meant to be implemented externally. To get a reference - * to a controller, use {@link li.cil.oc.api.Nanomachines#getController}. - */ -public interface Controller { - /** - * Reconfigure the neural connections managed by this controller. This - * will lead to the system being unavailable for a short while, in which - * the neural connections are rebuilt in a new configuration. In addition, - * some debuffs will be applied to the player. - *

- * This will reset all inputs to disabled and deactivate all previously - * active behaviors. - * - * @return the controller itself, for chaining / convenience. - */ - Controller reconfigure(); - - /** - * Get the number of inputs available. - *

- * This number depends on the total number of behaviors available, to keep - * randomization at a manageable level. It is computed internally and - * based on a configuration value. - * - * @return the total number of available inputs. - */ - int getTotalInputCount(); - - /** - * Get the number of inputs that may be active at the same time - * before negative effects are applied to the player. - *

- * The number of active inputs may exceed this value, but this will - * have negative effects on the player. - * - * @return the number of inputs that may safely be active at a time. - */ - int getSafeActiveInputs(); - - /** - * Get the total number of inputs that may be active at the same time. - *

- * The number of active inputs cannot exceed this value. - * - * @return the number of inputs that may be active at a time. - */ - int getMaxActiveInputs(); - - /** - * Get whether the input with the specified index is active. - * - * @param index the input index. - * @return whether the input is active. - * @throws IndexOutOfBoundsException if index < 0 or index >= getInputCount. - */ - boolean getInput(int index); - - /** - * Set the state of the input with the specified index. - *

- * This will fail if too many inputs are active already. It will also - * always fail when called on the client. - * - * @param index the input index. - * @param value whether the input should be active. - * @return whether the input was changed successfully. - * @throws IndexOutOfBoundsException if index < 0 or index >= getInputCount. - */ - boolean setInput(int index, boolean value); - - /** - * Get the list of currently active behaviors, based on the current input states. - *

- * Note that behaviors may behave differently depending on how many active - * inputs they have. Behaviors in the returned list will have at least one - * active input. - * - * @return the list of currently active behaviors. Never null. - */ - Iterable getActiveBehaviors(); - - /** - * Get the number of active inputs for the specified behavior. - * - * @param behavior the behavior to get the number of inputs for. - * @return the number of inputs active for the specified behavior. - */ - int getInputCount(Behavior behavior); - - // ----------------------------------------------------------------------- // - - /** - * The amount of energy stored by this nanomachine controller. - */ - double getLocalBuffer(); - - /** - * The maximum amount of energy stored by this nanomachine controller. - */ - double getLocalBufferSize(); - - /** - * Try to apply the specified delta to the controller's buffer. - *

- * A negative value will drain energy from the buffer, a positive value - * will inject energy into the buffer. - * - * @param delta the amount of energy to consume or store. - * @return the remainder of the delta that could not be applied. - */ - double changeBuffer(double delta); -} diff --git a/src/api/java/li/cil/oc/api/nanomachines/DisableReason.java b/src/api/java/li/cil/oc/api/nanomachines/DisableReason.java deleted file mode 100755 index 13d806e36..000000000 --- a/src/api/java/li/cil/oc/api/nanomachines/DisableReason.java +++ /dev/null @@ -1,23 +0,0 @@ -package li.cil.oc.api.nanomachines; - -/** - * Enum with reasons why a nanomachine behavior was disabled. - *

- * This allows some more context specific behavior in a more stable fashion. - */ -public enum DisableReason { - /** - * This covers things like players logging off or the controller being reset. - */ - Default, - - /** - * Input state changed, leading to a behavior being disabled. - */ - InputChanged, - - /** - * System has run out of energy and is powering down. - */ - OutOfEnergy -} diff --git a/src/api/java/li/cil/oc/api/network/Analyzable.java b/src/api/java/li/cil/oc/api/network/Analyzable.java deleted file mode 100755 index 204d57720..000000000 --- a/src/api/java/li/cil/oc/api/network/Analyzable.java +++ /dev/null @@ -1,35 +0,0 @@ -package li.cil.oc.api.network; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.EnumFacing; - -/** - * Allows defining a callback for when a block is right-clicked with an - * analyzer. - *

- * This has to be implemented by a {@link net.minecraft.tileentity.TileEntity}, - * else it will have no effect. - */ -public interface Analyzable { - /** - * Called when a player uses the analyzer tool on the tile entity's block. - *

- * This can be used to display additional block specific information in the - * player's chat when the analyzer is used (or do whatever) and may also be - * used to redirect the query to some other environment by returning some - * other environment than this. The latter is used by multi-block - * screens, for example, to always show information of the primary screen. - *

- * Return null to suppress any further node information being - * displayed. - * - * @param player the player that used the analyzer. - * @param side the side of the block the player clicked. - * @param hitX the relative X coordinate the player clicked. - * @param hitY the relative Y coordinate the player clicked. - * @param hitZ the relative Z coordinate the player clicked. - * @return the nodes to display information for, usually an environment's - * main node (i.e. this.node()). - */ - Node[] onAnalyze(EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ); -} diff --git a/src/api/java/li/cil/oc/api/network/BlacklistedPeripheral.java b/src/api/java/li/cil/oc/api/network/BlacklistedPeripheral.java deleted file mode 100755 index 7598551d5..000000000 --- a/src/api/java/li/cil/oc/api/network/BlacklistedPeripheral.java +++ /dev/null @@ -1,13 +0,0 @@ -package li.cil.oc.api.network; - -/** - * This interface can be implemented by ComputerCraft peripherals, to allow - * dynamically deciding whether OC should wrap the peripheral or not. - *

- * If you have an OC driver equivalent to your peripheral and the more broad, - * IMC based method (which works purely on class names) doesn't work for you, - * use this. - */ -public interface BlacklistedPeripheral { - boolean isPeripheralBlacklisted(); -} diff --git a/src/api/java/li/cil/oc/api/network/Component.java b/src/api/java/li/cil/oc/api/network/Component.java deleted file mode 100755 index abf29618f..000000000 --- a/src/api/java/li/cil/oc/api/network/Component.java +++ /dev/null @@ -1,107 +0,0 @@ -package li.cil.oc.api.network; - -import li.cil.oc.api.machine.Callback; -import li.cil.oc.api.machine.Context; - -import java.util.Collection; - -/** - * Components are nodes that can be addressed computers via drivers. - *

- * Components therefore form a sub-network in the overall network, and some - * special rules apply to them. For one, components specify an additional - * kind of visibility. Component visibility may have to differ from real - * network reachability in some cases, such as network cards (which have to - * be able to communicate across the whole network, but computers should only - * "see" the cards installed directly in them). - *

- * Unlike the {@link Node}'s network reachability, this is a dynamic value and - * can be changed at any time. For example, this is used to hide multi-block - * screen parts that are not the origin from computers in the network. - *

- * The method responsible for dispatching network messages from computers also - * only allows sending messages to components that the computer can see, - * according to the component's visibility. Therefore nodes won't receive - * messages from computer's that should not be able to see them. - */ -public interface Component extends Node { - /** - * The name of the node. - *

- * This should be the type name of the component represented by the node, - * since this is what is returned from component.type. As such it - * is to be expected that there be multiple nodes with the same name, but - * that those nodes all have the same underlying type (i.e. there can be - * multiple "filesystem" nodes, but they should all behave the same way). - */ - String name(); - - /** - * Get the visibility of this component. - */ - Visibility visibility(); - - /** - * Set the visibility of this component. - *

- * Note that this cannot be higher / more visible than the reachability of - * the node. Trying to set it to a higher value will generate an exception. - * - * @throws java.lang.IllegalArgumentException if the specified value is - * more visible than the node's - * reachability. - */ - void setVisibility(Visibility value); - - /** - * Tests whether this component can be seen by the specified node, - * usually representing a computer in the network. - *

- * Important: this will always return true if the node is - * not currently in a network. - * - * @param other the computer node to check for. - * @return true if the computer can see this node; false otherwise. - */ - boolean canBeSeenFrom(Node other); - - // ----------------------------------------------------------------------- // - - /** - * The list of names of methods exposed by this component. - *

- * This does not return the callback annotations directly, because those - * may not contain the method's name (as it defaults to the name of the - * annotated method). - *

- * The returned collection is read-only. - */ - Collection methods(); - - /** - * Get the annotation information of a method. - *

- * This is needed for custom architecture implementations that need to know - * if a callback is direct or not, for example. - * - * @param method the method to the the info for. - * @return the annotation of the specified method or null. - */ - Callback annotation(String method); - - /** - * Tries to call a function with the specified name on this component. - *

- * The name of the method must be one of the names in {@link #methods()}. - * The returned array may be null if there is no return value. - * - * @param method the name of the method to call. - * @param context the context from which the method is called, usually the - * instance of the computer running the script that made - * the call. - * @param arguments the arguments passed to the method. - * @return the list of results, or null if there is no result. - * @throws NoSuchMethodException if there is no method with that name. - */ - Object[] invoke(String method, Context context, Object... arguments) throws Exception; -} diff --git a/src/api/java/li/cil/oc/api/network/ComponentConnector.java b/src/api/java/li/cil/oc/api/network/ComponentConnector.java deleted file mode 100755 index 969a8901d..000000000 --- a/src/api/java/li/cil/oc/api/network/ComponentConnector.java +++ /dev/null @@ -1,7 +0,0 @@ -package li.cil.oc.api.network; - -/** - * For nodes that are both component and connector. - */ -public interface ComponentConnector extends Component, Connector { -} diff --git a/src/api/java/li/cil/oc/api/network/ComponentHost.java b/src/api/java/li/cil/oc/api/network/ComponentHost.java deleted file mode 100755 index d0680c556..000000000 --- a/src/api/java/li/cil/oc/api/network/ComponentHost.java +++ /dev/null @@ -1,14 +0,0 @@ -package li.cil.oc.api.network; - -/** - * A more in-depth implementation of an environment host, also providing - * access to the hosted environments. - */ -public interface ComponentHost extends EnvironmentHost { - /** - * The list of components active in the component host. - * - * @return the list of components. - */ - Iterable getComponents(); -} diff --git a/src/api/java/li/cil/oc/api/network/Connector.java b/src/api/java/li/cil/oc/api/network/Connector.java deleted file mode 100755 index 7189915bd..000000000 --- a/src/api/java/li/cil/oc/api/network/Connector.java +++ /dev/null @@ -1,97 +0,0 @@ -package li.cil.oc.api.network; - -/** - * Interface for nodes that act as power connectors between their network and - * some power producer or consumer. - *

- * For each connector a buffer is managed. Its size is initialized via the - * factory function in the network API, but can also be configured later on. - * Its current fill level can be queried and manipulated as desired. - *

- * Each connector can take two roles: it can be a producer, feeding - * power into the network, or it can be a consumer, requiring power - * from the network to power something (or it can be both). This depends - * entirely on how you call {@link #changeBuffer}, i.e. on whether you - * fill up the connectors buffer or drain it. - *

- * To feed power into the network, simply fill up the buffer, to consume power - * take power from the buffer. The network will balance the power between all - * buffers connected to it. The algorithm goes as follows: if there was a change - * to some buffer, computer the average power available in all buffers. Build - * two sets: those of buffers with above-average level, and those with below- - * average fill. From all above-average buffers take so much energy that they - * remain just above average fill (but only take integral values - this is to - * avoid floating point errors causing trouble). Distribute the collected energy - * equally among the below-average buffers (as good as possible). - */ -public interface Connector extends Node { - /** - * The energy stored in the local buffer. - */ - double localBuffer(); - - /** - * The size of the local buffer. - */ - double localBufferSize(); - - /** - * The accumulative energy stored across all buffers in the node's network. - */ - double globalBuffer(); - - /** - * The accumulative size of all buffers in the node's network. - */ - double globalBufferSize(); - - /** - * Try to apply the specified delta to the global buffer. - *

- * This can be used to apply reactionary power changes. For example, a - * screen may require a certain amount of energy to refresh its display when - * a program tries to display text on it. For running costs just apply the - * same delta each tick. - *

- * If the specified delta cannot be completely applied to the buffer, the - * remaining delta will be returned. This means that for negative values - * a part of the energy will have been consumed, though. - *

- * If there is enough energy or no overflow this will return 0. - *

- * Keep in mind that this change is applied to the global buffer, - * i.e. energy from multiple buffers may be consumed / multiple buffers may - * be filled. The buffer for which this method is called (i.e. this node - * instance) will be prioritized, though. - * - * @param delta the amount of energy to consume or store. - * @return the remainder of the delta that could not be applied. - */ - double changeBuffer(double delta); - - /** - * Like {@link #changeBuffer}, but will only store/consume the specified - * amount of energy if there is enough capacity/energy available. - * - * @param delta the amount of energy to consume or store. - * @return true if the energy was successfully consumed or stored. - */ - boolean tryChangeBuffer(double delta); - - /** - * Change the size of the connectors local buffer. - *

- * If the size is reduced, any superfluous energy is distributed across - * other connectors' buffers in the network, if possible. Any surplus - * energy that cannot be stored in other buffers will be lost. - *

- * Note that this automatically called when the connector is disconnected - * from its network to set its buffer size to zero and distribute its - * energy to other connectors in the network. - * - * @param size the new size of the local buffer. Note that this is capped - * to a minimum of zero, i.e. if a negative value is passed the - * size will be set to zero. - */ - void setLocalBufferSize(double size); -} diff --git a/src/api/java/li/cil/oc/api/network/Environment.java b/src/api/java/li/cil/oc/api/network/Environment.java deleted file mode 100755 index 906543874..000000000 --- a/src/api/java/li/cil/oc/api/network/Environment.java +++ /dev/null @@ -1,113 +0,0 @@ -package li.cil.oc.api.network; - -/** - * The environment of a node. - *

- * For blocks/tile entities this will usually be the tile entity. For items - * this will usually be an object created when a component is added to a - * compatible inventory (e.g. put into a computer). - *

- * Tile entities should implement this interface if they want to be connected - * to the component network of their neighboring blocks. If you cannot do that, - * as mentioned above, you will have to provide a driver that creates a managed - * environment for the block you wish to connect instead. - *

- * To get some more control over which sides of your block may connect to a - * network, see {@link SidedEnvironment}. - *

- * When a tile entity implements this interface a good way of connecting and - * disconnecting is the following pattern: - *

- *     void updateEntity() {
- *         super.updateEntity()
- *         if (node != null && node.network == null) {
- *             api.Network.joinOrCreateNetwork(this);
- *         }
- *     }
- *
- *     void onChunkUnload() {
- *         super.onChunkUnload()
- *         if (node != null) node.remove()
- *     }
- *
- *     void invalidate() {
- *         super.invalidate()
- *         if (node != null) node.remove()
- *     }
- * 
- *

- * Item environments are always managed, so you will always have to provide a - * driver for items that should interact with the component network. - *

- * To interact with environments from user code you will have to do two things: - *

    - *
  1. Make the environment's {@link #node} a {@link Component} and ensure - * its {@link Component#visibility} is set to a value where it can - * be seen by computers in the network.
  2. - *
  3. Annotate methods in the environment as {@link li.cil.oc.api.machine.Callback}s.
  4. - *
- */ -public interface Environment { - /** - * The node this environment wraps. - *

- * The node is the environments gateway to the component network, and thus - * its preferred way to interact with other components in the same network. - * - * @return the node this environment wraps. - */ - Node node(); - - /** - * This is called when a node is added to a network. - *

- * This is also called for the node itself, if it was added to the network. - *

- * At this point the node's network is never null and you can use - * it to query it for other nodes. Use this to perform initialization logic, - * such as building lists of nodes of a certain type in the network. - *

- * For example, if node A is added to a network with nodes B and C, these - * calls are made: - *

    - *
  • A.onConnect(A)
  • - *
  • A.onConnect(B)
  • - *
  • A.onConnect(C)
  • - *
  • B.onConnect(A)
  • - *
  • C.onConnect(A)
  • - *
- */ - void onConnect(Node node); - - /** - * This is called when a node is removed from the network. - *

- * This is also called for the node itself, when it has been removed from - * its network. Note that this is called on the node that is being removed - * only once with the node itself as the parameter. - *

- * At this point the node's network is no longer available (null). - * Use this to perform clean-up logic such as removing references to the - * removed node. - *

- * For example, if node A is removed from a network with nodes A, B and C, - * these calls are made: - *

    - *
  • A.onDisconnect(A)
  • - *
  • B.onDisconnect(A)
  • - *
  • C.onDisconnect(A)
  • - *
- */ - void onDisconnect(Node node); - - /** - * This is the generic message handler. - *

- * It is called whenever this environments {@link Node} receives a message - * that was sent via one of the send methods in the {@link Network} - * or the Node itself. - * - * @param message the message to handle. - */ - void onMessage(Message message); -} diff --git a/src/api/java/li/cil/oc/api/network/EnvironmentHost.java b/src/api/java/li/cil/oc/api/network/EnvironmentHost.java deleted file mode 100755 index db3f47c78..000000000 --- a/src/api/java/li/cil/oc/api/network/EnvironmentHost.java +++ /dev/null @@ -1,52 +0,0 @@ -package li.cil.oc.api.network; - -import net.minecraft.world.World; - -/** - * To be implemented by 'hosts' of components. - *

- * This is what's passed to drivers as the host when creating an environment. - * It is generally used to represent the components' location in the world. - *

- * You will only need to implement this if you intend to host components, e.g. - * by providing a custom computer case or such. In OpenComputers this interface - * is usually implemented directly by the tile entities acting as the host, so - * in most cases you should be able to cast this to TileEntity for - * more options, if necessary. - */ -public interface EnvironmentHost { - /** - * The world the container lives in. - */ - World world(); - - /** - * The container's X position in the world. - *

- * For tile entities this is the centered position. For example, - * if the tile entity is located at (0, 2, 3) this will be 0.5. - */ - double xPosition(); - - /** - * The container's Y position in the world. - *

- * For tile entities this is the centered position. For example, - * if the tile entity is located at (0, 2, 3) this will be 2.5. - */ - double yPosition(); - - /** - * The container's Z position in the world. - *

- * For tile entities this is the centered position. For example, - * if the tile entity is located at (0, 2, 3) this will be 3.5. - */ - double zPosition(); - - /** - * Marks the container as "changed" so that it knows it has to be saved - * again in the next world save. - */ - void markChanged(); -} diff --git a/src/api/java/li/cil/oc/api/network/FilteredEnvironment.java b/src/api/java/li/cil/oc/api/network/FilteredEnvironment.java deleted file mode 100755 index 9f81749f7..000000000 --- a/src/api/java/li/cil/oc/api/network/FilteredEnvironment.java +++ /dev/null @@ -1,25 +0,0 @@ -package li.cil.oc.api.network; - -/** - * This interface can be added to {@link Environment}s with a number of - * {@link li.cil.oc.api.machine.Callback}s on them, to select which of these - * callbacks should be exposed to machines dynamically. - *

- * Important: while this allows dynamic selection of callbacks, if - * what the filter method returns changes during the lifetime of the - * environment, these changes will not be reflected in already connected - * computers. - */ -public interface FilteredEnvironment { - /** - * Whether the callback with the specified name on this environment is enabled. - *

- * Returning true will be the same as if this interface were not - * implemented. Returning false will hide the callback with the - * specified name from machines connected to it. - * - * @param name the name of the callback to check for. - * @return whether the callback should be visible or not. - */ - boolean isCallbackEnabled(String name); -} diff --git a/src/api/java/li/cil/oc/api/network/ManagedEnvironment.java b/src/api/java/li/cil/oc/api/network/ManagedEnvironment.java deleted file mode 100755 index 7a1a10ea5..000000000 --- a/src/api/java/li/cil/oc/api/network/ManagedEnvironment.java +++ /dev/null @@ -1,33 +0,0 @@ -package li.cil.oc.api.network; - -import li.cil.oc.api.Persistable; - -/** - * This kind of environment is managed by either a compatible inventory, such - * as a computer or floppy drive, or by an adapter block or similar. - *

- * This means its update and save/load methods will be called by their logical - * container. This is required for item environments, and for block - * environments that cannot be directly integrated into a block's tile entity, - * for example because you have no direct control over the block (e.g. what we - * do with the command block). - *

- * You should not implement this interface in your tile entities, or - * weird things may happen (e.g. update and save/load being called multiple - * times). - */ -public interface ManagedEnvironment extends Environment, Persistable { - /** - * Like the method of the same name on tile entities, this is used to - * decide whether to put a component in the list of components that need - * updating, i.e. for which {@link #update()} should be called each tick. - *

- * Return false here, if you do not need updates, to improve performance. - */ - boolean canUpdate(); - - /** - * This is called by the host of this managed environment once per tick. - */ - void update(); -} diff --git a/src/api/java/li/cil/oc/api/network/ManagedPeripheral.java b/src/api/java/li/cil/oc/api/network/ManagedPeripheral.java deleted file mode 100755 index 3e69def05..000000000 --- a/src/api/java/li/cil/oc/api/network/ManagedPeripheral.java +++ /dev/null @@ -1,38 +0,0 @@ -package li.cil.oc.api.network; - -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Context; - -/** - * This interface can be used with an {@link li.cil.oc.api.network.Environment} - * and is intended to be used for environments wrapping a ComputerCraft - * peripheral. It could be used for other purposes as well, though. It allows - * providing method names in addition to those defined via the - * {@link li.cil.oc.api.machine.Callback} annotation, and invoking said methods. - */ -public interface ManagedPeripheral { - /** - * Get the list of methods provided by this environment, in - * addition to methods marked as callbacks. - *

- * Returning null has the same meaning as returning an empty array, - * that being that there are no methods - in which case you don't need this - * interface! - * - * @return the list of methods provided by the environment. - */ - String[] methods(); - - /** - * Calls a method from the list provided by {@link #methods()}. - *

- * - * @param method the name of the method to call. - * @param context the context from which the method is called. - * @param args the arguments to pass to the method. - * @return the result of calling the method. Same as for callbacks. - * @throws java.lang.NoSuchMethodException if there is no method with the - * specified name. - */ - Object[] invoke(String method, Context context, Arguments args) throws Exception; -} diff --git a/src/api/java/li/cil/oc/api/network/Message.java b/src/api/java/li/cil/oc/api/network/Message.java deleted file mode 100755 index 980b36a63..000000000 --- a/src/api/java/li/cil/oc/api/network/Message.java +++ /dev/null @@ -1,39 +0,0 @@ -package li.cil.oc.api.network; - -/** - * This type is used to deliver messages sent in a component network. - *

- * We use an extra class to deliver messages to nodes to make the cancel logic - * more clear (returning a boolean can get annoying very fast). - */ -public interface Message { - /** - * The node that sent the message. - * - * @return the source node. - */ - Node source(); - - /** - * The name of this message. - * - * @return the name of the message. - */ - String name(); - - /** - * The values passed along in the message. - * - * @return the message data. - */ - Object[] data(); - - /** - * Stop further propagation of a broadcast message. - *

- * This can be used to stop further distributing messages when either - * serving a message to a specific address and there are multiple nodes - * with that address, or when serving a broadcast message. - */ - void cancel(); -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/network/Network.java b/src/api/java/li/cil/oc/api/network/Network.java deleted file mode 100755 index 3d76f0014..000000000 --- a/src/api/java/li/cil/oc/api/network/Network.java +++ /dev/null @@ -1,225 +0,0 @@ -package li.cil.oc.api.network; - -/** - * Interface for interacting with networks. - *

- * Computers and components form ad-hoc "networks" when placed next to each - * other. They allow computers to communicate with the components attached to - * them (and nodes amongst each other) by using the network as an index - * structure. - *

- * There are three types of nodes: - *

    - *
  • {@link Node}, the most basic form.
  • - *
  • {@link Component}, used to expose callbacks to user code.
  • - *
  • {@link Connector}, used for consuming of producing energy.
  • - *
- *

- * See Node for more details on the behavior of single nodes, and in - * particular how nodes represented by tile entities should be added. - *

- * Another important concept of node networks is reachability and visibility, - * see {@link Visibility}. - *

- * Note that network access in general is not thread safe! Networks - * should only be accessed from the main server thread. The exception are the - * connector nodes, which can be used to consume or produce energy from other - * threads. - *

- * IMPORTANT: do *not* implement this interface yourself and create - * instances of your own network implementation; this will lead to - * incompatibilities with the built-in network implementation (which can only - * merge with other networks of its own type). Always use the methods provided - * in {@link li.cil.oc.api.Network} to create and join networks. - */ -public interface Network { - /** - * Adds a new node connection in the network. - *

- * This is used by nodes to join an existing network. At least one of the two - * nodes must already be in the network. If one of the nodes is not yet in the - * network, it will be added to the network. If both nodes are already in the - * network only the connection between the two nodes is added. If one of the - * nodes is not in this network but in another network, the networks will be - * merged. - *

- * This way of adding nodes is used to build an internal graph to allow - * properly splitting networks when nodes are removed. - * - * @param nodeA the first node. - * @param nodeB the second node. - * @return true if a new connection between the two nodes was added; false if - * the connection already existed. - * @throws IllegalArgumentException if neither node is in this network. - */ - boolean connect(Node nodeA, Node nodeB); - - /** - * Removes a node connection in the network. - *

- * Both nodes must be part of this network. - *

- * This can be useful for cutting connections that depend on some condition - * that does not involve the nodes' actual existence in the network, such as - * the distance between two nodes, for example (think access points of a - * wireless network). - * - * @param nodeA the first node. - * @param nodeB the second node. - * @return true if the connection was cut; false if there was none. - * @throws IllegalArgumentException if the nodes are not in this network. - */ - boolean disconnect(Node nodeA, Node nodeB); - - /** - * Removes a node from the network. - *

- * This should be called by nodes when they are destroyed (e.g. in - * {@link net.minecraft.tileentity.TileEntity#invalidate()}) or unloaded - * (e.g. in {@link net.minecraft.tileentity.TileEntity#onChunkUnload()}). - * Removing the node can lead to one or more new networks if it was the a - * bridge node, i.e. the only node connecting the resulting networks. - * - * @param node the node to remove from the network. - * @return true if the node was removed; false if it wasn't in the network. - */ - boolean remove(Node node); - - // ----------------------------------------------------------------------- // - - /** - * Get the network node with the specified address. - * - * @param address the address of the node to get. - * @return the node with that address. - */ - Node node(String address); - - /** - * The list of all nodes in this network. - * - * @return the list of nodes in this network. - */ - Iterable nodes(); - - /** - * The list of addressed nodes in the network visible to the specified node. - *

- * This does not include nodes with a visibility of None - * or a visibility of Neighbors when there is no direct connection - * between that node and the reference node. - *

- * This does not include the node itself. - *

- * This can be useful when performing a delayed initialization of a node. - * For example, computers will use this when starting up to generate - * component_added signals for all visible components in the - * network. - * - * @param reference the node to get the visible other nodes for. - * @return the nodes visible to the specified node. - */ - Iterable nodes(Node reference); - - /** - * The list of nodes the specified node is directly connected to. - *

- * This does include nodes with a visibility of None. - *

- * This does not include the node itself. - *

- * This can be used to verify arguments for components that should only work - * for other components that are directly connected to them, for example. - * - * @param node the node to get the neighbors for. - * @return a list of nodes the node is directly connect to. - * @throws IllegalArgumentException if the specified node is not in this network. - */ - Iterable neighbors(Node node); - - // ----------------------------------------------------------------------- // - - /** - * Sends a message to the node with the specified address. - *

- * If the target node with that address has a visibility of None - * the message will not be delivered to that node. If the target - * node with that address has a visibility of Neighbors and the - * source node is not directly connected to the target the message will - * not be delivered to that node. - *

- * Messages should have a unique name to allow differentiating them when - * handling them in a network node. For example, computers will try to parse - * messages named computer.signal by converting the message data to - * a signal and inject that signal into the machine, so no message not used - * for this purpose should be named computer.signal. - * - * @param source the node that sends the message. - * @param target the id of the node to send the message to. - * @param name the name of the message. - * @param data the message to send. - * @throws IllegalArgumentException if the source node is not in this network. - */ - void sendToAddress(Node source, String target, String name, Object... data); - - /** - * Sends a message to all addressed, visible neighbors of the source node. - *

- * Targets are determined using {@link #neighbors(Node)} and additionally - * filtered for reachability (so that unreachable nodes are ignored). - *

- * Messages should have a unique name to allow differentiating them when - * handling them in a network node. For example, computers will try to parse - * messages named computer.signal by converting the message data to - * a signal and inject that signal into the machine, so no message not used - * for this purpose should be named computer.signal. - * - * @param source the node that sends the message. - * @param name the name of the message. - * @param data the message to send. - * @throws IllegalArgumentException if the source node is not in this network. - * @see #neighbors(Node) - */ - void sendToNeighbors(Node source, String name, Object... data); - - /** - * Sends a message to all addressed nodes reachable to the source node. - *

- * Targets are determined using {@link #nodes(Node)}. - *

- * Messages should have a unique name to allow differentiating them when - * handling them in a network node. For example, computers will try to parse - * messages named computer.signal by converting the message data to - * a signal and inject that signal into the machine, so no message not used - * for this purpose should be named computer.signal. - * - * @param source the node that sends the message. - * @param data the message to send. - * @throws IllegalArgumentException if the source node is not in this network. - * @see #nodes(Node) - */ - void sendToReachable(Node source, String name, Object... data); - - /** - * Sends a message to all addressed nodes visible to the source node. - *

- * Targets are determined using {@link #nodes(Node)} and additionally - * filtered for visibility (so that invisible nodes are ignored). - *

- * Note that messages sent this way are only delivered to other - * components. The message will not be delivered to normal nodes. - *

- * Messages should have a unique name to allow differentiating them when - * handling them in a network node. For example, computers will try to parse - * messages named computer.signal by converting the message data to - * a signal and inject that signal into the machine, so no message not used - * for this purpose should be named computer.signal. - * - * @param source the node that sends the message. - * @param data the message to send. - * @throws IllegalArgumentException if the source node is not in this network. - * @see #nodes(Node) - * @see Component#canBeSeenFrom(Node) - */ - void sendToVisible(Node source, String name, Object... data); -} diff --git a/src/api/java/li/cil/oc/api/network/Node.java b/src/api/java/li/cil/oc/api/network/Node.java deleted file mode 100755 index b50a648ff..000000000 --- a/src/api/java/li/cil/oc/api/network/Node.java +++ /dev/null @@ -1,220 +0,0 @@ -package li.cil.oc.api.network; - -import li.cil.oc.api.Persistable; - -/** - * A single node in a {@link Network}. - *

- * All nodes in a network have a unique address; the network will generate a - * unique address and assign it to new nodes. - *

- * Per default there are two kinds of nodes: tile entities and items. - *

- * Items will usually only have nodes when in containers, such as a computer or - * disk drive. Otherwise you'll have to connect/disconnect them manually as - * desired. - *

- * All other kinds of nodes you may come up with will also have to be - * handled manually. - *

- * Items have to be handled by a corresponding {@link li.cil.oc.api.driver.Item}. - * Existing blocks may be interfaced with the adapter block if a - * {@link li.cil.oc.api.driver.Block} exists that supports the block. - *

- * Important: like the Network interface you must not create - * your own implementations of this interface. Use the factory methods in the - * network API to create new node instances and store them in your environment. - * - * @see Component - */ -public interface Node extends Persistable { - /** - * The environment hosting this node. - *

- * For blocks whose tile entities implement {@link Environment} this will - * be the tile entity. For all other implementations this will be a managed - * environment. - */ - Environment host(); - - /** - * The reachability of this node. - *

- * This is used by the network to control which system messages to deliver - * to which nodes. This value should not change over the lifetime of a node. - *

- * It furthermore determines what is returned by the Network's - * neighbors and nodes functions. - *

- * Note that this has no effect on the real reachability of a node; - * it is only used to filter to which nodes to send connect, disconnect and - * reconnect messages. If addressed directly, the node will still receive - * that message even if it comes from a node that should not be able to see - * it. Therefore nodes should still verify themselves that they want to - * accept a message from the message's source. - *

- * A different matter is a {@link Component}'s visibility, which is - * checked before delivering messages a computer tries to send. - */ - Visibility reachability(); - - /** - * The address of the node, so that it can be found in the network. - *

- * This is used by the network manager when a node is added to a network to - * assign it a unique address, if it doesn't already have one. Nodes must not - * use custom addresses, only those assigned by the network. The only option - * they have is to *not* have an address, which can be useful for "dummy" - * nodes, such as cables. In that case they may ignore the address being set. - */ - String address(); - - /** - * The network this node is currently in. - *

- * Note that valid nodes should never return `None` here. When created a node - * should immediately be added to a network, after being removed from its - * network a node should be considered invalid. - *

- * This will always be set automatically by the network manager. Do not - * change this value and do not return anything that it wasn't set to. - */ - Network network(); - - // ----------------------------------------------------------------------- // - - /** - * Checks whether this node is a neighbor of the specified node. - * - * @param other the node to check for. - * @return whether this node is directly connected to the other node. - */ - boolean isNeighborOf(Node other); - - /** - * Checks whether this node can be reached from the specified node. - * - * @param other the node to check for. - * @return whether this node can be reached from the specified node. - */ - boolean canBeReachedFrom(Node other); - - /** - * Get the list of neighbor nodes, i.e. nodes directly connected to this - * node. - *

- * This is a shortcut for node.network.neighbors(node). - *

- * If this node is not in a network, i.e. network is null, - * this returns an empty list. - * - * @return the list of nodes directly connected to this node. - */ - Iterable neighbors(); - - /** - * Get the list of nodes reachable from this node, based on their - * {@link #reachability()}. - *

- * This is a shortcut for node.network.nodes(node). - *

- * If this node is not in a network, i.e. network is null, - * this returns an empty list. - * - * @return the list of nodes reachable from this node. - */ - Iterable reachableNodes(); - - // ----------------------------------------------------------------------- // - - /** - * Connects the specified node to this node. - *

- * This is a shortcut for node.network.connect(node, other). - *

- * If this node is not in a network, i.e. network is null, - * this will throw an exception. - * - * @param node the node to connect to this node. - * @throws NullPointerException if network is null. - */ - void connect(Node node); - - /** - * Disconnects the specified node from this node. - *

- * This is a shortcut for node.network.disconnect(node, other). - *

- * If this node is not in a network, i.e. network is null, - * this will do nothing. - * - * @param node the node to connect to this node. - * @throws NullPointerException if network is null. - */ - void disconnect(Node node); - - /** - * Removes this node from its network. - *

- * This is a shortcut for node.network.remove(node). - *

- * If this node is not in a network, i.e. network is null, - * this will do nothing. - */ - void remove(); - - // ----------------------------------------------------------------------- // - - /** - * Send a message to a node with the specified address. - *

- * This is a shortcut for node.network.sendToAddress(node, ...). - *

- * If this node is not in a network, i.e. network is null, - * this will do nothing. - * - * @param target the address of the node to send the message to. - * @param name the name of the message. - * @param data the data to pass along with the message. - */ - void sendToAddress(String target, String name, Object... data); - - /** - * Send a message to all neighbors of this node. - *

- * This is a shortcut for node.network.sendToNeighbors(node, ...). - *

- * If this node is not in a network, i.e. network is null, - * this will do nothing. - * - * @param name the name of the message. - * @param data the data to pass along with the message. - */ - void sendToNeighbors(String name, Object... data); - - /** - * Send a message to all nodes reachable from this node. - *

- * This is a shortcut for node.network.sendToReachable(node, ...). - *

- * If this node is not in a network, i.e. network is null, - * this will do nothing. - * - * @param name the name of the message. - * @param data the data to pass along with the message. - */ - void sendToReachable(String name, Object... data); - - /** - * Send a message to all nodes visible from this node. - *

- * This is a shortcut for node.network.sendToVisible(node, ...). - *

- * If this node is not in a network, i.e. network is null, - * this will do nothing. - * - * @param name the name of the message. - * @param data the data to pass along with the message. - */ - void sendToVisible(String name, Object... data); -} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/network/Packet.java b/src/api/java/li/cil/oc/api/network/Packet.java deleted file mode 100755 index 233e72018..000000000 --- a/src/api/java/li/cil/oc/api/network/Packet.java +++ /dev/null @@ -1,69 +0,0 @@ -package li.cil.oc.api.network; - -import net.minecraft.nbt.NBTTagCompound; - -/** - * These packets represent messages sent using a network card or wireless - * network card, and can be relayed by the switch and access point blocks. - *

- * These will be sent as the payload of network.message messages. - *

- * Important: do not implement this interface. Use the factory - * methods in {@link li.cil.oc.api.Network} instead. - */ -public interface Packet { - /** - * The address of the original sender of this packet. - */ - String source(); - - /** - * The address of the destination of the packet. This is null for - * broadcast packets. - */ - String destination(); - - /** - * The port this packet is being sent to. - */ - int port(); - - /** - * The payload of the packet. This will usually only contain simple types, - * to allow persisting the packet. - */ - Object[] data(); - - /** - * The size of the packet's payload. - *

- * This is computed based on the types in the data array, but is only defined - * for primitive types, i.e. null, boolean, integer, boolean byte array and - * string. All other types do not contribute to the packet's size. - */ - int size(); - - /** - * The remaining 'time to live' for this packet. When a packet with a TTL of - * zero is received it will not be relayed by switches and access points. It - * will however still be received by a network card. - */ - int ttl(); - - /** - * Generates a copy of the packet, with a reduced time to live. - *

- * This is called by switches and access points to generate relayed packets. - * - * @return a copy of this packet with a reduced TTL. - */ - Packet hop(); - - /** - * Saves the packet's data to the specified compound tag. - *

- * Restore a packet saved like this using the factory method in the - * {@link li.cil.oc.api.Network} class. - */ - void save(NBTTagCompound nbt); -} diff --git a/src/api/java/li/cil/oc/api/network/SidedComponent.java b/src/api/java/li/cil/oc/api/network/SidedComponent.java deleted file mode 100755 index bc5eea0dd..000000000 --- a/src/api/java/li/cil/oc/api/network/SidedComponent.java +++ /dev/null @@ -1,26 +0,0 @@ -package li.cil.oc.api.network; - -import net.minecraft.util.EnumFacing; - -/** - * This is an extended version of {@link li.cil.oc.api.network.SimpleComponent} - * which allows controlling connectivity on a side-by-side basis. - *

- * Like the SimpleComponent interface, this is intended to be used - * with tile entities that should act as OC components. Please see the - * SimpleComponent interface for more information. - */ -public interface SidedComponent { - /** - * Whether this component can connect to a node on the specified side. - *

- * The provided side is relative to the component, i.e. when the tile - * entity sits at (0, 0, 0) and is asked for its southern node (positive - * Z axis) it has to return the connectivity for the face between it and - * the block at (0, 0, 1). - * - * @param side the side to check for. - * @return whether the component may be connected to from the specified side. - */ - boolean canConnectNode(EnumFacing side); -} diff --git a/src/api/java/li/cil/oc/api/network/SidedEnvironment.java b/src/api/java/li/cil/oc/api/network/SidedEnvironment.java deleted file mode 100755 index 125710043..000000000 --- a/src/api/java/li/cil/oc/api/network/SidedEnvironment.java +++ /dev/null @@ -1,55 +0,0 @@ -package li.cil.oc.api.network; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** - * This interface is like {@link net.minecraft.inventory.ISidedInventory} is to - * {@link net.minecraft.inventory.IInventory}, it allows an environment to - * specify different node access for its different sides. - *

- * This interface is intended to be used on tile entities that are environments. - * It is used to determine which neighbors a tile entity can connect to when - * calling {@link li.cil.oc.api.Network#joinOrCreateNetwork(TileEntity)}. It is - * used by the keyboard to only interface with the side on which it is attached, - * as well as the switch to offer a different node for each side. - */ -public interface SidedEnvironment { - /** - * The node this environment uses for the specified side. - *

- * This is the side aware version of the normal {@link li.cil.oc.api.network.Environment#node} - * method. - *

- * The provided side is relative to the environment, i.e. when the tile - * entity hosting the environment sits at (0, 0, 0) and is asked for its - * southern node (positive Z axis) it has to return the node for the face - * between it and the block at (0, 0, 1). - * - * @param side the side to get the node for. - * @return the node for the specified side. - * @see li.cil.oc.api.network.Environment#node - */ - Node sidedNode(EnumFacing side); - - /** - * Whether the environment provides a node to connect to on the specified - * side. - *

- * For each side the environment returns false here, it should - * return null from {@link #sidedNode}, and for each side it - * returns true for it should return a node. - *

- * This is intended for the client side, i.e. rendering related things, - * since nodes are not created on the client side. - *

- * The side is relative to the environment, same as for sidedNode. - * - * @param side the side to check for. - * @return whether the environment provides a node for the specified side. - */ - @SideOnly(Side.CLIENT) - boolean canConnect(EnumFacing side); -} diff --git a/src/api/java/li/cil/oc/api/network/SimpleComponent.java b/src/api/java/li/cil/oc/api/network/SimpleComponent.java deleted file mode 100755 index 7c5d10de3..000000000 --- a/src/api/java/li/cil/oc/api/network/SimpleComponent.java +++ /dev/null @@ -1,114 +0,0 @@ -package li.cil.oc.api.network; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * This interface can be used to easily convert tile entities to components, - * without having to implement {@link li.cil.oc.api.network.Environment} - * themselves. The simple implementation will provide no access to OC's internal - * component network, since you won't have access to the node representing the - * tile entity. Use this only for simple cases, where you want to expose a - * couple of methods to the programs running computers. - *

- * This is an interface instead of an annotation, to allow stripping via the - * ever so handy {@link net.minecraftforge.fml.common.Optional} annotation, - * meaning there will be no strong dependency on OpenComputers. - *

- * Classes implementing this interface will be expanded with the methods - * required for them to function as native block components (say, like the - * screen or keyboard). This means functions in the Environment - * interface have to created using a class transformer. If any of the methods - * already exist, this will fail! If things don't work, check your logs, first. - *

- * To expose methods to OC, tag them with {@link li.cil.oc.api.machine.Callback} - * and have them use the according signature (see the documentation on the - * Callback annotation). - *

- * Alternatively, implement {@link li.cil.oc.api.network.ManagedPeripheral} in - * addition to this interface, to make methods available ComputerCraft style. - *

- * So, in short: - *

    - *
  • Implement this interface on a tile entity that should expose - * methods to computers.
  • - *
  • Annotate methods with Callback so they exported.
  • - *
  • Alternatively/additionally implement ManagedPeripheral to - * provide methods via a list of names and single callback method.
  • - *
- *

- * For example: - *

- *     {@literal @}Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")
- *     public class TileEntityMyFancyThing extends TileEntity
- *            implements SimpleComponent
- *     {
- *         {@literal @}Override
- *         public String getComponentName() {
- *             return "fancy_thing";
- *         }
- *
- *         {@literal @}Callback
- *         {@literal @}Optional.Method(modid = "OpenComputers")
- *         public Object[] greet(Context context, Arguments args) {
- *             return new Object[]{String.format("Hello, %s!", args.checkString(0))};
- *         }
- *     }
- * 
- * Using the alternative method to provide methods: - *
- *     {@literal @}Optional.InterfaceList({
- *         {@literal @}Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
- *         {@literal @}Optional.Interface(iface = "li.cil.oc.api.network.ManagedPeripheral", modid = "OpenComputers")
- *     })
- *     public class TileEntityMyFancyThing extends TileEntity
- *            implements SimpleComponent, ManagedPeripheral
- *     {
- *         {@literal @}Override
- *         public String getComponentName() {
- *             return "fancy_thing";
- *         }
- *
- *         public String[] methods() {
- *             return new String[] {"greet"};
- *         }
- *
- *         {@literal @}Optional.Method(modid = "OpenComputers")
- *         public Object[] invoke(String method, Context context, Arguments args) {
- *             if ("greet".equals(method)) {
- *                 return new Object[]{String.format("Hello, %s!", args.checkString(0))};
- *             } else {
- *                 throw new NoSuchMethodException();
- *             }
- *         }
- *     }
- * 
- */ -public interface SimpleComponent { - /** - * The name the component should be made available as. - *

component.list() in Lua, for - * example. You'll want to make this short and descriptive. The convention - * for component names is: all lowercase, underscores where necessary. Good - * component names are for example: disk_drive, furnace, crafting_table. - * - * @return the component's name. - */ - String getComponentName(); - - /** - * Use this to skip logic injection for the class this is implemented by. - *

- * For example, if you have a class transformer that injects logic from a - * template class into your actual tile entities, OC's class transformer - * would complain when it finds the interface on the template class. That - * warning can be suppressed by using this annotation on the template. - */ - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.TYPE) - @interface SkipInjection { - } -} diff --git a/src/api/java/li/cil/oc/api/network/Visibility.java b/src/api/java/li/cil/oc/api/network/Visibility.java deleted file mode 100755 index e91a79043..000000000 --- a/src/api/java/li/cil/oc/api/network/Visibility.java +++ /dev/null @@ -1,42 +0,0 @@ -package li.cil.oc.api.network; - -/** - * Possible reachability values for nodes. - *

- * Since all nodes that are connected are packed into the same network, we want - * some way of controlling what's accessible from where on a low level (to - * avoid unnecessary messages and unauthorized access). - *

- * Note that there is a more specific kind of visibility for components. See - * {@link Component} for more details on that. - */ -public enum Visibility { - /** - * Nodes with this visibility neither receive nor send messages. - *

- * Components with this visibility cannot be seen nor reached by computers. - */ - None, - - /** - * Nodes with this visibility only receive messages from their immediate - * neighbors, i.e. nodes to which a direct connection exists. It can send - * messages to all nodes visible to it. - *

- * Components with this visibility can likewise only be reached by the - * computer(s) they are directly attached to. For example, if a block - * component is placed directly next to the computer, or an item installed - * in the computer (i.e. it is in the computer's inventory). - */ - Neighbors, - - /** - * Nodes with this visibility can receive messages from any node in its - * network. It can still only send messages to all nodes visible to it. - *

- * Components with this visibility are likewise reachable by all computers - * in their network. For example, a screen only indirectly connected to a - * computer will still be addressable by that computer. - */ - Network -} diff --git a/src/api/java/li/cil/oc/api/network/WirelessEndpoint.java b/src/api/java/li/cil/oc/api/network/WirelessEndpoint.java deleted file mode 100755 index c5de36d3d..000000000 --- a/src/api/java/li/cil/oc/api/network/WirelessEndpoint.java +++ /dev/null @@ -1,47 +0,0 @@ -package li.cil.oc.api.network; - -import net.minecraft.world.World; - -/** - * Interface for wireless endpoints that can be registered with the internal - * wireless network registry. - *

- * These can be added to the wireless network via the Network API, to - * allow them to receive packets like wireless network cards and access points - * do (and handle or forward them as they see fit). - *

- * If the position of the endpoint can change, it must be updated manually via - * {@link li.cil.oc.api.Network#updateWirelessNetwork(WirelessEndpoint)}. - */ -public interface WirelessEndpoint { - /** - * The X coordinate of the endpoint in the world, in block coordinates. - */ - int x(); - - /** - * The Y coordinate of the endpoint in the world, in block coordinates. - */ - int y(); - - /** - * The Z coordinate of the endpoint in the world, in block coordinates. - */ - int z(); - - /** - * The world this endpoint lives in. - */ - World world(); - - /** - * Makes the endpoint receive a single packet. - * - * @param packet the packet to receive. - * @param sender the endpoint that sent the message. This is not - * necessarily the original sender of the packet, just - * the last point it went through, such as an access - * point, for example. - */ - void receivePacket(Packet packet, WirelessEndpoint sender); -} diff --git a/src/api/java/li/cil/oc/api/network/package-info.java b/src/api/java/li/cil/oc/api/network/package-info.java deleted file mode 100755 index 4892d137c..000000000 --- a/src/api/java/li/cil/oc/api/network/package-info.java +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This package provides component networking related functionality. - *

- * This mainly involves the (purely server-side!) network that is spanned over - * all of OpenComputers' components, including blocks and items alike. - */ -@net.minecraftforge.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Network", - apiVersion = API.VERSION) -package li.cil.oc.api.network; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/package-info.java b/src/api/java/li/cil/oc/api/package-info.java deleted file mode 100755 index f0d055739..000000000 --- a/src/api/java/li/cil/oc/api/package-info.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * This API provides interfaces and factory methods for the OpenComputers mod. - *

- * There are several parts to this API: - *

- *
The {@link li.cil.oc.api.Driver} API
- *
- * This API is used to provide glue code to the mod that allows it to interact - * with foreign objects. You need a driver if you wish to connect some object - * to the internal {@link li.cil.oc.api.network.Network}, for example because - * you wish to interact with other blocks / components of the mod. The most - * typical scenario for this will be adding a new object that user programs - * should be able to interact with: a {@link li.cil.oc.api.network.Component}. - *

- * Note that for tile entities you implement yourself, you will not have to - * provide a driver, as long as you implement the necessary interface: - * {@link li.cil.oc.api.network.Environment} and call {@link li.cil.oc.api.Network#joinOrCreateNetwork(net.minecraft.tileentity.TileEntity)} - * in the first updateEntity() call. For items that should be installed - * in a computer you will always have to provide a driver. - *

- *
The {@link li.cil.oc.api.FileSystem} API
- *
- * This API provides facilities that make it easier to create file systems that - * can be interacted with from user programs via the file system driver that - * comes with the mod. - *
- *
The {@link li.cil.oc.api.Network} API
- *
- * This API provides interfaces that allow interacting with the internal network - * and creating nodes, components and power connectors for said network. If you - * implement Environment in your tile entity or provide a - * {@link li.cil.oc.api.network.ManagedEnvironment} via a driver you'll want to - * create a node. This API provides factory methods for creating it. - *
- *
- */ -@net.minecraftforge.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Core", - apiVersion = API.VERSION) -package li.cil.oc.api; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/prefab/AbstractBehavior.java b/src/api/java/li/cil/oc/api/prefab/AbstractBehavior.java deleted file mode 100755 index ea1ad4bb9..000000000 --- a/src/api/java/li/cil/oc/api/prefab/AbstractBehavior.java +++ /dev/null @@ -1,52 +0,0 @@ -package li.cil.oc.api.prefab; - -import li.cil.oc.api.nanomachines.Behavior; -import li.cil.oc.api.nanomachines.DisableReason; -import net.minecraft.entity.player.EntityPlayer; - -/** - * Base class for behaviors, mostly useful to have less cluttered classes when - * you only need one or two of the methods in the interface. - *

- * This implementation will also store the player the behavior was created for. - */ -public abstract class AbstractBehavior implements Behavior { - /** - * The player this behavior was created for. - */ - public final EntityPlayer player; - - /** - * Pass along the player the behavior was created for here to have it stored - * for later use. - * - * @param player the player the behavior was created for. - */ - protected AbstractBehavior(EntityPlayer player) { - this.player = player; - } - - /** - * Use this if you do not need the player reference in your implementation. - */ - protected AbstractBehavior() { - this(null); - } - - @Override - public String getNameHint() { - return null; - } - - @Override - public void onEnable() { - } - - @Override - public void onDisable(DisableReason reason) { - } - - @Override - public void update() { - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/AbstractInteractiveImageRenderer.java b/src/api/java/li/cil/oc/api/prefab/AbstractInteractiveImageRenderer.java deleted file mode 100755 index a7ef3b20b..000000000 --- a/src/api/java/li/cil/oc/api/prefab/AbstractInteractiveImageRenderer.java +++ /dev/null @@ -1,19 +0,0 @@ -package li.cil.oc.api.prefab; - -import li.cil.oc.api.manual.InteractiveImageRenderer; - -/** - * Simple base implementation of {@link li.cil.oc.api.manual.InteractiveImageRenderer}. - */ -@SuppressWarnings("UnusedDeclaration") -public abstract class AbstractInteractiveImageRenderer implements InteractiveImageRenderer { - @Override - public String getTooltip(String tooltip) { - return tooltip; - } - - @Override - public boolean onMouseClick(int mouseX, int mouseY) { - return false; - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/AbstractProvider.java b/src/api/java/li/cil/oc/api/prefab/AbstractProvider.java deleted file mode 100755 index 9f0393835..000000000 --- a/src/api/java/li/cil/oc/api/prefab/AbstractProvider.java +++ /dev/null @@ -1,74 +0,0 @@ -package li.cil.oc.api.prefab; - -import li.cil.oc.api.nanomachines.Behavior; -import li.cil.oc.api.nanomachines.BehaviorProvider; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; - -/** - * Example base implementation of nanomachine behavior provider. - *

- * This class takes care of handling the unique identifier used to tell - * if a behavior is its own when loading from NBT. - */ -public abstract class AbstractProvider implements BehaviorProvider { - /** - * Unique identifier used to tell if a behavior is ours when asked to load it. - */ - protected final String id; - - /** - * For the ID passed in here, it is suggested to use a one-time generated - * UUID that is hard-coded into your provider implementation. Take care to - * use a different one for each provider you create! - * - * @param id the unique identifier for this provider. - */ - protected AbstractProvider(String id) { - if (id == null) throw new NullPointerException("id must not be null"); - this.id = id; - } - - /** - * Called when saving a behavior created using this behavior to NBT. - *

- * The ID will already have been written, don't overwrite it. Store - * any additional data you need to restore the behavior here, if any. - * - * @param behavior the behavior to persist. - * @param nbt the NBT tag to persist it to. - */ - protected void writeBehaviorToNBT(Behavior behavior, NBTTagCompound nbt) { - } - - /** - * Called when loading a behavior from NBT. - *

- * Use the data written in {@link #writeBehaviorToNBT} to restore the behavior - * to its previous state, then return it. - * - * @param player the player to restore the behavior for. - * @param nbt the NBT tag to load restore the behavior from. - * @return the restored behavior. - */ - protected abstract Behavior readBehaviorFromNBT(EntityPlayer player, NBTTagCompound nbt); - - // ----------------------------------------------------------------------- // - - @Override - public NBTTagCompound writeToNBT(Behavior behavior) { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setString("provider", id); - writeBehaviorToNBT(behavior, nbt); - return nbt; - } - - @Override - public Behavior readFromNBT(EntityPlayer player, NBTTagCompound nbt) { - if (id.equals(nbt.getString("provider"))) { - return readBehaviorFromNBT(player, nbt); - } else { - return null; - } - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/AbstractValue.java b/src/api/java/li/cil/oc/api/prefab/AbstractValue.java deleted file mode 100755 index 7d686b5df..000000000 --- a/src/api/java/li/cil/oc/api/prefab/AbstractValue.java +++ /dev/null @@ -1,37 +0,0 @@ -package li.cil.oc.api.prefab; - -import li.cil.oc.api.machine.Arguments; -import li.cil.oc.api.machine.Context; -import li.cil.oc.api.machine.Value; -import net.minecraft.nbt.NBTTagCompound; - -/** - * Basic implementation for the Value interface. - */ -public class AbstractValue implements Value { - @Override - public Object apply(Context context, Arguments arguments) { - return null; - } - - @Override - public void unapply(Context context, Arguments arguments) { - } - - @Override - public Object[] call(Context context, Arguments arguments) { - throw new RuntimeException("trying to call a non-callable value"); - } - - @Override - public void dispose(Context context) { - } - - @Override - public void load(NBTTagCompound nbt) { - } - - @Override - public void save(NBTTagCompound nbt) { - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/DriverBlock.java b/src/api/java/li/cil/oc/api/prefab/DriverBlock.java deleted file mode 100755 index b672abccd..000000000 --- a/src/api/java/li/cil/oc/api/prefab/DriverBlock.java +++ /dev/null @@ -1,55 +0,0 @@ -package li.cil.oc.api.prefab; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.oredict.OreDictionary; - -/** - * If you wish to create a block component for a third-party block, i.e. a block - * for which you do not control the tile entity, such as vanilla blocks, you - * will need a block driver. - *

- * This prefab allows creating a driver that works for a specified list of item - * stacks (to support different blocks with the same id but different metadata - * values). - *

- * You still have to provide the implementation for creating its environment, if - * any. - * - * @see li.cil.oc.api.network.ManagedEnvironment - * @deprecated Use {@link DriverSidedBlock} instead. - */ -@Deprecated // TODO Remove in OC 1.7 -@SuppressWarnings("UnusedDeclaration") -public abstract class DriverBlock implements li.cil.oc.api.driver.Block { - protected final ItemStack[] blocks; - - protected DriverBlock(final ItemStack... blocks) { - this.blocks = blocks.clone(); - } - - @Override - public boolean worksWith(final World world, final BlockPos pos) { - final IBlockState state = world.getBlockState(pos); - final Block block = state.getBlock(); - return worksWith(block, block.getMetaFromState(state)); - } - - protected boolean worksWith(final Block referenceBlock, final int referenceMetadata) { - for (ItemStack stack : blocks) { - if (stack != null && stack.getItem() instanceof ItemBlock) { - final ItemBlock item = (ItemBlock) stack.getItem(); - final Block supportedBlock = item.getBlock(); - final int supportedMetadata = item.getMetadata(stack.getItemDamage()); - if (referenceBlock == supportedBlock && (referenceMetadata == supportedMetadata || stack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) { - return true; - } - } - } - return false; - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/DriverItem.java b/src/api/java/li/cil/oc/api/prefab/DriverItem.java deleted file mode 100755 index 5b098a449..000000000 --- a/src/api/java/li/cil/oc/api/prefab/DriverItem.java +++ /dev/null @@ -1,85 +0,0 @@ -package li.cil.oc.api.prefab; - -import li.cil.oc.api.network.EnvironmentHost; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -/** - * If you wish to create item components such as the network card or hard drives - * you will need an item driver. - *

- * This prefab allows creating a driver that works for a specified list of item - * stacks (to support different items with the same id but different damage - * values). It also takes care of creating and getting the tag compound on an - * item stack to save data to or load data from. - *

- * You still have to specify your component's slot type and provide the - * implementation for creating its environment, if any. - * - * @see li.cil.oc.api.network.ManagedEnvironment - */ -@SuppressWarnings("UnusedDeclaration") -public abstract class DriverItem implements li.cil.oc.api.driver.Item { - protected final ItemStack[] items; - - protected DriverItem(final ItemStack... items) { - this.items = items.clone(); - } - - @Override - public boolean worksWith(final ItemStack stack) { - if (stack != null) { - for (ItemStack item : items) { - if (item != null && item.isItemEqual(stack)) { - return true; - } - } - } - return false; - } - - @Override - public int tier(final ItemStack stack) { - return 0; - } - - @Override - public NBTTagCompound dataTag(final ItemStack stack) { - if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); - } - final NBTTagCompound nbt = stack.getTagCompound(); - // This is the suggested key under which to store item component data. - // You are free to change this as you please. - if (!nbt.hasKey("oc:data")) { - nbt.setTag("oc:data", new NBTTagCompound()); - } - return nbt.getCompoundTag("oc:data"); - } - - // Convenience methods provided for HostAware drivers. - - protected boolean isAdapter(Class host) { - return li.cil.oc.api.internal.Adapter.class.isAssignableFrom(host); - } - - protected boolean isComputer(Class host) { - return li.cil.oc.api.internal.Case.class.isAssignableFrom(host); - } - - protected boolean isRobot(Class host) { - return li.cil.oc.api.internal.Robot.class.isAssignableFrom(host); - } - - protected boolean isRotatable(Class host) { - return li.cil.oc.api.internal.Rotatable.class.isAssignableFrom(host); - } - - protected boolean isServer(Class host) { - return li.cil.oc.api.internal.Server.class.isAssignableFrom(host); - } - - protected boolean isTablet(Class host) { - return li.cil.oc.api.internal.Tablet.class.isAssignableFrom(host); - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/DriverSidedBlock.java b/src/api/java/li/cil/oc/api/prefab/DriverSidedBlock.java deleted file mode 100755 index 3f4db0ee5..000000000 --- a/src/api/java/li/cil/oc/api/prefab/DriverSidedBlock.java +++ /dev/null @@ -1,57 +0,0 @@ -package li.cil.oc.api.prefab; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; -import net.minecraftforge.oredict.OreDictionary; - -/** - * If you wish to create a block component for a third-party block, i.e. a block - * for which you do not control the tile entity, such as vanilla blocks, you - * will need a block driver. - *

- * This prefab allows creating a driver that works for a specified list of item - * stacks (to support different blocks with the same id but different metadata - * values). - *

- * You still have to provide the implementation for creating its environment, if - * any. - *

- * To limit sidedness, I recommend overriding {@link #worksWith(World, BlockPos, EnumFacing)} - * and calling super.worksWith in addition to the side check. - * - * @see li.cil.oc.api.network.ManagedEnvironment - */ -@SuppressWarnings("UnusedDeclaration") -public abstract class DriverSidedBlock implements li.cil.oc.api.driver.SidedBlock { - protected final ItemStack[] blocks; - - protected DriverSidedBlock(final ItemStack... blocks) { - this.blocks = blocks.clone(); - } - - @Override - public boolean worksWith(final World world, final BlockPos pos, final EnumFacing side) { - final IBlockState state = world.getBlockState(pos); - final Block block = state.getBlock(); - return worksWith(block, block.getMetaFromState(state)); - } - - protected boolean worksWith(final Block referenceBlock, final int referenceMetadata) { - for (ItemStack stack : blocks) { - if (stack != null && stack.getItem() instanceof ItemBlock) { - final ItemBlock item = (ItemBlock) stack.getItem(); - final Block supportedBlock = item.getBlock(); - final int supportedMetadata = item.getMetadata(stack.getItemDamage()); - if (referenceBlock == supportedBlock && (referenceMetadata == supportedMetadata || stack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) { - return true; - } - } - } - return false; - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/DriverSidedTileEntity.java b/src/api/java/li/cil/oc/api/prefab/DriverSidedTileEntity.java deleted file mode 100755 index 0b06f2e6b..000000000 --- a/src/api/java/li/cil/oc/api/prefab/DriverSidedTileEntity.java +++ /dev/null @@ -1,26 +0,0 @@ -package li.cil.oc.api.prefab; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -/** - * To limit sidedness, I recommend overriding {@link #worksWith(World, BlockPos, EnumFacing)} - * and calling super.worksWith in addition to the side check. - */ -public abstract class DriverSidedTileEntity implements li.cil.oc.api.driver.SidedBlock { - public abstract Class getTileEntityClass(); - - @Override - public boolean worksWith(final World world, final BlockPos pos, final EnumFacing side) { - final Class filter = getTileEntityClass(); - if (filter == null) { - // This can happen if filter classes are deduced by reflection and - // the class in question is not present. - return false; - } - final TileEntity tileEntity = world.getTileEntity(pos); - return tileEntity != null && filter.isAssignableFrom(tileEntity.getClass()); - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/DriverTileEntity.java b/src/api/java/li/cil/oc/api/prefab/DriverTileEntity.java deleted file mode 100755 index 061dd6486..000000000 --- a/src/api/java/li/cil/oc/api/prefab/DriverTileEntity.java +++ /dev/null @@ -1,25 +0,0 @@ -package li.cil.oc.api.prefab; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -/** - * @deprecated Use {@link DriverSidedTileEntity} instead. - */ -@Deprecated // TODO Remove in OC 1.7 -public abstract class DriverTileEntity implements li.cil.oc.api.driver.Block { - public abstract Class getTileEntityClass(); - - @Override - public boolean worksWith(final World world, final BlockPos pos) { - final Class filter = getTileEntityClass(); - if (filter == null) { - // This can happen if filter classes are deduced by reflection and - // the class in question is not present. - return false; - } - final TileEntity tileEntity = world.getTileEntity(pos); - return tileEntity != null && filter.isAssignableFrom(tileEntity.getClass()); - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/ItemStackTabIconRenderer.java b/src/api/java/li/cil/oc/api/prefab/ItemStackTabIconRenderer.java deleted file mode 100755 index 5c42ff214..000000000 --- a/src/api/java/li/cil/oc/api/prefab/ItemStackTabIconRenderer.java +++ /dev/null @@ -1,32 +0,0 @@ -package li.cil.oc.api.prefab; - -import li.cil.oc.api.manual.TabIconRenderer; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** - * Simple implementation of a tab icon renderer using an item stack as its graphic. - */ -@SuppressWarnings("UnusedDeclaration") -public class ItemStackTabIconRenderer implements TabIconRenderer { - private final ItemStack stack; - - public ItemStackTabIconRenderer(ItemStack stack) { - this.stack = stack; - } - - @SideOnly(Side.CLIENT) - @Override - public void render() { - GlStateManager.enableRescaleNormal(); - RenderHelper.enableGUIStandardItemLighting(); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240); - Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(stack, 0, 0); - RenderHelper.disableStandardItemLighting(); - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/ManagedEnvironment.java b/src/api/java/li/cil/oc/api/prefab/ManagedEnvironment.java deleted file mode 100755 index 3841707c6..000000000 --- a/src/api/java/li/cil/oc/api/prefab/ManagedEnvironment.java +++ /dev/null @@ -1,76 +0,0 @@ -package li.cil.oc.api.prefab; - -import li.cil.oc.api.network.Message; -import li.cil.oc.api.network.Node; -import net.minecraft.nbt.NBTTagCompound; - -/** - * Simple base implementation of the ManagedEnvironment interface, so - * unused methods don't clutter the implementing class. - */ -public abstract class ManagedEnvironment implements li.cil.oc.api.network.ManagedEnvironment { - public static final String NODE_TAG = "node"; - - // Should be initialized using setNode(api.Network.newNode()). See TileEntityEnvironment. - private Node _node; - - @Override - public Node node() { - return _node; - } - - protected void setNode(Node value) { - _node = value; - } - - @Override - public boolean canUpdate() { - return false; - } - - @Override - public void update() { - } - - @Override - public void onConnect(final Node node) { - } - - @Override - public void onDisconnect(final Node node) { - } - - @Override - public void onMessage(final Message message) { - } - - @Override - public void load(final NBTTagCompound nbt) { - if (node() != null) { - node().load(nbt.getCompoundTag(NODE_TAG)); - } - } - - @Override - public void save(final NBTTagCompound nbt) { - if (node() != null) { - // Force joining a network when saving and we're not in one yet, so that - // the address is embedded in the saved data that gets sent to the client, - // so that that address can be used to associate components on server and - // client (for example keyboard and screen/text buffer). - if (node().address() == null) { - li.cil.oc.api.Network.joinNewNetwork(node()); - - final NBTTagCompound nodeTag = new NBTTagCompound(); - node().save(nodeTag); - nbt.setTag(NODE_TAG, nodeTag); - - node().remove(); - } else { - final NBTTagCompound nodeTag = new NBTTagCompound(); - node().save(nodeTag); - nbt.setTag(NODE_TAG, nodeTag); - } - } - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/ResourceContentProvider.java b/src/api/java/li/cil/oc/api/prefab/ResourceContentProvider.java deleted file mode 100755 index 44d5efe68..000000000 --- a/src/api/java/li/cil/oc/api/prefab/ResourceContentProvider.java +++ /dev/null @@ -1,65 +0,0 @@ -package li.cil.oc.api.prefab; - -import com.google.common.base.Charsets; -import li.cil.oc.api.manual.ContentProvider; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ResourceLocation; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; - -/** - * Basic implementation of a content provider based on Minecraft's resource - * loading framework. - *

- * Beware that the manual is unaware of resource domains. In other words, two - * paths that are identical except for their resource domain will be the same, - * as seen from the manual. This means you should probably place your - * documentation somewhere other than doc/, because that's where the - * OpenComputers documentation lives, and it is queried first - meaning if you - * have a page with the same path as one in OpenComputers, it is practically - * unreachable (because the OC provider is always queried first). - */ -@SuppressWarnings("UnusedDeclaration") -public class ResourceContentProvider implements ContentProvider { - private final String resourceDomain; - - private final String basePath; - - public ResourceContentProvider(String resourceDomain, String basePath) { - this.resourceDomain = resourceDomain; - this.basePath = basePath; - } - - public ResourceContentProvider(String resourceDomain) { - this(resourceDomain, ""); - } - - @Override - public Iterable getContent(String path) { - final ResourceLocation location = new ResourceLocation(resourceDomain, basePath + (path.startsWith("/") ? path.substring(1) : path)); - InputStream is = null; - try { - is = Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream(); - final BufferedReader reader = new BufferedReader(new InputStreamReader(is, Charsets.UTF_8)); - final ArrayList lines = new ArrayList(); - String line; - while ((line = reader.readLine()) != null) { - lines.add(line); - } - return lines; - } catch (Throwable ignored) { - return null; - } finally { - if (is != null) { - try { - is.close(); - } catch (IOException ignored) { - } - } - } - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/TextureTabIconRenderer.java b/src/api/java/li/cil/oc/api/prefab/TextureTabIconRenderer.java deleted file mode 100755 index f87057695..000000000 --- a/src/api/java/li/cil/oc/api/prefab/TextureTabIconRenderer.java +++ /dev/null @@ -1,38 +0,0 @@ -package li.cil.oc.api.prefab; - -import li.cil.oc.api.manual.TabIconRenderer; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.VertexBuffer; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import org.lwjgl.opengl.GL11; - -/** - * Simple implementation of a tab icon renderer using a full texture as its graphic. - */ -@SuppressWarnings("UnusedDeclaration") -public class TextureTabIconRenderer implements TabIconRenderer { - private final ResourceLocation location; - - public TextureTabIconRenderer(ResourceLocation location) { - this.location = location; - } - - @Override - @SideOnly(Side.CLIENT) - public void render() { - Minecraft.getMinecraft().getTextureManager().bindTexture(location); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, Minecraft.getMinecraft().getTextureManager().getTexture(location).getGlTextureId()); - final Tessellator t = Tessellator.getInstance(); - final VertexBuffer r = t.getBuffer(); - r.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); - r.pos(0, 16, 0).tex(0, 1).endVertex(); - r.pos(16, 16, 0).tex(1, 1).endVertex(); - r.pos(16, 0, 0).tex(1, 0).endVertex(); - r.pos(0, 0, 0).tex(0, 0).endVertex(); - t.draw(); - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/TileEntityEnvironment.java b/src/api/java/li/cil/oc/api/prefab/TileEntityEnvironment.java deleted file mode 100755 index 531552534..000000000 --- a/src/api/java/li/cil/oc/api/prefab/TileEntityEnvironment.java +++ /dev/null @@ -1,157 +0,0 @@ -package li.cil.oc.api.prefab; - -import li.cil.oc.api.Network; -import li.cil.oc.api.network.Environment; -import li.cil.oc.api.network.Message; -import li.cil.oc.api.network.Node; -import li.cil.oc.api.network.Visibility; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ITickable; - -/** - * TileEntities can implement the {@link li.cil.oc.api.network.Environment} - * interface to allow them to interact with the component network, by providing - * a {@link li.cil.oc.api.network.Node} and connecting it to said network. - *

- * Nodes in such a network can communicate with each other, or just use the - * network as an index structure to find other nodes connected to them. - */ -@SuppressWarnings("UnusedDeclaration") -public abstract class TileEntityEnvironment extends TileEntity implements Environment, ITickable { - /** - * This must be set in subclasses to the node that is used to represent - * this tile entity. - *

- * You must only create new nodes using the factory method in the network - * API, {@link li.cil.oc.api.Network#newNode(Environment, Visibility)}. - *

- * For example: - *

-     * // The first parameters to newNode is the host() of the node, which will
-     * // usually be this tile entity. The second one is it's reachability,
-     * // which determines how other nodes in the same network can query this
-     * // node. See {@link li.cil.oc.api.network.Network#nodes(li.cil.oc.api.network.Node)}.
-     * node = Network.newNode(this, Visibility.Network)
-     *       // This call allows the node to consume energy from the
-     *       // component network it is in and act as a consumer, or to
-     *       // inject energy into that network and act as a producer.
-     *       // If you do not need energy remove this call.
-     *       .withConnector()
-     *       // This call marks the tile entity as a component. This means you
-     *       // can mark methods in it using the {@link li.cil.oc.api.machine.Callback}
-     *       // annotation, making them callable from user code. The first
-     *       // parameter is the name by which the component will be known in
-     *       // the computer, in this case it could be accessed as
-     *       // component.example. The second parameter is the
-     *       // component's visibility. This is like the node's reachability,
-     *       // but only applies to computers. For example, network cards can
-     *       // only be seen by the computer they're installed in, but
-     *       // can be reached by all other network cards in the same
-     *       // network. If you do not need callbacks remove this call.
-     *       .withComponent("example", Visibility.Neighbors)
-     *       // Finalizes the construction of the node and returns it.
-     *       .create();
-     * 
- */ - protected Node node; - - // See updateEntity(). - protected boolean addedToNetwork = false; - - // ----------------------------------------------------------------------- // - - @Override - public Node node() { - return node; - } - - @Override - public void onConnect(final Node node) { - // This is called when the call to Network.joinOrCreateNetwork(this) in - // updateEntity was successful, in which case `node == this`. - // This is also called for any other node that gets connected to the - // network our node is in, in which case `node` is the added node. - // If our node is added to an existing network, this is called for each - // node already in said network. - } - - @Override - public void onDisconnect(final Node node) { - // This is called when this node is removed from its network when the - // tile entity is removed from the world (see onChunkUnload() and - // invalidate()), in which case `node == this`. - // This is also called for each other node that gets removed from the - // network our node is in, in which case `node` is the removed node. - // If a net-split occurs this is called for each node that is no longer - // connected to our node. - } - - @Override - public void onMessage(final Message message) { - // This is used to deliver messages sent via node.sendToXYZ. Handle - // messages at your own discretion. If you do not wish to handle a - // message you should *not* throw an exception, though. - } - - // ----------------------------------------------------------------------- // - - @Override - public void update() { - // On the first update, try to add our node to nearby networks. We do - // this in the update logic, not in validate() because we need to access - // neighboring tile entities, which isn't possible in validate(). - // We could alternatively check node != null && node.network() == null, - // but this has somewhat better performance, and makes it clearer. - if (!addedToNetwork) { - addedToNetwork = true; - Network.joinOrCreateNetwork(this); - } - } - - @Override - public void onChunkUnload() { - super.onChunkUnload(); - // Make sure to remove the node from its network when its environment, - // meaning this tile entity, gets unloaded. - if (node != null) node.remove(); - } - - @Override - public void invalidate() { - super.invalidate(); - // Make sure to remove the node from its network when its environment, - // meaning this tile entity, gets unloaded. - if (node != null) node.remove(); - } - - // ----------------------------------------------------------------------- // - - @Override - public void readFromNBT(final NBTTagCompound nbt) { - super.readFromNBT(nbt); - // The host check may be superfluous for you. It's just there to allow - // some special cases, where getNode() returns some node managed by - // some other instance (for example when you have multiple internal - // nodes in this tile entity). - if (node != null && node.host() == this) { - // This restores the node's address, which is required for networks - // to continue working without interruption across loads. If the - // node is a power connector this is also required to restore the - // internal energy buffer of the node. - node.load(nbt.getCompoundTag("oc:node")); - } - } - - @Override - public NBTTagCompound writeToNBT(final NBTTagCompound nbt) { - super.writeToNBT(nbt); - // See readFromNBT() regarding host check. - if (node != null && node.host() == this) { - final NBTTagCompound nodeNbt = new NBTTagCompound(); - node.save(nodeNbt); - nbt.setTag("oc:node", nodeNbt); - } - return nbt; - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/TileEntitySidedEnvironment.java b/src/api/java/li/cil/oc/api/prefab/TileEntitySidedEnvironment.java deleted file mode 100755 index c3d878d9e..000000000 --- a/src/api/java/li/cil/oc/api/prefab/TileEntitySidedEnvironment.java +++ /dev/null @@ -1,153 +0,0 @@ -package li.cil.oc.api.prefab; - -import li.cil.oc.api.Network; -import li.cil.oc.api.network.Node; -import li.cil.oc.api.network.SidedEnvironment; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.ITickable; - -/** - * TileEntities can implement the {@link li.cil.oc.api.network.SidedEnvironment} - * interface to allow them to interact with the component network, by providing - * a separate {@link li.cil.oc.api.network.Node} for each block face, and - * connecting it to said network. This allows more control over connectivity - * than the simple {@link li.cil.oc.api.network.Environment}. - *

- * Nodes in such a network can communicate with each other, or just use the - * network as an index structure to find other nodes connected to them. - */ -@SuppressWarnings("UnusedDeclaration") -public abstract class TileEntitySidedEnvironment extends TileEntity implements SidedEnvironment, ITickable { - // See constructor. - protected Node[] nodes = new Node[6]; - - // See updateEntity(). - protected boolean addedToNetwork = false; - - /** - * This expects a node per face that is used to represent this tile entity. - *

- * You must only create new nodes using the factory method in the network - * API, {@link li.cil.oc.api.Network#newNode(li.cil.oc.api.network.Environment, li.cil.oc.api.network.Visibility)}. - *

- * For example: - *

-     * // The first parameters to newNode is the host() of the node, which will
-     * // usually be this tile entity. The second one is it's reachability,
-     * // which determines how other nodes in the same network can query this
-     * // node. See {@link li.cil.oc.api.network.Network#nodes(li.cil.oc.api.network.Node)}.
-     * super(Network.newNode(???, Visibility.Network)
-     *       // This call allows the node to consume energy from the
-     *       // component network it is in and act as a consumer, or to
-     *       // inject energy into that network and act as a producer.
-     *       // If you do not need energy remove this call.
-     *       .withConnector()
-     *       // This call marks the tile entity as a component. This means you
-     *       // can mark methods in it using the {@link li.cil.oc.api.machine.Callback}
-     *       // annotation, making them callable from user code. The first
-     *       // parameter is the name by which the component will be known in
-     *       // the computer, in this case it could be accessed as
-     *       // component.example. The second parameter is the
-     *       // component's visibility. This is like the node's reachability,
-     *       // but only applies to computers. For example, network cards can
-     *       // only be seen by the computer they're installed in, but
-     *       // can be reached by all other network cards in the same
-     *       // network. If you do not need callbacks remove this call.
-     *       .withComponent("example", Visibility.Neighbors)
-     *       // Finalizes the construction of the node and returns it.
-     *       .create(), ...);
-     * 
- */ - protected TileEntitySidedEnvironment(final Node... nodes) { - System.arraycopy(nodes, 0, this.nodes, 0, Math.min(nodes.length, this.nodes.length)); - } - - // ----------------------------------------------------------------------- // - - // canConnect() is for the client side, to determine how cables are - // rendered, for example, so you'll have to provide that logic yourself. - // Nodes are only created on the server side, so checking whether a node - // exists for a side won't work on the client. - - @Override - public Node sidedNode(final EnumFacing side) { - return nodes[side.ordinal()]; - } - - // ----------------------------------------------------------------------- // - - @Override - public void update() { - // On the first update, try to add our node to nearby networks. We do - // this in the update logic, not in validate() because we need to access - // neighboring tile entities, which isn't possible in validate(). - // We could alternatively check node != null && node.network() == null, - // but this has somewhat better performance, and makes it clearer. - if (!addedToNetwork) { - addedToNetwork = true; - // Note that joinOrCreateNetwork will try to connect each of our - // sided nodes to their respective neighbor (sided) node. - Network.joinOrCreateNetwork(this); - } - } - - @Override - public void onChunkUnload() { - super.onChunkUnload(); - // Make sure to remove the node from its network when its environment, - // meaning this tile entity, gets unloaded. - for (Node node : nodes) { - if (node != null) node.remove(); - } - } - - @Override - public void invalidate() { - super.invalidate(); - // Make sure to remove the node from its network when its environment, - // meaning this tile entity, gets unloaded. - for (Node node : nodes) { - if (node != null) node.remove(); - } - } - - // ----------------------------------------------------------------------- // - - @Override - public void readFromNBT(final NBTTagCompound nbt) { - super.readFromNBT(nbt); - int index = 0; - for (Node node : nodes) { - // The host check may be superfluous for you. It's just there to allow - // some special cases, where getNode() returns some node managed by - // some other instance (for example when you have multiple internal - // nodes in this tile entity). - if (node != null && node.host() == this) { - // This restores the node's address, which is required for networks - // to continue working without interruption across loads. If the - // node is a power connector this is also required to restore the - // internal energy buffer of the node. - node.load(nbt.getCompoundTag("oc:node" + index)); - } - ++index; - } - } - - @Override - public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(nbt); - int index = 0; - for (Node node : nodes) { - // See readFromNBT() regarding host check. - if (node != null && node.host() == this) { - final NBTTagCompound nodeNbt = new NBTTagCompound(); - node.save(nodeNbt); - nbt.setTag("oc:node" + index, nodeNbt); - } - ++index; - } - return nbt; - } -} diff --git a/src/api/java/li/cil/oc/api/prefab/package-info.java b/src/api/java/li/cil/oc/api/prefab/package-info.java deleted file mode 100755 index 306982259..000000000 --- a/src/api/java/li/cil/oc/api/prefab/package-info.java +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This package provides base implementations of some interfaces. - *

- * This is provided for convenience only, you do not have to use these classes, - * you are free to fully implement them yourself. You may also copy these - * classes and / or rename them if you wish. Just don't make changes to them - * while leaving them in the same package with the same name and then ship them - * with your mod! - */ -@net.minecraftforge.fml.common.API( - owner = API.ID_OWNER, - provides = "OpenComputersAPI|Prefab", - apiVersion = API.VERSION) -package li.cil.oc.api.prefab; - -import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/util/Lifecycle.java b/src/api/java/li/cil/oc/api/util/Lifecycle.java deleted file mode 100755 index ddf0bbdd2..000000000 --- a/src/api/java/li/cil/oc/api/util/Lifecycle.java +++ /dev/null @@ -1,66 +0,0 @@ -package li.cil.oc.api.util; - -import li.cil.oc.api.network.Node; - -/** - * Implement this on {@link li.cil.oc.api.network.ManagedEnvironment}s to be - * notified with proper lifecycle changes, instead of relying on something - * like {@link li.cil.oc.api.network.Environment#onDisconnect(Node)}. - *

- * This is primarily intended to be used on the client side, where there - * are no nodes, to allow components to know when they are being unloaded. - */ -public interface Lifecycle { - /** - * States an object can enter. - */ - enum LifecycleState { - /** - * State immediately active after construction of the object. - *

- * This generally means initial construction of the object and - * restoring its state (e.g. loading data if it's persistable). - */ - Constructing, - - /** - * State active when object is being lazily set up. - *

- * This generally means setting up references, and connecting - * nodes if the object is networked. - */ - Initializing, - - /** - * State active when object finished setting up. - *

- * This means everything is set up and the object now enters - * its general use lifetime (where components are updated each - * tick for example). - */ - Initialized, - - /** - * State active when object begins cleaning up. - *

- * This means tearing down references and disconnecting nodes, - * for example. - */ - Disposing, - - /** - * State active after object has been cleaned up, right before - * references by the managing container to it are dropped. - *

- * This means the object is now considered "dead". - */ - Disposed - } - - /** - * Called when the state of the object changes. - * - * @param state the lifecycle state that is being entered. - */ - void onLifecycleStateChange(LifecycleState state); -} diff --git a/src/api/java/li/cil/oc/api/util/StateAware.java b/src/api/java/li/cil/oc/api/util/StateAware.java deleted file mode 100755 index cbdfa1bd0..000000000 --- a/src/api/java/li/cil/oc/api/util/StateAware.java +++ /dev/null @@ -1,42 +0,0 @@ -package li.cil.oc.api.util; - -import java.util.EnumSet; - -/** - * Implemented on machines that have an "working" state. - *

- * This is similar to BuildCraft's IHasWork interface. - *

- * This can also be implemented on {@link li.cil.oc.api.component.RackMountable}s - * to indicate a working state, which is used when checking for redstone cards - * in them, for example (only active mountables will be used). - */ -public interface StateAware { - /** - * Get the current work state (usually a TileEntity. - *

- * An empty set indicates that no work can be performed. - * - * @return the current state. - */ - EnumSet getCurrentState(); - - /** - * Possible work states. - */ - enum State { - None, - - /** - * Indicates that some work can be performed / energy can be consumed, - * but that the current state is being idle. - */ - CanWork, - - /** - * Indicates that some work is currently being performed / some energy - * is currently being consumed. - */ - IsWorking - } -} diff --git a/src/api/java/mcp/mobius/waila/api/ITaggedList.java b/src/api/java/mcp/mobius/waila/api/ITaggedList.java deleted file mode 100644 index 62af479d4..000000000 --- a/src/api/java/mcp/mobius/waila/api/ITaggedList.java +++ /dev/null @@ -1,19 +0,0 @@ -package mcp.mobius.waila.api; - -import java.util.Collection; -import java.util.List; -import java.util.Set; - -public interface ITaggedList extends List { - public boolean add(E e, T tag); - public boolean add(E e, Collection taglst); - public Set getTags(E e); - public Set getTags(int index); - public void addTag(E e, T tag); - public void addTag(int index, T tag); - public void removeTag(E e, T tag); - public void removeTag(int index, T tag); - public Set getEntries(T tag); - public void removeEntries(T tag); - public String getTagsAsString(E e); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java b/src/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java deleted file mode 100644 index 7dc6ba03c..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaBlockDecorator.java +++ /dev/null @@ -1,24 +0,0 @@ -package mcp.mobius.waila.api; - -import net.minecraft.item.ItemStack; - -/** - * Callback class interface used to provide Block/TileEntity decorator.
- * All methods in this interface shouldn't to be called by the implementing mod. An instance of the class is to be - * registered to Waila via the {@link IWailaRegistrar} instance provided in the original registration callback method - * (cf. {@link IWailaRegistrar} documentation for more information). - * @author ProfMobius - * - */ -public interface IWailaBlockDecorator { - - /** - * Callback for the decorator. It provides a standard GL stack positioned on the block.
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerDecorator}.
- * @param itemStack Current block scanned, in ItemStack form. - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - */ - void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config); - -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaCommonAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaCommonAccessor.java deleted file mode 100644 index 074de6cd5..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaCommonAccessor.java +++ /dev/null @@ -1,37 +0,0 @@ -package mcp.mobius.waila.api; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; - -/** - * The Accessor is used to get some basic data out of the game without having to request direct access to the game engine.
- * It will also return things that are unmodified by the overriding systems (like getWailaStack).
- * Common accessor for both Entity and Block/TileEntity.
- * Available data depends on what it is called upon (ie : getEntity() will return null if looking at a block, etc).
- * - */ -public interface IWailaCommonAccessor { - World getWorld(); - EntityPlayer getPlayer(); - Block getBlock(); - int getBlockID(); - String getBlockQualifiedName(); - int getMetadata(); - TileEntity getTileEntity(); - Entity getEntity(); - BlockPos getPosition(); - Vec3d getRenderingPosition(); - NBTTagCompound getNBTData(); - int getNBTInteger(NBTTagCompound tag, String keyname); - double getPartialFrame(); - EnumFacing getSide(); - ItemStack getStack(); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java b/src/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java deleted file mode 100644 index 9752e423f..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaConfigHandler.java +++ /dev/null @@ -1,44 +0,0 @@ -package mcp.mobius.waila.api; - -import java.util.HashMap; -import java.util.Set; - -/** - * Read-only interface for Waila internal config storage.
- * An instance of this interface is passed to most of Waila callbacks as a way to change the behavior depending on client settings. - * - * @author ProfMobius - * - */ -public interface IWailaConfigHandler { - /** Returns a set of all the currently loaded modules in the config handler. - * - * @return - */ - public Set getModuleNames(); - - /** - * Returns all the currently available options for a given module - * - * @param modName Module name - * @return - */ - public HashMap getConfigKeys(String modName); - - /** - * Returns the current value of an option (true/false) with a default value if not set. - * - * @param key Option to lookup - * @param defvalue Default values - * @return Value of the option or defvalue if not set. - */ - public boolean getConfig(String key, boolean defvalue); - - /** - * Returns the current value of an option (true/false) with a default value true if not set - * - * @param key Option to lookup - * @return Value of the option or true if not set. - */ - public boolean getConfig(String key); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java deleted file mode 100644 index 4038d7721..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java +++ /dev/null @@ -1,39 +0,0 @@ -package mcp.mobius.waila.api; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; - -/** - * The Accessor is used to get some basic data out of the game without having to request direct access to the game engine.
- * It will also return things that are unmodified by the overriding systems (like getWailaStack).
- * An instance of this interface is passed to most of Waila Block/TileEntity callbacks. - * @author ProfMobius - * - */ - -public interface IWailaDataAccessor{ - World getWorld(); - EntityPlayer getPlayer(); - Block getBlock(); - //int getBlockID(); - int getMetadata(); - IBlockState getBlockState(); - TileEntity getTileEntity(); - RayTraceResult getMOP(); - BlockPos getPosition(); - Vec3d getRenderingPosition(); - NBTTagCompound getNBTData(); - int getNBTInteger(NBTTagCompound tag, String keyname); - double getPartialFrame(); - EnumFacing getSide(); - ItemStack getStack(); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java b/src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java deleted file mode 100644 index 0d0e75598..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java +++ /dev/null @@ -1,82 +0,0 @@ -package mcp.mobius.waila.api; - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -/** - * Callback class interface used to provide Block/TileEntity tooltip informations to Waila.
- * All methods in this interface shouldn't to be called by the implementing mod. An instance of the class is to be - * registered to Waila via the {@link IWailaRegistrar} instance provided in the original registration callback method - * (cf. {@link IWailaRegistrar} documentation for more information). - * @author ProfMobius - * - */ -public interface IWailaDataProvider{ - - /** - * Callback used to override the default Waila lookup system.
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerStackProvider}.
- * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return null if override is not required, an ItemStack otherwise. - */ - ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerHeadProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param itemStack Current block scanned, in ItemStack form. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerBodyProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param itemStack Current block scanned, in ItemStack form. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerTailProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param itemStack Current block scanned, in ItemStack form. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used server side to return a custom synchronization NBTTagCompound.
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerNBTProvider} server and client side.
- * You are supposed to always return the modified input NBTTagCompound tag.
- * @param player The player requesting data synchronization (The owner of the current connection). - * @param te The TileEntity targeted for synchronization. - * @param tag Current synchronization tag (might have been processed by other providers and might be processed by other providers). - * @param world TileEntity's World. - * @param pos Position of the TileEntity. - * @return Modified input NBTTagCompound tag. - */ - NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java deleted file mode 100644 index 52326671f..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java +++ /dev/null @@ -1,27 +0,0 @@ -package mcp.mobius.waila.api; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; - -/** - * The Accessor is used to get some basic data out of the game without having to request direct access to the game engine.
- * It will also return things that are unmodified by the overriding systems (like getWailaStack).
- * An instance of this interface is passed to most of Waila Entity callbacks. - * @author ProfMobius - * - */ - -public interface IWailaEntityAccessor { - World getWorld(); - EntityPlayer getPlayer(); - Entity getEntity(); - RayTraceResult getMOP(); - Vec3d getRenderingPosition(); - NBTTagCompound getNBTData(); - int getNBTInteger(NBTTagCompound tag, String keyname); - double getPartialFrame(); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java b/src/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java deleted file mode 100644 index 5a9acd8da..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaEntityProvider.java +++ /dev/null @@ -1,79 +0,0 @@ -package mcp.mobius.waila.api; - -import java.util.List; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; - -/** - * Callback class interface used to provide Entity tooltip informations to Waila.
- * All methods in this interface shouldn't to be called by the implementing mod. An instance of the class is to be - * registered to Waila via the {@link IWailaRegistrar} instance provided in the original registration callback method - * (cf. {@link IWailaRegistrar} documentation for more information). - * @author ProfMobius - * - */ -public interface IWailaEntityProvider { - - /** - * Callback used to override the default Waila lookup system.
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerOverrideEntityProvider}.
- * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return null if override is not required, an Entity otherwise. - */ - Entity getWailaOverride(IWailaEntityAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerHeadProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param entity Current Entity scanned. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaHead(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerBodyProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param entity Current Entity scanned. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaBody(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerTailProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param entity Current Entity scanned. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaTail(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used server side to return a custom synchronization NBTTagCompound.
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerNBTProvider} server and client side.
- * You are supposed to always return the modified input NBTTagCompound tag.
- * @param player The player requesting data synchronization (The owner of the current connection). - * @param ent The Entity targeted for synchronization. - * @param tag Current synchronization tag (might have been processed by other providers and might be processed by other providers). - * @param world TileEntity's World. - * @return Modified input NBTTagCompound tag. - */ - NBTTagCompound getNBTData(EntityPlayerMP player, Entity ent, NBTTagCompound tag, World world); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java deleted file mode 100644 index 55184c620..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java +++ /dev/null @@ -1,29 +0,0 @@ -package mcp.mobius.waila.api; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; - -/** - * The Accessor is used to get some basic data out of the game without having to request direct access to the game engine.
- * It will also return things that are unmodified by the overriding systems (like getWailaStack).
- * An instance of this interface is passed to most of Waila FMP callbacks. - * @author ProfMobius - * - */ - -public interface IWailaFMPAccessor { - World getWorld(); - EntityPlayer getPlayer(); - TileEntity getTileEntity(); - RayTraceResult getPosition(); - NBTTagCompound getNBTData(); - NBTTagCompound getFullNBTData(); - int getNBTInteger(NBTTagCompound tag, String keyname); - double getPartialFrame(); - Vec3d getRenderingPosition(); - String getID(); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java b/src/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java deleted file mode 100644 index 5484a566e..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaFMPDecorator.java +++ /dev/null @@ -1,23 +0,0 @@ -package mcp.mobius.waila.api; - -import net.minecraft.item.ItemStack; - -/** - * Callback class interface used to provide FMP decorator.
- * All methods in this interface shouldn't to be called by the implementing mod. An instance of the class is to be - * registered to Waila via the {@link IWailaRegistrar} instance provided in the original registration callback method - * (cf. {@link IWailaRegistrar} documentation for more information). - * @author ProfMobius - * - */ -public interface IWailaFMPDecorator { - - /** - * Callback for the decorator. It provides a standard GL stack positioned on the block.
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerDecorator}.
- * @param itemStack Current block scanned, in ItemStack form. - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - */ - void decorateBlock(ItemStack itemStack, IWailaFMPAccessor accessor, IWailaConfigHandler config); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java b/src/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java deleted file mode 100644 index 6db02fb27..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaFMPProvider.java +++ /dev/null @@ -1,54 +0,0 @@ -package mcp.mobius.waila.api; - -import java.util.List; - -import net.minecraft.item.ItemStack; - -/** - * Callback class interface used to provide FMP tooltip informations to Waila.
- * All methods in this interface shouldn't to be called by the implementing mod. An instance of the class is to be - * registered to Waila via the {@link IWailaRegistrar} instance provided in the original registration callback method - * (cf. {@link IWailaRegistrar} documentation for more information). - * @author ProfMobius - * - */ -public interface IWailaFMPProvider { - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerHeadProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param itemStack Current block scanned, in ItemStack form. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaHead(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerBodyProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param itemStack Current block scanned, in ItemStack form. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaBody(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); - - /** - * Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).
- * Will be used if the implementing class is registered via {@link IWailaRegistrar}.{@link registerTailProvider} client side.
- * You are supposed to always return the modified input currenttip.
- * - * @param itemStack Current block scanned, in ItemStack form. - * @param currenttip Current list of tooltip lines (might have been processed by other providers and might be processed by other providers). - * @param accessor Contains most of the relevant information about the current environment. - * @param config Current configuration of Waila. - * @return Modified input currenttip - */ - List getWailaTail(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaRegistrar.java b/src/api/java/mcp/mobius/waila/api/IWailaRegistrar.java deleted file mode 100644 index b42e753cb..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaRegistrar.java +++ /dev/null @@ -1,65 +0,0 @@ -package mcp.mobius.waila.api; - -/** - * Main registration interface. An instance will be provided to a method specified in an IMC msg formatted as follow
- * FMLInterModComms.sendMessage("Waila", "register", "fully.qualified.path.to.registration.method");
- * The registration method need to follow this signature
- * public static void callbackRegister({@link IWailaRegistrar} registrar)

- * If not specified otherwise, all the registration methods taking a class can take classes as well as interfaces. - * Waila will do a lookup using instanceof on the registered classes, meaning that if all your targets inherit one interface, you only need - * to specify it to cover the whole hierarchy.
- * For the registration of blocks, both Blocks and TileEntities are accepted.

- * For the configuration keys :
- * modname refers to a String used for display in Waila's config panel.
- * keyname refers to an unique key used internally for config query (cf {@link IWailaConfigHandler}). Those keys are shared across Waila, keep them unique !
- * - * - * @author ProfMobius - * - */ -public interface IWailaRegistrar { - /* Add a config option in the section modname with displayed text configtext and access key keyname */ - public void addConfig(String modname, String keyname, String configtext); - public void addConfig(String modname, String keyname, String configtext, boolean defvalue); - public void addConfigRemote(String modname, String keyname, String configtext); - public void addConfigRemote(String modname, String keyname, String configtext, boolean defvalue); - public void addConfig(String modname, String keyname); - public void addConfig(String modname, String keyname, boolean defvalue); - public void addConfigRemote(String modname, String keyname); - public void addConfigRemote(String modname, String keyname, boolean defvalue); - - /* Register a stack overrider for the given blockID */ - public void registerStackProvider(IWailaDataProvider dataProvider, Class block); - - /* Same thing, but works on a class hierarchy instead */ - public void registerHeadProvider (IWailaDataProvider dataProvider, Class block); - public void registerBodyProvider (IWailaDataProvider dataProvider, Class block); - public void registerTailProvider (IWailaDataProvider dataProvider, Class block); - - /* Registering an NBT Provider provides a way to override the default "writeToNBT" way of doing things. */ - public void registerNBTProvider(IWailaDataProvider dataProvider, Class block); - - /* Entity text registration methods */ - public void registerHeadProvider (IWailaEntityProvider dataProvider, Class entity); - public void registerBodyProvider (IWailaEntityProvider dataProvider, Class entity); - public void registerTailProvider (IWailaEntityProvider dataProvider, Class entity); - public void registerOverrideEntityProvider (IWailaEntityProvider dataProvider, Class entity); - - /* Registering an NBT Provider provides a way to override the default "writeToNBT" way of doing things. */ - public void registerNBTProvider(IWailaEntityProvider dataProvider, Class entity); - - /* FMP Providers */ - public void registerHeadProvider(IWailaFMPProvider dataProvider, String name); - public void registerBodyProvider(IWailaFMPProvider dataProvider, String name); - public void registerTailProvider(IWailaFMPProvider dataProvider, String name); - - /* The block decorators */ - public void registerDecorator (IWailaBlockDecorator decorator, Class block); - public void registerDecorator (IWailaFMPDecorator decorator, String name); - - public void registerTooltipRenderer(String name, IWailaTooltipRenderer renderer); - - /* UNUSED FOR NOW (Will be used for the ingame wiki */ - //public void registerDocTextFile (String filename); - //public void registerShortDataProvider (IWailaSummaryProvider dataProvider, Class item); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java b/src/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java deleted file mode 100644 index f79064981..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaSummaryProvider.java +++ /dev/null @@ -1,21 +0,0 @@ -package mcp.mobius.waila.api; - -import java.util.LinkedHashMap; - -import net.minecraft.item.ItemStack; - -public interface IWailaSummaryProvider { - /* This interface is used to control the display data in the description screen */ - - /* BASIC TOOLS & ITEMS DATA */ - //EnumToolMaterial getMaterial(ItemStack stack); - //String getMaterialName(ItemStack stack); - //String getEffectiveBlock(ItemStack stack); - //int getHarvestLevel(ItemStack stack); - //float getEfficiencyOnProperMaterial(ItemStack stack); - //int getEnchantability(ItemStack stack); - //int getDamageVsEntity(ItemStack stack); - //int getDurability(ItemStack stack); - - LinkedHashMap getSummary(ItemStack stack, LinkedHashMap currentSummary, IWailaConfigHandler config); -} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaTooltipRenderer.java b/src/api/java/mcp/mobius/waila/api/IWailaTooltipRenderer.java deleted file mode 100644 index efbfd91b7..000000000 --- a/src/api/java/mcp/mobius/waila/api/IWailaTooltipRenderer.java +++ /dev/null @@ -1,23 +0,0 @@ -package mcp.mobius.waila.api; - -import java.awt.Dimension; - - -public interface IWailaTooltipRenderer { - /** - * - * @param params Array of string parameters as passed to the RENDER arg in the tooltip ({rendername,param1,param2,...}) - * @param accessor A global accessor for TileEntities and Entities - * @return Dimension of the reserved area - */ - Dimension getSize(String[] params, IWailaCommonAccessor accessor); - - /** - * Draw method for the renderer. The GL matrice is automatically moved to the top left of the reserved zone.
- * All calls should be relative to (0,0) - * - * @param params Array of string parameters as passed to the RENDER arg in the tooltip ({rendername,param1,param2,...}) - * @param accessor A global accessor for TileEntities and Entities - */ - void draw (String[] params, IWailaCommonAccessor accessor); -} diff --git a/src/api/java/mcp/mobius/waila/api/SpecialChars.java b/src/api/java/mcp/mobius/waila/api/SpecialChars.java deleted file mode 100644 index 4ef877d62..000000000 --- a/src/api/java/mcp/mobius/waila/api/SpecialChars.java +++ /dev/null @@ -1,67 +0,0 @@ -package mcp.mobius.waila.api; - -import java.util.regex.Pattern; - -public class SpecialChars { - - public static String MCStyle = "\u00A7"; - - public static String BLACK = MCStyle + "0"; - public static String DBLUE = MCStyle + "1"; - public static String DGREEN = MCStyle + "2"; - public static String DAQUA = MCStyle + "3"; - public static String DRED = MCStyle + "4"; - public static String DPURPLE = MCStyle + "5"; - public static String GOLD = MCStyle + "6"; - public static String GRAY = MCStyle + "7"; - public static String DGRAY = MCStyle + "8"; - public static String BLUE = MCStyle + "9"; - public static String GREEN = MCStyle + "a"; - public static String AQUA = MCStyle + "b"; - public static String RED = MCStyle + "c"; - public static String LPURPLE = MCStyle + "d"; - public static String YELLOW = MCStyle + "e"; - public static String WHITE = MCStyle + "f"; - - public static String OBF = MCStyle + "k"; - public static String BOLD = MCStyle + "l"; - public static String STRIKE = MCStyle + "m"; - public static String UNDER = MCStyle + "n"; - public static String ITALIC = MCStyle + "o"; - public static String RESET = MCStyle + "r"; - - public static String WailaStyle = "\u00A4"; - public static String WailaIcon = "\u00A5"; - public static String WailaRenderer = "\u00A6"; - public static String TAB = WailaStyle + WailaStyle +"a"; - public static String ALIGNRIGHT = WailaStyle + WailaStyle +"b"; - public static String ALIGNCENTER = WailaStyle + WailaStyle +"c"; - public static String HEART = WailaStyle + WailaIcon +"a"; - public static String HHEART = WailaStyle + WailaIcon +"b"; - public static String EHEART = WailaStyle + WailaIcon +"c"; - public static String RENDER = WailaStyle + WailaRenderer +"a"; - - public static final Pattern patternMinecraft = Pattern.compile("(?i)" + MCStyle + "[0-9A-FK-OR]"); - public static final Pattern patternWaila = Pattern.compile("(?i)(" + WailaStyle + "(?..))"); - public static final Pattern patternRender = Pattern.compile("(?i)(" + RENDER + "\\{(?[^,}]*),?(?[^}]*)\\})"); - public static final Pattern patternTab = Pattern.compile("(?i)" + TAB); - public static final Pattern patternRight = Pattern.compile("(?i)" + ALIGNRIGHT); - public static final Pattern patternCenter = Pattern.compile("(?i)" + ALIGNCENTER); - public static final Pattern patternIcon = Pattern.compile("(?i)(" + WailaStyle + WailaIcon + "(?[0-9a-z]))"); - public static final Pattern patternLineSplit = Pattern.compile("(?i)(" + WailaStyle + WailaStyle + "[^" + WailaStyle + "]+|" + WailaStyle + WailaIcon + "[0-9A-Z]|" + WailaStyle + WailaRenderer + "a\\{([^,}]*),?([^}]*)\\}|[^" + WailaStyle + "]+)"); - - /** - * Helper method to get a proper RENDER string. Just put the name of the renderer and the params in, and it will give back a directly usable String for the tooltip. - * @param name - * @param params - * @return - */ - public static String getRenderString(String name, String... params){ - String result = RENDER + "{" + name; - for (String s : params){ - result += "," + s; - } - result += "}"; - return result; - } -} diff --git a/src/api/java/mcp/mobius/waila/api/package-info.java b/src/api/java/mcp/mobius/waila/api/package-info.java deleted file mode 100644 index e1f6cdfa2..000000000 --- a/src/api/java/mcp/mobius/waila/api/package-info.java +++ /dev/null @@ -1,3 +0,0 @@ -@API(apiVersion="1.3",owner="Waila",provides="WailaAPI") -package mcp.mobius.waila.api; -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/micdoodle8/mods/galacticraft/api/world/ISolarLevel.java b/src/api/java/micdoodle8/mods/galacticraft/api/world/ISolarLevel.java index 721af2336..d9983d39e 100644 --- a/src/api/java/micdoodle8/mods/galacticraft/api/world/ISolarLevel.java +++ b/src/api/java/micdoodle8/mods/galacticraft/api/world/ISolarLevel.java @@ -9,8 +9,8 @@ package micdoodle8.mods.galacticraft.api.world; *

* for example: *

- * if (worldObj.provider instanceof ISolarLevel) solarStrength *= ((ISolarLevel) - * worldObj.provider).getSolarEnergyMultiplier(); + * if (world.provider instanceof ISolarLevel) solarStrength *= ((ISolarLevel) + * world.provider).getSolarEnergyMultiplier(); */ public interface ISolarLevel { diff --git a/src/api/java/net/darkhax/tesla/Tesla.java b/src/api/java/net/darkhax/tesla/Tesla.java deleted file mode 100755 index 540c2ca8d..000000000 --- a/src/api/java/net/darkhax/tesla/Tesla.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.darkhax.tesla; - -import net.darkhax.tesla.api.ITeslaConsumer; -import net.darkhax.tesla.api.ITeslaHolder; -import net.darkhax.tesla.api.ITeslaProducer; -import net.darkhax.tesla.api.implementation.BaseTeslaContainer; -import net.darkhax.tesla.capability.TeslaCapabilities.CapabilityTeslaConsumer; -import net.darkhax.tesla.capability.TeslaCapabilities.CapabilityTeslaHolder; -import net.darkhax.tesla.capability.TeslaCapabilities.CapabilityTeslaProducer; -import net.darkhax.tesla.lib.Constants; -import net.minecraftforge.common.capabilities.CapabilityManager; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventHandler; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; - -@Mod(modid = Constants.MOD_ID, name = Constants.MOD_NAME, version = Constants.VERSION_NUMBER, acceptedMinecraftVersions = "[1.9.4,1.10.2]") -public class Tesla { - - @Mod.Instance(Constants.MOD_ID) - public static Tesla instance; - - @EventHandler - public void preInit (FMLPreInitializationEvent event) { - - CapabilityManager.INSTANCE.register(ITeslaConsumer.class, new CapabilityTeslaConsumer(), BaseTeslaContainer.class); - CapabilityManager.INSTANCE.register(ITeslaProducer.class, new CapabilityTeslaProducer(), BaseTeslaContainer.class); - CapabilityManager.INSTANCE.register(ITeslaHolder.class, new CapabilityTeslaHolder(), BaseTeslaContainer.class); - } -} \ No newline at end of file diff --git a/src/api/java/net/darkhax/tesla/api/ITeslaConsumer.java b/src/api/java/net/darkhax/tesla/api/ITeslaConsumer.java deleted file mode 100755 index 1f44d716f..000000000 --- a/src/api/java/net/darkhax/tesla/api/ITeslaConsumer.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.darkhax.tesla.api; - -public interface ITeslaConsumer { - - /** - * Offers power to the Tesla Consumer. - * - * @param power The amount of power to offer. - * @param simulated Whether or not this is being called as part of a simulation. - * Simulations are used to get information without affecting the Tesla Producer. - * @return The amount of power that the consumer accepts. - */ - long givePower (long power, boolean simulated); -} diff --git a/src/api/java/net/darkhax/tesla/api/ITeslaHolder.java b/src/api/java/net/darkhax/tesla/api/ITeslaHolder.java deleted file mode 100755 index 3588a82c9..000000000 --- a/src/api/java/net/darkhax/tesla/api/ITeslaHolder.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.darkhax.tesla.api; - -public interface ITeslaHolder { - - /** - * Gets the amount of Tesla power stored being stored. - * - * @return The amount of Tesla power being stored. - */ - long getStoredPower (); - - /** - * Gets the maximum amount of Tesla power that can be held. - * - * @return The maximum amount of Tesla power that can be held. - */ - long getCapacity (); -} \ No newline at end of file diff --git a/src/api/java/net/darkhax/tesla/api/ITeslaProducer.java b/src/api/java/net/darkhax/tesla/api/ITeslaProducer.java deleted file mode 100755 index 71f1b570b..000000000 --- a/src/api/java/net/darkhax/tesla/api/ITeslaProducer.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.darkhax.tesla.api; - -public interface ITeslaProducer { - - /** - * Requests an amount of power from the Tesla Producer. - * - * @param power The amount of power to request. - * @param simulated Whether or not this is being called as part of a simulation. - * Simulations are used to get information without affecting the Tesla Producer. - * @return The amount of power that the Tesla Producer will give. - */ - long takePower (long power, boolean simulated); -} \ No newline at end of file diff --git a/src/api/java/net/darkhax/tesla/api/implementation/BaseTeslaContainer.java b/src/api/java/net/darkhax/tesla/api/implementation/BaseTeslaContainer.java deleted file mode 100755 index 6d25952f8..000000000 --- a/src/api/java/net/darkhax/tesla/api/implementation/BaseTeslaContainer.java +++ /dev/null @@ -1,225 +0,0 @@ -package net.darkhax.tesla.api.implementation; - -import net.darkhax.tesla.api.ITeslaConsumer; -import net.darkhax.tesla.api.ITeslaHolder; -import net.darkhax.tesla.api.ITeslaProducer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.INBTSerializable; - -/** - * A basic Tesla container that serves as a consumer, producer and holder. Custom - * implementations do not need to use all three. The INBTSerializable interface is also - * optional. - */ -public class BaseTeslaContainer implements ITeslaConsumer, ITeslaProducer, ITeslaHolder, INBTSerializable { - - /** - * The amount of stored Tesla power. - */ - private long stored; - - /** - * The maximum amount of Tesla power that can be stored. - */ - private long capacity; - - /** - * The maximum amount of Tesla power that can be accepted. - */ - private long inputRate; - - /** - * The maximum amount of Tesla power that can be extracted - */ - private long outputRate; - - /** - * Default constructor. Sets capacity to 5000 and transfer rate to 50. This constructor - * will not set the amount of stored power. These values are arbitrary and should not be - * taken as a base line for balancing. - */ - public BaseTeslaContainer() { - - this(5000, 50, 50); - } - - /** - * Constructor for setting the basic values. Will not construct with any stored power. - * - * @param capacity The maximum amount of Tesla power that the container should hold. - * @param input The maximum rate of power that can be accepted at a time. - * @param output The maximum rate of power that can be extracted at a time. - */ - public BaseTeslaContainer(long capacity, long input, long output) { - - this(0, capacity, input, output); - } - - /** - * Constructor for setting all of the base values, including the stored power. - * - * @param power The amount of stored power to initialize the container with. - * @param capacity The maximum amount of Tesla power that the container should hold. - * @param input The maximum rate of power that can be accepted at a time. - * @param output The maximum rate of power that can be extracted at a time. - */ - public BaseTeslaContainer(long power, long capacity, long input, long output) { - - this.stored = power; - this.capacity = capacity; - this.inputRate = input; - this.outputRate = output; - } - - /** - * Constructor for creating an instance directly from a compound tag. This expects that the - * compound tag has some of the required data. @See {@link #deserializeNBT(NBTTagCompound)} - * for precise info on what is expected. This constructor will only set the stored power if - * it has been written on the compound tag. - * - * @param dataTag The NBTCompoundTag to read the important data from. - */ - public BaseTeslaContainer(NBTTagCompound dataTag) { - - this.deserializeNBT(dataTag); - } - - @Override - public long getStoredPower () { - - return this.stored; - } - - @Override - public long givePower (long Tesla, boolean simulated) { - - final long acceptedTesla = Math.min(this.getCapacity() - this.stored, Math.min(this.getInputRate(), Tesla)); - - if (!simulated) - this.stored += acceptedTesla; - - return acceptedTesla; - } - - @Override - public long takePower (long Tesla, boolean simulated) { - - final long removedPower = Math.min(this.stored, Math.min(this.getOutputRate(), Tesla)); - - if (!simulated) - this.stored -= removedPower; - - return removedPower; - } - - @Override - public long getCapacity () { - - return this.capacity; - } - - @Override - public NBTTagCompound serializeNBT () { - - final NBTTagCompound dataTag = new NBTTagCompound(); - dataTag.setLong("TeslaPower", this.stored); - dataTag.setLong("TeslaCapacity", this.capacity); - dataTag.setLong("TeslaInput", this.inputRate); - dataTag.setLong("TeslaOutput", this.outputRate); - - return dataTag; - } - - @Override - public void deserializeNBT (NBTTagCompound nbt) { - - this.stored = nbt.getLong("TeslaPower"); - - if (nbt.hasKey("TeslaCapacity")) - this.capacity = nbt.getLong("TeslaCapacity"); - - if (nbt.hasKey("TeslaInput")) - this.inputRate = nbt.getLong("TeslaInput"); - - if (nbt.hasKey("TeslaOutput")) - this.outputRate = nbt.getLong("TeslaOutput"); - - if (this.stored > this.getCapacity()) - this.stored = this.getCapacity(); - } - - /** - * Sets the capacity of the the container. If the existing stored power is more than the - * new capacity, the stored power will be decreased to match the new capacity. - * - * @param capacity The new capacity for the container. - * @return The instance of the container being updated. - */ - public BaseTeslaContainer setCapacity (long capacity) { - - this.capacity = capacity; - - if (this.stored > capacity) - this.stored = capacity; - - return this; - } - - /** - * Gets the maximum amount of Tesla power that can be accepted by the container. - * - * @return The amount of Tesla power that can be accepted at any time. - */ - public long getInputRate () { - - return this.inputRate; - } - - /** - * Sets the maximum amount of Tesla power that can be accepted by the container. - * - * @param rate The amount of Tesla power to accept at a time. - * @return The instance of the container being updated. - */ - public BaseTeslaContainer setInputRate (long rate) { - - this.inputRate = rate; - return this; - } - - /** - * Gets the maximum amount of Tesla power that can be pulled from the container. - * - * @return The amount of Tesla power that can be extracted at any time. - */ - public long getOutputRate () { - - return this.outputRate; - } - - /** - * Sets the maximum amount of Tesla power that can be pulled from the container. - * - * @param rate The amount of Tesla power that can be extracted. - * @return The instance of the container being updated. - */ - public BaseTeslaContainer setOutputRate (long rate) { - - this.outputRate = rate; - return this; - } - - /** - * Sets both the input and output rates of the container at the same time. Both rates will - * be the same. - * - * @param rate The input/output rate for the Tesla container. - * @return The instance of the container being updated. - */ - public BaseTeslaContainer setTransferRate (long rate) { - - this.setInputRate(rate); - this.setOutputRate(rate); - return this; - } -} \ No newline at end of file diff --git a/src/api/java/net/darkhax/tesla/api/implementation/BaseTeslaContainerProvider.java b/src/api/java/net/darkhax/tesla/api/implementation/BaseTeslaContainerProvider.java deleted file mode 100755 index 1519e1429..000000000 --- a/src/api/java/net/darkhax/tesla/api/implementation/BaseTeslaContainerProvider.java +++ /dev/null @@ -1,57 +0,0 @@ -package net.darkhax.tesla.api.implementation; - -import net.darkhax.tesla.capability.TeslaCapabilities; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.common.util.INBTSerializable; - -/** - * A capability provider for the base Tesla container implementation. - */ -public class BaseTeslaContainerProvider implements INBTSerializable, ICapabilityProvider { - - /** - * The capability being provided. - */ - private final BaseTeslaContainer container; - - /** - * Constructor for setting the BaseTeslaContainer for the provider to provide. - * - * @param container The BaseTeslaContainer to provide. - */ - public BaseTeslaContainerProvider(BaseTeslaContainer container) { - - this.container = container; - } - - @Override - public boolean hasCapability (Capability capability, EnumFacing facing) { - - return capability == TeslaCapabilities.CAPABILITY_CONSUMER || capability == TeslaCapabilities.CAPABILITY_PRODUCER || capability == TeslaCapabilities.CAPABILITY_HOLDER; - } - - @Override - @SuppressWarnings("unchecked") - public T getCapability (Capability capability, EnumFacing facing) { - - if (capability == TeslaCapabilities.CAPABILITY_CONSUMER || capability == TeslaCapabilities.CAPABILITY_PRODUCER || capability == TeslaCapabilities.CAPABILITY_HOLDER) - return (T) this.container; - - return null; - } - - @Override - public NBTTagCompound serializeNBT () { - - return this.container.serializeNBT(); - } - - @Override - public void deserializeNBT (NBTTagCompound nbt) { - - this.container.deserializeNBT(nbt); - } -} \ No newline at end of file diff --git a/src/api/java/net/darkhax/tesla/api/implementation/InfiniteTeslaConsumer.java b/src/api/java/net/darkhax/tesla/api/implementation/InfiniteTeslaConsumer.java deleted file mode 100755 index 592fcd31d..000000000 --- a/src/api/java/net/darkhax/tesla/api/implementation/InfiniteTeslaConsumer.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.darkhax.tesla.api.implementation; - -import net.darkhax.tesla.api.ITeslaConsumer; - -/** - * Logic for a Tesla Consumer that will consume infinite amounts of power. - */ -public class InfiniteTeslaConsumer implements ITeslaConsumer { - - @Override - public long givePower (long power, boolean simulated) { - - return power; - } -} \ No newline at end of file diff --git a/src/api/java/net/darkhax/tesla/api/implementation/InfiniteTeslaConsumerProvider.java b/src/api/java/net/darkhax/tesla/api/implementation/InfiniteTeslaConsumerProvider.java deleted file mode 100755 index c61cafc2a..000000000 --- a/src/api/java/net/darkhax/tesla/api/implementation/InfiniteTeslaConsumerProvider.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.darkhax.tesla.api.implementation; - -import net.darkhax.tesla.capability.TeslaCapabilities; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ICapabilityProvider; - -/** - * A capability provider for the infinite Tesla consumer capability. - */ -public class InfiniteTeslaConsumerProvider implements ICapabilityProvider { - - @Override - public boolean hasCapability (Capability capability, EnumFacing facing) { - - return capability == TeslaCapabilities.CAPABILITY_CONSUMER; - } - - @Override - @SuppressWarnings("unchecked") - public T getCapability (Capability capability, EnumFacing facing) { - - return capability == TeslaCapabilities.CAPABILITY_CONSUMER ? (T) new InfiniteTeslaConsumer() : null; - } -} diff --git a/src/api/java/net/darkhax/tesla/api/implementation/InfiniteTeslaProducer.java b/src/api/java/net/darkhax/tesla/api/implementation/InfiniteTeslaProducer.java deleted file mode 100755 index db269d0ca..000000000 --- a/src/api/java/net/darkhax/tesla/api/implementation/InfiniteTeslaProducer.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.darkhax.tesla.api.implementation; - -import net.darkhax.tesla.api.ITeslaProducer; - -/** - * Logic for a Tesla Producer that will produce an infinite amount of energy. - */ -public class InfiniteTeslaProducer implements ITeslaProducer { - - @Override - public long takePower (long power, boolean simulated) { - - return power; - } -} \ No newline at end of file diff --git a/src/api/java/net/darkhax/tesla/api/implementation/InfiniteTeslaProducerProvider.java b/src/api/java/net/darkhax/tesla/api/implementation/InfiniteTeslaProducerProvider.java deleted file mode 100755 index ee6a01250..000000000 --- a/src/api/java/net/darkhax/tesla/api/implementation/InfiniteTeslaProducerProvider.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.darkhax.tesla.api.implementation; - -import net.darkhax.tesla.capability.TeslaCapabilities; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ICapabilityProvider; - -/** - * A capability provider for the infinite Tesla producer capability. - */ -public class InfiniteTeslaProducerProvider implements ICapabilityProvider { - - @Override - public boolean hasCapability (Capability capability, EnumFacing facing) { - - return capability == TeslaCapabilities.CAPABILITY_PRODUCER; - } - - @Override - @SuppressWarnings("unchecked") - public T getCapability (Capability capability, EnumFacing facing) { - - return capability == TeslaCapabilities.CAPABILITY_PRODUCER ? (T) new InfiniteTeslaConsumer() : null; - } -} diff --git a/src/api/java/net/darkhax/tesla/capability/TeslaCapabilities.java b/src/api/java/net/darkhax/tesla/capability/TeslaCapabilities.java deleted file mode 100755 index eead19a05..000000000 --- a/src/api/java/net/darkhax/tesla/capability/TeslaCapabilities.java +++ /dev/null @@ -1,73 +0,0 @@ -package net.darkhax.tesla.capability; - -import net.darkhax.tesla.api.ITeslaConsumer; -import net.darkhax.tesla.api.ITeslaHolder; -import net.darkhax.tesla.api.ITeslaProducer; -import net.minecraft.nbt.NBTBase; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.Capability.IStorage; -import net.minecraftforge.common.capabilities.CapabilityInject; - -public class TeslaCapabilities { - - /** - * Access to the consumer capability. Can be used for making checks. - */ - @CapabilityInject(ITeslaConsumer.class) - public static Capability CAPABILITY_CONSUMER = null; - - /** - * Access to the producer capability. Can be used for making checks. - */ - @CapabilityInject(ITeslaProducer.class) - public static Capability CAPABILITY_PRODUCER = null; - - /** - * Access to the holder capability. Can be used for making checks. - */ - @CapabilityInject(ITeslaHolder.class) - public static Capability CAPABILITY_HOLDER = null; - - public static class CapabilityTeslaConsumer implements IStorage { - - @Override - public NBTBase writeNBT (Capability capability, ITeslaConsumer instance, EnumFacing side) { - - return null; - } - - @Override - public void readNBT (Capability capability, ITeslaConsumer instance, EnumFacing side, NBTBase nbt) { - - } - } - - public static class CapabilityTeslaProducer implements IStorage { - - @Override - public NBTBase writeNBT (Capability capability, ITeslaProducer instance, EnumFacing side) { - - return null; - } - - @Override - public void readNBT (Capability capability, ITeslaProducer instance, EnumFacing side, NBTBase nbt) { - - } - } - - public static class CapabilityTeslaHolder implements IStorage { - - @Override - public NBTBase writeNBT (Capability capability, ITeslaHolder instance, EnumFacing side) { - - return null; - } - - @Override - public void readNBT (Capability capability, ITeslaHolder instance, EnumFacing side, NBTBase nbt) { - - } - } -} \ No newline at end of file diff --git a/src/api/java/net/darkhax/tesla/lib/Constants.java b/src/api/java/net/darkhax/tesla/lib/Constants.java deleted file mode 100755 index 1264984bf..000000000 --- a/src/api/java/net/darkhax/tesla/lib/Constants.java +++ /dev/null @@ -1,8 +0,0 @@ -package net.darkhax.tesla.lib; - -public class Constants { - - public static final String MOD_ID = "tesla"; - public static final String MOD_NAME = "TESLA"; - public static final String VERSION_NUMBER = "1.2.1.0"; -} diff --git a/src/api/java/net/darkhax/tesla/lib/PowerBar.java b/src/api/java/net/darkhax/tesla/lib/PowerBar.java deleted file mode 100755 index 1ac5f4737..000000000 --- a/src/api/java/net/darkhax/tesla/lib/PowerBar.java +++ /dev/null @@ -1,103 +0,0 @@ -package net.darkhax.tesla.lib; - -import net.darkhax.tesla.api.ITeslaHolder; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class PowerBar { - - /** - * Constant reference to the included gui element sheet. - */ - private static final ResourceLocation TEXTURE_SHEET = new ResourceLocation("tesla", "textures/gui/elements.png"); - - /** - * The x position of the power bar on the screen. - */ - private final int x; - - /** - * The y position of the power bar on the screen. - */ - private final int y; - - /** - * The screen to draw the power bar on. - */ - private final GuiScreen screen; - - /** - * The type of background the use when drawing the power bar. - */ - private final BackgroundType background; - - /** - * Object that can be used to draw a power bar on the screen. - * - * @param screen The screen to draw the power bar on. - * @param x The x position of the power bar on the screen. - * @param y The y position of the power bar on the screen. - * @param type The background type to use for the power bar. - */ - public PowerBar(GuiScreen screen, int x, int y, BackgroundType type) { - - this.background = type; - this.screen = screen; - this.x = x; - this.y = y; - } - - /** - * Draws a power bar that represents the power held within an ITeslaHolder. - * - * @param holder The holder to represent. - */ - public void draw (ITeslaHolder holder) { - - draw(holder.getStoredPower(), holder.getCapacity()); - } - - /** - * Draws a power bard that represents the based power information. - * - * @param power The amount of power to represent. - * @param capacity The capacity to represent. - */ - public void draw (long power, long capacity) { - - screen.mc.getTextureManager().bindTexture(TEXTURE_SHEET); - - if (this.background == BackgroundType.LIGHT) - screen.drawTexturedModalRect(x, y, 3, 1, 14, 50); - - else if (this.background == BackgroundType.DARK) - screen.drawTexturedModalRect(x, y, 3, 53, 14, 50); - - long powerOffset = (power * 51) / capacity; - screen.drawTexturedModalRect(x + 1, (int) (y + 50 - powerOffset), 18, (int) (51 - powerOffset), 14, (int) (powerOffset + 2)); - } - - /** - * Describes a background image to be rendered for a power bar. - */ - public enum BackgroundType { - - /** - * No background texture. - */ - NONE, - - /** - * The lighter background texture. - */ - LIGHT, - - /** - * The darker background texture. - */ - DARK, - } -} \ No newline at end of file diff --git a/src/api/java/net/darkhax/tesla/lib/TeslaUtils.java b/src/api/java/net/darkhax/tesla/lib/TeslaUtils.java deleted file mode 100755 index 2d9f9012d..000000000 --- a/src/api/java/net/darkhax/tesla/lib/TeslaUtils.java +++ /dev/null @@ -1,302 +0,0 @@ -package net.darkhax.tesla.lib; - -import java.util.ArrayList; -import java.util.List; - -import net.darkhax.tesla.api.ITeslaConsumer; -import net.darkhax.tesla.api.ITeslaHolder; -import net.darkhax.tesla.api.ITeslaProducer; -import net.darkhax.tesla.capability.TeslaCapabilities; -import net.minecraft.client.resources.I18n; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ICapabilityProvider; - -public class TeslaUtils { - - /** - * The smallest unit of power measurement. - */ - public static final int TESLA = 1; - - /** - * The amount of Tesla in a KiloTesla. One thousand. - */ - public static final int KILOTESLA = 1000; - - /** - * The amount of Telsa in a MegaTesla. One Million. - */ - public static final int MEGATESLA = 1000000; - - /** - * The amount of Tesla in a GigaTesla. One Billion. - */ - public static final int GIGATESLA = 1000000000; - - /** - * The amount of Telsa in a TeraTesla. One Trillion. - */ - public static final long TERATESLA = 1000000000000L; - - /** - * The amount of Tesla in a PentaTesla. One Quadrilli.on - */ - public static final long PENTATESLA = 1000000000000000L; - - /** - * The amount of Tesla in a ExaTesla. One Quintilian. - * - * The ExaTesla should not be treated as the largest unit of Tesla. The naming scheme can - * go on indefinitely. The next unit would be a ZettaTesla, followed by YottaTesla, - * BronoTesla, GeopTesla and so on. While it is possible to define these measurements, - * there really isn't a point. - */ - public static final long EXATESLA = 1000000000000000000L; - - /** - * Converts an amount of Tesla units into a human readable String. The string amount is - * only rounded to one decimal place. - * - * @param tesla The amount of Tesla units to display. - * @return A human readable display of the Tesla units. - */ - public static String getDisplayableTeslaCount (long tesla) { - - if (tesla < 1000) - return tesla + " T"; - - final int exp = (int) (Math.log(tesla) / Math.log(1000)); - final char unitType = "KMGTPE".charAt(exp - 1); - return String.format("%.1f %sT", tesla / Math.pow(1000, exp), unitType); - } - - /** - * Gets the abbreviated name of the best unit to describe the provided power. For example, - * anything less than 1000 will return t for tesla, while anything between 999 and one - * million will return kt for kilo tesla. This method has support for up to Exatesla. - * - * @param tesla The amount of Tesla to get the unit for. - * @return The abbreviated name for the unit used to describe the provided power amount. - */ - public static String getUnitType (long tesla) { - - if (tesla < 1000) - return tesla + "t"; - - final int exp = (int) (Math.log(tesla) / Math.log(1000)); - return "kmgtpe".charAt(exp - 1) + "t"; - } - - /** - * Gets the name of the the power unit that best represents the amount of provided power. - * The name will be translated to the local language, or english if that language is not - * yet supported. - * - * @param tesla The amount of Tesla to get the unit name for. - * @return The name of the power unit that best represents the amount of power provided. - */ - public static String getLocalizedUnitType (long tesla) { - - return I18n.format("unit.tesla." + getUnitType(tesla)); - } - - /** - * Checks if a capability provider has support for Tesla. - * - * @param provider The provider to check. ItemStack/TileEntity/Entity and so on. - * @param side The side to check. - * @return Whether or not the provider has support for Tesla. - */ - public static boolean hasTeslaSupport (ICapabilityProvider provider, EnumFacing side) { - - return isTeslaHolder(provider, side) || isTeslaConsumer(provider, side) || isTeslaProducer(provider, side); - } - - /** - * Checks if a capability provider is a Tesla holder. - * - * @param provider The provider to check. ItemStack/TileEntity/Entity and so on. - * @param side The side to check. - * @return Whether or not the provider is a Tesla holder. - */ - public static boolean isTeslaHolder (ICapabilityProvider provider, EnumFacing side) { - - return provider.hasCapability(TeslaCapabilities.CAPABILITY_HOLDER, side); - } - - /** - * Checks if a capability provider is a Tesla consumer. - * - * @param provider The provider to check. ItemStack/TileEntity/Entity and so on. - * @param side The side to check. - * @return Whether or not the provider is a Tesla consumer. - */ - public static boolean isTeslaConsumer (ICapabilityProvider provider, EnumFacing side) { - - return provider.hasCapability(TeslaCapabilities.CAPABILITY_CONSUMER, side); - } - - /** - * Checks if a capability provider is a Tesla producer. - * - * @param provider The provider to check. ItemStack/TileEntity/Entity and so on. - * @param side The side to check. - * @return Whether or not the provider is a Tesla producer. - */ - public static boolean isTeslaProducer (ICapabilityProvider provider, EnumFacing side) { - - return provider.hasCapability(TeslaCapabilities.CAPABILITY_PRODUCER, side); - } - - /** - * Gets an ITeslaHolder implementation from the capability provider. - * - * @param provider The provider to get the capability from. - * @param side The side to access; - * @return A Tesla holder implementation, or null if none could be found. - */ - public static ITeslaHolder getTeslaHolder (ICapabilityProvider provider, EnumFacing side) { - - return (ITeslaHolder) provider.getCapability(TeslaCapabilities.CAPABILITY_HOLDER, side); - } - - /** - * Gets an ITeslaConsumer implementation from the capability provider. - * - * @param provider The provider to get the capability from. - * @param side The side to access; - * @return A Tesla consumer implementation, or null if none could be found. - */ - public static ITeslaConsumer getTeslaConsumer (ICapabilityProvider provider, EnumFacing side) { - - return (ITeslaConsumer) provider.getCapability(TeslaCapabilities.CAPABILITY_HOLDER, side); - } - - /** - * Gets an ITeslaProducer implementation from the capability provider. - * - * @param provider The provider to get the capability from. - * @param side The side to access; - * @return A Tesla producer implementation, or null if none could be found. - */ - public static ITeslaProducer getTeslaProducer (ICapabilityProvider provider, EnumFacing side) { - - return (ITeslaProducer) provider.getCapability(TeslaCapabilities.CAPABILITY_HOLDER, side); - } - - /** - * Gets the capacity of a provider. - * - * @param provider The provider to access. - * @param side The side to access. - * @return The capacity of the provider. 0 if it has no capacity. - */ - public static long getCapacity (ICapabilityProvider provider, EnumFacing side) { - - return isTeslaHolder(provider, side) ? getTeslaHolder(provider, side).getCapacity() : 0; - } - - /** - * Gets the stored power of a provider. - * - * @param provider The provider to access. - * @param side The side to access. - * @return The amount of power stored. - */ - public static long getStoredPower (ICapabilityProvider provider, EnumFacing side) { - - return isTeslaHolder(provider, side) ? getTeslaHolder(provider, side).getStoredPower() : 0; - } - - /** - * Attempt to give power to a provider. - * - * @param power The amount of power to offer. - * @param simulated Whether or not this is being called as part of a simulation. - * Simulations are used to get information without affecting the Tesla Producer. - * @return The amount of power that the consumer accepts. - */ - public static long givePower (ICapabilityProvider provider, EnumFacing side, long power, boolean simulated) { - - return isTeslaConsumer(provider, side) ? getTeslaConsumer(provider, side).givePower(power, simulated) : 0; - } - - /** - * Attempts to take power from a provider. - * - * @param power The amount of power to request. - * @param simulated Whether or not this is being called as part of a simulation. - * Simulations are used to get information without affecting the Tesla Producer. - * @return The amount of power that the Tesla Producer will give. - */ - public static long takePower (ICapabilityProvider provider, EnumFacing side, long power, boolean simulated) { - - return isTeslaProducer(provider, side) ? getTeslaProducer(provider, side).takePower(power, simulated) : 0; - } - - /** - * Gets a list of all capabilities that touch a BlockPos. This will search for tile - * entities touching the BlockPos and then query them for access to their capabilities. - * - * @param capability The capability you want to retrieve. - * @param world The world that this is happening in. - * @param pos The position to search around. - * @return A list of all capabilities that are being held by connected blocks. - */ - public static List getConnectedCapabilities (Capability capability, World world, BlockPos pos) { - - final List capabilities = new ArrayList(); - - for (final EnumFacing side : EnumFacing.values()) { - - final TileEntity tile = world.getTileEntity(pos.offset(side)); - - if (tile != null && !tile.isInvalid() && tile.hasCapability(capability, side.getOpposite())) - capabilities.add(tile.getCapability(capability, side.getOpposite())); - } - - return capabilities; - } - - /** - * Attempts to give power to all consumers touching the given BlockPos. - * - * @param world The world that this is happening in. - * @param pos The position to search around. - * @param amount The amount of power to offer to each individual face. - * @param simulated Whether or not this is being ran as part of a simulation. - * @return The amount of power that was consumed. - */ - public static long distributePowerToAllFaces (World world, BlockPos pos, long amount, boolean simulated) { - - long consumedPower = 0L; - - for (final ITeslaConsumer consumer : getConnectedCapabilities(TeslaCapabilities.CAPABILITY_CONSUMER, world, pos)) - consumedPower += consumer.givePower(amount, simulated); - - return consumedPower; - } - - /** - * Attempts to consume power from all producers touching the given BlockPos. - * - * @param world The world that this is happening in. - * @param pos The position to search around. - * @param amount The amount of power to request from each individual face. - * @param simulated Whether or not this is being ran as part of a simulation. - * @return The amount of power that was successfully consumed. - */ - public static long consumePowerFromAllFaces (World world, BlockPos pos, long amount, boolean simulated) { - - long recievedPower = 0L; - - for (final ITeslaProducer producer : getConnectedCapabilities(TeslaCapabilities.CAPABILITY_PRODUCER, world, pos)) - recievedPower += producer.takePower(amount, simulated); - - return recievedPower; - } -} \ No newline at end of file diff --git a/src/api/java/powercrystals/minefactoryreloaded/api/IDeepStorageUnit.java b/src/api/java/powercrystals/minefactoryreloaded/api/IDeepStorageUnit.java deleted file mode 100644 index bc84d73cb..000000000 --- a/src/api/java/powercrystals/minefactoryreloaded/api/IDeepStorageUnit.java +++ /dev/null @@ -1,29 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.item.ItemStack; - -public interface IDeepStorageUnit -{ - /** - * @return A populated ItemStack with stackSize for the full amount of materials in the DSU. - * May have a stackSize > getMaxStackSize(). May have a stackSize of 0 (indicating locked contents). - */ - ItemStack getStoredItemType(); - - /** - * Sets the total amount of the item currently being stored, or zero if all items are to be removed. - */ - void setStoredItemCount(int amount); - - /** - * Sets the type of the stored item and initializes the number of stored items to amount. - * Will overwrite any existing stored items. - */ - void setStoredItemType(ItemStack type, int amount); - - /** - * @return The maximum number of items the DSU can hold. - * May change based on the current type stored. - */ - int getMaxStoredCount(); -} diff --git a/src/api/java/rebelkeithy/mods/metallurgy/api/IMetalSet.java b/src/api/java/rebelkeithy/mods/metallurgy/api/IMetalSet.java deleted file mode 100644 index 40dd5cfa6..000000000 --- a/src/api/java/rebelkeithy/mods/metallurgy/api/IMetalSet.java +++ /dev/null @@ -1,12 +0,0 @@ -package rebelkeithy.mods.metallurgy.api; - -import java.util.Map; - -public interface IMetalSet -{ - public IOreInfo getOreInfo(int metadata); - - public IOreInfo getOreInfo(String name); - - public Map getOreList(); -} diff --git a/src/api/java/rebelkeithy/mods/metallurgy/api/IOreInfo.java b/src/api/java/rebelkeithy/mods/metallurgy/api/IOreInfo.java deleted file mode 100644 index 4571c9bc4..000000000 --- a/src/api/java/rebelkeithy/mods/metallurgy/api/IOreInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -package rebelkeithy.mods.metallurgy.api; - -import net.minecraft.item.ItemStack; - -public interface IOreInfo -{ - // Returns an array of OreDictionary keys of the dusts the make this if it's - // an alloy - // if it's not an alloy, this returns null - public String[] getAlloyRecipe(); - - public ItemStack getBlock(); - - public ItemStack getBrick(); - - // If this ore drops something other than itself, this returns the ItemStack - // of the drop, otherwise returns null - public ItemStack getDrop(); - - public int getDropAmountMax(); - - public int getDropAmountMin(); - - // Returns the itemstack of dust this ore crushes into, if no dust exists, - // returns null - public ItemStack getDust(); - - // Returns the itemstack of ingot for this ore, if no ingot exists, returns - // null - public ItemStack getIngot(); - - public String getName(); - - public ItemStack getOre(); - - public OreType getType(); - - public boolean isEnabled(); - - public int getBlockHarvestLevel(); - - public int getToolHarvestLevel(); -} diff --git a/src/api/java/rebelkeithy/mods/metallurgy/api/MetallurgyAPI.java b/src/api/java/rebelkeithy/mods/metallurgy/api/MetallurgyAPI.java deleted file mode 100644 index af6cfa926..000000000 --- a/src/api/java/rebelkeithy/mods/metallurgy/api/MetallurgyAPI.java +++ /dev/null @@ -1,56 +0,0 @@ -package rebelkeithy.mods.metallurgy.api; - -import java.lang.reflect.Field; - -public class MetallurgyAPI -{ - - // Values for name: "base", "precious", "nether", "fantasy", "ender", - // "utility", "vanilla" - public static IMetalSet getMetalSet(String name) - { - try - { - String className = "rebelkeithy.mods.metallurgy.metals.MetallurgyMetals"; - - if (name.equals("vanilla")) - { - className = "rebelkeithy.mods.metallurgy.vanilla.MetallurgyVanilla"; - } - - final Class metallurgyMetals = Class.forName(className); - final Field set = metallurgyMetals.getField(name + "Set"); - return (IMetalSet) set.get(null); - } catch (final NoSuchFieldException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (final SecurityException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (final ClassNotFoundException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (final IllegalArgumentException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (final IllegalAccessException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - return null; - } - - public static String[] getMetalSetNames() - { - // TODO maybe put something to get runtime list here - final String[] names = - { "base", "precious", "nether", "fantasy", "ender", "utility", "vanilla" }; - return names; - } -} diff --git a/src/api/java/rebelkeithy/mods/metallurgy/api/OreType.java b/src/api/java/rebelkeithy/mods/metallurgy/api/OreType.java deleted file mode 100644 index 960c58222..000000000 --- a/src/api/java/rebelkeithy/mods/metallurgy/api/OreType.java +++ /dev/null @@ -1,19 +0,0 @@ -package rebelkeithy.mods.metallurgy.api; - -public enum OreType -{ - - ORE(true), CATALYST(true), ALLOY(false), RESPAWN(true), DROP(true); - - private boolean generates; - - OreType(boolean generates) - { - this.generates = generates; - } - - public boolean generates() - { - return generates; - } -} diff --git a/src/main/java/mekanism/api/Coord4D.java b/src/main/java/mekanism/api/Coord4D.java index b222b4424..918f96e2b 100644 --- a/src/main/java/mekanism/api/Coord4D.java +++ b/src/main/java/mekanism/api/Coord4D.java @@ -45,7 +45,7 @@ public class Coord4D yCoord = (int)entity.posY; zCoord = (int)entity.posZ; - dimensionId = entity.worldObj.provider.getDimension(); + dimensionId = entity.world.provider.getDimension(); } /** @@ -57,9 +57,9 @@ public class Coord4D */ public Coord4D(double x, double y, double z, int dimension) { - xCoord = MathHelper.floor_double(x); - yCoord = MathHelper.floor_double(y); - zCoord = MathHelper.floor_double(z); + xCoord = MathHelper.floor(x); + yCoord = MathHelper.floor(y); + zCoord = MathHelper.floor(z); dimensionId = dimension; } @@ -295,7 +295,7 @@ public class Coord4D int subX = xCoord - obj.xCoord; int subY = yCoord - obj.yCoord; int subZ = zCoord - obj.zCoord; - return (int)MathHelper.sqrt_double(subX * subX + subY * subY + subZ * subZ); + return (int)MathHelper.sqrt(subX * subX + subY * subY + subZ * subZ); } /** diff --git a/src/main/java/mekanism/api/EnumColor.java b/src/main/java/mekanism/api/EnumColor.java index f878c6d55..102189027 100644 --- a/src/main/java/mekanism/api/EnumColor.java +++ b/src/main/java/mekanism/api/EnumColor.java @@ -116,4 +116,17 @@ public enum EnumColor implements IStringSerializable { return code; } + + public static EnumColor getFromDyeName(String s) + { + for(EnumColor c : values()) + { + if(c.dyeName.equalsIgnoreCase(s)) + { + return c; + } + } + + return null; + } } diff --git a/src/main/java/mekanism/api/ItemRetriever.java b/src/main/java/mekanism/api/ItemRetriever.java deleted file mode 100644 index c2820f0bc..000000000 --- a/src/main/java/mekanism/api/ItemRetriever.java +++ /dev/null @@ -1,112 +0,0 @@ -package mekanism.api; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -/** - * Use this class's 'getItem()' method to retrieve ItemStacks from the 'Mekanism' - * class. - * @author AidanBrady - * - */ -public final class ItemRetriever -{ - /** The 'MekanismItems' class that items are retrieved from. */ - private static Class MekanismItems; - - /** The 'MekanismBlocks' class that blocks are retrieved from. */ - private static Class MekanismBlocks; - - /** - * Attempts to retrieve an ItemStack of an item with the declared identifier. - * - * Mekanism identifiers follow an easy-to-remember pattern. All identifiers - * are identical to the String returned by 'getItemName().' None include spaces, - * and all start with a capital letter. The name that shows up in-game can be - * stripped down to identifier form by removing spaces and all non-alphabetic - * characters (,./'=-_). Below is an example: - * - * ItemStack enrichedAlloy = ItemRetriever.getItem("EnrichedAlloy"); - * - * Note that for items or blocks that have specific metadata you will need to create - * a new ItemStack with that specified value, as this will only return an ItemStack - * with the meta value '0.' - * - * Make sure you run this in or after FMLPostInitializationEvent runs, because most - * items are registered when FMLInitializationEvent runs. However, some items ARE - * registered later in order to hook into other mods. In a rare circumstance you may - * have to add "after:Mekanism" in the @Mod 'dependencies' annotation. - * - * @param identifier - a String to be searched in the 'MekanismItems' class - * @return an ItemStack of the declared identifier, otherwise null. - */ - public static ItemStack getItem(String identifier) - { - try { - if(MekanismItems == null) - { - MekanismItems = Class.forName("mekanism.common.MekanismItems"); - } - - Object ret = MekanismItems.getField(identifier).get(null); - - if(ret instanceof Item) - { - return new ItemStack((Item)ret, 1); - } - else { - return null; - } - } catch(Exception e) { - System.err.println("Error retrieving item with identifier '" + identifier + "': " + e.getMessage()); - return null; - } - } - - /** - * Attempts to retrieve an ItemStack of a block with the declared identifier. - * - * Mekanism identifiers follow an easy-to-remember pattern. All identifiers - * are identical to the String returned by 'getItemName().' None include spaces, - * and all start with a capital letter. The name that shows up in-game can be - * stripped down to identifier form by removing spaces and all non-alphabetic - * characters (,./'=-_). Below is an example: - * - * ItemStack enrichedAlloy = ItemRetriever.getItem("EnrichedAlloy"); - * - * Note that for items or blocks that have specific metadata you will need to create - * a new ItemStack with that specified value, as this will only return an ItemStack - * with the meta value '0.' - * - * Make sure you run this in or after FMLPostInitializationEvent runs, because most - * items are registered when FMLInitializationEvent runs. However, some items ARE - * registered later in order to hook into other mods. In a rare circumstance you may - * have to add "after:Mekanism" in the @Mod 'dependencies' annotation. - * - * @param identifier - a String to be searched in the 'MekanismBlocks' class - * @return an ItemStack of the declared identifier, otherwise null. - */ - public static ItemStack getBlock(String identifier) - { - try { - if(MekanismBlocks == null) - { - MekanismBlocks = Class.forName("mekanism.common.MekanismBlocks"); - } - - Object ret = MekanismBlocks.getField(identifier).get(null); - - if(ret instanceof Block) - { - return new ItemStack((Block)ret, 1); - } - else { - return null; - } - } catch(Exception e) { - System.err.println("Error retrieving block with identifier '" + identifier + "': " + e.getMessage()); - return null; - } - } -} diff --git a/src/main/java/mekanism/api/MekanismAPI.java b/src/main/java/mekanism/api/MekanismAPI.java index b6cf53bb3..9c66ec57b 100644 --- a/src/main/java/mekanism/api/MekanismAPI.java +++ b/src/main/java/mekanism/api/MekanismAPI.java @@ -17,11 +17,11 @@ public class MekanismAPI /** Mekanism debug mode */ public static boolean debug = false; - public static boolean isBlockCompatible(Item item, int meta) + public static boolean isBlockCompatible(Block block, int meta) { for(BlockInfo i : cardboardBoxIgnore) { - if(i.block == Block.getBlockFromItem(item) && (i.meta == OreDictionary.WILDCARD_VALUE || i.meta == meta)) + if(i.block == block && (i.meta == OreDictionary.WILDCARD_VALUE || i.meta == meta)) { return false; } diff --git a/src/main/java/mekanism/api/Pos3D.java b/src/main/java/mekanism/api/Pos3D.java index b00c51484..9849a3323 100644 --- a/src/main/java/mekanism/api/Pos3D.java +++ b/src/main/java/mekanism/api/Pos3D.java @@ -181,7 +181,7 @@ public class Pos3D extends Vec3d double subX = xCoord - pos.xCoord; double subY = yCoord - pos.yCoord; double subZ = zCoord - pos.zCoord; - return MathHelper.sqrt_double(subX * subX + subY * subY + subZ * subZ); + return MathHelper.sqrt(subX * subX + subY * subY + subZ * subZ); } /** diff --git a/src/main/java/mekanism/api/TabProxy.java b/src/main/java/mekanism/api/TabProxy.java deleted file mode 100644 index c562c0247..000000000 --- a/src/main/java/mekanism/api/TabProxy.java +++ /dev/null @@ -1,42 +0,0 @@ -package mekanism.api; - -import net.minecraft.creativetab.CreativeTabs; - -/** - * Class used to indirectly reference the Mekanism creative tab. - * @author AidanBrady - * - */ -public final class TabProxy -{ - /** The 'Mekanism' class where the tab instance is stored. */ - public static Class Mekanism; - - /** - * Attempts to get the Mekanism creative tab instance from the 'Mekanism' class. Will return - * the tab if the mod is loaded, but otherwise will return the defined 'preferred' creative tab. This way - * you don't need to worry about NPEs! - * @return Mekanism creative tab if can, otherwise preferred tab - */ - public static CreativeTabs tabMekanism(CreativeTabs preferred) - { - try { - if(Mekanism == null) - { - Mekanism = Class.forName("mekanism.common.Mekanism"); - } - - Object ret = Mekanism.getField("tabMekanism").get(null); - - if(ret instanceof CreativeTabs) - { - return (CreativeTabs)ret; - } - - return preferred; - } catch(Exception e) { - System.err.println("Error retrieving Mekanism creative tab."); - return preferred; - } - } -} diff --git a/src/main/java/mekanism/api/energy/EnergizedItemManager.java b/src/main/java/mekanism/api/energy/EnergizedItemManager.java index 165bdf608..d49b61d4d 100644 --- a/src/main/java/mekanism/api/energy/EnergizedItemManager.java +++ b/src/main/java/mekanism/api/energy/EnergizedItemManager.java @@ -12,7 +12,7 @@ public class EnergizedItemManager */ public static double discharge(ItemStack itemStack, double amount) { - if(itemStack != null) + if(!itemStack.isEmpty()) { if(itemStack.getItem() instanceof IEnergizedItem) { @@ -39,7 +39,7 @@ public class EnergizedItemManager */ public static double charge(ItemStack itemStack, double amount) { - if(itemStack != null) + if(!itemStack.isEmpty()) { if(itemStack.getItem() instanceof IEnergizedItem) { diff --git a/src/main/java/mekanism/api/energy/ICableOutputter.java b/src/main/java/mekanism/api/energy/ICableOutputter.java deleted file mode 100644 index 73757cd92..000000000 --- a/src/main/java/mekanism/api/energy/ICableOutputter.java +++ /dev/null @@ -1,18 +0,0 @@ -package mekanism.api.energy; - -import net.minecraft.util.EnumFacing; - -/** - * Implement this if your TileEntity is capable of outputting energy to cables, overriding Mekanism's default implementation. - * @author AidanBrady - * - */ -public interface ICableOutputter -{ - /** - * Whether or not this block can output to a cable on a specific side. - * @param side - side to check - * @return if the block can output - */ - public boolean canOutputTo(EnumFacing side); -} diff --git a/src/main/java/mekanism/api/energy/IStrictEnergyAcceptor.java b/src/main/java/mekanism/api/energy/IStrictEnergyAcceptor.java index 49b6ee226..644aa76e1 100644 --- a/src/main/java/mekanism/api/energy/IStrictEnergyAcceptor.java +++ b/src/main/java/mekanism/api/energy/IStrictEnergyAcceptor.java @@ -3,21 +3,22 @@ package mekanism.api.energy; import net.minecraft.util.EnumFacing; /** - * Implement this if your TileEntity can accept energy at a floating-point double value from Universal Cables. + * Implement this if your TileEntity can accept energy. * @author AidanBrady * */ -public interface IStrictEnergyAcceptor extends IStrictEnergyStorage +public interface IStrictEnergyAcceptor { /** * Transfer a certain amount of energy to this acceptor. * @param amount - amount to transfer + * @param simulate - if the operation should be simulated * @return energy used */ - public double transferEnergyToAcceptor(EnumFacing side, double amount); + public double acceptEnergy(EnumFacing side, double amount, boolean simulate); /** - * Whether or not this tile entity accepts energy from a certain side. + * Whether or not this tile entity can accept energy from a certain side. * @param side - side to check * @return if tile entity accepts energy */ diff --git a/src/main/java/mekanism/api/energy/IStrictEnergyOutputter.java b/src/main/java/mekanism/api/energy/IStrictEnergyOutputter.java new file mode 100644 index 000000000..ef13c095b --- /dev/null +++ b/src/main/java/mekanism/api/energy/IStrictEnergyOutputter.java @@ -0,0 +1,26 @@ +package mekanism.api.energy; + +import net.minecraft.util.EnumFacing; + +/** + * Implement this if your TileEntity can output energy. + * @author AidanBrady + * + */ +public interface IStrictEnergyOutputter +{ + /** + * Pulls a certain amount of energy from this outputter. + * @param amount - amount to pull + * @param simulate - if the operation should be simulated + * @return energy sent + */ + public double pullEnergy(EnumFacing side, double amount, boolean simulate); + + /** + * Whether or not this tile entity can output energy on a specific side. + * @param side - side to check + * @return if the tile entity outputs energy + */ + public boolean canOutputEnergy(EnumFacing side); +} diff --git a/src/main/java/mekanism/api/energy/package-info.java b/src/main/java/mekanism/api/energy/package-info.java index 921d955d3..02c018275 100644 --- a/src/main/java/mekanism/api/energy/package-info.java +++ b/src/main/java/mekanism/api/energy/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "9.0.0", owner = "Mekanism", provides = "MekanismAPI|energy") +@API(apiVersion = "9.0.0", owner = "mekanism", provides = "MekanismAPI|energy") package mekanism.api.energy; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/mekanism/api/gas/Gas.java b/src/main/java/mekanism/api/gas/Gas.java index 9ade2f0ee..eaf57b358 100644 --- a/src/main/java/mekanism/api/gas/Gas.java +++ b/src/main/java/mekanism/api/gas/Gas.java @@ -223,22 +223,32 @@ public class Gas * Registers a new fluid out of this Gas or gets one from the FluidRegistry. * @return this Gas object */ - public Gas registerFluid() + public Gas registerFluid(String name) { if(fluid == null) { - if(FluidRegistry.getFluid(getName()) == null) + if(FluidRegistry.getFluid(name) == null) { - fluid = new Fluid(getName(), getIcon(), getIcon()).setGaseous(true); + fluid = new Fluid(name, getIcon(), getIcon()); FluidRegistry.registerFluid(fluid); } else { - fluid = FluidRegistry.getFluid(getName()); + fluid = FluidRegistry.getFluid(name); } } return this; } + + /** + * Registers a new fluid out of this Gas or gets one from the FluidRegistry. + * Uses default gas name. + * @return this Gas object + */ + public Gas registerFluid() + { + return registerFluid(getName()); + } @Override public String toString() diff --git a/src/main/java/mekanism/api/gas/IGasTransmitter.java b/src/main/java/mekanism/api/gas/IGasTransmitter.java deleted file mode 100644 index 2785ac1c8..000000000 --- a/src/main/java/mekanism/api/gas/IGasTransmitter.java +++ /dev/null @@ -1,9 +0,0 @@ -package mekanism.api.gas; - -import mekanism.api.transmitters.IGridTransmitter; -import net.minecraft.tileentity.TileEntity; - -public interface IGasTransmitter extends IGridTransmitter -{ - public boolean canTransferGasToTube(TileEntity tile); -} diff --git a/src/main/java/mekanism/api/gas/package-info.java b/src/main/java/mekanism/api/gas/package-info.java index b90d72b83..941425974 100644 --- a/src/main/java/mekanism/api/gas/package-info.java +++ b/src/main/java/mekanism/api/gas/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "9.0.0", owner = "Mekanism", provides = "MekanismAPI|gas") +@API(apiVersion = "9.0.0", owner = "mekanism", provides = "MekanismAPI|gas") package mekanism.api.gas; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/mekanism/api/infuse/package-info.java b/src/main/java/mekanism/api/infuse/package-info.java index 97cd6be1d..ceea59cf5 100644 --- a/src/main/java/mekanism/api/infuse/package-info.java +++ b/src/main/java/mekanism/api/infuse/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "9.0.0", owner = "Mekanism", provides = "MekanismAPI|infuse") +@API(apiVersion = "9.0.0", owner = "mekanism", provides = "MekanismAPI|infuse") package mekanism.api.infuse; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/mekanism/api/lasers/package-info.java b/src/main/java/mekanism/api/lasers/package-info.java index e11d37c48..6333b70a8 100644 --- a/src/main/java/mekanism/api/lasers/package-info.java +++ b/src/main/java/mekanism/api/lasers/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "9.0.0", owner = "Mekanism", provides = "MekanismAPI|laser") +@API(apiVersion = "9.0.0", owner = "mekanism", provides = "MekanismAPI|laser") package mekanism.api.lasers; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/mekanism/api/package-info.java b/src/main/java/mekanism/api/package-info.java index 945c0628f..00bbfa724 100644 --- a/src/main/java/mekanism/api/package-info.java +++ b/src/main/java/mekanism/api/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "9.0.0", owner = "Mekanism", provides = "MekanismAPI|core") +@API(apiVersion = "9.0.0", owner = "mekanism", provides = "MekanismAPI|core") package mekanism.api; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/mekanism/api/reactor/IFusionReactor.java b/src/main/java/mekanism/api/reactor/IFusionReactor.java deleted file mode 100644 index da96a27c3..000000000 --- a/src/main/java/mekanism/api/reactor/IFusionReactor.java +++ /dev/null @@ -1,65 +0,0 @@ -package mekanism.api.reactor; - -import mekanism.api.IHeatTransfer; -import mekanism.api.gas.GasTank; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidTank; - -public interface IFusionReactor extends IHeatTransfer -{ - public void addTemperatureFromEnergyInput(double energyAdded); - - public void simulate(); - - public FluidTank getWaterTank(); - - public FluidTank getSteamTank(); - - public GasTank getDeuteriumTank(); - - public GasTank getTritiumTank(); - - public GasTank getFuelTank(); - - public double getBufferedEnergy(); - - public void setBufferedEnergy(double energy); - - public double getPlasmaTemp(); - - public void setPlasmaTemp(double temp); - - public double getCaseTemp(); - - public void setCaseTemp(double temp); - - public double getBufferSize(); - - public void formMultiblock(boolean keepBurning); - - public boolean isFormed(); - - public void setInjectionRate(int rate); - - public int getInjectionRate(); - - public boolean isBurning(); - - public void setBurning(boolean burn); - - public int getMinInjectionRate(boolean active); - - public double getMaxPlasmaTemperature(boolean active); - - public double getMaxCasingTemperature(boolean active); - - public double getIgnitionTemperature(boolean active); - - public double getPassiveGeneration(boolean active, boolean current); - - public int getSteamPerTick(boolean current); - - public void updateTemperatures(); - - public ItemStack[] getInventory(); -} diff --git a/src/main/java/mekanism/api/reactor/INeutronCapture.java b/src/main/java/mekanism/api/reactor/INeutronCapture.java deleted file mode 100644 index 6171a7f74..000000000 --- a/src/main/java/mekanism/api/reactor/INeutronCapture.java +++ /dev/null @@ -1,6 +0,0 @@ -package mekanism.api.reactor; - -public interface INeutronCapture extends IReactorBlock -{ - public int absorbNeutrons(int neutrons); -} diff --git a/src/main/java/mekanism/api/reactor/IReactorBlock.java b/src/main/java/mekanism/api/reactor/IReactorBlock.java deleted file mode 100644 index 66919fdb1..000000000 --- a/src/main/java/mekanism/api/reactor/IReactorBlock.java +++ /dev/null @@ -1,10 +0,0 @@ -package mekanism.api.reactor; - -public interface IReactorBlock -{ - public boolean isFrame(); - - public void setReactor(IFusionReactor reactor); - - public IFusionReactor getReactor(); -} diff --git a/src/main/java/mekanism/api/reactor/package-info.java b/src/main/java/mekanism/api/reactor/package-info.java deleted file mode 100644 index e34266b48..000000000 --- a/src/main/java/mekanism/api/reactor/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion = "9.0.0", owner = "Mekanism", provides = "MekanismAPI|reactor") -package mekanism.api.reactor; -import net.minecraftforge.fml.common.API; - diff --git a/src/main/java/mekanism/api/recipe/RecipeHelper.java b/src/main/java/mekanism/api/recipe/RecipeHelper.java deleted file mode 100644 index a125a8cbb..000000000 --- a/src/main/java/mekanism/api/recipe/RecipeHelper.java +++ /dev/null @@ -1,318 +0,0 @@ -package mekanism.api.recipe; - -import java.lang.reflect.Method; - -import mekanism.api.gas.GasStack; -import mekanism.api.infuse.InfuseType; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -/** - * SET TO BE REMOVED NEXT MINOR MEKANISM VERSION, PLEASE USE IMC INSTEAD. - * Use this handy class to add recipes to Mekanism machinery. - * @author AidanBrady - * - */ -@Deprecated -public final class RecipeHelper -{ - /** - * Add an Enrichment Chamber recipe. - * @param input - input ItemStack - * @param output - output ItemStack - */ - public static void addEnrichmentChamberRecipe(ItemStack input, ItemStack output) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addEnrichmentChamberRecipe", ItemStack.class, ItemStack.class); - m.invoke(null, input, output); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } - - /** - * Add an Osmium Compressor recipe. - * @param input - input ItemStack - * @param output - output ItemStack - */ - public static void addOsmiumCompressorRecipe(ItemStack input, ItemStack output) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addOsmiumCompressorRecipe", ItemStack.class, ItemStack.class); - m.invoke(null, input, output); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } - - /** - * Add a Combiner recipe. - * @param input - input ItemStack - * @param output - output ItemStack - */ - public static void addCombinerRecipe(ItemStack input, ItemStack output) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addCombinerRecipe", ItemStack.class, ItemStack.class); - m.invoke(null, input, output); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } - - /** - * Add a Crusher recipe. - * @param input - input ItemStack - * @param output - output ItemStack - */ - public static void addCrusherRecipe(ItemStack input, ItemStack output) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addCrusherRecipe", ItemStack.class, ItemStack.class); - m.invoke(null, input, output); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } - - /** - * Add a Purification Chamber recipe. - * @param input - input ItemStack - * @param output - output ItemStack - */ - public static void addPurificationChamberRecipe(ItemStack input, ItemStack output) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addPurificationChamberRecipe", ItemStack.class, ItemStack.class); - m.invoke(null, input, output); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } - - /** - * Add a Chemical Oxidizer recipe. - * @param input - input ItemStack - * @param output - output GasStack - */ - public static void addChemicalOxidizerRecipe(ItemStack input, GasStack output) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addChemicalOxidizerRecipe", ItemStack.class, GasStack.class); - m.invoke(null, input, output); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } - - /** - * Add a Chemical Infuser recipe. - * @param leftInput - left input GasStack - * @param rightInput - right input GasStack - * @param output - output GasStack - */ - public static void addChemicalInfuserRecipe(GasStack leftInput, GasStack rightInput, GasStack output) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addChemicalInfuserRecipe", GasStack.class, GasStack.class, GasStack.class); - m.invoke(null, leftInput, rightInput, output); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } - - /** - * Add a Precision Sawmill recipe. - * @param input - input ItemStack - * @param primaryOutput - guaranteed output - * @param secondaryOutput - possible extra output - * @param chance - probability of obtaining extra output - */ - public static void addPrecisionSawmillRecipe(ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, double chance) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addPrecisionSawmillRecipe", ItemStack.class, ItemStack.class, ItemStack.class, Double.TYPE); - m.invoke(null, input, primaryOutput, secondaryOutput, chance); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } - - /** - * Add a Precision Sawmill recipe with no chance output - * @param input - input ItemStack - * @param primaryOutput - guaranteed output - */ - public static void addPrecisionSawmillRecipe(ItemStack input, ItemStack primaryOutput) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addPrecisionSawmillRecipe", ItemStack.class, ItemStack.class); - m.invoke(null, input, primaryOutput); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } - - /** - * Add a Chemical Injection Chamber recipe. - * @param input - input AdvancedInput - * @param output - output ItemStack - */ - public static void addChemicalInjectionChamberRecipe(ItemStack input, String gasName, ItemStack output) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addChemicalInjectionChamberRecipe", ItemStack.class, String.class, ItemStack.class); - m.invoke(null, input, gasName, output); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } - - /** - * Add an Electrolytic Separator recipe. - * @param input - input FluidStack - * @param energy - required energy - * @param leftOutput - left output GasStack - * @param rightOutput - right output GasStack - */ - public static void addElectrolyticSeparatorRecipe(FluidStack input, double energy, GasStack leftOutput, GasStack rightOutput) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addElectrolyticSeparatorRecipe", FluidStack.class, Double.TYPE, GasStack.class, GasStack.class); - m.invoke(null, input, energy, leftOutput, rightOutput); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } - - /** - * Add a Chemical Dissolution Chamber recipe. - * @param input - input ItemStack - * @param output - output GasStack - */ - public static void addChemicalDissolutionChamberRecipe(ItemStack input, GasStack output) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addChemicalDissolutionChamberRecipe", ItemStack.class, GasStack.class); - m.invoke(null, input, output); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } - - /** - * Add a Chemical Washer recipe. - * @param input - input GasStack - * @param output - output GasStack - */ - public static void addChemicalWasherRecipe(GasStack input, GasStack output) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addChemicalWasherRecipe", GasStack.class, GasStack.class); - m.invoke(null, input, output); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } - - /** - * Add a Chemical Crystallizer recipe. - * @param input - input GasStack - * @param output - output ItemStack - */ - public static void addChemicalCrystallizerRecipe(GasStack input, ItemStack output) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addChemicalCrystallizerRecipe", GasStack.class, ItemStack.class); - m.invoke(null, input, output); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } - - /** - * Add a Metallurgic Infuser recipe. - * @param infuse - which Infuse to use - * @param amount - how much Infuse to use - * @param input - input ItemStack - * @param output - output ItemStack - */ - public static void addMetallurgicInfuserRecipe(InfuseType infuse, int amount, ItemStack input, ItemStack output) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addMetallurgicInfuserRecipe", InfuseType.class, Integer.TYPE, ItemStack.class, ItemStack.class); - m.invoke(null, infuse, amount, input, output); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } - - /** - * Add a Pressurized Reaction Chamber recipe. - * @param inputSolid - input ItemStack - * @param inputFluid - input FluidStack - * @param inputGas - input GasStack - * @param outputSolid - output ItemStack - * @param outputGas - output GasStack - * @param extraEnergy - extra energy needed by the recipe - * @param ticks - amount of ticks it takes for this recipe to complete - */ - public static void addPRCRecipe(ItemStack inputSolid, FluidStack inputFluid, GasStack inputGas, ItemStack outputSolid, GasStack outputGas, double extraEnergy, int ticks) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addPRCRecipe", ItemStack.class, FluidStack.class, GasStack.class, ItemStack.class, GasStack.class, Double.TYPE, Integer.TYPE); - m.invoke(null, inputSolid, inputFluid, inputGas, outputSolid, outputGas, extraEnergy, ticks); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } - - /** - * Add a Thermal Evaporation Plant recipe. - * @param input - input GasStack - * @param output - output GasStack - */ - public static void addThermalEvaporationRecipe(FluidStack input, FluidStack output) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addThermalEvaporationRecipe", FluidStack.class, FluidStack.class); - m.invoke(null, input, output); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } - - /** - * Add a Solar Neutron Activator recipe. - * @param input - input GasStack - * @param output - output GasStack - */ - public static void addSolarNeutronRecipe(GasStack input, GasStack output) - { - try { - Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler"); - Method m = recipeClass.getMethod("addSolarNeutronRecipe", GasStack.class, GasStack.class); - m.invoke(null, input, output); - } catch(Exception e) { - System.err.println("Error while adding recipe: " + e.getMessage()); - } - } -} diff --git a/src/main/java/mekanism/api/recipe/package-info.java b/src/main/java/mekanism/api/recipe/package-info.java deleted file mode 100644 index 7d9481aa8..000000000 --- a/src/main/java/mekanism/api/recipe/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion = "9.0.0", owner = "Mekanism", provides = "MekanismAPI|recipe") -package mekanism.api.recipe; -import net.minecraftforge.fml.common.API; - diff --git a/src/main/java/mekanism/api/transmitters/DynamicNetwork.java b/src/main/java/mekanism/api/transmitters/DynamicNetwork.java index e19a94749..707cc23bb 100644 --- a/src/main/java/mekanism/api/transmitters/DynamicNetwork.java +++ b/src/main/java/mekanism/api/transmitters/DynamicNetwork.java @@ -46,7 +46,7 @@ public abstract class DynamicNetwork> implemen protected int updateDelay = 0; protected boolean firstUpdate = true; - protected World worldObj = null; + protected World world = null; public void addNewTransmitters(Collection> newTransmitters) { @@ -61,9 +61,9 @@ public abstract class DynamicNetwork> implemen { if(transmitter.isValid()) { - if(worldObj == null) + if(world == null) { - worldObj = transmitter.world(); + world = transmitter.world(); } for(EnumFacing side : EnumFacing.VALUES) @@ -180,7 +180,7 @@ public abstract class DynamicNetwork> implemen public void invalidateTransmitter(IGridTransmitter transmitter) { - if(!worldObj.isRemote && transmitter.isValid()) + if(!world.isRemote && transmitter.isValid()) { transmitter.takeShare(); transmitter.setTransmitterNetwork(null); @@ -334,7 +334,7 @@ public abstract class DynamicNetwork> implemen public World getWorld() { - return worldObj; + return world; } public abstract Set> getAcceptors(Object data); diff --git a/src/main/java/mekanism/api/transmitters/TransmissionType.java b/src/main/java/mekanism/api/transmitters/TransmissionType.java index de678bb9f..e72d24f1d 100644 --- a/src/main/java/mekanism/api/transmitters/TransmissionType.java +++ b/src/main/java/mekanism/api/transmitters/TransmissionType.java @@ -1,6 +1,5 @@ package mekanism.api.transmitters; -import mekanism.api.gas.IGasTransmitter; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.translation.I18n; @@ -66,14 +65,6 @@ public enum TransmissionType } } - if(this == GAS && currentTile instanceof IGasTransmitter) - { - if(((IGasTransmitter)currentTile).canTransferGasToTube(sideTile)) - { - return true; - } - } - return false; } } \ No newline at end of file diff --git a/src/main/java/mekanism/api/transmitters/package-info.java b/src/main/java/mekanism/api/transmitters/package-info.java index 412714cb0..4975a33a0 100644 --- a/src/main/java/mekanism/api/transmitters/package-info.java +++ b/src/main/java/mekanism/api/transmitters/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "9.0.0", owner = "Mekanism", provides = "MekanismAPI|transmitter") +@API(apiVersion = "9.0.0", owner = "mekanism", provides = "MekanismAPI|transmitter") package mekanism.api.transmitters; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/mekanism/api/util/package-info.java b/src/main/java/mekanism/api/util/package-info.java index bf15e52e5..78a74cdff 100644 --- a/src/main/java/mekanism/api/util/package-info.java +++ b/src/main/java/mekanism/api/util/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "9.0.0", owner = "Mekanism", provides = "MekanismAPI|util") +@API(apiVersion = "9.0.0", owner = "mekanism", provides = "MekanismAPI|util") package mekanism.api.util; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/mekanism/client/ClientConnectionHandler.java b/src/main/java/mekanism/client/ClientConnectionHandler.java index 12f248d58..1e9d0a665 100644 --- a/src/main/java/mekanism/client/ClientConnectionHandler.java +++ b/src/main/java/mekanism/client/ClientConnectionHandler.java @@ -2,9 +2,9 @@ package mekanism.client; import java.net.InetSocketAddress; -import mekanism.api.MekanismConfig.general; import mekanism.client.voice.VoiceClient; import mekanism.common.Mekanism; +import mekanism.common.config.MekanismConfig.general; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientConnectedToServerEvent; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/mekanism/client/ClientProxy.java b/src/main/java/mekanism/client/ClientProxy.java index e443519b4..e86d353dc 100644 --- a/src/main/java/mekanism/client/ClientProxy.java +++ b/src/main/java/mekanism/client/ClientProxy.java @@ -10,11 +10,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import mcmultipart.client.multipart.MultipartRegistryClient; import mekanism.api.Coord4D; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.client; -import mekanism.api.MekanismConfig.general; import mekanism.api.Pos3D; import mekanism.client.SparkleAnimation.INodeChecker; import mekanism.client.entity.ParticleLaser; @@ -125,6 +122,10 @@ import mekanism.common.block.states.BlockStateMachine.MachineBlockStateMapper; import mekanism.common.block.states.BlockStateMachine.MachineType; import mekanism.common.block.states.BlockStateOre.EnumOreType; import mekanism.common.block.states.BlockStatePlastic.PlasticBlockStateMapper; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterStateMapper; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterType; +import mekanism.common.config.MekanismConfig.client; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.entity.EntityBabySkeleton; import mekanism.common.entity.EntityBalloon; import mekanism.common.entity.EntityFlame; @@ -134,20 +135,13 @@ import mekanism.common.inventory.InventoryPersonalChest; import mekanism.common.item.ItemBlockBasic; import mekanism.common.item.ItemBlockGasTank; import mekanism.common.item.ItemBlockMachine; +import mekanism.common.item.ItemBlockTransmitter; import mekanism.common.item.ItemCraftingFormula; import mekanism.common.item.ItemPortableTeleporter; import mekanism.common.item.ItemSeismicReader; import mekanism.common.item.ItemWalkieTalkie; import mekanism.common.multiblock.MultiblockManager; -import mekanism.common.multipart.PartDiversionTransporter; -import mekanism.common.multipart.PartLogisticalTransporter; -import mekanism.common.multipart.PartMechanicalPipe; -import mekanism.common.multipart.PartPressurizedTube; -import mekanism.common.multipart.PartRestrictiveTransporter; -import mekanism.common.multipart.PartThermodynamicConductor; -import mekanism.common.multipart.PartUniversalCable; import mekanism.common.network.PacketPortableTeleporter.PortableTeleporterMessage; -import mekanism.common.tile.TileEntityAdvancedElectricMachine; import mekanism.common.tile.TileEntityAdvancedFactory; import mekanism.common.tile.TileEntityAmbientAccumulator; import mekanism.common.tile.TileEntityBin; @@ -165,7 +159,6 @@ import mekanism.common.tile.TileEntityCrusher; import mekanism.common.tile.TileEntityDigitalMiner; import mekanism.common.tile.TileEntityDynamicTank; import mekanism.common.tile.TileEntityDynamicValve; -import mekanism.common.tile.TileEntityElectricMachine; import mekanism.common.tile.TileEntityElectricPump; import mekanism.common.tile.TileEntityElectrolyticSeparator; import mekanism.common.tile.TileEntityEliteFactory; @@ -198,6 +191,15 @@ import mekanism.common.tile.TileEntitySeismicVibrator; import mekanism.common.tile.TileEntitySolarNeutronActivator; import mekanism.common.tile.TileEntityTeleporter; import mekanism.common.tile.TileEntityThermalEvaporationController; +import mekanism.common.tile.prefab.TileEntityAdvancedElectricMachine; +import mekanism.common.tile.prefab.TileEntityElectricMachine; +import mekanism.common.tile.transmitter.TileEntityDiversionTransporter; +import mekanism.common.tile.transmitter.TileEntityLogisticalTransporter; +import mekanism.common.tile.transmitter.TileEntityMechanicalPipe; +import mekanism.common.tile.transmitter.TileEntityPressurizedTube; +import mekanism.common.tile.transmitter.TileEntityRestrictiveTransporter; +import mekanism.common.tile.transmitter.TileEntityThermodynamicConductor; +import mekanism.common.tile.transmitter.TileEntityUniversalCable; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -212,7 +214,7 @@ import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderSkeleton; -import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.entity.monster.AbstractSkeleton; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.Item; @@ -251,6 +253,7 @@ public class ClientProxy extends CommonProxy { public static Map machineResources = new HashMap(); public static Map basicResources = new HashMap(); + public static Map transmitterResources = new HashMap(); public static final String[] CUSTOM_RENDERS = new String[] {"fluid_tank", "bin_basic", "bin_advanced", "bin_elite", "bin_ultimate", "Jetpack", "FreeRunners", "AtomicDisassembler", "ScubaTank", "GasMask", "ArmoredJetpack", "Flamethrower", "personal_chest", @@ -262,6 +265,7 @@ public class ClientProxy extends CommonProxy private static final IStateMapper plasticMapper = new PlasticBlockStateMapper(); private static final IStateMapper fenceMapper = new PlasticFenceStateMapper(); private static final IStateMapper boxMapper = new CardboardBoxStateMapper(); + private static final IStateMapper transmitterMapper = new TransmitterStateMapper(); @Override public void loadConfiguration() @@ -279,6 +283,7 @@ public class ClientProxy extends CommonProxy client.enableAmbientLighting = Mekanism.configuration.get("client", "EnableAmbientLighting", true).getBoolean(); client.ambientLightingLevel = Mekanism.configuration.get("client", "AmbientLightingLevel", 15).getInt(); client.opaqueTransmitters = Mekanism.configuration.get("client", "OpaqueTransmitterRender", false).getBoolean(); + client.allowConfiguratorModeScroll = Mekanism.configuration.get("client", "ConfiguratorModeScroll", true).getBoolean(); if(Mekanism.configuration.hasChanged()) { @@ -289,7 +294,7 @@ public class ClientProxy extends CommonProxy @Override public void openPersonalChest(EntityPlayer entityplayer, int id, int windowId, boolean isBlock, BlockPos pos, EnumHand hand) { - TileEntityPersonalChest tileEntity = (TileEntityPersonalChest)entityplayer.worldObj.getTileEntity(pos); + TileEntityPersonalChest tileEntity = (TileEntityPersonalChest)entityplayer.world.getTileEntity(pos); if(id == 0) { @@ -350,19 +355,18 @@ public class ClientProxy extends CommonProxy ClientRegistry.registerTileEntity(TileEntityQuantumEntangloporter.class, "QuantumEntangloporter", new RenderQuantumEntangloporter()); ClientRegistry.registerTileEntity(TileEntityChemicalDissolutionChamber.class, "ChemicalDissolutionChamber", new RenderChemicalDissolutionChamber()); - MultipartRegistryClient.bindMultipartSpecialRenderer(PartMechanicalPipe.class, new RenderMechanicalPipe()); - MultipartRegistryClient.bindMultipartSpecialRenderer(PartUniversalCable.class, new RenderUniversalCable()); - MultipartRegistryClient.bindMultipartSpecialRenderer(PartThermodynamicConductor.class, new RenderThermodynamicConductor()); - MultipartRegistryClient.bindMultipartSpecialRenderer(PartLogisticalTransporter.class, new RenderLogisticalTransporter()); - MultipartRegistryClient.bindMultipartSpecialRenderer(PartDiversionTransporter.class, new RenderLogisticalTransporter()); - MultipartRegistryClient.bindMultipartSpecialRenderer(PartRestrictiveTransporter.class, new RenderLogisticalTransporter()); - MultipartRegistryClient.bindMultipartSpecialRenderer(PartPressurizedTube.class, new RenderPressurizedTube()); + ClientRegistry.registerTileEntity(TileEntityMechanicalPipe.class, "MechanicalPipe", new RenderMechanicalPipe()); + ClientRegistry.registerTileEntity(TileEntityUniversalCable.class, "UniversalCable", new RenderUniversalCable()); + ClientRegistry.registerTileEntity(TileEntityThermodynamicConductor.class, "ThermodynamicConductor", new RenderThermodynamicConductor()); + ClientRegistry.registerTileEntity(TileEntityLogisticalTransporter.class, "LogisticalTransporter", new RenderLogisticalTransporter()); + ClientRegistry.registerTileEntity(TileEntityDiversionTransporter.class, "DiversionTransporter", new RenderLogisticalTransporter()); + ClientRegistry.registerTileEntity(TileEntityRestrictiveTransporter.class, "RestrictiveTransporter", new RenderLogisticalTransporter()); + ClientRegistry.registerTileEntity(TileEntityPressurizedTube.class, "PressurizedTube", new RenderPressurizedTube()); } @Override public void registerItemRenders() { - registerItemRender(MekanismItems.PartTransmitter); registerItemRender(MekanismItems.ElectricBow); registerItemRender(MekanismItems.Dust); registerItemRender(MekanismItems.Ingot); @@ -412,7 +416,6 @@ public class ClientProxy extends CommonProxy registerItemRender(MekanismItems.GaugeDropper); registerItemRender(MekanismItems.TierInstaller); registerItemRender(MekanismItems.OtherDust); - registerItemRender(MekanismItems.GlowPanel); ModelBakery.registerItemVariants(MekanismItems.WalkieTalkie, ItemWalkieTalkie.OFF_MODEL); @@ -440,12 +443,18 @@ public class ClientProxy extends CommonProxy ModelLoader.setCustomStateMapper(MekanismBlocks.RoadPlasticBlock, plasticMapper); ModelLoader.setCustomStateMapper(MekanismBlocks.PlasticFence, fenceMapper); ModelLoader.setCustomStateMapper(MekanismBlocks.CardboardBox, boxMapper); + ModelLoader.setCustomStateMapper(MekanismBlocks.Transmitter, transmitterMapper); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.ObsidianTNT), 0, new ModelResourceLocation("mekanism:ObsidianTNT", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.SaltBlock), 0, new ModelResourceLocation("mekanism:SaltBlock", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.CardboardBox), 0, new ModelResourceLocation("mekanism:CardboardBox", "storage=false")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.CardboardBox), 1, new ModelResourceLocation("mekanism:CardboardBox", "storage=true")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.EnergyCube), 0, new ModelResourceLocation("mekanism:EnergyCube", "inventory")); + + for(int i = 0; i < EnumColor.DYES.length; i++) + { + ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.GlowPanel), i, new ModelResourceLocation("mekanism:glowpanel", "inventory")); + } for(MachineType type : MachineType.values()) { @@ -591,6 +600,50 @@ public class ClientProxy extends CommonProxy ModelLoader.registerItemVariants(Item.getItemFromBlock(type.blockType.getBlock()), modelsToAdd.toArray(new ModelResourceLocation[] {})); } + + for(TransmitterType type : TransmitterType.values()) + { + List modelsToAdd = new ArrayList(); + String resource = "mekanism:" + type.getName(); + BaseTier tierPointer = null; + + if(type.hasTiers()) + { + tierPointer = BaseTier.values()[0]; + resource = "mekanism:" + type.getName() + "_" + tierPointer.getName(); + } + + while(true) + { + if(transmitterResources.get(resource) == null) + { + String properties = "inventory"; + ModelResourceLocation model = new ModelResourceLocation(resource, properties); + + transmitterResources.put(resource, model); + modelsToAdd.add(model); + + if(type.hasTiers()) + { + if(tierPointer.ordinal() < BaseTier.values().length-1) + { + tierPointer = BaseTier.values()[tierPointer.ordinal()+1]; + + if(tierPointer.isObtainable()) + { + resource = "mekanism:" + type.getName() + "_" + tierPointer.getName(); + + continue; + } + } + } + } + + break; + } + + ModelLoader.registerItemVariants(Item.getItemFromBlock(MekanismBlocks.Transmitter), modelsToAdd.toArray(new ModelResourceLocation[] {})); + } for(EnumColor color : EnumColor.DYES) { @@ -671,6 +724,31 @@ public class ClientProxy extends CommonProxy ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.BasicBlock), basicMesher); ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.BasicBlock2), basicMesher); + ItemMeshDefinition transmitterMesher = new ItemMeshDefinition() { + @Override + public ModelResourceLocation getModelLocation(ItemStack stack) + { + TransmitterType type = TransmitterType.get(stack.getItemDamage()); + + if(type != null) + { + String resource = "mekanism:" + type.getName(); + + if(type.hasTiers()) + { + BaseTier tier = ((ItemBlockTransmitter)stack.getItem()).getBaseTier(stack); + resource = "mekanism:" + type.getName() + "_" + tier.getName(); + } + + return transmitterResources.get(resource); + } + + return null; + } + }; + + ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.Transmitter), transmitterMesher); + OBJLoader.INSTANCE.addDomain("mekanism"); } @@ -717,10 +795,12 @@ public class ClientProxy extends CommonProxy case 14: ItemStack itemStack = player.getHeldItem(EnumHand.values()[pos.getX()]); - if(itemStack != null && itemStack.getItem() instanceof ItemPortableTeleporter) + if(!itemStack.isEmpty() && itemStack.getItem() instanceof ItemPortableTeleporter) { return new GuiTeleporter(player, EnumHand.values()[pos.getX()], itemStack); } + + return null; case 15: return new GuiPurificationChamber(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity); case 16: @@ -737,6 +817,8 @@ public class ClientProxy extends CommonProxy { return new GuiRobitMain(player.inventory, robit); } + + return null; case 22: robit = (EntityRobit)world.getEntityByID(pos.getX()); @@ -744,6 +826,8 @@ public class ClientProxy extends CommonProxy { return new GuiRobitCrafting(player.inventory, robit); } + + return null; case 23: robit = (EntityRobit)world.getEntityByID(pos.getX()); @@ -751,6 +835,8 @@ public class ClientProxy extends CommonProxy { return new GuiRobitInventory(player.inventory, robit); } + + return null; case 24: robit = (EntityRobit)world.getEntityByID(pos.getX()); @@ -758,6 +844,8 @@ public class ClientProxy extends CommonProxy { return new GuiRobitSmelting(player.inventory, robit); } + + return null; case 25: robit = (EntityRobit)world.getEntityByID(pos.getX()); @@ -765,6 +853,8 @@ public class ClientProxy extends CommonProxy { return new GuiRobitRepair(player.inventory, robit); } + + return null; case 29: return new GuiChemicalOxidizer(player.inventory, (TileEntityChemicalOxidizer)tileEntity); case 30: @@ -786,10 +876,12 @@ public class ClientProxy extends CommonProxy case 38: ItemStack itemStack1 = player.getHeldItem(EnumHand.values()[pos.getX()]); - if(itemStack1 != null && itemStack1.getItem() instanceof ItemSeismicReader) + if(!itemStack1.isEmpty() && itemStack1.getItem() instanceof ItemSeismicReader) { return new GuiSeismicReader(world, new Coord4D(player), itemStack1.copy()); } + + return null; case 39: return new GuiSeismicVibrator(player.inventory, (TileEntitySeismicVibrator)tileEntity); case 40: @@ -840,7 +932,7 @@ public class ClientProxy extends CommonProxy { GuiScreen screen = Minecraft.getMinecraft().currentScreen; - if(screen instanceof GuiTeleporter && ((GuiTeleporter)screen).itemStack != null) + if(screen instanceof GuiTeleporter && !((GuiTeleporter)screen).itemStack.isEmpty()) { GuiTeleporter teleporter = (GuiTeleporter)screen; @@ -856,7 +948,7 @@ public class ClientProxy extends CommonProxy @Override public void addHitEffects(Coord4D coord, RayTraceResult mop) { - if(Minecraft.getMinecraft().theWorld != null) + if(Minecraft.getMinecraft().world != null) { Minecraft.getMinecraft().effectRenderer.addBlockHitEffects(coord.getPos(), mop); } @@ -1007,7 +1099,7 @@ public class ClientProxy extends CommonProxy }); RenderingRegistry.registerEntityRenderingHandler(EntityBabySkeleton.class, new IRenderFactory() { @Override - public Render createRenderFor(RenderManager manager) + public Render createRenderFor(RenderManager manager) { return new RenderSkeleton(manager); } @@ -1025,7 +1117,7 @@ public class ClientProxy extends CommonProxy @Override public ModelResourceLocation getModelLocation(ItemStack stack) { - if(stack != null && stack.getItem() instanceof ItemWalkieTalkie) + if(!stack.isEmpty() && stack.getItem() instanceof ItemWalkieTalkie) { ItemWalkieTalkie item = (ItemWalkieTalkie)stack.getItem(); @@ -1044,7 +1136,7 @@ public class ClientProxy extends CommonProxy @Override public ModelResourceLocation getModelLocation(ItemStack stack) { - if(stack != null && stack.getItem() instanceof ItemCraftingFormula) + if(!stack.isEmpty() && stack.getItem() instanceof ItemCraftingFormula) { ItemCraftingFormula item = (ItemCraftingFormula)stack.getItem(); @@ -1114,20 +1206,20 @@ public class ClientProxy extends CommonProxy return context.getServerHandler().playerEntity; } else { - return Minecraft.getMinecraft().thePlayer; + return Minecraft.getMinecraft().player; } } @Override public void handlePacket(Runnable runnable, EntityPlayer player) { - if(player == null || player.worldObj.isRemote) + if(player == null || player.world.isRemote) { Minecraft.getMinecraft().addScheduledTask(runnable); } - else if(player != null && !player.worldObj.isRemote) + else if(player != null && !player.world.isRemote) { - ((WorldServer)player.worldObj).addScheduledTask(runnable); //singleplayer + ((WorldServer)player.world).addScheduledTask(runnable); //singleplayer } } diff --git a/src/main/java/mekanism/client/ClientTickHandler.java b/src/main/java/mekanism/client/ClientTickHandler.java index e63846429..ff9306675 100644 --- a/src/main/java/mekanism/client/ClientTickHandler.java +++ b/src/main/java/mekanism/client/ClientTickHandler.java @@ -10,30 +10,40 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Map.Entry; +import java.util.Random; import java.util.Set; import mekanism.api.IClientTicker; -import mekanism.api.MekanismConfig.client; -import mekanism.api.ObfuscatedNames; import mekanism.api.gas.GasStack; -import mekanism.api.util.ReflectionUtils; +import mekanism.client.render.RenderTickHandler; import mekanism.client.sound.SoundHandler; import mekanism.common.CommonPlayerTickHandler; import mekanism.common.KeySync; import mekanism.common.Mekanism; +import mekanism.common.ObfuscatedNames; +import mekanism.common.config.MekanismConfig.client; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.frequency.Frequency; +import mekanism.common.item.ItemConfigurator; import mekanism.common.item.ItemFlamethrower; import mekanism.common.item.ItemFreeRunners; import mekanism.common.item.ItemGasMask; import mekanism.common.item.ItemJetpack; +import mekanism.common.item.ItemConfigurator.ConfiguratorMode; import mekanism.common.item.ItemJetpack.JetpackMode; import mekanism.common.item.ItemScubaTank; import mekanism.common.network.PacketFlamethrowerData; +import mekanism.common.network.PacketConfiguratorState.ConfiguratorStateMessage; import mekanism.common.network.PacketFlamethrowerData.FlamethrowerDataMessage; import mekanism.common.network.PacketJetpackData.JetpackDataMessage; import mekanism.common.network.PacketJetpackData.JetpackPacket; +import mekanism.common.network.PacketPortableTeleporter.PortableTeleporterMessage; +import mekanism.common.network.PacketPortableTeleporter.PortableTeleporterPacketType; import mekanism.common.network.PacketScubaTankData.ScubaTankDataMessage; import mekanism.common.network.PacketScubaTankData.ScubaTankPacket; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.ReflectionUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.network.NetworkPlayerInfo; @@ -41,8 +51,11 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; +import net.minecraft.util.EnumHand; +import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.MouseEvent; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; @@ -70,6 +83,7 @@ public class ClientTickHandler public boolean shouldReset = false; public static Minecraft mc = FMLClientHandler.instance().getClient(); + public static Random rand = new Random(); public static final String MIKE_CAPE = "https://dl.dropboxusercontent.com/s/ji06yflixnszcby/cape.png"; public static final String DONATE_CAPE = "https://dl.dropboxusercontent.com/u/90411166/donate.png"; @@ -80,6 +94,9 @@ public class ClientTickHandler private Map aidanDownload = new HashMap(); public static Set tickingSet = new HashSet(); + public static Map portableTeleports = new HashMap<>(); + + public static int wheelStatus = 0; @SubscribeEvent public void onTick(ClientTickEvent event) @@ -94,9 +111,9 @@ public class ClientTickHandler { MekanismClient.ticksPassed++; - if(!hasNotified && mc.theWorld != null && Mekanism.latestVersionNumber != null && Mekanism.recentNews != null) + if(!hasNotified && mc.world != null && Mekanism.latestVersionNumber != null && Mekanism.recentNews != null) { - MekanismUtils.checkForUpdates(mc.thePlayer); + MekanismUtils.checkForUpdates(mc.player); hasNotified = true; } @@ -116,7 +133,7 @@ public class ClientTickHandler } } - if(mc.theWorld != null) + if(mc.world != null) { shouldReset = true; } @@ -126,140 +143,140 @@ public class ClientTickHandler shouldReset = false; } - if(mc.theWorld != null && !Mekanism.proxy.isPaused()) + if(mc.world != null && mc.player != null && !Mekanism.proxy.isPaused()) { - if((!initHoliday || MekanismClient.ticksPassed % 1200 == 0) && mc.thePlayer != null) + if((!initHoliday || MekanismClient.ticksPassed % 1200 == 0) && mc.player != null) { HolidayManager.check(); initHoliday = true; } - for(EntityPlayer entityPlayer : mc.theWorld.playerEntities) + for(EntityPlayer entityPlayer : mc.world.playerEntities) { if(entityPlayer instanceof AbstractClientPlayer) { AbstractClientPlayer player = (AbstractClientPlayer)entityPlayer; - if(StringUtils.stripControlCodes(player.getName()).equals("mikeacttck")) + if(StringUtils.stripControlCodes(player.getName()).equals("mikeacttck")) + { + CapeBufferDownload download = mikeDownload.get(player.getName()); + + if(download == null) { - CapeBufferDownload download = mikeDownload.get(player.getName()); + download = new CapeBufferDownload(player.getName(), MIKE_CAPE); + mikeDownload.put(player.getName(), download); - if(download == null) - { - download = new CapeBufferDownload(player.getName(), MIKE_CAPE); - mikeDownload.put(player.getName(), download); - - download.start(); - } - else { - if(!download.downloaded) - { - continue; - } - - setCape(player, download.getResourceLocation()); - } + download.start(); } - else if(StringUtils.stripControlCodes(player.getName()).equals("aidancbrady")) + else { + if(!download.downloaded) + { + continue; + } + + setCape(player, download.getResourceLocation()); + } + } + else if(StringUtils.stripControlCodes(player.getName()).equals("aidancbrady")) + { + CapeBufferDownload download = aidanDownload.get(player.getName()); + + if(download == null) { - CapeBufferDownload download = aidanDownload.get(player.getName()); + download = new CapeBufferDownload(player.getName(), AIDAN_CAPE); + aidanDownload.put(player.getName(), download); - if(download == null) - { - download = new CapeBufferDownload(player.getName(), AIDAN_CAPE); - aidanDownload.put(player.getName(), download); - - download.start(); - } - else { - if(!download.downloaded) - { - continue; - } - - setCape(player, download.getResourceLocation()); - } + download.start(); } - else if(Mekanism.donators.contains(StringUtils.stripControlCodes(player.getName()))) + else { + if(!download.downloaded) + { + continue; + } + + setCape(player, download.getResourceLocation()); + } + } + else if(Mekanism.donators.contains(StringUtils.stripControlCodes(player.getName()))) + { + CapeBufferDownload download = donateDownload.get(player.getName()); + + if(download == null) { - CapeBufferDownload download = donateDownload.get(player.getName()); + download = new CapeBufferDownload(player.getName(), DONATE_CAPE); + donateDownload.put(player.getName(), download); - if(download == null) - { - download = new CapeBufferDownload(player.getName(), DONATE_CAPE); - donateDownload.put(player.getName(), download); - - download.start(); - } - else { - if(!download.downloaded) - { - continue; - } - - setCape(player, download.getResourceLocation()); - } + download.start(); } + else { + if(!download.downloaded) + { + continue; + } + + setCape(player, download.getResourceLocation()); + } + } } } - ItemStack bootStack = mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.FEET); + ItemStack bootStack = mc.player.getItemStackFromSlot(EntityEquipmentSlot.FEET); - if(bootStack != null && bootStack.getItem() instanceof ItemFreeRunners) + if(!bootStack.isEmpty() && bootStack.getItem() instanceof ItemFreeRunners) { - mc.thePlayer.stepHeight = 1.002F; + mc.player.stepHeight = 1.002F; } else { - if(mc.thePlayer.stepHeight == 1.002F) + if(mc.player.stepHeight == 1.002F) { - mc.thePlayer.stepHeight = 0.5F; + mc.player.stepHeight = 0.5F; } } - if(Mekanism.flamethrowerActive.contains(mc.thePlayer.getName()) != isFlamethrowerOn(mc.thePlayer)) + if(Mekanism.flamethrowerActive.contains(mc.player.getName()) != isFlamethrowerOn(mc.player)) { - if(isFlamethrowerOn(mc.thePlayer)) + if(isFlamethrowerOn(mc.player)) { - Mekanism.flamethrowerActive.add(mc.thePlayer.getName()); + Mekanism.flamethrowerActive.add(mc.player.getName()); } else { - Mekanism.flamethrowerActive.remove(mc.thePlayer.getName()); + Mekanism.flamethrowerActive.remove(mc.player.getName()); } - Mekanism.packetHandler.sendToServer(new FlamethrowerDataMessage(PacketFlamethrowerData.FlamethrowerPacket.UPDATE, null, mc.thePlayer.getName(), isFlamethrowerOn(mc.thePlayer))); + Mekanism.packetHandler.sendToServer(new FlamethrowerDataMessage(PacketFlamethrowerData.FlamethrowerPacket.UPDATE, null, mc.player.getName(), isFlamethrowerOn(mc.player))); } - if(Mekanism.jetpackOn.contains(mc.thePlayer.getName()) != isJetpackOn(mc.thePlayer)) + if(Mekanism.jetpackOn.contains(mc.player.getName()) != isJetpackOn(mc.player)) { - if(isJetpackOn(mc.thePlayer)) + if(isJetpackOn(mc.player)) { - Mekanism.jetpackOn.add(mc.thePlayer.getName()); + Mekanism.jetpackOn.add(mc.player.getName()); } else { - Mekanism.jetpackOn.remove(mc.thePlayer.getName()); + Mekanism.jetpackOn.remove(mc.player.getName()); } - Mekanism.packetHandler.sendToServer(new JetpackDataMessage(JetpackPacket.UPDATE, mc.thePlayer.getName(), isJetpackOn(mc.thePlayer))); + Mekanism.packetHandler.sendToServer(new JetpackDataMessage(JetpackPacket.UPDATE, mc.player.getName(), isJetpackOn(mc.player))); } - if(Mekanism.gasmaskOn.contains(mc.thePlayer.getName()) != isGasMaskOn(mc.thePlayer)) + if(Mekanism.gasmaskOn.contains(mc.player.getName()) != isGasMaskOn(mc.player)) { - if(isGasMaskOn(mc.thePlayer) && mc.currentScreen == null) + if(isGasMaskOn(mc.player) && mc.currentScreen == null) { - Mekanism.gasmaskOn.add(mc.thePlayer.getName()); + Mekanism.gasmaskOn.add(mc.player.getName()); } else { - Mekanism.gasmaskOn.remove(mc.thePlayer.getName()); + Mekanism.gasmaskOn.remove(mc.player.getName()); } - Mekanism.packetHandler.sendToServer(new ScubaTankDataMessage(ScubaTankPacket.UPDATE, mc.thePlayer.getName(), isGasMaskOn(mc.thePlayer))); + Mekanism.packetHandler.sendToServer(new ScubaTankDataMessage(ScubaTankPacket.UPDATE, mc.player.getName(), isGasMaskOn(mc.player))); } if(client.enablePlayerSounds) { for(String username : Mekanism.jetpackOn) { - EntityPlayer player = mc.theWorld.getPlayerEntityByName(username); + EntityPlayer player = mc.world.getPlayerEntityByName(username); if(player != null) { @@ -274,7 +291,7 @@ public class ClientTickHandler for(String username : Mekanism.gasmaskOn) { - EntityPlayer player = mc.theWorld.getPlayerEntityByName(username); + EntityPlayer player = mc.world.getPlayerEntityByName(username); if(player != null) { @@ -287,7 +304,7 @@ public class ClientTickHandler } } - for(EntityPlayer player : (List)mc.theWorld.playerEntities) + for(EntityPlayer player : (List)mc.world.playerEntities) { if(hasFlamethrower(player)) { @@ -300,93 +317,113 @@ public class ClientTickHandler } } } - - ItemStack chestStack = mc.thePlayer.getItemStackFromSlot(EntityEquipmentSlot.CHEST); - if(chestStack != null && chestStack.getItem() instanceof ItemJetpack) + for(Iterator> iter = portableTeleports.entrySet().iterator(); iter.hasNext();) + { + Entry entry = iter.next(); + + for(int i = 0; i < 100; i++) + { + double x = entry.getKey().posX + rand.nextDouble()-0.5D; + double y = entry.getKey().posY + rand.nextDouble()*2-2D; + double z = entry.getKey().posZ + rand.nextDouble()-0.5D; + + mc.world.spawnParticle(EnumParticleTypes.PORTAL, x, y, z, 0, 1, 0); + } + + if(mc.world.getWorldTime() == entry.getValue().teleportTime) + { + Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.TELEPORT, entry.getValue().hand, entry.getValue().freq)); + iter.remove(); + } + } + + ItemStack chestStack = mc.player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); + + if(!chestStack.isEmpty() && chestStack.getItem() instanceof ItemJetpack) { MekanismClient.updateKey(mc.gameSettings.keyBindJump, KeySync.ASCEND); MekanismClient.updateKey(mc.gameSettings.keyBindSneak, KeySync.DESCEND); } - if(isFlamethrowerOn(mc.thePlayer)) + if(isFlamethrowerOn(mc.player)) { - ItemFlamethrower flamethrower = (ItemFlamethrower)mc.thePlayer.inventory.getCurrentItem().getItem(); + ItemFlamethrower flamethrower = (ItemFlamethrower)mc.player.inventory.getCurrentItem().getItem(); - if(!mc.thePlayer.capabilities.isCreativeMode) + if(!mc.player.capabilities.isCreativeMode) { - flamethrower.useGas(mc.thePlayer.inventory.getCurrentItem()); + flamethrower.useGas(mc.player.inventory.getCurrentItem()); } } - if(isJetpackOn(mc.thePlayer)) + if(isJetpackOn(mc.player)) { ItemJetpack jetpack = (ItemJetpack)chestStack.getItem(); if(jetpack.getMode(chestStack) == JetpackMode.NORMAL) { - mc.thePlayer.motionY = Math.min(mc.thePlayer.motionY + 0.15D, 0.5D); - mc.thePlayer.fallDistance = 0.0F; + mc.player.motionY = Math.min(mc.player.motionY + 0.15D, 0.5D); + mc.player.fallDistance = 0.0F; } else if(jetpack.getMode(chestStack) == JetpackMode.HOVER) { if((!mc.gameSettings.keyBindJump.isKeyDown() && !mc.gameSettings.keyBindSneak.isKeyDown()) || (mc.gameSettings.keyBindJump.isKeyDown() && mc.gameSettings.keyBindSneak.isKeyDown()) || mc.currentScreen != null) { - if(mc.thePlayer.motionY > 0) + if(mc.player.motionY > 0) { - mc.thePlayer.motionY = Math.max(mc.thePlayer.motionY - 0.15D, 0); + mc.player.motionY = Math.max(mc.player.motionY - 0.15D, 0); } - else if(mc.thePlayer.motionY < 0) + else if(mc.player.motionY < 0) { - if(!CommonPlayerTickHandler.isOnGround(mc.thePlayer)) + if(!CommonPlayerTickHandler.isOnGround(mc.player)) { - mc.thePlayer.motionY = Math.min(mc.thePlayer.motionY + 0.15D, 0); + mc.player.motionY = Math.min(mc.player.motionY + 0.15D, 0); } } } else { if(mc.gameSettings.keyBindJump.isKeyDown() && mc.currentScreen == null) { - mc.thePlayer.motionY = Math.min(mc.thePlayer.motionY + 0.15D, 0.2D); + mc.player.motionY = Math.min(mc.player.motionY + 0.15D, 0.2D); } else if(mc.gameSettings.keyBindSneak.isKeyDown() && mc.currentScreen == null) { - if(!CommonPlayerTickHandler.isOnGround(mc.thePlayer)) + if(!CommonPlayerTickHandler.isOnGround(mc.player)) { - mc.thePlayer.motionY = Math.max(mc.thePlayer.motionY - 0.15D, -0.2D); + mc.player.motionY = Math.max(mc.player.motionY - 0.15D, -0.2D); } } } - mc.thePlayer.fallDistance = 0.0F; + mc.player.fallDistance = 0.0F; } jetpack.useGas(chestStack); } - if(isGasMaskOn(mc.thePlayer)) + if(isGasMaskOn(mc.player)) { ItemScubaTank tank = (ItemScubaTank)chestStack.getItem(); final int max = 300; tank.useGas(chestStack); - GasStack received = tank.useGas(chestStack, max-mc.thePlayer.getAir()); + GasStack received = tank.useGas(chestStack, max-mc.player.getAir()); if(received != null) { - mc.thePlayer.setAir(mc.thePlayer.getAir()+received.amount); + mc.player.setAir(mc.player.getAir()+received.amount); } - if(mc.thePlayer.getAir() == max) + if(mc.player.getAir() == max) { - for(Object obj : mc.thePlayer.getActivePotionEffects()) + for(Object obj : mc.player.getActivePotionEffects()) { if(obj instanceof PotionEffect) { for(int i = 0; i < 9; i++) { - ((PotionEffect)obj).onUpdate(mc.thePlayer); + ((PotionEffect)obj).onUpdate(mc.player); } } } @@ -395,6 +432,40 @@ public class ClientTickHandler } } + @SubscribeEvent + public void onMouseEvent(MouseEvent event) + { + if(client.allowConfiguratorModeScroll && mc.player != null && mc.player.isSneaking()) + { + ItemStack stack = mc.player.getHeldItemMainhand(); + int delta = event.getDwheel(); + + if(stack.getItem() instanceof ItemConfigurator && delta != 0) + { + ItemConfigurator configurator = (ItemConfigurator)stack.getItem(); + RenderTickHandler.modeSwitchTimer = 100; + + wheelStatus += event.getDwheel(); + int scaledDelta = wheelStatus/120; + wheelStatus = wheelStatus % 120; + int newVal = configurator.getState(stack).ordinal() + (scaledDelta % ConfiguratorMode.values().length); + + if(newVal > 0) + { + newVal = newVal % ConfiguratorMode.values().length; + } + else if(newVal < 0) + { + newVal = ConfiguratorMode.values().length + newVal; + } + + configurator.setState(stack, ConfiguratorMode.values()[newVal]); + Mekanism.packetHandler.sendToServer(new ConfiguratorStateMessage(EnumHand.MAIN_HAND, configurator.getState(stack))); + event.setCanceled(true); + } + } + } + public static void setCape(AbstractClientPlayer player, ResourceLocation cape) { try { @@ -423,14 +494,14 @@ public class ClientTickHandler public static boolean isJetpackOn(EntityPlayer player) { - if(player != mc.thePlayer) + if(player != mc.player) { return Mekanism.jetpackOn.contains(player.getName()); } - ItemStack stack = player.inventory.armorInventory[2]; + ItemStack stack = player.inventory.armorInventory.get(2); - if(stack != null && !player.capabilities.isCreativeMode) + if(!stack.isEmpty() && !player.capabilities.isCreativeMode) { if(stack.getItem() instanceof ItemJetpack) { @@ -446,11 +517,11 @@ public class ClientTickHandler { if((!mc.gameSettings.keyBindJump.isKeyDown() && !mc.gameSettings.keyBindSneak.isKeyDown()) || (mc.gameSettings.keyBindJump.isKeyDown() && mc.gameSettings.keyBindSneak.isKeyDown()) || mc.currentScreen != null) { - return !player.onGround; + return !CommonPlayerTickHandler.isOnGround(player); } else if(mc.gameSettings.keyBindSneak.isKeyDown() && mc.currentScreen == null) { - return !player.onGround; + return !CommonPlayerTickHandler.isOnGround(player); } return true; @@ -464,15 +535,15 @@ public class ClientTickHandler public static boolean isGasMaskOn(EntityPlayer player) { - if(player != mc.thePlayer) + if(player != mc.player) { return Mekanism.gasmaskOn.contains(player.getName()); } - ItemStack tank = player.inventory.armorInventory[2]; - ItemStack mask = player.inventory.armorInventory[3]; + ItemStack tank = player.inventory.armorInventory.get(2); + ItemStack mask = player.inventory.armorInventory.get(3); - if(tank != null && mask != null) + if(!tank.isEmpty() && !mask.isEmpty()) { if(tank.getItem() instanceof ItemScubaTank && mask.getItem() instanceof ItemGasMask) { @@ -493,7 +564,7 @@ public class ClientTickHandler public static boolean isFlamethrowerOn(EntityPlayer player) { - if(player != mc.thePlayer) + if(player != mc.player) { return Mekanism.flamethrowerActive.contains(player.getName()); } @@ -511,7 +582,7 @@ public class ClientTickHandler public static boolean hasFlamethrower(EntityPlayer player) { - if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().getItem() instanceof ItemFlamethrower) + if(!player.inventory.getCurrentItem().isEmpty() && player.inventory.getCurrentItem().getItem() instanceof ItemFlamethrower) { ItemFlamethrower flamethrower = (ItemFlamethrower)player.inventory.getCurrentItem().getItem(); @@ -523,4 +594,29 @@ public class ClientTickHandler return false; } + + public static void portableTeleport(EntityPlayer player, EnumHand hand, Frequency freq) + { + if(general.portableTeleporterDelay == 0) + { + Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.TELEPORT, hand, freq)); + } + else { + portableTeleports.put(player, new TeleportData(hand, freq, mc.world.getWorldTime()+general.portableTeleporterDelay)); + } + } + + private static class TeleportData + { + private EnumHand hand; + private Frequency freq; + private long teleportTime; + + public TeleportData(EnumHand h, Frequency f, long t) + { + hand = h; + freq = f; + teleportTime = t; + } + } } diff --git a/src/main/java/mekanism/client/HolidayManager.java b/src/main/java/mekanism/client/HolidayManager.java index bb36b594f..ce81a4c09 100644 --- a/src/main/java/mekanism/client/HolidayManager.java +++ b/src/main/java/mekanism/client/HolidayManager.java @@ -5,8 +5,8 @@ import java.util.Calendar; import java.util.List; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.client; import mekanism.common.Mekanism; +import mekanism.common.config.MekanismConfig.client; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; @@ -42,7 +42,7 @@ public final class HolidayManager { if(holiday.getDate().equals(date)) { - holiday.onEvent(mc.thePlayer); + holiday.onEvent(mc.player); holidaysNotified.add(holiday); } } @@ -103,13 +103,13 @@ public final class HolidayManager public void onEvent(EntityPlayer player) { String themedLines = getThemedLines(new EnumColor[] {EnumColor.DARK_GREEN, EnumColor.DARK_RED}, 13); - player.addChatMessage(new TextComponentString(themedLines + EnumColor.DARK_BLUE + "[Mekanism]" + themedLines)); - player.addChatMessage(new TextComponentString(EnumColor.RED + "Merry Christmas, " + EnumColor.DARK_BLUE + player.getName() + EnumColor.RED + "!")); - player.addChatMessage(new TextComponentString(EnumColor.RED + "May you have plenty of Christmas cheer")); - player.addChatMessage(new TextComponentString(EnumColor.RED + "and have a relaxing holiday with your")); - player.addChatMessage(new TextComponentString(EnumColor.RED + "family :)")); - player.addChatMessage(new TextComponentString(EnumColor.DARK_GREY + "-aidancbrady")); - player.addChatMessage(new TextComponentString(themedLines + EnumColor.DARK_BLUE + "[=======]" + themedLines)); + player.sendMessage(new TextComponentString(themedLines + EnumColor.DARK_BLUE + "[Mekanism]" + themedLines)); + player.sendMessage(new TextComponentString(EnumColor.RED + "Merry Christmas, " + EnumColor.DARK_BLUE + player.getName() + EnumColor.RED + "!")); + player.sendMessage(new TextComponentString(EnumColor.RED + "May you have plenty of Christmas cheer")); + player.sendMessage(new TextComponentString(EnumColor.RED + "and have a relaxing holiday with your")); + player.sendMessage(new TextComponentString(EnumColor.RED + "family :)")); + player.sendMessage(new TextComponentString(EnumColor.DARK_GREY + "-aidancbrady")); + player.sendMessage(new TextComponentString(themedLines + EnumColor.DARK_BLUE + "[=======]" + themedLines)); } @Override @@ -152,12 +152,12 @@ public final class HolidayManager public void onEvent(EntityPlayer player) { String themedLines = getThemedLines(new EnumColor[] {EnumColor.WHITE, EnumColor.YELLOW}, 13); - player.addChatMessage(new TextComponentString(themedLines + EnumColor.DARK_BLUE + "[Mekanism]" + themedLines)); - player.addChatMessage(new TextComponentString(EnumColor.AQUA + "Happy New Year, " + EnumColor.DARK_BLUE + player.getName() + EnumColor.RED + "!")); - player.addChatMessage(new TextComponentString(EnumColor.AQUA + "Best wishes to you as we enter this")); - player.addChatMessage(new TextComponentString(EnumColor.AQUA + "new and exciting year of " + calendar.get(Calendar.YEAR) + "! :)")); - player.addChatMessage(new TextComponentString(EnumColor.DARK_GREY + "-aidancbrady")); - player.addChatMessage(new TextComponentString(themedLines + EnumColor.DARK_BLUE + "[=======]" + themedLines)); + player.sendMessage(new TextComponentString(themedLines + EnumColor.DARK_BLUE + "[Mekanism]" + themedLines)); + player.sendMessage(new TextComponentString(EnumColor.AQUA + "Happy New Year, " + EnumColor.DARK_BLUE + player.getName() + EnumColor.RED + "!")); + player.sendMessage(new TextComponentString(EnumColor.AQUA + "Best wishes to you as we enter this")); + player.sendMessage(new TextComponentString(EnumColor.AQUA + "new and exciting year of " + calendar.get(Calendar.YEAR) + "! :)")); + player.sendMessage(new TextComponentString(EnumColor.DARK_GREY + "-aidancbrady")); + player.sendMessage(new TextComponentString(themedLines + EnumColor.DARK_BLUE + "[=======]" + themedLines)); } } diff --git a/src/main/java/mekanism/client/MekanismClient.java b/src/main/java/mekanism/client/MekanismClient.java index 2ed8f26db..b61f107e2 100644 --- a/src/main/java/mekanism/client/MekanismClient.java +++ b/src/main/java/mekanism/client/MekanismClient.java @@ -2,15 +2,16 @@ package mekanism.client; import java.util.HashMap; import java.util.Map; +import java.util.UUID; import mekanism.api.MekanismAPI; import mekanism.api.MekanismAPI.BoxBlacklistEvent; -import mekanism.api.MekanismConfig.general; import mekanism.client.render.obj.TransmitterModel; import mekanism.client.sound.SoundHandler; import mekanism.client.voice.VoiceClient; import mekanism.common.Mekanism; import mekanism.common.base.IModule; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.content.boiler.SynchronizedBoilerData; import mekanism.common.network.PacketKey.KeyMessage; import mekanism.common.security.SecurityData; @@ -20,7 +21,8 @@ import net.minecraftforge.common.MinecraftForge; public class MekanismClient extends Mekanism { - public static Map clientSecurityMap = new HashMap(); + public static Map clientSecurityMap = new HashMap(); + public static Map clientUUIDMap = new HashMap(); public static VoiceClient voiceClient; @@ -30,16 +32,17 @@ public class MekanismClient extends Mekanism { boolean down = Minecraft.getMinecraft().currentScreen == null && key.isPressed(); - if(down != keyMap.has(Minecraft.getMinecraft().thePlayer, type)) + if(down != keyMap.has(Minecraft.getMinecraft().player, type)) { Mekanism.packetHandler.sendToServer(new KeyMessage(type, down)); - keyMap.update(Minecraft.getMinecraft().thePlayer, type, down); + keyMap.update(Minecraft.getMinecraft().player, type, down); } } public static void reset() { clientSecurityMap.clear(); + clientUUIDMap.clear(); if(general.voiceServerEnabled) { @@ -51,6 +54,7 @@ public class MekanismClient extends Mekanism } ClientTickHandler.tickingSet.clear(); + ClientTickHandler.portableTeleports.clear(); TransmitterModel.clearCache(); diff --git a/src/main/java/mekanism/client/MekanismKeyHandler.java b/src/main/java/mekanism/client/MekanismKeyHandler.java index 6527c1e13..7cdca1bf9 100644 --- a/src/main/java/mekanism/client/MekanismKeyHandler.java +++ b/src/main/java/mekanism/client/MekanismKeyHandler.java @@ -1,7 +1,6 @@ package mekanism.client; import mekanism.api.EnumColor; -import mekanism.api.util.StackUtils; import mekanism.client.sound.SoundHandler; import mekanism.common.Mekanism; import mekanism.common.MekanismSounds; @@ -25,6 +24,7 @@ import mekanism.common.network.PacketScubaTankData.ScubaTankDataMessage; import mekanism.common.network.PacketScubaTankData.ScubaTankPacket; import mekanism.common.network.PacketWalkieTalkieState.WalkieTalkieStateMessage; import mekanism.common.util.LangUtils; +import mekanism.common.util.StackUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; @@ -75,7 +75,7 @@ public class MekanismKeyHandler extends MekKeyHandler { if(kb == modeSwitchKey) { - EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer; + EntityPlayer player = FMLClientHandler.instance().getClient().player; ItemStack toolStack = player.inventory.getCurrentItem(); Item item = StackUtils.getItem(toolStack); @@ -87,7 +87,7 @@ public class MekanismKeyHandler extends MekKeyHandler int toSet = configurator.getState(toolStack).ordinal() < ConfiguratorMode.values().length-1 ? configurator.getState(toolStack).ordinal() + 1 : 0; configurator.setState(toolStack, ConfiguratorMode.values()[toSet]); Mekanism.packetHandler.sendToServer(new ConfiguratorStateMessage(EnumHand.MAIN_HAND, configurator.getState(toolStack))); - player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.configureState") + ": " + configurator.getColor(configurator.getState(toolStack)) + configurator.getStateDisplay(configurator.getState(toolStack)))); + player.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.configureState") + ": " + configurator.getColor(configurator.getState(toolStack)) + configurator.getStateDisplay(configurator.getState(toolStack)))); } else if(player.isSneaking() && item instanceof ItemElectricBow) { @@ -95,7 +95,7 @@ public class MekanismKeyHandler extends MekKeyHandler bow.setFireState(toolStack, !bow.getFireState(toolStack)); Mekanism.packetHandler.sendToServer(new ElectricBowStateMessage(EnumHand.MAIN_HAND, bow.getFireState(toolStack))); - player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.fireMode") + ": " + (bow.getFireState(toolStack) ? EnumColor.DARK_GREEN : EnumColor.DARK_RED) + LangUtils.transOnOff(bow.getFireState(toolStack)))); + player.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.fireMode") + ": " + (bow.getFireState(toolStack) ? EnumColor.DARK_GREEN : EnumColor.DARK_RED) + LangUtils.transOnOff(bow.getFireState(toolStack)))); } else if(player.isSneaking() && item instanceof ItemBlockMachine) { @@ -105,7 +105,7 @@ public class MekanismKeyHandler extends MekKeyHandler { machine.setBucketMode(toolStack, !machine.getBucketMode(toolStack)); Mekanism.packetHandler.sendToServer(new PortableTankStateMessage(EnumHand.MAIN_HAND, machine.getBucketMode(toolStack))); - player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.portableTank.bucketMode") + ": " + (machine.getBucketMode(toolStack) ? EnumColor.DARK_GREEN : EnumColor.DARK_RED) + LangUtils.transOnOff(machine.getBucketMode(toolStack)))); + player.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.portableTank.bucketMode") + ": " + (machine.getBucketMode(toolStack) ? EnumColor.DARK_GREEN : EnumColor.DARK_RED) + LangUtils.transOnOff(machine.getBucketMode(toolStack)))); } } else if(player.isSneaking() && item instanceof ItemWalkieTalkie) @@ -126,12 +126,12 @@ public class MekanismKeyHandler extends MekKeyHandler flamethrower.incrementMode(toolStack); Mekanism.packetHandler.sendToServer(new PacketFlamethrowerData.FlamethrowerDataMessage(PacketFlamethrowerData.FlamethrowerPacket.MODE, EnumHand.MAIN_HAND, null, false)); - player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.flamethrower.modeBump") + ": " + flamethrower.getMode(toolStack).getName())); + player.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.flamethrower.modeBump") + ": " + flamethrower.getMode(toolStack).getName())); } } else if(kb == armorModeSwitchKey) { - EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer; + EntityPlayer player = FMLClientHandler.instance().getClient().player; ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); Item chestItem = StackUtils.getItem(chestStack); diff --git a/src/main/java/mekanism/client/SparkleAnimation.java b/src/main/java/mekanism/client/SparkleAnimation.java index 7a30d8930..5466e3c3a 100644 --- a/src/main/java/mekanism/client/SparkleAnimation.java +++ b/src/main/java/mekanism/client/SparkleAnimation.java @@ -5,8 +5,8 @@ import java.util.Random; import java.util.Set; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; import mekanism.common.MekanismSounds; +import mekanism.common.config.MekanismConfig.general; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; diff --git a/src/main/java/mekanism/client/gui/ConfigGuiFactory.java b/src/main/java/mekanism/client/gui/ConfigGuiFactory.java index 947e81730..27afb793e 100644 --- a/src/main/java/mekanism/client/gui/ConfigGuiFactory.java +++ b/src/main/java/mekanism/client/gui/ConfigGuiFactory.java @@ -31,4 +31,16 @@ public class ConfigGuiFactory implements IModGuiFactory { return null; } + + @Override + public boolean hasConfigGui() + { + return true; + } + + @Override + public GuiScreen createConfigGui(GuiScreen parentScreen) + { + return new GuiMekanismConfig(parentScreen); + } } diff --git a/src/main/java/mekanism/client/gui/GuiAdvancedElectricMachine.java b/src/main/java/mekanism/client/gui/GuiAdvancedElectricMachine.java index ae8632dd3..ac3ccef8f 100644 --- a/src/main/java/mekanism/client/gui/GuiAdvancedElectricMachine.java +++ b/src/main/java/mekanism/client/gui/GuiAdvancedElectricMachine.java @@ -3,7 +3,6 @@ package mekanism.client.gui; import java.util.List; import mekanism.api.gas.GasStack; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiPowerBar; @@ -20,8 +19,9 @@ import mekanism.client.gui.element.GuiTransporterConfigTab; import mekanism.client.gui.element.GuiUpgradeTab; import mekanism.client.render.MekanismRenderer; import mekanism.common.inventory.container.ContainerAdvancedElectricMachine; -import mekanism.common.tile.TileEntityAdvancedElectricMachine; +import mekanism.common.tile.prefab.TileEntityAdvancedElectricMachine; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/mekanism/client/gui/GuiBoilerStats.java b/src/main/java/mekanism/client/gui/GuiBoilerStats.java index 063bdb916..215b41256 100644 --- a/src/main/java/mekanism/client/gui/GuiBoilerStats.java +++ b/src/main/java/mekanism/client/gui/GuiBoilerStats.java @@ -2,22 +2,22 @@ package mekanism.client.gui; import java.util.List; -import mekanism.api.MekanismConfig.general; -import mekanism.api.util.ListUtils; -import mekanism.api.util.UnitDisplayUtils; -import mekanism.api.util.UnitDisplayUtils.TemperatureUnit; import mekanism.client.gui.element.GuiBoilerTab; import mekanism.client.gui.element.GuiBoilerTab.BoilerTab; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiGraph; import mekanism.client.gui.element.GuiGraph.GraphDataHandler; import mekanism.client.gui.element.GuiHeatInfo; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.content.boiler.SynchronizedBoilerData; import mekanism.common.inventory.container.ContainerNull; import mekanism.common.tile.TileEntityBoilerCasing; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.UnitDisplayUtils; import mekanism.common.util.MekanismUtils.ResourceType; +import mekanism.common.util.UnitDisplayUtils.TemperatureUnit; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/mekanism/client/gui/GuiChanceMachine.java b/src/main/java/mekanism/client/gui/GuiChanceMachine.java index c334cb19f..282f69e26 100644 --- a/src/main/java/mekanism/client/gui/GuiChanceMachine.java +++ b/src/main/java/mekanism/client/gui/GuiChanceMachine.java @@ -2,7 +2,6 @@ package mekanism.client.gui; import java.util.List; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiPowerBar; @@ -20,6 +19,7 @@ import mekanism.client.gui.element.GuiUpgradeTab; import mekanism.common.inventory.container.ContainerChanceMachine; import mekanism.common.tile.TileEntityChanceMachine; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/mekanism/client/gui/GuiChemicalCrystallizer.java b/src/main/java/mekanism/client/gui/GuiChemicalCrystallizer.java index 969042a12..435ccb02c 100644 --- a/src/main/java/mekanism/client/gui/GuiChemicalCrystallizer.java +++ b/src/main/java/mekanism/client/gui/GuiChemicalCrystallizer.java @@ -6,7 +6,6 @@ import java.util.List; import mekanism.api.gas.Gas; import mekanism.api.gas.GasTank; import mekanism.api.gas.OreGas; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiGasGauge; @@ -28,6 +27,7 @@ import mekanism.common.inventory.container.ContainerChemicalCrystallizer; import mekanism.common.recipe.machines.CrystallizerRecipe; import mekanism.common.tile.TileEntityChemicalCrystallizer; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.client.renderer.GlStateManager; @@ -71,7 +71,7 @@ public class GuiChemicalCrystallizer extends GuiMekanism @Override public List getInfo() { - String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyUsage); + String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick); return ListUtils.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t", LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy())); } }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png"))); diff --git a/src/main/java/mekanism/client/gui/GuiChemicalDissolutionChamber.java b/src/main/java/mekanism/client/gui/GuiChemicalDissolutionChamber.java index a299c0241..e432a9907 100644 --- a/src/main/java/mekanism/client/gui/GuiChemicalDissolutionChamber.java +++ b/src/main/java/mekanism/client/gui/GuiChemicalDissolutionChamber.java @@ -3,7 +3,6 @@ package mekanism.client.gui; import java.util.List; import mekanism.api.gas.GasTank; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiGasGauge; @@ -21,6 +20,7 @@ import mekanism.client.gui.element.GuiUpgradeTab; import mekanism.common.inventory.container.ContainerChemicalDissolutionChamber; import mekanism.common.tile.TileEntityChemicalDissolutionChamber; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.entity.player.InventoryPlayer; @@ -46,7 +46,7 @@ public class GuiChemicalDissolutionChamber extends GuiMekanism @Override public List getInfo() { - String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyUsage); + String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick); return ListUtils.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t", LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy())); } }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalDissolutionChamber.png"))); diff --git a/src/main/java/mekanism/client/gui/GuiChemicalInfuser.java b/src/main/java/mekanism/client/gui/GuiChemicalInfuser.java index 2208988b3..d235ac86d 100644 --- a/src/main/java/mekanism/client/gui/GuiChemicalInfuser.java +++ b/src/main/java/mekanism/client/gui/GuiChemicalInfuser.java @@ -3,7 +3,6 @@ package mekanism.client.gui; import java.util.List; import mekanism.api.gas.GasTank; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiGasGauge; @@ -21,6 +20,7 @@ import mekanism.client.gui.element.GuiUpgradeTab; import mekanism.common.inventory.container.ContainerChemicalInfuser; import mekanism.common.tile.TileEntityChemicalInfuser; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.entity.player.InventoryPlayer; diff --git a/src/main/java/mekanism/client/gui/GuiChemicalInjectionChamber.java b/src/main/java/mekanism/client/gui/GuiChemicalInjectionChamber.java index c94fc277a..ab12e5cd6 100644 --- a/src/main/java/mekanism/client/gui/GuiChemicalInjectionChamber.java +++ b/src/main/java/mekanism/client/gui/GuiChemicalInjectionChamber.java @@ -1,7 +1,7 @@ package mekanism.client.gui; import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.common.tile.TileEntityAdvancedElectricMachine; +import mekanism.common.tile.prefab.TileEntityAdvancedElectricMachine; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/mekanism/client/gui/GuiChemicalOxidizer.java b/src/main/java/mekanism/client/gui/GuiChemicalOxidizer.java index 9cc16820d..eb2b69d9c 100644 --- a/src/main/java/mekanism/client/gui/GuiChemicalOxidizer.java +++ b/src/main/java/mekanism/client/gui/GuiChemicalOxidizer.java @@ -3,7 +3,6 @@ package mekanism.client.gui; import java.util.List; import mekanism.api.gas.GasTank; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiGasGauge; @@ -21,6 +20,7 @@ import mekanism.client.gui.element.GuiUpgradeTab; import mekanism.common.inventory.container.ContainerChemicalOxidizer; import mekanism.common.tile.TileEntityChemicalOxidizer; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.entity.player.InventoryPlayer; @@ -46,7 +46,7 @@ public class GuiChemicalOxidizer extends GuiMekanism @Override public List getInfo() { - String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyUsage); + String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick); return ListUtils.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t", LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy())); } }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"))); diff --git a/src/main/java/mekanism/client/gui/GuiChemicalWasher.java b/src/main/java/mekanism/client/gui/GuiChemicalWasher.java index becd2a6a8..950fae1f5 100644 --- a/src/main/java/mekanism/client/gui/GuiChemicalWasher.java +++ b/src/main/java/mekanism/client/gui/GuiChemicalWasher.java @@ -3,7 +3,6 @@ package mekanism.client.gui; import java.util.List; import mekanism.api.gas.GasTank; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiBucketIO; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; @@ -25,6 +24,7 @@ import mekanism.client.gui.element.GuiUpgradeTab; import mekanism.common.inventory.container.ContainerChemicalWasher; import mekanism.common.tile.TileEntityChemicalWasher; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.entity.player.InventoryPlayer; diff --git a/src/main/java/mekanism/client/gui/GuiCombiner.java b/src/main/java/mekanism/client/gui/GuiCombiner.java index 358e22677..8b7dfb9bb 100644 --- a/src/main/java/mekanism/client/gui/GuiCombiner.java +++ b/src/main/java/mekanism/client/gui/GuiCombiner.java @@ -1,7 +1,7 @@ package mekanism.client.gui; import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.common.tile.TileEntityAdvancedElectricMachine; +import mekanism.common.tile.prefab.TileEntityAdvancedElectricMachine; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/mekanism/client/gui/GuiCrusher.java b/src/main/java/mekanism/client/gui/GuiCrusher.java index e3557a5ad..368c8d42c 100644 --- a/src/main/java/mekanism/client/gui/GuiCrusher.java +++ b/src/main/java/mekanism/client/gui/GuiCrusher.java @@ -1,7 +1,7 @@ package mekanism.client.gui; import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.common.tile.TileEntityElectricMachine; +import mekanism.common.tile.prefab.TileEntityElectricMachine; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/mekanism/client/gui/GuiDictionary.java b/src/main/java/mekanism/client/gui/GuiDictionary.java index d7ced029f..9125e2960 100644 --- a/src/main/java/mekanism/client/gui/GuiDictionary.java +++ b/src/main/java/mekanism/client/gui/GuiDictionary.java @@ -23,7 +23,7 @@ import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class GuiDictionary extends GuiMekanism { - public ItemStack itemType; + public ItemStack itemType = ItemStack.EMPTY; public GuiScrollList scrollList; @@ -43,7 +43,7 @@ public class GuiDictionary extends GuiMekanism fontRendererObj.drawString(LangUtils.localize("item.Dictionary.name"), 64, 5, 0x404040); fontRendererObj.drawString(LangUtils.localize("container.inventory"), 8, ySize - 96 + 2, 0x404040); - if(itemType != null) + if(!itemType.isEmpty()) { GlStateManager.pushMatrix(); RenderHelper.enableGUIStandardItemLighting(); @@ -118,10 +118,10 @@ public class GuiDictionary extends GuiMekanism { ItemStack stack = hovering.getStack(); - if(stack != null) + if(!stack.isEmpty()) { itemType = stack.copy(); - itemType.stackSize = 1; + itemType.setCount(1); scrollList.setText(MekanismUtils.getOreDictName(itemType)); SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); @@ -133,18 +133,18 @@ public class GuiDictionary extends GuiMekanism if(xAxis >= 6 && xAxis <= 22 && yAxis >= 6 && yAxis <= 22) { - ItemStack stack = mc.thePlayer.inventory.getItemStack(); + ItemStack stack = mc.player.inventory.getItemStack(); - if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { itemType = stack.copy(); - itemType.stackSize = 1; + itemType.setCount(1); scrollList.setText(MekanismUtils.getOreDictName(itemType)); } - else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - itemType = null; + itemType = ItemStack.EMPTY; scrollList.setText(null); } diff --git a/src/main/java/mekanism/client/gui/GuiDigitalMiner.java b/src/main/java/mekanism/client/gui/GuiDigitalMiner.java index b7098f175..0b8f092b5 100644 --- a/src/main/java/mekanism/client/gui/GuiDigitalMiner.java +++ b/src/main/java/mekanism/client/gui/GuiDigitalMiner.java @@ -6,7 +6,6 @@ import java.util.List; import mekanism.api.Coord4D; import mekanism.api.EnumColor; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiPowerBar; @@ -27,6 +26,7 @@ import mekanism.common.network.PacketDigitalMinerGui.MinerGuiPacket; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.tile.TileEntityDigitalMiner; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.client.gui.GuiButton; @@ -183,7 +183,7 @@ public class GuiDigitalMiner extends GuiMekanism fontRendererObj.drawString(LangUtils.localize("gui.digitalMiner.toMine") + ":", 9, 59, 0x00CD00); fontRendererObj.drawString("" + tileEntity.clientToMine, 9, 68, 0x00CD00); - if(tileEntity.missingStack != null) + if(!tileEntity.missingStack.isEmpty()) { GlStateManager.pushMatrix(); GL11.glColor4f(1, 1, 1, 1); @@ -220,7 +220,7 @@ public class GuiDigitalMiner extends GuiMekanism if(xAxis >= 144 && xAxis <= 160 && yAxis >= 27 && yAxis <= 43) { - if(tileEntity.missingStack != null) + if(!tileEntity.missingStack.isEmpty()) { drawCreativeTabHoveringText(LangUtils.localize("gui.digitalMiner.missingBlock"), xAxis, yAxis); } diff --git a/src/main/java/mekanism/client/gui/GuiElectricMachine.java b/src/main/java/mekanism/client/gui/GuiElectricMachine.java index e62720f83..b351d4c53 100644 --- a/src/main/java/mekanism/client/gui/GuiElectricMachine.java +++ b/src/main/java/mekanism/client/gui/GuiElectricMachine.java @@ -2,7 +2,6 @@ package mekanism.client.gui; import java.util.List; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiPowerBar; @@ -18,8 +17,9 @@ import mekanism.client.gui.element.GuiSlot.SlotType; import mekanism.client.gui.element.GuiTransporterConfigTab; import mekanism.client.gui.element.GuiUpgradeTab; import mekanism.common.inventory.container.ContainerElectricMachine; -import mekanism.common.tile.TileEntityElectricMachine; +import mekanism.common.tile.prefab.TileEntityElectricMachine; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/mekanism/client/gui/GuiElectricPump.java b/src/main/java/mekanism/client/gui/GuiElectricPump.java index 21b328da0..64e3ef792 100644 --- a/src/main/java/mekanism/client/gui/GuiElectricPump.java +++ b/src/main/java/mekanism/client/gui/GuiElectricPump.java @@ -2,7 +2,6 @@ package mekanism.client.gui; import java.util.List; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiFluidGauge; @@ -18,6 +17,7 @@ import mekanism.client.gui.element.GuiUpgradeTab; import mekanism.common.inventory.container.ContainerElectricPump; import mekanism.common.tile.TileEntityElectricPump; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.entity.player.InventoryPlayer; diff --git a/src/main/java/mekanism/client/gui/GuiElectrolyticSeparator.java b/src/main/java/mekanism/client/gui/GuiElectrolyticSeparator.java index acab2f321..a7245f2c7 100755 --- a/src/main/java/mekanism/client/gui/GuiElectrolyticSeparator.java +++ b/src/main/java/mekanism/client/gui/GuiElectrolyticSeparator.java @@ -6,7 +6,6 @@ import java.util.List; import mekanism.api.Coord4D; import mekanism.api.gas.GasTank; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiFluidGauge; @@ -31,6 +30,7 @@ import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.tile.TileEntityElectrolyticSeparator; import mekanism.common.tile.TileEntityGasTank; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.entity.player.InventoryPlayer; diff --git a/src/main/java/mekanism/client/gui/GuiEnergizedSmelter.java b/src/main/java/mekanism/client/gui/GuiEnergizedSmelter.java index 1503e37af..a88b5cfd4 100644 --- a/src/main/java/mekanism/client/gui/GuiEnergizedSmelter.java +++ b/src/main/java/mekanism/client/gui/GuiEnergizedSmelter.java @@ -1,7 +1,7 @@ package mekanism.client.gui; import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.common.tile.TileEntityElectricMachine; +import mekanism.common.tile.prefab.TileEntityElectricMachine; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/mekanism/client/gui/GuiEnergyCube.java b/src/main/java/mekanism/client/gui/GuiEnergyCube.java index 3b7823e82..27ee6dd34 100644 --- a/src/main/java/mekanism/client/gui/GuiEnergyCube.java +++ b/src/main/java/mekanism/client/gui/GuiEnergyCube.java @@ -3,7 +3,6 @@ package mekanism.client.gui; import java.util.List; import mekanism.api.energy.IStrictEnergyStorage; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyGauge; import mekanism.client.gui.element.GuiEnergyGauge.IEnergyInfoHandler; @@ -18,6 +17,7 @@ import mekanism.client.gui.element.GuiTransporterConfigTab; import mekanism.common.inventory.container.ContainerEnergyCube; import mekanism.common.tile.TileEntityEnergyCube; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.entity.player.InventoryPlayer; diff --git a/src/main/java/mekanism/client/gui/GuiEnrichmentChamber.java b/src/main/java/mekanism/client/gui/GuiEnrichmentChamber.java index 0808c3f6f..ace10b6bc 100644 --- a/src/main/java/mekanism/client/gui/GuiEnrichmentChamber.java +++ b/src/main/java/mekanism/client/gui/GuiEnrichmentChamber.java @@ -1,7 +1,7 @@ package mekanism.client.gui; import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.common.tile.TileEntityElectricMachine; +import mekanism.common.tile.prefab.TileEntityElectricMachine; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/mekanism/client/gui/GuiFactory.java b/src/main/java/mekanism/client/gui/GuiFactory.java index 0c7ac8c49..f215b84ed 100644 --- a/src/main/java/mekanism/client/gui/GuiFactory.java +++ b/src/main/java/mekanism/client/gui/GuiFactory.java @@ -5,7 +5,6 @@ import java.util.ArrayList; import java.util.List; import mekanism.api.Coord4D; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiRecipeType; @@ -25,6 +24,7 @@ import mekanism.common.item.ItemGaugeDropper; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.tile.TileEntityFactory; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.player.InventoryPlayer; @@ -168,9 +168,9 @@ public class GuiFactory extends GuiMekanism if(xAxis > 8 && xAxis < 168 && yAxis > 78 && yAxis < 83) { - ItemStack stack = mc.thePlayer.inventory.getItemStack(); + ItemStack stack = mc.player.inventory.getItemStack(); - if(stack != null && stack.getItem() instanceof ItemGaugeDropper) + if(!stack.isEmpty() && stack.getItem() instanceof ItemGaugeDropper) { ArrayList data = new ArrayList(); data.add(1); diff --git a/src/main/java/mekanism/client/gui/GuiFluidicPlenisher.java b/src/main/java/mekanism/client/gui/GuiFluidicPlenisher.java index 22380fc34..86137ec1c 100644 --- a/src/main/java/mekanism/client/gui/GuiFluidicPlenisher.java +++ b/src/main/java/mekanism/client/gui/GuiFluidicPlenisher.java @@ -2,7 +2,6 @@ package mekanism.client.gui; import java.util.List; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiFluidGauge; @@ -18,6 +17,7 @@ import mekanism.client.gui.element.GuiUpgradeTab; import mekanism.common.inventory.container.ContainerFluidicPlenisher; import mekanism.common.tile.TileEntityFluidicPlenisher; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.entity.player.InventoryPlayer; diff --git a/src/main/java/mekanism/client/gui/GuiFormulaicAssemblicator.java b/src/main/java/mekanism/client/gui/GuiFormulaicAssemblicator.java index 8d88ce143..c1193f8aa 100644 --- a/src/main/java/mekanism/client/gui/GuiFormulaicAssemblicator.java +++ b/src/main/java/mekanism/client/gui/GuiFormulaicAssemblicator.java @@ -5,7 +5,6 @@ import java.util.ArrayList; import java.util.List; import mekanism.api.Coord4D; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiPowerBar; @@ -25,6 +24,7 @@ import mekanism.common.item.ItemCraftingFormula; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.tile.TileEntityFormulaicAssemblicator; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.client.renderer.GlStateManager; @@ -100,7 +100,12 @@ public class GuiFormulaicAssemblicator extends GuiMekanism if(xAxis >= 107 && xAxis <= 123 && yAxis >= 75 && yAxis <= 91) { - drawCreativeTabHoveringText(LangUtils.localize("gui.autoModeToggle") + " " + LangUtils.transOnOff(!tileEntity.autoMode), xAxis, yAxis); + drawCreativeTabHoveringText(LangUtils.localize("gui.autoModeToggle") + ": " + LangUtils.transOnOff(tileEntity.autoMode), xAxis, yAxis); + } + + if(xAxis >= 26 && xAxis <= 42 && yAxis >= 75 && yAxis <= 91) + { + drawCreativeTabHoveringText(LangUtils.localize("gui.stockControl") + ": " + LangUtils.transOnOff(tileEntity.stockControl), xAxis, yAxis); } super.drawGuiContainerForegroundLayer(mouseX, mouseY); @@ -179,9 +184,18 @@ public class GuiFormulaicAssemblicator extends GuiMekanism else { drawTexturedModalRect(guiWidth + 107, guiHeight + 75, 176 + 46, 16, 16, 16); } + + if(xAxis >= 26 && xAxis <= 42 && yAxis >= 75 && yAxis <= 91) + { + drawTexturedModalRect(guiWidth + 26, guiHeight + 75, 176 + 62, 48 + 0, 16, 16); + } + else { + drawTexturedModalRect(guiWidth + 26, guiHeight + 75, 176 + 62, 48 + 16, 16, 16); + } } else { drawTexturedModalRect(guiWidth + 107, guiHeight + 75, 176 + 46, 32, 16, 16); + drawTexturedModalRect(guiWidth + 26, guiHeight + 75, 176 + 62, 48 + 32, 16, 16); } if(tileEntity.operatingTicks > 0) @@ -197,20 +211,20 @@ public class GuiFormulaicAssemblicator extends GuiMekanism { for(int i = 0; i < 9; i++) { - ItemStack stack = tileEntity.formula.input[i]; + ItemStack stack = tileEntity.formula.input.get(i); - if(stack != null) + if(!stack.isEmpty()) { Slot slot = (Slot)inventorySlots.inventorySlots.get(i+20); GlStateManager.pushMatrix(); - if(slot.getStack() == null || !slot.getStack().isItemEqual(stack)) + if(slot.getStack().isEmpty() || !slot.getStack().isItemEqual(stack)) { - drawGradientRect(guiWidth + slot.xDisplayPosition, guiHeight + slot.yDisplayPosition, guiWidth + slot.xDisplayPosition + 16, guiHeight + slot.yDisplayPosition + 16, -2137456640, -2137456640); + drawGradientRect(guiWidth + slot.xPos, guiHeight + slot.yPos, guiWidth + slot.xPos + 16, guiHeight + slot.yPos + 16, -2137456640, -2137456640); } RenderHelper.enableGUIStandardItemLighting(); - itemRender.renderItemAndEffectIntoGUI(stack, guiWidth + slot.xDisplayPosition, guiHeight + slot.yDisplayPosition); + itemRender.renderItemAndEffectIntoGUI(stack, guiWidth + slot.xPos, guiHeight + slot.yPos); MekanismRenderer.resetColor(); GlStateManager.popMatrix(); } @@ -222,8 +236,8 @@ public class GuiFormulaicAssemblicator extends GuiMekanism private boolean canEncode() { - return tileEntity.formula == null && tileEntity.inventory[2] != null && tileEntity.inventory[2].getItem() instanceof ItemCraftingFormula && - ((ItemCraftingFormula)tileEntity.inventory[2].getItem()).getInventory(tileEntity.inventory[2]) == null; + return tileEntity.formula == null && !tileEntity.inventory.get(2).isEmpty() && tileEntity.inventory.get(2).getItem() instanceof ItemCraftingFormula && + ((ItemCraftingFormula)tileEntity.inventory.get(2).getItem()).getInventory(tileEntity.inventory.get(2)) == null; } @Override @@ -296,6 +310,16 @@ public class GuiFormulaicAssemblicator extends GuiMekanism Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data)); } + + if(xAxis >= 26 && xAxis <= 42 && yAxis >= 75 && yAxis <= 91) + { + SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); + + ArrayList data = new ArrayList(); + data.add(5); + + Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data)); + } } } } diff --git a/src/main/java/mekanism/client/gui/GuiFuelwoodHeater.java b/src/main/java/mekanism/client/gui/GuiFuelwoodHeater.java index e09dadca9..3d2f49bc7 100644 --- a/src/main/java/mekanism/client/gui/GuiFuelwoodHeater.java +++ b/src/main/java/mekanism/client/gui/GuiFuelwoodHeater.java @@ -2,20 +2,20 @@ package mekanism.client.gui; import java.util.List; -import mekanism.api.MekanismConfig.general; -import mekanism.api.util.ListUtils; -import mekanism.api.util.UnitDisplayUtils; -import mekanism.api.util.UnitDisplayUtils.TemperatureUnit; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiHeatInfo; import mekanism.client.gui.element.GuiSecurityTab; import mekanism.client.gui.element.GuiSlot; import mekanism.client.gui.element.GuiSlot.SlotType; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.inventory.container.ContainerFuelwoodHeater; import mekanism.common.tile.TileEntityFuelwoodHeater; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.UnitDisplayUtils; import mekanism.common.util.MekanismUtils.ResourceType; +import mekanism.common.util.UnitDisplayUtils.TemperatureUnit; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/mekanism/client/gui/GuiInductionMatrix.java b/src/main/java/mekanism/client/gui/GuiInductionMatrix.java index 988c8dc86..747fe2813 100644 --- a/src/main/java/mekanism/client/gui/GuiInductionMatrix.java +++ b/src/main/java/mekanism/client/gui/GuiInductionMatrix.java @@ -2,7 +2,6 @@ package mekanism.client.gui; import java.util.List; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiMatrixTab; @@ -11,6 +10,7 @@ import mekanism.client.render.MekanismRenderer; import mekanism.common.inventory.container.ContainerInductionMatrix; import mekanism.common.tile.TileEntityInductionCasing; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.entity.player.InventoryPlayer; diff --git a/src/main/java/mekanism/client/gui/GuiMItemStackFilter.java b/src/main/java/mekanism/client/gui/GuiMItemStackFilter.java index 81ae3c518..e37e25d8e 100644 --- a/src/main/java/mekanism/client/gui/GuiMItemStackFilter.java +++ b/src/main/java/mekanism/client/gui/GuiMItemStackFilter.java @@ -88,7 +88,7 @@ public class GuiMItemStackFilter extends GuiMekanism if(guibutton.id == 0) { - if(filter.itemType != null) + if(!filter.itemType.isEmpty()) { if(isNew) { @@ -122,13 +122,9 @@ public class GuiMItemStackFilter extends GuiMekanism fontRendererObj.drawString(LangUtils.localize("gui.status") + ": " + status, 35, 20, 0x00CD00); fontRendererObj.drawString(LangUtils.localize("gui.itemFilter.details") + ":", 35, 32, 0x00CD00); - if(filter.itemType != null) + if(!filter.itemType.isEmpty()) { renderScaledText(filter.itemType.getDisplayName(), 35, 41, 0x00CD00, 107); - } - - if(filter.itemType != null) - { GlStateManager.pushMatrix(); RenderHelper.enableGUIStandardItemLighting(); itemRender.renderItemAndEffectIntoGUI(filter.itemType, 12, 19); @@ -136,7 +132,7 @@ public class GuiMItemStackFilter extends GuiMekanism GlStateManager.popMatrix(); } - if(filter.replaceStack != null) + if(!filter.replaceStack.isEmpty()) { GlStateManager.pushMatrix(); RenderHelper.enableGUIStandardItemLighting(); @@ -275,22 +271,22 @@ public class GuiMItemStackFilter extends GuiMekanism if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35) { - ItemStack stack = mc.thePlayer.inventory.getItemStack(); + ItemStack stack = mc.player.inventory.getItemStack(); - if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { if(stack.getItem() instanceof ItemBlock) { if(Block.getBlockFromItem(stack.getItem()) != Blocks.BEDROCK) { filter.itemType = stack.copy(); - filter.itemType.stackSize = 1; + filter.itemType.setCount(1); } } } - else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - filter.itemType = null; + filter.itemType = ItemStack.EMPTY; } SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); @@ -299,26 +295,26 @@ public class GuiMItemStackFilter extends GuiMekanism if(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35) { boolean doNull = false; - ItemStack stack = mc.thePlayer.inventory.getItemStack(); - ItemStack toUse = null; + ItemStack stack = mc.player.inventory.getItemStack(); + ItemStack toUse = ItemStack.EMPTY; - if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { if(stack.getItem() instanceof ItemBlock) { if(Block.getBlockFromItem(stack.getItem()) != Blocks.BEDROCK) { toUse = stack.copy(); - toUse.stackSize = 1; + toUse.setCount(1); } } } - else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { doNull = true; } - if(toUse != null || doNull) + if(!toUse.isEmpty() || doNull) { filter.replaceStack = toUse; } diff --git a/src/main/java/mekanism/client/gui/GuiMMaterialFilter.java b/src/main/java/mekanism/client/gui/GuiMMaterialFilter.java index 10c155e57..b6996f1da 100644 --- a/src/main/java/mekanism/client/gui/GuiMMaterialFilter.java +++ b/src/main/java/mekanism/client/gui/GuiMMaterialFilter.java @@ -88,7 +88,7 @@ public class GuiMMaterialFilter extends GuiMekanism if(guibutton.id == 0) { - if(filter.materialItem != null) + if(!filter.materialItem.isEmpty()) { if(isNew) { @@ -100,8 +100,7 @@ public class GuiMMaterialFilter extends GuiMekanism Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0)); } - else if(filter.materialItem == null) - { + else { status = EnumColor.DARK_RED + LangUtils.localize("gui.itemFilter.noItem"); ticker = 20; } @@ -123,13 +122,9 @@ public class GuiMMaterialFilter extends GuiMekanism fontRendererObj.drawString(LangUtils.localize("gui.status") + ": " + status, 35, 20, 0x00CD00); fontRendererObj.drawString(LangUtils.localize("gui.materialFilter.details") + ":", 35, 32, 0x00CD00); - if(filter.materialItem != null) + if(!filter.materialItem.isEmpty()) { renderScaledText(filter.materialItem.getDisplayName(), 35, 41, 0x00CD00, 107); - } - - if(filter.materialItem != null) - { GlStateManager.pushMatrix(); RenderHelper.enableGUIStandardItemLighting(); itemRender.renderItemAndEffectIntoGUI(filter.materialItem, 12, 19); @@ -137,7 +132,7 @@ public class GuiMMaterialFilter extends GuiMekanism GlStateManager.popMatrix(); } - if(filter.replaceStack != null) + if(!filter.replaceStack.isEmpty()) { GlStateManager.pushMatrix(); RenderHelper.enableGUIStandardItemLighting(); @@ -257,22 +252,22 @@ public class GuiMMaterialFilter extends GuiMekanism if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35) { - ItemStack stack = mc.thePlayer.inventory.getItemStack(); + ItemStack stack = mc.player.inventory.getItemStack(); - if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { if(stack.getItem() instanceof ItemBlock) { if(Block.getBlockFromItem(stack.getItem()) != Blocks.BEDROCK) { filter.materialItem = stack.copy(); - filter.materialItem.stackSize = 1; + filter.materialItem.setCount(1); } } } - else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - filter.materialItem = null; + filter.materialItem = ItemStack.EMPTY; } SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); @@ -281,26 +276,26 @@ public class GuiMMaterialFilter extends GuiMekanism if(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35) { boolean doNull = false; - ItemStack stack = mc.thePlayer.inventory.getItemStack(); - ItemStack toUse = null; + ItemStack stack = mc.player.inventory.getItemStack(); + ItemStack toUse = ItemStack.EMPTY; - if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { if(stack.getItem() instanceof ItemBlock) { if(Block.getBlockFromItem(stack.getItem()) != Blocks.BEDROCK) { toUse = stack.copy(); - toUse.stackSize = 1; + toUse.setCount(1); } } } - else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { doNull = true; } - if(toUse != null || doNull) + if(!toUse.isEmpty() || doNull) { filter.replaceStack = toUse; } diff --git a/src/main/java/mekanism/client/gui/GuiMModIDFilter.java b/src/main/java/mekanism/client/gui/GuiMModIDFilter.java index b7cd628e9..c0f75588a 100644 --- a/src/main/java/mekanism/client/gui/GuiMModIDFilter.java +++ b/src/main/java/mekanism/client/gui/GuiMModIDFilter.java @@ -48,7 +48,7 @@ public class GuiMModIDFilter extends GuiMekanism private GuiTextField modIDText; - public ItemStack renderStack; + public ItemStack renderStack = ItemStack.EMPTY; public int ticker = 0; @@ -167,7 +167,7 @@ public class GuiMModIDFilter extends GuiMekanism fontRendererObj.drawString(LangUtils.localize("gui.status") + ": " + status, 35, 20, 0x00CD00); renderScaledText(LangUtils.localize("gui.id") + ": " + filter.modID, 35, 32, 0x00CD00, 107); - if(renderStack != null) + if(!renderStack.isEmpty()) { try { GlStateManager.pushMatrix(); @@ -178,7 +178,7 @@ public class GuiMModIDFilter extends GuiMekanism } catch(Exception e) {} } - if(filter.replaceStack != null) + if(!filter.replaceStack.isEmpty()) { GlStateManager.pushMatrix(); RenderHelper.enableGUIStandardItemLighting(); @@ -290,7 +290,7 @@ public class GuiMModIDFilter extends GuiMekanism } else if(iterStacks != null && iterStacks.size() == 0) { - renderStack = null; + renderStack = ItemStack.EMPTY; } } @@ -327,26 +327,26 @@ public class GuiMModIDFilter extends GuiMekanism if(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35) { boolean doNull = false; - ItemStack stack = mc.thePlayer.inventory.getItemStack(); - ItemStack toUse = null; + ItemStack stack = mc.player.inventory.getItemStack(); + ItemStack toUse = ItemStack.EMPTY; - if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { if(stack.getItem() instanceof ItemBlock) { if(Block.getBlockFromItem(stack.getItem()) != Blocks.BEDROCK) { toUse = stack.copy(); - toUse.stackSize = 1; + toUse.setCount(1); } } } - else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { doNull = true; } - if(toUse != null || doNull) + if(!toUse.isEmpty() || doNull) { filter.replaceStack = toUse; } diff --git a/src/main/java/mekanism/client/gui/GuiMOreDictFilter.java b/src/main/java/mekanism/client/gui/GuiMOreDictFilter.java index 6fb610f7d..a9ea1e9c9 100644 --- a/src/main/java/mekanism/client/gui/GuiMOreDictFilter.java +++ b/src/main/java/mekanism/client/gui/GuiMOreDictFilter.java @@ -48,7 +48,7 @@ public class GuiMOreDictFilter extends GuiMekanism private GuiTextField oreDictText; - public ItemStack renderStack; + public ItemStack renderStack = ItemStack.EMPTY; public int ticker = 0; @@ -167,7 +167,7 @@ public class GuiMOreDictFilter extends GuiMekanism fontRendererObj.drawString(LangUtils.localize("gui.status") + ": " + status, 35, 20, 0x00CD00); renderScaledText(LangUtils.localize("gui.key") + ": " + filter.oreDictName, 35, 32, 0x00CD00, 107); - if(renderStack != null) + if(!renderStack.isEmpty()) { try { GlStateManager.pushMatrix(); @@ -178,7 +178,7 @@ public class GuiMOreDictFilter extends GuiMekanism } catch(Exception e) {} } - if(filter.replaceStack != null) + if(!filter.replaceStack.isEmpty()) { GlStateManager.pushMatrix(); RenderHelper.enableGUIStandardItemLighting(); @@ -290,7 +290,7 @@ public class GuiMOreDictFilter extends GuiMekanism } else if(iterStacks != null && iterStacks.size() == 0) { - renderStack = null; + renderStack = ItemStack.EMPTY; } } @@ -327,26 +327,26 @@ public class GuiMOreDictFilter extends GuiMekanism if(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35) { boolean doNull = false; - ItemStack stack = mc.thePlayer.inventory.getItemStack(); - ItemStack toUse = null; + ItemStack stack = mc.player.inventory.getItemStack(); + ItemStack toUse = ItemStack.EMPTY; - if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { if(stack.getItem() instanceof ItemBlock) { if(Block.getBlockFromItem(stack.getItem()) != Blocks.BEDROCK) { toUse = stack.copy(); - toUse.stackSize = 1; + toUse.setCount(1); } } } - else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { doNull = true; } - if(toUse != null || doNull) + if(!toUse.isEmpty() || doNull) { filter.replaceStack = toUse; } diff --git a/src/main/java/mekanism/client/gui/GuiMatrixStats.java b/src/main/java/mekanism/client/gui/GuiMatrixStats.java index 125b7905c..e0559be97 100644 --- a/src/main/java/mekanism/client/gui/GuiMatrixStats.java +++ b/src/main/java/mekanism/client/gui/GuiMatrixStats.java @@ -3,7 +3,6 @@ package mekanism.client.gui; import java.util.List; import mekanism.api.energy.IStrictEnergyStorage; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyGauge; import mekanism.client.gui.element.GuiEnergyGauge.IEnergyInfoHandler; @@ -15,6 +14,7 @@ import mekanism.client.gui.element.GuiRateBar.IRateInfoHandler; import mekanism.common.inventory.container.ContainerNull; import mekanism.common.tile.TileEntityInductionCasing; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.entity.player.InventoryPlayer; diff --git a/src/main/java/mekanism/client/gui/GuiMekanism.java b/src/main/java/mekanism/client/gui/GuiMekanism.java index e6cc6b8f1..b6684a510 100644 --- a/src/main/java/mekanism/client/gui/GuiMekanism.java +++ b/src/main/java/mekanism/client/gui/GuiMekanism.java @@ -10,7 +10,7 @@ import mekanism.client.gui.element.GuiElement; import mekanism.common.SideData; import mekanism.common.base.ISideConfiguration; import mekanism.common.item.ItemConfigurator; -import mekanism.common.tile.TileEntityContainerBlock; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; @@ -21,6 +21,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper { @@ -116,9 +117,9 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper } } - ItemStack stack = mc.thePlayer.inventory.getItemStack(); + ItemStack stack = mc.player.inventory.getItemStack(); - if(stack != null && stack.getItem() instanceof ItemConfigurator && hovering != null) + if(!stack.isEmpty() && stack.getItem() instanceof ItemConfigurator && hovering != null) { SideData data = getFromSlot(hovering); @@ -158,7 +159,7 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper protected boolean isMouseOverSlot(Slot slot, int mouseX, int mouseY) { - return isPointInRegion(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, mouseX, mouseY); + return isPointInRegion(slot.xPos, slot.yPos, 16, 16, mouseX, mouseY); } @Override @@ -258,6 +259,29 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper handleMouseClick(slot, slotIndex, button, modifier); } + @Override + public void handleMouseInput() throws java.io.IOException + { + super.handleMouseInput(); + + int xAxis = Mouse.getEventX() * width / mc.displayWidth - getXPos(); + int yAxis = height - Mouse.getEventY() * height / mc.displayHeight - 1 - getYPos(); + int delta = Mouse.getEventDWheel(); + + if(delta != 0) + { + mouseWheel(xAxis, yAxis, delta); + } + } + + public void mouseWheel(int xAxis, int yAxis, int delta) + { + for(GuiElement element : guiElements) + { + element.mouseWheel(xAxis, yAxis, delta); + } + } + public int getXPos() { return (width - xSize) / 2; diff --git a/src/main/java/mekanism/client/gui/GuiMetallurgicInfuser.java b/src/main/java/mekanism/client/gui/GuiMetallurgicInfuser.java index 79cae810c..0ff8b79b5 100644 --- a/src/main/java/mekanism/client/gui/GuiMetallurgicInfuser.java +++ b/src/main/java/mekanism/client/gui/GuiMetallurgicInfuser.java @@ -5,7 +5,6 @@ import java.util.ArrayList; import java.util.List; import mekanism.api.Coord4D; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiPowerBar; @@ -27,6 +26,7 @@ import mekanism.common.inventory.container.ContainerMetallurgicInfuser; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.tile.TileEntityMetallurgicInfuser; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.entity.player.InventoryPlayer; diff --git a/src/main/java/mekanism/client/gui/GuiOredictionificator.java b/src/main/java/mekanism/client/gui/GuiOredictionificator.java index 2c9a23c89..82c5ed314 100644 --- a/src/main/java/mekanism/client/gui/GuiOredictionificator.java +++ b/src/main/java/mekanism/client/gui/GuiOredictionificator.java @@ -132,7 +132,7 @@ public class GuiOredictionificator extends GuiMekanism ItemStack stack = renderStacks.get(filter); - if(stack != null) + if(!stack.isEmpty()) { GlStateManager.pushMatrix(); RenderHelper.enableGUIStandardItemLighting(); @@ -258,7 +258,7 @@ public class GuiOredictionificator extends GuiMekanism { if(filter.filter == null || filter.filter.isEmpty()) { - renderStacks.put(filter, null); + renderStacks.put(filter, ItemStack.EMPTY); continue; } @@ -266,7 +266,7 @@ public class GuiOredictionificator extends GuiMekanism if(stacks.isEmpty()) { - renderStacks.put(filter, null); + renderStacks.put(filter, ItemStack.EMPTY); continue; } @@ -275,7 +275,7 @@ public class GuiOredictionificator extends GuiMekanism renderStacks.put(filter, stacks.get(filter.index).copy()); } else { - renderStacks.put(filter, null); + renderStacks.put(filter, ItemStack.EMPTY); } } } diff --git a/src/main/java/mekanism/client/gui/GuiOsmiumCompressor.java b/src/main/java/mekanism/client/gui/GuiOsmiumCompressor.java index 02d63182e..a4c0cb086 100644 --- a/src/main/java/mekanism/client/gui/GuiOsmiumCompressor.java +++ b/src/main/java/mekanism/client/gui/GuiOsmiumCompressor.java @@ -1,7 +1,7 @@ package mekanism.client.gui; import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.common.tile.TileEntityAdvancedElectricMachine; +import mekanism.common.tile.prefab.TileEntityAdvancedElectricMachine; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/mekanism/client/gui/GuiPRC.java b/src/main/java/mekanism/client/gui/GuiPRC.java index 78d68a59f..42fa9351f 100644 --- a/src/main/java/mekanism/client/gui/GuiPRC.java +++ b/src/main/java/mekanism/client/gui/GuiPRC.java @@ -3,7 +3,6 @@ package mekanism.client.gui; import java.util.List; import mekanism.api.gas.GasTank; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiFluidGauge; @@ -26,6 +25,7 @@ import mekanism.client.gui.element.GuiUpgradeTab; import mekanism.common.inventory.container.ContainerPRC; import mekanism.common.tile.TileEntityPRC; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.entity.player.InventoryPlayer; diff --git a/src/main/java/mekanism/client/gui/GuiPurificationChamber.java b/src/main/java/mekanism/client/gui/GuiPurificationChamber.java index a0b7c801b..315db642e 100644 --- a/src/main/java/mekanism/client/gui/GuiPurificationChamber.java +++ b/src/main/java/mekanism/client/gui/GuiPurificationChamber.java @@ -1,7 +1,7 @@ package mekanism.client.gui; import mekanism.client.gui.element.GuiProgress.ProgressBar; -import mekanism.common.tile.TileEntityAdvancedElectricMachine; +import mekanism.common.tile.prefab.TileEntityAdvancedElectricMachine; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/mekanism/client/gui/GuiQuantumEntangloporter.java b/src/main/java/mekanism/client/gui/GuiQuantumEntangloporter.java index bcdb1174d..fc524719c 100644 --- a/src/main/java/mekanism/client/gui/GuiQuantumEntangloporter.java +++ b/src/main/java/mekanism/client/gui/GuiQuantumEntangloporter.java @@ -121,7 +121,7 @@ public class GuiQuantumEntangloporter extends GuiMekanism public void updateButtons() { - if(tileEntity.getSecurity().getOwner() == null) + if(tileEntity.getSecurity().getClientOwner() == null) { return; } @@ -138,7 +138,7 @@ public class GuiQuantumEntangloporter extends GuiMekanism else { for(Frequency freq : tileEntity.publicCache) { - text.add(freq.name + " (" + freq.owner + ")"); + text.add(freq.name + " (" + freq.clientOwner + ")"); } } @@ -166,7 +166,7 @@ public class GuiQuantumEntangloporter extends GuiMekanism setButton.enabled = false; } - if(tileEntity.getSecurity().getOwner().equals(freq.owner)) + if(tileEntity.getSecurity().getOwnerUUID().equals(freq.ownerUUID)) { deleteButton.enabled = true; } @@ -290,7 +290,7 @@ public class GuiQuantumEntangloporter extends GuiMekanism int yAxis = (mouseY-(height-ySize)/2); fontRendererObj.drawString(tileEntity.getName(), (xSize/2)-(fontRendererObj.getStringWidth(tileEntity.getName())/2), 4, 0x404040); - fontRendererObj.drawString(LangUtils.localize("gui.owner") + ": " + (tileEntity.getSecurity().getOwner() != null ? tileEntity.getSecurity().getOwner() : LangUtils.localize("gui.none")), 8, (ySize-96)+4, 0x404040); + fontRendererObj.drawString(LangUtils.localize("gui.owner") + ": " + (tileEntity.getSecurity().getClientOwner() != null ? tileEntity.getSecurity().getClientOwner() : LangUtils.localize("gui.none")), 8, (ySize-96)+4, 0x404040); fontRendererObj.drawString(LangUtils.localize("gui.freq") + ":", 32, 81, 0x404040); fontRendererObj.drawString(LangUtils.localize("gui.security") + ":", 32, 91, 0x404040); diff --git a/src/main/java/mekanism/client/gui/GuiResistiveHeater.java b/src/main/java/mekanism/client/gui/GuiResistiveHeater.java index 2b20a3216..fefe34c32 100644 --- a/src/main/java/mekanism/client/gui/GuiResistiveHeater.java +++ b/src/main/java/mekanism/client/gui/GuiResistiveHeater.java @@ -5,10 +5,6 @@ import java.util.ArrayList; import java.util.List; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; -import mekanism.api.util.ListUtils; -import mekanism.api.util.UnitDisplayUtils; -import mekanism.api.util.UnitDisplayUtils.TemperatureUnit; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiHeatInfo; @@ -20,12 +16,16 @@ import mekanism.client.gui.element.GuiSlot.SlotOverlay; import mekanism.client.gui.element.GuiSlot.SlotType; import mekanism.client.sound.SoundHandler; import mekanism.common.Mekanism; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.inventory.container.ContainerResistiveHeater; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.tile.TileEntityResistiveHeater; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.UnitDisplayUtils; import mekanism.common.util.MekanismUtils.ResourceType; +import mekanism.common.util.UnitDisplayUtils.TemperatureUnit; import net.minecraft.client.gui.GuiTextField; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.SoundEvents; diff --git a/src/main/java/mekanism/client/gui/GuiRobitCrafting.java b/src/main/java/mekanism/client/gui/GuiRobitCrafting.java index 9b526cc70..a3cffeb13 100644 --- a/src/main/java/mekanism/client/gui/GuiRobitCrafting.java +++ b/src/main/java/mekanism/client/gui/GuiRobitCrafting.java @@ -108,7 +108,7 @@ public class GuiRobitCrafting extends GuiMekanism { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 0, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 21, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 21, mc.world, robit.getEntityId(), 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 30 && yAxis <= 48) { @@ -118,19 +118,19 @@ public class GuiRobitCrafting extends GuiMekanism { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 2, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 23, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 23, mc.world, robit.getEntityId(), 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88) { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 3, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 24, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 24, mc.world, robit.getEntityId(), 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 90 && yAxis <= 108) { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 4, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 25, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 25, mc.world, robit.getEntityId(), 0, 0); } } } diff --git a/src/main/java/mekanism/client/gui/GuiRobitInventory.java b/src/main/java/mekanism/client/gui/GuiRobitInventory.java index 8ba3cf020..7088f4cc6 100644 --- a/src/main/java/mekanism/client/gui/GuiRobitInventory.java +++ b/src/main/java/mekanism/client/gui/GuiRobitInventory.java @@ -108,13 +108,13 @@ public class GuiRobitInventory extends GuiMekanism { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 0, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 21, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 21, mc.world, robit.getEntityId(), 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 30 && yAxis <= 48) { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 1, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 22, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 22, mc.world, robit.getEntityId(), 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 50 && yAxis <= 68) { @@ -124,13 +124,13 @@ public class GuiRobitInventory extends GuiMekanism { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 3, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 24, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 24, mc.world, robit.getEntityId(), 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 90 && yAxis <= 108) { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 4, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 25, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 25, mc.world, robit.getEntityId(), 0, 0); } } } diff --git a/src/main/java/mekanism/client/gui/GuiRobitMain.java b/src/main/java/mekanism/client/gui/GuiRobitMain.java index 04b251356..8f7086a6e 100644 --- a/src/main/java/mekanism/client/gui/GuiRobitMain.java +++ b/src/main/java/mekanism/client/gui/GuiRobitMain.java @@ -95,7 +95,7 @@ public class GuiRobitMain extends GuiMekanism } else if(i == Keyboard.KEY_ESCAPE) { - mc.thePlayer.closeScreen(); + mc.player.closeScreen(); } nameChangeField.textboxKeyTyped(c, i); @@ -275,25 +275,25 @@ public class GuiRobitMain extends GuiMekanism { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 1, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 22, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 22, mc.world, robit.getEntityId(), 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 50 && yAxis <= 68) { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 2, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 23, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 23, mc.world, robit.getEntityId(), 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88) { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 3, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 24, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 24, mc.world, robit.getEntityId(), 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 90 && yAxis <= 108) { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 4, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 25, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 25, mc.world, robit.getEntityId(), 0, 0); } else if(xAxis >= 152 && xAxis <= 170 && yAxis >= 54 && yAxis <= 72) { diff --git a/src/main/java/mekanism/client/gui/GuiRobitRepair.java b/src/main/java/mekanism/client/gui/GuiRobitRepair.java index 3eaf1ce89..e351e33b1 100644 --- a/src/main/java/mekanism/client/gui/GuiRobitRepair.java +++ b/src/main/java/mekanism/client/gui/GuiRobitRepair.java @@ -3,7 +3,6 @@ package mekanism.client.gui; import io.netty.buffer.Unpooled; import java.io.IOException; -import java.util.List; import mekanism.client.sound.SoundHandler; import mekanism.common.Mekanism; @@ -24,6 +23,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraft.network.play.client.CPacketCustomPayload; +import net.minecraft.util.NonNullList; import net.minecraft.util.text.translation.I18n; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -86,7 +86,7 @@ public class GuiRobitRepair extends GuiMekanism implements IContainerListener boolean flag = true; String s = I18n.translateToLocalFormatted("container.repair.cost", repairContainer.maximumCost); - if(repairContainer.maximumCost >= 40 && !mc.thePlayer.capabilities.isCreativeMode) + if(repairContainer.maximumCost >= 40 && !mc.player.capabilities.isCreativeMode) { s = LangUtils.localize("container.repair.expensive"); k = 16736352; @@ -132,7 +132,7 @@ public class GuiRobitRepair extends GuiMekanism implements IContainerListener if(itemNameField.textboxKeyTyped(c, i)) { repairContainer.updateItemName(itemNameField.getText()); - mc.thePlayer.connection.sendPacket(new CPacketCustomPayload("MC|ItemName", (new PacketBuffer(Unpooled.buffer())).writeString(itemNameField.getText()))); + mc.player.connection.sendPacket(new CPacketCustomPayload("MC|ItemName", (new PacketBuffer(Unpooled.buffer())).writeString(itemNameField.getText()))); } else { super.keyTyped(c, i); @@ -155,25 +155,25 @@ public class GuiRobitRepair extends GuiMekanism implements IContainerListener { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 0, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 21, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 21, mc.world, robit.getEntityId(), 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 30 && yAxis <= 48) { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 1, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 22, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 22, mc.world, robit.getEntityId(), 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 50 && yAxis <= 68) { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 2, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 23, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 23, mc.world, robit.getEntityId(), 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88) { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 3, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 24, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 24, mc.world, robit.getEntityId(), 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 90 && yAxis <= 108) { @@ -254,7 +254,7 @@ public class GuiRobitRepair extends GuiMekanism implements IContainerListener } @Override - public void updateCraftingInventory(Container container, List list) + public void updateCraftingInventory(Container container, NonNullList list) { sendSlotContents(container, 0, container.getSlot(0).getStack()); } @@ -264,13 +264,13 @@ public class GuiRobitRepair extends GuiMekanism implements IContainerListener { if(slotID == 0) { - itemNameField.setText(itemstack == null ? "" : itemstack.getDisplayName()); - itemNameField.setEnabled(itemstack != null); + itemNameField.setText(itemstack.isEmpty() ? "" : itemstack.getDisplayName()); + itemNameField.setEnabled(!itemstack.isEmpty()); - if(itemstack != null) + if(!itemstack.isEmpty()) { repairContainer.updateItemName(itemNameField.getText()); - mc.thePlayer.connection.sendPacket(new CPacketCustomPayload("MC|ItemName", (new PacketBuffer(Unpooled.buffer())).writeString(itemNameField.getText()))); + mc.player.connection.sendPacket(new CPacketCustomPayload("MC|ItemName", (new PacketBuffer(Unpooled.buffer())).writeString(itemNameField.getText()))); } } } diff --git a/src/main/java/mekanism/client/gui/GuiRobitSmelting.java b/src/main/java/mekanism/client/gui/GuiRobitSmelting.java index f72be0621..c27d63342 100644 --- a/src/main/java/mekanism/client/gui/GuiRobitSmelting.java +++ b/src/main/java/mekanism/client/gui/GuiRobitSmelting.java @@ -116,19 +116,19 @@ public class GuiRobitSmelting extends GuiMekanism { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 0, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 21, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 21, mc.world, robit.getEntityId(), 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 30 && yAxis <= 48) { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 1, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 22, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 22, mc.world, robit.getEntityId(), 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 50 && yAxis <= 68) { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 2, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 23, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 23, mc.world, robit.getEntityId(), 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88) { @@ -138,7 +138,7 @@ public class GuiRobitSmelting extends GuiMekanism { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new RobitMessage(RobitPacketType.GUI, 4, robit.getEntityId(), null)); - mc.thePlayer.openGui(Mekanism.instance, 25, mc.theWorld, robit.getEntityId(), 0, 0); + mc.player.openGui(Mekanism.instance, 25, mc.world, robit.getEntityId(), 0, 0); } } } diff --git a/src/main/java/mekanism/client/gui/GuiRotaryCondensentrator.java b/src/main/java/mekanism/client/gui/GuiRotaryCondensentrator.java index a890c25e8..38ad90d36 100644 --- a/src/main/java/mekanism/client/gui/GuiRotaryCondensentrator.java +++ b/src/main/java/mekanism/client/gui/GuiRotaryCondensentrator.java @@ -6,7 +6,6 @@ import java.util.List; import mekanism.api.Coord4D; import mekanism.api.gas.GasTank; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiFluidGauge; @@ -29,6 +28,7 @@ import mekanism.common.inventory.container.ContainerRotaryCondensentrator; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.tile.TileEntityRotaryCondensentrator; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.entity.player.InventoryPlayer; diff --git a/src/main/java/mekanism/client/gui/GuiSecurityDesk.java b/src/main/java/mekanism/client/gui/GuiSecurityDesk.java index 045de868d..f0e193a74 100644 --- a/src/main/java/mekanism/client/gui/GuiSecurityDesk.java +++ b/src/main/java/mekanism/client/gui/GuiSecurityDesk.java @@ -96,7 +96,7 @@ public class GuiSecurityDesk extends GuiMekanism public void updateButtons() { - if(tileEntity.owner == null) + if(tileEntity.clientOwner == null) { return; } @@ -146,7 +146,7 @@ public class GuiSecurityDesk extends GuiMekanism int xAxis = (mouseX - (width - xSize) / 2); int yAxis = (mouseY - (height - ySize) / 2); - if(tileEntity.frequency != null && tileEntity.owner != null && tileEntity.owner.equals(mc.thePlayer.getName())) + if(tileEntity.frequency != null && tileEntity.ownerUUID != null && tileEntity.clientOwner.equals(mc.player.getName())) { if(xAxis >= 123 && xAxis <= 134 && yAxis >= 68 && yAxis <= 79) { @@ -255,7 +255,7 @@ public class GuiSecurityDesk extends GuiMekanism int xAxis = (mouseX-(width-xSize)/2); int yAxis = (mouseY-(height-ySize)/2); - String ownerText = EnumColor.RED + tileEntity.owner != null ? (LangUtils.localize("gui.owner") + ": " + tileEntity.owner) : LangUtils.localize("gui.noOwner"); + String ownerText = EnumColor.RED + tileEntity.clientOwner != null ? (LangUtils.localize("gui.owner") + ": " + tileEntity.clientOwner) : LangUtils.localize("gui.noOwner"); fontRendererObj.drawString(tileEntity.getName(), (xSize/2)-(fontRendererObj.getStringWidth(tileEntity.getName())/2), 4, 0x404040); fontRendererObj.drawString(ownerText, (xSize - 7) - fontRendererObj.getStringWidth(ownerText), (ySize - 96) + 2, 0x404040); fontRendererObj.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040); @@ -309,7 +309,7 @@ public class GuiSecurityDesk extends GuiMekanism int xAxis = (mouseX - (width - xSize) / 2); int yAxis = (mouseY - (height - ySize) / 2); - if(tileEntity.frequency != null && tileEntity.owner != null && mc.thePlayer.getName().equals(tileEntity.owner)) + if(tileEntity.frequency != null && tileEntity.clientOwner != null && mc.player.getName().equals(tileEntity.clientOwner)) { drawTexturedModalRect(guiWidth + 145, guiHeight + 78, xSize + (tileEntity.frequency.override ? 0 : 6), 22, 6, 6); diff --git a/src/main/java/mekanism/client/gui/GuiSeismicReader.java b/src/main/java/mekanism/client/gui/GuiSeismicReader.java index 962ddec65..0a36e0327 100644 --- a/src/main/java/mekanism/client/gui/GuiSeismicReader.java +++ b/src/main/java/mekanism/client/gui/GuiSeismicReader.java @@ -143,7 +143,7 @@ public class GuiSeismicReader extends GuiScreen // Get the name from the stack and render it if(currentLayer - 1 >= 0) { - ItemStack nameStack = new ItemStack(blockList.get(currentLayer - 1).getRight(), 0, blockList.get(currentLayer - 1).getLeft()); + ItemStack nameStack = new ItemStack(blockList.get(currentLayer - 1).getRight(), 1, blockList.get(currentLayer - 1).getLeft()); String renderString = "unknown"; if(nameStack.getItem() != null) @@ -229,7 +229,7 @@ public class GuiSeismicReader extends GuiScreen public void calculate() { - for(BlockPos p = new BlockPos(pos.zCoord, 0, pos.zCoord); p.getY() < pos.yCoord; p = p.up()) + for(BlockPos p = new BlockPos(pos.xCoord, 0, pos.zCoord); p.getY() < pos.yCoord; p = p.up()) { IBlockState state = worldObj.getBlockState(p); Block block = state.getBlock(); diff --git a/src/main/java/mekanism/client/gui/GuiSeismicVibrator.java b/src/main/java/mekanism/client/gui/GuiSeismicVibrator.java index 410ab55b4..2598cafc7 100644 --- a/src/main/java/mekanism/client/gui/GuiSeismicVibrator.java +++ b/src/main/java/mekanism/client/gui/GuiSeismicVibrator.java @@ -2,8 +2,6 @@ package mekanism.client.gui; import java.util.List; -import mekanism.api.MekanismConfig.usage; -import mekanism.api.util.ListUtils; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiPowerBar; @@ -12,9 +10,11 @@ import mekanism.client.gui.element.GuiSecurityTab; import mekanism.client.gui.element.GuiSlot; import mekanism.client.gui.element.GuiSlot.SlotOverlay; import mekanism.client.gui.element.GuiSlot.SlotType; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.inventory.container.ContainerSeismicVibrator; import mekanism.common.tile.TileEntitySeismicVibrator; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.entity.player.InventoryPlayer; diff --git a/src/main/java/mekanism/client/gui/GuiSideConfiguration.java b/src/main/java/mekanism/client/gui/GuiSideConfiguration.java index 0a9677eda..a365da363 100644 --- a/src/main/java/mekanism/client/gui/GuiSideConfiguration.java +++ b/src/main/java/mekanism/client/gui/GuiSideConfiguration.java @@ -19,8 +19,8 @@ import mekanism.common.inventory.container.ContainerNull; import mekanism.common.network.PacketConfigurationUpdate.ConfigurationPacket; import mekanism.common.network.PacketConfigurationUpdate.ConfigurationUpdateMessage; import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage; -import mekanism.common.tile.TileEntityContainerBlock; import mekanism.common.tile.component.TileComponentConfig; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; @@ -210,7 +210,7 @@ public class GuiSideConfiguration extends GuiMekanism TileEntity tile = (TileEntity)configurable; - if(tile == null || mc.theWorld.getTileEntity(tile.getPos()) == null) + if(tile == null || mc.world.getTileEntity(tile.getPos()) == null) { mc.displayGuiScreen(null); } diff --git a/src/main/java/mekanism/client/gui/GuiTItemStackFilter.java b/src/main/java/mekanism/client/gui/GuiTItemStackFilter.java index c53ea7733..c4f680418 100644 --- a/src/main/java/mekanism/client/gui/GuiTItemStackFilter.java +++ b/src/main/java/mekanism/client/gui/GuiTItemStackFilter.java @@ -77,8 +77,8 @@ public class GuiTItemStackFilter extends GuiMekanism int guiHeight = (height - ySize) / 2; buttonList.clear(); - buttonList.add(new GuiButton(0, guiWidth + 27, guiHeight + 62, 60, 20, LangUtils.localize("gui.save"))); - buttonList.add(new GuiButton(1, guiWidth + 89, guiHeight + 62, 60, 20, LangUtils.localize("gui.delete"))); + buttonList.add(new GuiButton(0, guiWidth + 47, guiHeight + 62, 60, 20, LangUtils.localize("gui.save"))); + buttonList.add(new GuiButton(1, guiWidth + 109, guiHeight + 62, 60, 20, LangUtils.localize("gui.delete"))); if(isNew) { @@ -101,7 +101,7 @@ public class GuiTItemStackFilter extends GuiMekanism if(guibutton.id == 0) { - if(filter.itemType != null && !minField.getText().isEmpty() && !maxField.getText().isEmpty()) + if(!filter.itemType.isEmpty() && !minField.getText().isEmpty() && !maxField.getText().isEmpty()) { int min = Integer.parseInt(minField.getText()); int max = Integer.parseInt(maxField.getText()); @@ -132,7 +132,7 @@ public class GuiTItemStackFilter extends GuiMekanism ticker = 20; } } - else if(filter.itemType == null) + else if(filter.itemType.isEmpty()) { status = EnumColor.DARK_RED + "No item"; ticker = 20; @@ -178,14 +178,11 @@ public class GuiTItemStackFilter extends GuiMekanism fontRendererObj.drawString(LangUtils.localize("gui.itemFilter.min") + ":", 128, 20, 0x404040); fontRendererObj.drawString(LangUtils.localize("gui.itemFilter.max") + ":", 128, 32, 0x404040); fontRendererObj.drawString(LangUtils.localize("gui." + (filter.sizeMode ? "on" : "off")), 141, 46, 0x404040); + fontRendererObj.drawString(LangUtils.localize("gui." + (filter.allowDefault ? "on" : "off")), 24, 66, 0x404040); - if(filter.itemType != null) + if(!filter.itemType.isEmpty()) { renderScaledText(filter.itemType.getDisplayName(), 35, 41, 0x00CD00, 89); - } - - if(filter.itemType != null) - { GlStateManager.pushMatrix(); RenderHelper.enableGUIStandardItemLighting(); itemRender.renderItemAndEffectIntoGUI(filter.itemType, 12, 19); @@ -206,6 +203,16 @@ public class GuiTItemStackFilter extends GuiMekanism GL11.glDisable(GL11.GL_LIGHTING); GlStateManager.popMatrix(); } + + if(xAxis >= 128 && xAxis <= 139 && yAxis >= 44 && yAxis <= 55) + { + drawCreativeTabHoveringText(LangUtils.localize("gui.sizeMode"), xAxis, yAxis); + } + + if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75) + { + drawCreativeTabHoveringText(LangUtils.localize("gui.allowDefault"), xAxis, yAxis); + } if(xAxis >= 12 && xAxis <= 28 && yAxis >= 44 && yAxis <= 60) { @@ -265,6 +272,14 @@ public class GuiTItemStackFilter extends GuiMekanism else { drawTexturedModalRect(guiWidth + 128, guiHeight + 44, 187, 11, 11, 11); } + + if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75) + { + drawTexturedModalRect(guiWidth + 11, guiHeight + 64, 198, 0, 11, 11); + } + else { + drawTexturedModalRect(guiWidth + 11, guiHeight + 64, 198, 11, 11, 11); + } minField.drawTextBox(); maxField.drawTextBox(); @@ -310,16 +325,16 @@ public class GuiTItemStackFilter extends GuiMekanism if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35) { - ItemStack stack = mc.thePlayer.inventory.getItemStack(); + ItemStack stack = mc.player.inventory.getItemStack(); - if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { filter.itemType = stack.copy(); - filter.itemType.stackSize = 1; + filter.itemType.setCount(1); } - else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - filter.itemType = null; + filter.itemType = ItemStack.EMPTY; } SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); @@ -330,6 +345,12 @@ public class GuiTItemStackFilter extends GuiMekanism SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); filter.sizeMode = !filter.sizeMode; } + + if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75) + { + SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); + filter.allowDefault = !filter.allowDefault; + } } if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && button == 0) diff --git a/src/main/java/mekanism/client/gui/GuiTMaterialFilter.java b/src/main/java/mekanism/client/gui/GuiTMaterialFilter.java index c6c8323f4..1e533c82a 100644 --- a/src/main/java/mekanism/client/gui/GuiTMaterialFilter.java +++ b/src/main/java/mekanism/client/gui/GuiTMaterialFilter.java @@ -76,8 +76,8 @@ public class GuiTMaterialFilter extends GuiMekanism int guiHeight = (height - ySize) / 2; buttonList.clear(); - buttonList.add(new GuiButton(0, guiWidth + 27, guiHeight + 62, 60, 20, LangUtils.localize("gui.save"))); - buttonList.add(new GuiButton(1, guiWidth + 89, guiHeight + 62, 60, 20, LangUtils.localize("gui.delete"))); + buttonList.add(new GuiButton(0, guiWidth + 47, guiHeight + 62, 60, 20, LangUtils.localize("gui.save"))); + buttonList.add(new GuiButton(1, guiWidth + 109, guiHeight + 62, 60, 20, LangUtils.localize("gui.delete"))); if(isNew) { @@ -92,7 +92,7 @@ public class GuiTMaterialFilter extends GuiMekanism if(guibutton.id == 0) { - if(filter.materialItem != null) + if(!filter.materialItem.isEmpty()) { if(isNew) { @@ -104,7 +104,7 @@ public class GuiTMaterialFilter extends GuiMekanism Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0)); } - else if(filter.materialItem == null) + else if(filter.materialItem.isEmpty()) { status = EnumColor.DARK_RED + LangUtils.localize("gui.itemFilter.noItem"); ticker = 20; @@ -126,14 +126,11 @@ public class GuiTMaterialFilter extends GuiMekanism fontRendererObj.drawString((isNew ? LangUtils.localize("gui.new") : LangUtils.localize("gui.edit")) + " " + LangUtils.localize("gui.materialFilter"), 43, 6, 0x404040); fontRendererObj.drawString(LangUtils.localize("gui.status") + ": " + status, 35, 20, 0x00CD00); fontRendererObj.drawString(LangUtils.localize("gui.materialFilter.details") + ":", 35, 32, 0x00CD00); + fontRendererObj.drawString(LangUtils.localize("gui." + (filter.allowDefault ? "on" : "off")), 24, 66, 0x404040); - if(filter.materialItem != null) + if(!filter.materialItem.isEmpty()) { renderScaledText(filter.materialItem.getDisplayName(), 35, 41, 0x00CD00, 107); - } - - if(filter.materialItem != null) - { GlStateManager.pushMatrix(); RenderHelper.enableGUIStandardItemLighting(); itemRender.renderItemAndEffectIntoGUI(filter.materialItem, 12, 19); @@ -155,6 +152,11 @@ public class GuiTMaterialFilter extends GuiMekanism GlStateManager.popMatrix(); } + if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75) + { + drawCreativeTabHoveringText(LangUtils.localize("gui.allowDefault"), xAxis, yAxis); + } + if(xAxis >= 12 && xAxis <= 28 && yAxis >= 44 && yAxis <= 60) { if(filter.color != null) @@ -202,6 +204,14 @@ public class GuiTMaterialFilter extends GuiMekanism else { drawTexturedModalRect(guiWidth + 5, guiHeight + 5, 176, 11, 11, 11); } + + if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75) + { + drawTexturedModalRect(guiWidth + 11, guiHeight + 64, 198, 0, 11, 11); + } + else { + drawTexturedModalRect(guiWidth + 11, guiHeight + 64, 198, 11, 11, 11); + } if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35) { @@ -241,26 +251,32 @@ public class GuiTMaterialFilter extends GuiMekanism if(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35) { - ItemStack stack = mc.thePlayer.inventory.getItemStack(); + ItemStack stack = mc.player.inventory.getItemStack(); - if(stack != null && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + if(!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { if(stack.getItem() instanceof ItemBlock) { if(Block.getBlockFromItem(stack.getItem()) != Blocks.BEDROCK) { filter.materialItem = stack.copy(); - filter.materialItem.stackSize = 1; + filter.materialItem.setCount(1); } } } - else if(stack == null && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + else if(stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - filter.materialItem = null; + filter.materialItem = ItemStack.EMPTY; } SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); } + + if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75) + { + SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); + filter.allowDefault = !filter.allowDefault; + } } if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && button == 0) diff --git a/src/main/java/mekanism/client/gui/GuiTModIDFilter.java b/src/main/java/mekanism/client/gui/GuiTModIDFilter.java index 18225cbc4..387ec6271 100644 --- a/src/main/java/mekanism/client/gui/GuiTModIDFilter.java +++ b/src/main/java/mekanism/client/gui/GuiTModIDFilter.java @@ -49,7 +49,7 @@ public class GuiTModIDFilter extends GuiMekanism private GuiTextField modIDText; - public ItemStack renderStack; + public ItemStack renderStack = ItemStack.EMPTY; public int ticker = 0; @@ -89,8 +89,8 @@ public class GuiTModIDFilter extends GuiMekanism int guiHeight = (height - ySize) / 2; buttonList.clear(); - buttonList.add(new GuiButton(0, guiWidth + 27, guiHeight + 62, 60, 20, LangUtils.localize("gui.save"))); - buttonList.add(new GuiButton(1, guiWidth + 89, guiHeight + 62, 60, 20, LangUtils.localize("gui.delete"))); + buttonList.add(new GuiButton(0, guiWidth + 47, guiHeight + 62, 60, 20, LangUtils.localize("gui.save"))); + buttonList.add(new GuiButton(1, guiWidth + 109, guiHeight + 62, 60, 20, LangUtils.localize("gui.delete"))); if(isNew) { @@ -167,8 +167,9 @@ public class GuiTModIDFilter extends GuiMekanism fontRendererObj.drawString((isNew ? LangUtils.localize("gui.new") : LangUtils.localize("gui.edit")) + " " + LangUtils.localize("gui.modIDFilter"), 43, 6, 0x404040); fontRendererObj.drawString(LangUtils.localize("gui.status") + ": " + status, 35, 20, 0x00CD00); renderScaledText(LangUtils.localize("gui.id") + ": " + filter.modID, 35, 32, 0x00CD00, 107); + fontRendererObj.drawString(LangUtils.localize("gui." + (filter.allowDefault ? "on" : "off")), 24, 66, 0x404040); - if(renderStack != null) + if(!renderStack.isEmpty()) { try { GlStateManager.pushMatrix(); @@ -192,6 +193,11 @@ public class GuiTModIDFilter extends GuiMekanism GL11.glDisable(GL11.GL_LIGHTING); GlStateManager.popMatrix(); } + + if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75) + { + drawCreativeTabHoveringText(LangUtils.localize("gui.allowDefault"), xAxis, yAxis); + } if(xAxis >= 12 && xAxis <= 28 && yAxis >= 44 && yAxis <= 60) { @@ -234,6 +240,14 @@ public class GuiTModIDFilter extends GuiMekanism else { drawTexturedModalRect(guiWidth + 131, guiHeight + 47, 176 + 11, 12, 12, 12); } + + if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75) + { + drawTexturedModalRect(guiWidth + 11, guiHeight + 64, 199, 0, 11, 11); + } + else { + drawTexturedModalRect(guiWidth + 11, guiHeight + 64, 199, 11, 11, 11); + } modIDText.drawTextBox(); @@ -277,7 +291,7 @@ public class GuiTModIDFilter extends GuiMekanism } else if(iterStacks != null && iterStacks.size() == 0) { - renderStack = null; + renderStack = ItemStack.EMPTY; } } @@ -304,6 +318,12 @@ public class GuiTModIDFilter extends GuiMekanism SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); setModID(); } + + if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75) + { + SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); + filter.allowDefault = !filter.allowDefault; + } } if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && button == 0) diff --git a/src/main/java/mekanism/client/gui/GuiTOreDictFilter.java b/src/main/java/mekanism/client/gui/GuiTOreDictFilter.java index d8affc2f3..1cf9d2f7a 100644 --- a/src/main/java/mekanism/client/gui/GuiTOreDictFilter.java +++ b/src/main/java/mekanism/client/gui/GuiTOreDictFilter.java @@ -49,7 +49,7 @@ public class GuiTOreDictFilter extends GuiMekanism private GuiTextField oreDictText; - public ItemStack renderStack; + public ItemStack renderStack = ItemStack.EMPTY; public int ticker = 0; @@ -89,8 +89,8 @@ public class GuiTOreDictFilter extends GuiMekanism int guiHeight = (height - ySize) / 2; buttonList.clear(); - buttonList.add(new GuiButton(0, guiWidth + 27, guiHeight + 62, 60, 20, LangUtils.localize("gui.save"))); - buttonList.add(new GuiButton(1, guiWidth + 89, guiHeight + 62, 60, 20, LangUtils.localize("gui.delete"))); + buttonList.add(new GuiButton(0, guiWidth + 47, guiHeight + 62, 60, 20, LangUtils.localize("gui.save"))); + buttonList.add(new GuiButton(1, guiWidth + 109, guiHeight + 62, 60, 20, LangUtils.localize("gui.delete"))); if(isNew) { @@ -167,8 +167,9 @@ public class GuiTOreDictFilter extends GuiMekanism fontRendererObj.drawString((isNew ? LangUtils.localize("gui.new") : LangUtils.localize("gui.edit")) + " " + LangUtils.localize("gui.oredictFilter"), 43, 6, 0x404040); fontRendererObj.drawString(LangUtils.localize("gui.status") + ": " + status, 35, 20, 0x00CD00); renderScaledText(LangUtils.localize("gui.key") + ": " + filter.oreDictName, 35, 32, 0x00CD00, 107); + fontRendererObj.drawString(LangUtils.localize("gui." + (filter.allowDefault ? "on" : "off")), 24, 66, 0x404040); - if(renderStack != null) + if(!renderStack.isEmpty()) { try { GlStateManager.pushMatrix(); @@ -192,6 +193,11 @@ public class GuiTOreDictFilter extends GuiMekanism GL11.glDisable(GL11.GL_LIGHTING); GlStateManager.popMatrix(); } + + if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75) + { + drawCreativeTabHoveringText(LangUtils.localize("gui.allowDefault"), xAxis, yAxis); + } if(xAxis >= 12 && xAxis <= 28 && yAxis >= 44 && yAxis <= 60) { @@ -234,6 +240,14 @@ public class GuiTOreDictFilter extends GuiMekanism else { drawTexturedModalRect(guiWidth + 131, guiHeight + 47, 176 + 11, 12, 12, 12); } + + if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75) + { + drawTexturedModalRect(guiWidth + 11, guiHeight + 64, 199, 0, 11, 11); + } + else { + drawTexturedModalRect(guiWidth + 11, guiHeight + 64, 199, 11, 11, 11); + } oreDictText.drawTextBox(); @@ -277,7 +291,7 @@ public class GuiTOreDictFilter extends GuiMekanism } else if(iterStacks != null && iterStacks.size() == 0) { - renderStack = null; + renderStack = ItemStack.EMPTY; } } @@ -304,6 +318,12 @@ public class GuiTOreDictFilter extends GuiMekanism SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); setOreDictKey(); } + + if(xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75) + { + SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); + filter.allowDefault = !filter.allowDefault; + } } if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && button == 0) diff --git a/src/main/java/mekanism/client/gui/GuiTeleporter.java b/src/main/java/mekanism/client/gui/GuiTeleporter.java index 0c0fb4963..7c7a00cfa 100644 --- a/src/main/java/mekanism/client/gui/GuiTeleporter.java +++ b/src/main/java/mekanism/client/gui/GuiTeleporter.java @@ -3,17 +3,20 @@ package mekanism.client.gui; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.UUID; import mekanism.api.Coord4D; import mekanism.api.EnumColor; +import mekanism.client.ClientTickHandler; +import mekanism.client.MekanismClient; import mekanism.client.gui.element.GuiPowerBar; import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler; import mekanism.client.gui.element.GuiRedstoneControl; import mekanism.client.gui.element.GuiScrollList; import mekanism.client.gui.element.GuiSlot; -import mekanism.client.gui.element.GuiUpgradeTab; import mekanism.client.gui.element.GuiSlot.SlotOverlay; import mekanism.client.gui.element.GuiSlot.SlotType; +import mekanism.client.gui.element.GuiUpgradeTab; import mekanism.client.sound.SoundHandler; import mekanism.common.Mekanism; import mekanism.common.frequency.Frequency; @@ -51,7 +54,7 @@ public class GuiTeleporter extends GuiMekanism public ResourceLocation resource; public TileEntityTeleporter tileEntity; - public ItemStack itemStack; + public ItemStack itemStack = ItemStack.EMPTY; public EntityPlayer entityPlayer; @@ -162,7 +165,7 @@ public class GuiTeleporter extends GuiMekanism setButton = new GuiButton(2, guiWidth + 27, guiHeight + 116, 60, 20, LangUtils.localize("gui.set")); deleteButton = new GuiButton(3, guiWidth + 89, guiHeight + 116, 60, 20, LangUtils.localize("gui.delete")); - if(itemStack != null) + if(!itemStack.isEmpty()) { teleportButton = new GuiButton(4, guiWidth + 42, guiHeight + 140, 92, 20, LangUtils.localize("gui.teleport")); } @@ -179,7 +182,7 @@ public class GuiTeleporter extends GuiMekanism buttonList.add(setButton); buttonList.add(deleteButton); - if(itemStack != null) + if(!itemStack.isEmpty()) { buttonList.add(teleportButton); @@ -240,7 +243,7 @@ public class GuiTeleporter extends GuiMekanism else { for(Frequency freq : getPublicCache()) { - text.add(freq.name + " (" + freq.owner + ")"); + text.add(freq.name + " (" + freq.clientOwner + ")"); } } @@ -268,7 +271,7 @@ public class GuiTeleporter extends GuiMekanism setButton.enabled = false; } - if(getOwner().equals(freq.owner)) + if(getOwner().equals(freq.ownerUUID)) { deleteButton.enabled = true; } @@ -281,7 +284,7 @@ public class GuiTeleporter extends GuiMekanism deleteButton.enabled = false; } - if(itemStack != null) + if(!itemStack.isEmpty()) { if(clientFreq != null && clientStatus == 1) { @@ -404,7 +407,7 @@ public class GuiTeleporter extends GuiMekanism if(clientFreq != null && clientStatus == 1) { mc.setIngameFocus(); - Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.TELEPORT, currentHand, clientFreq)); + ClientTickHandler.portableTeleport(entityPlayer, currentHand, clientFreq); } } @@ -418,7 +421,7 @@ public class GuiTeleporter extends GuiMekanism int yAxis = (mouseY-(height-ySize)/2); fontRendererObj.drawString(getName(), (xSize/2)-(fontRendererObj.getStringWidth(getName())/2), 4, 0x404040); - fontRendererObj.drawString(LangUtils.localize("gui.owner") + ": " + (getOwner() != null ? getOwner() : LangUtils.localize("gui.none")), 8, itemStack != null ? ySize-12 : (ySize-96)+4, 0x404040); + fontRendererObj.drawString(LangUtils.localize("gui.owner") + ": " + (getOwnerUsername() != null ? getOwnerUsername() : LangUtils.localize("gui.none")), 8, !itemStack.isEmpty() ? ySize-12 : (ySize-96)+4, 0x404040); fontRendererObj.drawString(LangUtils.localize("gui.freq") + ":", 32, 81, 0x404040); fontRendererObj.drawString(LangUtils.localize("gui.security") + ":", 32, 91, 0x404040); @@ -490,14 +493,25 @@ public class GuiTeleporter extends GuiMekanism return EnumColor.DARK_RED + LangUtils.localize("gui.teleporter.noLink"); } - private String getOwner() + private UUID getOwner() { if(tileEntity != null) { - return tileEntity.getSecurity().getOwner(); + return tileEntity.getSecurity().getOwnerUUID(); } else { - return ((IOwnerItem)itemStack.getItem()).getOwner(itemStack); + return ((IOwnerItem)itemStack.getItem()).getOwnerUUID(itemStack); + } + } + + private String getOwnerUsername() + { + if(tileEntity != null) + { + return tileEntity.getSecurity().getClientOwner(); + } + else { + return MekanismClient.clientUUIDMap.get(((IOwnerItem)itemStack.getItem()).getOwnerUUID(itemStack)); } } @@ -528,7 +542,7 @@ public class GuiTeleporter extends GuiMekanism private double getEnergy() { - if(itemStack != null) + if(!itemStack.isEmpty()) { return ((ItemPortableTeleporter)itemStack.getItem()).getEnergy(itemStack); } @@ -538,7 +552,7 @@ public class GuiTeleporter extends GuiMekanism private double getMaxEnergy() { - if(itemStack != null) + if(!itemStack.isEmpty()) { return ((ItemPortableTeleporter)itemStack.getItem()).getMaxEnergy(itemStack); } diff --git a/src/main/java/mekanism/client/gui/GuiThermalEvaporationController.java b/src/main/java/mekanism/client/gui/GuiThermalEvaporationController.java index 72023c8b7..db107dcb8 100644 --- a/src/main/java/mekanism/client/gui/GuiThermalEvaporationController.java +++ b/src/main/java/mekanism/client/gui/GuiThermalEvaporationController.java @@ -2,20 +2,20 @@ package mekanism.client.gui; import java.util.List; -import mekanism.api.MekanismConfig.general; -import mekanism.api.util.ListUtils; -import mekanism.api.util.UnitDisplayUtils; -import mekanism.api.util.UnitDisplayUtils.TemperatureUnit; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiFluidGauge; import mekanism.client.gui.element.GuiFluidGauge.IFluidInfoHandler; import mekanism.client.gui.element.GuiGauge; import mekanism.client.gui.element.GuiHeatInfo; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.inventory.container.ContainerThermalEvaporationController; import mekanism.common.tile.TileEntityThermalEvaporationController; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.UnitDisplayUtils; import mekanism.common.util.MekanismUtils.ResourceType; +import mekanism.common.util.UnitDisplayUtils.TemperatureUnit; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/mekanism/client/gui/GuiThermoelectricBoiler.java b/src/main/java/mekanism/client/gui/GuiThermoelectricBoiler.java index fccc51fd6..ee73f096a 100644 --- a/src/main/java/mekanism/client/gui/GuiThermoelectricBoiler.java +++ b/src/main/java/mekanism/client/gui/GuiThermoelectricBoiler.java @@ -2,10 +2,6 @@ package mekanism.client.gui; import java.util.List; -import mekanism.api.MekanismConfig.general; -import mekanism.api.util.ListUtils; -import mekanism.api.util.UnitDisplayUtils; -import mekanism.api.util.UnitDisplayUtils.TemperatureUnit; import mekanism.client.gui.element.GuiBoilerTab; import mekanism.client.gui.element.GuiBoilerTab.BoilerTab; import mekanism.client.gui.element.GuiElement.IInfoHandler; @@ -14,12 +10,16 @@ import mekanism.client.gui.element.GuiRateBar; import mekanism.client.gui.element.GuiRateBar.IRateInfoHandler; import mekanism.client.render.MekanismRenderer; import mekanism.client.render.MekanismRenderer.FluidType; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.content.boiler.SynchronizedBoilerData; import mekanism.common.inventory.container.ContainerFilter; import mekanism.common.tile.TileEntityBoilerCasing; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.UnitDisplayUtils; import mekanism.common.util.MekanismUtils.ResourceType; +import mekanism.common.util.UnitDisplayUtils.TemperatureUnit; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/mekanism/client/gui/GuiTransporterConfig.java b/src/main/java/mekanism/client/gui/GuiTransporterConfig.java index b98b87132..681b8f777 100644 --- a/src/main/java/mekanism/client/gui/GuiTransporterConfig.java +++ b/src/main/java/mekanism/client/gui/GuiTransporterConfig.java @@ -16,8 +16,8 @@ import mekanism.common.inventory.container.ContainerNull; import mekanism.common.network.PacketConfigurationUpdate.ConfigurationPacket; import mekanism.common.network.PacketConfigurationUpdate.ConfigurationUpdateMessage; import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage; -import mekanism.common.tile.TileEntityContainerBlock; import mekanism.common.tile.component.TileComponentConfig; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; diff --git a/src/main/java/mekanism/client/gui/element/GuiElement.java b/src/main/java/mekanism/client/gui/element/GuiElement.java index 84dcd6e8a..2ff52b160 100644 --- a/src/main/java/mekanism/client/gui/element/GuiElement.java +++ b/src/main/java/mekanism/client/gui/element/GuiElement.java @@ -3,9 +3,9 @@ package mekanism.client.gui.element; import java.awt.Rectangle; import java.util.List; -import mekanism.api.ObfuscatedNames; -import mekanism.api.util.ReflectionUtils; import mekanism.client.gui.IGuiWrapper; +import mekanism.common.ObfuscatedNames; +import mekanism.common.util.ReflectionUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiContainer; @@ -74,7 +74,6 @@ public abstract class GuiElement { try { int left = (Integer)ReflectionUtils.getPrivateValue(guiObj, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - System.out.println(left + " " + guiLeft); ReflectionUtils.setPrivateValue(guiObj, left + guiLeft, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); } catch(Exception e) { e.printStackTrace(); @@ -126,6 +125,8 @@ public abstract class GuiElement public void mouseReleased(int x, int y, int type) {} + public void mouseWheel(int x, int y, int delta) {} + public abstract Rectangle4i getBounds(int guiWidth, int guiHeight); public abstract void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight); diff --git a/src/main/java/mekanism/client/gui/element/GuiEnergyInfo.java b/src/main/java/mekanism/client/gui/element/GuiEnergyInfo.java index 85781de0a..075c77a4f 100644 --- a/src/main/java/mekanism/client/gui/element/GuiEnergyInfo.java +++ b/src/main/java/mekanism/client/gui/element/GuiEnergyInfo.java @@ -3,12 +3,12 @@ package mekanism.client.gui.element; import java.util.ArrayList; import java.util.List; -import mekanism.api.MekanismConfig.general; -import mekanism.api.util.UnitDisplayUtils.EnergyType; import mekanism.client.gui.IGuiWrapper; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; +import mekanism.common.util.UnitDisplayUtils.EnergyType; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/mekanism/client/gui/element/GuiFluidGauge.java b/src/main/java/mekanism/client/gui/element/GuiFluidGauge.java index 10ac5c1d8..6a56bceb5 100644 --- a/src/main/java/mekanism/client/gui/element/GuiFluidGauge.java +++ b/src/main/java/mekanism/client/gui/element/GuiFluidGauge.java @@ -63,9 +63,9 @@ public class GuiFluidGauge extends GuiGauge { if(xAxis >= xLocation + 1 && xAxis <= xLocation + width - 1 && yAxis >= yLocation + 1 && yAxis <= yLocation + height - 1) { - ItemStack stack = mc.thePlayer.inventory.getItemStack(); + ItemStack stack = mc.player.inventory.getItemStack(); - if(guiObj instanceof GuiMekanism && stack != null && stack.getItem() instanceof ItemGaugeDropper) + if(guiObj instanceof GuiMekanism && !stack.isEmpty() && stack.getItem() instanceof ItemGaugeDropper) { TileEntity tile = ((GuiMekanism)guiObj).getTileEntity(); diff --git a/src/main/java/mekanism/client/gui/element/GuiGasGauge.java b/src/main/java/mekanism/client/gui/element/GuiGasGauge.java index c7eed7461..e0b67fb96 100644 --- a/src/main/java/mekanism/client/gui/element/GuiGasGauge.java +++ b/src/main/java/mekanism/client/gui/element/GuiGasGauge.java @@ -50,9 +50,9 @@ public class GuiGasGauge extends GuiGauge { if(xAxis >= xLocation + 1 && xAxis <= xLocation + width - 1 && yAxis >= yLocation + 1 && yAxis <= yLocation + height - 1) { - ItemStack stack = mc.thePlayer.inventory.getItemStack(); + ItemStack stack = mc.player.inventory.getItemStack(); - if(guiObj instanceof GuiMekanism && stack != null && stack.getItem() instanceof ItemGaugeDropper) + if(guiObj instanceof GuiMekanism && !stack.isEmpty() && stack.getItem() instanceof ItemGaugeDropper) { TileEntity tile = ((GuiMekanism)guiObj).getTileEntity(); diff --git a/src/main/java/mekanism/client/gui/element/GuiGauge.java b/src/main/java/mekanism/client/gui/element/GuiGauge.java index 4baa040c2..b87a17c10 100644 --- a/src/main/java/mekanism/client/gui/element/GuiGauge.java +++ b/src/main/java/mekanism/client/gui/element/GuiGauge.java @@ -131,9 +131,9 @@ public abstract class GuiGauge extends GuiElement { if(xAxis >= xLocation + 1 && xAxis <= xLocation + width - 1 && yAxis >= yLocation + 1 && yAxis <= yLocation + height - 1) { - ItemStack stack = mc.thePlayer.inventory.getItemStack(); + ItemStack stack = mc.player.inventory.getItemStack(); - if(stack != null && stack.getItem() instanceof ItemConfigurator && color != null) + if(!stack.isEmpty() && stack.getItem() instanceof ItemConfigurator && color != null) { if(guiObj instanceof GuiMekanism && ((GuiMekanism)guiObj).getTileEntity() != null) { diff --git a/src/main/java/mekanism/client/gui/element/GuiHeatInfo.java b/src/main/java/mekanism/client/gui/element/GuiHeatInfo.java index 83657dcea..48dbab9b7 100644 --- a/src/main/java/mekanism/client/gui/element/GuiHeatInfo.java +++ b/src/main/java/mekanism/client/gui/element/GuiHeatInfo.java @@ -3,12 +3,12 @@ package mekanism.client.gui.element; import java.util.ArrayList; import java.util.List; -import mekanism.api.MekanismConfig.general; -import mekanism.api.util.UnitDisplayUtils.TempType; import mekanism.client.gui.IGuiWrapper; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; +import mekanism.common.util.UnitDisplayUtils.TempType; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/mekanism/client/gui/element/GuiScrollList.java b/src/main/java/mekanism/client/gui/element/GuiScrollList.java index 57f666b16..8fc599681 100644 --- a/src/main/java/mekanism/client/gui/element/GuiScrollList.java +++ b/src/main/java/mekanism/client/gui/element/GuiScrollList.java @@ -244,4 +244,16 @@ public class GuiScrollList extends GuiElement } } } + + @Override + public void mouseWheel(int x, int y, int delta) + { + super.mouseWheel(x, y, delta); + + if(x > xPosition && x < xPosition+xSize && y > yPosition && y < yPosition+size*10) + { + scroll = Math.min(Math.max(scroll - (delta / 120F) * (1F / textEntries.size()), 0), 1); // 120 = DirectInput factor for one notch. Linux/OSX LWGL scale accordingly + drawScroll(); + } + } } diff --git a/src/main/java/mekanism/client/gui/element/GuiSecurityTab.java b/src/main/java/mekanism/client/gui/element/GuiSecurityTab.java index f650a52a1..69f46c2ea 100644 --- a/src/main/java/mekanism/client/gui/element/GuiSecurityTab.java +++ b/src/main/java/mekanism/client/gui/element/GuiSecurityTab.java @@ -1,13 +1,14 @@ package mekanism.client.gui.element; +import java.util.UUID; + import mekanism.api.Coord4D; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.general; -import mekanism.api.util.ListUtils; import mekanism.client.MekanismClient; import mekanism.client.gui.IGuiWrapper; import mekanism.client.sound.SoundHandler; import mekanism.common.Mekanism; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.network.PacketSecurityMode.SecurityModeMessage; import mekanism.common.security.ISecurityItem; import mekanism.common.security.ISecurityTile; @@ -15,6 +16,7 @@ import mekanism.common.security.ISecurityTile.SecurityMode; import mekanism.common.security.SecurityData; import mekanism.common.security.SecurityFrequency; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.common.util.SecurityUtils; @@ -72,8 +74,7 @@ public class GuiSecurityTab extends GuiElement int renderX = 26 + (18*mode.ordinal()); - if(getOwner() != null && getOwner().equals(mc.thePlayer.getName()) && - (data == null || !data.override)) + if(getOwner() != null && getOwner().equals(mc.player.getUniqueID()) && (data == null || !data.override)) { if(xAxis >= 179 && xAxis <= 197 && yAxis >= 36 && yAxis <= 54) { @@ -99,7 +100,7 @@ public class GuiSecurityTab extends GuiElement { String securityDisplay = isItem ? SecurityUtils.getSecurityDisplay(getItem(), Side.CLIENT) : SecurityUtils.getSecurityDisplay(tileEntity, Side.CLIENT); String securityText = EnumColor.GREY + LangUtils.localize("gui.security") + ": " + securityDisplay; - String ownerText = SecurityUtils.getOwnerDisplay(mc.thePlayer.getName(), getOwner()); + String ownerText = SecurityUtils.getOwnerDisplay(mc.player, getOwnerUsername()); String overrideText = EnumColor.RED + "(" + LangUtils.localize("gui.overridden") + ")"; if(isItem ? SecurityUtils.isOverridden(getItem(), Side.CLIENT) : SecurityUtils.isOverridden(tileEntity, Side.CLIENT)) @@ -118,9 +119,9 @@ public class GuiSecurityTab extends GuiElement { if(isItem) { - if(getItem() == null || !(getItem().getItem() instanceof ISecurityItem)) + if(getItem().isEmpty() || !(getItem().getItem() instanceof ISecurityItem)) { - mc.thePlayer.closeScreen(); + mc.player.closeScreen(); return null; } @@ -133,14 +134,16 @@ public class GuiSecurityTab extends GuiElement private SecurityMode getSecurity() { - if(!general.allowProtection) { + if(!general.allowProtection) + { return SecurityMode.PUBLIC; } + if(isItem) { - if(getItem() == null || !(getItem().getItem() instanceof ISecurityItem)) + if(getItem().isEmpty() || !(getItem().getItem() instanceof ISecurityItem)) { - mc.thePlayer.closeScreen(); + mc.player.closeScreen(); return SecurityMode.PUBLIC; } @@ -151,26 +154,43 @@ public class GuiSecurityTab extends GuiElement } } - private String getOwner() + private UUID getOwner() { if(isItem) { - if(getItem() == null || !(getItem().getItem() instanceof ISecurityItem)) + if(getItem().isEmpty() || !(getItem().getItem() instanceof ISecurityItem)) { - mc.thePlayer.closeScreen(); + mc.player.closeScreen(); return null; } - return ((ISecurityItem)getItem().getItem()).getOwner(getItem()); + return ((ISecurityItem)getItem().getItem()).getOwnerUUID(getItem()); } else { - return ((ISecurityTile)tileEntity).getSecurity().getOwner(); + return ((ISecurityTile)tileEntity).getSecurity().getOwnerUUID(); + } + } + + private String getOwnerUsername() + { + if(isItem) + { + if(getItem().isEmpty() || !(getItem().getItem() instanceof ISecurityItem)) + { + mc.player.closeScreen(); + return null; + } + + return MekanismClient.clientUUIDMap.get(((ISecurityItem)getItem().getItem()).getOwnerUUID(getItem())); + } + else { + return ((ISecurityTile)tileEntity).getSecurity().getClientOwner(); } } private ItemStack getItem() { - return mc.thePlayer.getHeldItem(currentHand); + return mc.player.getHeldItem(currentHand); } @Override @@ -181,7 +201,7 @@ public class GuiSecurityTab extends GuiElement { if(button == 0 && general.allowProtection) { - if(getOwner() != null && mc.thePlayer.getName().equals(getOwner())) + if(getOwner() != null && mc.player.getUniqueID().equals(getOwner())) { if(xAxis >= 179 && xAxis <= 197 && yAxis >= 36 && yAxis <= 54) { diff --git a/src/main/java/mekanism/client/jei/BaseRecipeCategory.java b/src/main/java/mekanism/client/jei/BaseRecipeCategory.java index ebf8eb421..dd8cf05e1 100644 --- a/src/main/java/mekanism/client/jei/BaseRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/BaseRecipeCategory.java @@ -1,5 +1,6 @@ package mekanism.client.jei; +import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -11,6 +12,7 @@ import mekanism.client.gui.element.GuiProgress.ProgressBar; import mekanism.client.render.MekanismRenderer; import mekanism.client.render.MekanismRenderer.FluidType; import mekanism.common.util.LangUtils; +import mezz.jei.api.gui.IDrawable; import mezz.jei.api.recipe.IRecipeCategory; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -72,9 +74,6 @@ public abstract class BaseRecipeCategory implements IRecipeCategory, IGuiWrapper e.renderBackground(0, 0, -xOffset, -yOffset); } } - - @Override - public void drawAnimations(Minecraft minecraft) {} @Override public void drawTexturedRect(int x, int y, int u, int v, int w, int h) @@ -172,4 +171,16 @@ public abstract class BaseRecipeCategory implements IRecipeCategory, IGuiWrapper public void addGuiElements() {} public static class GuiDummy extends Gui {} + + @Override + public IDrawable getIcon() + { + return null; + } + + @Override + public List getTooltipStrings(int mouseX, int mouseY) + { + return Collections.emptyList(); + } } diff --git a/src/main/java/mekanism/client/jei/GasStackHelper.java b/src/main/java/mekanism/client/jei/GasStackHelper.java new file mode 100644 index 000000000..8ba323008 --- /dev/null +++ b/src/main/java/mekanism/client/jei/GasStackHelper.java @@ -0,0 +1,94 @@ +package mekanism.client.jei; + +import java.awt.Color; +import java.util.Collections; +import java.util.List; + +import javax.annotation.Nullable; + +import mekanism.api.gas.Gas; +import mekanism.api.gas.GasStack; +import mezz.jei.api.ingredients.IIngredientHelper; +import net.minecraft.item.ItemStack; + +import com.google.common.base.Objects; + +public class GasStackHelper implements IIngredientHelper +{ + @Override + public List expandSubtypes(List contained) + { + return contained; + } + + @Override + @Nullable + public GasStack getMatch(Iterable ingredients, GasStack toMatch) + { + for(GasStack stack : ingredients) + { + if(toMatch.getGas() == stack.getGas()) + { + return stack; + } + } + + return null; + } + + @Override + public String getDisplayName(GasStack ingredient) + { + return ingredient.getGas().getLocalizedName(); + } + + @Override + public String getUniqueId(GasStack ingredient) + { + return "gas:" + ingredient.getGas().getName(); + } + + @Override + public String getWildcardId(GasStack ingredient) + { + return getUniqueId(ingredient); + } + + @Override + public String getModId(GasStack ingredient) + { + return ingredient.getGas().getIcon().getResourceDomain(); + } + + @Override + public Iterable getColors(GasStack ingredient) + { + return Collections.emptyList(); + } + + @Override + public ItemStack cheatIngredient(GasStack ingredient, boolean fullStack) + { + return ItemStack.EMPTY; + } + + @Override + public String getErrorInfo(GasStack ingredient) + { + Objects.ToStringHelper toStringHelper = Objects.toStringHelper(GasStack.class); + + Gas gas = ingredient.getGas(); + + if(gas != null) + { + toStringHelper.add("Gas", gas.getLocalizedName()); + } + else { + toStringHelper.add("Gas", "null"); + } + + toStringHelper.add("Amount", ingredient.amount); + + return toStringHelper.toString(); + } +} diff --git a/src/main/java/mekanism/client/jei/GuiElementHandler.java b/src/main/java/mekanism/client/jei/GuiElementHandler.java index b6e1bb9ed..8b260b442 100644 --- a/src/main/java/mekanism/client/jei/GuiElementHandler.java +++ b/src/main/java/mekanism/client/jei/GuiElementHandler.java @@ -36,4 +36,10 @@ public class GuiElementHandler implements IAdvancedGuiHandler return null; } + + @Override + public Object getIngredientUnderMouse(GuiContainer guiContainer, int mouseX, int mouseY) + { + return null; + } } diff --git a/src/main/java/mekanism/client/jei/MekanismJEI.java b/src/main/java/mekanism/client/jei/MekanismJEI.java index 62fd80d55..1001a6ac3 100644 --- a/src/main/java/mekanism/client/jei/MekanismJEI.java +++ b/src/main/java/mekanism/client/jei/MekanismJEI.java @@ -2,9 +2,11 @@ package mekanism.client.jei; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; +import mekanism.api.gas.GasStack; import mekanism.client.gui.GuiChemicalCrystallizer; import mekanism.client.gui.GuiChemicalDissolutionChamber; import mekanism.client.gui.GuiChemicalInfuser; @@ -26,61 +28,42 @@ import mekanism.client.gui.GuiThermalEvaporationController; import mekanism.client.gui.element.GuiProgress.ProgressBar; import mekanism.client.jei.crafting.ShapedMekanismRecipeHandler; import mekanism.client.jei.crafting.ShapelessMekanismRecipeHandler; +import mekanism.client.jei.gas.GasStackRenderer; import mekanism.client.jei.machine.AdvancedMachineRecipeCategory; -import mekanism.client.jei.machine.AdvancedMachineRecipeHandler; import mekanism.client.jei.machine.AdvancedMachineRecipeWrapper; +import mekanism.client.jei.machine.BaseRecipeHandler; import mekanism.client.jei.machine.ChanceMachineRecipeCategory; -import mekanism.client.jei.machine.ChanceMachineRecipeHandler; import mekanism.client.jei.machine.ChanceMachineRecipeWrapper; import mekanism.client.jei.machine.MachineRecipeCategory; -import mekanism.client.jei.machine.MachineRecipeHandler; import mekanism.client.jei.machine.MachineRecipeWrapper; -import mekanism.client.jei.machine.advanced.ChemicalInjectionChamberRecipeHandler; import mekanism.client.jei.machine.advanced.ChemicalInjectionChamberRecipeWrapper; -import mekanism.client.jei.machine.advanced.CombinerRecipeHandler; import mekanism.client.jei.machine.advanced.CombinerRecipeWrapper; -import mekanism.client.jei.machine.advanced.OsmiumCompressorRecipeHandler; import mekanism.client.jei.machine.advanced.OsmiumCompressorRecipeWrapper; -import mekanism.client.jei.machine.advanced.PurificationChamberRecipeHandler; import mekanism.client.jei.machine.advanced.PurificationChamberRecipeWrapper; -import mekanism.client.jei.machine.basic.CrusherRecipeHandler; import mekanism.client.jei.machine.basic.CrusherRecipeWrapper; -import mekanism.client.jei.machine.basic.EnrichmentRecipeHandler; import mekanism.client.jei.machine.basic.EnrichmentRecipeWrapper; -import mekanism.client.jei.machine.chance.PrecisionSawmillRecipeHandler; import mekanism.client.jei.machine.chance.PrecisionSawmillRecipeWrapper; import mekanism.client.jei.machine.chemical.ChemicalCrystallizerRecipeCategory; -import mekanism.client.jei.machine.chemical.ChemicalCrystallizerRecipeHandler; import mekanism.client.jei.machine.chemical.ChemicalCrystallizerRecipeWrapper; import mekanism.client.jei.machine.chemical.ChemicalDissolutionChamberRecipeCategory; -import mekanism.client.jei.machine.chemical.ChemicalDissolutionChamberRecipeHandler; import mekanism.client.jei.machine.chemical.ChemicalDissolutionChamberRecipeWrapper; import mekanism.client.jei.machine.chemical.ChemicalInfuserRecipeCategory; -import mekanism.client.jei.machine.chemical.ChemicalInfuserRecipeHandler; import mekanism.client.jei.machine.chemical.ChemicalInfuserRecipeWrapper; import mekanism.client.jei.machine.chemical.ChemicalOxidizerRecipeCategory; -import mekanism.client.jei.machine.chemical.ChemicalOxidizerRecipeHandler; import mekanism.client.jei.machine.chemical.ChemicalOxidizerRecipeWrapper; import mekanism.client.jei.machine.chemical.ChemicalWasherRecipeCategory; -import mekanism.client.jei.machine.chemical.ChemicalWasherRecipeHandler; import mekanism.client.jei.machine.chemical.ChemicalWasherRecipeWrapper; import mekanism.client.jei.machine.other.ElectrolyticSeparatorRecipeCategory; -import mekanism.client.jei.machine.other.ElectrolyticSeparatorRecipeHandler; import mekanism.client.jei.machine.other.ElectrolyticSeparatorRecipeWrapper; import mekanism.client.jei.machine.other.MetallurgicInfuserRecipeCategory; -import mekanism.client.jei.machine.other.MetallurgicInfuserRecipeHandler; import mekanism.client.jei.machine.other.MetallurgicInfuserRecipeWrapper; import mekanism.client.jei.machine.other.PRCRecipeCategory; -import mekanism.client.jei.machine.other.PRCRecipeHandler; import mekanism.client.jei.machine.other.PRCRecipeWrapper; import mekanism.client.jei.machine.other.RotaryCondensentratorRecipeCategory; -import mekanism.client.jei.machine.other.RotaryCondensentratorRecipeHandler; import mekanism.client.jei.machine.other.RotaryCondensentratorRecipeWrapper; import mekanism.client.jei.machine.other.SolarNeutronRecipeCategory; -import mekanism.client.jei.machine.other.SolarNeutronRecipeHandler; import mekanism.client.jei.machine.other.SolarNeutronRecipeWrapper; import mekanism.client.jei.machine.other.ThermalEvaporationRecipeCategory; -import mekanism.client.jei.machine.other.ThermalEvaporationRecipeHandler; import mekanism.client.jei.machine.other.ThermalEvaporationRecipeWrapper; import mekanism.common.MekanismBlocks; import mekanism.common.MekanismItems; @@ -104,19 +87,20 @@ import mekanism.common.recipe.machines.SeparatorRecipe; import mekanism.common.recipe.machines.SolarNeutronRecipe; import mekanism.common.recipe.machines.ThermalEvaporationRecipe; import mekanism.common.recipe.machines.WasherRecipe; -import mekanism.common.util.ItemDataUtils; -import mezz.jei.api.IJeiRuntime; -import mezz.jei.api.IModPlugin; +import mezz.jei.api.BlankModPlugin; import mezz.jei.api.IModRegistry; +import mezz.jei.api.ISubtypeRegistry; import mezz.jei.api.ISubtypeRegistry.ISubtypeInterpreter; import mezz.jei.api.JEIPlugin; +import mezz.jei.api.ingredients.IModIngredientRegistration; import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; @JEIPlugin -public class MekanismJEI implements IModPlugin +public class MekanismJEI extends BlankModPlugin { public static ISubtypeInterpreter NBT_INTERPRETER = new ISubtypeInterpreter() { @Override @@ -138,85 +122,97 @@ public class MekanismJEI implements IModPlugin } }; + @Override + public void registerItemSubtypes(ISubtypeRegistry registry) + { + registry.registerSubtypeInterpreter(Item.getItemFromBlock(MekanismBlocks.EnergyCube), NBT_INTERPRETER); + registry.registerSubtypeInterpreter(Item.getItemFromBlock(MekanismBlocks.MachineBlock), NBT_INTERPRETER); + registry.registerSubtypeInterpreter(Item.getItemFromBlock(MekanismBlocks.MachineBlock2), NBT_INTERPRETER); + registry.registerSubtypeInterpreter(Item.getItemFromBlock(MekanismBlocks.MachineBlock3), NBT_INTERPRETER); + registry.registerSubtypeInterpreter(Item.getItemFromBlock(MekanismBlocks.BasicBlock), NBT_INTERPRETER); + registry.registerSubtypeInterpreter(Item.getItemFromBlock(MekanismBlocks.BasicBlock2), NBT_INTERPRETER); + registry.registerSubtypeInterpreter(Item.getItemFromBlock(MekanismBlocks.GasTank), NBT_INTERPRETER); + registry.registerSubtypeInterpreter(Item.getItemFromBlock(MekanismBlocks.CardboardBox), NBT_INTERPRETER); + registry.registerSubtypeInterpreter(Item.getItemFromBlock(MekanismBlocks.Transmitter), NBT_INTERPRETER); + } + + @Override + public void registerIngredients(IModIngredientRegistration registry) + { + List list = GasRegistry.getRegisteredGasses().stream().filter(g -> g.isVisible()).map(g -> new GasStack(g, Fluid.BUCKET_VOLUME)).collect(Collectors.toList()); + registry.register(GasStack.class, list, new GasStackHelper(), new GasStackRenderer()); + } + @Override public void register(IModRegistry registry) { registry.addAdvancedGuiHandlers(new GuiElementHandler()); - registry.addRecipeHandlers(new ShapedMekanismRecipeHandler()); - registry.addRecipeHandlers(new ShapelessMekanismRecipeHandler()); + registry.addRecipeHandlers(new ShapedMekanismRecipeHandler(registry.getJeiHelpers())); + registry.addRecipeHandlers(new ShapelessMekanismRecipeHandler(registry.getJeiHelpers())); - registry.getJeiHelpers().getItemBlacklist().addItemToBlacklist(new ItemStack(MekanismItems.ItemProxy)); - registry.getJeiHelpers().getItemBlacklist().addItemToBlacklist(new ItemStack(MekanismBlocks.BoundingBlock)); - - registry.getJeiHelpers().getSubtypeRegistry().registerNbtInterpreter(Item.getItemFromBlock(MekanismBlocks.EnergyCube), NBT_INTERPRETER); - registry.getJeiHelpers().getSubtypeRegistry().registerNbtInterpreter(Item.getItemFromBlock(MekanismBlocks.MachineBlock), NBT_INTERPRETER); - registry.getJeiHelpers().getSubtypeRegistry().registerNbtInterpreter(Item.getItemFromBlock(MekanismBlocks.MachineBlock2), NBT_INTERPRETER); - registry.getJeiHelpers().getSubtypeRegistry().registerNbtInterpreter(Item.getItemFromBlock(MekanismBlocks.MachineBlock3), NBT_INTERPRETER); - registry.getJeiHelpers().getSubtypeRegistry().registerNbtInterpreter(Item.getItemFromBlock(MekanismBlocks.BasicBlock), NBT_INTERPRETER); - registry.getJeiHelpers().getSubtypeRegistry().registerNbtInterpreter(Item.getItemFromBlock(MekanismBlocks.BasicBlock2), NBT_INTERPRETER); - registry.getJeiHelpers().getSubtypeRegistry().registerNbtInterpreter(Item.getItemFromBlock(MekanismBlocks.GasTank), NBT_INTERPRETER); - registry.getJeiHelpers().getSubtypeRegistry().registerNbtInterpreter(Item.getItemFromBlock(MekanismBlocks.CardboardBox), NBT_INTERPRETER); + registry.getJeiHelpers().getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(MekanismItems.ItemProxy)); + registry.getJeiHelpers().getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(MekanismBlocks.BoundingBlock)); try { - registerBasicMachine(registry, Recipe.ENRICHMENT_CHAMBER, "tile.MachineBlock.EnrichmentChamber.name", ProgressBar.BLUE, EnrichmentRecipeHandler.class, EnrichmentRecipeWrapper.class); - registerBasicMachine(registry, Recipe.CRUSHER, "tile.MachineBlock.Crusher.name", ProgressBar.CRUSH, CrusherRecipeHandler.class, CrusherRecipeWrapper.class); + registerBasicMachine(registry, Recipe.ENRICHMENT_CHAMBER, "tile.MachineBlock.EnrichmentChamber.name", ProgressBar.BLUE, EnrichmentRecipeWrapper.class); + registerBasicMachine(registry, Recipe.CRUSHER, "tile.MachineBlock.Crusher.name", ProgressBar.CRUSH, CrusherRecipeWrapper.class); - registerAdvancedMachine(registry, Recipe.COMBINER, "tile.MachineBlock.Combiner.name", ProgressBar.STONE, CombinerRecipeHandler.class, CombinerRecipeWrapper.class); - registerAdvancedMachine(registry, Recipe.PURIFICATION_CHAMBER, "tile.MachineBlock.PurificationChamber.name", ProgressBar.RED, PurificationChamberRecipeHandler.class, PurificationChamberRecipeWrapper.class); - registerAdvancedMachine(registry, Recipe.OSMIUM_COMPRESSOR, "tile.MachineBlock.OsmiumCompressor.name", ProgressBar.RED, OsmiumCompressorRecipeHandler.class, OsmiumCompressorRecipeWrapper.class); - registerAdvancedMachine(registry, Recipe.CHEMICAL_INJECTION_CHAMBER, "nei.chemicalInjectionChamber", ProgressBar.YELLOW, ChemicalInjectionChamberRecipeHandler.class, ChemicalInjectionChamberRecipeWrapper.class); + registerAdvancedMachine(registry, Recipe.COMBINER, "tile.MachineBlock.Combiner.name", ProgressBar.STONE, CombinerRecipeWrapper.class); + registerAdvancedMachine(registry, Recipe.PURIFICATION_CHAMBER, "tile.MachineBlock.PurificationChamber.name", ProgressBar.RED, PurificationChamberRecipeWrapper.class); + registerAdvancedMachine(registry, Recipe.OSMIUM_COMPRESSOR, "tile.MachineBlock.OsmiumCompressor.name", ProgressBar.RED, OsmiumCompressorRecipeWrapper.class); + registerAdvancedMachine(registry, Recipe.CHEMICAL_INJECTION_CHAMBER, "nei.chemicalInjectionChamber", ProgressBar.YELLOW, ChemicalInjectionChamberRecipeWrapper.class); - registerChanceMachine(registry, Recipe.PRECISION_SAWMILL, "tile.MachineBlock2.PrecisionSawmill.name", ProgressBar.PURPLE, PrecisionSawmillRecipeHandler.class, PrecisionSawmillRecipeWrapper.class); + registerChanceMachine(registry, Recipe.PRECISION_SAWMILL, "tile.MachineBlock2.PrecisionSawmill.name", ProgressBar.PURPLE, PrecisionSawmillRecipeWrapper.class); MetallurgicInfuserRecipeCategory metallurgicInfuserCategory = new MetallurgicInfuserRecipeCategory(registry.getJeiHelpers().getGuiHelper()); registry.addRecipeCategories(metallurgicInfuserCategory); - registry.addRecipeHandlers(new MetallurgicInfuserRecipeHandler(metallurgicInfuserCategory)); + registry.addRecipeHandlers(new BaseRecipeHandler(metallurgicInfuserCategory, MetallurgicInfuserRecipeWrapper.class)); addRecipes(registry, Recipe.METALLURGIC_INFUSER, metallurgicInfuserCategory, MetallurgicInfuserRecipe.class, MetallurgicInfuserRecipeCategory.class, MetallurgicInfuserRecipeWrapper.class); ChemicalCrystallizerRecipeCategory chemicalCrystallizerCategory = new ChemicalCrystallizerRecipeCategory(registry.getJeiHelpers().getGuiHelper()); registry.addRecipeCategories(chemicalCrystallizerCategory); - registry.addRecipeHandlers(new ChemicalCrystallizerRecipeHandler(chemicalCrystallizerCategory)); + registry.addRecipeHandlers(new BaseRecipeHandler(chemicalCrystallizerCategory, ChemicalCrystallizerRecipeWrapper.class)); addRecipes(registry, Recipe.CHEMICAL_CRYSTALLIZER, chemicalCrystallizerCategory, CrystallizerRecipe.class, ChemicalCrystallizerRecipeCategory.class, ChemicalCrystallizerRecipeWrapper.class); ChemicalDissolutionChamberRecipeCategory chemicalDissolutionChamberCategory = new ChemicalDissolutionChamberRecipeCategory(registry.getJeiHelpers().getGuiHelper()); registry.addRecipeCategories(chemicalDissolutionChamberCategory); - registry.addRecipeHandlers(new ChemicalDissolutionChamberRecipeHandler(chemicalDissolutionChamberCategory)); + registry.addRecipeHandlers(new BaseRecipeHandler(chemicalDissolutionChamberCategory, ChemicalDissolutionChamberRecipeWrapper.class)); addRecipes(registry, Recipe.CHEMICAL_DISSOLUTION_CHAMBER, chemicalDissolutionChamberCategory, DissolutionRecipe.class, ChemicalDissolutionChamberRecipeCategory.class, ChemicalDissolutionChamberRecipeWrapper.class); ChemicalInfuserRecipeCategory chemicalInfuserCategory = new ChemicalInfuserRecipeCategory(registry.getJeiHelpers().getGuiHelper()); registry.addRecipeCategories(chemicalInfuserCategory); - registry.addRecipeHandlers(new ChemicalInfuserRecipeHandler(chemicalInfuserCategory)); + registry.addRecipeHandlers(new BaseRecipeHandler(chemicalInfuserCategory, ChemicalInfuserRecipeWrapper.class)); addRecipes(registry, Recipe.CHEMICAL_INFUSER, chemicalInfuserCategory, ChemicalInfuserRecipe.class, ChemicalInfuserRecipeCategory.class, ChemicalInfuserRecipeWrapper.class); ChemicalOxidizerRecipeCategory chemicalOxidizerCategory = new ChemicalOxidizerRecipeCategory(registry.getJeiHelpers().getGuiHelper()); registry.addRecipeCategories(chemicalOxidizerCategory); - registry.addRecipeHandlers(new ChemicalOxidizerRecipeHandler(chemicalOxidizerCategory)); + registry.addRecipeHandlers(new BaseRecipeHandler(chemicalOxidizerCategory, ChemicalOxidizerRecipeWrapper.class)); addRecipes(registry, Recipe.CHEMICAL_OXIDIZER, chemicalOxidizerCategory, OxidationRecipe.class, ChemicalOxidizerRecipeCategory.class, ChemicalOxidizerRecipeWrapper.class); ChemicalWasherRecipeCategory chemicalWasherCategory = new ChemicalWasherRecipeCategory(registry.getJeiHelpers().getGuiHelper()); registry.addRecipeCategories(chemicalWasherCategory); - registry.addRecipeHandlers(new ChemicalWasherRecipeHandler(chemicalWasherCategory)); + registry.addRecipeHandlers(new BaseRecipeHandler(chemicalWasherCategory, ChemicalWasherRecipeWrapper.class)); addRecipes(registry, Recipe.CHEMICAL_WASHER, chemicalWasherCategory, WasherRecipe.class, ChemicalWasherRecipeCategory.class, ChemicalWasherRecipeWrapper.class); SolarNeutronRecipeCategory solarNeutronCategory = new SolarNeutronRecipeCategory(registry.getJeiHelpers().getGuiHelper()); registry.addRecipeCategories(solarNeutronCategory); - registry.addRecipeHandlers(new SolarNeutronRecipeHandler(solarNeutronCategory)); + registry.addRecipeHandlers(new BaseRecipeHandler(solarNeutronCategory, SolarNeutronRecipeWrapper.class)); addRecipes(registry, Recipe.SOLAR_NEUTRON_ACTIVATOR, solarNeutronCategory, SolarNeutronRecipe.class, SolarNeutronRecipeCategory.class, SolarNeutronRecipeWrapper.class); ElectrolyticSeparatorRecipeCategory electrolyticSeparatorCategory = new ElectrolyticSeparatorRecipeCategory(registry.getJeiHelpers().getGuiHelper()); registry.addRecipeCategories(electrolyticSeparatorCategory); - registry.addRecipeHandlers(new ElectrolyticSeparatorRecipeHandler(electrolyticSeparatorCategory)); + registry.addRecipeHandlers(new BaseRecipeHandler(electrolyticSeparatorCategory, ElectrolyticSeparatorRecipeWrapper.class)); addRecipes(registry, Recipe.ELECTROLYTIC_SEPARATOR, electrolyticSeparatorCategory, SeparatorRecipe.class, ElectrolyticSeparatorRecipeCategory.class, ElectrolyticSeparatorRecipeWrapper.class); ThermalEvaporationRecipeCategory thermalEvaporationCategory = new ThermalEvaporationRecipeCategory(registry.getJeiHelpers().getGuiHelper()); registry.addRecipeCategories(thermalEvaporationCategory); - registry.addRecipeHandlers(new ThermalEvaporationRecipeHandler(thermalEvaporationCategory)); + registry.addRecipeHandlers(new BaseRecipeHandler(thermalEvaporationCategory, ThermalEvaporationRecipeWrapper.class)); addRecipes(registry, Recipe.THERMAL_EVAPORATION_PLANT, thermalEvaporationCategory, ThermalEvaporationRecipe.class, ThermalEvaporationRecipeCategory.class, ThermalEvaporationRecipeWrapper.class); PRCRecipeCategory prcCategory = new PRCRecipeCategory(registry.getJeiHelpers().getGuiHelper()); registry.addRecipeCategories(prcCategory); - registry.addRecipeHandlers(new PRCRecipeHandler(prcCategory)); + registry.addRecipeHandlers(new BaseRecipeHandler(prcCategory, PRCRecipeWrapper.class)); addRecipes(registry, Recipe.PRESSURIZED_REACTION_CHAMBER, prcCategory, PressurizedRecipe.class, PRCRecipeCategory.class, PRCRecipeWrapper.class); } catch(Exception e) { e.printStackTrace(); @@ -226,7 +222,7 @@ public class MekanismJEI implements IModPlugin RotaryCondensentratorRecipeCategory rotaryCondensentratorCategory = new RotaryCondensentratorRecipeCategory(registry.getJeiHelpers().getGuiHelper()); registry.addRecipeCategories(rotaryCondensentratorCategory); - registry.addRecipeHandlers(new RotaryCondensentratorRecipeHandler(rotaryCondensentratorCategory)); + registry.addRecipeHandlers(new BaseRecipeHandler(rotaryCondensentratorCategory, RotaryCondensentratorRecipeWrapper.class)); for(Gas gas : GasRegistry.getRegisteredGasses()) { @@ -285,32 +281,32 @@ public class MekanismJEI implements IModPlugin registry.addRecipeCategoryCraftingItem(type.getStack(), "mekanism." + type.getName()); } - private void registerBasicMachine(IModRegistry registry, Recipe recipe, String unlocalized, ProgressBar bar, Class handler, Class wrapper) throws Exception + private void registerBasicMachine(IModRegistry registry, Recipe recipe, String unlocalized, ProgressBar bar, Class wrapper) throws Exception { MachineRecipeCategory category = new MachineRecipeCategory(registry.getJeiHelpers().getGuiHelper(), recipe.name().toLowerCase(), unlocalized, bar); registry.addRecipeCategories(category); - registry.addRecipeHandlers(handler.getConstructor(MachineRecipeCategory.class).newInstance(category)); + registry.addRecipeHandlers(new BaseRecipeHandler(category, wrapper)); addRecipes(registry, recipe, category, BasicMachineRecipe.class, MachineRecipeCategory.class, wrapper); } - private void registerAdvancedMachine(IModRegistry registry, Recipe recipe, String unlocalized, ProgressBar bar, Class handler, Class wrapper) throws Exception + private void registerAdvancedMachine(IModRegistry registry, Recipe recipe, String unlocalized, ProgressBar bar, Class wrapper) throws Exception { AdvancedMachineRecipeCategory category = new AdvancedMachineRecipeCategory(registry.getJeiHelpers().getGuiHelper(), recipe.name().toLowerCase(), unlocalized, bar); registry.addRecipeCategories(category); - registry.addRecipeHandlers(handler.getConstructor(AdvancedMachineRecipeCategory.class).newInstance(category)); + registry.addRecipeHandlers(new BaseRecipeHandler(category, wrapper)); addRecipes(registry, recipe, category, AdvancedMachineRecipe.class, AdvancedMachineRecipeCategory.class, wrapper); } - private void registerChanceMachine(IModRegistry registry, Recipe recipe, String unlocalized, ProgressBar bar, Class handler, Class wrapper) throws Exception + private void registerChanceMachine(IModRegistry registry, Recipe recipe, String unlocalized, ProgressBar bar, Class wrapper) throws Exception { ChanceMachineRecipeCategory category = new ChanceMachineRecipeCategory(registry.getJeiHelpers().getGuiHelper(), recipe.name().toLowerCase(), unlocalized, bar); registry.addRecipeCategories(category); - registry.addRecipeHandlers(handler.getConstructor(ChanceMachineRecipeCategory.class).newInstance(category)); + registry.addRecipeHandlers(new BaseRecipeHandler(category, wrapper)); addRecipes(registry, recipe, category, ChanceMachineRecipe.class, ChanceMachineRecipeCategory.class, wrapper); } @@ -329,7 +325,4 @@ public class MekanismJEI implements IModPlugin registry.addRecipes(recipes); } - - @Override - public void onRuntimeAvailable(IJeiRuntime runtime) {} } diff --git a/src/main/java/mekanism/client/jei/crafting/ShapedMekanismRecipeHandler.java b/src/main/java/mekanism/client/jei/crafting/ShapedMekanismRecipeHandler.java index ce3918257..e00fa6099 100644 --- a/src/main/java/mekanism/client/jei/crafting/ShapedMekanismRecipeHandler.java +++ b/src/main/java/mekanism/client/jei/crafting/ShapedMekanismRecipeHandler.java @@ -1,18 +1,20 @@ package mekanism.client.jei.crafting; import mekanism.common.recipe.ShapedMekanismRecipe; +import mezz.jei.api.IJeiHelpers; import mezz.jei.api.recipe.IRecipeHandler; import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.VanillaRecipeCategoryUid; public class ShapedMekanismRecipeHandler implements IRecipeHandler { - @Override - public String getRecipeCategoryUid() + private final IJeiHelpers jeiHelpers; + + public ShapedMekanismRecipeHandler(IJeiHelpers helpers) { - return VanillaRecipeCategoryUid.CRAFTING; + jeiHelpers = helpers; } - + @Override public Class getRecipeClass() { @@ -22,7 +24,7 @@ public class ShapedMekanismRecipeHandler implements IRecipeHandler getOutputs() - { - return Collections.singletonList(recipe.getRecipeOutput()); + List> inputs = stackHelper.expandRecipeItemStackInputs(Arrays.asList(recipe.getInput())); + ingredients.setInputLists(ItemStack.class, inputs); + ingredients.setOutput(ItemStack.class, recipeOutput); } @Override diff --git a/src/main/java/mekanism/client/jei/crafting/ShapelessMekanismRecipeHandler.java b/src/main/java/mekanism/client/jei/crafting/ShapelessMekanismRecipeHandler.java index bd1f4692a..e89c19be7 100644 --- a/src/main/java/mekanism/client/jei/crafting/ShapelessMekanismRecipeHandler.java +++ b/src/main/java/mekanism/client/jei/crafting/ShapelessMekanismRecipeHandler.java @@ -3,12 +3,20 @@ package mekanism.client.jei.crafting; import javax.annotation.Nonnull; import mekanism.common.recipe.ShapelessMekanismRecipe; +import mezz.jei.api.IJeiHelpers; import mezz.jei.api.recipe.IRecipeHandler; import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.VanillaRecipeCategoryUid; public class ShapelessMekanismRecipeHandler implements IRecipeHandler { + private final IJeiHelpers jeiHelpers; + + public ShapelessMekanismRecipeHandler(IJeiHelpers helpers) + { + jeiHelpers = helpers; + } + @Override @Nonnull public Class getRecipeClass() @@ -16,18 +24,11 @@ public class ShapelessMekanismRecipeHandler implements IRecipeHandler getOutputs() - { - return Collections.singletonList(recipe.getRecipeOutput()); + List> inputs = stackHelper.expandRecipeItemStackInputs(recipe.getInput()); + ingredients.setInputLists(ItemStack.class, inputs); + + if(recipeOutput != null) + { + ingredients.setOutput(ItemStack.class, recipeOutput); + } } } diff --git a/src/main/java/mekanism/client/jei/gas/GasStackHelper.java b/src/main/java/mekanism/client/jei/gas/GasStackHelper.java deleted file mode 100644 index 06de01d44..000000000 --- a/src/main/java/mekanism/client/jei/gas/GasStackHelper.java +++ /dev/null @@ -1,29 +0,0 @@ -package mekanism.client.jei.gas; - - -public class GasStackHelper// implements IIngredientHelper -{ - /*@Override - public Collection expandSubtypes(Collection contained) { - return contained; - } - - @Override - public GasStack getMatch(Iterable ingredients, @Nonnull Focus toMatch) { - if (toMatch.getGas() == null) { - return null; - } - for (GasStack GasStack : ingredients) { - if (toMatch.getGas() == GasStack.getGas()) { - return GasStack; - } - } - return null; - } - - @Nonnull - @Override - public Focus createFocus(@Nonnull GasStack ingredient) { - return new Focus(ingredient.getGas()); - }*/ -} diff --git a/src/main/java/mekanism/client/jei/gas/GasStackRenderer.java b/src/main/java/mekanism/client/jei/gas/GasStackRenderer.java new file mode 100644 index 000000000..5250f8a4e --- /dev/null +++ b/src/main/java/mekanism/client/jei/gas/GasStackRenderer.java @@ -0,0 +1,230 @@ +package mekanism.client.jei.gas; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Nullable; + +import mekanism.api.gas.Gas; +import mekanism.api.gas.GasStack; +import mekanism.common.util.LangUtils; +import mezz.jei.api.gui.IDrawable; +import mezz.jei.api.ingredients.IIngredientRenderer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.TextFormatting; +import net.minecraftforge.fluids.Fluid; + +public class GasStackRenderer implements IIngredientRenderer +{ + private static final int TEX_WIDTH = 16; + private static final int TEX_HEIGHT = 16; + private static final int MIN_FLUID_HEIGHT = 1; // ensure tiny amounts of gas are still visible + + private final int capacityMb; + private final TooltipMode tooltipMode; + private final int width; + private final int height; + @Nullable + private final IDrawable overlay; + + enum TooltipMode + { + SHOW_AMOUNT, + SHOW_AMOUNT_AND_CAPACITY, + ITEM_LIST + } + + public GasStackRenderer() + { + this(Fluid.BUCKET_VOLUME, TooltipMode.ITEM_LIST, TEX_WIDTH, TEX_HEIGHT, null); + } + + public GasStackRenderer(int capacityMb, boolean showCapacity, int width, int height, @Nullable IDrawable overlay) + { + this(capacityMb, showCapacity ? TooltipMode.SHOW_AMOUNT_AND_CAPACITY : TooltipMode.SHOW_AMOUNT, width, height, overlay); + } + + public GasStackRenderer(int capacityMb, TooltipMode tooltipMode, int width, int height, @Nullable IDrawable overlay) + { + this.capacityMb = capacityMb; + this.tooltipMode = tooltipMode; + this.width = width; + this.height = height; + this.overlay = overlay; + } + + @Override + public void render(Minecraft minecraft, final int xPosition, final int yPosition, @Nullable GasStack gasStack) + { + GlStateManager.enableBlend(); + GlStateManager.enableAlpha(); + + drawGas(minecraft, xPosition, yPosition, gasStack); + + GlStateManager.color(1, 1, 1, 1); + + if(overlay != null) + { + GlStateManager.pushMatrix(); + GlStateManager.translate(0, 0, 200); + overlay.draw(minecraft, xPosition, yPosition); + GlStateManager.popMatrix(); + } + + GlStateManager.disableAlpha(); + GlStateManager.disableBlend(); + } + + private void drawGas(Minecraft minecraft, final int xPosition, final int yPosition, @Nullable GasStack gasStack) + { + if(gasStack == null) + { + return; + } + + Gas gas = gasStack.getGas(); + + if(gas == null) + { + return; + } + + TextureAtlasSprite gasStillSprite = getStillGasSprite(minecraft, gas); + + int gasColor = 0xFFFFFFFF; + + int scaledAmount = (gasStack.amount * height) / capacityMb; + + if(gasStack.amount > 0 && scaledAmount < MIN_FLUID_HEIGHT) + { + scaledAmount = MIN_FLUID_HEIGHT; + } + + if(scaledAmount > height) + { + scaledAmount = height; + } + + drawTiledSprite(minecraft, xPosition, yPosition, width, height, gasColor, scaledAmount, gasStillSprite); + } + + private void drawTiledSprite(Minecraft minecraft, final int xPosition, final int yPosition, final int tiledWidth, final int tiledHeight, int color, int scaledAmount, TextureAtlasSprite sprite) + { + minecraft.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + setGLColorFromInt(color); + + final int xTileCount = tiledWidth / TEX_WIDTH; + final int xRemainder = tiledWidth - (xTileCount * TEX_WIDTH); + final int yTileCount = scaledAmount / TEX_HEIGHT; + final int yRemainder = scaledAmount - (yTileCount * TEX_HEIGHT); + + final int yStart = yPosition + tiledHeight; + + for(int xTile = 0; xTile <= xTileCount; xTile++) + { + for(int yTile = 0; yTile <= yTileCount; yTile++) + { + int width = (xTile == xTileCount) ? xRemainder : TEX_WIDTH; + int height = (yTile == yTileCount) ? yRemainder : TEX_HEIGHT; + int x = xPosition + (xTile * TEX_WIDTH); + int y = yStart - ((yTile + 1) * TEX_HEIGHT); + + if(width > 0 && height > 0) + { + int maskTop = TEX_HEIGHT - height; + int maskRight = TEX_WIDTH - width; + + drawTextureWithMasking(x, y, sprite, maskTop, maskRight, 100); + } + } + } + } + + private static TextureAtlasSprite getStillGasSprite(Minecraft minecraft, Gas gas) + { + TextureMap textureMapBlocks = minecraft.getTextureMapBlocks(); + ResourceLocation gasStill = gas.getIcon(); + TextureAtlasSprite gasStillSprite = null; + + if(gasStill != null) + { + gasStillSprite = textureMapBlocks.getTextureExtry(gasStill.toString()); + } + + if(gasStillSprite == null) + { + gasStillSprite = textureMapBlocks.getMissingSprite(); + } + + return gasStillSprite; + } + + private static void setGLColorFromInt(int color) + { + float red = (color >> 16 & 0xFF) / 255.0F; + float green = (color >> 8 & 0xFF) / 255.0F; + float blue = (color & 0xFF) / 255.0F; + + GlStateManager.color(red, green, blue, 1.0F); + } + + private static void drawTextureWithMasking(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) + { + double uMin = (double) textureSprite.getMinU(); + double uMax = (double) textureSprite.getMaxU(); + double vMin = (double) textureSprite.getMinV(); + double vMax = (double) textureSprite.getMaxV(); + uMax = uMax - (maskRight / 16.0 * (uMax - uMin)); + vMax = vMax - (maskTop / 16.0 * (vMax - vMin)); + + Tessellator tessellator = Tessellator.getInstance(); + VertexBuffer vertexBuffer = tessellator.getBuffer(); + vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX); + vertexBuffer.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex(); + vertexBuffer.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex(uMax, vMax).endVertex(); + vertexBuffer.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex(uMax, vMin).endVertex(); + vertexBuffer.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex(); + tessellator.draw(); + } + + @Override + public List getTooltip(Minecraft minecraft, GasStack gasStack) + { + List tooltip = new ArrayList(); + Gas gasType = gasStack.getGas(); + + if(gasType == null) + { + return tooltip; + } + + String gasName = gasType.getLocalizedName(); + tooltip.add(gasName); + + if(tooltipMode == TooltipMode.SHOW_AMOUNT_AND_CAPACITY) + { + String amount = LangUtils.localizeWithFormat("jei.tooltip.liquid.amount.with.capacity", gasStack.amount, capacityMb); + tooltip.add(TextFormatting.GRAY + amount); + } + else if (tooltipMode == TooltipMode.SHOW_AMOUNT) + { + String amount = LangUtils.localizeWithFormat("jei.tooltip.liquid.amount", gasStack.amount); + tooltip.add(TextFormatting.GRAY + amount); + } + + return tooltip; + } + + @Override + public FontRenderer getFontRenderer(Minecraft minecraft, GasStack gasStack) { + return minecraft.fontRendererObj; + } +} diff --git a/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeCategory.java index 12ab12557..26ebb52f4 100644 --- a/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeCategory.java @@ -1,5 +1,7 @@ package mekanism.client.jei.machine; +import java.util.List; + import mekanism.api.gas.GasStack; import mekanism.client.gui.element.GuiPowerBar; import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler; @@ -12,6 +14,7 @@ import mekanism.client.gui.element.GuiSlot.SlotType; import mekanism.client.jei.BaseRecipeCategory; import mekanism.common.recipe.inputs.AdvancedMachineInput; import mekanism.common.recipe.machines.AdvancedMachineRecipe; +import mekanism.common.recipe.outputs.ItemStackOutput; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import mezz.jei.api.IGuiHelper; @@ -19,6 +22,7 @@ import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.ITickTimer; +import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; @@ -91,7 +95,7 @@ public class AdvancedMachineRecipeCategory extends BaseRecipeCategory } @Override - public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) + public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) { if(recipeWrapper instanceof AdvancedMachineRecipeWrapper) { @@ -106,8 +110,8 @@ public class AdvancedMachineRecipeCategory extends BaseRecipeCategory itemStacks.init(1, false, 87, 18); itemStacks.init(2, false, 27, 36); - itemStacks.setFromRecipe(0, recipeWrapper.getInputs()); - itemStacks.setFromRecipe(1, recipeWrapper.getOutputs()); + itemStacks.set(0, input.itemStack); + itemStacks.set(1, ((ItemStackOutput)tempRecipe.recipeOutput).output); itemStacks.set(2, ((AdvancedMachineRecipeWrapper)recipeWrapper).getFuelStacks(input.gasType)); } } diff --git a/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeHandler.java deleted file mode 100644 index cc6a0e8c6..000000000 --- a/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeHandler.java +++ /dev/null @@ -1,52 +0,0 @@ -package mekanism.client.jei.machine; - -import javax.annotation.Nonnull; - -import mezz.jei.api.recipe.IRecipeHandler; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class AdvancedMachineRecipeHandler implements IRecipeHandler -{ - private final AdvancedMachineRecipeCategory category; - - public Class wrapperClass; - - public AdvancedMachineRecipeHandler(AdvancedMachineRecipeCategory c, Class wrapper) - { - category = c; - - wrapperClass = wrapper; - } - - @Override - public Class getRecipeClass() - { - return wrapperClass; - } - - @Nonnull - @Override - public String getRecipeCategoryUid() - { - return category.getUid(); - } - - @Nonnull - @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull T recipe) - { - return recipe; - } - - @Override - public boolean isRecipeValid(@Nonnull T recipe) - { - return recipe.category == category; - } - - @Override - public String getRecipeCategoryUid(@Nonnull T recipe) - { - return category.getUid(); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeWrapper.java index aea384250..a26260d83 100644 --- a/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeWrapper.java @@ -1,20 +1,18 @@ package mekanism.client.jei.machine; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import mekanism.api.gas.Gas; import mekanism.common.recipe.inputs.AdvancedMachineInput; import mekanism.common.recipe.machines.AdvancedMachineRecipe; import mekanism.common.recipe.outputs.ItemStackOutput; -import mezz.jei.api.recipe.BlankRecipeWrapper; +import mezz.jei.api.ingredients.IIngredients; import net.minecraft.item.ItemStack; -public abstract class AdvancedMachineRecipeWrapper extends BlankRecipeWrapper +public abstract class AdvancedMachineRecipeWrapper extends BaseRecipeWrapper { public AdvancedMachineRecipe recipe; @@ -26,18 +24,11 @@ public abstract class AdvancedMachineRecipeWrapper extends BlankRecipeWrapper category = c; } - @Nonnull @Override - public List getInputs() + public void getIngredients(IIngredients ingredients) { - return Arrays.asList(((AdvancedMachineInput)recipe.getInput()).itemStack); - } - - @Nonnull - @Override - public List getOutputs() - { - return Arrays.asList(((ItemStackOutput)recipe.getOutput()).output); + ingredients.setInput(ItemStack.class, ((AdvancedMachineInput)recipe.getInput()).itemStack); + ingredients.setOutput(ItemStack.class, ((ItemStackOutput)recipe.getOutput()).output); } @Nullable @@ -54,5 +45,11 @@ public abstract class AdvancedMachineRecipeWrapper extends BlankRecipeWrapper return currenttip; } + @Override + public AdvancedMachineRecipeCategory getCategory() + { + return category; + } + public abstract List getFuelStacks(Gas gasType); } diff --git a/src/main/java/mekanism/client/jei/machine/BaseRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/BaseRecipeHandler.java new file mode 100644 index 000000000..5a579fc5f --- /dev/null +++ b/src/main/java/mekanism/client/jei/machine/BaseRecipeHandler.java @@ -0,0 +1,46 @@ +package mekanism.client.jei.machine; + +import javax.annotation.Nonnull; + +import mekanism.client.jei.BaseRecipeCategory; +import mezz.jei.api.recipe.IRecipeHandler; +import mezz.jei.api.recipe.IRecipeWrapper; + +public class BaseRecipeHandler implements IRecipeHandler +{ + private final CATEGORY category; + + public Class wrapperClass; + + public BaseRecipeHandler(CATEGORY c, Class wrapper) + { + category = c; + + wrapperClass = wrapper; + } + + @Override + public Class getRecipeClass() + { + return wrapperClass; + } + + @Nonnull + @Override + public IRecipeWrapper getRecipeWrapper(@Nonnull WRAPPER recipe) + { + return recipe; + } + + @Override + public boolean isRecipeValid(@Nonnull WRAPPER recipe) + { + return recipe.getCategory() == category; + } + + @Override + public String getRecipeCategoryUid(@Nonnull WRAPPER recipe) + { + return category.getUid(); + } +} diff --git a/src/main/java/mekanism/client/jei/machine/BaseRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/BaseRecipeWrapper.java new file mode 100644 index 000000000..1bb315840 --- /dev/null +++ b/src/main/java/mekanism/client/jei/machine/BaseRecipeWrapper.java @@ -0,0 +1,9 @@ +package mekanism.client.jei.machine; + +import mekanism.client.jei.BaseRecipeCategory; +import mezz.jei.api.recipe.BlankRecipeWrapper; + +public abstract class BaseRecipeWrapper extends BlankRecipeWrapper +{ + public abstract BaseRecipeCategory getCategory(); +} diff --git a/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeCategory.java index 3bf0f6948..cedce59b0 100644 --- a/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeCategory.java @@ -1,5 +1,7 @@ package mekanism.client.jei.machine; +import java.util.List; + import mekanism.client.gui.element.GuiPowerBar; import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler; import mekanism.client.gui.element.GuiProgress; @@ -9,6 +11,7 @@ import mekanism.client.gui.element.GuiSlot; import mekanism.client.gui.element.GuiSlot.SlotOverlay; import mekanism.client.gui.element.GuiSlot.SlotType; import mekanism.client.jei.BaseRecipeCategory; +import mekanism.common.recipe.inputs.ItemStackInput; import mekanism.common.recipe.machines.ChanceMachineRecipe; import mekanism.common.recipe.outputs.ChanceOutput; import mekanism.common.util.MekanismUtils; @@ -18,6 +21,7 @@ import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.ITickTimer; +import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.util.ResourceLocation; @@ -73,7 +77,7 @@ public class ChanceMachineRecipeCategory extends BaseRecipeCategory } @Override - public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) + public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) { if(recipeWrapper instanceof ChanceMachineRecipeWrapper) { @@ -86,13 +90,13 @@ public class ChanceMachineRecipeCategory extends BaseRecipeCategory itemStacks.init(1, false, 87, 18); itemStacks.init(2, false, 103, 18); - itemStacks.setFromRecipe(0, recipeWrapper.getInputs()); + itemStacks.set(0, ((ItemStackInput)tempRecipe.recipeInput).ingredient); ChanceOutput output = (ChanceOutput)tempRecipe.getOutput(); if(output.hasPrimary()) { - itemStacks.setFromRecipe(1, output.primaryOutput); + itemStacks.set(1, output.primaryOutput); } if(output.hasSecondary()) diff --git a/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeHandler.java deleted file mode 100644 index aeedbeaa6..000000000 --- a/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeHandler.java +++ /dev/null @@ -1,52 +0,0 @@ -package mekanism.client.jei.machine; - -import javax.annotation.Nonnull; - -import mezz.jei.api.recipe.IRecipeHandler; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class ChanceMachineRecipeHandler implements IRecipeHandler -{ - private final ChanceMachineRecipeCategory category; - - public Class wrapperClass; - - public ChanceMachineRecipeHandler(ChanceMachineRecipeCategory c, Class wrapper) - { - category = c; - - wrapperClass = wrapper; - } - - @Override - public Class getRecipeClass() - { - return wrapperClass; - } - - @Nonnull - @Override - public String getRecipeCategoryUid() - { - return category.getUid(); - } - - @Nonnull - @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull T recipe) - { - return recipe; - } - - @Override - public boolean isRecipeValid(@Nonnull T recipe) - { - return recipe.category == category; - } - - @Override - public String getRecipeCategoryUid(@Nonnull T recipe) - { - return category.getUid(); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeWrapper.java index a32363c46..379ab0035 100644 --- a/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeWrapper.java @@ -1,19 +1,18 @@ package mekanism.client.jei.machine; import java.util.Arrays; -import java.util.List; import javax.annotation.Nonnull; import mekanism.common.recipe.inputs.ItemStackInput; import mekanism.common.recipe.machines.ChanceMachineRecipe; import mekanism.common.recipe.outputs.ChanceOutput; -import mezz.jei.api.recipe.BlankRecipeWrapper; +import mezz.jei.api.ingredients.IIngredients; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.item.ItemStack; -public class ChanceMachineRecipeWrapper extends BlankRecipeWrapper +public class ChanceMachineRecipeWrapper extends BaseRecipeWrapper { public ChanceMachineRecipe recipe; @@ -25,20 +24,12 @@ public class ChanceMachineRecipeWrapper extends BlankRecipeWrapper category = c; } - @Nonnull @Override - public List getInputs() - { - return Arrays.asList(((ItemStackInput)recipe.getInput()).ingredient); - } - - @Nonnull - @Override - public List getOutputs() + public void getIngredients(IIngredients ingredients) { ChanceOutput output = (ChanceOutput)recipe.getOutput(); - - return Arrays.asList(output.primaryOutput, output.secondaryOutput); + ingredients.setInput(ItemStack.class, ((ItemStackInput)recipe.getInput()).ingredient); + ingredients.setOutputs(ItemStack.class, Arrays.asList(output.primaryOutput, output.secondaryOutput)); } @Override @@ -52,4 +43,10 @@ public class ChanceMachineRecipeWrapper extends BlankRecipeWrapper fontRendererObj.drawString(Math.round(output.secondaryChance*100) + "%", 104, 41, 0x404040, false); } } + + @Override + public ChanceMachineRecipeCategory getCategory() + { + return category; + } } diff --git a/src/main/java/mekanism/client/jei/machine/MachineRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/MachineRecipeCategory.java index 5b41c8194..cd76b8af4 100644 --- a/src/main/java/mekanism/client/jei/machine/MachineRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/MachineRecipeCategory.java @@ -1,5 +1,7 @@ package mekanism.client.jei.machine; +import java.util.List; + import mekanism.client.gui.element.GuiPowerBar; import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler; import mekanism.client.gui.element.GuiProgress; @@ -17,7 +19,9 @@ import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.ITickTimer; +import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; +import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; public class MachineRecipeCategory extends BaseRecipeCategory @@ -72,7 +76,7 @@ public class MachineRecipeCategory extends BaseRecipeCategory } @Override - public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) + public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) { if(recipeWrapper instanceof MachineRecipeWrapper) { @@ -84,7 +88,6 @@ public class MachineRecipeCategory extends BaseRecipeCategory itemStacks.init(0, true, 27, 0); itemStacks.init(1, false, 87, 18); - itemStacks.setFromRecipe(0, recipeWrapper.getInputs()); - itemStacks.setFromRecipe(1, recipeWrapper.getOutputs()); + itemStacks.set(ingredients); } } diff --git a/src/main/java/mekanism/client/jei/machine/MachineRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/MachineRecipeHandler.java deleted file mode 100644 index 5788e452a..000000000 --- a/src/main/java/mekanism/client/jei/machine/MachineRecipeHandler.java +++ /dev/null @@ -1,52 +0,0 @@ -package mekanism.client.jei.machine; - -import javax.annotation.Nonnull; - -import mezz.jei.api.recipe.IRecipeHandler; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class MachineRecipeHandler implements IRecipeHandler -{ - private final MachineRecipeCategory category; - - public Class wrapperClass; - - public MachineRecipeHandler(MachineRecipeCategory c, Class wrapper) - { - category = c; - - wrapperClass = wrapper; - } - - @Override - public Class getRecipeClass() - { - return wrapperClass; - } - - @Nonnull - @Override - public String getRecipeCategoryUid() - { - return category.getUid(); - } - - @Nonnull - @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull T recipe) - { - return recipe; - } - - @Override - public boolean isRecipeValid(@Nonnull T recipe) - { - return recipe.category == category; - } - - @Override - public String getRecipeCategoryUid(@Nonnull T recipe) - { - return category.getUid(); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/MachineRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/MachineRecipeWrapper.java index 7cc872bdd..684c53cb9 100644 --- a/src/main/java/mekanism/client/jei/machine/MachineRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/MachineRecipeWrapper.java @@ -1,17 +1,12 @@ package mekanism.client.jei.machine; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.Nonnull; - import mekanism.common.recipe.inputs.ItemStackInput; import mekanism.common.recipe.machines.BasicMachineRecipe; import mekanism.common.recipe.outputs.ItemStackOutput; -import mezz.jei.api.recipe.BlankRecipeWrapper; +import mezz.jei.api.ingredients.IIngredients; import net.minecraft.item.ItemStack; -public class MachineRecipeWrapper extends BlankRecipeWrapper +public class MachineRecipeWrapper extends BaseRecipeWrapper { public BasicMachineRecipe recipe; @@ -23,17 +18,16 @@ public class MachineRecipeWrapper extends BlankRecipeWrapper category = c; } - @Nonnull @Override - public List getInputs() + public void getIngredients(IIngredients ingredients) { - return Arrays.asList(((ItemStackInput)recipe.getInput()).ingredient); + ingredients.setInput(ItemStack.class, ((ItemStackInput)recipe.getInput()).ingredient); + ingredients.setOutput(ItemStack.class, ((ItemStackOutput)recipe.getOutput()).output); } - - @Nonnull + @Override - public List getOutputs() + public MachineRecipeCategory getCategory() { - return Arrays.asList(((ItemStackOutput)recipe.getOutput()).output); + return category; } } diff --git a/src/main/java/mekanism/client/jei/machine/advanced/ChemicalInjectionChamberRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/advanced/ChemicalInjectionChamberRecipeHandler.java deleted file mode 100644 index 6f4d0d573..000000000 --- a/src/main/java/mekanism/client/jei/machine/advanced/ChemicalInjectionChamberRecipeHandler.java +++ /dev/null @@ -1,12 +0,0 @@ -package mekanism.client.jei.machine.advanced; - -import mekanism.client.jei.machine.AdvancedMachineRecipeCategory; -import mekanism.client.jei.machine.AdvancedMachineRecipeHandler; - -public class ChemicalInjectionChamberRecipeHandler extends AdvancedMachineRecipeHandler -{ - public ChemicalInjectionChamberRecipeHandler(AdvancedMachineRecipeCategory c) - { - super(c, ChemicalInjectionChamberRecipeWrapper.class); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/advanced/ChemicalInjectionChamberRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/advanced/ChemicalInjectionChamberRecipeWrapper.java index 747a64cb6..6ae7b20e2 100644 --- a/src/main/java/mekanism/client/jei/machine/advanced/ChemicalInjectionChamberRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/advanced/ChemicalInjectionChamberRecipeWrapper.java @@ -5,11 +5,12 @@ import java.util.List; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; -import mekanism.api.util.ListUtils; import mekanism.client.jei.machine.AdvancedMachineRecipeCategory; import mekanism.client.jei.machine.AdvancedMachineRecipeWrapper; +import mekanism.common.MekanismFluids; import mekanism.common.Tier.GasTankTier; import mekanism.common.recipe.machines.AdvancedMachineRecipe; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; @@ -24,23 +25,23 @@ public class ChemicalInjectionChamberRecipeWrapper extends AdvancedMachineRecipe @Override public List getFuelStacks(Gas gasType) { - if(gasType == GasRegistry.getGas("sulfuricAcid")) + if(gasType == MekanismFluids.SulfuricAcid) { List fuels = new ArrayList(); fuels.addAll(OreDictionary.getOres("dustSulfur")); - fuels.add(MekanismUtils.getFullGasTank(GasTankTier.BASIC, GasRegistry.getGas("sulfuricAcid"))); + fuels.add(MekanismUtils.getFullGasTank(GasTankTier.BASIC, MekanismFluids.SulfuricAcid)); return fuels; } - else if(gasType == GasRegistry.getGas("water")) + else if(gasType == MekanismFluids.Water) { - return ListUtils.asList(MekanismUtils.getFullGasTank(GasTankTier.BASIC, GasRegistry.getGas("water"))); + return ListUtils.asList(MekanismUtils.getFullGasTank(GasTankTier.BASIC, MekanismFluids.Water)); } - else if(gasType == GasRegistry.getGas("hydrogenChloride")) + else if(gasType == MekanismFluids.HydrogenChloride) { List fuels = new ArrayList(); fuels.addAll(OreDictionary.getOres("dustSalt")); - fuels.add(MekanismUtils.getFullGasTank(GasTankTier.BASIC, GasRegistry.getGas("hydrogenChloride"))); + fuels.add(MekanismUtils.getFullGasTank(GasTankTier.BASIC, MekanismFluids.HydrogenChloride)); return fuels; } diff --git a/src/main/java/mekanism/client/jei/machine/advanced/CombinerRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/advanced/CombinerRecipeHandler.java deleted file mode 100644 index 109977634..000000000 --- a/src/main/java/mekanism/client/jei/machine/advanced/CombinerRecipeHandler.java +++ /dev/null @@ -1,12 +0,0 @@ -package mekanism.client.jei.machine.advanced; - -import mekanism.client.jei.machine.AdvancedMachineRecipeCategory; -import mekanism.client.jei.machine.AdvancedMachineRecipeHandler; - -public class CombinerRecipeHandler extends AdvancedMachineRecipeHandler -{ - public CombinerRecipeHandler(AdvancedMachineRecipeCategory c) - { - super(c, CombinerRecipeWrapper.class); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/advanced/CombinerRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/advanced/CombinerRecipeWrapper.java index b770154eb..7a95ecded 100644 --- a/src/main/java/mekanism/client/jei/machine/advanced/CombinerRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/advanced/CombinerRecipeWrapper.java @@ -3,10 +3,10 @@ package mekanism.client.jei.machine.advanced; import java.util.List; import mekanism.api.gas.Gas; -import mekanism.api.util.ListUtils; import mekanism.client.jei.machine.AdvancedMachineRecipeCategory; import mekanism.client.jei.machine.AdvancedMachineRecipeWrapper; import mekanism.common.recipe.machines.AdvancedMachineRecipe; +import mekanism.common.util.ListUtils; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; diff --git a/src/main/java/mekanism/client/jei/machine/advanced/OsmiumCompressorRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/advanced/OsmiumCompressorRecipeHandler.java deleted file mode 100644 index bc3d7bfec..000000000 --- a/src/main/java/mekanism/client/jei/machine/advanced/OsmiumCompressorRecipeHandler.java +++ /dev/null @@ -1,12 +0,0 @@ -package mekanism.client.jei.machine.advanced; - -import mekanism.client.jei.machine.AdvancedMachineRecipeCategory; -import mekanism.client.jei.machine.AdvancedMachineRecipeHandler; - -public class OsmiumCompressorRecipeHandler extends AdvancedMachineRecipeHandler -{ - public OsmiumCompressorRecipeHandler(AdvancedMachineRecipeCategory c) - { - super(c, OsmiumCompressorRecipeWrapper.class); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/advanced/OsmiumCompressorRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/advanced/OsmiumCompressorRecipeWrapper.java index bb4acf946..d747c2418 100644 --- a/src/main/java/mekanism/client/jei/machine/advanced/OsmiumCompressorRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/advanced/OsmiumCompressorRecipeWrapper.java @@ -3,11 +3,12 @@ package mekanism.client.jei.machine.advanced; import java.util.List; import mekanism.api.gas.Gas; -import mekanism.api.util.ListUtils; import mekanism.client.jei.machine.AdvancedMachineRecipeCategory; import mekanism.client.jei.machine.AdvancedMachineRecipeWrapper; import mekanism.common.MekanismItems; import mekanism.common.recipe.machines.AdvancedMachineRecipe; +import mekanism.common.util.ListUtils; +import mezz.jei.api.ingredients.IIngredients; import net.minecraft.item.ItemStack; public class OsmiumCompressorRecipeWrapper extends AdvancedMachineRecipeWrapper diff --git a/src/main/java/mekanism/client/jei/machine/advanced/PurificationChamberRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/advanced/PurificationChamberRecipeHandler.java deleted file mode 100644 index 482c812e3..000000000 --- a/src/main/java/mekanism/client/jei/machine/advanced/PurificationChamberRecipeHandler.java +++ /dev/null @@ -1,12 +0,0 @@ -package mekanism.client.jei.machine.advanced; - -import mekanism.client.jei.machine.AdvancedMachineRecipeCategory; -import mekanism.client.jei.machine.AdvancedMachineRecipeHandler; - -public class PurificationChamberRecipeHandler extends AdvancedMachineRecipeHandler -{ - public PurificationChamberRecipeHandler(AdvancedMachineRecipeCategory c) - { - super(c, PurificationChamberRecipeWrapper.class); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/advanced/PurificationChamberRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/advanced/PurificationChamberRecipeWrapper.java index 0d29503cf..88409d629 100644 --- a/src/main/java/mekanism/client/jei/machine/advanced/PurificationChamberRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/advanced/PurificationChamberRecipeWrapper.java @@ -4,12 +4,12 @@ import java.util.ArrayList; import java.util.List; import mekanism.api.gas.Gas; -import mekanism.api.gas.GasRegistry; -import mekanism.api.util.ListUtils; import mekanism.client.jei.machine.AdvancedMachineRecipeCategory; import mekanism.client.jei.machine.AdvancedMachineRecipeWrapper; +import mekanism.common.MekanismFluids; import mekanism.common.Tier.GasTankTier; import mekanism.common.recipe.machines.AdvancedMachineRecipe; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -24,9 +24,9 @@ public class PurificationChamberRecipeWrapper extends AdvancedMachineRecipeWrapp @Override public List getFuelStacks(Gas gasType) { - if(gasType == GasRegistry.getGas("oxygen")) + if(gasType == MekanismFluids.Oxygen) { - return ListUtils.asList(new ItemStack(Items.FLINT), MekanismUtils.getFullGasTank(GasTankTier.BASIC, GasRegistry.getGas("oxygen"))); + return ListUtils.asList(new ItemStack(Items.FLINT), MekanismUtils.getFullGasTank(GasTankTier.BASIC, MekanismFluids.Oxygen)); } return new ArrayList(); diff --git a/src/main/java/mekanism/client/jei/machine/basic/CrusherRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/basic/CrusherRecipeHandler.java deleted file mode 100644 index bce25da89..000000000 --- a/src/main/java/mekanism/client/jei/machine/basic/CrusherRecipeHandler.java +++ /dev/null @@ -1,12 +0,0 @@ -package mekanism.client.jei.machine.basic; - -import mekanism.client.jei.machine.MachineRecipeCategory; -import mekanism.client.jei.machine.MachineRecipeHandler; - -public class CrusherRecipeHandler extends MachineRecipeHandler -{ - public CrusherRecipeHandler(MachineRecipeCategory c) - { - super(c, CrusherRecipeWrapper.class); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/basic/EnrichmentRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/basic/EnrichmentRecipeHandler.java deleted file mode 100644 index 7b62a193d..000000000 --- a/src/main/java/mekanism/client/jei/machine/basic/EnrichmentRecipeHandler.java +++ /dev/null @@ -1,12 +0,0 @@ -package mekanism.client.jei.machine.basic; - -import mekanism.client.jei.machine.MachineRecipeCategory; -import mekanism.client.jei.machine.MachineRecipeHandler; - -public class EnrichmentRecipeHandler extends MachineRecipeHandler -{ - public EnrichmentRecipeHandler(MachineRecipeCategory c) - { - super(c, EnrichmentRecipeWrapper.class); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/chance/PrecisionSawmillRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/chance/PrecisionSawmillRecipeHandler.java deleted file mode 100644 index f97cb37d2..000000000 --- a/src/main/java/mekanism/client/jei/machine/chance/PrecisionSawmillRecipeHandler.java +++ /dev/null @@ -1,12 +0,0 @@ -package mekanism.client.jei.machine.chance; - -import mekanism.client.jei.machine.ChanceMachineRecipeCategory; -import mekanism.client.jei.machine.ChanceMachineRecipeHandler; - -public class PrecisionSawmillRecipeHandler extends ChanceMachineRecipeHandler -{ - public PrecisionSawmillRecipeHandler(ChanceMachineRecipeCategory c) - { - super(c, PrecisionSawmillRecipeWrapper.class); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeCategory.java index 8b3749745..35e4de0ee 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeCategory.java @@ -8,6 +8,7 @@ import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.ITickTimer; +import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; @@ -59,7 +60,7 @@ public class ChemicalCrystallizerRecipeCategory extends BaseRecipeCategory } @Override - public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) + public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) { if(recipeWrapper instanceof ChemicalCrystallizerRecipeWrapper) { diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeHandler.java deleted file mode 100644 index fd518981b..000000000 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -package mekanism.client.jei.machine.chemical; - -import javax.annotation.Nonnull; - -import mezz.jei.api.recipe.IRecipeHandler; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class ChemicalCrystallizerRecipeHandler implements IRecipeHandler -{ - private final ChemicalCrystallizerRecipeCategory category; - - public ChemicalCrystallizerRecipeHandler(ChemicalCrystallizerRecipeCategory c) - { - category = c; - } - - @Override - public Class getRecipeClass() - { - return ChemicalCrystallizerRecipeWrapper.class; - } - - @Nonnull - @Override - public String getRecipeCategoryUid() - { - return category.getUid(); - } - - @Nonnull - @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull ChemicalCrystallizerRecipeWrapper recipe) - { - return recipe; - } - - @Override - public boolean isRecipeValid(@Nonnull ChemicalCrystallizerRecipeWrapper recipe) - { - return recipe.category == category; - } - - @Override - public String getRecipeCategoryUid(@Nonnull ChemicalCrystallizerRecipeWrapper recipe) - { - return category.getUid(); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeWrapper.java index c1b1720ea..2d118c3e7 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeWrapper.java @@ -1,18 +1,18 @@ package mekanism.client.jei.machine.chemical; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import javax.annotation.Nonnull; import javax.annotation.Nullable; +import mekanism.api.gas.GasStack; +import mekanism.client.jei.machine.BaseRecipeWrapper; import mekanism.common.recipe.machines.CrystallizerRecipe; import mekanism.common.util.LangUtils; -import mezz.jei.api.recipe.BlankRecipeWrapper; +import mezz.jei.api.ingredients.IIngredients; import net.minecraft.item.ItemStack; -public class ChemicalCrystallizerRecipeWrapper extends BlankRecipeWrapper +public class ChemicalCrystallizerRecipeWrapper extends BaseRecipeWrapper { public CrystallizerRecipe recipe; @@ -24,18 +24,11 @@ public class ChemicalCrystallizerRecipeWrapper extends BlankRecipeWrapper category = c; } - @Nonnull @Override - public List getInputs() + public void getIngredients(IIngredients ingredients) { - return new ArrayList(); - } - - @Nonnull - @Override - public List getOutputs() - { - return Arrays.asList(recipe.getOutput().output); + ingredients.setInput(GasStack.class, recipe.recipeInput.ingredient); + ingredients.setOutput(ItemStack.class, recipe.recipeOutput.output); } @Nullable @@ -51,4 +44,10 @@ public class ChemicalCrystallizerRecipeWrapper extends BlankRecipeWrapper return currenttip; } + + @Override + public ChemicalCrystallizerRecipeCategory getCategory() + { + return category; + } } diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeCategory.java index dc9d631b0..dd89dd078 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeCategory.java @@ -1,14 +1,15 @@ package mekanism.client.jei.machine.chemical; -import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.client.jei.BaseRecipeCategory; +import mekanism.common.MekanismFluids; import mekanism.common.recipe.machines.DissolutionRecipe; import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.ITickTimer; +import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; @@ -47,7 +48,7 @@ public class ChemicalDissolutionChamberRecipeCategory extends BaseRecipeCategory float f = (float)timer.getValue() / 20F; drawTexturedRect(64-xOffset, 40-yOffset, 176, 63, (int)(48*f), 8); - displayGauge(58, 6-xOffset, 5-yOffset, 176, 4, 58, null, new GasStack(GasRegistry.getGas("sulfuricAcid"), 1)); + displayGauge(58, 6-xOffset, 5-yOffset, 176, 4, 58, null, new GasStack(MekanismFluids.SulfuricAcid, 1)); if(gas != null) { @@ -62,7 +63,7 @@ public class ChemicalDissolutionChamberRecipeCategory extends BaseRecipeCategory } @Override - public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) + public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) { if(recipeWrapper instanceof ChemicalDissolutionChamberRecipeWrapper) { diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeHandler.java deleted file mode 100644 index f6a2346d3..000000000 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -package mekanism.client.jei.machine.chemical; - -import javax.annotation.Nonnull; - -import mezz.jei.api.recipe.IRecipeHandler; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class ChemicalDissolutionChamberRecipeHandler implements IRecipeHandler -{ - private final ChemicalDissolutionChamberRecipeCategory category; - - public ChemicalDissolutionChamberRecipeHandler(ChemicalDissolutionChamberRecipeCategory c) - { - category = c; - } - - @Override - public Class getRecipeClass() - { - return ChemicalDissolutionChamberRecipeWrapper.class; - } - - @Nonnull - @Override - public String getRecipeCategoryUid() - { - return category.getUid(); - } - - @Nonnull - @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull ChemicalDissolutionChamberRecipeWrapper recipe) - { - return recipe; - } - - @Override - public boolean isRecipeValid(@Nonnull ChemicalDissolutionChamberRecipeWrapper recipe) - { - return recipe.category == category; - } - - @Override - public String getRecipeCategoryUid(@Nonnull ChemicalDissolutionChamberRecipeWrapper recipe) - { - return category.getUid(); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeWrapper.java index c6cb3b3b0..7ad89dba3 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeWrapper.java @@ -1,19 +1,19 @@ package mekanism.client.jei.machine.chemical; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import javax.annotation.Nonnull; import javax.annotation.Nullable; -import mekanism.api.gas.GasRegistry; +import mekanism.api.gas.GasStack; +import mekanism.client.jei.machine.BaseRecipeWrapper; +import mekanism.common.MekanismFluids; import mekanism.common.recipe.machines.DissolutionRecipe; import mekanism.common.util.LangUtils; -import mezz.jei.api.recipe.BlankRecipeWrapper; +import mezz.jei.api.ingredients.IIngredients; import net.minecraft.item.ItemStack; -public class ChemicalDissolutionChamberRecipeWrapper extends BlankRecipeWrapper +public class ChemicalDissolutionChamberRecipeWrapper extends BaseRecipeWrapper { public DissolutionRecipe recipe; @@ -25,18 +25,12 @@ public class ChemicalDissolutionChamberRecipeWrapper extends BlankRecipeWrapper category = c; } - @Nonnull @Override - public List getInputs() + public void getIngredients(IIngredients ingredients) { - return Arrays.asList(recipe.getInput().ingredient); - } - - @Nonnull - @Override - public List getOutputs() - { - return new ArrayList(); + ingredients.setInput(GasStack.class, new GasStack(MekanismFluids.SulfuricAcid, 1000)); + ingredients.setInput(ItemStack.class, recipe.recipeInput.ingredient); + ingredients.setOutput(GasStack.class, recipe.recipeOutput.output); } @Nullable @@ -47,7 +41,7 @@ public class ChemicalDissolutionChamberRecipeWrapper extends BlankRecipeWrapper if(mouseX >= 6-3 && mouseX <= 22-3 && mouseY >= 5-3 && mouseY <= 63-3) { - currenttip.add(GasRegistry.getGas("sulfuricAcid").getLocalizedName()); + currenttip.add(MekanismFluids.SulfuricAcid.getLocalizedName()); } else if(mouseX >= 134-3 && mouseX <= 150-3 && mouseY >= 14-3 && mouseY <= 72-3) { @@ -56,4 +50,10 @@ public class ChemicalDissolutionChamberRecipeWrapper extends BlankRecipeWrapper return currenttip; } + + @Override + public ChemicalDissolutionChamberRecipeCategory getCategory() + { + return category; + } } diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeCategory.java index acdc7cbc2..10efbef17 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeCategory.java @@ -6,6 +6,7 @@ import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.ITickTimer; +import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; @@ -65,7 +66,7 @@ public class ChemicalInfuserRecipeCategory extends BaseRecipeCategory } @Override - public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) + public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) { if(recipeWrapper instanceof ChemicalInfuserRecipeWrapper) { diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeHandler.java deleted file mode 100644 index 48e24670e..000000000 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -package mekanism.client.jei.machine.chemical; - -import javax.annotation.Nonnull; - -import mezz.jei.api.recipe.IRecipeHandler; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class ChemicalInfuserRecipeHandler implements IRecipeHandler -{ - private final ChemicalInfuserRecipeCategory category; - - public ChemicalInfuserRecipeHandler(ChemicalInfuserRecipeCategory c) - { - category = c; - } - - @Override - public Class getRecipeClass() - { - return ChemicalInfuserRecipeWrapper.class; - } - - @Nonnull - @Override - public String getRecipeCategoryUid() - { - return category.getUid(); - } - - @Nonnull - @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull ChemicalInfuserRecipeWrapper recipe) - { - return recipe; - } - - @Override - public boolean isRecipeValid(@Nonnull ChemicalInfuserRecipeWrapper recipe) - { - return recipe.category == category; - } - - @Override - public String getRecipeCategoryUid(@Nonnull ChemicalInfuserRecipeWrapper recipe) - { - return category.getUid(); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeWrapper.java index 832d9283c..46942dd6d 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeWrapper.java @@ -1,17 +1,18 @@ package mekanism.client.jei.machine.chemical; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -import javax.annotation.Nonnull; import javax.annotation.Nullable; +import mekanism.api.gas.GasStack; +import mekanism.client.jei.machine.BaseRecipeWrapper; import mekanism.common.recipe.machines.ChemicalInfuserRecipe; import mekanism.common.util.LangUtils; -import mezz.jei.api.recipe.BlankRecipeWrapper; -import net.minecraft.item.ItemStack; +import mezz.jei.api.ingredients.IIngredients; -public class ChemicalInfuserRecipeWrapper extends BlankRecipeWrapper +public class ChemicalInfuserRecipeWrapper extends BaseRecipeWrapper { public ChemicalInfuserRecipe recipe; @@ -23,18 +24,11 @@ public class ChemicalInfuserRecipeWrapper extends BlankRecipeWrapper category = c; } - @Nonnull @Override - public List getInputs() + public void getIngredients(IIngredients ingredients) { - return new ArrayList(); - } - - @Nonnull - @Override - public List getOutputs() - { - return new ArrayList(); + ingredients.setInputs(GasStack.class, Arrays.asList(recipe.recipeInput.leftGas, recipe.recipeInput.rightGas)); + ingredients.setOutput(GasStack.class, recipe.recipeOutput.output); } @Nullable @@ -58,4 +52,10 @@ public class ChemicalInfuserRecipeWrapper extends BlankRecipeWrapper return currenttip; } + + @Override + public ChemicalInfuserRecipeCategory getCategory() + { + return category; + } } diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeCategory.java index 0f8bd2c81..26200d23a 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeCategory.java @@ -16,6 +16,7 @@ import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.ITickTimer; +import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; @@ -82,7 +83,7 @@ public class ChemicalOxidizerRecipeCategory extends BaseRecipeCategory } @Override - public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) + public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) { if(recipeWrapper instanceof ChemicalOxidizerRecipeWrapper) { @@ -92,7 +93,6 @@ public class ChemicalOxidizerRecipeCategory extends BaseRecipeCategory IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); itemStacks.init(0, true, 25-xOffset, 35-yOffset); - itemStacks.set(0, tempRecipe.getInput().ingredient); } } diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeHandler.java deleted file mode 100644 index 726a8a452..000000000 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -package mekanism.client.jei.machine.chemical; - -import javax.annotation.Nonnull; - -import mezz.jei.api.recipe.IRecipeHandler; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class ChemicalOxidizerRecipeHandler implements IRecipeHandler -{ - private final ChemicalOxidizerRecipeCategory category; - - public ChemicalOxidizerRecipeHandler(ChemicalOxidizerRecipeCategory c) - { - category = c; - } - - @Override - public Class getRecipeClass() - { - return ChemicalOxidizerRecipeWrapper.class; - } - - @Nonnull - @Override - public String getRecipeCategoryUid() - { - return category.getUid(); - } - - @Nonnull - @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull ChemicalOxidizerRecipeWrapper recipe) - { - return recipe; - } - - @Override - public boolean isRecipeValid(@Nonnull ChemicalOxidizerRecipeWrapper recipe) - { - return recipe.category == category; - } - - @Override - public String getRecipeCategoryUid(@Nonnull ChemicalOxidizerRecipeWrapper recipe) - { - return category.getUid(); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeWrapper.java index 75806fc71..1017ab8c8 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeWrapper.java @@ -1,18 +1,18 @@ package mekanism.client.jei.machine.chemical; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import javax.annotation.Nonnull; import javax.annotation.Nullable; +import mekanism.api.gas.GasStack; +import mekanism.client.jei.machine.BaseRecipeWrapper; import mekanism.common.recipe.machines.OxidationRecipe; import mekanism.common.util.LangUtils; -import mezz.jei.api.recipe.BlankRecipeWrapper; +import mezz.jei.api.ingredients.IIngredients; import net.minecraft.item.ItemStack; -public class ChemicalOxidizerRecipeWrapper extends BlankRecipeWrapper +public class ChemicalOxidizerRecipeWrapper extends BaseRecipeWrapper { public OxidationRecipe recipe; @@ -24,18 +24,11 @@ public class ChemicalOxidizerRecipeWrapper extends BlankRecipeWrapper category = c; } - @Nonnull @Override - public List getInputs() + public void getIngredients(IIngredients ingredients) { - return Arrays.asList(recipe.getInput().ingredient); - } - - @Nonnull - @Override - public List getOutputs() - { - return new ArrayList(); + ingredients.setInput(ItemStack.class, recipe.recipeInput.ingredient); + ingredients.setOutput(GasStack.class, recipe.recipeOutput.output); } @Nullable @@ -51,4 +44,10 @@ public class ChemicalOxidizerRecipeWrapper extends BlankRecipeWrapper return currenttip; } + + @Override + public ChemicalOxidizerRecipeCategory getCategory() + { + return category; + } } diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeCategory.java index c7e895a9f..1e75c67e5 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeCategory.java @@ -10,6 +10,7 @@ import mezz.jei.api.gui.IGuiFluidStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.ITickTimer; import mezz.jei.api.gui.ITooltipCallback; +import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; @@ -66,7 +67,7 @@ public class ChemicalWasherRecipeCategory extends BaseRecipeCategory } @Override - public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) + public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) { if(recipeWrapper instanceof ChemicalWasherRecipeWrapper) { @@ -76,7 +77,7 @@ public class ChemicalWasherRecipeCategory extends BaseRecipeCategory IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks(); fluidStacks.init(0, true, 6-xOffset, 5-yOffset, 16, 58, 1000, false, fluidOverlay); - fluidStacks.set(0, recipeWrapper.getFluidInputs()); + fluidStacks.set(0, ingredients.getInputs(FluidStack.class).get(0)); fluidStacks.addTooltipCallback(new ITooltipCallback() { @Override diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeHandler.java deleted file mode 100644 index 022f904fe..000000000 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -package mekanism.client.jei.machine.chemical; - -import javax.annotation.Nonnull; - -import mezz.jei.api.recipe.IRecipeHandler; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class ChemicalWasherRecipeHandler implements IRecipeHandler -{ - private final ChemicalWasherRecipeCategory category; - - public ChemicalWasherRecipeHandler(ChemicalWasherRecipeCategory c) - { - category = c; - } - - @Override - public Class getRecipeClass() - { - return ChemicalWasherRecipeWrapper.class; - } - - @Nonnull - @Override - public String getRecipeCategoryUid() - { - return category.getUid(); - } - - @Nonnull - @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull ChemicalWasherRecipeWrapper recipe) - { - return recipe; - } - - @Override - public boolean isRecipeValid(@Nonnull ChemicalWasherRecipeWrapper recipe) - { - return recipe.category == category; - } - - @Override - public String getRecipeCategoryUid(@Nonnull ChemicalWasherRecipeWrapper recipe) - { - return category.getUid(); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeWrapper.java index ea248ca09..cfd557904 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeWrapper.java @@ -1,20 +1,19 @@ package mekanism.client.jei.machine.chemical; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import javax.annotation.Nonnull; import javax.annotation.Nullable; +import mekanism.api.gas.GasStack; +import mekanism.client.jei.machine.BaseRecipeWrapper; import mekanism.common.recipe.machines.WasherRecipe; import mekanism.common.util.LangUtils; -import mezz.jei.api.recipe.BlankRecipeWrapper; -import net.minecraft.item.ItemStack; +import mezz.jei.api.ingredients.IIngredients; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -public class ChemicalWasherRecipeWrapper extends BlankRecipeWrapper +public class ChemicalWasherRecipeWrapper extends BaseRecipeWrapper { public WasherRecipe recipe; @@ -26,25 +25,12 @@ public class ChemicalWasherRecipeWrapper extends BlankRecipeWrapper category = c; } - @Nonnull @Override - public List getInputs() + public void getIngredients(IIngredients ingredients) { - return new ArrayList(); - } - - @Nonnull - @Override - public List getFluidInputs() - { - return Arrays.asList(new FluidStack(FluidRegistry.WATER, 1000)); - } - - @Nonnull - @Override - public List getOutputs() - { - return new ArrayList(); + ingredients.setInput(FluidStack.class, new FluidStack(FluidRegistry.WATER, 1000)); + ingredients.setInput(GasStack.class, recipe.recipeInput.ingredient); + ingredients.setOutput(GasStack.class, recipe.recipeOutput.output); } @Nullable @@ -64,4 +50,10 @@ public class ChemicalWasherRecipeWrapper extends BlankRecipeWrapper return currenttip; } + + @Override + public ChemicalWasherRecipeCategory getCategory() + { + return category; + } } diff --git a/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeCategory.java index a05358924..333d1b5cb 100644 --- a/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeCategory.java @@ -1,5 +1,6 @@ package mekanism.client.jei.machine.other; +import java.util.ArrayList; import java.util.List; import mekanism.client.gui.element.GuiFluidGauge; @@ -23,6 +24,7 @@ import mezz.jei.api.gui.IGuiFluidStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.ITickTimer; import mezz.jei.api.gui.ITooltipCallback; +import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; @@ -113,7 +115,7 @@ public class ElectrolyticSeparatorRecipeCategory extends BaseRecipeCategory } @Override - public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) + public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) { if(recipeWrapper instanceof ElectrolyticSeparatorRecipeWrapper) { @@ -123,7 +125,7 @@ public class ElectrolyticSeparatorRecipeCategory extends BaseRecipeCategory IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks(); fluidStacks.init(0, true, 2, 2, 16, 58, tempRecipe.getInput().ingredient.amount, false, fluidOverlay); - fluidStacks.set(0, recipeWrapper.getFluidInputs()); + fluidStacks.set(0, ingredients.getInputs(FluidStack.class).get(0)); fluidStacks.addTooltipCallback(new ITooltipCallback() { @Override diff --git a/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeHandler.java deleted file mode 100644 index 4f138e298..000000000 --- a/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -package mekanism.client.jei.machine.other; - -import javax.annotation.Nonnull; - -import mezz.jei.api.recipe.IRecipeHandler; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class ElectrolyticSeparatorRecipeHandler implements IRecipeHandler -{ - private final ElectrolyticSeparatorRecipeCategory category; - - public ElectrolyticSeparatorRecipeHandler(ElectrolyticSeparatorRecipeCategory c) - { - category = c; - } - - @Override - public Class getRecipeClass() - { - return ElectrolyticSeparatorRecipeWrapper.class; - } - - @Nonnull - @Override - public String getRecipeCategoryUid() - { - return category.getUid(); - } - - @Nonnull - @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull ElectrolyticSeparatorRecipeWrapper recipe) - { - return recipe; - } - - @Override - public boolean isRecipeValid(@Nonnull ElectrolyticSeparatorRecipeWrapper recipe) - { - return recipe.category == category; - } - - @Override - public String getRecipeCategoryUid(@Nonnull ElectrolyticSeparatorRecipeWrapper recipe) - { - return category.getUid(); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeWrapper.java index 6b7a3fe3c..ac707033d 100644 --- a/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeWrapper.java @@ -4,15 +4,15 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import javax.annotation.Nonnull; import javax.annotation.Nullable; +import mekanism.api.gas.GasStack; +import mekanism.client.jei.machine.BaseRecipeWrapper; import mekanism.common.recipe.machines.SeparatorRecipe; -import mezz.jei.api.recipe.BlankRecipeWrapper; -import net.minecraft.item.ItemStack; +import mezz.jei.api.ingredients.IIngredients; import net.minecraftforge.fluids.FluidStack; -public class ElectrolyticSeparatorRecipeWrapper extends BlankRecipeWrapper +public class ElectrolyticSeparatorRecipeWrapper extends BaseRecipeWrapper { public SeparatorRecipe recipe; @@ -24,25 +24,11 @@ public class ElectrolyticSeparatorRecipeWrapper extends BlankRecipeWrapper category = c; } - @Nonnull @Override - public List getInputs() + public void getIngredients(IIngredients ingredients) { - return new ArrayList(); - } - - @Nonnull - @Override - public List getFluidInputs() - { - return Arrays.asList(recipe.getInput().ingredient); - } - - @Nonnull - @Override - public List getOutputs() - { - return new ArrayList(); + ingredients.setInput(FluidStack.class, recipe.recipeInput.ingredient); + ingredients.setOutputs(GasStack.class, Arrays.asList(recipe.recipeOutput.leftGas, recipe.recipeOutput.rightGas)); } @Nullable @@ -62,4 +48,10 @@ public class ElectrolyticSeparatorRecipeWrapper extends BlankRecipeWrapper return currenttip; } + + @Override + public ElectrolyticSeparatorRecipeCategory getCategory() + { + return category; + } } diff --git a/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeCategory.java index d85ccfca8..c72d378c4 100644 --- a/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeCategory.java @@ -25,6 +25,7 @@ import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.ITickTimer; +import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; @@ -110,7 +111,7 @@ public class MetallurgicInfuserRecipeCategory extends BaseRecipeCategory } @Override - public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) + public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) { if(recipeWrapper instanceof MetallurgicInfuserRecipeWrapper) { @@ -124,7 +125,7 @@ public class MetallurgicInfuserRecipeCategory extends BaseRecipeCategory itemStacks.init(2, true, 11, 18); itemStacks.set(0, tempRecipe.getInput().inputStack); - itemStacks.setFromRecipe(1, recipeWrapper.getOutputs()); + itemStacks.set(1, tempRecipe.getOutput().output); itemStacks.set(2, getInfuseStacks(tempRecipe.getInput().infuse.type)); } } diff --git a/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeHandler.java deleted file mode 100644 index d974c4780..000000000 --- a/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -package mekanism.client.jei.machine.other; - -import javax.annotation.Nonnull; - -import mezz.jei.api.recipe.IRecipeHandler; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class MetallurgicInfuserRecipeHandler implements IRecipeHandler -{ - private final MetallurgicInfuserRecipeCategory category; - - public MetallurgicInfuserRecipeHandler(MetallurgicInfuserRecipeCategory c) - { - category = c; - } - - @Override - public Class getRecipeClass() - { - return MetallurgicInfuserRecipeWrapper.class; - } - - @Nonnull - @Override - public String getRecipeCategoryUid() - { - return category.getUid(); - } - - @Nonnull - @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull MetallurgicInfuserRecipeWrapper recipe) - { - return recipe; - } - - @Override - public boolean isRecipeValid(@Nonnull MetallurgicInfuserRecipeWrapper recipe) - { - return recipe.category == category; - } - - @Override - public String getRecipeCategoryUid(@Nonnull MetallurgicInfuserRecipeWrapper recipe) - { - return category.getUid(); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeWrapper.java index 974a3cf43..d77aefa94 100644 --- a/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeWrapper.java @@ -1,16 +1,14 @@ package mekanism.client.jei.machine.other; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import javax.annotation.Nonnull; - +import mekanism.client.jei.machine.BaseRecipeWrapper; import mekanism.common.recipe.machines.MetallurgicInfuserRecipe; -import mezz.jei.api.recipe.BlankRecipeWrapper; +import mezz.jei.api.ingredients.IIngredients; import net.minecraft.item.ItemStack; -public class MetallurgicInfuserRecipeWrapper extends BlankRecipeWrapper +public class MetallurgicInfuserRecipeWrapper extends BaseRecipeWrapper { public MetallurgicInfuserRecipe recipe; @@ -22,21 +20,20 @@ public class MetallurgicInfuserRecipeWrapper extends BlankRecipeWrapper category = c; } - @Nonnull @Override - public List getInputs() + public void getIngredients(IIngredients ingredients) { - List list = new ArrayList(); - list.add(recipe.getInput().inputStack); - list.addAll(MetallurgicInfuserRecipeCategory.getInfuseStacks(recipe.getInput().infuse.type)); + List inputStacks = Arrays.asList(recipe.recipeInput.inputStack); + List infuseStacks = MetallurgicInfuserRecipeCategory.getInfuseStacks(recipe.getInput().infuse.type); - return list; + ingredients.setInput(ItemStack.class, recipe.recipeInput.inputStack); + ingredients.setInputLists(ItemStack.class, Arrays.asList(inputStacks, infuseStacks)); + ingredients.setOutput(ItemStack.class, recipe.recipeOutput.output); } - - @Nonnull + @Override - public List getOutputs() + public MetallurgicInfuserRecipeCategory getCategory() { - return Arrays.asList(recipe.getOutput().output); + return category; } } diff --git a/src/main/java/mekanism/client/jei/machine/other/PRCRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/other/PRCRecipeCategory.java index d41b2f99a..744b414ca 100644 --- a/src/main/java/mekanism/client/jei/machine/other/PRCRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/PRCRecipeCategory.java @@ -24,6 +24,7 @@ import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.ITickTimer; import mezz.jei.api.gui.ITooltipCallback; +import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; @@ -111,7 +112,7 @@ public class PRCRecipeCategory extends BaseRecipeCategory } @Override - public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) + public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) { if(recipeWrapper instanceof PRCRecipeWrapper) { @@ -123,15 +124,14 @@ public class PRCRecipeCategory extends BaseRecipeCategory itemStacks.init(0, true, 53-xOffset, 34-yOffset); itemStacks.init(1, false, 115-xOffset, 34-yOffset); - itemStacks.set(0, recipeWrapper.getInputs()); - itemStacks.set(1, recipeWrapper.getOutputs()); + itemStacks.set(0, tempRecipe.recipeInput.getSolid()); + itemStacks.set(1, tempRecipe.recipeOutput.getItemOutput()); IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks(); fluidStacks.init(0, true, 3, 0, 16, 58, tempRecipe.getInput().getFluid().amount, false, fluidOverlay); - fluidStacks.set(0, recipeWrapper.getFluidInputs()); + fluidStacks.set(0, tempRecipe.recipeInput.getFluid()); fluidStacks.addTooltipCallback(new ITooltipCallback() { - @Override public void onTooltip(int slotIndex, boolean input, FluidStack ingredient, List tooltip) { diff --git a/src/main/java/mekanism/client/jei/machine/other/PRCRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/other/PRCRecipeHandler.java deleted file mode 100644 index 2567cafb8..000000000 --- a/src/main/java/mekanism/client/jei/machine/other/PRCRecipeHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -package mekanism.client.jei.machine.other; - -import javax.annotation.Nonnull; - -import mezz.jei.api.recipe.IRecipeHandler; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class PRCRecipeHandler implements IRecipeHandler -{ - private final PRCRecipeCategory category; - - public PRCRecipeHandler(PRCRecipeCategory c) - { - category = c; - } - - @Override - public Class getRecipeClass() - { - return PRCRecipeWrapper.class; - } - - @Nonnull - @Override - public String getRecipeCategoryUid() - { - return category.getUid(); - } - - @Nonnull - @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull PRCRecipeWrapper recipe) - { - return recipe; - } - - @Override - public boolean isRecipeValid(@Nonnull PRCRecipeWrapper recipe) - { - return recipe.category == category; - } - - @Override - public String getRecipeCategoryUid(@Nonnull PRCRecipeWrapper recipe) - { - return category.getUid(); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/other/PRCRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/other/PRCRecipeWrapper.java index 4d1ddcfce..bed55c013 100644 --- a/src/main/java/mekanism/client/jei/machine/other/PRCRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/PRCRecipeWrapper.java @@ -1,19 +1,19 @@ package mekanism.client.jei.machine.other; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import javax.annotation.Nonnull; import javax.annotation.Nullable; +import mekanism.api.gas.GasStack; +import mekanism.client.jei.machine.BaseRecipeWrapper; import mekanism.common.recipe.machines.PressurizedRecipe; import mekanism.common.util.LangUtils; -import mezz.jei.api.recipe.BlankRecipeWrapper; +import mezz.jei.api.ingredients.IIngredients; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -public class PRCRecipeWrapper extends BlankRecipeWrapper +public class PRCRecipeWrapper extends BaseRecipeWrapper { public PressurizedRecipe recipe; @@ -25,25 +25,14 @@ public class PRCRecipeWrapper extends BlankRecipeWrapper category = c; } - @Nonnull @Override - public List getInputs() + public void getIngredients(IIngredients ingredients) { - return Arrays.asList(recipe.getInput().getSolid()); - } - - @Nonnull - @Override - public List getFluidInputs() - { - return Arrays.asList(recipe.getInput().getFluid()); - } - - @Nonnull - @Override - public List getOutputs() - { - return Arrays.asList(recipe.getOutput().getItemOutput()); + ingredients.setInput(ItemStack.class, recipe.recipeInput.getSolid()); + ingredients.setInput(FluidStack.class, recipe.recipeInput.getFluid()); + ingredients.setInput(GasStack.class, recipe.recipeInput.getGas()); + ingredients.setOutput(ItemStack.class, recipe.recipeOutput.getItemOutput()); + ingredients.setOutput(GasStack.class, recipe.recipeOutput.getGasOutput()); } @Nullable @@ -63,4 +52,10 @@ public class PRCRecipeWrapper extends BlankRecipeWrapper return currenttip; } + + @Override + public PRCRecipeCategory getCategory() + { + return category; + } } diff --git a/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeCategory.java index bfb7f318d..647553c90 100644 --- a/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeCategory.java @@ -1,5 +1,7 @@ package mekanism.client.jei.machine.other; +import java.util.List; + import mekanism.api.gas.GasStack; import mekanism.client.jei.BaseRecipeCategory; import mezz.jei.api.IGuiHelper; @@ -7,9 +9,11 @@ import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiFluidStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.ITickTimer; +import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.FluidStack; public class RotaryCondensentratorRecipeCategory extends BaseRecipeCategory { @@ -63,7 +67,7 @@ public class RotaryCondensentratorRecipeCategory extends BaseRecipeCategory } @Override - public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) + public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) { if(recipeWrapper instanceof RotaryCondensentratorRecipeWrapper) { @@ -73,6 +77,13 @@ public class RotaryCondensentratorRecipeCategory extends BaseRecipeCategory IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks(); fluidStacks.init(0, !tempRecipe.condensentrating, 134-xOffset, 14-yOffset, 16, 58, 1000, false, fluidOverlay); - fluidStacks.set(0, tempRecipe.condensentrating ? recipeWrapper.getFluidOutputs() : recipeWrapper.getFluidInputs()); + + if(tempRecipe.condensentrating) + { + fluidStacks.set(0, ingredients.getOutputs(FluidStack.class).get(0)); + } + else { + fluidStacks.set(0, ingredients.getInputs(FluidStack.class).get(0)); + } } } diff --git a/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeHandler.java deleted file mode 100644 index 74e16658d..000000000 --- a/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -package mekanism.client.jei.machine.other; - -import javax.annotation.Nonnull; - -import mezz.jei.api.recipe.IRecipeHandler; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class RotaryCondensentratorRecipeHandler implements IRecipeHandler -{ - private final RotaryCondensentratorRecipeCategory category; - - public RotaryCondensentratorRecipeHandler(RotaryCondensentratorRecipeCategory c) - { - category = c; - } - - @Override - public Class getRecipeClass() - { - return RotaryCondensentratorRecipeWrapper.class; - } - - @Nonnull - @Override - public String getRecipeCategoryUid() - { - return category.getUid(); - } - - @Nonnull - @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull RotaryCondensentratorRecipeWrapper recipe) - { - return recipe; - } - - @Override - public boolean isRecipeValid(@Nonnull RotaryCondensentratorRecipeWrapper recipe) - { - return recipe.category == category; - } - - @Override - public String getRecipeCategoryUid(@Nonnull RotaryCondensentratorRecipeWrapper recipe) - { - return category.getUid(); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeWrapper.java index 703de3bdb..3d3293735 100644 --- a/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeWrapper.java @@ -1,22 +1,22 @@ package mekanism.client.jei.machine.other; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import javax.annotation.Nonnull; import javax.annotation.Nullable; import mekanism.api.gas.Gas; +import mekanism.api.gas.GasStack; +import mekanism.client.jei.machine.BaseRecipeWrapper; import mekanism.common.util.LangUtils; -import mezz.jei.api.recipe.BlankRecipeWrapper; +import mezz.jei.api.ingredients.IIngredients; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; -public class RotaryCondensentratorRecipeWrapper extends BlankRecipeWrapper +public class RotaryCondensentratorRecipeWrapper extends BaseRecipeWrapper { public Fluid fluidType; public Gas gasType; @@ -34,43 +34,17 @@ public class RotaryCondensentratorRecipeWrapper extends BlankRecipeWrapper category = c; } - @Nonnull @Override - public List getInputs() - { - return new ArrayList(); - } - - @Nonnull - @Override - public List getFluidInputs() + public void getIngredients(IIngredients ingredients) { if(condensentrating) { - return new ArrayList(); + ingredients.setInput(GasStack.class, new GasStack(gasType, 1000)); + ingredients.setOutput(FluidStack.class, new FluidStack(fluidType, 1000)); } else { - return Arrays.asList(new FluidStack(fluidType, 1000)); - } - } - - @Nonnull - @Override - public List getOutputs() - { - return new ArrayList(); - } - - @Nonnull - @Override - public List getFluidOutputs() - { - if(condensentrating) - { - return Arrays.asList(new FluidStack(fluidType, 1000)); - } - else { - return new ArrayList(); + ingredients.setInput(FluidStack.class, new FluidStack(fluidType, 1000)); + ingredients.setOutput(GasStack.class, new GasStack(gasType, 1000)); } } @@ -94,4 +68,10 @@ public class RotaryCondensentratorRecipeWrapper extends BlankRecipeWrapper return currenttip; } + + @Override + public RotaryCondensentratorRecipeCategory getCategory() + { + return category; + } } diff --git a/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeCategory.java index 23d5e0d95..1187f95f5 100644 --- a/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeCategory.java @@ -1,11 +1,14 @@ package mekanism.client.jei.machine.other; +import java.util.List; + import mekanism.client.jei.BaseRecipeCategory; import mekanism.common.recipe.machines.SolarNeutronRecipe; import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.ITickTimer; +import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; @@ -59,7 +62,7 @@ public class SolarNeutronRecipeCategory extends BaseRecipeCategory } @Override - public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) + public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) { if(recipeWrapper instanceof SolarNeutronRecipeWrapper) { diff --git a/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeHandler.java deleted file mode 100644 index f55e1170c..000000000 --- a/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -package mekanism.client.jei.machine.other; - -import javax.annotation.Nonnull; - -import mezz.jei.api.recipe.IRecipeHandler; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class SolarNeutronRecipeHandler implements IRecipeHandler -{ - private final SolarNeutronRecipeCategory category; - - public SolarNeutronRecipeHandler(SolarNeutronRecipeCategory c) - { - category = c; - } - - @Override - public Class getRecipeClass() - { - return SolarNeutronRecipeWrapper.class; - } - - @Nonnull - @Override - public String getRecipeCategoryUid() - { - return category.getUid(); - } - - @Nonnull - @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull SolarNeutronRecipeWrapper recipe) - { - return recipe; - } - - @Override - public boolean isRecipeValid(@Nonnull SolarNeutronRecipeWrapper recipe) - { - return recipe.category == category; - } - - @Override - public String getRecipeCategoryUid(@Nonnull SolarNeutronRecipeWrapper recipe) - { - return category.getUid(); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeWrapper.java index 068bfa2d0..ed16c824e 100644 --- a/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeWrapper.java @@ -3,15 +3,15 @@ package mekanism.client.jei.machine.other; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; import javax.annotation.Nullable; +import mekanism.api.gas.GasStack; +import mekanism.client.jei.machine.BaseRecipeWrapper; import mekanism.common.recipe.machines.SolarNeutronRecipe; import mekanism.common.util.LangUtils; -import mezz.jei.api.recipe.BlankRecipeWrapper; -import net.minecraft.item.ItemStack; +import mezz.jei.api.ingredients.IIngredients; -public class SolarNeutronRecipeWrapper extends BlankRecipeWrapper +public class SolarNeutronRecipeWrapper extends BaseRecipeWrapper { public SolarNeutronRecipe recipe; @@ -23,18 +23,11 @@ public class SolarNeutronRecipeWrapper extends BlankRecipeWrapper category = c; } - @Nonnull @Override - public List getInputs() + public void getIngredients(IIngredients ingredients) { - return new ArrayList(); - } - - @Nonnull - @Override - public List getOutputs() - { - return new ArrayList(); + ingredients.setInput(GasStack.class, recipe.getInput().ingredient); + ingredients.setOutput(GasStack.class, recipe.getOutput().output); } @Nullable @@ -54,4 +47,10 @@ public class SolarNeutronRecipeWrapper extends BlankRecipeWrapper return currenttip; } + + @Override + public SolarNeutronRecipeCategory getCategory() + { + return category; + } } diff --git a/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeCategory.java index a191ffbf7..bf9cf0aaf 100644 --- a/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeCategory.java @@ -10,6 +10,7 @@ import mezz.jei.api.gui.IGuiFluidStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.ITickTimer; import mezz.jei.api.gui.ITooltipCallback; +import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; @@ -56,7 +57,7 @@ public class ThermalEvaporationRecipeCategory extends BaseRecipeCategory } @Override - public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper) + public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) { if(recipeWrapper instanceof ThermalEvaporationRecipeWrapper) { @@ -68,11 +69,10 @@ public class ThermalEvaporationRecipeCategory extends BaseRecipeCategory fluidStacks.init(0, true, 7-xOffset, 14-yOffset, 16, 58, tempRecipe.getInput().ingredient.amount, false, fluidOverlay); fluidStacks.init(1, false, 153-xOffset, 14-yOffset, 16, 58, tempRecipe.getOutput().output.amount, false, fluidOverlay); - fluidStacks.set(0, recipeWrapper.getFluidInputs()); - fluidStacks.set(1, recipeWrapper.getFluidOutputs()); + fluidStacks.set(0, tempRecipe.recipeInput.ingredient); + fluidStacks.set(1, tempRecipe.recipeOutput.output); fluidStacks.addTooltipCallback(new ITooltipCallback() { - @Override public void onTooltip(int slotIndex, boolean input, FluidStack ingredient, List tooltip) { diff --git a/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeHandler.java b/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeHandler.java deleted file mode 100644 index 7722eb8cd..000000000 --- a/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -package mekanism.client.jei.machine.other; - -import javax.annotation.Nonnull; - -import mezz.jei.api.recipe.IRecipeHandler; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class ThermalEvaporationRecipeHandler implements IRecipeHandler -{ - private final ThermalEvaporationRecipeCategory category; - - public ThermalEvaporationRecipeHandler(ThermalEvaporationRecipeCategory c) - { - category = c; - } - - @Override - public Class getRecipeClass() - { - return ThermalEvaporationRecipeWrapper.class; - } - - @Nonnull - @Override - public String getRecipeCategoryUid() - { - return category.getUid(); - } - - @Nonnull - @Override - public IRecipeWrapper getRecipeWrapper(@Nonnull ThermalEvaporationRecipeWrapper recipe) - { - return recipe; - } - - @Override - public boolean isRecipeValid(@Nonnull ThermalEvaporationRecipeWrapper recipe) - { - return recipe.category == category; - } - - @Override - public String getRecipeCategoryUid(@Nonnull ThermalEvaporationRecipeWrapper recipe) - { - return category.getUid(); - } -} diff --git a/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeWrapper.java index 3fc0c671a..ff22dc42f 100644 --- a/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeWrapper.java @@ -1,15 +1,11 @@ package mekanism.client.jei.machine.other; -import java.util.Arrays; -import java.util.List; - -import javax.annotation.Nonnull; - +import mekanism.client.jei.machine.BaseRecipeWrapper; import mekanism.common.recipe.machines.ThermalEvaporationRecipe; -import mezz.jei.api.recipe.BlankRecipeWrapper; +import mezz.jei.api.ingredients.IIngredients; import net.minecraftforge.fluids.FluidStack; -public class ThermalEvaporationRecipeWrapper extends BlankRecipeWrapper +public class ThermalEvaporationRecipeWrapper extends BaseRecipeWrapper { public ThermalEvaporationRecipe recipe; @@ -20,18 +16,17 @@ public class ThermalEvaporationRecipeWrapper extends BlankRecipeWrapper recipe = r; category = c; } - - @Nonnull + @Override - public List getFluidInputs() + public void getIngredients(IIngredients ingredients) { - return Arrays.asList(recipe.getInput().ingredient); + ingredients.setInput(FluidStack.class, recipe.getInput().ingredient); + ingredients.setOutput(FluidStack.class, recipe.getOutput().output); } - @Nonnull @Override - public List getFluidOutputs() + public ThermalEvaporationRecipeCategory getCategory() { - return Arrays.asList(recipe.getOutput().output); + return category; } } diff --git a/src/main/java/mekanism/client/render/MekanismRenderer.java b/src/main/java/mekanism/client/render/MekanismRenderer.java index 7c9590855..70187de84 100644 --- a/src/main/java/mekanism/client/render/MekanismRenderer.java +++ b/src/main/java/mekanism/client/render/MekanismRenderer.java @@ -7,20 +7,20 @@ import java.util.List; import java.util.Map; import mekanism.api.EnumColor; -import mekanism.api.ObfuscatedNames; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; import mekanism.api.infuse.InfuseRegistry; import mekanism.api.infuse.InfuseType; import mekanism.api.transmitters.TransmissionType; -import mekanism.api.util.ReflectionUtils; import mekanism.client.render.obj.TransmitterModel; import mekanism.client.render.tileentity.RenderConfigurableMachine; import mekanism.client.render.tileentity.RenderFluidTank; import mekanism.client.render.tileentity.RenderThermalEvaporationController; import mekanism.client.render.transmitter.RenderLogisticalTransporter; import mekanism.client.render.transmitter.RenderMechanicalPipe; +import mekanism.common.ObfuscatedNames; import mekanism.common.base.IMetaItem; +import mekanism.common.util.ReflectionUtils; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GLAllocation; @@ -238,6 +238,15 @@ public class MekanismRenderer } } + public static void saveRenderer(Tessellator tess) + { + if(MekanismRenderer.isDrawing(tess)) + { + prevFormat = tess.getBuffer().getVertexFormat(); + prevMode = tess.getBuffer().getDrawMode(); + } + } + public static void resumeRenderer(Tessellator tess) { if(prevFormat != null) diff --git a/src/main/java/mekanism/client/render/MinerVisualRenderer.java b/src/main/java/mekanism/client/render/MinerVisualRenderer.java index d1d2bc2aa..f72e44355 100644 --- a/src/main/java/mekanism/client/render/MinerVisualRenderer.java +++ b/src/main/java/mekanism/client/render/MinerVisualRenderer.java @@ -61,7 +61,7 @@ public final class MinerVisualRenderer { if(x == -data.radius || x == data.radius || y == data.minY-data.yCoord || y == data.maxY-data.yCoord || z == -data.radius || z == data.radius) { - models.add(createModel(new Coord4D(x, y, z, mc.theWorld.provider.getDimension()))); + models.add(createModel(new Coord4D(x, y, z, mc.world.provider.getDimension()))); } } } diff --git a/src/main/java/mekanism/client/render/RenderTickHandler.java b/src/main/java/mekanism/client/render/RenderTickHandler.java index fa733fc45..67ac8e614 100644 --- a/src/main/java/mekanism/client/render/RenderTickHandler.java +++ b/src/main/java/mekanism/client/render/RenderTickHandler.java @@ -6,10 +6,14 @@ import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.MekanismAPI; import mekanism.api.Pos3D; +import mekanism.client.ClientTickHandler; import mekanism.client.render.particle.EntityJetpackFlameFX; import mekanism.client.render.particle.EntityJetpackSmokeFX; import mekanism.client.render.particle.EntityScubaBubbleFX; +import mekanism.common.ColourRGBA; import mekanism.common.Mekanism; +import mekanism.common.item.ItemConfigurator; +import mekanism.common.item.ItemConfigurator.ConfiguratorMode; import mekanism.common.item.ItemFlamethrower; import mekanism.common.item.ItemJetpack; import mekanism.common.item.ItemScubaTank; @@ -36,16 +40,17 @@ public class RenderTickHandler { public Random rand = new Random(); public Minecraft mc = Minecraft.getMinecraft(); + public static int modeSwitchTimer = 0; @SubscribeEvent public void tickEnd(RenderTickEvent event) { if(event.phase == Phase.END) { - if(mc.thePlayer != null && mc.theWorld != null && !mc.isGamePaused()) + if(mc.player != null && mc.world != null && !mc.isGamePaused()) { - EntityPlayer player = mc.thePlayer; - World world = mc.thePlayer.worldObj; + EntityPlayer player = mc.player; + World world = mc.player.world; FontRenderer font = mc.fontRendererObj; RayTraceResult pos = player.rayTrace(40.0D, 1.0F); @@ -78,8 +83,28 @@ public class RenderTickHandler font.drawStringWithShadow("Side: " + pos.sideHit, 1, 37, 0x404040); } } + + if(modeSwitchTimer > 1 && mc.currentScreen == null && player.getHeldItemMainhand().getItem() instanceof ItemConfigurator) + { + ItemStack stack = player.getHeldItemMainhand(); + ScaledResolution scaledresolution = new ScaledResolution(mc); + ConfiguratorMode mode = ((ItemConfigurator)stack.getItem()).getState(stack); + + int x = scaledresolution.getScaledWidth(); + int y = scaledresolution.getScaledHeight(); + int stringWidth = font.getStringWidth(mode.getName()); + int color = new ColourRGBA(1, 1, 1, (float)modeSwitchTimer/100F).argb(); + font.drawString(mode.getColor() + mode.getName(), x/2 - stringWidth/2, y-60, color); + } + + modeSwitchTimer = Math.max(modeSwitchTimer-1, 0); + + if(modeSwitchTimer == 0) + { + ClientTickHandler.wheelStatus = 0; + } - if(player != null && mc.currentScreen == null && player.getItemStackFromSlot(EntityEquipmentSlot.CHEST) != null) + if(mc.currentScreen == null && !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty()) { ItemStack stack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); @@ -109,7 +134,7 @@ public class RenderTickHandler { for(String s : Mekanism.jetpackOn) { - EntityPlayer p = mc.theWorld.getPlayerEntityByName(s); + EntityPlayer p = mc.world.getPlayerEntityByName(s); if(p == null) { @@ -154,7 +179,7 @@ public class RenderTickHandler { for(String s : Mekanism.gasmaskOn) { - EntityPlayer p = mc.theWorld.getPlayerEntityByName(s); + EntityPlayer p = mc.world.getPlayerEntityByName(s); if(p == null || !p.isInWater()) { @@ -179,7 +204,7 @@ public class RenderTickHandler { for(EntityPlayer p : world.playerEntities) { - if(!Mekanism.flamethrowerActive.contains(p.getName()) && !p.isSwingInProgress && p.inventory.getCurrentItem() != null && p.inventory.getCurrentItem().getItem() instanceof ItemFlamethrower) + if(!Mekanism.flamethrowerActive.contains(p.getName()) && !p.isSwingInProgress && !p.inventory.getCurrentItem().isEmpty() && p.inventory.getCurrentItem().getItem() instanceof ItemFlamethrower) { if(((ItemFlamethrower)p.inventory.getCurrentItem().getItem()).getGas(p.inventory.getCurrentItem()) != null) { diff --git a/src/main/java/mekanism/client/render/ctm/Dir.java b/src/main/java/mekanism/client/render/ctm/Dir.java index f82c8f05d..111c73f64 100644 --- a/src/main/java/mekanism/client/render/ctm/Dir.java +++ b/src/main/java/mekanism/client/render/ctm/Dir.java @@ -14,7 +14,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; /** - * Think of this class as a "Two dimensional ForgeDirection, with diagonals". + * Think of this class as a "Two dimensional EnumFacing, with diagonals". *

* It represents the eight different directions a face of a block can connect with CTM, and contains the logic for determining if a block is indeed connected in that direction. *

diff --git a/src/main/java/mekanism/client/render/ctm/Quad.java b/src/main/java/mekanism/client/render/ctm/Quad.java index 87751f069..3a2c3b404 100644 --- a/src/main/java/mekanism/client/render/ctm/Quad.java +++ b/src/main/java/mekanism/client/render/ctm/Quad.java @@ -483,6 +483,12 @@ public class Quad private boolean applyDiffuseLighting; + @Override + public void setTexture(TextureAtlasSprite sprite) + { + //TODO ignore for now + } + @Override public void setQuadTint(int tint) { diff --git a/src/main/java/mekanism/client/render/entity/RenderObsidianTNTPrimed.java b/src/main/java/mekanism/client/render/entity/RenderObsidianTNTPrimed.java index 88c9715ee..8ae7b9cad 100644 --- a/src/main/java/mekanism/client/render/entity/RenderObsidianTNTPrimed.java +++ b/src/main/java/mekanism/client/render/entity/RenderObsidianTNTPrimed.java @@ -35,7 +35,7 @@ public class RenderObsidianTNTPrimed extends Render if(entityobsidiantnt.fuse - partialTicks + 1.0F < 10.0F) { float f = 1.0F - (entityobsidiantnt.fuse - partialTicks + 1.0F) / 10.0F; - f = MathHelper.clamp_float(f, 0.0F, 1.0F); + f = MathHelper.clamp(f, 0.0F, 1.0F); f = f * f; f = f * f; float f1 = 1.0F + f * 0.3F; diff --git a/src/main/java/mekanism/client/render/item/BakedCustomItemModel.java b/src/main/java/mekanism/client/render/item/BakedCustomItemModel.java index 88dd0ba1f..0355aefea 100644 --- a/src/main/java/mekanism/client/render/item/BakedCustomItemModel.java +++ b/src/main/java/mekanism/client/render/item/BakedCustomItemModel.java @@ -27,6 +27,7 @@ import mekanism.client.render.ctm.CTMModelFactory; import mekanism.client.render.tileentity.RenderBin; import mekanism.client.render.tileentity.RenderEnergyCube; import mekanism.client.render.tileentity.RenderFluidTank; +import mekanism.common.Mekanism; import mekanism.common.MekanismItems; import mekanism.common.SideData.IOState; import mekanism.common.Tier.EnergyCubeTier; @@ -70,6 +71,7 @@ import net.minecraftforge.fluids.Fluid; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GLContext; public class BakedCustomItemModel implements IBakedModel, IPerspectiveAwareModel { @@ -120,7 +122,7 @@ public class BakedCustomItemModel implements IBakedModel, IPerspectiveAwareModel { if(basicType == BasicBlockType.BIN) { - GlStateManager.pushMatrix(); + /*GlStateManager.pushMatrix(); ItemBlockBasic itemBasic = (ItemBlockBasic)stack.getItem(); InventoryBin inv = new InventoryBin(stack); binRenderer.render(EnumFacing.NORTH, inv.getItemType(), inv.getItemCount(), false, -0.5, -0.5, -0.5); @@ -131,7 +133,7 @@ public class BakedCustomItemModel implements IBakedModel, IPerspectiveAwareModel GlStateManager.enableBlend(); GlStateManager.blendFunc(770, 771); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.popMatrix(); + GlStateManager.popMatrix(); TODO get this working*/ } else if(basicType == BasicBlockType.SECURITY_DESK) { @@ -424,27 +426,41 @@ public class BakedCustomItemModel implements IBakedModel, IPerspectiveAwareModel } Tessellator tessellator = Tessellator.getInstance(); - VertexFormat prevFormat = null; - int prevMode = -1; - - MekanismRenderer.pauseRenderer(tessellator); - List generalQuads = new LinkedList(); - - GlStateManager.pushMatrix(); - GlStateManager.translate(0.5F, 0.5F, 0.5F); - GlStateManager.rotate(180, 0.0F, 1.0F, 0.0F); - doRender(prevTransform); - GlStateManager.enableLighting(); - GlStateManager.enableLight(0); - GlStateManager.enableLight(1); - GlStateManager.enableColorMaterial(); - GlStateManager.colorMaterial(1032, 5634); - GlStateManager.enableCull(); - Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); - GlStateManager.popMatrix(); - - MekanismRenderer.resumeRenderer(tessellator); + + //Test if the current thread has a Context loaded (we don't use it so no need to import its type) + Object contextCapabilities; + try { + contextCapabilities = GLContext.getCapabilities(); + } catch (RuntimeException e){ + contextCapabilities = null; + } + + if (contextCapabilities != null && MekanismRenderer.isDrawing(tessellator)) { + try { + VertexFormat prevFormat = null; + int prevMode = -1; + + MekanismRenderer.pauseRenderer(tessellator); + + GlStateManager.pushMatrix(); + GlStateManager.translate(0.5F, 0.5F, 0.5F); + GlStateManager.rotate(180, 0.0F, 1.0F, 0.0F); + doRender(prevTransform); + GlStateManager.enableLighting(); + GlStateManager.enableLight(0); + GlStateManager.enableLight(1); + GlStateManager.enableColorMaterial(); + GlStateManager.colorMaterial(1032, 5634); + GlStateManager.enableCull(); + Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + GlStateManager.popMatrix(); + + MekanismRenderer.resumeRenderer(tessellator); + } catch (Throwable t) { + Mekanism.logger.error("Error caught in CustomItemModel", t); + } + } if(Block.getBlockFromItem(stack.getItem()) != null) { diff --git a/src/main/java/mekanism/client/render/obj/GlowPanelModel.java b/src/main/java/mekanism/client/render/obj/GlowPanelModel.java index abf9ce0b0..571bb2730 100644 --- a/src/main/java/mekanism/client/render/obj/GlowPanelModel.java +++ b/src/main/java/mekanism/client/render/obj/GlowPanelModel.java @@ -8,8 +8,8 @@ import javax.vecmath.Matrix4f; import mekanism.api.EnumColor; import mekanism.client.render.ctm.CTMModelFactory; -import mekanism.common.multipart.ColorProperty; -import mekanism.common.multipart.PartGlowPanel; +import mekanism.common.block.property.PropertyColor; +import mekanism.common.tile.TileEntityGlowPanel; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; @@ -70,7 +70,7 @@ public class GlowPanelModel extends OBJBakedModelBase if(tempState != null) { - return ((IExtendedBlockState)tempState).getValue(ColorProperty.INSTANCE).color; + return ((IExtendedBlockState)tempState).getValue(PropertyColor.INSTANCE).color; } return EnumColor.WHITE; @@ -137,8 +137,8 @@ public class GlowPanelModel extends OBJBakedModelBase if(state != null && tempState == null) { - int hash = PartGlowPanel.hash((IExtendedBlockState)state); - EnumColor color = ((IExtendedBlockState)state).getValue(ColorProperty.INSTANCE).color; + int hash = TileEntityGlowPanel.hash((IExtendedBlockState)state); + EnumColor color = ((IExtendedBlockState)state).getValue(PropertyColor.INSTANCE).color; if(!glowPanelCache.containsKey(hash)) { diff --git a/src/main/java/mekanism/client/render/obj/TransmitterModel.java b/src/main/java/mekanism/client/render/obj/TransmitterModel.java index 918352efa..add01f4b5 100644 --- a/src/main/java/mekanism/client/render/obj/TransmitterModel.java +++ b/src/main/java/mekanism/client/render/obj/TransmitterModel.java @@ -10,12 +10,12 @@ import java.util.Set; import javax.vecmath.Matrix4f; -import mekanism.api.MekanismConfig.client; import mekanism.client.render.ctm.CTMModelFactory; -import mekanism.common.multipart.ColorProperty; -import mekanism.common.multipart.ConnectionProperty; -import mekanism.common.multipart.PartSidedPipe; -import mekanism.common.multipart.PartSidedPipe.ConnectionType; +import mekanism.common.block.property.PropertyColor; +import mekanism.common.block.property.PropertyConnection; +import mekanism.common.config.MekanismConfig.client; +import mekanism.common.tile.transmitter.TileEntitySidedPipe; +import mekanism.common.tile.transmitter.TileEntitySidedPipe.ConnectionType; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.IBakedModel; @@ -117,12 +117,12 @@ public class TransmitterModel extends OBJBakedModelBase { IExtendedBlockState extended = (IExtendedBlockState)state; BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer(); - ColorProperty colorProp = extended.getValue(ColorProperty.INSTANCE); + PropertyColor colorProp = extended.getValue(PropertyColor.INSTANCE); int color = -1; if(colorProp != null && colorProp.color != null) { - color = extended.getValue(ColorProperty.INSTANCE).color.ordinal(); + color = extended.getValue(PropertyColor.INSTANCE).color.ordinal(); } OBJState obj = extended.getValue(OBJProperty.INSTANCE); @@ -132,21 +132,23 @@ public class TransmitterModel extends OBJBakedModelBase color = -1; } - int hash = Objects.hash(layer.ordinal(), color, ConnectionProperty.INSTANCE.valueToString(extended.getValue(ConnectionProperty.INSTANCE))); - - if(obj.getVisibilityMap().containsKey(Group.ALL) || obj.getVisibilityMap().containsKey(Group.ALL_EXCEPT)) - { - updateStateVisibilityMap(obj); - } - - if(!modelCache.containsKey(hash)) - { - TransmitterModel model = new TransmitterModel(baseModel, getModel(), obj, vertexFormat, textureMap, transformationMap); - model.tempState = state; - modelCache.put(hash, model.getQuads(state, side, rand)); - } - - return modelCache.get(hash); + try { + int hash = Objects.hash(layer.ordinal(), color, PropertyConnection.INSTANCE.valueToString(extended.getValue(PropertyConnection.INSTANCE))); + + if(obj.getVisibilityMap().containsKey(Group.ALL) || obj.getVisibilityMap().containsKey(Group.ALL_EXCEPT)) + { + updateStateVisibilityMap(obj); + } + + if(!modelCache.containsKey(hash)) + { + TransmitterModel model = new TransmitterModel(baseModel, getModel(), obj, vertexFormat, textureMap, transformationMap); + model.tempState = state; + modelCache.put(hash, model.getQuads(state, side, rand)); + } + + return modelCache.get(hash); + } catch(Exception e) {} } return super.getQuads(state, side, rand); @@ -157,7 +159,7 @@ public class TransmitterModel extends OBJBakedModelBase { if(tempState != null) { - ColorProperty prop = ((IExtendedBlockState)tempState).getValue(ColorProperty.INSTANCE); + PropertyColor prop = ((IExtendedBlockState)tempState).getValue(PropertyColor.INSTANCE); if(MinecraftForgeClient.getRenderLayer() == BlockRenderLayer.TRANSLUCENT && prop != null && prop.color != null) { @@ -174,8 +176,8 @@ public class TransmitterModel extends OBJBakedModelBase if(tempState != null) { EnumFacing side = EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z); - ColorProperty prop = ((IExtendedBlockState)tempState).getValue(ColorProperty.INSTANCE); - ConnectionProperty connection = ((IExtendedBlockState)tempState).getValue(ConnectionProperty.INSTANCE); + PropertyColor prop = ((IExtendedBlockState)tempState).getValue(PropertyColor.INSTANCE); + PropertyConnection connection = ((IExtendedBlockState)tempState).getValue(PropertyConnection.INSTANCE); boolean sideIconOverride = getIconStatus(side, connection) > 0; if(MinecraftForgeClient.getRenderLayer() == BlockRenderLayer.TRANSLUCENT) @@ -224,7 +226,7 @@ public class TransmitterModel extends OBJBakedModelBase if(tempState != null) { EnumFacing side = EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z); - ConnectionProperty connection = ((IExtendedBlockState)tempState).getValue(ConnectionProperty.INSTANCE); + PropertyConnection connection = ((IExtendedBlockState)tempState).getValue(PropertyConnection.INSTANCE); if(groupName.endsWith("NONE") && getIconStatus(side, connection) == 2) { @@ -235,9 +237,9 @@ public class TransmitterModel extends OBJBakedModelBase return false; } - public byte getIconStatus(EnumFacing side, ConnectionProperty connection) + public byte getIconStatus(EnumFacing side, PropertyConnection connection) { - ConnectionType type = PartSidedPipe.getConnectionType(side, connection.connectionByte, connection.transmitterConnections, connection.connectionTypes); + ConnectionType type = TileEntitySidedPipe.getConnectionType(side, connection.connectionByte, connection.transmitterConnections, connection.connectionTypes); if(type == ConnectionType.NONE) { diff --git a/src/main/java/mekanism/client/render/tileentity/RenderConfigurableMachine.java b/src/main/java/mekanism/client/render/tileentity/RenderConfigurableMachine.java index 9162bdf62..0026ead4c 100644 --- a/src/main/java/mekanism/client/render/tileentity/RenderConfigurableMachine.java +++ b/src/main/java/mekanism/client/render/tileentity/RenderConfigurableMachine.java @@ -44,11 +44,11 @@ public class RenderConfigurableMachine +public class RenderLogisticalTransporter extends RenderTransmitterBase { private ModelTransporterBox modelBox = new ModelTransporterBox(); @@ -50,7 +50,7 @@ public class RenderLogisticalTransporter extends RenderTransmitterBase +public class RenderMechanicalPipe extends RenderTransmitterBase { private static HashMap> cachedLiquids = new HashMap>(); @@ -33,7 +33,7 @@ public class RenderMechanicalPipe extends RenderTransmitterBase +public class RenderPressurizedTube extends RenderTransmitterBase { public RenderPressurizedTube() { @@ -18,7 +18,7 @@ public class RenderPressurizedTube extends RenderTransmitterBase +public class RenderThermodynamicConductor extends RenderTransmitterBase { public RenderThermodynamicConductor() { @@ -18,7 +18,7 @@ public class RenderThermodynamicConductor extends RenderTransmitterBase extends MultipartSpecialRenderer +public abstract class RenderTransmitterBase extends TileEntitySpecialRenderer { private static OBJModel contentsModel; private static Map contentsMap = new HashMap(); @@ -106,7 +106,7 @@ public abstract class RenderTransmitterBase extends M return modelParts; } - public IBakedModel getModelForSide(PartTransmitter part, EnumFacing side) + public IBakedModel getModelForSide(TileEntityTransmitter part, EnumFacing side) { String sideName = side.name().toLowerCase(); String typeName = part.getConnectionType(side).name().toUpperCase(); diff --git a/src/main/java/mekanism/client/render/transmitter/RenderUniversalCable.java b/src/main/java/mekanism/client/render/transmitter/RenderUniversalCable.java index 3faa0bb4a..500327c58 100644 --- a/src/main/java/mekanism/client/render/transmitter/RenderUniversalCable.java +++ b/src/main/java/mekanism/client/render/transmitter/RenderUniversalCable.java @@ -1,16 +1,16 @@ package mekanism.client.render.transmitter; -import mekanism.api.MekanismConfig.client; import mekanism.client.render.MekanismRenderer; import mekanism.common.ColourRGBA; -import mekanism.common.multipart.PartUniversalCable; +import mekanism.common.config.MekanismConfig.client; +import mekanism.common.tile.transmitter.TileEntityUniversalCable; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.util.EnumFacing; import org.lwjgl.opengl.GL11; -public class RenderUniversalCable extends RenderTransmitterBase +public class RenderUniversalCable extends RenderTransmitterBase { public RenderUniversalCable() { @@ -18,7 +18,7 @@ public class RenderUniversalCable extends RenderTransmitterBase"; } @Override - public List getCommandAliases() + public List getAliases() { return Arrays.asList(new String[] {"mekanism", "mek"}); } @@ -49,13 +45,13 @@ public class CommandMekanism extends CommandBase { if(params.length < 1) { - sender.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------")); - sender.addChatMessage(new TextComponentString(EnumColor.GREY + " *Version: " + EnumColor.DARK_GREY + Mekanism.versionNumber)); - sender.addChatMessage(new TextComponentString(EnumColor.GREY + " *Latest Version: " + EnumColor.DARK_GREY + Mekanism.latestVersionNumber)); - sender.addChatMessage(new TextComponentString(EnumColor.GREY + " *Developed on Mac OS X 10.8 Mountain Lion")); - sender.addChatMessage(new TextComponentString(EnumColor.GREY + " *Code, textures, and ideas by aidancbrady")); - sender.addChatMessage(new TextComponentString(EnumColor.GREY + " *Recent News: " + EnumColor.INDIGO + Mekanism.recentNews)); - sender.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); + sender.sendMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------")); + sender.sendMessage(new TextComponentString(EnumColor.GREY + " *Version: " + EnumColor.DARK_GREY + Mekanism.versionNumber)); + sender.sendMessage(new TextComponentString(EnumColor.GREY + " *Latest Version: " + EnumColor.DARK_GREY + Mekanism.latestVersionNumber)); + sender.sendMessage(new TextComponentString(EnumColor.GREY + " *Developed on Mac OS X 10.8 Mountain Lion")); + sender.sendMessage(new TextComponentString(EnumColor.GREY + " *Code, textures, and ideas by aidancbrady")); + sender.sendMessage(new TextComponentString(EnumColor.GREY + " *Recent News: " + EnumColor.INDIGO + Mekanism.recentNews)); + sender.sendMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); } else if(params.length >= 1) { @@ -63,25 +59,25 @@ public class CommandMekanism extends CommandBase { if(params.length == 1) { - sender.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------")); - sender.addChatMessage(new TextComponentString(EnumColor.INDIGO + " /mk" + EnumColor.GREY + " -- displays the main page.")); - sender.addChatMessage(new TextComponentString(EnumColor.INDIGO + " /mk help" + EnumColor.GREY + " -- displays this guide.")); - sender.addChatMessage(new TextComponentString(EnumColor.INDIGO + " /mk version" + EnumColor.GREY + " -- displays the version number.")); - sender.addChatMessage(new TextComponentString(EnumColor.INDIGO + " /mk latest" + EnumColor.GREY + " -- displays the latest version number.")); - sender.addChatMessage(new TextComponentString(EnumColor.INDIGO + " /mk news" + EnumColor.GREY + " -- displays most recent recent news.")); - sender.addChatMessage(new TextComponentString(EnumColor.INDIGO + " /mk debug" + EnumColor.GREY + " -- toggles Mekanism's debug mode.")); - sender.addChatMessage(new TextComponentString(EnumColor.INDIGO + " /mk teleporter" + EnumColor.GREY + " -- provides information on teleporters.")); - sender.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); + sender.sendMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------")); + sender.sendMessage(new TextComponentString(EnumColor.INDIGO + " /mk" + EnumColor.GREY + " -- displays the main page.")); + sender.sendMessage(new TextComponentString(EnumColor.INDIGO + " /mk help" + EnumColor.GREY + " -- displays this guide.")); + sender.sendMessage(new TextComponentString(EnumColor.INDIGO + " /mk version" + EnumColor.GREY + " -- displays the version number.")); + sender.sendMessage(new TextComponentString(EnumColor.INDIGO + " /mk latest" + EnumColor.GREY + " -- displays the latest version number.")); + sender.sendMessage(new TextComponentString(EnumColor.INDIGO + " /mk news" + EnumColor.GREY + " -- displays most recent recent news.")); + sender.sendMessage(new TextComponentString(EnumColor.INDIGO + " /mk debug" + EnumColor.GREY + " -- toggles Mekanism's debug mode.")); + sender.sendMessage(new TextComponentString(EnumColor.INDIGO + " /mk teleporter" + EnumColor.GREY + " -- provides information on teleporters.")); + sender.sendMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); } else if(params[1].equalsIgnoreCase("teleporter")) { - sender.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------")); - sender.addChatMessage(new TextComponentString(EnumColor.INDIGO + " /mk teleporter freq list" + EnumColor.GREY + " -- displays a list of the public frequencies.")); - sender.addChatMessage(new TextComponentString(EnumColor.INDIGO + " /mk teleporter freq list [user]" + EnumColor.GREY + " -- displays a list of a certain user's private frequencies.")); - sender.addChatMessage(new TextComponentString(EnumColor.INDIGO + " /mk teleporter freq delete [freq]" + EnumColor.GREY + " -- removes a frequency from the public list.")); - sender.addChatMessage(new TextComponentString(EnumColor.INDIGO + " /mk teleporter freq delete [user] [freq]" + EnumColor.GREY + " -- removes a freqency from a certain user's private list.")); - sender.addChatMessage(new TextComponentString(EnumColor.INDIGO + " /mk teleporter freq deleteAll [user]" + EnumColor.GREY + " -- removes all frequencies owned by a certain user.")); - sender.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); + sender.sendMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------")); + sender.sendMessage(new TextComponentString(EnumColor.INDIGO + " /mk teleporter freq list" + EnumColor.GREY + " -- displays a list of the public frequencies.")); + sender.sendMessage(new TextComponentString(EnumColor.INDIGO + " /mk teleporter freq list [user]" + EnumColor.GREY + " -- displays a list of a certain user's private frequencies.")); + sender.sendMessage(new TextComponentString(EnumColor.INDIGO + " /mk teleporter freq delete [freq]" + EnumColor.GREY + " -- removes a frequency from the public list.")); + sender.sendMessage(new TextComponentString(EnumColor.INDIGO + " /mk teleporter freq delete [user] [freq]" + EnumColor.GREY + " -- removes a freqency from a certain user's private list.")); + sender.sendMessage(new TextComponentString(EnumColor.INDIGO + " /mk teleporter freq deleteAll [user]" + EnumColor.GREY + " -- removes all frequencies owned by a certain user.")); + sender.sendMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); } } else if(params[0].equalsIgnoreCase("version")) @@ -90,115 +86,25 @@ public class CommandMekanism extends CommandBase { if(general.updateNotifications || Mekanism.latestVersionNumber == null || Mekanism.recentNews == null || Mekanism.latestVersionNumber.equals("null")) { - sender.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Minecraft is in offline mode, could not check for updates.")); + sender.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Minecraft is in offline mode, could not check for updates.")); } else { - sender.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Your client is up to date.")); + sender.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Your client is up to date.")); } } } else if(params[0].equalsIgnoreCase("news")) { - sender.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Most recent news: " + EnumColor.INDIGO + Mekanism.recentNews)); + sender.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Most recent news: " + EnumColor.INDIGO + Mekanism.recentNews)); } else if(params[0].equalsIgnoreCase("latest")) { - sender.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " The latest version for this mod is " + EnumColor.DARK_GREY + Mekanism.latestVersionNumber + EnumColor.GREY + ".")); - } - else if(params[0].equalsIgnoreCase("teleporter")) - { - if(params.length == 2) - { - sender.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Invalid parameters.")); - } - else if(params[1].equalsIgnoreCase("freq") || params[1].equalsIgnoreCase("frequencies")) - { - if(params[2].equalsIgnoreCase("list")) - { - sender.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------")); - - if(params.length == 3) - { - for(Frequency freq : Mekanism.publicTeleporters.getFrequencies()) - { - sender.addChatMessage(new TextComponentString(EnumColor.INDIGO + " - " + freq.name + EnumColor.GREY + " (" + freq.owner + ")")); - } - } - else { - FrequencyManager manager = TileEntityTeleporter.loadManager(params[3].trim(), sender.getEntityWorld()); - - if(manager != null) - { - for(Frequency freq : manager.getFrequencies()) - { - sender.addChatMessage(new TextComponentString(EnumColor.INDIGO + " - " + freq.name + EnumColor.GREY + " (" + freq.owner + ")")); - } - } - else { - sender.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " User profile doesn't exist.")); - } - } - - sender.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); - } - else if(params[2].equalsIgnoreCase("delete")) - { - if(params.length == 4) - { - if(Mekanism.publicTeleporters.containsFrequency(params[3].trim())) - { - Mekanism.publicTeleporters.remove(params[3].trim()); - sender.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Successfully removed frequency.")); - } - else { - sender.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " No such frequency found.")); - } - } - else if(params.length == 5) - { - FrequencyManager manager = TileEntityTeleporter.loadManager(params[3].trim(), sender.getEntityWorld()); - - if(manager != null) - { - if(manager.containsFrequency(params[4].trim())) - { - manager.remove(params[4].trim()); - sender.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Successfully removed frequency.")); - } - else { - sender.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " No such frequency found.")); - } - } - else { - sender.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " User profile doesn't exist.")); - } - } - } - else if(params[2].equalsIgnoreCase("deleteAll")) - { - if(params.length == 4) - { - String owner = params[3].trim(); - FrequencyManager manager = TileEntityTeleporter.loadManager(owner, sender.getEntityWorld()); - - if(manager != null) - { - int amount = Mekanism.publicTeleporters.removeAll(owner); - amount += manager.removeAll(owner); - - sender.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Successfully removed " + amount + " frequencies.")); - } - else { - sender.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " User profile doesn't exist.")); - } - } - } - } + sender.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " The latest version for this mod is " + EnumColor.DARK_GREY + Mekanism.latestVersionNumber + EnumColor.GREY + ".")); } else if(params[0].equalsIgnoreCase("debug")) { MekanismAPI.debug = !MekanismAPI.debug; - sender.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Debug mode set to " + EnumColor.DARK_GREY + MekanismAPI.debug)); + sender.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Debug mode set to " + EnumColor.DARK_GREY + MekanismAPI.debug)); } else if(params[0].equalsIgnoreCase("op")) { @@ -221,14 +127,8 @@ public class CommandMekanism extends CommandBase } } else { - sender.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Unknown command. Type '" + EnumColor.INDIGO + "/mk help" + EnumColor.GREY + "' for help.")); + sender.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Unknown command. Type '" + EnumColor.INDIGO + "/mk help" + EnumColor.GREY + "' for help.")); } } } - - @Override - public int compareTo(ICommand obj) - { - return 0; - } } diff --git a/src/main/java/mekanism/common/CommonPlayerTickHandler.java b/src/main/java/mekanism/common/CommonPlayerTickHandler.java index cc9925b29..0fd367280 100644 --- a/src/main/java/mekanism/common/CommonPlayerTickHandler.java +++ b/src/main/java/mekanism/common/CommonPlayerTickHandler.java @@ -1,8 +1,6 @@ package mekanism.common; -import mekanism.api.ObfuscatedNames; import mekanism.api.gas.GasStack; -import mekanism.api.util.ReflectionUtils; import mekanism.common.entity.EntityFlame; import mekanism.common.item.ItemFlamethrower; import mekanism.common.item.ItemFreeRunners; @@ -10,6 +8,7 @@ import mekanism.common.item.ItemGasMask; import mekanism.common.item.ItemJetpack; import mekanism.common.item.ItemJetpack.JetpackMode; import mekanism.common.item.ItemScubaTank; +import mekanism.common.util.ReflectionUtils; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -40,7 +39,7 @@ public class CommonPlayerTickHandler { ItemStack feetStack = player.getItemStackFromSlot(EntityEquipmentSlot.FEET); - if(feetStack != null && feetStack.getItem() instanceof ItemFreeRunners) + if(!feetStack.isEmpty() && feetStack.getItem() instanceof ItemFreeRunners) { player.stepHeight = 1.002F; } @@ -53,7 +52,7 @@ public class CommonPlayerTickHandler if(isFlamethrowerOn(player)) { - player.worldObj.spawnEntityInWorld(new EntityFlame(player)); + player.world.spawnEntity(new EntityFlame(player)); if(!player.capabilities.isCreativeMode) { @@ -144,23 +143,28 @@ public class CommonPlayerTickHandler public static boolean isOnGround(EntityPlayer player) { - int x = MathHelper.floor_double(player.posX); - int y = (int)Math.round(player.posY - 1); - int z = MathHelper.floor_double(player.posZ); - - BlockPos pos = new BlockPos(x, y, z); - IBlockState s = player.worldObj.getBlockState(pos); - AxisAlignedBB box = s.getCollisionBoundingBox(player.worldObj, pos); - AxisAlignedBB playerBox = player.getCollisionBoundingBox(); + int x = MathHelper.floor(player.posX); + int y = MathHelper.floor(player.posY-0.01); + int z = MathHelper.floor(player.posZ); - return box != null && playerBox != null && playerBox.offset(0, -0.01, 0).intersectsWith(box); + BlockPos pos = new BlockPos(x, y, z); + IBlockState s = player.world.getBlockState(pos); + AxisAlignedBB box = s.getBoundingBox(player.world, pos).offset(pos); + AxisAlignedBB playerBox = player.getEntityBoundingBox(); + + if(!s.getBlock().isAir(s, player.world, pos) && playerBox.offset(0, -0.01, 0).intersectsWith(box)) + { + return true; + } + + return false; } public boolean isJetpackOn(EntityPlayer player) { - ItemStack stack = player.inventory.armorInventory[2]; + ItemStack stack = player.inventory.armorInventory.get(2); - if(stack != null && !player.capabilities.isCreativeMode) + if(!stack.isEmpty() && !player.capabilities.isCreativeMode) { if(stack.getItem() instanceof ItemJetpack) { @@ -176,11 +180,11 @@ public class CommonPlayerTickHandler { if((!Mekanism.keyMap.has(player, KeySync.ASCEND) && !Mekanism.keyMap.has(player, KeySync.DESCEND)) || (Mekanism.keyMap.has(player, KeySync.ASCEND) && Mekanism.keyMap.has(player, KeySync.DESCEND))) { - return !player.onGround; + return !isOnGround(player); } else if(Mekanism.keyMap.has(player, KeySync.DESCEND)) { - return !player.onGround; + return !isOnGround(player); } return true; @@ -194,10 +198,10 @@ public class CommonPlayerTickHandler public static boolean isGasMaskOn(EntityPlayer player) { - ItemStack tank = player.inventory.armorInventory[2]; - ItemStack mask = player.inventory.armorInventory[3]; + ItemStack tank = player.inventory.armorInventory.get(2); + ItemStack mask = player.inventory.armorInventory.get(3); - if(tank != null && mask != null) + if(!tank.isEmpty() && !mask.isEmpty()) { if(tank.getItem() instanceof ItemScubaTank && mask.getItem() instanceof ItemGasMask) { @@ -220,7 +224,7 @@ public class CommonPlayerTickHandler { if(Mekanism.flamethrowerActive.contains(player.getName())) { - if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().getItem() instanceof ItemFlamethrower) + if(!player.inventory.getCurrentItem().isEmpty() && player.inventory.getCurrentItem().getItem() instanceof ItemFlamethrower) { return true; } diff --git a/src/main/java/mekanism/common/CommonPlayerTracker.java b/src/main/java/mekanism/common/CommonPlayerTracker.java index 8788813b7..bc293c82f 100644 --- a/src/main/java/mekanism/common/CommonPlayerTracker.java +++ b/src/main/java/mekanism/common/CommonPlayerTracker.java @@ -25,7 +25,7 @@ public class CommonPlayerTracker @SubscribeEvent public void onPlayerLoginEvent(PlayerLoggedInEvent event) { - if(!event.player.worldObj.isRemote) + if(!event.player.world.isRemote) { Mekanism.packetHandler.sendTo(new ConfigSyncMessage(), (EntityPlayerMP)event.player); Mekanism.packetHandler.sendTo(new BoxBlacklistMessage(), (EntityPlayerMP)event.player); @@ -52,7 +52,7 @@ public class CommonPlayerTracker Mekanism.gasmaskOn.remove(event.player.getName()); Mekanism.flamethrowerActive.remove(event.player.getName()); - if(!event.player.worldObj.isRemote) + if(!event.player.world.isRemote) { Mekanism.packetHandler.sendTo(new JetpackDataMessage(JetpackPacket.FULL, null, false), (EntityPlayerMP)event.player); Mekanism.packetHandler.sendTo(new ScubaTankDataMessage(ScubaTankPacket.FULL, null, false), (EntityPlayerMP)event.player); diff --git a/src/main/java/mekanism/common/CommonProxy.java b/src/main/java/mekanism/common/CommonProxy.java index ae6924260..632b7dc30 100644 --- a/src/main/java/mekanism/common/CommonProxy.java +++ b/src/main/java/mekanism/common/CommonProxy.java @@ -5,17 +5,15 @@ import java.lang.ref.WeakReference; import mekanism.api.Coord4D; import mekanism.api.MekanismAPI; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.machines; -import mekanism.api.MekanismConfig.usage; import mekanism.api.Pos3D; -import mekanism.api.util.UnitDisplayUtils.EnergyType; -import mekanism.api.util.UnitDisplayUtils.TempType; import mekanism.client.SparkleAnimation.INodeChecker; import mekanism.common.base.IGuiProvider; import mekanism.common.base.IUpgradeTile; import mekanism.common.block.states.BlockStateMachine; import mekanism.common.block.states.BlockStateMachine.MachineType; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.config.MekanismConfig.usage; +import mekanism.common.config.TypeConfigManager; import mekanism.common.entity.EntityRobit; import mekanism.common.inventory.container.ContainerAdvancedElectricMachine; import mekanism.common.inventory.container.ContainerChanceMachine; @@ -61,7 +59,6 @@ import mekanism.common.inventory.container.ContainerThermalEvaporationController import mekanism.common.inventory.container.ContainerUpgradeManagement; import mekanism.common.item.ItemPortableTeleporter; import mekanism.common.network.PacketPortableTeleporter.PortableTeleporterMessage; -import mekanism.common.tile.TileEntityAdvancedElectricMachine; import mekanism.common.tile.TileEntityAdvancedFactory; import mekanism.common.tile.TileEntityBin; import mekanism.common.tile.TileEntityBoilerCasing; @@ -75,12 +72,10 @@ import mekanism.common.tile.TileEntityChemicalInjectionChamber; import mekanism.common.tile.TileEntityChemicalOxidizer; import mekanism.common.tile.TileEntityChemicalWasher; import mekanism.common.tile.TileEntityCombiner; -import mekanism.common.tile.TileEntityContainerBlock; import mekanism.common.tile.TileEntityCrusher; import mekanism.common.tile.TileEntityDigitalMiner; import mekanism.common.tile.TileEntityDynamicTank; import mekanism.common.tile.TileEntityDynamicValve; -import mekanism.common.tile.TileEntityElectricMachine; import mekanism.common.tile.TileEntityElectricPump; import mekanism.common.tile.TileEntityElectrolyticSeparator; import mekanism.common.tile.TileEntityEliteFactory; @@ -113,13 +108,24 @@ import mekanism.common.tile.TileEntitySeismicVibrator; import mekanism.common.tile.TileEntitySolarNeutronActivator; import mekanism.common.tile.TileEntityTeleporter; import mekanism.common.tile.TileEntityThermalEvaporationController; +import mekanism.common.tile.prefab.TileEntityAdvancedElectricMachine; +import mekanism.common.tile.prefab.TileEntityContainerBlock; +import mekanism.common.tile.prefab.TileEntityElectricMachine; +import mekanism.common.tile.transmitter.TileEntityDiversionTransporter; +import mekanism.common.tile.transmitter.TileEntityLogisticalTransporter; +import mekanism.common.tile.transmitter.TileEntityMechanicalPipe; +import mekanism.common.tile.transmitter.TileEntityPressurizedTube; +import mekanism.common.tile.transmitter.TileEntityRestrictiveTransporter; +import mekanism.common.tile.transmitter.TileEntityThermodynamicConductor; +import mekanism.common.tile.transmitter.TileEntityUniversalCable; +import mekanism.common.util.UnitDisplayUtils.EnergyType; +import mekanism.common.util.UnitDisplayUtils.TempType; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; @@ -183,6 +189,15 @@ public class CommonProxy implements IGuiProvider GameRegistry.registerTileEntity(TileEntitySecurityDesk.class, "SecurityDesk"); GameRegistry.registerTileEntity(TileEntityQuantumEntangloporter.class, "QuantumEntangloporter"); GameRegistry.registerTileEntity(TileEntityChemicalDissolutionChamber.class, "ChemicalDissolutionChamber"); + + //transmitters + GameRegistry.registerTileEntity(TileEntityMechanicalPipe.class, "MechanicalPipe"); + GameRegistry.registerTileEntity(TileEntityUniversalCable.class, "UniversalCable"); + GameRegistry.registerTileEntity(TileEntityThermodynamicConductor.class, "ThermodynamicConductor"); + GameRegistry.registerTileEntity(TileEntityLogisticalTransporter.class, "LogisticalTransporter"); + GameRegistry.registerTileEntity(TileEntityPressurizedTube.class, "PressurizedTube"); + GameRegistry.registerTileEntity(TileEntityDiversionTransporter.class, "DiversionTransporter"); + GameRegistry.registerTileEntity(TileEntityRestrictiveTransporter.class, "RestrictiveTransporter"); } public void handleTeleporterUpdate(PortableTeleporterMessage message) {} @@ -234,6 +249,8 @@ public class CommonProxy implements IGuiProvider general.TO_RF = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "RFToJoules", 0.4D).getDouble(); general.FROM_TESLA = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "JoulesToTesla", 2.5D).getDouble(); general.TO_TESLA = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "TeslaToJoules", 0.4D).getDouble(); + general.FROM_FORGE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "JoulesToForge", 2.5D).getDouble(); + general.TO_FORGE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ForgeToJoules", 0.4D).getDouble(); general.FROM_H2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "HydrogenEnergyDensity", 200D, "Determines Electrolytic Separator usage").getDouble(); general.ETHENE_BURN_TIME = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EthyleneBurnTime", 40).getInt(); general.ENERGY_PER_REDSTONE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnergyPerRedstone", 10000D).getDouble(); @@ -265,10 +282,12 @@ public class CommonProxy implements IGuiProvider general.allowTransmitterAlloyUpgrade = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AllowTransmitterAlloyUpgrade", true).getBoolean(); general.allowChunkloading = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AllowChunkloading", true).getBoolean(); general.allowProtection = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AllowProtection", true).getBoolean(); + general.portableTeleporterDelay = 100;//Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "PortableTeleporterDelay", 0).getInt(); general.blacklistIC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistIC2Power", false).getBoolean(); general.blacklistRF = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistRFPower", false).getBoolean(); general.blacklistTesla = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistTeslaPower", false).getBoolean(); + general.blacklistForge = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistForgePower", false).getBoolean(); String s = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnergyType", "J", null, new String[]{"J", "RF", "EU", "T"}).getString(); @@ -321,18 +340,16 @@ public class CommonProxy implements IGuiProvider general.laserRange = Mekanism.configuration.get("general", "LaserRange", 64).getInt(); general.laserEnergyNeededPerHardness = Mekanism.configuration.get("general", "LaserDiggingEnergy", 100000).getInt(); general.destroyDisabledBlocks = Mekanism.configuration.get("general", "DestroyDisabledBlocks", true).getBoolean(); - for(MachineType type : BlockStateMachine.MachineType.getValidMachines()) { - machines.setEntry(type.machineName, Mekanism.configuration.get("machines", type.machineName + "Enabled", true).getBoolean()); + general.machinesManager.setEntry(type.blockName, Mekanism.configuration.get("machines", type.blockName + "Enabled", true).getBoolean()); } usage.enrichmentChamberUsage = Mekanism.configuration.get("usage", "EnrichmentChamberUsage", 50D).getDouble(); usage.osmiumCompressorUsage = Mekanism.configuration.get("usage", "OsmiumCompressorUsage", 100D).getDouble(); usage.combinerUsage = Mekanism.configuration.get("usage", "CombinerUsage", 50D).getDouble(); usage.crusherUsage = Mekanism.configuration.get("usage", "CrusherUsage", 50D).getDouble(); - usage.factoryUsage = Mekanism.configuration.get("usage", "FactoryUsage", 50D).getDouble(); usage.metallurgicInfuserUsage = Mekanism.configuration.get("usage", "MetallurgicInfuserUsage", 50D).getDouble(); usage.purificationChamberUsage = Mekanism.configuration.get("usage", "PurificationChamberUsage", 200D).getDouble(); usage.energizedSmelterUsage = Mekanism.configuration.get("usage", "EnergizedSmelterUsage", 50D).getDouble(); @@ -368,6 +385,8 @@ public class CommonProxy implements IGuiProvider public void init() { MinecraftForge.EVENT_BUS.register(Mekanism.worldTickHandler); + + MekanismSounds.register(); } /** @@ -435,10 +454,12 @@ public class CommonProxy implements IGuiProvider case 14: ItemStack itemStack = player.getHeldItem(EnumHand.values()[pos.getX()]); - if(itemStack != null && itemStack.getItem() instanceof ItemPortableTeleporter) + if(!itemStack.isEmpty() && itemStack.getItem() instanceof ItemPortableTeleporter) { return new ContainerNull(); } + + return null; case 15: return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity); case 16: @@ -454,6 +475,8 @@ public class CommonProxy implements IGuiProvider { return new ContainerRobitMain(player.inventory, robit); } + + return null; case 22: robit = (EntityRobit)world.getEntityByID(pos.getX()); @@ -461,6 +484,8 @@ public class CommonProxy implements IGuiProvider { return new ContainerRobitCrafting(player.inventory, robit); } + + return null; case 23: robit = (EntityRobit)world.getEntityByID(pos.getX()); @@ -468,6 +493,8 @@ public class CommonProxy implements IGuiProvider { return new ContainerRobitInventory(player.inventory, robit); } + + return null; case 24: robit = (EntityRobit)world.getEntityByID(pos.getX()); @@ -475,6 +502,8 @@ public class CommonProxy implements IGuiProvider { return new ContainerRobitSmelting(player.inventory, robit); } + + return null; case 25: robit = (EntityRobit)world.getEntityByID(pos.getX()); @@ -482,6 +511,8 @@ public class CommonProxy implements IGuiProvider { return new ContainerRobitRepair(player.inventory, robit); } + + return null; case 26: return new ContainerNull(player, (TileEntityContainerBlock)tileEntity); case 27: @@ -571,21 +602,6 @@ public class CommonProxy implements IGuiProvider { return (File)FMLInjectionData.data()[6]; } - - public void updateConfigRecipes() - { - for(MachineType type : BlockStateMachine.MachineType.getValidMachines()) - { - if(machines.isEnabled(type.machineName)) - { - CraftingManager.getInstance().getRecipeList().removeAll(type.getRecipes()); - CraftingManager.getInstance().getRecipeList().addAll(type.getRecipes()); - } - else { - CraftingManager.getInstance().getRecipeList().removeAll(type.getRecipes()); - } - } - } public void onConfigSync(boolean fromPacket) { @@ -599,7 +615,7 @@ public class CommonProxy implements IGuiProvider BlockStateMachine.MachineType.updateAllUsages(); - updateConfigRecipes(); + TypeConfigManager.updateConfigRecipes(MachineType.getValidMachines(), general.machinesManager); if(fromPacket) { @@ -632,7 +648,7 @@ public class CommonProxy implements IGuiProvider dummyPlayer = createNewPlayer(world); } else { - dummyPlayer.get().worldObj = world; + dummyPlayer.get().world = world; } return dummyPlayer; @@ -645,7 +661,7 @@ public class CommonProxy implements IGuiProvider dummyPlayer = createNewPlayer(world, x, y, z); } else { - dummyPlayer.get().worldObj = world; + dummyPlayer.get().world = world; dummyPlayer.get().posX = x; dummyPlayer.get().posY = y; dummyPlayer.get().posZ = z; @@ -663,7 +679,7 @@ public class CommonProxy implements IGuiProvider { if(player instanceof EntityPlayerMP) { - ((WorldServer)player.worldObj).addScheduledTask(runnable); + ((WorldServer)player.world).addScheduledTask(runnable); } } diff --git a/src/main/java/mekanism/common/CreativeTabMekanism.java b/src/main/java/mekanism/common/CreativeTabMekanism.java index 607eb82f4..de97a8c0d 100644 --- a/src/main/java/mekanism/common/CreativeTabMekanism.java +++ b/src/main/java/mekanism/common/CreativeTabMekanism.java @@ -18,8 +18,8 @@ public class CreativeTabMekanism extends CreativeTabs } @Override - public Item getTabIconItem() + public ItemStack getTabIconItem() { - return MekanismItems.AtomicAlloy; + return new ItemStack(MekanismItems.AtomicAlloy); } } diff --git a/src/main/java/mekanism/common/FuelHandler.java b/src/main/java/mekanism/common/FuelHandler.java index 5be26dca7..d4fded57b 100644 --- a/src/main/java/mekanism/common/FuelHandler.java +++ b/src/main/java/mekanism/common/FuelHandler.java @@ -2,8 +2,8 @@ package mekanism.common; import java.util.HashMap; -import mekanism.api.MekanismConfig.general; import mekanism.api.gas.Gas; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.util.MekanismUtils; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fml.common.ModAPIManager; diff --git a/src/main/java/mekanism/common/LaserManager.java b/src/main/java/mekanism/common/LaserManager.java index e54619403..da681ee8b 100644 --- a/src/main/java/mekanism/common/LaserManager.java +++ b/src/main/java/mekanism/common/LaserManager.java @@ -3,11 +3,11 @@ package mekanism.common; import java.util.List; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; import mekanism.api.Pos3D; import mekanism.api.lasers.ILaserReceptor; -import mekanism.api.util.CapabilityUtils; import mekanism.common.capabilities.Capabilities; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.util.CapabilityUtils; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; @@ -68,7 +68,7 @@ public class LaserManager if(energy > 256) { - e.attackEntityFrom(DamageSource.generic, (float)energy/1000F); + e.attackEntityFrom(DamageSource.GENERIC, (float)energy/1000F); } } diff --git a/src/main/java/mekanism/common/Mekanism.java b/src/main/java/mekanism/common/Mekanism.java index 54f8f3ad5..73dada4d6 100644 --- a/src/main/java/mekanism/common/Mekanism.java +++ b/src/main/java/mekanism/common/Mekanism.java @@ -10,15 +10,11 @@ import java.util.Map; import java.util.Set; import java.util.UUID; -import mcmultipart.MCMultiPartMod; import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.MekanismAPI; import mekanism.api.MekanismAPI.BoxBlacklistEvent; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.usage; import mekanism.api.gas.Gas; -import mekanism.api.gas.GasNetwork.GasTransferEvent; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.OreGas; @@ -30,8 +26,6 @@ import mekanism.api.transmitters.DynamicNetwork.NetworkClientRequest; import mekanism.api.transmitters.DynamicNetwork.TransmittersAddedEvent; import mekanism.api.transmitters.TransmitterNetworkRegistry; import mekanism.client.ClientTickHandler; -import mekanism.common.EnergyNetwork.EnergyTransferEvent; -import mekanism.common.FluidNetwork.FluidTransferEvent; import mekanism.common.Tier.BaseTier; import mekanism.common.Tier.BinTier; import mekanism.common.Tier.EnergyCubeTier; @@ -43,10 +37,13 @@ import mekanism.common.Tier.InductionProviderTier; import mekanism.common.base.IChunkLoadHandler; import mekanism.common.base.IFactory.RecipeType; import mekanism.common.base.IModule; -import mekanism.common.block.states.BlockStateMachine; import mekanism.common.block.states.BlockStateMachine.MachineType; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterType; import mekanism.common.capabilities.Capabilities; import mekanism.common.chunkloading.ChunkManager; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.config.MekanismConfig.usage; +import mekanism.common.config.TypeConfigManager; import mekanism.common.content.boiler.SynchronizedBoilerData; import mekanism.common.content.entangloporter.InventoryFrequency; import mekanism.common.content.matrix.SynchronizedMatrixData; @@ -60,10 +57,11 @@ import mekanism.common.entity.EntityObsidianTNT; import mekanism.common.entity.EntityRobit; import mekanism.common.frequency.Frequency; import mekanism.common.frequency.FrequencyManager; +import mekanism.common.integration.IMCHandler; import mekanism.common.integration.MekanismHooks; import mekanism.common.integration.OreDictManager; +import mekanism.common.integration.multipart.MultipartMekanism; import mekanism.common.multiblock.MultiblockManager; -import mekanism.common.multipart.MultipartMekanism; import mekanism.common.network.PacketDataRequest.DataRequestMessage; import mekanism.common.network.PacketSimpleGui; import mekanism.common.network.PacketTransmitterUpdate.PacketType; @@ -84,11 +82,11 @@ import mekanism.common.tile.TileEntityCardboardBox; import mekanism.common.tile.TileEntityChemicalInfuser; import mekanism.common.tile.TileEntityChemicalOxidizer; import mekanism.common.tile.TileEntityChemicalWasher; -import mekanism.common.tile.TileEntityElectricBlock; import mekanism.common.tile.TileEntityElectricPump; import mekanism.common.tile.TileEntityElectrolyticSeparator; import mekanism.common.tile.TileEntityFluidicPlenisher; import mekanism.common.tile.TileEntityFuelwoodHeater; +import mekanism.common.tile.TileEntityGlowPanel; import mekanism.common.tile.TileEntityInductionCasing; import mekanism.common.tile.TileEntityInductionCell; import mekanism.common.tile.TileEntityInductionPort; @@ -103,6 +101,10 @@ import mekanism.common.tile.TileEntityStructuralGlass; import mekanism.common.tile.TileEntitySuperheatingElement; import mekanism.common.tile.TileEntityThermalEvaporationBlock; import mekanism.common.tile.TileEntityThermalEvaporationValve; +import mekanism.common.tile.prefab.TileEntityElectricBlock; +import mekanism.common.transmitters.grid.EnergyNetwork.EnergyTransferEvent; +import mekanism.common.transmitters.grid.FluidNetwork.FluidTransferEvent; +import mekanism.common.transmitters.grid.GasNetwork.GasTransferEvent; import mekanism.common.util.MekanismUtils; import mekanism.common.voice.VoiceServerManager; import mekanism.common.world.GenHandler; @@ -150,9 +152,6 @@ import net.minecraftforge.oredict.RecipeSorter.Category; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import rebelkeithy.mods.metallurgy.api.IOreInfo; -import rebelkeithy.mods.metallurgy.api.MetallurgyAPI; - import com.mojang.authlib.GameProfile; /** @@ -160,16 +159,16 @@ import com.mojang.authlib.GameProfile; * @author AidanBrady * */ -@Mod(modid = "Mekanism", name = "Mekanism", version = "9.2.2", guiFactory = "mekanism.client.gui.ConfigGuiFactory", - dependencies = "required-after:mcmultipart;" + - "after:JEI;" + - "after:BuildCraft;" + - "after:BuildCraftAPI;" + - "after:IC2;" + - "after:CoFHCore;" + - "after:ComputerCraft;" + - "after:Galacticraft API;" + - "after:MetallurgyCore") +@Mod(modid = "mekanism", name = "Mekanism", version = "9.3.2", guiFactory = "mekanism.client.gui.ConfigGuiFactory", + dependencies = "after:mcmultipart;" + + "after:jei;" + + "after:buildcraft;" + + "after:buildcraftapi;" + + "after:ic2;" + + "after:cofhcore;" + + "after:computercraft;" + + "after:galacticraft api;" + + "after:metallurgycore") public class Mekanism { /** Mekanism Packet Pipeline */ @@ -183,7 +182,7 @@ public class Mekanism public static CommonProxy proxy; /** Mekanism mod instance */ - @Instance("Mekanism") + @Instance("mekanism") public static Mekanism instance; /** Mekanism hooks instance */ @@ -193,7 +192,7 @@ public class Mekanism public static Configuration configuration; /** Mekanism version number */ - public static Version versionNumber = new Version(9, 2, 2); + public static Version versionNumber = new Version(9, 3, 2); /** MultiblockManagers for various structrures */ public static MultiblockManager tankManager = new MultiblockManager("dynamicTank"); @@ -202,10 +201,10 @@ public class Mekanism /** FrequencyManagers for various networks */ public static FrequencyManager publicTeleporters = new FrequencyManager(Frequency.class, Frequency.TELEPORTER); - public static Map privateTeleporters = new HashMap(); + public static Map privateTeleporters = new HashMap(); public static FrequencyManager publicEntangloporters = new FrequencyManager(InventoryFrequency.class, InventoryFrequency.ENTANGLOPORTER); - public static Map privateEntangloporters = new HashMap(); + public static Map privateEntangloporters = new HashMap(); public static FrequencyManager securityFrequencies = new FrequencyManager(SecurityFrequency.class, SecurityFrequency.SECURITY); @@ -319,16 +318,16 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.EnergyTablet.getUnchargedItem(), "RCR", "ECE", "RCR", Character.valueOf('C'), "ingotGold", Character.valueOf('R'), "dustRedstone", Character.valueOf('E'), MekanismItems.EnrichedAlloy )); - BlockStateMachine.MachineType.ENRICHMENT_CHAMBER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 0), + MachineType.ENRICHMENT_CHAMBER.addRecipe(new ShapedMekanismRecipe(MachineType.ENRICHMENT_CHAMBER.getStack(), "RCR", "iIi", "RCR", Character.valueOf('i'), "ingotIron", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('R'), "alloyBasic", Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) )); - BlockStateMachine.MachineType.OSMIUM_COMPRESSOR.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 1), + MachineType.OSMIUM_COMPRESSOR.addRecipe(new ShapedMekanismRecipe(MachineType.OSMIUM_COMPRESSOR.getStack(), "ECE", "BIB", "ECE", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED), Character.valueOf('B'), Items.BUCKET, Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) )); - BlockStateMachine.MachineType.COMBINER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 2), + MachineType.COMBINER.addRecipe(new ShapedMekanismRecipe(MachineType.COMBINER.getStack(), "RCR", "SIS", "RCR", Character.valueOf('S'), "cobblestone", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ELITE), Character.valueOf('R'), "alloyElite", Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) )); - BlockStateMachine.MachineType.CRUSHER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 3), + MachineType.CRUSHER.addRecipe(new ShapedMekanismRecipe(MachineType.CRUSHER.getStack(), "RCR", "LIL", "RCR", Character.valueOf('R'), "dustRedstone", Character.valueOf('L'), Items.LAVA_BUCKET, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.SpeedUpgrade), @@ -352,7 +351,7 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.AtomicDisassembler.getUnchargedItem(), "AEA", "ACA", " O ", Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('C'), MekanismItems.AtomicAlloy, Character.valueOf('O'), "ingotRefinedObsidian" )); - BlockStateMachine.MachineType.METALLURGIC_INFUSER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 8), + MachineType.METALLURGIC_INFUSER.addRecipe(new ShapedMekanismRecipe(MachineType.METALLURGIC_INFUSER.getStack(), "IFI", "ROR", "IFI", Character.valueOf('I'), "ingotIron", Character.valueOf('F'), Blocks.FURNACE, Character.valueOf('R'), "dustRedstone", Character.valueOf('O'), "ingotOsmium" )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.TeleportationCore), @@ -361,11 +360,11 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.PortableTeleporter.getUnchargedItem(), " E ", "CTC", " E ", Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('T'), MekanismItems.TeleportationCore )); - BlockStateMachine.MachineType.TELEPORTER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 11), + MachineType.TELEPORTER.addRecipe(new ShapedMekanismRecipe(MachineType.TELEPORTER.getStack(), "COC", "OTO", "COC", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('O'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('T'), MekanismItems.TeleportationCore )); - BlockStateMachine.MachineType.PURIFICATION_CHAMBER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 9), - "ECE", "ORO", "ECE", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED), Character.valueOf('E'), "alloyAdvanced", Character.valueOf('O'), "ingotOsmium", Character.valueOf('R'), new ItemStack(MekanismBlocks.MachineBlock, 1, 0) + MachineType.PURIFICATION_CHAMBER.addRecipe(new ShapedMekanismRecipe(MachineType.PURIFICATION_CHAMBER.getStack(), + "ECE", "ORO", "ECE", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED), Character.valueOf('E'), "alloyAdvanced", Character.valueOf('O'), "ingotOsmium", Character.valueOf('R'), MachineType.ENRICHMENT_CHAMBER.getStack() )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.Configurator.getUnchargedItem(), " L ", "AEA", " S ", Character.valueOf('L'), new ItemStack(Items.DYE, 1, 4), Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('S'), Items.STICK @@ -376,14 +375,14 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock, 1, 8), new Object[] { "SGS", "GPG", "SGS", Character.valueOf('S'), "ingotSteel", Character.valueOf('P'), "ingotOsmium", Character.valueOf('G'), "blockGlass" })); - BlockStateMachine.MachineType.ENERGIZED_SMELTER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 10), + MachineType.ENERGIZED_SMELTER.addRecipe(new ShapedMekanismRecipe(MachineType.ENERGIZED_SMELTER.getStack(), "RCR", "GIG", "RCR", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('R'), "alloyBasic", Character.valueOf('G'), "blockGlass", Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) )); - BlockStateMachine.MachineType.ELECTRIC_PUMP.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 12), + MachineType.ELECTRIC_PUMP.addRecipe(new ShapedMekanismRecipe(MachineType.ELECTRIC_PUMP.getStack(), " B ", "ECE", "OOO", Character.valueOf('B'), Items.BUCKET, Character.valueOf('E'), MekanismItems.EnrichedAlloy, Character.valueOf('C'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('O'), "ingotOsmium" )); - BlockStateMachine.MachineType.PERSONAL_CHEST.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 13), - "SGS", "CcC", "SSS", Character.valueOf('S'), "ingotSteel", Character.valueOf('G'), "blockGlass", Character.valueOf('C'), Blocks.CHEST, Character.valueOf('c'), MekanismUtils.getControlCircuit(BaseTier.BASIC) + MachineType.PERSONAL_CHEST.addRecipe(new ShapedMekanismRecipe(MachineType.PERSONAL_CHEST.getStack(), + "SGS", "CcC", "SSS", Character.valueOf('S'), "ingotSteel", Character.valueOf('G'), "blockGlass", Character.valueOf('C'), "chestWood", Character.valueOf('c'), MekanismUtils.getControlCircuit(BaseTier.BASIC) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock, 4, 9), " I ", "IBI", " I ", Character.valueOf('I'), "ingotSteel", Character.valueOf('B'), Items.BUCKET @@ -394,11 +393,11 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock, 2, 11), " I ", "ICI", " I ", Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 9), Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC) )); - BlockStateMachine.MachineType.CHARGEPAD.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 14), + MachineType.CHARGEPAD.addRecipe(new ShapedMekanismRecipe(MachineType.CHARGEPAD.getStack(), "PPP", "SES", Character.valueOf('P'), Blocks.STONE_PRESSURE_PLATE, Character.valueOf('S'), "ingotSteel", Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem() )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.Robit.getUnchargedItem(), - " S ", "ECE", "OIO", Character.valueOf('S'), "ingotSteel", Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('C'), MekanismItems.AtomicAlloy, Character.valueOf('O'), "ingotRefinedObsidian", Character.valueOf('I'), new ItemStack(MekanismBlocks.MachineBlock, 1, 13) + " S ", "ECE", "OIO", Character.valueOf('S'), "ingotSteel", Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('C'), MekanismItems.AtomicAlloy, Character.valueOf('O'), "ingotRefinedObsidian", Character.valueOf('I'), MachineType.PERSONAL_CHEST.getStack() )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.NetworkReader.getUnchargedItem(), " G ", "AEA", " I ", Character.valueOf('G'), "blockGlass", Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('I'), "ingotSteel" @@ -406,14 +405,14 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.WalkieTalkie), " O", "SCS", " S ", Character.valueOf('O'), "ingotOsmium", Character.valueOf('S'), "ingotSteel", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC) )); - BlockStateMachine.MachineType.LOGISTICAL_SORTER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 15), + MachineType.LOGISTICAL_SORTER.addRecipe(new ShapedMekanismRecipe(MachineType.LOGISTICAL_SORTER.getStack(), "IPI", "ICI", "III", Character.valueOf('I'), "ingotIron", Character.valueOf('P'), Blocks.PISTON, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC) )); - BlockStateMachine.MachineType.DIGITAL_MINER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 4), - "ACA", "SES", "TIT", Character.valueOf('A'), MekanismItems.AtomicAlloy, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('S'), new ItemStack(MekanismBlocks.MachineBlock, 1, 15), Character.valueOf('E'), MekanismItems.Robit.getUnchargedItem(), + MachineType.DIGITAL_MINER.addRecipe(new ShapedMekanismRecipe(MachineType.DIGITAL_MINER.getStack(), + "ACA", "SES", "TIT", Character.valueOf('A'), MekanismItems.AtomicAlloy, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('S'), MachineType.LOGISTICAL_SORTER.getStack(), Character.valueOf('E'), MekanismItems.Robit.getUnchargedItem(), Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('T'), MekanismItems.TeleportationCore )); - BlockStateMachine.MachineType.ROTARY_CONDENSENTRATOR.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 0), + MachineType.ROTARY_CONDENSENTRATOR.addRecipe(new ShapedMekanismRecipe(MachineType.ROTARY_CONDENSENTRATOR.getStack(), "GCG", "tEI", "GCG", Character.valueOf('G'), "blockGlass", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('t'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC), Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('T'), new ItemStack(MekanismBlocks.BasicBlock, 1, 9), Character.valueOf('I'), MekanismUtils.getEmptyFluidTank(FluidTankTier.BASIC) )); @@ -429,16 +428,16 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.ScubaTank.getEmptyItem(), " C ", "ATA", "SSS", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('S'), "ingotSteel" )); - BlockStateMachine.MachineType.CHEMICAL_OXIDIZER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 1), - "ACA", "ERG", "ACA", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('R'), new ItemStack(MekanismBlocks.BasicBlock, 1, 9), Character.valueOf('G'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC), Character.valueOf('E'), new ItemStack(MekanismBlocks.MachineBlock, 1, 13), Character.valueOf('A'), MekanismItems.EnrichedAlloy + MachineType.CHEMICAL_OXIDIZER.addRecipe(new ShapedMekanismRecipe(MachineType.CHEMICAL_OXIDIZER.getStack(), + "ACA", "ERG", "ACA", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('R'), new ItemStack(MekanismBlocks.BasicBlock, 1, 9), Character.valueOf('G'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC), Character.valueOf('E'), MachineType.PERSONAL_CHEST.getStack(), Character.valueOf('A'), MekanismItems.EnrichedAlloy )); - BlockStateMachine.MachineType.CHEMICAL_INFUSER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 2), + MachineType.CHEMICAL_INFUSER.addRecipe(new ShapedMekanismRecipe(MachineType.CHEMICAL_INFUSER.getStack(), "ACA", "GRG", "ACA", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('R'), new ItemStack(MekanismBlocks.BasicBlock, 1, 9), Character.valueOf('G'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC), Character.valueOf('A'), MekanismItems.EnrichedAlloy )); - BlockStateMachine.MachineType.CHEMICAL_INJECTION_CHAMBER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 3), - "RCR", "GPG", "RCR", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ELITE), Character.valueOf('R'), "alloyElite", Character.valueOf('G'), "ingotGold", Character.valueOf('P'), new ItemStack(MekanismBlocks.MachineBlock, 1, 9) + MachineType.CHEMICAL_INJECTION_CHAMBER.addRecipe(new ShapedMekanismRecipe(MachineType.CHEMICAL_INJECTION_CHAMBER.getStack(), + "RCR", "GPG", "RCR", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ELITE), Character.valueOf('R'), "alloyElite", Character.valueOf('G'), "ingotGold", Character.valueOf('P'), MachineType.PURIFICATION_CHAMBER.getStack() )); - BlockStateMachine.MachineType.ELECTROLYTIC_SEPARATOR.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 4), + MachineType.ELECTROLYTIC_SEPARATOR.addRecipe(new ShapedMekanismRecipe(MachineType.ELECTROLYTIC_SEPARATOR.getStack(), "IRI", "ECE", "IRI", Character.valueOf('I'), "ingotIron", Character.valueOf('R'), "dustRedstone", Character.valueOf('E'), MekanismItems.EnrichedAlloy, Character.valueOf('C'), MekanismItems.ElectrolyticCore )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.ElectrolyticCore), @@ -450,7 +449,7 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(Items.PAPER, 6), "SSS", Character.valueOf('S'), MekanismItems.Sawdust )); - BlockStateMachine.MachineType.PRECISION_SAWMILL.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 5), + MachineType.PRECISION_SAWMILL.addRecipe(new ShapedMekanismRecipe(MachineType.PRECISION_SAWMILL.getStack(), "ICI", "ASA", "ICI", Character.valueOf('I'), "ingotIron", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('S'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock, 1, 14), @@ -462,13 +461,13 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock2, 4, 0), " S ", "SCS", " S ", Character.valueOf('C'), "ingotCopper", Character.valueOf('S'), "ingotSteel" )); - BlockStateMachine.MachineType.CHEMICAL_DISSOLUTION_CHAMBER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 6), + MachineType.CHEMICAL_DISSOLUTION_CHAMBER.addRecipe(new ShapedMekanismRecipe(MachineType.CHEMICAL_DISSOLUTION_CHAMBER.getStack(), "CGC", "EAE", "CGC", Character.valueOf('G'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC), Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('A'), MekanismItems.AtomicAlloy, Character.valueOf('E'), MekanismItems.EnrichedAlloy )); - BlockStateMachine.MachineType.CHEMICAL_WASHER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 7), + MachineType.CHEMICAL_WASHER.addRecipe(new ShapedMekanismRecipe(MachineType.CHEMICAL_WASHER.getStack(), "CWC", "EIE", "CGC", Character.valueOf('W'), Items.BUCKET, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('E'), MekanismItems.EnrichedAlloy, Character.valueOf('G'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC), Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) )); - BlockStateMachine.MachineType.CHEMICAL_CRYSTALLIZER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 8), + MachineType.CHEMICAL_CRYSTALLIZER.addRecipe(new ShapedMekanismRecipe(MachineType.CHEMICAL_CRYSTALLIZER.getStack(), "CGC", "ASA", "CGC", Character.valueOf('G'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC), Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('A'), MekanismItems.AtomicAlloy, Character.valueOf('S'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.FreeRunners.getUnchargedItem(), @@ -483,15 +482,15 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.SeismicReader.getUnchargedItem(), "SLS", "STS", "SSS", Character.valueOf('S'), "ingotSteel", Character.valueOf('L'), new ItemStack(Items.DYE, 1, 4), Character.valueOf('T'), MekanismItems.EnergyTablet.getUnchargedItem() )); - BlockStateMachine.MachineType.SEISMIC_VIBRATOR.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 9), + MachineType.SEISMIC_VIBRATOR.addRecipe(new ShapedMekanismRecipe(MachineType.SEISMIC_VIBRATOR.getStack(), "TLT", "CIC", "TTT", Character.valueOf('T'), "ingotTin", Character.valueOf('L'), new ItemStack(Items.DYE, 1, 4), Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) )); - BlockStateMachine.MachineType.PRESSURIZED_REACTION_CHAMBER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 10), + MachineType.PRESSURIZED_REACTION_CHAMBER.addRecipe(new ShapedMekanismRecipe(MachineType.PRESSURIZED_REACTION_CHAMBER.getStack(), "TET", "CIC", "GFG", Character.valueOf('S'), "ingotSteel", Character.valueOf('E'), MekanismItems.EnrichedAlloy, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('G'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC), - Character.valueOf('I'), new ItemStack(MekanismBlocks.MachineBlock, 1, 0), Character.valueOf('F'), new ItemStack(MekanismBlocks.BasicBlock, 1, 9) + Character.valueOf('I'), MachineType.ENRICHMENT_CHAMBER.getStack(), Character.valueOf('F'), new ItemStack(MekanismBlocks.BasicBlock, 1, 9) )); - BlockStateMachine.MachineType.FLUIDIC_PLENISHER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 12), - "TTT", "CPC", "TTT", Character.valueOf('P'), new ItemStack(MekanismBlocks.MachineBlock, 1, 12), Character.valueOf('T'), "ingotTin", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC) + MachineType.FLUIDIC_PLENISHER.addRecipe(new ShapedMekanismRecipe(MachineType.FLUIDIC_PLENISHER.getStack(), + "TTT", "CPC", "TTT", Character.valueOf('P'), MachineType.ELECTRIC_PUMP.getStack(), Character.valueOf('T'), "ingotTin", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(Blocks.RAIL, 24), "O O", "OSO", "O O", Character.valueOf('O'), "ingotOsmium", Character.valueOf('S'), "stickWood" @@ -502,7 +501,7 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.GaugeDropper.getEmptyItem(), " O ", "G G", "GGG", Character.valueOf('O'), "ingotOsmium", Character.valueOf('G'), "paneGlass" )); - BlockStateMachine.MachineType.SOLAR_NEUTRON_ACTIVATOR.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock3, 1, 1), + MachineType.SOLAR_NEUTRON_ACTIVATOR.addRecipe(new ShapedMekanismRecipe(MachineType.SOLAR_NEUTRON_ACTIVATOR.getStack(), "APA", "CSC", "BBB", Character.valueOf('A'), "alloyElite", Character.valueOf('S'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('P'), new ItemStack(MekanismItems.Polyethene, 1, 2), Character.valueOf('B'), "ingotBronze", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ELITE) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock2, 4, 1), @@ -523,17 +522,17 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.TierInstaller, 1, 3), new Object[] { "RCR", "dWd", "RCR", Character.valueOf('R'), "alloyUltimate", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ULTIMATE), Character.valueOf('d'), "gemDiamond", Character.valueOf('W'), "plankWood" })); - BlockStateMachine.MachineType.OREDICTIONIFICATOR.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock3, 1, 3), - "SGS", "CBC", "SWS", Character.valueOf('S'), "ingotSteel", Character.valueOf('G'), "paneGlass", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('B'), MekanismItems.Dictionary, Character.valueOf('W'), Blocks.CHEST + MachineType.OREDICTIONIFICATOR.addRecipe(new ShapedMekanismRecipe(MachineType.OREDICTIONIFICATOR.getStack(), + "SGS", "CBC", "SWS", Character.valueOf('S'), "ingotSteel", Character.valueOf('G'), "paneGlass", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('B'), MekanismItems.Dictionary, Character.valueOf('W'), "chestWood" )); - BlockStateMachine.MachineType.LASER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 13), + MachineType.LASER.addRecipe(new ShapedMekanismRecipe(MachineType.LASER.getStack(), "RE ", "RCD", "RE ", Character.valueOf('R'), "alloyElite", Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('C'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('D'), "gemDiamond" )); - BlockStateMachine.MachineType.LASER_AMPLIFIER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 14), + MachineType.LASER_AMPLIFIER.addRecipe(new ShapedMekanismRecipe(MachineType.LASER_AMPLIFIER.getStack(), "SSS", "SED", "SSS", Character.valueOf('S'), "ingotSteel", Character.valueOf('E'), MekanismUtils.getEnergyCube(EnergyCubeTier.BASIC), Character.valueOf('D'), "gemDiamond" )); - BlockStateMachine.MachineType.LASER_TRACTOR_BEAM.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 15), - "C", "F", Character.valueOf('C'), new ItemStack(MekanismBlocks.MachineBlock, 1, 13), Character.valueOf('F'), new ItemStack(MekanismBlocks.MachineBlock2, 1, 14) + MachineType.LASER_TRACTOR_BEAM.addRecipe(new ShapedMekanismRecipe(MachineType.LASER_TRACTOR_BEAM.getStack(), + "C", "F", Character.valueOf('C'), MachineType.PERSONAL_CHEST.getStack(), Character.valueOf('F'), MachineType.LASER_AMPLIFIER.getStack() )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock2, 1, 6), "SFS", "FAF", "SFS", Character.valueOf('S'), "ingotSteel", Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('F'), Blocks.IRON_BARS @@ -547,14 +546,14 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock2, 1, 5), "ACA", "CIC", "ACA", Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('C'), "ingotCopper", Character.valueOf('A'), "alloyBasic" )); - MachineType.RESISTIVE_HEATER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock3, 1, 4), new Object[] { + MachineType.RESISTIVE_HEATER.addRecipe(new ShapedMekanismRecipe(MachineType.RESISTIVE_HEATER.getStack(), new Object[] { "CRC", "RHR", "CEC", Character.valueOf('C'), "ingotTin", Character.valueOf('R'), "dustRedstone", Character.valueOf('H'), new ItemStack(MekanismBlocks.BasicBlock2, 1, 5), Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem() - }));; - MachineType.QUANTUM_ENTANGLOPORTER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock3, 1, 0), new Object[] { + })); + MachineType.QUANTUM_ENTANGLOPORTER.addRecipe(new ShapedMekanismRecipe(MachineType.QUANTUM_ENTANGLOPORTER.getStack(), new Object[] { "OCO", "ATA", "OCO", Character.valueOf('O'), "ingotRefinedObsidian", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ULTIMATE), Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), MekanismItems.TeleportationCore })); - MachineType.FORMULAIC_ASSEMBLICATOR.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock3, 1, 5), new Object[] { - "STS", "BIB", "SCS", Character.valueOf('S'), "ingotSteel", Character.valueOf('T'), Blocks.CRAFTING_TABLE, Character.valueOf('B'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('C'), Blocks.CHEST + MachineType.FORMULAIC_ASSEMBLICATOR.addRecipe(new ShapedMekanismRecipe(MachineType.FORMULAIC_ASSEMBLICATOR.getStack(), new Object[] { + "STS", "BIB", "SCS", Character.valueOf('S'), "ingotSteel", Character.valueOf('T'), Blocks.CRAFTING_TABLE, Character.valueOf('B'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('C'), "chestWood" })); CraftingManager.getInstance().getRecipeList().add(new ShapelessMekanismRecipe(new ItemStack(MekanismItems.CraftingFormula), new Object[] { Items.PAPER, MekanismUtils.getControlCircuit(BaseTier.BASIC) @@ -563,7 +562,7 @@ public class Mekanism "SGS", "CIC", "STS", Character.valueOf('S'), "ingotSteel", Character.valueOf('G'), "blockGlass", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ELITE), Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('T'), MekanismItems.TeleportationCore })); - MachineType.FUELWOOD_HEATER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock3, 1, 6), new Object[] { + MachineType.FUELWOOD_HEATER.addRecipe(new ShapedMekanismRecipe(MachineType.FUELWOOD_HEATER.getStack(), new Object[] { "SCS", "FHF", "SSS", Character.valueOf('S'), "ingotSteel", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('F'), Blocks.FURNACE, Character.valueOf('H'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) })); @@ -665,13 +664,13 @@ public class Mekanism //Factory recipes for(RecipeType type : RecipeType.values()) { - BlockStateMachine.MachineType.BASIC_FACTORY.addRecipe(new ShapedMekanismRecipe(MekanismUtils.getFactory(FactoryTier.BASIC, type), + MachineType.BASIC_FACTORY.addRecipe(new ShapedMekanismRecipe(MekanismUtils.getFactory(FactoryTier.BASIC, type), "RCR", "iOi", "RCR", Character.valueOf('R'), "alloyBasic", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('i'), "ingotIron", Character.valueOf('O'), type.getStack() )); - BlockStateMachine.MachineType.ADVANCED_FACTORY.addRecipe(new ShapedMekanismRecipe(MekanismUtils.getFactory(FactoryTier.ADVANCED, type), + MachineType.ADVANCED_FACTORY.addRecipe(new ShapedMekanismRecipe(MekanismUtils.getFactory(FactoryTier.ADVANCED, type), "ECE", "oOo", "ECE", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED), Character.valueOf('o'), "ingotOsmium", Character.valueOf('O'), MekanismUtils.getFactory(FactoryTier.BASIC, type) )); - BlockStateMachine.MachineType.ELITE_FACTORY.addRecipe(new ShapedMekanismRecipe(MekanismUtils.getFactory(FactoryTier.ELITE, type), + MachineType.ELITE_FACTORY.addRecipe(new ShapedMekanismRecipe(MekanismUtils.getFactory(FactoryTier.ELITE, type), "RCR", "gOg", "RCR", Character.valueOf('R'), "alloyElite", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ELITE), Character.valueOf('g'), "ingotGold", Character.valueOf('O'), MekanismUtils.getFactory(FactoryTier.ADVANCED, type) )); } @@ -680,71 +679,71 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new BinRecipe()); //Transmitters - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 0), + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.UNIVERSAL_CABLE, BaseTier.BASIC, 8), "SRS", Character.valueOf('S'), "ingotSteel", Character.valueOf('R'), "dustRedstone" )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 1), - "TTT", "TET", "TTT", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 0) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.UNIVERSAL_CABLE, BaseTier.ADVANCED, 8), + "TTT", "TET", "TTT", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('T'), MekanismUtils.getTransmitter(TransmitterType.UNIVERSAL_CABLE, BaseTier.BASIC, 1) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 2), - "TTT", "TRT", "TTT", Character.valueOf('R'), "alloyElite", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 1) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.UNIVERSAL_CABLE, BaseTier.ELITE, 8), + "TTT", "TRT", "TTT", Character.valueOf('R'), "alloyElite", Character.valueOf('T'), MekanismUtils.getTransmitter(TransmitterType.UNIVERSAL_CABLE, BaseTier.ADVANCED, 1) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 3), - "TTT", "TAT", "TTT", Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 2) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.UNIVERSAL_CABLE, BaseTier.ULTIMATE, 8), + "TTT", "TAT", "TTT", Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), MekanismUtils.getTransmitter(TransmitterType.UNIVERSAL_CABLE, BaseTier.ELITE, 1) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 4), + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.MECHANICAL_PIPE, BaseTier.BASIC, 8), "SBS", Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Items.BUCKET )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 5), - "TTT", "TET", "TTT", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 4) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.MECHANICAL_PIPE, BaseTier.ADVANCED, 8), + "TTT", "TET", "TTT", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('T'), MekanismUtils.getTransmitter(TransmitterType.MECHANICAL_PIPE, BaseTier.BASIC, 1) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 6), - "TTT", "TRT", "TTT", Character.valueOf('R'), "alloyElite", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 5) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.MECHANICAL_PIPE, BaseTier.ELITE, 8), + "TTT", "TRT", "TTT", Character.valueOf('R'), "alloyElite", Character.valueOf('T'), MekanismUtils.getTransmitter(TransmitterType.MECHANICAL_PIPE, BaseTier.ADVANCED, 1) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 7), - "TTT", "TAT", "TTT", Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 6) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.MECHANICAL_PIPE, BaseTier.ULTIMATE, 8), + "TTT", "TAT", "TTT", Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), MekanismUtils.getTransmitter(TransmitterType.MECHANICAL_PIPE, BaseTier.ELITE, 1) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 8), + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.PRESSURIZED_TUBE, BaseTier.BASIC, 8), "SGS", Character.valueOf('S'), "ingotSteel", Character.valueOf('G'), "blockGlass" )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 9), - "TTT", "TET", "TTT", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 8) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.PRESSURIZED_TUBE, BaseTier.ADVANCED, 8), + "TTT", "TET", "TTT", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('T'), MekanismUtils.getTransmitter(TransmitterType.PRESSURIZED_TUBE, BaseTier.BASIC, 1) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 10), - "TTT", "TRT", "TTT", Character.valueOf('R'), "alloyElite", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 9) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.PRESSURIZED_TUBE, BaseTier.ELITE, 8), + "TTT", "TRT", "TTT", Character.valueOf('R'), "alloyElite", Character.valueOf('T'), MekanismUtils.getTransmitter(TransmitterType.PRESSURIZED_TUBE, BaseTier.ADVANCED, 1) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 11), - "TTT", "TAT", "TTT", Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 10) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.PRESSURIZED_TUBE, BaseTier.ULTIMATE, 8), + "TTT", "TAT", "TTT", Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), MekanismUtils.getTransmitter(TransmitterType.PRESSURIZED_TUBE, BaseTier.ELITE, 1) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 12), + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.LOGISTICAL_TRANSPORTER, BaseTier.BASIC, 8), "SCS", Character.valueOf('S'), "ingotSteel", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 13), - "TTT", "TET", "TTT", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 12) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.LOGISTICAL_TRANSPORTER, BaseTier.ADVANCED, 8), + "TTT", "TET", "TTT", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('T'), MekanismUtils.getTransmitter(TransmitterType.LOGISTICAL_TRANSPORTER, BaseTier.BASIC, 1) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 14), - "TTT", "TRT", "TTT", Character.valueOf('R'), "alloyElite", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 13) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.LOGISTICAL_TRANSPORTER, BaseTier.ELITE, 8), + "TTT", "TRT", "TTT", Character.valueOf('R'), "alloyElite", Character.valueOf('T'), MekanismUtils.getTransmitter(TransmitterType.LOGISTICAL_TRANSPORTER, BaseTier.ADVANCED, 1) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 15), - "TTT", "TAT", "TTT", Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 14) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.LOGISTICAL_TRANSPORTER, BaseTier.ULTIMATE, 8), + "TTT", "TAT", "TTT", Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), MekanismUtils.getTransmitter(TransmitterType.LOGISTICAL_TRANSPORTER, BaseTier.ELITE, 1) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 2, 16), + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.RESTRICTIVE_TRANSPORTER, BaseTier.BASIC, 2), "SBS", Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Blocks.IRON_BARS )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 2, 17), + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.DIVERSION_TRANSPORTER, BaseTier.BASIC, 2), "RRR", "SBS", "RRR", Character.valueOf('R'), "dustRedstone", Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Blocks.IRON_BARS )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 18), + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.THERMODYNAMIC_CONDUCTOR, BaseTier.BASIC, 8), "SCS", Character.valueOf('S'), "ingotSteel", Character.valueOf('C'), "ingotCopper" )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 19), - "TTT", "TET", "TTT", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 18) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.THERMODYNAMIC_CONDUCTOR, BaseTier.ADVANCED, 8), + "TTT", "TET", "TTT", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('T'), MekanismUtils.getTransmitter(TransmitterType.THERMODYNAMIC_CONDUCTOR, BaseTier.BASIC, 1) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 20), - "TTT", "TRT", "TTT", Character.valueOf('R'), "alloyElite", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 19) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.THERMODYNAMIC_CONDUCTOR, BaseTier.ELITE, 8), + "TTT", "TRT", "TTT", Character.valueOf('R'), "alloyElite", Character.valueOf('T'), MekanismUtils.getTransmitter(TransmitterType.THERMODYNAMIC_CONDUCTOR, BaseTier.ADVANCED, 1) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 21), - "TTT", "TAT", "TTT", Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 20) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getTransmitter(TransmitterType.THERMODYNAMIC_CONDUCTOR, BaseTier.ULTIMATE, 8), + "TTT", "TAT", "TTT", Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), MekanismUtils.getTransmitter(TransmitterType.THERMODYNAMIC_CONDUCTOR, BaseTier.ELITE, 1) )); //Plastic stuff @@ -760,7 +759,7 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.PlasticBlock, 4, 15), "SSS", "S S", "SSS", Character.valueOf('S'), new ItemStack(MekanismItems.Polyethene, 1, 2) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.GlowPanel, 2, 15), + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.GlowPanel, 2, 15), "PSP", "S S", "GSG", Character.valueOf('P'), "paneGlass", Character.valueOf('S'), new ItemStack(MekanismItems.Polyethene, 1, 2), Character.valueOf('G'), "dustGlowstone" )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.PlasticFence, 3, 15), @@ -772,7 +771,7 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.PlasticBlock, 4, i), "SSS", "SDS", "SSS", Character.valueOf('S'), new ItemStack(MekanismItems.Polyethene, 1, 2), Character.valueOf('D'), "dye" + EnumColor.DYES[i].dyeName )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.GlowPanel, 2, i), + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.GlowPanel, 2, i), "PSP", "SDS", "GSG", Character.valueOf('P'), "paneGlass", Character.valueOf('S'), new ItemStack(MekanismItems.Polyethene, 1, 2), Character.valueOf('D'), "dye" + EnumColor.DYES[i].dyeName, Character.valueOf('G'), "dustGlowstone" )); } @@ -801,8 +800,8 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.ReinforcedPlasticBlock, 4, i), " P ", "PDP", " P ", Character.valueOf('P'), new ItemStack(MekanismBlocks.ReinforcedPlasticBlock, 1, j), Character.valueOf('D'), "dye" + EnumColor.DYES[i].dyeName )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.GlowPanel, 4, i), - " P ", "PDP", " P ", Character.valueOf('P'), new ItemStack(MekanismItems.GlowPanel, 1, j), Character.valueOf('D'), "dye" + EnumColor.DYES[i].dyeName + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.GlowPanel, 4, i), + " P ", "PDP", " P ", Character.valueOf('P'), new ItemStack(MekanismBlocks.GlowPanel, 1, j), Character.valueOf('D'), "dye" + EnumColor.DYES[i].dyeName )); } @@ -837,6 +836,7 @@ public class Mekanism RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.LAPIS_ORE), new ItemStack(Items.DYE, 12, 4)); RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.COAL_ORE), new ItemStack(Items.COAL, 2)); RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.DIAMOND_ORE), new ItemStack(Items.DIAMOND, 2)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.EMERALD_ORE), new ItemStack(Items.EMERALD, 2)); RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.MOSSY_COBBLESTONE), new ItemStack(Blocks.COBBLESTONE)); RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.STONE), new ItemStack(Blocks.STONEBRICK, 1, 2)); RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.SAND), new ItemStack(Blocks.GRAVEL)); @@ -905,10 +905,10 @@ public class Mekanism RecipeHandler.addPurificationChamberRecipe(new ItemStack(Blocks.GRAVEL), new ItemStack(Items.FLINT)); //Chemical Injection Chamber Recipes - RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Blocks.DIRT), "water", new ItemStack(Blocks.CLAY)); - RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Blocks.HARDENED_CLAY), "water", new ItemStack(Blocks.CLAY)); - RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Items.BRICK), "water", new ItemStack(Items.CLAY_BALL)); - RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Items.GUNPOWDER), "hydrogenChloride", new ItemStack(MekanismItems.OtherDust, 1, 3)); + RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Blocks.DIRT), MekanismFluids.Water, new ItemStack(Blocks.CLAY)); + RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Blocks.HARDENED_CLAY), MekanismFluids.Water, new ItemStack(Blocks.CLAY)); + RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Items.BRICK), MekanismFluids.Water, new ItemStack(Items.CLAY_BALL)); + RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Items.GUNPOWDER), MekanismFluids.HydrogenChloride, new ItemStack(MekanismItems.OtherDust, 1, 3)); //Precision Sawmill Recipes RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.LADDER, 3), new ItemStack(Items.STICK, 7)); @@ -955,23 +955,23 @@ public class Mekanism RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("OBSIDIAN"), 10, new ItemStack(MekanismItems.ReinforcedAlloy), new ItemStack(MekanismItems.AtomicAlloy)); //Chemical Infuser Recipes - RecipeHandler.addChemicalInfuserRecipe(new GasStack(GasRegistry.getGas("oxygen"), 1), new GasStack(GasRegistry.getGas("sulfurDioxideGas"), 2), new GasStack(GasRegistry.getGas("sulfurTrioxideGas"), 2)); - RecipeHandler.addChemicalInfuserRecipe(new GasStack(GasRegistry.getGas("sulfurTrioxideGas"), 1), new GasStack(GasRegistry.getGas("water"), 1), new GasStack(GasRegistry.getGas("sulfuricAcid"), 1)); - RecipeHandler.addChemicalInfuserRecipe(new GasStack(GasRegistry.getGas("hydrogen"), 1), new GasStack(GasRegistry.getGas("chlorine"), 1), new GasStack(GasRegistry.getGas("hydrogenChloride"), 1)); - RecipeHandler.addChemicalInfuserRecipe(new GasStack(GasRegistry.getGas("deuterium"), 1), new GasStack(GasRegistry.getGas("tritium"), 1), new GasStack(GasRegistry.getGas("fusionFuelDT"), 2)); + RecipeHandler.addChemicalInfuserRecipe(new GasStack(MekanismFluids.Oxygen, 1), new GasStack(MekanismFluids.SulfurDioxide, 2), new GasStack(MekanismFluids.SulfurTrioxide, 2)); + RecipeHandler.addChemicalInfuserRecipe(new GasStack(MekanismFluids.SulfurTrioxide, 1), new GasStack(MekanismFluids.Water, 1), new GasStack(MekanismFluids.SulfuricAcid, 1)); + RecipeHandler.addChemicalInfuserRecipe(new GasStack(MekanismFluids.Hydrogen, 1), new GasStack(MekanismFluids.Chlorine, 1), new GasStack(MekanismFluids.HydrogenChloride, 1)); + RecipeHandler.addChemicalInfuserRecipe(new GasStack(MekanismFluids.Deuterium, 1), new GasStack(MekanismFluids.Tritium, 1), new GasStack(MekanismFluids.FusionFuel, 2)); //Electrolytic Separator Recipes - RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("water", 2), 2 * general.FROM_H2, new GasStack(GasRegistry.getGas("hydrogen"), 2), new GasStack(GasRegistry.getGas("oxygen"), 1)); - RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("brine", 10), 2 * general.FROM_H2, new GasStack(GasRegistry.getGas("sodium"), 1), new GasStack(GasRegistry.getGas("chlorine"), 1)); - RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("heavywater", 2), usage.heavyWaterElectrolysisUsage, new GasStack(GasRegistry.getGas("deuterium"), 2), new GasStack(GasRegistry.getGas("oxygen"), 1)); + RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("water", 2), 2 * general.FROM_H2, new GasStack(MekanismFluids.Hydrogen, 2), new GasStack(MekanismFluids.Oxygen, 1)); + RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("brine", 10), 2 * general.FROM_H2, new GasStack(MekanismFluids.Sodium, 1), new GasStack(MekanismFluids.Chlorine, 1)); + RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("heavywater", 2), usage.heavyWaterElectrolysisUsage, new GasStack(MekanismFluids.Deuterium, 2), new GasStack(MekanismFluids.Oxygen, 1)); //Thermal Evaporation Plant Recipes RecipeHandler.addThermalEvaporationRecipe(FluidRegistry.getFluidStack("water", 10), FluidRegistry.getFluidStack("brine", 1)); - RecipeHandler.addThermalEvaporationRecipe(FluidRegistry.getFluidStack("brine", 10), FluidRegistry.getFluidStack("lithium", 1)); + RecipeHandler.addThermalEvaporationRecipe(FluidRegistry.getFluidStack("brine", 10), FluidRegistry.getFluidStack("liquidlithium", 1)); //Chemical Crystallizer Recipes - RecipeHandler.addChemicalCrystallizerRecipe(new GasStack(GasRegistry.getGas("lithium"), 100), new ItemStack(MekanismItems.OtherDust, 1, 4)); - RecipeHandler.addChemicalCrystallizerRecipe(new GasStack(GasRegistry.getGas("brine"), 15), new ItemStack(MekanismItems.Salt)); + RecipeHandler.addChemicalCrystallizerRecipe(new GasStack(MekanismFluids.Lithium, 100), new ItemStack(MekanismItems.OtherDust, 1, 4)); + RecipeHandler.addChemicalCrystallizerRecipe(new GasStack(MekanismFluids.Brine, 15), new ItemStack(MekanismItems.Salt)); //T4 Processing Recipes for(Gas gas : GasRegistry.getRegisteredGasses()) @@ -987,26 +987,26 @@ public class Mekanism //Pressurized Reaction Chamber Recipes RecipeHandler.addPRCRecipe( - new ItemStack(MekanismItems.BioFuel, 2), new FluidStack(FluidRegistry.WATER, 10), new GasStack(GasRegistry.getGas("hydrogen"), 100), - new ItemStack(MekanismItems.Substrate), new GasStack(GasRegistry.getGas("ethene"), 100), + new ItemStack(MekanismItems.BioFuel, 2), new FluidStack(FluidRegistry.WATER, 10), new GasStack(MekanismFluids.Hydrogen, 100), + new ItemStack(MekanismItems.Substrate), new GasStack(MekanismFluids.Ethene, 100), 0, 100 ); RecipeHandler.addPRCRecipe( - new ItemStack(MekanismItems.Substrate), new FluidStack(FluidRegistry.getFluid("ethene"), 50), new GasStack(GasRegistry.getGas("oxygen"), 10), - new ItemStack(MekanismItems.Polyethene), new GasStack(GasRegistry.getGas("oxygen"), 5), + new ItemStack(MekanismItems.Substrate), new FluidStack(MekanismFluids.Ethene.getFluid(), 50), new GasStack(MekanismFluids.Oxygen, 10), + new ItemStack(MekanismItems.Polyethene), new GasStack(MekanismFluids.Oxygen, 5), 1000, 60 ); RecipeHandler.addPRCRecipe( - new ItemStack(MekanismItems.Substrate), new FluidStack(FluidRegistry.WATER, 200), new GasStack(GasRegistry.getGas("ethene"), 100), - new ItemStack(MekanismItems.Substrate, 8), new GasStack(GasRegistry.getGas("oxygen"), 10), + new ItemStack(MekanismItems.Substrate), new FluidStack(FluidRegistry.WATER, 200), new GasStack(MekanismFluids.Ethene, 100), + new ItemStack(MekanismItems.Substrate, 8), new GasStack(MekanismFluids.Oxygen, 10), 200, 400 ); //Solar Neutron Activator Recipes - RecipeHandler.addSolarNeutronRecipe(new GasStack(GasRegistry.getGas("lithium"), 1), new GasStack(GasRegistry.getGas("tritium"), 1)); + RecipeHandler.addSolarNeutronRecipe(new GasStack(MekanismFluids.Lithium, 1), new GasStack(MekanismFluids.Tritium, 1)); //Infuse objects InfuseRegistry.registerInfuseObject(new ItemStack(MekanismItems.BioFuel), new InfuseObject(InfuseRegistry.get("BIO"), 5)); @@ -1036,7 +1036,7 @@ public class Mekanism }); //Fuel Gases - FuelHandler.addGas(GasRegistry.getGas("hydrogen"), 1, general.FROM_H2); + FuelHandler.addGas(MekanismFluids.Hydrogen, 1, general.FROM_H2); //RecipeSorter registrations RecipeSorter.register("mekanism_shaped", ShapedMekanismRecipe.class, Category.SHAPED, ""); @@ -1050,7 +1050,7 @@ public class Mekanism public void registerOreDict() { //Add specific items to ore dictionary for recipe usage in other mods. - OreDictionary.registerOre("universalCable", new ItemStack(MekanismItems.PartTransmitter, 8, 0)); + OreDictionary.registerOre("universalCable", MekanismUtils.getTransmitter(TransmitterType.UNIVERSAL_CABLE, BaseTier.BASIC, 1)); OreDictionary.registerOre("battery", MekanismItems.EnergyTablet.getUnchargedItem()); OreDictionary.registerOre("pulpWood", MekanismItems.Sawdust); OreDictionary.registerOre("dustWood", MekanismItems.Sawdust); @@ -1121,81 +1121,17 @@ public class Mekanism OreDictionary.registerOre("itemBioFuel", new ItemStack(MekanismItems.BioFuel)); } - /** - * Integrates the mod with other mods -- registering items and blocks with the Forge Ore Dictionary - * and adding machine recipes with other items' corresponding resources. - */ - public void addIntegratedItems() - { - if(hooks.MetallurgyCoreLoaded) - { - try { - String[] setNames = {"base", "precious", "nether", "fantasy", "ender", "utility"}; - - for(String setName : setNames ) - { - for(IOreInfo oreInfo : MetallurgyAPI.getMetalSet(setName).getOreList().values()) - { - switch(oreInfo.getType()) - { - case ALLOY: - { - if(oreInfo.getIngot() != null && oreInfo.getDust() != null) - { - RecipeHandler.addCrusherRecipe(MekanismUtils.size(oreInfo.getIngot(), 1), MekanismUtils.size(oreInfo.getDust(), 1)); - } - - break; - } - case DROP: - { - ItemStack ore = oreInfo.getOre(); - ItemStack drop = oreInfo.getDrop(); - - if(drop != null && ore != null) - { - RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), MekanismUtils.size(drop, 12)); - } - - break; - } - default: - { - ItemStack ore = oreInfo.getOre(); - ItemStack dust = oreInfo.getDust(); - ItemStack ingot = oreInfo.getIngot(); - - if(ore != null && dust != null) - { - RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), MekanismUtils.size(dust, 2)); - RecipeHandler.addCombinerRecipe(MekanismUtils.size(dust, 8), MekanismUtils.size(ore, 1)); - } - - if(ingot != null && dust != null) - { - RecipeHandler.addCrusherRecipe(MekanismUtils.size(ingot, 1), MekanismUtils.size(dust, 1)); - } - - break; - } - } - } - } - } catch(Exception e) {} - } - } - /** * Adds and registers all entities and tile entities. */ public void addEntities() { //Registrations - EntityRegistry.registerModEntity(EntityObsidianTNT.class, "ObsidianTNT", 0, this, 64, 5, true); - EntityRegistry.registerModEntity(EntityRobit.class, "Robit", 1, this, 64, 2, true); - EntityRegistry.registerModEntity(EntityBalloon.class, "Balloon", 2, this, 64, 1, true); - EntityRegistry.registerModEntity(EntityBabySkeleton.class, "BabySkeleton", 3, this, 64, 5, true); - EntityRegistry.registerModEntity(EntityFlame.class, "Flame", 4, this, 64, 5, true); + EntityRegistry.registerModEntity(new ResourceLocation("mekanism", "ObsidianTNT"), EntityObsidianTNT.class, "ObsidianTNT", 0, this, 64, 5, true); + EntityRegistry.registerModEntity(new ResourceLocation("mekanism", "Robit"), EntityRobit.class, "Robit", 1, this, 64, 2, true); + EntityRegistry.registerModEntity(new ResourceLocation("mekanism", "Balloon"), EntityBalloon.class, "Balloon", 2, this, 64, 1, true); + EntityRegistry.registerModEntity(new ResourceLocation("mekanism", "BabySkeleton"), EntityBabySkeleton.class, "BabySkeleton", 3, this, 64, 5, true); + EntityRegistry.registerModEntity(new ResourceLocation("mekanism", "Flame"), EntityFlame.class, "Flame", 4, this, 64, 5, true); //Tile entities GameRegistry.registerTileEntity(TileEntityBoundingBlock.class, "BoundingBlock"); @@ -1223,6 +1159,7 @@ public class Mekanism GameRegistry.registerTileEntity(TileEntityRotaryCondensentrator.class, "RotaryCondensentrator"); GameRegistry.registerTileEntity(TileEntityElectricPump.class, "ElectricPump"); GameRegistry.registerTileEntity(TileEntityFluidicPlenisher.class, "FluidicPlenisher"); + GameRegistry.registerTileEntity(TileEntityGlowPanel.class, "GlowPanel"); //Load tile entities that have special renderers. proxy.registerSpecialTileEntities(); @@ -1303,8 +1240,14 @@ public class Mekanism MekanismItems.register(); MekanismBlocks.register(); - //Set up multiparts - new MultipartMekanism(); + if(Loader.isModLoaded("mcmultipart")) + { + //Set up multiparts + new MultipartMekanism(); + } + else { + logger.info("Didn't detect MCMP, ignoring compatibility package"); + } Mekanism.proxy.preInit(); @@ -1416,12 +1359,10 @@ public class Mekanism MinecraftForge.EVENT_BUS.post(new BoxBlacklistEvent()); - addIntegratedItems(); - OreDictManager.init(); //Update the config-dependent recipes after the recipes have actually been added in the first place - Mekanism.proxy.updateConfigRecipes(); + TypeConfigManager.updateConfigRecipes(MachineType.getValidMachines(), general.machinesManager); logger.info("Hooking complete."); } @@ -1497,7 +1438,6 @@ public class Mekanism MekanismAPI.addBoxBlacklist(Blocks.ACACIA_DOOR, OreDictionary.WILDCARD_VALUE); MekanismAPI.addBoxBlacklist(Blocks.DARK_OAK_DOOR, OreDictionary.WILDCARD_VALUE); MekanismAPI.addBoxBlacklist(Blocks.IRON_DOOR, OreDictionary.WILDCARD_VALUE); - MekanismAPI.addBoxBlacklist(MCMultiPartMod.multipart, OreDictionary.WILDCARD_VALUE); BoxBlacklistParser.load(); } @@ -1556,7 +1496,7 @@ public class Mekanism return; } - ChunkPos coordPair = event.getChunk().getChunkCoordIntPair(); + ChunkPos coordPair = event.getChunk().getPos(); worldTickHandler.addRegenChunk(event.getWorld().provider.getDimension(), coordPair); } } @@ -1565,7 +1505,7 @@ public class Mekanism @SubscribeEvent public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) { - if(event.getModID().equals("Mekanism")) + if(event.getModID().equals("mekanism")) { proxy.loadConfiguration(); proxy.onConfigSync(false); diff --git a/src/main/java/mekanism/common/MekanismBlocks.java b/src/main/java/mekanism/common/MekanismBlocks.java index 0e1a5866c..f9741741c 100644 --- a/src/main/java/mekanism/common/MekanismBlocks.java +++ b/src/main/java/mekanism/common/MekanismBlocks.java @@ -10,26 +10,30 @@ import mekanism.common.block.BlockBounding; import mekanism.common.block.BlockCardboardBox; import mekanism.common.block.BlockEnergyCube; import mekanism.common.block.BlockGasTank; +import mekanism.common.block.BlockGlowPanel; import mekanism.common.block.BlockMachine; import mekanism.common.block.BlockObsidianTNT; import mekanism.common.block.BlockOre; import mekanism.common.block.BlockPlastic; import mekanism.common.block.BlockPlasticFence; import mekanism.common.block.BlockSalt; +import mekanism.common.block.BlockTransmitter; import mekanism.common.block.states.BlockStatePlastic.PlasticBlockType; import mekanism.common.item.ItemBlockBasic; import mekanism.common.item.ItemBlockCardboardBox; import mekanism.common.item.ItemBlockEnergyCube; import mekanism.common.item.ItemBlockGasTank; +import mekanism.common.item.ItemBlockGlowPanel; import mekanism.common.item.ItemBlockMachine; import mekanism.common.item.ItemBlockOre; import mekanism.common.item.ItemBlockPlastic; +import mekanism.common.item.ItemBlockTransmitter; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; -@ObjectHolder("Mekanism") +@ObjectHolder("mekanism") public class MekanismBlocks { public static Block BasicBlock = BlockBasic.getBlockBasic(BASIC_BLOCK_1); @@ -40,9 +44,11 @@ public class MekanismBlocks public static Block OreBlock = new BlockOre(); public static Block ObsidianTNT = new BlockObsidianTNT().setCreativeTab(Mekanism.tabMekanism); public static Block EnergyCube = new BlockEnergyCube(); + public static Block Transmitter = new BlockTransmitter(); public static Block BoundingBlock = (BlockBounding)new BlockBounding(); public static Block GasTank = new BlockGasTank(); public static Block CardboardBox = new BlockCardboardBox(); + public static Block GlowPanel = new BlockGlowPanel(); public static Block PlasticBlock = new BlockPlastic(PlasticBlockType.PLASTIC); public static Block SlickPlasticBlock = new BlockPlastic(PlasticBlockType.SLICK); public static Block GlowPlasticBlock = new BlockPlastic(PlasticBlockType.GLOW); @@ -63,10 +69,12 @@ public class MekanismBlocks GameRegistry.register(init(MachineBlock3, "MachineBlock3")); GameRegistry.register(init(OreBlock, "OreBlock")); GameRegistry.register(init(EnergyCube, "EnergyCube")); + GameRegistry.register(init(Transmitter, "Transmitter")); GameRegistry.register(init(ObsidianTNT, "ObsidianTNT")); GameRegistry.register(init(BoundingBlock, "BoundingBlock")); GameRegistry.register(init(GasTank, "GasTank")); GameRegistry.register(init(CardboardBox, "CardboardBox")); + GameRegistry.register(init(GlowPanel, "GlowPanel")); GameRegistry.register(init(PlasticBlock, "PlasticBlock")); GameRegistry.register(init(SlickPlasticBlock, "SlickPlasticBlock")); GameRegistry.register(init(GlowPlasticBlock, "GlowPlasticBlock")); @@ -82,10 +90,12 @@ public class MekanismBlocks GameRegistry.register(MekanismItems.init(new ItemBlockMachine(MachineBlock3), "MachineBlock3")); GameRegistry.register(MekanismItems.init(new ItemBlockOre(OreBlock), "OreBlock")); GameRegistry.register(MekanismItems.init(new ItemBlockEnergyCube(EnergyCube), "EnergyCube")); + GameRegistry.register(MekanismItems.init(new ItemBlockTransmitter(Transmitter), "Transmitter")); GameRegistry.register(MekanismItems.init(new ItemBlock(ObsidianTNT), "ObsidianTNT")); GameRegistry.register(MekanismItems.init(new ItemBlock(BoundingBlock), "BoundingBlock")); GameRegistry.register(MekanismItems.init(new ItemBlockGasTank(GasTank), "GasTank")); GameRegistry.register(MekanismItems.init(new ItemBlockCardboardBox(CardboardBox), "CardboardBox")); + GameRegistry.register(MekanismItems.init(new ItemBlockGlowPanel(GlowPanel), "GlowPanel")); GameRegistry.register(MekanismItems.init(new ItemBlockPlastic(PlasticBlock), "PlasticBlock")); GameRegistry.register(MekanismItems.init(new ItemBlockPlastic(SlickPlasticBlock), "SlickPlasticBlock")); GameRegistry.register(MekanismItems.init(new ItemBlockPlastic(GlowPlasticBlock), "GlowPlasticBlock")); diff --git a/src/main/java/mekanism/common/MekanismFluids.java b/src/main/java/mekanism/common/MekanismFluids.java index 9e6993f55..a5f48d38f 100644 --- a/src/main/java/mekanism/common/MekanismFluids.java +++ b/src/main/java/mekanism/common/MekanismFluids.java @@ -9,30 +9,52 @@ import net.minecraftforge.fluids.FluidRegistry; public class MekanismFluids { + public static final Gas Hydrogen = new Gas("hydrogen", "mekanism:blocks/liquid/LiquidHydrogen"); + public static final Gas Oxygen = new Gas("oxygen", "mekanism:blocks/liquid/LiquidOxygen"); + public static final Gas Water = new Gas("water", "mekanism:blocks/liquid/LiquidSteam"); + public static final Gas Chlorine = new Gas("chlorine", "mekanism:blocks/liquid/LiquidChlorine"); + public static final Gas SulfurDioxide = new Gas("sulfurdioxide", "mekanism:blocks/liquid/LiquidSulfurDioxide"); + public static final Gas SulfurTrioxide = new Gas("sulfurtrioxide", "mekanism:blocks/liquid/LiquidSulfurTrioxide"); + public static final Gas SulfuricAcid = new Gas("sulfuricacid", "mekanism:blocks/liquid/LiquidSulfuricAcid"); + public static final Gas HydrogenChloride = new Gas("hydrogenchloride", "mekanism:blocks/liquid/LiquidHydrogenChloride"); + + public static final Fluid HeavyWater = new Fluid("heavywater", new ResourceLocation("mekanism:blocks/liquid/LiquidHeavyWater"), new ResourceLocation("mekanism:blocks/liquid/LiquidHeavyWater")); + public static final Fluid Steam = new Fluid("steam", new ResourceLocation("mekanism:blocks/liquid/LiquidSteam"), new ResourceLocation("mekanism:blocks/liquid/LiquidSteam")).setGaseous(true); + + //Internal gases + public static final Gas LiquidOsmium = new Gas("liquidosmium", "mekanism:blocks/liquid/LiquidOsmium"); + public static final Gas LiquidStone = new Gas("liquidstone", "mekanism:blocks/liquid/LiquidStone"); + public static final Gas Ethene = new Gas("ethene", "mekanism:blocks/liquid/LiquidEthene"); + public static final Gas Sodium = new Gas("sodium", "mekanism:blocks/liquid/LiquidSodium"); + public static final Gas Brine = new Gas("brine", "mekanism:blocks/liquid/LiquidBrine"); + public static final Gas Deuterium = new Gas("deuterium", "mekanism:blocks/liquid/LiquidDeuterium"); + public static final Gas Tritium = new Gas("tritium", "mekanism:blocks/liquid/LiquidTritium"); + public static final Gas FusionFuel = new Gas("fusionfuel", "mekanism:blocks/liquid/LiquidDT"); + public static final Gas Lithium = new Gas("lithium", "mekanism:blocks/liquid/LiquidLithium"); + public static void register() { - GasRegistry.register(new Gas("hydrogen", "mekanism:blocks/liquid/LiquidHydrogen")).registerFluid(); - GasRegistry.register(new Gas("oxygen", "mekanism:blocks/liquid/LiquidOxygen")).registerFluid(); - GasRegistry.register(new Gas("water", "mekanism:blocks/liquid/LiquidSteam")).registerFluid(); - GasRegistry.register(new Gas("chlorine", "mekanism:blocks/liquid/LiquidChlorine")).registerFluid(); - GasRegistry.register(new Gas("sulfurDioxideGas", "mekanism:blocks/liquid/LiquidSulfurDioxide")).registerFluid(); - GasRegistry.register(new Gas("sulfurTrioxideGas", "mekanism:blocks/liquid/LiquidSulfurTrioxide")).registerFluid(); - GasRegistry.register(new Gas("sulfuricAcid", "mekanism:blocks/liquid/LiquidSulfuricAcid")).registerFluid(); - GasRegistry.register(new Gas("hydrogenChloride", "mekanism:blocks/liquid/LiquidHydrogenChloride")).registerFluid(); - GasRegistry.register(new Gas("liquidOsmium", "mekanism:blocks/liquid/LiquidOsmium").setVisible(false)); - GasRegistry.register(new Gas("liquidStone", "mekanism:blocks/liquid/LiquidStone").setVisible(false)); - GasRegistry.register(new Gas("ethene", "mekanism:blocks/liquid/LiquidEthene").registerFluid()); - GasRegistry.register(new Gas("sodium", "mekanism:blocks/liquid/LiquidSodium").registerFluid()); - GasRegistry.register(new Gas("brine", "mekanism:blocks/liquid/LiquidBrine").registerFluid()); - GasRegistry.register(new Gas("deuterium", "mekanism:blocks/liquid/LiquidDeuterium")).registerFluid(); - GasRegistry.register(new Gas("tritium", "mekanism:blocks/liquid/LiquidTritium")).registerFluid(); - GasRegistry.register(new Gas("fusionFuelDT", "mekanism:blocks/liquid/LiquidDT")).registerFluid(); - GasRegistry.register(new Gas("lithium", "mekanism:blocks/liquid/LiquidLithium")).registerFluid(); + GasRegistry.register(Hydrogen).registerFluid("liquidhydrogen"); + GasRegistry.register(Oxygen).registerFluid("liquidoxygen"); + GasRegistry.register(Water).registerFluid(); + GasRegistry.register(Chlorine).registerFluid("liquidchlorine"); + GasRegistry.register(SulfurDioxide).registerFluid("liquidsulfurdioxide"); + GasRegistry.register(SulfurTrioxide).registerFluid("liquidsulfurtrioxide"); + GasRegistry.register(SulfuricAcid).registerFluid(); + GasRegistry.register(HydrogenChloride).registerFluid("liquidhydrogenchloride"); + GasRegistry.register(Ethene).registerFluid("liquidethene"); + GasRegistry.register(Sodium).registerFluid("liquidsodium"); + GasRegistry.register(Brine).registerFluid(); + GasRegistry.register(Deuterium).registerFluid("liquiddeuterium"); + GasRegistry.register(Tritium).registerFluid("liquidtritium"); + GasRegistry.register(FusionFuel).registerFluid("liquidfusionfuel"); + GasRegistry.register(Lithium).registerFluid("liquidlithium"); - FluidRegistry.getFluid("brine").setGaseous(false); + GasRegistry.register(LiquidOsmium).setVisible(false); + GasRegistry.register(LiquidStone).setVisible(false); - FluidRegistry.registerFluid(new Fluid("heavyWater", new ResourceLocation("mekanism:blocks/liquid/LiquidHeavyWater"), new ResourceLocation("mekanism:blocks/liquid/LiquidHeavyWater"))); - FluidRegistry.registerFluid(new Fluid("steam", new ResourceLocation("mekanism:blocks/liquid/LiquidSteam"), new ResourceLocation("mekanism:blocks/liquid/LiquidSteam")).setGaseous(true)); + FluidRegistry.registerFluid(HeavyWater); + FluidRegistry.registerFluid(Steam); for(Resource resource : Resource.values()) { @@ -44,8 +66,8 @@ public class MekanismFluids FluidRegistry.enableUniversalBucket(); - FluidRegistry.addBucketForFluid(FluidRegistry.getFluid("heavywater")); - FluidRegistry.addBucketForFluid(FluidRegistry.getFluid("brine")); - FluidRegistry.addBucketForFluid(FluidRegistry.getFluid("lithium")); + FluidRegistry.addBucketForFluid(HeavyWater); + FluidRegistry.addBucketForFluid(Brine.getFluid()); + FluidRegistry.addBucketForFluid(Lithium.getFluid()); } } diff --git a/src/main/java/mekanism/common/MekanismItems.java b/src/main/java/mekanism/common/MekanismItems.java index 6b57c1fd9..964c1f187 100644 --- a/src/main/java/mekanism/common/MekanismItems.java +++ b/src/main/java/mekanism/common/MekanismItems.java @@ -33,14 +33,12 @@ import mekanism.common.item.ItemShard; import mekanism.common.item.ItemTierInstaller; import mekanism.common.item.ItemUpgrade; import mekanism.common.item.ItemWalkieTalkie; -import mekanism.common.multipart.ItemGlowPanel; -import mekanism.common.multipart.ItemPartTransmitter; import net.minecraft.item.Item; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; -@ObjectHolder("Mekanism") +@ObjectHolder("mekanism") public class MekanismItems { public static final Item EnrichedAlloy = new ItemAlloy(); @@ -78,8 +76,6 @@ public class MekanismItems public static final ItemGaugeDropper GaugeDropper = (ItemGaugeDropper)new ItemGaugeDropper(); public static final Item ConfigurationCard = new ItemConfigurationCard(); public static final Item CraftingFormula = new ItemCraftingFormula(); - public static final Item PartTransmitter = new ItemPartTransmitter(); - public static final Item GlowPanel = new ItemGlowPanel(); public static final ItemScubaTank ScubaTank = (ItemScubaTank)new ItemScubaTank(); public static final ItemGasMask GasMask = (ItemGasMask)new ItemGasMask(); public static final ItemJetpack Jetpack = (ItemJetpack)new ItemJetpack(); @@ -104,7 +100,6 @@ public class MekanismItems */ public static void register() { - GameRegistry.register(init(PartTransmitter, "MultipartTransmitter")); GameRegistry.register(init(ElectricBow, "ElectricBow")); GameRegistry.register(init(Dust, "Dust")); GameRegistry.register(init(Ingot, "Ingot")); @@ -152,7 +147,6 @@ public class MekanismItems GameRegistry.register(init(Substrate, "Substrate")); GameRegistry.register(init(Polyethene, "Polyethene")); GameRegistry.register(init(BioFuel, "BioFuel")); - GameRegistry.register(init(GlowPanel, "GlowPanel")); GameRegistry.register(init(Flamethrower, "Flamethrower")); GameRegistry.register(init(GaugeDropper, "GaugeDropper")); GameRegistry.register(init(TierInstaller, "TierInstaller")); diff --git a/src/main/java/mekanism/common/MekanismSounds.java b/src/main/java/mekanism/common/MekanismSounds.java index af4d477c0..89434b936 100644 --- a/src/main/java/mekanism/common/MekanismSounds.java +++ b/src/main/java/mekanism/common/MekanismSounds.java @@ -2,16 +2,37 @@ package mekanism.common; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; +import net.minecraftforge.fml.common.registry.GameRegistry; -public final class MekanismSounds +public final class MekanismSounds { - public static final SoundEvent BEEP = new SoundEvent(new ResourceLocation("mekanism:etc.Beep")); - public static final SoundEvent CLICK = new SoundEvent(new ResourceLocation("mekanism:etc.Click")); - public static final SoundEvent DING = new SoundEvent(new ResourceLocation("mekanism:etc.Ding")); - public static final SoundEvent ERROR = new SoundEvent(new ResourceLocation("mekanism:etc.Error")); - public static final SoundEvent GAS_MASK = new SoundEvent(new ResourceLocation("mekanism:etc.GasMask")); - public static final SoundEvent HYDRAULIC = new SoundEvent(new ResourceLocation("mekanism:etc.Hydraulic")); - public static final SoundEvent POP = new SoundEvent(new ResourceLocation("mekanism:etc.Pop")); - public static final SoundEvent SUCCESS = new SoundEvent(new ResourceLocation("mekanism:etc.Success")); - public static final SoundEvent CJ_EASTER_EGG = new SoundEvent(new ResourceLocation("mekanism:etc.cj")); + public static SoundEvent BEEP; + public static SoundEvent CLICK; + public static SoundEvent DING; + public static SoundEvent ERROR; + public static SoundEvent GAS_MASK; + public static SoundEvent HYDRAULIC; + public static SoundEvent POP; + public static SoundEvent SUCCESS; + public static SoundEvent CJ_EASTER_EGG; + + public static void register() + { + BEEP = registerSound("etc.Beep"); + CLICK = registerSound("etc.Click"); + DING = registerSound("etc.Ding"); + ERROR = registerSound("etc.Error"); + GAS_MASK = registerSound("etc.GasMask"); + HYDRAULIC = registerSound("etc.Hydraulic"); + POP = registerSound("etc.Pop"); + SUCCESS = registerSound("etc.Success"); + CJ_EASTER_EGG = registerSound("etc.cj"); + } + + public static SoundEvent registerSound(String soundName) + { + ResourceLocation soundID = new ResourceLocation("mekanism", soundName); + SoundEvent event = new SoundEvent(soundID).setRegistryName(soundID); + return GameRegistry.register(event); + } } diff --git a/src/main/java/mekanism/api/ObfuscatedNames.java b/src/main/java/mekanism/common/ObfuscatedNames.java similarity index 92% rename from src/main/java/mekanism/api/ObfuscatedNames.java rename to src/main/java/mekanism/common/ObfuscatedNames.java index ca1075a57..ce4fcb920 100644 --- a/src/main/java/mekanism/api/ObfuscatedNames.java +++ b/src/main/java/mekanism/common/ObfuscatedNames.java @@ -1,10 +1,10 @@ -package mekanism.api; +package mekanism.common; public final class ObfuscatedNames { - public static String[] Minecraft_timer = new String[] {"timer", "field_71428_T", "S"}; - public static String[] GuiContainer_xSize = new String[] {"xSize", "field_146999_f", "c"}; - public static String[] GuiContainer_ySize = new String[] {"ySize", "field_147000_g", "d"}; + public static String[] Minecraft_timer = new String[] {"timer", "field_71428_T"}; + public static String[] GuiContainer_xSize = new String[] {"xSize", "field_146999_f"}; + public static String[] GuiContainer_ySize = new String[] {"ySize", "field_147000_g"}; public static String[] GuiContainer_guiLeft = new String[] {"guiLeft", "field_147003_i"}; public static String[] GuiContainer_guiTop = new String[] {"guiTop", "field_147009_r"}; public static String[] NetHandlerPlayServer_floatingTickCount = new String[] {"floatingTickCount", "field_147365_f"}; diff --git a/src/main/java/mekanism/common/OreDictCache.java b/src/main/java/mekanism/common/OreDictCache.java index 873bf9374..78abaa3f4 100644 --- a/src/main/java/mekanism/common/OreDictCache.java +++ b/src/main/java/mekanism/common/OreDictCache.java @@ -18,7 +18,7 @@ public final class OreDictCache public static List getOreDictName(ItemStack check) { - if(check == null || check.getItem() == null) + if(check.isEmpty()) { return new ArrayList(); } diff --git a/src/main/java/mekanism/common/PacketHandler.java b/src/main/java/mekanism/common/PacketHandler.java index 233d9b1d6..11453ba18 100644 --- a/src/main/java/mekanism/common/PacketHandler.java +++ b/src/main/java/mekanism/common/PacketHandler.java @@ -6,8 +6,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import mekanism.api.MekanismConfig.general; import mekanism.api.Range4D; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.network.PacketBoxBlacklist; import mekanism.common.network.PacketBoxBlacklist.BoxBlacklistMessage; import mekanism.common.network.PacketConfigSync; @@ -150,7 +150,11 @@ public class PacketHandler try { for(Object data : dataValues) { - if(data instanceof Integer) + if(data instanceof Byte) + { + output.writeByte((Byte)data); + } + else if(data instanceof Integer) { output.writeInt((Integer)data); } @@ -178,10 +182,6 @@ public class PacketHandler { writeString(output, (String)data); } - else if(data instanceof Byte) - { - output.writeByte((Byte)data); - } else if(data instanceof EnumFacing) { output.writeInt(((EnumFacing)data).ordinal()); @@ -256,7 +256,7 @@ public class PacketHandler { if(general.logPackets) { - System.out.println("[Mekanism] " + log); + Mekanism.logger.info(log); } } @@ -288,7 +288,7 @@ public class PacketHandler { MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); - for(EntityPlayerMP player : server.getPlayerList().getPlayerList()) + for(EntityPlayerMP player : server.getPlayerList().getPlayers()) { sendTo(message, player); } @@ -336,7 +336,7 @@ public class PacketHandler if(server != null && cuboid != null) { - for(EntityPlayerMP player : (List)server.getPlayerList().getPlayerList()) + for(EntityPlayerMP player : (List)server.getPlayerList().getPlayers()) { if(player.dimension == dimId && cuboid.isVecInside(new Vec3d(player.posX, player.posY, player.posZ))) { @@ -352,7 +352,7 @@ public class PacketHandler if(server != null) { - for(EntityPlayerMP player : (List)server.getPlayerList().getPlayerList()) + for(EntityPlayerMP player : (List)server.getPlayerList().getPlayers()) { if(player.dimension == range.dimensionId && Range4D.getChunkRange(player).intersects(range)) { diff --git a/src/main/java/mekanism/common/Tier.java b/src/main/java/mekanism/common/Tier.java index 45111fad2..52bc7674b 100644 --- a/src/main/java/mekanism/common/Tier.java +++ b/src/main/java/mekanism/common/Tier.java @@ -6,7 +6,7 @@ import java.util.ArrayList; import java.util.List; import mekanism.api.EnumColor; -import mekanism.common.multipart.TransmitterType; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterType; import mekanism.common.util.LangUtils; import net.minecraft.util.IStringSerializable; import net.minecraft.util.ResourceLocation; @@ -249,21 +249,17 @@ public final class Tier public static enum CableTier implements ITier { - BASIC(3200, TransmitterType.UNIVERSAL_CABLE_BASIC), - ADVANCED(12800, TransmitterType.UNIVERSAL_CABLE_ADVANCED), - ELITE(64000, TransmitterType.UNIVERSAL_CABLE_ELITE), - ULTIMATE(320000, TransmitterType.UNIVERSAL_CABLE_ULTIMATE); + BASIC(3200), + ADVANCED(12800), + ELITE(64000), + ULTIMATE(320000); public int cableCapacity; private int baseCapacity; - - public TransmitterType type; - private CableTier(int capacity, TransmitterType transmitterType) + private CableTier(int capacity) { baseCapacity = cableCapacity = capacity; - - type = transmitterType; } @Override @@ -306,25 +302,21 @@ public final class Tier public static enum PipeTier implements ITier { - BASIC(1000, 100, TransmitterType.MECHANICAL_PIPE_BASIC), - ADVANCED(4000, 400, TransmitterType.MECHANICAL_PIPE_ADVANCED), - ELITE(16000, 1600, TransmitterType.MECHANICAL_PIPE_ELITE), - ULTIMATE(64000, 6400, TransmitterType.MECHANICAL_PIPE_ULTIMATE); + BASIC(1000, 100), + ADVANCED(4000, 400), + ELITE(16000, 1600), + ULTIMATE(64000, 6400); public int pipeCapacity; private int baseCapacity; public int pipePullAmount; private int basePull; - - public TransmitterType type; - private PipeTier(int capacity, int pullAmount, TransmitterType transmitterType) + private PipeTier(int capacity, int pullAmount) { baseCapacity = pipeCapacity = capacity; basePull = pipePullAmount = pullAmount; - - type = transmitterType; } @Override @@ -370,25 +362,21 @@ public final class Tier public static enum TubeTier implements ITier { - BASIC(256, 64, TransmitterType.PRESSURIZED_TUBE_BASIC), - ADVANCED(1024, 256, TransmitterType.PRESSURIZED_TUBE_ADVANCED), - ELITE(4096, 1024, TransmitterType.PRESSURIZED_TUBE_ELITE), - ULTIMATE(16384, 4096, TransmitterType.PRESSURIZED_TUBE_ULTIMATE); + BASIC(256, 64), + ADVANCED(1024, 256), + ELITE(4096, 1024), + ULTIMATE(16384, 4096); public int tubeCapacity; private int baseCapacity; public int tubePullAmount; private int basePull; - - public TransmitterType type; - private TubeTier(int capacity, int pullAmount, TransmitterType transmitterType) + private TubeTier(int capacity, int pullAmount) { baseCapacity = tubeCapacity = capacity; basePull = tubePullAmount = pullAmount; - - type = transmitterType; } @Override @@ -434,25 +422,21 @@ public final class Tier public static enum TransporterTier implements ITier { - BASIC(1, 5, TransmitterType.LOGISTICAL_TRANSPORTER_BASIC), - ADVANCED(16, 10, TransmitterType.LOGISTICAL_TRANSPORTER_ADVANCED), - ELITE(32, 20, TransmitterType.LOGISTICAL_TRANSPORTER_ELITE), - ULTIMATE(64, 50, TransmitterType.LOGISTICAL_TRANSPORTER_ULTIMATE); + BASIC(1, 5), + ADVANCED(16, 10), + ELITE(32, 20), + ULTIMATE(64, 50); public int pullAmount; private int basePull; public int speed; private int baseSpeed; - - public TransmitterType type; - private TransporterTier(int pull, int s, TransmitterType transmitterType) + private TransporterTier(int pull, int s) { basePull = pullAmount = pull; baseSpeed = speed = s; - - type = transmitterType; } @Override @@ -498,10 +482,10 @@ public final class Tier public static enum ConductorTier implements ITier { - BASIC(5, 1, 10, new ColourRGBA(0.2, 0.2, 0.2, 1), TransmitterType.THERMODYNAMIC_CONDUCTOR_BASIC), - ADVANCED(5, 1, 400, new ColourRGBA(0.2, 0.2, 0.2, 1), TransmitterType.THERMODYNAMIC_CONDUCTOR_ADVANCED), - ELITE(5, 1, 8000, new ColourRGBA(0.2, 0.2, 0.2, 1), TransmitterType.THERMODYNAMIC_CONDUCTOR_ELITE), - ULTIMATE(5, 1, 100000, new ColourRGBA(0.2, 0.2, 0.2, 1), TransmitterType.THERMODYNAMIC_CONDUCTOR_ULTIMATE); + BASIC(5, 1, 10, new ColourRGBA(0.2, 0.2, 0.2, 1)), + ADVANCED(5, 1, 400, new ColourRGBA(0.2, 0.2, 0.2, 1)), + ELITE(5, 1, 8000, new ColourRGBA(0.2, 0.2, 0.2, 1)), + ULTIMATE(5, 1, 100000, new ColourRGBA(0.2, 0.2, 0.2, 1)); public double inverseConduction; private double baseConduction; @@ -513,18 +497,14 @@ public final class Tier private double baseConductionInsulation; public ColourRGBA baseColour; - - public TransmitterType type; - private ConductorTier(double inversek, double inverseC, double insulationInversek, ColourRGBA colour, TransmitterType transmitterType) + private ConductorTier(double inversek, double inverseC, double insulationInversek, ColourRGBA colour) { baseConduction = inverseConduction = inversek; baseHeatCapacity = inverseHeatCapacity = inverseC; baseConductionInsulation = inverseConductionInsulation = insulationInversek; baseColour = colour; - - type = transmitterType; } @Override @@ -577,7 +557,7 @@ public final class Tier ADVANCED(28000, 800), ELITE(56000, 1600), ULTIMATE(112000, 3200), - CREATIVE(Integer.MAX_VALUE, Integer.MAX_VALUE); + CREATIVE(Integer.MAX_VALUE, Integer.MAX_VALUE/2); public int storage; private int baseStorage; @@ -625,7 +605,7 @@ public final class Tier ADVANCED(128000, 512), ELITE(256000, 1028), ULTIMATE(512000, 2056), - CREATIVE(Integer.MAX_VALUE, Integer.MAX_VALUE); + CREATIVE(Integer.MAX_VALUE, Integer.MAX_VALUE/2); public int storage; private int baseStorage; diff --git a/src/main/java/mekanism/common/Upgrade.java b/src/main/java/mekanism/common/Upgrade.java index 16ab48df7..c7f57a361 100644 --- a/src/main/java/mekanism/common/Upgrade.java +++ b/src/main/java/mekanism/common/Upgrade.java @@ -6,8 +6,8 @@ import java.util.List; import java.util.Map; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.general; import mekanism.common.base.IUpgradeTile; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.util.LangUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -78,7 +78,7 @@ public enum Upgrade return new ItemStack(MekanismItems.AnchorUpgrade); } - return null; + return ItemStack.EMPTY; } public List getInfo(TileEntity tile) diff --git a/src/main/java/mekanism/common/base/EnergyAcceptorWrapper.java b/src/main/java/mekanism/common/base/EnergyAcceptorWrapper.java index 3842678f3..465dc32ec 100644 --- a/src/main/java/mekanism/common/base/EnergyAcceptorWrapper.java +++ b/src/main/java/mekanism/common/base/EnergyAcceptorWrapper.java @@ -4,14 +4,16 @@ import ic2.api.energy.EnergyNet; import ic2.api.energy.tile.IEnergySink; import ic2.api.energy.tile.IEnergyTile; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; import mekanism.api.energy.IStrictEnergyAcceptor; -import mekanism.api.util.CapabilityUtils; import mekanism.common.capabilities.Capabilities; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.MekanismUtils; import net.darkhax.tesla.api.ITeslaConsumer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraftforge.energy.CapabilityEnergy; +import net.minecraftforge.energy.IEnergyStorage; import cofh.api.energy.IEnergyReceiver; public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor @@ -27,7 +29,7 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor EnergyAcceptorWrapper wrapper = null; - if(CapabilityUtils.hasCapability(tileEntity, Capabilities.ENERGY_ACCEPTOR_CAPABILITY, null)) + if(CapabilityUtils.hasCapability(tileEntity, Capabilities.ENERGY_ACCEPTOR_CAPABILITY, side)) { wrapper = new MekanismAcceptor(CapabilityUtils.getCapability(tileEntity, Capabilities.ENERGY_ACCEPTOR_CAPABILITY, side)); } @@ -35,6 +37,10 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor { wrapper = new TeslaAcceptor(CapabilityUtils.getCapability(tileEntity, Capabilities.TESLA_CONSUMER_CAPABILITY, side)); } + else if(MekanismUtils.useForge() && CapabilityUtils.hasCapability(tileEntity, CapabilityEnergy.ENERGY, side)) + { + wrapper = new ForgeAcceptor(CapabilityUtils.getCapability(tileEntity, CapabilityEnergy.ENERGY, side)); + } else if(MekanismUtils.useRF() && tileEntity instanceof IEnergyReceiver) { wrapper = new RFAcceptor((IEnergyReceiver)tileEntity); @@ -69,9 +75,9 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor } @Override - public double transferEnergyToAcceptor(EnumFacing side, double amount) + public double acceptEnergy(EnumFacing side, double amount, boolean simulate) { - return acceptor.transferEnergyToAcceptor(side, amount); + return acceptor.acceptEnergy(side, amount, simulate); } @Override @@ -80,28 +86,10 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor return acceptor.canReceiveEnergy(side); } - @Override - public double getEnergy() - { - return acceptor.getEnergy(); - } - - @Override - public void setEnergy(double energy) - { - acceptor.setEnergy(energy); - } - - @Override - public double getMaxEnergy() - { - return acceptor.getMaxEnergy(); - } - @Override public boolean needsEnergy(EnumFacing side) { - return acceptor.getMaxEnergy() - acceptor.getEnergy() > 0; + return acceptor.acceptEnergy(side, 1, true) > 0; } } @@ -115,9 +103,9 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor } @Override - public double transferEnergyToAcceptor(EnumFacing side, double amount) + public double acceptEnergy(EnumFacing side, double amount, boolean simulate) { - return fromRF(acceptor.receiveEnergy(side, Math.min(Integer.MAX_VALUE, toRF(amount)), false)); + return fromRF(acceptor.receiveEnergy(side, Math.min(Integer.MAX_VALUE, toRF(amount)), simulate)); } @Override @@ -126,26 +114,6 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor return acceptor.canConnectEnergy(side); } - @Override - public double getEnergy() - { - return fromRF(acceptor.getEnergyStored(null)); - } - - @Override - public void setEnergy(double energy) - { - int rfToSet = toRF(energy); - int amountToReceive = rfToSet - acceptor.getEnergyStored(null); - acceptor.receiveEnergy(null, amountToReceive, false); - } - - @Override - public double getMaxEnergy() - { - return fromRF(acceptor.getMaxEnergyStored(null)); - } - @Override public boolean needsEnergy(EnumFacing side) { @@ -173,7 +141,7 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor } @Override - public double transferEnergyToAcceptor(EnumFacing side, double amount) + public double acceptEnergy(EnumFacing side, double amount, boolean simulate) { double toTransfer = Math.min(Math.min(acceptor.getDemandedEnergy(), toEU(amount)), Integer.MAX_VALUE); double rejects = acceptor.injectEnergy(side, toTransfer, 0); @@ -187,21 +155,6 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor return acceptor.acceptsEnergyFrom(null, side); } - @Override - public double getEnergy() - { - return 0; - } - - @Override - public void setEnergy(double energy) {} - - @Override - public double getMaxEnergy() - { - return 0; - } - @Override public boolean needsEnergy(EnumFacing side) { @@ -229,7 +182,7 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor } @Override - public double transferEnergyToAcceptor(EnumFacing side, double amount) + public double acceptEnergy(EnumFacing side, double amount, boolean simulate) { return fromTesla(acceptor.givePower(toTesla(amount), false)); } @@ -240,21 +193,6 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor return acceptor.givePower(1, true) > 0; } - @Override - public double getEnergy() - { - return 0; - } - - @Override - public void setEnergy(double energy) {} - - @Override - public double getMaxEnergy() - { - return 0; - } - @Override public boolean needsEnergy(EnumFacing side) { @@ -271,4 +209,42 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor return tesla*general.FROM_TESLA; } } + + public static class ForgeAcceptor extends EnergyAcceptorWrapper + { + private IEnergyStorage acceptor; + + public ForgeAcceptor(IEnergyStorage forgeConsumer) + { + acceptor = forgeConsumer; + } + + @Override + public double acceptEnergy(EnumFacing side, double amount, boolean simulate) + { + return fromForge(acceptor.receiveEnergy(Math.min(Integer.MAX_VALUE, toForge(amount)), simulate)); + } + + @Override + public boolean canReceiveEnergy(EnumFacing side) + { + return acceptor.canReceive(); + } + + @Override + public boolean needsEnergy(EnumFacing side) + { + return acceptor.canReceive(); + } + + public int toForge(double joules) + { + return (int)Math.round(joules*general.TO_FORGE); + } + + public double fromForge(double forge) + { + return forge*general.FROM_FORGE; + } + } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/base/FluidItemWrapper.java b/src/main/java/mekanism/common/base/FluidItemWrapper.java index 3aa348d35..fee6ecedb 100644 --- a/src/main/java/mekanism/common/base/FluidItemWrapper.java +++ b/src/main/java/mekanism/common/base/FluidItemWrapper.java @@ -1,14 +1,14 @@ package mekanism.common.base; import mekanism.common.capabilities.ItemCapabilityWrapper.ItemCapability; +import net.minecraft.item.ItemStack; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidContainerItem; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.FluidTankProperties; -import net.minecraftforge.fluids.capability.IFluidHandler; +import net.minecraftforge.fluids.capability.IFluidHandlerItem; -public class FluidItemWrapper extends ItemCapability implements IFluidHandler +public class FluidItemWrapper extends ItemCapability implements IFluidHandlerItem { @Override public FluidTankProperties[] getTankProperties() @@ -19,7 +19,7 @@ public class FluidItemWrapper extends ItemCapability implements IFluidHandler @Override public int fill(FluidStack resource, boolean doFill) { - if(getStack().stackSize != 1) + if(getStack().getCount() != 1) { return 0; } @@ -30,7 +30,7 @@ public class FluidItemWrapper extends ItemCapability implements IFluidHandler @Override public FluidStack drain(FluidStack resource, boolean doDrain) { - if(getStack().stackSize != 1 || resource == null) + if(getStack().getCount() != 1 || resource == null) { return null; } @@ -51,7 +51,7 @@ public class FluidItemWrapper extends ItemCapability implements IFluidHandler @Override public FluidStack drain(int maxDrain, boolean doDrain) { - if(getStack().stackSize != 1) + if(getStack().getCount() != 1) { return null; } @@ -59,14 +59,20 @@ public class FluidItemWrapper extends ItemCapability implements IFluidHandler return getItem().drain(getStack(), maxDrain, doDrain); } - public IFluidContainerItem getItem() + @Override + public ItemStack getContainer() { - return (IFluidContainerItem)getStack().getItem(); + return getStack(); + } + + public IFluidItemWrapper getItem() + { + return (IFluidItemWrapper)getStack().getItem(); } @Override public boolean canProcess(Capability cap) { - return cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY; + return cap == CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY; } } diff --git a/src/main/java/mekanism/common/base/IAdvancedBoundingBlock.java b/src/main/java/mekanism/common/base/IAdvancedBoundingBlock.java index 67ea46dc1..74fd2764c 100644 --- a/src/main/java/mekanism/common/base/IAdvancedBoundingBlock.java +++ b/src/main/java/mekanism/common/base/IAdvancedBoundingBlock.java @@ -1,15 +1,16 @@ package mekanism.common.base; import ic2.api.energy.tile.IEnergySink; -import mekanism.api.Coord4D; import mekanism.api.IConfigCardAccess.ISpecialConfigData; import mekanism.api.energy.IStrictEnergyAcceptor; import mekanism.api.energy.IStrictEnergyStorage; -import mekanism.common.integration.IComputerIntegration; +import mekanism.common.integration.computer.IComputerIntegration; import mekanism.common.security.ISecurityTile; +import net.minecraft.block.Block; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.fml.common.Optional.Interface; import net.minecraftforge.fml.common.Optional.InterfaceList; @@ -21,13 +22,13 @@ import cofh.api.energy.IEnergyReceiver; }) public interface IAdvancedBoundingBlock extends ICapabilityProvider, IBoundingBlock, ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IStrictEnergyStorage, IEnergyReceiver, IEnergyProvider, IComputerIntegration, ISpecialConfigData, ISecurityTile { - public int[] getBoundSlots(Coord4D location, EnumFacing side); + public int[] getBoundSlots(BlockPos location, EnumFacing side); - public boolean canBoundInsert(Coord4D location, int i, ItemStack itemstack); + public boolean canBoundInsert(BlockPos location, int i, ItemStack itemstack); - public boolean canBoundExtract(Coord4D location, int i, ItemStack itemstack, EnumFacing side); + public boolean canBoundExtract(BlockPos location, int i, ItemStack itemstack, EnumFacing side); - public boolean canBoundReceiveEnergy(Coord4D location, EnumFacing side); + public boolean canBoundReceiveEnergy(BlockPos location, EnumFacing side); public void onPower(); diff --git a/src/main/java/mekanism/common/base/IBlockType.java b/src/main/java/mekanism/common/base/IBlockType.java new file mode 100644 index 000000000..8a5e7d850 --- /dev/null +++ b/src/main/java/mekanism/common/base/IBlockType.java @@ -0,0 +1,18 @@ +package mekanism.common.base; + +import java.util.Collection; + +import mekanism.common.recipe.ShapedMekanismRecipe; + +public interface IBlockType +{ + public String getBlockName(); + + public Collection getRecipes(); + + public void addRecipes(Collection recipes); + + public void addRecipe(ShapedMekanismRecipe recipe); + + public boolean isEnabled(); +} diff --git a/src/main/java/mekanism/common/base/IEnergyWrapper.java b/src/main/java/mekanism/common/base/IEnergyWrapper.java index 76a076018..d4e25adab 100644 --- a/src/main/java/mekanism/common/base/IEnergyWrapper.java +++ b/src/main/java/mekanism/common/base/IEnergyWrapper.java @@ -6,8 +6,8 @@ import ic2.api.tile.IEnergyStorage; import java.util.EnumSet; -import mekanism.api.energy.ICableOutputter; import mekanism.api.energy.IStrictEnergyAcceptor; +import mekanism.api.energy.IStrictEnergyOutputter; import mekanism.api.energy.IStrictEnergyStorage; import net.minecraft.inventory.IInventory; import net.minecraft.util.EnumFacing; @@ -22,13 +22,11 @@ import cofh.api.energy.IEnergyReceiver; @Interface(iface = "ic2.api.energy.tile.IEnergyEmitter", modid = "IC2"), @Interface(iface = "ic2.api.tile.IEnergyStorage", modid = "IC2") }) -public interface IEnergyWrapper extends IStrictEnergyStorage, IEnergyReceiver, IEnergyProvider, IEnergySink, IEnergySource, IEnergyStorage, IStrictEnergyAcceptor, ICableOutputter, IInventory +public interface IEnergyWrapper extends IStrictEnergyStorage, IEnergyReceiver, IEnergyProvider, IEnergySink, IEnergySource, IEnergyStorage, IStrictEnergyAcceptor, IStrictEnergyOutputter, IInventory { public EnumSet getOutputtingSides(); public EnumSet getConsumingSides(); public double getMaxOutput(); - - public double removeEnergyFromProvider(EnumFacing side, double amount); } diff --git a/src/main/java/mekanism/common/base/IFactory.java b/src/main/java/mekanism/common/base/IFactory.java index ceda02913..21647221b 100644 --- a/src/main/java/mekanism/common/base/IFactory.java +++ b/src/main/java/mekanism/common/base/IFactory.java @@ -4,7 +4,6 @@ import java.util.Map; import mekanism.api.gas.Gas; import mekanism.api.gas.GasStack; -import mekanism.api.util.StackUtils; import mekanism.common.InfuseStorage; import mekanism.common.block.states.BlockStateMachine.MachineType; import mekanism.common.recipe.RecipeHandler; @@ -16,8 +15,9 @@ import mekanism.common.recipe.machines.AdvancedMachineRecipe; import mekanism.common.recipe.machines.BasicMachineRecipe; import mekanism.common.recipe.machines.MachineRecipe; import mekanism.common.recipe.machines.MetallurgicInfuserRecipe; -import mekanism.common.tile.TileEntityAdvancedElectricMachine; +import mekanism.common.tile.prefab.TileEntityAdvancedElectricMachine; import mekanism.common.util.LangUtils; +import mekanism.common.util.StackUtils; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; @@ -175,7 +175,7 @@ public interface IFactory public boolean hasRecipe(ItemStack itemStack) { - if(itemStack == null) + if(itemStack.isEmpty()) { return false; } @@ -207,6 +207,11 @@ public interface IFactory return cacheTile; } + + public double getEnergyUsage() + { + return type.getUsage(); + } public int getMaxSecondaryEnergy() { diff --git a/src/main/java/mekanism/common/base/IFluidItemWrapper.java b/src/main/java/mekanism/common/base/IFluidItemWrapper.java new file mode 100644 index 000000000..c21861ac9 --- /dev/null +++ b/src/main/java/mekanism/common/base/IFluidItemWrapper.java @@ -0,0 +1,15 @@ +package mekanism.common.base; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +public interface IFluidItemWrapper +{ + public FluidStack getFluid(ItemStack container); + + public int getCapacity(ItemStack container); + + public int fill(ItemStack container, FluidStack resource, boolean doFill); + + public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain); +} diff --git a/src/main/java/mekanism/common/base/ILogisticalTransporter.java b/src/main/java/mekanism/common/base/ILogisticalTransporter.java index 597d20e56..17d46136e 100644 --- a/src/main/java/mekanism/common/base/ILogisticalTransporter.java +++ b/src/main/java/mekanism/common/base/ILogisticalTransporter.java @@ -4,19 +4,19 @@ import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.transmitters.IBlockableConnection; import mekanism.api.transmitters.IGridTransmitter; -import mekanism.common.InventoryNetwork; +import mekanism.common.content.transporter.TransitRequest; +import mekanism.common.content.transporter.TransitRequest.TransitResponse; import mekanism.common.content.transporter.TransporterStack; import mekanism.common.tile.TileEntityLogisticalSorter; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; +import mekanism.common.transmitters.grid.InventoryNetwork; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -public interface ILogisticalTransporter extends IGridTransmitter, IBlockableConnection +public interface ILogisticalTransporter extends IGridTransmitter, IBlockableConnection { - public ItemStack insert(Coord4D original, ItemStack itemStack, EnumColor color, boolean doEmit, int min); + public TransitResponse insert(Coord4D original, TransitRequest request, EnumColor color, boolean doEmit, int min); - public ItemStack insertRR(TileEntityLogisticalSorter outputter, ItemStack itemStack, EnumColor color, boolean doEmit, int min); + public TransitResponse insertRR(TileEntityLogisticalSorter outputter, TransitRequest request, EnumColor color, boolean doEmit, int min); public void entityEntering(TransporterStack stack, int progress); diff --git a/src/main/java/mekanism/common/base/ITankManager.java b/src/main/java/mekanism/common/base/ITankManager.java index 9cf0d095a..203ff4e64 100644 --- a/src/main/java/mekanism/common/base/ITankManager.java +++ b/src/main/java/mekanism/common/base/ITankManager.java @@ -20,14 +20,14 @@ public interface ITankManager { ItemStack stack = player.inventory.getItemStack(); - if(stack == null || !(stack.getItem() instanceof ItemGaugeDropper)) + if(stack.isEmpty() || !(stack.getItem() instanceof ItemGaugeDropper)) { return; } ItemGaugeDropper dropper = (ItemGaugeDropper)stack.getItem(); - if(stack != null) + if(!stack.isEmpty()) { if(tank instanceof GasTank) { diff --git a/src/main/java/mekanism/common/base/ItemHandlerWrapper.java b/src/main/java/mekanism/common/base/ItemHandlerWrapper.java new file mode 100644 index 000000000..a74948884 --- /dev/null +++ b/src/main/java/mekanism/common/base/ItemHandlerWrapper.java @@ -0,0 +1,13 @@ +package mekanism.common.base; + +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.items.wrapper.SidedInvWrapper; + +public class ItemHandlerWrapper extends SidedInvWrapper +{ + public ItemHandlerWrapper(ISidedInventory inv, EnumFacing side) + { + super(inv, side); + } +} diff --git a/src/main/java/mekanism/common/block/BlockBasic.java b/src/main/java/mekanism/common/block/BlockBasic.java index c9c0de1d4..112995856 100644 --- a/src/main/java/mekanism/common/block/BlockBasic.java +++ b/src/main/java/mekanism/common/block/BlockBasic.java @@ -1,12 +1,11 @@ package mekanism.common.block; -import java.util.List; import java.util.Random; +import java.util.UUID; import mekanism.api.Coord4D; import mekanism.api.energy.IEnergizedItem; import mekanism.api.energy.IStrictEnergyStorage; -import mekanism.api.util.StackUtils; import mekanism.client.render.ctm.CTMBlockRenderContext; import mekanism.client.render.ctm.CTMData; import mekanism.client.render.ctm.ICTMBlock; @@ -26,7 +25,6 @@ import mekanism.common.inventory.InventoryBin; import mekanism.common.item.ItemBlockBasic; import mekanism.common.multiblock.IMultiblock; import mekanism.common.multiblock.IStructuralMultiblock; -import mekanism.common.tile.TileEntityBasicBlock; import mekanism.common.tile.TileEntityBin; import mekanism.common.tile.TileEntityDynamicTank; import mekanism.common.tile.TileEntityInductionCell; @@ -36,9 +34,11 @@ import mekanism.common.tile.TileEntityMultiblock; import mekanism.common.tile.TileEntitySecurityDesk; import mekanism.common.tile.TileEntitySuperheatingElement; import mekanism.common.tile.TileEntityThermalEvaporationController; +import mekanism.common.tile.prefab.TileEntityBasicBlock; import mekanism.common.util.FluidContainerUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.SecurityUtils; +import mekanism.common.util.StackUtils; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; @@ -58,9 +58,11 @@ import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; @@ -68,7 +70,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; -import net.minecraftforge.fluids.capability.IFluidHandler; +import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -220,7 +222,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock } @Override - public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock) + public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock, BlockPos fromPos) { if(!world.isRemote) { @@ -299,7 +301,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs creativetabs, List list) + public void getSubBlocks(Item item, CreativeTabs creativetabs, NonNullList list) { for(BasicBlockType type : BasicBlockType.values()) { @@ -412,10 +414,10 @@ public abstract class BlockBasic extends Block implements ICTMBlock { if(!player.isSneaking()) { - world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, bin.removeStack().copy())); + world.spawnEntity(new EntityItem(world, player.posX, player.posY, player.posZ, bin.removeStack().copy())); } else { - world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, bin.remove(1).copy())); + world.spawnEntity(new EntityItem(world, player.posX, player.posY, player.posZ, bin.remove(1).copy())); } } } @@ -423,10 +425,11 @@ public abstract class BlockBasic extends Block implements ICTMBlock } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { BasicBlockType type = BasicBlockType.get(state); TileEntity tile = world.getTileEntity(pos); + ItemStack stack = entityplayer.getHeldItem(hand); if(type == BasicBlockType.REFINED_OBSIDIAN) { @@ -451,13 +454,13 @@ public abstract class BlockBasic extends Block implements ICTMBlock } else if(tile instanceof TileEntitySecurityDesk) { - String owner = ((TileEntitySecurityDesk)tile).owner; + UUID ownerUUID = ((TileEntitySecurityDesk)tile).ownerUUID; if(!entityplayer.isSneaking()) { if(!world.isRemote) { - if(owner == null || entityplayer.getName().equals(owner)) + if(ownerUUID == null || entityplayer.getUniqueID().equals(ownerUUID)) { entityplayer.openGui(Mekanism.instance, 57, world, pos.getX(), pos.getY(), pos.getZ()); } @@ -473,7 +476,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock { TileEntityBin bin = (TileEntityBin)tile; - if(stack != null && MekanismUtils.hasUsableWrench(entityplayer, pos)) + if(!stack.isEmpty() && MekanismUtils.hasUsableWrench(entityplayer, pos)) { if(!world.isRemote) { @@ -487,13 +490,13 @@ public abstract class BlockBasic extends Block implements ICTMBlock if(MekanismUtils.isBCWrench(tool)) { - ((IToolWrench)tool).wrenchUsed(entityplayer, pos); + ((IToolWrench)tool).wrenchUsed(entityplayer, hand, stack, new RayTraceResult(new Vec3d(hitX, hitY, hitZ), side, pos)); } int change = bin.facing.rotateY().ordinal(); bin.setFacing((short)change); - world.notifyNeighborsOfStateChange(pos, this); + world.notifyNeighborsOfStateChange(pos, this, true); } return true; @@ -503,9 +506,9 @@ public abstract class BlockBasic extends Block implements ICTMBlock { if(bin.getItemCount() < bin.tier.storage) { - if(bin.addTicks == 0 && stack != null) + if(bin.addTicks == 0) { - if(stack != null) + if(!stack.isEmpty()) { ItemStack remain = bin.add(stack); entityplayer.setHeldItem(hand, remain); @@ -514,19 +517,19 @@ public abstract class BlockBasic extends Block implements ICTMBlock } else if(bin.addTicks > 0 && bin.getItemCount() > 0) { - ItemStack[] inv = entityplayer.inventory.mainInventory; + NonNullList inv = entityplayer.inventory.mainInventory; - for(int i = 0; i < inv.length; i++) + for(int i = 0; i < inv.size(); i++) { if(bin.getItemCount() == bin.tier.storage) { break; } - if(inv[i] != null) + if(!inv.get(i).isEmpty()) { - ItemStack remain = bin.add(inv[i]); - inv[i] = remain; + ItemStack remain = bin.add(inv.get(i)); + inv.set(i, remain); bin.addTicks = 5; } @@ -584,13 +587,14 @@ public abstract class BlockBasic extends Block implements ICTMBlock if(FluidContainerUtils.isFluidContainer(itemStack)) { - IFluidHandler handler = FluidUtil.getFluidHandler(copyStack); + IFluidHandlerItem handler = FluidUtil.getFluidHandler(copyStack); if(FluidUtil.getFluidContained(copyStack) == null) { if(tileEntity.structure.fluidStored != null) { int filled = handler.fill(tileEntity.structure.fluidStored, !player.capabilities.isCreativeMode); + copyStack = handler.getContainer(); if(filled > 0) { @@ -598,15 +602,15 @@ public abstract class BlockBasic extends Block implements ICTMBlock { tileEntity.structure.fluidStored.amount -= filled; } - else if(itemStack.stackSize == 1) + else if(itemStack.getCount() == 1) { tileEntity.structure.fluidStored.amount -= filled; player.setHeldItem(hand, copyStack); } - else if(itemStack.stackSize > 1 && player.inventory.addItemStackToInventory(copyStack)) + else if(itemStack.getCount() > 1 && player.inventory.addItemStackToInventory(copyStack)) { tileEntity.structure.fluidStored.amount -= filled; - itemStack.stackSize--; + itemStack.shrink(1); } if(tileEntity.structure.fluidStored.amount == 0) @@ -630,10 +634,11 @@ public abstract class BlockBasic extends Block implements ICTMBlock boolean filled = false; FluidStack drained = handler.drain(needed, !player.capabilities.isCreativeMode); + copyStack = handler.getContainer(); - if(copyStack.stackSize == 0) + if(copyStack.getCount() == 0) { - copyStack = null; + copyStack = ItemStack.EMPTY; } if(drained != null) @@ -643,9 +648,9 @@ public abstract class BlockBasic extends Block implements ICTMBlock filled = true; } else { - if(copyStack != null) + if(!copyStack.isEmpty()) { - if(itemStack.stackSize == 1) + if(itemStack.getCount() == 1) { player.setHeldItem(hand, copyStack); filled = true; @@ -653,18 +658,18 @@ public abstract class BlockBasic extends Block implements ICTMBlock else { if(player.inventory.addItemStackToInventory(copyStack)) { - itemStack.stackSize--; + itemStack.shrink(1); filled = true; } } } else { - itemStack.stackSize--; + itemStack.shrink(1); - if(itemStack.stackSize == 0) + if(itemStack.getCount() == 0) { - player.setHeldItem(hand, null); + player.setHeldItem(hand, ItemStack.EMPTY); } filled = true; @@ -777,7 +782,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock if(world.getTileEntity(pos) instanceof TileEntityBasicBlock) { TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos); - int side = MathHelper.floor_double((placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + int side = MathHelper.floor((placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; int height = Math.round(placer.rotationPitch); int change = 3; @@ -809,7 +814,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock if(tileEntity instanceof TileEntitySecurityDesk) { - ((TileEntitySecurityDesk)tileEntity).owner = placer.getName(); + ((TileEntitySecurityDesk)tileEntity).ownerUUID = placer.getUniqueID(); } if(tileEntity instanceof IBoundingBlock) @@ -910,7 +915,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(state, null, world, pos, player)); - world.spawnEntityInWorld(entityItem); + world.spawnEntity(entityItem); } return world.setBlockToAir(pos); @@ -931,7 +936,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, itemStack); - world.spawnEntityInWorld(entityItem); + world.spawnEntity(entityItem); } return itemStack; @@ -1035,8 +1040,8 @@ public abstract class BlockBasic extends Block implements ICTMBlock } @Override - public boolean isBeaconBase(IBlockAccess worldObj, BlockPos pos, BlockPos beacon) + public boolean isBeaconBase(IBlockAccess world, BlockPos pos, BlockPos beacon) { - return BasicBlockType.get(worldObj.getBlockState(pos)).isBeaconBase; + return BasicBlockType.get(world.getBlockState(pos)).isBeaconBase; } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/block/BlockBounding.java b/src/main/java/mekanism/common/block/BlockBounding.java index 6fc3b8700..a1d311b74 100644 --- a/src/main/java/mekanism/common/block/BlockBounding.java +++ b/src/main/java/mekanism/common/block/BlockBounding.java @@ -49,12 +49,12 @@ public class BlockBounding extends Block } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { try { TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(pos); IBlockState state1 = world.getBlockState(tileEntity.mainPos); - return state1.getBlock().onBlockActivated(world, tileEntity.mainPos, state1, player, hand, stack, side, hitX, hitY, hitZ); + return state1.getBlock().onBlockActivated(world, tileEntity.mainPos, state1, player, hand, side, hitX, hitY, hitZ); } catch(Exception e) { return false; } @@ -93,13 +93,13 @@ public class BlockBounding extends Block } @Override - public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock) + public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock, BlockPos neighborPos) { try { TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(pos); tileEntity.onNeighborChange(state.getBlock()); IBlockState state1 = world.getBlockState(tileEntity.mainPos); - state1.getBlock().neighborChanged(state1, world, tileEntity.mainPos, this); + state1.getBlock().neighborChanged(state1, world, tileEntity.mainPos, neighborBlock, neighborPos); } catch(Exception e) {} } diff --git a/src/main/java/mekanism/common/block/BlockCardboardBox.java b/src/main/java/mekanism/common/block/BlockCardboardBox.java index 34cb64f2b..cb062fc8a 100644 --- a/src/main/java/mekanism/common/block/BlockCardboardBox.java +++ b/src/main/java/mekanism/common/block/BlockCardboardBox.java @@ -65,7 +65,7 @@ public class BlockCardboardBox extends BlockContainer } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if(!world.isRemote && entityplayer.isSneaking()) { @@ -88,7 +88,7 @@ public class BlockCardboardBox extends BlockContainer if(data.block != null) { - IBlockState newstate = data.block.onBlockPlaced(world, pos, side, hitX, hitY, hitZ, data.meta, entityplayer); + IBlockState newstate = data.block.getStateForPlacement(world, pos, side, hitX, hitY, hitZ, data.meta, entityplayer, hand); data.meta = newstate.getBlock().getMetaFromState(newstate); } @@ -112,7 +112,7 @@ public class BlockCardboardBox extends BlockContainer EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, itemStack); - world.spawnEntityInWorld(entityItem); + world.spawnEntity(entityItem); } } @@ -146,7 +146,7 @@ public class BlockCardboardBox extends BlockContainer EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, itemStack); - world.spawnEntityInWorld(entityItem); + world.spawnEntity(entityItem); } return itemStack; @@ -182,7 +182,7 @@ public class BlockCardboardBox extends BlockContainer EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(state, null, world, pos, player)); - world.spawnEntityInWorld(entityItem); + world.spawnEntity(entityItem); } return world.setBlockToAir(pos); diff --git a/src/main/java/mekanism/common/block/BlockEnergyCube.java b/src/main/java/mekanism/common/block/BlockEnergyCube.java index 38e0952fe..b2afc4857 100644 --- a/src/main/java/mekanism/common/block/BlockEnergyCube.java +++ b/src/main/java/mekanism/common/block/BlockEnergyCube.java @@ -1,6 +1,5 @@ package mekanism.common.block; -import java.util.List; import java.util.Random; import mekanism.api.energy.IEnergizedItem; @@ -15,8 +14,8 @@ import mekanism.common.block.states.BlockStateFacing; import mekanism.common.item.ItemBlockEnergyCube; import mekanism.common.security.ISecurityItem; import mekanism.common.security.ISecurityTile; -import mekanism.common.tile.TileEntityBasicBlock; import mekanism.common.tile.TileEntityEnergyCube; +import mekanism.common.tile.prefab.TileEntityBasicBlock; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.SecurityUtils; @@ -36,9 +35,11 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -107,7 +108,7 @@ public class BlockEnergyCube extends BlockContainer } @Override - public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock) + public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock, BlockPos neighborPos) { if(!world.isRemote) { @@ -124,7 +125,7 @@ public class BlockEnergyCube extends BlockContainer public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos); - int side = MathHelper.floor_double((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + int side = MathHelper.floor((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; int height = Math.round(placer.rotationPitch); int change = 3; @@ -164,7 +165,7 @@ public class BlockEnergyCube extends BlockContainer @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs creativetabs, List list) + public void getSubBlocks(Item item, CreativeTabs creativetabs, NonNullList list) { for(EnergyCubeTier tier : EnergyCubeTier.values()) { @@ -187,7 +188,7 @@ public class BlockEnergyCube extends BlockContainer } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if(world.isRemote) { @@ -195,8 +196,9 @@ public class BlockEnergyCube extends BlockContainer } TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getTileEntity(pos); + ItemStack stack = entityplayer.getHeldItem(hand); - if(stack != null) + if(!stack.isEmpty()) { Item tool = stack.getItem(); @@ -213,13 +215,13 @@ public class BlockEnergyCube extends BlockContainer if(MekanismUtils.isBCWrench(tool)) { - ((IToolWrench)tool).wrenchUsed(entityplayer, pos); + ((IToolWrench)tool).wrenchUsed(entityplayer, hand, stack, new RayTraceResult(new Vec3d(hitX, hitY, hitZ), side, pos)); } int change = tileEntity.facing.rotateAround(side.getAxis()).ordinal(); tileEntity.setFacing((short)change); - world.notifyNeighborsOfStateChange(pos, this); + world.notifyNeighborsOfStateChange(pos, this, true); } else { SecurityUtils.displayNoAccess(entityplayer); @@ -259,7 +261,7 @@ public class BlockEnergyCube extends BlockContainer double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(state, null, world, pos, player)); - world.spawnEntityInWorld(entityItem); + world.spawnEntity(entityItem); } return world.setBlockToAir(pos); @@ -300,7 +302,7 @@ public class BlockEnergyCube extends BlockContainer if(securityItem.hasSecurity(itemStack)) { - securityItem.setOwner(itemStack, ((ISecurityTile)tileEntity).getSecurity().getOwner()); + securityItem.setOwnerUUID(itemStack, ((ISecurityTile)tileEntity).getSecurity().getOwnerUUID()); securityItem.setSecurity(itemStack, ((ISecurityTile)tileEntity).getSecurity().getMode()); } } @@ -340,7 +342,7 @@ public class BlockEnergyCube extends BlockContainer EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, itemStack); - world.spawnEntityInWorld(entityItem); + world.spawnEntity(entityItem); } return itemStack; diff --git a/src/main/java/mekanism/common/block/BlockGasTank.java b/src/main/java/mekanism/common/block/BlockGasTank.java index a452c7c80..64297680f 100644 --- a/src/main/java/mekanism/common/block/BlockGasTank.java +++ b/src/main/java/mekanism/common/block/BlockGasTank.java @@ -12,8 +12,8 @@ import mekanism.common.block.states.BlockStateFacing; import mekanism.common.block.states.BlockStateGasTank; import mekanism.common.security.ISecurityItem; import mekanism.common.security.ISecurityTile; -import mekanism.common.tile.TileEntityBasicBlock; import mekanism.common.tile.TileEntityGasTank; +import mekanism.common.tile.prefab.TileEntityBasicBlock; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.SecurityUtils; @@ -36,13 +36,14 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import buildcraft.api.tools.IToolWrench; public class BlockGasTank extends BlockContainer { - private static final AxisAlignedBB TANK_BOUNDS = new AxisAlignedBB(0.2F, 0.0F, 0.2F, 0.8F, 1.0F, 0.8F); + private static final AxisAlignedBB TANK_BOUNDS = new AxisAlignedBB(0.1875F, 0.0F, 0.1875F, 0.8125F, 1.0F, 0.8125F); public BlockGasTank() { @@ -98,7 +99,7 @@ public class BlockGasTank extends BlockContainer { TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos); - int side = MathHelper.floor_double((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + int side = MathHelper.floor((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; int change = 3; switch(side) @@ -114,7 +115,7 @@ public class BlockGasTank extends BlockContainer } @Override - public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock) + public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock, BlockPos neighborPos) { if(!world.isRemote) { @@ -136,7 +137,7 @@ public class BlockGasTank extends BlockContainer } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if(world.isRemote) { @@ -144,8 +145,9 @@ public class BlockGasTank extends BlockContainer } TileEntityGasTank tileEntity = (TileEntityGasTank)world.getTileEntity(pos); + ItemStack stack = entityplayer.getHeldItem(hand); - if(stack != null) + if(!stack.isEmpty()) { Item tool = stack.getItem(); @@ -162,13 +164,13 @@ public class BlockGasTank extends BlockContainer if(MekanismUtils.isBCWrench(tool)) { - ((IToolWrench)tool).wrenchUsed(entityplayer, pos); + ((IToolWrench)tool).wrenchUsed(entityplayer, hand, stack, new RayTraceResult(new Vec3d(hitX, hitY, hitZ), side, pos)); } int change = tileEntity.facing.rotateY().ordinal(); tileEntity.setFacing((short)change); - world.notifyNeighborsOfStateChange(pos, this); + world.notifyNeighborsOfStateChange(pos, this, true); } else { SecurityUtils.displayNoAccess(entityplayer); @@ -209,7 +211,7 @@ public class BlockGasTank extends BlockContainer EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(state, null, world, pos, player)); - world.spawnEntityInWorld(entityItem); + world.spawnEntity(entityItem); } return world.setBlockToAir(pos); @@ -230,7 +232,7 @@ public class BlockGasTank extends BlockContainer EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, itemStack); - world.spawnEntityInWorld(entityItem); + world.spawnEntity(entityItem); } return itemStack; @@ -289,7 +291,7 @@ public class BlockGasTank extends BlockContainer if(securityItem.hasSecurity(itemStack)) { - securityItem.setOwner(itemStack, ((ISecurityTile)tileEntity).getSecurity().getOwner()); + securityItem.setOwnerUUID(itemStack, ((ISecurityTile)tileEntity).getSecurity().getOwnerUUID()); securityItem.setSecurity(itemStack, ((ISecurityTile)tileEntity).getSecurity().getMode()); } } @@ -367,4 +369,22 @@ public class BlockGasTank extends BlockContainer return false; } + + @Override + public boolean isFullBlock(IBlockState state) + { + return false; + } + + @Override + public boolean isFullCube(IBlockState state) + { + return false; + } + + @Override + public boolean isBlockSolid(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + return false; + } } diff --git a/src/main/java/mekanism/common/block/BlockGlowPanel.java b/src/main/java/mekanism/common/block/BlockGlowPanel.java new file mode 100644 index 000000000..0480378b6 --- /dev/null +++ b/src/main/java/mekanism/common/block/BlockGlowPanel.java @@ -0,0 +1,240 @@ +package mekanism.common.block; + +import java.util.Random; + +import mekanism.api.Coord4D; +import mekanism.common.Mekanism; +import mekanism.common.MekanismBlocks; +import mekanism.common.block.property.PropertyColor; +import mekanism.common.block.states.BlockStateFacing; +import mekanism.common.block.states.BlockStateGlowPanel; +import mekanism.common.tile.TileEntityGlowPanel; +import mekanism.common.util.MultipartUtils; +import net.minecraft.block.Block; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.BlockStateContainer; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumBlockRenderType; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.property.IExtendedBlockState; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public class BlockGlowPanel extends Block implements ITileEntityProvider +{ + private static Random rand = new Random(); + public static AxisAlignedBB[] bounds = new AxisAlignedBB[6]; + + static + { + AxisAlignedBB cuboid = new AxisAlignedBB(0.25, 0, 0.25, 0.75, 0.125, 0.75); + Vec3d fromOrigin = new Vec3d(-0.5, -0.5, -0.5); + + for(EnumFacing side : EnumFacing.VALUES) + { + bounds[side.ordinal()] = MultipartUtils.rotate(cuboid.offset(fromOrigin.xCoord, fromOrigin.yCoord, fromOrigin.zCoord), side).offset(-fromOrigin.xCoord, -fromOrigin.zCoord, -fromOrigin.zCoord); + } + } + + public BlockGlowPanel() + { + super(Material.PISTON); + setCreativeTab(Mekanism.tabMekanism); + setHardness(1F); + setResistance(10F); + } + + @Override + public int getMetaFromState(IBlockState state) + { + return 0; + } + + @Override + public BlockStateContainer createBlockState() + { + return new BlockStateGlowPanel(this); + } + + @Override + public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) + { + TileEntityGlowPanel tileEntity = (TileEntityGlowPanel)world.getTileEntity(pos); + return tileEntity != null ? state.withProperty(BlockStateFacing.facingProperty, tileEntity.side) : state; + } + + @SideOnly(Side.CLIENT) + @Override + public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) + { + TileEntityGlowPanel tileEntity = (TileEntityGlowPanel)world.getTileEntity(pos); + + if(tileEntity != null) + { + state = state.withProperty(BlockStateFacing.facingProperty, tileEntity.side); + + if(state instanceof IExtendedBlockState) + { + return ((IExtendedBlockState)state).withProperty(PropertyColor.INSTANCE, new PropertyColor(tileEntity.colour)); + } + } + + return state; + } + + @Override + public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos neighbor) + { + TileEntityGlowPanel tileEntity = (TileEntityGlowPanel)world.getTileEntity(pos); + + if(!world.isRemote && !canStay(tileEntity)) + { + float motion = 0.7F; + double motionX = (rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + double motionY = (rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + double motionZ = (rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + + ItemStack stack = new ItemStack(MekanismBlocks.GlowPanel, 1, tileEntity.colour.getMetaValue()); + EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, stack); + + world.spawnEntity(entityItem); + world.setBlockToAir(pos); + } + } + + @Override + public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) + { + TileEntityGlowPanel tileEntity = (TileEntityGlowPanel)world.getTileEntity(pos); + + if(!tileEntity.getWorld().isRemote && !canStay(tileEntity)) + { + float motion = 0.7F; + double motionX = (rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + double motionY = (rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + double motionZ = (rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + + ItemStack stack = new ItemStack(MekanismBlocks.GlowPanel, 1, tileEntity.colour.getMetaValue()); + EntityItem entityItem = new EntityItem(tileEntity.getWorld(), pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, stack); + + tileEntity.getWorld().spawnEntity(entityItem); + tileEntity.getWorld().setBlockToAir(pos); + } + } + + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) + { + TileEntity tile = world.getTileEntity(pos); + + if(tile != null && tile instanceof TileEntityGlowPanel) + { + return bounds[((TileEntityGlowPanel)tile).side.ordinal()]; + } + + return super.getBoundingBox(state, world, pos); + } + + @Override + public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side) + { + return world.isSideSolid(pos.offset(side.getOpposite()), side); + } + + public static boolean canStay(TileEntityGlowPanel tileEntity) + { + Coord4D adj = new Coord4D(tileEntity.getPos().offset(tileEntity.side), tileEntity.getWorld()); + return tileEntity.getWorld().isSideSolid(adj.getPos(), tileEntity.side.getOpposite()); + } + + @Override + public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) + { + return 15; + } + + @Override + public int quantityDropped(Random random) + { + return 0; + } + + @Override + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) + { + TileEntityGlowPanel tileEntity = (TileEntityGlowPanel)world.getTileEntity(pos); + return new ItemStack(MekanismBlocks.GlowPanel, 1, tileEntity.colour.getMetaValue()); + } + + @Override + public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) + { + if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest) + { + float motion = 0.7F; + double motionX = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + + EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(state, null, world, pos, player)); + + world.spawnEntity(entityItem); + } + + return super.removedByPlayer(state, world, pos, player, willHarvest); + } + + @Override + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntityGlowPanel(); + } + + @Override + public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) + { + return true; + } + + @Override + public EnumBlockRenderType getRenderType(IBlockState state) + { + return EnumBlockRenderType.MODEL; + } + + @Override + public boolean isBlockNormalCube(IBlockState state) + { + return false; + } + + @Override + public boolean isOpaqueCube(IBlockState state) + { + return false; + } + + @Override + public boolean isFullCube(IBlockState state) + { + return false; + } + + @Override + public boolean isFullBlock(IBlockState state) + { + return false; + } +} diff --git a/src/main/java/mekanism/common/block/BlockMachine.java b/src/main/java/mekanism/common/block/BlockMachine.java index a3c447cff..6529f9ed9 100644 --- a/src/main/java/mekanism/common/block/BlockMachine.java +++ b/src/main/java/mekanism/common/block/BlockMachine.java @@ -1,19 +1,15 @@ package mekanism.common.block; -import java.util.List; import java.util.Random; +import java.util.UUID; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.client; -import mekanism.api.MekanismConfig.general; import mekanism.api.energy.IEnergizedItem; import mekanism.api.energy.IStrictEnergyStorage; -import mekanism.api.util.StackUtils; import mekanism.client.render.ctm.CTMBlockRenderContext; import mekanism.client.render.ctm.CTMData; import mekanism.client.render.ctm.ICTMBlock; import mekanism.common.Mekanism; -import mekanism.common.Tier.BaseTier; import mekanism.common.Tier.FluidTankTier; import mekanism.common.base.IActiveState; import mekanism.common.base.IBoundingBlock; @@ -32,25 +28,28 @@ import mekanism.common.block.states.BlockStateFacing; import mekanism.common.block.states.BlockStateMachine; import mekanism.common.block.states.BlockStateMachine.MachineBlock; import mekanism.common.block.states.BlockStateMachine.MachineType; +import mekanism.common.config.MekanismConfig.client; import mekanism.common.item.ItemBlockMachine; import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage; import mekanism.common.network.PacketLogisticalSorterGui.SorterGuiPacket; import mekanism.common.security.ISecurityItem; import mekanism.common.security.ISecurityTile; -import mekanism.common.tile.TileEntityBasicBlock; -import mekanism.common.tile.TileEntityChargepad; -import mekanism.common.tile.TileEntityContainerBlock; import mekanism.common.tile.TileEntityFactory; import mekanism.common.tile.TileEntityFluidTank; +import mekanism.common.tile.TileEntityLaser; import mekanism.common.tile.TileEntityLaserAmplifier; import mekanism.common.tile.TileEntityLogisticalSorter; import mekanism.common.tile.TileEntityMetallurgicInfuser; import mekanism.common.tile.TileEntityPersonalChest; +import mekanism.common.tile.prefab.TileEntityBasicBlock; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import mekanism.common.util.FluidContainerUtils; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.MultipartUtils; import mekanism.common.util.PipeUtils; import mekanism.common.util.SecurityUtils; +import mekanism.common.util.StackUtils; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -73,19 +72,19 @@ import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.property.IExtendedBlockState; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; -import net.minecraftforge.fluids.capability.IFluidHandler; +import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import buildcraft.api.tools.IToolWrench; @@ -141,6 +140,8 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock private static final AxisAlignedBB CHARGEPAD_BOUNDS = new AxisAlignedBB(0.0F, 0.0F, 0.0F, 1.0F, 0.06F, 1.0F); private static final AxisAlignedBB TANK_BOUNDS = new AxisAlignedBB(0.125F, 0.0F, 0.125F, 0.875F, 1.0F, 0.875F); + private static final AxisAlignedBB LASER_BOUNDS = new AxisAlignedBB(0.25F, 0.0F, 0.25F, 0.75F, 1.0F, 0.75F); + private static final AxisAlignedBB LOGISTICAL_SORTER_BOUNDS = new AxisAlignedBB(0.125F, 0.0F, 0.125F, 0.875F, 1.0F, 0.875F); public BlockMachine() { @@ -246,7 +247,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos); - int side = MathHelper.floor_double((placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + int side = MathHelper.floor((placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; int height = Math.round(placer.rotationPitch); int change = 3; @@ -260,7 +261,8 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock if(height >= 65) { change = 1; - } else if(height <= -65) + } + else if(height <= -65) { change = 0; } @@ -403,7 +405,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs creativetabs, List list) + public void getSubBlocks(Item item, CreativeTabs creativetabs, NonNullList list) { for(MachineType type : MachineType.getValidMachines()) { @@ -441,7 +443,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if(world.isRemote) { @@ -450,8 +452,9 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos); int metadata = state.getBlock().getMetaFromState(state); + ItemStack stack = entityplayer.getHeldItem(hand); - if(stack != null) + if(!stack.isEmpty()) { Item tool = stack.getItem(); @@ -468,7 +471,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock if(MekanismUtils.isBCWrench(tool)) { - ((IToolWrench)tool).wrenchUsed(entityplayer, pos); + ((IToolWrench)tool).wrenchUsed(entityplayer, hand, stack, new RayTraceResult(new Vec3d(hitX, hitY, hitZ), side, pos)); } int change = tileEntity.facing.rotateY().ordinal(); @@ -491,7 +494,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock } tileEntity.setFacing((short)change); - world.notifyNeighborsOfStateChange(pos, this); + world.notifyNeighborsOfStateChange(pos, this, true); } else { SecurityUtils.displayNoAccess(entityplayer); @@ -529,7 +532,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock { if(SecurityUtils.canAccess(entityplayer, tileEntity)) { - if(stack != null && FluidContainerUtils.isFluidContainer(stack)) + if(!stack.isEmpty() && FluidContainerUtils.isFluidContainer(stack)) { if(manageInventory(entityplayer, (TileEntityFluidTank)tileEntity, hand, stack)) { @@ -568,9 +571,9 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock case QUANTUM_ENTANGLOPORTER: if(!entityplayer.isSneaking()) { - String owner = ((ISecurityTile)tileEntity).getSecurity().getOwner(); + UUID owner = ((ISecurityTile)tileEntity).getSecurity().getOwnerUUID(); - if(MekanismUtils.isOp((EntityPlayerMP)entityplayer) || owner == null || entityplayer.getName().equals(owner)) + if(MekanismUtils.isOp((EntityPlayerMP)entityplayer) || owner == null || entityplayer.getUniqueID().equals(owner)) { entityplayer.openGui(Mekanism.instance, type.guiId, world, pos.getX(), pos.getY(), pos.getZ()); } @@ -682,7 +685,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(state, null, world, pos, player)); - world.spawnEntityInWorld(entityItem); + world.spawnEntity(entityItem); } return world.setBlockToAir(pos); @@ -726,23 +729,24 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock if(FluidContainerUtils.isFluidContainer(itemStack)) { - IFluidHandler handler = FluidUtil.getFluidHandler(copyStack); + IFluidHandlerItem handler = FluidUtil.getFluidHandler(copyStack); if(FluidUtil.getFluidContained(copyStack) == null) { if(tileEntity.fluidTank.getFluid() != null) { int filled = handler.fill(tileEntity.fluidTank.getFluid(), !player.capabilities.isCreativeMode); + copyStack = handler.getContainer(); if(filled > 0) { - if(itemStack.stackSize == 1) + if(itemStack.getCount() == 1) { player.setHeldItem(hand, copyStack); } - else if(itemStack.stackSize > 1 && player.inventory.addItemStackToInventory(copyStack)) + else if(itemStack.getCount() > 1 && player.inventory.addItemStackToInventory(copyStack)) { - itemStack.stackSize--; + itemStack.shrink(1); } if(tileEntity.tier != FluidTankTier.CREATIVE) @@ -765,10 +769,11 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock boolean filled = false; FluidStack drained = handler.drain(needed, !player.capabilities.isCreativeMode); + copyStack = handler.getContainer(); - if(copyStack.stackSize == 0) + if(copyStack.getCount() == 0) { - copyStack = null; + copyStack = ItemStack.EMPTY; } if(drained != null) @@ -778,9 +783,9 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock filled = true; } else { - if(copyStack != null) + if(!copyStack.isEmpty()) { - if(itemStack.stackSize == 1) + if(itemStack.getCount() == 1) { player.setHeldItem(hand, copyStack); filled = true; @@ -788,18 +793,18 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock else { if(player.inventory.addItemStackToInventory(copyStack)) { - itemStack.stackSize--; + itemStack.shrink(1); filled = true; } } } else { - itemStack.stackSize--; + itemStack.shrink(1); - if(itemStack.stackSize == 0) + if(itemStack.getCount() == 0) { - player.setHeldItem(hand, null); + player.setHeldItem(hand, ItemStack.EMPTY); } filled = true; @@ -832,7 +837,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock } @Override - public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock) + public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock, BlockPos neighborPos) { if(!world.isRemote) { @@ -887,7 +892,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock if(securityItem.hasSecurity(itemStack)) { - securityItem.setOwner(itemStack, ((ISecurityTile)tileEntity).getSecurity().getOwner()); + securityItem.setOwnerUUID(itemStack, ((ISecurityTile)tileEntity).getSecurity().getOwnerUUID()); securityItem.setSecurity(itemStack, ((ISecurityTile)tileEntity).getSecurity().getMode()); } } @@ -922,7 +927,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock energizedItem.setEnergy(itemStack, ((IStrictEnergyStorage)tileEntity).getEnergy()); } - if(tileEntity instanceof TileEntityContainerBlock && ((TileEntityContainerBlock)tileEntity).inventory.length > 0) + if(tileEntity instanceof TileEntityContainerBlock && ((TileEntityContainerBlock)tileEntity).inventory.size() > 0) { ISustainedInventory inventory = (ISustainedInventory)itemStack.getItem(); inventory.setInventory(((ISustainedInventory)tileEntity).getInventory(), itemStack); @@ -977,7 +982,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, itemStack); - world.spawnEntityInWorld(entityItem); + world.spawnEntity(entityItem); } return itemStack; @@ -987,7 +992,8 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) { MachineType type = MachineType.get(getMachineBlock(), state.getBlock().getMetaFromState(state)); - + TileEntity tile = world.getTileEntity(pos); + if(type == null) { return super.getBoundingBox(state, world, pos); @@ -999,6 +1005,16 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock return CHARGEPAD_BOUNDS; case FLUID_TANK: return TANK_BOUNDS; + case LASER: + if(tile instanceof TileEntityLaser) + { + return MultipartUtils.rotate(LASER_BOUNDS.offset(-0.5, -0.5, -0.5), ((TileEntityLaser)tile).facing).offset(0.5, 0.5, 0.5); + } + case LOGISTICAL_SORTER: + if(tile instanceof TileEntityLogisticalSorter) + { + return MultipartUtils.rotate(LOGISTICAL_SORTER_BOUNDS.offset(-0.5, -0.5, -0.5), ((TileEntityLogisticalSorter)tile).facing).offset(0.5, 0.5, 0.5); + } default: return super.getBoundingBox(state, world, pos); } @@ -1011,13 +1027,8 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock } @Override - public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos) + public AxisAlignedBB getCollisionBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) { - if(world.getTileEntity(pos) instanceof TileEntityChargepad) - { - return null; - } - return super.getCollisionBoundingBox(state, world, pos); } diff --git a/src/main/java/mekanism/common/block/BlockObsidianTNT.java b/src/main/java/mekanism/common/block/BlockObsidianTNT.java index e13a85405..07fa6d5e5 100644 --- a/src/main/java/mekanism/common/block/BlockObsidianTNT.java +++ b/src/main/java/mekanism/common/block/BlockObsidianTNT.java @@ -46,7 +46,7 @@ public class BlockObsidianTNT extends Block } @Override - public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock) + public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock, BlockPos neighborPos) { if(world.isBlockIndirectlyGettingPowered(pos) > 0) { @@ -62,7 +62,7 @@ public class BlockObsidianTNT extends Block { EntityObsidianTNT entity = new EntityObsidianTNT(world, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F); entity.fuse = world.rand.nextInt(entity.fuse / 4) + entity.fuse / 8; - world.spawnEntityInWorld(entity); + world.spawnEntity(entity); } } @@ -71,15 +71,17 @@ public class BlockObsidianTNT extends Block if(!world.isRemote) { EntityObsidianTNT entity = new EntityObsidianTNT(world, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F); - world.spawnEntityInWorld(entity); + world.spawnEntity(entity); entity.playSound(SoundEvents.ENTITY_TNT_PRIMED, 1.0F, 1.0F); } } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { - if(stack != null && stack.getItem() == Items.FLINT_AND_STEEL) + ItemStack stack = entityplayer.getHeldItem(hand); + + if(!stack.isEmpty() && stack.getItem() == Items.FLINT_AND_STEEL) { explode(world, pos); world.setBlockToAir(pos); @@ -87,7 +89,7 @@ public class BlockObsidianTNT extends Block return true; } else { - return super.onBlockActivated(world, pos, state, entityplayer, hand, stack, side, hitX, hitY, hitZ); + return super.onBlockActivated(world, pos, state, entityplayer, hand, side, hitX, hitY, hitZ); } } diff --git a/src/main/java/mekanism/common/block/BlockOre.java b/src/main/java/mekanism/common/block/BlockOre.java index e69b452ba..da3128698 100644 --- a/src/main/java/mekanism/common/block/BlockOre.java +++ b/src/main/java/mekanism/common/block/BlockOre.java @@ -1,7 +1,5 @@ package mekanism.common.block; -import java.util.List; - import mekanism.common.Mekanism; import mekanism.common.block.states.BlockStateOre; import mekanism.common.block.states.BlockStateOre.EnumOreType; @@ -12,6 +10,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -59,7 +58,7 @@ public class BlockOre extends Block @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs creativetabs, List list) + public void getSubBlocks(Item item, CreativeTabs creativetabs, NonNullList list) { for(EnumOreType ore : EnumOreType.values()) { diff --git a/src/main/java/mekanism/common/block/BlockPlastic.java b/src/main/java/mekanism/common/block/BlockPlastic.java index 844cfb592..4b10f95f4 100644 --- a/src/main/java/mekanism/common/block/BlockPlastic.java +++ b/src/main/java/mekanism/common/block/BlockPlastic.java @@ -1,7 +1,5 @@ package mekanism.common.block; -import java.util.List; - import mekanism.api.EnumColor; import mekanism.common.Mekanism; import mekanism.common.block.states.BlockStatePlastic; @@ -15,6 +13,8 @@ import net.minecraft.entity.Entity; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; @@ -57,20 +57,18 @@ public class BlockPlastic extends Block { return state.getValue(BlockStatePlastic.colorProperty).getDyeDamage(); } - + @Override - public Vec3d modifyAcceleration(World world, BlockPos pos, Entity e, Vec3d motion) - { + public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn) + { if(type == PlasticBlockType.ROAD) { double boost = 1.6; - - double a = Math.atan2(motion.xCoord, motion.zCoord); - return new Vec3d(motion.xCoord + Math.sin(a) * boost * slipperiness, motion.yCoord, motion.zCoord + Math.cos(a) * boost * slipperiness); + double a = Math.atan2(entityIn.motionX, entityIn.motionZ); + entityIn.motionX += Math.sin(a) * boost * slipperiness; + entityIn.motionZ += Math.cos(a) * boost * slipperiness; } - - return motion; - } + } @Override public int damageDropped(IBlockState state) @@ -80,7 +78,7 @@ public class BlockPlastic extends Block @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs creativetabs, List list) + public void getSubBlocks(Item item, CreativeTabs creativetabs, NonNullList list) { for(int i = 0; i < EnumColor.DYES.length; i++) { diff --git a/src/main/java/mekanism/common/block/BlockPlasticFence.java b/src/main/java/mekanism/common/block/BlockPlasticFence.java index a7d5e4ee3..2d8719ab0 100644 --- a/src/main/java/mekanism/common/block/BlockPlasticFence.java +++ b/src/main/java/mekanism/common/block/BlockPlasticFence.java @@ -1,9 +1,6 @@ package mekanism.common.block; import static mekanism.common.block.states.BlockStatePlastic.colorProperty; - -import java.util.List; - import mekanism.api.EnumColor; import mekanism.common.Mekanism; import net.minecraft.block.BlockFence; @@ -17,6 +14,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -49,7 +47,7 @@ public class BlockPlasticFence extends BlockFence @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs creativetabs, List list) + public void getSubBlocks(Item item, CreativeTabs creativetabs, NonNullList list) { for(int i = 0; i < EnumColor.DYES.length; i++) { diff --git a/src/main/java/mekanism/common/block/BlockTransmitter.java b/src/main/java/mekanism/common/block/BlockTransmitter.java new file mode 100644 index 000000000..7b094a3fd --- /dev/null +++ b/src/main/java/mekanism/common/block/BlockTransmitter.java @@ -0,0 +1,427 @@ +package mekanism.common.block; + +import java.util.Arrays; +import java.util.List; +import java.util.Random; + +import javax.annotation.Nullable; + +import mekanism.common.Mekanism; +import mekanism.common.MekanismBlocks; +import mekanism.common.Tier.BaseTier; +import mekanism.common.base.ITierItem; +import mekanism.common.block.property.PropertyConnection; +import mekanism.common.block.states.BlockStateTransmitter; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterType; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterType.Size; +import mekanism.common.tile.transmitter.TileEntityDiversionTransporter; +import mekanism.common.tile.transmitter.TileEntityLogisticalTransporter; +import mekanism.common.tile.transmitter.TileEntityMechanicalPipe; +import mekanism.common.tile.transmitter.TileEntityPressurizedTube; +import mekanism.common.tile.transmitter.TileEntityRestrictiveTransporter; +import mekanism.common.tile.transmitter.TileEntitySidedPipe; +import mekanism.common.tile.transmitter.TileEntitySidedPipe.ConnectionType; +import mekanism.common.tile.transmitter.TileEntityThermodynamicConductor; +import mekanism.common.tile.transmitter.TileEntityUniversalCable; +import mekanism.common.util.MekanismUtils; +import mekanism.common.util.MultipartUtils; +import mekanism.common.util.MultipartUtils.AdvancedRayTraceResult; +import net.minecraft.block.Block; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.BlockStateContainer; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumBlockRenderType; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.client.model.obj.OBJModel.OBJProperty; +import net.minecraftforge.client.model.obj.OBJModel.OBJState; +import net.minecraftforge.common.property.IExtendedBlockState; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public class BlockTransmitter extends Block implements ITileEntityProvider +{ + public static AxisAlignedBB[] smallSides = new AxisAlignedBB[7]; + public static AxisAlignedBB[] largeSides = new AxisAlignedBB[7]; + + public static AxisAlignedBB smallDefault = smallSides[6]; + public static AxisAlignedBB largeDefault = largeSides[6]; + + static + { + smallSides[0] = new AxisAlignedBB(0.3, 0.0, 0.3, 0.7, 0.3, 0.7); + smallSides[1] = new AxisAlignedBB(0.3, 0.7, 0.3, 0.7, 1.0, 0.7); + smallSides[2] = new AxisAlignedBB(0.3, 0.3, 0.0, 0.7, 0.7, 0.3); + smallSides[3] = new AxisAlignedBB(0.3, 0.3, 0.7, 0.7, 0.7, 1.0); + smallSides[4] = new AxisAlignedBB(0.0, 0.3, 0.3, 0.3, 0.7, 0.7); + smallSides[5] = new AxisAlignedBB(0.7, 0.3, 0.3, 1.0, 0.7, 0.7); + smallSides[6] = new AxisAlignedBB(0.3, 0.3, 0.3, 0.7, 0.7, 0.7); + + largeSides[0] = new AxisAlignedBB(0.25, 0.0, 0.25, 0.75, 0.25, 0.75); + largeSides[1] = new AxisAlignedBB(0.25, 0.75, 0.25, 0.75, 1.0, 0.75); + largeSides[2] = new AxisAlignedBB(0.25, 0.25, 0.0, 0.75, 0.75, 0.25); + largeSides[3] = new AxisAlignedBB(0.25, 0.25, 0.75, 0.75, 0.75, 1.0); + largeSides[4] = new AxisAlignedBB(0.0, 0.25, 0.25, 0.25, 0.75, 0.75); + largeSides[5] = new AxisAlignedBB(0.75, 0.25, 0.25, 1.0, 0.75, 0.75); + largeSides[6] = new AxisAlignedBB(0.25, 0.25, 0.25, 0.75, 0.75, 0.75); + } + + public BlockTransmitter() + { + super(Material.PISTON); + setCreativeTab(Mekanism.tabMekanism); + setHardness(1F); + setResistance(10F); + } + + @Override + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + TileEntity tile = worldIn.getTileEntity(pos); + + if(tile instanceof TileEntitySidedPipe) + { + state = state.withProperty(BlockStateTransmitter.tierProperty, ((TileEntitySidedPipe)tile).getBaseTier()); + } + + return state; + } + + @Override + public IBlockState getStateFromMeta(int meta) + { + TransmitterType type = TransmitterType.get(meta); + return getDefaultState().withProperty(BlockStateTransmitter.typeProperty, type); + } + + @Override + public int getMetaFromState(IBlockState state) + { + TransmitterType type = state.getValue(BlockStateTransmitter.typeProperty); + return type.ordinal(); + } + + @Override + public BlockStateContainer createBlockState() + { + return new BlockStateTransmitter(this); + } + + @SideOnly(Side.CLIENT) + @Override + public IBlockState getExtendedState(IBlockState state, IBlockAccess w, BlockPos pos) + { + TileEntitySidedPipe tile = (TileEntitySidedPipe)w.getTileEntity(pos); + + if(tile != null) + { + return tile.getExtendedState(state); + } + else { + ConnectionType[] typeArray = new ConnectionType[] {ConnectionType.NORMAL, ConnectionType.NORMAL, ConnectionType.NORMAL, + ConnectionType.NORMAL, ConnectionType.NORMAL, ConnectionType.NORMAL}; + PropertyConnection connectionProp = new PropertyConnection((byte)0, (byte)0, typeArray, true); + + return ((IExtendedBlockState)state).withProperty(OBJProperty.INSTANCE, new OBJState(Arrays.asList(), true)).withProperty(PropertyConnection.INSTANCE, connectionProp); + } + } + + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) + { + TileEntity tile = world.getTileEntity(pos); + + if(tile instanceof TileEntitySidedPipe && ((TileEntitySidedPipe)tile).getTransmitterType().getSize() == Size.SMALL) + { + return smallSides[6]; + } + + return largeSides[6]; + } + + @Override + public void addCollisionBoxToList(IBlockState state, World world, BlockPos pos, AxisAlignedBB entityBox, List collidingBoxes, @Nullable Entity entityIn, boolean b) + { + TileEntitySidedPipe tile = (TileEntitySidedPipe)world.getTileEntity(pos); + + if(tile != null) + { + List boxes = tile.getCollisionBoxes(entityBox.offset(-pos.getX(), -pos.getY(), -pos.getZ())); + + for(AxisAlignedBB box : boxes) + { + collidingBoxes.add(box.offset(pos)); + } + } + } + + @Override + public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World world, BlockPos pos) + { + return getDefaultForTile((TileEntitySidedPipe)world.getTileEntity(pos)).offset(pos); + } + + @Override + public RayTraceResult collisionRayTrace(IBlockState blockState, World world, BlockPos pos, Vec3d start, Vec3d end) + { + TileEntitySidedPipe tile = (TileEntitySidedPipe)world.getTileEntity(pos); + + if(tile == null) + { + return null; + } + + List boxes = tile.getCollisionBoxes(); + AdvancedRayTraceResult result = MultipartUtils.collisionRayTrace(pos, start, end, boxes); + + if(result != null && result.valid()) + { + setDefaultForTile(tile, result.bounds); + } + + return result != null ? result.hit : null; + } + + @Override + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) + { + ItemStack stack = player.getHeldItem(hand); + + if(stack.isEmpty()) + { + return false; + } + + if(MekanismUtils.hasUsableWrench(player, pos) && player.isSneaking()) + { + if(!world.isRemote) + { + dismantleBlock(state, world, pos, false); + } + + return true; + } + + return false; + } + + @Override + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) + { + TileEntitySidedPipe tileEntity = (TileEntitySidedPipe)world.getTileEntity(pos); + ItemStack itemStack = new ItemStack(MekanismBlocks.Transmitter, 1, tileEntity.getTransmitterType().ordinal()); + + if(!itemStack.hasTagCompound()) + { + itemStack.setTagCompound(new NBTTagCompound()); + } + + ITierItem tierItem = (ITierItem)itemStack.getItem(); + tierItem.setBaseTier(itemStack, tileEntity.getBaseTier()); + + return itemStack; + } + + public ItemStack dismantleBlock(IBlockState state, World world, BlockPos pos, boolean returnBlock) + { + ItemStack itemStack = getPickBlock(state, null, world, pos, null); + + world.setBlockToAir(pos); + + if(!returnBlock) + { + float motion = 0.7F; + double motionX = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + + EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, itemStack); + + world.spawnEntity(entityItem); + } + + return itemStack; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item item, CreativeTabs creativetabs, NonNullList list) + { + for(TransmitterType type : TransmitterType.values()) + { + if(type.hasTiers()) + { + for(BaseTier tier : BaseTier.values()) + { + if(tier.isObtainable()) + { + list.add(MekanismUtils.getTransmitter(type, tier, 1)); + } + } + } + else { + list.add(MekanismUtils.getTransmitter(type, BaseTier.BASIC, 1)); + } + } + } + + @Override + public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + TileEntitySidedPipe tile = (TileEntitySidedPipe)world.getTileEntity(pos); + tile.onAdded(); + } + + @Override + public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos neighbor) + { + TileEntitySidedPipe tile = (TileEntitySidedPipe)world.getTileEntity(pos); + EnumFacing side = EnumFacing.getFacingFromVector(neighbor.getX() - pos.getX(), neighbor.getY() - pos.getY(), neighbor.getZ() - pos.getZ()); + tile.onNeighborBlockChange(side); + } + + @Override + public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) + { + TileEntitySidedPipe tile = (TileEntitySidedPipe)world.getTileEntity(pos); + EnumFacing side = EnumFacing.getFacingFromVector(neighbor.getX() - pos.getX(), neighbor.getY() - pos.getY(), neighbor.getZ() - pos.getZ()); + tile.onNeighborTileChange(side); + } + + @Override + public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) + { + TransmitterType type = state.getValue(BlockStateTransmitter.typeProperty); + + if(layer == BlockRenderLayer.TRANSLUCENT && (type == TransmitterType.LOGISTICAL_TRANSPORTER || type == TransmitterType.DIVERSION_TRANSPORTER)) + { + return true; + } + + return layer == BlockRenderLayer.CUTOUT; + } + + @Override + public EnumBlockRenderType getRenderType(IBlockState state) + { + return EnumBlockRenderType.MODEL; + } + + @Override + public boolean isBlockNormalCube(IBlockState state) + { + return false; + } + + @Override + public boolean isOpaqueCube(IBlockState state) + { + return false; + } + + @Override + public boolean isFullCube(IBlockState state) + { + return false; + } + + @Override + public boolean isFullBlock(IBlockState state) + { + return false; + } + + @Override + public int quantityDropped(Random random) + { + return 0; + } + + @Override + public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) + { + if(!player.capabilities.isCreativeMode && !world.isRemote && willHarvest) + { + float motion = 0.7F; + double motionX = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; + + EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(state, null, world, pos, player)); + + world.spawnEntity(entityItem); + } + + return super.removedByPlayer(state, world, pos, player, willHarvest); + } + + private static AxisAlignedBB getDefaultForTile(TileEntitySidedPipe tile) + { + if(tile == null || tile.getTransmitterType().getSize() == Size.SMALL) + { + return smallDefault; + } + + return largeDefault; + } + + private static void setDefaultForTile(TileEntitySidedPipe tile, AxisAlignedBB box) + { + if(tile == null) + { + return; + } + + if(tile.getTransmitterType().getSize() == Size.SMALL) + { + smallDefault = box; + return; + } + + largeDefault = box; + } + + @Override + public TileEntity createNewTileEntity(World worldIn, int meta) + { + TransmitterType type = TransmitterType.get(meta); + + switch(type) + { + case UNIVERSAL_CABLE: + return new TileEntityUniversalCable(); + case MECHANICAL_PIPE: + return new TileEntityMechanicalPipe(); + case PRESSURIZED_TUBE: + return new TileEntityPressurizedTube(); + case LOGISTICAL_TRANSPORTER: + return new TileEntityLogisticalTransporter(); + case DIVERSION_TRANSPORTER: + return new TileEntityDiversionTransporter(); + case RESTRICTIVE_TRANSPORTER: + return new TileEntityRestrictiveTransporter(); + case THERMODYNAMIC_CONDUCTOR: + return new TileEntityThermodynamicConductor(); + } + + return null; + } +} diff --git a/src/main/java/mekanism/common/multipart/ColorProperty.java b/src/main/java/mekanism/common/block/property/PropertyColor.java similarity index 51% rename from src/main/java/mekanism/common/multipart/ColorProperty.java rename to src/main/java/mekanism/common/block/property/PropertyColor.java index 890f10cb3..ed20c2d4e 100644 --- a/src/main/java/mekanism/common/multipart/ColorProperty.java +++ b/src/main/java/mekanism/common/block/property/PropertyColor.java @@ -1,17 +1,17 @@ -package mekanism.common.multipart; +package mekanism.common.block.property; import mekanism.api.EnumColor; import net.minecraftforge.common.property.IUnlistedProperty; -public class ColorProperty implements IUnlistedProperty +public class PropertyColor implements IUnlistedProperty { - public static ColorProperty INSTANCE = new ColorProperty(); + public static PropertyColor INSTANCE = new PropertyColor(); public EnumColor color; - public ColorProperty() {} + public PropertyColor() {} - public ColorProperty(EnumColor c) + public PropertyColor(EnumColor c) { color = c; } @@ -23,7 +23,7 @@ public class ColorProperty implements IUnlistedProperty } @Override - public boolean isValid(ColorProperty value) + public boolean isValid(PropertyColor value) { return true; } @@ -35,7 +35,7 @@ public class ColorProperty implements IUnlistedProperty } @Override - public String valueToString(ColorProperty value) + public String valueToString(PropertyColor value) { return color.getName(); } diff --git a/src/main/java/mekanism/common/multipart/ConnectionProperty.java b/src/main/java/mekanism/common/block/property/PropertyConnection.java similarity index 60% rename from src/main/java/mekanism/common/multipart/ConnectionProperty.java rename to src/main/java/mekanism/common/block/property/PropertyConnection.java index ec771c745..1d6db0d8a 100644 --- a/src/main/java/mekanism/common/multipart/ConnectionProperty.java +++ b/src/main/java/mekanism/common/block/property/PropertyConnection.java @@ -1,22 +1,22 @@ -package mekanism.common.multipart; +package mekanism.common.block.property; import java.util.Arrays; -import mekanism.common.multipart.PartSidedPipe.ConnectionType; +import mekanism.common.tile.transmitter.TileEntitySidedPipe.ConnectionType; import net.minecraftforge.common.property.IUnlistedProperty; -public class ConnectionProperty implements IUnlistedProperty +public class PropertyConnection implements IUnlistedProperty { - public static ConnectionProperty INSTANCE = new ConnectionProperty(); + public static PropertyConnection INSTANCE = new PropertyConnection(); public byte connectionByte; public byte transmitterConnections; public ConnectionType[] connectionTypes; public boolean renderCenter; - public ConnectionProperty() {} + public PropertyConnection() {} - public ConnectionProperty(byte b, byte b1, ConnectionType[] types, boolean center) + public PropertyConnection(byte b, byte b1, ConnectionType[] types, boolean center) { connectionByte = b; transmitterConnections = b1; @@ -31,7 +31,7 @@ public class ConnectionProperty implements IUnlistedProperty } @Override - public boolean isValid(ConnectionProperty value) + public boolean isValid(PropertyConnection value) { return true; } @@ -43,7 +43,7 @@ public class ConnectionProperty implements IUnlistedProperty } @Override - public String valueToString(ConnectionProperty value) + public String valueToString(PropertyConnection value) { return Byte.toString(value.connectionByte) + "_" + Byte.toString(value.transmitterConnections) + "_" + Arrays.toString(value.connectionTypes) + "_" + value.renderCenter; diff --git a/src/main/java/mekanism/common/block/states/BlockStateGlowPanel.java b/src/main/java/mekanism/common/block/states/BlockStateGlowPanel.java new file mode 100644 index 000000000..1fd97c8b8 --- /dev/null +++ b/src/main/java/mekanism/common/block/states/BlockStateGlowPanel.java @@ -0,0 +1,15 @@ +package mekanism.common.block.states; + +import mekanism.common.block.BlockGlowPanel; +import mekanism.common.block.property.PropertyColor; +import net.minecraft.block.properties.IProperty; +import net.minecraftforge.common.property.ExtendedBlockState; +import net.minecraftforge.common.property.IUnlistedProperty; + +public class BlockStateGlowPanel extends ExtendedBlockState +{ + public BlockStateGlowPanel(BlockGlowPanel block) + { + super(block, new IProperty[] {BlockStateFacing.facingProperty}, new IUnlistedProperty[] {PropertyColor.INSTANCE}); + } +} diff --git a/src/main/java/mekanism/common/block/states/BlockStateMachine.java b/src/main/java/mekanism/common/block/states/BlockStateMachine.java index c5fe8e5b8..e9a9c0e2d 100644 --- a/src/main/java/mekanism/common/block/states/BlockStateMachine.java +++ b/src/main/java/mekanism/common/block/states/BlockStateMachine.java @@ -5,14 +5,14 @@ import java.util.Collection; import java.util.HashSet; import java.util.List; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.machines; -import mekanism.api.MekanismConfig.usage; import mekanism.common.Mekanism; import mekanism.common.MekanismBlocks; import mekanism.common.Tier.BaseTier; +import mekanism.common.base.IBlockType; import mekanism.common.base.IFactory.RecipeType; import mekanism.common.block.BlockMachine; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.recipe.ShapedMekanismRecipe; import mekanism.common.tile.TileEntityAdvancedFactory; import mekanism.common.tile.TileEntityAmbientAccumulator; @@ -118,7 +118,7 @@ public class BlockStateMachine extends ExtendedBlockState } } - public static enum MachineType implements IStringSerializable + public static enum MachineType implements IStringSerializable, IBlockType { ENRICHMENT_CHAMBER(MachineBlock.MACHINE_BLOCK_1, 0, "EnrichmentChamber", 3, TileEntityEnrichmentChamber.class, true, false, true, Plane.HORIZONTAL, true), OSMIUM_COMPRESSOR(MachineBlock.MACHINE_BLOCK_1, 1, "OsmiumCompressor", 4, TileEntityOsmiumCompressor.class, true, false, true, Plane.HORIZONTAL, true), @@ -162,14 +162,14 @@ public class BlockStateMachine extends ExtendedBlockState public MachineBlock typeBlock; public int meta; - public String machineName; + public String blockName; public int guiId; public double baseEnergy; public Class tileEntityClass; public boolean isElectric; public boolean hasModel; public boolean supportsUpgrades; - public Collection machineRecipes = new HashSet(); + public Collection blockRecipes = new HashSet(); public Predicate facingPredicate; public boolean activable; @@ -177,7 +177,7 @@ public class BlockStateMachine extends ExtendedBlockState { typeBlock = block; meta = i; - machineName = s; + blockName = s; guiId = j; tileEntityClass = tileClass; isElectric = electric; @@ -186,25 +186,35 @@ public class BlockStateMachine extends ExtendedBlockState facingPredicate = predicate; activable = hasActiveTexture; } + + @Override + public String getBlockName() + { + return blockName; + } + @Override public boolean isEnabled() { - return machines.isEnabled(this.machineName); + return general.machinesManager.isEnabled(blockName); } + @Override public void addRecipes(Collection recipes) { - machineRecipes.addAll(recipes); + blockRecipes.addAll(recipes); } + @Override public void addRecipe(ShapedMekanismRecipe recipe) { - machineRecipes.add(recipe); + blockRecipes.add(recipe); } + @Override public Collection getRecipes() { - return machineRecipes; + return blockRecipes; } public static List getValidMachines() @@ -276,12 +286,6 @@ public class BlockStateMachine extends ExtendedBlockState return usage.crusherUsage; case DIGITAL_MINER: return usage.digitalMinerUsage; - case BASIC_FACTORY: - return usage.factoryUsage * 3; - case ADVANCED_FACTORY: - return usage.factoryUsage * 5; - case ELITE_FACTORY: - return usage.factoryUsage * 7; case METALLURGIC_INFUSER: return usage.metallurgicInfuserUsage; case PURIFICATION_CHAMBER: @@ -361,7 +365,7 @@ public class BlockStateMachine extends ExtendedBlockState public String getDescription() { - return LangUtils.localize("tooltip." + machineName); + return LangUtils.localize("tooltip." + blockName); } public ItemStack getStack() diff --git a/src/main/java/mekanism/common/block/states/BlockStateTransmitter.java b/src/main/java/mekanism/common/block/states/BlockStateTransmitter.java new file mode 100644 index 000000000..8950e45f2 --- /dev/null +++ b/src/main/java/mekanism/common/block/states/BlockStateTransmitter.java @@ -0,0 +1,136 @@ +package mekanism.common.block.states; + +import mekanism.api.transmitters.TransmissionType; +import mekanism.common.Tier.BaseTier; +import mekanism.common.block.BlockTransmitter; +import mekanism.common.block.property.PropertyColor; +import mekanism.common.block.property.PropertyConnection; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.statemap.StateMapperBase; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.obj.OBJModel.OBJProperty; +import net.minecraftforge.common.property.ExtendedBlockState; +import net.minecraftforge.common.property.IUnlistedProperty; + +public class BlockStateTransmitter extends ExtendedBlockState +{ + public static final PropertyEnum typeProperty = PropertyEnum.create("type", TransmitterType.class); + public static final PropertyEnum tierProperty = PropertyEnum.create("tier", BaseTier.class); + + public BlockStateTransmitter(BlockTransmitter block) + { + super(block, new IProperty[] {typeProperty, tierProperty}, new IUnlistedProperty[] {OBJProperty.INSTANCE, PropertyColor.INSTANCE, PropertyConnection.INSTANCE}); + } + + public enum TransmitterType implements IStringSerializable + { + UNIVERSAL_CABLE("UniversalCable", Size.SMALL, TransmissionType.ENERGY, false, true), + MECHANICAL_PIPE("MechanicalPipe", Size.LARGE, TransmissionType.FLUID, false, true), + PRESSURIZED_TUBE("PressurizedTube", Size.SMALL, TransmissionType.GAS, false, true), + LOGISTICAL_TRANSPORTER("LogisticalTransporter", Size.LARGE, TransmissionType.ITEM, true, true), + RESTRICTIVE_TRANSPORTER("RestrictiveTransporter", Size.LARGE, TransmissionType.ITEM, false, false), + DIVERSION_TRANSPORTER("DiversionTransporter", Size.LARGE, TransmissionType.ITEM, true, false), + THERMODYNAMIC_CONDUCTOR("ThermodynamicConductor", Size.SMALL, TransmissionType.HEAT, false, true); + + private String unlocalizedName; + private Size size; + private TransmissionType transmissionType; + private boolean transparencyRender; + private boolean tiers; + + private TransmitterType(String name, Size s, TransmissionType type, boolean transparency, boolean b) + { + unlocalizedName = name; + size = s; + transmissionType = type; + transparencyRender = transparency; + tiers = b; + } + + @Override + public String getName() + { + return name().toLowerCase(); + } + + public String getUnlocalizedName() + { + return unlocalizedName; + } + + public Size getSize() + { + return size; + } + + public boolean hasTransparency() + { + return transparencyRender; + } + + public TransmissionType getTransmission() + { + return transmissionType; + } + + public boolean hasTiers() + { + return tiers; + } + + public static enum Size + { + SMALL(6), + LARGE(8); + + public int centerSize; + + private Size(int size) + { + centerSize = size; + } + } + + public static TransmitterType get(int meta) + { + return TransmitterType.values()[meta]; + } + } + + public static class TransmitterStateMapper extends StateMapperBase + { + @Override + protected ModelResourceLocation getModelResourceLocation(IBlockState state) + { + BlockTransmitter block = (BlockTransmitter)state.getBlock(); + TransmitterType type = state.getValue(typeProperty); + StringBuilder builder = new StringBuilder(); + String nameOverride = null; + + if(type.tiers) + { + BaseTier tier = state.getValue(tierProperty); + + if(tier == BaseTier.CREATIVE) + { + tier = BaseTier.ULTIMATE; + } + + nameOverride = type.getName() + "_" + tier.getName(); + } + + if(builder.length() == 0) + { + builder.append("normal"); + } + + ResourceLocation baseLocation = new ResourceLocation("mekanism", nameOverride != null ? nameOverride : type.getName()); + + return new ModelResourceLocation(baseLocation, builder.toString()); + } + } +} diff --git a/src/main/java/mekanism/common/capabilities/Capabilities.java b/src/main/java/mekanism/common/capabilities/Capabilities.java index 0190d3abe..3dd605987 100644 --- a/src/main/java/mekanism/common/capabilities/Capabilities.java +++ b/src/main/java/mekanism/common/capabilities/Capabilities.java @@ -6,8 +6,8 @@ import mekanism.api.IConfigCardAccess.ISpecialConfigData; import mekanism.api.IConfigurable; import mekanism.api.IEvaporationSolar; import mekanism.api.IHeatTransfer; -import mekanism.api.energy.ICableOutputter; import mekanism.api.energy.IStrictEnergyAcceptor; +import mekanism.api.energy.IStrictEnergyOutputter; import mekanism.api.energy.IStrictEnergyStorage; import mekanism.api.gas.IGasHandler; import mekanism.api.gas.ITubeConnection; @@ -33,8 +33,8 @@ public class Capabilities @CapabilityInject(IStrictEnergyAcceptor.class) public static Capability ENERGY_ACCEPTOR_CAPABILITY = null; - @CapabilityInject(ICableOutputter.class) - public static Capability CABLE_OUTPUTTER_CAPABILITY = null; + @CapabilityInject(IStrictEnergyOutputter.class) + public static Capability ENERGY_OUTPUTTER_CAPABILITY = null; @CapabilityInject(IConfigurable.class) public static Capability CONFIGURABLE_CAPABILITY = null; diff --git a/src/main/java/mekanism/common/capabilities/DefaultCableOutputter.java b/src/main/java/mekanism/common/capabilities/DefaultCableOutputter.java index 6f12aa92b..725338232 100644 --- a/src/main/java/mekanism/common/capabilities/DefaultCableOutputter.java +++ b/src/main/java/mekanism/common/capabilities/DefaultCableOutputter.java @@ -1,6 +1,6 @@ package mekanism.common.capabilities; -import mekanism.api.energy.ICableOutputter; +import mekanism.api.energy.IStrictEnergyOutputter; import mekanism.common.capabilities.DefaultStorageHelper.NullStorage; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.CapabilityManager; @@ -8,16 +8,22 @@ import net.minecraftforge.common.capabilities.CapabilityManager; /** * Created by ben on 30/04/16. */ -public class DefaultCableOutputter implements ICableOutputter +public class DefaultCableOutputter implements IStrictEnergyOutputter { + @Override + public double pullEnergy(EnumFacing side, double amount, boolean simulate) + { + return 0; + } + @Override - public boolean canOutputTo(EnumFacing side) + public boolean canOutputEnergy(EnumFacing side) { return true; } - + public static void register() { - CapabilityManager.INSTANCE.register(ICableOutputter.class, new NullStorage<>(), DefaultCableOutputter.class); + CapabilityManager.INSTANCE.register(IStrictEnergyOutputter.class, new NullStorage<>(), DefaultCableOutputter.class); } } diff --git a/src/main/java/mekanism/common/capabilities/DefaultLogisticalTransporter.java b/src/main/java/mekanism/common/capabilities/DefaultLogisticalTransporter.java index 9fe201f4f..b79891195 100644 --- a/src/main/java/mekanism/common/capabilities/DefaultLogisticalTransporter.java +++ b/src/main/java/mekanism/common/capabilities/DefaultLogisticalTransporter.java @@ -5,13 +5,13 @@ import java.util.Collection; import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.transmitters.TransmissionType; -import mekanism.common.InventoryNetwork; import mekanism.common.base.ILogisticalTransporter; import mekanism.common.capabilities.DefaultStorageHelper.NullStorage; +import mekanism.common.content.transporter.TransitRequest; +import mekanism.common.content.transporter.TransitRequest.TransitResponse; import mekanism.common.content.transporter.TransporterStack; import mekanism.common.tile.TileEntityLogisticalSorter; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; +import mekanism.common.transmitters.grid.InventoryNetwork; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; @@ -23,15 +23,15 @@ import net.minecraftforge.common.capabilities.CapabilityManager; public class DefaultLogisticalTransporter implements ILogisticalTransporter { @Override - public ItemStack insert(Coord4D original, ItemStack itemStack, EnumColor color, boolean doEmit, int min) + public TransitResponse insert(Coord4D original, TransitRequest request, EnumColor color, boolean doEmit, int min) { - return null; + return TransitResponse.EMPTY; } @Override - public ItemStack insertRR(TileEntityLogisticalSorter outputter, ItemStack itemStack, EnumColor color, boolean doEmit, int min) + public TransitResponse insertRR(TileEntityLogisticalSorter outputter, TransitRequest request, EnumColor color, boolean doEmit, int min) { - return null; + return TransitResponse.EMPTY; } @Override @@ -161,7 +161,7 @@ public class DefaultLogisticalTransporter implements ILogisticalTransporter } @Override - public IInventory getAcceptor(EnumFacing side) + public TileEntity getAcceptor(EnumFacing side) { return null; } diff --git a/src/main/java/mekanism/common/capabilities/DefaultStrictEnergyAcceptor.java b/src/main/java/mekanism/common/capabilities/DefaultStrictEnergyAcceptor.java index 1b9d2bc06..228e5d7fc 100644 --- a/src/main/java/mekanism/common/capabilities/DefaultStrictEnergyAcceptor.java +++ b/src/main/java/mekanism/common/capabilities/DefaultStrictEnergyAcceptor.java @@ -2,32 +2,18 @@ package mekanism.common.capabilities; import mekanism.api.energy.IStrictEnergyAcceptor; import mekanism.common.capabilities.DefaultStorageHelper.DefaultStorage; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.CapabilityManager; -import net.minecraftforge.common.util.INBTSerializable; /** * Created by ben on 30/04/16. */ -public class DefaultStrictEnergyAcceptor extends DefaultStrictEnergyStorage implements IStrictEnergyAcceptor, INBTSerializable +public class DefaultStrictEnergyAcceptor implements IStrictEnergyAcceptor { - public DefaultStrictEnergyAcceptor() - { - this(0); - } - - public DefaultStrictEnergyAcceptor(double capacity) - { - super(capacity); - } - @Override - public double transferEnergyToAcceptor(EnumFacing side, double amount) + public double acceptEnergy(EnumFacing side, double amount, boolean simulate) { - double used = Math.min(amount, Math.max(0, getMaxEnergy() - getEnergy())); - setEnergy(getEnergy() + used); - return used; + return 0; } @Override @@ -36,18 +22,6 @@ public class DefaultStrictEnergyAcceptor extends DefaultStrictEnergyStorage impl return true; } - @Override - public NBTTagCompound serializeNBT() - { - return super.serializeNBT(); - } - - @Override - public void deserializeNBT(NBTTagCompound nbt) - { - super.deserializeNBT(nbt); - } - public static void register() { CapabilityManager.INSTANCE.register(IStrictEnergyAcceptor.class, new DefaultStorage<>(), DefaultStrictEnergyAcceptor.class); diff --git a/src/main/java/mekanism/api/MekanismConfig.java b/src/main/java/mekanism/common/config/MekanismConfig.java similarity index 90% rename from src/main/java/mekanism/api/MekanismConfig.java rename to src/main/java/mekanism/common/config/MekanismConfig.java index a3c5b0c01..2fc3088df 100644 --- a/src/main/java/mekanism/api/MekanismConfig.java +++ b/src/main/java/mekanism/common/config/MekanismConfig.java @@ -1,15 +1,14 @@ -package mekanism.api; +package mekanism.common.config; -import java.util.HashMap; -import java.util.Map; - -import mekanism.api.util.UnitDisplayUtils.EnergyType; -import mekanism.api.util.UnitDisplayUtils.TempType; +import mekanism.common.util.UnitDisplayUtils.EnergyType; +import mekanism.common.util.UnitDisplayUtils.TempType; public class MekanismConfig { public static class general { + public static TypeConfigManager machinesManager = new TypeConfigManager(); + public static boolean updateNotifications = true; public static boolean controlCircuitOreDict = true; public static boolean logPackets = false; @@ -36,16 +35,19 @@ public class MekanismConfig public static double TO_IC2; public static double TO_RF; public static double TO_TESLA; + public static double TO_FORGE; public static double FROM_H2; public static double FROM_IC2; public static double FROM_RF; public static double FROM_TESLA; + public static double FROM_FORGE; public static int laserRange; public static double laserEnergyNeededPerHardness; public static double minerSilkMultiplier = 6; public static boolean blacklistIC2; public static boolean blacklistRF; public static boolean blacklistTesla; + public static boolean blacklistForge; public static boolean destroyDisabledBlocks; public static boolean prefilledGasTanks; public static double armoredJetpackDamageRatio; @@ -70,6 +72,7 @@ public class MekanismConfig public static boolean allowTransmitterAlloyUpgrade; public static boolean allowChunkloading; public static boolean allowProtection = true; + public static int portableTeleporterDelay; } public static class client @@ -85,21 +88,7 @@ public class MekanismConfig public static boolean enableAmbientLighting; public static int ambientLightingLevel; public static boolean opaqueTransmitters = false; - } - - public static class machines - { - private static Map config = new HashMap(); - - public static boolean isEnabled(String type) - { - return config.get(type) != null && config.get(type); - } - - public static void setEntry(String type, boolean enabled) - { - config.put(type, enabled); - } + public static boolean allowConfiguratorModeScroll; } public static class usage @@ -108,7 +97,6 @@ public class MekanismConfig public static double osmiumCompressorUsage; public static double combinerUsage; public static double crusherUsage; - public static double factoryUsage; public static double metallurgicInfuserUsage; public static double purificationChamberUsage; public static double energizedSmelterUsage; @@ -133,6 +121,8 @@ public class MekanismConfig public static class generators { + public static TypeConfigManager generatorsManager = new TypeConfigManager(); + public static double advancedSolarGeneration; public static double bioGeneration; public static double heatGeneration; @@ -150,6 +140,8 @@ public class MekanismConfig public static double turbineVentGasFlow; public static double turbineDisperserGasFlow; public static int condenserRate; + + public static double energyPerFusionFuel; } public static class tools diff --git a/src/main/java/mekanism/common/config/TypeConfigManager.java b/src/main/java/mekanism/common/config/TypeConfigManager.java new file mode 100644 index 000000000..056422620 --- /dev/null +++ b/src/main/java/mekanism/common/config/TypeConfigManager.java @@ -0,0 +1,40 @@ +package mekanism.common.config; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import mekanism.common.base.IBlockType; +import net.minecraft.item.crafting.CraftingManager; + +public class TypeConfigManager +{ + private Map config = new HashMap(); + + public boolean isEnabled(String type) + { + return config.get(type) != null && config.get(type); + } + + public void setEntry(String type, boolean enabled) + { + config.put(type, enabled); + } + + public static void updateConfigRecipes(List blocks, TypeConfigManager manager) + { + for(Object obj : blocks) //enums are quirky + { + IBlockType type = (IBlockType)obj; + + if(manager.isEnabled(type.getBlockName())) + { + CraftingManager.getInstance().getRecipeList().removeAll(type.getRecipes()); + CraftingManager.getInstance().getRecipeList().addAll(type.getRecipes()); + } + else { + CraftingManager.getInstance().getRecipeList().removeAll(type.getRecipes()); + } + } + } +} diff --git a/src/main/java/mekanism/common/content/assemblicator/RecipeFormula.java b/src/main/java/mekanism/common/content/assemblicator/RecipeFormula.java index 3713ca9d1..da88c0f8d 100644 --- a/src/main/java/mekanism/common/content/assemblicator/RecipeFormula.java +++ b/src/main/java/mekanism/common/content/assemblicator/RecipeFormula.java @@ -1,31 +1,35 @@ package mekanism.common.content.assemblicator; -import mekanism.api.util.StackUtils; +import java.util.ArrayList; +import java.util.List; + import mekanism.common.util.MekanismUtils; import mekanism.common.util.RecipeUtils; +import mekanism.common.util.StackUtils; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.NonNullList; import net.minecraft.world.World; public class RecipeFormula { private InventoryCrafting dummy = MekanismUtils.getDummyCraftingInv(); - public ItemStack[] input = new ItemStack[9]; + public NonNullList input = NonNullList.withSize(9, ItemStack.EMPTY); public IRecipe recipe = null; - public RecipeFormula(World world, ItemStack[] inv) + public RecipeFormula(World world, NonNullList inv) { this(world, inv, 0); } - public RecipeFormula(World world, ItemStack[] inv, int start) + public RecipeFormula(World world, NonNullList inv, int start) { for(int i = 0; i < 9; i++) { - input[i] = StackUtils.size(inv[start+i], 1); + input.set(i, StackUtils.size(inv.get(start+i), 1)); } resetToRecipe(); @@ -37,15 +41,15 @@ public class RecipeFormula { for(int i = 0; i < 9; i++) { - dummy.setInventorySlotContents(i, input[i]); + dummy.setInventorySlotContents(i, input.get(i)); } } - public boolean matches(World world, ItemStack[] newInput, int start) + public boolean matches(World world, NonNullList newInput, int start) { for(int i = 0; i < 9; i++) { - dummy.setInventorySlotContents(i, newInput[start+i]); + dummy.setInventorySlotContents(i, newInput.get(start+i)); } return recipe.matches(dummy, world); @@ -70,12 +74,31 @@ public class RecipeFormula return true; } - dummy.setInventorySlotContents(i, input[i]); + dummy.setInventorySlotContents(i, input.get(i)); } return false; } + public List getIngredientIndices(World world, ItemStack stack) + { + List ret = new ArrayList<>(); + + for(int i = 0; i < 9; i++) + { + dummy.setInventorySlotContents(i, stack); + + if(recipe.matches(dummy, world)) + { + ret.add(i); + } + + dummy.setInventorySlotContents(i, input.get(i)); + } + + return ret; + } + public boolean isValidFormula(World world) { return getRecipe(world) != null; diff --git a/src/main/java/mekanism/common/content/boiler/SynchronizedBoilerData.java b/src/main/java/mekanism/common/content/boiler/SynchronizedBoilerData.java index 601fba1f8..0445fffca 100644 --- a/src/main/java/mekanism/common/content/boiler/SynchronizedBoilerData.java +++ b/src/main/java/mekanism/common/content/boiler/SynchronizedBoilerData.java @@ -7,12 +7,13 @@ import java.util.Set; import mekanism.api.Coord4D; import mekanism.api.IHeatTransfer; -import mekanism.api.MekanismConfig.general; -import mekanism.api.util.UnitDisplayUtils.TemperatureUnit; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.content.tank.SynchronizedTankData.ValveData; import mekanism.common.multiblock.SynchronizedData; +import mekanism.common.util.UnitDisplayUtils.TemperatureUnit; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.fluids.FluidStack; public class SynchronizedBoilerData extends SynchronizedData implements IHeatTransfer @@ -47,7 +48,7 @@ public class SynchronizedBoilerData extends SynchronizedData inventory = NonNullList.withSize(2, ItemStack.EMPTY); public Coord4D upperRenderLocation; @@ -99,7 +100,7 @@ public class SynchronizedBoilerData extends SynchronizedData getInventory() { return inventory; } diff --git a/src/main/java/mekanism/common/content/entangloporter/InventoryFrequency.java b/src/main/java/mekanism/common/content/entangloporter/InventoryFrequency.java index 4b36ef498..1fc76337b 100644 --- a/src/main/java/mekanism/common/content/entangloporter/InventoryFrequency.java +++ b/src/main/java/mekanism/common/content/entangloporter/InventoryFrequency.java @@ -3,13 +3,18 @@ package mekanism.common.content.entangloporter; import io.netty.buffer.ByteBuf; import java.util.ArrayList; +import java.util.UUID; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; import mekanism.common.PacketHandler; import mekanism.common.frequency.Frequency; +import mekanism.common.util.InventoryUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.NonNullList; +import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; @@ -23,12 +28,12 @@ public class InventoryFrequency extends Frequency public double storedEnergy; public FluidTank storedFluid; public GasTank storedGas; - public ItemStack storedItem; + public NonNullList inventory = NonNullList.withSize(1, ItemStack.EMPTY); public double temperature; - public InventoryFrequency(String n, String o) + public InventoryFrequency(String n, UUID uuid) { - super(n, o); + super(n, uuid); storedFluid = new FluidTank(1000); storedGas = new GasTank(1000); @@ -61,10 +66,20 @@ public class InventoryFrequency extends Frequency nbtTags.setTag("storedGas", storedGas.write(new NBTTagCompound())); } - if(storedItem != null) + NBTTagList tagList = new NBTTagList(); + + for(int slotCount = 0; slotCount < 1; slotCount++) { - nbtTags.setTag("storedItem", storedItem.writeToNBT(new NBTTagCompound())); + if(!inventory.get(slotCount).isEmpty()) + { + NBTTagCompound tagCompound = new NBTTagCompound(); + tagCompound.setByte("Slot", (byte)slotCount); + inventory.get(slotCount).writeToNBT(tagCompound); + tagList.appendTag(tagCompound); + } } + + nbtTags.setTag("Items", tagList); nbtTags.setDouble("temperature", temperature); } @@ -89,9 +104,18 @@ public class InventoryFrequency extends Frequency storedGas.read(nbtTags.getCompoundTag("storedGas")); } - if(nbtTags.hasKey("storedItem")) + NBTTagList tagList = nbtTags.getTagList("Items", NBT.TAG_COMPOUND); + inventory = NonNullList.withSize(2, ItemStack.EMPTY); + + for(int tagCount = 0; tagCount < tagList.tagCount(); tagCount++) { - storedItem = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("storedItem")); + NBTTagCompound tagCompound = (NBTTagCompound)tagList.getCompoundTagAt(tagCount); + byte slotID = tagCompound.getByte("Slot"); + + if(slotID >= 0 && slotID < 1) + { + inventory.set(slotID, InventoryUtils.loadFromNBT(tagCompound)); + } } temperature = nbtTags.getDouble("temperature"); diff --git a/src/main/java/mekanism/common/content/matrix/MatrixCache.java b/src/main/java/mekanism/common/content/matrix/MatrixCache.java index 482a2a4ec..aedb1fdd7 100644 --- a/src/main/java/mekanism/common/content/matrix/MatrixCache.java +++ b/src/main/java/mekanism/common/content/matrix/MatrixCache.java @@ -1,14 +1,16 @@ package mekanism.common.content.matrix; import mekanism.common.multiblock.MultiblockCache; +import mekanism.common.util.InventoryUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.util.Constants.NBT; public class MatrixCache extends MultiblockCache { - public ItemStack[] inventory = new ItemStack[2]; + public NonNullList inventory = NonNullList.withSize(2, ItemStack.EMPTY); @Override public void apply(SynchronizedMatrixData data) @@ -26,7 +28,7 @@ public class MatrixCache extends MultiblockCache public void load(NBTTagCompound nbtTags) { NBTTagList tagList = nbtTags.getTagList("Items", NBT.TAG_COMPOUND); - inventory = new ItemStack[2]; + inventory = NonNullList.withSize(2, ItemStack.EMPTY); for(int tagCount = 0; tagCount < tagList.tagCount(); tagCount++) { @@ -35,7 +37,7 @@ public class MatrixCache extends MultiblockCache if(slotID >= 0 && slotID < 2) { - inventory[slotID] = ItemStack.loadItemStackFromNBT(tagCompound); + inventory.set(slotID, InventoryUtils.loadFromNBT(tagCompound)); } } } @@ -47,11 +49,11 @@ public class MatrixCache extends MultiblockCache for(int slotCount = 0; slotCount < 2; slotCount++) { - if(inventory[slotCount] != null) + if(!inventory.get(slotCount).isEmpty()) { NBTTagCompound tagCompound = new NBTTagCompound(); tagCompound.setByte("Slot", (byte)slotCount); - inventory[slotCount].writeToNBT(tagCompound); + inventory.get(slotCount).writeToNBT(tagCompound); tagList.appendTag(tagCompound); } } diff --git a/src/main/java/mekanism/common/content/matrix/MatrixUpdateProtocol.java b/src/main/java/mekanism/common/content/matrix/MatrixUpdateProtocol.java index e606e9aa6..4514859c4 100644 --- a/src/main/java/mekanism/common/content/matrix/MatrixUpdateProtocol.java +++ b/src/main/java/mekanism/common/content/matrix/MatrixUpdateProtocol.java @@ -3,7 +3,6 @@ package mekanism.common.content.matrix; import java.util.List; import mekanism.api.Coord4D; -import mekanism.api.util.StackUtils; import mekanism.common.Mekanism; import mekanism.common.MekanismBlocks; import mekanism.common.multiblock.MultiblockCache; @@ -12,6 +11,7 @@ import mekanism.common.multiblock.UpdateProtocol; import mekanism.common.tile.TileEntityInductionCasing; import mekanism.common.tile.TileEntityInductionCell; import mekanism.common.tile.TileEntityInductionProvider; +import mekanism.common.util.StackUtils; import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; diff --git a/src/main/java/mekanism/common/content/matrix/SynchronizedMatrixData.java b/src/main/java/mekanism/common/content/matrix/SynchronizedMatrixData.java index 2398d2d66..59b04442b 100644 --- a/src/main/java/mekanism/common/content/matrix/SynchronizedMatrixData.java +++ b/src/main/java/mekanism/common/content/matrix/SynchronizedMatrixData.java @@ -8,11 +8,12 @@ import mekanism.common.multiblock.SynchronizedData; import mekanism.common.tile.TileEntityInductionCell; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.NonNullList; import net.minecraft.world.World; public class SynchronizedMatrixData extends SynchronizedData { - public ItemStack[] inventory = new ItemStack[2]; + public NonNullList inventory = NonNullList.withSize(2, ItemStack.EMPTY); public Set cells = new HashSet(); @@ -29,7 +30,7 @@ public class SynchronizedMatrixData extends SynchronizedData getInventory() { return inventory; } diff --git a/src/main/java/mekanism/common/content/miner/MItemStackFilter.java b/src/main/java/mekanism/common/content/miner/MItemStackFilter.java index 25428cc5f..b9c9913a6 100644 --- a/src/main/java/mekanism/common/content/miner/MItemStackFilter.java +++ b/src/main/java/mekanism/common/content/miner/MItemStackFilter.java @@ -4,6 +4,7 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; +import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -11,7 +12,7 @@ import net.minecraft.nbt.NBTTagCompound; public class MItemStackFilter extends MinerFilter { - public ItemStack itemType; + public ItemStack itemType = ItemStack.EMPTY; public boolean fuzzy; public MItemStackFilter(ItemStack item) @@ -24,7 +25,7 @@ public class MItemStackFilter extends MinerFilter @Override public boolean canFilter(ItemStack itemStack) { - if(itemStack == null) + if(itemStack.isEmpty()) { return false; } @@ -56,7 +57,7 @@ public class MItemStackFilter extends MinerFilter super.read(nbtTags); fuzzy = nbtTags.getBoolean("fuzzy"); - itemType = ItemStack.loadItemStackFromNBT(nbtTags); + itemType = InventoryUtils.loadFromNBT(nbtTags); } @Override @@ -69,7 +70,7 @@ public class MItemStackFilter extends MinerFilter data.add(fuzzy); data.add(MekanismUtils.getID(itemType)); - data.add(itemType.stackSize); + data.add(itemType.getCount()); data.add(itemType.getItemDamage()); } @@ -88,7 +89,7 @@ public class MItemStackFilter extends MinerFilter { int code = 1; code = 31 * code + MekanismUtils.getID(itemType); - code = 31 * code + itemType.stackSize; + code = 31 * code + itemType.getCount(); code = 31 * code + itemType.getItemDamage(); return code; } diff --git a/src/main/java/mekanism/common/content/miner/MMaterialFilter.java b/src/main/java/mekanism/common/content/miner/MMaterialFilter.java index 6ce3d3287..92cf312a3 100644 --- a/src/main/java/mekanism/common/content/miner/MMaterialFilter.java +++ b/src/main/java/mekanism/common/content/miner/MMaterialFilter.java @@ -5,6 +5,7 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; import mekanism.common.content.transporter.Finder.MaterialFinder; +import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -15,7 +16,7 @@ import net.minecraft.nbt.NBTTagCompound; public class MMaterialFilter extends MinerFilter { - public ItemStack materialItem; + public ItemStack materialItem = ItemStack.EMPTY; public Material getMaterial() { @@ -25,7 +26,7 @@ public class MMaterialFilter extends MinerFilter @Override public boolean canFilter(ItemStack itemStack) { - if(itemStack == null || !(itemStack.getItem() instanceof ItemBlock)) + if(itemStack.isEmpty() || !(itemStack.getItem() instanceof ItemBlock)) { return false; } @@ -49,7 +50,7 @@ public class MMaterialFilter extends MinerFilter { super.read(nbtTags); - materialItem = ItemStack.loadItemStackFromNBT(nbtTags); + materialItem = InventoryUtils.loadFromNBT(nbtTags); } @Override @@ -60,7 +61,7 @@ public class MMaterialFilter extends MinerFilter super.write(data); data.add(MekanismUtils.getID(materialItem)); - data.add(materialItem.stackSize); + data.add(materialItem.getCount()); data.add(materialItem.getItemDamage()); } @@ -77,7 +78,7 @@ public class MMaterialFilter extends MinerFilter { int code = 1; code = 31 * code + MekanismUtils.getID(materialItem); - code = 31 * code + materialItem.stackSize; + code = 31 * code + materialItem.getCount(); code = 31 * code + materialItem.getItemDamage(); return code; } diff --git a/src/main/java/mekanism/common/content/miner/MModIDFilter.java b/src/main/java/mekanism/common/content/miner/MModIDFilter.java index 00dccb392..b05302b5c 100644 --- a/src/main/java/mekanism/common/content/miner/MModIDFilter.java +++ b/src/main/java/mekanism/common/content/miner/MModIDFilter.java @@ -17,7 +17,7 @@ public class MModIDFilter extends MinerFilter @Override public boolean canFilter(ItemStack itemStack) { - if(itemStack == null || !(itemStack.getItem() instanceof ItemBlock)) + if(itemStack.isEmpty() || !(itemStack.getItem() instanceof ItemBlock)) { return false; } diff --git a/src/main/java/mekanism/common/content/miner/MOreDictFilter.java b/src/main/java/mekanism/common/content/miner/MOreDictFilter.java index d43635789..770597ca7 100644 --- a/src/main/java/mekanism/common/content/miner/MOreDictFilter.java +++ b/src/main/java/mekanism/common/content/miner/MOreDictFilter.java @@ -17,7 +17,7 @@ public class MOreDictFilter extends MinerFilter @Override public boolean canFilter(ItemStack itemStack) { - if(itemStack == null || !(itemStack.getItem() instanceof ItemBlock)) + if(itemStack.isEmpty() || !(itemStack.getItem() instanceof ItemBlock)) { return false; } diff --git a/src/main/java/mekanism/common/content/miner/MinerFilter.java b/src/main/java/mekanism/common/content/miner/MinerFilter.java index f7f93eb8b..c7c265923 100644 --- a/src/main/java/mekanism/common/content/miner/MinerFilter.java +++ b/src/main/java/mekanism/common/content/miner/MinerFilter.java @@ -4,6 +4,7 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; +import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -11,7 +12,7 @@ import net.minecraft.nbt.NBTTagCompound; public abstract class MinerFilter { - public ItemStack replaceStack; + public ItemStack replaceStack = ItemStack.EMPTY; public boolean requireStack; @@ -21,7 +22,7 @@ public abstract class MinerFilter { nbtTags.setBoolean("requireStack", requireStack); - if(replaceStack != null) + if(!replaceStack.isEmpty()) { nbtTags.setTag("replaceStack", replaceStack.writeToNBT(new NBTTagCompound())); } @@ -35,7 +36,7 @@ public abstract class MinerFilter if(nbtTags.hasKey("replaceStack")) { - replaceStack = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("replaceStack")); + replaceStack = InventoryUtils.loadFromNBT(nbtTags.getCompoundTag("replaceStack")); } } @@ -43,7 +44,7 @@ public abstract class MinerFilter { data.add(requireStack); - if(replaceStack != null) + if(!replaceStack.isEmpty()) { data.add(true); data.add(MekanismUtils.getID(replaceStack)); @@ -63,7 +64,7 @@ public abstract class MinerFilter replaceStack = new ItemStack(Item.getItemById(dataStream.readInt()), 1, dataStream.readInt()); } else { - replaceStack = null; + replaceStack = ItemStack.EMPTY; } } diff --git a/src/main/java/mekanism/common/content/tank/SynchronizedTankData.java b/src/main/java/mekanism/common/content/tank/SynchronizedTankData.java index c7e3db0d6..7e45ddb1a 100644 --- a/src/main/java/mekanism/common/content/tank/SynchronizedTankData.java +++ b/src/main/java/mekanism/common/content/tank/SynchronizedTankData.java @@ -8,6 +8,7 @@ import mekanism.common.multiblock.SynchronizedData; import mekanism.common.util.FluidContainerUtils.ContainerEditMode; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.fluids.FluidStack; public class SynchronizedTankData extends SynchronizedData @@ -20,7 +21,7 @@ public class SynchronizedTankData extends SynchronizedData public ContainerEditMode editMode = ContainerEditMode.BOTH; - public ItemStack[] inventory = new ItemStack[2]; + public NonNullList inventory = NonNullList.withSize(2, ItemStack.EMPTY); public Set valves = new HashSet(); @@ -47,7 +48,7 @@ public class SynchronizedTankData extends SynchronizedData } @Override - public ItemStack[] getInventory() + public NonNullList getInventory() { return inventory; } diff --git a/src/main/java/mekanism/common/content/tank/TankCache.java b/src/main/java/mekanism/common/content/tank/TankCache.java index eb23200c4..a8c3d52d9 100644 --- a/src/main/java/mekanism/common/content/tank/TankCache.java +++ b/src/main/java/mekanism/common/content/tank/TankCache.java @@ -2,15 +2,17 @@ package mekanism.common.content.tank; import mekanism.common.multiblock.MultiblockCache; import mekanism.common.util.FluidContainerUtils.ContainerEditMode; +import mekanism.common.util.InventoryUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.fluids.FluidStack; public class TankCache extends MultiblockCache { - public ItemStack[] inventory = new ItemStack[2]; + public NonNullList inventory = NonNullList.withSize(2, ItemStack.EMPTY); public FluidStack fluid; @@ -38,7 +40,7 @@ public class TankCache extends MultiblockCache editMode = ContainerEditMode.values()[nbtTags.getInteger("editMode")]; NBTTagList tagList = nbtTags.getTagList("Items", NBT.TAG_COMPOUND); - inventory = new ItemStack[2]; + inventory = NonNullList.withSize(2, ItemStack.EMPTY); for(int tagCount = 0; tagCount < tagList.tagCount(); tagCount++) { @@ -47,7 +49,7 @@ public class TankCache extends MultiblockCache if(slotID >= 0 && slotID < 2) { - inventory[slotID] = ItemStack.loadItemStackFromNBT(tagCompound); + inventory.set(slotID, InventoryUtils.loadFromNBT(tagCompound)); } } @@ -66,11 +68,11 @@ public class TankCache extends MultiblockCache for(int slotCount = 0; slotCount < 2; slotCount++) { - if(inventory[slotCount] != null) + if(!inventory.get(slotCount).isEmpty()) { NBTTagCompound tagCompound = new NBTTagCompound(); tagCompound.setByte("Slot", (byte)slotCount); - inventory[slotCount].writeToNBT(tagCompound); + inventory.get(slotCount).writeToNBT(tagCompound); tagList.appendTag(tagCompound); } } diff --git a/src/main/java/mekanism/common/content/tank/TankUpdateProtocol.java b/src/main/java/mekanism/common/content/tank/TankUpdateProtocol.java index 536137d5a..cf8f11886 100644 --- a/src/main/java/mekanism/common/content/tank/TankUpdateProtocol.java +++ b/src/main/java/mekanism/common/content/tank/TankUpdateProtocol.java @@ -3,7 +3,6 @@ package mekanism.common.content.tank; import java.util.List; import mekanism.api.Coord4D; -import mekanism.api.util.StackUtils; import mekanism.common.Mekanism; import mekanism.common.MekanismBlocks; import mekanism.common.block.BlockBasic; @@ -14,6 +13,7 @@ import mekanism.common.multiblock.MultiblockManager; import mekanism.common.multiblock.UpdateProtocol; import mekanism.common.tile.TileEntityDynamicTank; import mekanism.common.tile.TileEntityDynamicValve; +import mekanism.common.util.StackUtils; import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/mekanism/common/content/transporter/Finder.java b/src/main/java/mekanism/common/content/transporter/Finder.java index d1ee9f4c9..0d268be89 100644 --- a/src/main/java/mekanism/common/content/transporter/Finder.java +++ b/src/main/java/mekanism/common/content/transporter/Finder.java @@ -2,9 +2,9 @@ package mekanism.common.content.transporter; import java.util.List; -import mekanism.api.util.StackUtils; import mekanism.common.util.ItemRegistryUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.StackUtils; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemBlock; @@ -103,7 +103,7 @@ public abstract class Finder @Override public boolean modifies(ItemStack stack) { - if(stack == null || !(stack.getItem() instanceof ItemBlock)) + if(stack.isEmpty() || !(stack.getItem() instanceof ItemBlock)) { return false; } @@ -124,7 +124,7 @@ public abstract class Finder @Override public boolean modifies(ItemStack stack) { - if(stack == null || !(stack.getItem() instanceof ItemBlock)) + if(stack.isEmpty()) { return false; } diff --git a/src/main/java/mekanism/common/content/transporter/InvStack.java b/src/main/java/mekanism/common/content/transporter/InvStack.java index b1644d378..c54222fcf 100644 --- a/src/main/java/mekanism/common/content/transporter/InvStack.java +++ b/src/main/java/mekanism/common/content/transporter/InvStack.java @@ -2,27 +2,34 @@ package mekanism.common.content.transporter; import java.util.ArrayList; +import mekanism.common.util.InventoryUtils; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.items.IItemHandler; public final class InvStack { - public IInventory inventory; + public TileEntity tileEntity; public ArrayList itemStacks; public ArrayList slotIDs; + public EnumFacing side; - public InvStack(IInventory inv) + public InvStack(TileEntity inv, EnumFacing facing) { - inventory = inv; + tileEntity = inv; itemStacks = new ArrayList(); slotIDs = new ArrayList(); + side = facing; } - public InvStack(IInventory inv, int id, ItemStack stack) + public InvStack(TileEntity inv, int id, ItemStack stack, EnumFacing facing) { - inventory = inv; + tileEntity = inv; itemStacks = new ArrayList(); slotIDs = new ArrayList(); + side = facing; appendStack(id, stack); } @@ -33,18 +40,18 @@ public final class InvStack for(ItemStack stack : itemStacks) { - size += stack.stackSize; + size += stack.getCount(); } if(!itemStacks.isEmpty()) { ItemStack ret = itemStacks.get(0).copy(); - ret.stackSize = size; + ret.setCount(size); return ret; } - return null; + return ItemStack.EMPTY; } public void appendStack(int id, ItemStack stack) @@ -55,31 +62,53 @@ public final class InvStack public void use(int amount) { - for(int i = 0; i < slotIDs.size(); i++) + if(tileEntity instanceof IInventory) { - ItemStack stack = itemStacks.get(i); - - if(inventory.getStackInSlot(slotIDs.get(i)).stackSize == stack.stackSize && stack.stackSize <= amount) + IInventory inventory = InventoryUtils.checkChestInv((IInventory)tileEntity); + + for(int i = 0; i < slotIDs.size(); i++) { - inventory.setInventorySlotContents(slotIDs.get(i), null); - amount -= stack.stackSize; + ItemStack stack = itemStacks.get(i); + + if(inventory.getStackInSlot(slotIDs.get(i)).getCount() == stack.getCount() && stack.getCount() <= amount) + { + inventory.setInventorySlotContents(slotIDs.get(i), ItemStack.EMPTY); + amount -= stack.getCount(); + } + else { + ItemStack ret = stack.copy(); + ret.setCount(inventory.getStackInSlot(slotIDs.get(i)).getCount() - stack.getCount()); + inventory.setInventorySlotContents(slotIDs.get(i), ret); + amount -= stack.getCount(); + } + + if(amount == 0) + { + return; + } } - else { - ItemStack ret = stack.copy(); - ret.stackSize = inventory.getStackInSlot(slotIDs.get(i)).stackSize - Math.min(stack.stackSize, amount); - inventory.setInventorySlotContents(slotIDs.get(i), ret); - amount -= ret.stackSize; - } - - if(amount == 0) + } + else if(InventoryUtils.isItemHandler(tileEntity, side)) + { + IItemHandler handler = InventoryUtils.getItemHandler(tileEntity, side); + + for(int i = 0; i < slotIDs.size(); i++) { - return; + ItemStack stack = itemStacks.get(i); + int toUse = Math.min(amount, stack.getCount()); + handler.extractItem(slotIDs.get(i), toUse, false); + amount -= toUse; + + if(amount == 0) + { + return; + } } } } public void use() { - use(getStack().stackSize); + use(getStack().getCount()); } } diff --git a/src/main/java/mekanism/common/content/transporter/StackSearcher.java b/src/main/java/mekanism/common/content/transporter/StackSearcher.java index 002f75f6d..64c92563e 100644 --- a/src/main/java/mekanism/common/content/transporter/StackSearcher.java +++ b/src/main/java/mekanism/common/content/transporter/StackSearcher.java @@ -1,106 +1,107 @@ package mekanism.common.content.transporter; -import mekanism.api.util.StackUtils; import mekanism.common.util.InventoryUtils; +import mekanism.common.util.StackUtils; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraftforge.items.IItemHandler; public class StackSearcher { - public int i; + public int i = -1; public int[] slots; - public IInventory theInventory; + public TileEntity tileEntity; public EnumFacing side; - public StackSearcher(IInventory inventory, EnumFacing direction) + public StackSearcher(TileEntity tile, EnumFacing direction) { - theInventory = InventoryUtils.checkChestInv(inventory); + tileEntity = tile; side = direction; - if(!(theInventory instanceof ISidedInventory)) + if(tile instanceof ISidedInventory) { - i = inventory.getSizeInventory(); - } - else { - slots = ((ISidedInventory)theInventory).getSlotsForFace(side.getOpposite()); + slots = ((ISidedInventory)tile).getSlotsForFace(side.getOpposite()); if(slots != null) { i = slots.length; } + } + else if(tile instanceof IInventory) + { + i = ((IInventory)tile).getSizeInventory(); + } + else if(InventoryUtils.isItemHandler(tile, direction.getOpposite())) + { + i = InventoryUtils.getItemHandler(tile, direction.getOpposite()).getSlots(); } } public InvStack takeTopStack(Finder id) { - if(!(theInventory instanceof ISidedInventory)) + if(tileEntity instanceof ISidedInventory) { - for(i = i - 1; i >= 0; i--) - { - if(theInventory.getStackInSlot(i) != null && id.modifies(theInventory.getStackInSlot(i))) - { - ItemStack toSend = theInventory.getStackInSlot(i).copy(); - return new InvStack(theInventory, i, toSend); - } - } - } - else { + ISidedInventory inventory = (ISidedInventory)tileEntity; + if(slots != null && slots.length != 0) { for(i = i - 1; i >= 0; i--) { int slotID = slots[i]; - if(theInventory.getStackInSlot(slotID) != null && id.modifies(theInventory.getStackInSlot(slotID))) + if(!inventory.getStackInSlot(slotID).isEmpty() && id.modifies(inventory.getStackInSlot(slotID))) { - ItemStack toSend = theInventory.getStackInSlot(slotID); + ItemStack toSend = inventory.getStackInSlot(slotID); - if(((ISidedInventory)theInventory).canExtractItem(slotID, toSend, side.getOpposite())) + if(((ISidedInventory)inventory).canExtractItem(slotID, toSend, side.getOpposite())) { - return new InvStack(theInventory, slotID, toSend); + return new InvStack(tileEntity, slotID, toSend, side.getOpposite()); } } } } } + else if(tileEntity instanceof IInventory) + { + IInventory inventory = InventoryUtils.checkChestInv((IInventory)tileEntity); + + for(i = i - 1; i >= 0; i--) + { + if(!inventory.getStackInSlot(i).isEmpty() && id.modifies(inventory.getStackInSlot(i))) + { + ItemStack toSend = inventory.getStackInSlot(i).copy(); + return new InvStack(tileEntity, i, toSend, side.getOpposite()); + } + } + } + else if(InventoryUtils.isItemHandler(tileEntity, side.getOpposite())) + { + IItemHandler inventory = InventoryUtils.getItemHandler(tileEntity, side.getOpposite()); + + for(i = i - 1; i >= 0; i--) + { + ItemStack stack = inventory.extractItem(i, 64, true); + + if(!stack.isEmpty() && id.modifies(stack)) + { + return new InvStack(tileEntity, i, stack, side.getOpposite()); + } + } + } return null; } public InvStack takeDefinedItem(ItemStack type, int min, int max) { - InvStack ret = new InvStack(theInventory); + InvStack ret = new InvStack(tileEntity, side.getOpposite()); - if(!(theInventory instanceof ISidedInventory)) + if(tileEntity instanceof ISidedInventory) { - for(i = i - 1; i >= 0; i--) - { - if(theInventory.getStackInSlot(i) != null && StackUtils.equalsWildcard(theInventory.getStackInSlot(i), type)) - { - ItemStack stack = theInventory.getStackInSlot(i); - int current = ret.getStack() != null ? ret.getStack().stackSize : 0; - - if(current+stack.stackSize <= max) - { - ret.appendStack(i, stack.copy()); - } - else { - ItemStack copy = stack.copy(); - copy.stackSize = max-current; - ret.appendStack(i, copy); - } - - if(ret.getStack() != null && ret.getStack().stackSize == max) - { - return ret; - } - } - } - } - else { - ISidedInventory sidedInventory = (ISidedInventory)theInventory; + ISidedInventory sidedInventory = (ISidedInventory)tileEntity; int[] slots = sidedInventory.getSlotsForFace(side.getOpposite()); if(slots != null && slots.length != 0) @@ -109,12 +110,12 @@ public class StackSearcher { int slotID = slots[i]; - if(sidedInventory.getStackInSlot(slotID) != null && StackUtils.equalsWildcard(theInventory.getStackInSlot(slotID), type)) + if(!sidedInventory.getStackInSlot(slotID).isEmpty() && StackUtils.equalsWildcard(sidedInventory.getStackInSlot(slotID), type)) { ItemStack stack = sidedInventory.getStackInSlot(slotID); - int current = ret.getStack() != null ? ret.getStack().stackSize : 0; + int current = !ret.getStack().isEmpty() ? ret.getStack().getCount() : 0; - if(current+stack.stackSize <= max) + if(current+stack.getCount() <= max) { ItemStack copy = stack.copy(); @@ -128,12 +129,12 @@ public class StackSearcher if(sidedInventory.canExtractItem(slotID, copy, side.getOpposite())) { - copy.stackSize = max-current; + copy.setCount(max-current); ret.appendStack(slotID, copy); } } - if(ret.getStack() != null && ret.getStack().stackSize == max) + if(!ret.getStack().isEmpty() && ret.getStack().getCount() == max) { return ret; } @@ -141,8 +142,65 @@ public class StackSearcher } } } + else if(tileEntity instanceof IInventory) + { + IInventory inventory = InventoryUtils.checkChestInv((IInventory)tileEntity); + + for(i = i - 1; i >= 0; i--) + { + if(!inventory.getStackInSlot(i).isEmpty() && StackUtils.equalsWildcard(inventory.getStackInSlot(i), type)) + { + ItemStack stack = inventory.getStackInSlot(i); + int current = !ret.getStack().isEmpty() ? ret.getStack().getCount() : 0; - if(ret != null && ret.getStack() != null && ret.getStack().stackSize >= min) + if(current+stack.getCount() <= max) + { + ret.appendStack(i, stack.copy()); + } + else { + ItemStack copy = stack.copy(); + copy.setCount(max-current); + ret.appendStack(i, copy); + } + + if(!ret.getStack().isEmpty() && ret.getStack().getCount() == max) + { + return ret; + } + } + } + } + else if(InventoryUtils.isItemHandler(tileEntity, side.getOpposite())) + { + IItemHandler inventory = InventoryUtils.getItemHandler(tileEntity, side.getOpposite()); + + for(i = i - 1; i >= 0; i--) + { + ItemStack stack = inventory.extractItem(i, max, true); + + if(!stack.isEmpty() && StackUtils.equalsWildcard(stack, type)) + { + int current = !ret.getStack().isEmpty() ? ret.getStack().getCount() : 0; + + if(current+stack.getCount() <= max) + { + ret.appendStack(i, stack.copy()); + } + else { + ItemStack copy = stack.copy(); + copy.setCount(max-current); + ret.appendStack(i, copy); + } + + if(!ret.getStack().isEmpty() && ret.getStack().getCount() == max) + { + return ret; + } + } + } + } + + if(ret != null && !ret.getStack().isEmpty() && ret.getStack().getCount() >= min) { return ret; } diff --git a/src/main/java/mekanism/common/content/transporter/TItemStackFilter.java b/src/main/java/mekanism/common/content/transporter/TItemStackFilter.java index d3ea5564d..6ff03ecdc 100644 --- a/src/main/java/mekanism/common/content/transporter/TItemStackFilter.java +++ b/src/main/java/mekanism/common/content/transporter/TItemStackFilter.java @@ -5,6 +5,7 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; import mekanism.common.content.transporter.Finder.ItemStackFinder; +import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -17,22 +18,25 @@ public class TItemStackFilter extends TransporterFilter public int min; public int max; - public ItemStack itemType; + public ItemStack itemType = ItemStack.EMPTY; @Override - public boolean canFilter(ItemStack itemStack) + public boolean canFilter(ItemStack itemStack, boolean strict) { - if(itemStack == null) + if(itemStack.isEmpty()) { return false; } - if(sizeMode && max == 0) + if(strict && sizeMode) { - return false; + if(max == 0 || itemStack.getCount() < min) + { + return false; + } } - return (itemType.getHasSubtypes() ? itemType.isItemEqual(itemStack) : itemType.getItem() == itemStack.getItem()) && (!sizeMode || itemStack.stackSize >= min); + return (itemType.getHasSubtypes() ? itemType.isItemEqual(itemStack) : itemType.getItem() == itemStack.getItem()); } @Override @@ -73,7 +77,7 @@ public class TItemStackFilter extends TransporterFilter min = nbtTags.getInteger("min"); max = nbtTags.getInteger("max"); - itemType = ItemStack.loadItemStackFromNBT(nbtTags); + itemType = InventoryUtils.loadFromNBT(nbtTags); } @Override @@ -88,7 +92,7 @@ public class TItemStackFilter extends TransporterFilter data.add(max); data.add(MekanismUtils.getID(itemType)); - data.add(itemType.stackSize); + data.add(itemType.getCount()); data.add(itemType.getItemDamage()); } @@ -110,7 +114,7 @@ public class TItemStackFilter extends TransporterFilter int code = 1; code = 31 * code + super.hashCode(); code = 31 * code + MekanismUtils.getID(itemType); - code = 31 * code + itemType.stackSize; + code = 31 * code + itemType.getCount(); code = 31 * code + itemType.getItemDamage(); code = 31 * code + (sizeMode ? 1 : 0); code = 31 * code + min; @@ -129,6 +133,7 @@ public class TItemStackFilter extends TransporterFilter public TItemStackFilter clone() { TItemStackFilter filter = new TItemStackFilter(); + filter.allowDefault = allowDefault; filter.color = color; filter.itemType = itemType.copy(); filter.sizeMode = sizeMode; diff --git a/src/main/java/mekanism/common/content/transporter/TMaterialFilter.java b/src/main/java/mekanism/common/content/transporter/TMaterialFilter.java index 792db9c1d..c581023d8 100644 --- a/src/main/java/mekanism/common/content/transporter/TMaterialFilter.java +++ b/src/main/java/mekanism/common/content/transporter/TMaterialFilter.java @@ -5,6 +5,7 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; import mekanism.common.content.transporter.Finder.MaterialFinder; +import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -15,7 +16,7 @@ import net.minecraft.nbt.NBTTagCompound; public class TMaterialFilter extends TransporterFilter { - public ItemStack materialItem; + public ItemStack materialItem = ItemStack.EMPTY; public Material getMaterial() { @@ -23,9 +24,9 @@ public class TMaterialFilter extends TransporterFilter } @Override - public boolean canFilter(ItemStack itemStack) + public boolean canFilter(ItemStack itemStack, boolean strict) { - if(itemStack == null || !(itemStack.getItem() instanceof ItemBlock)) + if(itemStack.isEmpty() || !(itemStack.getItem() instanceof ItemBlock)) { return false; } @@ -53,7 +54,7 @@ public class TMaterialFilter extends TransporterFilter { super.read(nbtTags); - materialItem = ItemStack.loadItemStackFromNBT(nbtTags); + materialItem = InventoryUtils.loadFromNBT(nbtTags); } @Override @@ -64,7 +65,7 @@ public class TMaterialFilter extends TransporterFilter super.write(data); data.add(MekanismUtils.getID(materialItem)); - data.add(materialItem.stackSize); + data.add(materialItem.getCount()); data.add(materialItem.getItemDamage()); } @@ -81,7 +82,7 @@ public class TMaterialFilter extends TransporterFilter { int code = 1; code = 31 * code + MekanismUtils.getID(materialItem); - code = 31 * code + materialItem.stackSize; + code = 31 * code + materialItem.getCount(); code = 31 * code + materialItem.getItemDamage(); return code; } @@ -96,6 +97,8 @@ public class TMaterialFilter extends TransporterFilter public TMaterialFilter clone() { TMaterialFilter filter = new TMaterialFilter(); + filter.allowDefault = allowDefault; + filter.color = color; filter.materialItem = materialItem; return filter; diff --git a/src/main/java/mekanism/common/content/transporter/TModIDFilter.java b/src/main/java/mekanism/common/content/transporter/TModIDFilter.java index 5d62a3b3c..1c8e23e55 100644 --- a/src/main/java/mekanism/common/content/transporter/TModIDFilter.java +++ b/src/main/java/mekanism/common/content/transporter/TModIDFilter.java @@ -14,9 +14,9 @@ public class TModIDFilter extends TransporterFilter public String modID; @Override - public boolean canFilter(ItemStack itemStack) + public boolean canFilter(ItemStack itemStack, boolean strict) { - if(itemStack == null) + if(itemStack.isEmpty()) { return false; } @@ -84,6 +84,7 @@ public class TModIDFilter extends TransporterFilter public TModIDFilter clone() { TModIDFilter filter = new TModIDFilter(); + filter.allowDefault = allowDefault; filter.color = color; filter.modID = modID; diff --git a/src/main/java/mekanism/common/content/transporter/TOreDictFilter.java b/src/main/java/mekanism/common/content/transporter/TOreDictFilter.java index 874256d86..59a3272fe 100644 --- a/src/main/java/mekanism/common/content/transporter/TOreDictFilter.java +++ b/src/main/java/mekanism/common/content/transporter/TOreDictFilter.java @@ -14,9 +14,9 @@ public class TOreDictFilter extends TransporterFilter public String oreDictName; @Override - public boolean canFilter(ItemStack itemStack) + public boolean canFilter(ItemStack itemStack, boolean strict) { - if(itemStack == null) + if(itemStack.isEmpty()) { return false; } @@ -84,6 +84,7 @@ public class TOreDictFilter extends TransporterFilter public TOreDictFilter clone() { TOreDictFilter filter = new TOreDictFilter(); + filter.allowDefault = allowDefault; filter.color = color; filter.oreDictName = oreDictName; diff --git a/src/main/java/mekanism/common/content/transporter/TransitRequest.java b/src/main/java/mekanism/common/content/transporter/TransitRequest.java new file mode 100644 index 000000000..50939a81f --- /dev/null +++ b/src/main/java/mekanism/common/content/transporter/TransitRequest.java @@ -0,0 +1,157 @@ +package mekanism.common.content.transporter; + +import java.util.HashMap; +import java.util.Map; + +import mekanism.common.content.transporter.Finder.FirstFinder; +import mekanism.common.util.InventoryUtils; +import mekanism.common.util.StackUtils; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.items.IItemHandler; + +public class TransitRequest +{ + public Map itemMap = new HashMap<>(); + + public boolean isEmpty() + { + return itemMap.isEmpty(); + } + + public void setItem(ItemStack stack, int slot) + { + itemMap.put(stack, slot); + } + + public ItemStack getSingleStack() + { + return itemMap.keySet().iterator().next(); + } + + public boolean hasType(ItemStack stack) + { + for(ItemStack s : itemMap.keySet()) + { + if(InventoryUtils.areItemsStackable(stack, s)) + { + return true; + } + } + + return false; + } + + public static TransitRequest getFromTransport(TransporterStack stack) + { + return getFromStack(stack.itemStack); + } + + public static TransitRequest getFromStack(ItemStack stack) + { + TransitRequest ret = new TransitRequest(); + ret.setItem(stack, -1); + return ret; + } + + public static TransitRequest getTopStacks(TileEntity tile, EnumFacing side, int amount) + { + return getTopStacks(tile, side, amount, new FirstFinder()); + } + + public static TransitRequest getTopStacks(TileEntity tile, EnumFacing side, int amount, Finder finder) + { + TransitRequest ret = new TransitRequest(); + + if(tile instanceof ISidedInventory) + { + ISidedInventory sidedInventory = (ISidedInventory)tile; + int[] slots = sidedInventory.getSlotsForFace(side.getOpposite()); + + if(slots != null) + { + for(int get = slots.length - 1; get >= 0; get--) + { + int slotID = slots[get]; + + if(!sidedInventory.getStackInSlot(slotID).isEmpty() && sidedInventory.getStackInSlot(slotID).getCount() > 0) + { + ItemStack toSend = sidedInventory.getStackInSlot(slotID).copy(); + toSend.setCount(Math.min(amount, toSend.getCount())); + + if(!ret.hasType(toSend) && sidedInventory.canExtractItem(slotID, toSend, side.getOpposite()) && finder.modifies(toSend)) + { + ret.setItem(toSend, slotID); + } + } + } + } + } + else if(tile instanceof IInventory) + { + IInventory inventory = InventoryUtils.checkChestInv((IInventory)tile); + + for(int i = inventory.getSizeInventory() - 1; i >= 0; i--) + { + if(!inventory.getStackInSlot(i).isEmpty() && inventory.getStackInSlot(i).getCount() > 0) + { + ItemStack toSend = inventory.getStackInSlot(i).copy(); + toSend.setCount(Math.min(amount, toSend.getCount())); + + if(!ret.hasType(toSend) && finder.modifies(toSend)) + { + ret.setItem(toSend, i); + } + } + } + } + else if(InventoryUtils.isItemHandler(tile, side.getOpposite())) + { + IItemHandler inventory = InventoryUtils.getItemHandler(tile, side.getOpposite()); + + for(int i = inventory.getSlots() - 1; i >= 0; i--) + { + ItemStack stack = inventory.extractItem(i, amount, true); + + if(!stack.isEmpty() && !ret.hasType(stack) && finder.modifies(stack)) + { + ret.setItem(stack, i); + } + } + } + + return ret; + } + + public static class TransitResponse + { + public static final TransitResponse EMPTY = new TransitResponse(-1, ItemStack.EMPTY); + + public int slotID; + public ItemStack stack = ItemStack.EMPTY; + + public TransitResponse(int s, ItemStack i) + { + slotID = s; + stack = i; + } + + public boolean isEmpty() + { + return stack.isEmpty(); + } + + public ItemStack getRejected(ItemStack orig) + { + return StackUtils.size(orig, orig.getCount() - stack.getCount()); + } + + public InvStack getInvStack(TileEntity tile, EnumFacing side) + { + return new InvStack(tile, slotID, stack, side); + } + } +} diff --git a/src/main/java/mekanism/common/content/transporter/TransporterFilter.java b/src/main/java/mekanism/common/content/transporter/TransporterFilter.java index 8450f3f92..c30eb9405 100644 --- a/src/main/java/mekanism/common/content/transporter/TransporterFilter.java +++ b/src/main/java/mekanism/common/content/transporter/TransporterFilter.java @@ -18,8 +18,10 @@ public abstract class TransporterFilter public static final List SPECIAL_CHARS = Arrays.asList('*', '-', ' ', '|', '_', '\''); public EnumColor color; + + public boolean allowDefault; - public abstract boolean canFilter(ItemStack itemStack); + public abstract boolean canFilter(ItemStack itemStack, boolean strict); public abstract Finder getFinder(); @@ -30,6 +32,8 @@ public abstract class TransporterFilter public void write(NBTTagCompound nbtTags) { + nbtTags.setBoolean("allowDefault", allowDefault); + if(color != null) { nbtTags.setInteger("color", TransporterUtils.colors.indexOf(color)); @@ -38,6 +42,8 @@ public abstract class TransporterFilter protected void read(NBTTagCompound nbtTags) { + allowDefault = nbtTags.getBoolean("allowDefault"); + if(nbtTags.hasKey("color")) { color = TransporterUtils.colors.get(nbtTags.getInteger("color")); @@ -46,6 +52,8 @@ public abstract class TransporterFilter public void write(ArrayList data) { + data.add(allowDefault); + if(color != null) { data.add(TransporterUtils.colors.indexOf(color)); @@ -57,6 +65,8 @@ public abstract class TransporterFilter protected void read(ByteBuf dataStream) { + allowDefault = dataStream.readBoolean(); + int c = dataStream.readInt(); if(c != -1) diff --git a/src/main/java/mekanism/common/content/transporter/TransporterManager.java b/src/main/java/mekanism/common/content/transporter/TransporterManager.java index 0d81f4cc1..ca9cd31ed 100644 --- a/src/main/java/mekanism/common/content/transporter/TransporterManager.java +++ b/src/main/java/mekanism/common/content/transporter/TransporterManager.java @@ -9,19 +9,21 @@ import java.util.Set; import mekanism.api.Coord4D; import mekanism.api.EnumColor; -import mekanism.api.util.StackUtils; import mekanism.common.base.ISideConfiguration; +import mekanism.common.content.transporter.TransitRequest.TransitResponse; import mekanism.common.content.transporter.TransporterStack.Path; import mekanism.common.tile.TileEntityBin; import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.StackUtils; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.fml.common.Loader; -import powercrystals.minefactoryreloaded.api.IDeepStorageUnit; +import net.minecraftforge.items.IItemHandler; public class TransporterManager { @@ -74,18 +76,28 @@ public class TransporterManager return ret; } + + public static InventoryCopy copyInv(IItemHandler handler) + { + NonNullList ret = NonNullList.withSize(handler.getSlots(), ItemStack.EMPTY); + + for(int i = 0; i < handler.getSlots(); i++) + { + ret.set(i, handler.getStackInSlot(i)); + } + + return new InventoryCopy(ret); + } public static InventoryCopy copyInvFromSide(IInventory inv, EnumFacing side) { - inv = InventoryUtils.checkChestInv(inv); - - ItemStack[] ret = new ItemStack[inv.getSizeInventory()]; + NonNullList ret = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY); if(!(inv instanceof ISidedInventory)) { for(int i = 0; i <= inv.getSizeInventory() - 1; i++) { - ret[i] = inv.getStackInSlot(i) != null ? inv.getStackInSlot(i).copy() : null; + ret.set(i, !inv.getStackInSlot(i).isEmpty() ? inv.getStackInSlot(i).copy() : ItemStack.EMPTY); } } else { @@ -101,7 +113,7 @@ public class TransporterManager { int slotID = slots[get]; - ret[slotID] = sidedInventory.getStackInSlot(slotID) != null ? sidedInventory.getStackInSlot(slotID).copy() : null; + ret.set(slotID, !sidedInventory.getStackInSlot(slotID).isEmpty() ? sidedInventory.getStackInSlot(slotID).copy() : ItemStack.EMPTY); } if(inv instanceof TileEntityBin) @@ -116,13 +128,13 @@ public class TransporterManager return new InventoryCopy(ret); } - public static void testInsert(IInventory inv, InventoryCopy copy, EnumFacing side, TransporterStack stack) + public static void testInsert(TileEntity tile, InventoryCopy copy, EnumFacing side, TransporterStack stack) { ItemStack toInsert = stack.itemStack.copy(); - if(stack.pathType != Path.HOME && inv instanceof ISideConfiguration) + if(stack.pathType != Path.HOME && tile instanceof ISideConfiguration) { - ISideConfiguration config = (ISideConfiguration)inv; + ISideConfiguration config = (ISideConfiguration)tile; EnumFacing tileSide = config.getOrientation(); EnumColor configColor = config.getEjector().getInputColor(MekanismUtils.getBaseOrientation(side, tileSide).getOpposite()); @@ -132,76 +144,14 @@ public class TransporterManager } } - if(Loader.isModLoaded("MinefactoryReloaded") && inv instanceof IDeepStorageUnit && !(inv instanceof TileEntityBin)) +// if(Loader.isModLoaded("MinefactoryReloaded") && tile instanceof IDeepStorageUnit && !(tile instanceof TileEntityBin)) +// { +// return; +// } + + if(tile instanceof ISidedInventory) { - return; - } - - if(!(inv instanceof ISidedInventory)) - { - for(int i = 0; i <= inv.getSizeInventory() - 1; i++) - { - if(stack.pathType != Path.HOME) - { - if(!inv.isItemValidForSlot(i, toInsert)) - { - continue; - } - } - - ItemStack inSlot = copy.inventory[i]; - - if(inSlot == null) - { - if(toInsert.stackSize <= inv.getInventoryStackLimit()) - { - copy.inventory[i] = toInsert; - return; - } - else { - int rejects = toInsert.stackSize - inv.getInventoryStackLimit(); - - ItemStack toSet = toInsert.copy(); - toSet.stackSize = inv.getInventoryStackLimit(); - - ItemStack remains = toInsert.copy(); - remains.stackSize = rejects; - - copy.inventory[i] = toSet; - - toInsert = remains; - } - } - else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inv.getInventoryStackLimit())) - { - int max = Math.min(inSlot.getMaxStackSize(), inv.getInventoryStackLimit()); - - if(inSlot.stackSize + toInsert.stackSize <= max) - { - ItemStack toSet = toInsert.copy(); - toSet.stackSize += inSlot.stackSize; - - copy.inventory[i] = toSet; - return; - } - else { - int rejects = (inSlot.stackSize + toInsert.stackSize) - max; - - ItemStack toSet = toInsert.copy(); - toSet.stackSize = max; - - ItemStack remains = toInsert.copy(); - remains.stackSize = rejects; - - copy.inventory[i] = toSet; - - toInsert = remains; - } - } - } - } - else { - ISidedInventory sidedInventory = (ISidedInventory)inv; + ISidedInventory sidedInventory = (ISidedInventory)tile; int[] slots = sidedInventory.getSlotsForFace(side.getOpposite()); if(slots != null && slots.length != 0) @@ -211,7 +161,7 @@ public class TransporterManager slots = sidedInventory.getSlotsForFace(EnumFacing.UP); } - if(inv instanceof TileEntityBin) + if(tile instanceof TileEntityBin) { int slot = slots[0]; @@ -220,8 +170,8 @@ public class TransporterManager return; } - int amountRemaining = ((TileEntityBin)inv).getMaxStoredCount()-copy.binAmount; - copy.binAmount += Math.min(amountRemaining, toInsert.stackSize); + int amountRemaining = ((TileEntityBin)sidedInventory).getMaxStoredCount()-copy.binAmount; + copy.binAmount += Math.min(amountRemaining, toInsert.getCount()); return; } @@ -238,51 +188,51 @@ public class TransporterManager } } - ItemStack inSlot = copy.inventory[slotID]; + ItemStack inSlot = copy.inventory.get(slotID); - if(inSlot == null) + if(inSlot.isEmpty()) { - if(toInsert.stackSize <= inv.getInventoryStackLimit()) + if(toInsert.getCount() <= sidedInventory.getInventoryStackLimit()) { - copy.inventory[slotID] = toInsert; + copy.inventory.set(slotID, toInsert); return; } else { - int rejects = toInsert.stackSize - inv.getInventoryStackLimit(); + int rejects = toInsert.getCount() - sidedInventory.getInventoryStackLimit(); ItemStack toSet = toInsert.copy(); - toSet.stackSize = inv.getInventoryStackLimit(); + toSet.setCount(sidedInventory.getInventoryStackLimit()); ItemStack remains = toInsert.copy(); - remains.stackSize = rejects; + remains.setCount(rejects); - copy.inventory[slotID] = toSet; + copy.inventory.set(slotID, toSet); toInsert = remains; } } - else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inv.getInventoryStackLimit())) + else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.getCount() < Math.min(inSlot.getMaxStackSize(), sidedInventory.getInventoryStackLimit())) { - int max = Math.min(inSlot.getMaxStackSize(), inv.getInventoryStackLimit()); + int max = Math.min(inSlot.getMaxStackSize(), sidedInventory.getInventoryStackLimit()); - if(inSlot.stackSize + toInsert.stackSize <= max) + if(inSlot.getCount() + toInsert.getCount() <= max) { ItemStack toSet = toInsert.copy(); - toSet.stackSize += inSlot.stackSize; + toSet.grow(inSlot.getCount()); - copy.inventory[slotID] = toSet; + copy.inventory.set(slotID, toSet); return; } else { - int rejects = (inSlot.stackSize + toInsert.stackSize) - max; + int rejects = (inSlot.getCount() + toInsert.getCount()) - max; ItemStack toSet = toInsert.copy(); - toSet.stackSize = max; + toSet.setCount(max); ItemStack remains = toInsert.copy(); - remains.stackSize = rejects; + remains.setCount(rejects); - copy.inventory[slotID] = toSet; + copy.inventory.set(slotID, toSet); toInsert = remains; } @@ -291,33 +241,165 @@ public class TransporterManager } } } + else if(tile instanceof IInventory) + { + IInventory inv = InventoryUtils.checkChestInv((IInventory)tile); + + for(int i = 0; i <= inv.getSizeInventory() - 1; i++) + { + if(stack.pathType != Path.HOME) + { + if(!inv.isItemValidForSlot(i, toInsert)) + { + continue; + } + } + + ItemStack inSlot = copy.inventory.get(i); + + if(inSlot.isEmpty()) + { + if(toInsert.getCount() <= inv.getInventoryStackLimit()) + { + copy.inventory.set(i, toInsert); + return; + } + else { + int rejects = toInsert.getCount() - inv.getInventoryStackLimit(); + + ItemStack toSet = toInsert.copy(); + toSet.setCount(inv.getInventoryStackLimit()); + + ItemStack remains = toInsert.copy(); + remains.setCount(rejects); + + copy.inventory.set(i, toSet); + + toInsert = remains; + } + } + else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.getCount() < Math.min(inSlot.getMaxStackSize(), inv.getInventoryStackLimit())) + { + int max = Math.min(inSlot.getMaxStackSize(), inv.getInventoryStackLimit()); + + if(inSlot.getCount() + toInsert.getCount() <= max) + { + ItemStack toSet = toInsert.copy(); + toSet.grow(inSlot.getCount()); + + copy.inventory.set(i, toSet); + return; + } + else { + int rejects = (inSlot.getCount() + toInsert.getCount()) - max; + + ItemStack toSet = toInsert.copy(); + toSet.setCount(max); + + ItemStack remains = toInsert.copy(); + remains.setCount(rejects); + + copy.inventory.set(i, toSet); + + toInsert = remains; + } + } + } + } + else if(InventoryUtils.isItemHandler(tile, side.getOpposite())) + { + IItemHandler inv = InventoryUtils.getItemHandler(tile, side.getOpposite()); + + for(int i = 0; i <= inv.getSlots() - 1; i++) + { + if(stack.pathType != Path.HOME) + { + ItemStack rejectStack = inv.insertItem(i, toInsert, true); + + if(!TransporterManager.didEmit(toInsert, rejectStack)) + { + continue; + } + } + + ItemStack inSlot = copy.inventory.get(i); + + if(inSlot.isEmpty()) + { + if(toInsert.getCount() <= inv.getSlotLimit(i)) + { + copy.inventory.set(i, toInsert); + return; + } + else { + int rejects = toInsert.getCount() - inv.getSlotLimit(i); + + ItemStack toSet = toInsert.copy(); + toSet.setCount(inv.getSlotLimit(i)); + + ItemStack remains = toInsert.copy(); + remains.setCount(rejects); + + copy.inventory.set(i, toSet); + + toInsert = remains; + } + } + else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.getCount() < Math.min(inSlot.getMaxStackSize(), inv.getSlotLimit(i))) + { + int max = Math.min(inSlot.getMaxStackSize(), inv.getSlotLimit(i)); + + if(inSlot.getCount() + toInsert.getCount() <= max) + { + ItemStack toSet = toInsert.copy(); + toSet.grow(inSlot.getCount()); + + copy.inventory.set(i, toSet); + return; + } + else { + int rejects = (inSlot.getCount() + toInsert.getCount()) - max; + + ItemStack toSet = toInsert.copy(); + toSet.setCount(max); + + ItemStack remains = toInsert.copy(); + remains.setCount(rejects); + + copy.inventory.set(i, toSet); + + toInsert = remains; + } + } + } + } } public static boolean didEmit(ItemStack stack, ItemStack returned) { - return returned == null || returned.stackSize < stack.stackSize; + return returned.isEmpty() || returned.getCount() < stack.getCount(); } public static ItemStack getToUse(ItemStack stack, ItemStack returned) { - if(returned == null || returned.stackSize == 0) + if(returned.isEmpty() || returned.getCount() == 0) { return stack; } - return MekanismUtils.size(stack, stack.stackSize-returned.stackSize); + return MekanismUtils.size(stack, stack.getCount()-returned.getCount()); + } + + public static ItemStack getToUse(ItemStack stack, int rejected) + { + return MekanismUtils.size(stack, stack.getCount()-rejected); } /** - * @return rejects + * @return TransitResponse of expected items to use */ - public static ItemStack getPredictedInsert(TileEntity tileEntity, EnumColor color, ItemStack itemStack, EnumFacing side) + public static TransitResponse getPredictedInsert(TileEntity tileEntity, EnumColor color, TransitRequest request, EnumFacing side) { - if(!(tileEntity instanceof IInventory)) - { - return itemStack; - } - if(tileEntity instanceof ISideConfiguration) { ISideConfiguration config = (ISideConfiguration)tileEntity; @@ -326,171 +408,254 @@ public class TransporterManager if(config.getEjector().hasStrictInput() && configColor != null && configColor != color) { - return itemStack; + return TransitResponse.EMPTY; } } - IInventory inventory = (IInventory)tileEntity; - InventoryCopy copy = copyInvFromSide(inventory, side); + InventoryCopy copy = null; + + if(tileEntity instanceof IInventory) + { + copy = copyInvFromSide(InventoryUtils.checkChestInv((IInventory)tileEntity), side); + } + else if(InventoryUtils.isItemHandler(tileEntity, side.getOpposite())) + { + copy = copyInv(InventoryUtils.getItemHandler(tileEntity, side.getOpposite())); + } if(copy == null) { - return itemStack; + return TransitResponse.EMPTY; } List insertQueue = getStacksToDest(Coord4D.get(tileEntity)); for(TransporterStack tStack : insertQueue) { - testInsert(inventory, copy, side, tStack); + testInsert(tileEntity, copy, side, tStack); } - ItemStack toInsert = itemStack.copy(); - - if(!(inventory instanceof ISidedInventory)) + for(Map.Entry requestEntry : request.itemMap.entrySet()) { - inventory = InventoryUtils.checkChestInv(inventory); - - for(int i = 0; i <= inventory.getSizeInventory() - 1; i++) - { - if(!inventory.isItemValidForSlot(i, toInsert)) - { - continue; - } - - ItemStack inSlot = copy.inventory[i]; - - if(toInsert == null) - { - return null; - } - else if(inSlot == null) - { - if(toInsert.stackSize <= inventory.getInventoryStackLimit()) - { - return null; - } - else { - int rejects = toInsert.stackSize - inventory.getInventoryStackLimit(); - - if(rejects < toInsert.stackSize) - { - toInsert = StackUtils.size(toInsert, rejects); - } - } - } - else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit())) - { - int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()); - - if(inSlot.stackSize + toInsert.stackSize <= max) - { - return null; - } - else { - int rejects = (inSlot.stackSize + toInsert.stackSize) - max; - - if(rejects < toInsert.stackSize) - { - toInsert = StackUtils.size(toInsert, rejects); - } - } - } - } - } - else { - ISidedInventory sidedInventory = (ISidedInventory)inventory; - int[] slots = sidedInventory.getSlotsForFace(side.getOpposite()); - - if(slots != null && slots.length != 0) - { - if(inventory instanceof TileEntityBin) - { - int slot = slots[0]; - - if(!sidedInventory.isItemValidForSlot(slot, toInsert) || !sidedInventory.canInsertItem(slot, toInsert, side.getOpposite())) - { - return toInsert; - } - - int amountRemaining = ((TileEntityBin)inventory).getMaxStoredCount()-copy.binAmount; - - if(toInsert.stackSize <= amountRemaining) - { - return null; - } - else { - return StackUtils.size(toInsert, toInsert.stackSize-amountRemaining); - } - } - else { - for(int get = 0; get <= slots.length - 1; get++) - { - int slotID = slots[get]; + ItemStack toInsert = requestEntry.getKey().copy(); - if(!sidedInventory.isItemValidForSlot(slotID, toInsert) || !sidedInventory.canInsertItem(slotID, toInsert, side.getOpposite())) + if(tileEntity instanceof ISidedInventory) + { + ISidedInventory sidedInventory = (ISidedInventory)tileEntity; + int[] slots = sidedInventory.getSlotsForFace(side.getOpposite()); + + if(slots != null && slots.length != 0) + { + if(tileEntity instanceof TileEntityBin) + { + int slot = slots[0]; + + if(!sidedInventory.isItemValidForSlot(slot, toInsert) || !sidedInventory.canInsertItem(slot, toInsert, side.getOpposite())) { continue; } - - ItemStack inSlot = copy.inventory[slotID]; - if(toInsert == null) + int amountRemaining = ((TileEntityBin)tileEntity).getMaxStoredCount()-copy.binAmount; + ItemStack ret = null; + + if(toInsert.getCount() <= amountRemaining) { - return null; + ret = toInsert; } - else if(inSlot == null) + else { + ret = StackUtils.size(toInsert, amountRemaining); + } + + return new TransitResponse(requestEntry.getValue(), ret); + } + else { + for(int get = 0; get <= slots.length - 1; get++) { - if(toInsert.stackSize <= inventory.getInventoryStackLimit()) + int slotID = slots[get]; + + if(!sidedInventory.isItemValidForSlot(slotID, toInsert) || !sidedInventory.canInsertItem(slotID, toInsert, side.getOpposite())) { - return null; + continue; } - else { - int rejects = toInsert.stackSize - inventory.getInventoryStackLimit(); - - if(rejects < toInsert.stackSize) - { - toInsert = StackUtils.size(toInsert, rejects); - } - } - } - else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit())) - { - int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()); + + ItemStack inSlot = copy.inventory.get(slotID); - if(inSlot.stackSize + toInsert.stackSize <= max) + if(toInsert.isEmpty()) { - return null; + return new TransitResponse(requestEntry.getValue(), requestEntry.getKey()); } - else { - int rejects = (inSlot.stackSize + toInsert.stackSize) - max; - - if(rejects < toInsert.stackSize) + else if(inSlot.isEmpty()) + { + if(toInsert.getCount() <= sidedInventory.getInventoryStackLimit()) { - toInsert = StackUtils.size(toInsert, rejects); + return new TransitResponse(requestEntry.getValue(), requestEntry.getKey()); + } + else { + int rejects = toInsert.getCount() - sidedInventory.getInventoryStackLimit(); + + if(rejects < toInsert.getCount()) + { + toInsert = StackUtils.size(toInsert, rejects); + } } } + else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.getCount() < Math.min(inSlot.getMaxStackSize(), sidedInventory.getInventoryStackLimit())) + { + int max = Math.min(inSlot.getMaxStackSize(), sidedInventory.getInventoryStackLimit()); + + if(inSlot.getCount() + toInsert.getCount() <= max) + { + return new TransitResponse(requestEntry.getValue(), requestEntry.getKey()); + } + else { + int rejects = (inSlot.getCount() + toInsert.getCount()) - max; + + if(rejects < toInsert.getCount()) + { + toInsert = StackUtils.size(toInsert, rejects); + } + } + } + } + + if(TransporterManager.didEmit(requestEntry.getKey(), toInsert)) + { + return new TransitResponse(requestEntry.getValue(), getToUse(requestEntry.getKey(), toInsert)); } } } } + else if(tileEntity instanceof IInventory) + { + IInventory inventory = InventoryUtils.checkChestInv((IInventory)tileEntity); + + for(int i = 0; i <= inventory.getSizeInventory() - 1; i++) + { + if(!inventory.isItemValidForSlot(i, toInsert)) + { + continue; + } + + ItemStack inSlot = copy.inventory.get(i); + + if(toInsert.isEmpty()) + { + return new TransitResponse(requestEntry.getValue(), requestEntry.getKey()); + } + else if(inSlot.isEmpty()) + { + if(toInsert.getCount() <= inventory.getInventoryStackLimit()) + { + return new TransitResponse(requestEntry.getValue(), requestEntry.getKey()); + } + else { + int rejects = toInsert.getCount() - inventory.getInventoryStackLimit(); + + if(rejects < toInsert.getCount()) + { + toInsert = StackUtils.size(toInsert, rejects); + } + } + } + else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.getCount() < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit())) + { + int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()); + + if(inSlot.getCount() + toInsert.getCount() <= max) + { + return new TransitResponse(requestEntry.getValue(), requestEntry.getKey()); + } + else { + int rejects = (inSlot.getCount() + toInsert.getCount()) - max; + + if(rejects < toInsert.getCount()) + { + toInsert = StackUtils.size(toInsert, rejects); + } + } + } + } + + if(TransporterManager.didEmit(requestEntry.getKey(), toInsert)) + { + return new TransitResponse(requestEntry.getValue(), getToUse(requestEntry.getKey(), toInsert)); + } + } + else if(InventoryUtils.isItemHandler(tileEntity, side.getOpposite())) + { + IItemHandler inventory = InventoryUtils.getItemHandler(tileEntity, side.getOpposite()); + + for(int i = 0; i <= inventory.getSlots() - 1; i++) + { + ItemStack rejectStack = inventory.insertItem(i, toInsert, true); + + if(!TransporterManager.didEmit(toInsert, rejectStack)) + { + continue; + } + + ItemStack inSlot = copy.inventory.get(i); + + if(toInsert.isEmpty()) + { + return new TransitResponse(requestEntry.getValue(), requestEntry.getKey()); + } + else if(inSlot.isEmpty()) + { + if(toInsert.getCount() <= inventory.getSlotLimit(i)) + { + return new TransitResponse(requestEntry.getValue(), requestEntry.getKey()); + } + else { + int rejects = toInsert.getCount() - inventory.getSlotLimit(i); + + if(rejects < toInsert.getCount()) + { + toInsert = StackUtils.size(toInsert, rejects); + } + } + } + else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.getCount() < Math.min(inSlot.getMaxStackSize(), inventory.getSlotLimit(i))) + { + int max = Math.min(inSlot.getMaxStackSize(), inventory.getSlotLimit(i)); + + if(inSlot.getCount() + toInsert.getCount() <= max) + { + return new TransitResponse(requestEntry.getValue(), requestEntry.getKey()); + } + else { + int rejects = (inSlot.getCount() + toInsert.getCount()) - max; + + if(rejects < toInsert.getCount()) + { + toInsert = StackUtils.size(toInsert, rejects); + } + } + } + } + + if(TransporterManager.didEmit(requestEntry.getKey(), toInsert)) + { + return new TransitResponse(requestEntry.getValue(), getToUse(requestEntry.getKey(), toInsert)); + } + } } - return toInsert; + return TransitResponse.EMPTY; } public static class InventoryCopy { - public ItemStack[] inventory; + public NonNullList inventory; public int binAmount; - public InventoryCopy(ItemStack[] inv) + public InventoryCopy(NonNullList inv) { inventory = inv; } - public InventoryCopy(ItemStack[] inv, int amount) + public InventoryCopy(NonNullList inv, int amount) { this(inv); binAmount = amount; diff --git a/src/main/java/mekanism/common/content/transporter/TransporterPathfinder.java b/src/main/java/mekanism/common/content/transporter/TransporterPathfinder.java index 3c9561a44..9cd40e355 100644 --- a/src/main/java/mekanism/common/content/transporter/TransporterPathfinder.java +++ b/src/main/java/mekanism/common/content/transporter/TransporterPathfinder.java @@ -10,15 +10,16 @@ import java.util.Map; import java.util.Set; import mekanism.api.Coord4D; -import mekanism.api.util.CapabilityUtils; -import mekanism.common.InventoryNetwork; -import mekanism.common.InventoryNetwork.AcceptorData; import mekanism.common.base.ILogisticalTransporter; import mekanism.common.capabilities.Capabilities; import mekanism.common.content.transporter.PathfinderCache.PathData; +import mekanism.common.content.transporter.TransitRequest.TransitResponse; import mekanism.common.content.transporter.TransporterPathfinder.Pathfinder.DestChecker; import mekanism.common.content.transporter.TransporterStack.Path; import mekanism.common.tile.TileEntityLogisticalSorter; +import mekanism.common.transmitters.grid.InventoryNetwork; +import mekanism.common.transmitters.grid.InventoryNetwork.AcceptorData; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.InventoryUtils; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -73,9 +74,10 @@ public final class TransporterPathfinder return new Destination(ret, true, null, 0).setPathType(Path.NONE); } else { - Destination newPath = TransporterPathfinder.getNewBasePath(CapabilityUtils.getCapability(start.getTileEntity(worldObj), Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, null), transportStack, 0); + TransitRequest request = TransitRequest.getFromTransport(transportStack); + Destination newPath = TransporterPathfinder.getNewBasePath(CapabilityUtils.getCapability(start.getTileEntity(worldObj), Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, null), transportStack, request, 0); - if(newPath != null && TransporterManager.didEmit(transportStack.itemStack, newPath.rejected)) + if(newPath != null && newPath.response != null) { transportStack.idleDir = null; newPath.setPathType(Path.DEST); @@ -159,10 +161,10 @@ public final class TransporterPathfinder { public List path; public Path pathType; - public ItemStack rejected; + public TransitResponse response; public double score; - public Destination(List list, boolean inv, ItemStack rejects, double gScore) + public Destination(List list, boolean inv, TransitResponse ret, double gScore) { path = new ArrayList<>(list); @@ -171,7 +173,7 @@ public final class TransporterPathfinder Collections.reverse(path); } - rejected = rejects; + response = ret; score = gScore; } @@ -229,7 +231,7 @@ public final class TransporterPathfinder } } - public static List getPaths(ILogisticalTransporter start, TransporterStack stack, int min) + public static List getPaths(ILogisticalTransporter start, TransporterStack stack, TransitRequest request, int min) { List paths = new ArrayList(); InventoryNetwork network = start.getTransmitterNetwork(); @@ -239,7 +241,7 @@ public final class TransporterPathfinder return paths; } - List acceptors = network.calculateAcceptors(stack.itemStack, stack.color); + List acceptors = network.calculateAcceptors(request, stack.color); for(AcceptorData entry : acceptors) { @@ -248,11 +250,11 @@ public final class TransporterPathfinder @Override public boolean isValid(TransporterStack stack, EnumFacing dir, TileEntity tile) { - return InventoryUtils.canInsert(tile, stack.color, stack.itemStack, dir, false); + return InventoryUtils.canInsert(tile, stack.color, entry.response.stack, dir, false); } }; - Destination d = getPath(checker, entry.sides, start, entry.location, stack, entry.rejected, min); + Destination d = getPath(checker, entry.sides, start, entry.location, stack, entry.response, min); if(d != null) { @@ -287,33 +289,33 @@ public final class TransporterPathfinder return true; } - public static Destination getPath(DestChecker checker, EnumSet sides, ILogisticalTransporter start, Coord4D dest, TransporterStack stack, ItemStack rejects, int min) + public static Destination getPath(DestChecker checker, EnumSet sides, ILogisticalTransporter start, Coord4D dest, TransporterStack stack, TransitResponse response, int min) { - List test = PathfinderCache.getCache(start.coord(), dest, sides); - - if(test != null && checkPath(start.world(), test, stack)) + if(response.stack.getCount() >= min) { - return new Destination(test, false, rejects, 0).calculateScore(start.world()); - } - - Pathfinder p = new Pathfinder(checker, start.world(), dest, start.coord(), stack); - - if(p.getPath().size() >= 2) - { - if(TransporterManager.getToUse(stack.itemStack, rejects).stackSize >= min) + List test = PathfinderCache.getCache(start.coord(), dest, sides); + + if(test != null && checkPath(start.world(), test, stack)) + { + return new Destination(test, false, response, 0).calculateScore(start.world()); + } + + Pathfinder p = new Pathfinder(checker, start.world(), dest, start.coord(), stack); + + if(p.getPath().size() >= 2) { PathfinderCache.cachedPaths.put(new PathData(start.coord(), dest, p.side), p.getPath()); - return new Destination(p.getPath(), false, rejects, p.finalScore); + return new Destination(p.getPath(), false, response, p.finalScore); } } return null; } - public static Destination getNewBasePath(ILogisticalTransporter start, TransporterStack stack, int min) + public static Destination getNewBasePath(ILogisticalTransporter start, TransporterStack stack, TransitRequest request, int min) { - List paths = getPaths(start, stack, min); + List paths = getPaths(start, stack, request, min); if(paths.isEmpty()) { @@ -323,9 +325,9 @@ public final class TransporterPathfinder return paths.get(0); } - public static Destination getNewRRPath(ILogisticalTransporter start, TransporterStack stack, TileEntityLogisticalSorter outputter, int min) + public static Destination getNewRRPath(ILogisticalTransporter start, TransporterStack stack, TransitRequest request ,TileEntityLogisticalSorter outputter, int min) { - List paths = getPaths(start, stack, min); + List paths = getPaths(start, stack, request, min); Map destPaths = new HashMap(); diff --git a/src/main/java/mekanism/common/content/transporter/TransporterStack.java b/src/main/java/mekanism/common/content/transporter/TransporterStack.java index bd56f1931..bc588906e 100644 --- a/src/main/java/mekanism/common/content/transporter/TransporterStack.java +++ b/src/main/java/mekanism/common/content/transporter/TransporterStack.java @@ -7,12 +7,14 @@ import java.util.List; import mekanism.api.Coord4D; import mekanism.api.EnumColor; -import mekanism.api.util.CapabilityUtils; import mekanism.common.PacketHandler; import mekanism.common.base.ILogisticalTransporter; import mekanism.common.capabilities.Capabilities; +import mekanism.common.content.transporter.TransitRequest.TransitResponse; import mekanism.common.content.transporter.TransporterPathfinder.Destination; import mekanism.common.tile.TileEntityLogisticalSorter; +import mekanism.common.util.CapabilityUtils; +import mekanism.common.util.InventoryUtils; import mekanism.common.util.TransporterUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -142,7 +144,7 @@ public class TransporterStack } pathType = Path.values()[nbtTags.getInteger("pathType")]; - itemStack = ItemStack.loadItemStackFromNBT(nbtTags); + itemStack = InventoryUtils.loadFromNBT(nbtTags); } public static TransporterStack readFromNBT(NBTTagCompound nbtTags) @@ -188,36 +190,36 @@ public class TransporterStack return pathToTarget; } - public ItemStack recalculatePath(ILogisticalTransporter transporter, int min) + public TransitResponse recalculatePath(TransitRequest request, ILogisticalTransporter transporter, int min) { - Destination newPath = TransporterPathfinder.getNewBasePath(transporter, this, min); + Destination newPath = TransporterPathfinder.getNewBasePath(transporter, this, request, min); if(newPath == null) { - return itemStack; + return TransitResponse.EMPTY; } idleDir = null; setPath(newPath.path, Path.DEST); initiatedPath = true; - return newPath.rejected; + return newPath.response; } - public ItemStack recalculateRRPath(TileEntityLogisticalSorter outputter, ILogisticalTransporter transporter, int min) + public TransitResponse recalculateRRPath(TransitRequest request, TileEntityLogisticalSorter outputter, ILogisticalTransporter transporter, int min) { - Destination newPath = TransporterPathfinder.getNewRRPath(transporter, this, outputter, min); + Destination newPath = TransporterPathfinder.getNewRRPath(transporter, this, request, outputter, min); if(newPath == null) { - return itemStack; + return TransitResponse.EMPTY; } idleDir = null; setPath(newPath.path, Path.DEST); initiatedPath = true; - return newPath.rejected; + return newPath.response; } public boolean calculateIdle(ILogisticalTransporter transporter) diff --git a/src/main/java/mekanism/common/entity/EntityBabySkeleton.java b/src/main/java/mekanism/common/entity/EntityBabySkeleton.java index 9bbe19b25..99c9efac8 100644 --- a/src/main/java/mekanism/common/entity/EntityBabySkeleton.java +++ b/src/main/java/mekanism/common/entity/EntityBabySkeleton.java @@ -31,7 +31,7 @@ public class EntityBabySkeleton extends EntitySkeleton { dataManager.set(IS_CHILD, child); - if(worldObj != null && !worldObj.isRemote) + if(world != null && !world.isRemote) { IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED); iattributeinstance.removeModifier(babySpeedBoostModifier); diff --git a/src/main/java/mekanism/common/entity/EntityBalloon.java b/src/main/java/mekanism/common/entity/EntityBalloon.java index 18453d922..b49b3e394 100644 --- a/src/main/java/mekanism/common/entity/EntityBalloon.java +++ b/src/main/java/mekanism/common/entity/EntityBalloon.java @@ -13,6 +13,7 @@ import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.ParticleRedstone; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.MoverType; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.datasync.DataParameter; @@ -75,7 +76,7 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData public EntityBalloon(EntityLivingBase entity, EnumColor c) { - this(entity.worldObj); + this(entity.world); latchedEntity = entity; setPosition(latchedEntity.posX, latchedEntity.posY + latchedEntity.height + 1.7F, latchedEntity.posZ); @@ -122,11 +123,11 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData return; } - if(worldObj.isRemote) + if(world.isRemote) { if(dataManager.get(IS_LATCHED) == 1) { - latched = new Coord4D((int)dataManager.get(LATCHED_X), (int)dataManager.get(LATCHED_Y), (int)dataManager.get(LATCHED_Z), worldObj.provider.getDimension()); + latched = new Coord4D((int)dataManager.get(LATCHED_X), (int)dataManager.get(LATCHED_Y), (int)dataManager.get(LATCHED_Z), world.provider.getDimension()); } else { latched = null; @@ -134,7 +135,7 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData if(dataManager.get(IS_LATCHED) == 2) { - latchedEntity = (EntityLivingBase)worldObj.getEntityByID(dataManager.get(LATCHED_ID)); + latchedEntity = (EntityLivingBase)world.getEntityByID(dataManager.get(LATCHED_ID)); } else { latchedEntity = null; @@ -158,16 +159,16 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData } } - if(!worldObj.isRemote) + if(!world.isRemote) { - if(latched != null && (latched.exists(worldObj) && latched.isAirBlock(worldObj))) + if(latched != null && (latched.exists(world) && latched.isAirBlock(world))) { latched = null; dataManager.set(IS_LATCHED, (byte)0); } - if(latchedEntity != null && (latchedEntity.getHealth() <= 0 || latchedEntity.isDead || !worldObj.loadedEntityList.contains(latchedEntity))) + if(latchedEntity != null && (latchedEntity.getHealth() <= 0 || latchedEntity.isDead || !world.loadedEntityList.contains(latchedEntity))) { latchedEntity = null; @@ -179,7 +180,7 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData { motionY = Math.min(motionY*1.02F, 0.2F); - moveEntity(motionX, motionY, motionZ); + move(MoverType.SELF, motionX, motionY, motionZ); motionX *= 0.98; motionZ *= 0.98; @@ -232,7 +233,7 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData for(BlockPos posi = pos; posi.getY() > 0; posi = posi.down()) { - if(posi.getY() < 256 && !worldObj.isAirBlock(posi)) + if(posi.getY() < 256 && !world.isAirBlock(posi)) { return posi.getY()+1+(entity instanceof EntityPlayer ? 1 : 0); } @@ -243,7 +244,7 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData private void findCachedEntity() { - for(Object obj : worldObj.loadedEntityList) + for(Object obj : world.loadedEntityList) { if(obj instanceof EntityLivingBase) { @@ -261,7 +262,7 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData { playSound(MekanismSounds.POP, 1, 1); - if(worldObj.isRemote) + if(world.isRemote) { for(int i = 0; i < 10; i++) { @@ -279,7 +280,7 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData { Pos3D pos = new Pos3D(posX + (rand.nextFloat()*.6 - 0.3), posY + (rand.nextFloat()*.6 - 0.3), posZ + (rand.nextFloat()*.6 - 0.3)); - Particle fx = new ParticleRedstone.Factory().getEntityFX(0, worldObj, pos.xCoord, pos.yCoord, pos.zCoord, 0, 0, 0); + Particle fx = new ParticleRedstone.Factory().createParticle(0, world, pos.xCoord, pos.yCoord, pos.zCoord, 0, 0, 0); fx.setRBGColorF(color.getColor(0), color.getColor(1), color.getColor(2)); Minecraft.getMinecraft().effectRenderer.addEffect(fx); @@ -387,7 +388,7 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData } else if(type == 2) { - latchedEntity = (EntityLivingBase)worldObj.getEntityByID(data.readInt()); + latchedEntity = (EntityLivingBase)world.getEntityByID(data.readInt()); } else { latched = null; @@ -427,7 +428,7 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData else { setBeenAttacked(); - if(dmgSource != DamageSource.magic && dmgSource != DamageSource.drown && dmgSource != DamageSource.fall) + if(dmgSource != DamageSource.MAGIC && dmgSource != DamageSource.DROWN && dmgSource != DamageSource.FALL) { pop(); return true; @@ -439,7 +440,7 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData public boolean isLatched() { - if(!worldObj.isRemote) + if(!world.isRemote) { return latched != null || latchedEntity != null; } diff --git a/src/main/java/mekanism/common/entity/EntityFlame.java b/src/main/java/mekanism/common/entity/EntityFlame.java index b8a3e4aba..84ff0f176 100644 --- a/src/main/java/mekanism/common/entity/EntityFlame.java +++ b/src/main/java/mekanism/common/entity/EntityFlame.java @@ -5,11 +5,11 @@ import io.netty.buffer.ByteBuf; import java.util.List; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; import mekanism.api.Pos3D; -import mekanism.api.util.StackUtils; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.item.ItemFlamethrower; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.StackUtils; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; @@ -47,7 +47,7 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData public EntityFlame(EntityPlayer player) { - this(player.worldObj); + this(player.world); Pos3D playerPos = new Pos3D(player).translate(0, 1.6, 0); Pos3D flameVec = new Pos3D(1, 1, 1); @@ -71,7 +71,7 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData public void setHeading(Pos3D motion) { - float d = MathHelper.sqrt_double((motion.xCoord * motion.xCoord) + (motion.zCoord * motion.zCoord)); + float d = MathHelper.sqrt((motion.xCoord * motion.xCoord) + (motion.zCoord * motion.zCoord)); prevRotationYaw = rotationYaw = (float)(Math.atan2(motion.xCoord, motion.zCoord) * 180.0D / Math.PI); prevRotationPitch = rotationPitch = (float)(Math.atan2(motion.yCoord, d) * 180.0D / Math.PI); @@ -113,7 +113,7 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData { Vec3d localVec = new Vec3d(posX, posY, posZ); Vec3d motionVec = new Vec3d(posX + motionX*2, posY + motionY*2, posZ + motionZ*2); - RayTraceResult mop = worldObj.rayTraceBlocks(localVec, motionVec, true, false, false); + RayTraceResult mop = world.rayTraceBlocks(localVec, motionVec, true, false, false); localVec = new Vec3d(posX, posY, posZ); motionVec = new Vec3d(posX + motionX, posY + motionY, posZ + motionZ); @@ -123,7 +123,7 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData } Entity entity = null; - List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, getEntityBoundingBox().addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D)); + List list = world.getEntitiesWithinAABBExcludingEntity(this, getEntityBoundingBox().addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D)); double entityDist = 0.0D; int i; @@ -183,19 +183,19 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData } else if(mop.typeOfHit == Type.BLOCK) { - IBlockState state = worldObj.getBlockState(mop.getBlockPos()); + IBlockState state = world.getBlockState(mop.getBlockPos()); Block block = state.getBlock(); - boolean fluid = MekanismUtils.isFluid(worldObj, new Coord4D(mop, worldObj)) || MekanismUtils.isDeadFluid(worldObj, new Coord4D(mop, worldObj)); + boolean fluid = MekanismUtils.isFluid(world, new Coord4D(mop, world)) || MekanismUtils.isDeadFluid(world, new Coord4D(mop, world)); - Coord4D sideCoord = new Coord4D(mop.getBlockPos().offset(mop.sideHit), worldObj); + Coord4D sideCoord = new Coord4D(mop.getBlockPos().offset(mop.sideHit), world); - if(general.aestheticWorldDamage && !fluid && (sideCoord.isAirBlock(worldObj) || sideCoord.isReplaceable(worldObj))) + if(general.aestheticWorldDamage && !fluid && (sideCoord.isAirBlock(world) || sideCoord.isReplaceable(world))) { - if(mode != ItemFlamethrower.FlamethrowerMode.COMBAT && !smeltBlock(new Coord4D(mop, worldObj))) + if(mode != ItemFlamethrower.FlamethrowerMode.COMBAT && !smeltBlock(new Coord4D(mop, world))) { - if(mode == ItemFlamethrower.FlamethrowerMode.INFERNO && !worldObj.isRemote) + if(mode == ItemFlamethrower.FlamethrowerMode.INFERNO && !world.isRemote) { - worldObj.setBlockState(sideCoord.getPos(), Blocks.FIRE.getDefaultState()); + world.setBlockState(sideCoord.getPos(), Blocks.FIRE.getDefaultState()); } } } @@ -215,9 +215,9 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData { ItemStack result = FurnaceRecipes.instance().getSmeltingResult(item.getEntityItem()); - if(result != null) + if(!result.isEmpty()) { - item.setEntityItemStack(StackUtils.size(result, item.getEntityItem().stackSize)); + item.setEntityItemStack(StackUtils.size(result, item.getEntityItem().getCount())); item.ticksExisted = 0; spawnParticlesAt(new Pos3D(item)); @@ -231,38 +231,44 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData private boolean smeltBlock(Coord4D block) { - ItemStack stack = block.getStack(worldObj); + ItemStack stack = block.getStack(world); - if(stack == null) + if(stack.isEmpty()) { return false; } - ItemStack result = FurnaceRecipes.instance().getSmeltingResult(block.getStack(worldObj)); + ItemStack result = ItemStack.EMPTY; - if(result != null && result.getItem() != null) + try { + result = FurnaceRecipes.instance().getSmeltingResult(block.getStack(world)); + } catch(Exception e) { + return false; + } + + if(!result.isEmpty() && result.getItem() != null) { - if(!worldObj.isRemote) + if(!world.isRemote) { - IBlockState state = block.getBlockState(worldObj); + IBlockState state = block.getBlockState(world); Block b = state.getBlock(); Block newBlock = Block.getBlockFromItem(result.getItem()); if(newBlock != null && newBlock != Blocks.AIR) { - worldObj.setBlockState(block.getPos(), Block.getBlockFromItem(result.getItem()).getStateFromMeta(result.getItemDamage()), 3); + world.setBlockState(block.getPos(), Block.getBlockFromItem(result.getItem()).getStateFromMeta(result.getItemDamage()), 3); } else { - worldObj.setBlockToAir(block.getPos()); + world.setBlockToAir(block.getPos()); - EntityItem item = new EntityItem(worldObj, block.xCoord + 0.5, block.yCoord + 0.5, block.zCoord + 0.5, result.copy()); + EntityItem item = new EntityItem(world, block.xCoord + 0.5, block.yCoord + 0.5, block.zCoord + 0.5, result.copy()); item.motionX = 0; item.motionY = 0; item.motionZ = 0; - worldObj.spawnEntityInWorld(item); + world.spawnEntity(item); } - worldObj.playEvent(null, 2001, block.getPos(), Block.getStateId(state)); + world.playEvent(null, 2001, block.getPos(), Block.getStateId(state)); } spawnParticlesAt(new Pos3D(block).translate(0.5, 0.5, 0.5)); @@ -294,7 +300,7 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData { for(int i = 0; i < 10; i++) { - worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, pos.xCoord + (rand.nextFloat()-0.5), pos.yCoord + (rand.nextFloat()-0.5), pos.zCoord + (rand.nextFloat()-0.5), 0, 0, 0); + world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, pos.xCoord + (rand.nextFloat()-0.5), pos.yCoord + (rand.nextFloat()-0.5), pos.zCoord + (rand.nextFloat()-0.5), 0, 0, 0); } } diff --git a/src/main/java/mekanism/common/entity/EntityObsidianTNT.java b/src/main/java/mekanism/common/entity/EntityObsidianTNT.java index 79b008e41..1595bca3a 100644 --- a/src/main/java/mekanism/common/entity/EntityObsidianTNT.java +++ b/src/main/java/mekanism/common/entity/EntityObsidianTNT.java @@ -1,7 +1,8 @@ package mekanism.common.entity; -import mekanism.api.MekanismConfig.general; +import mekanism.common.config.MekanismConfig.general; import net.minecraft.entity.Entity; +import net.minecraft.entity.MoverType; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumParticleTypes; import net.minecraft.world.World; @@ -71,7 +72,7 @@ public class EntityObsidianTNT extends Entity motionY -= 0.04; - moveEntity(motionX, motionY, motionZ); + move(MoverType.SELF, motionX, motionY, motionZ); motionX *= 0.98; motionY *= 0.98; @@ -86,7 +87,7 @@ public class EntityObsidianTNT extends Entity if(fuse-- <= 0) { - if(!worldObj.isRemote) + if(!world.isRemote) { setDead(); explode(); @@ -97,18 +98,18 @@ public class EntityObsidianTNT extends Entity setDead(); } else { - worldObj.spawnParticle(EnumParticleTypes.LAVA, posX, posY + 0.5, posZ, 0, 0, 0); + world.spawnParticle(EnumParticleTypes.LAVA, posX, posY + 0.5, posZ, 0, 0, 0); } } } else { - worldObj.spawnParticle(EnumParticleTypes.LAVA, posX, posY + 0.5, posZ, 0, 0, 0); + world.spawnParticle(EnumParticleTypes.LAVA, posX, posY + 0.5, posZ, 0, 0, 0); } } private void explode() { - worldObj.createExplosion(null, posX, posY, posZ, general.obsidianTNTBlastRadius, true); + world.createExplosion(null, posX, posY, posZ, general.obsidianTNTBlastRadius, true); hasExploded = true; } diff --git a/src/main/java/mekanism/common/entity/EntityRobit.java b/src/main/java/mekanism/common/entity/EntityRobit.java index 124091cfe..97cd97567 100644 --- a/src/main/java/mekanism/common/entity/EntityRobit.java +++ b/src/main/java/mekanism/common/entity/EntityRobit.java @@ -6,21 +6,25 @@ import ic2.api.item.IElectricItem; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.List; +import java.util.UUID; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; import mekanism.api.energy.EnergizedItemManager; import mekanism.api.energy.IEnergizedItem; import mekanism.common.Mekanism; import mekanism.common.MekanismItems; -import mekanism.common.RobitAIFollow; -import mekanism.common.RobitAIPickup; import mekanism.common.base.ISustainedInventory; +import mekanism.common.capabilities.Capabilities; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.entity.ai.RobitAIFollow; +import mekanism.common.entity.ai.RobitAIPickup; import mekanism.common.item.ItemConfigurator; import mekanism.common.item.ItemRobit; import mekanism.common.tile.TileEntityChargepad; +import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; import micdoodle8.mods.galacticraft.api.entity.IEntityBreathable; +import net.darkhax.tesla.api.ITeslaProducer; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAILookIdle; @@ -31,6 +35,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ItemStackHelper; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; @@ -43,11 +48,15 @@ import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.UsernameCache; import net.minecraftforge.common.util.Constants; +import net.minecraftforge.energy.CapabilityEnergy; +import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Optional.Interface; import cofh.api.energy.IEnergyContainerItem; @@ -59,7 +68,7 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine public Coord4D homeLocation; - public ItemStack[] inventory = new ItemStack[31]; + public NonNullList inventory = NonNullList.withSize(31, ItemStack.EMPTY); public int furnaceBurnTime = 0; public int currentItemBurnTime = 0; @@ -68,7 +77,8 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine public boolean texTick; private static final DataParameter ELECTRICITY = EntityDataManager.createKey(EntityRobit.class, DataSerializers.FLOAT); - private static final DataParameter OWNER = EntityDataManager.createKey(EntityRobit.class, DataSerializers.STRING); + private static final DataParameter OWNER_UUID = EntityDataManager.createKey(EntityRobit.class, DataSerializers.STRING); + private static final DataParameter OWNER_NAME = EntityDataManager.createKey(EntityRobit.class, DataSerializers.STRING); private static final DataParameter FOLLOW = EntityDataManager.createKey(EntityRobit.class, DataSerializers.BOOLEAN); private static final DataParameter DROP_PICKUP = EntityDataManager.createKey(EntityRobit.class, DataSerializers.BOOLEAN); @@ -127,7 +137,8 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine super.entityInit(); dataManager.register(ELECTRICITY, 0F); - dataManager.register(OWNER, ""); + dataManager.register(OWNER_UUID, ""); + dataManager.register(OWNER_NAME, ""); dataManager.register(FOLLOW, false); dataManager.register(DROP_PICKUP, false); } @@ -140,7 +151,7 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine @Override public void onEntityUpdate() { - if(!worldObj.isRemote) + if(!world.isRemote) { if(getFollowing() && getOwner() != null && getDistanceSqToEntity(getOwner()) > 4 && !getNavigator().noPath() && getEnergy() > 0) { @@ -150,7 +161,7 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine super.onEntityUpdate(); - if(!worldObj.isRemote) + if(!world.isRemote) { if(getDropPickup()) { @@ -164,54 +175,71 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine return; } - if(!(homeLocation.getTileEntity(FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(homeLocation.dimensionId)) instanceof TileEntityChargepad)) + if(ticksExisted % 20 == 0) { - drop(); - setDead(); - - return; + World serverWorld = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(homeLocation.dimensionId); + + if(homeLocation.exists(serverWorld)) + { + if(!(homeLocation.getTileEntity(serverWorld) instanceof TileEntityChargepad)) + { + drop(); + setDead(); + } + } } if(getEnergy() == 0 && !isOnChargepad()) { goHome(); } + + ItemStack stack = inventory.get(27); - if(inventory[27] != null && getEnergy() < MAX_ELECTRICITY) + if(!stack.isEmpty() && getEnergy() < MAX_ELECTRICITY) { - if(inventory[27].getItem() instanceof IEnergizedItem) + if(stack.getItem() instanceof IEnergizedItem) { - setEnergy(getEnergy() + EnergizedItemManager.discharge(inventory[27], MAX_ELECTRICITY - getEnergy())); + setEnergy(getEnergy() + EnergizedItemManager.discharge(stack, MAX_ELECTRICITY - getEnergy())); } - else if(MekanismUtils.useIC2() && inventory[27].getItem() instanceof IElectricItem) + else if(MekanismUtils.useTesla() && stack.hasCapability(Capabilities.TESLA_PRODUCER_CAPABILITY, null)) { - IElectricItem item = (IElectricItem)inventory[27].getItem(); - - if(item.canProvideEnergy(inventory[27])) + ITeslaProducer producer = stack.getCapability(Capabilities.TESLA_PRODUCER_CAPABILITY, null); + + long needed = (long)Math.round((MAX_ELECTRICITY-getEnergy())*general.TO_TESLA); + setEnergy(getEnergy() + producer.takePower(needed, false)*general.FROM_TESLA); + } + else if(MekanismUtils.useForge() && stack.hasCapability(CapabilityEnergy.ENERGY, null)) + { + IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null); + + if(storage.canExtract()) { - double gain = ElectricItem.manager.discharge(inventory[27], (MAX_ELECTRICITY - getEnergy())* general.TO_IC2, 4, true, true, false)*general.FROM_IC2; + int needed = (int)Math.round(Math.min(Integer.MAX_VALUE, (MAX_ELECTRICITY-getEnergy())*general.TO_FORGE)); + setEnergy(getEnergy() + storage.extractEnergy(needed, false)*general.FROM_FORGE); + } + } + else if(MekanismUtils.useRF() && stack.getItem() instanceof IEnergyContainerItem) + { + IEnergyContainerItem item = (IEnergyContainerItem)stack.getItem(); + + int needed = (int)Math.round(Math.min(Integer.MAX_VALUE, (MAX_ELECTRICITY - getEnergy())*general.TO_RF)); + setEnergy(getEnergy() + (item.extractEnergy(stack, needed, false)*general.FROM_RF)); + } + else if(MekanismUtils.useIC2() && stack.getItem() instanceof IElectricItem) + { + IElectricItem item = (IElectricItem)stack.getItem(); + + if(item.canProvideEnergy(stack)) + { + double gain = ElectricItem.manager.discharge(stack, (MAX_ELECTRICITY - getEnergy())*general.TO_IC2, 4, true, true, false)*general.FROM_IC2; setEnergy(getEnergy() + gain); } } - else if(MekanismUtils.useRF() && inventory[27].getItem() instanceof IEnergyContainerItem) - { - ItemStack itemStack = inventory[27]; - IEnergyContainerItem item = (IEnergyContainerItem)inventory[27].getItem(); - - int itemEnergy = (int)Math.round(Math.min(Math.sqrt(item.getMaxEnergyStored(itemStack)), item.getEnergyStored(itemStack))); - int toTransfer = (int)Math.round(Math.min(itemEnergy, ((MAX_ELECTRICITY - getEnergy())*general.TO_RF))); - - setEnergy(getEnergy() + (item.extractEnergy(itemStack, toTransfer, false)* general.FROM_RF)); - } - else if(inventory[27].getItem() == Items.REDSTONE && getEnergy()+ general.ENERGY_PER_REDSTONE <= MAX_ELECTRICITY) + else if(stack.getItem() == Items.REDSTONE && getEnergy()+general.ENERGY_PER_REDSTONE <= MAX_ELECTRICITY) { setEnergy(getEnergy() + general.ENERGY_PER_REDSTONE); - inventory[27].stackSize--; - - if(inventory[27].stackSize <= 0) - { - inventory[27] = null; - } + stack.shrink(1); } } @@ -220,21 +248,21 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine furnaceBurnTime--; } - if(!worldObj.isRemote) + if(!world.isRemote) { if(furnaceBurnTime == 0 && canSmelt()) { - currentItemBurnTime = furnaceBurnTime = TileEntityFurnace.getItemBurnTime(inventory[29]); + currentItemBurnTime = furnaceBurnTime = TileEntityFurnace.getItemBurnTime(inventory.get(29)); if(furnaceBurnTime > 0) { - if(inventory[29] != null) + if(!inventory.get(29).isEmpty()) { - inventory[29].stackSize--; + inventory.get(29).shrink(1); - if(inventory[29].stackSize == 0) + if(inventory.get(29).getCount() == 0) { - inventory[29] = inventory[29].getItem().getContainerItem(inventory[29]); + inventory.set(29, inventory.get(29).getItem().getContainerItem(inventory.get(29))); } } } @@ -259,7 +287,7 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine private void collectItems() { - List items = worldObj.getEntitiesWithinAABB(EntityItem.class, getEntityBoundingBox().expand(1.5, 1.5, 1.5)); + List items = world.getEntitiesWithinAABB(EntityItem.class, getEntityBoundingBox().expand(1.5, 1.5, 1.5)); if(items != null && !items.isEmpty()) { @@ -272,29 +300,29 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine for(int i = 0; i < 27; i++) { - ItemStack itemStack = inventory[i]; + ItemStack itemStack = inventory.get(i); - if(itemStack == null) + if(itemStack.isEmpty()) { - inventory[i] = item.getEntityItem(); - onItemPickup(item, item.getEntityItem().stackSize); + inventory.set(i, item.getEntityItem()); + onItemPickup(item, item.getEntityItem().getCount()); item.setDead(); playSound(SoundEvents.ENTITY_ITEM_PICKUP, 1.0F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); break; } - else if(itemStack.isItemEqual(item.getEntityItem()) && itemStack.stackSize < itemStack.getMaxStackSize()) + else if(itemStack.isItemEqual(item.getEntityItem()) && itemStack.getCount() < itemStack.getMaxStackSize()) { - int needed = itemStack.getMaxStackSize() - itemStack.stackSize; - int toAdd = Math.min(needed, item.getEntityItem().stackSize); + int needed = itemStack.getMaxStackSize() - itemStack.getCount(); + int toAdd = Math.min(needed, item.getEntityItem().getCount()); - itemStack.stackSize += toAdd; - item.getEntityItem().stackSize -= toAdd; + itemStack.grow(toAdd); + item.getEntityItem().shrink(toAdd); onItemPickup(item, toAdd); - if(item.getEntityItem().stackSize == 0) + if(item.getEntityItem().getCount() == 0) { item.setDead(); } @@ -312,7 +340,7 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine { setFollowing(false); - if(worldObj.provider.getDimension() != homeLocation.dimensionId) + if(world.provider.getDimension() != homeLocation.dimensionId) { changeDimension(homeLocation.dimensionId); } @@ -326,16 +354,16 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine private boolean canSmelt() { - if(inventory[28] == null) + if(inventory.get(28).isEmpty()) { return false; } else { - ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(inventory[28]); - if(itemstack == null) return false; - if(inventory[30] == null) return true; - if(!inventory[30].isItemEqual(itemstack)) return false; - int result = inventory[30].stackSize + itemstack.stackSize; + ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(inventory.get(28)); + if(itemstack.isEmpty()) return false; + if(inventory.get(30).isEmpty()) return true; + if(!inventory.get(30).isItemEqual(itemstack)) return false; + int result = inventory.get(30).getCount() + itemstack.getCount(); return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize()); } } @@ -344,23 +372,18 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine { if(canSmelt()) { - ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(inventory[28]); + ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(inventory.get(28)); - if(inventory[30] == null) + if(inventory.get(30).isEmpty()) { - inventory[30] = itemstack.copy(); + inventory.set(30, itemstack.copy()); } - else if(inventory[30].isItemEqual(itemstack)) + else if(inventory.get(30).isItemEqual(itemstack)) { - inventory[30].stackSize += itemstack.stackSize; + inventory.get(30).grow(itemstack.getCount()); } - inventory[28].stackSize--; - - if(inventory[28].stackSize <= 0) - { - inventory[28] = null; - } + inventory.get(28).shrink(1); } } @@ -368,7 +391,7 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine { BlockPos pos = new BlockPos(this); - if(worldObj.getTileEntity(pos) instanceof TileEntityChargepad) + if(world.getTileEntity(pos) instanceof TileEntityChargepad) { return true; } @@ -377,13 +400,15 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine } @Override - public EnumActionResult applyPlayerInteraction(EntityPlayer entityplayer, Vec3d vec, ItemStack stack, EnumHand hand) + public EnumActionResult applyPlayerInteraction(EntityPlayer entityplayer, Vec3d vec, EnumHand hand) { + ItemStack stack = entityplayer.getHeldItem(hand); + if(entityplayer.isSneaking()) { - if(stack != null && stack.getItem() instanceof ItemConfigurator) + if(!stack.isEmpty() && stack.getItem() instanceof ItemConfigurator) { - if(!worldObj.isRemote) + if(!world.isRemote) { drop(); } @@ -395,7 +420,7 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine } } else { - entityplayer.openGui(Mekanism.instance, 21, worldObj, getEntityId(), 0, 0); + entityplayer.openGui(Mekanism.instance, 21, world, getEntityId(), 0, 0); return EnumActionResult.SUCCESS; } @@ -404,7 +429,7 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine public void drop() { - EntityItem entityItem = new EntityItem(worldObj, posX, posY+0.3, posZ, new ItemStack(MekanismItems.Robit)); + EntityItem entityItem = new EntityItem(world, posX, posY+0.3, posZ, new ItemStack(MekanismItems.Robit)); ItemRobit item = (ItemRobit)entityItem.getEntityItem().getItem(); item.setEnergy(entityItem.getEntityItem(), getEnergy()); @@ -416,7 +441,7 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine entityItem.motionY = rand.nextGaussian() * k + 0.2F; entityItem.motionZ = 0; - worldObj.spawnEntityInWorld(entityItem); + world.spawnEntity(entityItem); } @Override @@ -428,9 +453,9 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine nbtTags.setString("name", getName()); - if(getOwnerName() != null) + if(getOwnerUUID() != null) { - nbtTags.setString("owner", getOwnerName()); + nbtTags.setString("ownerUUID", getOwnerUUID().toString()); } nbtTags.setBoolean("follow", getFollowing()); @@ -444,13 +469,13 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine NBTTagList tagList = new NBTTagList(); - for(int slotCount = 0; slotCount < inventory.length; slotCount++) + for(int slotCount = 0; slotCount < inventory.size(); slotCount++) { - if(inventory[slotCount] != null) + if(!inventory.get(slotCount).isEmpty()) { NBTTagCompound tagCompound = new NBTTagCompound(); tagCompound.setByte("Slot", (byte)slotCount); - inventory[slotCount].writeToNBT(tagCompound); + inventory.get(slotCount).writeToNBT(tagCompound); tagList.appendTag(tagCompound); } } @@ -467,9 +492,9 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine setCustomNameTag(nbtTags.getString("name")); - if(nbtTags.hasKey("owner")) + if(nbtTags.hasKey("ownerUUID")) { - setOwner(nbtTags.getString("owner")); + setOwnerUUID(UUID.fromString(nbtTags.getString("ownerUUID"))); } setFollowing(nbtTags.getBoolean("follow")); @@ -479,16 +504,16 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine homeLocation = Coord4D.read(nbtTags); NBTTagList tagList = nbtTags.getTagList("Items", Constants.NBT.TAG_COMPOUND); - inventory = new ItemStack[getSizeInventory()]; + inventory = NonNullList.withSize(getSizeInventory(), ItemStack.EMPTY); for(int tagCount = 0; tagCount < tagList.tagCount(); tagCount++) { NBTTagCompound tagCompound = tagList.getCompoundTagAt(tagCount); byte slotID = tagCompound.getByte("Slot"); - if(slotID >= 0 && slotID < inventory.length) + if(slotID >= 0 && slotID < inventory.size()) { - inventory[slotID] = ItemStack.loadItemStackFromNBT(tagCompound); + inventory.set(slotID, InventoryUtils.loadFromNBT(tagCompound)); } } } @@ -537,17 +562,23 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine public EntityPlayer getOwner() { - return worldObj.getPlayerEntityByName(getOwnerName()); + return world.getPlayerEntityByUUID(getOwnerUUID()); } public String getOwnerName() { - return dataManager.get(OWNER); + return dataManager.get(OWNER_NAME); } - public void setOwner(String username) + public UUID getOwnerUUID() { - dataManager.set(OWNER, username); + return UUID.fromString(dataManager.get(OWNER_UUID)); + } + + public void setOwnerUUID(UUID uuid) + { + dataManager.set(OWNER_UUID, uuid.toString()); + dataManager.set(OWNER_NAME, UsernameCache.getLastKnownUsername(uuid)); } public boolean getFollowing() @@ -573,66 +604,35 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine @Override public int getSizeInventory() { - return inventory.length; + return inventory.size(); } @Override public ItemStack getStackInSlot(int slotID) { - return inventory[slotID]; + return inventory.get(slotID); } @Override public ItemStack decrStackSize(int slotID, int amount) { - if(getStackInSlot(slotID) != null) - { - ItemStack tempStack; - - if(getStackInSlot(slotID).stackSize <= amount) - { - tempStack = getStackInSlot(slotID); - setInventorySlotContents(slotID, null); - return tempStack; - } - else { - tempStack = getStackInSlot(slotID).splitStack(amount); - - if(getStackInSlot(slotID).stackSize == 0) - { - setInventorySlotContents(slotID, null); - } - - return tempStack; - } - } - else { - return null; - } + return ItemStackHelper.getAndSplit(inventory, slotID, amount); } @Override public ItemStack removeStackFromSlot(int slotID) { - if(getStackInSlot(slotID) != null) - { - ItemStack tempStack = getStackInSlot(slotID); - setInventorySlotContents(slotID, null); - return tempStack; - } - else { - return null; - } + return ItemStackHelper.getAndRemove(inventory, slotID); } @Override public void setInventorySlotContents(int slotID, ItemStack itemstack) { - inventory[slotID] = itemstack; + inventory.set(slotID, itemstack); - if(itemstack != null && itemstack.stackSize > getInventoryStackLimit()) + if(!itemstack.isEmpty() && itemstack.getCount() > getInventoryStackLimit()) { - itemstack.stackSize = getInventoryStackLimit(); + itemstack.setCount(getInventoryStackLimit()); } } @@ -646,7 +646,7 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine public void markDirty() {} @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) + public boolean isUsableByPlayer(EntityPlayer entityplayer) { return true; } @@ -689,16 +689,16 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine return; } - inventory = new ItemStack[getSizeInventory()]; + inventory = NonNullList.withSize(getSizeInventory(), ItemStack.EMPTY); for(int slots = 0; slots < nbtTags.tagCount(); slots++) { NBTTagCompound tagCompound = (NBTTagCompound)nbtTags.getCompoundTagAt(slots); byte slotID = tagCompound.getByte("Slot"); - if(slotID >= 0 && slotID < inventory.length) + if(slotID >= 0 && slotID < inventory.size()) { - inventory[slotID] = ItemStack.loadItemStackFromNBT(tagCompound); + inventory.set(slotID, InventoryUtils.loadFromNBT(tagCompound)); } } } @@ -708,19 +708,33 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine { NBTTagList tagList = new NBTTagList(); - for(int slots = 0; slots < inventory.length; slots++) + for(int slots = 0; slots < inventory.size(); slots++) { - if(inventory[slots] != null) + if(!inventory.get(slots).isEmpty()) { NBTTagCompound tagCompound = new NBTTagCompound(); tagCompound.setByte("Slot", (byte)slots); - inventory[slots].writeToNBT(tagCompound); + inventory.get(slots).writeToNBT(tagCompound); tagList.appendTag(tagCompound); } } return tagList; } + + @Override + public boolean isEmpty() + { + for(ItemStack stack : inventory) + { + if(!stack.isEmpty()) + { + return false; + } + } + + return true; + } @Override public boolean canBreath() diff --git a/src/main/java/mekanism/common/RobitAIFollow.java b/src/main/java/mekanism/common/entity/ai/RobitAIFollow.java similarity index 82% rename from src/main/java/mekanism/common/RobitAIFollow.java rename to src/main/java/mekanism/common/entity/ai/RobitAIFollow.java index a40c324c4..3ad3e1848 100644 --- a/src/main/java/mekanism/common/RobitAIFollow.java +++ b/src/main/java/mekanism/common/entity/ai/RobitAIFollow.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.common.entity.ai; import mekanism.common.entity.EntityRobit; import net.minecraft.block.Block; @@ -22,7 +22,7 @@ public class RobitAIFollow extends EntityAIBase private EntityPlayer theOwner; /** The world the robit is located in. */ - private World theWorld; + private World world; /** How fast the robit can travel. */ private float moveSpeed; @@ -44,7 +44,7 @@ public class RobitAIFollow extends EntityAIBase public RobitAIFollow(EntityRobit entityRobit, float speed, float min, float max) { theRobit = entityRobit; - theWorld = entityRobit.worldObj; + world = entityRobit.world; moveSpeed = speed; thePathfinder = entityRobit.getNavigator(); minDist = min; @@ -60,7 +60,7 @@ public class RobitAIFollow extends EntityAIBase { return false; } - else if(theRobit.worldObj.provider.getDimension() != player.worldObj.provider.getDimension()) + else if(theRobit.world.provider.getDimension() != player.world.provider.getDimension()) { return false; } @@ -88,7 +88,7 @@ public class RobitAIFollow extends EntityAIBase @Override public boolean continueExecuting() { - return !thePathfinder.noPath() && theRobit.getDistanceSqToEntity(theOwner) > (maxDist * maxDist) && theRobit.getFollowing() && theRobit.getEnergy() > 0 && theOwner.worldObj.provider.getDimension() == theRobit.worldObj.provider.getDimension(); + return !thePathfinder.noPath() && theRobit.getDistanceSqToEntity(theOwner) > (maxDist * maxDist) && theRobit.getFollowing() && theRobit.getEnergy() > 0 && theOwner.world.provider.getDimension() == theRobit.world.provider.getDimension(); } @Override @@ -122,9 +122,9 @@ public class RobitAIFollow extends EntityAIBase { if(theRobit.getDistanceSqToEntity(theOwner) >= 144.0D) { - int x = MathHelper.floor_double(theOwner.posX) - 2; - int y = MathHelper.floor_double(theOwner.getEntityBoundingBox().minY); - int z = MathHelper.floor_double(theOwner.posZ) - 2; + int x = MathHelper.floor(theOwner.posX) - 2; + int y = MathHelper.floor(theOwner.getEntityBoundingBox().minY); + int z = MathHelper.floor(theOwner.posZ) - 2; for(int l = 0; l <= 4; ++l) { @@ -133,7 +133,7 @@ public class RobitAIFollow extends EntityAIBase BlockPos pos = new BlockPos(x+l, y, z+i1); BlockPos under = new BlockPos(x + l, y - 1, z + i1); - if((l < 1 || i1 < 1 || l > 3 || i1 > 3) && theWorld.getBlockState(under).isSideSolid(theWorld, under, EnumFacing.UP) && isEmptyBlock(pos) && isEmptyBlock(new BlockPos(x + l, y + 1, z + i1))) + if((l < 1 || i1 < 1 || l > 3 || i1 > 3) && world.getBlockState(under).isSideSolid(world, under, EnumFacing.UP) && isEmptyBlock(pos) && isEmptyBlock(new BlockPos(x + l, y + 1, z + i1))) { theRobit.setLocationAndAngles((x + l) + 0.5F, y, (z + i1) + 0.5F, theRobit.rotationYaw, theRobit.rotationPitch); thePathfinder.clearPathEntity(); @@ -149,7 +149,7 @@ public class RobitAIFollow extends EntityAIBase private boolean isEmptyBlock(BlockPos pos) { - IBlockState iblockstate = theWorld.getBlockState(pos); + IBlockState iblockstate = world.getBlockState(pos); Block block = iblockstate.getBlock(); return block == Blocks.AIR ? true : !iblockstate.isFullCube(); diff --git a/src/main/java/mekanism/common/RobitAIPickup.java b/src/main/java/mekanism/common/entity/ai/RobitAIPickup.java similarity index 81% rename from src/main/java/mekanism/common/RobitAIPickup.java rename to src/main/java/mekanism/common/entity/ai/RobitAIPickup.java index fbc6af267..240bc70ac 100644 --- a/src/main/java/mekanism/common/RobitAIPickup.java +++ b/src/main/java/mekanism/common/entity/ai/RobitAIPickup.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.common.entity.ai; import java.util.Iterator; import java.util.List; @@ -27,7 +27,7 @@ public class RobitAIPickup extends EntityAIBase private EntityRobit theRobit; /** The world the robit is located in. */ - private World theWorld; + private World world; /** How fast the robit can travel. */ private float moveSpeed; @@ -45,7 +45,7 @@ public class RobitAIPickup extends EntityAIBase public RobitAIPickup(EntityRobit entityRobit, float speed) { theRobit = entityRobit; - theWorld = entityRobit.worldObj; + world = entityRobit.world; moveSpeed = speed; thePathfinder = entityRobit.getNavigator(); } @@ -63,7 +63,7 @@ public class RobitAIPickup extends EntityAIBase return true; } - List items = theRobit.worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(theRobit.posX-10, theRobit.posY-10, theRobit.posZ-10, theRobit.posX+10, theRobit.posY+10, theRobit.posZ+10)); + List items = theRobit.world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(theRobit.posX-10, theRobit.posY-10, theRobit.posZ-10, theRobit.posX+10, theRobit.posY+10, theRobit.posZ+10)); Iterator iter = items.iterator(); //Cached for slight performance double closestDistance = -1; @@ -100,7 +100,7 @@ public class RobitAIPickup extends EntityAIBase @Override public boolean continueExecuting() { - return !closest.isDead && !thePathfinder.noPath() && theRobit.getDistanceSqToEntity(closest) > 100 && theRobit.getDropPickup() && theRobit.getEnergy() > 0 && closest.worldObj.provider.getDimension() == theRobit.worldObj.provider.getDimension(); + return !closest.isDead && !thePathfinder.noPath() && theRobit.getDistanceSqToEntity(closest) > 100 && theRobit.getDropPickup() && theRobit.getEnergy() > 0 && closest.world.provider.getDimension() == theRobit.world.provider.getDimension(); } @Override @@ -136,9 +136,9 @@ public class RobitAIPickup extends EntityAIBase { if(theRobit.getDistanceSqToEntity(closest) >= 144.0D) { - int x = MathHelper.floor_double(closest.posX) - 2; - int y = MathHelper.floor_double(closest.getEntityBoundingBox().minY); - int z = MathHelper.floor_double(closest.posZ) - 2; + int x = MathHelper.floor(closest.posX) - 2; + int y = MathHelper.floor(closest.getEntityBoundingBox().minY); + int z = MathHelper.floor(closest.posZ) - 2; for(int l = 0; l <= 4; ++l) { @@ -147,7 +147,7 @@ public class RobitAIPickup extends EntityAIBase BlockPos pos = new BlockPos(x+l, y, z+i1); BlockPos under = new BlockPos(x + l, y - 1, z + i1); - if((l < 1 || i1 < 1 || l > 3 || i1 > 3) && theWorld.getBlockState(under).isSideSolid(theWorld, under, EnumFacing.UP) && isEmptyBlock(pos) && isEmptyBlock(new BlockPos(x + l, y + 1, z + i1))) + if((l < 1 || i1 < 1 || l > 3 || i1 > 3) && world.getBlockState(under).isSideSolid(world, under, EnumFacing.UP) && isEmptyBlock(pos) && isEmptyBlock(new BlockPos(x + l, y + 1, z + i1))) { theRobit.setLocationAndAngles((x + l) + 0.5F, y, (z + i1) + 0.5F, theRobit.rotationYaw, theRobit.rotationPitch); thePathfinder.clearPathEntity(); @@ -163,7 +163,7 @@ public class RobitAIPickup extends EntityAIBase private boolean isEmptyBlock(BlockPos pos) { - IBlockState iblockstate = theWorld.getBlockState(pos); + IBlockState iblockstate = world.getBlockState(pos); Block block = iblockstate.getBlock(); return block == Blocks.AIR ? true : !iblockstate.isFullCube(); diff --git a/src/main/java/mekanism/common/frequency/Frequency.java b/src/main/java/mekanism/common/frequency/Frequency.java index d4b6df755..b4d76e39e 100644 --- a/src/main/java/mekanism/common/frequency/Frequency.java +++ b/src/main/java/mekanism/common/frequency/Frequency.java @@ -5,17 +5,20 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; import java.util.HashSet; import java.util.Set; +import java.util.UUID; import mekanism.api.Coord4D; import mekanism.common.PacketHandler; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.UsernameCache; public class Frequency { public static final String TELEPORTER = "Teleporter"; public String name; - public String owner; + public UUID ownerUUID; + public String clientOwner; public boolean valid = true; @@ -23,10 +26,10 @@ public class Frequency public Set activeCoords = new HashSet(); - public Frequency(String n, String o) + public Frequency(String n, UUID uuid) { name = n; - owner = o; + ownerUUID = uuid; } public Frequency(NBTTagCompound nbtTags) @@ -100,28 +103,30 @@ public class Frequency public void write(NBTTagCompound nbtTags) { nbtTags.setString("name", name); - nbtTags.setString("owner", owner); + nbtTags.setString("ownerUUID", ownerUUID.toString()); nbtTags.setBoolean("publicFreq", publicFreq); } protected void read(NBTTagCompound nbtTags) { name = nbtTags.getString("name"); - owner = nbtTags.getString("owner"); + ownerUUID = UUID.fromString(nbtTags.getString("ownerUUID")); publicFreq = nbtTags.getBoolean("publicFreq"); } public void write(ArrayList data) { data.add(name); - data.add(owner); + data.add(ownerUUID.toString()); + data.add(UsernameCache.getLastKnownUsername(ownerUUID)); data.add(publicFreq); } protected void read(ByteBuf dataStream) { name = PacketHandler.readString(dataStream); - owner = PacketHandler.readString(dataStream); + ownerUUID = UUID.fromString(PacketHandler.readString(dataStream)); + clientOwner = PacketHandler.readString(dataStream); publicFreq = dataStream.readBoolean(); } @@ -130,7 +135,7 @@ public class Frequency { int code = 1; code = 31 * code + name.hashCode(); - code = 31 * code + owner.hashCode(); + code = 31 * code + ownerUUID.hashCode(); code = 31 * code + (publicFreq ? 1 : 0); return code; } @@ -139,6 +144,6 @@ public class Frequency public boolean equals(Object obj) { return obj instanceof Frequency && ((Frequency)obj).name.equals(name) - && ((Frequency)obj).owner.equals(owner) && ((Frequency)obj).publicFreq == publicFreq; + && ((Frequency)obj).ownerUUID.equals(ownerUUID) && ((Frequency)obj).publicFreq == publicFreq; } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/frequency/FrequencyManager.java b/src/main/java/mekanism/common/frequency/FrequencyManager.java index c567d965c..cab8fae5c 100644 --- a/src/main/java/mekanism/common/frequency/FrequencyManager.java +++ b/src/main/java/mekanism/common/frequency/FrequencyManager.java @@ -9,6 +9,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; +import java.util.UUID; import mekanism.api.Coord4D; import net.minecraft.nbt.NBTTagCompound; @@ -32,7 +33,7 @@ public class FrequencyManager private FrequencyDataHandler dataHandler; - private String owner; + private UUID ownerUUID; private String name; @@ -46,11 +47,11 @@ public class FrequencyManager managers.add(this); } - public FrequencyManager(Class c, String n, String s) + public FrequencyManager(Class c, String n, UUID uuid) { this(c, n); - owner = s; + ownerUUID = uuid; } public static void load(World world) @@ -63,7 +64,7 @@ public class FrequencyManager } } - public Frequency update(String user, Coord4D coord, Frequency freq) + public Frequency update(Coord4D coord, Frequency freq) { for(Frequency iterFreq : frequencies) { @@ -81,13 +82,13 @@ public class FrequencyManager return null; } - public void remove(String name, String owner) + public void remove(String name, UUID owner) { for(Iterator iter = getFrequencies().iterator(); iter.hasNext();) { Frequency iterFreq = iter.next(); - if(iterFreq.name.equals(name) && iterFreq.owner.equals(owner)) + if(iterFreq.name.equals(name) && iterFreq.ownerUUID.equals(owner)) { iter.remove(); dataHandler.markDirty(); @@ -117,7 +118,7 @@ public class FrequencyManager { Frequency iterFreq = iter.next(); - if(iterFreq.owner.equals(user)) + if(iterFreq.ownerUUID.equals(user)) { iter.remove(); dataHandler.markDirty(); @@ -137,7 +138,7 @@ public class FrequencyManager } } - public Frequency validateFrequency(String user, Coord4D coord, Frequency freq) + public Frequency validateFrequency(UUID uuid, Coord4D coord, Frequency freq) { for(Frequency iterFreq : frequencies) { @@ -150,7 +151,7 @@ public class FrequencyManager } } - if(user.equals(freq.owner)) + if(uuid.equals(freq.ownerUUID)) { freq.activeCoords.add(coord); freq.valid = true; @@ -184,25 +185,6 @@ public class FrequencyManager } } - public static FrequencyManager loadOnly(World world, String owner, Class freqClass, String n) - { - FrequencyManager manager = new FrequencyManager(freqClass, n); - String name = manager.getName(); - - FrequencyDataHandler handler = (FrequencyDataHandler)world.getPerWorldStorage().getOrLoadData(FrequencyDataHandler.class, name); - - if(handler == null) - { - return null; - } - else { - manager.dataHandler = handler; - manager.dataHandler.syncManager(); - - return manager; - } - } - public Set getFrequencies() { return frequencies; @@ -306,7 +288,7 @@ public class FrequencyManager public String getName() { - return owner != null ? (owner + "_" + name + "FrequencyHandler") : (name + "FrequencyHandler"); + return ownerUUID != null ? (ownerUUID.toString() + "_" + name + "FrequencyHandler") : (name + "FrequencyHandler"); } public static void reset() @@ -325,7 +307,7 @@ public class FrequencyManager public FrequencyManager manager; public Set loadedFrequencies; - public String loadedOwner; + public UUID loadedOwner; public FrequencyDataHandler(String tagName) { @@ -342,7 +324,7 @@ public class FrequencyManager if(loadedFrequencies != null) { manager.frequencies = loadedFrequencies; - manager.owner = loadedOwner; + manager.ownerUUID = loadedOwner; } } @@ -352,9 +334,9 @@ public class FrequencyManager try { String frequencyClass = nbtTags.getString("frequencyClass"); - if(nbtTags.hasKey("owner")) + if(nbtTags.hasKey("ownerUUID")) { - loadedOwner = nbtTags.getString("owner"); + loadedOwner = UUID.fromString(nbtTags.getString("ownerUUID")); } NBTTagList list = nbtTags.getTagList("freqList", NBT.TAG_COMPOUND); @@ -380,9 +362,9 @@ public class FrequencyManager { nbtTags.setString("frequencyClass", manager.frequencyClass.getName()); - if(manager.owner != null) + if(manager.ownerUUID != null) { - nbtTags.setString("owner", manager.owner); + nbtTags.setString("ownerUUID", manager.ownerUUID.toString()); } NBTTagList list = new NBTTagList(); diff --git a/src/main/java/mekanism/common/IMCHandler.java b/src/main/java/mekanism/common/integration/IMCHandler.java similarity index 96% rename from src/main/java/mekanism/common/IMCHandler.java rename to src/main/java/mekanism/common/integration/IMCHandler.java index 1979fb79e..694fd11c9 100644 --- a/src/main/java/mekanism/common/IMCHandler.java +++ b/src/main/java/mekanism/common/integration/IMCHandler.java @@ -1,7 +1,8 @@ -package mekanism.common; +package mekanism.common.integration; import java.util.List; +import mekanism.common.Mekanism; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.recipe.ShapedMekanismRecipe; @@ -63,7 +64,7 @@ public class IMCHandler { ItemStack stack = RecipeUtils.loadRecipeItemStack(msg.getNBTValue()); - if(stack != null) + if(!stack.isEmpty()) { RecipeUtils.removeRecipes(stack); Mekanism.logger.info("[Mekanism] " + msg.getSender() + " removed a Mekanism recipe from the recipe list."); @@ -83,7 +84,7 @@ public class IMCHandler for(Recipe type : Recipe.values()) { - if(msg.key.equalsIgnoreCase(type.getRecipeName() + "Recipe")) + if(message.equalsIgnoreCase(type.getRecipeName() + "Recipe")) { MachineInput input = type.createInput(msg.getNBTValue()); diff --git a/src/main/java/mekanism/common/integration/MekanismHooks.java b/src/main/java/mekanism/common/integration/MekanismHooks.java index af231e811..bb5af026c 100644 --- a/src/main/java/mekanism/common/integration/MekanismHooks.java +++ b/src/main/java/mekanism/common/integration/MekanismHooks.java @@ -1,18 +1,21 @@ package mekanism.common.integration; -import ic2.api.recipe.IMachineRecipeManager.RecipeIoContainer; -import ic2.api.recipe.RecipeInputItemStack; -import ic2.api.recipe.RecipeInputOreDict; +import ic2.api.recipe.IRecipeInput; +import ic2.api.recipe.MachineRecipe; import ic2.api.recipe.Recipes; +import java.util.Collection; import java.util.List; import li.cil.oc.api.Driver; import mekanism.api.transmitters.TransmissionType; import mekanism.common.Mekanism; +import mekanism.common.MekanismBlocks; import mekanism.common.MekanismItems; import mekanism.common.Resource; -import mekanism.common.multipart.TransmitterType; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterType; +import mekanism.common.integration.computer.CCPeripheral; +import mekanism.common.integration.computer.OCDriver; import mekanism.common.recipe.RecipeHandler; import mekanism.common.util.MekanismUtils; import net.minecraft.init.Items; @@ -37,6 +40,7 @@ public final class MekanismHooks public boolean CCLoaded = false; public boolean AE2Loaded = false; public boolean TeslaLoaded = false; + public boolean MCMPLoaded = false; public boolean MetallurgyCoreLoaded = false; public boolean MetallurgyBaseLoaded = false; @@ -50,6 +54,7 @@ public final class MekanismHooks if(Loader.isModLoaded("ComputerCraft")) CCLoaded = true; if(Loader.isModLoaded("appliedenergistics2")) AE2Loaded = true; if(Loader.isModLoaded("tesla")) TeslaLoaded = true; + if(Loader.isModLoaded("mcmultipart")) MCMPLoaded = true; if(Loader.isModLoaded("Metallurgy3Core")) { @@ -68,16 +73,21 @@ public final class MekanismHooks { loadCCPeripheralProviders(); } + + if(MetallurgyCoreLoaded) + { + //loadMettallurgy(); + } } @Method(modid = "IC2") public void hookIC2Recipes() { - for(RecipeIoContainer entry : Recipes.macerator.getRecipes()) + for(MachineRecipe> entry : Recipes.macerator.getRecipes()) { - if(!entry.input.getInputs().isEmpty()) + if(!entry.getInput().getInputs().isEmpty()) { - List names = MekanismUtils.getOreDictName(entry.input.getInputs().get(0)); + List names = MekanismUtils.getOreDictName(entry.getInput().getInputs().get(0)); for(String name : names) { @@ -85,7 +95,7 @@ public final class MekanismHooks if(name.startsWith("ingot")) { - RecipeHandler.addCrusherRecipe(entry.input.getInputs().get(0), entry.output.items.get(0)); + RecipeHandler.addCrusherRecipe(entry.getInput().getInputs().get(0), entry.getOutput().iterator().next()); did = true; } @@ -98,28 +108,22 @@ public final class MekanismHooks } try { - Recipes.macerator.addRecipe(new RecipeInputOreDict("oreOsmium"), null, false, new ItemStack(MekanismItems.Dust, 2, Resource.OSMIUM.ordinal())); + Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("oreOsmium"), null, false, new ItemStack(MekanismItems.Dust, 2, Resource.OSMIUM.ordinal())); } catch(Exception e) {} try { - Recipes.macerator.addRecipe(new RecipeInputOreDict("ingotOsmium"), null, false, new ItemStack(MekanismItems.Dust, 1, Resource.OSMIUM.ordinal())); - Recipes.macerator.addRecipe(new RecipeInputOreDict("ingotRefinedObsidian"), null, false, new ItemStack(MekanismItems.OtherDust, 1, 5)); - Recipes.macerator.addRecipe(new RecipeInputOreDict("ingotRefinedGlowstone"), null, false, new ItemStack(Items.GLOWSTONE_DUST)); - Recipes.macerator.addRecipe(new RecipeInputOreDict("ingotSteel"), null, false, new ItemStack(MekanismItems.OtherDust, 1, 1)); + Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("ingotOsmium"), null, false, new ItemStack(MekanismItems.Dust, 1, Resource.OSMIUM.ordinal())); + Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("ingotRefinedObsidian"), null, false, new ItemStack(MekanismItems.OtherDust, 1, 5)); + Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("ingotRefinedGlowstone"), null, false, new ItemStack(Items.GLOWSTONE_DUST)); + Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("ingotSteel"), null, false, new ItemStack(MekanismItems.OtherDust, 1, 1)); } catch(Exception e) {} try { for(Resource resource : Resource.values()) { - Recipes.macerator.addRecipe(new RecipeInputOreDict("clump" + resource.getName()), null, false, new ItemStack(MekanismItems.DirtyDust, 1, resource.ordinal())); + Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("clump" + resource.getName()), null, false, new ItemStack(MekanismItems.DirtyDust, 1, resource.ordinal())); } } catch(Exception e) {} - - NBTTagCompound tag = new NBTTagCompound(); - - tag.setInteger("amplification", 50000); - - Recipes.matterAmplifier.addRecipe(new RecipeInputItemStack(new ItemStack(MekanismItems.EnrichedAlloy), 1), tag, false); } @Method(modid = "ComputerCraft") @@ -163,22 +167,77 @@ public final class MekanismHooks { if(type.getTransmission().equals(TransmissionType.ITEM)) { - FMLInterModComms.sendMessage("appliedenergistics2","add-p2p-attunement-item",new ItemStack(MekanismItems.PartTransmitter, 1, type.ordinal())); + FMLInterModComms.sendMessage("appliedenergistics2", "add-p2p-attunement-item", new ItemStack(MekanismBlocks.Transmitter, 1, type.ordinal())); continue; } if(type.getTransmission().equals(TransmissionType.FLUID)) { - FMLInterModComms.sendMessage("appliedenergistics2","add-p2p-attunement-fluid",new ItemStack(MekanismItems.PartTransmitter, 1, type.ordinal())); + FMLInterModComms.sendMessage("appliedenergistics2", "add-p2p-attunement-fluid", new ItemStack(MekanismBlocks.Transmitter, 1, type.ordinal())); continue; } if(type.getTransmission().equals(TransmissionType.ENERGY)) { - FMLInterModComms.sendMessage("appliedenergistics2",energyP2P,new ItemStack(MekanismItems.PartTransmitter, 1, type.ordinal())); + FMLInterModComms.sendMessage("appliedenergistics2", energyP2P, new ItemStack(MekanismBlocks.Transmitter, 1, type.ordinal())); continue; } } } + + /*public void loadMetallurgy() + { + try + { + String[] setNames = {"base", "precious", "nether", "fantasy", "ender", "utility"}; + + for (String setName : setNames) + { + for (IOreInfo oreInfo : MetallurgyAPI.getMetalSet(setName).getOreList().values()) + { + switch (oreInfo.getType()) + { + case ALLOY: + if (oreInfo.getIngot() != null && oreInfo.getDust() != null) + { + RecipeHandler.addCrusherRecipe(MekanismUtils.size(oreInfo.getIngot(), 1), MekanismUtils.size(oreInfo.getDust(), 1)); + } + + break; + case DROP: + ItemStack ore = oreInfo.getOre(); + ItemStack drop = oreInfo.getDrop(); + + if (drop != null && ore != null) + { + RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), MekanismUtils.size(drop, 12)); + } + + break; + default: + ItemStack ore = oreInfo.getOre(); + ItemStack dust = oreInfo.getDust(); + ItemStack ingot = oreInfo.getIngot(); + + if (ore != null && dust != null) + { + RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), MekanismUtils.size(dust, 2)); + RecipeHandler.addCombinerRecipe(MekanismUtils.size(dust, 8), MekanismUtils.size(ore, 1)); + } + + if (ingot != null && dust != null) + { + RecipeHandler.addCrusherRecipe(MekanismUtils.size(ingot, 1), MekanismUtils.size(dust, 1)); + } + + break; + } + } + } + } + catch (Exception e) + { + } + }*/ } diff --git a/src/main/java/mekanism/common/integration/OreDictManager.java b/src/main/java/mekanism/common/integration/OreDictManager.java index 871bbe2f9..a8f1ab644 100644 --- a/src/main/java/mekanism/common/integration/OreDictManager.java +++ b/src/main/java/mekanism/common/integration/OreDictManager.java @@ -1,6 +1,5 @@ package mekanism.common.integration; -import ic2.api.recipe.RecipeInputOreDict; import ic2.api.recipe.Recipes; import java.util.ArrayList; @@ -11,13 +10,15 @@ import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.infuse.InfuseObject; import mekanism.api.infuse.InfuseRegistry; -import mekanism.api.util.StackUtils; import mekanism.common.Mekanism; +import mekanism.common.MekanismFluids; import mekanism.common.MekanismItems; import mekanism.common.Resource; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.StackUtils; +import net.minecraft.block.BlockPlanks; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -62,18 +63,18 @@ public final class OreDictManager { for(ItemStack ore : OreDictionary.getOres("woodRubber")) { - RecipeHandler.addPrecisionSawmillRecipe(StackUtils.size(ore, 1), new ItemStack(Blocks.PLANKS, 4), StackUtils.size(OreDictionary.getOres("itemRubber").get(0), 1), 1F); + RecipeHandler.addPrecisionSawmillRecipe(StackUtils.size(ore, 1), new ItemStack(Blocks.PLANKS, BlockPlanks.EnumType.JUNGLE.getMetadata(), 4), StackUtils.size(OreDictionary.getOres("itemRubber").get(0), 1), 1F); } } for(ItemStack ore : OreDictionary.getOres("dustSulfur")) { - RecipeHandler.addChemicalOxidizerRecipe(StackUtils.size(ore, 1), new GasStack(GasRegistry.getGas("sulfurDioxideGas"), 100)); + RecipeHandler.addChemicalOxidizerRecipe(StackUtils.size(ore, 1), new GasStack(MekanismFluids.SulfurDioxide, 100)); } for(ItemStack ore : OreDictionary.getOres("dustSalt")) { - RecipeHandler.addChemicalOxidizerRecipe(StackUtils.size(ore, 1), new GasStack(GasRegistry.getGas("brine"), 15)); + RecipeHandler.addChemicalOxidizerRecipe(StackUtils.size(ore, 1), new GasStack(MekanismFluids.Brine, 15)); } for(ItemStack ore : OreDictionary.getOres("dustRefinedObsidian")) @@ -99,7 +100,7 @@ public final class OreDictManager for(ItemStack ore : OreDictionary.getOres("crystal" + resource.getName())) { - RecipeHandler.addChemicalInjectionChamberRecipe(StackUtils.size(ore, 1), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 1, resource.ordinal())); + RecipeHandler.addChemicalInjectionChamberRecipe(StackUtils.size(ore, 1), MekanismFluids.HydrogenChloride, new ItemStack(MekanismItems.Shard, 1, resource.ordinal())); } for(ItemStack ore : OreDictionary.getOres("dustDirty" + resource.getName())) @@ -111,7 +112,7 @@ public final class OreDictManager { RecipeHandler.addEnrichmentChamberRecipe(StackUtils.size(ore, 1), new ItemStack(MekanismItems.Dust, 2, resource.ordinal())); RecipeHandler.addPurificationChamberRecipe(StackUtils.size(ore, 1), new ItemStack(MekanismItems.Clump, 3, resource.ordinal())); - RecipeHandler.addChemicalInjectionChamberRecipe(StackUtils.size(ore, 1), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 4, resource.ordinal())); + RecipeHandler.addChemicalInjectionChamberRecipe(StackUtils.size(ore, 1), MekanismFluids.HydrogenChloride, new ItemStack(MekanismItems.Shard, 4, resource.ordinal())); RecipeHandler.addChemicalDissolutionChamberRecipe(StackUtils.size(ore, 1), new GasStack(GasRegistry.getGas(resource.getName().toLowerCase()), 1000)); } @@ -291,7 +292,7 @@ public final class OreDictManager for(ItemStack ore : OreDictionary.getOres("dustLithium")) { - RecipeHandler.addChemicalOxidizerRecipe(StackUtils.size(ore, 1), new GasStack(GasRegistry.getGas("lithium"), 100)); + RecipeHandler.addChemicalOxidizerRecipe(StackUtils.size(ore, 1), new GasStack(MekanismFluids.Lithium, 100)); } for(ItemStack ore : OreDictionary.getOres("dustObsidian")) @@ -326,7 +327,7 @@ public final class OreDictManager public static void addIC2BronzeRecipe() { try { - Recipes.macerator.addRecipe(new RecipeInputOreDict("ingotBronze"), null, false, StackUtils.size(OreDictionary.getOres("dustBronze").get(0), 1)); + Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("ingotBronze"), null, false, StackUtils.size(OreDictionary.getOres("dustBronze").get(0), 1)); } catch(Exception e) {} } @@ -345,11 +346,10 @@ public final class OreDictManager }; InventoryCrafting tempCrafting = new InventoryCrafting(tempContainer, 3, 3); - ArrayList recipeList = (ArrayList)CraftingManager.getInstance().getRecipeList(); for(int i = 1; i < 9; i++) { - tempCrafting.setInventorySlotContents(i, null); + tempCrafting.setInventorySlotContents(i, ItemStack.EMPTY); } List registeredOres = OreDictionary.getOres("logWood"); diff --git a/src/main/java/mekanism/common/integration/CCPeripheral.java b/src/main/java/mekanism/common/integration/computer/CCPeripheral.java similarity index 98% rename from src/main/java/mekanism/common/integration/CCPeripheral.java rename to src/main/java/mekanism/common/integration/computer/CCPeripheral.java index 94008f185..42f479a67 100644 --- a/src/main/java/mekanism/common/integration/CCPeripheral.java +++ b/src/main/java/mekanism/common/integration/computer/CCPeripheral.java @@ -1,4 +1,4 @@ -package mekanism.common.integration; +package mekanism.common.integration.computer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; diff --git a/src/main/java/mekanism/common/integration/IComputerIntegration.java b/src/main/java/mekanism/common/integration/computer/IComputerIntegration.java similarity index 84% rename from src/main/java/mekanism/common/integration/IComputerIntegration.java rename to src/main/java/mekanism/common/integration/computer/IComputerIntegration.java index 7fe1d4b30..82dff9342 100644 --- a/src/main/java/mekanism/common/integration/IComputerIntegration.java +++ b/src/main/java/mekanism/common/integration/computer/IComputerIntegration.java @@ -1,4 +1,4 @@ -package mekanism.common.integration; +package mekanism.common.integration.computer; import net.minecraft.inventory.IInventory; diff --git a/src/main/java/mekanism/common/integration/OCDriver.java b/src/main/java/mekanism/common/integration/computer/OCDriver.java similarity index 88% rename from src/main/java/mekanism/common/integration/OCDriver.java rename to src/main/java/mekanism/common/integration/computer/OCDriver.java index 077aa5796..9572d3951 100644 --- a/src/main/java/mekanism/common/integration/OCDriver.java +++ b/src/main/java/mekanism/common/integration/computer/OCDriver.java @@ -1,4 +1,4 @@ -package mekanism.common.integration; +package mekanism.common.integration.computer; import java.util.Arrays; import java.util.Locale; @@ -7,10 +7,11 @@ import li.cil.oc.api.Network; import li.cil.oc.api.driver.NamedBlock; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Context; +import li.cil.oc.api.network.ManagedEnvironment; import li.cil.oc.api.network.ManagedPeripheral; import li.cil.oc.api.network.Visibility; +import li.cil.oc.api.prefab.AbstractManagedEnvironment; import li.cil.oc.api.prefab.DriverSidedTileEntity; -import li.cil.oc.api.prefab.ManagedEnvironment; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; @@ -40,7 +41,7 @@ public class OCDriver extends DriverSidedTileEntity return null; } - public class OCManagedEnvironment extends ManagedEnvironment implements NamedBlock, ManagedPeripheral + public class OCManagedEnvironment extends AbstractManagedEnvironment implements NamedBlock, ManagedPeripheral { public IComputerIntegration computerTile; @@ -78,4 +79,4 @@ public class OCDriver extends DriverSidedTileEntity return name; } } -} \ No newline at end of file +} diff --git a/src/main/java/mekanism/common/integration/forgeenergy/ForgeEnergyCableIntegration.java b/src/main/java/mekanism/common/integration/forgeenergy/ForgeEnergyCableIntegration.java new file mode 100644 index 000000000..b5f0e85f5 --- /dev/null +++ b/src/main/java/mekanism/common/integration/forgeenergy/ForgeEnergyCableIntegration.java @@ -0,0 +1,55 @@ +package mekanism.common.integration.forgeenergy; + +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.tile.transmitter.TileEntityUniversalCable; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.energy.IEnergyStorage; + +public class ForgeEnergyCableIntegration implements IEnergyStorage +{ + public TileEntityUniversalCable tileEntity; + + public EnumFacing side; + + public ForgeEnergyCableIntegration(TileEntityUniversalCable tile, EnumFacing facing) + { + tileEntity = tile; + side = facing; + } + + @Override + public int receiveEnergy(int maxReceive, boolean simulate) + { + return (int)Math.round(tileEntity.acceptEnergy(side, maxReceive*general.FROM_FORGE, simulate)*general.TO_FORGE); + } + + @Override + public int extractEnergy(int maxExtract, boolean simulate) + { + return 0; + } + + @Override + public int getEnergyStored() + { + return (int)Math.round(Math.min(Integer.MAX_VALUE, tileEntity.getEnergy()*general.TO_FORGE)); + } + + @Override + public int getMaxEnergyStored() + { + return (int)Math.round(Math.min(Integer.MAX_VALUE, tileEntity.getMaxEnergy()*general.TO_FORGE)); + } + + @Override + public boolean canExtract() + { + return false; + } + + @Override + public boolean canReceive() + { + return tileEntity.canReceiveEnergy(side); + } +} diff --git a/src/main/java/mekanism/common/integration/forgeenergy/ForgeEnergyIntegration.java b/src/main/java/mekanism/common/integration/forgeenergy/ForgeEnergyIntegration.java new file mode 100644 index 000000000..86dfd217a --- /dev/null +++ b/src/main/java/mekanism/common/integration/forgeenergy/ForgeEnergyIntegration.java @@ -0,0 +1,65 @@ +package mekanism.common.integration.forgeenergy; + +import mekanism.common.base.IEnergyWrapper; +import mekanism.common.config.MekanismConfig.general; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.energy.IEnergyStorage; + +public class ForgeEnergyIntegration implements IEnergyStorage +{ + public IEnergyWrapper tileEntity; + + public EnumFacing side; + + public ForgeEnergyIntegration(IEnergyWrapper tile, EnumFacing facing) + { + tileEntity = tile; + side = facing; + } + + @Override + public int receiveEnergy(int maxReceive, boolean simulate) + { + return rfToForge(tileEntity.receiveEnergy(side, forgeToRF(maxReceive), simulate)); + } + + @Override + public int extractEnergy(int maxExtract, boolean simulate) + { + return rfToForge(tileEntity.extractEnergy(side, forgeToRF(maxExtract), simulate)); + } + + @Override + public int getEnergyStored() + { + return (int)Math.round(Math.min(Integer.MAX_VALUE, tileEntity.getEnergy()*general.TO_FORGE)); + } + + @Override + public int getMaxEnergyStored() + { + return (int)Math.round(Math.min(Integer.MAX_VALUE, tileEntity.getMaxEnergy()*general.TO_FORGE)); + } + + @Override + public boolean canExtract() + { + return tileEntity.getOutputtingSides().contains(side); + } + + @Override + public boolean canReceive() + { + return tileEntity.getConsumingSides().contains(side); + } + + public static int rfToForge(int rf) + { + return (int)Math.round(rf*general.FROM_RF*general.TO_FORGE); + } + + public static int forgeToRF(int forge) + { + return (int)Math.round(forge*general.FROM_FORGE*general.TO_RF); + } +} diff --git a/src/main/java/mekanism/common/integration/forgeenergy/ForgeEnergyItemWrapper.java b/src/main/java/mekanism/common/integration/forgeenergy/ForgeEnergyItemWrapper.java new file mode 100644 index 000000000..046e6630f --- /dev/null +++ b/src/main/java/mekanism/common/integration/forgeenergy/ForgeEnergyItemWrapper.java @@ -0,0 +1,84 @@ +package mekanism.common.integration.forgeenergy; + +import mekanism.api.energy.IEnergizedItem; +import mekanism.common.capabilities.ItemCapabilityWrapper.ItemCapability; +import mekanism.common.config.MekanismConfig.general; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.energy.CapabilityEnergy; +import net.minecraftforge.energy.IEnergyStorage; + +public class ForgeEnergyItemWrapper extends ItemCapability implements IEnergyStorage +{ + @Override + public boolean canProcess(Capability capability) + { + return capability == CapabilityEnergy.ENERGY; + } + + public IEnergizedItem getItem() + { + return (IEnergizedItem)getStack().getItem(); + } + + @Override + public int receiveEnergy(int maxReceive, boolean simulate) + { + if(getItem().canReceive(getStack())) + { + int energyNeeded = getMaxEnergyStored()-getEnergyStored(); + int toReceive = Math.min(maxReceive, energyNeeded); + + if(!simulate) + { + getItem().setEnergy(getStack(), getItem().getEnergy(getStack()) + toReceive*general.FROM_TESLA); + } + + return toReceive; + } + + return 0; + } + + @Override + public int extractEnergy(int maxExtract, boolean simulate) + { + if(getItem().canSend(getStack())) + { + int energyRemaining = getEnergyStored(); + int toSend = Math.min(maxExtract, energyRemaining); + + if(!simulate) + { + getItem().setEnergy(getStack(), getItem().getEnergy(getStack()) - toSend*general.FROM_TESLA); + } + + return toSend; + } + + return 0; + } + + @Override + public int getEnergyStored() + { + return (int)Math.round(getItem().getEnergy(getStack())*general.TO_FORGE); + } + + @Override + public int getMaxEnergyStored() + { + return (int)Math.round(getItem().getMaxEnergy(getStack())*general.TO_FORGE); + } + + @Override + public boolean canExtract() + { + return getItem().canSend(getStack()); + } + + @Override + public boolean canReceive() + { + return getItem().canReceive(getStack()); + } +} diff --git a/src/main/java/mekanism/common/integration/IC2Integration.java b/src/main/java/mekanism/common/integration/ic2/IC2Integration.java similarity index 95% rename from src/main/java/mekanism/common/integration/IC2Integration.java rename to src/main/java/mekanism/common/integration/ic2/IC2Integration.java index 2ae2731cc..a0146caac 100644 --- a/src/main/java/mekanism/common/integration/IC2Integration.java +++ b/src/main/java/mekanism/common/integration/ic2/IC2Integration.java @@ -1,11 +1,11 @@ -package mekanism.common.integration; +package mekanism.common.integration.ic2; import ic2.api.energy.EnergyNet; import ic2.api.energy.tile.IEnergySink; import ic2.api.energy.tile.IEnergySource; import ic2.api.energy.tile.IEnergyTile; -import mekanism.api.MekanismConfig.general; import mekanism.common.base.IEnergyWrapper; +import mekanism.common.config.MekanismConfig.general; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.common.Optional.Method; diff --git a/src/main/java/mekanism/common/integration/IC2ItemManager.java b/src/main/java/mekanism/common/integration/ic2/IC2ItemManager.java similarity index 96% rename from src/main/java/mekanism/common/integration/IC2ItemManager.java rename to src/main/java/mekanism/common/integration/ic2/IC2ItemManager.java index 3dd1e921b..aeef7604a 100644 --- a/src/main/java/mekanism/common/integration/IC2ItemManager.java +++ b/src/main/java/mekanism/common/integration/ic2/IC2ItemManager.java @@ -1,8 +1,8 @@ -package mekanism.common.integration; +package mekanism.common.integration.ic2; import ic2.api.item.IElectricItemManager; -import mekanism.api.MekanismConfig.general; import mekanism.api.energy.IEnergizedItem; +import mekanism.common.config.MekanismConfig.general; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; diff --git a/src/main/java/mekanism/common/integration/multipart/MultipartGlowPanel.java b/src/main/java/mekanism/common/integration/multipart/MultipartGlowPanel.java new file mode 100644 index 000000000..415a7e9aa --- /dev/null +++ b/src/main/java/mekanism/common/integration/multipart/MultipartGlowPanel.java @@ -0,0 +1,27 @@ +package mekanism.common.integration.multipart; + +import mcmultipart.api.multipart.IMultipart; +import mcmultipart.api.slot.EnumFaceSlot; +import mcmultipart.api.slot.IPartSlot; +import mekanism.common.block.states.BlockStateFacing; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class MultipartGlowPanel implements IMultipart +{ + @Override + public IPartSlot getSlotForPlacement(World world, BlockPos pos, IBlockState state, EnumFacing facing, float hitX, float hitY,float hitZ, EntityLivingBase placer) + { + return EnumFaceSlot.values()[facing.ordinal()]; + } + + @Override + public IPartSlot getSlotFromWorld(IBlockAccess world, BlockPos pos, IBlockState state) + { + return EnumFaceSlot.values()[state.getValue(BlockStateFacing.facingProperty).ordinal()]; + } +} diff --git a/src/main/java/mekanism/common/integration/multipart/MultipartMekanism.java b/src/main/java/mekanism/common/integration/multipart/MultipartMekanism.java new file mode 100644 index 000000000..748b72089 --- /dev/null +++ b/src/main/java/mekanism/common/integration/multipart/MultipartMekanism.java @@ -0,0 +1,165 @@ +package mekanism.common.integration.multipart; + +import static mekanism.common.block.states.BlockStateMachine.MachineBlock.MACHINE_BLOCK_1; +import static mekanism.common.block.states.BlockStateMachine.MachineBlock.MACHINE_BLOCK_2; + +import java.util.Collection; +import java.util.Collections; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import mcmultipart.api.addon.IMCMPAddon; +import mcmultipart.api.addon.MCMPAddon; +import mcmultipart.api.container.IPartInfo; +import mcmultipart.api.multipart.IMultipart; +import mcmultipart.api.multipart.IMultipartRegistry; +import mcmultipart.api.multipart.IMultipartTile; +import mcmultipart.api.multipart.MultipartOcclusionHelper; +import mcmultipart.api.ref.MCMPCapabilities; +import mekanism.common.MekanismBlocks; +import mekanism.common.block.BlockTransmitter; +import mekanism.common.block.states.BlockStateMachine.MachineType; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterType.Size; +import mekanism.common.tile.TileEntityGlowPanel; +import mekanism.common.tile.transmitter.TileEntityTransmitter; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.event.AttachCapabilitiesEvent; +import net.minecraftforge.fml.common.event.FMLInterModComms; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +@MCMPAddon +public class MultipartMekanism implements IMCMPAddon +{ + @SubscribeEvent + public void onAttachTile(AttachCapabilitiesEvent event) + { + TileEntity tile = event.getObject(); + + if(tile instanceof TileEntityTransmitter) + { + register(event, "transmitter"); + } + else if(tile instanceof TileEntityGlowPanel) + { + register(event, "glow_panel"); + } + } + + @Override + public void registerParts(IMultipartRegistry registry) + { + MinecraftForge.EVENT_BUS.register(this); + + registry.registerPartWrapper(MekanismBlocks.Transmitter, new MultipartTransmitter()); + registry.registerStackWrapper(Item.getItemFromBlock(MekanismBlocks.Transmitter), s -> true, MekanismBlocks.Transmitter); + registry.registerPartWrapper(MekanismBlocks.GlowPanel, new MultipartGlowPanel()); + registry.registerStackWrapper(Item.getItemFromBlock(MekanismBlocks.GlowPanel), s -> true, MekanismBlocks.GlowPanel); + } + + private void register(AttachCapabilitiesEvent e, String id) + { + e.addCapability(new ResourceLocation("mekanism:" + id), new ICapabilityProvider() { + private MultipartTile tile; + + @Override + public boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) + { + return capability == MCMPCapabilities.MULTIPART_TILE; + } + + @Nullable + @Override + public T getCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) + { + if(capability == MCMPCapabilities.MULTIPART_TILE) + { + if(tile == null) + { + tile = new MultipartTile(e.getObject(), id); + } + + return MCMPCapabilities.MULTIPART_TILE.cast(tile); + } + + return null; + } + }); + } + + public void init() + { + registerMicroMaterials(); + } + + public void registerMicroMaterials() + { + for(int i = 0; i < 16; i++) + { + FMLInterModComms.sendMessage("ForgeMicroblock", "microMaterial", new ItemStack(MekanismBlocks.BasicBlock, 1, i)); + + if(!MachineType.get(MACHINE_BLOCK_1, i).hasModel) + { + FMLInterModComms.sendMessage("ForgeMicroblock", "microMaterial", new ItemStack(MekanismBlocks.MachineBlock, 1, i)); + } + + if(!MachineType.get(MACHINE_BLOCK_2, i).hasModel) + { + FMLInterModComms.sendMessage("ForgeMicroblock", "microMaterial", new ItemStack(MekanismBlocks.MachineBlock2, 1, i)); + } + } + + FMLInterModComms.sendMessage("ForgeMicroblock", "microMaterial", new ItemStack(MekanismBlocks.BasicBlock2, 1, 0)); + FMLInterModComms.sendMessage("ForgeMicroblock", "microMaterial", new ItemStack(MekanismBlocks.CardboardBox)); + } + + public static boolean hasConnectionWith(TileEntity tile, EnumFacing side) + { + if(tile != null && tile.hasCapability(MCMPCapabilities.MULTIPART_TILE, null)) + { + IMultipartTile multipartTile = tile.getCapability(MCMPCapabilities.MULTIPART_TILE, null); + + if(multipartTile instanceof MultipartTile && ((MultipartTile)multipartTile).getID().equals("transmitter")) + { + IPartInfo partInfo = ((MultipartTile)multipartTile).getInfo(); + + if(partInfo != null) + { + for(IPartInfo info : partInfo.getContainer().getParts().values()) + { + IMultipart multipart = info.getPart(); + Collection origBounds = getTransmitterSideBounds(multipartTile, side); + + if(MultipartOcclusionHelper.testBoxIntersection(origBounds, multipart.getOcclusionBoxes(info))) + { + return false; + } + } + } + } + } + + return true; + } + + public static Collection getTransmitterSideBounds(IMultipartTile tile, EnumFacing side) + { + if(tile.getTileEntity() instanceof TileEntityTransmitter) + { + TileEntityTransmitter transmitter = ((TileEntityTransmitter)tile.getTileEntity()); + boolean large = transmitter.getTransmitterType().getSize() == Size.LARGE; + AxisAlignedBB ret = large ? BlockTransmitter.largeSides[side.ordinal()] : BlockTransmitter.smallSides[side.ordinal()]; + return Collections.singletonList(ret); + } + + return Collections.emptyList(); + } +} diff --git a/src/main/java/mekanism/common/integration/multipart/MultipartTile.java b/src/main/java/mekanism/common/integration/multipart/MultipartTile.java new file mode 100644 index 000000000..496fb81ae --- /dev/null +++ b/src/main/java/mekanism/common/integration/multipart/MultipartTile.java @@ -0,0 +1,40 @@ +package mekanism.common.integration.multipart; + +import mcmultipart.api.container.IPartInfo; +import mcmultipart.api.multipart.IMultipartTile; +import net.minecraft.tileentity.TileEntity; + +public class MultipartTile implements IMultipartTile +{ + private TileEntity owner; + private String id; + private IPartInfo partInfo; + + public MultipartTile(TileEntity tile, String s) + { + owner = tile; + id = s; + } + + @Override + public void setPartInfo(IPartInfo info) + { + partInfo = info; + } + + @Override + public TileEntity getTileEntity() + { + return owner; + } + + public String getID() + { + return id; + } + + public IPartInfo getInfo() + { + return partInfo; + } +} diff --git a/src/main/java/mekanism/common/integration/multipart/MultipartTransmitter.java b/src/main/java/mekanism/common/integration/multipart/MultipartTransmitter.java new file mode 100644 index 000000000..947af9bbf --- /dev/null +++ b/src/main/java/mekanism/common/integration/multipart/MultipartTransmitter.java @@ -0,0 +1,40 @@ +package mekanism.common.integration.multipart; + +import mcmultipart.api.container.IPartInfo; +import mcmultipart.api.multipart.IMultipart; +import mcmultipart.api.slot.EnumCenterSlot; +import mcmultipart.api.slot.IPartSlot; +import mekanism.common.tile.transmitter.TileEntitySidedPipe; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class MultipartTransmitter implements IMultipart +{ + @Override + public IPartSlot getSlotForPlacement(World world, BlockPos pos, IBlockState state, EnumFacing facing, float hitX, float hitY, float hitZ, EntityLivingBase placer) + { + return EnumCenterSlot.CENTER; + } + + @Override + public IPartSlot getSlotFromWorld(IBlockAccess world, BlockPos pos, IBlockState state) + { + return EnumCenterSlot.CENTER; + } + + @Override + public void onPartChanged(IPartInfo part, IPartInfo otherPart) + { + TileEntity tile = part.getTile().getTileEntity(); + + if(tile instanceof TileEntitySidedPipe) + { + ((TileEntitySidedPipe)tile).onPartChanged(otherPart.getPart()); + } + } +} diff --git a/src/main/java/mekanism/common/integration/tesla/TeslaCableIntegration.java b/src/main/java/mekanism/common/integration/tesla/TeslaCableIntegration.java new file mode 100644 index 000000000..878a1d6f1 --- /dev/null +++ b/src/main/java/mekanism/common/integration/tesla/TeslaCableIntegration.java @@ -0,0 +1,29 @@ +package mekanism.common.integration.tesla; + +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.tile.transmitter.TileEntityUniversalCable; +import net.darkhax.tesla.api.ITeslaConsumer; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.fml.common.Optional.Interface; +import net.minecraftforge.fml.common.Optional.Method; + +@Interface(iface = "net.darkhax.tesla.api.ITeslaConsumer", modid = "tesla") +public class TeslaCableIntegration implements ITeslaConsumer +{ + public TileEntityUniversalCable tileEntity; + + public EnumFacing side; + + public TeslaCableIntegration(TileEntityUniversalCable tile, EnumFacing facing) + { + tileEntity = tile; + side = facing; + } + + @Override + @Method(modid = "tesla") + public long givePower(long power, boolean simulated) + { + return (long)Math.round(tileEntity.acceptEnergy(side, power*general.FROM_TESLA, simulated)*general.TO_TESLA); + } +} diff --git a/src/main/java/mekanism/common/integration/TeslaIntegration.java b/src/main/java/mekanism/common/integration/tesla/TeslaIntegration.java similarity index 73% rename from src/main/java/mekanism/common/integration/TeslaIntegration.java rename to src/main/java/mekanism/common/integration/tesla/TeslaIntegration.java index 81b730f58..a601e9a1c 100644 --- a/src/main/java/mekanism/common/integration/TeslaIntegration.java +++ b/src/main/java/mekanism/common/integration/tesla/TeslaIntegration.java @@ -1,7 +1,7 @@ -package mekanism.common.integration; +package mekanism.common.integration.tesla; -import mekanism.api.MekanismConfig.general; import mekanism.common.base.IEnergyWrapper; +import mekanism.common.config.MekanismConfig.general; import net.darkhax.tesla.api.ITeslaConsumer; import net.darkhax.tesla.api.ITeslaHolder; import net.darkhax.tesla.api.ITeslaProducer; @@ -45,13 +45,23 @@ public class TeslaIntegration implements ITeslaHolder, ITeslaConsumer, ITeslaPro @Method(modid = "tesla") public long takePower(long power, boolean simulated) { - return (long)(tileEntity.extractEnergy(side, (int)(power*general.FROM_TESLA*general.TO_RF), simulated)*general.FROM_RF*general.TO_TESLA); + return rfToTesla(tileEntity.extractEnergy(side, teslaToRF(power), simulated)); } @Override @Method(modid = "tesla") public long givePower(long power, boolean simulated) { - return (long)(tileEntity.receiveEnergy(side, (int)(power*general.FROM_TESLA*general.TO_RF), simulated)*general.FROM_RF*general.TO_TESLA); + return rfToTesla(tileEntity.receiveEnergy(side, teslaToRF(power), simulated)); + } + + public long rfToTesla(int rf) + { + return (long)Math.round(rf*general.FROM_RF*general.TO_TESLA); + } + + public int teslaToRF(long tesla) + { + return (int)Math.round(Math.min(Integer.MAX_VALUE, tesla*general.FROM_TESLA*general.TO_RF)); } } diff --git a/src/main/java/mekanism/common/integration/TeslaItemWrapper.java b/src/main/java/mekanism/common/integration/tesla/TeslaItemWrapper.java similarity index 96% rename from src/main/java/mekanism/common/integration/TeslaItemWrapper.java rename to src/main/java/mekanism/common/integration/tesla/TeslaItemWrapper.java index 33fa8232f..7c042d4e5 100644 --- a/src/main/java/mekanism/common/integration/TeslaItemWrapper.java +++ b/src/main/java/mekanism/common/integration/tesla/TeslaItemWrapper.java @@ -1,9 +1,9 @@ -package mekanism.common.integration; +package mekanism.common.integration.tesla; -import mekanism.api.MekanismConfig.general; import mekanism.api.energy.IEnergizedItem; import mekanism.common.capabilities.Capabilities; import mekanism.common.capabilities.ItemCapabilityWrapper.ItemCapability; +import mekanism.common.config.MekanismConfig.general; import net.darkhax.tesla.api.ITeslaConsumer; import net.darkhax.tesla.api.ITeslaHolder; import net.darkhax.tesla.api.ITeslaProducer; diff --git a/src/main/java/mekanism/common/inventory/InventoryBin.java b/src/main/java/mekanism/common/inventory/InventoryBin.java index cc3a39030..360a95a51 100644 --- a/src/main/java/mekanism/common/inventory/InventoryBin.java +++ b/src/main/java/mekanism/common/inventory/InventoryBin.java @@ -1,10 +1,11 @@ package mekanism.common.inventory; -import mekanism.api.util.StackUtils; import mekanism.common.Tier.BinTier; import mekanism.common.base.ITierItem; import mekanism.common.block.states.BlockStateBasic.BasicBlockType; +import mekanism.common.util.InventoryUtils; import mekanism.common.util.ItemDataUtils; +import mekanism.common.util.StackUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -19,29 +20,29 @@ public class InventoryBin public ItemStack getStack() { - if(getItemCount() > 0 && getItemType() != null) + if(getItemCount() > 0 && !getItemType().isEmpty()) { ItemStack ret = getItemType().copy(); - ret.stackSize = Math.min(getItemType().getMaxStackSize(), getItemCount()); + ret.setCount(Math.min(getItemType().getMaxStackSize(), getItemCount())); return ret; } - return null; + return ItemStack.EMPTY; } public ItemStack removeStack() { ItemStack stack = getStack(); - if(stack == null) + if(stack.isEmpty()) { - return null; + return ItemStack.EMPTY; } if(getTier() != BinTier.CREATIVE) { - setItemCount(getItemCount() - stack.stackSize); + setItemCount(getItemCount() - stack.getCount()); } return stack.copy(); @@ -51,21 +52,21 @@ public class InventoryBin { if(isValid(stack) && (getTier() == BinTier.CREATIVE || getItemCount() != getMaxStorage())) { - if(getItemType() == null) + if(getItemType().isEmpty()) { setItemType(stack); } if(getTier() != BinTier.CREATIVE) { - if(getItemCount() + stack.stackSize <= getMaxStorage()) + if(getItemCount() + stack.getCount() <= getMaxStorage()) { - setItemCount(getItemCount() + stack.stackSize); - return null; + setItemCount(getItemCount() + stack.getCount()); + return ItemStack.EMPTY; } else { ItemStack rejects = getItemType().copy(); - rejects.stackSize = (getItemCount()+stack.stackSize) - getMaxStorage(); + rejects.setCount((getItemCount()+stack.getCount()) - getMaxStorage()); setItemCount(getMaxStorage()); @@ -82,7 +83,7 @@ public class InventoryBin public boolean isValid(ItemStack stack) { - if(stack == null || stack.stackSize <= 0) + if(stack.isEmpty() || stack.getCount() <= 0) { return false; } @@ -92,7 +93,7 @@ public class InventoryBin return false; } - if(getItemType() == null) + if(getItemType().isEmpty()) { return true; } @@ -126,7 +127,7 @@ public class InventoryBin if(getItemCount() == 0) { - setItemType(null); + setItemType(ItemStack.EMPTY); } } @@ -134,15 +135,15 @@ public class InventoryBin { if(getItemCount() == 0) { - return null; + return ItemStack.EMPTY; } - return ItemStack.loadItemStackFromNBT(ItemDataUtils.getCompound(bin, "storedItem")); + return InventoryUtils.loadFromNBT(ItemDataUtils.getCompound(bin, "storedItem")); } public void setItemType(ItemStack stack) { - if(stack == null) + if(stack.isEmpty()) { ItemDataUtils.removeData(bin, "storedItem"); return; diff --git a/src/main/java/mekanism/common/inventory/InventoryPersonalChest.java b/src/main/java/mekanism/common/inventory/InventoryPersonalChest.java index 39da19070..a0ff60c6f 100644 --- a/src/main/java/mekanism/common/inventory/InventoryPersonalChest.java +++ b/src/main/java/mekanism/common/inventory/InventoryPersonalChest.java @@ -1,6 +1,7 @@ package mekanism.common.inventory; import mekanism.common.base.ISustainedInventory; +import mekanism.common.util.InventoryUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.InventoryBasic; import net.minecraft.item.ItemStack; @@ -63,7 +64,7 @@ public class InventoryPersonalChest extends InventoryBasic for(int slotCount = 0; slotCount < getSizeInventory(); slotCount++) { - if(getStackInSlot(slotCount) != null) + if(!getStackInSlot(slotCount).isEmpty()) { NBTTagCompound tagCompound = new NBTTagCompound(); tagCompound.setByte("Slot", (byte)slotCount); @@ -72,7 +73,7 @@ public class InventoryPersonalChest extends InventoryBasic } } - if(getStack() != null) + if(!getStack().isEmpty()) { ((ISustainedInventory)getStack().getItem()).setInventory(tagList, getStack()); } @@ -98,7 +99,7 @@ public class InventoryPersonalChest extends InventoryBasic if(slotID >= 0 && slotID < getSizeInventory()) { - setInventorySlotContents(slotID, ItemStack.loadItemStackFromNBT(tagCompound)); + setInventorySlotContents(slotID, InventoryUtils.loadFromNBT(tagCompound)); } } } @@ -108,6 +109,6 @@ public class InventoryPersonalChest extends InventoryBasic public ItemStack getStack() { - return itemStack != null ? itemStack : entityPlayer.getHeldItem(currentHand); + return !itemStack.isEmpty() ? itemStack : entityPlayer.getHeldItem(currentHand); } } diff --git a/src/main/java/mekanism/common/inventory/container/ContainerAdvancedElectricMachine.java b/src/main/java/mekanism/common/inventory/container/ContainerAdvancedElectricMachine.java index cd8b22f0c..86a3310c6 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerAdvancedElectricMachine.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerAdvancedElectricMachine.java @@ -5,7 +5,7 @@ import java.util.Map; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; import mekanism.common.inventory.slot.SlotOutput; import mekanism.common.recipe.inputs.AdvancedMachineInput; -import mekanism.common.tile.TileEntityAdvancedElectricMachine; +import mekanism.common.tile.prefab.TileEntityAdvancedElectricMachine; import mekanism.common.util.ChargeUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -56,13 +56,13 @@ public class ContainerAdvancedElectricMachine extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -74,7 +74,7 @@ public class ContainerAdvancedElectricMachine extends Container { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } else if(ChargeUtils.canBeDischarged(slotStack)) @@ -83,13 +83,13 @@ public class ContainerAdvancedElectricMachine extends Container { if(!mergeItemStack(slotStack, 3, 4, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -99,13 +99,13 @@ public class ContainerAdvancedElectricMachine extends Container { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -115,13 +115,13 @@ public class ContainerAdvancedElectricMachine extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -130,38 +130,38 @@ public class ContainerAdvancedElectricMachine extends Container { if(!mergeItemStack(slotStack, 31, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 30) { if(!mergeItemStack(slotStack, 4, 30, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerChanceMachine.java b/src/main/java/mekanism/common/inventory/container/ContainerChanceMachine.java index b2a2db59a..413a1c8dc 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerChanceMachine.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerChanceMachine.java @@ -55,13 +55,13 @@ public class ContainerChanceMachine extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -73,7 +73,7 @@ public class ContainerChanceMachine extends Container { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } else if(ChargeUtils.canBeDischarged(slotStack)) @@ -82,14 +82,14 @@ public class ContainerChanceMachine extends Container { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 1) { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -99,13 +99,13 @@ public class ContainerChanceMachine extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -114,38 +114,38 @@ public class ContainerChanceMachine extends Container { if(!mergeItemStack(slotStack, 31, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 30) { if(!mergeItemStack(slotStack, 4, 30, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerChemicalCrystallizer.java b/src/main/java/mekanism/common/inventory/container/ContainerChemicalCrystallizer.java index 1dd32d5ff..59285818a 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerChemicalCrystallizer.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerChemicalCrystallizer.java @@ -54,13 +54,13 @@ public class ContainerChemicalCrystallizer extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -74,13 +74,13 @@ public class ContainerChemicalCrystallizer extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -88,7 +88,7 @@ public class ContainerChemicalCrystallizer extends Container { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } else if(ChargeUtils.canBeDischarged(slotStack)) @@ -97,14 +97,14 @@ public class ContainerChemicalCrystallizer extends Container { if(!mergeItemStack(slotStack, 2, 3, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 2) { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -113,38 +113,38 @@ public class ContainerChemicalCrystallizer extends Container { if(!mergeItemStack(slotStack, 30, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 29) { if(!mergeItemStack(slotStack, 3, 29, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerChemicalDissolutionChamber.java b/src/main/java/mekanism/common/inventory/container/ContainerChemicalDissolutionChamber.java index 6f471c1c6..b7e350500 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerChemicalDissolutionChamber.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerChemicalDissolutionChamber.java @@ -56,13 +56,13 @@ public class ContainerChemicalDissolutionChamber extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -76,13 +76,13 @@ public class ContainerChemicalDissolutionChamber extends Container { if(!mergeItemStack(slotStack, 1, 2, true)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -92,14 +92,14 @@ public class ContainerChemicalDissolutionChamber extends Container { if(!mergeItemStack(slotStack, 3, 4, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 3) { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -111,14 +111,14 @@ public class ContainerChemicalDissolutionChamber extends Container { if(!mergeItemStack(slotStack, 2, 3, false)) { - return null; + return ItemStack.EMPTY; } } } else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -127,38 +127,38 @@ public class ContainerChemicalDissolutionChamber extends Container { if(!mergeItemStack(slotStack, 31, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 30) { if(!mergeItemStack(slotStack, 4, 30, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerChemicalInfuser.java b/src/main/java/mekanism/common/inventory/container/ContainerChemicalInfuser.java index 634d69128..ab08acb1f 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerChemicalInfuser.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerChemicalInfuser.java @@ -54,13 +54,13 @@ public class ContainerChemicalInfuser extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -74,14 +74,14 @@ public class ContainerChemicalInfuser extends Container { if(!mergeItemStack(slotStack, 3, 4, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 3) { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -91,13 +91,13 @@ public class ContainerChemicalInfuser extends Container { if(!mergeItemStack(slotStack, 0, 3, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 5, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -106,38 +106,38 @@ public class ContainerChemicalInfuser extends Container { if(!mergeItemStack(slotStack, 31, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 30) { if(!mergeItemStack(slotStack, 4, 30, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerChemicalOxidizer.java b/src/main/java/mekanism/common/inventory/container/ContainerChemicalOxidizer.java index 7eea1d294..1d48f6c4f 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerChemicalOxidizer.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerChemicalOxidizer.java @@ -55,13 +55,13 @@ public class ContainerChemicalOxidizer extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -75,14 +75,14 @@ public class ContainerChemicalOxidizer extends Container { if(!mergeItemStack(slotStack, 0, 1, true)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 0) { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -92,14 +92,14 @@ public class ContainerChemicalOxidizer extends Container { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 1) { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -109,13 +109,13 @@ public class ContainerChemicalOxidizer extends Container { if(!mergeItemStack(slotStack, 2, 3, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -124,38 +124,38 @@ public class ContainerChemicalOxidizer extends Container { if(!mergeItemStack(slotStack, 30, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 29) { if(!mergeItemStack(slotStack, 3, 29, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerChemicalWasher.java b/src/main/java/mekanism/common/inventory/container/ContainerChemicalWasher.java index 3960c3424..e2eccc915 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerChemicalWasher.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerChemicalWasher.java @@ -57,13 +57,13 @@ public class ContainerChemicalWasher extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -75,7 +75,7 @@ public class ContainerChemicalWasher extends Container { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } else if(FluidUtil.getFluidContained(slotStack) != null && FluidUtil.getFluidContained(slotStack).getFluid() == FluidRegistry.WATER) @@ -84,13 +84,13 @@ public class ContainerChemicalWasher extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -100,13 +100,13 @@ public class ContainerChemicalWasher extends Container { if(!mergeItemStack(slotStack, 2, 3, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -116,14 +116,14 @@ public class ContainerChemicalWasher extends Container { if(!mergeItemStack(slotStack, 3, 4, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 3) { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -132,38 +132,38 @@ public class ContainerChemicalWasher extends Container { if(!mergeItemStack(slotStack, 31, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 31) { if(!mergeItemStack(slotStack, 4, 30, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerDictionary.java b/src/main/java/mekanism/common/inventory/container/ContainerDictionary.java index 231ffec87..122c843e7 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerDictionary.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerDictionary.java @@ -35,7 +35,7 @@ public class ContainerDictionary extends Container @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -47,37 +47,37 @@ public class ContainerDictionary extends Container { if(!mergeItemStack(slotStack, 27, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 26) { if(!mergeItemStack(slotStack, 0, 26, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 0, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerDigitalMiner.java b/src/main/java/mekanism/common/inventory/container/ContainerDigitalMiner.java index bb64f0c33..177c1027f 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerDigitalMiner.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerDigitalMiner.java @@ -58,13 +58,13 @@ public class ContainerDigitalMiner extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -78,14 +78,14 @@ public class ContainerDigitalMiner extends Container { if(!mergeItemStack(slotStack, 27, 28, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID <= 27) { if(!mergeItemStack(slotStack, 28, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -94,29 +94,29 @@ public class ContainerDigitalMiner extends Container { if(!mergeItemStack(slotStack, 28, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } else if(!mergeItemStack(slotStack, 0, 27, false)) { - return null; + return ItemStack.EMPTY; } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerDynamicTank.java b/src/main/java/mekanism/common/inventory/container/ContainerDynamicTank.java index 3dc9027f0..6f52255dd 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerDynamicTank.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerDynamicTank.java @@ -50,13 +50,13 @@ public class ContainerDynamicTank extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -70,13 +70,13 @@ public class ContainerDynamicTank extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -85,38 +85,38 @@ public class ContainerDynamicTank extends Container { if(!mergeItemStack(slotStack, 29, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 28) { if(!mergeItemStack(slotStack, 2, 28, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerElectricMachine.java b/src/main/java/mekanism/common/inventory/container/ContainerElectricMachine.java index 1cea3ef0e..a1bc5e83b 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerElectricMachine.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerElectricMachine.java @@ -4,7 +4,7 @@ import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; import mekanism.common.inventory.slot.SlotOutput; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.inputs.ItemStackInput; -import mekanism.common.tile.TileEntityElectricMachine; +import mekanism.common.tile.prefab.TileEntityElectricMachine; import mekanism.common.util.ChargeUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -54,13 +54,13 @@ public class ContainerElectricMachine extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -72,7 +72,7 @@ public class ContainerElectricMachine extends Container { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } else if(RecipeHandler.getRecipe(new ItemStackInput(slotStack), tileEntity.getRecipes()) != null) @@ -81,13 +81,13 @@ public class ContainerElectricMachine extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -97,14 +97,14 @@ public class ContainerElectricMachine extends Container { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 1) { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -113,38 +113,38 @@ public class ContainerElectricMachine extends Container { if(!mergeItemStack(slotStack, 30, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 29) { if(!mergeItemStack(slotStack, 3, 29, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerElectricPump.java b/src/main/java/mekanism/common/inventory/container/ContainerElectricPump.java index 8587beb6b..2ea04f34a 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerElectricPump.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerElectricPump.java @@ -54,13 +54,13 @@ public class ContainerElectricPump extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -131,20 +131,20 @@ public class ContainerElectricPump extends Container } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { return null; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerElectrolyticSeparator.java b/src/main/java/mekanism/common/inventory/container/ContainerElectrolyticSeparator.java index 3ef39d7ca..b06abcdde 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerElectrolyticSeparator.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerElectrolyticSeparator.java @@ -1,7 +1,7 @@ package mekanism.common.inventory.container; -import mekanism.api.gas.GasRegistry; import mekanism.api.gas.IGasItem; +import mekanism.common.MekanismFluids; import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge; import mekanism.common.inventory.slot.SlotStorageTank; import mekanism.common.recipe.RecipeHandler; @@ -56,13 +56,13 @@ public class ContainerElectrolyticSeparator extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -76,25 +76,25 @@ public class ContainerElectrolyticSeparator extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotStack.getItem() instanceof IGasItem) { if(((IGasItem)slotStack.getItem()).getGas(slotStack) != null) { - if(((IGasItem)slotStack.getItem()).getGas(slotStack).getGas() == GasRegistry.getGas("hydrogen")) + if(((IGasItem)slotStack.getItem()).getGas(slotStack).getGas() == MekanismFluids.Hydrogen) { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } - else if(((IGasItem)slotStack.getItem()).getGas(slotStack).getGas() == GasRegistry.getGas("oxygen")) + else if(((IGasItem)slotStack.getItem()).getGas(slotStack).getGas() == MekanismFluids.Oxygen) { if(!mergeItemStack(slotStack, 2, 3, false)) { - return null; + return ItemStack.EMPTY; } } } @@ -104,7 +104,7 @@ public class ContainerElectrolyticSeparator extends Container { if(!mergeItemStack(slotStack, 2, 3, false)) { - return null; + return ItemStack.EMPTY; } } } @@ -113,7 +113,7 @@ public class ContainerElectrolyticSeparator extends Container { if(!mergeItemStack(slotStack, 3, 4, false)) { - return null; + return ItemStack.EMPTY; } } else { @@ -121,20 +121,20 @@ public class ContainerElectrolyticSeparator extends Container { if(!mergeItemStack(slotStack, 31, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 30) { if(!mergeItemStack(slotStack, 4, 30, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -142,24 +142,24 @@ public class ContainerElectrolyticSeparator extends Container else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerEnergyCube.java b/src/main/java/mekanism/common/inventory/container/ContainerEnergyCube.java index f91b6ff93..78ac955c3 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerEnergyCube.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerEnergyCube.java @@ -55,13 +55,13 @@ public class ContainerEnergyCube extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -77,13 +77,13 @@ public class ContainerEnergyCube extends Container { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -98,7 +98,7 @@ public class ContainerEnergyCube extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } } @@ -107,7 +107,7 @@ public class ContainerEnergyCube extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } } @@ -119,14 +119,14 @@ public class ContainerEnergyCube extends Container { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -134,7 +134,7 @@ public class ContainerEnergyCube extends Container { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -144,38 +144,38 @@ public class ContainerEnergyCube extends Container { if(!mergeItemStack(slotStack, 29, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 28) { if(!mergeItemStack(slotStack, 2, 28, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerFactory.java b/src/main/java/mekanism/common/inventory/container/ContainerFactory.java index cb038eda4..4e5a75ada 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerFactory.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerFactory.java @@ -108,13 +108,13 @@ public class ContainerFactory extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -124,23 +124,23 @@ public class ContainerFactory extends Container if(isOutputSlot(slotID)) { - if(!mergeItemStack(slotStack, tileEntity.inventory.length-1, inventorySlots.size(), true)) + if(!mergeItemStack(slotStack, tileEntity.inventory.size()-1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } else if(slotID != 1 && slotID != 2 && isProperMachine(slotStack) && !slotStack.isItemEqual(tileEntity.getMachineStack())) { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 2) { - if(!mergeItemStack(slotStack, tileEntity.inventory.length-1, inventorySlots.size(), true)) + if(!mergeItemStack(slotStack, tileEntity.inventory.size()-1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } else if(tileEntity.recipeType.getAnyRecipe(slotStack, tileEntity.gasTank.getGasType(), tileEntity.infuseStored) != null) @@ -149,13 +149,13 @@ public class ContainerFactory extends Container { if(!mergeItemStack(slotStack, 4, 4+tileEntity.tier.processes, false)) { - return null; + return ItemStack.EMPTY; } } else { - if(!mergeItemStack(slotStack, tileEntity.inventory.length-1, inventorySlots.size(), true)) + if(!mergeItemStack(slotStack, tileEntity.inventory.size()-1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -165,88 +165,88 @@ public class ContainerFactory extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 0) { - if(!mergeItemStack(slotStack, tileEntity.inventory.length-1, inventorySlots.size(), true)) + if(!mergeItemStack(slotStack, tileEntity.inventory.size()-1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } else if(tileEntity.recipeType.getItemGas(slotStack) != null) { - if(slotID >= tileEntity.inventory.length-1) + if(slotID >= tileEntity.inventory.size()-1) { if(!mergeItemStack(slotStack, 3, 4, false)) { - return null; + return ItemStack.EMPTY; } } else { - if(!mergeItemStack(slotStack, tileEntity.inventory.length-1, inventorySlots.size(), true)) + if(!mergeItemStack(slotStack, tileEntity.inventory.size()-1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } else if(tileEntity.recipeType == RecipeType.INFUSING && InfuseRegistry.getObject(slotStack) != null && (tileEntity.infuseStored.type == null || tileEntity.infuseStored.type == InfuseRegistry.getObject(slotStack).type)) { - if(slotID >= tileEntity.inventory.length-1) + if(slotID >= tileEntity.inventory.size()-1) { if(!mergeItemStack(slotStack, 3, 4, false)) { - return null; + return ItemStack.EMPTY; } } else { - if(!mergeItemStack(slotStack, tileEntity.inventory.length-1, inventorySlots.size(), true)) + if(!mergeItemStack(slotStack, tileEntity.inventory.size()-1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } else { - int slotEnd = tileEntity.inventory.length-1; + int slotEnd = tileEntity.inventory.size()-1; if(slotID >= slotEnd && slotID <= (slotEnd+26)) { if(!mergeItemStack(slotStack, (slotEnd+27), inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > (slotEnd+26)) { if(!mergeItemStack(slotStack, slotEnd, (slotEnd+26), false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, slotEnd, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; @@ -254,7 +254,7 @@ public class ContainerFactory extends Container public boolean isProperMachine(ItemStack itemStack) { - if(itemStack != null && itemStack.getItem() instanceof ItemBlockMachine) + if(!itemStack.isEmpty() && itemStack.getItem() instanceof ItemBlockMachine) { for(RecipeType type : RecipeType.values()) { diff --git a/src/main/java/mekanism/common/inventory/container/ContainerFilter.java b/src/main/java/mekanism/common/inventory/container/ContainerFilter.java index f381aafec..aa279f50e 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerFilter.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerFilter.java @@ -1,6 +1,6 @@ package mekanism.common.inventory.container; -import mekanism.common.tile.TileEntityContainerBlock; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -46,13 +46,13 @@ public class ContainerFilter extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -64,37 +64,37 @@ public class ContainerFilter extends Container { if(!mergeItemStack(slotStack, 27, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 26) { if(!mergeItemStack(slotStack, 0, 26, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 0, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerFluidTank.java b/src/main/java/mekanism/common/inventory/container/ContainerFluidTank.java index 88cc32cf7..3bca77056 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerFluidTank.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerFluidTank.java @@ -50,13 +50,13 @@ public class ContainerFluidTank extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -70,13 +70,13 @@ public class ContainerFluidTank extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -85,38 +85,38 @@ public class ContainerFluidTank extends Container { if(!mergeItemStack(slotStack, 29, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 28) { if(!mergeItemStack(slotStack, 2, 28, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerFluidicPlenisher.java b/src/main/java/mekanism/common/inventory/container/ContainerFluidicPlenisher.java index 1bc9db952..233623b9f 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerFluidicPlenisher.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerFluidicPlenisher.java @@ -53,13 +53,13 @@ public class ContainerFluidicPlenisher extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -73,13 +73,13 @@ public class ContainerFluidicPlenisher extends Container { if(!mergeItemStack(slotStack, 2, 3, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -89,14 +89,14 @@ public class ContainerFluidicPlenisher extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 0) { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -104,7 +104,7 @@ public class ContainerFluidicPlenisher extends Container { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } else { @@ -112,38 +112,38 @@ public class ContainerFluidicPlenisher extends Container { if(!mergeItemStack(slotStack, 30, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 29) { if(!mergeItemStack(slotStack, 3, 29, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerFormulaicAssemblicator.java b/src/main/java/mekanism/common/inventory/container/ContainerFormulaicAssemblicator.java index c100f6ffd..04d0ff33a 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerFormulaicAssemblicator.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerFormulaicAssemblicator.java @@ -97,13 +97,13 @@ public class ContainerFormulaicAssemblicator extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -117,13 +117,13 @@ public class ContainerFormulaicAssemblicator extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 34, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -133,13 +133,13 @@ public class ContainerFormulaicAssemblicator extends Container { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 34, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -147,14 +147,14 @@ public class ContainerFormulaicAssemblicator extends Container { if(!mergeItemStack(slotStack, 34, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } else if(tileEntity.formula == null || tileEntity.formula.isIngredient(tileEntity.getWorld(), slotStack)) { if(!mergeItemStack(slotStack, 2, 20, false)) { - return null; + return ItemStack.EMPTY; } } else { @@ -162,38 +162,38 @@ public class ContainerFormulaicAssemblicator extends Container { if(!mergeItemStack(slotStack, 61, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 60) { if(!mergeItemStack(slotStack, 34, 60, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 34, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerFuelwoodHeater.java b/src/main/java/mekanism/common/inventory/container/ContainerFuelwoodHeater.java index 78faf675e..aa9f238df 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerFuelwoodHeater.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerFuelwoodHeater.java @@ -48,13 +48,13 @@ public class ContainerFuelwoodHeater extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -68,14 +68,14 @@ public class ContainerFuelwoodHeater extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 0) { if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -84,38 +84,38 @@ public class ContainerFuelwoodHeater extends Container { if(!mergeItemStack(slotStack, 28, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 27) { if(!mergeItemStack(slotStack, 1, 27, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerGasTank.java b/src/main/java/mekanism/common/inventory/container/ContainerGasTank.java index ec318d728..44d8e1926 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerGasTank.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerGasTank.java @@ -50,13 +50,13 @@ public class ContainerGasTank extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -72,7 +72,7 @@ public class ContainerGasTank extends Container { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } } @@ -80,7 +80,7 @@ public class ContainerGasTank extends Container { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -89,38 +89,38 @@ public class ContainerGasTank extends Container { if(!mergeItemStack(slotStack, 29, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 28) { if(!mergeItemStack(slotStack, 2, 28, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerInductionMatrix.java b/src/main/java/mekanism/common/inventory/container/ContainerInductionMatrix.java index d2db3283d..ebe6de2b5 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerInductionMatrix.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerInductionMatrix.java @@ -54,13 +54,13 @@ public class ContainerInductionMatrix extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -76,13 +76,13 @@ public class ContainerInductionMatrix extends Container { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -97,7 +97,7 @@ public class ContainerInductionMatrix extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } } @@ -106,7 +106,7 @@ public class ContainerInductionMatrix extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } } @@ -118,14 +118,14 @@ public class ContainerInductionMatrix extends Container { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -133,7 +133,7 @@ public class ContainerInductionMatrix extends Container { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -143,38 +143,38 @@ public class ContainerInductionMatrix extends Container { if(!mergeItemStack(slotStack, 29, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 28) { if(!mergeItemStack(slotStack, 2, 28, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerLaserAmplifier.java b/src/main/java/mekanism/common/inventory/container/ContainerLaserAmplifier.java index 3e0d0358e..e034d29fb 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerLaserAmplifier.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerLaserAmplifier.java @@ -46,13 +46,13 @@ public class ContainerLaserAmplifier extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -64,37 +64,37 @@ public class ContainerLaserAmplifier extends Container { if(!mergeItemStack(slotStack, 27, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 26) { if(!mergeItemStack(slotStack, 0, 26, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 0, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerLaserTractorBeam.java b/src/main/java/mekanism/common/inventory/container/ContainerLaserTractorBeam.java index 63a1188d8..bf1899940 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerLaserTractorBeam.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerLaserTractorBeam.java @@ -53,13 +53,13 @@ public class ContainerLaserTractorBeam extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -71,28 +71,28 @@ public class ContainerLaserTractorBeam extends Container { if(!mergeItemStack(slotStack, 27, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } else if(!mergeItemStack(slotStack, 0, 27, false)) { - return null; + return ItemStack.EMPTY; } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerMetallurgicInfuser.java b/src/main/java/mekanism/common/inventory/container/ContainerMetallurgicInfuser.java index 40449a222..09c68f61f 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerMetallurgicInfuser.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerMetallurgicInfuser.java @@ -57,13 +57,13 @@ public class ContainerMetallurgicInfuser extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -77,21 +77,21 @@ public class ContainerMetallurgicInfuser extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else if(ChargeUtils.canBeDischarged(slotStack)) { if(!mergeItemStack(slotStack, 3, 4, false)) { - return null; + return ItemStack.EMPTY; } } else if(isInputItem(slotStack)) { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } else { @@ -99,20 +99,20 @@ public class ContainerMetallurgicInfuser extends Container { if(!mergeItemStack(slotStack, 31, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 30) { if(!mergeItemStack(slotStack, 4, 30, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -120,24 +120,24 @@ public class ContainerMetallurgicInfuser extends Container else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerNull.java b/src/main/java/mekanism/common/inventory/container/ContainerNull.java index 765a0fa85..19367463b 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerNull.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerNull.java @@ -1,6 +1,6 @@ package mekanism.common.inventory.container; -import mekanism.common.tile.TileEntityContainerBlock; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; @@ -43,7 +43,7 @@ public class ContainerNull extends Container { if(tileEntity != null) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } return true; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerOredictionificator.java b/src/main/java/mekanism/common/inventory/container/ContainerOredictionificator.java index 596e2b496..60cce739b 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerOredictionificator.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerOredictionificator.java @@ -49,13 +49,13 @@ public class ContainerOredictionificator extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -67,22 +67,22 @@ public class ContainerOredictionificator extends Container { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } - else if(tileEntity.getResult(slotStack) != null) + else if(!tileEntity.getResult(slotStack).isEmpty()) { if(slotID != 0 && slotID != 1) { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -91,38 +91,38 @@ public class ContainerOredictionificator extends Container { if(!mergeItemStack(slotStack, 29, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 28) { if(!mergeItemStack(slotStack, 2, 28, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerPRC.java b/src/main/java/mekanism/common/inventory/container/ContainerPRC.java index 9cd5e6b45..86c451488 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerPRC.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerPRC.java @@ -53,13 +53,13 @@ public class ContainerPRC extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -71,7 +71,7 @@ public class ContainerPRC extends Container { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } else if(ChargeUtils.canBeDischarged(slotStack)) @@ -80,14 +80,14 @@ public class ContainerPRC extends Container { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 1) { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -97,13 +97,13 @@ public class ContainerPRC extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -112,38 +112,38 @@ public class ContainerPRC extends Container { if(!mergeItemStack(slotStack, 30, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 29) { if(!mergeItemStack(slotStack, 3, 29, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerPersonalChest.java b/src/main/java/mekanism/common/inventory/container/ContainerPersonalChest.java index dddc5e0fa..ca3105bda 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerPersonalChest.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerPersonalChest.java @@ -89,7 +89,7 @@ public class ContainerPersonalChest extends Container { if(isBlock) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } return true; @@ -98,7 +98,7 @@ public class ContainerPersonalChest extends Container @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -110,28 +110,28 @@ public class ContainerPersonalChest extends Container { if(!mergeItemStack(slotStack, 54, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } else if(!mergeItemStack(slotStack, 0, 54, false)) { - return null; + return ItemStack.EMPTY; } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; @@ -144,9 +144,9 @@ public class ContainerPersonalChest extends Container { ItemStack itemStack = player.inventory.getStackInSlot(destSlot); - if(itemStack != null && MachineType.get(itemStack) == MachineType.PERSONAL_CHEST) + if(!itemStack.isEmpty() && MachineType.get(itemStack) == MachineType.PERSONAL_CHEST) { - return null; + return ItemStack.EMPTY; } } diff --git a/src/main/java/mekanism/common/inventory/container/ContainerQuantumEntangloporter.java b/src/main/java/mekanism/common/inventory/container/ContainerQuantumEntangloporter.java index 94fb19314..24df7774f 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerQuantumEntangloporter.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerQuantumEntangloporter.java @@ -46,13 +46,13 @@ public class ContainerQuantumEntangloporter extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -64,37 +64,37 @@ public class ContainerQuantumEntangloporter extends Container { if(!mergeItemStack(slotStack, 27, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 26) { if(!mergeItemStack(slotStack, 0, 26, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 0, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerResistiveHeater.java b/src/main/java/mekanism/common/inventory/container/ContainerResistiveHeater.java index ec720df2d..ecb943e89 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerResistiveHeater.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerResistiveHeater.java @@ -49,13 +49,13 @@ public class ContainerResistiveHeater extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -69,14 +69,14 @@ public class ContainerResistiveHeater extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 0) { if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -85,38 +85,38 @@ public class ContainerResistiveHeater extends Container { if(!mergeItemStack(slotStack, 28, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 27) { if(!mergeItemStack(slotStack, 1, 27, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerRobitCrafting.java b/src/main/java/mekanism/common/inventory/container/ContainerRobitCrafting.java index 03a75e5a5..9c780c5ec 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerRobitCrafting.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerRobitCrafting.java @@ -12,7 +12,7 @@ public class ContainerRobitCrafting extends ContainerWorkbench public ContainerRobitCrafting(InventoryPlayer inventory, EntityRobit entity) { - super(inventory, entity.worldObj, BlockPos.ORIGIN); + super(inventory, entity.world, BlockPos.ORIGIN); robit = entity; } diff --git a/src/main/java/mekanism/common/inventory/container/ContainerRobitInventory.java b/src/main/java/mekanism/common/inventory/container/ContainerRobitInventory.java index e0f418a14..d7ad1dc0b 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerRobitInventory.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerRobitInventory.java @@ -49,7 +49,7 @@ public class ContainerRobitInventory extends Container @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -61,28 +61,28 @@ public class ContainerRobitInventory extends Container { if(!mergeItemStack(slotStack, 27, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } else if(!mergeItemStack(slotStack, 0, 27, false)) { - return null; + return ItemStack.EMPTY; } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerRobitMain.java b/src/main/java/mekanism/common/inventory/container/ContainerRobitMain.java index c1737e246..6a110ab79 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerRobitMain.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerRobitMain.java @@ -51,6 +51,6 @@ public class ContainerRobitMain extends Container @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - return null; + return ItemStack.EMPTY; } } diff --git a/src/main/java/mekanism/common/inventory/container/ContainerRobitRepair.java b/src/main/java/mekanism/common/inventory/container/ContainerRobitRepair.java index a98e6eaaf..193ed3e2c 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerRobitRepair.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerRobitRepair.java @@ -12,7 +12,7 @@ public class ContainerRobitRepair extends ContainerRepair public ContainerRobitRepair(InventoryPlayer inventory, EntityRobit entity) { - super(inventory, entity.worldObj, BlockPos.ORIGIN, inventory.player); + super(inventory, entity.world, BlockPos.ORIGIN, inventory.player); robit = entity; } diff --git a/src/main/java/mekanism/common/inventory/container/ContainerRobitSmelting.java b/src/main/java/mekanism/common/inventory/container/ContainerRobitSmelting.java index a7e2ef5fd..ab47dbd82 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerRobitSmelting.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerRobitSmelting.java @@ -111,7 +111,7 @@ public class ContainerRobitSmelting extends Container @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -123,56 +123,56 @@ public class ContainerRobitSmelting extends Container { if(!mergeItemStack(slotStack, 3, 39, true)) { - return null; + return ItemStack.EMPTY; } } else if(slotID != 1 && slotID != 0) { - if(FurnaceRecipes.instance().getSmeltingResult(slotStack) != null) + if(!FurnaceRecipes.instance().getSmeltingResult(slotStack).isEmpty()) { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else if(TileEntityFurnace.isItemFuel(slotStack)) { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID >= 3 && slotID < 30) { if(!mergeItemStack(slotStack, 30, 39, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID >= 30 && slotID < 39 && !mergeItemStack(slotStack, 3, 30, false)) { - return null; + return ItemStack.EMPTY; } } else if(!mergeItemStack(slotStack, 3, 39, false)) { - return null; + return ItemStack.EMPTY; } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack(null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerRotaryCondensentrator.java b/src/main/java/mekanism/common/inventory/container/ContainerRotaryCondensentrator.java index a7f0708d2..cfbcc2a9c 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerRotaryCondensentrator.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerRotaryCondensentrator.java @@ -57,13 +57,13 @@ public class ContainerRotaryCondensentrator extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -77,13 +77,13 @@ public class ContainerRotaryCondensentrator extends Container { if(!mergeItemStack(slotStack, 4, 5, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 5, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -93,13 +93,13 @@ public class ContainerRotaryCondensentrator extends Container { if(!mergeItemStack(slotStack, 2, 3, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 5, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -111,21 +111,21 @@ public class ContainerRotaryCondensentrator extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else if(((IGasItem)slotStack.getItem()).canReceiveGas(slotStack, tileEntity.gasTank.getGas() != null ? tileEntity.gasTank.getGas().getGas() : null)) { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } } else { if(!mergeItemStack(slotStack, 5, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -134,38 +134,38 @@ public class ContainerRotaryCondensentrator extends Container { if(!mergeItemStack(slotStack, 32, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 31) { if(!mergeItemStack(slotStack, 5, 31, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 5, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerSecurityDesk.java b/src/main/java/mekanism/common/inventory/container/ContainerSecurityDesk.java index d1bca514b..19afded4a 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerSecurityDesk.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerSecurityDesk.java @@ -50,13 +50,13 @@ public class ContainerSecurityDesk extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -70,13 +70,13 @@ public class ContainerSecurityDesk extends Container { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 29, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } } @@ -85,38 +85,38 @@ public class ContainerSecurityDesk extends Container { if(!mergeItemStack(slotStack, 29, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 28) { if(!mergeItemStack(slotStack, 2, 28, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerSeismicVibrator.java b/src/main/java/mekanism/common/inventory/container/ContainerSeismicVibrator.java index 8abf8b2b8..949bfd730 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerSeismicVibrator.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerSeismicVibrator.java @@ -49,13 +49,13 @@ public class ContainerSeismicVibrator extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -69,14 +69,14 @@ public class ContainerSeismicVibrator extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 0) { if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -85,38 +85,38 @@ public class ContainerSeismicVibrator extends Container { if(!mergeItemStack(slotStack, 28, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 27) { if(!mergeItemStack(slotStack, 1, 27, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerSolarNeutronActivator.java b/src/main/java/mekanism/common/inventory/container/ContainerSolarNeutronActivator.java index ec49f36cd..a05d80e83 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerSolarNeutronActivator.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerSolarNeutronActivator.java @@ -50,13 +50,13 @@ public class ContainerSolarNeutronActivator extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -72,21 +72,21 @@ public class ContainerSolarNeutronActivator extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else if(((IGasItem)slotStack.getItem()).canReceiveGas(slotStack, tileEntity.outputTank.getGas() != null ? tileEntity.outputTank.getGas().getGas() : null)) { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -95,38 +95,38 @@ public class ContainerSolarNeutronActivator extends Container { if(!mergeItemStack(slotStack, 29, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 28) { if(!mergeItemStack(slotStack, 2, 28, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerTeleporter.java b/src/main/java/mekanism/common/inventory/container/ContainerTeleporter.java index 40e323c84..a030f001c 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerTeleporter.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerTeleporter.java @@ -49,13 +49,13 @@ public class ContainerTeleporter extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -69,14 +69,14 @@ public class ContainerTeleporter extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 0) { if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -85,38 +85,38 @@ public class ContainerTeleporter extends Container { if(!mergeItemStack(slotStack, 28, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 27) { if(!mergeItemStack(slotStack, 1, 27, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerThermalEvaporationController.java b/src/main/java/mekanism/common/inventory/container/ContainerThermalEvaporationController.java index c5260eb72..617c1e743 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerThermalEvaporationController.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerThermalEvaporationController.java @@ -54,13 +54,13 @@ public class ContainerThermalEvaporationController extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -72,7 +72,7 @@ public class ContainerThermalEvaporationController extends Container { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } else if(FluidContainerUtils.isFluidContainer(slotStack) && FluidUtil.getFluidContained(slotStack) == null) @@ -81,14 +81,14 @@ public class ContainerThermalEvaporationController extends Container { if(!mergeItemStack(slotStack, 2, 3, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 2) { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -98,14 +98,14 @@ public class ContainerThermalEvaporationController extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 0) { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -114,38 +114,38 @@ public class ContainerThermalEvaporationController extends Container { if(!mergeItemStack(slotStack, 31, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 30) { if(!mergeItemStack(slotStack, 4, 30, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/container/ContainerUpgradeManagement.java b/src/main/java/mekanism/common/inventory/container/ContainerUpgradeManagement.java index 46b7a0615..7bbe35c28 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerUpgradeManagement.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerUpgradeManagement.java @@ -3,7 +3,7 @@ package mekanism.common.inventory.container; import mekanism.common.base.IUpgradeItem; import mekanism.common.base.IUpgradeTile; import mekanism.common.inventory.slot.SlotMachineUpgrade; -import mekanism.common.tile.TileEntityContainerBlock; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -50,13 +50,13 @@ public class ContainerUpgradeManagement extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return ((TileEntityContainerBlock)tileEntity).isUseableByPlayer(entityplayer); + return ((TileEntityContainerBlock)tileEntity).isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -70,13 +70,13 @@ public class ContainerUpgradeManagement extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -85,38 +85,38 @@ public class ContainerUpgradeManagement extends Container { if(!mergeItemStack(slotStack, 28, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 27) { if(!mergeItemStack(slotStack, 1, 27, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/common/inventory/slot/SlotPersonalChest.java b/src/main/java/mekanism/common/inventory/slot/SlotPersonalChest.java index 6cd48c1bf..ab7506f83 100644 --- a/src/main/java/mekanism/common/inventory/slot/SlotPersonalChest.java +++ b/src/main/java/mekanism/common/inventory/slot/SlotPersonalChest.java @@ -15,7 +15,7 @@ public class SlotPersonalChest extends Slot @Override public boolean canTakeStack(EntityPlayer player) { - if(inventory.getStackInSlot(getSlotIndex()) == null) + if(inventory.getStackInSlot(getSlotIndex()).isEmpty()) { return false; } diff --git a/src/main/java/mekanism/common/item/ItemAlloy.java b/src/main/java/mekanism/common/item/ItemAlloy.java index dca1f8087..b043dee15 100644 --- a/src/main/java/mekanism/common/item/ItemAlloy.java +++ b/src/main/java/mekanism/common/item/ItemAlloy.java @@ -1,10 +1,10 @@ package mekanism.common.item; import mekanism.api.IAlloyInteraction; -import mekanism.api.MekanismConfig.general; -import mekanism.api.util.CapabilityUtils; import mekanism.common.MekanismItems; import mekanism.common.capabilities.Capabilities; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.util.CapabilityUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -22,9 +22,10 @@ public class ItemAlloy extends ItemMekanism } @Override - public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) + public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntity tile = world.getTileEntity(pos); + ItemStack stack = player.getHeldItem(hand); if(general.allowTransmitterAlloyUpgrade && CapabilityUtils.hasCapability(tile, Capabilities.ALLOY_INTERACTION_CAPABILITY, side)) { diff --git a/src/main/java/mekanism/common/item/ItemAtomicDisassembler.java b/src/main/java/mekanism/common/item/ItemAtomicDisassembler.java index f8859f225..ba99d008f 100644 --- a/src/main/java/mekanism/common/item/ItemAtomicDisassembler.java +++ b/src/main/java/mekanism/common/item/ItemAtomicDisassembler.java @@ -6,14 +6,12 @@ import java.util.List; import java.util.Map; import java.util.Set; -import com.google.common.collect.Multimap; - import mekanism.api.Coord4D; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.general; -import mekanism.api.util.ListUtils; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.block.Block; import net.minecraft.block.BlockDirt; @@ -36,6 +34,8 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; +import com.google.common.collect.Multimap; + public class ItemAtomicDisassembler extends ItemEnergized { public double HOE_USAGE = 10 * general.DISASSEMBLER_USAGE; @@ -114,9 +114,9 @@ public class ItemAtomicDisassembler extends ItemEnergized { super.onBlockStartBreak(itemstack, pos, player); - if(!player.worldObj.isRemote) + if(!player.world.isRemote) { - IBlockState state = player.worldObj.getBlockState(pos); + IBlockState state = player.world.getBlockState(pos); Block block = state.getBlock(); int meta = block.getMetaFromState(state); @@ -126,7 +126,7 @@ public class ItemAtomicDisassembler extends ItemEnergized } ItemStack stack = new ItemStack(block, 1, meta); - Coord4D orig = new Coord4D(pos, player.worldObj); + Coord4D orig = new Coord4D(pos, player.world); List names = MekanismUtils.getOreDictName(stack); @@ -142,7 +142,7 @@ public class ItemAtomicDisassembler extends ItemEnergized if(getMode(itemstack) == 3 && isOre && !player.capabilities.isCreativeMode) { - Set found = new Finder(player.worldObj, stack, new Coord4D(pos, player.worldObj)).calc(); + Set found = new Finder(player.world, stack, new Coord4D(pos, player.world)).calc(); for(Coord4D coord : found) { @@ -151,13 +151,13 @@ public class ItemAtomicDisassembler extends ItemEnergized continue; } - Block block2 = coord.getBlock(player.worldObj); + Block block2 = coord.getBlock(player.world); - block2.onBlockDestroyedByPlayer(player.worldObj, coord.getPos(), state); - player.worldObj.playEvent(null, 2001, coord.getPos(), Block.getStateId(state)); - player.worldObj.setBlockToAir(coord.getPos()); - block2.breakBlock(player.worldObj, coord.getPos(), state); - block2.dropBlockAsItem(player.worldObj, coord.getPos(), state, 0); + block2.onBlockDestroyedByPlayer(player.world, coord.getPos(), state); + player.world.playEvent(null, 2001, coord.getPos(), Block.getStateId(state)); + player.world.setBlockToAir(coord.getPos()); + block2.breakBlock(player.world, coord.getPos(), state); + block2.dropBlockAsItem(player.world, coord.getPos(), state, 0); setEnergy(itemstack, getEnergy(itemstack) - (general.DISASSEMBLER_USAGE*getEfficiency(itemstack))); } @@ -174,28 +174,35 @@ public class ItemAtomicDisassembler extends ItemEnergized } @Override - public ActionResult onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, EnumHand hand) + public ActionResult onItemRightClick(World world, EntityPlayer entityplayer, EnumHand hand) { - if(!world.isRemote && entityplayer.isSneaking()) + ItemStack itemstack = entityplayer.getHeldItem(hand); + + if(entityplayer.isSneaking()) { - toggleMode(itemstack); - entityplayer.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.modeToggle") + " " + EnumColor.INDIGO + getModeName(itemstack) + EnumColor.AQUA + " (" + getEfficiency(itemstack) + ")")); + if(!world.isRemote) + { + toggleMode(itemstack); + entityplayer.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.modeToggle") + " " + EnumColor.INDIGO + getModeName(itemstack) + EnumColor.AQUA + " (" + getEfficiency(itemstack) + ")")); + } + + return new ActionResult(EnumActionResult.SUCCESS, itemstack); } - return new ActionResult(EnumActionResult.SUCCESS, itemstack); + return new ActionResult(EnumActionResult.PASS, itemstack); } @Override - public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) + public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { - if(!player.isSneaking()) + ItemStack stack = player.getHeldItem(hand); + Block block = world.getBlockState(pos).getBlock(); + + if(!player.isSneaking() && (block == Blocks.DIRT || block == Blocks.GRASS || block == Blocks.GRASS_PATH)) { if(useHoe(stack, player, world, pos, side) == EnumActionResult.FAIL) { - if(world.getBlockState(pos).getBlock() != Blocks.FARMLAND) - { - return EnumActionResult.FAIL; - } + return EnumActionResult.FAIL; } switch(getEfficiency(stack)) @@ -342,7 +349,7 @@ public class ItemAtomicDisassembler extends ItemEnergized if(equipmentSlot == EntityEquipmentSlot.MAINHAND) { - multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4000000953674316D, 0)); + multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4000000953674316D, 0)); } return multimap; diff --git a/src/main/java/mekanism/common/item/ItemBalloon.java b/src/main/java/mekanism/common/item/ItemBalloon.java index 64775cac9..4ca5187e9 100644 --- a/src/main/java/mekanism/common/item/ItemBalloon.java +++ b/src/main/java/mekanism/common/item/ItemBalloon.java @@ -20,6 +20,7 @@ import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.translation.I18n; @@ -62,7 +63,7 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem } @Override - public void getSubItems(Item item, CreativeTabs tabs, List list) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList list) { for(int i = 0; i < EnumColor.DYES.length; i++) { @@ -78,18 +79,20 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem } @Override - public ActionResult onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, EnumHand hand) + public ActionResult onItemRightClick(World world, EntityPlayer entityplayer, EnumHand hand) { + ItemStack itemstack = entityplayer.getHeldItem(hand); + if(!world.isRemote) { Pos3D pos = new Pos3D(hand == EnumHand.MAIN_HAND ? -0.4 : 0.4, 0, 0.3).rotateYaw(entityplayer.renderYawOffset).translate(new Pos3D(entityplayer)); - world.spawnEntityInWorld(new EntityBalloon(world, pos.xCoord-0.5, pos.yCoord-0.25, pos.zCoord-0.5, getColor(itemstack))); + world.spawnEntity(new EntityBalloon(world, pos.xCoord-0.5, pos.yCoord-0.25, pos.zCoord-0.5, getColor(itemstack))); } if(!entityplayer.capabilities.isCreativeMode) { - itemstack.stackSize--; + itemstack.shrink(1); } return new ActionResult(EnumActionResult.SUCCESS, itemstack); @@ -115,13 +118,15 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem } @Override - public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) + public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { + ItemStack stack = player.getHeldItem(hand); + if(player.isSneaking()) { AxisAlignedBB bound = new AxisAlignedBB(pos, pos.add(1, 3, 1)); - List balloonsNear = player.worldObj.getEntitiesWithinAABB(EntityBalloon.class, bound); + List balloonsNear = player.world.getEntitiesWithinAABB(EntityBalloon.class, bound); if(balloonsNear.size() > 0) { @@ -145,8 +150,8 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem if(!world.isRemote) { - world.spawnEntityInWorld(new EntityBalloon(world, new Coord4D(pos, world), getColor(stack))); - stack.stackSize--; + world.spawnEntity(new EntityBalloon(world, new Coord4D(pos, world), getColor(stack))); + stack.shrink(1); } return EnumActionResult.SUCCESS; @@ -163,11 +168,11 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem { if(player.isSneaking()) { - if(!player.worldObj.isRemote) + if(!player.world.isRemote) { AxisAlignedBB bound = new AxisAlignedBB(entity.posX - 0.2, entity.posY - 0.5, entity.posZ - 0.2, entity.posX + 0.2, entity.posY + entity.height + 4, entity.posZ + 0.2); - List balloonsNear = player.worldObj.getEntitiesWithinAABB(EntityBalloon.class, bound); + List balloonsNear = player.world.getEntitiesWithinAABB(EntityBalloon.class, bound); for(EntityBalloon balloon : balloonsNear) { @@ -177,8 +182,8 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem } } - player.worldObj.spawnEntityInWorld(new EntityBalloon(entity, getColor(stack))); - stack.stackSize--; + player.world.spawnEntity(new EntityBalloon(entity, getColor(stack))); + stack.shrink(1); } return true; @@ -198,7 +203,7 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem public ItemStack dispenseStack(IBlockSource source, ItemStack stack) { Coord4D coord = new Coord4D(source.getX(), source.getY(), source.getZ(), source.getWorld().provider.getDimension()); - EnumFacing side = (EnumFacing)source.func_189992_e().getValue(BlockDispenser.FACING); + EnumFacing side = (EnumFacing)source.getBlockState().getValue(BlockDispenser.FACING); List entities = source.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, coord.offset(side).getBoundingBox()); boolean latched = false; @@ -220,7 +225,7 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem if(!hasBalloon) { - source.getWorld().spawnEntityInWorld(new EntityBalloon(entity, getColor(stack))); + source.getWorld().spawnEntity(new EntityBalloon(entity, getColor(stack))); latched = true; } } @@ -255,11 +260,11 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem if(!source.getWorld().isRemote) { - source.getWorld().spawnEntityInWorld(new EntityBalloon(source.getWorld(), pos.xCoord, pos.yCoord, pos.zCoord, getColor(stack))); + source.getWorld().spawnEntity(new EntityBalloon(source.getWorld(), pos.xCoord, pos.yCoord, pos.zCoord, getColor(stack))); } } - stack.stackSize--; + stack.shrink(1); return stack; } diff --git a/src/main/java/mekanism/common/item/ItemBlockCardboardBox.java b/src/main/java/mekanism/common/item/ItemBlockCardboardBox.java index 4f871a523..0c175ea0a 100644 --- a/src/main/java/mekanism/common/item/ItemBlockCardboardBox.java +++ b/src/main/java/mekanism/common/item/ItemBlockCardboardBox.java @@ -54,7 +54,7 @@ public class ItemBlockCardboardBox extends ItemBlock if(data != null) { try { - list.add(LangUtils.localize("tooltip.block") + ": " + new ItemStack(data.block, data.meta).getDisplayName()); + list.add(LangUtils.localize("tooltip.block") + ": " + new ItemStack(data.block, 1, data.meta).getDisplayName()); list.add(LangUtils.localize("tooltip.meta") + ": " + data.meta); if(data.tileTag != null) @@ -72,15 +72,17 @@ public class ItemBlockCardboardBox extends ItemBlock } @Override - public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) + public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + ItemStack stack = player.getHeldItem(hand); + if(!player.isSneaking() && !world.isAirBlock(pos) && stack.getItemDamage() == 0) { IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); int meta = block.getMetaFromState(state); - if(!world.isRemote && MekanismAPI.isBlockCompatible(Item.getItemFromBlock(block), meta) && state.getBlockHardness(world, pos) != -1) + if(!world.isRemote && MekanismAPI.isBlockCompatible(block, meta) && state.getBlockHardness(world, pos) != -1) { BlockData data = new BlockData(); data.block = block; @@ -99,7 +101,7 @@ public class ItemBlockCardboardBox extends ItemBlock if(!player.capabilities.isCreativeMode) { - stack.stackSize--; + stack.shrink(1); } world.setBlockState(pos, MekanismBlocks.CardboardBox.getStateFromMeta(1), 3); diff --git a/src/main/java/mekanism/common/item/ItemBlockEnergyCube.java b/src/main/java/mekanism/common/item/ItemBlockEnergyCube.java index d719a7681..2fe310258 100644 --- a/src/main/java/mekanism/common/item/ItemBlockEnergyCube.java +++ b/src/main/java/mekanism/common/item/ItemBlockEnergyCube.java @@ -5,14 +5,15 @@ import ic2.api.item.ISpecialElectricItem; import java.util.ArrayList; import java.util.List; +import java.util.UUID; import mekanism.api.Coord4D; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.general; import mekanism.api.Range4D; import mekanism.api.energy.IEnergizedItem; import mekanism.api.transmitters.TransmissionType; import mekanism.client.MekKeyHandler; +import mekanism.client.MekanismClient; import mekanism.client.MekanismKeyHandler; import mekanism.common.Mekanism; import mekanism.common.Tier.BaseTier; @@ -21,8 +22,10 @@ import mekanism.common.base.ISideConfiguration; import mekanism.common.base.ISustainedInventory; import mekanism.common.base.ITierItem; import mekanism.common.capabilities.ItemCapabilityWrapper; -import mekanism.common.integration.IC2ItemManager; -import mekanism.common.integration.TeslaItemWrapper; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.integration.forgeenergy.ForgeEnergyItemWrapper; +import mekanism.common.integration.ic2.IC2ItemManager; +import mekanism.common.integration.tesla.TeslaItemWrapper; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.security.ISecurityItem; import mekanism.common.security.ISecurityTile; @@ -42,6 +45,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.fml.common.Optional.Interface; @@ -82,7 +86,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IS else { if(hasSecurity(itemstack)) { - list.add(SecurityUtils.getOwnerDisplay(entityplayer.getName(), getOwner(itemstack))); + list.add(SecurityUtils.getOwnerDisplay(entityplayer, MekanismClient.clientUUIDMap.get(getOwnerUUID(itemstack)))); list.add(EnumColor.GREY + LangUtils.localize("gui.security") + ": " + SecurityUtils.getSecurityDisplay(itemstack, Side.CLIENT)); if(SecurityUtils.isOverridden(itemstack, Side.CLIENT)) @@ -128,16 +132,16 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IS if(tileEntity instanceof ISecurityTile) { ISecurityTile security = (ISecurityTile)tileEntity; - security.getSecurity().setOwner(getOwner(stack)); + security.getSecurity().setOwnerUUID(getOwnerUUID(stack)); if(hasSecurity(stack)) { security.getSecurity().setMode(getSecurity(stack)); } - if(getOwner(stack) == null) + if(getOwnerUUID(stack) == null) { - security.getSecurity().setOwner(player.getName()); + security.getSecurity().setOwnerUUID(player.getUniqueID()); } } @@ -312,6 +316,12 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IS { return 1D-(getEnergy(stack)/getMaxEnergy(stack)); } + + @Override + public int getRGBDurabilityForDisplay(ItemStack stack) + { + return MathHelper.hsvToRGB(Math.max(0.0F, (float)(1-getDurabilityForDisplay(stack))) / 3.0F, 1.0F, 1.0F); + } @Override @Method(modid = "IC2") @@ -321,26 +331,26 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IS } @Override - public String getOwner(ItemStack stack) + public UUID getOwnerUUID(ItemStack stack) { - if(ItemDataUtils.hasData(stack, "owner")) + if(ItemDataUtils.hasData(stack, "ownerUUID")) { - return ItemDataUtils.getString(stack, "owner"); + return UUID.fromString(ItemDataUtils.getString(stack, "ownerUUID")); } return null; } @Override - public void setOwner(ItemStack stack, String owner) + public void setOwnerUUID(ItemStack stack, UUID owner) { - if(owner == null || owner.isEmpty()) + if(owner == null) { - ItemDataUtils.removeData(stack, "owner"); + ItemDataUtils.removeData(stack, "ownerUUID"); return; } - ItemDataUtils.setString(stack, "owner", owner); + ItemDataUtils.setString(stack, "ownerUUID", owner.toString()); } @Override @@ -375,6 +385,6 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IS @Override public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) { - return new ItemCapabilityWrapper(stack, new TeslaItemWrapper()); + return new ItemCapabilityWrapper(stack, new TeslaItemWrapper(), new ForgeEnergyItemWrapper()); } } diff --git a/src/main/java/mekanism/common/item/ItemBlockGasTank.java b/src/main/java/mekanism/common/item/ItemBlockGasTank.java index 904d449e5..0464af627 100644 --- a/src/main/java/mekanism/common/item/ItemBlockGasTank.java +++ b/src/main/java/mekanism/common/item/ItemBlockGasTank.java @@ -2,16 +2,17 @@ package mekanism.common.item; import java.util.ArrayList; import java.util.List; +import java.util.UUID; import mekanism.api.Coord4D; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.general; import mekanism.api.Range4D; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.IGasItem; import mekanism.client.MekKeyHandler; +import mekanism.client.MekanismClient; import mekanism.client.MekanismKeyHandler; import mekanism.common.Mekanism; import mekanism.common.Tier.BaseTier; @@ -19,6 +20,7 @@ import mekanism.common.Tier.GasTankTier; import mekanism.common.base.ISideConfiguration; import mekanism.common.base.ISustainedInventory; import mekanism.common.base.ITierItem; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.security.ISecurityItem; import mekanism.common.security.ISecurityTile; @@ -38,7 +40,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -88,16 +92,16 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI if(tileEntity instanceof ISecurityTile) { ISecurityTile security = (ISecurityTile)tileEntity; - security.getSecurity().setOwner(getOwner(stack)); + security.getSecurity().setOwnerUUID(getOwnerUUID(stack)); if(hasSecurity(stack)) { security.getSecurity().setMode(getSecurity(stack)); } - if(getOwner(stack) == null) + if(getOwnerUUID(stack) == null) { - security.getSecurity().setOwner(player.getName()); + security.getSecurity().setOwnerUUID(player.getUniqueID()); } } @@ -147,7 +151,7 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI else { if(hasSecurity(itemstack)) { - list.add(SecurityUtils.getOwnerDisplay(entityplayer.getName(), getOwner(itemstack))); + list.add(SecurityUtils.getOwnerDisplay(entityplayer, MekanismClient.clientUUIDMap.get(getOwnerUUID(itemstack)))); list.add(EnumColor.GREY + LangUtils.localize("gui.security") + ": " + SecurityUtils.getSecurityDisplay(itemstack, Side.CLIENT)); if(SecurityUtils.isOverridden(itemstack, Side.CLIENT)) @@ -191,7 +195,7 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI } @Override - public void getSubItems(Item item, CreativeTabs tabs, List list) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList list) { for(GasTankTier tier : GasTankTier.values()) { @@ -339,26 +343,32 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI } @Override - public String getOwner(ItemStack stack) + public int getRGBDurabilityForDisplay(ItemStack stack) + { + return MathHelper.hsvToRGB(Math.max(0.0F, (float)(1-getDurabilityForDisplay(stack))) / 3.0F, 1.0F, 1.0F); + } + + @Override + public UUID getOwnerUUID(ItemStack stack) { - if(ItemDataUtils.hasData(stack, "owner")) + if(ItemDataUtils.hasData(stack, "ownerUUID")) { - return ItemDataUtils.getString(stack, "owner"); + return UUID.fromString(ItemDataUtils.getString(stack, "ownerUUID")); } return null; } @Override - public void setOwner(ItemStack stack, String owner) + public void setOwnerUUID(ItemStack stack, UUID owner) { - if(owner == null || owner.isEmpty()) + if(owner == null) { - ItemDataUtils.removeData(stack, "owner"); + ItemDataUtils.removeData(stack, "ownerUUID"); return; } - ItemDataUtils.setString(stack, "owner", owner); + ItemDataUtils.setString(stack, "ownerUUID", owner.toString()); } @Override diff --git a/src/main/java/mekanism/common/item/ItemBlockGlowPanel.java b/src/main/java/mekanism/common/item/ItemBlockGlowPanel.java new file mode 100644 index 000000000..d12529028 --- /dev/null +++ b/src/main/java/mekanism/common/item/ItemBlockGlowPanel.java @@ -0,0 +1,109 @@ +package mekanism.common.item; + +import java.util.ArrayList; + +import mcmultipart.api.multipart.IMultipart; +import mekanism.api.Coord4D; +import mekanism.api.EnumColor; +import mekanism.api.Range4D; +import mekanism.common.Mekanism; +import mekanism.common.network.PacketTileEntity.TileEntityMessage; +import mekanism.common.tile.TileEntityGlowPanel; +import mekanism.common.util.LangUtils; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.text.translation.I18n; +import net.minecraft.world.World; + +public class ItemBlockGlowPanel extends ItemBlock +{ + public Block metaBlock; + + public ItemBlockGlowPanel(Block block) + { + super(block); + metaBlock = block; + setHasSubtypes(true); + setCreativeTab(Mekanism.tabMekanism); + } + + @Override + public int getMetadata(int i) + { + return i; + } + + @Override + public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState state) + { + boolean place = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, state); + + if(place) + { + TileEntityGlowPanel tileEntity = (TileEntityGlowPanel)world.getTileEntity(pos); + EnumColor col = EnumColor.DYES[stack.getItemDamage()]; + + BlockPos pos1 = pos.offset(side.getOpposite()); + + if(world.isSideSolid(pos1, side)) + { + tileEntity.setOrientation(side.getOpposite()); + } + + tileEntity.setColour(col); + + if(!world.isRemote) + { + Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(tileEntity))); + } + } + + return place; + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, NonNullList listToAddTo) + { + for(EnumColor color : EnumColor.DYES) + { + listToAddTo.add(new ItemStack(item, 1, color.getMetaValue())); + } + } + + @Override + public String getItemStackDisplayName(ItemStack stack) + { + EnumColor colour = EnumColor.DYES[stack.getItemDamage()]; + String colourName; + + if(I18n.canTranslate(getUnlocalizedName(stack) + "." + colour.dyeName)) + { + return LangUtils.localize(getUnlocalizedName(stack) + "." + colour.dyeName); + } + + if(colour == EnumColor.BLACK) + { + colourName = EnumColor.DARK_GREY + colour.getDyeName(); + } + else { + colourName = colour.getDyedName(); + } + + return colourName + " " + super.getItemStackDisplayName(stack); + } + + @Override + public boolean shouldRotateAroundWhenRendering() + { + return true; + } +} diff --git a/src/main/java/mekanism/common/item/ItemBlockMachine.java b/src/main/java/mekanism/common/item/ItemBlockMachine.java index e137eb02b..7af54e59c 100644 --- a/src/main/java/mekanism/common/item/ItemBlockMachine.java +++ b/src/main/java/mekanism/common/item/ItemBlockMachine.java @@ -6,13 +6,14 @@ import ic2.api.item.ISpecialElectricItem; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.UUID; import mekanism.api.Coord4D; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.general; import mekanism.api.Range4D; import mekanism.api.energy.IEnergizedItem; import mekanism.client.MekKeyHandler; +import mekanism.client.MekanismClient; import mekanism.client.MekanismKeyHandler; import mekanism.common.Mekanism; import mekanism.common.Tier.BaseTier; @@ -20,6 +21,7 @@ import mekanism.common.Tier.FluidTankTier; import mekanism.common.Upgrade; import mekanism.common.base.FluidItemWrapper; import mekanism.common.base.IFactory; +import mekanism.common.base.IFluidItemWrapper; import mekanism.common.base.IRedstoneControl; import mekanism.common.base.IRedstoneControl.RedstoneControl; import mekanism.common.base.ISideConfiguration; @@ -30,17 +32,19 @@ import mekanism.common.base.ITierItem; import mekanism.common.base.IUpgradeTile; import mekanism.common.block.states.BlockStateMachine.MachineType; import mekanism.common.capabilities.ItemCapabilityWrapper; -import mekanism.common.integration.IC2ItemManager; -import mekanism.common.integration.TeslaItemWrapper; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.integration.forgeenergy.ForgeEnergyItemWrapper; +import mekanism.common.integration.ic2.IC2ItemManager; +import mekanism.common.integration.tesla.TeslaItemWrapper; import mekanism.common.inventory.InventoryPersonalChest; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.security.ISecurityItem; import mekanism.common.security.ISecurityTile; import mekanism.common.security.ISecurityTile.SecurityMode; -import mekanism.common.tile.TileEntityBasicBlock; -import mekanism.common.tile.TileEntityElectricBlock; import mekanism.common.tile.TileEntityFactory; import mekanism.common.tile.TileEntityFluidTank; +import mekanism.common.tile.prefab.TileEntityBasicBlock; +import mekanism.common.tile.prefab.TileEntityElectricBlock; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; @@ -72,7 +76,6 @@ import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidContainerItem; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fml.common.Optional.Interface; import net.minecraftforge.fml.common.Optional.InterfaceList; @@ -128,7 +131,7 @@ import cofh.api.energy.IEnergyContainerItem; @InterfaceList({ @Interface(iface = "ic2.api.item.ISpecialElectricItem", modid = "IC2") }) -public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpecialElectricItem, IFactory, ISustainedInventory, ISustainedTank, IEnergyContainerItem, IFluidContainerItem, ITierItem, ISecurityItem +public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpecialElectricItem, IFactory, ISustainedInventory, ISustainedTank, IEnergyContainerItem, IFluidItemWrapper, ITierItem, ISecurityItem { public Block metaBlock; @@ -152,7 +155,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec { if(MachineType.get(itemstack) != null) { - return getUnlocalizedName() + "." + MachineType.get(itemstack).machineName; + return getUnlocalizedName() + "." + MachineType.get(itemstack).blockName; } return "null"; @@ -215,7 +218,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec { if(hasSecurity(itemstack)) { - list.add(SecurityUtils.getOwnerDisplay(entityplayer.getName(), getOwner(itemstack))); + list.add(SecurityUtils.getOwnerDisplay(entityplayer, MekanismClient.clientUUIDMap.get(getOwnerUUID(itemstack)))); list.add(EnumColor.GREY + LangUtils.localize("gui.security") + ": " + SecurityUtils.getSecurityDisplay(itemstack, Side.CLIENT)); if(SecurityUtils.isOverridden(itemstack, Side.CLIENT)) @@ -270,8 +273,9 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec } @Override - public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) + public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { + ItemStack stack = player.getHeldItem(hand); MachineType type = MachineType.get(stack); if(type == MachineType.FLUID_TANK && getBucketMode(stack)) @@ -279,7 +283,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec return EnumActionResult.PASS; } - return super.onItemUse(stack, player, world, pos, hand, side, hitX, hitY, hitZ); + return super.onItemUse(player, world, pos, hand, side, hitX, hitY, hitZ); } @Override @@ -330,16 +334,16 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec if(tileEntity instanceof ISecurityTile) { ISecurityTile security = (ISecurityTile)tileEntity; - security.getSecurity().setOwner(getOwner(stack)); + security.getSecurity().setOwnerUUID(getOwnerUUID(stack)); if(hasSecurity(stack)) { security.getSecurity().setMode(getSecurity(stack)); } - if(getOwner(stack) == null) + if(getOwnerUUID(stack) == null) { - security.getSecurity().setOwner(player.getName()); + security.getSecurity().setOwnerUUID(player.getUniqueID()); } } @@ -382,10 +386,8 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec { TileEntityFactory factory = (TileEntityFactory)tileEntity; RecipeType recipeType = RecipeType.values()[getRecipeType(stack)]; - factory.recipeType = recipeType; - factory.upgradeComponent.setSupported(Upgrade.GAS, recipeType.fuelEnergyUpgrades()); - factory.secondaryEnergyPerTick = factory.getSecondaryEnergyPerTick(recipeType); - world.notifyNeighborsOfStateChange(pos, tileEntity.getBlockType()); + factory.setRecipeType(recipeType); + world.notifyNeighborsOfStateChange(pos, tileEntity.getBlockType(), true); Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(tileEntity))); } @@ -453,17 +455,18 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec } @Override - public ActionResult onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, EnumHand hand) + public ActionResult onItemRightClick(World world, EntityPlayer entityplayer, EnumHand hand) { + ItemStack itemstack = entityplayer.getHeldItem(hand); MachineType type = MachineType.get(itemstack); if(MachineType.get(itemstack) == MachineType.PERSONAL_CHEST) { if(!world.isRemote) { - if(getOwner(itemstack) == null) + if(getOwnerUUID(itemstack) == null) { - setOwner(itemstack, entityplayer.getName()); + setOwnerUUID(itemstack, entityplayer.getUniqueID()); } if(SecurityUtils.canAccess(entityplayer, itemstack)) @@ -864,26 +867,26 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec } @Override - public String getOwner(ItemStack stack) + public UUID getOwnerUUID(ItemStack stack) { - if(ItemDataUtils.hasData(stack, "owner")) + if(ItemDataUtils.hasData(stack, "ownerUUID")) { - return ItemDataUtils.getString(stack, "owner"); + return UUID.fromString(ItemDataUtils.getString(stack, "ownerUUID")); } return null; } @Override - public void setOwner(ItemStack stack, String owner) + public void setOwnerUUID(ItemStack stack, UUID owner) { - if(owner == null || owner.isEmpty()) + if(owner == null) { - ItemDataUtils.removeData(stack, "owner"); + ItemDataUtils.removeData(stack, "ownerUUID"); return; } - ItemDataUtils.setString(stack, "owner", owner); + ItemDataUtils.setString(stack, "ownerUUID", owner.toString()); } @Override @@ -925,11 +928,11 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec @Override public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) { - return new ItemCapabilityWrapper(stack, new FluidItemWrapper(), new TeslaItemWrapper()) { + return new ItemCapabilityWrapper(stack, new TeslaItemWrapper(), new ForgeEnergyItemWrapper(), new FluidItemWrapper()) { @Override public boolean hasCapability(Capability capability, EnumFacing facing) { - if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + if(capability == CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY) { return MachineType.get(itemStack) == MachineType.FLUID_TANK; } diff --git a/src/main/java/mekanism/common/multipart/ItemPartTransmitter.java b/src/main/java/mekanism/common/item/ItemBlockTransmitter.java similarity index 62% rename from src/main/java/mekanism/common/multipart/ItemPartTransmitter.java rename to src/main/java/mekanism/common/item/ItemBlockTransmitter.java index 03ab2ed1c..2dfa092cf 100644 --- a/src/main/java/mekanism/common/multipart/ItemPartTransmitter.java +++ b/src/main/java/mekanism/common/item/ItemBlockTransmitter.java @@ -1,50 +1,72 @@ -package mekanism.common.multipart; +package mekanism.common.item; +import java.util.ArrayList; import java.util.List; -import mcmultipart.item.ItemMultiPart; -import mcmultipart.multipart.IMultipart; +import mekanism.api.Coord4D; import mekanism.api.EnumColor; +import mekanism.api.Range4D; import mekanism.api.transmitters.TransmissionType; import mekanism.client.MekKeyHandler; import mekanism.client.MekanismKeyHandler; import mekanism.common.Mekanism; import mekanism.common.Tier; import mekanism.common.Tier.BaseTier; -import mekanism.common.base.IMetaItem; +import mekanism.common.base.ITierItem; +import mekanism.common.block.states.BlockStateTransmitter; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterType; +import mekanism.common.network.PacketTileEntity.TileEntityMessage; +import mekanism.common.tile.transmitter.TileEntitySidedPipe; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.settings.GameSettings; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public class ItemPartTransmitter extends ItemMultiPart implements IMetaItem +public class ItemBlockTransmitter extends ItemBlock implements ITierItem { - public ItemPartTransmitter() + public Block metaBlock; + + public ItemBlockTransmitter(Block block) { - super(); + super(block); + metaBlock = block; setHasSubtypes(true); setCreativeTab(Mekanism.tabMekanism); } @Override - public IMultipart createPart(World world, BlockPos pos, EnumFacing dir, Vec3d hit, ItemStack stack, EntityPlayer player) + public int getMetadata(int i) { - return PartTransmitter.getPartType(TransmitterType.values()[getDamage(stack)]); + return i; } - + @Override - public int getMetadata(int damage) + public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState state) { - return damage; + boolean place = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, state); + + if(place) + { + TileEntitySidedPipe tileEntity = (TileEntitySidedPipe)world.getTileEntity(pos); + tileEntity.setBaseTier(getBaseTier(stack)); + + if(!world.isRemote) + { + Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(tileEntity))); + } + } + + return place; } @Override @@ -54,11 +76,11 @@ public class ItemPartTransmitter extends ItemMultiPart implements IMetaItem if(!MekKeyHandler.getIsKeyPressed(MekanismKeyHandler.sneakKey)) { TransmissionType transmission = TransmitterType.values()[itemstack.getItemDamage()].getTransmission(); - BaseTier tier = TransmitterType.values()[itemstack.getItemDamage()].getTier(); + BaseTier tier = getBaseTier(itemstack); if(transmission == TransmissionType.ENERGY) { - list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.capacity") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(Tier.CableTier.values()[itemstack.getItemDamage()].cableCapacity) + "/t"); + list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.capacity") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(Tier.CableTier.get(tier).cableCapacity) + "/t"); } else if(transmission == TransmissionType.FLUID) { @@ -75,13 +97,21 @@ public class ItemPartTransmitter extends ItemMultiPart implements IMetaItem list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.speed") + ": " + EnumColor.GREY + (Tier.TransporterTier.get(tier).speed/(100/20)) + " m/s"); list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.pumpRate") + ": " + EnumColor.GREY + Tier.TransporterTier.get(tier).pullAmount*2 + "/s"); } + else if(transmission == TransmissionType.HEAT) + { + list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.conduction") + ": " + EnumColor.GREY + Tier.ConductorTier.get(tier).inverseConduction); + list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.insulation") + ": " + EnumColor.GREY + Tier.ConductorTier.get(tier).inverseConductionInsulation); + list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.heatCapacity") + ": " + EnumColor.GREY + Tier.ConductorTier.get(tier).inverseHeatCapacity); + } list.add(LangUtils.localize("tooltip.hold") + " " + EnumColor.AQUA + GameSettings.getKeyDisplayString(MekanismKeyHandler.sneakKey.getKeyCode()) + EnumColor.GREY + " " + LangUtils.localize("tooltip.forDetails")); } else { - switch(itemstack.getItemDamage()) + TransmitterType type = TransmitterType.values()[itemstack.getItemDamage()]; + + switch(type) { - case 0: case 1: case 2: case 3: + case UNIVERSAL_CABLE: { list.add(EnumColor.DARK_GREY + LangUtils.localize("tooltip.capableTrans") + ":"); list.add("- " + EnumColor.PURPLE + "RF " + EnumColor.GREY + "(ThermalExpansion)"); @@ -89,26 +119,26 @@ public class ItemPartTransmitter extends ItemMultiPart implements IMetaItem list.add("- " + EnumColor.PURPLE + "Joules " + EnumColor.GREY + "(Mekanism)"); break; } - case 4: case 5: case 6: case 7: + case MECHANICAL_PIPE: { list.add(EnumColor.DARK_GREY + LangUtils.localize("tooltip.capableTrans") + ":"); list.add("- " + EnumColor.PURPLE + LangUtils.localize("tooltip.fluids") + " " + EnumColor.GREY + "(MinecraftForge)"); break; } - case 8: case 9: case 10: case 11: + case PRESSURIZED_TUBE: { list.add(EnumColor.DARK_GREY + LangUtils.localize("tooltip.capableTrans") + ":"); list.add("- " + EnumColor.PURPLE + LangUtils.localize("tooltip.gasses") + " (Mekanism)"); break; } - case 12: case 13: case 14: case 15: + case LOGISTICAL_TRANSPORTER: { list.add(EnumColor.DARK_GREY + LangUtils.localize("tooltip.capableTrans") + ":"); list.add("- " + EnumColor.PURPLE + LangUtils.localize("tooltip.items") + " (" + LangUtils.localize("tooltip.universal") + ")"); list.add("- " + EnumColor.PURPLE + LangUtils.localize("tooltip.blocks") + " (" + LangUtils.localize("tooltip.universal") + ")"); break; } - case 16: + case RESTRICTIVE_TRANSPORTER: { list.add(EnumColor.DARK_GREY + LangUtils.localize("tooltip.capableTrans") + ":"); list.add("- " + EnumColor.PURPLE + LangUtils.localize("tooltip.items") + " (" + LangUtils.localize("tooltip.universal") + ")"); @@ -116,7 +146,7 @@ public class ItemPartTransmitter extends ItemMultiPart implements IMetaItem list.add("- " + EnumColor.DARK_RED + LangUtils.localize("tooltip.restrictiveDesc")); break; } - case 17: + case DIVERSION_TRANSPORTER: { list.add(EnumColor.DARK_GREY + LangUtils.localize("tooltip.capableTrans") + ":"); list.add("- " + EnumColor.PURPLE + LangUtils.localize("tooltip.items") + " (" + LangUtils.localize("tooltip.universal") + ")"); @@ -124,7 +154,7 @@ public class ItemPartTransmitter extends ItemMultiPart implements IMetaItem list.add("- " + EnumColor.DARK_RED + LangUtils.localize("tooltip.diversionDesc")); break; } - case 18: case 19: case 20: case 21: + case THERMODYNAMIC_CONDUCTOR: { list.add(EnumColor.DARK_GREY + LangUtils.localize("tooltip.capableTrans") + ":"); list.add("- " + EnumColor.PURPLE + LangUtils.localize("tooltip.heat") + " (Mekanism)"); @@ -134,31 +164,40 @@ public class ItemPartTransmitter extends ItemMultiPart implements IMetaItem } } - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tab, List listToAddTo) - { - for(TransmitterType type : TransmitterType.values()) - { - listToAddTo.add(new ItemStack(item, 1, type.ordinal())); - } - } - @Override public String getUnlocalizedName(ItemStack stack) { - return getUnlocalizedName() + "." + TransmitterType.values()[stack.getItemDamage()].getName(); + TransmitterType type = TransmitterType.get(stack.getItemDamage()); + String name = type.getUnlocalizedName(); + + if(type.hasTiers()) + { + BaseTier tier = getBaseTier(stack); + name = tier.getSimpleName() + name; + } + + return getUnlocalizedName() + "." + name; + } + + @Override + public BaseTier getBaseTier(ItemStack itemstack) + { + if(!itemstack.hasTagCompound()) + { + return BaseTier.BASIC; + } + + return BaseTier.values()[itemstack.getTagCompound().getInteger("tier")]; } @Override - public String getTexture(int meta) + public void setBaseTier(ItemStack itemstack, BaseTier tier) { - return TransmitterType.values()[meta].name().toLowerCase(); - } + if(!itemstack.hasTagCompound()) + { + itemstack.setTagCompound(new NBTTagCompound()); + } - @Override - public int getVariants() - { - return TransmitterType.values().length; + itemstack.getTagCompound().setInteger("tier", tier.ordinal()); } } diff --git a/src/main/java/mekanism/common/item/ItemClump.java b/src/main/java/mekanism/common/item/ItemClump.java index 7ac776fcc..ef8fb12a3 100644 --- a/src/main/java/mekanism/common/item/ItemClump.java +++ b/src/main/java/mekanism/common/item/ItemClump.java @@ -1,12 +1,11 @@ package mekanism.common.item; -import java.util.List; - import mekanism.common.Resource; import mekanism.common.base.IMetaItem; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; public class ItemClump extends ItemMekanism implements IMetaItem { @@ -29,7 +28,7 @@ public class ItemClump extends ItemMekanism implements IMetaItem } @Override - public void getSubItems(Item item, CreativeTabs tabs, List itemList) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList itemList) { for(int counter = 0; counter < Resource.values().length; counter++) { diff --git a/src/main/java/mekanism/common/item/ItemConfigurationCard.java b/src/main/java/mekanism/common/item/ItemConfigurationCard.java index e35011dc7..802ad3489 100644 --- a/src/main/java/mekanism/common/item/ItemConfigurationCard.java +++ b/src/main/java/mekanism/common/item/ItemConfigurationCard.java @@ -4,12 +4,12 @@ import java.util.List; import mekanism.api.EnumColor; import mekanism.api.IConfigCardAccess.ISpecialConfigData; -import mekanism.api.util.CapabilityUtils; import mekanism.common.base.IRedstoneControl; import mekanism.common.base.IRedstoneControl.RedstoneControl; import mekanism.common.base.ISideConfiguration; import mekanism.common.capabilities.Capabilities; -import mekanism.common.tile.TileEntityContainerBlock; +import mekanism.common.tile.prefab.TileEntityContainerBlock; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.LangUtils; import mekanism.common.util.SecurityUtils; @@ -42,8 +42,10 @@ public class ItemConfigurationCard extends ItemMekanism } @Override - public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) + public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + ItemStack stack = player.getHeldItem(hand); + if(!world.isRemote) { TileEntity tileEntity = world.getTileEntity(pos); @@ -66,7 +68,7 @@ public class ItemConfigurationCard extends ItemMekanism { data.setString("dataType", getNameFromTile(tileEntity, side)); setData(stack, data); - player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.configurationCard.got").replaceAll("%s", EnumColor.INDIGO + LangUtils.localize(data.getString("dataType")) + EnumColor.GREY))); + player.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.configurationCard.got").replaceAll("%s", EnumColor.INDIGO + LangUtils.localize(data.getString("dataType")) + EnumColor.GREY))); } return EnumActionResult.SUCCESS; @@ -83,11 +85,11 @@ public class ItemConfigurationCard extends ItemMekanism special.setConfigurationData(getData(stack)); } - player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.DARK_GREEN + LangUtils.localize("tooltip.configurationCard.set").replaceAll("%s", EnumColor.INDIGO + LangUtils.localize(getDataType(stack)) + EnumColor.DARK_GREEN))); + player.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.DARK_GREEN + LangUtils.localize("tooltip.configurationCard.set").replaceAll("%s", EnumColor.INDIGO + LangUtils.localize(getDataType(stack)) + EnumColor.DARK_GREEN))); setData(stack, null); } else { - player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.RED + LangUtils.localize("tooltip.configurationCard.unequal") + ".")); + player.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.RED + LangUtils.localize("tooltip.configurationCard.unequal") + ".")); } return EnumActionResult.SUCCESS; diff --git a/src/main/java/mekanism/common/item/ItemConfigurator.java b/src/main/java/mekanism/common/item/ItemConfigurator.java index b3c53cdff..d93b7e0b9 100644 --- a/src/main/java/mekanism/common/item/ItemConfigurator.java +++ b/src/main/java/mekanism/common/item/ItemConfigurator.java @@ -11,15 +11,15 @@ import mekanism.api.IConfigurable; import mekanism.api.IMekWrench; import mekanism.api.Range4D; import mekanism.api.transmitters.TransmissionType; -import mekanism.api.util.CapabilityUtils; import mekanism.common.Mekanism; import mekanism.common.SideData; import mekanism.common.base.ISideConfiguration; import mekanism.common.capabilities.Capabilities; import mekanism.common.network.PacketTileEntity.TileEntityMessage; -import mekanism.common.tile.TileEntityBasicBlock; -import mekanism.common.tile.TileEntityContainerBlock; import mekanism.common.tile.component.TileComponentConfig; +import mekanism.common.tile.prefab.TileEntityBasicBlock; +import mekanism.common.tile.prefab.TileEntityContainerBlock; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; @@ -37,6 +37,7 @@ import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -69,8 +70,10 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool } @Override - public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) + public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + ItemStack stack = player.getHeldItem(hand); + if(!world.isRemote) { Block block = world.getBlockState(pos).getBlock(); @@ -87,7 +90,7 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool { if(!player.isSneaking()) { - player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + getViewModeText(getState(stack).getTransmission()) + ": " + initial.color + initial.localize() + " (" + initial.color.getColoredName() + ")")); + player.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + getViewModeText(getState(stack).getTransmission()) + ": " + initial.color + initial.localize() + " (" + initial.color.getColoredName() + ")")); } else { if(getEnergy(stack) >= ENERGY_PER_CONFIGURE) @@ -97,7 +100,7 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool setEnergy(stack, getEnergy(stack) - ENERGY_PER_CONFIGURE); MekanismUtils.incrementOutput(config, getState(stack).getTransmission(), MekanismUtils.getBaseOrientation(side, config.getOrientation())); SideData data = config.getConfig().getOutput(getState(stack).getTransmission(), side, config.getOrientation()); - player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + getToggleModeText(getState(stack).getTransmission()) + ": " + data.color + data.localize() + " (" + data.color.getColoredName() + ")")); + player.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + getToggleModeText(getState(stack).getTransmission()) + ": " + data.color + data.localize() + " (" + data.color.getColoredName() + ")")); if(config instanceof TileEntityBasicBlock) { @@ -147,7 +150,7 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool { ItemStack slotStack = inv.getStackInSlot(i); - if(slotStack != null) + if(!slotStack.isEmpty()) { if(getEnergy(stack) < ENERGY_PER_ITEM_DUMP) { @@ -158,32 +161,21 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool float yRandom = random.nextFloat() * 0.8F + 0.1F; float zRandom = random.nextFloat() * 0.8F + 0.1F; - while(slotStack.stackSize > 0) + EntityItem item = new EntityItem(world, pos.getX() + xRandom, pos.getY() + yRandom, pos.getZ() + zRandom, slotStack.copy()); + + if(slotStack.hasTagCompound()) { - int j = random.nextInt(21) + 10; - - if(j > slotStack.stackSize) - { - j = slotStack.stackSize; - } - - slotStack.stackSize -= j; - EntityItem item = new EntityItem(world, pos.getX() + xRandom, pos.getY() + yRandom, pos.getZ() + zRandom, new ItemStack(slotStack.getItem(), j, slotStack.getItemDamage())); - - if(slotStack.hasTagCompound()) - { - item.getEntityItem().setTagCompound((NBTTagCompound)slotStack.getTagCompound().copy()); - } - - float k = 0.05F; - item.motionX = random.nextGaussian() * k; - item.motionY = random.nextGaussian() * k + 0.2F; - item.motionZ = random.nextGaussian() * k; - world.spawnEntityInWorld(item); - - inv.setInventorySlotContents(i, null); - setEnergy(stack, getEnergy(stack) - ENERGY_PER_ITEM_DUMP); + item.getEntityItem().setTagCompound((NBTTagCompound)slotStack.getTagCompound().copy()); } + + float k = 0.05F; + item.motionX = random.nextGaussian() * k; + item.motionY = random.nextGaussian() * k + 0.2F; + item.motionZ = random.nextGaussian() * k; + world.spawnEntity(item); + + inv.setInventorySlotContents(i, ItemStack.EMPTY); + setEnergy(stack, getEnergy(stack) - ENERGY_PER_ITEM_DUMP); } } @@ -264,23 +256,14 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool @Override @Method(modid = "BuildCraft") - public boolean canWrench(EntityPlayer player, BlockPos pos) + public boolean canWrench(EntityPlayer player, EnumHand hand, ItemStack wrench, RayTraceResult rayTrace) { - return canUseWrench(player.inventory.getCurrentItem(), player, pos); + return canUseWrench(wrench, player, rayTrace.getBlockPos()); } @Override @Method(modid = "BuildCraft") - public void wrenchUsed(EntityPlayer player, BlockPos pos) {} - - @Override - public boolean canWrench(EntityPlayer player, Entity entity) - { - return false; - } - - @Override - public void wrenchUsed(EntityPlayer player, Entity entity) {} + public void wrenchUsed(EntityPlayer player, EnumHand hand, ItemStack wrench, RayTraceResult rayTrace) {} @Override public boolean canUseWrench(ItemStack stack, EntityPlayer player, BlockPos pos) diff --git a/src/main/java/mekanism/common/item/ItemControlCircuit.java b/src/main/java/mekanism/common/item/ItemControlCircuit.java index d0aa4da47..c012dd3a2 100644 --- a/src/main/java/mekanism/common/item/ItemControlCircuit.java +++ b/src/main/java/mekanism/common/item/ItemControlCircuit.java @@ -1,12 +1,11 @@ package mekanism.common.item; -import java.util.List; - import mekanism.common.Tier.BaseTier; import mekanism.common.base.IMetaItem; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; public class ItemControlCircuit extends ItemMekanism implements IMetaItem { @@ -29,7 +28,7 @@ public class ItemControlCircuit extends ItemMekanism implements IMetaItem } @Override - public void getSubItems(Item item, CreativeTabs tabs, List itemList) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList itemList) { for(BaseTier tier : BaseTier.values()) { diff --git a/src/main/java/mekanism/common/item/ItemCraftingFormula.java b/src/main/java/mekanism/common/item/ItemCraftingFormula.java index de5b7b4ce..712b5bb12 100644 --- a/src/main/java/mekanism/common/item/ItemCraftingFormula.java +++ b/src/main/java/mekanism/common/item/ItemCraftingFormula.java @@ -16,6 +16,7 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -35,7 +36,7 @@ public class ItemCraftingFormula extends ItemMekanism @SideOnly(Side.CLIENT) public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) { - ItemStack[] inv = getInventory(itemstack); + NonNullList inv = getInventory(itemstack); if(inv != null) { @@ -43,13 +44,13 @@ public class ItemCraftingFormula extends ItemMekanism } } - private void addIngredientDetails(ItemStack[] inv, List list) + private void addIngredientDetails(NonNullList inv, List list) { List stacks = new ArrayList(); for(ItemStack stack : inv) { - if(stack != null) + if(!stack.isEmpty()) { boolean found = false; @@ -57,7 +58,7 @@ public class ItemCraftingFormula extends ItemMekanism { if(InventoryUtils.canStack(stack, iterStack)) { - iterStack.stackSize += stack.stackSize; + iterStack.grow(stack.getCount()); found = true; } } @@ -73,13 +74,15 @@ public class ItemCraftingFormula extends ItemMekanism for(ItemStack stack : stacks) { - list.add(EnumColor.GREY + " - " + stack.getDisplayName() + " (" + stack.stackSize + ")"); + list.add(EnumColor.GREY + " - " + stack.getDisplayName() + " (" + stack.getCount() + ")"); } } @Override - public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) + public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { + ItemStack stack = player.getHeldItem(hand); + if(player.isSneaking()) { if(!world.isRemote) @@ -124,7 +127,7 @@ public class ItemCraftingFormula extends ItemMekanism ItemDataUtils.setBoolean(stack, "invalid", invalid); } - public ItemStack[] getInventory(ItemStack stack) + public NonNullList getInventory(ItemStack stack) { if(!ItemDataUtils.hasData(stack, "Items")) { @@ -132,7 +135,7 @@ public class ItemCraftingFormula extends ItemMekanism } NBTTagList tagList = ItemDataUtils.getList(stack, "Items"); - ItemStack[] inventory = new ItemStack[9]; + NonNullList inventory = NonNullList.withSize(9, ItemStack.EMPTY); for(int tagCount = 0; tagCount < tagList.tagCount(); tagCount++) { @@ -141,14 +144,14 @@ public class ItemCraftingFormula extends ItemMekanism if(slotID >= 0 && slotID < 9) { - inventory[slotID] = ItemStack.loadItemStackFromNBT(tagCompound); + inventory.set(slotID, InventoryUtils.loadFromNBT(tagCompound)); } } return inventory; } - public void setInventory(ItemStack stack, ItemStack[] inv) + public void setInventory(ItemStack stack, NonNullList inv) { if(inv == null) { @@ -160,11 +163,11 @@ public class ItemCraftingFormula extends ItemMekanism for(int slotCount = 0; slotCount < 9; slotCount++) { - if(inv[slotCount] != null) + if(!inv.get(slotCount).isEmpty()) { NBTTagCompound tagCompound = new NBTTagCompound(); tagCompound.setByte("Slot", (byte)slotCount); - inv[slotCount].writeToNBT(tagCompound); + inv.get(slotCount).writeToNBT(tagCompound); tagList.appendTag(tagCompound); } } diff --git a/src/main/java/mekanism/common/item/ItemCrystal.java b/src/main/java/mekanism/common/item/ItemCrystal.java index 5f2a10a02..368d14d5d 100644 --- a/src/main/java/mekanism/common/item/ItemCrystal.java +++ b/src/main/java/mekanism/common/item/ItemCrystal.java @@ -1,12 +1,11 @@ package mekanism.common.item; -import java.util.List; - import mekanism.common.Resource; import mekanism.common.base.IMetaItem; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; public class ItemCrystal extends ItemMekanism implements IMetaItem { @@ -29,7 +28,7 @@ public class ItemCrystal extends ItemMekanism implements IMetaItem } @Override - public void getSubItems(Item item, CreativeTabs tabs, List itemList) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList itemList) { for(int counter = 0; counter < Resource.values().length; counter++) { diff --git a/src/main/java/mekanism/common/item/ItemDictionary.java b/src/main/java/mekanism/common/item/ItemDictionary.java index 88cf789c9..2ac05b19c 100644 --- a/src/main/java/mekanism/common/item/ItemDictionary.java +++ b/src/main/java/mekanism/common/item/ItemDictionary.java @@ -27,8 +27,10 @@ public class ItemDictionary extends ItemMekanism } @Override - public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) + public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + ItemStack stack = player.getHeldItem(hand); + if(!player.isSneaking()) { IBlockState state = world.getBlockState(pos); @@ -43,15 +45,15 @@ public class ItemDictionary extends ItemMekanism if(!names.isEmpty()) { - player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + LangUtils.localize("tooltip.keysFound") + ":")); + player.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + LangUtils.localize("tooltip.keysFound") + ":")); for(String name : names) { - player.addChatMessage(new TextComponentString(EnumColor.DARK_GREEN + " - " + name)); + player.sendMessage(new TextComponentString(EnumColor.DARK_GREEN + " - " + name)); } } else { - player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + LangUtils.localize("tooltip.noKey") + ".")); + player.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + LangUtils.localize("tooltip.noKey") + ".")); } } @@ -63,13 +65,16 @@ public class ItemDictionary extends ItemMekanism } @Override - public ActionResult onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, EnumHand hand) + public ActionResult onItemRightClick(World world, EntityPlayer entityplayer, EnumHand hand) { + ItemStack itemstack = entityplayer.getHeldItem(hand); + if(entityplayer.isSneaking()) { entityplayer.openGui(Mekanism.instance, 0, world, 0, 0, 0); + return new ActionResult(EnumActionResult.SUCCESS, itemstack); } - return new ActionResult(EnumActionResult.SUCCESS, itemstack); + return new ActionResult(EnumActionResult.PASS, itemstack); } } diff --git a/src/main/java/mekanism/common/item/ItemDirtyDust.java b/src/main/java/mekanism/common/item/ItemDirtyDust.java index 002f60bb3..92e45eade 100644 --- a/src/main/java/mekanism/common/item/ItemDirtyDust.java +++ b/src/main/java/mekanism/common/item/ItemDirtyDust.java @@ -1,13 +1,12 @@ package mekanism.common.item; -import java.util.List; - import mekanism.common.Mekanism; import mekanism.common.Resource; import mekanism.common.base.IMetaItem; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; public class ItemDirtyDust extends ItemMekanism implements IMetaItem { @@ -31,7 +30,7 @@ public class ItemDirtyDust extends ItemMekanism implements IMetaItem } @Override - public void getSubItems(Item item, CreativeTabs tabs, List itemList) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList itemList) { for(int counter = 0; counter < Resource.values().length; counter++) { diff --git a/src/main/java/mekanism/common/item/ItemDust.java b/src/main/java/mekanism/common/item/ItemDust.java index c65b0dd25..e75d24567 100644 --- a/src/main/java/mekanism/common/item/ItemDust.java +++ b/src/main/java/mekanism/common/item/ItemDust.java @@ -1,12 +1,11 @@ package mekanism.common.item; -import java.util.List; - import mekanism.common.Resource; import mekanism.common.base.IMetaItem; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; public class ItemDust extends ItemMekanism implements IMetaItem { @@ -29,7 +28,7 @@ public class ItemDust extends ItemMekanism implements IMetaItem } @Override - public void getSubItems(Item item, CreativeTabs tabs, List itemList) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList itemList) { for(int counter = 0; counter < Resource.values().length; counter++) { diff --git a/src/main/java/mekanism/common/item/ItemElectricBow.java b/src/main/java/mekanism/common/item/ItemElectricBow.java index 01ac9d867..1cd019a0f 100644 --- a/src/main/java/mekanism/common/item/ItemElectricBow.java +++ b/src/main/java/mekanism/common/item/ItemElectricBow.java @@ -2,8 +2,6 @@ package mekanism.common.item; import java.util.List; -import javax.annotation.Nullable; - import mekanism.api.EnumColor; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.LangUtils; @@ -51,12 +49,12 @@ public class ItemElectricBow extends ItemEnergized ItemStack ammo = findAmmo(player); int maxItemUse = getMaxItemUseDuration(itemstack) - itemUseCount; - maxItemUse = ForgeEventFactory.onArrowLoose(itemstack, world, player, maxItemUse, itemstack != null || flag); + maxItemUse = ForgeEventFactory.onArrowLoose(itemstack, world, player, maxItemUse, !itemstack.isEmpty() || flag); if(maxItemUse < 0) return; - if(flag || ammo != null) + if(flag || !ammo.isEmpty()) { - if(ammo == null) + if(ammo.isEmpty()) { ammo = new ItemStack(Items.ARROW); } @@ -99,16 +97,16 @@ public class ItemElectricBow extends ItemEnergized entityarrow.setFire(getFireState(itemstack) ? 100 : 0); - world.spawnEntityInWorld(entityarrow); + world.spawnEntity(entityarrow); } world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F); if(!noConsume) { - ammo.stackSize--; + ammo.shrink(1); - if(ammo.stackSize == 0) + if(ammo.getCount() == 0) { player.inventory.deleteStack(ammo); } @@ -152,19 +150,20 @@ public class ItemElectricBow extends ItemEnergized } } - return null; + return ItemStack.EMPTY; } } - protected boolean isArrow(@Nullable ItemStack stack) + protected boolean isArrow(ItemStack stack) { - return stack != null && stack.getItem() instanceof ItemArrow; + return !stack.isEmpty() && stack.getItem() instanceof ItemArrow; } @Override - public ActionResult onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) + public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) { - boolean flag = findAmmo(playerIn) != null; + ItemStack itemStackIn = playerIn.getHeldItem(hand); + boolean flag = !findAmmo(playerIn).isEmpty(); ActionResult ret = ForgeEventFactory.onArrowNock(itemStackIn, worldIn, playerIn, hand, flag); if(ret != null) return ret; diff --git a/src/main/java/mekanism/common/item/ItemEnergized.java b/src/main/java/mekanism/common/item/ItemEnergized.java index 8c803bcf0..be5b11559 100644 --- a/src/main/java/mekanism/common/item/ItemEnergized.java +++ b/src/main/java/mekanism/common/item/ItemEnergized.java @@ -6,12 +6,13 @@ import ic2.api.item.ISpecialElectricItem; import java.util.List; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.general; import mekanism.api.energy.IEnergizedItem; import mekanism.common.Mekanism; import mekanism.common.capabilities.ItemCapabilityWrapper; -import mekanism.common.integration.IC2ItemManager; -import mekanism.common.integration.TeslaItemWrapper; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.integration.forgeenergy.ForgeEnergyItemWrapper; +import mekanism.common.integration.ic2.IC2ItemManager; +import mekanism.common.integration.tesla.TeslaItemWrapper; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; @@ -20,6 +21,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.MathHelper; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.fml.common.Optional.Interface; import net.minecraftforge.fml.common.Optional.InterfaceList; @@ -53,6 +56,12 @@ public class ItemEnergized extends ItemMekanism implements IEnergizedItem, ISpec { return 1D-(getEnergy(stack)/getMaxEnergy(stack)); } + + @Override + public int getRGBDurabilityForDisplay(ItemStack stack) + { + return MathHelper.hsvToRGB(Math.max(0.0F, (float)(1-getDurabilityForDisplay(stack))) / 3.0F, 1.0F, 1.0F); + } @Override public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) @@ -66,7 +75,7 @@ public class ItemEnergized extends ItemMekanism implements IEnergizedItem, ISpec } @Override - public void getSubItems(Item item, CreativeTabs tabs, List list) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList list) { ItemStack discharged = new ItemStack(this); list.add(discharged); @@ -171,6 +180,6 @@ public class ItemEnergized extends ItemMekanism implements IEnergizedItem, ISpec @Override public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) { - return new ItemCapabilityWrapper(stack, new TeslaItemWrapper()); + return new ItemCapabilityWrapper(stack, new TeslaItemWrapper(), new ForgeEnergyItemWrapper()); } } diff --git a/src/main/java/mekanism/common/item/ItemFlamethrower.java b/src/main/java/mekanism/common/item/ItemFlamethrower.java index ef3eaf720..a3b39236e 100644 --- a/src/main/java/mekanism/common/item/ItemFlamethrower.java +++ b/src/main/java/mekanism/common/item/ItemFlamethrower.java @@ -3,11 +3,11 @@ package mekanism.common.item; import java.util.List; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.general; import mekanism.api.gas.Gas; -import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.IGasItem; +import mekanism.common.MekanismFluids; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.LangUtils; import net.minecraft.creativetab.CreativeTabs; @@ -15,6 +15,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.MathHelper; public class ItemFlamethrower extends ItemMekanism implements IGasItem { @@ -44,7 +46,10 @@ public class ItemFlamethrower extends ItemMekanism implements IGasItem public void useGas(ItemStack stack) { - setGas(stack, new GasStack(getGas(stack).getGas(), getGas(stack).amount - 1)); + if(getGas(stack) != null) + { + setGas(stack, new GasStack(getGas(stack).getGas(), getGas(stack).amount - 1)); + } } @Override @@ -67,7 +72,7 @@ public class ItemFlamethrower extends ItemMekanism implements IGasItem return 0; } - if(stack.getGas() != GasRegistry.getGas("hydrogen")) + if(stack.getGas() != MekanismFluids.Hydrogen) { return 0; } @@ -92,7 +97,7 @@ public class ItemFlamethrower extends ItemMekanism implements IGasItem @Override public boolean canReceiveGas(ItemStack itemstack, Gas type) { - return type == GasRegistry.getGas("hydrogen"); + return type == MekanismFluids.Hydrogen; } @Override @@ -112,6 +117,12 @@ public class ItemFlamethrower extends ItemMekanism implements IGasItem { return 1D-((getGas(stack) != null ? (double)getGas(stack).amount : 0D)/(double)getMaxGas(stack)); } + + @Override + public int getRGBDurabilityForDisplay(ItemStack stack) + { + return MathHelper.hsvToRGB(Math.max(0.0F, (float)(1-getDurabilityForDisplay(stack))) / 3.0F, 1.0F, 1.0F); + } @Override public GasStack getGas(ItemStack itemstack) @@ -142,14 +153,14 @@ public class ItemFlamethrower extends ItemMekanism implements IGasItem } @Override - public void getSubItems(Item item, CreativeTabs tabs, List list) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList list) { ItemStack empty = new ItemStack(this); setGas(empty, null); list.add(empty); ItemStack filled = new ItemStack(this); - setGas(filled, new GasStack(GasRegistry.getGas("hydrogen"), ((IGasItem)filled.getItem()).getMaxGas(filled))); + setGas(filled, new GasStack(MekanismFluids.Hydrogen, ((IGasItem)filled.getItem()).getMaxGas(filled))); list.add(filled); } diff --git a/src/main/java/mekanism/common/item/ItemFreeRunners.java b/src/main/java/mekanism/common/item/ItemFreeRunners.java index ae0e16460..49574a28c 100644 --- a/src/main/java/mekanism/common/item/ItemFreeRunners.java +++ b/src/main/java/mekanism/common/item/ItemFreeRunners.java @@ -6,14 +6,15 @@ import ic2.api.item.ISpecialElectricItem; import java.util.List; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.general; import mekanism.api.energy.IEnergizedItem; import mekanism.client.render.ModelCustomArmor; import mekanism.client.render.ModelCustomArmor.ArmorModel; import mekanism.common.Mekanism; import mekanism.common.capabilities.ItemCapabilityWrapper; -import mekanism.common.integration.IC2ItemManager; -import mekanism.common.integration.TeslaItemWrapper; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.integration.forgeenergy.ForgeEnergyItemWrapper; +import mekanism.common.integration.ic2.IC2ItemManager; +import mekanism.common.integration.tesla.TeslaItemWrapper; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; @@ -29,6 +30,8 @@ import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.MathHelper; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.event.entity.living.LivingAttackEvent; @@ -88,7 +91,7 @@ public class ItemFreeRunners extends ItemArmor implements IEnergizedItem, ISpeci } @Override - public void getSubItems(Item item, CreativeTabs tabs, List list) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList list) { ItemStack discharged = new ItemStack(this); list.add(discharged); @@ -194,6 +197,12 @@ public class ItemFreeRunners extends ItemArmor implements IEnergizedItem, ISpeci { return 1D-(getEnergy(stack)/getMaxEnergy(stack)); } + + @Override + public int getRGBDurabilityForDisplay(ItemStack stack) + { + return MathHelper.hsvToRGB(Math.max(0.0F, (float)(1-getDurabilityForDisplay(stack))) / 3.0F, 1.0F, 1.0F); + } @Override @Method(modid = "IC2") @@ -208,11 +217,11 @@ public class ItemFreeRunners extends ItemArmor implements IEnergizedItem, ISpeci EntityLivingBase base = event.getEntityLiving(); ItemStack stack = base.getItemStackFromSlot(EntityEquipmentSlot.FEET); - if(stack != null && stack.getItem() instanceof ItemFreeRunners) + if(!stack.isEmpty() && stack.getItem() instanceof ItemFreeRunners) { ItemFreeRunners boots = (ItemFreeRunners)stack.getItem(); - if(boots.getEnergy(stack) > 0 && event.getSource() == DamageSource.fall) + if(boots.getEnergy(stack) > 0 && event.getSource() == DamageSource.FALL) { boots.setEnergy(stack, boots.getEnergy(stack)-event.getAmount()*50); event.setCanceled(true); @@ -223,6 +232,6 @@ public class ItemFreeRunners extends ItemArmor implements IEnergizedItem, ISpeci @Override public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) { - return new ItemCapabilityWrapper(stack, new TeslaItemWrapper()); + return new ItemCapabilityWrapper(stack, new TeslaItemWrapper(), new ForgeEnergyItemWrapper()); } } diff --git a/src/main/java/mekanism/common/item/ItemGasMask.java b/src/main/java/mekanism/common/item/ItemGasMask.java index bb7654c81..3c5a594f9 100644 --- a/src/main/java/mekanism/common/item/ItemGasMask.java +++ b/src/main/java/mekanism/common/item/ItemGasMask.java @@ -54,17 +54,17 @@ public class ItemGasMask extends ItemArmor ItemStack headStack = base.getItemStackFromSlot(EntityEquipmentSlot.HEAD); ItemStack chestStack = base.getItemStackFromSlot(EntityEquipmentSlot.CHEST); - if(headStack != null && headStack.getItem() instanceof ItemGasMask) + if(!headStack.isEmpty() && headStack.getItem() instanceof ItemGasMask) { ItemGasMask mask = (ItemGasMask)headStack.getItem(); - if(chestStack != null && chestStack.getItem() instanceof ItemScubaTank) + if(!chestStack.isEmpty() && chestStack.getItem() instanceof ItemScubaTank) { ItemScubaTank tank = (ItemScubaTank)chestStack.getItem(); if(tank.getFlowing(chestStack) && tank.getGas(chestStack) != null) { - if(event.getSource() == DamageSource.magic) + if(event.getSource() == DamageSource.MAGIC) { event.setCanceled(true); } diff --git a/src/main/java/mekanism/common/item/ItemGaugeDropper.java b/src/main/java/mekanism/common/item/ItemGaugeDropper.java index 74a996972..0b1d5a79e 100644 --- a/src/main/java/mekanism/common/item/ItemGaugeDropper.java +++ b/src/main/java/mekanism/common/item/ItemGaugeDropper.java @@ -17,6 +17,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.fluids.Fluid; @@ -47,7 +48,7 @@ public class ItemGaugeDropper extends ItemMekanism implements IGasItem } @Override - public void getSubItems(Item item, CreativeTabs tabs, List list) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList list) { list.add(getEmptyItem()); } @@ -68,8 +69,10 @@ public class ItemGaugeDropper extends ItemMekanism implements IGasItem } @Override - public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) + public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { + ItemStack stack = player.getHeldItem(hand); + if(player.isSneaking() && !world.isRemote) { setGas(stack, null); diff --git a/src/main/java/mekanism/common/item/ItemHDPE.java b/src/main/java/mekanism/common/item/ItemHDPE.java index c906715cc..4e9a0c5aa 100644 --- a/src/main/java/mekanism/common/item/ItemHDPE.java +++ b/src/main/java/mekanism/common/item/ItemHDPE.java @@ -1,12 +1,11 @@ package mekanism.common.item; -import java.util.List; - import mekanism.common.Mekanism; import mekanism.common.base.IMetaItem; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; public class ItemHDPE extends ItemMekanism implements IMetaItem { @@ -30,7 +29,7 @@ public class ItemHDPE extends ItemMekanism implements IMetaItem } @Override - public void getSubItems(Item item, CreativeTabs tabs, List itemList) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList itemList) { for(int counter = 0; counter < PlasticItem.values().length; counter++) { diff --git a/src/main/java/mekanism/common/item/ItemIngot.java b/src/main/java/mekanism/common/item/ItemIngot.java index e0a87d3f8..3dcd05bd6 100644 --- a/src/main/java/mekanism/common/item/ItemIngot.java +++ b/src/main/java/mekanism/common/item/ItemIngot.java @@ -1,11 +1,10 @@ package mekanism.common.item; -import java.util.List; - import mekanism.common.base.IMetaItem; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; public class ItemIngot extends ItemMekanism implements IMetaItem { @@ -32,7 +31,7 @@ public class ItemIngot extends ItemMekanism implements IMetaItem } @Override - public void getSubItems(Item item, CreativeTabs tabs, List itemList) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList itemList) { for(int counter = 0; counter <= 6; counter++) { diff --git a/src/main/java/mekanism/common/item/ItemJetpack.java b/src/main/java/mekanism/common/item/ItemJetpack.java index a960926ab..05d9efd39 100644 --- a/src/main/java/mekanism/common/item/ItemJetpack.java +++ b/src/main/java/mekanism/common/item/ItemJetpack.java @@ -3,15 +3,15 @@ package mekanism.common.item; import java.util.List; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.general; import mekanism.api.gas.Gas; -import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.IGasItem; import mekanism.client.render.ModelCustomArmor; import mekanism.client.render.ModelCustomArmor.ArmorModel; import mekanism.common.Mekanism; +import mekanism.common.MekanismFluids; import mekanism.common.MekanismItems; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.LangUtils; import net.minecraft.client.model.ModelBiped; @@ -26,6 +26,8 @@ import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.MathHelper; import net.minecraftforge.common.ISpecialArmor; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.relauncher.Side; @@ -52,6 +54,12 @@ public class ItemJetpack extends ItemArmor implements IGasItem, ISpecialArmor { return 1D-((getGas(stack) != null ? (double)getGas(stack).amount : 0D)/(double)getMaxGas(stack)); } + + @Override + public int getRGBDurabilityForDisplay(ItemStack stack) + { + return MathHelper.hsvToRGB(Math.max(0.0F, (float)(1-getDurabilityForDisplay(stack))) / 3.0F, 1.0F, 1.0F); + } @Override public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) @@ -129,7 +137,7 @@ public class ItemJetpack extends ItemArmor implements IGasItem, ISpecialArmor return 0; } - if(stack.getGas() != GasRegistry.getGas("hydrogen")) + if(stack.getGas() != MekanismFluids.Hydrogen) { return 0; } @@ -154,7 +162,7 @@ public class ItemJetpack extends ItemArmor implements IGasItem, ISpecialArmor @Override public boolean canReceiveGas(ItemStack itemstack, Gas type) { - return type == GasRegistry.getGas("hydrogen"); + return type == MekanismFluids.Hydrogen; } @Override @@ -202,14 +210,14 @@ public class ItemJetpack extends ItemArmor implements IGasItem, ISpecialArmor } @Override - public void getSubItems(Item item, CreativeTabs tabs, List list) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList list) { ItemStack empty = new ItemStack(this); setGas(empty, null); list.add(empty); ItemStack filled = new ItemStack(this); - setGas(filled, new GasStack(GasRegistry.getGas("hydrogen"), ((IGasItem)filled.getItem()).getMaxGas(filled))); + setGas(filled, new GasStack(MekanismFluids.Hydrogen, ((IGasItem)filled.getItem()).getMaxGas(filled))); list.add(filled); } diff --git a/src/main/java/mekanism/common/item/ItemNetworkReader.java b/src/main/java/mekanism/common/item/ItemNetworkReader.java index 4dc65f938..944524eea 100644 --- a/src/main/java/mekanism/common/item/ItemNetworkReader.java +++ b/src/main/java/mekanism/common/item/ItemNetworkReader.java @@ -10,8 +10,8 @@ import mekanism.api.MekanismAPI; import mekanism.api.transmitters.DynamicNetwork; import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.TransmitterNetworkRegistry; -import mekanism.api.util.CapabilityUtils; import mekanism.common.capabilities.Capabilities; +import mekanism.common.util.CapabilityUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -32,8 +32,10 @@ public class ItemNetworkReader extends ItemEnergized } @Override - public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) + public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + ItemStack stack = player.getHeldItem(hand); + if(!world.isRemote) { TileEntity tileEntity = world.getTileEntity(pos); @@ -47,21 +49,21 @@ public class ItemNetworkReader extends ItemEnergized IGridTransmitter transmitter = CapabilityUtils.getCapability(tileEntity, Capabilities.GRID_TRANSMITTER_CAPABILITY, side.getOpposite()); - player.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------")); - player.addChatMessage(new TextComponentString(EnumColor.GREY + " *Transmitters: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkSize())); - player.addChatMessage(new TextComponentString(EnumColor.GREY + " *Acceptors: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkAcceptorSize())); - player.addChatMessage(new TextComponentString(EnumColor.GREY + " *Needed: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkNeeded())); - player.addChatMessage(new TextComponentString(EnumColor.GREY + " *Buffer: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkBuffer())); - player.addChatMessage(new TextComponentString(EnumColor.GREY + " *Throughput: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkFlow())); - player.addChatMessage(new TextComponentString(EnumColor.GREY + " *Capacity: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkCapacity())); + player.sendMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------")); + player.sendMessage(new TextComponentString(EnumColor.GREY + " *Transmitters: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkSize())); + player.sendMessage(new TextComponentString(EnumColor.GREY + " *Acceptors: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkAcceptorSize())); + player.sendMessage(new TextComponentString(EnumColor.GREY + " *Needed: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkNeeded())); + player.sendMessage(new TextComponentString(EnumColor.GREY + " *Buffer: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkBuffer())); + player.sendMessage(new TextComponentString(EnumColor.GREY + " *Throughput: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkFlow())); + player.sendMessage(new TextComponentString(EnumColor.GREY + " *Capacity: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkCapacity())); if(CapabilityUtils.hasCapability(tileEntity, Capabilities.HEAT_TRANSFER_CAPABILITY, side.getOpposite())) { IHeatTransfer transfer = CapabilityUtils.getCapability(tileEntity, Capabilities.HEAT_TRANSFER_CAPABILITY, side.getOpposite()); - player.addChatMessage(new TextComponentString(EnumColor.GREY + " *Temperature: " + EnumColor.DARK_GREY + transfer.getTemp() + "K above ambient")); + player.sendMessage(new TextComponentString(EnumColor.GREY + " *Temperature: " + EnumColor.DARK_GREY + transfer.getTemp() + "K above ambient")); } - player.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); + player.sendMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); return EnumActionResult.SUCCESS; } @@ -70,9 +72,9 @@ public class ItemNetworkReader extends ItemEnergized if(drain) setEnergy(stack, getEnergy(stack)-ENERGY_PER_USE); IHeatTransfer transfer = CapabilityUtils.getCapability(tileEntity, Capabilities.HEAT_TRANSFER_CAPABILITY, side.getOpposite()); - player.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------")); - player.addChatMessage(new TextComponentString(EnumColor.GREY + " *Temperature: " + EnumColor.DARK_GREY + transfer.getTemp() + "K above ambient")); - player.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); + player.sendMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------")); + player.sendMessage(new TextComponentString(EnumColor.GREY + " *Temperature: " + EnumColor.DARK_GREY + transfer.getTemp() + "K above ambient")); + player.sendMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); return EnumActionResult.SUCCESS; } @@ -93,9 +95,9 @@ public class ItemNetworkReader extends ItemEnergized if(transmitter.getTransmitterNetwork().possibleAcceptors.containsKey(coord.offset(iterSide.getOpposite())) && !iteratedNetworks.contains(transmitter.getTransmitterNetwork())) { - player.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[" + transmitter.getTransmissionType().getName() + "]" + EnumColor.GREY + " -------------")); - player.addChatMessage(new TextComponentString(EnumColor.GREY + " *Connected sides: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetwork().acceptorDirections.get(coord.offset(iterSide.getOpposite())))); - player.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); + player.sendMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[" + transmitter.getTransmissionType().getName() + "]" + EnumColor.GREY + " -------------")); + player.sendMessage(new TextComponentString(EnumColor.GREY + " *Connected sides: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetwork().acceptorDirections.get(coord.offset(iterSide.getOpposite())))); + player.sendMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); iteratedNetworks.add(transmitter.getTransmitterNetwork()); } @@ -109,14 +111,14 @@ public class ItemNetworkReader extends ItemEnergized if(player.isSneaking() && MekanismAPI.debug) { String[] strings = TransmitterNetworkRegistry.getInstance().toStrings(); - player.addChatMessage(new TextComponentString(EnumColor.GREY + "---------- " + EnumColor.DARK_BLUE + "[Mekanism Debug]" + EnumColor.GREY + " ----------")); + player.sendMessage(new TextComponentString(EnumColor.GREY + "---------- " + EnumColor.DARK_BLUE + "[Mekanism Debug]" + EnumColor.GREY + " ----------")); for(String s : strings) { - player.addChatMessage(new TextComponentString(EnumColor.DARK_GREY + s)); + player.sendMessage(new TextComponentString(EnumColor.DARK_GREY + s)); } - player.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); + player.sendMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); } } diff --git a/src/main/java/mekanism/common/item/ItemOtherDust.java b/src/main/java/mekanism/common/item/ItemOtherDust.java index e4f0eab3e..925ef1aed 100644 --- a/src/main/java/mekanism/common/item/ItemOtherDust.java +++ b/src/main/java/mekanism/common/item/ItemOtherDust.java @@ -1,11 +1,10 @@ package mekanism.common.item; -import java.util.List; - import mekanism.common.base.IMetaItem; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; public class ItemOtherDust extends ItemMekanism implements IMetaItem { @@ -36,7 +35,7 @@ public class ItemOtherDust extends ItemMekanism implements IMetaItem } @Override - public void getSubItems(Item item, CreativeTabs tabs, List itemList) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList itemList) { for(int counter = 0; counter < subtypes.length; counter++) { diff --git a/src/main/java/mekanism/common/item/ItemPortableTeleporter.java b/src/main/java/mekanism/common/item/ItemPortableTeleporter.java index 2ab8d31ca..bbe06930b 100644 --- a/src/main/java/mekanism/common/item/ItemPortableTeleporter.java +++ b/src/main/java/mekanism/common/item/ItemPortableTeleporter.java @@ -1,10 +1,14 @@ package mekanism.common.item; import java.util.List; +import java.util.UUID; import mekanism.api.Coord4D; import mekanism.api.EnumColor; +import mekanism.client.MekanismClient; import mekanism.common.Mekanism; +import mekanism.common.network.PacketSecurityUpdate.SecurityPacket; +import mekanism.common.network.PacketSecurityUpdate.SecurityUpdateMessage; import mekanism.common.security.IOwnerItem; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.LangUtils; @@ -28,7 +32,7 @@ public class ItemPortableTeleporter extends ItemEnergized implements IOwnerItem @Override public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) { - list.add(SecurityUtils.getOwnerDisplay(entityplayer.getName(), getOwner(itemstack))); + list.add(SecurityUtils.getOwnerDisplay(entityplayer, MekanismClient.clientUUIDMap.get(getOwnerUUID(itemstack)))); if(getFrequency(itemstack) != null) { @@ -40,14 +44,17 @@ public class ItemPortableTeleporter extends ItemEnergized implements IOwnerItem } @Override - public ActionResult onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, EnumHand hand) + public ActionResult onItemRightClick(World world, EntityPlayer entityplayer, EnumHand hand) { + ItemStack itemstack = entityplayer.getHeldItem(hand); + if(!world.isRemote) { - if(getOwner(itemstack) == null) + if(getOwnerUUID(itemstack) == null) { - setOwner(itemstack, entityplayer.getName()); - entityplayer.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("gui.nowOwn"))); + setOwnerUUID(itemstack, entityplayer.getUniqueID()); + Mekanism.packetHandler.sendToAll(new SecurityUpdateMessage(SecurityPacket.UPDATE, entityplayer.getUniqueID(), null)); + entityplayer.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("gui.nowOwn"))); } else { if(SecurityUtils.canAccess(entityplayer, itemstack)) @@ -72,7 +79,7 @@ public class ItemPortableTeleporter extends ItemEnergized implements IOwnerItem int neededEnergy = 1000; - if(entity.worldObj.provider.getDimension() != coords.dimensionId) + if(entity.world.provider.getDimension() != coords.dimensionId) { neededEnergy += 10000; } @@ -91,29 +98,29 @@ public class ItemPortableTeleporter extends ItemEnergized implements IOwnerItem } @Override - public String getOwner(ItemStack stack) + public UUID getOwnerUUID(ItemStack stack) { - if(ItemDataUtils.hasData(stack, "owner")) + if(ItemDataUtils.hasData(stack, "ownerUUID")) { - return ItemDataUtils.getString(stack, "owner"); + return UUID.fromString(ItemDataUtils.getString(stack, "ownerUUID")); } return null; } @Override - public void setOwner(ItemStack stack, String owner) + public void setOwnerUUID(ItemStack stack, UUID owner) { setFrequency(stack, null); setPrivateMode(stack, false); - if(owner == null || owner.isEmpty()) + if(owner == null) { - ItemDataUtils.removeData(stack, "owner"); + ItemDataUtils.removeData(stack, "ownerUUID"); return; } - ItemDataUtils.setString(stack, "owner", owner); + ItemDataUtils.setString(stack, "ownerUUID", owner.toString()); } @Override diff --git a/src/main/java/mekanism/common/item/ItemProxy.java b/src/main/java/mekanism/common/item/ItemProxy.java index 317842601..0286aeb37 100644 --- a/src/main/java/mekanism/common/item/ItemProxy.java +++ b/src/main/java/mekanism/common/item/ItemProxy.java @@ -1,5 +1,6 @@ package mekanism.common.item; +import mekanism.common.util.InventoryUtils; import mekanism.common.util.ItemDataUtils; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -45,7 +46,7 @@ public class ItemProxy extends Item { if(ItemDataUtils.getBoolean(stack, "hasStack")) { - return ItemStack.loadItemStackFromNBT(ItemDataUtils.getCompound(stack, "savedItem")); + return InventoryUtils.loadFromNBT(ItemDataUtils.getCompound(stack, "savedItem")); } return null; @@ -58,11 +59,11 @@ public class ItemProxy extends Item { EntityPlayer player = (EntityPlayer)entity; - for(int i = 0; i < player.inventory.mainInventory.length; i++) + for(int i = 0; i < player.inventory.mainInventory.size(); i++) { - if(player.inventory.mainInventory[i] != null && player.inventory.mainInventory[i].getItem() == this) + if(!player.inventory.mainInventory.get(i).isEmpty() && player.inventory.mainInventory.get(i).getItem() == this) { - player.inventory.mainInventory[i] = null; + player.inventory.mainInventory.remove(i); } } } diff --git a/src/main/java/mekanism/common/item/ItemRobit.java b/src/main/java/mekanism/common/item/ItemRobit.java index a6e4940c4..899bf3e48 100644 --- a/src/main/java/mekanism/common/item/ItemRobit.java +++ b/src/main/java/mekanism/common/item/ItemRobit.java @@ -39,9 +39,10 @@ public class ItemRobit extends ItemEnergized implements ISustainedInventory } @Override - public EnumActionResult onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, BlockPos pos, EnumHand hand, EnumFacing side, float posX, float posY, float posZ) + public EnumActionResult onItemUse(EntityPlayer entityplayer, World world, BlockPos pos, EnumHand hand, EnumFacing side, float posX, float posY, float posZ) { TileEntity tileEntity = world.getTileEntity(pos); + ItemStack itemstack = entityplayer.getHeldItem(hand); if(tileEntity instanceof TileEntityChargepad) { @@ -55,14 +56,14 @@ public class ItemRobit extends ItemEnergized implements ISustainedInventory robit.setHome(Coord4D.get(chargepad)); robit.setEnergy(getEnergy(itemstack)); - robit.setOwner(entityplayer.getName()); + robit.setOwnerUUID(entityplayer.getUniqueID()); robit.setInventory(getInventory(itemstack)); robit.setCustomNameTag(getName(itemstack)); - world.spawnEntityInWorld(robit); + world.spawnEntity(robit); } - entityplayer.setHeldItem(hand, null); + entityplayer.setHeldItem(hand, ItemStack.EMPTY); return EnumActionResult.SUCCESS; } diff --git a/src/main/java/mekanism/common/item/ItemScubaTank.java b/src/main/java/mekanism/common/item/ItemScubaTank.java index dc46634b0..84b01c6e2 100644 --- a/src/main/java/mekanism/common/item/ItemScubaTank.java +++ b/src/main/java/mekanism/common/item/ItemScubaTank.java @@ -3,14 +3,14 @@ package mekanism.common.item; import java.util.List; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.general; import mekanism.api.gas.Gas; -import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.IGasItem; import mekanism.client.render.ModelCustomArmor; import mekanism.client.render.ModelCustomArmor.ArmorModel; import mekanism.common.Mekanism; +import mekanism.common.MekanismFluids; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.LangUtils; import net.minecraft.client.model.ModelBiped; @@ -24,6 +24,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.MathHelper; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -65,6 +67,12 @@ public class ItemScubaTank extends ItemArmor implements IGasItem { return 1D-((getGas(stack) != null ? (double)getGas(stack).amount : 0D)/(double)getMaxGas(stack)); } + + @Override + public int getRGBDurabilityForDisplay(ItemStack stack) + { + return MathHelper.hsvToRGB(Math.max(0.0F, (float)(1-getDurabilityForDisplay(stack))) / 3.0F, 1.0F, 1.0F); + } @Override public boolean isValidArmor(ItemStack stack, EntityEquipmentSlot armorType, Entity entity) @@ -127,7 +135,7 @@ public class ItemScubaTank extends ItemArmor implements IGasItem return 0; } - if(stack.getGas() != GasRegistry.getGas("oxygen")) + if(stack.getGas() != MekanismFluids.Oxygen) { return 0; } @@ -174,7 +182,7 @@ public class ItemScubaTank extends ItemArmor implements IGasItem @Override public boolean canReceiveGas(ItemStack itemstack, Gas type) { - return type == GasRegistry.getGas("oxygen"); + return type == MekanismFluids.Oxygen; } @Override @@ -213,14 +221,14 @@ public class ItemScubaTank extends ItemArmor implements IGasItem } @Override - public void getSubItems(Item item, CreativeTabs tabs, List list) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList list) { ItemStack empty = new ItemStack(this); setGas(empty, null); list.add(empty); ItemStack filled = new ItemStack(this); - setGas(filled, new GasStack(GasRegistry.getGas("oxygen"), ((IGasItem)filled.getItem()).getMaxGas(filled))); + setGas(filled, new GasStack(MekanismFluids.Oxygen, ((IGasItem)filled.getItem()).getMaxGas(filled))); list.add(filled); } } diff --git a/src/main/java/mekanism/common/item/ItemSeismicReader.java b/src/main/java/mekanism/common/item/ItemSeismicReader.java index 192d21d80..d59371dfe 100644 --- a/src/main/java/mekanism/common/item/ItemSeismicReader.java +++ b/src/main/java/mekanism/common/item/ItemSeismicReader.java @@ -29,15 +29,16 @@ public class ItemSeismicReader extends ItemEnergized } @Override - public ActionResult onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, EnumHand hand) + public ActionResult onItemRightClick(World world, EntityPlayer entityplayer, EnumHand hand) { Chunk3D chunk = new Chunk3D(entityplayer); + ItemStack itemstack = entityplayer.getHeldItem(hand); if(getEnergy(itemstack) < ENERGY_USAGE && !entityplayer.capabilities.isCreativeMode) { if(!world.isRemote) { - entityplayer.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.RED + LangUtils.localize("tooltip.seismicReader.needsEnergy"))); + entityplayer.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.RED + LangUtils.localize("tooltip.seismicReader.needsEnergy"))); } return new ActionResult(EnumActionResult.SUCCESS, itemstack); @@ -46,7 +47,7 @@ public class ItemSeismicReader extends ItemEnergized { if(!world.isRemote) { - entityplayer.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.RED + LangUtils.localize("tooltip.seismicReader.noVibrations"))); + entityplayer.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.RED + LangUtils.localize("tooltip.seismicReader.noVibrations"))); } return new ActionResult(EnumActionResult.SUCCESS, itemstack); diff --git a/src/main/java/mekanism/common/item/ItemShard.java b/src/main/java/mekanism/common/item/ItemShard.java index 2e10a282e..c9ee86afd 100644 --- a/src/main/java/mekanism/common/item/ItemShard.java +++ b/src/main/java/mekanism/common/item/ItemShard.java @@ -1,12 +1,11 @@ package mekanism.common.item; -import java.util.List; - import mekanism.common.Resource; import mekanism.common.base.IMetaItem; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; public class ItemShard extends ItemMekanism implements IMetaItem { @@ -29,7 +28,7 @@ public class ItemShard extends ItemMekanism implements IMetaItem } @Override - public void getSubItems(Item item, CreativeTabs tabs, List itemList) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList itemList) { for(int counter = 0; counter < Resource.values().length; counter++) { diff --git a/src/main/java/mekanism/common/item/ItemTierInstaller.java b/src/main/java/mekanism/common/item/ItemTierInstaller.java index 6c63e4e3e..c7ffec555 100644 --- a/src/main/java/mekanism/common/item/ItemTierInstaller.java +++ b/src/main/java/mekanism/common/item/ItemTierInstaller.java @@ -1,11 +1,9 @@ package mekanism.common.item; -import java.util.List; - import mekanism.common.Tier.BaseTier; import mekanism.common.base.IMetaItem; import mekanism.common.base.ITierUpgradeable; -import mekanism.common.tile.TileEntityBasicBlock; +import mekanism.common.tile.prefab.TileEntityBasicBlock; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -14,6 +12,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -27,7 +26,7 @@ public class ItemTierInstaller extends ItemMekanism implements IMetaItem } @Override - public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) + public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { if(world.isRemote) { @@ -35,6 +34,7 @@ public class ItemTierInstaller extends ItemMekanism implements IMetaItem } TileEntity tile = world.getTileEntity(pos); + ItemStack stack = player.getHeldItem(hand); BaseTier tier = BaseTier.values()[stack.getItemDamage()]; if(tile instanceof ITierUpgradeable) @@ -48,7 +48,7 @@ public class ItemTierInstaller extends ItemMekanism implements IMetaItem { if(!player.capabilities.isCreativeMode) { - stack.stackSize--; + stack.shrink(1); } return EnumActionResult.SUCCESS; @@ -73,7 +73,7 @@ public class ItemTierInstaller extends ItemMekanism implements IMetaItem } @Override - public void getSubItems(Item item, CreativeTabs tabs, List itemList) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList itemList) { for(BaseTier tier : BaseTier.values()) { diff --git a/src/main/java/mekanism/common/item/ItemUpgrade.java b/src/main/java/mekanism/common/item/ItemUpgrade.java index 20fa6da5c..8519cadfd 100644 --- a/src/main/java/mekanism/common/item/ItemUpgrade.java +++ b/src/main/java/mekanism/common/item/ItemUpgrade.java @@ -53,11 +53,12 @@ public class ItemUpgrade extends ItemMekanism implements IUpgradeItem } @Override - public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) + public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { if(player.isSneaking()) { TileEntity tile = world.getTileEntity(pos); + ItemStack stack = player.getHeldItem(hand); Upgrade type = getUpgradeType(stack); if(tile instanceof IUpgradeTile) @@ -69,7 +70,7 @@ public class ItemUpgrade extends ItemMekanism implements IUpgradeItem if(!world.isRemote && component.getUpgrades(type) < type.getMax()) { component.addUpgrade(type); - stack.stackSize--; + stack.shrink(1); } } diff --git a/src/main/java/mekanism/common/item/ItemWalkieTalkie.java b/src/main/java/mekanism/common/item/ItemWalkieTalkie.java index 0aae3ca9a..a839d322b 100644 --- a/src/main/java/mekanism/common/item/ItemWalkieTalkie.java +++ b/src/main/java/mekanism/common/item/ItemWalkieTalkie.java @@ -47,8 +47,10 @@ public class ItemWalkieTalkie extends ItemMekanism } @Override - public ActionResult onItemRightClick(ItemStack itemStack, World world, EntityPlayer player, EnumHand hand) + public ActionResult onItemRightClick(World world, EntityPlayer player, EnumHand hand) { + ItemStack itemStack = player.getHeldItem(hand); + if(player.isSneaking()) { setOn(itemStack, !getOn(itemStack)); diff --git a/src/main/java/mekanism/common/multiblock/SynchronizedData.java b/src/main/java/mekanism/common/multiblock/SynchronizedData.java index 17d6b3cb2..0508c2629 100644 --- a/src/main/java/mekanism/common/multiblock/SynchronizedData.java +++ b/src/main/java/mekanism/common/multiblock/SynchronizedData.java @@ -5,6 +5,7 @@ import java.util.Set; import mekanism.api.Coord4D; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; public abstract class SynchronizedData> { @@ -33,7 +34,7 @@ public abstract class SynchronizedData> public Set internalLocations = new HashSet(); - public ItemStack[] getInventory() + public NonNullList getInventory() { return null; } diff --git a/src/main/java/mekanism/common/multiblock/TileEntityInternalMultiblock.java b/src/main/java/mekanism/common/multiblock/TileEntityInternalMultiblock.java index 9b721874d..6b1f1465e 100644 --- a/src/main/java/mekanism/common/multiblock/TileEntityInternalMultiblock.java +++ b/src/main/java/mekanism/common/multiblock/TileEntityInternalMultiblock.java @@ -5,7 +5,7 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; import mekanism.common.PacketHandler; -import mekanism.common.tile.TileEntityBasicBlock; +import mekanism.common.tile.prefab.TileEntityBasicBlock; import net.minecraftforge.fml.common.FMLCommonHandler; public class TileEntityInternalMultiblock extends TileEntityBasicBlock diff --git a/src/main/java/mekanism/common/multiblock/UpdateProtocol.java b/src/main/java/mekanism/common/multiblock/UpdateProtocol.java index 6ea2ab73d..a6624b25d 100644 --- a/src/main/java/mekanism/common/multiblock/UpdateProtocol.java +++ b/src/main/java/mekanism/common/multiblock/UpdateProtocol.java @@ -37,7 +37,7 @@ public abstract class UpdateProtocol> */ public void loopThrough(Coord4D coord) { - World worldObj = pointer.getWorld(); + World world = pointer.getWorld(); int origX = coord.xCoord, origY = coord.yCoord, origZ = coord.zCoord; @@ -323,7 +323,7 @@ public abstract class UpdateProtocol> { TileEntity tile = new Coord4D(pos, pointer.getWorld()).getTileEntity(pointer.getWorld()); - if(tile == null || !tile.hasWorldObj() || tile.isInvalid()) + if(tile == null || !tile.hasWorld() || tile.isInvalid()) { return false; } diff --git a/src/main/java/mekanism/common/multipart/GlowPanelBlockState.java b/src/main/java/mekanism/common/multipart/GlowPanelBlockState.java deleted file mode 100644 index caaa8b5f6..000000000 --- a/src/main/java/mekanism/common/multipart/GlowPanelBlockState.java +++ /dev/null @@ -1,15 +0,0 @@ -package mekanism.common.multipart; - -import mcmultipart.MCMultiPartMod; -import mekanism.common.block.states.BlockStateFacing; -import net.minecraft.block.properties.IProperty; -import net.minecraftforge.common.property.ExtendedBlockState; -import net.minecraftforge.common.property.IUnlistedProperty; - -public class GlowPanelBlockState extends ExtendedBlockState -{ - public GlowPanelBlockState() - { - super(MCMultiPartMod.multipart, new IProperty[] {BlockStateFacing.facingProperty}, new IUnlistedProperty[] {ColorProperty.INSTANCE}); - } -} diff --git a/src/main/java/mekanism/common/multipart/ItemGlowPanel.java b/src/main/java/mekanism/common/multipart/ItemGlowPanel.java deleted file mode 100644 index 74fb65c6b..000000000 --- a/src/main/java/mekanism/common/multipart/ItemGlowPanel.java +++ /dev/null @@ -1,96 +0,0 @@ -package mekanism.common.multipart; - -import java.util.List; - -import mcmultipart.item.ItemMultiPart; -import mcmultipart.multipart.IMultipart; -import mekanism.api.EnumColor; -import mekanism.common.Mekanism; -import mekanism.common.base.IMetaItem; -import mekanism.common.util.LangUtils; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.text.translation.I18n; -import net.minecraft.world.World; - -public class ItemGlowPanel extends ItemMultiPart implements IMetaItem -{ - public ItemGlowPanel() - { - super(); - setHasSubtypes(true); - setCreativeTab(Mekanism.tabMekanism); - } - - @Override - public IMultipart createPart(World world, BlockPos pos, EnumFacing orientation, Vec3d vHit, ItemStack item, EntityPlayer player) - { - EnumColor col = EnumColor.DYES[item.getItemDamage()]; - - if(pos != null && orientation != null) - { - BlockPos pos1 = pos.offset(orientation); - - if(world.isSideSolid(pos1, orientation.getOpposite())) - { - return new PartGlowPanel(col, orientation); - } - } - - return null; - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List listToAddTo) - { - for(EnumColor color : EnumColor.DYES) - { - listToAddTo.add(new ItemStack(item, 1, color.getMetaValue())); - } - } - - @Override - public String getItemStackDisplayName(ItemStack stack) - { - EnumColor colour = EnumColor.DYES[stack.getItemDamage()]; - String colourName; - - if(I18n.canTranslate(getUnlocalizedName(stack) + "." + colour.dyeName)) - { - return LangUtils.localize(getUnlocalizedName(stack) + "." + colour.dyeName); - } - - if(colour == EnumColor.BLACK) - { - colourName = EnumColor.DARK_GREY + colour.getDyeName(); - } - else { - colourName = colour.getDyedName(); - } - - return colourName + " " + super.getItemStackDisplayName(stack); - } - - @Override - public boolean shouldRotateAroundWhenRendering() - { - return true; - } - - @Override - public String getTexture(int meta) - { - return "glow_panel"; - } - - @Override - public int getVariants() - { - return EnumColor.DYES.length; - } -} diff --git a/src/main/java/mekanism/common/multipart/MultipartMekanism.java b/src/main/java/mekanism/common/multipart/MultipartMekanism.java deleted file mode 100644 index 3c0c355de..000000000 --- a/src/main/java/mekanism/common/multipart/MultipartMekanism.java +++ /dev/null @@ -1,228 +0,0 @@ -package mekanism.common.multipart; - -import static mekanism.common.block.states.BlockStateMachine.MachineBlock.MACHINE_BLOCK_1; -import static mekanism.common.block.states.BlockStateMachine.MachineBlock.MACHINE_BLOCK_2; -import mcmultipart.multipart.IMultipart; -import mcmultipart.multipart.IPartFactory; -import mcmultipart.multipart.Multipart; -import mcmultipart.multipart.MultipartRegistry; -import mekanism.common.MekanismBlocks; -import mekanism.common.Tier; -import mekanism.common.block.states.BlockStateMachine.MachineType; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.Vec3d; -import net.minecraftforge.fml.common.event.FMLInterModComms; - -public class MultipartMekanism implements IPartFactory -{ - public MultipartMekanism() - { - init(); - } - - public void init() - { - MultipartRegistry.registerPartFactory(this, "mekanism:universal_cable_basic", - "mekanism:universal_cable_advanced", "mekanism:universal_cable_elite", - "mekanism:universal_cable_ultimate", "mekanism:mechanical_pipe", - "mekanism:mechanical_pipe_basic", "mekanism:mechanical_pipe_advanced", - "mekanism:mechanical_pipe_elite", "mekanism:mechanical_pipe_ultimate", - "mekanism:pressurized_tube_basic", "mekanism:pressurized_tube_advanced", - "mekanism:pressurized_tube_elite", "mekanism:pressurized_tube_ultimate", - "mekanism:logistical_transporter_basic", "mekanism:logistical_transporter_advanced", - "mekanism:logistical_transporter_elite", "mekanism:logistical_transporter_ultimate", - "mekanism:restrictive_transporter", "mekanism:diversion_transporter", - "mekanism:thermodynamic_conductor_basic", "mekanism:thermodynamic_conductor_advanced", - "mekanism:thermodynamic_conductor_elite", "mekanism:thermodynamic_conductor_ultimate", - "mekanism:glow_panel"); - - registerMicroMaterials(); - } - - @Override - public IMultipart createPart(ResourceLocation resource, boolean client) - { - String name = resource.toString(); - - if(name.equals("mekanism:universal_cable")) - { - return new PartUniversalCable(Tier.CableTier.BASIC); - } - else if(name.equals("mekanism:universal_cable_basic")) - { - return new PartUniversalCable(Tier.CableTier.BASIC); - } - else if(name.equals("mekanism:universal_cable_advanced")) - { - return new PartUniversalCable(Tier.CableTier.ADVANCED); - } - else if(name.equals("mekanism:universal_cable_elite")) - { - return new PartUniversalCable(Tier.CableTier.ELITE); - } - else if(name.equals("mekanism:universal_cable_ultimate")) - { - return new PartUniversalCable(Tier.CableTier.ULTIMATE); - } - else if(name.equals("mekanism:mechanical_pipe")) - { - return new PartMechanicalPipe(Tier.PipeTier.BASIC); - } - else if(name.equals("mekanism:mechanical_pipe_basic")) - { - return new PartMechanicalPipe(Tier.PipeTier.BASIC); - } - else if(name.equals("mekanism:mechanical_pipe_advanced")) - { - return new PartMechanicalPipe(Tier.PipeTier.ADVANCED); - } - else if(name.equals("mekanism:mechanical_pipe_elite")) - { - return new PartMechanicalPipe(Tier.PipeTier.ELITE); - } - else if(name.equals("mekanism:mechanical_pipe_ultimate")) - { - return new PartMechanicalPipe(Tier.PipeTier.ULTIMATE); - } - else if(name.equals("mekanism:pressurized_tube_basic") || name.equals("mekanism:pressurized_tube")) - { - return new PartPressurizedTube(Tier.TubeTier.BASIC); - } - else if(name.equals("mekanism:pressurized_tube_advanced")) - { - return new PartPressurizedTube(Tier.TubeTier.ADVANCED); - } - else if(name.equals("mekanism:pressurized_tube_elite")) - { - return new PartPressurizedTube(Tier.TubeTier.ELITE); - } - else if(name.equals("mekanism:pressurized_tube_ultimate")) - { - return new PartPressurizedTube(Tier.TubeTier.ULTIMATE); - } - else if(name.equals("mekanism:logistical_transporter_basic") || name.equals("mekanism:logistical_transporter")) - { - return new PartLogisticalTransporter(Tier.TransporterTier.BASIC); - } - else if(name.equals("mekanism:logistical_transporter_advanced")) - { - return new PartLogisticalTransporter(Tier.TransporterTier.ADVANCED); - } - else if(name.equals("mekanism:logistical_transporter_elite")) - { - return new PartLogisticalTransporter(Tier.TransporterTier.ELITE); - } - else if(name.equals("mekanism:logistical_transporter_ultimate")) - { - return new PartLogisticalTransporter(Tier.TransporterTier.ULTIMATE); - } - else if(name.equals("mekanism:restrictive_transporter")) - { - return new PartRestrictiveTransporter(); - } - else if(name.equals("mekanism:diversion_transporter")) - { - return new PartDiversionTransporter(); - } - else if(name.equals("mekanism:thermodynamic_conductor_basic")) - { - return new PartThermodynamicConductor(Tier.ConductorTier.BASIC); - } - else if(name.equals("mekanism:thermodynamic_conductor_advanced")) - { - return new PartThermodynamicConductor(Tier.ConductorTier.ADVANCED); - } - else if(name.equals("mekanism:thermodynamic_conductor_elite")) - { - return new PartThermodynamicConductor(Tier.ConductorTier.ELITE); - } - else if(name.equals("mekanism:thermodynamic_conductor_ultimate")) - { - return new PartThermodynamicConductor(Tier.ConductorTier.ULTIMATE); - } - else if(name.equals("mekanism:glow_panel")) - { - return new PartGlowPanel(); - } - - return null; - } - - public void registerMicroMaterials() - { - for(int i = 0; i < 16; i++) - { -// MicroblockRegistry.registerMaterial(new PlasticMicroMaterial(MekanismBlocks.PlasticBlock, i), BlockMicroMaterial.materialKey(MekanismBlocks.PlasticBlock, i)); -// MicroMaterialRegistry.registerMaterial(new PlasticMicroMaterial(MekanismBlocks.GlowPlasticBlock, i), BlockMicroMaterial.materialKey(MekanismBlocks.GlowPlasticBlock, i)); -// MicroMaterialRegistry.registerMaterial(new PlasticMicroMaterial(MekanismBlocks.SlickPlasticBlock, i), BlockMicroMaterial.materialKey(MekanismBlocks.SlickPlasticBlock, i)); -// MicroMaterialRegistry.registerMaterial(new PlasticMicroMaterial(MekanismBlocks.ReinforcedPlasticBlock, i), BlockMicroMaterial.materialKey(MekanismBlocks.ReinforcedPlasticBlock, i)); -// MicroMaterialRegistry.registerMaterial(new PlasticMicroMaterial(MekanismBlocks.RoadPlasticBlock, i), BlockMicroMaterial.materialKey(MekanismBlocks.RoadPlasticBlock, i)); - - FMLInterModComms.sendMessage("ForgeMicroblock", "microMaterial", new ItemStack(MekanismBlocks.BasicBlock, 1, i)); - - if(!MachineType.get(MACHINE_BLOCK_1, i).hasModel) - { - FMLInterModComms.sendMessage("ForgeMicroblock", "microMaterial", new ItemStack(MekanismBlocks.MachineBlock, 1, i)); - } - - if(!MachineType.get(MACHINE_BLOCK_2, i).hasModel) - { - FMLInterModComms.sendMessage("ForgeMicroblock", "microMaterial", new ItemStack(MekanismBlocks.MachineBlock2, 1, i)); - } - } - - FMLInterModComms.sendMessage("ForgeMicroblock", "microMaterial", new ItemStack(MekanismBlocks.BasicBlock2, 1, 0)); - FMLInterModComms.sendMessage("ForgeMicroblock", "microMaterial", new ItemStack(MekanismBlocks.CardboardBox)); - } - - public static void dropItem(ItemStack stack, Multipart multipart) - { - EntityItem item = new EntityItem(multipart.getWorld(), multipart.getPos().getX()+0.5, multipart.getPos().getY()+0.5, multipart.getPos().getZ()+0.5, stack); - item.motionX = multipart.getWorld().rand.nextGaussian() * 0.05; - item.motionY = multipart.getWorld().rand.nextGaussian() * 0.05 + 0.2; - item.motionZ = multipart.getWorld().rand.nextGaussian() * 0.05; - item.setDefaultPickupDelay(); - multipart.getWorld().spawnEntityInWorld(item); - } - - public static void dropItems(Multipart multipart) - { - for(ItemStack stack : multipart.getDrops()) - { - dropItem(stack, multipart); - } - } - - public static AxisAlignedBB rotate(AxisAlignedBB aabb, EnumFacing side) - { - Vec3d v1 = rotate(new Vec3d(aabb.minX, aabb.minY, aabb.minZ), side); - Vec3d v2 = rotate(new Vec3d(aabb.maxX, aabb.maxY, aabb.maxZ), side); - - return new AxisAlignedBB(v1.xCoord, v1.yCoord, v1.zCoord, v2.xCoord, v2.yCoord, v2.zCoord); - } - - public static Vec3d rotate(Vec3d vec, EnumFacing side) - { - switch(side) - { - case DOWN: - return new Vec3d(vec.xCoord, vec.yCoord, vec.zCoord); - case UP: - return new Vec3d(vec.xCoord, -vec.yCoord, -vec.zCoord); - case NORTH: - return new Vec3d(vec.xCoord, -vec.zCoord, vec.yCoord); - case SOUTH: - return new Vec3d(vec.xCoord, vec.zCoord, -vec.yCoord); - case WEST: - return new Vec3d(vec.yCoord, -vec.xCoord, vec.zCoord); - case EAST: - return new Vec3d(-vec.yCoord, vec.xCoord, vec.zCoord); - } - - return null; - } -} diff --git a/src/main/java/mekanism/common/multipart/PartGlowPanel.java b/src/main/java/mekanism/common/multipart/PartGlowPanel.java deleted file mode 100644 index ab8461f8f..000000000 --- a/src/main/java/mekanism/common/multipart/PartGlowPanel.java +++ /dev/null @@ -1,211 +0,0 @@ -package mekanism.common.multipart; - -import java.util.Collections; -import java.util.List; - -import mcmultipart.microblock.IMicroblock.IFaceMicroblock; -import mcmultipart.multipart.IMultipart; -import mcmultipart.multipart.INormallyOccludingPart; -import mcmultipart.multipart.Multipart; -import mcmultipart.multipart.PartSlot; -import mcmultipart.raytrace.PartMOP; -import mekanism.api.Coord4D; -import mekanism.api.EnumColor; -import mekanism.common.MekanismItems; -import mekanism.common.block.states.BlockStateFacing; -import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -//import net.minecraft.util.IIcon; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.Vec3d; -import net.minecraftforge.common.property.IExtendedBlockState; - -public class PartGlowPanel extends Multipart implements INormallyOccludingPart -{ - public EnumColor colour = EnumColor.WHITE; - public EnumFacing side = EnumFacing.DOWN; - - public static AxisAlignedBB[] bounds = new AxisAlignedBB[6]; - - static - { - AxisAlignedBB cuboid = new AxisAlignedBB(0.25, 0, 0.25, 0.75, 0.125, 0.75); - Vec3d fromOrigin = new Vec3d(-0.5, -0.5, -0.5); - - for(EnumFacing side : EnumFacing.VALUES) - { - bounds[side.ordinal()] = MultipartMekanism.rotate(cuboid.offset(fromOrigin.xCoord, fromOrigin.yCoord, fromOrigin.zCoord), side).offset(-fromOrigin.xCoord, -fromOrigin.zCoord, -fromOrigin.zCoord); - } - } - - public PartGlowPanel() - { - super(); - } - - public PartGlowPanel(EnumColor colour, EnumFacing side) - { - super(); - setColour(colour); - setOrientation(side); - } - - @Override - public void addSelectionBoxes(List list) - { - list.add(bounds[side.ordinal()]); - } - - @Override - public ResourceLocation getType() - { - return new ResourceLocation("mekanism:glow_panel"); - } - - public void setColour(EnumColor newColour) - { - colour = newColour; - } - - public void setOrientation(EnumFacing newSide) - { - side = newSide; - } - - @Override - public void onNeighborTileChange(EnumFacing side) - { - if(!getWorld().isRemote && !canStay()) - { - MultipartMekanism.dropItem(new ItemStack(MekanismItems.GlowPanel, 1, colour.getMetaValue()), this); - getContainer().removePart(this); - } - } - - @Override - public void onPartChanged(IMultipart other) - { - if(!getWorld().isRemote && !canStay()) - { - MultipartMekanism.dropItem(new ItemStack(MekanismItems.GlowPanel, 1, colour.getMetaValue()), this); - getContainer().removePart(this); - } - } - - @Override - public void writeUpdatePacket(PacketBuffer data) - { - data.writeInt(side.ordinal()); - data.writeInt(colour.getMetaValue()); - } - - @Override - public void readUpdatePacket(PacketBuffer data) - { - side = EnumFacing.getFront(data.readInt()); - colour = EnumColor.DYES[data.readInt()]; - } - - @Override - public NBTTagCompound writeToNBT(NBTTagCompound nbt) - { - nbt.setInteger("side", side.ordinal()); - nbt.setInteger("colour", colour.getMetaValue()); - - return nbt; - } - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - side = EnumFacing.getFront(nbt.getInteger("side")); - colour = EnumColor.DYES[nbt.getInteger("colour")]; - } - - @Override - public int getLightValue() - { - return 15; - } - - @Override - public void addOcclusionBoxes(List list) - { - addSelectionBoxes(list); - } - - @Override - public float getHardness(PartMOP partHit) - { - return 3.5F; - } - - @Override - public List getDrops() - { - return Collections.singletonList(getPickBlock(null, null)); - } - - @Override - public ItemStack getPickBlock(EntityPlayer player, PartMOP hit) - { - return new ItemStack(MekanismItems.GlowPanel, 1, colour.getMetaValue()); - } - - public boolean canStay() - { - Coord4D adj = new Coord4D(getPos().offset(side), getWorld()); - return getWorld().isSideSolid(adj.getPos(), side.getOpposite()) || (getContainer().getPartInSlot(PartSlot.getFaceSlot(side)) instanceof IFaceMicroblock && ((IFaceMicroblock)getContainer().getPartInSlot(PartSlot.getFaceSlot(side))).isFaceHollow()); - } - - @Override - public ResourceLocation getModelPath() - { - return getType(); - } - - @Override - public BlockStateContainer createBlockState() - { - return new GlowPanelBlockState(); - } - - @Override - public IBlockState getActualState(IBlockState state) - { - return state.withProperty(BlockStateFacing.facingProperty, side); - } - - @Override - public IBlockState getExtendedState(IBlockState state) - { - state = state.withProperty(BlockStateFacing.facingProperty, side); - - if(state instanceof IExtendedBlockState) - { - return ((IExtendedBlockState)state).withProperty(ColorProperty.INSTANCE, new ColorProperty(colour)); - } - - return state; - } - - public static int hash(IExtendedBlockState state) - { - int hash = 1; - hash = 31 * hash + state.getValue(ColorProperty.INSTANCE).color.ordinal(); - hash = 31 * hash + state.getValue(BlockStateFacing.facingProperty).ordinal(); - - return hash; - } - - @Override - public boolean shouldBreakingUseExtendedState() { - return true; - } -} diff --git a/src/main/java/mekanism/common/multipart/TransmitterType.java b/src/main/java/mekanism/common/multipart/TransmitterType.java deleted file mode 100644 index 8a292e259..000000000 --- a/src/main/java/mekanism/common/multipart/TransmitterType.java +++ /dev/null @@ -1,85 +0,0 @@ -package mekanism.common.multipart; - -import mekanism.api.transmitters.TransmissionType; -import mekanism.common.Tier.BaseTier; - -public enum TransmitterType -{ - UNIVERSAL_CABLE_BASIC("BasicUniversalCable", BaseTier.BASIC, Size.SMALL, TransmissionType.ENERGY, false, 0, 0), - UNIVERSAL_CABLE_ADVANCED("AdvancedUniversalCable", BaseTier.ADVANCED, Size.SMALL, TransmissionType.ENERGY, false, 1, 1), - UNIVERSAL_CABLE_ELITE("EliteUniversalCable", BaseTier.ELITE, Size.SMALL, TransmissionType.ENERGY, false, 2, 2), - UNIVERSAL_CABLE_ULTIMATE("UltimateUniversalCable", BaseTier.ULTIMATE, Size.SMALL, TransmissionType.ENERGY, false, 3, 3), - MECHANICAL_PIPE_BASIC("BasicMechanicalPipe", BaseTier.BASIC, Size.LARGE, TransmissionType.FLUID, false, 0, 0), - MECHANICAL_PIPE_ADVANCED("AdvancedMechanicalPipe", BaseTier.ADVANCED, Size.LARGE, TransmissionType.FLUID, false, 1, 1), - MECHANICAL_PIPE_ELITE("EliteMechanicalPipe", BaseTier.ELITE, Size.LARGE, TransmissionType.FLUID, false, 2, 2), - MECHANICAL_PIPE_ULTIMATE("UltimateMechanicalPipe", BaseTier.ULTIMATE, Size.LARGE, TransmissionType.FLUID, false, 3, 3), - PRESSURIZED_TUBE_BASIC("BasicPressurizedTube", BaseTier.BASIC, Size.SMALL, TransmissionType.GAS, false, 0, 0), - PRESSURIZED_TUBE_ADVANCED("AdvancedPressurizedTube", BaseTier.ADVANCED, Size.SMALL, TransmissionType.GAS, false, 1, 1), - PRESSURIZED_TUBE_ELITE("ElitePressurizedTube", BaseTier.ELITE, Size.SMALL, TransmissionType.GAS, false, 2, 2), - PRESSURIZED_TUBE_ULTIMATE("UltimatePressurizedTube", BaseTier.ULTIMATE, Size.SMALL, TransmissionType.GAS, false, 3, 3), - LOGISTICAL_TRANSPORTER_BASIC("BasicLogisticalTransporter", BaseTier.BASIC, Size.LARGE, TransmissionType.ITEM, true, 0, 0, 6, 10), - LOGISTICAL_TRANSPORTER_ADVANCED("AdvancedLogisticalTransporter", BaseTier.ADVANCED, Size.LARGE, TransmissionType.ITEM, true, 1, 1, 6, 10), - LOGISTICAL_TRANSPORTER_ELITE("EliteLogisticalTransporter", BaseTier.ELITE, Size.LARGE, TransmissionType.ITEM, true, 2, 2, 6, 10), - LOGISTICAL_TRANSPORTER_ULTIMATE("UltimateLogisticalTransporter", BaseTier.ULTIMATE, Size.LARGE, TransmissionType.ITEM, true, 3, 3, 6, 10), - RESTRICTIVE_TRANSPORTER("RestrictiveTransporter", BaseTier.BASIC, Size.LARGE, TransmissionType.ITEM, false, 4, 8), - DIVERSION_TRANSPORTER("DiversionTransporter", BaseTier.BASIC, Size.LARGE, TransmissionType.ITEM, true, 5, 14, 6, 10), - THERMODYNAMIC_CONDUCTOR_BASIC("BasicThermodynamicConductor", BaseTier.BASIC, Size.SMALL, TransmissionType.HEAT, false, 0, 0), - THERMODYNAMIC_CONDUCTOR_ADVANCED("AdvancedThermodynamicConductor", BaseTier.ADVANCED, Size.SMALL, TransmissionType.HEAT, false, 1, 1), - THERMODYNAMIC_CONDUCTOR_ELITE("EliteThermodynamicConductor", BaseTier.ELITE, Size.SMALL, TransmissionType.HEAT, false, 2, 2), - THERMODYNAMIC_CONDUCTOR_ULTIMATE("UltimateThermodynamicConductor", BaseTier.ULTIMATE, Size.SMALL, TransmissionType.HEAT, false, 3, 3); - - private String unlocalizedName; - private Size size; - private TransmissionType transmissionType; - private boolean transparencyRender; - private int[] indexes; - private BaseTier tier; - - private TransmitterType(String name, BaseTier t, Size s, TransmissionType type, boolean transparency, int... is) - { - unlocalizedName = name; - tier = t; - size = s; - transmissionType = type; - transparencyRender = transparency; - indexes = is; - } - - public BaseTier getTier() - { - return tier; - } - - public String getName() - { - return unlocalizedName; - } - - public Size getSize() - { - return size; - } - - public boolean hasTransparency() - { - return transparencyRender; - } - - public TransmissionType getTransmission() - { - return transmissionType; - } - - public static enum Size - { - SMALL(6), - LARGE(8); - - public int centerSize; - - private Size(int size) - { - centerSize = size; - } - } -} diff --git a/src/main/java/mekanism/common/network/PacketConfigSync.java b/src/main/java/mekanism/common/network/PacketConfigSync.java index 5074a2846..37f2659fd 100644 --- a/src/main/java/mekanism/common/network/PacketConfigSync.java +++ b/src/main/java/mekanism/common/network/PacketConfigSync.java @@ -1,16 +1,15 @@ package mekanism.common.network; import io.netty.buffer.ByteBuf; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.machines; -import mekanism.api.MekanismConfig.usage; -import mekanism.api.util.UnitDisplayUtils.EnergyType; import mekanism.common.Mekanism; import mekanism.common.Tier; import mekanism.common.base.IModule; import mekanism.common.block.states.BlockStateMachine; import mekanism.common.block.states.BlockStateMachine.MachineType; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.network.PacketConfigSync.ConfigSyncMessage; +import mekanism.common.util.UnitDisplayUtils.EnergyType; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; @@ -45,6 +44,8 @@ public class PacketConfigSync implements IMessageHandler privateFreqs = new ArrayList(); - for(Frequency f : getManager(player.getName(), world).getFrequencies()) + for(Frequency f : getManager(player.getUniqueID(), world).getFrequencies()) { privateFreqs.add(f); } @@ -168,7 +169,7 @@ public class PacketPortableTeleporter implements IMessageHandler { if(message.guiType == 0) { - player.openGui(Mekanism.instance, 21, player.worldObj, message.entityId, 0, 0); + player.openGui(Mekanism.instance, 21, player.world, message.entityId, 0, 0); } else if(message.guiType == 1) { - player.openGui(Mekanism.instance, 22, player.worldObj, message.entityId, 0, 0); + player.openGui(Mekanism.instance, 22, player.world, message.entityId, 0, 0); } else if(message.guiType == 2) { - player.openGui(Mekanism.instance, 23, player.worldObj, message.entityId, 0, 0); + player.openGui(Mekanism.instance, 23, player.world, message.entityId, 0, 0); } else if(message.guiType == 3) { - player.openGui(Mekanism.instance, 24, player.worldObj, message.entityId, 0, 0); + player.openGui(Mekanism.instance, 24, player.world, message.entityId, 0, 0); } else if(message.guiType == 4) { - player.openGui(Mekanism.instance, 25, player.worldObj, message.entityId, 0, 0); + player.openGui(Mekanism.instance, 25, player.world, message.entityId, 0, 0); } } else if(message.activeType == RobitPacketType.FOLLOW) { - EntityRobit robit = (EntityRobit)player.worldObj.getEntityByID(message.entityId); + EntityRobit robit = (EntityRobit)player.world.getEntityByID(message.entityId); if(robit != null) { @@ -55,7 +55,7 @@ public class PacketRobit implements IMessageHandler } else if(message.activeType == RobitPacketType.NAME) { - EntityRobit robit = (EntityRobit)player.worldObj.getEntityByID(message.entityId); + EntityRobit robit = (EntityRobit)player.world.getEntityByID(message.entityId); if(robit != null) { @@ -64,7 +64,7 @@ public class PacketRobit implements IMessageHandler } else if(message.activeType == RobitPacketType.GO_HOME) { - EntityRobit robit = (EntityRobit)player.worldObj.getEntityByID(message.entityId); + EntityRobit robit = (EntityRobit)player.world.getEntityByID(message.entityId); if(robit != null) { @@ -73,7 +73,7 @@ public class PacketRobit implements IMessageHandler } else if(message.activeType == RobitPacketType.DROP_PICKUP) { - EntityRobit robit = (EntityRobit)player.worldObj.getEntityByID(message.entityId); + EntityRobit robit = (EntityRobit)player.world.getEntityByID(message.entityId); if(robit != null) { diff --git a/src/main/java/mekanism/common/network/PacketScubaTankData.java b/src/main/java/mekanism/common/network/PacketScubaTankData.java index 3a8fe6c66..a229d971b 100644 --- a/src/main/java/mekanism/common/network/PacketScubaTankData.java +++ b/src/main/java/mekanism/common/network/PacketScubaTankData.java @@ -29,16 +29,16 @@ public class PacketScubaTankData implements IMessageHandler 1) + if(bin.isEmpty() || bin.getCount() > 1) { - return null; + return ItemStack.EMPTY; } - ItemStack addStack = null; + ItemStack addStack = ItemStack.EMPTY; for(int i = 0; i < 9; i++) { ItemStack stack = inv.getStackInSlot(i); - if(stack != null && !isBin(stack)) + if(!stack.isEmpty() && !isBin(stack)) { - if(addStack != null) + if(!addStack.isEmpty()) { - return null; + return ItemStack.EMPTY; } addStack = stack.copy(); @@ -94,13 +95,13 @@ public class BinRecipe implements IRecipe InventoryBin binInv = new InventoryBin(bin); - if(addStack != null) + if(!addStack.isEmpty()) { if(!(addStack.getItem() instanceof ItemProxy)) { - if(binInv.getItemType() != null && !binInv.getItemType().isItemEqual(addStack)) + if(!binInv.getItemType().isEmpty() && !binInv.getItemType().isItemEqual(addStack)) { - return null; + return ItemStack.EMPTY; } binInv.add(addStack); @@ -122,11 +123,11 @@ public class BinRecipe implements IRecipe @Override public ItemStack getRecipeOutput() { - return null; + return ItemStack.EMPTY; } @Override - public ItemStack[] getRemainingItems(InventoryCrafting inv) + public NonNullList getRemainingItems(InventoryCrafting inv) { return ForgeHooks.defaultRecipeGetRemainingItems(inv); } @@ -134,7 +135,7 @@ public class BinRecipe implements IRecipe @SubscribeEvent public void onCrafting(ItemCraftedEvent event) { - if(getResult(event.craftMatrix) != null) + if(!getResult(event.craftMatrix).isEmpty()) { if(!isBin(event.crafting)) { @@ -148,7 +149,7 @@ public class BinRecipe implements IRecipe int size = inv.getItemCount(); ItemStack testRemove = inv.removeStack(); - int newCount = size-(testRemove != null ? testRemove.stackSize : 0); + int newCount = size-(!testRemove.isEmpty() ? testRemove.getCount() : 0); if(inv.getTier() == BinTier.CREATIVE) { @@ -169,7 +170,7 @@ public class BinRecipe implements IRecipe { bin = i; } - else if(!isBin(event.craftMatrix.getStackInSlot(i)) && event.craftMatrix.getStackInSlot(i) != null) + else if(!isBin(event.craftMatrix.getStackInSlot(i)) && !event.craftMatrix.getStackInSlot(i).isEmpty()) { other = i; } @@ -180,14 +181,14 @@ public class BinRecipe implements IRecipe ItemStack testRemain = new InventoryBin(binStack.copy()).add(otherStack.copy()); - if(testRemain != null && testRemain.stackSize > 0) + if(!testRemain.isEmpty() && testRemain.getCount() > 0) { ItemStack proxy = new ItemStack(MekanismItems.ItemProxy); ((ItemProxy)proxy.getItem()).setSavedItem(proxy, testRemain.copy()); event.craftMatrix.setInventorySlotContents(other, proxy); } else { - event.craftMatrix.setInventorySlotContents(other, null); + event.craftMatrix.setInventorySlotContents(other, ItemStack.EMPTY); } } } diff --git a/src/main/java/mekanism/common/recipe/RecipeHandler.java b/src/main/java/mekanism/common/recipe/RecipeHandler.java index 444d0dec8..c5416668e 100644 --- a/src/main/java/mekanism/common/recipe/RecipeHandler.java +++ b/src/main/java/mekanism/common/recipe/RecipeHandler.java @@ -1,14 +1,16 @@ package mekanism.common.recipe; import java.lang.reflect.Constructor; +import java.util.ArrayList; import java.util.HashMap; +import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; import mekanism.api.gas.Gas; import mekanism.api.gas.GasStack; import mekanism.api.infuse.InfuseType; -import mekanism.api.util.StackUtils; import mekanism.common.block.states.BlockStateMachine.MachineType; import mekanism.common.recipe.inputs.AdvancedMachineInput; import mekanism.common.recipe.inputs.ChemicalPairInput; @@ -49,8 +51,10 @@ import mekanism.common.recipe.outputs.GasOutput; import mekanism.common.recipe.outputs.ItemStackOutput; import mekanism.common.recipe.outputs.MachineOutput; import mekanism.common.recipe.outputs.PressurizedOutput; +import mekanism.common.util.StackUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -68,7 +72,22 @@ public final class RecipeHandler public static void removeRecipe(Recipe recipeMap, MachineRecipe recipe) { - recipeMap.remove(recipe); + List toRemove = new ArrayList<>(); + + for(Iterator iter = recipeMap.get().keySet().iterator(); iter.hasNext();) + { + MachineInput iterInput = (MachineInput)iter.next(); + + if(iterInput.testEquality(recipe.getInput())) + { + toRemove.add(iterInput); + } + } + + for(MachineInput iterInput : toRemove) + { + recipeMap.get().remove(iterInput); + } } /** @@ -159,9 +178,9 @@ public final class RecipeHandler * @param input - input ItemStack * @param output - output ItemStack */ - public static void addChemicalInjectionChamberRecipe(ItemStack input, String gasName, ItemStack output) + public static void addChemicalInjectionChamberRecipe(ItemStack input, Gas gas, ItemStack output) { - addRecipe(Recipe.CHEMICAL_INJECTION_CHAMBER, new InjectionRecipe(input, gasName, output)); + addRecipe(Recipe.CHEMICAL_INJECTION_CHAMBER, new InjectionRecipe(input, gas, output)); } /** @@ -488,13 +507,15 @@ public final class RecipeHandler */ public static > boolean isInRecipe(ItemStack itemstack, Map recipes) { - if(itemstack != null) + if(!itemstack.isEmpty()) { for(RECIPE recipe : recipes.values()) { ItemStackInput required = recipe.getInput(); + NonNullList list = NonNullList.create(); + list.add(itemstack); - if(required.useItemStackFromInventory(new ItemStack[]{itemstack}, 0, false)) + if(required.useItemStackFromInventory(list, 0, false)) { return true; } @@ -506,7 +527,7 @@ public final class RecipeHandler public static boolean isInPressurizedRecipe(ItemStack stack) { - if(stack != null) + if(!stack.isEmpty()) { for(PressurizedInput key : (Set)Recipe.PRESSURIZED_REACTION_CHAMBER.get().keySet()) { @@ -539,25 +560,25 @@ public final class RecipeHandler public static enum Recipe { - ENERGIZED_SMELTER(MachineType.ENERGIZED_SMELTER.machineName, ItemStackInput.class, ItemStackOutput.class, SmeltingRecipe.class), - ENRICHMENT_CHAMBER(MachineType.ENRICHMENT_CHAMBER.machineName, ItemStackInput.class, ItemStackOutput.class, EnrichmentRecipe.class), - OSMIUM_COMPRESSOR(MachineType.OSMIUM_COMPRESSOR.machineName, AdvancedMachineInput.class, ItemStackOutput.class, OsmiumCompressorRecipe.class), - COMBINER(MachineType.COMBINER.machineName, AdvancedMachineInput.class, ItemStackOutput.class, CombinerRecipe.class), - CRUSHER(MachineType.CRUSHER.machineName, ItemStackInput.class, ItemStackOutput.class, CrusherRecipe.class), - PURIFICATION_CHAMBER(MachineType.PURIFICATION_CHAMBER.machineName, AdvancedMachineInput.class, ItemStackOutput.class, PurificationRecipe.class), - METALLURGIC_INFUSER(MachineType.METALLURGIC_INFUSER.machineName, InfusionInput.class, ItemStackOutput.class, MetallurgicInfuserRecipe.class), - CHEMICAL_INFUSER(MachineType.CHEMICAL_INFUSER.machineName, ChemicalPairInput.class, GasOutput.class, ChemicalInfuserRecipe.class), - CHEMICAL_OXIDIZER(MachineType.CHEMICAL_OXIDIZER.machineName, ItemStackInput.class, GasOutput.class, OxidationRecipe.class), - CHEMICAL_INJECTION_CHAMBER(MachineType.CHEMICAL_INJECTION_CHAMBER.machineName, AdvancedMachineInput.class, ItemStackOutput.class, InjectionRecipe.class), - ELECTROLYTIC_SEPARATOR(MachineType.ELECTROLYTIC_SEPARATOR.machineName, FluidInput.class, ChemicalPairOutput.class, SeparatorRecipe.class), - PRECISION_SAWMILL(MachineType.PRECISION_SAWMILL.machineName, ItemStackInput.class, ChanceOutput.class, SawmillRecipe.class), - CHEMICAL_DISSOLUTION_CHAMBER(MachineType.CHEMICAL_DISSOLUTION_CHAMBER.machineName, ItemStackInput.class, GasOutput.class, DissolutionRecipe.class), - CHEMICAL_WASHER(MachineType.CHEMICAL_WASHER.machineName, GasInput.class, GasOutput.class, WasherRecipe.class), - CHEMICAL_CRYSTALLIZER(MachineType.CHEMICAL_CRYSTALLIZER.machineName, GasInput.class, ItemStackOutput.class, CrystallizerRecipe.class), - PRESSURIZED_REACTION_CHAMBER(MachineType.PRESSURIZED_REACTION_CHAMBER.machineName, PressurizedInput.class, PressurizedOutput.class, PressurizedRecipe.class), - AMBIENT_ACCUMULATOR(MachineType.AMBIENT_ACCUMULATOR.machineName, IntegerInput.class, GasOutput.class, AmbientGasRecipe.class), + ENERGIZED_SMELTER(MachineType.ENERGIZED_SMELTER.blockName, ItemStackInput.class, ItemStackOutput.class, SmeltingRecipe.class), + ENRICHMENT_CHAMBER(MachineType.ENRICHMENT_CHAMBER.blockName, ItemStackInput.class, ItemStackOutput.class, EnrichmentRecipe.class), + OSMIUM_COMPRESSOR(MachineType.OSMIUM_COMPRESSOR.blockName, AdvancedMachineInput.class, ItemStackOutput.class, OsmiumCompressorRecipe.class), + COMBINER(MachineType.COMBINER.blockName, AdvancedMachineInput.class, ItemStackOutput.class, CombinerRecipe.class), + CRUSHER(MachineType.CRUSHER.blockName, ItemStackInput.class, ItemStackOutput.class, CrusherRecipe.class), + PURIFICATION_CHAMBER(MachineType.PURIFICATION_CHAMBER.blockName, AdvancedMachineInput.class, ItemStackOutput.class, PurificationRecipe.class), + METALLURGIC_INFUSER(MachineType.METALLURGIC_INFUSER.blockName, InfusionInput.class, ItemStackOutput.class, MetallurgicInfuserRecipe.class), + CHEMICAL_INFUSER(MachineType.CHEMICAL_INFUSER.blockName, ChemicalPairInput.class, GasOutput.class, ChemicalInfuserRecipe.class), + CHEMICAL_OXIDIZER(MachineType.CHEMICAL_OXIDIZER.blockName, ItemStackInput.class, GasOutput.class, OxidationRecipe.class), + CHEMICAL_INJECTION_CHAMBER(MachineType.CHEMICAL_INJECTION_CHAMBER.blockName, AdvancedMachineInput.class, ItemStackOutput.class, InjectionRecipe.class), + ELECTROLYTIC_SEPARATOR(MachineType.ELECTROLYTIC_SEPARATOR.blockName, FluidInput.class, ChemicalPairOutput.class, SeparatorRecipe.class), + PRECISION_SAWMILL(MachineType.PRECISION_SAWMILL.blockName, ItemStackInput.class, ChanceOutput.class, SawmillRecipe.class), + CHEMICAL_DISSOLUTION_CHAMBER(MachineType.CHEMICAL_DISSOLUTION_CHAMBER.blockName, ItemStackInput.class, GasOutput.class, DissolutionRecipe.class), + CHEMICAL_WASHER(MachineType.CHEMICAL_WASHER.blockName, GasInput.class, GasOutput.class, WasherRecipe.class), + CHEMICAL_CRYSTALLIZER(MachineType.CHEMICAL_CRYSTALLIZER.blockName, GasInput.class, ItemStackOutput.class, CrystallizerRecipe.class), + PRESSURIZED_REACTION_CHAMBER(MachineType.PRESSURIZED_REACTION_CHAMBER.blockName, PressurizedInput.class, PressurizedOutput.class, PressurizedRecipe.class), + AMBIENT_ACCUMULATOR(MachineType.AMBIENT_ACCUMULATOR.blockName, IntegerInput.class, GasOutput.class, AmbientGasRecipe.class), THERMAL_EVAPORATION_PLANT("ThermalEvaporationPlant", FluidInput.class, FluidOutput.class, ThermalEvaporationRecipe.class), - SOLAR_NEUTRON_ACTIVATOR(MachineType.SOLAR_NEUTRON_ACTIVATOR.machineName, GasInput.class, GasOutput.class, SolarNeutronRecipe.class); + SOLAR_NEUTRON_ACTIVATOR(MachineType.SOLAR_NEUTRON_ACTIVATOR.blockName, GasInput.class, GasOutput.class, SolarNeutronRecipe.class); private HashMap recipes; private String recipeName; @@ -610,8 +631,13 @@ public final class RecipeHandler MachineOutput output = outputClass.newInstance(); output.load(nbtTags); - Constructor construct = recipeClass.getDeclaredConstructor(inputClass, outputClass); - return (RECIPE)construct.newInstance(input, output); + try { + Constructor construct = recipeClass.getDeclaredConstructor(inputClass, outputClass); + return (RECIPE)construct.newInstance(input, output); + } catch(Exception e) { + Constructor construct = recipeClass.getDeclaredConstructor(inputClass, outputClass, NBTTagCompound.class); + return (RECIPE)construct.newInstance(input, output, nbtTags); + } } catch(Exception e) { return null; } diff --git a/src/main/java/mekanism/common/recipe/ShapedMekanismRecipe.java b/src/main/java/mekanism/common/recipe/ShapedMekanismRecipe.java index b899ef679..c6b107a30 100644 --- a/src/main/java/mekanism/common/recipe/ShapedMekanismRecipe.java +++ b/src/main/java/mekanism/common/recipe/ShapedMekanismRecipe.java @@ -3,6 +3,8 @@ package mekanism.common.recipe; import java.util.HashMap; import mekanism.common.Mekanism; +import mekanism.common.MekanismItems; +import mekanism.common.util.InventoryUtils; import mekanism.common.util.RecipeUtils; import net.minecraft.block.Block; import net.minecraft.inventory.InventoryCrafting; @@ -11,6 +13,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.util.Constants.NBT; @@ -26,7 +29,7 @@ public class ShapedMekanismRecipe implements IRecipe private static final int MAX_CRAFT_GRID_WIDTH = 3; private static final int MAX_CRAFT_GRID_HEIGHT = 3; - private ItemStack output = null; + private ItemStack output = ItemStack.EMPTY; private Object[] input = null; public int width = 0; @@ -154,7 +157,7 @@ public class ShapedMekanismRecipe implements IRecipe } @Override - public ItemStack[] getRemainingItems(InventoryCrafting inv) + public NonNullList getRemainingItems(InventoryCrafting inv) { return ForgeHooks.defaultRecipeGetRemainingItems(inv); } @@ -225,7 +228,7 @@ public class ShapedMekanismRecipe implements IRecipe return false; } } - else if(target == null && slot != null) + else if(target == null && !slot.isEmpty()) { return false; } @@ -254,10 +257,10 @@ public class ShapedMekanismRecipe implements IRecipe return null; } - ItemStack result = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("result")); + ItemStack result = InventoryUtils.loadFromNBT(nbtTags.getCompoundTag("result")); NBTTagList list = nbtTags.getTagList("input", NBT.TAG_COMPOUND); - if(result == null || list.tagCount() == 0) + if(result.isEmpty() || list.tagCount() == 0) { Mekanism.logger.error("[Mekanism] Shaped recipe parse error: invalid result stack or input data list."); return null; @@ -291,7 +294,7 @@ public class ShapedMekanismRecipe implements IRecipe } else if(compound.hasKey("itemstack")) { - ret[i] = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("itemstack")); + ret[i] = InventoryUtils.loadFromNBT(compound.getCompoundTag("itemstack")); } else { Mekanism.logger.error("[Mekanism] Shaped recipe parse error: invalid input tag data key."); diff --git a/src/main/java/mekanism/common/recipe/ShapelessMekanismRecipe.java b/src/main/java/mekanism/common/recipe/ShapelessMekanismRecipe.java index d093f2092..42e05e103 100644 --- a/src/main/java/mekanism/common/recipe/ShapelessMekanismRecipe.java +++ b/src/main/java/mekanism/common/recipe/ShapelessMekanismRecipe.java @@ -5,6 +5,7 @@ import java.util.Iterator; import java.util.List; import mekanism.common.Mekanism; +import mekanism.common.util.InventoryUtils; import mekanism.common.util.RecipeUtils; import net.minecraft.block.Block; import net.minecraft.inventory.InventoryCrafting; @@ -13,6 +14,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.util.Constants.NBT; @@ -20,7 +22,7 @@ import net.minecraftforge.oredict.OreDictionary; public class ShapelessMekanismRecipe implements IRecipe { - private ItemStack output = null; + private ItemStack output = ItemStack.EMPTY; private ArrayList input = new ArrayList(); public ShapelessMekanismRecipe(Block result, Object... recipe){ this(new ItemStack(result), recipe); } @@ -75,7 +77,7 @@ public class ShapelessMekanismRecipe implements IRecipe } @Override - public ItemStack[] getRemainingItems(InventoryCrafting inv) + public NonNullList getRemainingItems(InventoryCrafting inv) { return ForgeHooks.defaultRecipeGetRemainingItems(inv); } @@ -96,7 +98,7 @@ public class ShapelessMekanismRecipe implements IRecipe { ItemStack slot = inv.getStackInSlot(x); - if(slot != null) + if(!slot.isEmpty()) { boolean inRecipe = false; Iterator req = required.iterator(); @@ -153,10 +155,10 @@ public class ShapelessMekanismRecipe implements IRecipe return null; } - ItemStack result = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("result")); + ItemStack result = InventoryUtils.loadFromNBT(nbtTags.getCompoundTag("result")); NBTTagList list = nbtTags.getTagList("input", NBT.TAG_COMPOUND); - if(result == null || list.tagCount() == 0) + if(result.isEmpty() || list.tagCount() == 0) { Mekanism.logger.error("[Mekanism] Shapeless recipe parse error: invalid result stack or input data list."); return null; @@ -174,7 +176,7 @@ public class ShapelessMekanismRecipe implements IRecipe } else if(compound.hasKey("itemstack")) { - ret[i] = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("itemstack")); + ret[i] = InventoryUtils.loadFromNBT(compound.getCompoundTag("itemstack")); } else { Mekanism.logger.error("[Mekanism] Shapeless recipe parse error: invalid input tag data key."); diff --git a/src/main/java/mekanism/common/recipe/inputs/AdvancedMachineInput.java b/src/main/java/mekanism/common/recipe/inputs/AdvancedMachineInput.java index 7725a1dbd..f43e3e2a3 100644 --- a/src/main/java/mekanism/common/recipe/inputs/AdvancedMachineInput.java +++ b/src/main/java/mekanism/common/recipe/inputs/AdvancedMachineInput.java @@ -2,13 +2,15 @@ package mekanism.common.recipe.inputs; import mekanism.api.gas.Gas; import mekanism.api.gas.GasTank; -import mekanism.api.util.StackUtils; +import mekanism.common.util.InventoryUtils; +import mekanism.common.util.StackUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; public class AdvancedMachineInput extends MachineInput { - public ItemStack itemStack; + public ItemStack itemStack = ItemStack.EMPTY; public Gas gasType; @@ -23,7 +25,7 @@ public class AdvancedMachineInput extends MachineInput @Override public void load(NBTTagCompound nbtTags) { - itemStack = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("input")); + itemStack = InventoryUtils.loadFromNBT(nbtTags.getCompoundTag("input")); gasType = Gas.readFromNBT(nbtTags.getCompoundTag("gasType")); } @@ -36,16 +38,16 @@ public class AdvancedMachineInput extends MachineInput @Override public boolean isValid() { - return itemStack != null && gasType != null; + return !itemStack.isEmpty() && gasType != null; } - public boolean useItem(ItemStack[] inventory, int index, boolean deplete) + public boolean useItem(NonNullList inventory, int index, boolean deplete) { - if(inputContains(inventory[index], itemStack)) + if(inputContains(inventory.get(index), itemStack)) { if(deplete) { - inventory[index] = StackUtils.subtract(inventory[index], itemStack); + inventory.set(index, StackUtils.subtract(inventory.get(index), itemStack)); } return true; @@ -67,7 +69,7 @@ public class AdvancedMachineInput extends MachineInput public boolean matches(AdvancedMachineInput input) { - return StackUtils.equalsWildcard(itemStack, input.itemStack) && input.itemStack.stackSize >= itemStack.stackSize; + return StackUtils.equalsWildcard(itemStack, input.itemStack) && input.itemStack.getCount() >= itemStack.getCount(); } @Override diff --git a/src/main/java/mekanism/common/recipe/inputs/FluidInput.java b/src/main/java/mekanism/common/recipe/inputs/FluidInput.java index 90deeef43..eb2abd12a 100644 --- a/src/main/java/mekanism/common/recipe/inputs/FluidInput.java +++ b/src/main/java/mekanism/common/recipe/inputs/FluidInput.java @@ -57,6 +57,7 @@ public class FluidInput extends MachineInput { return !other.isValid(); } + return ingredient.equals(other.ingredient); } diff --git a/src/main/java/mekanism/common/recipe/inputs/InfusionInput.java b/src/main/java/mekanism/common/recipe/inputs/InfusionInput.java index 840443291..e40952e08 100644 --- a/src/main/java/mekanism/common/recipe/inputs/InfusionInput.java +++ b/src/main/java/mekanism/common/recipe/inputs/InfusionInput.java @@ -2,10 +2,12 @@ package mekanism.common.recipe.inputs; import mekanism.api.infuse.InfuseRegistry; import mekanism.api.infuse.InfuseType; -import mekanism.api.util.StackUtils; import mekanism.common.InfuseStorage; +import mekanism.common.util.InventoryUtils; +import mekanism.common.util.StackUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; /** * An infusion input, containing the type of and amount of infuse the operation requires, as well as the input ItemStack. @@ -34,7 +36,7 @@ public class InfusionInput extends MachineInput @Override public void load(NBTTagCompound nbtTags) { - inputStack = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("input")); + inputStack = InventoryUtils.loadFromNBT(nbtTags.getCompoundTag("input")); InfuseType type = InfuseRegistry.get(nbtTags.getString("infuseType")); int amount = nbtTags.getInteger("infuseAmount"); infuse = new InfuseStorage(type, amount); @@ -54,13 +56,13 @@ public class InfusionInput extends MachineInput return infuse.type != null && inputStack != null; } - public boolean use(ItemStack[] inventory, int index, InfuseStorage infuseStorage, boolean deplete) + public boolean use(NonNullList inventory, int index, InfuseStorage infuseStorage, boolean deplete) { - if(inputContains(inventory[index], inputStack) && infuseStorage.contains(infuse)) + if(inputContains(inventory.get(index), inputStack) && infuseStorage.contains(infuse)) { if(deplete) { - inventory[index] = StackUtils.subtract(inventory[index], inputStack); + inventory.set(index, StackUtils.subtract(inventory.get(index), inputStack)); infuseStorage.subtract(infuse); } diff --git a/src/main/java/mekanism/common/recipe/inputs/ItemStackInput.java b/src/main/java/mekanism/common/recipe/inputs/ItemStackInput.java index 76d0a8b7f..2f86cc2e2 100644 --- a/src/main/java/mekanism/common/recipe/inputs/ItemStackInput.java +++ b/src/main/java/mekanism/common/recipe/inputs/ItemStackInput.java @@ -1,13 +1,15 @@ package mekanism.common.recipe.inputs; -import mekanism.api.util.StackUtils; +import mekanism.common.util.InventoryUtils; +import mekanism.common.util.StackUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; import net.minecraftforge.oredict.OreDictionary; public class ItemStackInput extends MachineInput { - public ItemStack ingredient; + public ItemStack ingredient = ItemStack.EMPTY; public ItemStackInput(ItemStack stack) { @@ -19,7 +21,7 @@ public class ItemStackInput extends MachineInput @Override public void load(NBTTagCompound nbtTags) { - ingredient = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("input")); + ingredient = InventoryUtils.loadFromNBT(nbtTags.getCompoundTag("input")); } @Override @@ -31,21 +33,21 @@ public class ItemStackInput extends MachineInput @Override public boolean isValid() { - return ingredient != null; + return !ingredient.isEmpty(); } public ItemStackInput wildCopy() { - return new ItemStackInput(new ItemStack(ingredient.getItem(), ingredient.stackSize, OreDictionary.WILDCARD_VALUE)); + return new ItemStackInput(new ItemStack(ingredient.getItem(), ingredient.getCount(), OreDictionary.WILDCARD_VALUE)); } - public boolean useItemStackFromInventory(ItemStack[] inventory, int index, boolean deplete) + public boolean useItemStackFromInventory(NonNullList inventory, int index, boolean deplete) { - if(inputContains(inventory[index], ingredient)) + if(inputContains(inventory.get(index), ingredient)) { if(deplete) { - inventory[index] = StackUtils.subtract(inventory[index], ingredient); + inventory.set(index, StackUtils.subtract(inventory.get(index), ingredient)); } return true; diff --git a/src/main/java/mekanism/common/recipe/inputs/MachineInput.java b/src/main/java/mekanism/common/recipe/inputs/MachineInput.java index 7340c5888..fe23e05f1 100644 --- a/src/main/java/mekanism/common/recipe/inputs/MachineInput.java +++ b/src/main/java/mekanism/common/recipe/inputs/MachineInput.java @@ -1,7 +1,7 @@ package mekanism.common.recipe.inputs; -import mekanism.api.util.StackUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.StackUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -27,14 +27,14 @@ public abstract class MachineInput> public static boolean inputContains(ItemStack container, ItemStack contained) { - if(container != null && container.stackSize >= contained.stackSize) + if(container != null && container.getCount() >= contained.getCount()) { if(MekanismUtils.getOreDictName(container).contains("treeSapling")) { return StackUtils.equalsWildcard(contained, container); } - return StackUtils.equalsWildcardWithNBT(contained, container) && container.stackSize >= contained.stackSize; + return StackUtils.equalsWildcardWithNBT(contained, container) && container.getCount() >= contained.getCount(); } return false; diff --git a/src/main/java/mekanism/common/recipe/inputs/PressurizedInput.java b/src/main/java/mekanism/common/recipe/inputs/PressurizedInput.java index 2fc3e919e..46eb15af7 100644 --- a/src/main/java/mekanism/common/recipe/inputs/PressurizedInput.java +++ b/src/main/java/mekanism/common/recipe/inputs/PressurizedInput.java @@ -2,9 +2,11 @@ package mekanism.common.recipe.inputs; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; -import mekanism.api.util.StackUtils; +import mekanism.common.util.InventoryUtils; +import mekanism.common.util.StackUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; @@ -13,7 +15,7 @@ import net.minecraftforge.fluids.FluidTank; */ public class PressurizedInput extends MachineInput { - private ItemStack theSolid; + private ItemStack theSolid = ItemStack.EMPTY; private FluidStack theFluid; private GasStack theGas; @@ -29,7 +31,7 @@ public class PressurizedInput extends MachineInput @Override public void load(NBTTagCompound nbtTags) { - theSolid = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("itemInput")); + theSolid = InventoryUtils.loadFromNBT(nbtTags.getCompoundTag("itemInput")); theFluid = FluidStack.loadFluidStackFromNBT(nbtTags.getCompoundTag("fluidInput")); theGas = GasStack.readFromNBT(nbtTags.getCompoundTag("gasInput")); } @@ -40,21 +42,23 @@ public class PressurizedInput extends MachineInput @Override public boolean isValid() { - return theSolid != null && theFluid != null && theGas != null; + return !theSolid.isEmpty() && theFluid != null && theGas != null; } - public boolean use(ItemStack[] inventory, int index, FluidTank fluidTank, GasTank gasTank, boolean deplete) + public boolean use(NonNullList inventory, int index, FluidTank fluidTank, GasTank gasTank, boolean deplete) { - if(meets(new PressurizedInput(inventory[index], fluidTank.getFluid(), gasTank.getGas()))) + if(meets(new PressurizedInput(inventory.get(index), fluidTank.getFluid(), gasTank.getGas()))) { if(deplete) { - inventory[index] = StackUtils.subtract(inventory[index], theSolid); + inventory.set(index, StackUtils.subtract(inventory.get(index), theSolid)); fluidTank.drain(theFluid.amount, true); gasTank.draw(theGas.amount, true); } + return true; } + return false; } @@ -65,7 +69,7 @@ public class PressurizedInput extends MachineInput */ public boolean containsType(ItemStack stack) { - if(stack == null || stack.stackSize == 0) + if(stack.isEmpty() || stack.getCount() == 0) { return false; } @@ -120,7 +124,7 @@ public class PressurizedInput extends MachineInput return false; } - return input.theSolid.stackSize >= theSolid.stackSize && input.theFluid.amount >= theFluid.amount && input.theGas.amount >= theGas.amount; + return input.theSolid.getCount() >= theSolid.getCount() && input.theFluid.amount >= theFluid.amount && input.theGas.amount >= theGas.amount; } @Override diff --git a/src/main/java/mekanism/common/recipe/machines/AdvancedMachineRecipe.java b/src/main/java/mekanism/common/recipe/machines/AdvancedMachineRecipe.java index 22bb16214..736521298 100644 --- a/src/main/java/mekanism/common/recipe/machines/AdvancedMachineRecipe.java +++ b/src/main/java/mekanism/common/recipe/machines/AdvancedMachineRecipe.java @@ -6,6 +6,7 @@ import mekanism.api.gas.GasTank; import mekanism.common.recipe.inputs.AdvancedMachineInput; import mekanism.common.recipe.outputs.ItemStackOutput; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; public abstract class AdvancedMachineRecipe> extends MachineRecipe { @@ -14,22 +15,17 @@ public abstract class AdvancedMachineRecipe inventory, int inputIndex, int outputIndex, GasTank gasTank, int amount) { return getInput().useItem(inventory, inputIndex, false) && getInput().useSecondary(gasTank, amount, false) && getOutput().applyOutputs(inventory, outputIndex, false); } - public void operate(ItemStack[] inventory, int inputIndex, int outputIndex, GasTank gasTank, int needed) + public void operate(NonNullList inventory, int inputIndex, int outputIndex, GasTank gasTank, int needed) { if(getInput().useItem(inventory, inputIndex, true) && getInput().useSecondary(gasTank, needed, true)) { diff --git a/src/main/java/mekanism/common/recipe/machines/BasicMachineRecipe.java b/src/main/java/mekanism/common/recipe/machines/BasicMachineRecipe.java index e2f628edb..32d609e6e 100644 --- a/src/main/java/mekanism/common/recipe/machines/BasicMachineRecipe.java +++ b/src/main/java/mekanism/common/recipe/machines/BasicMachineRecipe.java @@ -3,6 +3,7 @@ package mekanism.common.recipe.machines; import mekanism.common.recipe.inputs.ItemStackInput; import mekanism.common.recipe.outputs.ItemStackOutput; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; public abstract class BasicMachineRecipe> extends MachineRecipe { @@ -16,12 +17,12 @@ public abstract class BasicMachineRecipe inventory, int inputIndex, int outputIndex) { return getInput().useItemStackFromInventory(inventory, inputIndex, false) && getOutput().applyOutputs(inventory, outputIndex, false); } - public void operate(ItemStack[] inventory, int inputIndex, int outputIndex) + public void operate(NonNullList inventory, int inputIndex, int outputIndex) { if(getInput().useItemStackFromInventory(inventory, inputIndex, true)) { diff --git a/src/main/java/mekanism/common/recipe/machines/ChanceMachineRecipe.java b/src/main/java/mekanism/common/recipe/machines/ChanceMachineRecipe.java index 159a2d1ab..c6a46a7f0 100644 --- a/src/main/java/mekanism/common/recipe/machines/ChanceMachineRecipe.java +++ b/src/main/java/mekanism/common/recipe/machines/ChanceMachineRecipe.java @@ -3,6 +3,7 @@ package mekanism.common.recipe.machines; import mekanism.common.recipe.inputs.ItemStackInput; import mekanism.common.recipe.outputs.ChanceOutput; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; public abstract class ChanceMachineRecipe> extends MachineRecipe { @@ -11,12 +12,12 @@ public abstract class ChanceMachineRecipe inventory, int inputIndex, int primaryIndex, int secondaryIndex) { return getInput().useItemStackFromInventory(inventory, inputIndex, false) && getOutput().applyOutputs(inventory, primaryIndex, secondaryIndex, false); } - public void operate(ItemStack[] inventory) + public void operate(NonNullList inventory) { if(getInput().useItemStackFromInventory(inventory, 0, true)) { diff --git a/src/main/java/mekanism/common/recipe/machines/CombinerRecipe.java b/src/main/java/mekanism/common/recipe/machines/CombinerRecipe.java index 2f889fa0c..8a0997304 100644 --- a/src/main/java/mekanism/common/recipe/machines/CombinerRecipe.java +++ b/src/main/java/mekanism/common/recipe/machines/CombinerRecipe.java @@ -1,5 +1,6 @@ package mekanism.common.recipe.machines; +import mekanism.common.MekanismFluids; import mekanism.common.recipe.inputs.AdvancedMachineInput; import mekanism.common.recipe.outputs.ItemStackOutput; import net.minecraft.item.ItemStack; @@ -13,7 +14,7 @@ public class CombinerRecipe extends AdvancedMachineRecipe public CombinerRecipe(ItemStack input, ItemStack output) { - super(input, "liquidStone", output); + super(input, MekanismFluids.LiquidStone, output); } @Override diff --git a/src/main/java/mekanism/common/recipe/machines/CrystallizerRecipe.java b/src/main/java/mekanism/common/recipe/machines/CrystallizerRecipe.java index 5122ca0c3..7288a5149 100644 --- a/src/main/java/mekanism/common/recipe/machines/CrystallizerRecipe.java +++ b/src/main/java/mekanism/common/recipe/machines/CrystallizerRecipe.java @@ -5,6 +5,7 @@ import mekanism.api.gas.GasTank; import mekanism.common.recipe.inputs.GasInput; import mekanism.common.recipe.outputs.ItemStackOutput; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; public class CrystallizerRecipe extends MachineRecipe { @@ -18,12 +19,12 @@ public class CrystallizerRecipe extends MachineRecipe inventory) { return getInput().useGas(gasTank, false, 1) && getOutput().applyOutputs(inventory, 1, false); } - public void operate(GasTank inputTank, ItemStack[] inventory) + public void operate(GasTank inputTank, NonNullList inventory) { if(getInput().useGas(inputTank, true, 1)) { diff --git a/src/main/java/mekanism/common/recipe/machines/DissolutionRecipe.java b/src/main/java/mekanism/common/recipe/machines/DissolutionRecipe.java index 9d36ac30d..2d8def3f4 100644 --- a/src/main/java/mekanism/common/recipe/machines/DissolutionRecipe.java +++ b/src/main/java/mekanism/common/recipe/machines/DissolutionRecipe.java @@ -5,6 +5,7 @@ import mekanism.api.gas.GasTank; import mekanism.common.recipe.inputs.ItemStackInput; import mekanism.common.recipe.outputs.GasOutput; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; public class DissolutionRecipe extends MachineRecipe { @@ -18,12 +19,12 @@ public class DissolutionRecipe extends MachineRecipe inventory, GasTank outputTank) { return getInput().useItemStackFromInventory(inventory, 1, false) && getOutput().applyOutputs(outputTank, false, 1); } - public void operate(ItemStack[] inventory, GasTank outputTank) + public void operate(NonNullList inventory, GasTank outputTank) { if(getInput().useItemStackFromInventory(inventory, 1, true)) { diff --git a/src/main/java/mekanism/common/recipe/machines/InjectionRecipe.java b/src/main/java/mekanism/common/recipe/machines/InjectionRecipe.java index 80c5c22b6..3101cac4b 100644 --- a/src/main/java/mekanism/common/recipe/machines/InjectionRecipe.java +++ b/src/main/java/mekanism/common/recipe/machines/InjectionRecipe.java @@ -1,5 +1,6 @@ package mekanism.common.recipe.machines; +import mekanism.api.gas.Gas; import mekanism.common.recipe.inputs.AdvancedMachineInput; import mekanism.common.recipe.outputs.ItemStackOutput; import net.minecraft.item.ItemStack; @@ -11,9 +12,9 @@ public class InjectionRecipe extends AdvancedMachineRecipe super(input, output); } - public InjectionRecipe(ItemStack input, String gasName, ItemStack output) + public InjectionRecipe(ItemStack input, Gas gas, ItemStack output) { - super(input, gasName, output); + super(input, gas, output); } @Override diff --git a/src/main/java/mekanism/common/recipe/machines/MetallurgicInfuserRecipe.java b/src/main/java/mekanism/common/recipe/machines/MetallurgicInfuserRecipe.java index a13d69fab..a9e20c908 100644 --- a/src/main/java/mekanism/common/recipe/machines/MetallurgicInfuserRecipe.java +++ b/src/main/java/mekanism/common/recipe/machines/MetallurgicInfuserRecipe.java @@ -4,6 +4,7 @@ import mekanism.common.InfuseStorage; import mekanism.common.recipe.inputs.InfusionInput; import mekanism.common.recipe.outputs.ItemStackOutput; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; public class MetallurgicInfuserRecipe extends MachineRecipe { @@ -17,7 +18,7 @@ public class MetallurgicInfuserRecipe extends MachineRecipe inventory, int inputIndex, int outputIndex, InfuseStorage infuse) { return getInput().use(inventory, inputIndex, infuse, false) && getOutput().applyOutputs(inventory, outputIndex, false); } @@ -28,7 +29,7 @@ public class MetallurgicInfuserRecipe extends MachineRecipe inventory, int inputIndex, int outputIndex, InfuseStorage infuseStored) { if(getInput().use(inventory, inputIndex, infuseStored, true)) { diff --git a/src/main/java/mekanism/common/recipe/machines/OsmiumCompressorRecipe.java b/src/main/java/mekanism/common/recipe/machines/OsmiumCompressorRecipe.java index 1c8a4b6d7..2bf3c9e29 100644 --- a/src/main/java/mekanism/common/recipe/machines/OsmiumCompressorRecipe.java +++ b/src/main/java/mekanism/common/recipe/machines/OsmiumCompressorRecipe.java @@ -1,5 +1,6 @@ package mekanism.common.recipe.machines; +import mekanism.common.MekanismFluids; import mekanism.common.recipe.inputs.AdvancedMachineInput; import mekanism.common.recipe.outputs.ItemStackOutput; import net.minecraft.item.ItemStack; @@ -13,7 +14,7 @@ public class OsmiumCompressorRecipe extends AdvancedMachineRecipe { @@ -24,12 +25,12 @@ public class OxidationRecipe extends MachineRecipe inventory, GasTank outputTank) { return getInput().useItemStackFromInventory(inventory, 0, false) && getOutput().applyOutputs(outputTank, false, 1); } - public void operate(ItemStack[] inventory, GasTank outputTank) + public void operate(NonNullList inventory, GasTank outputTank) { if(getInput().useItemStackFromInventory(inventory, 0, true)) { diff --git a/src/main/java/mekanism/common/recipe/machines/PressurizedRecipe.java b/src/main/java/mekanism/common/recipe/machines/PressurizedRecipe.java index 0ff2e97cc..c3bfa015b 100644 --- a/src/main/java/mekanism/common/recipe/machines/PressurizedRecipe.java +++ b/src/main/java/mekanism/common/recipe/machines/PressurizedRecipe.java @@ -5,6 +5,8 @@ import mekanism.api.gas.GasTank; import mekanism.common.recipe.inputs.PressurizedInput; import mekanism.common.recipe.outputs.PressurizedOutput; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; @@ -26,6 +28,14 @@ public class PressurizedRecipe extends MachineRecipe inventory, FluidTank inputFluidTank, GasTank inputGasTank, GasTank outputGasTank) { return getInput().use(inventory, 0, inputFluidTank, inputGasTank, false) && getOutput().applyOutputs(inventory, 2, outputGasTank, false); } - public void operate(ItemStack[] inventory, FluidTank inputFluidTank, GasTank inputGasTank, GasTank outputGasTank) + public void operate(NonNullList inventory, FluidTank inputFluidTank, GasTank inputGasTank, GasTank outputGasTank) { if(getInput().use(inventory, 0, inputFluidTank, inputGasTank, true)) { diff --git a/src/main/java/mekanism/common/recipe/machines/PurificationRecipe.java b/src/main/java/mekanism/common/recipe/machines/PurificationRecipe.java index d7859e08d..9d126bc98 100644 --- a/src/main/java/mekanism/common/recipe/machines/PurificationRecipe.java +++ b/src/main/java/mekanism/common/recipe/machines/PurificationRecipe.java @@ -1,5 +1,6 @@ package mekanism.common.recipe.machines; +import mekanism.common.MekanismFluids; import mekanism.common.recipe.inputs.AdvancedMachineInput; import mekanism.common.recipe.outputs.ItemStackOutput; import net.minecraft.item.ItemStack; @@ -13,7 +14,7 @@ public class PurificationRecipe extends AdvancedMachineRecipe { private static Random rand = new Random(); - public ItemStack primaryOutput; + public ItemStack primaryOutput = ItemStack.EMPTY; - public ItemStack secondaryOutput; + public ItemStack secondaryOutput = ItemStack.EMPTY; public double secondaryChance; @@ -28,8 +30,8 @@ public class ChanceOutput extends MachineOutput @Override public void load(NBTTagCompound nbtTags) { - primaryOutput = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("primaryOutput")); - secondaryOutput = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("secondaryOutput")); + primaryOutput = InventoryUtils.loadFromNBT(nbtTags.getCompoundTag("primaryOutput")); + secondaryOutput = InventoryUtils.loadFromNBT(nbtTags.getCompoundTag("secondaryOutput")); secondaryChance = nbtTags.getDouble("secondaryChance"); } @@ -45,30 +47,30 @@ public class ChanceOutput extends MachineOutput public boolean hasPrimary() { - return primaryOutput != null; + return !primaryOutput.isEmpty(); } public boolean hasSecondary() { - return secondaryOutput != null; + return !secondaryOutput.isEmpty(); } - public boolean applyOutputs(ItemStack[] inventory, int primaryIndex, int secondaryIndex, boolean doEmit) + public boolean applyOutputs(NonNullList inventory, int primaryIndex, int secondaryIndex, boolean doEmit) { if(hasPrimary()) { - if(inventory[primaryIndex] == null) + if(inventory.get(primaryIndex).isEmpty()) { if(doEmit) { - inventory[primaryIndex] = primaryOutput.copy(); + inventory.set(primaryIndex, primaryOutput.copy()); } } - else if(inventory[primaryIndex].isItemEqual(primaryOutput) && inventory[primaryIndex].stackSize + primaryOutput.stackSize <= inventory[primaryIndex].getMaxStackSize()) + else if(inventory.get(primaryIndex).isItemEqual(primaryOutput) && inventory.get(primaryIndex).getCount() + primaryOutput.getCount() <= inventory.get(primaryIndex).getMaxStackSize()) { if(doEmit) { - inventory[primaryIndex].stackSize += primaryOutput.stackSize; + inventory.get(primaryIndex).grow(primaryOutput.getCount()); } } else { @@ -78,20 +80,20 @@ public class ChanceOutput extends MachineOutput if(hasSecondary() && (!doEmit || checkSecondary())) { - if(inventory[secondaryIndex] == null) + if(inventory.get(secondaryIndex).isEmpty()) { if(doEmit) { - inventory[secondaryIndex] = secondaryOutput.copy(); + inventory.set(secondaryIndex, secondaryOutput.copy()); } return true; } - else if(inventory[secondaryIndex].isItemEqual(secondaryOutput) && inventory[secondaryIndex].stackSize + primaryOutput.stackSize <= inventory[secondaryIndex].getMaxStackSize()) + else if(inventory.get(secondaryIndex).isItemEqual(secondaryOutput) && inventory.get(secondaryIndex).getCount() + primaryOutput.getCount() <= inventory.get(secondaryIndex).getMaxStackSize()) { if(doEmit) { - inventory[secondaryIndex].stackSize += secondaryOutput.stackSize; + inventory.get(secondaryIndex).grow(secondaryOutput.getCount()); } return true; diff --git a/src/main/java/mekanism/common/recipe/outputs/ItemStackOutput.java b/src/main/java/mekanism/common/recipe/outputs/ItemStackOutput.java index 7ee952f81..a75ecefc6 100644 --- a/src/main/java/mekanism/common/recipe/outputs/ItemStackOutput.java +++ b/src/main/java/mekanism/common/recipe/outputs/ItemStackOutput.java @@ -1,11 +1,13 @@ package mekanism.common.recipe.outputs; +import mekanism.common.util.InventoryUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; public class ItemStackOutput extends MachineOutput { - public ItemStack output; + public ItemStack output = ItemStack.EMPTY; public ItemStackOutput(ItemStack stack) { @@ -17,29 +19,30 @@ public class ItemStackOutput extends MachineOutput @Override public void load(NBTTagCompound nbtTags) { - output = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("output")); + output = InventoryUtils.loadFromNBT(nbtTags.getCompoundTag("output")); } - public boolean applyOutputs(ItemStack[] inventory, int index, boolean doEmit) + public boolean applyOutputs(NonNullList inventory, int index, boolean doEmit) { - if(inventory[index] == null) + if(inventory.get(index).isEmpty()) { if(doEmit) { - inventory[index] = output.copy(); + inventory.set(index, output.copy()); } return true; } - else if(inventory[index].isItemEqual(output) && inventory[index].stackSize + output.stackSize <= inventory[index].getMaxStackSize()) + else if(inventory.get(index).isItemEqual(output) && inventory.get(index).getCount() + output.getCount() <= inventory.get(index).getMaxStackSize()) { if(doEmit) { - inventory[index].stackSize += output.stackSize; + inventory.get(index).grow(output.getCount()); } return true; } + return false; } diff --git a/src/main/java/mekanism/common/recipe/outputs/PressurizedOutput.java b/src/main/java/mekanism/common/recipe/outputs/PressurizedOutput.java index 5692be99a..78192b8a1 100644 --- a/src/main/java/mekanism/common/recipe/outputs/PressurizedOutput.java +++ b/src/main/java/mekanism/common/recipe/outputs/PressurizedOutput.java @@ -2,12 +2,14 @@ package mekanism.common.recipe.outputs; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; +import mekanism.common.util.InventoryUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; public class PressurizedOutput extends MachineOutput { - private ItemStack itemOutput; + private ItemStack itemOutput = ItemStack.EMPTY; private GasStack gasOutput; public PressurizedOutput(ItemStack item, GasStack gas) @@ -21,7 +23,7 @@ public class PressurizedOutput extends MachineOutput @Override public void load(NBTTagCompound nbtTags) { - itemOutput = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("itemOutput")); + itemOutput = InventoryUtils.loadFromNBT(nbtTags.getCompoundTag("itemOutput")); gasOutput = GasStack.readFromNBT(nbtTags.getCompoundTag("gasOutput")); } @@ -30,9 +32,9 @@ public class PressurizedOutput extends MachineOutput return tank.canReceive(gasOutput.getGas()) && tank.getNeeded() >= gasOutput.amount; } - public boolean canAddProducts(ItemStack[] inventory, int index) + public boolean canAddProducts(NonNullList inventory, int index) { - return inventory[index] == null || (inventory[index].isItemEqual(itemOutput) && inventory[index].stackSize + itemOutput.stackSize <= inventory[index].getMaxStackSize()); + return inventory.get(index).isEmpty() || (inventory.get(index).isItemEqual(itemOutput) && inventory.get(index).getCount() + itemOutput.getCount() <= inventory.get(index).getMaxStackSize()); } public void fillTank(GasTank tank) @@ -40,19 +42,19 @@ public class PressurizedOutput extends MachineOutput tank.receive(gasOutput, true); } - public void addProducts(ItemStack[] inventory, int index) + public void addProducts(NonNullList inventory, int index) { - if(inventory[index] == null) + if(inventory.get(index).isEmpty()) { - inventory[index] = itemOutput.copy(); + inventory.set(index, itemOutput.copy()); } - else if(inventory[index].isItemEqual(itemOutput)) + else if(inventory.get(index).isItemEqual(itemOutput)) { - inventory[index].stackSize += itemOutput.stackSize; + inventory.get(index).grow(itemOutput.getCount()); } } - public boolean applyOutputs(ItemStack[] inventory, int index, GasTank tank, boolean doEmit) + public boolean applyOutputs(NonNullList inventory, int index, GasTank tank, boolean doEmit) { if(canFillTank(tank) && canAddProducts(inventory, index)) { @@ -61,8 +63,10 @@ public class PressurizedOutput extends MachineOutput fillTank(tank); addProducts(inventory, index); } + return true; } + return false; } diff --git a/src/main/java/mekanism/common/security/IOwnerItem.java b/src/main/java/mekanism/common/security/IOwnerItem.java index 7dd4afb11..95c4b5b33 100644 --- a/src/main/java/mekanism/common/security/IOwnerItem.java +++ b/src/main/java/mekanism/common/security/IOwnerItem.java @@ -1,12 +1,14 @@ package mekanism.common.security; +import java.util.UUID; + import net.minecraft.item.ItemStack; public interface IOwnerItem { - public String getOwner(ItemStack stack); + public UUID getOwnerUUID(ItemStack stack); - public void setOwner(ItemStack stack, String owner); + public void setOwnerUUID(ItemStack stack, UUID owner); public boolean hasOwner(ItemStack stack); } diff --git a/src/main/java/mekanism/common/security/SecurityFrequency.java b/src/main/java/mekanism/common/security/SecurityFrequency.java index 33506de51..1b2ecf242 100644 --- a/src/main/java/mekanism/common/security/SecurityFrequency.java +++ b/src/main/java/mekanism/common/security/SecurityFrequency.java @@ -3,6 +3,7 @@ package mekanism.common.security; import io.netty.buffer.ByteBuf; import java.util.ArrayList; +import java.util.UUID; import mekanism.common.HashList; import mekanism.common.PacketHandler; @@ -11,6 +12,7 @@ import mekanism.common.security.ISecurityTile.SecurityMode; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagString; +import net.minecraftforge.common.UsernameCache; import net.minecraftforge.common.util.Constants.NBT; public class SecurityFrequency extends Frequency @@ -23,9 +25,9 @@ public class SecurityFrequency extends Frequency public SecurityMode securityMode; - public SecurityFrequency(String o) + public SecurityFrequency(UUID uuid) { - super("Security", o); + super("Security", uuid); trusted = new HashList(); securityMode = SecurityMode.PUBLIC; @@ -111,7 +113,6 @@ public class SecurityFrequency extends Frequency override = dataStream.readBoolean(); securityMode = SecurityMode.values()[dataStream.readInt()]; - trusted.clear(); int size = dataStream.readInt(); for(int i = 0; i < size; i++) diff --git a/src/main/java/mekanism/common/tile/TileEntityAdvancedBoundingBlock.java b/src/main/java/mekanism/common/tile/TileEntityAdvancedBoundingBlock.java index d784d966a..bf5e70f25 100644 --- a/src/main/java/mekanism/common/tile/TileEntityAdvancedBoundingBlock.java +++ b/src/main/java/mekanism/common/tile/TileEntityAdvancedBoundingBlock.java @@ -7,7 +7,7 @@ import mekanism.api.IConfigCardAccess.ISpecialConfigData; import mekanism.api.energy.IStrictEnergyAcceptor; import mekanism.common.base.IAdvancedBoundingBlock; import mekanism.common.capabilities.Capabilities; -import mekanism.common.integration.IComputerIntegration; +import mekanism.common.integration.computer.IComputerIntegration; import mekanism.common.util.InventoryUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; @@ -29,6 +29,17 @@ import cofh.api.energy.IEnergyReceiver; }) public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock implements ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IEnergyReceiver, IEnergyProvider, IComputerIntegration, ISpecialConfigData { + @Override + public boolean isEmpty() + { + if(getInv() == null) + { + return true; + } + + return getInv().isEmpty(); + } + @Override public int getSizeInventory() { @@ -124,14 +135,14 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp } @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) + public boolean isUsableByPlayer(EntityPlayer entityplayer) { if(getInv() == null) { return false; } - return getInv().isUseableByPlayer(entityplayer); + return getInv().isUsableByPlayer(entityplayer); } @Override @@ -164,7 +175,7 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp return false; } - return getInv().canBoundInsert(Coord4D.get(this), i, itemstack); + return getInv().canBoundInsert(getPos(), i, itemstack); } @Override @@ -196,7 +207,7 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp return InventoryUtils.EMPTY; } - return getInv().getBoundSlots(Coord4D.get(this), side); + return getInv().getBoundSlots(getPos(), side); } @Override @@ -213,7 +224,7 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp return false; } - return getInv().canBoundExtract(Coord4D.get(this), i, itemstack, side); + return getInv().canBoundExtract(getPos(), i, itemstack, side); } @Override @@ -284,47 +295,14 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp } @Override - public double getEnergy() - { - if(getInv() == null) - { - return 0; - } - - return getInv().getEnergy(); - } - - @Override - public void setEnergy(double energy) - { - if(getInv() == null) - { - return; - } - - getInv().setEnergy(energy); - } - - @Override - public double getMaxEnergy() - { - if(getInv() == null) - { - return 0; - } - - return getInv().getMaxEnergy(); - } - - @Override - public double transferEnergyToAcceptor(EnumFacing side, double amount) + public double acceptEnergy(EnumFacing side, double amount, boolean simulate) { if(getInv() == null || !canReceiveEnergy(side)) { return 0; } - return getInv().transferEnergyToAcceptor(side, amount); + return getInv().acceptEnergy(side, amount, simulate); } @Override @@ -335,7 +313,7 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp return false; } - return getInv().canBoundReceiveEnergy(Coord4D.get(this), side); + return getInv().canBoundReceiveEnergy(getPos(), side); } @Override @@ -381,15 +359,15 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp return null; } - TileEntity tile = new Coord4D(mainPos, worldObj).getTileEntity(worldObj); + TileEntity tile = new Coord4D(mainPos, world).getTileEntity(world); if(!(tile instanceof IAdvancedBoundingBlock)) { - worldObj.setBlockToAir(mainPos); + world.setBlockToAir(mainPos); return null; } - return (IAdvancedBoundingBlock)new Coord4D(mainPos, worldObj).getTileEntity(worldObj); + return (IAdvancedBoundingBlock)new Coord4D(mainPos, world).getTileEntity(world); } @Override diff --git a/src/main/java/mekanism/common/tile/TileEntityAdvancedFactory.java b/src/main/java/mekanism/common/tile/TileEntityAdvancedFactory.java index 8226753d9..948b3b8f9 100644 --- a/src/main/java/mekanism/common/tile/TileEntityAdvancedFactory.java +++ b/src/main/java/mekanism/common/tile/TileEntityAdvancedFactory.java @@ -32,9 +32,6 @@ public class TileEntityAdvancedFactory extends TileEntityFactory configComponent.setCanEject(TransmissionType.GAS, false); configComponent.setInputConfig(TransmissionType.ENERGY); - - upgradeComponent = new TileComponentUpgrade(this, 0); - upgradeComponent.setSupported(Upgrade.MUFFLING); ejectorComponent = new TileComponentEjector(this); ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(2)); diff --git a/src/main/java/mekanism/common/tile/TileEntityAmbientAccumulator.java b/src/main/java/mekanism/common/tile/TileEntityAmbientAccumulator.java index 68643b6be..b5b6205ad 100644 --- a/src/main/java/mekanism/common/tile/TileEntityAmbientAccumulator.java +++ b/src/main/java/mekanism/common/tile/TileEntityAmbientAccumulator.java @@ -13,8 +13,10 @@ import mekanism.api.gas.ITubeConnection; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.inputs.IntegerInput; import mekanism.common.recipe.machines.AmbientGasRecipe; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.fml.common.FMLCommonHandler; public class TileEntityAmbientAccumulator extends TileEntityContainerBlock implements IGasHandler, ITubeConnection @@ -29,17 +31,17 @@ public class TileEntityAmbientAccumulator extends TileEntityContainerBlock imple public TileEntityAmbientAccumulator() { super("AmbientAccumulator"); - inventory = new ItemStack[0]; + inventory = NonNullList.withSize(0, ItemStack.EMPTY); } @Override public void onUpdate() { - if(!worldObj.isRemote) + if(!world.isRemote) { - if(cachedRecipe == null || worldObj.provider.getDimension() != cachedDimensionId) + if(cachedRecipe == null || world.provider.getDimension() != cachedDimensionId) { - cachedDimensionId = worldObj.provider.getDimension(); + cachedDimensionId = world.provider.getDimension(); cachedRecipe = RecipeHandler.getDimensionGas(new IntegerInput(cachedDimensionId)); } diff --git a/src/main/java/mekanism/common/tile/TileEntityBasicMachine.java b/src/main/java/mekanism/common/tile/TileEntityBasicMachine.java deleted file mode 100644 index 6adcecccd..000000000 --- a/src/main/java/mekanism/common/tile/TileEntityBasicMachine.java +++ /dev/null @@ -1,331 +0,0 @@ -package mekanism.common.tile; - -import io.netty.buffer.ByteBuf; - -import java.util.ArrayList; -import java.util.EnumSet; - -import mekanism.api.Coord4D; -import mekanism.api.IConfigCardAccess; -import mekanism.api.MekanismConfig.general; -import mekanism.api.Range4D; -import mekanism.api.transmitters.TransmissionType; -import mekanism.common.Mekanism; -import mekanism.common.Upgrade; -import mekanism.common.base.IElectricMachine; -import mekanism.common.base.IRedstoneControl; -import mekanism.common.base.ISideConfiguration; -import mekanism.common.base.IUpgradeTile; -import mekanism.common.capabilities.Capabilities; -import mekanism.common.integration.IComputerIntegration; -import mekanism.common.network.PacketTileEntity.TileEntityMessage; -import mekanism.common.recipe.inputs.MachineInput; -import mekanism.common.recipe.machines.MachineRecipe; -import mekanism.common.recipe.outputs.MachineOutput; -import mekanism.common.security.ISecurityTile; -import mekanism.common.tile.component.TileComponentConfig; -import mekanism.common.tile.component.TileComponentEjector; -import mekanism.common.tile.component.TileComponentSecurity; -import mekanism.common.tile.component.TileComponentUpgrade; -import mekanism.common.util.MekanismUtils; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.fml.common.FMLCommonHandler; - -public abstract class TileEntityBasicMachine, OUTPUT extends MachineOutput, RECIPE extends MachineRecipe> extends TileEntityNoisyElectricBlock implements IElectricMachine, IComputerIntegration, ISideConfiguration, IUpgradeTile, IRedstoneControl, IConfigCardAccess, ISecurityTile -{ - /** How much energy this machine uses per tick, un-upgraded. */ - public double BASE_ENERGY_PER_TICK; - - /** How much energy this machine uses per tick including upgrades */ - public double energyPerTick; - - /** How many ticks this machine has operated for. */ - public int operatingTicks = 0; - - /** Un-upgraded ticks required to operate -- or smelt an item. */ - public int BASE_TICKS_REQUIRED; - - /** Ticks required including upgrades */ - public int ticksRequired; - - /** How many ticks must pass until this block's active state can sync with the client. */ - public int updateDelay; - - /** Whether or not this block is in it's active state. */ - public boolean isActive; - - /** The client's current active state. */ - public boolean clientActive; - - /** The GUI texture path for this machine. */ - public ResourceLocation guiLocation; - - /** This machine's current RedstoneControl type. */ - public RedstoneControl controlType = RedstoneControl.DISABLED; - - /** This machine's previous amount of energy. */ - public double prevEnergy; - - public RECIPE cachedRecipe = null; - - public TileComponentUpgrade upgradeComponent; - public TileComponentEjector ejectorComponent; - public TileComponentConfig configComponent; - public TileComponentSecurity securityComponent; - - /** - * The foundation of all machines - a simple tile entity with a facing, active state, initialized state, sound effect, and animated texture. - * @param soundPath - location of the sound effect - * @param name - full name of this machine - * @param location - GUI texture path of this machine - * @param perTick - the energy this machine consumes every tick in it's active state - * @param baseTicksRequired - how many ticks it takes to run a cycle - * @param maxEnergy - how much energy this machine can store - */ - public TileEntityBasicMachine(String soundPath, String name, ResourceLocation location, double perTick, int baseTicksRequired, double maxEnergy) - { - super("machine." + soundPath, name, maxEnergy); - - BASE_ENERGY_PER_TICK = perTick; - energyPerTick = perTick; - BASE_TICKS_REQUIRED = baseTicksRequired; - ticksRequired = baseTicksRequired; - guiLocation = location; - isActive = false; - - securityComponent = new TileComponentSecurity(this); - } - - @Override - public void onUpdate() - { - super.onUpdate(); - - if(worldObj.isRemote && updateDelay > 0) - { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } - } - - if(!worldObj.isRemote) - { - if(updateDelay > 0) - { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - } - } - } - } - - @Override - public EnumSet getConsumingSides() - { - return configComponent.getSidesForData(TransmissionType.ENERGY, facing, 1); - } - - @Override - public void readFromNBT(NBTTagCompound nbtTags) - { - super.readFromNBT(nbtTags); - - operatingTicks = nbtTags.getInteger("operatingTicks"); - clientActive = isActive = nbtTags.getBoolean("isActive"); - controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")]; - } - - @Override - public NBTTagCompound writeToNBT(NBTTagCompound nbtTags) - { - super.writeToNBT(nbtTags); - - nbtTags.setInteger("operatingTicks", operatingTicks); - nbtTags.setBoolean("isActive", isActive); - nbtTags.setInteger("controlType", controlType.ordinal()); - - return nbtTags; - } - - @Override - public void handlePacketData(ByteBuf dataStream) - { - super.handlePacketData(dataStream); - - if(FMLCommonHandler.instance().getEffectiveSide().isClient()) - { - operatingTicks = dataStream.readInt(); - clientActive = dataStream.readBoolean(); - ticksRequired = dataStream.readInt(); - controlType = RedstoneControl.values()[dataStream.readInt()]; - - if(updateDelay == 0 && clientActive != isActive) - { - updateDelay = general.UPDATE_DELAY; - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } - } - } - - @Override - public ArrayList getNetworkedData(ArrayList data) - { - super.getNetworkedData(data); - - data.add(operatingTicks); - data.add(isActive); - data.add(ticksRequired); - data.add(controlType.ordinal()); - - return data; - } - - /** - * Gets the scaled progress level for the GUI. - */ - public double getScaledProgress() - { - return ((double)operatingTicks) / ((double)ticksRequired); - } - - @Override - public boolean getActive() - { - return isActive; - } - - @Override - public void setActive(boolean active) - { - isActive = active; - - if(clientActive != active && updateDelay == 0) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - - updateDelay = 10; - clientActive = active; - } - } - - @Override - public void recalculateUpgradables(Upgrade upgrade) - { - super.recalculateUpgradables(upgrade); - - switch(upgrade) - { - case SPEED: - ticksRequired = MekanismUtils.getTicks(this, BASE_TICKS_REQUIRED); - energyPerTick = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_PER_TICK); - break; - case ENERGY: - energyPerTick = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_PER_TICK); - maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); - break; - default: - break; - } - } - - @Override - public boolean canSetFacing(int facing) - { - return facing != 0 && facing != 1; - } - - @Override - public int[] getSlotsForFace(EnumFacing side) - { - return configComponent.getOutput(TransmissionType.ITEM, side, facing).availableSlots; - } - - @Override - public TileComponentConfig getConfig() - { - return configComponent; - } - - @Override - public EnumFacing getOrientation() - { - return facing; - } - - @Override - public boolean renderUpdate() - { - return true; - } - - @Override - public boolean lightUpdate() - { - return true; - } - - @Override - public RedstoneControl getControlType() - { - return controlType; - } - - @Override - public void setControlType(RedstoneControl type) - { - controlType = type; - MekanismUtils.saveChunk(this); - } - - @Override - public boolean canPulse() - { - return false; - } - - @Override - public TileComponentUpgrade getComponent() - { - return upgradeComponent; - } - - @Override - public TileComponentEjector getEjector() - { - return ejectorComponent; - } - - @Override - public TileComponentSecurity getSecurity() - { - return securityComponent; - } - - @Override - public boolean hasCapability(Capability capability, EnumFacing side) - { - return capability == Capabilities.CONFIG_CARD_CAPABILITY || super.hasCapability(capability, side); - } - - @Override - public T getCapability(Capability capability, EnumFacing side) - { - if(capability == Capabilities.CONFIG_CARD_CAPABILITY) - { - return (T)this; - } - - return super.getCapability(capability, side); - } -} diff --git a/src/main/java/mekanism/common/tile/TileEntityBin.java b/src/main/java/mekanism/common/tile/TileEntityBin.java index 2d67c4c33..1043358f5 100644 --- a/src/main/java/mekanism/common/tile/TileEntityBin.java +++ b/src/main/java/mekanism/common/tile/TileEntityBin.java @@ -7,8 +7,6 @@ import java.util.ArrayList; import mekanism.api.Coord4D; import mekanism.api.IConfigurable; import mekanism.api.Range4D; -import mekanism.api.util.CapabilityUtils; -import mekanism.api.util.StackUtils; import mekanism.common.Mekanism; import mekanism.common.PacketHandler; import mekanism.common.Tier.BaseTier; @@ -17,16 +15,19 @@ import mekanism.common.base.IActiveState; import mekanism.common.base.ILogisticalTransporter; import mekanism.common.base.ITierUpgradeable; import mekanism.common.capabilities.Capabilities; -import mekanism.common.content.transporter.TransporterManager; +import mekanism.common.content.transporter.TransitRequest; +import mekanism.common.content.transporter.TransitRequest.TransitResponse; import mekanism.common.item.ItemBlockBasic; import mekanism.common.network.PacketTileEntity.TileEntityMessage; +import mekanism.common.tile.prefab.TileEntityBasicBlock; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.StackUtils; import mekanism.common.util.TransporterUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; -import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -39,12 +40,10 @@ import net.minecraft.util.text.TextComponentString; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Optional.Interface; -import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.CapabilityItemHandler; -import powercrystals.minefactoryreloaded.api.IDeepStorageUnit; +import net.minecraftforge.items.IItemHandler; -@Interface(iface = "powercrystals.minefactoryreloaded.api.IDeepStorageUnit", modid = "MineFactoryReloaded") -public class TileEntityBin extends TileEntityBasicBlock implements ISidedInventory, IActiveState, IDeepStorageUnit, IConfigurable, ITierUpgradeable +public class TileEntityBin extends TileEntityBasicBlock implements ISidedInventory, IActiveState, IConfigurable, ITierUpgradeable { public boolean isActive; @@ -60,10 +59,10 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento public BinTier tier = BinTier.BASIC; - public ItemStack itemType; + public ItemStack itemType = ItemStack.EMPTY; - public ItemStack topStack; - public ItemStack bottomStack; + public ItemStack topStack = ItemStack.EMPTY; + public ItemStack bottomStack = ItemStack.EMPTY; public int prevCount; @@ -71,8 +70,9 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento private BinItemHandler myItemHandler; - public TileEntityBin(){ - this.myItemHandler = new BinItemHandler(this); + public TileEntityBin() + { + myItemHandler = new BinItemHandler(this); } @Override @@ -93,11 +93,11 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento public void sortStacks() { - if(getItemCount() == 0 || itemType == null) + if(getItemCount() == 0 || itemType.isEmpty()) { - itemType = null; - topStack = null; - bottomStack = null; + itemType = ItemStack.EMPTY; + topStack = ItemStack.EMPTY; + bottomStack = ItemStack.EMPTY; cacheCount = 0; return; @@ -108,17 +108,17 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento if(remain >= itemType.getMaxStackSize()) { - topStack = null; + topStack = ItemStack.EMPTY; } else { topStack = itemType.copy(); - topStack.stackSize = itemType.getMaxStackSize()-remain; + topStack.setCount(itemType.getMaxStackSize()-remain); } count -= StackUtils.getSize(topStack); bottomStack = itemType.copy(); - bottomStack.stackSize = Math.min(itemType.getMaxStackSize(), count); + bottomStack.setCount(Math.min(itemType.getMaxStackSize(), count)); count -= StackUtils.getSize(bottomStack); @@ -127,7 +127,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento public boolean isValid(ItemStack stack) { - if(stack == null || stack.stackSize <= 0) + if(stack.isEmpty() || stack.getCount() <= 0) { return false; } @@ -137,7 +137,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento return false; } - if(itemType == null) + if(itemType.isEmpty()) { return true; } @@ -154,26 +154,27 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento { if(isValid(stack) && (tier == BinTier.CREATIVE || getItemCount() != tier.storage)) { - if(itemType == null && !simulate) + if(itemType.isEmpty() && !simulate) { setItemType(stack); } if(tier != BinTier.CREATIVE) { - if(getItemCount() + stack.stackSize <= tier.storage) + if(getItemCount() + stack.getCount() <= tier.storage) { - if (!simulate) + if(!simulate) { - setItemCount(getItemCount() + stack.stackSize); + setItemCount(getItemCount() + stack.getCount()); } - return null; + + return ItemStack.EMPTY; } else { ItemStack rejects = stack.copy(); - rejects.stackSize = (getItemCount()+stack.stackSize) - tier.storage; + rejects.setCount((getItemCount()+stack.getCount()) - tier.storage); - if (!simulate) + if(!simulate) { setItemCount(tier.storage); } @@ -182,7 +183,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento } } else { - if (!simulate) + if(!simulate) { setItemCount(Integer.MAX_VALUE); } @@ -201,25 +202,25 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento { if(getItemCount() == 0) { - return null; + return ItemStack.EMPTY; } - return remove(bottomStack.stackSize); + return remove(bottomStack.getCount()); } public ItemStack remove(int amount, boolean simulate) { if(getItemCount() == 0) { - return null; + return ItemStack.EMPTY; } ItemStack ret = itemType.copy(); - ret.stackSize = Math.min(Math.min(amount, itemType.getMaxStackSize()), getItemCount()); + ret.setCount(Math.min(Math.min(amount, itemType.getMaxStackSize()), getItemCount())); if(tier != BinTier.CREATIVE && !simulate) { - setItemCount(getItemCount() - ret.stackSize); + setItemCount(getItemCount() - ret.getCount()); } return ret; @@ -238,7 +239,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento @Override public void onUpdate() { - if(!worldObj.isRemote) + if(!world.isRemote) { addTicks = Math.max(0, addTicks-1); delayTicks = Math.max(0, delayTicks-1); @@ -253,24 +254,29 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento if(delayTicks == 0) { - if(bottomStack != null && isActive) + if(!bottomStack.isEmpty() && isActive) { - TileEntity tile = Coord4D.get(this).offset(EnumFacing.DOWN).getTileEntity(worldObj); + TileEntity tile = Coord4D.get(this).offset(EnumFacing.DOWN).getTileEntity(world); if(CapabilityUtils.hasCapability(tile, Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, EnumFacing.UP)) { ILogisticalTransporter transporter = CapabilityUtils.getCapability(tile, Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, EnumFacing.UP); + TransitResponse response = TransporterUtils.insert(this, transporter, TransitRequest.getFromStack(bottomStack), null, true, 0); - ItemStack rejects = TransporterUtils.insert(this, transporter, bottomStack, null, true, 0); - - if(TransporterManager.didEmit(bottomStack, rejects)) + if(!response.isEmpty()) { - setInventorySlotContents(0, rejects); + bottomStack.shrink(response.stack.getCount()); + setInventorySlotContents(0, bottomStack); } } - else if(tile instanceof IInventory) - { - setInventorySlotContents(0, InventoryUtils.putStackInInventory((IInventory)tile, bottomStack, EnumFacing.DOWN, false)); + else { + TransitResponse response = InventoryUtils.putStackInInventory(tile, TransitRequest.getFromStack(bottomStack), EnumFacing.DOWN, false); + + if(!response.isEmpty()) + { + bottomStack.shrink(response.stack.getCount()); + setInventorySlotContents(0, bottomStack); + } } delayTicks = 10; @@ -291,12 +297,12 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento nbtTags.setInteger("itemCount", cacheCount); nbtTags.setInteger("tier", tier.ordinal()); - if(bottomStack != null) + if(!bottomStack.isEmpty()) { nbtTags.setTag("bottomStack", bottomStack.writeToNBT(new NBTTagCompound())); } - if(topStack != null) + if(!topStack.isEmpty()) { nbtTags.setTag("topStack", topStack.writeToNBT(new NBTTagCompound())); } @@ -318,12 +324,12 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento cacheCount = nbtTags.getInteger("itemCount"); tier = BinTier.values()[nbtTags.getInteger("tier")]; - bottomStack = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("bottomStack")); - topStack = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("topStack")); + bottomStack = InventoryUtils.loadFromNBT(nbtTags.getCompoundTag("bottomStack")); + topStack = InventoryUtils.loadFromNBT(nbtTags.getCompoundTag("topStack")); if(getItemCount() > 0) { - itemType = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("itemType")); + itemType = InventoryUtils.loadFromNBT(nbtTags.getCompoundTag("itemType")); } } @@ -360,10 +366,10 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento itemType = PacketHandler.readStack(dataStream); } else { - itemType = null; + itemType = ItemStack.EMPTY; } - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } @@ -384,7 +390,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento { if(slotID == 1) { - return null; + return ItemStack.EMPTY; } else if(slotID == 0) { @@ -393,7 +399,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento if(toRemove > 0) { ItemStack ret = itemType.copy(); - ret.stackSize = toRemove; + ret.setCount(toRemove); setItemCount(getItemCount()-toRemove); @@ -401,7 +407,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento } } - return null; + return ItemStack.EMPTY; } @Override @@ -428,25 +434,25 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento if(tier != BinTier.CREATIVE) { - if(itemstack == null) + if(itemstack.isEmpty()) { - setItemCount(getItemCount() - bottomStack.stackSize); + setItemCount(getItemCount() - bottomStack.getCount()); } else { - setItemCount(getItemCount() - (bottomStack.stackSize-itemstack.stackSize)); + setItemCount(getItemCount() - (bottomStack.getCount()-itemstack.getCount())); } } } else if(i == 1) { - if(itemstack == null) + if(itemstack.isEmpty()) { - topStack = null; + topStack = ItemStack.EMPTY; } else { - if(isValid(itemstack) && itemstack.stackSize > StackUtils.getSize(topStack) && tier != BinTier.CREATIVE) + if(isValid(itemstack) && itemstack.getCount() > StackUtils.getSize(topStack) && tier != BinTier.CREATIVE) { - add(StackUtils.size(itemstack, itemstack.stackSize-StackUtils.getSize(topStack))); + add(StackUtils.size(itemstack, itemstack.getCount()-StackUtils.getSize(topStack))); } } } @@ -457,7 +463,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento { super.markDirty(); - if(!worldObj.isRemote) + if(!world.isRemote) { MekanismUtils.saveChunk(this); Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); @@ -468,29 +474,29 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento public void setItemType(ItemStack stack) { - if(stack == null) + if(stack.isEmpty()) { - itemType = null; + itemType = ItemStack.EMPTY; cacheCount = 0; - topStack = null; - bottomStack = null; + topStack = ItemStack.EMPTY; + bottomStack = ItemStack.EMPTY; return; } ItemStack ret = stack.copy(); - ret.stackSize = 1; + ret.setCount(1); itemType = ret; } public void setItemCount(int count) { cacheCount = Math.max(0, count); - topStack = null; - bottomStack = null; + topStack = ItemStack.EMPTY; + bottomStack = ItemStack.EMPTY; if(count == 0) { - setItemType(null); + setItemType(ItemStack.EMPTY); } markDirty(); @@ -521,7 +527,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento } @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) + public boolean isUsableByPlayer(EntityPlayer entityplayer) { return true; } @@ -537,6 +543,12 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento { return i == 1 && isValid(itemstack); } + + @Override + public boolean isEmpty() + { + return getItemCount() == 0; + } @Override public int getField(int id) @@ -623,41 +635,41 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento return true; } - @Override - public ItemStack getStoredItemType() - { - if(itemType == null) - { - return null; - } - - return MekanismUtils.size(itemType, getItemCount()); - } - - @Override - public void setStoredItemCount(int amount) - { - if(amount == 0) - { - setStoredItemType(null, 0); - } - - setItemCount(amount); - } - - @Override - public void setStoredItemType(ItemStack type, int amount) - { - itemType = type; - cacheCount = amount; - - topStack = null; - bottomStack = null; - - markDirty(); - } - - @Override +// @Override +// public ItemStack getStoredItemType() +// { +// if(itemType == null) +// { +// return ItemStack.EMPTY; +// } +// +// return MekanismUtils.size(itemType, getItemCount()); +// } +// +// @Override +// public void setStoredItemCount(int amount) +// { +// if(amount == 0) +// { +// setStoredItemType(ItemStack.EMPTY, 0); +// } +// +// setItemCount(amount); +// } +// +// @Override +// public void setStoredItemType(ItemStack type, int amount) +// { +// itemType = type; +// cacheCount = amount; +// +// topStack = ItemStack.EMPTY; +// bottomStack = ItemStack.EMPTY; +// +// markDirty(); +// } +// +// @Override public int getMaxStoredCount() { return tier.storage; @@ -667,7 +679,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento public EnumActionResult onSneakRightClick(EntityPlayer player, EnumFacing side) { setActive(!getActive()); - worldObj.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), SoundEvents.UI_BUTTON_CLICK, SoundCategory.BLOCKS, 0.3F, 1); + world.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), SoundEvents.UI_BUTTON_CLICK, SoundCategory.BLOCKS, 0.3F, 1); return EnumActionResult.SUCCESS; } @@ -707,37 +719,54 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento { this.tileEntityBin = tileEntityBin; } + + @Override + public int getSlotLimit(int slot) + { + if(slot != 0) + { + return 0; + } + + return tier.storage; + } - public int getSlots(){return 1;} + @Override + public int getSlots() + { + return 1; + } + @Override public ItemStack getStackInSlot(int slot) { - if (slot != 0 || tileEntityBin.itemType == null) + if(slot != 0 || tileEntityBin.itemType == null) { - return null; + return ItemStack.EMPTY; } return MekanismUtils.size(tileEntityBin.itemType, tileEntityBin.getItemCount()); } + @Override public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) { - if (slot != 0) + if(slot != 0) { - return null; + return ItemStack.EMPTY; } + return tileEntityBin.add(stack, simulate); - } public ItemStack extractItem(int slot, int amount, boolean simulate) { - if (slot != 0) + if(slot != 0) { - return null; + return ItemStack.EMPTY; } return tileEntityBin.remove(amount, simulate); } } -} \ No newline at end of file +} diff --git a/src/main/java/mekanism/common/tile/TileEntityBoilerCasing.java b/src/main/java/mekanism/common/tile/TileEntityBoilerCasing.java index 03dc0c507..6a05310a3 100644 --- a/src/main/java/mekanism/common/tile/TileEntityBoilerCasing.java +++ b/src/main/java/mekanism/common/tile/TileEntityBoilerCasing.java @@ -24,6 +24,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -48,7 +49,7 @@ public class TileEntityBoilerCasing extends TileEntityMultiblock= structure.upperRenderLocation.yCoord-1) { @@ -43,7 +44,7 @@ public class TileEntityBoilerValve extends TileEntityBoilerCasing implements IFl { for(EnumFacing side : EnumFacing.values()) { - TileEntity tile = Coord4D.get(this).offset(side).getTileEntity(worldObj); + TileEntity tile = Coord4D.get(this).offset(side).getTileEntity(world); if(tile != null && !(tile instanceof TileEntityBoilerValve) && CapabilityUtils.hasCapability(tile, CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side.getOpposite())) { @@ -68,7 +69,7 @@ public class TileEntityBoilerValve extends TileEntityBoilerCasing implements IFl @Override public FluidTankInfo[] getTankInfo(EnumFacing from) { - if((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure)) + if((!world.isRemote && structure != null) || (world.isRemote && clientHasStructure)) { if(structure.upperRenderLocation != null && getPos().getY() >= structure.upperRenderLocation.yCoord-1) { @@ -124,7 +125,7 @@ public class TileEntityBoilerValve extends TileEntityBoilerCasing implements IFl @Override public boolean canFill(EnumFacing from, Fluid fluid) { - if((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure)) + if((!world.isRemote && structure != null) || (world.isRemote && clientHasStructure)) { return structure.upperRenderLocation != null && getPos().getY() < structure.upperRenderLocation.yCoord-1; } @@ -135,7 +136,7 @@ public class TileEntityBoilerValve extends TileEntityBoilerCasing implements IFl @Override public boolean canDrain(EnumFacing from, Fluid fluid) { - if((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure)) + if((!world.isRemote && structure != null) || (world.isRemote && clientHasStructure)) { return structure.upperRenderLocation != null && getPos().getY() >= structure.upperRenderLocation.yCoord-1; } @@ -143,10 +144,49 @@ public class TileEntityBoilerValve extends TileEntityBoilerCasing implements IFl return false; } + private static final String[] methods = new String[] {"isFormed", "getSteam", "getWater", "getBoilRate", "getMaxBoilRate", "getTemp"}; + + @Override + public String[] getMethods() + { + return methods; + } + + @Override + public Object[] invoke(int method, Object[] arguments) throws Exception + { + if(method == 0) + { + return new Object[] {structure != null}; + } + else { + if(structure == null) + { + return new Object[] {"Unformed"}; + } + + switch(method) + { + case 1: + return new Object[] {structure.steamStored != null ? structure.steamStored.amount : 0}; + case 2: + return new Object[] {structure.waterStored != null ? structure.waterStored.amount : 0}; + case 3: + return new Object[] {structure.lastBoilRate}; + case 4: + return new Object[] {structure.lastMaxBoil}; + case 5: + return new Object[] {structure.temperature}; + } + } + + throw new NoSuchMethodException(); + } + @Override public boolean hasCapability(Capability capability, EnumFacing side) { - if((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure)) + if((!world.isRemote && structure != null) || (world.isRemote && clientHasStructure)) { if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) { @@ -160,7 +200,7 @@ public class TileEntityBoilerValve extends TileEntityBoilerCasing implements IFl @Override public T getCapability(Capability capability, EnumFacing side) { - if((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure)) + if((!world.isRemote && structure != null) || (world.isRemote && clientHasStructure)) { if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) { diff --git a/src/main/java/mekanism/common/tile/TileEntityBoundingBlock.java b/src/main/java/mekanism/common/tile/TileEntityBoundingBlock.java index 49b136fdc..50e41d4c7 100644 --- a/src/main/java/mekanism/common/tile/TileEntityBoundingBlock.java +++ b/src/main/java/mekanism/common/tile/TileEntityBoundingBlock.java @@ -11,6 +11,7 @@ import mekanism.common.base.ITileNetwork; import mekanism.common.capabilities.Capabilities; import mekanism.common.network.PacketDataRequest.DataRequestMessage; import mekanism.common.network.PacketTileEntity.TileEntityMessage; +import mekanism.common.tile.prefab.TileEntityBasicBlock; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -30,7 +31,7 @@ public class TileEntityBoundingBlock extends TileEntity implements ITileNetwork { receivedCoords = true; - if(!worldObj.isRemote) + if(!world.isRemote) { mainPos = pos; @@ -43,7 +44,7 @@ public class TileEntityBoundingBlock extends TileEntity implements ITileNetwork { super.validate(); - if(worldObj.isRemote) + if(world.isRemote) { Mekanism.packetHandler.sendToServer(new DataRequestMessage(Coord4D.get(this))); } @@ -51,13 +52,13 @@ public class TileEntityBoundingBlock extends TileEntity implements ITileNetwork public void onNeighborChange(Block block) { - TileEntity tile = worldObj.getTileEntity(mainPos); + TileEntity tile = world.getTileEntity(mainPos); if(tile instanceof TileEntityBasicBlock) { TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)tile; - int power = worldObj.isBlockIndirectlyGettingPowered(getPos()); + int power = world.isBlockIndirectlyGettingPowered(getPos()); if(prevPower != power) { @@ -82,7 +83,7 @@ public class TileEntityBoundingBlock extends TileEntity implements ITileNetwork @Override public void handlePacketData(ByteBuf dataStream) { - if(worldObj.isRemote) + if(world.isRemote) { mainPos = new BlockPos(dataStream.readInt(), dataStream.readInt(), dataStream.readInt()); prevPower = dataStream.readInt(); diff --git a/src/main/java/mekanism/common/tile/TileEntityChanceMachine.java b/src/main/java/mekanism/common/tile/TileEntityChanceMachine.java index 79d86135b..35ceb290e 100644 --- a/src/main/java/mekanism/common/tile/TileEntityChanceMachine.java +++ b/src/main/java/mekanism/common/tile/TileEntityChanceMachine.java @@ -13,19 +13,20 @@ import mekanism.common.recipe.machines.ChanceMachineRecipe; import mekanism.common.recipe.outputs.ChanceOutput; import mekanism.common.tile.component.TileComponentConfig; import mekanism.common.tile.component.TileComponentEjector; -import mekanism.common.tile.component.TileComponentUpgrade; +import mekanism.common.tile.prefab.TileEntityBasicMachine; import mekanism.common.util.ChargeUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; public abstract class TileEntityChanceMachine> extends TileEntityBasicMachine { - public TileEntityChanceMachine(String soundPath, String name, ResourceLocation location, double perTick, int ticksRequired, double maxEnergy) + public TileEntityChanceMachine(String soundPath, String name, double maxEnergy, double baseEnergyUsage, int ticksRequired, ResourceLocation location) { - super(soundPath, name, location, perTick, ticksRequired, maxEnergy); + super(soundPath, name, maxEnergy, baseEnergyUsage, 3, ticksRequired, location); configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY); @@ -37,10 +38,7 @@ public abstract class TileEntityChanceMachine entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX() + 1, getPos().getY() + 0.2, getPos().getZ() + 1)); + List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX() + 1, getPos().getY() + 0.2, getPos().getZ() + 1)); for(EntityLivingBase entity : entities) { @@ -108,10 +114,10 @@ public class TileEntityChargepad extends TileEntityNoisyElectricBlock { if(isActive) { - worldObj.playSound((EntityPlayer)null, getPos().getX() + 0.5, getPos().getY() + 0.1, getPos().getZ() + 0.5, SoundEvents.BLOCK_STONE_PRESSPLATE_CLICK_ON, SoundCategory.BLOCKS, 0.3F, 0.8F); + world.playSound((EntityPlayer)null, getPos().getX() + 0.5, getPos().getY() + 0.1, getPos().getZ() + 0.5, SoundEvents.BLOCK_STONE_PRESSPLATE_CLICK_ON, SoundCategory.BLOCKS, 0.3F, 0.8F); } else { - worldObj.playSound((EntityPlayer)null, getPos().getX() + 0.5, getPos().getY() + 0.1, getPos().getZ() + 0.5, SoundEvents.BLOCK_STONE_PRESSPLATE_CLICK_OFF, SoundCategory.BLOCKS, 0.3F, 0.7F); + world.playSound((EntityPlayer)null, getPos().getX() + 0.5, getPos().getY() + 0.1, getPos().getZ() + 0.5, SoundEvents.BLOCK_STONE_PRESSPLATE_CLICK_OFF, SoundCategory.BLOCKS, 0.3F, 0.7F); } setActive(isActive); @@ -119,32 +125,47 @@ public class TileEntityChargepad extends TileEntityNoisyElectricBlock } else if(isActive) { - worldObj.spawnParticle(EnumParticleTypes.REDSTONE, getPos().getX()+random.nextDouble(), getPos().getY()+0.15, getPos().getZ()+random.nextDouble(), 0, 0, 0); + world.spawnParticle(EnumParticleTypes.REDSTONE, getPos().getX()+random.nextDouble(), getPos().getY()+0.15, getPos().getZ()+random.nextDouble(), 0, 0, 0); } } public void chargeItemStack(ItemStack itemstack) { - if(itemstack != null) + if(!itemstack.isEmpty()) { if(itemstack.getItem() instanceof IEnergizedItem) { setEnergy(getEnergy() - EnergizedItemManager.charge(itemstack, getEnergy())); } - else if(MekanismUtils.useIC2() && itemstack.getItem() instanceof IElectricItem) + else if(MekanismUtils.useTesla() && itemstack.hasCapability(Capabilities.TESLA_CONSUMER_CAPABILITY, null)) { - double sent = ElectricItem.manager.charge(itemstack, (int)(getEnergy()*general.TO_IC2), 4, true, false)*general.FROM_IC2; - setEnergy(getEnergy() - sent); + ITeslaConsumer consumer = itemstack.getCapability(Capabilities.TESLA_CONSUMER_CAPABILITY, null); + + long stored = (long)Math.round(getEnergy()*general.TO_TESLA); + setEnergy(getEnergy() - consumer.givePower(stored, false)*general.FROM_TESLA); + } + else if(MekanismUtils.useForge() && itemstack.hasCapability(CapabilityEnergy.ENERGY, null)) + { + IEnergyStorage storage = itemstack.getCapability(CapabilityEnergy.ENERGY, null); + + if(storage.canReceive()) + { + int stored = (int)Math.round(Math.min(Integer.MAX_VALUE, getEnergy()*general.TO_FORGE)); + setEnergy(getEnergy() - storage.receiveEnergy(stored, false)*general.FROM_FORGE); + } } else if(MekanismUtils.useRF() && itemstack.getItem() instanceof IEnergyContainerItem) { IEnergyContainerItem item = (IEnergyContainerItem)itemstack.getItem(); - int itemEnergy = (int)Math.round(Math.min(Math.sqrt(item.getMaxEnergyStored(itemstack)), item.getMaxEnergyStored(itemstack) - item.getEnergyStored(itemstack))); - int toTransfer = (int)Math.round(Math.min(itemEnergy, (getEnergy()*general.TO_RF))); - + int toTransfer = (int)Math.round(getEnergy()*general.TO_RF); setEnergy(getEnergy() - (item.receiveEnergy(itemstack, toTransfer, false)*general.FROM_RF)); } + else if(MekanismUtils.useIC2() && itemstack.getItem() instanceof IElectricItem) + { + double sent = ElectricItem.manager.charge(itemstack, getEnergy()*general.TO_IC2, 4, true, false)*general.FROM_IC2; + setEnergy(getEnergy() - sent); + } } } @@ -203,7 +224,7 @@ public class TileEntityChargepad extends TileEntityNoisyElectricBlock if(clientActive != isActive) { isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } } diff --git a/src/main/java/mekanism/common/tile/TileEntityChemicalCrystallizer.java b/src/main/java/mekanism/common/tile/TileEntityChemicalCrystallizer.java index cab110150..278936cba 100644 --- a/src/main/java/mekanism/common/tile/TileEntityChemicalCrystallizer.java +++ b/src/main/java/mekanism/common/tile/TileEntityChemicalCrystallizer.java @@ -4,87 +4,55 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; -import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.IConfigCardAccess; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.usage; -import mekanism.api.Range4D; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; -import mekanism.api.gas.GasTransmission; import mekanism.api.gas.IGasHandler; import mekanism.api.gas.IGasItem; import mekanism.api.gas.ITubeConnection; import mekanism.api.transmitters.TransmissionType; -import mekanism.common.Mekanism; import mekanism.common.SideData; -import mekanism.common.Upgrade; -import mekanism.common.base.IRedstoneControl; import mekanism.common.base.ISideConfiguration; import mekanism.common.base.ISustainedData; import mekanism.common.base.ITankManager; -import mekanism.common.base.IUpgradeTile; import mekanism.common.block.states.BlockStateMachine; import mekanism.common.capabilities.Capabilities; -import mekanism.common.network.PacketTileEntity.TileEntityMessage; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.inputs.GasInput; import mekanism.common.recipe.machines.CrystallizerRecipe; -import mekanism.common.security.ISecurityTile; import mekanism.common.tile.component.TileComponentConfig; import mekanism.common.tile.component.TileComponentEjector; -import mekanism.common.tile.component.TileComponentSecurity; -import mekanism.common.tile.component.TileComponentUpgrade; +import mekanism.common.tile.prefab.TileEntityOperationalMachine; import mekanism.common.util.ChargeUtils; +import mekanism.common.util.GasUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; -public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, ISideConfiguration, IUpgradeTile, ISustainedData, ITankManager, IConfigCardAccess, ISecurityTile +public class TileEntityChemicalCrystallizer extends TileEntityOperationalMachine implements IGasHandler, ITubeConnection, ISideConfiguration, ISustainedData, ITankManager, IConfigCardAccess { public static final int MAX_GAS = 10000; public GasTank inputTank = new GasTank(MAX_GAS); - public int updateDelay; - - public int operatingTicks; - - public int BASE_TICKS_REQUIRED = 200; - - public int ticksRequired = 200; - - public boolean isActive; - - public boolean clientActive; - - public double prevEnergy; - - public final double BASE_ENERGY_USAGE = usage.chemicalCrystallizerUsage; - - public double energyUsage = usage.chemicalCrystallizerUsage; - public CrystallizerRecipe cachedRecipe; - /** This machine's current RedstoneControl type. */ - public RedstoneControl controlType = RedstoneControl.DISABLED; - - public TileComponentUpgrade upgradeComponent; public TileComponentEjector ejectorComponent; public TileComponentConfig configComponent; - public TileComponentSecurity securityComponent; public TileEntityChemicalCrystallizer() { - super("machine.crystallizer", "ChemicalCrystallizer", BlockStateMachine.MachineType.CHEMICAL_CRYSTALLIZER.baseEnergy); + super("machine.crystallizer", "ChemicalCrystallizer", BlockStateMachine.MachineType.CHEMICAL_CRYSTALLIZER.baseEnergy, usage.chemicalCrystallizerUsage, 3, 200); configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY, TransmissionType.GAS); @@ -101,15 +69,10 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock configComponent.setInputConfig(TransmissionType.ENERGY); - inventory = new ItemStack[4]; - - upgradeComponent = new TileComponentUpgrade(this, 3); - upgradeComponent.setSupported(Upgrade.MUFFLING); + inventory = NonNullList.withSize(4, ItemStack.EMPTY); ejectorComponent = new TileComponentEjector(this); ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(2)); - - securityComponent = new TileComponentSecurity(this); } @Override @@ -117,43 +80,22 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock { super.onUpdate(); - if(worldObj.isRemote && updateDelay > 0) + if(!world.isRemote) { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } - } - - if(!worldObj.isRemote) - { - if(updateDelay > 0) - { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - } - } - ChargeUtils.discharge(2, this); - if(inventory[0] != null && (inputTank.getGas() == null || inputTank.getStored() < inputTank.getMaxGas())) + if(!inventory.get(0).isEmpty() && (inputTank.getGas() == null || inputTank.getStored() < inputTank.getMaxGas())) { - inputTank.receive(GasTransmission.removeGas(inventory[0], inputTank.getGasType(), inputTank.getNeeded()), true); + inputTank.receive(GasUtils.removeGas(inventory.get(0), inputTank.getGasType(), inputTank.getNeeded()), true); } CrystallizerRecipe recipe = getRecipe(); - if(canOperate(recipe) && MekanismUtils.canFunction(this) && getEnergy() >= energyUsage) + if(canOperate(recipe) && MekanismUtils.canFunction(this) && getEnergy() >= energyPerTick) { setActive(true); - setEnergy(getEnergy() - energyUsage); + setEnergy(getEnergy() - energyPerTick); if((operatingTicks+1) < ticksRequired) { @@ -217,10 +159,6 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock if(FMLCommonHandler.instance().getEffectiveSide().isClient()) { - isActive = dataStream.readBoolean(); - operatingTicks = dataStream.readInt(); - controlType = RedstoneControl.values()[dataStream.readInt()]; - if(dataStream.readBoolean()) { inputTank.setGas(new GasStack(GasRegistry.getGas(dataStream.readInt()), dataStream.readInt())); @@ -228,13 +166,6 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock else { inputTank.setGas(null); } - - if(updateDelay == 0 && clientActive != isActive) - { - updateDelay = general.UPDATE_DELAY; - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } } } @@ -243,10 +174,6 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock { super.getNetworkedData(data); - data.add(isActive); - data.add(operatingTicks); - data.add(controlType.ordinal()); - if(inputTank.getGas() != null) { data.add(true); @@ -265,10 +192,6 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock { super.readFromNBT(nbtTags); - isActive = nbtTags.getBoolean("isActive"); - operatingTicks = nbtTags.getInteger("operatingTicks"); - controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")]; - inputTank.read(nbtTags.getCompoundTag("rightTank")); } @@ -277,10 +200,6 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock { super.writeToNBT(nbtTags); - nbtTags.setBoolean("isActive", isActive); - nbtTags.setInteger("operatingTicks", operatingTicks); - nbtTags.setInteger("controlType", controlType.ordinal()); - nbtTags.setTag("rightTank", inputTank.write(new NBTTagCompound())); nbtTags.setBoolean("sideDataStored", true); @@ -293,44 +212,7 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock { return i != 0 && i != 1; } - - public double getScaledProgress() - { - return ((double)operatingTicks) / (double)ticksRequired; - } - @Override - public void setActive(boolean active) - { - isActive = active; - - if(clientActive != active && updateDelay == 0) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - - updateDelay = 10; - clientActive = active; - } - } - - @Override - public boolean getActive() - { - return isActive; - } - - @Override - public boolean renderUpdate() - { - return false; - } - - @Override - public boolean lightUpdate() - { - return true; - } - @Override public boolean canTubeConnect(EnumFacing side) { @@ -344,25 +226,6 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock RecipeHandler.Recipe.CHEMICAL_CRYSTALLIZER.containsRecipe(type); } - @Override - public RedstoneControl getControlType() - { - return controlType; - } - - @Override - public void setControlType(RedstoneControl type) - { - controlType = type; - MekanismUtils.saveChunk(this); - } - - @Override - public boolean canPulse() - { - return false; - } - @Override public int receiveGas(EnumFacing side, GasStack stack, boolean doTransfer) { @@ -410,7 +273,7 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock { if(slotID == 0) { - return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).getGas(itemstack) != null && + return !itemstack.isEmpty() && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).getGas(itemstack) != null && RecipeHandler.Recipe.CHEMICAL_CRYSTALLIZER.containsRecipe(((IGasItem)itemstack.getItem()).getGas(itemstack).getGas()); } else if(slotID == 2) @@ -426,7 +289,7 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock { if(slotID == 0) { - return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).getGas(itemstack) == null; + return !itemstack.isEmpty() && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).getGas(itemstack) == null; } else if(slotID == 1) { @@ -464,12 +327,6 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock return ejectorComponent; } - @Override - public TileComponentUpgrade getComponent() - { - return upgradeComponent; - } - @Override public void writeSustainedData(ItemStack itemStack) { @@ -484,36 +341,10 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock { inputTank.setGas(GasStack.readFromNBT(ItemDataUtils.getCompound(itemStack, "inputTank"))); } - - @Override - public void recalculateUpgradables(Upgrade upgrade) - { - super.recalculateUpgradables(upgrade); - - switch(upgrade) - { - case SPEED: - ticksRequired = MekanismUtils.getTicks(this, BASE_TICKS_REQUIRED); - energyUsage = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_USAGE); - break; - case ENERGY: - energyUsage = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_USAGE); - maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); - break; - default: - break; - } - } @Override public Object[] getTanks() { return new Object[] {inputTank}; } - - @Override - public TileComponentSecurity getSecurity() - { - return securityComponent; - } } diff --git a/src/main/java/mekanism/common/tile/TileEntityChemicalDissolutionChamber.java b/src/main/java/mekanism/common/tile/TileEntityChemicalDissolutionChamber.java index d8fd64398..883a79c57 100644 --- a/src/main/java/mekanism/common/tile/TileEntityChemicalDissolutionChamber.java +++ b/src/main/java/mekanism/common/tile/TileEntityChemicalDissolutionChamber.java @@ -4,47 +4,40 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; -import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.usage; -import mekanism.api.Range4D; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; -import mekanism.api.gas.GasTransmission; import mekanism.api.gas.IGasHandler; import mekanism.api.gas.IGasItem; import mekanism.api.gas.ITubeConnection; -import mekanism.api.util.ListUtils; -import mekanism.common.Mekanism; +import mekanism.common.MekanismFluids; import mekanism.common.Upgrade; -import mekanism.common.base.IRedstoneControl; import mekanism.common.base.ISustainedData; import mekanism.common.base.ITankManager; -import mekanism.common.base.IUpgradeTile; import mekanism.common.block.states.BlockStateMachine; import mekanism.common.capabilities.Capabilities; -import mekanism.common.network.PacketTileEntity.TileEntityMessage; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.inputs.ItemStackInput; import mekanism.common.recipe.machines.DissolutionRecipe; -import mekanism.common.security.ISecurityTile; -import mekanism.common.tile.component.TileComponentAdvancedUpgrade; -import mekanism.common.tile.component.TileComponentSecurity; import mekanism.common.tile.component.TileComponentUpgrade; +import mekanism.common.tile.prefab.TileEntityMachine; import mekanism.common.util.ChargeUtils; +import mekanism.common.util.GasUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.ItemDataUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.StatUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; -public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectricBlock implements ITubeConnection, IRedstoneControl, IGasHandler, IUpgradeTile, ISustainedData, ITankManager, ISecurityTile +public class TileEntityChemicalDissolutionChamber extends TileEntityMachine implements ITubeConnection, IGasHandler, ISustainedData, ITankManager { public GasTank injectTank = new GasTank(MAX_GAS); public GasTank outputTank = new GasTank(MAX_GAS); @@ -57,16 +50,8 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri public int injectUsageThisTick; - public int updateDelay; - public int gasOutput = 256; - public boolean isActive; - - public boolean clientActive; - - public double prevEnergy; - public int operatingTicks = 0; public int BASE_TICKS_REQUIRED = 100; @@ -75,59 +60,30 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri public final double BASE_ENERGY_USAGE = usage.chemicalDissolutionChamberUsage; - public double energyUsage = usage.chemicalDissolutionChamberUsage; - public DissolutionRecipe cachedRecipe; - - public TileComponentUpgrade upgradeComponent = new TileComponentAdvancedUpgrade(this, 4); - public TileComponentSecurity securityComponent = new TileComponentSecurity(this); - - public RedstoneControl controlType = RedstoneControl.DISABLED; public TileEntityChemicalDissolutionChamber() { - super("machine.dissolution", "ChemicalDissolutionChamber", BlockStateMachine.MachineType.CHEMICAL_DISSOLUTION_CHAMBER.baseEnergy); + super("machine.dissolution", "ChemicalDissolutionChamber", BlockStateMachine.MachineType.CHEMICAL_DISSOLUTION_CHAMBER.baseEnergy, usage.chemicalDissolutionChamberUsage, 4); - inventory = new ItemStack[5]; - upgradeComponent.setSupported(Upgrade.MUFFLING); + inventory = NonNullList.withSize(5, ItemStack.EMPTY); } @Override public void onUpdate() { - if(worldObj.isRemote && updateDelay > 0) + if(!world.isRemote) { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } - } - - if(!worldObj.isRemote) - { - if(updateDelay > 0) - { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - } - } - ChargeUtils.discharge(3, this); - if(inventory[0] != null && injectTank.getNeeded() > 0) + if(!inventory.get(0).isEmpty() && injectTank.getNeeded() > 0) { - injectTank.receive(GasTransmission.removeGas(inventory[0], GasRegistry.getGas("sulfuricAcid"), injectTank.getNeeded()), true); + injectTank.receive(GasUtils.removeGas(inventory.get(0), MekanismFluids.SulfuricAcid, injectTank.getNeeded()), true); } - if(inventory[2] != null && outputTank.getGas() != null) + if(!inventory.get(2).isEmpty() && outputTank.getGas() != null) { - outputTank.draw(GasTransmission.addGas(inventory[2], outputTank.getGas()), true); + outputTank.draw(GasUtils.addGas(inventory.get(2), outputTank.getGas()), true); } boolean changed = false; @@ -136,10 +92,10 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri injectUsageThisTick = Math.max(1, StatUtils.inversePoisson(injectUsage)); - if(canOperate(recipe) && getEnergy() >= energyUsage && injectTank.getStored() >= injectUsageThisTick && MekanismUtils.canFunction(this)) + if(canOperate(recipe) && getEnergy() >= energyPerTick && injectTank.getStored() >= injectUsageThisTick && MekanismUtils.canFunction(this)) { setActive(true); - setEnergy(getEnergy() - energyUsage); + setEnergy(getEnergy() - energyPerTick); minorOperate(); if((operatingTicks+1) < ticksRequired) @@ -169,7 +125,7 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri if(outputTank.getGas() != null) { GasStack toSend = new GasStack(outputTank.getGas().getGas(), Math.min(outputTank.getStored(), gasOutput)); - outputTank.draw(GasTransmission.emit(toSend, this, ListUtils.asList(MekanismUtils.getRight(facing))), true); + outputTank.draw(GasUtils.emit(toSend, this, ListUtils.asList(MekanismUtils.getRight(facing))), true); } } } @@ -194,7 +150,7 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri { if(slotID == 2) { - return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null); + return !itemstack.isEmpty() && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null); } return false; @@ -238,7 +194,7 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri public ItemStackInput getInput() { - return new ItemStackInput(inventory[1]); + return new ItemStackInput(inventory.get(1)); } public boolean canOperate(DissolutionRecipe recipe) @@ -265,8 +221,6 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri if(FMLCommonHandler.instance().getEffectiveSide().isClient()) { - isActive = dataStream.readBoolean(); - controlType = RedstoneControl.values()[dataStream.readInt()]; operatingTicks = dataStream.readInt(); if(dataStream.readBoolean()) @@ -284,13 +238,6 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri else { outputTank.setGas(null); } - - if(updateDelay == 0 && clientActive != isActive) - { - updateDelay = general.UPDATE_DELAY; - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } } } @@ -299,8 +246,6 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri { super.getNetworkedData(data); - data.add(isActive); - data.add(controlType.ordinal()); data.add(operatingTicks); if(injectTank.getGas() != null) @@ -331,8 +276,6 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri { super.readFromNBT(nbtTags); - isActive = nbtTags.getBoolean("isActive"); - controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")]; operatingTicks = nbtTags.getInteger("operatingTicks"); injectTank.read(nbtTags.getCompoundTag("injectTank")); outputTank.read(nbtTags.getCompoundTag("gasTank")); @@ -343,8 +286,6 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri { super.writeToNBT(nbtTags); - nbtTags.setBoolean("isActive", isActive); - nbtTags.setInteger("controlType", controlType.ordinal()); nbtTags.setInteger("operatingTicks", operatingTicks); nbtTags.setTag("injectTank", injectTank.write(new NBTTagCompound())); nbtTags.setTag("gasTank", outputTank.write(new NBTTagCompound())); @@ -357,38 +298,6 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri { return i != 0 && i != 1; } - - @Override - public void setActive(boolean active) - { - isActive = active; - - if(clientActive != active && updateDelay == 0) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - - updateDelay = 10; - clientActive = active; - } - } - - @Override - public boolean getActive() - { - return isActive; - } - - @Override - public boolean renderUpdate() - { - return false; - } - - @Override - public boolean lightUpdate() - { - return true; - } @Override public boolean canTubeConnect(EnumFacing side) @@ -396,25 +305,6 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri return side == MekanismUtils.getLeft(facing) || side == MekanismUtils.getRight(facing); } - @Override - public RedstoneControl getControlType() - { - return controlType; - } - - @Override - public void setControlType(RedstoneControl type) - { - controlType = type; - MekanismUtils.saveChunk(this); - } - - @Override - public boolean canPulse() - { - return false; - } - @Override public int receiveGas(EnumFacing side, GasStack stack, boolean doTransfer) { @@ -435,7 +325,7 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri @Override public boolean canReceiveGas(EnumFacing side, Gas type) { - return side == MekanismUtils.getLeft(facing) && type == GasRegistry.getGas("sulfuricAcid"); + return side == MekanismUtils.getLeft(facing) && type == MekanismFluids.SulfuricAcid; } @Override @@ -501,13 +391,9 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri break; case SPEED: ticksRequired = MekanismUtils.getTicks(this, BASE_TICKS_REQUIRED); - energyUsage = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_USAGE); + energyPerTick = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_USAGE); injectUsage = MekanismUtils.getSecondaryEnergyPerTickMean(this, BASE_INJECT_USAGE); break; - case ENERGY: - energyUsage = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_USAGE); - maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); - break; default: break; } @@ -518,10 +404,4 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri { return new Object[] {injectTank, outputTank}; } - - @Override - public TileComponentSecurity getSecurity() - { - return securityComponent; - } } diff --git a/src/main/java/mekanism/common/tile/TileEntityChemicalInfuser.java b/src/main/java/mekanism/common/tile/TileEntityChemicalInfuser.java index 2a08a98eb..140f34e82 100644 --- a/src/main/java/mekanism/common/tile/TileEntityChemicalInfuser.java +++ b/src/main/java/mekanism/common/tile/TileEntityChemicalInfuser.java @@ -5,20 +5,13 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; import java.util.List; -import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.usage; -import mekanism.api.Range4D; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; -import mekanism.api.gas.GasTransmission; import mekanism.api.gas.IGasHandler; import mekanism.api.gas.IGasItem; import mekanism.api.gas.ITubeConnection; -import mekanism.api.util.ListUtils; -import mekanism.common.Mekanism; import mekanism.common.Upgrade; import mekanism.common.Upgrade.IUpgradeInfoHandler; import mekanism.common.base.IRedstoneControl; @@ -27,25 +20,27 @@ import mekanism.common.base.ITankManager; import mekanism.common.base.IUpgradeTile; import mekanism.common.block.states.BlockStateMachine; import mekanism.common.capabilities.Capabilities; -import mekanism.common.network.PacketTileEntity.TileEntityMessage; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.inputs.ChemicalPairInput; import mekanism.common.recipe.machines.ChemicalInfuserRecipe; import mekanism.common.security.ISecurityTile; -import mekanism.common.tile.component.TileComponentSecurity; -import mekanism.common.tile.component.TileComponentUpgrade; +import mekanism.common.tile.prefab.TileEntityMachine; import mekanism.common.util.ChargeUtils; +import mekanism.common.util.GasUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.ItemDataUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing.Axis; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; -public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, ISustainedData, IUpgradeTile, IUpgradeInfoHandler, ITankManager, ISecurityTile +public class TileEntityChemicalInfuser extends TileEntityMachine implements IGasHandler, ITubeConnection, IRedstoneControl, ISustainedData, IUpgradeTile, IUpgradeInfoHandler, ITankManager, ISecurityTile { public GasTank leftTank = new GasTank(MAX_GAS); public GasTank rightTank = new GasTank(MAX_GAS); @@ -53,36 +48,17 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl public static final int MAX_GAS = 10000; - public int updateDelay; - public int gasOutput = 256; - public boolean isActive; - - public boolean clientActive; - - public double prevEnergy; - - public final double BASE_ENERGY_USAGE = usage.chemicalInfuserUsage; - - public double energyPerTick = BASE_ENERGY_USAGE; - public ChemicalInfuserRecipe cachedRecipe; public double clientEnergyUsed; - - public TileComponentUpgrade upgradeComponent = new TileComponentUpgrade(this, 4); - public TileComponentSecurity securityComponent = new TileComponentSecurity(this); - - /** This machine's current RedstoneControl type. */ - public RedstoneControl controlType = RedstoneControl.DISABLED; public TileEntityChemicalInfuser() { - super("machine.cheminfuser", "ChemicalInfuser", BlockStateMachine.MachineType.CHEMICAL_INFUSER.baseEnergy); + super("machine.cheminfuser", "ChemicalInfuser", BlockStateMachine.MachineType.CHEMICAL_INFUSER.baseEnergy, usage.chemicalInfuserUsage, 4); - inventory = new ItemStack[5]; - upgradeComponent.setSupported(Upgrade.MUFFLING); + inventory = NonNullList.withSize(5, ItemStack.EMPTY); } @Override @@ -90,44 +66,23 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl { super.onUpdate(); - if(worldObj.isRemote && updateDelay > 0) + if(!world.isRemote) { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } - } - - if(!worldObj.isRemote) - { - if(updateDelay > 0) - { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - } - } - ChargeUtils.discharge(3, this); - if(inventory[0] != null && (leftTank.getGas() == null || leftTank.getStored() < leftTank.getMaxGas())) + if(!inventory.get(0).isEmpty() && (leftTank.getGas() == null || leftTank.getStored() < leftTank.getMaxGas())) { - leftTank.receive(GasTransmission.removeGas(inventory[0], leftTank.getGasType(), leftTank.getNeeded()), true); + leftTank.receive(GasUtils.removeGas(inventory.get(0), leftTank.getGasType(), leftTank.getNeeded()), true); } - if(inventory[1] != null && (rightTank.getGas() == null || rightTank.getStored() < rightTank.getMaxGas())) + if(!inventory.get(1).isEmpty() && (rightTank.getGas() == null || rightTank.getStored() < rightTank.getMaxGas())) { - rightTank.receive(GasTransmission.removeGas(inventory[1], rightTank.getGasType(), rightTank.getNeeded()), true); + rightTank.receive(GasUtils.removeGas(inventory.get(1), rightTank.getGasType(), rightTank.getNeeded()), true); } - if(inventory[2] != null && centerTank.getGas() != null) + if(!inventory.get(2).isEmpty() && centerTank.getGas() != null) { - centerTank.draw(GasTransmission.addGas(inventory[2], centerTank.getGas()), true); + centerTank.draw(GasUtils.addGas(inventory.get(2), centerTank.getGas()), true); } ChemicalInfuserRecipe recipe = getRecipe(); @@ -152,7 +107,7 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl if(centerTank.getGas() != null) { GasStack toSend = new GasStack(centerTank.getGas().getGas(), Math.min(centerTank.getStored(), gasOutput)); - centerTank.draw(GasTransmission.emit(toSend, this, ListUtils.asList(facing)), true); + centerTank.draw(GasUtils.emit(toSend, this, ListUtils.asList(facing)), true); } prevEnergy = getEnergy(); @@ -206,7 +161,6 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl int operations = getUpgradedUsage(recipe); recipe.operate(leftTank, rightTank, centerTank, operations); - markDirty(); return operations; @@ -219,8 +173,6 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl if(FMLCommonHandler.instance().getEffectiveSide().isClient()) { - isActive = dataStream.readBoolean(); - controlType = RedstoneControl.values()[dataStream.readInt()]; clientEnergyUsed = dataStream.readDouble(); if(dataStream.readBoolean()) @@ -246,13 +198,6 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl else { centerTank.setGas(null); } - - if(updateDelay == 0 && clientActive != isActive) - { - updateDelay = general.UPDATE_DELAY; - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } } } @@ -261,8 +206,6 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl { super.getNetworkedData(data); - data.add(isActive); - data.add(controlType.ordinal()); data.add(clientEnergyUsed); if(leftTank.getGas() != null) @@ -303,9 +246,6 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl { super.readFromNBT(nbtTags); - isActive = nbtTags.getBoolean("isActive"); - controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")]; - leftTank.read(nbtTags.getCompoundTag("leftTank")); rightTank.read(nbtTags.getCompoundTag("rightTank")); centerTank.read(nbtTags.getCompoundTag("centerTank")); @@ -316,9 +256,6 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl { super.writeToNBT(nbtTags); - nbtTags.setBoolean("isActive", isActive); - nbtTags.setInteger("controlType", controlType.ordinal()); - nbtTags.setTag("leftTank", leftTank.write(new NBTTagCompound())); nbtTags.setTag("rightTank", rightTank.write(new NBTTagCompound())); nbtTags.setTag("centerTank", centerTank.write(new NBTTagCompound())); @@ -350,38 +287,6 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl return null; } - @Override - public void setActive(boolean active) - { - isActive = active; - - if(clientActive != active && updateDelay == 0) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - - updateDelay = 10; - clientActive = active; - } - } - - @Override - public boolean getActive() - { - return isActive; - } - - @Override - public boolean renderUpdate() - { - return false; - } - - @Override - public boolean lightUpdate() - { - return true; - } - @Override public boolean canTubeConnect(EnumFacing side) { @@ -394,25 +299,6 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl return (getTank(side) != null && getTank(side) != centerTank) && getTank(side).canReceive(type); } - @Override - public RedstoneControl getControlType() - { - return controlType; - } - - @Override - public void setControlType(RedstoneControl type) - { - controlType = type; - MekanismUtils.saveChunk(this); - } - - @Override - public boolean canPulse() - { - return false; - } - @Override public int receiveGas(EnumFacing side, GasStack stack, boolean doTransfer) { @@ -470,11 +356,11 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl { if(slotID == 0 || slotID == 2) { - return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canReceiveGas(itemstack, null); + return !itemstack.isEmpty() && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canReceiveGas(itemstack, null); } else if(slotID == 1) { - return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null); + return !itemstack.isEmpty() && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null); } else if(slotID == 3) { @@ -534,27 +420,6 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl centerTank.setGas(GasStack.readFromNBT(ItemDataUtils.getCompound(itemStack, "centerTank"))); } - @Override - public TileComponentUpgrade getComponent() - { - return upgradeComponent; - } - - @Override - public void recalculateUpgradables(Upgrade upgrade) - { - super.recalculateUpgradables(upgrade); - - switch(upgrade) - { - case ENERGY: - maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); - energyPerTick = MekanismUtils.getBaseEnergyPerTick(this, BASE_ENERGY_USAGE); - default: - break; - } - } - @Override public List getInfo(Upgrade upgrade) { @@ -566,10 +431,4 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl { return new Object[] {leftTank, rightTank, centerTank}; } - - @Override - public TileComponentSecurity getSecurity() - { - return securityComponent; - } } diff --git a/src/main/java/mekanism/common/tile/TileEntityChemicalInjectionChamber.java b/src/main/java/mekanism/common/tile/TileEntityChemicalInjectionChamber.java index abe6c12bb..0a8965102 100644 --- a/src/main/java/mekanism/common/tile/TileEntityChemicalInjectionChamber.java +++ b/src/main/java/mekanism/common/tile/TileEntityChemicalInjectionChamber.java @@ -3,18 +3,20 @@ package mekanism.common.tile; import java.util.Map; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.usage; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; -import mekanism.api.gas.GasTransmission; import mekanism.api.gas.IGasItem; import mekanism.api.transmitters.TransmissionType; import mekanism.common.MekanismBlocks; +import mekanism.common.MekanismFluids; import mekanism.common.SideData; import mekanism.common.block.states.BlockStateMachine; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.recipe.machines.InjectionRecipe; +import mekanism.common.tile.prefab.TileEntityAdvancedElectricMachine; +import mekanism.common.util.GasUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.block.Block; @@ -25,7 +27,7 @@ public class TileEntityChemicalInjectionChamber extends TileEntityAdvancedElectr { public TileEntityChemicalInjectionChamber() { - super("injection", "ChemicalInjectionChamber", usage.chemicalInjectionChamberUsage, 1, 200, BlockStateMachine.MachineType.CHEMICAL_INJECTION_CHAMBER.baseEnergy); + super("injection", "ChemicalInjectionChamber", BlockStateMachine.MachineType.CHEMICAL_INJECTION_CHAMBER.baseEnergy, usage.chemicalInjectionChamberUsage, 200, 1); configComponent.addSupported(TransmissionType.GAS); configComponent.addOutput(TransmissionType.GAS, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY)); @@ -43,10 +45,10 @@ public class TileEntityChemicalInjectionChamber extends TileEntityAdvancedElectr @Override public GasStack getItemGas(ItemStack itemstack) { - if(MekanismUtils.getOreDictName(itemstack).contains("dustSulfur")) return new GasStack(GasRegistry.getGas("sulfuricAcid"), 2); - if(MekanismUtils.getOreDictName(itemstack).contains("dustSalt")) return new GasStack(GasRegistry.getGas("hydrogenChloride"), 2); + if(MekanismUtils.getOreDictName(itemstack).contains("dustSulfur")) return new GasStack(MekanismFluids.SulfuricAcid, 2); + if(MekanismUtils.getOreDictName(itemstack).contains("dustSalt")) return new GasStack(MekanismFluids.HydrogenChloride, 2); if(Block.getBlockFromItem(itemstack.getItem()) == MekanismBlocks.GasTank && ((IGasItem)itemstack.getItem()).getGas(itemstack) != null && - isValidGas(((IGasItem)itemstack.getItem()).getGas(itemstack).getGas())) return new GasStack(GasRegistry.getGas("sulfuricAcid"), 1); + isValidGas(((IGasItem)itemstack.getItem()).getGas(itemstack).getGas())) return new GasStack(MekanismFluids.SulfuricAcid, 1); return null; } @@ -76,13 +78,13 @@ public class TileEntityChemicalInjectionChamber extends TileEntityAdvancedElectr @Override public void handleSecondaryFuel() { - if(inventory[1] != null && gasTank.getNeeded() > 0 && inventory[1].getItem() instanceof IGasItem) + if(!inventory.get(1).isEmpty() && gasTank.getNeeded() > 0 && inventory.get(1).getItem() instanceof IGasItem) { - GasStack gas = ((IGasItem)inventory[1].getItem()).getGas(inventory[1]); + GasStack gas = ((IGasItem)inventory.get(1).getItem()).getGas(inventory.get(1)); if(gas != null && isValidGas(gas.getGas())) { - GasStack removed = GasTransmission.removeGas(inventory[1], gasTank.getGasType(), gasTank.getNeeded()); + GasStack removed = GasUtils.removeGas(inventory.get(1), gasTank.getGasType(), gasTank.getNeeded()); gasTank.receive(removed, true); } @@ -101,7 +103,7 @@ public class TileEntityChemicalInjectionChamber extends TileEntityAdvancedElectr @Override public boolean isValidGas(Gas gas) { - return gas == GasRegistry.getGas("sulfuricAcid") || gas == GasRegistry.getGas("water") || gas == GasRegistry.getGas("hydrogenChloride"); + return gas == MekanismFluids.SulfuricAcid || gas == MekanismFluids.Water || gas == MekanismFluids.HydrogenChloride; } @Override diff --git a/src/main/java/mekanism/common/tile/TileEntityChemicalOxidizer.java b/src/main/java/mekanism/common/tile/TileEntityChemicalOxidizer.java index b917fad40..76335b93f 100644 --- a/src/main/java/mekanism/common/tile/TileEntityChemicalOxidizer.java +++ b/src/main/java/mekanism/common/tile/TileEntityChemicalOxidizer.java @@ -4,82 +4,49 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; -import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.usage; -import mekanism.api.Range4D; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; -import mekanism.api.gas.GasTransmission; import mekanism.api.gas.IGasItem; import mekanism.api.gas.ITubeConnection; -import mekanism.api.util.ListUtils; -import mekanism.common.Mekanism; -import mekanism.common.Upgrade; -import mekanism.common.base.IRedstoneControl; import mekanism.common.base.ISustainedData; import mekanism.common.base.ITankManager; -import mekanism.common.base.IUpgradeTile; import mekanism.common.block.states.BlockStateMachine; import mekanism.common.capabilities.Capabilities; -import mekanism.common.network.PacketTileEntity.TileEntityMessage; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.inputs.ItemStackInput; import mekanism.common.recipe.machines.OxidationRecipe; -import mekanism.common.security.ISecurityTile; -import mekanism.common.tile.component.TileComponentSecurity; -import mekanism.common.tile.component.TileComponentUpgrade; +import mekanism.common.tile.prefab.TileEntityOperationalMachine; import mekanism.common.util.ChargeUtils; +import mekanism.common.util.GasUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.ItemDataUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing.Axis; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; -public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock implements ITubeConnection, IRedstoneControl, IUpgradeTile, ISustainedData, ITankManager, ISecurityTile +public class TileEntityChemicalOxidizer extends TileEntityOperationalMachine implements ITubeConnection, ISustainedData, ITankManager { public GasTank gasTank = new GasTank(MAX_GAS); public static final int MAX_GAS = 10000; - public int updateDelay; - public int gasOutput = 256; - public boolean isActive; - - public boolean clientActive; - - public double prevEnergy; - - public int operatingTicks = 0; - - public int BASE_TICKS_REQUIRED = 100; - - public int ticksRequired = BASE_TICKS_REQUIRED; - - public final double BASE_ENERGY_USAGE = usage.rotaryCondensentratorUsage; - - public double energyUsage = BASE_ENERGY_USAGE; - public OxidationRecipe cachedRecipe; - public RedstoneControl controlType = RedstoneControl.DISABLED; - - public TileComponentUpgrade upgradeComponent = new TileComponentUpgrade(this, 3); - public TileComponentSecurity securityComponent = new TileComponentSecurity(this); - public TileEntityChemicalOxidizer() { - super("machine.oxidizer", "ChemicalOxidizer", BlockStateMachine.MachineType.CHEMICAL_OXIDIZER.baseEnergy); + super("machine.oxidizer", "ChemicalOxidizer", BlockStateMachine.MachineType.CHEMICAL_OXIDIZER.baseEnergy, usage.rotaryCondensentratorUsage, 3, 100); - inventory = new ItemStack[4]; - upgradeComponent.setSupported(Upgrade.MUFFLING); + inventory = NonNullList.withSize(4, ItemStack.EMPTY); } @Override @@ -87,42 +54,21 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp { super.onUpdate(); - if(worldObj.isRemote && updateDelay > 0) + if(!world.isRemote) { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } - } - - if(!worldObj.isRemote) - { - if(updateDelay > 0) - { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - } - } - ChargeUtils.discharge(1, this); - if(inventory[2] != null && gasTank.getGas() != null) + if(!inventory.get(2).isEmpty() && gasTank.getGas() != null) { - gasTank.draw(GasTransmission.addGas(inventory[2], gasTank.getGas()), true); + gasTank.draw(GasUtils.addGas(inventory.get(2), gasTank.getGas()), true); } OxidationRecipe recipe = getRecipe(); - if(canOperate(recipe) && getEnergy() >= energyUsage && MekanismUtils.canFunction(this)) + if(canOperate(recipe) && getEnergy() >= energyPerTick && MekanismUtils.canFunction(this)) { setActive(true); - setEnergy(getEnergy() - energyUsage); + setEnergy(getEnergy() - energyPerTick); if(operatingTicks < ticksRequired) { @@ -147,7 +93,7 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp if(gasTank.getGas() != null) { GasStack toSend = new GasStack(gasTank.getGas().getGas(), Math.min(gasTank.getStored(), gasOutput)); - gasTank.draw(GasTransmission.emit(toSend, this, ListUtils.asList(MekanismUtils.getRight(facing))), true); + gasTank.draw(GasUtils.emit(toSend, this, ListUtils.asList(MekanismUtils.getRight(facing))), true); } } } @@ -172,7 +118,7 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp { if(slotID == 2) { - return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null); + return !itemstack.isEmpty() && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null); } return false; @@ -197,11 +143,6 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp return InventoryUtils.EMPTY; } - public double getScaledProgress() - { - return ((double)operatingTicks) / ((double)ticksRequired); - } - public OxidationRecipe getRecipe() { ItemStackInput input = getInput(); @@ -216,7 +157,7 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp public ItemStackInput getInput() { - return new ItemStackInput(inventory[0]); + return new ItemStackInput(inventory.get(0)); } public boolean canOperate(OxidationRecipe recipe) @@ -238,10 +179,6 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp if(FMLCommonHandler.instance().getEffectiveSide().isClient()) { - isActive = dataStream.readBoolean(); - controlType = RedstoneControl.values()[dataStream.readInt()]; - operatingTicks = dataStream.readInt(); - if(dataStream.readBoolean()) { gasTank.setGas(new GasStack(GasRegistry.getGas(dataStream.readInt()), dataStream.readInt())); @@ -249,13 +186,6 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp else { gasTank.setGas(null); } - - if(updateDelay == 0 && clientActive != isActive) - { - updateDelay = general.UPDATE_DELAY; - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } } } @@ -264,10 +194,6 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp { super.getNetworkedData(data); - data.add(isActive); - data.add(controlType.ordinal()); - data.add(operatingTicks); - if(gasTank.getGas() != null) { data.add(true); @@ -286,9 +212,6 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp { super.readFromNBT(nbtTags); - isActive = nbtTags.getBoolean("isActive"); - controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")]; - operatingTicks = nbtTags.getInteger("operatingTicks"); gasTank.read(nbtTags.getCompoundTag("gasTank")); } @@ -297,9 +220,6 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp { super.writeToNBT(nbtTags); - nbtTags.setBoolean("isActive", isActive); - nbtTags.setInteger("controlType", controlType.ordinal()); - nbtTags.setInteger("operatingTicks", operatingTicks); nbtTags.setTag("gasTank", gasTank.write(new NBTTagCompound())); return nbtTags; @@ -310,38 +230,6 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp { return i != 0 && i != 1; } - - @Override - public void setActive(boolean active) - { - isActive = active; - - if(clientActive != active && updateDelay == 0) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - - updateDelay = 10; - clientActive = active; - } - } - - @Override - public boolean getActive() - { - return isActive; - } - - @Override - public boolean renderUpdate() - { - return false; - } - - @Override - public boolean lightUpdate() - { - return true; - } @Override public boolean canTubeConnect(EnumFacing side) @@ -366,31 +254,6 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp return super.getCapability(capability, side); } - @Override - public RedstoneControl getControlType() - { - return controlType; - } - - @Override - public void setControlType(RedstoneControl type) - { - controlType = type; - MekanismUtils.saveChunk(this); - } - - @Override - public boolean canPulse() - { - return false; - } - - @Override - public TileComponentUpgrade getComponent() - { - return upgradeComponent; - } - @Override public void writeSustainedData(ItemStack itemStack) { @@ -405,33 +268,10 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp { gasTank.setGas(GasStack.readFromNBT(ItemDataUtils.getCompound(itemStack, "gasTank"))); } - - @Override - public void recalculateUpgradables(Upgrade upgrade) - { - super.recalculateUpgradables(upgrade); - - switch(upgrade) - { - case SPEED: - ticksRequired = MekanismUtils.getTicks(this, BASE_TICKS_REQUIRED); - case ENERGY: - energyUsage = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_USAGE); - maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); - default: - break; - } - } @Override public Object[] getTanks() { return new Object[] {gasTank}; } - - @Override - public TileComponentSecurity getSecurity() - { - return securityComponent; - } } diff --git a/src/main/java/mekanism/common/tile/TileEntityChemicalWasher.java b/src/main/java/mekanism/common/tile/TileEntityChemicalWasher.java index aa544a8e8..5cd5f7e78 100644 --- a/src/main/java/mekanism/common/tile/TileEntityChemicalWasher.java +++ b/src/main/java/mekanism/common/tile/TileEntityChemicalWasher.java @@ -5,49 +5,42 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; import java.util.List; -import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.usage; -import mekanism.api.Range4D; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; -import mekanism.api.gas.GasTransmission; import mekanism.api.gas.IGasHandler; import mekanism.api.gas.IGasItem; import mekanism.api.gas.ITubeConnection; -import mekanism.api.util.ListUtils; -import mekanism.common.Mekanism; import mekanism.common.PacketHandler; import mekanism.common.Upgrade; import mekanism.common.Upgrade.IUpgradeInfoHandler; import mekanism.common.base.FluidHandlerWrapper; import mekanism.common.base.IFluidHandlerWrapper; -import mekanism.common.base.IRedstoneControl; import mekanism.common.base.ISustainedData; import mekanism.common.base.ITankManager; -import mekanism.common.base.IUpgradeTile; import mekanism.common.block.states.BlockStateMachine; import mekanism.common.capabilities.Capabilities; -import mekanism.common.network.PacketTileEntity.TileEntityMessage; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.inputs.GasInput; import mekanism.common.recipe.machines.WasherRecipe; -import mekanism.common.security.ISecurityTile; -import mekanism.common.tile.component.TileComponentSecurity; -import mekanism.common.tile.component.TileComponentUpgrade; +import mekanism.common.tile.prefab.TileEntityMachine; import mekanism.common.util.ChargeUtils; import mekanism.common.util.FluidContainerUtils; import mekanism.common.util.FluidContainerUtils.FluidChecker; +import mekanism.common.util.GasUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.ItemDataUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.PipeUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing.Axis; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; @@ -58,7 +51,7 @@ import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fml.common.FMLCommonHandler; -public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, IFluidHandlerWrapper, IUpgradeTile, ISustainedData, IUpgradeInfoHandler, ITankManager, ISecurityTile +public class TileEntityChemicalWasher extends TileEntityMachine implements IGasHandler, ITubeConnection, IFluidHandlerWrapper, ISustainedData, IUpgradeInfoHandler, ITankManager { public FluidTank fluidTank = new FluidTank(MAX_FLUID); public GasTank inputTank = new GasTank(MAX_GAS); @@ -69,36 +62,17 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple public static int WATER_USAGE = 5; - public int updateDelay; - public int gasOutput = 256; - public boolean isActive; - - public boolean clientActive; - - public double prevEnergy; - - public final double BASE_ENERGY_USAGE = usage.chemicalWasherUsage; - - public double energyPerTick = BASE_ENERGY_USAGE; - public WasherRecipe cachedRecipe; public double clientEnergyUsed; - - public TileComponentUpgrade upgradeComponent = new TileComponentUpgrade(this, 4); - public TileComponentSecurity securityComponent = new TileComponentSecurity(this); - - /** This machine's current RedstoneControl type. */ - public RedstoneControl controlType = RedstoneControl.DISABLED; public TileEntityChemicalWasher() { - super("machine.washer", "ChemicalWasher", BlockStateMachine.MachineType.CHEMICAL_WASHER.baseEnergy); + super("machine.washer", "ChemicalWasher", BlockStateMachine.MachineType.CHEMICAL_WASHER.baseEnergy, usage.chemicalWasherUsage, 4); - inventory = new ItemStack[5]; - upgradeComponent.setSupported(Upgrade.MUFFLING); + inventory = NonNullList.withSize(5, ItemStack.EMPTY); } @Override @@ -106,35 +80,14 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple { super.onUpdate(); - if(worldObj.isRemote && updateDelay > 0) + if(!world.isRemote) { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } - } - - if(!worldObj.isRemote) - { - if(updateDelay > 0) - { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - } - } - ChargeUtils.discharge(3, this); manageBuckets(); - if(inventory[2] != null && outputTank.getGas() != null) + if(!inventory.get(2).isEmpty() && outputTank.getGas() != null) { - outputTank.draw(GasTransmission.addGas(inventory[2], outputTank.getGas()), true); + outputTank.draw(GasUtils.addGas(inventory.get(2), outputTank.getGas()), true); } WasherRecipe recipe = getRecipe(); @@ -159,7 +112,7 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple if(outputTank.getGas() != null) { GasStack toSend = new GasStack(outputTank.getGas().getGas(), Math.min(outputTank.getStored(), gasOutput)); - outputTank.draw(GasTransmission.emit(toSend, this, ListUtils.asList(MekanismUtils.getRight(facing))), true); + outputTank.draw(GasUtils.emit(toSend, this, ListUtils.asList(MekanismUtils.getRight(facing))), true); } prevEnergy = getEnergy(); @@ -199,7 +152,7 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple private void manageBuckets() { - if(FluidContainerUtils.isFluidContainer(inventory[0])) + if(FluidContainerUtils.isFluidContainer(inventory.get(0))) { FluidContainerUtils.handleContainerItemEmpty(this, fluidTank, 0, 1, FluidChecker.check(FluidRegistry.WATER)); } @@ -221,8 +174,6 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple if(FMLCommonHandler.instance().getEffectiveSide().isClient()) { - isActive = dataStream.readBoolean(); - controlType = RedstoneControl.values()[dataStream.readInt()]; clientEnergyUsed = dataStream.readDouble(); if(dataStream.readBoolean()) @@ -253,7 +204,7 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple { updateDelay = general.UPDATE_DELAY; isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } } @@ -263,8 +214,6 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple { super.getNetworkedData(data); - data.add(isActive); - data.add(controlType.ordinal()); data.add(clientEnergyUsed); if(fluidTank.getFluid() != null) @@ -305,9 +254,6 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple { super.readFromNBT(nbtTags); - isActive = nbtTags.getBoolean("isActive"); - controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")]; - fluidTank.readFromNBT(nbtTags.getCompoundTag("leftTank")); inputTank.read(nbtTags.getCompoundTag("rightTank")); outputTank.read(nbtTags.getCompoundTag("centerTank")); @@ -318,9 +264,6 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple { super.writeToNBT(nbtTags); - nbtTags.setBoolean("isActive", isActive); - nbtTags.setInteger("controlType", controlType.ordinal()); - nbtTags.setTag("leftTank", fluidTank.writeToNBT(new NBTTagCompound())); nbtTags.setTag("rightTank", inputTank.write(new NBTTagCompound())); nbtTags.setTag("centerTank", outputTank.write(new NBTTagCompound())); @@ -348,38 +291,6 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple return null; } - @Override - public void setActive(boolean active) - { - isActive = active; - - if(clientActive != active && updateDelay == 0) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - - updateDelay = 10; - clientActive = active; - } - } - - @Override - public boolean getActive() - { - return isActive; - } - - @Override - public boolean renderUpdate() - { - return false; - } - - @Override - public boolean lightUpdate() - { - return true; - } - @Override public boolean canTubeConnect(EnumFacing side) { @@ -397,24 +308,6 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple return false; } - @Override - public RedstoneControl getControlType() - { - return controlType; - } - - @Override - public void setControlType(RedstoneControl type) - { - controlType = type; - MekanismUtils.saveChunk(this); - } - - @Override - public boolean canPulse() - { - return false; - } @Override public int receiveGas(EnumFacing side, GasStack stack, boolean doTransfer) @@ -464,7 +357,7 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple { if(slotID == 1) { - return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null); + return !itemstack.isEmpty() && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null); } else if(slotID == 2) { @@ -588,27 +481,6 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple inputTank.setGas(GasStack.readFromNBT(ItemDataUtils.getCompound(itemStack, "inputTank"))); outputTank.setGas(GasStack.readFromNBT(ItemDataUtils.getCompound(itemStack, "outputTank"))); } - - @Override - public TileComponentUpgrade getComponent() - { - return upgradeComponent; - } - - @Override - public void recalculateUpgradables(Upgrade upgrade) - { - super.recalculateUpgradables(upgrade); - - switch(upgrade) - { - case ENERGY: - maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); - energyPerTick = MekanismUtils.getBaseEnergyPerTick(this, BASE_ENERGY_USAGE); - default: - break; - } - } @Override public List getInfo(Upgrade upgrade) @@ -621,10 +493,4 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple { return new Object[] {fluidTank, inputTank, outputTank}; } - - @Override - public TileComponentSecurity getSecurity() - { - return securityComponent; - } } diff --git a/src/main/java/mekanism/common/tile/TileEntityCombiner.java b/src/main/java/mekanism/common/tile/TileEntityCombiner.java index e9f1da65d..9a0fa53cc 100644 --- a/src/main/java/mekanism/common/tile/TileEntityCombiner.java +++ b/src/main/java/mekanism/common/tile/TileEntityCombiner.java @@ -2,13 +2,14 @@ package mekanism.common.tile; import java.util.Map; -import mekanism.api.MekanismConfig.usage; import mekanism.api.gas.Gas; -import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; +import mekanism.common.MekanismFluids; import mekanism.common.block.states.BlockStateMachine; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.recipe.machines.CombinerRecipe; +import mekanism.common.tile.prefab.TileEntityAdvancedElectricMachine; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemBlock; @@ -18,7 +19,7 @@ public class TileEntityCombiner extends TileEntityAdvancedElectricMachine { public TileEntityCrusher() { - super("crusher", "Crusher", usage.crusherUsage, 200, BlockStateMachine.MachineType.CRUSHER.baseEnergy); + super("crusher", "Crusher", BlockStateMachine.MachineType.CRUSHER.baseEnergy, usage.crusherUsage, 200); } @Override diff --git a/src/main/java/mekanism/common/tile/TileEntityDigitalMiner.java b/src/main/java/mekanism/common/tile/TileEntityDigitalMiner.java index 38a0eb191..7d56ed0a0 100644 --- a/src/main/java/mekanism/common/tile/TileEntityDigitalMiner.java +++ b/src/main/java/mekanism/common/tile/TileEntityDigitalMiner.java @@ -15,9 +15,7 @@ import java.util.stream.Collectors; import mekanism.api.Chunk3D; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.usage; import mekanism.api.Range4D; -import mekanism.api.util.CapabilityUtils; import mekanism.common.HashList; import mekanism.common.Mekanism; import mekanism.common.Upgrade; @@ -29,12 +27,15 @@ import mekanism.common.base.IUpgradeTile; import mekanism.common.block.states.BlockStateMachine; import mekanism.common.capabilities.Capabilities; import mekanism.common.chunkloading.IChunkLoader; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.content.miner.MItemStackFilter; import mekanism.common.content.miner.MOreDictFilter; import mekanism.common.content.miner.MinerFilter; import mekanism.common.content.miner.ThreadMinerSearch; import mekanism.common.content.miner.ThreadMinerSearch.State; import mekanism.common.content.transporter.InvStack; +import mekanism.common.content.transporter.TransitRequest; +import mekanism.common.content.transporter.TransitRequest.TransitResponse; import mekanism.common.content.transporter.TransporterManager; import mekanism.common.inventory.container.ContainerFilter; import mekanism.common.inventory.container.ContainerNull; @@ -42,6 +43,8 @@ import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.tile.component.TileComponentChunkLoader; import mekanism.common.tile.component.TileComponentSecurity; import mekanism.common.tile.component.TileComponentUpgrade; +import mekanism.common.tile.prefab.TileEntityElectricBlock; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.ChargeUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.ItemDataUtils; @@ -53,13 +56,13 @@ import net.minecraft.block.BlockBush; import net.minecraft.block.state.IBlockState; 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.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; @@ -97,7 +100,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I public boolean doEject = false; public boolean doPull = false; - public ItemStack missingStack = null; + public ItemStack missingStack = ItemStack.EMPTY; public int BASE_DELAY = 80; @@ -134,7 +137,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I public TileEntityDigitalMiner() { super("DigitalMiner", BlockStateMachine.MachineType.DIGITAL_MINER.baseEnergy); - inventory = new ItemStack[29]; + inventory = NonNullList.withSize(29, ItemStack.EMPTY); radius = 10; upgradeComponent.setSupported(Upgrade.ANCHOR); @@ -156,7 +159,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I } } - if(!worldObj.isRemote) + if(!world.isRemote) { if(!initCalc) { @@ -207,7 +210,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I break; } - if(!coord.exists(worldObj)) + if(!coord.exists(world)) { set.clear(index); @@ -220,11 +223,11 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I continue; } - IBlockState state = coord.getBlockState(worldObj); + IBlockState state = coord.getBlockState(world); Block block = state.getBlock(); int meta = block.getMetaFromState(state); - if(block == null || coord.isAirBlock(worldObj)) + if(block == null || coord.isAirBlock(world)) { set.clear(index); @@ -262,7 +265,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I continue; } - List drops = MinerUtils.getDrops(worldObj, coord, silkTouch); + List drops = MinerUtils.getDrops(world, coord, silkTouch); if(canInsert(drops) && setReplace(coord, index)) { @@ -275,9 +278,9 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I it.remove(); } - worldObj.playEvent(null, 2001, coord.getPos(), Block.getStateId(state)); + world.playEvent(null, 2001, coord.getPos(), Block.getStateId(state)); - missingStack = null; + missingStack = ItemStack.EMPTY; } break; @@ -293,22 +296,26 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I setActive(false); } } + + TransitRequest ejectMap = getEjectItemMap(); - if(doEject && delayTicks == 0 && getTopEject(false, null) != null && getEjectInv() != null && getEjectTile() != null) + if(doEject && delayTicks == 0 && !ejectMap.isEmpty() && getEjectInv() != null && getEjectTile() != null) { - if(getEjectInv() instanceof IInventory) + if(CapabilityUtils.hasCapability(getEjectInv(), Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, facing.getOpposite())) { - ItemStack remains = InventoryUtils.putStackInInventory((IInventory)getEjectInv(), getTopEject(false, null), facing.getOpposite(), false); + TransitResponse response = TransporterUtils.insert(getEjectTile(), CapabilityUtils.getCapability(getEjectInv(), Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, facing.getOpposite()), ejectMap, null, true, 0); - getTopEject(true, remains); - } - else if(CapabilityUtils.hasCapability(getEjectInv(), Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, facing.getOpposite())) - { - ItemStack rejected = TransporterUtils.insert(getEjectTile(), CapabilityUtils.getCapability(getEjectInv(), Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, facing.getOpposite()), getTopEject(false, null), null, true, 0); - - if(TransporterManager.didEmit(getTopEject(false, null), rejected)) + if(!response.isEmpty()) { - getTopEject(true, rejected); + response.getInvStack(this, facing.getOpposite()).use(); + } + } + else { + TransitResponse response = InventoryUtils.putStackInInventory(getEjectInv(), ejectMap, facing.getOpposite(), false); + + if(!response.isEmpty()) + { + response.getInvStack(this, facing.getOpposite()).use(); } } @@ -359,36 +366,36 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I */ public boolean setReplace(Coord4D obj, int index) { - IBlockState state = obj.getBlockState(worldObj); + IBlockState state = obj.getBlockState(world); Block block = state.getBlock(); - EntityPlayer dummy = Mekanism.proxy.getDummyPlayer((WorldServer)worldObj, obj.xCoord, obj.yCoord, obj.zCoord).get(); - BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(worldObj, obj.getPos(), state, dummy); + EntityPlayer dummy = Mekanism.proxy.getDummyPlayer((WorldServer)world, obj.xCoord, obj.yCoord, obj.zCoord).get(); + BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, obj.getPos(), state, dummy); MinecraftForge.EVENT_BUS.post(event); if(!event.isCanceled()) { ItemStack stack = getReplace(index); - if(stack != null) + if(!stack.isEmpty()) { - worldObj.setBlockState(obj.getPos(), Block.getBlockFromItem(stack.getItem()).getStateFromMeta(stack.getItemDamage()), 3); + world.setBlockState(obj.getPos(), Block.getBlockFromItem(stack.getItem()).getStateFromMeta(stack.getItemDamage()), 3); - IBlockState s = obj.getBlockState(worldObj); - if(s.getBlock() instanceof BlockBush && !((BlockBush)s.getBlock()).canBlockStay(worldObj, obj.getPos(), s)) + IBlockState s = obj.getBlockState(world); + if(s.getBlock() instanceof BlockBush && !((BlockBush)s.getBlock()).canBlockStay(world, obj.getPos(), s)) { - s.getBlock().dropBlockAsItem(worldObj, obj.getPos(), s, 1); - worldObj.setBlockToAir(obj.getPos()); + s.getBlock().dropBlockAsItem(world, obj.getPos(), s, 1); + world.setBlockToAir(obj.getPos()); } return true; } else { MinerFilter filter = replaceMap.get(index); - - if(filter == null || (filter.replaceStack == null || !filter.requireStack)) + + if(filter == null || (filter.replaceStack.isEmpty() || !filter.requireStack)) { - worldObj.setBlockToAir(obj.getPos()); + world.setBlockToAir(obj.getPos()); return true; } @@ -406,29 +413,24 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I { MinerFilter filter = replaceMap.get(index); - if(filter == null || filter.replaceStack == null) + if(filter == null || filter.replaceStack.isEmpty()) { - return null; + return ItemStack.EMPTY; } for(int i = 0; i < 27; i++) { - if(inventory[i] != null && inventory[i].isItemEqual(filter.replaceStack)) + if(!inventory.get(i).isEmpty() && inventory.get(i).isItemEqual(filter.replaceStack)) { - inventory[i].stackSize--; - - if(inventory[i].stackSize == 0) - { - inventory[i] = null; - } + inventory.get(i).shrink(1); return MekanismUtils.size(filter.replaceStack, 1); } } - if(doPull && getPullInv() instanceof IInventory) + if(doPull && getPullInv() != null) { - InvStack stack = InventoryUtils.takeDefinedItem((IInventory)getPullInv(), EnumFacing.UP, filter.replaceStack.copy(), 1, 1); + InvStack stack = InventoryUtils.takeDefinedItem(getPullInv(), EnumFacing.UP, filter.replaceStack.copy(), 1, 1); if(stack != null) { @@ -437,44 +439,44 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I } } - return null; + return ItemStack.EMPTY; } - public ItemStack[] copy(ItemStack[] stacks) + public NonNullList copy(NonNullList stacks) { - ItemStack[] toReturn = new ItemStack[stacks.length]; + NonNullList toReturn = NonNullList.withSize(stacks.size(), ItemStack.EMPTY); - for(int i = 0; i < stacks.length; i++) + for(int i = 0; i < stacks.size(); i++) { - toReturn[i] = stacks[i] != null ? stacks[i].copy() : null; + toReturn.set(i, !stacks.get(i).isEmpty() ? stacks.get(i).copy() : ItemStack.EMPTY); } return toReturn; } - public ItemStack getTopEject(boolean remove, ItemStack reject) + public TransitRequest getEjectItemMap() { + TransitRequest request = new TransitRequest(); + for(int i = 27-1; i >= 0; i--) { - ItemStack stack = inventory[i]; + ItemStack stack = inventory.get(i); - if(stack != null) + if(!stack.isEmpty()) { if(isReplaceStack(stack)) { continue; } - if(remove) + if(!request.hasType(stack)) { - inventory[i] = reject; + request.setItem(stack, i); } - - return stack; } } - return null; + return request; } public boolean canInsert(List stacks) @@ -484,35 +486,37 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I return true; } - ItemStack[] testInv = copy(inventory); + NonNullList testInv = copy(inventory); int added = 0; stacks: for(ItemStack stack : stacks) { - if(stack == null || stack.getItem() == null) + stack = stack.copy(); + + if(stack.isEmpty() || stack.getItem() == null) { continue; } for(int i = 0; i < 27; i++) { - if(testInv[i] != null && testInv[i].getItem() == null) + if(!testInv.get(i).isEmpty() && testInv.get(i).getItem() == null) { - testInv[i] = null; + testInv.set(i, ItemStack.EMPTY); } - if(testInv[i] == null) + if(testInv.get(i).isEmpty()) { - testInv[i] = stack; + testInv.set(i, stack); added++; continue stacks; } - else if(testInv[i].isItemEqual(stack) && testInv[i].stackSize+stack.stackSize <= stack.getMaxStackSize()) + else if(testInv.get(i).isItemEqual(stack) && testInv.get(i).getCount()+stack.getCount() <= stack.getMaxStackSize()) { - testInv[i].stackSize += stack.stackSize; + testInv.get(i).grow(stack.getCount()); added++; continue stacks; @@ -530,14 +534,14 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I public TileEntity getPullInv() { - return Coord4D.get(this).translate(0, 2, 0).getTileEntity(worldObj); + return Coord4D.get(this).translate(0, 2, 0).getTileEntity(world); } public TileEntity getEjectInv() { EnumFacing side = facing.getOpposite(); - return worldObj.getTileEntity(getPos().up().offset(side, 2)); + return world.getTileEntity(getPos().up().offset(side, 2)); } public void add(List stacks) @@ -552,15 +556,15 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I { for(int i = 0; i < 27; i++) { - if(inventory[i] == null) + if(inventory.get(i).isEmpty()) { - inventory[i] = stack; + inventory.set(i, stack); continue stacks; } - else if(inventory[i].isItemEqual(stack) && inventory[i].stackSize+stack.stackSize <= stack.getMaxStackSize()) + else if(inventory.get(i).isItemEqual(stack) && inventory.get(i).getCount()+stack.getCount() <= stack.getMaxStackSize()) { - inventory[i].stackSize += stack.stackSize; + inventory.get(i).grow(stack.getCount()); continue stacks; } @@ -603,7 +607,8 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I running = false; oresToMine.clear(); replaceMap.clear(); - missingStack = null; + missingStack = ItemStack.EMPTY; + setActive(false); MekanismUtils.saveChunk(this); } @@ -612,7 +617,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I { for(MinerFilter filter : filters) { - if(filter.replaceStack != null && filter.replaceStack.isItemEqual(stack)) + if(!filter.replaceStack.isEmpty() && filter.replaceStack.isItemEqual(stack)) { return true; } @@ -638,7 +643,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I { super.openInventory(player); - if(!worldObj.isRemote) + if(!world.isRemote) { Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), (EntityPlayerMP)player); } @@ -817,7 +822,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I missingStack = new ItemStack(Item.getItemById(dataStream.readInt()), 1, dataStream.readInt()); } else { - missingStack = null; + missingStack = ItemStack.EMPTY; } filters.clear(); @@ -850,7 +855,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I missingStack = new ItemStack(Item.getItemById(dataStream.readInt()), 1, dataStream.readInt()); } else { - missingStack = null; + missingStack = ItemStack.EMPTY; } } else if(type == 2) @@ -875,14 +880,14 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I missingStack = new ItemStack(Item.getItemById(dataStream.readInt()), 1, dataStream.readInt()); } else { - missingStack = null; + missingStack = ItemStack.EMPTY; } } if(clientActive != isActive) { isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } } @@ -916,7 +921,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I data.add(controlType.ordinal()); data.add(inverse); - if(missingStack != null) + if(!missingStack.isEmpty()) { data.add(true); data.add(MekanismUtils.getID(missingStack)); @@ -953,7 +958,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I data.add(getSize()); } - if(missingStack != null) + if(!missingStack.isEmpty()) { data.add(true); data.add(MekanismUtils.getID(missingStack)); @@ -994,7 +999,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I data.add(controlType.ordinal()); data.add(inverse); - if(missingStack != null) + if(!missingStack.isEmpty()) { data.add(true); data.add(MekanismUtils.getID(missingStack)); @@ -1035,7 +1040,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I public Coord4D getStartingCoord() { - return new Coord4D(getPos().getX()-radius, minY, getPos().getZ()-radius, worldObj.provider.getDimension()); + return new Coord4D(getPos().getX()-radius, minY, getPos().getZ()-radius, world.provider.getDimension()); } public Coord4D getCoordFromIndex(int index) @@ -1047,7 +1052,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I int y = start.yCoord+(index/diameter/diameter); int z = start.zCoord+(index/diameter)%diameter; - return new Coord4D(x, y, z, worldObj.provider.getDimension()); + return new Coord4D(x, y, z, world.provider.getDimension()); } @Override @@ -1134,8 +1139,8 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I } BlockPos pos1 = getPos().add(x, y, z); - MekanismUtils.makeAdvancedBoundingBlock(worldObj, pos1, Coord4D.get(this)); - worldObj.notifyNeighborsOfStateChange(pos1, getBlockType()); + MekanismUtils.makeAdvancedBoundingBlock(world, pos1, Coord4D.get(this)); + world.notifyNeighborsOfStateChange(pos1, getBlockType(), true); } } } @@ -1156,7 +1161,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I { for(int z = -1; z <= +1; z++) { - worldObj.setBlockToAir(getPos().add(x, y, z)); + world.setBlockToAir(getPos().add(x, y, z)); } } } @@ -1171,17 +1176,17 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I public TileEntity getEjectTile() { EnumFacing side = facing.getOpposite(); - return worldObj.getTileEntity(getPos().up().offset(side)); + return world.getTileEntity(getPos().up().offset(side)); } @Override - public int[] getBoundSlots(Coord4D location, EnumFacing side) + public int[] getBoundSlots(BlockPos location, EnumFacing side) { EnumFacing dir = facing.getOpposite(); BlockPos pull = getPos().up(); BlockPos eject = pull.offset(dir); - + if((location.equals(eject) && side == dir) || (location.equals(pull) && side == EnumFacing.UP)) { if(EJECT_INV == null) @@ -1201,7 +1206,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I } @Override - public boolean canBoundInsert(Coord4D location, int i, ItemStack itemstack) + public boolean canBoundInsert(BlockPos location, int i, ItemStack itemstack) { EnumFacing side = facing.getOpposite(); @@ -1214,7 +1219,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I } else if(location.equals(pull)) { - if(itemstack != null && isReplaceStack(itemstack)) + if(!itemstack.isEmpty() && isReplaceStack(itemstack)) { return true; } @@ -1224,7 +1229,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I } @Override - public boolean canBoundExtract(Coord4D location, int i, ItemStack itemstack, EnumFacing dir) + public boolean canBoundExtract(BlockPos location, int i, ItemStack itemstack, EnumFacing dir) { EnumFacing side = facing.getOpposite(); @@ -1233,7 +1238,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I if(location.equals(eject)) { - if(itemstack != null && isReplaceStack(itemstack)) + if(!itemstack.isEmpty() && isReplaceStack(itemstack)) { return false; } @@ -1260,7 +1265,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I numPowering--; } - public String[] methods = {"setRadius", "setMin", "setMax", "addFilter", "removeFilter", "addOreFilter", "removeOreFilter", "reset", "start", "stop"}; + public String[] methods = {"setRadius", "setMin", "setMax", "addFilter", "removeFilter", "addOreFilter", "removeOreFilter", "reset", "start", "stop", "getToMine"}; @Override public String[] getMethods() @@ -1271,114 +1276,147 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I @Override public Object[] invoke(int method, Object[] arguments) throws Exception { - if(arguments.length > 0) + if(method == 0) { - int num = 0; - - if(arguments[0] instanceof Double) + if(arguments.length != 1 || !(arguments[0] instanceof Double)) { - num = ((Double)arguments[0]).intValue(); + return new Object[] {"Invalid parameters."}; } - else if(arguments[0] instanceof String && (method != 5 && method != 6)) + + radius = ((Double)arguments[0]).intValue(); + } + else if(method == 1) + { + if(arguments.length != 1 || !(arguments[0] instanceof Double)) { - num = Integer.parseInt((String)arguments[0]); + return new Object[] {"Invalid parameters."}; + } + + minY = ((Double)arguments[0]).intValue(); + } + else if(method == 2) + { + if(arguments.length != 1 || !(arguments[0] instanceof Double)) + { + return new Object[] {"Invalid parameters."}; + } + + maxY = ((Double)arguments[0]).intValue(); + } + else if(method == 3) + { + if(arguments.length < 1 || !(arguments[0] instanceof Double)) + { + return new Object[] {"Invalid parameters."}; + } + + int id = ((Double)arguments[0]).intValue(); + int meta = 0; + + if(arguments.length > 1) + { + if(arguments[1] instanceof Double) + { + meta = ((Double)arguments[1]).intValue(); + } } - if(num != 0) + filters.add(new MItemStackFilter(new ItemStack(Item.getItemById(id), 1, meta))); + + return new Object[] {"Added filter."}; + } + else if(method == 4) + { + if(arguments.length < 1 || !(arguments[0] instanceof Double)) { - if(method == 0) - { - radius = num; - } - else if(method == 1) - { - minY = num; - } - else if(method == 2) - { - maxY = num; - } - else if(method == 3) - { - int meta = 0; + return new Object[] {"Invalid parameters."}; + } + + int id = ((Double)arguments[0]).intValue(); + Iterator iter = filters.iterator(); - if(arguments.length > 1) + while(iter.hasNext()) + { + MinerFilter filter = iter.next(); + + if(filter instanceof MItemStackFilter) + { + if(MekanismUtils.getID(((MItemStackFilter)filter).itemType) == id) { - if(arguments[1] instanceof Double) - { - meta = ((Double)arguments[1]).intValue(); - } - else if(arguments[1] instanceof String) - { - meta = Integer.parseInt((String)arguments[1]); - } + iter.remove(); + return new Object[] {"Removed filter."}; } - - filters.add(new MItemStackFilter(new ItemStack(Item.getItemById(num), 1, meta))); - } - else if(method == 4) - { - Iterator iter = filters.iterator(); - - while(iter.hasNext()) - { - MinerFilter filter = iter.next(); - - if(filter instanceof MItemStackFilter) - { - if(MekanismUtils.getID(((MItemStackFilter)filter).itemType) == num) - { - iter.remove(); - } - } - } - } - else if(method == 5) - { - String ore = (String)arguments[0]; - MOreDictFilter filter = new MOreDictFilter(); - - filter.oreDictName = ore; - filters.add(filter); - } - else if(method == 6) - { - String ore = (String)arguments[0]; - Iterator iter = filters.iterator(); - - while(iter.hasNext()) - { - MinerFilter filter = iter.next(); - - if(filter instanceof MOreDictFilter) - { - if(((MOreDictFilter)filter).oreDictName.equals(ore)) - { - iter.remove(); - } - } - } - } - else if(method == 7) - { - reset(); - } - else if(method == 8) - { - start(); - } - else if(method == 9) - { - stop(); } } + + return new Object[] {"Couldn't find filter."}; + } + else if(method == 5) + { + if(arguments.length < 1 || !(arguments[0] instanceof String)) + { + return new Object[] {"Invalid parameters."}; + } + + String ore = (String)arguments[0]; + MOreDictFilter filter = new MOreDictFilter(); + + filter.oreDictName = ore; + filters.add(filter); + + return new Object[] {"Added filter."}; + } + else if(method == 6) + { + if(arguments.length < 1 || !(arguments[0] instanceof String)) + { + return new Object[] {"Invalid parameters."}; + } + + String ore = (String)arguments[0]; + Iterator iter = filters.iterator(); + + while(iter.hasNext()) + { + MinerFilter filter = iter.next(); + + if(filter instanceof MOreDictFilter) + { + if(((MOreDictFilter)filter).oreDictName.equals(ore)) + { + iter.remove(); + return new Object[] {"Removed filter."}; + } + } + } + + return new Object[] {"Couldn't find filter."}; + } + else if(method == 7) + { + reset(); + return new Object[] {"Reset miner."}; + } + else if(method == 8) + { + start(); + return new Object[] {"Started miner."}; + } + else if(method == 9) + { + stop(); + return new Object[] {"Stopped miner."}; + } + else if(method == 10) + { + return new Object[] {searcher != null ? searcher.found : 0}; } for(EntityPlayer player : playersUsing) { Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(this), getGenericPacket(new ArrayList())), (EntityPlayerMP)player); } - + return null; } @@ -1498,22 +1536,23 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I case ENERGY: energyUsage = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_USAGE); maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); + setEnergy(Math.min(getMaxEnergy(), getEnergy())); default: break; } } @Override - public boolean canBoundReceiveEnergy(Coord4D coord, EnumFacing side) + public boolean canBoundReceiveEnergy(BlockPos coord, EnumFacing side) { EnumFacing left = MekanismUtils.getLeft(facing); EnumFacing right = MekanismUtils.getRight(facing); - if(coord.equals(Coord4D.get(this).offset(left))) + if(coord.equals(getPos().offset(left))) { return side == left; } - else if(coord.equals(Coord4D.get(this).offset(right))) + else if(coord.equals(getPos().offset(right))) { return side == right; } diff --git a/src/main/java/mekanism/common/tile/TileEntityDynamicTank.java b/src/main/java/mekanism/common/tile/TileEntityDynamicTank.java index 8b301bdf6..130f02fa5 100644 --- a/src/main/java/mekanism/common/tile/TileEntityDynamicTank.java +++ b/src/main/java/mekanism/common/tile/TileEntityDynamicTank.java @@ -24,6 +24,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -46,7 +47,7 @@ public class TileEntityDynamicTank extends TileEntityMultiblock capability, EnumFacing side) { - if((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure)) + if((!world.isRemote && structure != null) || (world.isRemote && clientHasStructure)) { if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) { @@ -94,7 +94,7 @@ public class TileEntityDynamicValve extends TileEntityDynamicTank implements IFl @Override public T getCapability(Capability capability, EnumFacing side) { - if((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure)) + if((!world.isRemote && structure != null) || (world.isRemote && clientHasStructure)) { if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) { diff --git a/src/main/java/mekanism/common/tile/TileEntityElectricPump.java b/src/main/java/mekanism/common/tile/TileEntityElectricPump.java index 68eb7042b..9ddc607d7 100644 --- a/src/main/java/mekanism/common/tile/TileEntityElectricPump.java +++ b/src/main/java/mekanism/common/tile/TileEntityElectricPump.java @@ -13,9 +13,7 @@ import java.util.Set; import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.IConfigurable; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.usage; -import mekanism.api.util.CapabilityUtils; +import mekanism.common.MekanismFluids; import mekanism.common.Upgrade; import mekanism.common.base.FluidHandlerWrapper; import mekanism.common.base.IFluidHandlerWrapper; @@ -24,10 +22,14 @@ import mekanism.common.base.ISustainedTank; import mekanism.common.base.ITankManager; import mekanism.common.base.IUpgradeTile; import mekanism.common.capabilities.Capabilities; -import mekanism.common.integration.IComputerIntegration; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.config.MekanismConfig.usage; +import mekanism.common.integration.computer.IComputerIntegration; import mekanism.common.security.ISecurityTile; import mekanism.common.tile.component.TileComponentSecurity; import mekanism.common.tile.component.TileComponentUpgrade; +import mekanism.common.tile.prefab.TileEntityElectricBlock; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.ChargeUtils; import mekanism.common.util.FluidContainerUtils; import mekanism.common.util.LangUtils; @@ -40,6 +42,7 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.text.TextComponentString; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.Constants.NBT; @@ -89,7 +92,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I public TileEntityElectricPump() { super("ElectricPump", 10000); - inventory = new ItemStack[4]; + inventory = NonNullList.withSize(4, ItemStack.EMPTY); upgradeComponent.setSupported(Upgrade.FILTER); } @@ -97,20 +100,20 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I @Override public void onUpdate() { - if(!worldObj.isRemote) + if(!world.isRemote) { ChargeUtils.discharge(2, this); if(fluidTank.getFluid() != null) { - if(FluidContainerUtils.isFluidContainer(inventory[0])) + if(FluidContainerUtils.isFluidContainer(inventory.get(0))) { FluidContainerUtils.handleContainerItemFill(this, fluidTank, 0, 1); } } } - if(!worldObj.isRemote) + if(!world.isRemote) { if(MekanismUtils.canFunction(this) && getEnergy() >= energyPerTick) { @@ -149,9 +152,9 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I super.onUpdate(); - if(!worldObj.isRemote && fluidTank.getFluid() != null) + if(!world.isRemote && fluidTank.getFluid() != null) { - TileEntity tileEntity = Coord4D.get(this).offset(EnumFacing.UP).getTileEntity(worldObj); + TileEntity tileEntity = Coord4D.get(this).offset(EnumFacing.UP).getTileEntity(world); if(tileEntity != null && CapabilityUtils.hasCapability(tileEntity, CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, EnumFacing.DOWN)) { @@ -176,7 +179,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I for(EnumFacing orientation : EnumFacing.VALUES) { Coord4D wrapper = Coord4D.get(this).offset(orientation); - FluidStack fluid = MekanismUtils.getFluid(worldObj, wrapper, hasFilter()); + FluidStack fluid = MekanismUtils.getFluid(world, wrapper, hasFilter()); if(fluid != null && (activeType == null || fluid.getFluid() == activeType) && (fluidTank.getFluid() == null || fluidTank.getFluid().isFluidEqual(fluid))) { @@ -188,7 +191,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I if(shouldTake(fluid, wrapper)) { - worldObj.setBlockToAir(wrapper.getPos()); + world.setBlockToAir(wrapper.getPos()); } } @@ -200,7 +203,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I //and then add the adjacent block to the recurring list for(Coord4D wrapper : tempPumpList) { - FluidStack fluid = MekanismUtils.getFluid(worldObj, wrapper, hasFilter()); + FluidStack fluid = MekanismUtils.getFluid(world, wrapper, hasFilter()); if(fluid != null && (activeType == null || fluid.getFluid() == activeType) && (fluidTank.getFluid() == null || fluidTank.getFluid().isFluidEqual(fluid))) { @@ -211,7 +214,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I if(shouldTake(fluid, wrapper)) { - worldObj.setBlockToAir(wrapper.getPos()); + world.setBlockToAir(wrapper.getPos()); } } @@ -225,7 +228,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I if(Coord4D.get(this).distanceTo(side) <= general.maxPumpRange) { - fluid = MekanismUtils.getFluid(worldObj, side, hasFilter()); + fluid = MekanismUtils.getFluid(world, side, hasFilter()); if(fluid != null && (activeType == null || fluid.getFluid() == activeType) && (fluidTank.getFluid() == null || fluidTank.getFluid().isFluidEqual(fluid))) { @@ -237,7 +240,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I if(shouldTake(fluid, side)) { - worldObj.setBlockToAir(side.getPos()); + world.setBlockToAir(side.getPos()); } } @@ -260,7 +263,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I private boolean shouldTake(FluidStack fluid, Coord4D coord) { - if(fluid.getFluid() == FluidRegistry.WATER || fluid.getFluid() == FluidRegistry.getFluid("heavywater")) + if(fluid.getFluid() == FluidRegistry.WATER || fluid.getFluid() == MekanismFluids.HeavyWater) { return general.pumpWaterSources; } @@ -514,7 +517,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I { reset(); - player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.configurator.pumpReset"))); + player.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.configurator.pumpReset"))); return EnumActionResult.SUCCESS; } @@ -618,6 +621,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I case ENERGY: energyPerTick = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_PER_TICK); maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); + setEnergy(Math.min(getMaxEnergy(), getEnergy())); default: break; } diff --git a/src/main/java/mekanism/common/tile/TileEntityElectrolyticSeparator.java b/src/main/java/mekanism/common/tile/TileEntityElectrolyticSeparator.java index c23e1a878..7de9571d3 100644 --- a/src/main/java/mekanism/common/tile/TileEntityElectrolyticSeparator.java +++ b/src/main/java/mekanism/common/tile/TileEntityElectrolyticSeparator.java @@ -5,49 +5,43 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; import java.util.List; -import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig; -import mekanism.api.Range4D; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; -import mekanism.api.gas.GasTransmission; import mekanism.api.gas.IGasHandler; import mekanism.api.gas.IGasItem; import mekanism.api.gas.ITubeConnection; -import mekanism.api.util.ListUtils; -import mekanism.common.Mekanism; +import mekanism.common.MekanismFluids; import mekanism.common.Upgrade; import mekanism.common.Upgrade.IUpgradeInfoHandler; import mekanism.common.base.FluidHandlerWrapper; -import mekanism.common.base.IActiveState; import mekanism.common.base.IFluidHandlerWrapper; -import mekanism.common.base.IRedstoneControl; import mekanism.common.base.ISustainedData; import mekanism.common.base.ITankManager; -import mekanism.common.base.IUpgradeTile; import mekanism.common.block.states.BlockStateMachine; import mekanism.common.capabilities.Capabilities; -import mekanism.common.integration.IComputerIntegration; -import mekanism.common.network.PacketTileEntity.TileEntityMessage; +import mekanism.common.integration.computer.IComputerIntegration; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.recipe.inputs.FluidInput; import mekanism.common.recipe.machines.SeparatorRecipe; import mekanism.common.recipe.outputs.ChemicalPairOutput; -import mekanism.common.security.ISecurityTile; import mekanism.common.tile.TileEntityGasTank.GasMode; import mekanism.common.tile.component.TileComponentSecurity; import mekanism.common.tile.component.TileComponentUpgrade; +import mekanism.common.tile.prefab.TileEntityMachine; import mekanism.common.util.ChargeUtils; import mekanism.common.util.FluidContainerUtils; +import mekanism.common.util.GasUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.ItemDataUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; @@ -59,7 +53,7 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.network.ByteBufUtils; -public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock implements IFluidHandlerWrapper, IComputerIntegration, ITubeConnection, ISustainedData, IGasHandler, IUpgradeTile, IUpgradeInfoHandler, ITankManager, IRedstoneControl, IActiveState, ISecurityTile +public class TileEntityElectrolyticSeparator extends TileEntityMachine implements IFluidHandlerWrapper, IComputerIntegration, ITubeConnection, ISustainedData, IGasHandler, IUpgradeInfoHandler, ITankManager { /** This separator's water slot. */ public FluidTank fluidTank = new FluidTank(24000); @@ -81,24 +75,11 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp /** Type type of gas this block is dumping. */ public GasMode dumpRight = GasMode.IDLE; - - public double BASE_ENERGY_USAGE; - - public double energyPerTick; - - public int updateDelay; - - public boolean isActive = false; - - public boolean clientActive = false; - - public double prevEnergy; public SeparatorRecipe cachedRecipe; public double clientEnergyUsed; - - public TileComponentUpgrade upgradeComponent = new TileComponentUpgrade(this, 4); + public TileComponentSecurity securityComponent = new TileComponentSecurity(this); /** This machine's current RedstoneControl type. */ @@ -106,8 +87,8 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp public TileEntityElectrolyticSeparator() { - super("ElectrolyticSeparator", BlockStateMachine.MachineType.ELECTROLYTIC_SEPARATOR.baseEnergy); - inventory = new ItemStack[5]; + super("machine.electrolyticseparator", "ElectrolyticSeparator", BlockStateMachine.MachineType.ELECTROLYTIC_SEPARATOR.baseEnergy, 0, 4); + inventory = NonNullList.withSize(5, ItemStack.EMPTY); } @Override @@ -115,51 +96,30 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp { super.onUpdate(); - if(worldObj.isRemote && updateDelay > 0) - { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } - } - - if(!worldObj.isRemote) + if(!world.isRemote) { - if(updateDelay > 0) - { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - } - } - ChargeUtils.discharge(3, this); - if(inventory[0] != null) + if(!inventory.get(0).isEmpty()) { - if(RecipeHandler.Recipe.ELECTROLYTIC_SEPARATOR.containsRecipe(inventory[0])) + if(RecipeHandler.Recipe.ELECTROLYTIC_SEPARATOR.containsRecipe(inventory.get(0))) { - if(FluidContainerUtils.isFluidContainer(inventory[0])) + if(FluidContainerUtils.isFluidContainer(inventory.get(0))) { - fluidTank.fill(FluidContainerUtils.extractFluid(fluidTank, inventory[0]), true); + fluidTank.fill(FluidContainerUtils.extractFluid(fluidTank, this, 0), true); } } } - if(inventory[1] != null && leftTank.getStored() > 0) + if(!inventory.get(1).isEmpty() && leftTank.getStored() > 0) { - leftTank.draw(GasTransmission.addGas(inventory[1], leftTank.getGas()), true); + leftTank.draw(GasUtils.addGas(inventory.get(1), leftTank.getGas()), true); MekanismUtils.saveChunk(this); } - if(inventory[2] != null && rightTank.getStored() > 0) + if(!inventory.get(2).isEmpty() && rightTank.getStored() > 0) { - rightTank.draw(GasTransmission.addGas(inventory[2], rightTank.getGas()), true); + rightTank.draw(GasUtils.addGas(inventory.get(2), rightTank.getGas()), true); MekanismUtils.saveChunk(this); } @@ -169,9 +129,9 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp { setActive(true); - boolean update = BASE_ENERGY_USAGE != recipe.energyUsage; + boolean update = BASE_ENERGY_PER_TICK != recipe.energyUsage; - BASE_ENERGY_USAGE = recipe.energyUsage; + BASE_ENERGY_PER_TICK = recipe.energyUsage; if(update) { @@ -198,7 +158,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp if(dumpLeft != GasMode.DUMPING) { GasStack toSend = new GasStack(leftTank.getGas().getGas(), Math.min(leftTank.getStored(), output)); - leftTank.draw(GasTransmission.emit(toSend, this, ListUtils.asList(MekanismUtils.getLeft(facing))), true); + leftTank.draw(GasUtils.emit(toSend, this, ListUtils.asList(MekanismUtils.getLeft(facing))), true); } else { leftTank.draw(dumpAmount, true); @@ -215,7 +175,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp if(dumpRight != GasMode.DUMPING) { GasStack toSend = new GasStack(rightTank.getGas().getGas(), Math.min(rightTank.getStored(), output)); - rightTank.draw(GasTransmission.emit(toSend, this, ListUtils.asList(MekanismUtils.getRight(facing))), true); + rightTank.draw(GasUtils.emit(toSend, this, ListUtils.asList(MekanismUtils.getRight(facing))), true); } else { rightTank.draw(dumpAmount, true); @@ -317,11 +277,11 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp } else if(slotID == 1) { - return itemstack.getItem() instanceof IGasItem && (((IGasItem)itemstack.getItem()).getGas(itemstack) == null || ((IGasItem)itemstack.getItem()).getGas(itemstack).getGas() == GasRegistry.getGas("hydrogen")); + return itemstack.getItem() instanceof IGasItem && (((IGasItem)itemstack.getItem()).getGas(itemstack) == null || ((IGasItem)itemstack.getItem()).getGas(itemstack).getGas() == MekanismFluids.Hydrogen); } else if(slotID == 2) { - return itemstack.getItem() instanceof IGasItem && (((IGasItem)itemstack.getItem()).getGas(itemstack) == null || ((IGasItem)itemstack.getItem()).getGas(itemstack).getGas() == GasRegistry.getGas("oxygen")); + return itemstack.getItem() instanceof IGasItem && (((IGasItem)itemstack.getItem()).getGas(itemstack) == null || ((IGasItem)itemstack.getItem()).getGas(itemstack).getGas() == MekanismFluids.Oxygen); } else if(slotID == 3) { @@ -393,18 +353,9 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp rightTank.setGas(null); } - controlType = RedstoneControl.values()[dataStream.readInt()]; dumpLeft = GasMode.values()[dataStream.readInt()]; dumpRight = GasMode.values()[dataStream.readInt()]; - clientActive = dataStream.readBoolean(); clientEnergyUsed = dataStream.readDouble(); - - if(updateDelay == 0 && clientActive != isActive) - { - updateDelay = MekanismConfig.general.UPDATE_DELAY; - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } } } @@ -443,10 +394,8 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp data.add(false); } - data.add(controlType.ordinal()); data.add(dumpLeft.ordinal()); data.add(dumpRight.ordinal()); - data.add(isActive); data.add(clientEnergyUsed); return data; @@ -468,9 +417,6 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp fluidTank.readFromNBT(nbtTags.getCompoundTag("fluidTank")); } - isActive = nbtTags.getBoolean("isActive"); - controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")]; - leftTank.read(nbtTags.getCompoundTag("leftTank")); rightTank.read(nbtTags.getCompoundTag("rightTank")); @@ -488,9 +434,6 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp nbtTags.setTag("fluidTank", fluidTank.writeToNBT(new NBTTagCompound())); } - nbtTags.setBoolean("isActive", isActive); - nbtTags.setInteger("controlType", controlType.ordinal()); - nbtTags.setTag("leftTank", leftTank.write(new NBTTagCompound())); nbtTags.setTag("rightTank", rightTank.write(new NBTTagCompound())); @@ -676,84 +619,6 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp return super.getCapability(capability, side); } - - @Override - public RedstoneControl getControlType() - { - return controlType; - } - - @Override - public void setControlType(RedstoneControl type) - { - controlType = type; - MekanismUtils.saveChunk(this); - } - - @Override - public boolean canPulse() - { - return false; - } - - @Override - public void setActive(boolean active) - { - isActive = active; - - if(clientActive != active && updateDelay == 0) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - - updateDelay = 10; - clientActive = active; - } - } - - @Override - public boolean getActive() - { - return isActive; - } - - @Override - public boolean renderUpdate() - { - return false; - } - - @Override - public boolean lightUpdate() - { - return true; - } - - @Override - public TileComponentUpgrade getComponent() - { - return upgradeComponent; - } - - @Override - public TileComponentSecurity getSecurity() - { - return securityComponent; - } - - @Override - public void recalculateUpgradables(Upgrade upgrade) - { - super.recalculateUpgradables(upgrade); - - switch(upgrade) - { - case ENERGY: - maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); - energyPerTick = BASE_ENERGY_USAGE; //Don't scale energy usage. - default: - break; - } - } @Override public List getInfo(Upgrade upgrade) diff --git a/src/main/java/mekanism/common/tile/TileEntityEliteFactory.java b/src/main/java/mekanism/common/tile/TileEntityEliteFactory.java index 9bd6dbae2..69d0e9ad0 100644 --- a/src/main/java/mekanism/common/tile/TileEntityEliteFactory.java +++ b/src/main/java/mekanism/common/tile/TileEntityEliteFactory.java @@ -32,9 +32,6 @@ public class TileEntityEliteFactory extends TileEntityFactory configComponent.setCanEject(TransmissionType.GAS, false); configComponent.setInputConfig(TransmissionType.ENERGY); - - upgradeComponent = new TileComponentUpgrade(this, 0); - upgradeComponent.setSupported(Upgrade.MUFFLING); ejectorComponent = new TileComponentEjector(this); ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(2)); diff --git a/src/main/java/mekanism/common/tile/TileEntityEnergizedSmelter.java b/src/main/java/mekanism/common/tile/TileEntityEnergizedSmelter.java index d7f069692..9a15b8f80 100644 --- a/src/main/java/mekanism/common/tile/TileEntityEnergizedSmelter.java +++ b/src/main/java/mekanism/common/tile/TileEntityEnergizedSmelter.java @@ -2,17 +2,18 @@ package mekanism.common.tile; import java.util.Map; -import mekanism.api.MekanismConfig.usage; import mekanism.common.block.states.BlockStateMachine; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.recipe.inputs.ItemStackInput; import mekanism.common.recipe.machines.SmeltingRecipe; +import mekanism.common.tile.prefab.TileEntityElectricMachine; public class TileEntityEnergizedSmelter extends TileEntityElectricMachine { public TileEntityEnergizedSmelter() { - super("smelter", "EnergizedSmelter", usage.energizedSmelterUsage, 200, BlockStateMachine.MachineType.ENERGIZED_SMELTER.baseEnergy); + super("smelter", "EnergizedSmelter", BlockStateMachine.MachineType.ENERGIZED_SMELTER.baseEnergy, usage.energizedSmelterUsage, 200); } @Override diff --git a/src/main/java/mekanism/common/tile/TileEntityEnergyCube.java b/src/main/java/mekanism/common/tile/TileEntityEnergyCube.java index 4c74a43ab..ce9ea8eba 100644 --- a/src/main/java/mekanism/common/tile/TileEntityEnergyCube.java +++ b/src/main/java/mekanism/common/tile/TileEntityEnergyCube.java @@ -7,6 +7,7 @@ import java.util.EnumSet; import mekanism.api.Coord4D; import mekanism.api.EnumColor; +import mekanism.api.IConfigCardAccess; import mekanism.api.Range4D; import mekanism.api.transmitters.TransmissionType; import mekanism.common.Mekanism; @@ -16,12 +17,14 @@ import mekanism.common.Tier.EnergyCubeTier; import mekanism.common.base.IRedstoneControl; import mekanism.common.base.ISideConfiguration; import mekanism.common.base.ITierUpgradeable; -import mekanism.common.integration.IComputerIntegration; +import mekanism.common.capabilities.Capabilities; +import mekanism.common.integration.computer.IComputerIntegration; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.security.ISecurityTile; import mekanism.common.tile.component.TileComponentConfig; import mekanism.common.tile.component.TileComponentEjector; import mekanism.common.tile.component.TileComponentSecurity; +import mekanism.common.tile.prefab.TileEntityElectricBlock; import mekanism.common.util.CableUtils; import mekanism.common.util.ChargeUtils; import mekanism.common.util.InventoryUtils; @@ -30,10 +33,12 @@ import mekanism.common.util.MekanismUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.MathHelper; +import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; -public class TileEntityEnergyCube extends TileEntityElectricBlock implements IComputerIntegration, IRedstoneControl, ISideConfiguration, ISecurityTile, ITierUpgradeable +public class TileEntityEnergyCube extends TileEntityElectricBlock implements IComputerIntegration, IRedstoneControl, ISideConfiguration, ISecurityTile, ITierUpgradeable, IConfigCardAccess { /** This Energy Cube's tier. */ public EnergyCubeTier tier = EnergyCubeTier.BASIC; @@ -68,7 +73,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements ICo configComponent.setIOConfig(TransmissionType.ENERGY); configComponent.setEjecting(TransmissionType.ENERGY, true); - inventory = new ItemStack[2]; + inventory = NonNullList.withSize(2, ItemStack.EMPTY); controlType = RedstoneControl.DISABLED; ejectorComponent = new TileComponentEjector(this); @@ -81,7 +86,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements ICo { super.onUpdate(); - if(!worldObj.isRemote) + if(!world.isRemote) { ChargeUtils.charge(0, this); ChargeUtils.discharge(1, this); @@ -235,7 +240,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements ICo if(prevTier != tier) { - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } } @@ -293,7 +298,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements ICo public int getRedstoneLevel() { double fractionFull = getEnergy()/getMaxEnergy(); - return MathHelper.floor_float((float)(fractionFull * 14.0F)) + (fractionFull > 0 ? 1 : 0); + return MathHelper.floor((float)(fractionFull * 14.0F)) + (fractionFull > 0 ? 1 : 0); } @Override @@ -337,4 +342,21 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements ICo { return securityComponent; } + + @Override + public boolean hasCapability(Capability capability, EnumFacing side) + { + return capability == Capabilities.CONFIG_CARD_CAPABILITY || super.hasCapability(capability, side); + } + + @Override + public T getCapability(Capability capability, EnumFacing side) + { + if(capability == Capabilities.CONFIG_CARD_CAPABILITY) + { + return (T)this; + } + + return super.getCapability(capability, side); + } } diff --git a/src/main/java/mekanism/common/tile/TileEntityEnrichmentChamber.java b/src/main/java/mekanism/common/tile/TileEntityEnrichmentChamber.java index 3394391a7..898e98a95 100644 --- a/src/main/java/mekanism/common/tile/TileEntityEnrichmentChamber.java +++ b/src/main/java/mekanism/common/tile/TileEntityEnrichmentChamber.java @@ -2,10 +2,11 @@ package mekanism.common.tile; import java.util.Map; -import mekanism.api.MekanismConfig.usage; import mekanism.common.block.states.BlockStateMachine; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.recipe.machines.EnrichmentRecipe; +import mekanism.common.tile.prefab.TileEntityElectricMachine; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -13,7 +14,7 @@ public class TileEntityEnrichmentChamber extends TileEntityElectricMachine 0) - { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } - } - - if(!worldObj.isRemote) + if(!world.isRemote) { if(ticker == 1) { - worldObj.notifyNeighborsOfStateChange(getPos(), getBlockType()); - } - - if(updateDelay > 0) - { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - } + world.notifyNeighborsOfStateChange(getPos(), getBlockType(), true); } ChargeUtils.discharge(1, this); @@ -302,13 +258,13 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I handleSecondaryFuel(); sortInventory(); - if(inventory[2] != null && inventory[3] == null) + if(!inventory.get(2).isEmpty() && inventory.get(3).isEmpty()) { RecipeType toSet = null; for(RecipeType type : RecipeType.values()) { - if(inventory[2].isItemEqual(type.getStack())) + if(inventory.get(2).isItemEqual(type.getStack())) { toSet = type; break; @@ -328,17 +284,17 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I upgradeComponent.write(ItemDataUtils.getDataMap(returnStack)); upgradeComponent.setSupported(Upgrade.GAS, toSet.fuelEnergyUpgrades()); - upgradeComponent.read(ItemDataUtils.getDataMap(inventory[2])); + upgradeComponent.read(ItemDataUtils.getDataMap(inventory.get(2))); - inventory[2] = null; - inventory[3] = returnStack; + inventory.set(2, ItemStack.EMPTY); + inventory.set(3, returnStack); - recipeType = toSet; + setRecipeType(toSet); gasTank.setGas(null); secondaryEnergyPerTick = getSecondaryEnergyPerTick(recipeType); - worldObj.notifyNeighborsOfStateChange(getPos(), getBlockType()); + world.notifyNeighborsOfStateChange(getPos(), getBlockType(), true); MekanismUtils.saveChunk(this); } @@ -377,7 +333,7 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I if(!canOperate(getInputSlot(process), getOutputSlot(process))) { - if(!(recipeType.usesFuel() && recipeType.hasRecipe(inventory[getInputSlot(process)]))) + if(!(recipeType.usesFuel() && recipeType.hasRecipe(inventory.get(getInputSlot(process))))) { progress[process] = 0; } @@ -417,6 +373,20 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I } } + public void setRecipeType(RecipeType type) + { + recipeType = type; + BASE_MAX_ENERGY = maxEnergy = 200*tier.processes*recipeType.getEnergyUsage(); + BASE_ENERGY_PER_TICK = energyPerTick = recipeType.getEnergyUsage(); + upgradeComponent.setSupported(Upgrade.GAS, recipeType.fuelEnergyUpgrades()); + secondaryEnergyPerTick = getSecondaryEnergyPerTick(recipeType); + + for(Upgrade upgrade : upgradeComponent.getSupportedTypes()) + { + recalculateUpgradables(upgrade); + } + } + @Override public EnumSet getConsumingSides() { @@ -457,9 +427,9 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I { if(invID1.ID == invID2.ID || StackUtils.diffIgnoreNull(invID1.stack, invID2.stack) || Math.abs(invID1.size()-invID2.size()) < 2) continue; - List evened = StackUtils.even(inventory[invID1.ID], inventory[invID2.ID]); - inventory[invID1.ID] = evened.get(0); - inventory[invID2.ID] = evened.get(1); + List evened = StackUtils.even(inventory.get(invID1.ID), inventory.get(invID2.ID)); + inventory.set(invID1.ID, evened.get(0)); + inventory.set(invID2.ID, evened.get(1)); didOp = true; break; @@ -487,17 +457,17 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I public int size() { - return stack != null ? stack.stackSize : 0; + return !stack.isEmpty() ? stack.getCount() : 0; } public Item item() { - return stack != null ? stack.getItem() : null; + return !stack.isEmpty() ? stack.getItem() : null; } - public static InvID get(int id, ItemStack[] inv) + public static InvID get(int id, NonNullList inv) { - return new InvID(inv[id], id); + return new InvID(inv.get(id), id); } } @@ -508,43 +478,38 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I public void handleSecondaryFuel() { - if(inventory[4] != null) + if(!inventory.get(4).isEmpty()) { if(recipeType.usesFuel() && gasTank.getNeeded() > 0) { - if(inventory[4].getItem() instanceof IGasItem) + if(inventory.get(4).getItem() instanceof IGasItem) { - GasStack gas = ((IGasItem)inventory[4].getItem()).getGas(inventory[4]); + GasStack gas = ((IGasItem)inventory.get(4).getItem()).getGas(inventory.get(4)); if(gas != null && recipeType.isValidGas(gas.getGas())) { - GasStack removed = GasTransmission.removeGas(inventory[4], gasTank.getGasType(), gasTank.getNeeded()); + GasStack removed = GasUtils.removeGas(inventory.get(4), gasTank.getGasType(), gasTank.getNeeded()); gasTank.receive(removed, true); } return; } - GasStack stack = recipeType.getItemGas(inventory[4]); + GasStack stack = recipeType.getItemGas(inventory.get(4)); int gasNeeded = gasTank.getNeeded(); if(stack != null && stack.amount <= gasNeeded) { gasTank.receive(stack, true); - inventory[4].stackSize--; - - if(inventory[4].stackSize == 0) - { - inventory[4] = null; - } + inventory.get(4).shrink(1); } } else if(recipeType == RecipeType.INFUSING) { - if(InfuseRegistry.getObject(inventory[4]) != null) + if(InfuseRegistry.getObject(inventory.get(4)) != null) { - InfuseObject infuse = InfuseRegistry.getObject(inventory[4]); + InfuseObject infuse = InfuseRegistry.getObject(inventory.get(4)); if(infuseStored.type == null || infuseStored.type == infuse.type) { @@ -552,12 +517,7 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I { infuseStored.amount += infuse.stored; infuseStored.type = infuse.type; - inventory[4].stackSize--; - - if(inventory[4].stackSize <= 0) - { - inventory[4] = null; - } + inventory.get(4).shrink(1); } } } @@ -675,14 +635,14 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I public boolean canOperate(int inputSlot, int outputSlot) { - if(inventory[inputSlot] == null) + if(inventory.get(inputSlot).isEmpty()) { return false; } if(recipeType.usesFuel()) { - AdvancedMachineRecipe recipe = recipeType.getRecipe(inventory[inputSlot], gasTank.getGasType()); + AdvancedMachineRecipe recipe = recipeType.getRecipe(inventory.get(inputSlot), gasTank.getGasType()); return recipe != null && recipe.canOperate(inventory, inputSlot, outputSlot, gasTank, secondaryEnergyThisTick); @@ -690,7 +650,7 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I if(recipeType == RecipeType.INFUSING) { - InfusionInput input = new InfusionInput(infuseStored, inventory[inputSlot]); + InfusionInput input = new InfusionInput(infuseStored, inventory.get(inputSlot)); MetallurgicInfuserRecipe recipe = RecipeHandler.getMetallurgicInfuserRecipe(input); if(recipe == null) @@ -701,7 +661,7 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I return recipe.canOperate(inventory, inputSlot, outputSlot, infuseStored); } - BasicMachineRecipe recipe = recipeType.getRecipe(inventory[inputSlot]); + BasicMachineRecipe recipe = recipeType.getRecipe(inventory.get(inputSlot)); return recipe != null && recipe.canOperate(inventory, inputSlot, outputSlot); @@ -716,19 +676,19 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I if(recipeType.usesFuel()) { - AdvancedMachineRecipe recipe = recipeType.getRecipe(inventory[inputSlot], gasTank.getGasType()); + AdvancedMachineRecipe recipe = recipeType.getRecipe(inventory.get(inputSlot), gasTank.getGasType()); recipe.operate(inventory, inputSlot, outputSlot, gasTank, secondaryEnergyThisTick); } else if(recipeType == RecipeType.INFUSING) { - InfusionInput input = new InfusionInput(infuseStored, inventory[inputSlot]); + InfusionInput input = new InfusionInput(infuseStored, inventory.get(inputSlot)); MetallurgicInfuserRecipe recipe = RecipeHandler.getMetallurgicInfuserRecipe(input); recipe.output(inventory, inputSlot, outputSlot, infuseStored); } else { - BasicMachineRecipe recipe = recipeType.getRecipe(inventory[inputSlot]); + BasicMachineRecipe recipe = recipeType.getRecipe(inventory.get(inputSlot)); recipe.operate(inventory, inputSlot, outputSlot); } @@ -762,12 +722,10 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I if(FMLCommonHandler.instance().getEffectiveSide().isClient()) { - clientActive = dataStream.readBoolean(); RecipeType oldRecipe = recipeType; recipeType = RecipeType.values()[dataStream.readInt()]; upgradeComponent.setSupported(Upgrade.GAS, recipeType.fuelEnergyUpgrades()); recipeTicks = dataStream.readInt(); - controlType = RedstoneControl.values()[dataStream.readInt()]; sorting = dataStream.readBoolean(); upgraded = dataStream.readBoolean(); lastUsage = dataStream.readDouble(); @@ -776,11 +734,11 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I if(recipeType != oldRecipe) { - secondaryEnergyPerTick = getSecondaryEnergyPerTick(recipeType); + setRecipeType(recipeType); if(!upgraded) { - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } @@ -796,18 +754,11 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I else { gasTank.setGas(null); } - - if(updateDelay == 0 && clientActive != isActive) - { - updateDelay = general.UPDATE_DELAY; - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } if(upgraded) { markDirty(); - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); upgraded = false; } } @@ -818,18 +769,9 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I { super.readFromNBT(nbtTags); - clientActive = isActive = nbtTags.getBoolean("isActive"); - RecipeType oldRecipe = recipeType; - recipeType = RecipeType.values()[nbtTags.getInteger("recipeType")]; + setRecipeType(RecipeType.values()[nbtTags.getInteger("recipeType")]); upgradeComponent.setSupported(Upgrade.GAS, recipeType.fuelEnergyUpgrades()); - - if(recipeType != oldRecipe) - { - secondaryEnergyPerTick = getSecondaryEnergyPerTick(recipeType); - } - recipeTicks = nbtTags.getInteger("recipeTicks"); - controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")]; sorting = nbtTags.getBoolean("sorting"); infuseStored.amount = nbtTags.getInteger("infuseStored"); infuseStored.type = InfuseRegistry.get(nbtTags.getString("type")); @@ -847,10 +789,8 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I { super.writeToNBT(nbtTags); - nbtTags.setBoolean("isActive", isActive); nbtTags.setInteger("recipeType", recipeType.ordinal()); nbtTags.setInteger("recipeTicks", recipeTicks); - nbtTags.setInteger("controlType", controlType.ordinal()); nbtTags.setBoolean("sorting", sorting); nbtTags.setInteger("infuseStored", infuseStored.amount); @@ -877,10 +817,8 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I { super.getNetworkedData(data); - data.add(isActive); data.add(recipeType.ordinal()); data.add(recipeTicks); - data.add(controlType.ordinal()); data.add(sorting); data.add(upgraded); data.add(lastUsage); @@ -992,26 +930,6 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I } } - @Override - public void setActive(boolean active) - { - isActive = active; - - if(clientActive != active && updateDelay == 0) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - - updateDelay = 10; - clientActive = active; - } - } - - @Override - public boolean getActive() - { - return isActive; - } - @Override public int[] getSlotsForFace(EnumFacing side) { @@ -1055,43 +973,6 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I } } - @Override - public boolean renderUpdate() - { - return true; - } - - @Override - public boolean lightUpdate() - { - return true; - } - - @Override - public RedstoneControl getControlType() - { - return controlType; - } - - @Override - public void setControlType(RedstoneControl type) - { - controlType = type; - MekanismUtils.saveChunk(this); - } - - @Override - public boolean canPulse() - { - return false; - } - - @Override - public TileComponentUpgrade getComponent() - { - return upgradeComponent; - } - @Override public TileComponentEjector getEjector() { @@ -1178,10 +1059,6 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I energyPerTick = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_PER_TICK); secondaryEnergyPerTick = getSecondaryEnergyPerTick(recipeType); break; - case ENERGY: - energyPerTick = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_PER_TICK); - maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); - break; default: break; } @@ -1206,10 +1083,4 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I { return tier.getBaseTier().getLocalizedName() + " " + recipeType.getLocalizedName() + " " + super.getName(); } - - @Override - public TileComponentSecurity getSecurity() - { - return securityComponent; - } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/tile/TileEntityFluidTank.java b/src/main/java/mekanism/common/tile/TileEntityFluidTank.java index 53615084c..4258ca120 100644 --- a/src/main/java/mekanism/common/tile/TileEntityFluidTank.java +++ b/src/main/java/mekanism/common/tile/TileEntityFluidTank.java @@ -6,9 +6,7 @@ import java.util.ArrayList; import mekanism.api.Coord4D; import mekanism.api.IConfigurable; -import mekanism.api.MekanismConfig.general; import mekanism.api.Range4D; -import mekanism.api.util.CapabilityUtils; import mekanism.common.Mekanism; import mekanism.common.PacketHandler; import mekanism.common.Tier.BaseTier; @@ -21,11 +19,14 @@ import mekanism.common.base.ISustainedTank; import mekanism.common.base.ITankManager; import mekanism.common.base.ITierUpgradeable; import mekanism.common.capabilities.Capabilities; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.security.ISecurityTile; import mekanism.common.tile.component.TileComponentSecurity; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import mekanism.common.util.FluidContainerUtils; import mekanism.common.util.FluidContainerUtils.ContainerEditMode; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; @@ -37,6 +38,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.MathHelper; import net.minecraftforge.common.capabilities.Capability; @@ -81,7 +83,7 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc super("FluidTank"); fluidTank = new FluidTank(tier.storage); - inventory = new ItemStack[2]; + inventory = NonNullList.withSize(2, ItemStack.EMPTY); } @Override @@ -110,7 +112,7 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc @Override public void onUpdate() { - if(worldObj.isRemote) + if(world.isRemote) { if(updateDelay > 0) { @@ -119,7 +121,7 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc if(updateDelay == 0 && clientActive != isActive) { isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } @@ -160,7 +162,7 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc prevAmount = fluidTank.getFluidAmount(); - if(inventory[0] != null) + if(!inventory.get(0).isEmpty()) { manageInventory(); } @@ -197,7 +199,7 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc { if(fluidTank.getFluid() != null) { - TileEntity tileEntity = Coord4D.get(this).offset(EnumFacing.DOWN).getTileEntity(worldObj); + TileEntity tileEntity = Coord4D.get(this).offset(EnumFacing.DOWN).getTileEntity(world); if(tileEntity != null && CapabilityUtils.hasCapability(tileEntity, CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, EnumFacing.UP)) { @@ -210,7 +212,7 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc private void manageInventory() { - if(FluidContainerUtils.isFluidContainer(inventory[0])) + if(FluidContainerUtils.isFluidContainer(inventory.get(0))) { FluidStack ret = FluidContainerUtils.handleContainerItem(this, inventory, editMode, fluidTank.getFluid(), getCurrentNeeded(), 0, 1, null); @@ -244,9 +246,9 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc { Coord4D up = Coord4D.get(this).offset(EnumFacing.UP); - if(up.getTileEntity(worldObj) instanceof TileEntityFluidTank) + if(up.getTileEntity(world) instanceof TileEntityFluidTank) { - IFluidHandler handler = CapabilityUtils.getCapability(up.getTileEntity(worldObj), CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, EnumFacing.DOWN); + IFluidHandler handler = CapabilityUtils.getCapability(up.getTileEntity(world), CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, EnumFacing.DOWN); if(PipeUtils.canFill(handler, fluid)) { @@ -361,7 +363,7 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc { updateDelay = general.UPDATE_DELAY; isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } } @@ -369,7 +371,7 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc public int getRedstoneLevel() { double fractionFull = (float)fluidTank.getFluidAmount()/(float)fluidTank.getCapacity(); - return MathHelper.floor_float((float)(fractionFull * 14.0F)) + (fractionFull > 0 ? 1 : 0); + return MathHelper.floor((float)(fractionFull * 14.0F)) + (fractionFull > 0 ? 1 : 0); } public int getCurrentNeeded() @@ -382,7 +384,7 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc } Coord4D top = Coord4D.get(this).offset(EnumFacing.UP); - TileEntity topTile = top.getTileEntity(worldObj); + TileEntity topTile = top.getTileEntity(world); if(topTile instanceof TileEntityFluidTank) { @@ -465,10 +467,10 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc @Override public EnumActionResult onSneakRightClick(EntityPlayer player, EnumFacing side) { - if(!worldObj.isRemote) + if(!world.isRemote) { setActive(!getActive()); - worldObj.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), SoundEvents.UI_BUTTON_CLICK, SoundCategory.BLOCKS, 0.3F, 1); + world.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), SoundEvents.UI_BUTTON_CLICK, SoundCategory.BLOCKS, 0.3F, 1); } return EnumActionResult.SUCCESS; @@ -562,10 +564,9 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc @Override public boolean canFill(EnumFacing from, Fluid fluid) { - if(from == EnumFacing.DOWN && worldObj != null && getPos() != null) + TileEntity tile = world.getTileEntity(getPos().offset(EnumFacing.DOWN)); + if(from == EnumFacing.DOWN && world != null && getPos() != null) { - TileEntity tile = worldObj.getTileEntity(getPos().offset(EnumFacing.DOWN)); - if(isActive && !(tile instanceof TileEntityFluidTank)) { return false; @@ -576,7 +577,13 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc { return true; } - + + if(isActive && tile instanceof TileEntityFluidTank) // Only fill if tanks underneath have same fluid. + { + return (fluidTank.getFluid() == null && ((TileEntityFluidTank)tile).canFill(EnumFacing.UP, fluid)) || + (fluidTank.getFluid() != null && fluidTank.getFluid().getFluid() == fluid); + } + return fluidTank.getFluid() == null || fluidTank.getFluid().getFluid() == fluid; } diff --git a/src/main/java/mekanism/common/tile/TileEntityFluidicPlenisher.java b/src/main/java/mekanism/common/tile/TileEntityFluidicPlenisher.java index 735e175c7..16158e3d8 100644 --- a/src/main/java/mekanism/common/tile/TileEntityFluidicPlenisher.java +++ b/src/main/java/mekanism/common/tile/TileEntityFluidicPlenisher.java @@ -10,8 +10,6 @@ import java.util.Set; import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.IConfigurable; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.usage; import mekanism.common.Upgrade; import mekanism.common.base.FluidHandlerWrapper; import mekanism.common.base.IFluidHandlerWrapper; @@ -20,10 +18,13 @@ import mekanism.common.base.ISustainedTank; import mekanism.common.base.IUpgradeTile; import mekanism.common.block.states.BlockStateMachine.MachineType; import mekanism.common.capabilities.Capabilities; -import mekanism.common.integration.IComputerIntegration; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.config.MekanismConfig.usage; +import mekanism.common.integration.computer.IComputerIntegration; import mekanism.common.security.ISecurityTile; import mekanism.common.tile.component.TileComponentSecurity; import mekanism.common.tile.component.TileComponentUpgrade; +import mekanism.common.tile.prefab.TileEntityElectricBlock; import mekanism.common.util.ChargeUtils; import mekanism.common.util.FluidContainerUtils; import mekanism.common.util.FluidContainerUtils.FluidChecker; @@ -36,6 +37,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.text.TextComponentString; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.Constants.NBT; @@ -81,17 +83,17 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen public TileEntityFluidicPlenisher() { super("FluidicPlenisher", MachineType.FLUIDIC_PLENISHER.baseEnergy); - inventory = new ItemStack[4]; + inventory = NonNullList.withSize(4, ItemStack.EMPTY); } @Override public void onUpdate() { - if(!worldObj.isRemote) + if(!world.isRemote) { ChargeUtils.discharge(2, this); - if(FluidContainerUtils.isFluidContainer(inventory[0])) + if(FluidContainerUtils.isFluidContainer(inventory.get(0))) { FluidContainerUtils.handleContainerItemEmpty(this, fluidTank, 0, 1, new FluidChecker() { @Override @@ -125,7 +127,7 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen { if(fluidTank.getFluid().getFluid().canBePlacedInWorld()) { - worldObj.setBlockState(below.getPos(), MekanismUtils.getFlowingBlock(fluidTank.getFluid().getFluid()).getDefaultState(), 3); + world.setBlockState(below.getPos(), MekanismUtils.getFlowingBlock(fluidTank.getFluid().getFluid()).getDefaultState(), 3); setEnergy(getEnergy() - energyPerTick); fluidTank.drain(Fluid.BUCKET_VOLUME, true); @@ -171,11 +173,11 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen for(Coord4D coord : activeNodes) { - if(coord.exists(worldObj)) + if(coord.exists(world)) { if(canReplace(coord, true, false)) { - worldObj.setBlockState(coord.getPos(), MekanismUtils.getFlowingBlock(fluidTank.getFluid().getFluid()).getDefaultState(), 3); + world.setBlockState(coord.getPos(), MekanismUtils.getFlowingBlock(fluidTank.getFluid().getFluid()).getDefaultState(), 3); fluidTank.drain(Fluid.BUCKET_VOLUME, true); } @@ -184,7 +186,7 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen { Coord4D sideCoord = coord.offset(dir); - if(sideCoord.exists(worldObj) && canReplace(sideCoord, true, true)) + if(sideCoord.exists(world) && canReplace(sideCoord, true, true)) { activeNodes.add(sideCoord); } @@ -209,17 +211,17 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen return false; } - if(coord.isAirBlock(worldObj) || MekanismUtils.isDeadFluid(worldObj, coord)) + if(coord.isAirBlock(world) || MekanismUtils.isDeadFluid(world, coord)) { return true; } - if(MekanismUtils.isFluid(worldObj, coord)) + if(MekanismUtils.isFluid(world, coord)) { return isPathfinding; } - return coord.getBlock(worldObj).isReplaceable(worldObj, coord.getPos()); + return coord.getBlock(world).isReplaceable(world, coord.getPos()); } @Override @@ -479,7 +481,7 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen usedNodes.clear(); finishedCalc = false; - player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.configurator.plenisherReset"))); + player.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.configurator.plenisherReset"))); return EnumActionResult.SUCCESS; } @@ -555,6 +557,7 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen case ENERGY: energyPerTick = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_PER_TICK); maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); + setEnergy(Math.min(getMaxEnergy(), getEnergy())); default: break; } diff --git a/src/main/java/mekanism/common/tile/TileEntityFormulaicAssemblicator.java b/src/main/java/mekanism/common/tile/TileEntityFormulaicAssemblicator.java index 9aedb7eea..59f40c4b5 100644 --- a/src/main/java/mekanism/common/tile/TileEntityFormulaicAssemblicator.java +++ b/src/main/java/mekanism/common/tile/TileEntityFormulaicAssemblicator.java @@ -3,12 +3,11 @@ package mekanism.common.tile; import io.netty.buffer.ByteBuf; import java.util.ArrayList; +import java.util.List; import mekanism.api.EnumColor; import mekanism.api.IConfigCardAccess; -import mekanism.api.MekanismConfig.usage; import mekanism.api.transmitters.TransmissionType; -import mekanism.api.util.StackUtils; import mekanism.common.PacketHandler; import mekanism.common.SideData; import mekanism.common.Upgrade; @@ -17,6 +16,7 @@ import mekanism.common.base.ISideConfiguration; import mekanism.common.base.IUpgradeTile; import mekanism.common.block.states.BlockStateMachine.MachineType; import mekanism.common.capabilities.Capabilities; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.content.assemblicator.RecipeFormula; import mekanism.common.item.ItemCraftingFormula; import mekanism.common.security.ISecurityTile; @@ -24,13 +24,16 @@ import mekanism.common.tile.component.TileComponentConfig; import mekanism.common.tile.component.TileComponentEjector; import mekanism.common.tile.component.TileComponentSecurity; import mekanism.common.tile.component.TileComponentUpgrade; +import mekanism.common.tile.prefab.TileEntityElectricBlock; import mekanism.common.util.ChargeUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.StackUtils; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -52,6 +55,9 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im public boolean isRecipe = false; + public boolean stockControl = false; + public boolean needsOrganize = true; //organize on load + public int pulseOperations; public RecipeFormula formula; @@ -63,9 +69,9 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im public TileComponentConfig configComponent; public TileComponentSecurity securityComponent; - public ItemStack lastFormulaStack; + public ItemStack lastFormulaStack = ItemStack.EMPTY; public boolean needsFormulaUpdate = false; - public ItemStack lastOutputStack; + public ItemStack lastOutputStack = ItemStack.EMPTY; public TileEntityFormulaicAssemblicator() { @@ -82,7 +88,7 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im configComponent.setConfig(TransmissionType.ITEM, new byte[] {0, 0, 0, 3, 1, 2}); configComponent.setInputConfig(TransmissionType.ENERGY); - inventory = new ItemStack[36]; + inventory = NonNullList.withSize(36, ItemStack.EMPTY); upgradeComponent = new TileComponentUpgrade(this, 0); @@ -97,8 +103,14 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im { super.onUpdate(); - if(!worldObj.isRemote) + if(!world.isRemote) { + if(formula != null && stockControl && needsOrganize) + { + needsOrganize = false; + organizeStock(); + } + ChargeUtils.discharge(1, this); if(controlType != RedstoneControl.PULSE) @@ -112,11 +124,11 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im RecipeFormula prev = formula; - if(inventory[2] != null && inventory[2].getItem() instanceof ItemCraftingFormula) + if(!inventory.get(2).isEmpty() && inventory.get(2).getItem() instanceof ItemCraftingFormula) { - ItemCraftingFormula item = (ItemCraftingFormula)inventory[2].getItem(); + ItemCraftingFormula item = (ItemCraftingFormula)inventory.get(2).getItem(); - if(formula == null || lastFormulaStack != inventory[2]) + if(formula == null || lastFormulaStack != inventory.get(2)) { loadFormula(); } @@ -130,7 +142,7 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im needsFormulaUpdate = true; } - lastFormulaStack = inventory[2]; + lastFormulaStack = inventory.get(2); if(autoMode && formula == null) { @@ -184,15 +196,15 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im public void loadFormula() { - ItemCraftingFormula item = (ItemCraftingFormula)inventory[2].getItem(); + ItemCraftingFormula item = (ItemCraftingFormula)inventory.get(2).getItem(); - if(item.getInventory(inventory[2]) != null && !item.isInvalid(inventory[2])) + if(item.getInventory(inventory.get(2)) != null && !item.isInvalid(inventory.get(2))) { - RecipeFormula itemFormula = new RecipeFormula(worldObj, item.getInventory(inventory[2])); + RecipeFormula itemFormula = new RecipeFormula(world, item.getInventory(inventory.get(2))); - if(itemFormula.isValidFormula(worldObj)) + if(itemFormula.isValidFormula(world)) { - if(formula != null && !formula.isFormulaEqual(worldObj, itemFormula)) + if(formula != null && !formula.isFormulaEqual(world, itemFormula)) { formula = itemFormula; operatingTicks = 0; @@ -204,7 +216,7 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im } else { formula = null; - item.setInvalid(inventory[2], true); + item.setInvalid(inventory.get(2), true); } } else { @@ -217,22 +229,24 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im { super.markDirty(); - if(worldObj != null && !worldObj.isRemote) + if(world != null && !world.isRemote) { if(formula == null) { for(int i = 0; i < 9; i++) { - dummyInv.setInventorySlotContents(i, inventory[27+i]); + dummyInv.setInventorySlotContents(i, inventory.get(27+i)); } - lastOutputStack = MekanismUtils.findMatchingRecipe(dummyInv, worldObj); - isRecipe = lastOutputStack != null; + lastOutputStack = MekanismUtils.findMatchingRecipe(dummyInv, world); + isRecipe = !lastOutputStack.isEmpty(); } else { - isRecipe = formula.matches(worldObj, inventory, 27); - lastOutputStack = isRecipe ? formula.recipe.getRecipeOutput() : null; + isRecipe = formula.matches(world, inventory, 27); + lastOutputStack = isRecipe ? formula.recipe.getRecipeOutput() : ItemStack.EMPTY; } + + needsOrganize = true; } } @@ -240,38 +254,33 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im { for(int i = 0; i < 9; i++) { - dummyInv.setInventorySlotContents(i, inventory[27+i]); + dummyInv.setInventorySlotContents(i, inventory.get(27+i)); } ItemStack output = lastOutputStack; - if(output != null && tryMoveToOutput(output, false)) + if(!output.isEmpty() && tryMoveToOutput(output, false)) { tryMoveToOutput(output, true); for(int i = 27; i <= 35; i++) { - if(inventory[i] != null) + if(!inventory.get(i).isEmpty()) { - ItemStack stack = inventory[i]; + ItemStack stack = inventory.get(i); - inventory[i].stackSize--; + inventory.get(i).shrink(1); - if(inventory[i].stackSize == 0) - { - inventory[i] = null; - } - - if(stack.stackSize == 0 && stack.getItem().hasContainerItem(stack)) + if(stack.getCount() == 0 && stack.getItem().hasContainerItem(stack)) { ItemStack container = stack.getItem().getContainerItem(stack); - if(container != null && container.isItemStackDamageable() && container.getItemDamage() > container.getMaxDamage()) + if(!container.isEmpty() && container.isItemStackDamageable() && container.getItemDamage() > container.getMaxDamage()) { - container = null; + container = ItemStack.EMPTY; } - if(container != null) + if(!container.isEmpty()) { boolean move = tryMoveToOutput(container.copy(), false); @@ -280,7 +289,7 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im tryMoveToOutput(container.copy(), true); } - inventory[i] = move ? null : container.copy(); + inventory.set(i, move ? ItemStack.EMPTY : container.copy()); } } } @@ -305,7 +314,7 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im { boolean canOperate = true; - if(!formula.matches(worldObj, inventory, 27)) + if(!formula.matches(world, inventory, 27)) { canOperate = moveItemsToGrid(); } @@ -328,17 +337,17 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im for(int i = 27; i <= 35; i++) { - if(formula.isIngredientInPos(worldObj, inventory[i], i-27)) + if(formula.isIngredientInPos(world, inventory.get(i), i-27)) { continue; } - if(inventory[i] != null) + if(!inventory.get(i).isEmpty()) { - inventory[i] = tryMoveToInput(inventory[i]); + inventory.set(i, tryMoveToInput(inventory.get(i))); markDirty(); - if(inventory[i] != null) + if(!inventory.get(i).isEmpty()) { ret = false; } @@ -346,17 +355,12 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im else { boolean found = false; - for(int j = 3; j <= 20; j++) + for(int j = 20; j >= 3; j--) { - if(inventory[j] != null && formula.isIngredientInPos(worldObj, inventory[j], i-27)) + if(!inventory.get(j).isEmpty() && formula.isIngredientInPos(world, inventory.get(j), i-27)) { - inventory[i] = StackUtils.size(inventory[j], 1); - inventory[j].stackSize--; - - if(inventory[j].stackSize == 0) - { - inventory[j] = null; - } + inventory.set(i, StackUtils.size(inventory.get(j), 1)); + inventory.get(j).shrink(1); markDirty(); found = true; @@ -384,9 +388,9 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im { for(int i = 27; i <= 35; i++) { - if(inventory[i] != null && (forcePush || (formula != null && !formula.isIngredientInPos(worldObj, inventory[i], i-27)))) + if(!inventory.get(i).isEmpty() && (forcePush || (formula != null && !formula.isIngredientInPos(world, inventory.get(i), i-27)))) { - inventory[i] = tryMoveToInput(inventory[i]); + inventory.set(i, tryMoveToInput(inventory.get(i))); } } @@ -409,28 +413,72 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im markDirty(); } + private void toggleStockControl() + { + if(!world.isRemote && formula != null) + { + stockControl = !stockControl; + + if(stockControl) + { + organizeStock(); + } + } + } + + private void organizeStock() + { + for(int j = 3; j <= 20; j++) + { + for(int i = 20; i > j; i--) + { + if(!inventory.get(i).isEmpty()) + { + if(inventory.get(j).isEmpty()) + { + inventory.set(j, inventory.get(i)); + inventory.set(i, ItemStack.EMPTY); + markDirty(); + return; + } + else if(inventory.get(j).getCount() < inventory.get(j).getMaxStackSize()) + { + if(InventoryUtils.areItemsStackable(inventory.get(i), inventory.get(j))) + { + int newCount = inventory.get(j).getCount() + inventory.get(i).getCount(); + inventory.get(j).setCount(Math.min(inventory.get(j).getMaxStackSize(), newCount)); + inventory.get(i).setCount(Math.max(0, newCount - inventory.get(j).getMaxStackSize())); + markDirty(); + return; + } + } + } + } + } + } + private ItemStack tryMoveToInput(ItemStack stack) { stack = stack.copy(); for(int i = 3; i <= 20; i++) { - if(inventory[i] == null) + if(inventory.get(i).isEmpty()) { - inventory[i] = stack; + inventory.set(i, stack); - return null; + return ItemStack.EMPTY; } - else if(InventoryUtils.areItemsStackable(stack, inventory[i]) && inventory[i].stackSize < inventory[i].getMaxStackSize()) + else if(InventoryUtils.areItemsStackable(stack, inventory.get(i)) && inventory.get(i).getCount() < inventory.get(i).getMaxStackSize()) { - int toUse = Math.min(stack.stackSize, inventory[i].getMaxStackSize()-inventory[i].stackSize); + int toUse = Math.min(stack.getCount(), inventory.get(i).getMaxStackSize()-inventory.get(i).getCount()); - inventory[i].stackSize += toUse; - stack.stackSize -= toUse; + inventory.get(i).grow(toUse); + stack.shrink(toUse); - if(stack.stackSize == 0) + if(stack.getCount() == 0) { - return null; + return ItemStack.EMPTY; } } } @@ -444,27 +492,27 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im for(int i = 21; i <= 26; i++) { - if(inventory[i] == null) + if(inventory.get(i).isEmpty()) { if(doMove) { - inventory[i] = stack; + inventory.set(i, stack); } return true; } - else if(InventoryUtils.areItemsStackable(stack, inventory[i]) && inventory[i].stackSize < inventory[i].getMaxStackSize()) + else if(InventoryUtils.areItemsStackable(stack, inventory.get(i)) && inventory.get(i).getCount() < inventory.get(i).getMaxStackSize()) { - int toUse = Math.min(stack.stackSize, inventory[i].getMaxStackSize()-inventory[i].stackSize); + int toUse = Math.min(stack.getCount(), inventory.get(i).getMaxStackSize()-inventory.get(i).getCount()); if(doMove) { - inventory[i].stackSize += toUse; + inventory.get(i).grow(toUse); } - stack.stackSize -= toUse; + stack.shrink(toUse); - if(stack.stackSize == 0) + if(stack.getCount() == 0) { return true; } @@ -476,17 +524,18 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im private void encodeFormula() { - if(inventory[2] != null && inventory[2].getItem() instanceof ItemCraftingFormula) + if(!inventory.get(2).isEmpty() && inventory.get(2).getItem() instanceof ItemCraftingFormula) { - ItemCraftingFormula item = (ItemCraftingFormula)inventory[2].getItem(); + ItemCraftingFormula item = (ItemCraftingFormula)inventory.get(2).getItem(); - if(item.getInventory(inventory[2]) == null) + if(item.getInventory(inventory.get(2)) == null) { - RecipeFormula formula = new RecipeFormula(worldObj, inventory, 27); + RecipeFormula formula = new RecipeFormula(world, inventory, 27); - if(formula.isValidFormula(worldObj)) + if(formula.isValidFormula(world)) { - item.setInventory(inventory[2], formula.input); + item.setInventory(inventory.get(2), formula.input); + markDirty(); } } } @@ -529,7 +578,31 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im return true; } else { - return formula.isIngredient(worldObj, itemstack); + List indices = formula.getIngredientIndices(world, itemstack); + + if(indices.size() > 0) + { + if(stockControl) + { + int filled = 0; + + for(int i = 3; i < 20; i++) + { + if(!inventory.get(i).isEmpty()) + { + if(formula.isIngredientInPos(world, inventory.get(i), indices.get(0))) + { + filled++; + } + } + } + + return filled < indices.size()*2; + } + else { + return true; + } + } } } else if(slotID == 1) @@ -549,6 +622,7 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im operatingTicks = nbtTags.getInteger("operatingTicks"); controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")]; pulseOperations = nbtTags.getInteger("pulseOperations"); + stockControl = nbtTags.getBoolean("stockControl"); } @Override @@ -560,6 +634,7 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im nbtTags.setInteger("operatingTicks", operatingTicks); nbtTags.setInteger("controlType", controlType.ordinal()); nbtTags.setInteger("pulseOperations", pulseOperations); + nbtTags.setBoolean("stockControl", stockControl); return nbtTags; } @@ -597,6 +672,10 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im moveItemsToInput(true); } } + else if(type == 5) + { + toggleStockControl(); + } return; } @@ -609,22 +688,23 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im operatingTicks = dataStream.readInt(); controlType = RedstoneControl.values()[dataStream.readInt()]; isRecipe = dataStream.readBoolean(); + stockControl = dataStream.readBoolean(); if(dataStream.readBoolean()) { if(dataStream.readBoolean()) { - ItemStack[] inv = new ItemStack[9]; + NonNullList inv = NonNullList.withSize(9, ItemStack.EMPTY); for(int i = 0; i < 9; i++) { if(dataStream.readBoolean()) { - inv[i] = PacketHandler.readStack(dataStream); + inv.set(i, PacketHandler.readStack(dataStream)); } } - formula = new RecipeFormula(worldObj, inv); + formula = new RecipeFormula(world, inv); } else { formula = null; @@ -642,6 +722,7 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im data.add(operatingTicks); data.add(controlType.ordinal()); data.add(isRecipe); + data.add(stockControl); if(needsFormulaUpdate) { @@ -653,10 +734,10 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im for(int i = 0; i < 9; i++) { - if(formula.input[i] != null) + if(!formula.input.get(i).isEmpty()) { data.add(true); - data.add(formula.input[i]); + data.add(formula.input.get(i)); } else { data.add(false); @@ -734,9 +815,13 @@ public class TileEntityFormulaicAssemblicator extends TileEntityElectricBlock im { case SPEED: ticksRequired = MekanismUtils.getTicks(this, BASE_TICKS_REQUIRED); + energyPerTick = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_PER_TICK); + break; case ENERGY: energyPerTick = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_PER_TICK); maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); + setEnergy(Math.min(getMaxEnergy(), getEnergy())); + break; default: break; } diff --git a/src/main/java/mekanism/common/tile/TileEntityFuelwoodHeater.java b/src/main/java/mekanism/common/tile/TileEntityFuelwoodHeater.java index 76a1bd0f3..b9b501fef 100644 --- a/src/main/java/mekanism/common/tile/TileEntityFuelwoodHeater.java +++ b/src/main/java/mekanism/common/tile/TileEntityFuelwoodHeater.java @@ -6,15 +6,16 @@ import java.util.ArrayList; import mekanism.api.Coord4D; import mekanism.api.IHeatTransfer; -import mekanism.api.MekanismConfig.general; import mekanism.api.Range4D; -import mekanism.api.util.CapabilityUtils; import mekanism.common.Mekanism; import mekanism.common.base.IActiveState; import mekanism.common.capabilities.Capabilities; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.security.ISecurityTile; import mekanism.common.tile.component.TileComponentSecurity; +import mekanism.common.tile.prefab.TileEntityContainerBlock; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.HeatUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.item.ItemStack; @@ -22,6 +23,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -49,24 +51,24 @@ public class TileEntityFuelwoodHeater extends TileEntityContainerBlock implement public TileEntityFuelwoodHeater() { super("FuelwoodHeater"); - inventory = new ItemStack[1]; + inventory = NonNullList.withSize(1, ItemStack.EMPTY); } @Override public void onUpdate() { - if(worldObj.isRemote && updateDelay > 0) + if(world.isRemote && updateDelay > 0) { updateDelay--; if(updateDelay == 0 && clientActive != isActive) { isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } - if(!worldObj.isRemote) + if(!world.isRemote) { if(updateDelay > 0) { @@ -86,17 +88,17 @@ public class TileEntityFuelwoodHeater extends TileEntityContainerBlock implement burning = true; } else { - if(inventory[0] != null) + if(!inventory.get(0).isEmpty()) { - maxBurnTime = burnTime = TileEntityFurnace.getItemBurnTime(inventory[0])/2; + maxBurnTime = burnTime = TileEntityFurnace.getItemBurnTime(inventory.get(0))/2; if(burnTime > 0) { - inventory[0].stackSize--; + inventory.get(0).shrink(1); - if(inventory[0].stackSize == 0) + if(inventory.get(0).getCount() == 0) { - inventory[0] = inventory[0].getItem().getContainerItem(inventory[0]); + inventory.set(0, inventory.get(0).getItem().getContainerItem(inventory.get(0))); } burning = true; @@ -160,7 +162,7 @@ public class TileEntityFuelwoodHeater extends TileEntityContainerBlock implement { updateDelay = general.UPDATE_DELAY; isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } } @@ -272,7 +274,7 @@ public class TileEntityFuelwoodHeater extends TileEntityContainerBlock implement @Override public IHeatTransfer getAdjacent(EnumFacing side) { - TileEntity adj = Coord4D.get(this).offset(side).getTileEntity(worldObj); + TileEntity adj = Coord4D.get(this).offset(side).getTileEntity(world); if(CapabilityUtils.hasCapability(adj, Capabilities.HEAT_TRANSFER_CAPABILITY, side.getOpposite())) { diff --git a/src/main/java/mekanism/common/tile/TileEntityGasTank.java b/src/main/java/mekanism/common/tile/TileEntityGasTank.java index 12c17f4d3..03f899970 100644 --- a/src/main/java/mekanism/common/tile/TileEntityGasTank.java +++ b/src/main/java/mekanism/common/tile/TileEntityGasTank.java @@ -11,7 +11,6 @@ import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; -import mekanism.api.gas.GasTransmission; import mekanism.api.gas.IGasHandler; import mekanism.api.gas.IGasItem; import mekanism.api.gas.ITubeConnection; @@ -24,11 +23,14 @@ import mekanism.common.base.IRedstoneControl; import mekanism.common.base.ISideConfiguration; import mekanism.common.base.ITierUpgradeable; import mekanism.common.capabilities.Capabilities; +import mekanism.common.integration.computer.IComputerIntegration; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.security.ISecurityTile; import mekanism.common.tile.component.TileComponentConfig; import mekanism.common.tile.component.TileComponentEjector; import mekanism.common.tile.component.TileComponentSecurity; +import mekanism.common.tile.prefab.TileEntityContainerBlock; +import mekanism.common.util.GasUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; @@ -37,11 +39,12 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.MathHelper; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; -public class TileEntityGasTank extends TileEntityContainerBlock implements IGasHandler, ITubeConnection, IRedstoneControl, ISideConfiguration, ISecurityTile, ITierUpgradeable +public class TileEntityGasTank extends TileEntityContainerBlock implements IGasHandler, ITubeConnection, IRedstoneControl, ISideConfiguration, ISecurityTile, ITierUpgradeable, IComputerIntegration { public enum GasMode { @@ -67,6 +70,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH public TileComponentEjector ejectorComponent; public TileComponentConfig configComponent; public TileComponentSecurity securityComponent; + private static final String[] methods = new String[] {"getMaxGas", "getStoredGas", "getGas"}; public TileEntityGasTank() { @@ -84,7 +88,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH configComponent.setEjecting(TransmissionType.GAS, true); gasTank = new GasTank(tier.storage); - inventory = new ItemStack[2]; + inventory = NonNullList.withSize(2, ItemStack.EMPTY); dumping = GasMode.IDLE; controlType = RedstoneControl.DISABLED; @@ -96,16 +100,16 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH @Override public void onUpdate() { - if(!worldObj.isRemote) + if(!world.isRemote) { - if(inventory[0] != null && gasTank.getGas() != null) + if(!inventory.get(0).isEmpty() && gasTank.getGas() != null) { - gasTank.draw(GasTransmission.addGas(inventory[0], gasTank.getGas()), tier != GasTankTier.CREATIVE); + gasTank.draw(GasUtils.addGas(inventory.get(0), gasTank.getGas()), tier != GasTankTier.CREATIVE); } - if(inventory[1] != null && (gasTank.getGas() == null || gasTank.getGas().amount < gasTank.getMaxGas())) + if(!inventory.get(1).isEmpty() && (gasTank.getGas() == null || gasTank.getGas().amount < gasTank.getMaxGas())) { - gasTank.receive(GasTransmission.removeGas(inventory[1], gasTank.getGasType(), gasTank.getNeeded()), true); + gasTank.receive(GasUtils.removeGas(inventory.get(1), gasTank.getGasType(), gasTank.getNeeded()), true); if(tier == GasTankTier.CREATIVE && gasTank.getGas() != null) { @@ -118,7 +122,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH if(configComponent.isEjecting(TransmissionType.GAS)) { GasStack toSend = new GasStack(gasTank.getGas().getGas(), Math.min(gasTank.getStored(), tier.output)); - gasTank.draw(GasTransmission.emit(toSend, this, configComponent.getSidesForData(TransmissionType.GAS, facing, 2)), tier != GasTankTier.CREATIVE); + gasTank.draw(GasUtils.emit(toSend, this, configComponent.getSidesForData(TransmissionType.GAS, facing, 2)), tier != GasTankTier.CREATIVE); } } @@ -309,7 +313,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH if(prevTier != tier) { - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } } @@ -377,7 +381,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH public int getRedstoneLevel() { double fractionFull = (float)gasTank.getStored()/(float)gasTank.getMaxGas(); - return MathHelper.floor_float((float)(fractionFull * 14.0F)) + (fractionFull > 0 ? 1 : 0); + return MathHelper.floor((float)(fractionFull * 14.0F)) + (fractionFull > 0 ? 1 : 0); } @Override @@ -421,4 +425,26 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH { return securityComponent; } + + @Override + public String[] getMethods() + { + return methods; + } + + @Override + public Object[] invoke(int method, Object[] arguments) throws Exception + { + switch(method) + { + case 0: + return new Object[] {gasTank.getMaxGas()}; + case 1: + return new Object[] {gasTank.getStored()}; + case 2: + return new Object[] {gasTank.getGas()}; + default: + throw new NoSuchMethodException(); + } + } } diff --git a/src/main/java/mekanism/common/tile/TileEntityGlowPanel.java b/src/main/java/mekanism/common/tile/TileEntityGlowPanel.java new file mode 100644 index 000000000..39d712c7d --- /dev/null +++ b/src/main/java/mekanism/common/tile/TileEntityGlowPanel.java @@ -0,0 +1,108 @@ +package mekanism.common.tile; + +import io.netty.buffer.ByteBuf; + +import java.util.ArrayList; + +import mekanism.api.Coord4D; +import mekanism.api.EnumColor; +import mekanism.common.Mekanism; +import mekanism.common.base.ITileNetwork; +import mekanism.common.block.property.PropertyColor; +import mekanism.common.block.states.BlockStateFacing; +import mekanism.common.capabilities.Capabilities; +import mekanism.common.network.PacketDataRequest.DataRequestMessage; +import mekanism.common.util.MekanismUtils; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.property.IExtendedBlockState; + +public class TileEntityGlowPanel extends TileEntity implements ITileNetwork +{ + public EnumColor colour = EnumColor.WHITE; + public EnumFacing side = EnumFacing.DOWN; + + public void setColour(EnumColor newColour) + { + colour = newColour; + } + + public void setOrientation(EnumFacing newSide) + { + side = newSide; + } + + @Override + public void handlePacketData(ByteBuf dataStream) throws Exception + { + side = EnumFacing.getFront(dataStream.readInt()); + colour = EnumColor.DYES[dataStream.readInt()]; + + MekanismUtils.updateBlock(world, pos); + } + + @Override + public ArrayList getNetworkedData(ArrayList data) + { + data.add(side.ordinal()); + data.add(colour.getMetaValue()); + + return data; + } + + @Override + public void validate() + { + super.validate(); + + if(world.isRemote) + { + Mekanism.packetHandler.sendToServer(new DataRequestMessage(Coord4D.get(this))); + } + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound nbt) + { + super.writeToNBT(nbt); + + nbt.setInteger("side", side.ordinal()); + nbt.setInteger("colour", colour.getMetaValue()); + + return nbt; + } + + @Override + public void readFromNBT(NBTTagCompound nbt) + { + super.readFromNBT(nbt); + + side = EnumFacing.getFront(nbt.getInteger("side")); + colour = EnumColor.DYES[nbt.getInteger("colour")]; + } + + @Override + public boolean hasCapability(Capability capability, EnumFacing facing) + { + return capability == Capabilities.TILE_NETWORK_CAPABILITY || super.hasCapability(capability, facing); + } + + @Override + public T getCapability(Capability capability, EnumFacing facing) + { + if(capability == Capabilities.TILE_NETWORK_CAPABILITY) + return (T)this; + return super.getCapability(capability, facing); + } + + public static int hash(IExtendedBlockState state) + { + int hash = 1; + hash = 31 * hash + state.getValue(PropertyColor.INSTANCE).color.ordinal(); + hash = 31 * hash + state.getValue(BlockStateFacing.facingProperty).ordinal(); + + return hash; + } +} diff --git a/src/main/java/mekanism/common/tile/TileEntityInductionCasing.java b/src/main/java/mekanism/common/tile/TileEntityInductionCasing.java index cd2c68bd2..b02c921bc 100644 --- a/src/main/java/mekanism/common/tile/TileEntityInductionCasing.java +++ b/src/main/java/mekanism/common/tile/TileEntityInductionCasing.java @@ -12,7 +12,7 @@ import mekanism.common.capabilities.Capabilities; import mekanism.common.content.matrix.MatrixCache; import mekanism.common.content.matrix.MatrixUpdateProtocol; import mekanism.common.content.matrix.SynchronizedMatrixData; -import mekanism.common.integration.IComputerIntegration; +import mekanism.common.integration.computer.IComputerIntegration; import mekanism.common.multiblock.MultiblockManager; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.util.ChargeUtils; @@ -21,6 +21,7 @@ import mekanism.common.util.MekanismUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -37,7 +38,7 @@ public class TileEntityInductionCasing extends TileEntityMultiblock())), new Range4D(Coord4D.get(this))); - player.openGui(Mekanism.instance, 49, worldObj, getPos().getX(), getPos().getY(), getPos().getZ()); + player.openGui(Mekanism.instance, 49, world, getPos().getX(), getPos().getY(), getPos().getZ()); return true; } @@ -82,7 +83,7 @@ public class TileEntityInductionCasing extends TileEntityMultiblock())), new Range4D(Coord4D.get(this))); markDirty(); @@ -503,21 +509,23 @@ public class TileEntityInductionPort extends TileEntityInductionCasing implement { return capability == Capabilities.ENERGY_STORAGE_CAPABILITY || capability == Capabilities.ENERGY_ACCEPTOR_CAPABILITY - || capability == Capabilities.CABLE_OUTPUTTER_CAPABILITY + || capability == Capabilities.ENERGY_OUTPUTTER_CAPABILITY || capability == Capabilities.TESLA_HOLDER_CAPABILITY || capability == Capabilities.CONFIGURABLE_CAPABILITY || (capability == Capabilities.TESLA_CONSUMER_CAPABILITY && getConsumingSides().contains(facing)) || (capability == Capabilities.TESLA_PRODUCER_CAPABILITY && getOutputtingSides().contains(facing)) + || capability == CapabilityEnergy.ENERGY || super.hasCapability(capability, facing); } - private CapabilityWrapperManager teslaManager = new CapabilityWrapperManager(TileEntityElectricBlock.class, TeslaIntegration.class); + private CapabilityWrapperManager teslaManager = new CapabilityWrapperManager(IEnergyWrapper.class, TeslaIntegration.class); + private CapabilityWrapperManager forgeEnergyManager = new CapabilityWrapperManager(IEnergyWrapper.class, ForgeEnergyIntegration.class); @Override public T getCapability(Capability capability, EnumFacing facing) { if(capability == Capabilities.ENERGY_STORAGE_CAPABILITY || capability == Capabilities.ENERGY_ACCEPTOR_CAPABILITY || - capability == Capabilities.CABLE_OUTPUTTER_CAPABILITY || capability == Capabilities.CONFIGURABLE_CAPABILITY) + capability == Capabilities.ENERGY_OUTPUTTER_CAPABILITY || capability == Capabilities.CONFIGURABLE_CAPABILITY) { return (T)this; } @@ -529,6 +537,11 @@ public class TileEntityInductionPort extends TileEntityInductionCasing implement return (T)teslaManager.getWrapper(this, facing); } + if(capability == CapabilityEnergy.ENERGY) + { + return (T)forgeEnergyManager.getWrapper(this, facing); + } + return super.getCapability(capability, facing); } } \ No newline at end of file diff --git a/src/main/java/mekanism/common/tile/TileEntityInductionProvider.java b/src/main/java/mekanism/common/tile/TileEntityInductionProvider.java index 0c2e9ebde..bc6b782c5 100644 --- a/src/main/java/mekanism/common/tile/TileEntityInductionProvider.java +++ b/src/main/java/mekanism/common/tile/TileEntityInductionProvider.java @@ -5,6 +5,7 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; import mekanism.common.Tier.InductionProviderTier; +import mekanism.common.tile.prefab.TileEntityBasicBlock; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.nbt.NBTTagCompound; @@ -34,7 +35,7 @@ public class TileEntityInductionProvider extends TileEntityBasicBlock if(prevTier != tier) { - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } } diff --git a/src/main/java/mekanism/common/tile/TileEntityLaser.java b/src/main/java/mekanism/common/tile/TileEntityLaser.java index 068671c59..720666852 100644 --- a/src/main/java/mekanism/common/tile/TileEntityLaser.java +++ b/src/main/java/mekanism/common/tile/TileEntityLaser.java @@ -6,25 +6,27 @@ import java.util.ArrayList; import java.util.EnumSet; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.usage; import mekanism.api.Range4D; import mekanism.api.lasers.ILaserReceptor; import mekanism.common.LaserManager; import mekanism.common.LaserManager.LaserInfo; import mekanism.common.Mekanism; import mekanism.common.base.IActiveState; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.network.PacketTileEntity.TileEntityMessage; +import mekanism.common.tile.prefab.TileEntityNoisyBlock; import mekanism.common.util.MekanismUtils; import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.RayTraceResult; import net.minecraftforge.fml.common.FMLCommonHandler; -public class TileEntityLaser extends TileEntityNoisyElectricBlock implements IActiveState +public class TileEntityLaser extends TileEntityNoisyBlock implements IActiveState { public Coord4D digging; public double diggingProgress; @@ -36,7 +38,7 @@ public class TileEntityLaser extends TileEntityNoisyElectricBlock implements IAc public TileEntityLaser() { super("machine.laser", "Laser", 2*usage.laserUsage); - inventory = new ItemStack[0]; + inventory = NonNullList.withSize(0, ItemStack.EMPTY); } @Override @@ -44,12 +46,12 @@ public class TileEntityLaser extends TileEntityNoisyElectricBlock implements IAc { super.onUpdate(); - if(worldObj.isRemote) + if(world.isRemote) { if(isActive) { - RayTraceResult mop = LaserManager.fireLaserClient(this, facing, usage.laserUsage, worldObj); - Coord4D hitCoord = mop == null ? null : new Coord4D(mop, worldObj); + RayTraceResult mop = LaserManager.fireLaserClient(this, facing, usage.laserUsage, world); + Coord4D hitCoord = mop == null ? null : new Coord4D(mop, world); if(hitCoord == null || !hitCoord.equals(digging)) { @@ -59,9 +61,9 @@ public class TileEntityLaser extends TileEntityNoisyElectricBlock implements IAc if(hitCoord != null) { - IBlockState blockHit = hitCoord.getBlockState(worldObj); - TileEntity tileHit = hitCoord.getTileEntity(worldObj); - float hardness = blockHit.getBlockHardness(worldObj, hitCoord.getPos()); + IBlockState blockHit = hitCoord.getBlockState(world); + TileEntity tileHit = hitCoord.getTileEntity(world); + float hardness = blockHit.getBlockHardness(world, hitCoord.getPos()); if(!(hardness < 0 || (LaserManager.isReceptor(tileHit, mop.sideHit) && !(LaserManager.getReceptor(tileHit, mop.sideHit).canLasersDig())))) { @@ -80,8 +82,8 @@ public class TileEntityLaser extends TileEntityNoisyElectricBlock implements IAc { setActive(true); - LaserInfo info = LaserManager.fireLaser(this, facing, usage.laserUsage, worldObj); - Coord4D hitCoord = info.movingPos == null ? null : new Coord4D(info.movingPos, worldObj); + LaserInfo info = LaserManager.fireLaser(this, facing, usage.laserUsage, world); + Coord4D hitCoord = info.movingPos == null ? null : new Coord4D(info.movingPos, world); if(hitCoord == null || !hitCoord.equals(digging)) { @@ -91,9 +93,9 @@ public class TileEntityLaser extends TileEntityNoisyElectricBlock implements IAc if(hitCoord != null) { - IBlockState blockHit = hitCoord.getBlockState(worldObj); - TileEntity tileHit = hitCoord.getTileEntity(worldObj); - float hardness = blockHit.getBlockHardness(worldObj, hitCoord.getPos()); + IBlockState blockHit = hitCoord.getBlockState(world); + TileEntity tileHit = hitCoord.getTileEntity(world); + float hardness = blockHit.getBlockHardness(world, hitCoord.getPos()); if(!(hardness < 0 || (LaserManager.isReceptor(tileHit, info.movingPos.sideHit) && !(LaserManager.getReceptor(tileHit, info.movingPos.sideHit).canLasersDig())))) { @@ -101,7 +103,7 @@ public class TileEntityLaser extends TileEntityNoisyElectricBlock implements IAc if(diggingProgress >= hardness*general.laserEnergyNeededPerHardness) { - LaserManager.breakBlock(hitCoord, true, worldObj); + LaserManager.breakBlock(hitCoord, true, world); diggingProgress = 0; } } @@ -174,7 +176,7 @@ public class TileEntityLaser extends TileEntityNoisyElectricBlock implements IAc if(clientActive != isActive) { isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } } diff --git a/src/main/java/mekanism/common/tile/TileEntityLaserAmplifier.java b/src/main/java/mekanism/common/tile/TileEntityLaserAmplifier.java index 2718fc52a..3be4ba8e4 100644 --- a/src/main/java/mekanism/common/tile/TileEntityLaserAmplifier.java +++ b/src/main/java/mekanism/common/tile/TileEntityLaserAmplifier.java @@ -5,8 +5,7 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; -import mekanism.api.energy.ICableOutputter; +import mekanism.api.energy.IStrictEnergyOutputter; import mekanism.api.energy.IStrictEnergyStorage; import mekanism.api.lasers.ILaserReceptor; import mekanism.common.LaserManager; @@ -14,10 +13,12 @@ import mekanism.common.LaserManager.LaserInfo; import mekanism.common.Mekanism; import mekanism.common.base.IRedstoneControl; import mekanism.common.capabilities.Capabilities; -import mekanism.common.integration.IComputerIntegration; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.integration.computer.IComputerIntegration; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.security.ISecurityTile; import mekanism.common.tile.component.TileComponentSecurity; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.block.state.IBlockState; @@ -25,12 +26,13 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; -public class TileEntityLaserAmplifier extends TileEntityContainerBlock implements ILaserReceptor, IRedstoneControl, ICableOutputter, IStrictEnergyStorage, IComputerIntegration, ISecurityTile +public class TileEntityLaserAmplifier extends TileEntityContainerBlock implements ILaserReceptor, IRedstoneControl, IStrictEnergyOutputter, IStrictEnergyStorage, IComputerIntegration, ISecurityTile { public static final double MAX_ENERGY = 5E9; public double collectedEnergy = 0; @@ -58,7 +60,7 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement public TileEntityLaserAmplifier() { super("LaserAmplifier"); - inventory = new ItemStack[0]; + inventory = NonNullList.withSize(0, ItemStack.EMPTY); } @Override @@ -76,12 +78,12 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement @Override public void onUpdate() { - if(worldObj.isRemote) + if(world.isRemote) { if(on) { - RayTraceResult mop = LaserManager.fireLaserClient(this, facing, lastFired, worldObj); - Coord4D hitCoord = mop == null ? null : new Coord4D(mop, worldObj); + RayTraceResult mop = LaserManager.fireLaserClient(this, facing, lastFired, world); + Coord4D hitCoord = mop == null ? null : new Coord4D(mop, world); if(hitCoord == null || !hitCoord.equals(digging)) { @@ -91,9 +93,9 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement if(hitCoord != null) { - IBlockState blockHit = hitCoord.getBlockState(worldObj); - TileEntity tileHit = hitCoord.getTileEntity(worldObj); - float hardness = blockHit.getBlockHardness(worldObj, hitCoord.getPos()); + IBlockState blockHit = hitCoord.getBlockState(world); + TileEntity tileHit = hitCoord.getTileEntity(world); + float hardness = blockHit.getBlockHardness(world, hitCoord.getPos()); if(!(hardness < 0 || (LaserManager.isReceptor(tileHit, mop.sideHit) && !(LaserManager.getReceptor(tileHit, mop.sideHit).canLasersDig())))) { @@ -132,8 +134,8 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D)); } - LaserInfo info = LaserManager.fireLaser(this, facing, firing, worldObj); - Coord4D hitCoord = info.movingPos == null ? null : new Coord4D(info.movingPos, worldObj); + LaserInfo info = LaserManager.fireLaser(this, facing, firing, world); + Coord4D hitCoord = info.movingPos == null ? null : new Coord4D(info.movingPos, world); if(hitCoord == null || !hitCoord.equals(digging)) { @@ -143,9 +145,9 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement if(hitCoord != null) { - IBlockState blockHit = hitCoord.getBlockState(worldObj); - TileEntity tileHit = hitCoord.getTileEntity(worldObj); - float hardness = blockHit.getBlockHardness(worldObj, hitCoord.getPos()); + IBlockState blockHit = hitCoord.getBlockState(world); + TileEntity tileHit = hitCoord.getTileEntity(world); + float hardness = blockHit.getBlockHardness(world, hitCoord.getPos()); if(!(hardness < 0 || (LaserManager.isReceptor(tileHit, info.movingPos.sideHit) && !(LaserManager.getReceptor(tileHit, info.movingPos.sideHit).canLasersDig())))) { @@ -153,7 +155,7 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement if(diggingProgress >= hardness*general.laserEnergyNeededPerHardness) { - LaserManager.breakBlock(hitCoord, true, worldObj); + LaserManager.breakBlock(hitCoord, true, world); diggingProgress = 0; } } @@ -185,10 +187,23 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement if(emittingRedstone != prevRedstone) { - worldObj.notifyNeighborsOfStateChange(getPos(), getBlockType()); + world.notifyNeighborsOfStateChange(getPos(), getBlockType(), true); } } } + + @Override + public double pullEnergy(EnumFacing side, double amount, boolean simulate) + { + double toGive = Math.min(getEnergy(), amount); + + if(!simulate) + { + setEnergy(getEnergy() - toGive); + } + + return toGive; + } @Override public void setEnergy(double energy) @@ -220,7 +235,7 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement } double fractionFull = getEnergy()/getMaxEnergy(); - return MathHelper.floor_float((float)(fractionFull * 14.0F)) + (fractionFull > 0 ? 1 : 0); + return MathHelper.floor((float)(fractionFull * 14.0F)) + (fractionFull > 0 ? 1 : 0); } @Override @@ -332,7 +347,7 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement } @Override - public boolean canOutputTo(EnumFacing side) + public boolean canOutputEnergy(EnumFacing side) { return true; } @@ -375,7 +390,7 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement public boolean hasCapability(Capability capability, EnumFacing facing) { return capability == Capabilities.ENERGY_STORAGE_CAPABILITY - || capability == Capabilities.CABLE_OUTPUTTER_CAPABILITY + || capability == Capabilities.ENERGY_OUTPUTTER_CAPABILITY || capability == Capabilities.LASER_RECEPTOR_CAPABILITY || super.hasCapability(capability, facing); } @@ -385,7 +400,7 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement { if(capability == Capabilities.ENERGY_STORAGE_CAPABILITY) return (T)this; - if(capability == Capabilities.CABLE_OUTPUTTER_CAPABILITY) + if(capability == Capabilities.ENERGY_OUTPUTTER_CAPABILITY) return (T)this; if(capability == Capabilities.LASER_RECEPTOR_CAPABILITY) return (T)this; diff --git a/src/main/java/mekanism/common/tile/TileEntityLaserTractorBeam.java b/src/main/java/mekanism/common/tile/TileEntityLaserTractorBeam.java index 7c3852ee0..a679ef391 100644 --- a/src/main/java/mekanism/common/tile/TileEntityLaserTractorBeam.java +++ b/src/main/java/mekanism/common/tile/TileEntityLaserTractorBeam.java @@ -6,22 +6,24 @@ import java.util.ArrayList; import java.util.List; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; import mekanism.api.lasers.ILaserReceptor; -import mekanism.api.util.StackUtils; import mekanism.common.LaserManager; import mekanism.common.LaserManager.LaserInfo; import mekanism.common.Mekanism; import mekanism.common.capabilities.Capabilities; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.security.ISecurityTile; import mekanism.common.tile.component.TileComponentSecurity; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import mekanism.common.util.InventoryUtils; +import mekanism.common.util.StackUtils; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.RayTraceResult; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -44,7 +46,7 @@ public class TileEntityLaserTractorBeam extends TileEntityContainerBlock impleme public TileEntityLaserTractorBeam() { super("LaserTractorBeam"); - inventory = new ItemStack[27]; + inventory = NonNullList.withSize(27, ItemStack.EMPTY); } @Override @@ -62,12 +64,12 @@ public class TileEntityLaserTractorBeam extends TileEntityContainerBlock impleme @Override public void onUpdate() { - if(worldObj.isRemote) + if(world.isRemote) { if(on) { - RayTraceResult mop = LaserManager.fireLaserClient(this, facing, lastFired, worldObj); - Coord4D hitCoord = mop == null ? null : new Coord4D(mop, worldObj); + RayTraceResult mop = LaserManager.fireLaserClient(this, facing, lastFired, world); + Coord4D hitCoord = mop == null ? null : new Coord4D(mop, world); if(hitCoord == null || !hitCoord.equals(digging)) { @@ -77,9 +79,9 @@ public class TileEntityLaserTractorBeam extends TileEntityContainerBlock impleme if(hitCoord != null) { - IBlockState blockHit = hitCoord.getBlockState(worldObj); - TileEntity tileHit = hitCoord.getTileEntity(worldObj); - float hardness = blockHit.getBlockHardness(worldObj, hitCoord.getPos()); + IBlockState blockHit = hitCoord.getBlockState(world); + TileEntity tileHit = hitCoord.getTileEntity(world); + float hardness = blockHit.getBlockHardness(world, hitCoord.getPos()); if(!(hardness < 0 || (LaserManager.isReceptor(tileHit, mop.sideHit) && !(LaserManager.getReceptor(tileHit, mop.sideHit).canLasersDig())))) { @@ -106,8 +108,8 @@ public class TileEntityLaserTractorBeam extends TileEntityContainerBlock impleme Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D)); } - LaserInfo info = LaserManager.fireLaser(this, facing, firing, worldObj); - Coord4D hitCoord = info.movingPos == null ? null : new Coord4D(info.movingPos, worldObj); + LaserInfo info = LaserManager.fireLaser(this, facing, firing, world); + Coord4D hitCoord = info.movingPos == null ? null : new Coord4D(info.movingPos, world); if(hitCoord == null || !hitCoord.equals(digging)) { @@ -117,9 +119,9 @@ public class TileEntityLaserTractorBeam extends TileEntityContainerBlock impleme if(hitCoord != null) { - IBlockState blockHit = hitCoord.getBlockState(worldObj); - TileEntity tileHit = hitCoord.getTileEntity(worldObj); - float hardness = blockHit.getBlockHardness(worldObj, hitCoord.getPos()); + IBlockState blockHit = hitCoord.getBlockState(world); + TileEntity tileHit = hitCoord.getTileEntity(world); + float hardness = blockHit.getBlockHardness(world, hitCoord.getPos()); if(!(hardness < 0 || (LaserManager.isReceptor(tileHit, info.movingPos.sideHit) && !(LaserManager.getReceptor(tileHit, info.movingPos.sideHit).canLasersDig())))) { @@ -127,7 +129,7 @@ public class TileEntityLaserTractorBeam extends TileEntityContainerBlock impleme if(diggingProgress >= hardness * general.laserEnergyNeededPerHardness) { - List drops = LaserManager.breakBlock(hitCoord, false, worldObj); + List drops = LaserManager.breakBlock(hitCoord, false, world); if(drops != null) receiveDrops(drops); diggingProgress = 0; } @@ -160,34 +162,37 @@ public class TileEntityLaserTractorBeam extends TileEntityContainerBlock impleme outer: for(ItemStack drop : drops) { - for(int i = 0; i < inventory.length; i++) + for(int i = 0; i < inventory.size(); i++) { - if(inventory[i] == null) + if(inventory.get(i).isEmpty()) { - inventory[i] = drop; + inventory.set(i, drop); continue outer; } - ItemStack slot = inventory[i]; + + ItemStack slot = inventory.get(i); + if(StackUtils.equalsWildcardWithNBT(slot, drop)) { - int change = Math.min(drop.stackSize, slot.getMaxStackSize() - slot.stackSize); - slot.stackSize += change; - drop.stackSize -= change; - if(drop.stackSize <= 0) continue outer; + int change = Math.min(drop.getCount(), slot.getMaxStackSize() - slot.getCount()); + slot.grow(change); + drop.shrink(change); + if(drop.getCount() <= 0) continue outer; } } + dropItem(drop); } } public void dropItem(ItemStack stack) { - EntityItem item = new EntityItem(worldObj, getPos().getX() + 0.5, getPos().getY() + 1, getPos().getZ() + 0.5, stack); - item.motionX = worldObj.rand.nextGaussian() * 0.05; - item.motionY = worldObj.rand.nextGaussian() * 0.05 + 0.2; - item.motionZ = worldObj.rand.nextGaussian() * 0.05; + EntityItem item = new EntityItem(world, getPos().getX() + 0.5, getPos().getY() + 1, getPos().getZ() + 0.5, stack); + item.motionX = world.rand.nextGaussian() * 0.05; + item.motionY = world.rand.nextGaussian() * 0.05 + 0.2; + item.motionZ = world.rand.nextGaussian() * 0.05; item.setPickupDelay(10); - worldObj.spawnEntityInWorld(item); + world.spawnEntity(item); } @Override diff --git a/src/main/java/mekanism/common/tile/TileEntityLogisticalSorter.java b/src/main/java/mekanism/common/tile/TileEntityLogisticalSorter.java index 3a20aa8d8..ce830d93d 100644 --- a/src/main/java/mekanism/common/tile/TileEntityLogisticalSorter.java +++ b/src/main/java/mekanism/common/tile/TileEntityLogisticalSorter.java @@ -4,13 +4,12 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; import java.util.EnumSet; +import java.util.Iterator; import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.IConfigCardAccess.ISpecialConfigData; -import mekanism.api.MekanismConfig.client; import mekanism.api.Range4D; -import mekanism.api.util.CapabilityUtils; import mekanism.common.HashList; import mekanism.common.Mekanism; import mekanism.common.MekanismSounds; @@ -20,33 +19,41 @@ import mekanism.common.base.IRedstoneControl; import mekanism.common.base.ISustainedData; import mekanism.common.block.states.BlockStateMachine; import mekanism.common.capabilities.Capabilities; -import mekanism.common.content.transporter.Finder.FirstFinder; +import mekanism.common.config.MekanismConfig.client; +import mekanism.common.content.transporter.Finder; import mekanism.common.content.transporter.InvStack; import mekanism.common.content.transporter.StackSearcher; import mekanism.common.content.transporter.TItemStackFilter; +import mekanism.common.content.transporter.TOreDictFilter; +import mekanism.common.content.transporter.TransitRequest; +import mekanism.common.content.transporter.TransitRequest.TransitResponse; import mekanism.common.content.transporter.TransporterFilter; -import mekanism.common.content.transporter.TransporterManager; +import mekanism.common.integration.computer.IComputerIntegration; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.security.ISecurityTile; import mekanism.common.tile.component.TileComponentSecurity; +import mekanism.common.tile.prefab.TileEntityElectricBlock; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.StackUtils; import mekanism.common.util.TransporterUtils; 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.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.SoundCategory; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.fml.common.FMLCommonHandler; -public class TileEntityLogisticalSorter extends TileEntityElectricBlock implements IRedstoneControl, IActiveState, ISpecialConfigData, ISustainedData, ISecurityTile +public class TileEntityLogisticalSorter extends TileEntityElectricBlock implements IRedstoneControl, IActiveState, ISpecialConfigData, ISustainedData, ISecurityTile, IComputerIntegration { public HashList filters = new HashList(); @@ -75,7 +82,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen public TileEntityLogisticalSorter() { super("LogisticalSorter", BlockStateMachine.MachineType.LOGISTICAL_SORTER.baseEnergy); - inventory = new ItemStack[1]; + inventory = NonNullList.withSize(1, ItemStack.EMPTY); doAutoSync = false; } @@ -84,7 +91,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen { super.onUpdate(); - if(!worldObj.isRemote) + if(!world.isRemote) { delayTicks = Math.max(0, delayTicks-1); @@ -95,75 +102,67 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen if(MekanismUtils.canFunction(this) && delayTicks == 0) { - TileEntity back = Coord4D.get(this).offset(facing.getOpposite()).getTileEntity(worldObj); - TileEntity front = Coord4D.get(this).offset(facing).getTileEntity(worldObj); + TileEntity back = Coord4D.get(this).offset(facing.getOpposite()).getTileEntity(world); + TileEntity front = Coord4D.get(this).offset(facing).getTileEntity(world); - if(back instanceof IInventory && (front != null && CapabilityUtils.hasCapability(front, Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, facing.getOpposite()) || front instanceof IInventory)) + boolean sentItems = false; + int min = 0; + + outer: + for(TransporterFilter filter : filters) { - IInventory inventory = InventoryUtils.checkChestInv((IInventory)back); - - boolean sentItems = false; - int min = 0; - - outer: - for(TransporterFilter filter : filters) + inner: + for(StackSearcher search = new StackSearcher(back, facing.getOpposite()); search.i >= 0;) { - inner: - for(StackSearcher search = new StackSearcher(inventory, facing.getOpposite()); search.i >= 0;) + InvStack invStack = filter.getStackFromInventory(search); + + if(invStack == null || invStack.getStack().isEmpty()) { - InvStack invStack = filter.getStackFromInventory(search); - - if(invStack == null || invStack.getStack() == null) - { - break inner; - } - - if(filter.canFilter(invStack.getStack())) - { - if(filter instanceof TItemStackFilter) - { - TItemStackFilter itemFilter = (TItemStackFilter)filter; - - if(itemFilter.sizeMode) - { - min = itemFilter.min; - } - } - - ItemStack used = emitItemToTransporter(front, invStack, filter.color, min); - - if(used != null) - { - invStack.use(used.stackSize); - inventory.markDirty(); - setActive(true); - sentItems = true; - - break outer; - } - } + break inner; } - } - if(!sentItems && autoEject) - { - InvStack invStack = InventoryUtils.takeTopStack(inventory, facing.getOpposite(), new FirstFinder()); - - if(invStack != null && invStack.getStack() != null) + if(filter.canFilter(invStack.getStack(), true)) { - ItemStack used = emitItemToTransporter(front, invStack, color, 0); + if(filter instanceof TItemStackFilter) + { + TItemStackFilter itemFilter = (TItemStackFilter)filter; + + if(itemFilter.sizeMode) + { + min = itemFilter.min; + } + } - if(used != null) + TransitRequest request = TransitRequest.getFromStack(invStack.getStack()); + TransitResponse response = emitItemToTransporter(front, request, filter.color, min); + + if(!response.isEmpty()) { - invStack.use(used.stackSize); - inventory.markDirty(); + invStack.use(response.stack.getCount()); + back.markDirty(); setActive(true); + sentItems = true; + + break outer; } } } - - delayTicks = 10; } + + if(!sentItems && autoEject) + { + TransitRequest request = TransitRequest.getTopStacks(back, facing.getOpposite(), 64, new StrictFilterFinder()); + TransitResponse response = emitItemToTransporter(front, request, color, 0); + + if(!response.isEmpty()) + { + response.getInvStack(back, facing).use(response.stack.getCount()); + back.markDirty(); + setActive(true); + } + } + + delayTicks = 10; } if(playersUsing.size() > 0) @@ -176,46 +175,23 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen } } - /* - * Returns used - */ - public ItemStack emitItemToTransporter(TileEntity front, InvStack inInventory, EnumColor filterColor, int min) + public TransitResponse emitItemToTransporter(TileEntity front, TransitRequest request, EnumColor filterColor, int min) { - ItemStack used = null; - if(CapabilityUtils.hasCapability(front, Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, facing.getOpposite())) { ILogisticalTransporter transporter = CapabilityUtils.getCapability(front, Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, facing.getOpposite()); if(!roundRobin) { - ItemStack rejects = TransporterUtils.insert(this, transporter, inInventory.getStack(), filterColor, true, min); - - if(TransporterManager.didEmit(inInventory.getStack(), rejects)) - { - used = TransporterManager.getToUse(inInventory.getStack(), rejects); - } + return TransporterUtils.insert(this, transporter, request, filterColor, true, min); } else { - ItemStack rejects = TransporterUtils.insertRR(this, transporter, inInventory.getStack(), filterColor, true, min); - - if(TransporterManager.didEmit(inInventory.getStack(), rejects)) - { - used = TransporterManager.getToUse(inInventory.getStack(), rejects); - } + return TransporterUtils.insertRR(this, transporter, request, filterColor, true, min); } } - else if(front instanceof IInventory) - { - ItemStack rejects = InventoryUtils.putStackInInventory((IInventory)front, inInventory.getStack(), facing, false); - - if(TransporterManager.didEmit(inInventory.getStack(), rejects)) - { - used = TransporterManager.getToUse(inInventory.getStack(), rejects); - } + else { + return InventoryUtils.putStackInInventory(front, request, facing, false); } - - return used; } @Override @@ -468,31 +444,20 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen public boolean canSendHome(ItemStack stack) { - TileEntity back = Coord4D.get(this).offset(facing.getOpposite()).getTileEntity(worldObj); - - if(back instanceof IInventory) - { - return InventoryUtils.canInsert(back, null, stack, facing.getOpposite(), true); - } - - return false; + TileEntity back = Coord4D.get(this).offset(facing.getOpposite()).getTileEntity(world); + return InventoryUtils.canInsert(back, null, stack, facing.getOpposite(), true); } public boolean hasInventory() { - return Coord4D.get(this).offset(facing.getOpposite()).getTileEntity(worldObj) instanceof IInventory; + TileEntity tile = Coord4D.get(this).offset(facing.getOpposite()).getTileEntity(world); + return TransporterUtils.isValidAcceptorOnSide(tile, facing.getOpposite()); } - public ItemStack sendHome(ItemStack stack) + public TransitResponse sendHome(ItemStack stack) { - TileEntity back = Coord4D.get(this).offset(facing.getOpposite()).getTileEntity(worldObj); - - if(back instanceof IInventory) - { - return InventoryUtils.putStackInInventory((IInventory)back, stack, facing.getOpposite(), true); - } - - return stack; + TileEntity back = Coord4D.get(this).offset(facing.getOpposite()).getTileEntity(world); + return InventoryUtils.putStackInInventory(back, TransitRequest.getFromStack(stack), facing.getOpposite(), true); } @Override @@ -527,7 +492,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen @Override public void openInventory(EntityPlayer player) { - if(!worldObj.isRemote) + if(!world.isRemote) { Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getFilterPacket(new ArrayList())), new Range4D(Coord4D.get(this))); } @@ -562,7 +527,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen if(active && client.enableMachineSounds) { - worldObj.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), MekanismSounds.CLICK, SoundCategory.BLOCKS, 0.3F, 1); + world.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), MekanismSounds.CLICK, SoundCategory.BLOCKS, 0.3F, 1); } clientActive = active; @@ -718,6 +683,159 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen } } + public String[] methods = {"setDefaultColor", "setRoundRobin", "setAutoEject", "addFilter", "removeFilter", "addOreFilter", "removeOreFilter"}; + + @Override + public String[] getMethods() + { + return methods; + } + + @Override + public Object[] invoke(int method, Object[] arguments) throws Exception + { + if(arguments.length > 0) + { + if(method == 0) + { + if(!(arguments[0] instanceof String)) + { + return new Object[] {"Invalid parameters."}; + } + + color = EnumColor.getFromDyeName((String)arguments[0]); + + if(color == null) + { + return new Object[] {"Default color set to null"}; + } + else { + return new Object[] {"Default color set to " + color.dyeName}; + } + } + else if(method == 1) + { + if(!(arguments[0] instanceof Boolean)) + { + return new Object[] {"Invalid parameters."}; + } + + roundRobin = (Boolean)arguments[0]; + + return new Object[] {"Round-robin mode set to " + roundRobin}; + } + else if(method == 2) + { + if(!(arguments[0] instanceof Boolean)) + { + return new Object[] {"Invalid parameters."}; + } + + autoEject = (Boolean)arguments[0]; + + return new Object[] {"Auto-eject mode set to " + autoEject}; + } + else if(method == 3) + { + if(arguments.length != 6 || !(arguments[0] instanceof String) || !(arguments[1] instanceof Double) || + !(arguments[2] instanceof String) || !(arguments[3] instanceof Boolean) || + !(arguments[4] instanceof Double) || !(arguments[5] instanceof Double)) + { + return new Object[] {"Invalid parameters."}; + } + + TItemStackFilter filter = new TItemStackFilter(); + filter.itemType = new ItemStack(Item.getByNameOrId((String)arguments[0]), 1, ((Double)arguments[1]).intValue()); + + if(filter.itemType.getItem() == null) + { + return new Object[] {"Invalid item type."}; + } + + filter.color = EnumColor.getFromDyeName((String)arguments[2]); + filter.sizeMode = (Boolean)arguments[3]; + filter.min = ((Double)arguments[4]).intValue(); + filter.max = ((Double)arguments[5]).intValue(); + filters.add(filter); + + return new Object[] {"Added filter."}; + } + else if(method == 4) + { + if(arguments.length != 2 || !(arguments[0] instanceof String) || !(arguments[1] instanceof Double)) + { + return new Object[] {"Invalid parameters."}; + } + + ItemStack stack = new ItemStack(Item.getByNameOrId((String)arguments[0]), 1, ((Double)arguments[1]).intValue()); + Iterator iter = filters.iterator(); + + while(iter.hasNext()) + { + TransporterFilter filter = iter.next(); + + if(filter instanceof TItemStackFilter) + { + if(StackUtils.equalsWildcard(((TItemStackFilter)filter).itemType, stack)) + { + iter.remove(); + return new Object[] {"Removed filter."}; + } + } + } + + return new Object[] {"Couldn't find filter."}; + } + else if(method == 5) + { + if(arguments.length != 2 || !(arguments[0] instanceof String) | !(arguments[1] instanceof String)) + { + return new Object[] {"Invalid parameters."}; + } + + TOreDictFilter filter = new TOreDictFilter(); + filter.oreDictName = (String)arguments[0]; + filter.color = EnumColor.getFromDyeName((String)arguments[1]); + filters.add(filter); + + return new Object[] {"Added filter."}; + } + else if(method == 6) + { + if(arguments.length != 1 || !(arguments[0] instanceof String)) + { + return new Object[] {"Invalid parameters."}; + } + + String ore = (String)arguments[0]; + Iterator iter = filters.iterator(); + + while(iter.hasNext()) + { + TransporterFilter filter = iter.next(); + + if(filter instanceof TOreDictFilter) + { + if(((TOreDictFilter)filter).oreDictName.equals(ore)) + { + iter.remove(); + return new Object[] {"Removed filter."}; + } + } + } + + return new Object[] {"Couldn't find filter."}; + } + } + + for(EntityPlayer player : playersUsing) + { + Mekanism.packetHandler.sendTo(new TileEntityMessage(Coord4D.get(this), getGenericPacket(new ArrayList())), (EntityPlayerMP)player); + } + + return null; + } + @Override public boolean hasCapability(Capability capability, EnumFacing side) { @@ -735,4 +853,21 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen return super.getCapability(capability, side); } + + private class StrictFilterFinder extends Finder + { + @Override + public boolean modifies(ItemStack stack) + { + for(TransporterFilter filter : filters) + { + if(filter.canFilter(stack, false) && !filter.allowDefault) + { + return false; + } + } + + return true; + } + } } diff --git a/src/main/java/mekanism/common/tile/TileEntityMetallurgicInfuser.java b/src/main/java/mekanism/common/tile/TileEntityMetallurgicInfuser.java index 80ad13a3c..a872f0900 100644 --- a/src/main/java/mekanism/common/tile/TileEntityMetallurgicInfuser.java +++ b/src/main/java/mekanism/common/tile/TileEntityMetallurgicInfuser.java @@ -4,17 +4,12 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; -import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.IConfigCardAccess; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.usage; -import mekanism.api.Range4D; import mekanism.api.infuse.InfuseObject; import mekanism.api.infuse.InfuseRegistry; import mekanism.api.transmitters.TransmissionType; import mekanism.common.InfuseStorage; -import mekanism.common.Mekanism; import mekanism.common.MekanismBlocks; import mekanism.common.MekanismItems; import mekanism.common.PacketHandler; @@ -22,76 +17,44 @@ import mekanism.common.SideData; import mekanism.common.Tier.BaseTier; import mekanism.common.Upgrade; import mekanism.common.base.IFactory.RecipeType; -import mekanism.common.base.IRedstoneControl; import mekanism.common.base.ISideConfiguration; import mekanism.common.base.ITierUpgradeable; -import mekanism.common.base.IUpgradeTile; import mekanism.common.block.states.BlockStateMachine; import mekanism.common.capabilities.Capabilities; -import mekanism.common.integration.IComputerIntegration; -import mekanism.common.network.PacketTileEntity.TileEntityMessage; +import mekanism.common.config.MekanismConfig.usage; +import mekanism.common.integration.computer.IComputerIntegration; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.recipe.inputs.InfusionInput; import mekanism.common.recipe.machines.MetallurgicInfuserRecipe; -import mekanism.common.security.ISecurityTile; import mekanism.common.tile.component.TileComponentConfig; import mekanism.common.tile.component.TileComponentEjector; import mekanism.common.tile.component.TileComponentSecurity; -import mekanism.common.tile.component.TileComponentUpgrade; +import mekanism.common.tile.prefab.TileEntityOperationalMachine; import mekanism.common.util.ChargeUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; -public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock implements IComputerIntegration, ISideConfiguration, IUpgradeTile, IRedstoneControl, IConfigCardAccess, ISecurityTile, ITierUpgradeable +public class TileEntityMetallurgicInfuser extends TileEntityOperationalMachine implements IComputerIntegration, ISideConfiguration, IConfigCardAccess, ITierUpgradeable { /** The maxiumum amount of infuse this machine can store. */ public int MAX_INFUSE = 1000; - /** How much energy this machine consumes per-tick. */ - public double BASE_ENERGY_PER_TICK = usage.metallurgicInfuserUsage; - - public double energyPerTick = BASE_ENERGY_PER_TICK; - - /** How many ticks it takes to run an operation. */ - public int BASE_TICKS_REQUIRED = 200; - - public int ticksRequired = BASE_TICKS_REQUIRED; - /** The amount of infuse this machine has stored. */ public InfuseStorage infuseStored = new InfuseStorage(); - /** How many ticks this machine has been operating for. */ - public int operatingTicks; - - /** Whether or not this machine is in it's active state. */ - public boolean isActive; - - /** The client's current active state. */ - public boolean clientActive; - - /** How many ticks must pass until this block's active state can sync with the client. */ - public int updateDelay; - - /** This machine's previous amount of energy. */ - public double prevEnergy; - - /** This machine's current RedstoneControl type. */ - public RedstoneControl controlType = RedstoneControl.DISABLED; - - public TileComponentUpgrade upgradeComponent; public TileComponentEjector ejectorComponent; public TileComponentConfig configComponent; - public TileComponentSecurity securityComponent; public TileEntityMetallurgicInfuser() { - super("machine.metalinfuser", "MetallurgicInfuser", BlockStateMachine.MachineType.METALLURGIC_INFUSER.baseEnergy); + super("machine.metalinfuser", "MetallurgicInfuser", BlockStateMachine.MachineType.METALLURGIC_INFUSER.baseEnergy, usage.metallurgicInfuserUsage, 0, 200); configComponent = new TileComponentConfig(this, TransmissionType.ITEM); @@ -103,10 +66,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i configComponent.setConfig(TransmissionType.ITEM, new byte[] {4, 0, 0, 3, 1, 2}); - inventory = new ItemStack[5]; - - upgradeComponent = new TileComponentUpgrade(this, 0); - upgradeComponent.setSupported(Upgrade.MUFFLING); + inventory = NonNullList.withSize(5, ItemStack.EMPTY); ejectorComponent = new TileComponentEjector(this); ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(2)); @@ -118,37 +78,16 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i public void onUpdate() { super.onUpdate(); - - if(worldObj.isRemote && updateDelay > 0) + + if(!world.isRemote) { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } - } - - if(!worldObj.isRemote) - { - if(updateDelay > 0) - { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - } - } - ChargeUtils.discharge(4, this); - if(inventory[1] != null) + if(!inventory.get(1).isEmpty()) { - if(InfuseRegistry.getObject(inventory[1]) != null) + if(InfuseRegistry.getObject(inventory.get(1)) != null) { - InfuseObject infuse = InfuseRegistry.getObject(inventory[1]); + InfuseObject infuse = InfuseRegistry.getObject(inventory.get(1)); if(infuseStored.type == null || infuseStored.type == infuse.type) { @@ -156,12 +95,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i { infuseStored.amount += infuse.stored; infuseStored.type = infuse.type; - inventory[1].stackSize--; - - if(inventory[1].stackSize <= 0) - { - inventory[1] = null; - } + inventory.get(1).shrink(1); } } } @@ -213,10 +147,10 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i return false; } - worldObj.setBlockToAir(getPos()); - worldObj.setBlockState(getPos(), MekanismBlocks.MachineBlock.getStateFromMeta(5), 3); + world.setBlockToAir(getPos()); + world.setBlockState(getPos(), MekanismBlocks.MachineBlock.getStateFromMeta(5), 3); - TileEntityFactory factory = (TileEntityFactory)worldObj.getTileEntity(getPos()); + TileEntityFactory factory = (TileEntityFactory)world.getTileEntity(getPos()); RecipeType type = RecipeType.INFUSING; //Basic @@ -257,11 +191,11 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i //Infuser factory.infuseStored = infuseStored; - factory.inventory[5] = inventory[2]; - factory.inventory[1] = inventory[4]; - factory.inventory[5+3] = inventory[3]; - factory.inventory[0] = inventory[0]; - factory.inventory[4] = inventory[1]; + factory.inventory.set(5, inventory.get(2)); + factory.inventory.set(1, inventory.get(4)); + factory.inventory.set(5+3, inventory.get(3)); + factory.inventory.set(0, inventory.get(0)); + factory.inventory.set(4, inventory.get(1)); for(Upgrade upgrade : factory.upgradeComponent.getSupportedTypes()) { @@ -335,7 +269,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i public InfusionInput getInput() { - return new InfusionInput(infuseStored, inventory[2]); + return new InfusionInput(infuseStored, inventory.get(2)); } public void operate(MetallurgicInfuserRecipe recipe) @@ -356,20 +290,12 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i return infuseStored.amount * i / MAX_INFUSE; } - public double getScaledProgress() - { - return ((double)operatingTicks) / ((double)ticksRequired); - } - @Override public void readFromNBT(NBTTagCompound nbtTags) { super.readFromNBT(nbtTags); - clientActive = isActive = nbtTags.getBoolean("isActive"); - operatingTicks = nbtTags.getInteger("operatingTicks"); infuseStored.amount = nbtTags.getInteger("infuseStored"); - controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")]; infuseStored.type = InfuseRegistry.get(nbtTags.getString("type")); } @@ -378,10 +304,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i { super.writeToNBT(nbtTags); - nbtTags.setBoolean("isActive", isActive); - nbtTags.setInteger("operatingTicks", operatingTicks); nbtTags.setInteger("infuseStored", infuseStored.amount); - nbtTags.setInteger("controlType", controlType.ordinal()); if(infuseStored.type != null) { @@ -409,18 +332,8 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i if(FMLCommonHandler.instance().getEffectiveSide().isClient()) { - clientActive = dataStream.readBoolean(); - operatingTicks = dataStream.readInt(); infuseStored.amount = dataStream.readInt(); - controlType = RedstoneControl.values()[dataStream.readInt()]; infuseStored.type = InfuseRegistry.get(PacketHandler.readString(dataStream)); - - if(updateDelay == 0 && clientActive != isActive) - { - updateDelay = general.UPDATE_DELAY; - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } } } @@ -429,10 +342,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i { super.getNetworkedData(data); - data.add(isActive); - data.add(operatingTicks); data.add(infuseStored.amount); - data.add(controlType.ordinal()); if(infuseStored.type != null) { @@ -491,26 +401,6 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i return side != 0 && side != 1; } - @Override - public void setActive(boolean active) - { - isActive = active; - - if(clientActive != active && updateDelay == 0) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - - updateDelay = 10; - clientActive = active; - } - } - - @Override - public boolean getActive() - { - return isActive; - } - @Override public TileComponentConfig getConfig() { @@ -523,72 +413,12 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i return facing; } - @Override - public boolean renderUpdate() - { - return false; - } - - @Override - public boolean lightUpdate() - { - return true; - } - - @Override - public RedstoneControl getControlType() - { - return controlType; - } - - @Override - public void setControlType(RedstoneControl type) - { - controlType = type; - MekanismUtils.saveChunk(this); - } - - @Override - public boolean canPulse() - { - return false; - } - - @Override - public TileComponentUpgrade getComponent() - { - return upgradeComponent; - } - @Override public TileComponentEjector getEjector() { return ejectorComponent; } - @Override - public TileComponentSecurity getSecurity() - { - return securityComponent; - } - - @Override - public void recalculateUpgradables(Upgrade upgrade) - { - super.recalculateUpgradables(upgrade); - - switch(upgrade) - { - case SPEED: - ticksRequired = MekanismUtils.getTicks(this, BASE_TICKS_REQUIRED); - case ENERGY: - energyPerTick = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_PER_TICK); - maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); - default: - break; - } - } - @Override public boolean hasCapability(Capability capability, EnumFacing side) { diff --git a/src/main/java/mekanism/common/tile/TileEntityMultiblock.java b/src/main/java/mekanism/common/tile/TileEntityMultiblock.java index 10c85fa31..f6aa6186d 100644 --- a/src/main/java/mekanism/common/tile/TileEntityMultiblock.java +++ b/src/main/java/mekanism/common/tile/TileEntityMultiblock.java @@ -14,16 +14,16 @@ import mekanism.common.multiblock.MultiblockManager; import mekanism.common.multiblock.SynchronizedData; import mekanism.common.multiblock.UpdateProtocol; import mekanism.common.network.PacketTileEntity.TileEntityMessage; -import net.minecraft.block.state.IBlockState; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.ItemStackHelper; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -59,7 +59,7 @@ public abstract class TileEntityMultiblock> extend @Override public void onUpdate() { - if(worldObj.isRemote) + if(world.isRemote) { if(structure == null) { @@ -77,18 +77,16 @@ public abstract class TileEntityMultiblock> extend prevStructure = clientHasStructure; } - if(playersUsing.size() > 0 && ((worldObj.isRemote && !clientHasStructure) || (!worldObj.isRemote && structure == null))) + if(playersUsing.size() > 0 && ((world.isRemote && !clientHasStructure) || (!world.isRemote && structure == null))) { for(EntityPlayer player : playersUsing) { - System.out.println(worldObj.isRemote + " " + clientHasStructure + " " + structure); - //player.closeScreen(); + player.closeScreen(); } } - if(!worldObj.isRemote) + if(!world.isRemote) { - //System.out.println(pos + " " + structure); if(structure == null) { isRendering = false; @@ -116,11 +114,11 @@ public abstract class TileEntityMultiblock> extend for(EnumFacing side : EnumFacing.VALUES) { Coord4D obj = Coord4D.get(this).offset(side); - TileEntity tile = obj.getTileEntity(worldObj); + TileEntity tile = obj.getTileEntity(world); - if(!obj.isAirBlock(worldObj) && (tile == null || tile.getClass() != getClass())) + if(!obj.isAirBlock(world) && (tile == null || tile.getClass() != getClass())) { - obj.getBlock(worldObj).onNeighborChange(worldObj, obj.getPos(), getPos()); + obj.getBlock(world).onNeighborChange(world, obj.getPos(), getPos()); } } @@ -131,7 +129,6 @@ public abstract class TileEntityMultiblock> extend if(structure != null) { - //System.out.println("Whee " + structure + " " + isInvalid()); getSynchronizedData().didTick = false; if(getSynchronizedData().inventoryID != null) @@ -147,7 +144,7 @@ public abstract class TileEntityMultiblock> extend @Override public void doUpdate() { - if(!worldObj.isRemote && (structure == null || !getSynchronizedData().didTick)) + if(!world.isRemote && (structure == null || !getSynchronizedData().didTick)) { getProtocol().doUpdate(); @@ -164,7 +161,7 @@ public abstract class TileEntityMultiblock> extend { for(Coord4D obj : getSynchronizedData().locations) { - TileEntityMultiblock tileEntity = (TileEntityMultiblock)obj.getTileEntity(worldObj); + TileEntityMultiblock tileEntity = (TileEntityMultiblock)obj.getTileEntity(world); if(tileEntity != null && tileEntity.isRendering) { @@ -273,23 +270,9 @@ public abstract class TileEntityMultiblock> extend } @Override - public ItemStack getStackInSlot(int slotID) + protected NonNullList getInventory() { - return structure != null && getSynchronizedData().getInventory() != null ? getSynchronizedData().getInventory()[slotID] : null; - } - - @Override - public void setInventorySlotContents(int slotID, ItemStack itemstack) - { - if(structure != null && getSynchronizedData().getInventory() != null) - { - getSynchronizedData().getInventory()[slotID] = itemstack; - - if(itemstack != null && itemstack.stackSize > getInventoryStackLimit()) - { - itemstack.stackSize = getInventoryStackLimit(); - } - } + return structure != null ? structure.getInventory() : null; } @Override diff --git a/src/main/java/mekanism/common/tile/TileEntityOredictionificator.java b/src/main/java/mekanism/common/tile/TileEntityOredictionificator.java index e17350413..54fa60fd4 100644 --- a/src/main/java/mekanism/common/tile/TileEntityOredictionificator.java +++ b/src/main/java/mekanism/common/tile/TileEntityOredictionificator.java @@ -20,6 +20,7 @@ import mekanism.common.capabilities.Capabilities; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.security.ISecurityTile; import mekanism.common.tile.component.TileComponentSecurity; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import mekanism.common.util.InventoryUtils; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.MekanismUtils; @@ -29,6 +30,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -50,16 +52,16 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple public TileEntityOredictionificator() { - super(BlockStateMachine.MachineType.OREDICTIONIFICATOR.machineName); + super(BlockStateMachine.MachineType.OREDICTIONIFICATOR.blockName); - inventory = new ItemStack[2]; + inventory = NonNullList.withSize(2, ItemStack.EMPTY); doAutoSync = false; } @Override public void onUpdate() { - if(!worldObj.isRemote) + if(!world.isRemote) { if(playersUsing.size() > 0) { @@ -71,34 +73,34 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple didProcess = false; - if(MekanismUtils.canFunction(this) && inventory[0] != null && getValidName(inventory[0]) != null) + if(MekanismUtils.canFunction(this) && !inventory.get(0).isEmpty() && getValidName(inventory.get(0)) != null) { - ItemStack result = getResult(inventory[0]); + ItemStack result = getResult(inventory.get(0)); - if(result != null) + if(!result.isEmpty()) { - if(inventory[1] == null) + if(inventory.get(1).isEmpty()) { - inventory[0].stackSize--; + inventory.get(0).shrink(1); - if(inventory[0].stackSize <= 0) + if(inventory.get(0).getCount() <= 0) { - inventory[0] = null; + inventory.set(0, ItemStack.EMPTY); } - inventory[1] = result; + inventory.set(1, result); didProcess = true; } - else if(inventory[1].isItemEqual(result) && inventory[1].stackSize < inventory[1].getMaxStackSize()) + else if(inventory.get(1).isItemEqual(result) && inventory.get(1).getCount() < inventory.get(1).getMaxStackSize()) { - inventory[0].stackSize--; + inventory.get(0).shrink(1); - if(inventory[0].stackSize <= 0) + if(inventory.get(0).getCount() <= 0) { - inventory[0] = null; + inventory.set(0, ItemStack.EMPTY); } - inventory[1].stackSize++; + inventory.get(1).grow(1); didProcess = true; } @@ -132,7 +134,7 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple if(s == null) { - return null; + return ItemStack.EMPTY; } List ores = OreDictionary.getOres(s); @@ -146,12 +148,12 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple return MekanismUtils.size(ores.get(filter.index), 1); } else { - return null; + return ItemStack.EMPTY; } } } - return null; + return ItemStack.EMPTY; } @Override @@ -179,7 +181,7 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple @Override public boolean isItemValidForSlot(int slotID, ItemStack itemstack) { - return slotID == 0 && getResult(itemstack) != null; + return slotID == 0 && !getResult(itemstack).isEmpty(); } @@ -319,7 +321,7 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple @Override public void openInventory(EntityPlayer player) { - if(!worldObj.isRemote) + if(!world.isRemote) { Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getFilterPacket(new ArrayList())), new Range4D(Coord4D.get(this))); } diff --git a/src/main/java/mekanism/common/tile/TileEntityOsmiumCompressor.java b/src/main/java/mekanism/common/tile/TileEntityOsmiumCompressor.java index 45905d397..2fc6ab456 100644 --- a/src/main/java/mekanism/common/tile/TileEntityOsmiumCompressor.java +++ b/src/main/java/mekanism/common/tile/TileEntityOsmiumCompressor.java @@ -2,13 +2,14 @@ package mekanism.common.tile; import java.util.Map; -import mekanism.api.MekanismConfig.usage; import mekanism.api.gas.Gas; -import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; +import mekanism.common.MekanismFluids; import mekanism.common.block.states.BlockStateMachine; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.recipe.machines.OsmiumCompressorRecipe; +import mekanism.common.tile.prefab.TileEntityAdvancedElectricMachine; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; @@ -16,7 +17,7 @@ public class TileEntityOsmiumCompressor extends TileEntityAdvancedElectricMachin { public TileEntityOsmiumCompressor() { - super("compressor", "OsmiumCompressor", usage.osmiumCompressorUsage, 1, 200, BlockStateMachine.MachineType.OSMIUM_COMPRESSOR.baseEnergy); + super("compressor", "OsmiumCompressor", BlockStateMachine.MachineType.OSMIUM_COMPRESSOR.baseEnergy, usage.osmiumCompressorUsage, 200, 1); } @Override @@ -34,7 +35,7 @@ public class TileEntityOsmiumCompressor extends TileEntityAdvancedElectricMachin { if(ore.isItemEqual(itemstack)) { - return new GasStack(GasRegistry.getGas("liquidOsmium"), 200); + return new GasStack(MekanismFluids.LiquidOsmium, 200); } } @@ -42,7 +43,7 @@ public class TileEntityOsmiumCompressor extends TileEntityAdvancedElectricMachin { if(ore.isItemEqual(itemstack)) { - return new GasStack(GasRegistry.getGas("liquidOsmium"), 1800); + return new GasStack(MekanismFluids.LiquidOsmium, 1800); } } diff --git a/src/main/java/mekanism/common/tile/TileEntityPRC.java b/src/main/java/mekanism/common/tile/TileEntityPRC.java index 7e329f26b..7d47287fa 100644 --- a/src/main/java/mekanism/common/tile/TileEntityPRC.java +++ b/src/main/java/mekanism/common/tile/TileEntityPRC.java @@ -6,7 +6,6 @@ import java.util.ArrayList; import java.util.Map; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.usage; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; @@ -23,6 +22,7 @@ import mekanism.common.base.ISustainedData; import mekanism.common.base.ITankManager; import mekanism.common.block.states.BlockStateMachine; import mekanism.common.capabilities.Capabilities; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.item.ItemUpgrade; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.inputs.PressurizedInput; @@ -30,7 +30,7 @@ import mekanism.common.recipe.machines.PressurizedRecipe; import mekanism.common.recipe.outputs.PressurizedOutput; import mekanism.common.tile.component.TileComponentConfig; import mekanism.common.tile.component.TileComponentEjector; -import mekanism.common.tile.component.TileComponentUpgrade; +import mekanism.common.tile.prefab.TileEntityBasicMachine; import mekanism.common.util.ChargeUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.ItemDataUtils; @@ -39,6 +39,7 @@ import mekanism.common.util.MekanismUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.Fluid; @@ -58,7 +59,7 @@ public class TileEntityPRC extends TileEntityBasicMachine 0) && (lidAngle == 0.0F)) { - worldObj.playSound(null, getPos().getX() + 0.5F, getPos().getY() + 0.5D, getPos().getZ() + 0.5F, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, (worldObj.rand.nextFloat()*0.1F) + 0.9F); + world.playSound(null, getPos().getX() + 0.5F, getPos().getY() + 0.5D, getPos().getZ() + 0.5F, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, (world.rand.nextFloat()*0.1F) + 0.9F); } if((playersUsing.size() == 0 && lidAngle > 0.0F) || (playersUsing.size() > 0 && lidAngle < 1.0F)) @@ -60,7 +62,7 @@ public class TileEntityPersonalChest extends TileEntityContainerBlock implements if(lidAngle < split && angle >= split) { - worldObj.playSound(null, getPos().getX() + 0.5D, getPos().getY() + 0.5D, getPos().getZ() + 0.5D, SoundEvents.BLOCK_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, (worldObj.rand.nextFloat()*0.1F) + 0.9F); + world.playSound(null, getPos().getX() + 0.5D, getPos().getY() + 0.5D, getPos().getZ() + 0.5D, SoundEvents.BLOCK_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, (world.rand.nextFloat()*0.1F) + 0.9F); } if(lidAngle < 0.0F) diff --git a/src/main/java/mekanism/common/tile/TileEntityPrecisionSawmill.java b/src/main/java/mekanism/common/tile/TileEntityPrecisionSawmill.java index 3deaa5280..49c08c217 100644 --- a/src/main/java/mekanism/common/tile/TileEntityPrecisionSawmill.java +++ b/src/main/java/mekanism/common/tile/TileEntityPrecisionSawmill.java @@ -2,8 +2,8 @@ package mekanism.common.tile; import java.util.Map; -import mekanism.api.MekanismConfig.usage; import mekanism.common.block.states.BlockStateMachine; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.recipe.inputs.ItemStackInput; import mekanism.common.recipe.machines.SawmillRecipe; @@ -16,7 +16,7 @@ public class TileEntityPrecisionSawmill extends TileEntityChanceMachine 0 && inventory[1].getItem() instanceof IGasItem) + if(!inventory.get(1).isEmpty() && gasTank.getNeeded() > 0 && inventory.get(1).getItem() instanceof IGasItem) { - GasStack removed = GasTransmission.removeGas(inventory[1], GasRegistry.getGas("oxygen"), gasTank.getNeeded()); + GasStack removed = GasUtils.removeGas(inventory.get(1), MekanismFluids.Oxygen, gasTank.getNeeded()); gasTank.receive(removed, true); return; } @@ -79,7 +80,7 @@ public class TileEntityPurificationChamber extends TileEntityAdvancedElectricMac @Override public boolean isValidGas(Gas gas) { - return gas == GasRegistry.getGas("oxygen"); + return gas == MekanismFluids.Oxygen; } @Override diff --git a/src/main/java/mekanism/common/tile/TileEntityQuantumEntangloporter.java b/src/main/java/mekanism/common/tile/TileEntityQuantumEntangloporter.java index e4a0f0539..b11ef18d6 100644 --- a/src/main/java/mekanism/common/tile/TileEntityQuantumEntangloporter.java +++ b/src/main/java/mekanism/common/tile/TileEntityQuantumEntangloporter.java @@ -13,7 +13,6 @@ import mekanism.api.gas.GasStack; import mekanism.api.gas.IGasHandler; import mekanism.api.gas.ITubeConnection; import mekanism.api.transmitters.TransmissionType; -import mekanism.api.util.CapabilityUtils; import mekanism.common.Mekanism; import mekanism.common.PacketHandler; import mekanism.common.SideData.IOState; @@ -26,12 +25,14 @@ import mekanism.common.content.entangloporter.InventoryFrequency; import mekanism.common.frequency.Frequency; import mekanism.common.frequency.FrequencyManager; import mekanism.common.frequency.IFrequencyHandler; -import mekanism.common.integration.IComputerIntegration; +import mekanism.common.integration.computer.IComputerIntegration; import mekanism.common.security.ISecurityTile; import mekanism.common.tile.component.TileComponentConfig; import mekanism.common.tile.component.TileComponentEjector; import mekanism.common.tile.component.TileComponentSecurity; +import mekanism.common.tile.prefab.TileEntityElectricBlock; import mekanism.common.util.CableUtils; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.HeatUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; @@ -40,6 +41,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -82,7 +84,7 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp } } - inventory = new ItemStack[0]; + inventory = NonNullList.withSize(0, ItemStack.EMPTY); configComponent.getOutputs(TransmissionType.ITEM).get(2).availableSlots = new int[] {0}; configComponent.getOutputs(TransmissionType.FLUID).get(2).availableSlots = new int[] {0}; @@ -101,7 +103,7 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp { super.onUpdate(); - if(!worldObj.isRemote) + if(!world.isRemote) { if(configComponent.isEjecting(TransmissionType.ENERGY)) { @@ -121,13 +123,13 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp { if(frequency != null && !frequency.valid) { - frequency = (InventoryFrequency)manager.validateFrequency(getSecurity().getOwner(), Coord4D.get(this), frequency); + frequency = (InventoryFrequency)manager.validateFrequency(getSecurity().getOwnerUUID(), Coord4D.get(this), frequency); markDirty(); } if(frequency != null) { - frequency = (InventoryFrequency)manager.update(getSecurity().getOwner(), Coord4D.get(this), frequency); + frequency = (InventoryFrequency)manager.update(Coord4D.get(this), frequency); if(frequency == null) { @@ -156,7 +158,7 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp { super.invalidate(); - if(!worldObj.isRemote) + if(!world.isRemote) { if(frequency != null) { @@ -183,7 +185,7 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp public FrequencyManager getManager(Frequency freq) { - if(getSecurity().getOwner() == null || freq == null) + if(getSecurity().getOwnerUUID() == null || freq == null) { return null; } @@ -193,14 +195,14 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp return Mekanism.publicEntangloporters; } else { - if(!Mekanism.privateEntangloporters.containsKey(getSecurity().getOwner())) + if(!Mekanism.privateEntangloporters.containsKey(getSecurity().getOwnerUUID())) { - FrequencyManager manager = new FrequencyManager(InventoryFrequency.class, InventoryFrequency.ENTANGLOPORTER, getSecurity().getOwner()); - Mekanism.privateEntangloporters.put(getSecurity().getOwner(), manager); - manager.createOrLoad(worldObj); + FrequencyManager manager = new FrequencyManager(InventoryFrequency.class, InventoryFrequency.ENTANGLOPORTER, getSecurity().getOwnerUUID()); + Mekanism.privateEntangloporters.put(getSecurity().getOwnerUUID(), manager); + manager.createOrLoad(world); } - return Mekanism.privateEntangloporters.get(getSecurity().getOwner()); + return Mekanism.privateEntangloporters.get(getSecurity().getOwnerUUID()); } } @@ -222,7 +224,7 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp } } - Frequency freq = new InventoryFrequency(name, getSecurity().getOwner()).setPublic(publicFreq); + Frequency freq = new InventoryFrequency(name, getSecurity().getOwnerUUID()).setPublic(publicFreq); freq.activeCoords.add(Coord4D.get(this)); manager.addFrequency(freq); frequency = (InventoryFrequency)freq; @@ -281,7 +283,7 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp if(manager != null) { - manager.remove(freq, getSecurity().getOwner()); + manager.remove(freq, getSecurity().getOwnerUUID()); } } @@ -508,29 +510,9 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp } @Override - public int getSizeInventory() + public NonNullList getInventory() { - return 1; - } - - @Override - public ItemStack getStackInSlot(int slotID) - { - return hasFrequency() && slotID == 0 ? frequency.storedItem : null; - } - - @Override - public void setInventorySlotContents(int slotID, ItemStack itemstack) - { - if(hasFrequency() && slotID == 0) - { - frequency.storedItem = itemstack; - - if(itemstack != null && itemstack.stackSize > getInventoryStackLimit()) - { - itemstack.stackSize = getInventoryStackLimit(); - } - } + return hasFrequency() ? frequency.inventory : null; } @Override @@ -585,7 +567,7 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp @Override public IHeatTransfer getAdjacent(EnumFacing side) { - TileEntity adj = Coord4D.get(this).offset(side).getTileEntity(worldObj); + TileEntity adj = Coord4D.get(this).offset(side).getTileEntity(world); if(hasFrequency() && configComponent.getOutput(TransmissionType.HEAT, side, facing).ioState == IOState.INPUT) { diff --git a/src/main/java/mekanism/common/tile/TileEntityResistiveHeater.java b/src/main/java/mekanism/common/tile/TileEntityResistiveHeater.java index 7c080686a..be6675b40 100644 --- a/src/main/java/mekanism/common/tile/TileEntityResistiveHeater.java +++ b/src/main/java/mekanism/common/tile/TileEntityResistiveHeater.java @@ -7,17 +7,18 @@ import java.util.EnumSet; import mekanism.api.Coord4D; import mekanism.api.IHeatTransfer; -import mekanism.api.MekanismConfig.general; import mekanism.api.Range4D; -import mekanism.api.util.CapabilityUtils; import mekanism.common.Mekanism; import mekanism.common.base.IRedstoneControl; import mekanism.common.block.states.BlockStateMachine.MachineType; import mekanism.common.capabilities.Capabilities; -import mekanism.common.integration.IComputerIntegration; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.integration.computer.IComputerIntegration; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.security.ISecurityTile; import mekanism.common.tile.component.TileComponentSecurity; +import mekanism.common.tile.prefab.TileEntityNoisyBlock; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.ChargeUtils; import mekanism.common.util.HeatUtils; import mekanism.common.util.MekanismUtils; @@ -25,10 +26,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; -public class TileEntityResistiveHeater extends TileEntityNoisyElectricBlock implements IHeatTransfer, IComputerIntegration, IRedstoneControl, ISecurityTile +public class TileEntityResistiveHeater extends TileEntityNoisyBlock implements IHeatTransfer, IComputerIntegration, IRedstoneControl, ISecurityTile { public double energyUsage = 100; @@ -55,7 +57,7 @@ public class TileEntityResistiveHeater extends TileEntityNoisyElectricBlock impl public TileEntityResistiveHeater() { super("machine.resistiveheater", "ResistiveHeater", MachineType.RESISTIVE_HEATER.baseEnergy); - inventory = new ItemStack[1]; + inventory = NonNullList.withSize(1, ItemStack.EMPTY); } @Override @@ -63,18 +65,18 @@ public class TileEntityResistiveHeater extends TileEntityNoisyElectricBlock impl { super.onUpdate(); - if(worldObj.isRemote && updateDelay > 0) + if(world.isRemote && updateDelay > 0) { updateDelay--; if(updateDelay == 0 && clientActive != isActive) { isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } - if(!worldObj.isRemote) + if(!world.isRemote) { boolean packet = false; @@ -194,7 +196,7 @@ public class TileEntityResistiveHeater extends TileEntityNoisyElectricBlock impl { updateDelay = general.UPDATE_DELAY; isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } } @@ -264,7 +266,7 @@ public class TileEntityResistiveHeater extends TileEntityNoisyElectricBlock impl @Override public IHeatTransfer getAdjacent(EnumFacing side) { - TileEntity adj = Coord4D.get(this).offset(side).getTileEntity(worldObj); + TileEntity adj = Coord4D.get(this).offset(side).getTileEntity(world); if(CapabilityUtils.hasCapability(adj, Capabilities.HEAT_TRANSFER_CAPABILITY, side.getOpposite())) { @@ -347,7 +349,8 @@ public class TileEntityResistiveHeater extends TileEntityNoisyElectricBlock impl { if(arguments[0] instanceof Double) { - temperature = (Double)arguments[0]; + energyUsage = (Double)arguments[0]; + return new Object[] {"Set energy usage."}; } } diff --git a/src/main/java/mekanism/common/tile/TileEntityRotaryCondensentrator.java b/src/main/java/mekanism/common/tile/TileEntityRotaryCondensentrator.java index 95e4005e8..8b7a5ada1 100644 --- a/src/main/java/mekanism/common/tile/TileEntityRotaryCondensentrator.java +++ b/src/main/java/mekanism/common/tile/TileEntityRotaryCondensentrator.java @@ -6,36 +6,29 @@ import java.util.ArrayList; import java.util.List; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.usage; -import mekanism.api.Range4D; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; -import mekanism.api.gas.GasTransmission; import mekanism.api.gas.IGasHandler; import mekanism.api.gas.ITubeConnection; -import mekanism.api.util.ListUtils; import mekanism.common.Mekanism; import mekanism.common.Upgrade; import mekanism.common.Upgrade.IUpgradeInfoHandler; import mekanism.common.base.FluidHandlerWrapper; -import mekanism.common.base.IActiveState; import mekanism.common.base.IFluidHandlerWrapper; -import mekanism.common.base.IRedstoneControl; import mekanism.common.base.ISustainedData; import mekanism.common.base.ITankManager; -import mekanism.common.base.IUpgradeTile; import mekanism.common.block.states.BlockStateMachine; import mekanism.common.capabilities.Capabilities; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.network.PacketTileEntity.TileEntityMessage; -import mekanism.common.security.ISecurityTile; -import mekanism.common.tile.component.TileComponentSecurity; -import mekanism.common.tile.component.TileComponentUpgrade; +import mekanism.common.tile.prefab.TileEntityMachine; import mekanism.common.util.ChargeUtils; import mekanism.common.util.FluidContainerUtils; +import mekanism.common.util.GasUtils; import mekanism.common.util.ItemDataUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.PipeUtils; import net.minecraft.entity.player.EntityPlayer; @@ -43,6 +36,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; @@ -53,7 +47,7 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.network.ByteBufUtils; -public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock implements IActiveState, ISustainedData, IFluidHandlerWrapper, IGasHandler, ITubeConnection, IRedstoneControl, IUpgradeTile, IUpgradeInfoHandler, ITankManager, ISecurityTile +public class TileEntityRotaryCondensentrator extends TileEntityMachine implements ISustainedData, IFluidHandlerWrapper, IGasHandler, ITubeConnection, IUpgradeInfoHandler, ITankManager { public GasTank gasTank = new GasTank(MAX_FLUID); @@ -66,30 +60,12 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp public int gasOutput = 256; - public int updateDelay; - - public boolean isActive; - - public boolean clientActive; - - public double prevEnergy; - - public final double BASE_ENERGY_USAGE = usage.rotaryCondensentratorUsage; - - public double energyPerTick = BASE_ENERGY_USAGE; - public double clientEnergyUsed; - - public TileComponentUpgrade upgradeComponent = new TileComponentUpgrade(this, 5); - public TileComponentSecurity securityComponent = new TileComponentSecurity(this); - - /** This machine's current RedstoneControl type. */ - public RedstoneControl controlType = RedstoneControl.DISABLED; public TileEntityRotaryCondensentrator() { - super("RotaryCondensentrator", BlockStateMachine.MachineType.ROTARY_CONDENSENTRATOR.baseEnergy); - inventory = new ItemStack[6]; + super("machine.rotarycondensentrator", "RotaryCondensentrator", BlockStateMachine.MachineType.ROTARY_CONDENSENTRATOR.baseEnergy, usage.rotaryCondensentratorUsage, 5); + inventory = NonNullList.withSize(6, ItemStack.EMPTY); } @Override @@ -97,42 +73,18 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp { super.onUpdate(); - if(worldObj.isRemote) + if(!world.isRemote) { - if(updateDelay > 0) - { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } - } - } - - if(!worldObj.isRemote) - { - if(updateDelay > 0) - { - updateDelay--; - - if(updateDelay == 0 && clientActive != isActive) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - } - } - ChargeUtils.discharge(4, this); if(mode == 0) { - if(inventory[1] != null && (gasTank.getGas() == null || gasTank.getStored() < gasTank.getMaxGas())) + if(!inventory.get(1).isEmpty() && (gasTank.getGas() == null || gasTank.getStored() < gasTank.getMaxGas())) { - gasTank.receive(GasTransmission.removeGas(inventory[1], gasTank.getGasType(), gasTank.getNeeded()), true); + gasTank.receive(GasUtils.removeGas(inventory.get(1), gasTank.getGasType(), gasTank.getNeeded()), true); } - if(FluidContainerUtils.isFluidContainer(inventory[2])) + if(FluidContainerUtils.isFluidContainer(inventory.get(2))) { FluidContainerUtils.handleContainerItemFill(this, fluidTank, 2, 3); } @@ -157,18 +109,18 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp } else if(mode == 1) { - if(inventory[0] != null && gasTank.getGas() != null) + if(!inventory.get(0).isEmpty() && gasTank.getGas() != null) { - gasTank.draw(GasTransmission.addGas(inventory[0], gasTank.getGas()), true); + gasTank.draw(GasUtils.addGas(inventory.get(0), gasTank.getGas()), true); } if(gasTank.getGas() != null) { GasStack toSend = new GasStack(gasTank.getGas().getGas(), Math.min(gasTank.getGas().amount, gasOutput)); - gasTank.draw(GasTransmission.emit(toSend, this, ListUtils.asList(MekanismUtils.getLeft(facing))), true); + gasTank.draw(GasUtils.emit(toSend, this, ListUtils.asList(MekanismUtils.getLeft(facing))), true); } - if(FluidContainerUtils.isFluidContainer(inventory[2])) + if(FluidContainerUtils.isFluidContainer(inventory.get(2))) { FluidContainerUtils.handleContainerItemEmpty(this, fluidTank, 2, 3); } @@ -256,8 +208,6 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp if(FMLCommonHandler.instance().getEffectiveSide().isClient()) { mode = dataStream.readInt(); - isActive = dataStream.readBoolean(); - controlType = RedstoneControl.values()[dataStream.readInt()]; clientEnergyUsed = dataStream.readDouble(); if(dataStream.readBoolean()) @@ -275,13 +225,6 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp else { gasTank.setGas(null); } - - if(updateDelay == 0 && clientActive != isActive) - { - updateDelay = general.UPDATE_DELAY; - isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); - } } } @@ -291,8 +234,6 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp super.getNetworkedData(data); data.add(mode); - data.add(isActive); - data.add(controlType.ordinal()); data.add(clientEnergyUsed); if(fluidTank.getFluid() != null) @@ -324,9 +265,6 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp super.readFromNBT(nbtTags); mode = nbtTags.getInteger("mode"); - isActive = nbtTags.getBoolean("isActive"); - controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")]; - gasTank.read(nbtTags.getCompoundTag("gasTank")); if(nbtTags.hasKey("fluidTank")) @@ -341,8 +279,6 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp super.writeToNBT(nbtTags); nbtTags.setInteger("mode", mode); - nbtTags.setBoolean("isActive", isActive); - nbtTags.setInteger("controlType", controlType.ordinal()); nbtTags.setTag("gasTank", gasTank.write(new NBTTagCompound())); if(fluidTank.getFluid() != null) @@ -353,44 +289,6 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp return nbtTags; } - @Override - public boolean canSetFacing(int i) - { - return i != 0 && i != 1; - } - - @Override - public void setActive(boolean active) - { - isActive = active; - - if(clientActive != active && updateDelay == 0) - { - Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); - - updateDelay = 10; - clientActive = active; - } - } - - @Override - public boolean getActive() - { - return isActive; - } - - @Override - public boolean renderUpdate() - { - return false; - } - - @Override - public boolean lightUpdate() - { - return true; - } - @Override public boolean canTubeConnect(EnumFacing side) { @@ -521,46 +419,6 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp return null; } - @Override - public RedstoneControl getControlType() - { - return controlType; - } - - @Override - public void setControlType(RedstoneControl type) - { - controlType = type; - MekanismUtils.saveChunk(this); - } - - @Override - public boolean canPulse() - { - return false; - } - - @Override - public TileComponentUpgrade getComponent() - { - return upgradeComponent; - } - - @Override - public void recalculateUpgradables(Upgrade upgrade) - { - super.recalculateUpgradables(upgrade); - - switch(upgrade) - { - case ENERGY: - maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); - energyPerTick = MekanismUtils.getBaseEnergyPerTick(this, BASE_ENERGY_USAGE); - default: - break; - } - } - @Override public List getInfo(Upgrade upgrade) { @@ -572,10 +430,4 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp { return new Object[] {gasTank, fluidTank}; } - - @Override - public TileComponentSecurity getSecurity() - { - return securityComponent; - } } diff --git a/src/main/java/mekanism/common/tile/TileEntitySecurityDesk.java b/src/main/java/mekanism/common/tile/TileEntitySecurityDesk.java index d1c88919a..1a2c383d1 100644 --- a/src/main/java/mekanism/common/tile/TileEntitySecurityDesk.java +++ b/src/main/java/mekanism/common/tile/TileEntitySecurityDesk.java @@ -3,6 +3,7 @@ package mekanism.common.tile; import io.netty.buffer.ByteBuf; import java.util.ArrayList; +import java.util.UUID; import mekanism.api.Coord4D; import mekanism.common.Mekanism; @@ -17,17 +18,21 @@ import mekanism.common.security.ISecurityItem; import mekanism.common.security.ISecurityTile.SecurityMode; import mekanism.common.security.SecurityData; import mekanism.common.security.SecurityFrequency; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import mekanism.common.util.MekanismUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; +import net.minecraftforge.common.UsernameCache; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class TileEntitySecurityDesk extends TileEntityContainerBlock implements IBoundingBlock { - public String owner; + public UUID ownerUUID; + public String clientOwner; public SecurityFrequency frequency; @@ -35,59 +40,59 @@ public class TileEntitySecurityDesk extends TileEntityContainerBlock implements { super("SecurityDesk"); - inventory = new ItemStack[2]; + inventory = NonNullList.withSize(2, ItemStack.EMPTY); } @Override public void onUpdate() { - if(!worldObj.isRemote) + if(!world.isRemote) { - if(owner != null && frequency != null) + if(ownerUUID != null && frequency != null) { - if(inventory[0] != null && inventory[0].getItem() instanceof IOwnerItem) + if(!inventory.get(0).isEmpty() && inventory.get(0).getItem() instanceof IOwnerItem) { - IOwnerItem item = (IOwnerItem)inventory[0].getItem(); + IOwnerItem item = (IOwnerItem)inventory.get(0).getItem(); - if(item.hasOwner(inventory[0]) && item.getOwner(inventory[0]) != null) + if(item.hasOwner(inventory.get(0)) && item.getOwnerUUID(inventory.get(0)) != null) { - if(item.getOwner(inventory[0]).equals(owner)) + if(item.getOwnerUUID(inventory.get(0)).equals(ownerUUID)) { - item.setOwner(inventory[0], null); + item.setOwnerUUID(inventory.get(0), null); - if(item instanceof ISecurityItem && ((ISecurityItem)item).hasSecurity(inventory[0])) + if(item instanceof ISecurityItem && ((ISecurityItem)item).hasSecurity(inventory.get(0))) { - ((ISecurityItem)item).setSecurity(inventory[0], SecurityMode.PUBLIC); + ((ISecurityItem)item).setSecurity(inventory.get(0), SecurityMode.PUBLIC); } } } } - if(inventory[1] != null && inventory[1].getItem() instanceof IOwnerItem) + if(!inventory.get(1).isEmpty() && inventory.get(1).getItem() instanceof IOwnerItem) { - IOwnerItem item = (IOwnerItem)inventory[1].getItem(); + IOwnerItem item = (IOwnerItem)inventory.get(1).getItem(); - if(item.hasOwner(inventory[1])) + if(item.hasOwner(inventory.get(1))) { - if(item.getOwner(inventory[1]) == null) + if(item.getOwnerUUID(inventory.get(1)) == null) { - item.setOwner(inventory[1], owner); + item.setOwnerUUID(inventory.get(1), ownerUUID); } - if(item.getOwner(inventory[1]).equals(owner)) + if(item.getOwnerUUID(inventory.get(1)).equals(ownerUUID)) { - if(item instanceof ISecurityItem && ((ISecurityItem)item).hasSecurity(inventory[1])) + if(item instanceof ISecurityItem && ((ISecurityItem)item).hasSecurity(inventory.get(1))) { - ((ISecurityItem)item).setSecurity(inventory[1], frequency.securityMode); + ((ISecurityItem)item).setSecurity(inventory.get(1), frequency.securityMode); } } } } } - if(frequency == null && owner != null) + if(frequency == null && ownerUUID != null) { - setFrequency(owner); + setFrequency(ownerUUID); } FrequencyManager manager = getManager(frequency); @@ -96,12 +101,12 @@ public class TileEntitySecurityDesk extends TileEntityContainerBlock implements { if(frequency != null && !frequency.valid) { - frequency = (SecurityFrequency)manager.validateFrequency(owner, Coord4D.get(this), frequency); + frequency = (SecurityFrequency)manager.validateFrequency(ownerUUID, Coord4D.get(this), frequency); } if(frequency != null) { - frequency = (SecurityFrequency)manager.update(owner, Coord4D.get(this), frequency); + frequency = (SecurityFrequency)manager.update(Coord4D.get(this), frequency); } } else { @@ -112,7 +117,7 @@ public class TileEntitySecurityDesk extends TileEntityContainerBlock implements public FrequencyManager getManager(Frequency freq) { - if(owner == null || freq == null) + if(ownerUUID == null || freq == null) { return null; } @@ -120,14 +125,14 @@ public class TileEntitySecurityDesk extends TileEntityContainerBlock implements return Mekanism.securityFrequencies; } - public void setFrequency(String owner) + public void setFrequency(UUID owner) { FrequencyManager manager = Mekanism.securityFrequencies; manager.deactivate(Coord4D.get(this)); for(Frequency freq : manager.getFrequencies()) { - if(freq.owner.equals(owner)) + if(freq.ownerUUID.equals(owner)) { frequency = (SecurityFrequency)freq; frequency.activeCoords.add(Coord4D.get(this)); @@ -172,7 +177,7 @@ public class TileEntitySecurityDesk extends TileEntityContainerBlock implements { frequency.override = !frequency.override; - Mekanism.packetHandler.sendToAll(new SecurityUpdateMessage(SecurityPacket.UPDATE, owner, new SecurityData(frequency))); + Mekanism.packetHandler.sendToAll(new SecurityUpdateMessage(SecurityPacket.UPDATE, ownerUUID, new SecurityData(frequency))); } } else if(type == 3) @@ -181,7 +186,7 @@ public class TileEntitySecurityDesk extends TileEntityContainerBlock implements { frequency.securityMode = SecurityMode.values()[dataStream.readInt()]; - Mekanism.packetHandler.sendToAll(new SecurityUpdateMessage(SecurityPacket.UPDATE, owner, new SecurityData(frequency))); + Mekanism.packetHandler.sendToAll(new SecurityUpdateMessage(SecurityPacket.UPDATE, ownerUUID, new SecurityData(frequency))); } } @@ -196,10 +201,10 @@ public class TileEntitySecurityDesk extends TileEntityContainerBlock implements { if(dataStream.readBoolean()) { - owner = PacketHandler.readString(dataStream); + clientOwner = PacketHandler.readString(dataStream); } else { - owner = null; + clientOwner = null; } if(dataStream.readBoolean()) @@ -217,9 +222,9 @@ public class TileEntitySecurityDesk extends TileEntityContainerBlock implements { super.readFromNBT(nbtTags); - if(nbtTags.hasKey("owner")) + if(nbtTags.hasKey("ownerUUID")) { - owner = nbtTags.getString("owner"); + ownerUUID = UUID.fromString(nbtTags.getString("ownerUUID")); } if(nbtTags.hasKey("frequency")) @@ -234,9 +239,9 @@ public class TileEntitySecurityDesk extends TileEntityContainerBlock implements { super.writeToNBT(nbtTags); - if(owner != null) + if(ownerUUID != null) { - nbtTags.setString("owner", owner); + nbtTags.setString("ownerUUID", ownerUUID.toString()); } if(frequency != null) @@ -254,10 +259,10 @@ public class TileEntitySecurityDesk extends TileEntityContainerBlock implements { super.getNetworkedData(data); - if(owner != null) + if(ownerUUID != null) { data.add(true); - data.add(owner); + data.add(UsernameCache.getLastKnownUsername(ownerUUID)); } else { data.add(false); @@ -280,7 +285,7 @@ public class TileEntitySecurityDesk extends TileEntityContainerBlock implements { super.invalidate(); - if(!worldObj.isRemote) + if(!world.isRemote) { if(frequency != null) { @@ -297,14 +302,14 @@ public class TileEntitySecurityDesk extends TileEntityContainerBlock implements @Override public void onPlace() { - MekanismUtils.makeBoundingBlock(worldObj, getPos().up(), Coord4D.get(this)); + MekanismUtils.makeBoundingBlock(world, getPos().up(), Coord4D.get(this)); } @Override public void onBreak() { - worldObj.setBlockToAir(getPos().up()); - worldObj.setBlockToAir(getPos()); + world.setBlockToAir(getPos().up()); + world.setBlockToAir(getPos()); } @Override diff --git a/src/main/java/mekanism/common/tile/TileEntitySeismicVibrator.java b/src/main/java/mekanism/common/tile/TileEntitySeismicVibrator.java index 4b6da6656..3c67dec50 100644 --- a/src/main/java/mekanism/common/tile/TileEntitySeismicVibrator.java +++ b/src/main/java/mekanism/common/tile/TileEntitySeismicVibrator.java @@ -6,22 +6,24 @@ import java.util.ArrayList; import java.util.EnumSet; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.usage; import mekanism.api.Range4D; import mekanism.common.Mekanism; import mekanism.common.base.IActiveState; import mekanism.common.base.IBoundingBlock; import mekanism.common.base.IRedstoneControl; import mekanism.common.block.states.BlockStateMachine; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.config.MekanismConfig.usage; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.security.ISecurityTile; import mekanism.common.tile.component.TileComponentSecurity; +import mekanism.common.tile.prefab.TileEntityElectricBlock; import mekanism.common.util.ChargeUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; @@ -45,7 +47,7 @@ public class TileEntitySeismicVibrator extends TileEntityElectricBlock implement { super("SeismicVibrator", BlockStateMachine.MachineType.SEISMIC_VIBRATOR.baseEnergy); - inventory = new ItemStack[1]; + inventory = NonNullList.withSize(1, ItemStack.EMPTY); } @Override @@ -53,7 +55,7 @@ public class TileEntitySeismicVibrator extends TileEntityElectricBlock implement { super.onUpdate(); - if(worldObj.isRemote) + if(world.isRemote) { if(isActive) { @@ -67,7 +69,7 @@ public class TileEntitySeismicVibrator extends TileEntityElectricBlock implement if(updateDelay == 0 && clientActive != isActive) { isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } } @@ -145,7 +147,7 @@ public class TileEntitySeismicVibrator extends TileEntityElectricBlock implement { updateDelay = general.UPDATE_DELAY; isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } } @@ -233,14 +235,14 @@ public class TileEntitySeismicVibrator extends TileEntityElectricBlock implement @Override public void onPlace() { - MekanismUtils.makeBoundingBlock(worldObj, getPos().up(), Coord4D.get(this)); + MekanismUtils.makeBoundingBlock(world, getPos().up(), Coord4D.get(this)); } @Override public void onBreak() { - worldObj.setBlockToAir(getPos().up()); - worldObj.setBlockToAir(getPos()); + world.setBlockToAir(getPos().up()); + world.setBlockToAir(getPos()); } @Override diff --git a/src/main/java/mekanism/common/tile/TileEntitySolarNeutronActivator.java b/src/main/java/mekanism/common/tile/TileEntitySolarNeutronActivator.java index e39157be0..01d316e28 100644 --- a/src/main/java/mekanism/common/tile/TileEntitySolarNeutronActivator.java +++ b/src/main/java/mekanism/common/tile/TileEntitySolarNeutronActivator.java @@ -6,16 +6,13 @@ import java.util.ArrayList; import java.util.List; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; import mekanism.api.Range4D; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; -import mekanism.api.gas.GasTransmission; import mekanism.api.gas.IGasHandler; import mekanism.api.gas.ITubeConnection; -import mekanism.api.util.ListUtils; import mekanism.common.Mekanism; import mekanism.common.Upgrade; import mekanism.common.Upgrade.IUpgradeInfoHandler; @@ -26,6 +23,7 @@ import mekanism.common.base.ISustainedData; import mekanism.common.base.ITankManager; import mekanism.common.base.IUpgradeTile; import mekanism.common.capabilities.Capabilities; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.inputs.GasInput; @@ -33,12 +31,16 @@ import mekanism.common.recipe.machines.SolarNeutronRecipe; import mekanism.common.security.ISecurityTile; import mekanism.common.tile.component.TileComponentSecurity; import mekanism.common.tile.component.TileComponentUpgrade; +import mekanism.common.tile.prefab.TileEntityContainerBlock; +import mekanism.common.util.GasUtils; import mekanism.common.util.ItemDataUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.biome.BiomeDesert; import net.minecraftforge.common.capabilities.Capability; @@ -73,24 +75,24 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im { super("SolarNeutronActivator"); upgradeComponent.setSupported(Upgrade.ENERGY, false); - inventory = new ItemStack[4]; + inventory = NonNullList.withSize(4, ItemStack.EMPTY); } @Override public void onUpdate() { - if(worldObj.isRemote && updateDelay > 0) + if(world.isRemote && updateDelay > 0) { updateDelay--; if(updateDelay == 0 && clientActive != isActive) { isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } - if(!worldObj.isRemote) + if(!world.isRemote) { if(updateDelay > 0) { @@ -102,21 +104,21 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im } } - if(inventory[0] != null && (inputTank.getGas() == null || inputTank.getStored() < inputTank.getMaxGas())) + if(!inventory.get(0).isEmpty() && (inputTank.getGas() == null || inputTank.getStored() < inputTank.getMaxGas())) { - inputTank.receive(GasTransmission.removeGas(inventory[0], inputTank.getGasType(), inputTank.getNeeded()), true); + inputTank.receive(GasUtils.removeGas(inventory.get(0), inputTank.getGasType(), inputTank.getNeeded()), true); } - if(inventory[1] != null && outputTank.getGas() != null) + if(!inventory.get(1).isEmpty() && outputTank.getGas() != null) { - outputTank.draw(GasTransmission.addGas(inventory[1], outputTank.getGas()), true); + outputTank.draw(GasUtils.addGas(inventory.get(1), outputTank.getGas()), true); } SolarNeutronRecipe recipe = getRecipe(); - boolean sky = ((!worldObj.isRaining() && !worldObj.isThundering()) || isDesert()) && !worldObj.provider.getHasNoSky() && worldObj.canSeeSky(getPos().up()); + boolean sky = ((!world.isRaining() && !world.isThundering()) || isDesert()) && !world.provider.hasNoSky() && world.canSeeSky(getPos().up()); - if(worldObj.isDaytime() && sky && canOperate(recipe) && MekanismUtils.canFunction(this)) + if(world.isDaytime() && sky && canOperate(recipe) && MekanismUtils.canFunction(this)) { setActive(true); @@ -129,7 +131,7 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im if(outputTank.getGas() != null) { GasStack toSend = new GasStack(outputTank.getGas().getGas(), Math.min(outputTank.getStored(), gasOutput)); - outputTank.draw(GasTransmission.emit(toSend, this, ListUtils.asList(facing)), true); + outputTank.draw(GasUtils.emit(toSend, this, ListUtils.asList(facing)), true); } } } @@ -144,7 +146,7 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im public boolean isDesert() { - return worldObj.provider.getBiomeForCoords(getPos()) instanceof BiomeDesert; + return world.provider.getBiomeForCoords(getPos()) instanceof BiomeDesert; } public SolarNeutronRecipe getRecipe() @@ -208,7 +210,7 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im { updateDelay = general.UPDATE_DELAY; isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } } @@ -279,14 +281,14 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im @Override public void onPlace() { - MekanismUtils.makeBoundingBlock(worldObj, Coord4D.get(this).offset(EnumFacing.UP).getPos(), Coord4D.get(this)); + MekanismUtils.makeBoundingBlock(world, Coord4D.get(this).offset(EnumFacing.UP).getPos(), Coord4D.get(this)); } @Override public void onBreak() { - worldObj.setBlockToAir(getPos().up()); - worldObj.setBlockToAir(getPos()); + world.setBlockToAir(getPos().up()); + world.setBlockToAir(getPos()); } @Override diff --git a/src/main/java/mekanism/common/tile/TileEntityStructuralGlass.java b/src/main/java/mekanism/common/tile/TileEntityStructuralGlass.java index 0afacfd5e..960a107e6 100644 --- a/src/main/java/mekanism/common/tile/TileEntityStructuralGlass.java +++ b/src/main/java/mekanism/common/tile/TileEntityStructuralGlass.java @@ -21,7 +21,7 @@ public class TileEntityStructuralGlass extends TileEntity implements IStructural { if(master != null) { - TileEntity masterTile = master.getTileEntity(worldObj); + TileEntity masterTile = master.getTileEntity(world); if(masterTile instanceof IMultiblock) { @@ -40,7 +40,7 @@ public class TileEntityStructuralGlass extends TileEntity implements IStructural { if(master != null) { - TileEntity masterTile = master.getTileEntity(worldObj); + TileEntity masterTile = master.getTileEntity(world); if(masterTile instanceof IMultiblock) { @@ -90,7 +90,7 @@ public class TileEntityStructuralGlass extends TileEntity implements IStructural for(EnumFacing side : EnumFacing.VALUES) { Coord4D coord = pos.offset(side); - TileEntity tile = coord.getTileEntity(worldObj); + TileEntity tile = coord.getTileEntity(world); if(!iterated.contains(coord)) { diff --git a/src/main/java/mekanism/common/tile/TileEntitySuperheatingElement.java b/src/main/java/mekanism/common/tile/TileEntitySuperheatingElement.java index 867f0ad29..5b73f70ad 100644 --- a/src/main/java/mekanism/common/tile/TileEntitySuperheatingElement.java +++ b/src/main/java/mekanism/common/tile/TileEntitySuperheatingElement.java @@ -38,7 +38,7 @@ public class TileEntitySuperheatingElement extends TileEntityInternalMultiblock super.setMultiblock(id); - if(packet && !worldObj.isRemote) + if(packet && !world.isRemote) { Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); } @@ -47,7 +47,7 @@ public class TileEntitySuperheatingElement extends TileEntityInternalMultiblock @Override public void onUpdate() { - if(worldObj.isRemote) + if(world.isRemote) { boolean newHot = false; @@ -58,7 +58,7 @@ public class TileEntitySuperheatingElement extends TileEntityInternalMultiblock if(prevHot != newHot) { - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); prevHot = newHot; } diff --git a/src/main/java/mekanism/common/tile/TileEntityTeleporter.java b/src/main/java/mekanism/common/tile/TileEntityTeleporter.java index 0e36c3561..4ea352bb7 100644 --- a/src/main/java/mekanism/common/tile/TileEntityTeleporter.java +++ b/src/main/java/mekanism/common/tile/TileEntityTeleporter.java @@ -11,11 +11,10 @@ import java.util.UUID; import mekanism.api.Chunk3D; import mekanism.api.Coord4D; -import mekanism.api.ObfuscatedNames; import mekanism.api.Range4D; -import mekanism.api.util.ReflectionUtils; import mekanism.common.Mekanism; import mekanism.common.MekanismBlocks; +import mekanism.common.ObfuscatedNames; import mekanism.common.PacketHandler; import mekanism.common.Upgrade; import mekanism.common.base.IRedstoneControl; @@ -25,7 +24,7 @@ import mekanism.common.chunkloading.IChunkLoader; import mekanism.common.frequency.Frequency; import mekanism.common.frequency.FrequencyManager; import mekanism.common.frequency.IFrequencyHandler; -import mekanism.common.integration.IComputerIntegration; +import mekanism.common.integration.computer.IComputerIntegration; import mekanism.common.network.PacketEntityMove.EntityMoveMessage; import mekanism.common.network.PacketPortalFX.PortalFXMessage; import mekanism.common.network.PacketTileEntity.TileEntityMessage; @@ -33,8 +32,10 @@ import mekanism.common.security.ISecurityTile; import mekanism.common.tile.component.TileComponentChunkLoader; import mekanism.common.tile.component.TileComponentSecurity; import mekanism.common.tile.component.TileComponentUpgrade; +import mekanism.common.tile.prefab.TileEntityElectricBlock; import mekanism.common.util.ChargeUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.ReflectionUtils; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; @@ -48,6 +49,7 @@ import net.minecraft.network.play.server.SPacketSetExperience; import net.minecraft.potion.PotionEffect; import net.minecraft.server.MinecraftServer; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; @@ -88,7 +90,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo public TileEntityTeleporter() { super("Teleporter", BlockStateMachine.MachineType.TELEPORTER.baseEnergy); - inventory = new ItemStack[2]; + inventory = NonNullList.withSize(2, ItemStack.EMPTY); securityComponent = new TileComponentSecurity(this); chunkLoaderComponent = new TileComponentChunkLoader(this); @@ -107,7 +109,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo resetBounds(); } - if(!worldObj.isRemote) + if(!world.isRemote) { FrequencyManager manager = getManager(frequency); @@ -115,12 +117,12 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo { if(frequency != null && !frequency.valid) { - frequency = manager.validateFrequency(getSecurity().getOwner(), Coord4D.get(this), frequency); + frequency = manager.validateFrequency(getSecurity().getOwnerUUID(), Coord4D.get(this), frequency); } if(frequency != null) { - frequency = manager.update(getSecurity().getOwner(), Coord4D.get(this), frequency); + frequency = manager.update(Coord4D.get(this), frequency); } } else { @@ -191,7 +193,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo } } - Frequency freq = new Frequency(name, getSecurity().getOwner()).setPublic(publicFreq); + Frequency freq = new Frequency(name, getSecurity().getOwnerUUID()).setPublic(publicFreq); freq.activeCoords.add(Coord4D.get(this)); manager.addFrequency(freq); frequency = freq; @@ -201,7 +203,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo public FrequencyManager getManager(Frequency freq) { - if(getSecurity().getOwner() == null || freq == null) + if(getSecurity().getOwnerUUID() == null || freq == null) { return null; } @@ -211,33 +213,23 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo return Mekanism.publicTeleporters; } else { - if(!Mekanism.privateTeleporters.containsKey(getSecurity().getOwner())) + if(!Mekanism.privateTeleporters.containsKey(getSecurity().getOwnerUUID())) { - FrequencyManager manager = new FrequencyManager(Frequency.class, Frequency.TELEPORTER, getSecurity().getOwner()); - Mekanism.privateTeleporters.put(getSecurity().getOwner(), manager); - manager.createOrLoad(worldObj); + FrequencyManager manager = new FrequencyManager(Frequency.class, Frequency.TELEPORTER, getSecurity().getOwnerUUID()); + Mekanism.privateTeleporters.put(getSecurity().getOwnerUUID(), manager); + manager.createOrLoad(world); } - return Mekanism.privateTeleporters.get(getSecurity().getOwner()); + return Mekanism.privateTeleporters.get(getSecurity().getOwnerUUID()); } } - public static FrequencyManager loadManager(String owner, World world) - { - if(Mekanism.privateTeleporters.containsKey(owner)) - { - return Mekanism.privateTeleporters.get(owner); - } - - return FrequencyManager.loadOnly(world, owner, Frequency.class, "Teleporter"); - } - @Override public void onChunkUnload() { super.onChunkUnload(); - if(!worldObj.isRemote && frequency != null) + if(!world.isRemote && frequency != null) { FrequencyManager manager = getManager(frequency); @@ -253,7 +245,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo { super.invalidate(); - if(!worldObj.isRemote) + if(!world.isRemote) { if(frequency != null) { @@ -271,7 +263,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo { List list = new ArrayList(); - for(Entity e : (List)worldObj.getEntitiesWithinAABB(Entity.class, teleportBounds)) + for(Entity e : (List)world.getEntitiesWithinAABB(Entity.class, teleportBounds)) { list.add(e.getPersistentID()); } @@ -348,7 +340,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo public void teleport() { - if(worldObj.isRemote) return; + if(world.isRemote) return; List entitiesInPortal = getToTeleport(); @@ -385,7 +377,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo setEnergy(getEnergy() - calculateEnergyCost(entity, closestCoords)); - worldObj.playSound(entity.posX, entity.posY, entity.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, entity.getSoundCategory(), 1.0F, 1.0F, false); + world.playSound(entity.posX, entity.posY, entity.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, entity.getSoundCategory(), 1.0F, 1.0F, false); } } } @@ -398,13 +390,13 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo WorldServer oldWorld = player.mcServer.worldServerForDimension(player.dimension); player.dimension = coord.dimensionId; WorldServer newWorld = player.mcServer.worldServerForDimension(player.dimension); - player.connection.sendPacket(new SPacketRespawn(player.dimension, player.worldObj.getDifficulty(), newWorld.getWorldInfo().getTerrainType(), player.interactionManager.getGameType())); + player.connection.sendPacket(new SPacketRespawn(player.dimension, player.world.getDifficulty(), newWorld.getWorldInfo().getTerrainType(), player.interactionManager.getGameType())); oldWorld.removeEntityDangerously(player); player.isDead = false; if(player.isEntityAlive()) { - newWorld.spawnEntityInWorld(player); + newWorld.spawnEntity(player); player.setLocationAndAngles(coord.xCoord+0.5, coord.yCoord+1, coord.zCoord+0.5, player.rotationYaw, player.rotationPitch); newWorld.updateEntityWithOptionalForce(player, false); player.setWorld(newWorld); @@ -434,18 +426,18 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo { WorldServer world = server.worldServerForDimension(coord.dimensionId); - if(entity.worldObj.provider.getDimension() != coord.dimensionId) + if(entity.world.provider.getDimension() != coord.dimensionId) { - entity.worldObj.removeEntity(entity); + entity.world.removeEntity(entity); entity.isDead = false; - world.spawnEntityInWorld(entity); + world.spawnEntity(entity); entity.setLocationAndAngles(coord.xCoord+0.5, coord.yCoord+1, coord.zCoord+0.5, entity.rotationYaw, entity.rotationPitch); world.updateEntityWithOptionalForce(entity, false); entity.setWorld(world); world.resetUpdateEntityTick(); - Entity e = EntityList.createEntityByName(EntityList.getEntityString(entity), world); + Entity e = EntityList.newEntity(entity.getClass(), world); if(e != null) { @@ -456,7 +448,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo exception.printStackTrace(); } - world.spawnEntityInWorld(e); + world.spawnEntity(e); teleporter.didTeleport.add(e.getPersistentID()); } @@ -476,7 +468,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo for(EnumFacing iterSide : MekanismUtils.SIDE_DIRS) { - if(upperCoord.offset(iterSide).isAirBlock(player.worldObj)) + if(upperCoord.offset(iterSide).isAirBlock(player.world)) { side = iterSide; break; @@ -509,7 +501,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo public List getToTeleport() { - List entities = worldObj.getEntitiesWithinAABB(Entity.class, teleportBounds); + List entities = world.getEntitiesWithinAABB(Entity.class, teleportBounds); List ret = new ArrayList(); for(Entity entity : entities) @@ -527,7 +519,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo { int energyCost = 1000; - if(entity.worldObj.provider.getDimension() != coords.dimensionId) + if(entity.world.provider.getDimension() != coords.dimensionId) { energyCost+=10000; } @@ -555,7 +547,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo public boolean isFrame(int x, int y, int z) { - IBlockState state = worldObj.getBlockState(new BlockPos(x, y, z)); + IBlockState state = world.getBlockState(new BlockPos(x, y, z)); return state.getBlock() == MekanismBlocks.BasicBlock && state.getBlock().getMetaFromState(state) == 7; } @@ -613,7 +605,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo if(manager != null) { - manager.remove(freq, getSecurity().getOwner()); + manager.remove(freq, getSecurity().getOwnerUUID()); } } diff --git a/src/main/java/mekanism/common/tile/TileEntityThermalEvaporationBlock.java b/src/main/java/mekanism/common/tile/TileEntityThermalEvaporationBlock.java index 13f998d23..a454d35c4 100644 --- a/src/main/java/mekanism/common/tile/TileEntityThermalEvaporationBlock.java +++ b/src/main/java/mekanism/common/tile/TileEntityThermalEvaporationBlock.java @@ -4,11 +4,13 @@ import java.util.HashSet; import java.util.Set; import mekanism.api.Coord4D; -import mekanism.common.integration.IComputerIntegration; +import mekanism.common.integration.computer.IComputerIntegration; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; public class TileEntityThermalEvaporationBlock extends TileEntityContainerBlock implements IComputerIntegration { @@ -20,20 +22,20 @@ public class TileEntityThermalEvaporationBlock extends TileEntityContainerBlock { super("ThermalEvaporationBlock"); - inventory = new ItemStack[0]; + inventory = NonNullList.withSize(0, ItemStack.EMPTY); } public TileEntityThermalEvaporationBlock(String fullName) { super(fullName); - inventory = new ItemStack[0]; + inventory = NonNullList.withSize(0, ItemStack.EMPTY); } @Override public void onUpdate() { - if(!worldObj.isRemote && ticker == 5 && !attempted && master == null) + if(!world.isRemote && ticker == 5 && !attempted && master == null) { updateController(); } @@ -72,7 +74,7 @@ public class TileEntityThermalEvaporationBlock extends TileEntityContainerBlock { super.onNeighborChange(block); - if(!worldObj.isRemote) + if(!world.isRemote) { TileEntityThermalEvaporationController tile = getController(); @@ -103,7 +105,7 @@ public class TileEntityThermalEvaporationBlock extends TileEntityContainerBlock { if(master != null) { - TileEntity tile = master.getTileEntity(worldObj); + TileEntity tile = master.getTileEntity(world); if(tile instanceof TileEntityThermalEvaporationController) { @@ -133,13 +135,13 @@ public class TileEntityThermalEvaporationBlock extends TileEntityContainerBlock { Coord4D coord = pos.offset(side); - if(!iterated.contains(coord) && coord.getTileEntity(worldObj) instanceof TileEntityThermalEvaporationBlock) + if(!iterated.contains(coord) && coord.getTileEntity(world) instanceof TileEntityThermalEvaporationBlock) { - ((TileEntityThermalEvaporationBlock)coord.getTileEntity(worldObj)).attempted = true; + ((TileEntityThermalEvaporationBlock)coord.getTileEntity(world)).attempted = true; - if(coord.getTileEntity(worldObj) instanceof TileEntityThermalEvaporationController) + if(coord.getTileEntity(world) instanceof TileEntityThermalEvaporationController) { - found = (TileEntityThermalEvaporationController)coord.getTileEntity(worldObj); + found = (TileEntityThermalEvaporationController)coord.getTileEntity(world); return; } diff --git a/src/main/java/mekanism/common/tile/TileEntityThermalEvaporationController.java b/src/main/java/mekanism/common/tile/TileEntityThermalEvaporationController.java index dafd4afc9..756d86b36 100644 --- a/src/main/java/mekanism/common/tile/TileEntityThermalEvaporationController.java +++ b/src/main/java/mekanism/common/tile/TileEntityThermalEvaporationController.java @@ -8,21 +8,21 @@ import java.util.Set; import mekanism.api.Coord4D; import mekanism.api.IEvaporationSolar; -import mekanism.api.MekanismConfig.general; import mekanism.api.Range4D; -import mekanism.api.util.CapabilityUtils; import mekanism.client.SparkleAnimation.INodeChecker; import mekanism.common.Mekanism; import mekanism.common.PacketHandler; import mekanism.common.base.IActiveState; import mekanism.common.base.ITankManager; import mekanism.common.capabilities.Capabilities; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.content.tank.TankUpdateProtocol; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.RecipeHandler.Recipe; import mekanism.common.recipe.inputs.FluidInput; import mekanism.common.recipe.machines.ThermalEvaporationRecipe; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.FluidContainerUtils; import mekanism.common.util.FluidContainerUtils.FluidChecker; import mekanism.common.util.MekanismUtils; @@ -31,6 +31,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; @@ -85,7 +86,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva { super("ThermalEvaporationController"); - inventory = new ItemStack[4]; + inventory = NonNullList.withSize(4, ItemStack.EMPTY); } @Override @@ -93,7 +94,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva { super.onUpdate(); - if(!worldObj.isRemote) + if(!world.isRemote) { updatedThisTick = false; @@ -188,7 +189,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva protected void refresh() { - if(!worldObj.isRemote) + if(!world.isRemote) { if(!updatedThisTick) { @@ -232,7 +233,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva { if(outputTank.getFluid() != null) { - if(FluidContainerUtils.isFluidContainer(inventory[2])) + if(FluidContainerUtils.isFluidContainer(inventory.get(2))) { FluidContainerUtils.handleContainerItemFill(this, outputTank, 2, 3); } @@ -240,7 +241,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva if(structured) { - if(FluidContainerUtils.isFluidContainer(inventory[0])) + if(FluidContainerUtils.isFluidContainer(inventory.get(0))) { FluidContainerUtils.handleContainerItemEmpty(this, inputTank, 0, 1, new FluidChecker() { @Override @@ -257,7 +258,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva { if(!temperatureSet) { - biomeTemp = worldObj.getBiomeForCoordsBody(getPos()).getFloatTemperature(getPos()); + biomeTemp = world.getBiomeForCoordsBody(getPos()).getFloatTemperature(getPos()); temperatureSet = true; } @@ -302,7 +303,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva public int getActiveSolars() { - if(worldObj.isRemote) + if(world.isRemote) { return clientSolarAmount; } @@ -331,13 +332,13 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva Coord4D startPoint = Coord4D.get(this); - while(startPoint.offset(EnumFacing.UP).getTileEntity(worldObj) instanceof TileEntityThermalEvaporationBlock) + while(startPoint.offset(EnumFacing.UP).getTileEntity(world) instanceof TileEntityThermalEvaporationBlock) { startPoint = startPoint.offset(EnumFacing.UP); } Coord4D test = startPoint.offset(EnumFacing.DOWN).offset(right, 2); - isLeftOnFace = test.getTileEntity(worldObj) instanceof TileEntityThermalEvaporationBlock; + isLeftOnFace = test.getTileEntity(world) instanceof TileEntityThermalEvaporationBlock; startPoint = startPoint.offset(left, isLeftOnFace ? 1 : 2); @@ -380,17 +381,17 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva for(int z = 0; z < 4; z++) { Coord4D pointer = current.offset(right, x).offset(back, z); - TileEntity pointerTile = pointer.getTileEntity(worldObj); + TileEntity pointerTile = pointer.getTileEntity(world); int corner = getCorner(x, z); if(corner != -1) { - if(addSolarPanel(pointer.getTileEntity(worldObj), corner)) + if(addSolarPanel(pointer.getTileEntity(world), corner)) { continue; } - else if(pointer.offset(EnumFacing.UP).getTileEntity(worldObj) instanceof TileEntityThermalEvaporationBlock || !addTankPart(pointerTile)) + else if(pointer.offset(EnumFacing.UP).getTileEntity(world) instanceof TileEntityThermalEvaporationBlock || !addTankPart(pointerTile)) { return false; } @@ -398,13 +399,13 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva else { if((x == 1 || x == 2) && (z == 1 || z == 2)) { - if(!pointer.isAirBlock(worldObj)) + if(!pointer.isAirBlock(world)) { return false; } } else { - if(pointer.offset(EnumFacing.UP).getTileEntity(worldObj) instanceof TileEntityThermalEvaporationBlock || !addTankPart(pointerTile)) + if(pointer.offset(EnumFacing.UP).getTileEntity(world) instanceof TileEntityThermalEvaporationBlock || !addTankPart(pointerTile)) { return false; } @@ -455,7 +456,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva for(int z = 0; z < 4; z++) { Coord4D pointer = current.offset(right, x).offset(back, z); - TileEntity pointerTile = pointer.getTileEntity(worldObj); + TileEntity pointerTile = pointer.getTileEntity(world); if((x == 1 || x == 2) && (z == 1 || z == 2)) { @@ -474,7 +475,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva } } else { - if(foundCenter || !pointer.isAirBlock(worldObj)) + if(foundCenter || !pointer.isAirBlock(world)) { height = -1; return false; @@ -589,7 +590,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva if(structured != clientStructured) { inputTank.setCapacity(getMaxFluid()); - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); if(structured) { @@ -692,7 +693,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva { for(Coord4D tankPart : tankParts) { - TileEntity tile = tankPart.getTileEntity(worldObj); + TileEntity tile = tankPart.getTileEntity(world); if(tile instanceof TileEntityThermalEvaporationBlock) { diff --git a/src/main/java/mekanism/common/tile/TileEntityThermalEvaporationValve.java b/src/main/java/mekanism/common/tile/TileEntityThermalEvaporationValve.java index 124401c99..e6b813034 100644 --- a/src/main/java/mekanism/common/tile/TileEntityThermalEvaporationValve.java +++ b/src/main/java/mekanism/common/tile/TileEntityThermalEvaporationValve.java @@ -22,7 +22,7 @@ public class TileEntityThermalEvaporationValve extends TileEntityThermalEvaporat { super.onUpdate(); - if(!worldObj.isRemote) + if(!world.isRemote) { if((master == null) == prevMaster) { @@ -30,9 +30,9 @@ public class TileEntityThermalEvaporationValve extends TileEntityThermalEvaporat { Coord4D obj = Coord4D.get(this).offset(side); - if(!obj.isAirBlock(worldObj) && !(obj.getTileEntity(worldObj) instanceof TileEntityThermalEvaporationBlock)) + if(!obj.isAirBlock(world) && !(obj.getTileEntity(world) instanceof TileEntityThermalEvaporationBlock)) { - obj.getBlock(worldObj).onNeighborChange(worldObj, obj.getPos(), getPos()); + obj.getBlock(world).onNeighborChange(world, obj.getPos(), getPos()); } } } diff --git a/src/main/java/mekanism/common/tile/component/TileComponentAdvancedUpgrade.java b/src/main/java/mekanism/common/tile/component/TileComponentAdvancedUpgrade.java deleted file mode 100644 index ead2bb703..000000000 --- a/src/main/java/mekanism/common/tile/component/TileComponentAdvancedUpgrade.java +++ /dev/null @@ -1,14 +0,0 @@ -package mekanism.common.tile.component; - -import mekanism.common.Upgrade; -import mekanism.common.tile.TileEntityContainerBlock; - -public class TileComponentAdvancedUpgrade extends TileComponentUpgrade -{ - public TileComponentAdvancedUpgrade(TileEntityContainerBlock tile, int slot) - { - super(tile, slot); - - setSupported(Upgrade.GAS); - } -} diff --git a/src/main/java/mekanism/common/tile/component/TileComponentChunkLoader.java b/src/main/java/mekanism/common/tile/component/TileComponentChunkLoader.java index b25d34500..a1c755798 100644 --- a/src/main/java/mekanism/common/tile/component/TileComponentChunkLoader.java +++ b/src/main/java/mekanism/common/tile/component/TileComponentChunkLoader.java @@ -7,13 +7,13 @@ import java.util.HashSet; import java.util.Set; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; import mekanism.common.Mekanism; import mekanism.common.Upgrade; import mekanism.common.base.ITileComponent; import mekanism.common.base.IUpgradeTile; import mekanism.common.chunkloading.IChunkLoader; -import mekanism.common.tile.TileEntityContainerBlock; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.math.ChunkPos; diff --git a/src/main/java/mekanism/common/tile/component/TileComponentConfig.java b/src/main/java/mekanism/common/tile/component/TileComponentConfig.java index 2dffd03f9..bf192963c 100644 --- a/src/main/java/mekanism/common/tile/component/TileComponentConfig.java +++ b/src/main/java/mekanism/common/tile/component/TileComponentConfig.java @@ -13,7 +13,7 @@ import mekanism.api.transmitters.TransmissionType; import mekanism.common.SideData; import mekanism.common.SideData.IOState; import mekanism.common.base.ITileComponent; -import mekanism.common.tile.TileEntityContainerBlock; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.nbt.NBTTagCompound; @@ -138,11 +138,21 @@ public class TileComponentConfig implements ITileComponent public SideData getOutput(TransmissionType type, EnumFacing side, EnumFacing facing) { + if(side == null) + { + return EMPTY; + } + return getOutput(type, MekanismUtils.getBaseOrientation(side, facing)); } public SideData getOutput(TransmissionType type, EnumFacing side) { + if(side == null) + { + return EMPTY; + } + int index = getConfig(type)[side.ordinal()]; if(index == -1) diff --git a/src/main/java/mekanism/common/tile/component/TileComponentEjector.java b/src/main/java/mekanism/common/tile/component/TileComponentEjector.java index 82b50238f..0610c9d72 100644 --- a/src/main/java/mekanism/common/tile/component/TileComponentEjector.java +++ b/src/main/java/mekanism/common/tile/component/TileComponentEjector.java @@ -11,21 +11,21 @@ import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; -import mekanism.api.gas.GasTransmission; import mekanism.api.transmitters.TransmissionType; -import mekanism.api.util.CapabilityUtils; import mekanism.common.SideData; import mekanism.common.base.ISideConfiguration; import mekanism.common.base.ITankManager; import mekanism.common.base.ITileComponent; import mekanism.common.capabilities.Capabilities; -import mekanism.common.content.transporter.TransporterManager; -import mekanism.common.tile.TileEntityContainerBlock; +import mekanism.common.content.transporter.TransitRequest; +import mekanism.common.content.transporter.TransitRequest.TransitResponse; +import mekanism.common.tile.prefab.TileEntityContainerBlock; +import mekanism.common.util.CapabilityUtils; +import mekanism.common.util.GasUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.PipeUtils; import mekanism.common.util.TransporterUtils; -import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -122,7 +122,7 @@ public class TileComponentEjector implements ITileComponent if(tank.getStored() > 0) { GasStack toEmit = tank.getGas().copy().withAmount(Math.min(GAS_OUTPUT, tank.getStored())); - int emit = GasTransmission.emit(toEmit, tileEntity, outputSides); + int emit = GasUtils.emit(toEmit, tileEntity, outputSides); tank.draw(emit, true); } } @@ -180,7 +180,7 @@ public class TileComponentEjector implements ITileComponent { int slotID = sideData.get(TransmissionType.ITEM).availableSlots[index]; - if(tileEntity.getStackInSlot(slotID) == null) + if(tileEntity.getStackInSlot(slotID).isEmpty()) { continue; } @@ -193,26 +193,30 @@ public class TileComponentEjector implements ITileComponent TileEntity tile = Coord4D.get(tileEntity).offset(side).getTileEntity(tileEntity.getWorld()); ItemStack prev = stack.copy(); - if(tile instanceof IInventory && !(CapabilityUtils.hasCapability(tile, Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, side.getOpposite()))) + if(CapabilityUtils.hasCapability(tile, Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, side.getOpposite())) { - stack = InventoryUtils.putStackInInventory((IInventory)tile, stack, side, false); - } - else if(CapabilityUtils.hasCapability(tile, Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, side.getOpposite())) - { - ItemStack rejects = TransporterUtils.insert(tileEntity, CapabilityUtils.getCapability(tile, Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, side.getOpposite()), stack, outputColor, true, 0); + TransitResponse response = TransporterUtils.insert(tileEntity, CapabilityUtils.getCapability(tile, Capabilities.LOGISTICAL_TRANSPORTER_CAPABILITY, side.getOpposite()), TransitRequest.getFromStack(stack.copy()), outputColor, true, 0); - if(TransporterManager.didEmit(stack, rejects)) + if(!response.isEmpty()) { - stack = rejects; + stack.shrink(response.stack.getCount()); + } + } + else { + TransitResponse response = InventoryUtils.putStackInInventory(tile, TransitRequest.getFromStack(stack.copy()), side, false); + + if(!response.isEmpty()) + { + stack.shrink(response.stack.getCount()); } } - if(stack == null || prev.stackSize != stack.stackSize) + if(stack.isEmpty() || prev.getCount() != stack.getCount()) { trackers.get(TransmissionType.ITEM)[index] = side.ordinal(); } - if(stack == null) + if(stack.isEmpty()) { break; } diff --git a/src/main/java/mekanism/common/tile/component/TileComponentSecurity.java b/src/main/java/mekanism/common/tile/component/TileComponentSecurity.java index 56d676cff..a2af50f49 100644 --- a/src/main/java/mekanism/common/tile/component/TileComponentSecurity.java +++ b/src/main/java/mekanism/common/tile/component/TileComponentSecurity.java @@ -3,26 +3,29 @@ package mekanism.common.tile.component; import io.netty.buffer.ByteBuf; import java.util.ArrayList; +import java.util.UUID; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; import mekanism.common.Mekanism; import mekanism.common.PacketHandler; import mekanism.common.base.ITileComponent; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.frequency.Frequency; import mekanism.common.frequency.FrequencyManager; import mekanism.common.security.ISecurityTile.SecurityMode; import mekanism.common.security.SecurityFrequency; -import mekanism.common.tile.TileEntityContainerBlock; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import mekanism.common.util.MekanismUtils; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.UsernameCache; public class TileComponentSecurity implements ITileComponent { /** TileEntity implementing this component. */ public TileEntityContainerBlock tileEntity; - private String owner; + private UUID ownerUUID; + private String clientOwner; private SecurityMode securityMode = SecurityMode.PUBLIC; @@ -37,7 +40,7 @@ public class TileComponentSecurity implements ITileComponent public void readFrom(TileComponentSecurity security) { - owner = security.owner; + ownerUUID = security.ownerUUID; securityMode = security.securityMode; } @@ -46,22 +49,29 @@ public class TileComponentSecurity implements ITileComponent return frequency; } - public String getOwner() + public UUID getOwnerUUID() { - return owner; + return ownerUUID; } - public void setOwner(String o) + public String getClientOwner() + { + return clientOwner; + } + + public void setOwnerUUID(UUID uuid) { frequency = null; - owner = o; + ownerUUID = uuid; } public SecurityMode getMode() { - if(general.allowProtection) { + if(general.allowProtection) + { return securityMode; - } else { + } + else { return SecurityMode.PUBLIC; } } @@ -73,7 +83,7 @@ public class TileComponentSecurity implements ITileComponent public FrequencyManager getManager(Frequency freq) { - if(owner == null || freq == null) + if(ownerUUID == null || freq == null) { return null; } @@ -81,14 +91,14 @@ public class TileComponentSecurity implements ITileComponent return Mekanism.securityFrequencies; } - public void setFrequency(String owner) + public void setFrequency(UUID owner) { FrequencyManager manager = Mekanism.securityFrequencies; manager.deactivate(Coord4D.get(tileEntity)); for(Frequency freq : manager.getFrequencies()) { - if(freq.owner.equals(owner)) + if(freq.ownerUUID.equals(owner)) { frequency = (SecurityFrequency)freq; frequency.activeCoords.add(Coord4D.get(tileEntity)); @@ -111,9 +121,9 @@ public class TileComponentSecurity implements ITileComponent { if(!tileEntity.getWorld().isRemote) { - if(frequency == null && owner != null) + if(frequency == null && ownerUUID != null) { - setFrequency(owner); + setFrequency(ownerUUID); } FrequencyManager manager = getManager(frequency); @@ -122,12 +132,12 @@ public class TileComponentSecurity implements ITileComponent { if(frequency != null && !frequency.valid) { - frequency = (SecurityFrequency)manager.validateFrequency(owner, Coord4D.get(tileEntity), frequency); + frequency = (SecurityFrequency)manager.validateFrequency(ownerUUID, Coord4D.get(tileEntity), frequency); } if(frequency != null) { - frequency = (SecurityFrequency)manager.update(owner, Coord4D.get(tileEntity), frequency); + frequency = (SecurityFrequency)manager.update(Coord4D.get(tileEntity), frequency); } } else { @@ -141,9 +151,9 @@ public class TileComponentSecurity implements ITileComponent { securityMode = SecurityMode.values()[nbtTags.getInteger("securityMode")]; - if(nbtTags.hasKey("owner")) + if(nbtTags.hasKey("ownerUUID")) { - owner = nbtTags.getString("owner"); + ownerUUID = UUID.fromString(nbtTags.getString("ownerUUID")); } if(nbtTags.hasKey("securityFreq")) @@ -160,10 +170,12 @@ public class TileComponentSecurity implements ITileComponent if(dataStream.readBoolean()) { - owner = PacketHandler.readString(dataStream); + ownerUUID = UUID.fromString(PacketHandler.readString(dataStream)); + clientOwner = PacketHandler.readString(dataStream); } else { - owner = null; + ownerUUID = null; + clientOwner = null; } if(dataStream.readBoolean()) @@ -180,9 +192,9 @@ public class TileComponentSecurity implements ITileComponent { nbtTags.setInteger("securityMode", securityMode.ordinal()); - if(owner != null) + if(ownerUUID != null) { - nbtTags.setString("owner", owner); + nbtTags.setString("ownerUUID", ownerUUID.toString()); } if(frequency != null) @@ -198,10 +210,11 @@ public class TileComponentSecurity implements ITileComponent { data.add(securityMode.ordinal()); - if(owner != null) + if(ownerUUID != null) { data.add(true); - data.add(owner); + data.add(ownerUUID.toString()); + data.add(UsernameCache.getLastKnownUsername(ownerUUID)); } else { data.add(false); diff --git a/src/main/java/mekanism/common/tile/component/TileComponentUpgrade.java b/src/main/java/mekanism/common/tile/component/TileComponentUpgrade.java index 23ae4e2f7..d61665133 100644 --- a/src/main/java/mekanism/common/tile/component/TileComponentUpgrade.java +++ b/src/main/java/mekanism/common/tile/component/TileComponentUpgrade.java @@ -15,7 +15,7 @@ import mekanism.common.Upgrade; import mekanism.common.base.ITileComponent; import mekanism.common.base.IUpgradeItem; import mekanism.common.network.PacketTileEntity.TileEntityMessage; -import mekanism.common.tile.TileEntityContainerBlock; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import net.minecraft.nbt.NBTTagCompound; public class TileComponentUpgrade implements ITileComponent @@ -60,9 +60,9 @@ public class TileComponentUpgrade implements ITileComponent { if(!tileEntity.getWorld().isRemote) { - if(tileEntity.inventory[upgradeSlot] != null && tileEntity.inventory[upgradeSlot].getItem() instanceof IUpgradeItem) + if(!tileEntity.inventory.get(upgradeSlot).isEmpty() && tileEntity.inventory.get(upgradeSlot).getItem() instanceof IUpgradeItem) { - Upgrade type = ((IUpgradeItem)tileEntity.inventory[upgradeSlot].getItem()).getUpgradeType(tileEntity.inventory[upgradeSlot]); + Upgrade type = ((IUpgradeItem)tileEntity.inventory.get(upgradeSlot).getItem()).getUpgradeType(tileEntity.inventory.get(upgradeSlot)); if(supports(type) && getUpgrades(type) < type.getMax()) { @@ -75,12 +75,7 @@ public class TileComponentUpgrade implements ITileComponent upgradeTicks = 0; addUpgrade(type); - tileEntity.inventory[upgradeSlot].stackSize--; - - if(tileEntity.inventory[upgradeSlot].stackSize == 0) - { - tileEntity.inventory[upgradeSlot] = null; - } + tileEntity.inventory.get(upgradeSlot).shrink(1); Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(tileEntity))); tileEntity.markDirty(); diff --git a/src/main/java/mekanism/common/tile/TileEntityAdvancedElectricMachine.java b/src/main/java/mekanism/common/tile/prefab/TileEntityAdvancedElectricMachine.java similarity index 90% rename from src/main/java/mekanism/common/tile/TileEntityAdvancedElectricMachine.java rename to src/main/java/mekanism/common/tile/prefab/TileEntityAdvancedElectricMachine.java index 243bf4707..fe3ceccd1 100644 --- a/src/main/java/mekanism/common/tile/TileEntityAdvancedElectricMachine.java +++ b/src/main/java/mekanism/common/tile/prefab/TileEntityAdvancedElectricMachine.java @@ -1,4 +1,4 @@ -package mekanism.common.tile; +package mekanism.common.tile.prefab; import io.netty.buffer.ByteBuf; @@ -23,10 +23,9 @@ import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.inputs.AdvancedMachineInput; import mekanism.common.recipe.machines.AdvancedMachineRecipe; import mekanism.common.recipe.outputs.ItemStackOutput; -import mekanism.common.tile.component.TileComponentAdvancedUpgrade; +import mekanism.common.tile.TileEntityFactory; import mekanism.common.tile.component.TileComponentConfig; import mekanism.common.tile.component.TileComponentEjector; -import mekanism.common.tile.component.TileComponentUpgrade; import mekanism.common.util.ChargeUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; @@ -35,6 +34,7 @@ import mekanism.common.util.StatUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -65,9 +65,9 @@ public abstract class TileEntityAdvancedElectricMachine 0) + if(!inventory.get(1).isEmpty() && gasTank.getNeeded() > 0) { - GasStack stack = getItemGas(inventory[1]); + GasStack stack = getItemGas(inventory.get(1)); int gasNeeded = gasTank.getNeeded(); if(stack != null && gasTank.canReceive(stack.getGas()) && gasNeeded >= stack.amount) { gasTank.receive(stack, true); - inventory[1].stackSize--; - - if(inventory[1].stackSize == 0) - { - inventory[1] = null; - } + inventory.get(1).shrink(1); } } } @@ -291,7 +288,7 @@ public abstract class TileEntityAdvancedElectricMachine 0) { @@ -126,8 +126,8 @@ public abstract class TileEntityBasicBlock extends TileEntity implements ITileNe if(clientFacing != facing) { - MekanismUtils.updateBlock(worldObj, getPos()); - worldObj.notifyNeighborsOfStateChange(getPos(), worldObj.getBlockState(getPos()).getBlock()); + MekanismUtils.updateBlock(world, getPos()); + world.notifyNeighborsOfStateChange(getPos(), world.getBlockState(getPos()).getBlock(), true); clientFacing = facing; } @@ -168,7 +168,7 @@ public abstract class TileEntityBasicBlock extends TileEntity implements ITileNe { super.validate(); - if(worldObj.isRemote) + if(world.isRemote) { Mekanism.packetHandler.sendToServer(new DataRequestMessage(Coord4D.get(this))); } @@ -184,7 +184,11 @@ public abstract class TileEntityBasicBlock extends TileEntity implements ITileNe { super.readFromNBT(nbtTags); - facing = EnumFacing.getFront(nbtTags.getInteger("facing")); + if(nbtTags.hasKey("facing")) + { + facing = EnumFacing.getFront(nbtTags.getInteger("facing")); + } + redstone = nbtTags.getBoolean("redstone"); for(ITileComponent component : components) @@ -198,7 +202,11 @@ public abstract class TileEntityBasicBlock extends TileEntity implements ITileNe { super.writeToNBT(nbtTags); - nbtTags.setInteger("facing", facing == null ? -1 : facing.ordinal()); + if(facing != null) + { + nbtTags.setInteger("facing", facing.ordinal()); + } + nbtTags.setBoolean("redstone", redstone); for(ITileComponent component : components) @@ -230,7 +238,7 @@ public abstract class TileEntityBasicBlock extends TileEntity implements ITileNe facing = EnumFacing.getFront(direction); } - if(!(facing == clientFacing || worldObj.isRemote)) + if(!(facing == clientFacing || world.isRemote)) { Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); markDirty(); @@ -262,7 +270,7 @@ public abstract class TileEntityBasicBlock extends TileEntity implements ITileNe public void onNeighborChange(Block block) { - if(!worldObj.isRemote) + if(!world.isRemote) { updatePower(); } @@ -270,7 +278,7 @@ public abstract class TileEntityBasicBlock extends TileEntity implements ITileNe private void updatePower() { - boolean power = worldObj.isBlockIndirectlyGettingPowered(getPos()) > 0; + boolean power = world.isBlockIndirectlyGettingPowered(getPos()) > 0; if(redstone != power) { @@ -299,4 +307,22 @@ public abstract class TileEntityBasicBlock extends TileEntity implements ITileNe return null; } + + @Override + public NBTTagCompound getUpdateTag() + { + // Forge writes only x/y/z/id info to a new NBT Tag Compound. This is fine, we have a custom network system + // to send other data so we don't use this one (yet). + return super.getUpdateTag(); + } + + @Override + public void handleUpdateTag(NBTTagCompound tag) + { + // The super implementation of handleUpdateTag is to call this readFromNBT. But, the given TagCompound + // only has x/y/z/id data, so our readFromNBT will set a bunch of default values which are wrong. + // So simply call the super's readFromNBT, to let Forge do whatever it wants, but don't treat this like + // a full NBT object, don't pass it to our custom read methods. + super.readFromNBT(tag); + } } diff --git a/src/main/java/mekanism/common/tile/prefab/TileEntityBasicMachine.java b/src/main/java/mekanism/common/tile/prefab/TileEntityBasicMachine.java new file mode 100644 index 000000000..e72b39745 --- /dev/null +++ b/src/main/java/mekanism/common/tile/prefab/TileEntityBasicMachine.java @@ -0,0 +1,91 @@ +package mekanism.common.tile.prefab; + +import java.util.EnumSet; + +import mekanism.api.IConfigCardAccess; +import mekanism.api.transmitters.TransmissionType; +import mekanism.common.base.IElectricMachine; +import mekanism.common.base.ISideConfiguration; +import mekanism.common.capabilities.Capabilities; +import mekanism.common.integration.computer.IComputerIntegration; +import mekanism.common.recipe.inputs.MachineInput; +import mekanism.common.recipe.machines.MachineRecipe; +import mekanism.common.recipe.outputs.MachineOutput; +import mekanism.common.tile.component.TileComponentConfig; +import mekanism.common.tile.component.TileComponentEjector; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.capabilities.Capability; + +public abstract class TileEntityBasicMachine, OUTPUT extends MachineOutput, RECIPE extends MachineRecipe> extends TileEntityOperationalMachine implements IElectricMachine, IComputerIntegration, ISideConfiguration, IConfigCardAccess +{ + public ResourceLocation guiLocation; + + public RECIPE cachedRecipe = null; + + public TileComponentEjector ejectorComponent; + public TileComponentConfig configComponent; + + /** + * The foundation of all machines - a simple tile entity with a facing, active state, initialized state, sound effect, and animated texture. + * @param soundPath - location of the sound effect + * @param name - full name of this machine + * @param location - GUI texture path of this machine + * @param perTick - the energy this machine consumes every tick in it's active state + * @param baseTicksRequired - how many ticks it takes to run a cycle + * @param maxEnergy - how much energy this machine can store + */ + public TileEntityBasicMachine(String soundPath, String name, double maxEnergy, double baseEnergyUsage, int upgradeSlot, int baseTicksRequired, ResourceLocation location) + { + super("machine." + soundPath, name, maxEnergy, baseEnergyUsage, upgradeSlot, baseTicksRequired); + + guiLocation = location; + } + + @Override + public EnumSet getConsumingSides() + { + return configComponent.getSidesForData(TransmissionType.ENERGY, facing, 1); + } + + @Override + public int[] getSlotsForFace(EnumFacing side) + { + return configComponent.getOutput(TransmissionType.ITEM, side, facing).availableSlots; + } + + @Override + public TileComponentConfig getConfig() + { + return configComponent; + } + + @Override + public EnumFacing getOrientation() + { + return facing; + } + + @Override + public TileComponentEjector getEjector() + { + return ejectorComponent; + } + + @Override + public boolean hasCapability(Capability capability, EnumFacing side) + { + return capability == Capabilities.CONFIG_CARD_CAPABILITY || super.hasCapability(capability, side); + } + + @Override + public T getCapability(Capability capability, EnumFacing side) + { + if(capability == Capabilities.CONFIG_CARD_CAPABILITY) + { + return (T)this; + } + + return super.getCapability(capability, side); + } +} diff --git a/src/main/java/mekanism/common/tile/TileEntityContainerBlock.java b/src/main/java/mekanism/common/tile/prefab/TileEntityContainerBlock.java similarity index 65% rename from src/main/java/mekanism/common/tile/TileEntityContainerBlock.java rename to src/main/java/mekanism/common/tile/prefab/TileEntityContainerBlock.java index 8eb2932fa..83397a91b 100644 --- a/src/main/java/mekanism/common/tile/TileEntityContainerBlock.java +++ b/src/main/java/mekanism/common/tile/prefab/TileEntityContainerBlock.java @@ -1,27 +1,30 @@ -package mekanism.common.tile; +package mekanism.common.tile.prefab; import mekanism.common.Upgrade; import mekanism.common.base.ISustainedInventory; +import mekanism.common.base.ItemHandlerWrapper; +import mekanism.common.capabilities.CapabilityWrapperManager; import mekanism.common.util.InventoryUtils; import mekanism.common.util.LangUtils; -import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; +import net.minecraft.inventory.ItemStackHelper; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; -import net.minecraft.util.math.BlockPos; +import net.minecraft.util.NonNullList; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; -import net.minecraft.world.World; +import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.Constants.NBT; +import net.minecraftforge.items.CapabilityItemHandler; public abstract class TileEntityContainerBlock extends TileEntityBasicBlock implements ISidedInventory, ISustainedInventory, ITickable { /** The inventory slot itemstacks used by this block. */ - public ItemStack[] inventory; + public NonNullList inventory; /** The full name of this machine. */ public String fullName; @@ -34,6 +37,20 @@ public abstract class TileEntityContainerBlock extends TileEntityBasicBlock impl { fullName = name; } + + @Override + public boolean isEmpty() + { + for(ItemStack stack : getInventory()) + { + if(!stack.isEmpty()) + { + return false; + } + } + + return true; + } @Override public void readFromNBT(NBTTagCompound nbtTags) @@ -43,7 +60,7 @@ public abstract class TileEntityContainerBlock extends TileEntityBasicBlock impl if(handleInventory()) { NBTTagList tagList = nbtTags.getTagList("Items", NBT.TAG_COMPOUND); - inventory = new ItemStack[getSizeInventory()]; + inventory = NonNullList.withSize(getSizeInventory(), ItemStack.EMPTY); for(int tagCount = 0; tagCount < tagList.tagCount(); tagCount++) { @@ -52,7 +69,7 @@ public abstract class TileEntityContainerBlock extends TileEntityBasicBlock impl if(slotID >= 0 && slotID < getSizeInventory()) { - setInventorySlotContents(slotID, ItemStack.loadItemStackFromNBT(tagCompound)); + setInventorySlotContents(slotID, InventoryUtils.loadFromNBT(tagCompound)); } } } @@ -83,77 +100,61 @@ public abstract class TileEntityContainerBlock extends TileEntityBasicBlock impl return nbtTags; } + + protected NonNullList getInventory() + { + return inventory; + } @Override public int getSizeInventory() { - return inventory != null ? inventory.length : 0; + return getInventory() != null ? getInventory().size() : 0; } @Override public ItemStack getStackInSlot(int slotID) { - return inventory != null ? inventory[slotID] : null; + return getInventory() != null ? getInventory().get(slotID) : ItemStack.EMPTY; } @Override public ItemStack decrStackSize(int slotID, int amount) { - if(getStackInSlot(slotID) != null) + if(getInventory() == null) { - ItemStack tempStack; - - if(getStackInSlot(slotID).stackSize <= amount) - { - tempStack = getStackInSlot(slotID); - setInventorySlotContents(slotID, null); - return tempStack; - } - else { - tempStack = getStackInSlot(slotID).splitStack(amount); - - if(getStackInSlot(slotID).stackSize == 0) - { - setInventorySlotContents(slotID, null); - } - - return tempStack; - } - } - else { - return null; + return ItemStack.EMPTY; } + + return ItemStackHelper.getAndSplit(getInventory(), slotID, amount); } @Override public ItemStack removeStackFromSlot(int slotID) { - if(getStackInSlot(slotID) != null) + if(getInventory() == null) { - ItemStack tempStack = getStackInSlot(slotID); - setInventorySlotContents(slotID, null); - return tempStack; - } - else { - return null; + return ItemStack.EMPTY; } + + return ItemStackHelper.getAndRemove(getInventory(), slotID); } @Override public void setInventorySlotContents(int slotID, ItemStack itemstack) { - inventory[slotID] = itemstack; + getInventory().set(slotID, itemstack); - if(itemstack != null && itemstack.stackSize > getInventoryStackLimit()) + if(!itemstack.isEmpty() && itemstack.getCount() > getInventoryStackLimit()) { - itemstack.stackSize = getInventoryStackLimit(); + itemstack.setCount(getInventoryStackLimit()); } markDirty(); } @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) + public boolean isUsableByPlayer(EntityPlayer entityplayer) { return !isInvalid(); } @@ -214,16 +215,16 @@ public abstract class TileEntityContainerBlock extends TileEntityBasicBlock impl return; } - inventory = new ItemStack[getSizeInventory()]; - + inventory = NonNullList.withSize(getSizeInventory(), ItemStack.EMPTY); + for(int slots = 0; slots < nbtTags.tagCount(); slots++) { NBTTagCompound tagCompound = (NBTTagCompound)nbtTags.getCompoundTagAt(slots); byte slotID = tagCompound.getByte("Slot"); - if(slotID >= 0 && slotID < inventory.length) + if(slotID >= 0 && slotID < inventory.size()) { - inventory[slotID] = ItemStack.loadItemStackFromNBT(tagCompound); + inventory.set(slotID, InventoryUtils.loadFromNBT(tagCompound)); } } } @@ -235,13 +236,13 @@ public abstract class TileEntityContainerBlock extends TileEntityBasicBlock impl if(handleInventory()) { - for(int slots = 0; slots < inventory.length; slots++) + for(int slots = 0; slots < inventory.size(); slots++) { - if(inventory[slots] != null) + if(!inventory.get(slots).isEmpty()) { NBTTagCompound tagCompound = new NBTTagCompound(); tagCompound.setByte("Slot", (byte)slots); - inventory[slots].writeToNBT(tagCompound); + inventory.get(slots).writeToNBT(tagCompound); tagList.appendTag(tagCompound); } } @@ -280,4 +281,23 @@ public abstract class TileEntityContainerBlock extends TileEntityBasicBlock impl { return new TextComponentString(getName()); } + + @Override + public boolean hasCapability(Capability capability, EnumFacing facing) + { + return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing); + } + + private CapabilityWrapperManager itemManager = new CapabilityWrapperManager(ISidedInventory.class, ItemHandlerWrapper.class); + + @Override + public T getCapability(Capability capability, EnumFacing facing) + { + if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) + { + return (T)itemManager.getWrapper(this, facing); + } + + return super.getCapability(capability, facing); + } } diff --git a/src/main/java/mekanism/common/tile/TileEntityElectricBlock.java b/src/main/java/mekanism/common/tile/prefab/TileEntityElectricBlock.java similarity index 80% rename from src/main/java/mekanism/common/tile/TileEntityElectricBlock.java rename to src/main/java/mekanism/common/tile/prefab/TileEntityElectricBlock.java index 5340044d0..c5b417fb9 100644 --- a/src/main/java/mekanism/common/tile/TileEntityElectricBlock.java +++ b/src/main/java/mekanism/common/tile/prefab/TileEntityElectricBlock.java @@ -1,4 +1,4 @@ -package mekanism.common.tile; +package mekanism.common.tile.prefab; import ic2.api.energy.EnergyNet; import ic2.api.energy.event.EnergyTileLoadEvent; @@ -12,18 +12,20 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; import java.util.EnumSet; -import mekanism.api.MekanismConfig.general; -import mekanism.api.util.CapabilityUtils; import mekanism.common.base.IEnergyWrapper; import mekanism.common.capabilities.Capabilities; import mekanism.common.capabilities.CapabilityWrapperManager; -import mekanism.common.integration.TeslaIntegration; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.integration.forgeenergy.ForgeEnergyIntegration; +import mekanism.common.integration.tesla.TeslaIntegration; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Optional.Method; @@ -57,9 +59,9 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i @Method(modid = "IC2") public void register() { - if(!worldObj.isRemote) + if(!world.isRemote) { - IEnergyTile registered = EnergyNet.instance.getTile(worldObj, getPos()); + IEnergyTile registered = EnergyNet.instance.getTile(world, getPos()); if(registered != this) { @@ -79,9 +81,9 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i @Method(modid = "IC2") public void deregister() { - if(!worldObj.isRemote) + if(!world.isRemote) { - IEnergyTile registered = EnergyNet.instance.getTile(worldObj, getPos()); + IEnergyTile registered = EnergyNet.instance.getTile(world, getPos()); if(registered instanceof IEnergyTile) { @@ -221,37 +223,13 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i @Override public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate) { - if(getConsumingSides().contains(from)) - { - double toAdd = (int)Math.min(getMaxEnergy()-getEnergy(), maxReceive*general.FROM_RF); - - if(!simulate) - { - setEnergy(getEnergy() + toAdd); - } - - return (int)Math.round(toAdd*general.TO_RF); - } - - return 0; + return (int)Math.round(Math.min(Integer.MAX_VALUE, acceptEnergy(from, maxReceive*general.FROM_RF, simulate)*general.TO_RF)); } @Override public int extractEnergy(EnumFacing from, int maxExtract, boolean simulate) { - if(getOutputtingSides().contains(from)) - { - double toSend = Math.min(getEnergy(), Math.min(getMaxOutput(), maxExtract*general.FROM_RF)); - - if(!simulate) - { - setEnergy(getEnergy() - toSend); - } - - return (int)Math.round(toSend*general.TO_RF); - } - - return 0; + return (int)Math.round(Math.min(Integer.MAX_VALUE, pullEnergy(from, maxExtract*general.FROM_RF, simulate)*general.TO_RF)); } @Override @@ -263,13 +241,13 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i @Override public int getEnergyStored(EnumFacing from) { - return (int)Math.round(getEnergy()*general.TO_RF); + return (int)Math.round(Math.min(Integer.MAX_VALUE, getEnergy()*general.TO_RF)); } @Override public int getMaxEnergyStored(EnumFacing from) { - return (int)Math.round(getMaxEnergy()*general.TO_RF); + return (int)Math.round(Math.min(Integer.MAX_VALUE, getMaxEnergy()*general.TO_RF)); } @Override @@ -298,7 +276,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i public int addEnergy(int amount) { setEnergy(getEnergy() + amount*general.FROM_IC2); - return (int)Math.round(getEnergy()*general.TO_IC2); + return (int)Math.round(Math.min(Integer.MAX_VALUE, getEnergy()*general.TO_IC2)); } @Override @@ -309,7 +287,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i } @Override - public boolean canOutputTo(EnumFacing side) + public boolean canOutputEnergy(EnumFacing side) { return getOutputtingSides().contains(side); } @@ -332,21 +310,21 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i @Method(modid = "IC2") public int getStored() { - return (int)Math.round(getEnergy()*general.TO_IC2); + return (int)Math.round(Math.min(Integer.MAX_VALUE, getEnergy()*general.TO_IC2)); } @Override @Method(modid = "IC2") public int getCapacity() { - return (int)Math.round(getMaxEnergy()*general.TO_IC2); + return (int)Math.round(Math.min(Integer.MAX_VALUE, getMaxEnergy()*general.TO_IC2)); } @Override @Method(modid = "IC2") public int getOutput() { - return (int)Math.round(getMaxOutput()*general.TO_IC2); + return (int)Math.round(Math.min(Integer.MAX_VALUE, getMaxOutput()*general.TO_IC2)); } @Override @@ -387,7 +365,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i return amount; } - return amount-transferEnergyToAcceptor(direction, amount*general.FROM_IC2)*general.TO_IC2; + return amount-acceptEnergy(direction, amount*general.FROM_IC2, false)*general.TO_IC2; } @Override @@ -398,7 +376,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i } @Override - public double transferEnergyToAcceptor(EnumFacing side, double amount) + public double acceptEnergy(EnumFacing side, double amount, boolean simulate) { if(!(getConsumingSides().contains(side) || side == null)) { @@ -406,13 +384,17 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i } double toUse = Math.min(getMaxEnergy()-getEnergy(), amount); - setEnergy(getEnergy() + toUse); + + if(!simulate) + { + setEnergy(getEnergy() + toUse); + } return toUse; } @Override - public double removeEnergyFromProvider(EnumFacing side, double amount) + public double pullEnergy(EnumFacing side, double amount, boolean simulate) { if(!(getOutputtingSides().contains(side) || side == null)) { @@ -420,7 +402,11 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i } double toGive = Math.min(getEnergy(), amount); - setEnergy(getEnergy() - toGive); + + if(!simulate) + { + setEnergy(getEnergy() - toGive); + } return toGive; } @@ -430,20 +416,22 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i { return capability == Capabilities.ENERGY_STORAGE_CAPABILITY || capability == Capabilities.ENERGY_ACCEPTOR_CAPABILITY - || capability == Capabilities.CABLE_OUTPUTTER_CAPABILITY + || capability == Capabilities.ENERGY_OUTPUTTER_CAPABILITY || capability == Capabilities.TESLA_HOLDER_CAPABILITY || (capability == Capabilities.TESLA_CONSUMER_CAPABILITY && getConsumingSides().contains(facing)) || (capability == Capabilities.TESLA_PRODUCER_CAPABILITY && getOutputtingSides().contains(facing)) + || capability == CapabilityEnergy.ENERGY || super.hasCapability(capability, facing); } private CapabilityWrapperManager teslaManager = new CapabilityWrapperManager(IEnergyWrapper.class, TeslaIntegration.class); + private CapabilityWrapperManager forgeEnergyManager = new CapabilityWrapperManager(IEnergyWrapper.class, ForgeEnergyIntegration.class); @Override public T getCapability(Capability capability, EnumFacing facing) { if(capability == Capabilities.ENERGY_STORAGE_CAPABILITY || capability == Capabilities.ENERGY_ACCEPTOR_CAPABILITY || - capability == Capabilities.CABLE_OUTPUTTER_CAPABILITY) + capability == Capabilities.ENERGY_OUTPUTTER_CAPABILITY) { return (T)this; } @@ -455,6 +443,11 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i return (T)teslaManager.getWrapper(this, facing); } + if(capability == CapabilityEnergy.ENERGY) + { + return (T)forgeEnergyManager.getWrapper(this, facing); + } + return super.getCapability(capability, facing); } } diff --git a/src/main/java/mekanism/common/tile/TileEntityElectricMachine.java b/src/main/java/mekanism/common/tile/prefab/TileEntityElectricMachine.java similarity index 89% rename from src/main/java/mekanism/common/tile/TileEntityElectricMachine.java rename to src/main/java/mekanism/common/tile/prefab/TileEntityElectricMachine.java index 948e53b07..527ffe57b 100644 --- a/src/main/java/mekanism/common/tile/TileEntityElectricMachine.java +++ b/src/main/java/mekanism/common/tile/prefab/TileEntityElectricMachine.java @@ -1,4 +1,4 @@ -package mekanism.common.tile; +package mekanism.common.tile.prefab; import mekanism.api.EnumColor; import mekanism.api.transmitters.TransmissionType; @@ -13,15 +13,16 @@ import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.inputs.ItemStackInput; import mekanism.common.recipe.machines.BasicMachineRecipe; import mekanism.common.recipe.outputs.ItemStackOutput; +import mekanism.common.tile.TileEntityFactory; import mekanism.common.tile.component.TileComponentConfig; import mekanism.common.tile.component.TileComponentEjector; -import mekanism.common.tile.component.TileComponentUpgrade; import mekanism.common.util.ChargeUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; public abstract class TileEntityElectricMachine> extends TileEntityBasicMachine implements ITierUpgradeable { @@ -35,9 +36,9 @@ public abstract class TileEntityElectricMachine 0) + { + updateDelay--; + + if(updateDelay == 0 && clientActive != isActive) + { + isActive = clientActive; + MekanismUtils.updateBlock(world, getPos()); + } + } + + if(!world.isRemote) + { + if(updateDelay > 0) + { + updateDelay--; + + if(updateDelay == 0 && clientActive != isActive) + { + Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); + } + } + } + } + + @Override + public boolean canSetFacing(int facing) + { + return facing != 0 && facing != 1; + } + + @Override + public void setActive(boolean active) + { + isActive = active; + + if(clientActive != active && updateDelay == 0) + { + Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); + + updateDelay = 10; + clientActive = active; + } + } + + @Override + public boolean getActive() + { + return isActive; + } + + @Override + public boolean renderUpdate() + { + return true; + } + + @Override + public boolean lightUpdate() + { + return true; + } + + @Override + public void handlePacketData(ByteBuf dataStream) + { + super.handlePacketData(dataStream); + + if(FMLCommonHandler.instance().getEffectiveSide().isClient()) + { + clientActive = dataStream.readBoolean(); + controlType = RedstoneControl.values()[dataStream.readInt()]; + + if(updateDelay == 0 && clientActive != isActive) + { + updateDelay = general.UPDATE_DELAY; + isActive = clientActive; + MekanismUtils.updateBlock(world, getPos()); + } + } + } + + @Override + public ArrayList getNetworkedData(ArrayList data) + { + super.getNetworkedData(data); + + data.add(isActive); + data.add(controlType.ordinal()); + + return data; + } + + @Override + public void readFromNBT(NBTTagCompound nbtTags) + { + super.readFromNBT(nbtTags); + + isActive = nbtTags.getBoolean("isActive"); + controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")]; + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound nbtTags) + { + super.writeToNBT(nbtTags); + + nbtTags.setBoolean("isActive", isActive); + nbtTags.setInteger("controlType", controlType.ordinal()); + + return nbtTags; + } + + @Override + public RedstoneControl getControlType() + { + return controlType; + } + + @Override + public void setControlType(RedstoneControl type) + { + controlType = type; + MekanismUtils.saveChunk(this); + } + + @Override + public boolean canPulse() + { + return false; + } + + @Override + public TileComponentSecurity getSecurity() + { + return securityComponent; + } + + @Override + public TileComponentUpgrade getComponent() + { + return upgradeComponent; + } + + @Override + public void recalculateUpgradables(Upgrade upgrade) + { + super.recalculateUpgradables(upgrade); + + switch(upgrade) + { + case ENERGY: + maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY); + energyPerTick = MekanismUtils.getBaseEnergyPerTick(this, BASE_ENERGY_PER_TICK); + setEnergy(Math.min(getMaxEnergy(), getEnergy())); + break; + default: + break; + } + } +} diff --git a/src/main/java/mekanism/common/tile/TileEntityNoisyElectricBlock.java b/src/main/java/mekanism/common/tile/prefab/TileEntityNoisyBlock.java similarity index 89% rename from src/main/java/mekanism/common/tile/TileEntityNoisyElectricBlock.java rename to src/main/java/mekanism/common/tile/prefab/TileEntityNoisyBlock.java index c170543a3..70c764fb5 100644 --- a/src/main/java/mekanism/common/tile/TileEntityNoisyElectricBlock.java +++ b/src/main/java/mekanism/common/tile/prefab/TileEntityNoisyBlock.java @@ -1,6 +1,5 @@ -package mekanism.common.tile; +package mekanism.common.tile.prefab; -import mekanism.api.MekanismConfig.client; import mekanism.client.HolidayManager; import mekanism.client.sound.ISoundSource; import mekanism.common.Upgrade; @@ -8,13 +7,14 @@ import mekanism.common.base.IActiveState; import mekanism.common.base.IHasSound; import mekanism.common.base.IUpgradeTile; import mekanism.common.base.SoundWrapper; +import mekanism.common.config.MekanismConfig.client; import net.minecraft.client.audio.ISound.AttenuationType; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.Vec3d; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public abstract class TileEntityNoisyElectricBlock extends TileEntityElectricBlock implements IHasSound, ISoundSource, IActiveState +public abstract class TileEntityNoisyBlock extends TileEntityElectricBlock implements IHasSound, ISoundSource, IActiveState { /** The ResourceLocation of the machine's sound */ public ResourceLocation soundURL; @@ -33,7 +33,7 @@ public abstract class TileEntityNoisyElectricBlock extends TileEntityElectricBlo * @param name - full name of this block * @param maxEnergy - how much energy this block can store */ - public TileEntityNoisyElectricBlock(String sound, String name, double maxEnergy) + public TileEntityNoisyBlock(String sound, String name, double maxEnergy) { super(name, maxEnergy); @@ -113,7 +113,7 @@ public abstract class TileEntityNoisyElectricBlock extends TileEntityElectricBlo { super.validate(); - if(worldObj.isRemote) + if(world.isRemote) { try { soundURL = HolidayManager.filterSound(new ResourceLocation("mekanism", "tile." + soundPath)); @@ -133,7 +133,7 @@ public abstract class TileEntityNoisyElectricBlock extends TileEntityElectricBlo { super.onUpdate(); - if(worldObj.isRemote) + if(world.isRemote) { updateSound(); } diff --git a/src/main/java/mekanism/common/tile/prefab/TileEntityOperationalMachine.java b/src/main/java/mekanism/common/tile/prefab/TileEntityOperationalMachine.java new file mode 100644 index 000000000..403225b62 --- /dev/null +++ b/src/main/java/mekanism/common/tile/prefab/TileEntityOperationalMachine.java @@ -0,0 +1,88 @@ +package mekanism.common.tile.prefab; + +import io.netty.buffer.ByteBuf; + +import java.util.ArrayList; + +import mekanism.common.Upgrade; +import mekanism.common.util.MekanismUtils; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fml.common.FMLCommonHandler; + +public class TileEntityOperationalMachine extends TileEntityMachine +{ + public int operatingTicks; + + public int BASE_TICKS_REQUIRED; + + public int ticksRequired; + + public TileEntityOperationalMachine(String sound, String name, double maxEnergy, double baseEnergyUsage, int upgradeSlot, int baseTicksRequired) + { + super(sound, name, maxEnergy, baseEnergyUsage, upgradeSlot); + + ticksRequired = BASE_TICKS_REQUIRED = baseTicksRequired; + } + + public double getScaledProgress() + { + return ((double)operatingTicks) / (double)ticksRequired; + } + + @Override + public void handlePacketData(ByteBuf dataStream) + { + super.handlePacketData(dataStream); + + if(FMLCommonHandler.instance().getEffectiveSide().isClient()) + { + operatingTicks = dataStream.readInt(); + ticksRequired = dataStream.readInt(); + } + } + + @Override + public ArrayList getNetworkedData(ArrayList data) + { + super.getNetworkedData(data); + + data.add(operatingTicks); + data.add(ticksRequired); + + return data; + } + + @Override + public void readFromNBT(NBTTagCompound nbtTags) + { + super.readFromNBT(nbtTags); + + operatingTicks = nbtTags.getInteger("operatingTicks"); + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound nbtTags) + { + super.writeToNBT(nbtTags); + + nbtTags.setInteger("operatingTicks", operatingTicks); + + return nbtTags; + } + + @Override + public void recalculateUpgradables(Upgrade upgrade) + { + super.recalculateUpgradables(upgrade); + + switch(upgrade) + { + case SPEED: + ticksRequired = MekanismUtils.getTicks(this, BASE_TICKS_REQUIRED); + energyPerTick = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_PER_TICK); + break; + default: + break; + } + } +} diff --git a/src/main/java/mekanism/common/multipart/PartDiversionTransporter.java b/src/main/java/mekanism/common/tile/transmitter/TileEntityDiversionTransporter.java similarity index 85% rename from src/main/java/mekanism/common/multipart/PartDiversionTransporter.java rename to src/main/java/mekanism/common/tile/transmitter/TileEntityDiversionTransporter.java index 1d6e11ee3..96663cc75 100644 --- a/src/main/java/mekanism/common/multipart/PartDiversionTransporter.java +++ b/src/main/java/mekanism/common/tile/transmitter/TileEntityDiversionTransporter.java @@ -1,4 +1,4 @@ -package mekanism.common.multipart; +package mekanism.common.tile.transmitter; import io.netty.buffer.ByteBuf; @@ -8,6 +8,8 @@ import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.Range4D; import mekanism.common.Mekanism; +import mekanism.common.block.states.BlockStateTransmitter; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterType; import mekanism.common.content.transporter.TransporterStack; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.util.LangUtils; @@ -16,19 +18,12 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextComponentString; -public class PartDiversionTransporter extends PartLogisticalTransporter +public class TileEntityDiversionTransporter extends TileEntityLogisticalTransporter { public int[] modes = {0, 0, 0, 0, 0, 0}; - @Override - public ResourceLocation getType() - { - return new ResourceLocation("mekanism:diversion_transporter"); - } - @Override public TransmitterType getTransmitterType() { @@ -46,7 +41,10 @@ public class PartDiversionTransporter extends PartLogisticalTransporter { super.readFromNBT(nbtTags); - modes = nbtTags.getIntArray("modes"); + if(nbtTags.hasKey("modes")) + { + modes = nbtTags.getIntArray("modes"); + } } @Override @@ -127,9 +125,8 @@ public class PartDiversionTransporter extends PartLogisticalTransporter } refreshConnections(); - notifyPartUpdate(); notifyTileChange(); - player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + LangUtils.localize("tooltip.configurator.toggleDiverter") + ": " + EnumColor.RED + description)); + player.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + LangUtils.localize("tooltip.configurator.toggleDiverter") + ": " + EnumColor.RED + description)); Coord4D coord = new Coord4D(getPos(), getWorld()); Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(coord, getNetworkedData(new ArrayList())), new Range4D(coord)); diff --git a/src/main/java/mekanism/common/multipart/PartLogisticalTransporter.java b/src/main/java/mekanism/common/tile/transmitter/TileEntityLogisticalTransporter.java similarity index 74% rename from src/main/java/mekanism/common/multipart/PartLogisticalTransporter.java rename to src/main/java/mekanism/common/tile/transmitter/TileEntityLogisticalTransporter.java index 776d6091b..34e490d9e 100644 --- a/src/main/java/mekanism/common/multipart/PartLogisticalTransporter.java +++ b/src/main/java/mekanism/common/tile/transmitter/TileEntityLogisticalTransporter.java @@ -1,4 +1,4 @@ -package mekanism.common.multipart; +package mekanism.common.tile.transmitter; import io.netty.buffer.ByteBuf; @@ -8,67 +8,66 @@ import java.util.Collection; import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.Range4D; -import mekanism.api.gas.IGasHandler; import mekanism.api.transmitters.TransmissionType; -import mekanism.api.util.CapabilityUtils; -import mekanism.common.InventoryNetwork; import mekanism.common.Mekanism; import mekanism.common.Tier; import mekanism.common.Tier.BaseTier; import mekanism.common.Tier.TransporterTier; import mekanism.common.base.ILogisticalTransporter; +import mekanism.common.block.property.PropertyColor; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterType; import mekanism.common.capabilities.Capabilities; -import mekanism.common.content.transporter.InvStack; import mekanism.common.content.transporter.PathfinderCache; -import mekanism.common.content.transporter.TransporterManager; +import mekanism.common.content.transporter.TransitRequest; +import mekanism.common.content.transporter.TransitRequest.TransitResponse; import mekanism.common.content.transporter.TransporterStack; import mekanism.common.network.PacketTileEntity.TileEntityMessage; -import mekanism.common.util.InventoryUtils; +import mekanism.common.transmitters.TransporterImpl; +import mekanism.common.transmitters.grid.InventoryNetwork; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.LangUtils; +import mekanism.common.util.MekanismUtils; import mekanism.common.util.TransporterUtils; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextComponentString; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.util.Constants.NBT; +import net.minecraftforge.fml.common.FMLCommonHandler; -public class PartLogisticalTransporter extends PartTransmitter +public class TileEntityLogisticalTransporter extends TileEntityTransmitter { public Tier.TransporterTier tier = Tier.TransporterTier.BASIC; public int pullDelay = 0; - - public PartLogisticalTransporter(TransporterTier transporterTier) + + public TileEntityLogisticalTransporter() { - this(); - tier = transporterTier; + transmitterDelegate = new TransporterImpl(this); } - - public PartLogisticalTransporter() - { - transmitterDelegate = new MultipartTransporter(this); - } - + @Override - public ResourceLocation getType() + public BaseTier getBaseTier() { - return new ResourceLocation("mekanism:logistical_transporter_" + tier.name().toLowerCase()); + return tier.getBaseTier(); + } + + @Override + public void setBaseTier(BaseTier baseTier) + { + tier = Tier.TransporterTier.get(baseTier); } @Override public TransmitterType getTransmitterType() { - return tier.type; + return TransmitterType.LOGISTICAL_TRANSPORTER; } @Override @@ -89,13 +88,13 @@ public class PartLogisticalTransporter extends PartTransmitter getNetworkedData(ArrayList data) { + data.add(0); + super.getNetworkedData(data); - data.add(0); + data.add(tier.ordinal()); if(getTransmitter().getColor() != null) { @@ -344,10 +342,10 @@ public class PartLogisticalTransporter extends PartTransmitter implements IFluidHandlerWrapper +public class TileEntityMechanicalPipe extends TileEntityTransmitter implements IFluidHandlerWrapper { - public Tier.PipeTier tier; + public Tier.PipeTier tier = Tier.PipeTier.BASIC; public float currentScale; public FluidTank buffer = new FluidTank(Fluid.BUCKET_VOLUME); public FluidStack lastWrite; - - public PartMechanicalPipe(Tier.PipeTier pipeTier) + + @Override + public BaseTier getBaseTier() { - super(); - tier = pipeTier; - buffer.setCapacity(getCapacity()); + return tier.getBaseTier(); } + @Override + public void setBaseTier(BaseTier baseTier) + { + tier = Tier.PipeTier.get(baseTier); + buffer.setCapacity(getCapacity()); + } + @Override public void update() { @@ -107,7 +115,7 @@ public class PartMechanicalPipe extends PartTransmitter getNetworkedData(ArrayList data) { - packet.writeInt(tier.ordinal()); + data.add(tier.ordinal()); - super.writeUpdatePacket(packet); + super.getNetworkedData(data); + + return data; } @Override diff --git a/src/main/java/mekanism/common/multipart/PartPressurizedTube.java b/src/main/java/mekanism/common/tile/transmitter/TileEntityPressurizedTube.java similarity index 85% rename from src/main/java/mekanism/common/multipart/PartPressurizedTube.java rename to src/main/java/mekanism/common/tile/transmitter/TileEntityPressurizedTube.java index a47804b59..ba66073c3 100644 --- a/src/main/java/mekanism/common/multipart/PartPressurizedTube.java +++ b/src/main/java/mekanism/common/tile/transmitter/TileEntityPressurizedTube.java @@ -1,27 +1,30 @@ -package mekanism.common.multipart; +package mekanism.common.tile.transmitter; +import io.netty.buffer.ByteBuf; + +import java.util.ArrayList; import java.util.Collection; import mekanism.api.gas.Gas; -import mekanism.api.gas.GasNetwork; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; -import mekanism.api.gas.GasTransmission; import mekanism.api.gas.IGasHandler; import mekanism.api.transmitters.TransmissionType; -import mekanism.api.util.CapabilityUtils; import mekanism.common.Tier; import mekanism.common.Tier.BaseTier; import mekanism.common.Tier.TubeTier; +import mekanism.common.block.states.BlockStateTransmitter; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterType; import mekanism.common.capabilities.Capabilities; +import mekanism.common.transmitters.grid.GasNetwork; +import mekanism.common.util.CapabilityUtils; +import mekanism.common.util.GasUtils; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.capabilities.Capability; -public class PartPressurizedTube extends PartTransmitter implements IGasHandler +public class TileEntityPressurizedTube extends TileEntityTransmitter implements IGasHandler { public Tier.TubeTier tier = Tier.TubeTier.BASIC; @@ -31,10 +34,16 @@ public class PartPressurizedTube extends PartTransmitter getNetworkedData(ArrayList data) { - packet.writeInt(tier.ordinal()); + data.add(tier.ordinal()); - super.writeUpdatePacket(packet); + super.getNetworkedData(data); + + return data; } @Override diff --git a/src/main/java/mekanism/common/multipart/PartRestrictiveTransporter.java b/src/main/java/mekanism/common/tile/transmitter/TileEntityRestrictiveTransporter.java similarity index 56% rename from src/main/java/mekanism/common/multipart/PartRestrictiveTransporter.java rename to src/main/java/mekanism/common/tile/transmitter/TileEntityRestrictiveTransporter.java index e913103a5..070175016 100644 --- a/src/main/java/mekanism/common/multipart/PartRestrictiveTransporter.java +++ b/src/main/java/mekanism/common/tile/transmitter/TileEntityRestrictiveTransporter.java @@ -1,18 +1,13 @@ -package mekanism.common.multipart; +package mekanism.common.tile.transmitter; +import mekanism.common.block.states.BlockStateTransmitter; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterType; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; -public class PartRestrictiveTransporter extends PartLogisticalTransporter +public class TileEntityRestrictiveTransporter extends TileEntityLogisticalTransporter { - @Override - public ResourceLocation getType() - { - return new ResourceLocation("mekanism:restrictive_transporter"); - } - @Override public TransmitterType getTransmitterType() { @@ -25,12 +20,6 @@ public class PartRestrictiveTransporter extends PartLogisticalTransporter return 1000; } - @Override - public boolean transparencyRender() - { - return false; - } - @Override protected EnumActionResult onConfigure(EntityPlayer player, int part, EnumFacing side) { diff --git a/src/main/java/mekanism/common/multipart/PartSidedPipe.java b/src/main/java/mekanism/common/tile/transmitter/TileEntitySidedPipe.java similarity index 56% rename from src/main/java/mekanism/common/multipart/PartSidedPipe.java rename to src/main/java/mekanism/common/tile/transmitter/TileEntitySidedPipe.java index c9e397255..261fd2c3d 100644 --- a/src/main/java/mekanism/common/multipart/PartSidedPipe.java +++ b/src/main/java/mekanism/common/tile/transmitter/TileEntitySidedPipe.java @@ -1,71 +1,58 @@ -package mekanism.common.multipart; +package mekanism.common.tile.transmitter; import io.netty.buffer.ByteBuf; import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import mcmultipart.MCMultiPartMod; -import mcmultipart.block.TileMultipartContainer; -import mcmultipart.multipart.IMultipart; -import mcmultipart.multipart.INormallyOccludingPart; -import mcmultipart.multipart.Multipart; -import mcmultipart.multipart.OcclusionHelper; -import mcmultipart.raytrace.PartMOP; -import mcmultipart.raytrace.RayTraceUtils; -import mcmultipart.raytrace.RayTraceUtils.AdvancedRayTraceResultPart; +import mcmultipart.api.multipart.IMultipart; import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.IConfigurable; +import mekanism.api.Range4D; import mekanism.api.transmitters.IBlockableConnection; import mekanism.api.transmitters.ITransmitter; import mekanism.api.transmitters.TransmissionType; -import mekanism.api.util.CapabilityUtils; -import mekanism.common.MekanismItems; -import mekanism.common.Tier; +import mekanism.common.Mekanism; +import mekanism.common.Tier.BaseTier; import mekanism.common.base.ITileNetwork; +import mekanism.common.block.BlockTransmitter; +import mekanism.common.block.property.PropertyConnection; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterType; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterType.Size; import mekanism.common.capabilities.Capabilities; -import mekanism.common.multipart.TransmitterType.Size; +import mekanism.common.integration.multipart.MultipartMekanism; +import mekanism.common.network.PacketTileEntity.TileEntityMessage; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.MekanismUtils; -import net.minecraft.block.Block; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.BlockStateContainer; +import mekanism.common.util.MultipartUtils; +import mekanism.common.util.MultipartUtils.AdvancedRayTraceResult; import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; import net.minecraft.util.ITickable; -import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraftforge.client.model.obj.OBJModel.OBJProperty; import net.minecraftforge.client.model.obj.OBJModel.OBJState; import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; -import net.minecraftforge.common.property.IUnlistedProperty; +import net.minecraftforge.fml.common.FMLCommonHandler; -public abstract class PartSidedPipe extends Multipart implements INormallyOccludingPart, /*ISlotOccludingPart, ISidedHollowConnect, JIconHitEffects, INeighborTileChange,*/ ITileNetwork, IBlockableConnection, IConfigurable, ITransmitter, ITickable +import org.apache.commons.lang3.tuple.Pair; + +public abstract class TileEntitySidedPipe extends TileEntity implements ITileNetwork, IBlockableConnection, IConfigurable, ITransmitter, ITickable { - public static AxisAlignedBB[] smallSides = new AxisAlignedBB[7]; - public static AxisAlignedBB[] largeSides = new AxisAlignedBB[7]; - public int delayTicks; - public EnumFacing testingSide = null; - public byte currentAcceptorConnections = 0x00; public byte currentTransmitterConnections = 0x00; @@ -81,78 +68,6 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud public ConnectionType[] connectionTypes = {ConnectionType.NORMAL, ConnectionType.NORMAL, ConnectionType.NORMAL, ConnectionType.NORMAL, ConnectionType.NORMAL, ConnectionType.NORMAL}; public TileEntity[] cachedAcceptors = new TileEntity[6]; - static - { - smallSides[0] = new AxisAlignedBB(0.3, 0.0, 0.3, 0.7, 0.3, 0.7); - smallSides[1] = new AxisAlignedBB(0.3, 0.7, 0.3, 0.7, 1.0, 0.7); - smallSides[2] = new AxisAlignedBB(0.3, 0.3, 0.0, 0.7, 0.7, 0.3); - smallSides[3] = new AxisAlignedBB(0.3, 0.3, 0.7, 0.7, 0.7, 1.0); - smallSides[4] = new AxisAlignedBB(0.0, 0.3, 0.3, 0.3, 0.7, 0.7); - smallSides[5] = new AxisAlignedBB(0.7, 0.3, 0.3, 1.0, 0.7, 0.7); - smallSides[6] = new AxisAlignedBB(0.3, 0.3, 0.3, 0.7, 0.7, 0.7); - - largeSides[0] = new AxisAlignedBB(0.25, 0.0, 0.25, 0.75, 0.25, 0.75); - largeSides[1] = new AxisAlignedBB(0.25, 0.75, 0.25, 0.75, 1.0, 0.75); - largeSides[2] = new AxisAlignedBB(0.25, 0.25, 0.0, 0.75, 0.75, 0.25); - largeSides[3] = new AxisAlignedBB(0.25, 0.25, 0.75, 0.75, 0.75, 1.0); - largeSides[4] = new AxisAlignedBB(0.0, 0.25, 0.25, 0.25, 0.75, 0.75); - largeSides[5] = new AxisAlignedBB(0.75, 0.25, 0.25, 1.0, 0.75, 0.75); - largeSides[6] = new AxisAlignedBB(0.25, 0.25, 0.25, 0.75, 0.75, 0.75); - } - - public static IMultipart getPartType(TransmitterType type) - { - switch(type) - { - case UNIVERSAL_CABLE_BASIC: - return new PartUniversalCable(Tier.CableTier.BASIC); - case UNIVERSAL_CABLE_ADVANCED: - return new PartUniversalCable(Tier.CableTier.ADVANCED); - case UNIVERSAL_CABLE_ELITE: - return new PartUniversalCable(Tier.CableTier.ELITE); - case UNIVERSAL_CABLE_ULTIMATE: - return new PartUniversalCable(Tier.CableTier.ULTIMATE); - case MECHANICAL_PIPE_BASIC: - return new PartMechanicalPipe(Tier.PipeTier.BASIC); - case MECHANICAL_PIPE_ADVANCED: - return new PartMechanicalPipe(Tier.PipeTier.ADVANCED); - case MECHANICAL_PIPE_ELITE: - return new PartMechanicalPipe(Tier.PipeTier.ELITE); - case MECHANICAL_PIPE_ULTIMATE: - return new PartMechanicalPipe(Tier.PipeTier.ULTIMATE); - case PRESSURIZED_TUBE_BASIC: - return new PartPressurizedTube(Tier.TubeTier.BASIC); - case PRESSURIZED_TUBE_ADVANCED: - return new PartPressurizedTube(Tier.TubeTier.ADVANCED); - case PRESSURIZED_TUBE_ELITE: - return new PartPressurizedTube(Tier.TubeTier.ELITE); - case PRESSURIZED_TUBE_ULTIMATE: - return new PartPressurizedTube(Tier.TubeTier.ULTIMATE); - case LOGISTICAL_TRANSPORTER_BASIC: - return new PartLogisticalTransporter(Tier.TransporterTier.BASIC); - case LOGISTICAL_TRANSPORTER_ADVANCED: - return new PartLogisticalTransporter(Tier.TransporterTier.ADVANCED); - case LOGISTICAL_TRANSPORTER_ELITE: - return new PartLogisticalTransporter(Tier.TransporterTier.ELITE); - case LOGISTICAL_TRANSPORTER_ULTIMATE: - return new PartLogisticalTransporter(Tier.TransporterTier.ULTIMATE); - case RESTRICTIVE_TRANSPORTER: - return new PartRestrictiveTransporter(); - case DIVERSION_TRANSPORTER: - return new PartDiversionTransporter(); - case THERMODYNAMIC_CONDUCTOR_BASIC: - return new PartThermodynamicConductor(Tier.ConductorTier.BASIC); - case THERMODYNAMIC_CONDUCTOR_ADVANCED: - return new PartThermodynamicConductor(Tier.ConductorTier.ADVANCED); - case THERMODYNAMIC_CONDUCTOR_ELITE: - return new PartThermodynamicConductor(Tier.ConductorTier.ELITE); - case THERMODYNAMIC_CONDUCTOR_ULTIMATE: - return new PartThermodynamicConductor(Tier.ConductorTier.ULTIMATE); - default: - return null; - } - } - public static boolean connectionMapContainsSide(byte connections, EnumFacing side) { byte tester = (byte)(1 << side.ordinal()); @@ -190,12 +105,19 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud if(sendDesc) { - sendUpdatePacket(); + Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); sendDesc = false; } } } + public BaseTier getBaseTier() + { + return BaseTier.BASIC; + } + + public void setBaseTier(BaseTier baseTier) {} + public boolean handlesRedstone() { return true; @@ -205,11 +127,6 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud { return false; } - - public boolean transparencyRender() - { - return false; - } public byte getPossibleTransmitterConnections() { @@ -343,119 +260,52 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud return (byte)(currentTransmitterConnections | currentAcceptorConnections); } - protected boolean isValidTransmitter(TileEntity tileEntity) + public boolean isValidTransmitter(TileEntity tileEntity) { return true; } - @Override - public float getHardness(PartMOP partHit) + public List getCollisionBoxes() { - return 3.5F; - } - -/* - @Override - public boolean occlusionTest(IMultipart other) - { - return NormalOcclusionTest.apply(this, other); - } -*/ - - @Override - public void addSelectionBoxes(List list) - { - if(getContainer() != null) + List list = new ArrayList<>(); + for(EnumFacing side : EnumFacing.values()) { - for(EnumFacing side : EnumFacing.values()) - { - int ord = side.ordinal(); - byte connections = getAllCurrentConnections(); + int ord = side.ordinal(); + byte connections = getAllCurrentConnections(); - if(connectionMapContainsSide(connections, side) || side == testingSide) - { - list.add(getTransmitterType().getSize() == Size.SMALL ? smallSides[ord] : largeSides[ord]); - } + if(connectionMapContainsSide(connections, side)) + { + list.add(getTransmitterType().getSize() == Size.SMALL ? BlockTransmitter.smallSides[ord] : BlockTransmitter.largeSides[ord]); } } - list.add(getTransmitterType().getSize() == Size.SMALL ? smallSides[6] : largeSides[6]); + list.add(getTransmitterType().getSize() == Size.SMALL ? BlockTransmitter.smallSides[6] : BlockTransmitter.largeSides[6]); + return list; } public abstract TransmitterType getTransmitterType(); - @Override - public void addCollisionBoxes(AxisAlignedBB mask, List list, Entity collidingEntity) + public List getCollisionBoxes(AxisAlignedBB entityBox) { - if(getContainer() != null) + List list = new ArrayList<>(); + + for(EnumFacing side : EnumFacing.values()) { - for(EnumFacing side : EnumFacing.values()) - { - int ord = side.ordinal(); - byte connections = getAllCurrentConnections(); + int ord = side.ordinal(); + byte connections = getAllCurrentConnections(); - if(connectionMapContainsSide(connections, side) || side == testingSide) - { - AxisAlignedBB box = getTransmitterType().getSize() == Size.SMALL ? smallSides[ord] : largeSides[ord]; - if(box.intersectsWith(mask)) list.add(box); - } + if(connectionMapContainsSide(connections, side)) + { + AxisAlignedBB box = getTransmitterType().getSize() == Size.SMALL ? BlockTransmitter.smallSides[ord] : BlockTransmitter.largeSides[ord]; + if(box.intersectsWith(entityBox)) list.add(box); } } - AxisAlignedBB box = getTransmitterType().getSize() == Size.SMALL ? smallSides[6] : largeSides[6]; - if(box.intersectsWith(mask)) list.add(box); + AxisAlignedBB box = getTransmitterType().getSize() == Size.SMALL ? BlockTransmitter.smallSides[6] : BlockTransmitter.largeSides[6]; + if(box.intersectsWith(entityBox)) list.add(box); + return list; } - - @Override - public void addOcclusionBoxes(List list) - { - addSelectionBoxes(list); - } -/* - @Override - public EnumSet getSlotMask() - { - return EnumSet.of(PartSlot.CENTER); - } - - @Override - public EnumSet getOccludedSlots() - { - return EnumSet.of(PartSlot.CENTER); //TODO implement properly - } - - @Override - public TextureAtlasSprite getBreakingIcon(Object subPart, EnumFacing side) - { - return getCenterIcon(true); - } - - @Override - public TextureAtlasSprite getBrokenIcon(EnumFacing side) - { - return getCenterIcon(true); - } - - @Override - public Cuboid6 getBounds() - { - return getTransmitterType().getSize() == Size.SMALL ? smallSides[6] : largeSides[6]; - } - - @Override - public int getHollowSize(EnumFacing side) - { - EnumFacing direction = EnumFacing.getOrientation(side); - - if(connectionMapContainsSide(getAllCurrentConnections(), direction) || direction == testingSide) - { - return getTransmitterType().getSize().centerSize+1; - } - - return 0; - } -*/ - + public abstract boolean isValidAcceptor(TileEntity tile, EnumFacing side); @Override @@ -493,40 +343,45 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud { return false; } - - testingSide = side; - IMultipart testPart = new OcclusionHelper.NormallyOccludingPart(getTransmitterType().getSize() == Size.SMALL ? smallSides[side.ordinal()] : largeSides[side.ordinal()]); - boolean unblocked = OcclusionHelper.occlusionTest(testPart, (part) -> part==this, getContainer().getParts());//getContainer().canReplacePart(this, this); - testingSide = null; - return unblocked; + if(Mekanism.hooks.MCMPLoaded) + { + return MultipartMekanism.hasConnectionWith(this, side); + } + + return true; + } + + @Override + public void handlePacketData(ByteBuf dataStream) throws Exception + { + if(FMLCommonHandler.instance().getEffectiveSide().isClient()) + { + currentTransmitterConnections = dataStream.readByte(); + currentAcceptorConnections = dataStream.readByte(); + + for(int i = 0; i < 6; i++) + { + connectionTypes[i] = ConnectionType.values()[dataStream.readInt()]; + } + + markDirty(); + MekanismUtils.updateBlock(world, pos); + } } @Override - public void readUpdatePacket(PacketBuffer packet) + public ArrayList getNetworkedData(ArrayList data) { - currentTransmitterConnections = packet.readByte(); - currentAcceptorConnections = packet.readByte(); - + data.add(currentTransmitterConnections); + data.add(currentAcceptorConnections); + for(int i = 0; i < 6; i++) { - connectionTypes[i] = ConnectionType.values()[packet.readInt()]; - } - - notifyPartUpdate(); - markRenderUpdate(); - } - - @Override - public void writeUpdatePacket(PacketBuffer packet) - { - packet.writeByte(currentTransmitterConnections); - packet.writeByte(currentAcceptorConnections); - - for(int i = 0; i < 6; i++) - { - packet.writeInt(connectionTypes[i].ordinal()); + data.add(connectionTypes[i].ordinal()); } + + return data; } @Override @@ -556,40 +411,6 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud return nbtTags; } - - @Override - public boolean onActivated(EntityPlayer player, EnumHand hand, ItemStack stack, PartMOP hit) - { - if(stack == null) - { - return false; - } - - if(MekanismUtils.hasUsableWrench(player, getPos()) && player.isSneaking()) - { - if(!getWorld().isRemote) - { - MultipartMekanism.dropItems(this); - getContainer().removePart(this); - } - - return true; - } - - return false; - } - - @Override - public List getDrops() - { - return Collections.singletonList(getPickBlock(null, null)); - } - - @Override - public ItemStack getPickBlock(EntityPlayer player, PartMOP hit) - { - return new ItemStack(MekanismItems.PartTransmitter, 1, getTransmitterType().ordinal()); - } protected void onRefresh() {} @@ -654,43 +475,38 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud public abstract void onWorldSeparate(); @Override - public void onRemoved() + public void invalidate() { onWorldSeparate(); - super.onRemoved(); + super.invalidate(); } @Override - public void onUnloaded() + public void onChunkUnload() { onWorldSeparate(); - super.onRemoved(); + super.onChunkUnload(); } - @Override public void onAdded() { onWorldJoin(); - super.onAdded(); - refreshConnections(); } @Override - public void onLoaded() + public void onLoad() { onWorldJoin(); - super.onLoaded(); + super.onLoad(); } - @Override public void onNeighborTileChange(EnumFacing side) { refreshConnections(side); } - @Override - public void onNeighborBlockChange(Block block) + public void onNeighborBlockChange(EnumFacing side) { if(handlesRedstone()) { @@ -707,11 +523,8 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud } } - @Override public void onPartChanged(IMultipart part) { - super.onPartChanged(part); - byte transmittersBefore = currentTransmitterConnections; refreshConnections(); @@ -721,15 +534,6 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud } } - @Override - public void handlePacketData(ByteBuf dataStream) throws Exception {} - - @Override - public ArrayList getNetworkedData(ArrayList data) - { - return data; - } - public ConnectionType getConnectionType(EnumFacing side) { return getConnectionType(side, getAllCurrentConnections(), currentTransmitterConnections, connectionTypes); @@ -769,7 +573,7 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud { if(!getWorld().isRemote) { - PartMOP hit = reTrace(getWorld(), getPos(), player); + RayTraceResult hit = reTrace(getWorld(), getPos(), player); if(hit == null) { @@ -784,7 +588,7 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud sendDesc = true; onModeChange(EnumFacing.getFront(hitSide.ordinal())); - player.addChatMessage(new TextComponentString("Connection type changed to " + connectionTypes[hitSide.ordinal()].toString())); + player.sendMessage(new TextComponentString("Connection type changed to " + connectionTypes[hitSide.ordinal()].toString())); return EnumActionResult.SUCCESS; } @@ -797,11 +601,10 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud return EnumActionResult.SUCCESS; } - private PartMOP reTrace(World world, BlockPos pos, EntityPlayer player) + private RayTraceResult reTrace(World world, BlockPos pos, EntityPlayer player) { - Vec3d start = RayTraceUtils.getStart(player); - Vec3d end = RayTraceUtils.getEnd(player); - AdvancedRayTraceResultPart result = ((TileMultipartContainer)world.getTileEntity(pos)).getPartContainer().collisionRayTrace(start, end); + Pair vecs = MultipartUtils.getRayTraceVectors(player); + AdvancedRayTraceResult result = MultipartUtils.collisionRayTrace(getPos(), vecs.getLeft(), vecs.getRight(), getCollisionBoxes()); return result == null ? null : result.hit; } @@ -810,21 +613,21 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud { List list = new ArrayList<>(); - if(getContainer() != null) + for(EnumFacing side : EnumFacing.values()) { - for(EnumFacing side : EnumFacing.values()) - { - int ord = side.ordinal(); - byte connections = getAllCurrentConnections(); + int ord = side.ordinal(); + byte connections = getAllCurrentConnections(); - if(connectionMapContainsSide(connections, side)) - { - list.add(side); - } + if(connectionMapContainsSide(connections, side)) + { + list.add(side); } } - if(boxIndex < list.size()) return list.get(boxIndex); + if(boxIndex < list.size()) + { + return list.get(boxIndex); + } return null; } @@ -848,24 +651,12 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud refreshConnections(); notifyTileChange(); - player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Redstone sensitivity turned " + EnumColor.INDIGO + (redstoneReactive ? "on." : "off."))); + player.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Redstone sensitivity turned " + EnumColor.INDIGO + (redstoneReactive ? "on." : "off."))); } return EnumActionResult.SUCCESS; } - @Override - public ResourceLocation getModelPath() - { - return getType(); - } - - @Override - public BlockStateContainer createBlockState() - { - return new ExtendedBlockState(MCMultiPartMod.multipart, new IProperty[0], new IUnlistedProperty[] {OBJProperty.INSTANCE, ColorProperty.INSTANCE, ConnectionProperty.INSTANCE}); - } - public List getVisibleGroups() { List visible = new ArrayList<>(); @@ -877,25 +668,24 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud return visible; } - - @Override + public IBlockState getExtendedState(IBlockState state) { - ConnectionProperty connectionProp = new ConnectionProperty(getAllCurrentConnections(), currentTransmitterConnections, connectionTypes, renderCenter()); + PropertyConnection connectionProp = new PropertyConnection(getAllCurrentConnections(), currentTransmitterConnections, connectionTypes, renderCenter()); - return ((IExtendedBlockState)state).withProperty(OBJProperty.INSTANCE, new OBJState(getVisibleGroups(), true)).withProperty(ConnectionProperty.INSTANCE, connectionProp); - } - - @Override - public boolean canRenderInLayer(BlockRenderLayer layer) - { - return layer == BlockRenderLayer.CUTOUT || (transparencyRender() && layer == BlockRenderLayer.TRANSLUCENT); + return ((IExtendedBlockState)state).withProperty(OBJProperty.INSTANCE, new OBJState(getVisibleGroups(), true)).withProperty(PropertyConnection.INSTANCE, connectionProp); } public void notifyTileChange() { MekanismUtils.notifyLoadedNeighborsOfTileChange(getWorld(), new Coord4D(getPos(), getWorld())); } + + @Override + public boolean canRenderBreaking() + { + return false; + } @Override public boolean hasCapability(Capability capability, EnumFacing facing) @@ -939,9 +729,4 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud return name().toLowerCase(); } } - - @Override - public boolean shouldBreakingUseExtendedState() { - return true; - } } diff --git a/src/main/java/mekanism/common/multipart/PartThermodynamicConductor.java b/src/main/java/mekanism/common/tile/transmitter/TileEntityThermodynamicConductor.java similarity index 84% rename from src/main/java/mekanism/common/multipart/PartThermodynamicConductor.java rename to src/main/java/mekanism/common/tile/transmitter/TileEntityThermodynamicConductor.java index 1be20c8c5..fbc28cd84 100644 --- a/src/main/java/mekanism/common/multipart/PartThermodynamicConductor.java +++ b/src/main/java/mekanism/common/tile/transmitter/TileEntityThermodynamicConductor.java @@ -1,4 +1,4 @@ -package mekanism.common.multipart; +package mekanism.common.tile.transmitter; import io.netty.buffer.ByteBuf; @@ -9,35 +9,41 @@ import mekanism.api.Coord4D; import mekanism.api.IHeatTransfer; import mekanism.api.Range4D; import mekanism.api.transmitters.TransmissionType; -import mekanism.api.util.CapabilityUtils; import mekanism.common.ColourRGBA; -import mekanism.common.HeatNetwork; import mekanism.common.Mekanism; import mekanism.common.Tier; import mekanism.common.Tier.BaseTier; import mekanism.common.Tier.ConductorTier; +import mekanism.common.block.states.BlockStateTransmitter; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterType; import mekanism.common.capabilities.Capabilities; import mekanism.common.network.PacketTileEntity.TileEntityMessage; +import mekanism.common.transmitters.grid.HeatNetwork; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.HeatUtils; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.capabilities.Capability; -public class PartThermodynamicConductor extends PartTransmitter implements IHeatTransfer +public class TileEntityThermodynamicConductor extends TileEntityTransmitter implements IHeatTransfer { - public Tier.ConductorTier tier; + public Tier.ConductorTier tier = Tier.ConductorTier.BASIC; public double temperature = 0; public double clientTemperature = 0; public double heatToAbsorb = 0; - - public PartThermodynamicConductor(Tier.ConductorTier conductorTier) + + @Override + public BaseTier getBaseTier() { - super(); - tier = conductorTier; + return tier.getBaseTier(); + } + + @Override + public void setBaseTier(BaseTier baseTier) + { + tier = Tier.ConductorTier.get(baseTier); } @Override @@ -73,7 +79,7 @@ public class PartThermodynamicConductor extends PartTransmitter getNetworkedData(ArrayList data) { + data.add(tier.ordinal()); + + super.getNetworkedData(data); + data.add(temperature); return data; } - @Override - public void writeUpdatePacket(PacketBuffer packet) - { - packet.writeInt(tier.ordinal()); - - super.writeUpdatePacket(packet); - } - - @Override - public void readUpdatePacket(PacketBuffer packet) - { - tier = ConductorTier.values()[packet.readInt()]; - - super.readUpdatePacket(packet); - } - public ColourRGBA getBaseColour() { return tier.baseColour; @@ -208,7 +200,7 @@ public class PartThermodynamicConductor extends PartTransmitter (temperature / 100)) + if(Math.abs(temperature - clientTemperature) > (temperature / 20)) { clientTemperature = temperature; sendTemp(); diff --git a/src/main/java/mekanism/common/multipart/PartTransmitter.java b/src/main/java/mekanism/common/tile/transmitter/TileEntityTransmitter.java similarity index 87% rename from src/main/java/mekanism/common/multipart/PartTransmitter.java rename to src/main/java/mekanism/common/tile/transmitter/TileEntityTransmitter.java index b14c26d5f..0b30468c7 100644 --- a/src/main/java/mekanism/common/multipart/PartTransmitter.java +++ b/src/main/java/mekanism/common/tile/transmitter/TileEntityTransmitter.java @@ -1,4 +1,4 @@ -package mekanism.common.multipart; +package mekanism.common.tile.transmitter; import java.util.Arrays; import java.util.Collection; @@ -12,6 +12,7 @@ import mekanism.api.transmitters.DynamicNetwork.NetworkClientRequest; import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.TransmitterNetworkRegistry; import mekanism.common.capabilities.Capabilities; +import mekanism.common.transmitters.TransmitterImpl; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -20,20 +21,20 @@ import net.minecraft.util.EnumHand; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.Capability; -public abstract class PartTransmitter> extends PartSidedPipe implements IAlloyInteraction +public abstract class TileEntityTransmitter> extends TileEntitySidedPipe implements IAlloyInteraction { - public MultipartTransmitter transmitterDelegate; + public TransmitterImpl transmitterDelegate; public boolean unloaded = true; public boolean dataRequest = false; - public PartTransmitter() + public TileEntityTransmitter() { - transmitterDelegate = new MultipartTransmitter<>(this); + transmitterDelegate = new TransmitterImpl<>(this); } - public MultipartTransmitter getTransmitter() + public TransmitterImpl getTransmitter() { return transmitterDelegate; } @@ -69,14 +70,14 @@ public abstract class PartTransmitter> extends } @Override - public void onUnloaded() + public void onChunkUnload() { if(!getWorld().isRemote) { getTransmitter().takeShare(); } - super.onUnloaded(); + super.onChunkUnload(); } @Override @@ -158,9 +159,9 @@ public abstract class PartTransmitter> extends for(Object iter : array) { - if(iter instanceof MultipartTransmitter) + if(iter instanceof TransmitterImpl) { - PartTransmitter t = ((MultipartTransmitter)iter).containingPart; + TileEntityTransmitter t = ((TransmitterImpl)iter).containingTile; if(t.upgrade(tierOrdinal)) { @@ -178,11 +179,11 @@ public abstract class PartTransmitter> extends { if(!player.capabilities.isCreativeMode) { - stack.stackSize--; + stack.shrink(1); - if(stack.stackSize == 0) + if(stack.getCount() == 0) { - player.setHeldItem(hand, null); + player.setHeldItem(hand, ItemStack.EMPTY); } } } diff --git a/src/main/java/mekanism/common/multipart/PartUniversalCable.java b/src/main/java/mekanism/common/tile/transmitter/TileEntityUniversalCable.java similarity index 67% rename from src/main/java/mekanism/common/multipart/PartUniversalCable.java rename to src/main/java/mekanism/common/tile/transmitter/TileEntityUniversalCable.java index 7781da1e4..6fddbf4c4 100644 --- a/src/main/java/mekanism/common/multipart/PartUniversalCable.java +++ b/src/main/java/mekanism/common/tile/transmitter/TileEntityUniversalCable.java @@ -1,56 +1,61 @@ -package mekanism.common.multipart; +package mekanism.common.tile.transmitter; import ic2.api.energy.EnergyNet; import ic2.api.energy.tile.IEnergySource; import ic2.api.energy.tile.IEnergyTile; +import io.netty.buffer.ByteBuf; +import java.util.ArrayList; import java.util.Collection; import java.util.List; -import mekanism.api.MekanismConfig.general; import mekanism.api.energy.EnergyStack; import mekanism.api.energy.IStrictEnergyAcceptor; import mekanism.api.energy.IStrictEnergyStorage; import mekanism.api.transmitters.TransmissionType; -import mekanism.api.util.CapabilityUtils; -import mekanism.common.EnergyNetwork; import mekanism.common.Tier; import mekanism.common.Tier.BaseTier; import mekanism.common.Tier.CableTier; import mekanism.common.base.EnergyAcceptorWrapper; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterType; import mekanism.common.capabilities.Capabilities; +import mekanism.common.capabilities.CapabilityWrapperManager; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.integration.forgeenergy.ForgeEnergyCableIntegration; +import mekanism.common.integration.tesla.TeslaCableIntegration; +import mekanism.common.transmitters.grid.EnergyNetwork; import mekanism.common.util.CableUtils; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.MekanismUtils; -import net.darkhax.tesla.api.ITeslaConsumer; import net.darkhax.tesla.api.ITeslaProducer; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.fml.common.Optional.Interface; -import net.minecraftforge.fml.common.Optional.InterfaceList; -import net.minecraftforge.fml.common.Optional.Method; +import net.minecraftforge.energy.CapabilityEnergy; +import net.minecraftforge.energy.IEnergyStorage; import cofh.api.energy.IEnergyProvider; import cofh.api.energy.IEnergyReceiver; -@InterfaceList({ - @Interface(iface = "net.darkhax.tesla.api.ITeslaConsumer", modid = "tesla") -}) -public class PartUniversalCable extends PartTransmitter implements IStrictEnergyAcceptor, IEnergyReceiver, IEnergyProvider, ITeslaConsumer +public class TileEntityUniversalCable extends TileEntityTransmitter implements IStrictEnergyAcceptor, IStrictEnergyStorage, IEnergyReceiver { - public Tier.CableTier tier; + public Tier.CableTier tier = CableTier.BASIC; public double currentPower = 0; public double lastWrite = 0; public EnergyStack buffer = new EnergyStack(0); - - public PartUniversalCable(Tier.CableTier cableTier) + + @Override + public BaseTier getBaseTier() { - super(); - tier = cableTier; + return tier.getBaseTier(); + } + + @Override + public void setBaseTier(BaseTier baseTier) + { + tier = Tier.CableTier.get(baseTier); } @Override @@ -73,7 +78,7 @@ public class PartUniversalCable extends PartTransmitter 0) + if(toDraw > 0) { - toDraw -= takeEnergy(received, true); + toDraw -= takeEnergy(toDraw, true); } - producer.takePower((long)(toDraw*general.TO_TESLA), false); + producer.takePower((long)Math.round(toDraw*general.TO_TESLA), false); + } + + else if(MekanismUtils.useForge() && CapabilityUtils.hasCapability(outputter, CapabilityEnergy.ENERGY, side.getOpposite())) + { + IEnergyStorage storage = CapabilityUtils.getCapability(outputter, CapabilityEnergy.ENERGY, side.getOpposite()); + double toDraw = storage.extractEnergy((int)Math.round(canDraw*general.TO_FORGE), true)*general.FROM_FORGE; + + if(toDraw > 0) + { + toDraw -= takeEnergy(toDraw, true); + } + + storage.extractEnergy((int)Math.round(toDraw*general.TO_TESLA), false); } else if(MekanismUtils.useRF() && outputter instanceof IEnergyProvider) { - double received = ((IEnergyProvider)outputter).extractEnergy(side.getOpposite(), (int)(canDraw*general.TO_RF), true)*general.FROM_RF; - double toDraw = received; + double toDraw = ((IEnergyProvider)outputter).extractEnergy(side.getOpposite(), (int)Math.round(Math.min(Integer.MAX_VALUE, canDraw*general.TO_RF)), true)*general.FROM_RF; - if(received > 0) + if(toDraw > 0) { - toDraw -= takeEnergy(received, true); + toDraw -= takeEnergy(toDraw, true); } - ((IEnergyProvider)outputter).extractEnergy(side.getOpposite(), (int)(toDraw*general.TO_RF), false); + ((IEnergyProvider)outputter).extractEnergy(side.getOpposite(), (int)Math.round(toDraw*general.TO_RF), false); } else if(MekanismUtils.useIC2()) { @@ -173,7 +189,7 @@ public class PartUniversalCable extends PartTransmitter getNetworkedData(ArrayList data) { - packet.writeInt(tier.ordinal()); + data.add(tier.ordinal()); - super.writeUpdatePacket(packet); + super.getNetworkedData(data); + + return data; } - + @Override public boolean hasCapability(Capability capability, EnumFacing facing) { return capability == Capabilities.ENERGY_STORAGE_CAPABILITY || capability == Capabilities.ENERGY_ACCEPTOR_CAPABILITY || capability == Capabilities.TESLA_CONSUMER_CAPABILITY + || capability == CapabilityEnergy.ENERGY || super.hasCapability(capability, facing); } + + private CapabilityWrapperManager teslaManager = new CapabilityWrapperManager(getClass(), TeslaCableIntegration.class); + private CapabilityWrapperManager forgeEnergyManager = new CapabilityWrapperManager(getClass(), ForgeEnergyCableIntegration.class); @Override public T getCapability(Capability capability, EnumFacing facing) { - if(capability == Capabilities.ENERGY_STORAGE_CAPABILITY || capability == Capabilities.ENERGY_ACCEPTOR_CAPABILITY || - capability == Capabilities.TESLA_CONSUMER_CAPABILITY) + if(capability == Capabilities.ENERGY_STORAGE_CAPABILITY || capability == Capabilities.ENERGY_ACCEPTOR_CAPABILITY) { return (T)this; } + if(capability == Capabilities.TESLA_CONSUMER_CAPABILITY) + { + return (T)teslaManager.getWrapper(this, facing); + } + + if(capability == CapabilityEnergy.ENERGY) + { + return (T)forgeEnergyManager.getWrapper(this, facing); + } + return super.getCapability(capability, facing); } } diff --git a/src/main/java/mekanism/common/multipart/MultipartTransmitter.java b/src/main/java/mekanism/common/transmitters/TransmitterImpl.java similarity index 62% rename from src/main/java/mekanism/common/multipart/MultipartTransmitter.java rename to src/main/java/mekanism/common/transmitters/TransmitterImpl.java index 316bbe6c9..d7ea725f6 100644 --- a/src/main/java/mekanism/common/multipart/MultipartTransmitter.java +++ b/src/main/java/mekanism/common/transmitters/TransmitterImpl.java @@ -1,44 +1,43 @@ -package mekanism.common.multipart; +package mekanism.common.transmitters; import java.util.Collection; -import mcmultipart.multipart.IMultipartContainer; import mekanism.api.Coord4D; import mekanism.api.transmitters.DynamicNetwork; import mekanism.api.transmitters.IGridTransmitter; import mekanism.api.transmitters.TransmissionType; -import mekanism.api.util.CapabilityUtils; import mekanism.common.capabilities.Capabilities; -import mekanism.common.transmitters.Transmitter; +import mekanism.common.tile.transmitter.TileEntityTransmitter; +import mekanism.common.util.CapabilityUtils; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; -public class MultipartTransmitter> extends Transmitter +public class TransmitterImpl> extends Transmitter { - public PartTransmitter containingPart; + public TileEntityTransmitter containingTile; - public MultipartTransmitter(PartTransmitter multiPart) + public TransmitterImpl(TileEntityTransmitter multiPart) { - setPart(multiPart); + setTileEntity(multiPart); } @Override public int getCapacity() { - return getPart().getCapacity(); + return getTileEntity().getCapacity(); } @Override public World world() { - return getPart().getWorld(); + return getTileEntity().getWorld(); } @Override public Coord4D coord() { - return new Coord4D(getPart().getPos(), getPart().getWorld()); + return new Coord4D(getTileEntity().getPos(), getTileEntity().getWorld()); } @Override @@ -48,7 +47,7 @@ public class MultipartTransmitter> extends Tran TileEntity potentialTransmitterTile = sideCoord.getTileEntity(world()); - if(!containingPart.canConnectMutual(side)) + if(!containingTile.canConnectMutual(side)) { return null; } @@ -57,7 +56,7 @@ public class MultipartTransmitter> extends Tran { IGridTransmitter transmitter = CapabilityUtils.getCapability(potentialTransmitterTile, Capabilities.GRID_TRANSMITTER_CAPABILITY, side.getOpposite()); - if(TransmissionType.checkTransmissionType(transmitter, getTransmissionType()) && containingPart.isValidTransmitter(potentialTransmitterTile)) + if(TransmissionType.checkTransmissionType(transmitter, getTransmissionType()) && containingTile.isValidTransmitter(potentialTransmitterTile)) { return sideCoord; } @@ -69,31 +68,26 @@ public class MultipartTransmitter> extends Tran @Override public A getAcceptor(EnumFacing side) { - return getPart().getCachedAcceptor(side); + return getTileEntity().getCachedAcceptor(side); } @Override public boolean isValid() { - IMultipartContainer cont = getPart().getContainer(); + TileEntity cont = getTileEntity(); if(cont == null) { return false; } - if(cont instanceof TileEntity && ((TileEntity)cont).isInvalid()) - { - return false; - } - - return !getPart().unloaded && coord().exists(world()); + return !cont.isInvalid() && coord().exists(world()); } @Override public N createEmptyNetwork() { - return getPart().createNewNetwork(); + return getTileEntity().createNewNetwork(); } @Override @@ -117,46 +111,46 @@ public class MultipartTransmitter> extends Tran @Override public void takeShare() { - containingPart.takeShare(); + containingTile.takeShare(); } @Override public void updateShare() { - containingPart.updateShare(); + containingTile.updateShare(); } @Override public Object getBuffer() { - return getPart().getBuffer(); + return getTileEntity().getBuffer(); } @Override public N mergeNetworks(Collection toMerge) { - return getPart().createNetworkByMerging(toMerge); + return getTileEntity().createNetworkByMerging(toMerge); } @Override public TransmissionType getTransmissionType() { - return getPart().getTransmissionType(); + return getTileEntity().getTransmissionType(); } @Override public void setRequestsUpdate() { - containingPart.sendDesc = true; + containingTile.sendDesc = true; } - public PartTransmitter getPart() + public TileEntityTransmitter getTileEntity() { - return containingPart; + return containingTile; } - public void setPart(PartTransmitter containingPart) + public void setTileEntity(TileEntityTransmitter containingPart) { - this.containingPart = containingPart; + this.containingTile = containingPart; } } diff --git a/src/main/java/mekanism/common/multipart/MultipartTransporter.java b/src/main/java/mekanism/common/transmitters/TransporterImpl.java similarity index 64% rename from src/main/java/mekanism/common/multipart/MultipartTransporter.java rename to src/main/java/mekanism/common/transmitters/TransporterImpl.java index 9ce5f0bf0..054b6e63b 100644 --- a/src/main/java/mekanism/common/multipart/MultipartTransporter.java +++ b/src/main/java/mekanism/common/transmitters/TransporterImpl.java @@ -1,4 +1,4 @@ -package mekanism.common.multipart; +package mekanism.common.transmitters; import java.util.HashSet; import java.util.Set; @@ -6,27 +6,29 @@ import java.util.Set; import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.Range4D; -import mekanism.api.util.CapabilityUtils; import mekanism.common.HashList; -import mekanism.common.InventoryNetwork; import mekanism.common.Mekanism; import mekanism.common.base.ILogisticalTransporter; import mekanism.common.capabilities.Capabilities; +import mekanism.common.content.transporter.TransitRequest; +import mekanism.common.content.transporter.TransitRequest.TransitResponse; import mekanism.common.content.transporter.TransporterManager; import mekanism.common.content.transporter.TransporterStack; import mekanism.common.content.transporter.TransporterStack.Path; -import mekanism.common.multipart.PartSidedPipe.ConnectionType; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.tile.TileEntityLogisticalSorter; +import mekanism.common.tile.transmitter.TileEntityLogisticalTransporter; +import mekanism.common.tile.transmitter.TileEntitySidedPipe.ConnectionType; +import mekanism.common.transmitters.grid.InventoryNetwork; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.TransporterUtils; -import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -public class MultipartTransporter extends MultipartTransmitter implements ILogisticalTransporter +public class TransporterImpl extends TransmitterImpl implements ILogisticalTransporter { public HashList transit = new HashList<>(); @@ -34,7 +36,7 @@ public class MultipartTransporter extends MultipartTransmitter needsSync = new HashSet<>(); - public MultipartTransporter(PartLogisticalTransporter multiPart) + public TransporterImpl(TileEntityLogisticalTransporter multiPart) { super(multiPart); } @@ -47,7 +49,7 @@ public class MultipartTransporter extends MultipartTransmitter remove = new HashSet(); - getPart().pullItems(); + getTileEntity().pullItems(); for(TransporterStack stack : transit) { if(!stack.initiatedPath) { - if(stack.itemStack == null || !recalculate(stack, null)) + if(stack.itemStack.isEmpty() || !recalculate(stack, null)) { remove.add(stack); continue; } } - stack.progress += getPart().tier.speed; + stack.progress += getTileEntity().tier.speed; if(stack.progress > 100) { @@ -108,27 +110,24 @@ public class MultipartTransporter extends MultipartTransmitter prev) { diff --git a/src/main/java/mekanism/common/FluidNetwork.java b/src/main/java/mekanism/common/transmitters/grid/FluidNetwork.java similarity index 98% rename from src/main/java/mekanism/common/FluidNetwork.java rename to src/main/java/mekanism/common/transmitters/grid/FluidNetwork.java index 14cb24514..2c73efbb6 100644 --- a/src/main/java/mekanism/common/FluidNetwork.java +++ b/src/main/java/mekanism/common/transmitters/grid/FluidNetwork.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.common.transmitters.grid; import java.util.ArrayList; import java.util.Collection; @@ -11,7 +11,7 @@ import java.util.Set; import mekanism.api.Coord4D; import mekanism.api.transmitters.DynamicNetwork; import mekanism.api.transmitters.IGridTransmitter; -import mekanism.api.util.CapabilityUtils; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.LangUtils; import mekanism.common.util.PipeUtils; import net.minecraft.tileentity.TileEntity; diff --git a/src/main/java/mekanism/api/gas/GasNetwork.java b/src/main/java/mekanism/common/transmitters/grid/GasNetwork.java similarity index 97% rename from src/main/java/mekanism/api/gas/GasNetwork.java rename to src/main/java/mekanism/common/transmitters/grid/GasNetwork.java index 571ef5f9d..5a49bd8d8 100644 --- a/src/main/java/mekanism/api/gas/GasNetwork.java +++ b/src/main/java/mekanism/common/transmitters/grid/GasNetwork.java @@ -1,4 +1,4 @@ -package mekanism.api.gas; +package mekanism.common.transmitters.grid; import java.util.Collection; import java.util.Collections; @@ -8,10 +8,13 @@ import java.util.List; import java.util.Set; import mekanism.api.Coord4D; +import mekanism.api.gas.Gas; +import mekanism.api.gas.GasStack; +import mekanism.api.gas.IGasHandler; import mekanism.api.transmitters.DynamicNetwork; import mekanism.api.transmitters.IGridTransmitter; -import mekanism.api.util.CapabilityUtils; import mekanism.common.capabilities.Capabilities; +import mekanism.common.util.CapabilityUtils; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/mekanism/common/HeatNetwork.java b/src/main/java/mekanism/common/transmitters/grid/HeatNetwork.java similarity index 75% rename from src/main/java/mekanism/common/HeatNetwork.java rename to src/main/java/mekanism/common/transmitters/grid/HeatNetwork.java index e3e018815..8fbed9812 100644 --- a/src/main/java/mekanism/common/HeatNetwork.java +++ b/src/main/java/mekanism/common/transmitters/grid/HeatNetwork.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.common.transmitters.grid; import java.util.Collection; import java.util.Set; @@ -7,11 +7,11 @@ import mekanism.api.Coord4D; import mekanism.api.IHeatTransfer; import mekanism.api.transmitters.DynamicNetwork; import mekanism.api.transmitters.IGridTransmitter; -import mekanism.api.util.UnitDisplayUtils.TemperatureUnit; import mekanism.common.capabilities.Capabilities; -import mekanism.common.multipart.MultipartTransmitter; +import mekanism.common.transmitters.TransmitterImpl; //import mekanism.common.multipart.MultipartTransmitter; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.UnitDisplayUtils.TemperatureUnit; import net.minecraftforge.fml.common.FMLCommonHandler; import org.apache.commons.lang3.tuple.Pair; @@ -82,9 +82,9 @@ public class HeatNetwork extends DynamicNetwork { for(IGridTransmitter transmitter : transmitters) { - if(transmitter instanceof MultipartTransmitter && ((MultipartTransmitter)transmitter).getPart().hasCapability(Capabilities.HEAT_TRANSFER_CAPABILITY, null)) + if(transmitter instanceof TransmitterImpl && ((TransmitterImpl)transmitter).getTileEntity().hasCapability(Capabilities.HEAT_TRANSFER_CAPABILITY, null)) { - IHeatTransfer heatTransmitter = (IHeatTransfer)((MultipartTransmitter)transmitter).getPart().getCapability(Capabilities.HEAT_TRANSFER_CAPABILITY, null); + IHeatTransfer heatTransmitter = (IHeatTransfer)((TransmitterImpl)transmitter).getTileEntity().getCapability(Capabilities.HEAT_TRANSFER_CAPABILITY, null); double[] d = heatTransmitter.simulateHeat(); newHeatTransferred += d[0]; newHeatLost += d[1]; @@ -93,9 +93,9 @@ public class HeatNetwork extends DynamicNetwork for(IGridTransmitter transmitter : transmitters) { - if(transmitter instanceof MultipartTransmitter && ((MultipartTransmitter)transmitter).getPart().hasCapability(Capabilities.HEAT_TRANSFER_CAPABILITY, null)) + if(transmitter instanceof TransmitterImpl && ((TransmitterImpl)transmitter).getTileEntity().hasCapability(Capabilities.HEAT_TRANSFER_CAPABILITY, null)) { - IHeatTransfer heatTransmitter = (IHeatTransfer)((MultipartTransmitter)transmitter).getPart().getCapability(Capabilities.HEAT_TRANSFER_CAPABILITY, null); + IHeatTransfer heatTransmitter = (IHeatTransfer)((TransmitterImpl)transmitter).getTileEntity().getCapability(Capabilities.HEAT_TRANSFER_CAPABILITY, null); newSumTemp += heatTransmitter.applyTemperatureChange(); } } diff --git a/src/main/java/mekanism/common/InventoryNetwork.java b/src/main/java/mekanism/common/transmitters/grid/InventoryNetwork.java similarity index 72% rename from src/main/java/mekanism/common/InventoryNetwork.java rename to src/main/java/mekanism/common/transmitters/grid/InventoryNetwork.java index 16769adb1..b4bf26ba8 100644 --- a/src/main/java/mekanism/common/InventoryNetwork.java +++ b/src/main/java/mekanism/common/transmitters/grid/InventoryNetwork.java @@ -1,4 +1,4 @@ -package mekanism.common; +package mekanism.common.transmitters.grid; import java.util.ArrayList; import java.util.Collection; @@ -11,8 +11,9 @@ import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.transmitters.DynamicNetwork; import mekanism.api.transmitters.IGridTransmitter; +import mekanism.common.content.transporter.TransitRequest; +import mekanism.common.content.transporter.TransitRequest.TransitResponse; import mekanism.common.content.transporter.TransporterManager; -import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -20,7 +21,7 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import org.apache.commons.lang3.tuple.Pair; -public class InventoryNetwork extends DynamicNetwork +public class InventoryNetwork extends DynamicNetwork { public InventoryNetwork() {} @@ -38,7 +39,7 @@ public class InventoryNetwork extends DynamicNetwork calculateAcceptors(ItemStack stack, EnumColor color) + public List calculateAcceptors(TransitRequest request, EnumColor color) { List toReturn = new ArrayList(); @@ -50,7 +51,7 @@ public class InventoryNetwork extends DynamicNetwork sides = acceptorDirections.get(coord); - IInventory acceptor = (IInventory)coord.getTileEntity(getWorld()); + TileEntity acceptor = coord.getTileEntity(getWorld()); if(sides == null || sides.isEmpty()) { @@ -61,13 +62,13 @@ public class InventoryNetwork extends DynamicNetwork sides = EnumSet.noneOf(EnumFacing.class); - public AcceptorData(Coord4D coord, ItemStack stack, EnumFacing side) + public AcceptorData(Coord4D coord, TransitResponse ret, EnumFacing side) { location = coord; - rejected = stack; + response = ret; sides.add(side); } } @@ -110,15 +111,15 @@ public class InventoryNetwork extends DynamicNetwork transmitter) {} + public void absorbBuffer(IGridTransmitter transmitter) {} @Override public void clampBuffer() {} @Override - public Set> getAcceptors(Object data) + public Set> getAcceptors(Object data) { - Set> toReturn = new HashSet<>(); + Set> toReturn = new HashSet<>(); if(FMLCommonHandler.instance().getEffectiveSide().isClient()) { diff --git a/src/main/java/mekanism/common/util/CableUtils.java b/src/main/java/mekanism/common/util/CableUtils.java index f29646622..f339b1309 100644 --- a/src/main/java/mekanism/common/util/CableUtils.java +++ b/src/main/java/mekanism/common/util/CableUtils.java @@ -3,19 +3,20 @@ package mekanism.common.util; import java.util.*; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; -import mekanism.api.energy.ICableOutputter; +import mekanism.api.energy.IStrictEnergyOutputter; import mekanism.api.energy.IStrictEnergyAcceptor; import mekanism.api.transmitters.TransmissionType; -import mekanism.api.util.CapabilityUtils; import mekanism.common.base.IEnergyWrapper; import mekanism.common.capabilities.Capabilities; -import mekanism.common.integration.IC2Integration; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.integration.ic2.IC2Integration; import net.darkhax.tesla.api.ITeslaConsumer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraftforge.energy.CapabilityEnergy; +import net.minecraftforge.energy.IEnergyStorage; import cofh.api.energy.IEnergyConnection; import cofh.api.energy.IEnergyProvider; import cofh.api.energy.IEnergyReceiver; @@ -105,11 +106,11 @@ public final class CableUtils return false; } - if(CapabilityUtils.hasCapability(tileEntity, Capabilities.CABLE_OUTPUTTER_CAPABILITY, side.getOpposite())) + if(CapabilityUtils.hasCapability(tileEntity, Capabilities.ENERGY_OUTPUTTER_CAPABILITY, side.getOpposite())) { - ICableOutputter outputter = CapabilityUtils.getCapability(tileEntity, Capabilities.CABLE_OUTPUTTER_CAPABILITY, side.getOpposite()); + IStrictEnergyOutputter outputter = CapabilityUtils.getCapability(tileEntity, Capabilities.ENERGY_OUTPUTTER_CAPABILITY, side.getOpposite()); - if(outputter != null && outputter.canOutputTo(side.getOpposite())) + if(outputter != null && outputter.canOutputEnergy(side.getOpposite())) { return true; } @@ -120,6 +121,11 @@ public final class CableUtils return true; } + if(MekanismUtils.useForge() && CapabilityUtils.hasCapability(tileEntity, CapabilityEnergy.ENERGY, side.getOpposite())) + { + return CapabilityUtils.getCapability(tileEntity, CapabilityEnergy.ENERGY, side.getOpposite()).canExtract(); + } + if(MekanismUtils.useRF() && tileEntity instanceof IEnergyProvider && ((IEnergyConnection)tileEntity).canConnectEnergy(side.getOpposite())) { return true; @@ -147,10 +153,14 @@ public final class CableUtils return true; } } - else if(CapabilityUtils.hasCapability(tileEntity, Capabilities.TESLA_CONSUMER_CAPABILITY, side.getOpposite())) + else if(MekanismUtils.useTesla() && CapabilityUtils.hasCapability(tileEntity, Capabilities.TESLA_CONSUMER_CAPABILITY, side.getOpposite())) { return true; } + else if(MekanismUtils.useForge() && CapabilityUtils.hasCapability(tileEntity, CapabilityEnergy.ENERGY, side.getOpposite())) + { + return CapabilityUtils.getCapability(tileEntity, CapabilityEnergy.ENERGY, side.getOpposite()).canReceive(); + } else if(MekanismUtils.useIC2() && IC2Integration.isAcceptor(orig, tileEntity, side)) { return true; @@ -242,14 +252,19 @@ public final class CableUtils if(acceptor.canReceiveEnergy(side.getOpposite())) { - sent += acceptor.transferEnergyToAcceptor(side.getOpposite(), currentSending); + sent += acceptor.acceptEnergy(side.getOpposite(), currentSending, false); } } - else if(CapabilityUtils.hasCapability(tileEntity, Capabilities.TESLA_CONSUMER_CAPABILITY, side.getOpposite())) + else if(MekanismUtils.useTesla() && CapabilityUtils.hasCapability(tileEntity, Capabilities.TESLA_CONSUMER_CAPABILITY, side.getOpposite())) { ITeslaConsumer consumer = CapabilityUtils.getCapability(tileEntity, Capabilities.TESLA_CONSUMER_CAPABILITY, side.getOpposite()); sent += consumer.givePower((long)Math.round(currentSending*general.TO_TESLA), false)*general.FROM_TESLA; } + else if(MekanismUtils.useForge() && CapabilityUtils.hasCapability(tileEntity, CapabilityEnergy.ENERGY, side.getOpposite())) + { + IEnergyStorage storage = CapabilityUtils.getCapability(tileEntity, CapabilityEnergy.ENERGY, side.getOpposite()); + sent += storage.receiveEnergy((int)Math.round(Math.min(Integer.MAX_VALUE, currentSending*general.TO_FORGE)), false)*general.FROM_FORGE; + } else if(MekanismUtils.useRF() && tileEntity instanceof IEnergyReceiver) { IEnergyReceiver handler = (IEnergyReceiver)tileEntity; diff --git a/src/main/java/mekanism/api/util/CapabilityUtils.java b/src/main/java/mekanism/common/util/CapabilityUtils.java similarity index 95% rename from src/main/java/mekanism/api/util/CapabilityUtils.java rename to src/main/java/mekanism/common/util/CapabilityUtils.java index 06888cff8..be7c4ea8d 100644 --- a/src/main/java/mekanism/api/util/CapabilityUtils.java +++ b/src/main/java/mekanism/common/util/CapabilityUtils.java @@ -1,4 +1,4 @@ -package mekanism.api.util; +package mekanism.common.util; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; diff --git a/src/main/java/mekanism/common/util/ChargeUtils.java b/src/main/java/mekanism/common/util/ChargeUtils.java index c3986ef6a..7e4c570fc 100644 --- a/src/main/java/mekanism/common/util/ChargeUtils.java +++ b/src/main/java/mekanism/common/util/ChargeUtils.java @@ -4,14 +4,19 @@ import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; import ic2.api.item.IElectricItemManager; import ic2.api.item.ISpecialElectricItem; -import mekanism.api.MekanismConfig.general; import mekanism.api.energy.EnergizedItemManager; import mekanism.api.energy.IEnergizedItem; import mekanism.api.energy.IStrictEnergyStorage; -import mekanism.common.tile.TileEntityContainerBlock; +import mekanism.common.capabilities.Capabilities; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.tile.prefab.TileEntityContainerBlock; +import net.darkhax.tesla.api.ITeslaConsumer; +import net.darkhax.tesla.api.ITeslaProducer; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; +import net.minecraftforge.energy.CapabilityEnergy; +import net.minecraftforge.energy.IEnergyStorage; import cofh.api.energy.IEnergyContainerItem; public final class ChargeUtils @@ -24,42 +29,52 @@ public final class ChargeUtils public static void discharge(int slotID, IStrictEnergyStorage storer) { IInventory inv = (TileEntityContainerBlock)storer; + ItemStack stack = inv.getStackInSlot(slotID); - if(inv.getStackInSlot(slotID) != null && storer.getEnergy() < storer.getMaxEnergy()) + if(!stack.isEmpty() && storer.getEnergy() < storer.getMaxEnergy()) { - if(inv.getStackInSlot(slotID).getItem() instanceof IEnergizedItem) + if(stack.getItem() instanceof IEnergizedItem) { - storer.setEnergy(storer.getEnergy() + EnergizedItemManager.discharge(inv.getStackInSlot(slotID), storer.getMaxEnergy() - storer.getEnergy())); + storer.setEnergy(storer.getEnergy() + EnergizedItemManager.discharge(stack, storer.getMaxEnergy() - storer.getEnergy())); } - else if(MekanismUtils.useIC2() && inv.getStackInSlot(slotID).getItem() instanceof IElectricItem) + else if(MekanismUtils.useTesla() && stack.hasCapability(Capabilities.TESLA_PRODUCER_CAPABILITY, null)) { - IElectricItem item = (IElectricItem)inv.getStackInSlot(slotID).getItem(); - - if(item.canProvideEnergy(inv.getStackInSlot(slotID))) + ITeslaProducer producer = stack.getCapability(Capabilities.TESLA_PRODUCER_CAPABILITY, null); + + long needed = (long)Math.round((storer.getMaxEnergy()-storer.getEnergy())*general.TO_TESLA); + storer.setEnergy(storer.getEnergy() + producer.takePower(needed, false)*general.FROM_TESLA); + } + else if(MekanismUtils.useForge() && stack.hasCapability(CapabilityEnergy.ENERGY, null)) + { + IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null); + + if(storage.canExtract()) { - double gain = ElectricItem.manager.discharge(inv.getStackInSlot(slotID), (int)((storer.getMaxEnergy() - storer.getEnergy())* general.TO_IC2), 4, true, true, false)* general.FROM_IC2; + int needed = (int)Math.round(Math.min(Integer.MAX_VALUE, (storer.getMaxEnergy()-storer.getEnergy())*general.TO_FORGE)); + storer.setEnergy(storer.getEnergy() + storage.extractEnergy(needed, false)*general.FROM_FORGE); + } + } + else if(MekanismUtils.useRF() && stack.getItem() instanceof IEnergyContainerItem) + { + IEnergyContainerItem item = (IEnergyContainerItem)stack.getItem(); + + int needed = (int)Math.round(Math.min(Integer.MAX_VALUE, (storer.getMaxEnergy() - storer.getEnergy())*general.TO_RF)); + storer.setEnergy(storer.getEnergy() + (item.extractEnergy(stack, needed, false)*general.FROM_RF)); + } + else if(MekanismUtils.useIC2() && stack.getItem() instanceof IElectricItem) + { + IElectricItem item = (IElectricItem)stack.getItem(); + + if(item.canProvideEnergy(stack)) + { + double gain = ElectricItem.manager.discharge(stack, (storer.getMaxEnergy() - storer.getEnergy())*general.TO_IC2, 4, true, true, false)*general.FROM_IC2; storer.setEnergy(storer.getEnergy() + gain); } } - else if(MekanismUtils.useRF() && inv.getStackInSlot(slotID).getItem() instanceof IEnergyContainerItem) - { - ItemStack itemStack = inv.getStackInSlot(slotID); - IEnergyContainerItem item = (IEnergyContainerItem)inv.getStackInSlot(slotID).getItem(); - - int itemEnergy = (int)Math.round(Math.min(Math.sqrt(item.getMaxEnergyStored(itemStack)), item.getEnergyStored(itemStack))); - int toTransfer = (int)Math.round(Math.min(itemEnergy, ((storer.getMaxEnergy() - storer.getEnergy())* general.TO_RF))); - - storer.setEnergy(storer.getEnergy() + (item.extractEnergy(itemStack, toTransfer, false)* general.FROM_RF)); - } - else if(inv.getStackInSlot(slotID).getItem() == Items.REDSTONE && storer.getEnergy()+general.ENERGY_PER_REDSTONE <= storer.getMaxEnergy()) + else if(stack.getItem() == Items.REDSTONE && storer.getEnergy()+general.ENERGY_PER_REDSTONE <= storer.getMaxEnergy()) { storer.setEnergy(storer.getEnergy() + general.ENERGY_PER_REDSTONE); - inv.getStackInSlot(slotID).stackSize--; - - if(inv.getStackInSlot(slotID).stackSize <= 0) - { - inv.setInventorySlotContents(slotID, null); - } + stack.shrink(1); } } } @@ -72,28 +87,43 @@ public final class ChargeUtils public static void charge(int slotID, IStrictEnergyStorage storer) { IInventory inv = (TileEntityContainerBlock)storer; + ItemStack stack = inv.getStackInSlot(slotID); - if(inv.getStackInSlot(slotID) != null && storer.getEnergy() > 0) + if(!stack.isEmpty() && storer.getEnergy() > 0) { - if(inv.getStackInSlot(slotID).getItem() instanceof IEnergizedItem) + if(stack.getItem() instanceof IEnergizedItem) { - storer.setEnergy(storer.getEnergy() - EnergizedItemManager.charge(inv.getStackInSlot(slotID), storer.getEnergy())); + storer.setEnergy(storer.getEnergy() - EnergizedItemManager.charge(stack, storer.getEnergy())); } - else if(MekanismUtils.useIC2() && inv.getStackInSlot(slotID).getItem() instanceof IElectricItem) + else if(MekanismUtils.useTesla() && stack.hasCapability(Capabilities.TESLA_CONSUMER_CAPABILITY, null)) { - double sent = ElectricItem.manager.charge(inv.getStackInSlot(slotID), (int)(storer.getEnergy()* general.TO_IC2), 4, true, false)* general.FROM_IC2; + ITeslaConsumer consumer = stack.getCapability(Capabilities.TESLA_CONSUMER_CAPABILITY, null); + + long stored = (long)Math.round(storer.getEnergy()*general.TO_TESLA); + storer.setEnergy(storer.getEnergy() - consumer.givePower(stored, false)*general.FROM_TESLA); + } + else if(MekanismUtils.useForge() && stack.hasCapability(CapabilityEnergy.ENERGY, null)) + { + IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null); + + if(storage.canReceive()) + { + int stored = (int)Math.round(Math.min(Integer.MAX_VALUE, storer.getEnergy()*general.TO_FORGE)); + storer.setEnergy(storer.getEnergy() - storage.receiveEnergy(stored, false)*general.FROM_FORGE); + } + } + else if(MekanismUtils.useRF() && stack.getItem() instanceof IEnergyContainerItem) + { + IEnergyContainerItem item = (IEnergyContainerItem)stack.getItem(); + + int toTransfer = (int)Math.round(storer.getEnergy()*general.TO_RF); + storer.setEnergy(storer.getEnergy() - (item.receiveEnergy(stack, toTransfer, false)*general.FROM_RF)); + } + else if(MekanismUtils.useIC2() && stack.getItem() instanceof IElectricItem) + { + double sent = ElectricItem.manager.charge(stack, storer.getEnergy()*general.TO_IC2, 4, true, false)*general.FROM_IC2; storer.setEnergy(storer.getEnergy() - sent); } - else if(MekanismUtils.useRF() && inv.getStackInSlot(slotID).getItem() instanceof IEnergyContainerItem) - { - ItemStack itemStack = inv.getStackInSlot(slotID); - IEnergyContainerItem item = (IEnergyContainerItem)inv.getStackInSlot(slotID).getItem(); - - int itemEnergy = (int)Math.round(Math.min(Math.sqrt(item.getMaxEnergyStored(itemStack)), item.getMaxEnergyStored(itemStack) - item.getEnergyStored(itemStack))); - int toTransfer = (int)Math.round(Math.min(itemEnergy, (storer.getEnergy()* general.TO_RF))); - - storer.setEnergy(storer.getEnergy() - (item.receiveEnergy(itemStack, toTransfer, false)* general.FROM_RF)); - } } } @@ -107,6 +137,8 @@ public final class ChargeUtils return (MekanismUtils.useIC2() && itemstack.getItem() instanceof IElectricItem && ((IElectricItem)itemstack.getItem()).canProvideEnergy(itemstack)) || (itemstack.getItem() instanceof IEnergizedItem && ((IEnergizedItem)itemstack.getItem()).canSend(itemstack)) || (MekanismUtils.useRF() && itemstack.getItem() instanceof IEnergyContainerItem && ((IEnergyContainerItem)itemstack.getItem()).extractEnergy(itemstack, 1, true) != 0) || + (MekanismUtils.useTesla() && itemstack.hasCapability(Capabilities.TESLA_PRODUCER_CAPABILITY, null) && itemstack.getCapability(Capabilities.TESLA_PRODUCER_CAPABILITY, null).takePower(1, true) > 0) || + (MekanismUtils.useForge() && itemstack.hasCapability(CapabilityEnergy.ENERGY, null) && itemstack.getCapability(CapabilityEnergy.ENERGY, null).canExtract()) || itemstack.getItem() == Items.REDSTONE; } @@ -119,7 +151,9 @@ public final class ChargeUtils { return (MekanismUtils.useIC2() && itemstack.getItem() instanceof IElectricItem) || (itemstack.getItem() instanceof IEnergizedItem && ((IEnergizedItem)itemstack.getItem()).canReceive(itemstack)) || - (MekanismUtils.useRF() && itemstack.getItem() instanceof IEnergyContainerItem && ((IEnergyContainerItem)itemstack.getItem()).receiveEnergy(itemstack, 1, true) != 0); + (MekanismUtils.useRF() && itemstack.getItem() instanceof IEnergyContainerItem && ((IEnergyContainerItem)itemstack.getItem()).receiveEnergy(itemstack, 1, true) != 0) || + (MekanismUtils.useTesla() && itemstack.hasCapability(Capabilities.TESLA_CONSUMER_CAPABILITY, null) && itemstack.getCapability(Capabilities.TESLA_CONSUMER_CAPABILITY, null).givePower(1, true) > 0) || + (MekanismUtils.useForge() && itemstack.hasCapability(CapabilityEnergy.ENERGY, null) && itemstack.getCapability(CapabilityEnergy.ENERGY, null).canReceive()); } /** @@ -143,16 +177,41 @@ public final class ChargeUtils return energized.getEnergy(itemstack) == 0; } } - else if(itemstack.getItem() instanceof IEnergyContainerItem) + else if(MekanismUtils.useRF() && itemstack.getItem() instanceof IEnergyContainerItem) { IEnergyContainerItem energyContainer = (IEnergyContainerItem)itemstack.getItem(); if(chargeSlot) { - return energyContainer.receiveEnergy(itemstack, 1, true) > 0; + return energyContainer.receiveEnergy(itemstack, 1, true) == 0; } else { - return energyContainer.extractEnergy(itemstack, 1, true) > 0; + return energyContainer.extractEnergy(itemstack, 1, true) == 0; + } + } + else if(MekanismUtils.useTesla()) + { + if(chargeSlot && itemstack.hasCapability(Capabilities.TESLA_CONSUMER_CAPABILITY, null)) + { + ITeslaConsumer consumer = itemstack.getCapability(Capabilities.TESLA_CONSUMER_CAPABILITY, null); + return consumer.givePower(1, true) == 0; + } + else if(!chargeSlot && itemstack.hasCapability(Capabilities.TESLA_PRODUCER_CAPABILITY, null)) + { + ITeslaProducer producer = itemstack.getCapability(Capabilities.TESLA_PRODUCER_CAPABILITY, null); + return producer.takePower(1, true) == 0; + } + } + else if(MekanismUtils.useForge() && itemstack.hasCapability(CapabilityEnergy.ENERGY, null)) + { + IEnergyStorage storage = itemstack.getCapability(CapabilityEnergy.ENERGY, null); + + if(chargeSlot) + { + return !storage.canReceive() || storage.receiveEnergy(1, true) == 0; + } + else { + return !storage.canExtract() || storage.extractEnergy(1, true) == 0; } } else if(MekanismUtils.useIC2() && itemstack.getItem() instanceof ISpecialElectricItem) @@ -163,10 +222,10 @@ public final class ChargeUtils { if(chargeSlot) { - return manager.charge(itemstack, 1, 3, true, true) > 0; + return manager.charge(itemstack, 1, 3, true, true) == 0; } else { - return manager.discharge(itemstack, 1, 3, true, true, true) > 0; + return manager.discharge(itemstack, 1, 3, true, true, true) == 0; } } } diff --git a/src/main/java/mekanism/common/util/FluidContainerUtils.java b/src/main/java/mekanism/common/util/FluidContainerUtils.java index 5e5b0b3f4..330829f5f 100644 --- a/src/main/java/mekanism/common/util/FluidContainerUtils.java +++ b/src/main/java/mekanism/common/util/FluidContainerUtils.java @@ -1,37 +1,40 @@ package mekanism.common.util; -import mekanism.api.util.StackUtils; -import mekanism.common.tile.TileEntityContainerBlock; +import mekanism.common.tile.prefab.TileEntityContainerBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.NonNullList; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; +import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.items.ItemHandlerHelper; public final class FluidContainerUtils { public static boolean isFluidContainer(ItemStack stack) { - return stack != null && stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null); + return !stack.isEmpty() && stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null); } - public static FluidStack extractFluid(FluidTank tileTank, ItemStack container) + public static FluidStack extractFluid(FluidTank tileTank, TileEntityContainerBlock tile, int slotID) { - return extractFluid(tileTank, container, FluidChecker.check(tileTank.getFluid())); + return extractFluid(tileTank, tile, slotID, FluidChecker.check(tileTank.getFluid())); } - public static FluidStack extractFluid(FluidTank tileTank, ItemStack container, FluidChecker checker) + public static FluidStack extractFluid(FluidTank tileTank, TileEntityContainerBlock tile, int slotID, FluidChecker checker) { - return extractFluid(tileTank.getCapacity()-tileTank.getFluidAmount(), container, checker); + FluidStack ret = extractFluid(tileTank.getCapacity()-tileTank.getFluidAmount(), tile.inventory.get(slotID), checker); + tile.inventory.set(slotID, FluidUtil.getFluidHandler(tile.inventory.get(slotID)).getContainer()); + return ret; } public static FluidStack extractFluid(int needed, ItemStack container, FluidChecker checker) { - IFluidHandler handler = FluidUtil.getFluidHandler(container); + IFluidHandlerItem handler = FluidUtil.getFluidHandler(container); if(handler == null || FluidUtil.getFluidContained(container) == null) { @@ -43,7 +46,9 @@ public final class FluidContainerUtils return null; } - return handler.drain(needed, true); + FluidStack ret = handler.drain(needed, true); + + return ret; } public static int insertFluid(FluidTank tileTank, ItemStack container) @@ -68,41 +73,32 @@ public final class FluidContainerUtils tank.setFluid(handleContainerItemFill(tileEntity, tileEntity.inventory, tank.getFluid(), inSlot, outSlot)); } - public static FluidStack handleContainerItemFill(TileEntity tileEntity, ItemStack[] inventory, FluidStack stack, int inSlot, int outSlot) + public static FluidStack handleContainerItemFill(TileEntity tileEntity, NonNullList inventory, FluidStack stack, int inSlot, int outSlot) { if(stack != null) { - ItemStack inputCopy = StackUtils.size(inventory[inSlot].copy(), 1); + ItemStack inputCopy = StackUtils.size(inventory.get(inSlot).copy(), 1); int drained = insertFluid(stack, inputCopy); + inputCopy = FluidUtil.getFluidHandler(inputCopy).getContainer(); - if(inventory[outSlot] != null && (!ItemHandlerHelper.canItemStacksStack(inventory[outSlot], inputCopy) || inventory[outSlot].stackSize == inventory[outSlot].getMaxStackSize())) + if(!inventory.get(outSlot).isEmpty() && (!ItemHandlerHelper.canItemStacksStack(inventory.get(outSlot), inputCopy) || inventory.get(outSlot).getCount() == inventory.get(outSlot).getMaxStackSize())) { return stack; } stack.amount -= drained; - if(inventory[outSlot] == null) + if(inventory.get(outSlot).isEmpty()) { - inventory[outSlot] = inputCopy; + inventory.set(outSlot, inputCopy); } - else if(ItemHandlerHelper.canItemStacksStack(inventory[outSlot], inputCopy)) + else if(ItemHandlerHelper.canItemStacksStack(inventory.get(outSlot), inputCopy)) { - inventory[outSlot].stackSize++; + inventory.get(outSlot).grow(1); } - inventory[inSlot].stackSize--; - - if(inventory[inSlot].stackSize == 0) - { - inventory[inSlot] = null; - } - - if(stack.amount == 0) - { - stack = null; - } + inventory.get(inSlot).shrink(1); tileEntity.markDirty(); } @@ -120,10 +116,10 @@ public final class FluidContainerUtils tank.setFluid(handleContainerItemEmpty(tileEntity, tileEntity.inventory, tank.getFluid(), tank.getCapacity()-tank.getFluidAmount(), inSlot, outSlot, checker)); } - public static FluidStack handleContainerItemEmpty(TileEntity tileEntity, ItemStack[] inventory, FluidStack stored, int needed, int inSlot, int outSlot, final FluidChecker checker) + public static FluidStack handleContainerItemEmpty(TileEntity tileEntity, NonNullList inventory, FluidStack stored, int needed, int inSlot, int outSlot, final FluidChecker checker) { final Fluid storedFinal = stored != null ? stored.getFluid() : null; - final ItemStack input = StackUtils.size(inventory[inSlot].copy(), 1); + final ItemStack input = StackUtils.size(inventory.get(inSlot).copy(), 1); FluidStack ret = extractFluid(needed, input, new FluidChecker() { @Override @@ -133,16 +129,11 @@ public final class FluidContainerUtils } }); - ItemStack inputCopy = input.copy(); + ItemStack inputCopy = FluidUtil.getFluidHandler(input).getContainer(); - if(inputCopy.stackSize == 0) + if(FluidUtil.getFluidContained(inputCopy) == null && !inputCopy.isEmpty()) { - inputCopy = null; - } - - if(FluidUtil.getFluidContained(inputCopy) == null && inputCopy != null) - { - if(inventory[outSlot] != null && (!ItemHandlerHelper.canItemStacksStack(inventory[outSlot], inputCopy) || inventory[outSlot].stackSize == inventory[outSlot].getMaxStackSize())) + if(!inventory.get(outSlot).isEmpty() && (!ItemHandlerHelper.canItemStacksStack(inventory.get(outSlot), inputCopy) || inventory.get(outSlot).getCount() == inventory.get(outSlot).getMaxStackSize())) { return stored; } @@ -165,29 +156,24 @@ public final class FluidContainerUtils if(FluidUtil.getFluidContained(inputCopy) == null || needed == 0) { - if(inputCopy != null) + if(!inputCopy.isEmpty()) { - if(inventory[outSlot] == null) + if(inventory.get(outSlot).isEmpty()) { - inventory[outSlot] = inputCopy; + inventory.set(outSlot, inputCopy); } - else if(ItemHandlerHelper.canItemStacksStack(inventory[outSlot], inputCopy)) + else if(ItemHandlerHelper.canItemStacksStack(inventory.get(outSlot), inputCopy)) { - inventory[outSlot].stackSize++; + inventory.get(outSlot).grow(1); } } - inventory[inSlot].stackSize--; - - if(inventory[inSlot].stackSize == 0) - { - inventory[inSlot] = null; - } + inventory.get(inSlot).shrink(1); tileEntity.markDirty(); } else { - inventory[inSlot] = inputCopy; + inventory.set(inSlot, inputCopy); } return stored; @@ -203,9 +189,9 @@ public final class FluidContainerUtils tank.setFluid(handleContainerItem(tileEntity, tileEntity.inventory, editMode, tank.getFluid(), tank.getCapacity()-tank.getFluidAmount(), inSlot, outSlot, checker)); } - public static FluidStack handleContainerItem(TileEntity tileEntity, ItemStack[] inventory, ContainerEditMode editMode, FluidStack stack, int needed, int inSlot, int outSlot, final FluidChecker checker) + public static FluidStack handleContainerItem(TileEntity tileEntity, NonNullList inventory, ContainerEditMode editMode, FluidStack stack, int needed, int inSlot, int outSlot, final FluidChecker checker) { - FluidStack fluidStack = FluidUtil.getFluidContained(inventory[inSlot]); + FluidStack fluidStack = FluidUtil.getFluidContained(inventory.get(inSlot)); if(editMode == ContainerEditMode.FILL || (editMode == ContainerEditMode.BOTH && fluidStack == null)) { diff --git a/src/main/java/mekanism/api/gas/GasTransmission.java b/src/main/java/mekanism/common/util/GasUtils.java similarity index 91% rename from src/main/java/mekanism/api/gas/GasTransmission.java rename to src/main/java/mekanism/common/util/GasUtils.java index 677edd682..0e34bba32 100644 --- a/src/main/java/mekanism/api/gas/GasTransmission.java +++ b/src/main/java/mekanism/common/util/GasUtils.java @@ -1,4 +1,4 @@ -package mekanism.api.gas; +package mekanism.common.util; import java.util.ArrayList; import java.util.Arrays; @@ -6,7 +6,11 @@ import java.util.Collection; import java.util.Collections; import java.util.List; -import mekanism.api.util.CapabilityUtils; +import mekanism.api.gas.Gas; +import mekanism.api.gas.GasStack; +import mekanism.api.gas.IGasHandler; +import mekanism.api.gas.IGasItem; +import mekanism.api.gas.ITubeConnection; import mekanism.common.capabilities.Capabilities; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -19,7 +23,7 @@ import net.minecraft.world.World; * @author AidanBrady * */ -public final class GasTransmission +public final class GasUtils { public static IGasHandler[] getConnectedAcceptors(TileEntity tileEntity, Collection sides) { @@ -87,7 +91,7 @@ public final class GasTransmission */ public static GasStack removeGas(ItemStack itemStack, Gas type, int amount) { - if(itemStack != null && itemStack.getItem() instanceof IGasItem) + if(!itemStack.isEmpty() && itemStack.getItem() instanceof IGasItem) { IGasItem item = (IGasItem)itemStack.getItem(); @@ -110,7 +114,7 @@ public final class GasTransmission */ public static int addGas(ItemStack itemStack, GasStack stack) { - if(itemStack != null && itemStack.getItem() instanceof IGasItem && ((IGasItem)itemStack.getItem()).canReceiveGas(itemStack, stack.getGas())) + if(!itemStack.isEmpty() && itemStack.getItem() instanceof IGasItem && ((IGasItem)itemStack.getItem()).canReceiveGas(itemStack, stack.getGas())) { return ((IGasItem)itemStack.getItem()).addGas(itemStack, stack.copy()); } diff --git a/src/main/java/mekanism/common/util/HeatUtils.java b/src/main/java/mekanism/common/util/HeatUtils.java index 968cc873c..f711f7589 100644 --- a/src/main/java/mekanism/common/util/HeatUtils.java +++ b/src/main/java/mekanism/common/util/HeatUtils.java @@ -1,7 +1,6 @@ package mekanism.common.util; import mekanism.api.IHeatTransfer; -import mekanism.api.util.CapabilityUtils; import mekanism.common.capabilities.Capabilities; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.ICapabilityProvider; diff --git a/src/main/java/mekanism/common/util/InventoryUtils.java b/src/main/java/mekanism/common/util/InventoryUtils.java index 369949c1c..cadea6056 100644 --- a/src/main/java/mekanism/common/util/InventoryUtils.java +++ b/src/main/java/mekanism/common/util/InventoryUtils.java @@ -1,19 +1,26 @@ package mekanism.common.util; +import java.util.Map; + import mekanism.api.EnumColor; -import mekanism.api.util.StackUtils; import mekanism.common.base.ISideConfiguration; import mekanism.common.content.transporter.Finder; import mekanism.common.content.transporter.InvStack; +import mekanism.common.content.transporter.TransitRequest; +import mekanism.common.content.transporter.TransitRequest.TransitResponse; +import mekanism.common.content.transporter.TransporterManager; import mekanism.common.tile.TileEntityBin; import mekanism.common.tile.TileEntityLogisticalSorter; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.InventoryLargeChest; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.EnumFacing; +import net.minecraftforge.items.CapabilityItemHandler; +import net.minecraftforge.items.IItemHandler; public final class InventoryUtils { @@ -30,7 +37,7 @@ public final class InventoryUtils return ret; } - + public static IInventory checkChestInv(IInventory inv) { if(inv instanceof TileEntityChest) @@ -64,254 +71,241 @@ public final class InventoryUtils return inv; } - public static ItemStack putStackInInventory(IInventory inventory, ItemStack itemStack, EnumFacing side, boolean force) + public static TransitResponse putStackInInventory(TileEntity tile, TransitRequest request, EnumFacing side, boolean force) { - inventory = checkChestInv(inventory); - - if(force && inventory instanceof TileEntityLogisticalSorter) + if(force && tile instanceof TileEntityLogisticalSorter) { - return ((TileEntityLogisticalSorter)inventory).sendHome(itemStack.copy()); + return ((TileEntityLogisticalSorter)tile).sendHome(request.getSingleStack()); } - ItemStack toInsert = itemStack.copy(); - - if(!(inventory instanceof ISidedInventory)) + for(Map.Entry requestEntry : request.itemMap.entrySet()) { - for(int i = 0; i <= inventory.getSizeInventory() - 1; i++) + ItemStack toInsert = requestEntry.getKey().copy(); + + //prioritize other implementations first to allow item forcing + if(tile instanceof ISidedInventory) { - if(!force) + ISidedInventory sidedInventory = (ISidedInventory)tile; + int[] slots = sidedInventory.getSlotsForFace(side.getOpposite()); + + if(slots != null && slots.length != 0) { - if(!inventory.isItemValidForSlot(i, toInsert)) + if(force && sidedInventory instanceof TileEntityBin && side == EnumFacing.UP) { - continue; + slots = sidedInventory.getSlotsForFace(EnumFacing.UP); } - } - - ItemStack inSlot = inventory.getStackInSlot(i); - - if(inSlot == null) - { - if(toInsert.stackSize <= inventory.getInventoryStackLimit()) + + for(int get = 0; get <= slots.length - 1; get++) { - inventory.setInventorySlotContents(i, toInsert); - inventory.markDirty(); - - return null; - } - else { - int rejects = toInsert.stackSize - inventory.getInventoryStackLimit(); - - ItemStack toSet = toInsert.copy(); - toSet.stackSize = inventory.getInventoryStackLimit(); - - ItemStack remains = toInsert.copy(); - remains.stackSize = rejects; - - inventory.setInventorySlotContents(i, toSet); - inventory.markDirty(); - - toInsert = remains; - } - } - else if(areItemsStackable(toInsert, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit())) - { - int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()); - - if(inSlot.stackSize + toInsert.stackSize <= max) - { - ItemStack toSet = toInsert.copy(); - toSet.stackSize += inSlot.stackSize; - - inventory.setInventorySlotContents(i, toSet); - inventory.markDirty(); - - return null; - } - else { - int rejects = (inSlot.stackSize + toInsert.stackSize) - max; - - ItemStack toSet = toInsert.copy(); - toSet.stackSize = max; - - ItemStack remains = toInsert.copy(); - remains.stackSize = rejects; - - inventory.setInventorySlotContents(i, toSet); - inventory.markDirty(); - - toInsert = remains; + int slotID = slots[get]; + + if(!force) + { + if(!sidedInventory.isItemValidForSlot(slotID, toInsert) || !sidedInventory.canInsertItem(slotID, toInsert, side.getOpposite())) + { + continue; + } + } + + ItemStack inSlot = sidedInventory.getStackInSlot(slotID); + + if(inSlot.isEmpty()) + { + if(toInsert.getCount() <= sidedInventory.getInventoryStackLimit()) + { + sidedInventory.setInventorySlotContents(slotID, toInsert); + sidedInventory.markDirty(); + + return new TransitResponse(requestEntry.getValue(), requestEntry.getKey()); + } + else { + int rejects = toInsert.getCount() - sidedInventory.getInventoryStackLimit(); + + ItemStack toSet = toInsert.copy(); + toSet.setCount(sidedInventory.getInventoryStackLimit()); + + ItemStack remains = toInsert.copy(); + remains.setCount(rejects); + + sidedInventory.setInventorySlotContents(slotID, toSet); + sidedInventory.markDirty(); + + toInsert = remains; + } + } + else if(areItemsStackable(toInsert, inSlot) && inSlot.getCount() < Math.min(inSlot.getMaxStackSize(), sidedInventory.getInventoryStackLimit())) + { + int max = Math.min(inSlot.getMaxStackSize(), sidedInventory.getInventoryStackLimit()); + + if(inSlot.getCount() + toInsert.getCount() <= max) + { + ItemStack toSet = toInsert.copy(); + toSet.grow(inSlot.getCount()); + + sidedInventory.setInventorySlotContents(slotID, toSet); + sidedInventory.markDirty(); + + return new TransitResponse(requestEntry.getValue(), requestEntry.getKey()); + } + else { + int rejects = (inSlot.getCount() + toInsert.getCount()) - max; + + ItemStack toSet = toInsert.copy(); + toSet.setCount(max); + + ItemStack remains = toInsert.copy(); + remains.setCount(rejects); + + sidedInventory.setInventorySlotContents(slotID, toSet); + sidedInventory.markDirty(); + + toInsert = remains; + } + } } } } - } - else { - ISidedInventory sidedInventory = (ISidedInventory)inventory; - int[] slots = sidedInventory.getSlotsForFace(side.getOpposite()); - - if(slots != null && slots.length != 0) + else if(tile instanceof IInventory) { - if(force && sidedInventory instanceof TileEntityBin && side == EnumFacing.UP) + IInventory inventory = checkChestInv((IInventory)tile); + + for(int i = 0; i <= inventory.getSizeInventory() - 1; i++) { - slots = sidedInventory.getSlotsForFace(EnumFacing.UP); - } - - for(int get = 0; get <= slots.length - 1; get++) - { - int slotID = slots[get]; - if(!force) { - if(!sidedInventory.isItemValidForSlot(slotID, toInsert) || !sidedInventory.canInsertItem(slotID, toInsert, side.getOpposite())) + if(!inventory.isItemValidForSlot(i, toInsert)) { continue; } } - - ItemStack inSlot = inventory.getStackInSlot(slotID); - - if(inSlot == null) + + ItemStack inSlot = inventory.getStackInSlot(i); + + if(inSlot.isEmpty()) { - if(toInsert.stackSize <= inventory.getInventoryStackLimit()) + if(toInsert.getCount() <= inventory.getInventoryStackLimit()) { - inventory.setInventorySlotContents(slotID, toInsert); + inventory.setInventorySlotContents(i, toInsert); inventory.markDirty(); - return null; + return new TransitResponse(requestEntry.getValue(), requestEntry.getKey()); } else { - int rejects = toInsert.stackSize - inventory.getInventoryStackLimit(); + int rejects = toInsert.getCount() - inventory.getInventoryStackLimit(); ItemStack toSet = toInsert.copy(); - toSet.stackSize = inventory.getInventoryStackLimit(); - + toSet.setCount(inventory.getInventoryStackLimit()); + ItemStack remains = toInsert.copy(); - remains.stackSize = rejects; - - inventory.setInventorySlotContents(slotID, toSet); + remains.setCount(rejects); + + inventory.setInventorySlotContents(i, toSet); inventory.markDirty(); - + toInsert = remains; } } - else if(areItemsStackable(toInsert, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit())) + else if(areItemsStackable(toInsert, inSlot) && inSlot.getCount() < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit())) { int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()); - if(inSlot.stackSize + toInsert.stackSize <= max) + if(inSlot.getCount() + toInsert.getCount() <= max) { ItemStack toSet = toInsert.copy(); - toSet.stackSize += inSlot.stackSize; - - inventory.setInventorySlotContents(slotID, toSet); + toSet.grow(inSlot.getCount()); + + inventory.setInventorySlotContents(i, toSet); inventory.markDirty(); - return null; + return new TransitResponse(requestEntry.getValue(), requestEntry.getKey()); } else { - int rejects = (inSlot.stackSize + toInsert.stackSize) - max; - + int rejects = (inSlot.getCount() + toInsert.getCount()) - max; + ItemStack toSet = toInsert.copy(); - toSet.stackSize = max; - + toSet.setCount(max); + ItemStack remains = toInsert.copy(); - remains.stackSize = rejects; - - inventory.setInventorySlotContents(slotID, toSet); + remains.setCount(rejects); + + inventory.setInventorySlotContents(i, toSet); inventory.markDirty(); - + toInsert = remains; } } } } + else if(isItemHandler(tile, side.getOpposite())) + { + IItemHandler inventory = getItemHandler(tile, side.getOpposite()); + + for(int i = 0; i < inventory.getSlots(); i++) + { + toInsert = inventory.insertItem(i, toInsert, false); + + if(toInsert.isEmpty()) + { + return new TransitResponse(requestEntry.getValue(), requestEntry.getKey()); + } + } + } + + if(TransporterManager.didEmit(requestEntry.getKey(), toInsert)) + { + return new TransitResponse(requestEntry.getValue(), TransporterManager.getToUse(requestEntry.getKey(), toInsert)); + } } - - return toInsert; + + return TransitResponse.EMPTY; } public static boolean areItemsStackable(ItemStack toInsert, ItemStack inSlot) { + if(toInsert.isEmpty() || inSlot.isEmpty()) + { + return true; + } + return inSlot.isItemEqual(toInsert) && ItemStack.areItemStackTagsEqual(inSlot, toInsert); } - public static InvStack takeTopItem(IInventory inventory, EnumFacing side, int amount) + public static InvStack takeDefinedItem(TileEntity tile, EnumFacing side, ItemStack type, int min, int max) { - inventory = checkChestInv(inventory); + InvStack ret = new InvStack(tile, side.getOpposite()); - if(!(inventory instanceof ISidedInventory)) + if(isItemHandler(tile, side.getOpposite())) { - for(int i = inventory.getSizeInventory() - 1; i >= 0; i--) + IItemHandler inventory = getItemHandler(tile, side.getOpposite()); + + for(int i = inventory.getSlots() - 1; i >= 0; i--) { - if(inventory.getStackInSlot(i) != null && inventory.getStackInSlot(i).stackSize > 0) + ItemStack stack = inventory.extractItem(i, max, true); + + if(!stack.isEmpty() && StackUtils.equalsWildcard(stack, type)) { - ItemStack toSend = inventory.getStackInSlot(i).copy(); - toSend.stackSize = Math.min(amount, toSend.stackSize); + int current = !ret.getStack().isEmpty() ? ret.getStack().getCount() : 0; - return new InvStack(inventory, i, toSend); - } - } - } - else { - ISidedInventory sidedInventory = (ISidedInventory)inventory; - int[] slots = sidedInventory.getSlotsForFace(side.getOpposite()); - - if(slots != null) - { - for(int get = slots.length - 1; get >= 0; get--) - { - int slotID = slots[get]; - - if(sidedInventory.getStackInSlot(slotID) != null && sidedInventory.getStackInSlot(slotID).stackSize > 0) - { - ItemStack toSend = sidedInventory.getStackInSlot(slotID).copy(); - toSend.stackSize = Math.min(amount, toSend.stackSize); - - if(sidedInventory.canExtractItem(slotID, toSend, side.getOpposite())) - { - return new InvStack(inventory, slotID, toSend); - } - } - } - } - } - - return null; - } - - public static InvStack takeDefinedItem(IInventory inventory, EnumFacing side, ItemStack type, int min, int max) - { - inventory = checkChestInv(inventory); - - InvStack ret = new InvStack(inventory); - - if(!(inventory instanceof ISidedInventory)) - { - for(int i = inventory.getSizeInventory() - 1; i >= 0; i--) - { - if(inventory.getStackInSlot(i) != null && StackUtils.equalsWildcard(inventory.getStackInSlot(i), type)) - { - ItemStack stack = inventory.getStackInSlot(i); - int current = ret.getStack() != null ? ret.getStack().stackSize : 0; - - if(current+stack.stackSize <= max) + if(current+stack.getCount() <= max) { ret.appendStack(i, stack.copy()); } else { ItemStack copy = stack.copy(); - copy.stackSize = max-current; + copy.setCount(max-current); ret.appendStack(i, copy); } - if(ret.getStack() != null && ret.getStack().stackSize == max) + if(!ret.getStack().isEmpty() && ret.getStack().getCount() == max) { return ret; } } } } - else { - ISidedInventory sidedInventory = (ISidedInventory)inventory; + else if(tile instanceof ISidedInventory) + { + ISidedInventory sidedInventory = (ISidedInventory)tile; int[] slots = sidedInventory.getSlotsForFace(side.getOpposite()); if(slots != null && slots.length != 0) @@ -320,12 +314,12 @@ public final class InventoryUtils { int slotID = slots[get]; - if(sidedInventory.getStackInSlot(slotID) != null && StackUtils.equalsWildcard(inventory.getStackInSlot(slotID), type)) + if(!sidedInventory.getStackInSlot(slotID).isEmpty() && StackUtils.equalsWildcard(sidedInventory.getStackInSlot(slotID), type)) { ItemStack stack = sidedInventory.getStackInSlot(slotID); - int current = ret.getStack() != null ? ret.getStack().stackSize : 0; + int current = !ret.getStack().isEmpty() ? ret.getStack().getCount() : 0; - if(current+stack.stackSize <= max) + if(current+stack.getCount() <= max) { ItemStack copy = stack.copy(); @@ -339,12 +333,12 @@ public final class InventoryUtils if(sidedInventory.canExtractItem(slotID, copy, side.getOpposite())) { - copy.stackSize = max-current; + copy.setCount(max-current); ret.appendStack(slotID, copy); } } - if(ret.getStack() != null && ret.getStack().stackSize == max) + if(!ret.getStack().isEmpty() && ret.getStack().getCount() == max) { return ret; } @@ -352,8 +346,36 @@ public final class InventoryUtils } } } + else if(tile instanceof IInventory) + { + IInventory inventory = checkChestInv((IInventory)tile); + + for(int i = inventory.getSizeInventory() - 1; i >= 0; i--) + { + if(!inventory.getStackInSlot(i).isEmpty() && StackUtils.equalsWildcard(inventory.getStackInSlot(i), type)) + { + ItemStack stack = inventory.getStackInSlot(i); + int current = !ret.getStack().isEmpty() ? ret.getStack().getCount() : 0; - if(ret != null && ret.getStack() != null && ret.getStack().stackSize >= min) + if(current+stack.getCount() <= max) + { + ret.appendStack(i, stack.copy()); + } + else { + ItemStack copy = stack.copy(); + copy.setCount(max-current); + ret.appendStack(i, copy); + } + + if(!ret.getStack().isEmpty() && ret.getStack().getCount() == max) + { + return ret; + } + } + } + } + + if(ret != null && !ret.getStack().isEmpty() && ret.getStack().getCount() >= min) { return ret; } @@ -361,54 +383,8 @@ public final class InventoryUtils return null; } - public static InvStack takeTopStack(IInventory inventory, EnumFacing side, Finder id) - { - inventory = checkChestInv(inventory); - - if(!(inventory instanceof ISidedInventory)) - { - for(int i = inventory.getSizeInventory() - 1; i >= 0; i--) - { - if(inventory.getStackInSlot(i) != null && id.modifies(inventory.getStackInSlot(i))) - { - ItemStack toSend = inventory.getStackInSlot(i).copy(); - return new InvStack(inventory, i, toSend); - } - } - } - else { - ISidedInventory sidedInventory = (ISidedInventory)inventory; - int[] slots = sidedInventory.getSlotsForFace(side.getOpposite()); - - if(slots != null && slots.length != 0) - { - for(int get = slots.length - 1; get >= 0; get--) - { - int slotID = slots[get]; - - if(sidedInventory.getStackInSlot(slotID) != null && id.modifies(sidedInventory.getStackInSlot(slotID))) - { - ItemStack toSend = sidedInventory.getStackInSlot(slotID); - - if(sidedInventory.canExtractItem(slotID, toSend, side.getOpposite())) - { - return new InvStack(inventory, slotID, toSend); - } - } - } - } - } - - return null; - } - public static boolean canInsert(TileEntity tileEntity, EnumColor color, ItemStack itemStack, EnumFacing side, boolean force) { - if(!(tileEntity instanceof IInventory)) - { - return false; - } - if(force && tileEntity instanceof TileEntityLogisticalSorter) { return ((TileEntityLogisticalSorter)tileEntity).canSendHome(itemStack); @@ -426,58 +402,23 @@ public final class InventoryUtils } } - IInventory inventory = checkChestInv((IInventory)tileEntity); - - if(!(inventory instanceof ISidedInventory)) + if(isItemHandler(tileEntity, side.getOpposite())) { - for(int i = 0; i <= inventory.getSizeInventory() - 1; i++) + IItemHandler inventory = getItemHandler(tileEntity, side.getOpposite()); + + for(int i = 0; i < inventory.getSlots(); i++) { - if(!force) + ItemStack rejects = inventory.insertItem(i, itemStack, true); + + if(TransporterManager.didEmit(itemStack, rejects)) { - if(!inventory.isItemValidForSlot(i, itemStack)) - { - continue; - } - } - - ItemStack inSlot = inventory.getStackInSlot(i); - - if(inSlot == null) - { - if(itemStack.stackSize <= inventory.getInventoryStackLimit()) - { - return true; - } - else { - int rejects = itemStack.stackSize - inventory.getInventoryStackLimit(); - - if(rejects < itemStack.stackSize) - { - return true; - } - } - } - else if(areItemsStackable(itemStack, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit())) - { - int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()); - - if(inSlot.stackSize + itemStack.stackSize <= max) - { - return true; - } - else { - int rejects = (inSlot.stackSize + itemStack.stackSize) - max; - - if(rejects < itemStack.stackSize) - { - return true; - } - } + return true; } } } - else { - ISidedInventory sidedInventory = (ISidedInventory)inventory; + else if(tileEntity instanceof ISidedInventory) + { + ISidedInventory sidedInventory = (ISidedInventory)tileEntity; int[] slots = sidedInventory.getSlotsForFace(side.getOpposite()); if(slots != null && slots.length != 0) @@ -499,35 +440,35 @@ public final class InventoryUtils } } - ItemStack inSlot = inventory.getStackInSlot(slotID); + ItemStack inSlot = sidedInventory.getStackInSlot(slotID); - if(inSlot == null) + if(inSlot.isEmpty()) { - if(itemStack.stackSize <= inventory.getInventoryStackLimit()) + if(itemStack.getCount() <= sidedInventory.getInventoryStackLimit()) { return true; } else { - int rejects = itemStack.stackSize - inventory.getInventoryStackLimit(); + int rejects = itemStack.getCount() - sidedInventory.getInventoryStackLimit(); - if(rejects < itemStack.stackSize) + if(rejects < itemStack.getCount()) { return true; } } } - else if(areItemsStackable(itemStack, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit())) + else if(areItemsStackable(itemStack, inSlot) && inSlot.getCount() < Math.min(inSlot.getMaxStackSize(), sidedInventory.getInventoryStackLimit())) { - int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()); + int max = Math.min(inSlot.getMaxStackSize(), sidedInventory.getInventoryStackLimit()); - if(inSlot.stackSize + itemStack.stackSize <= max) + if(inSlot.getCount() + itemStack.getCount() <= max) { return true; } else { - int rejects = (inSlot.stackSize + itemStack.stackSize) - max; + int rejects = (inSlot.getCount() + itemStack.getCount()) - max; - if(rejects < itemStack.stackSize) + if(rejects < itemStack.getCount()) { return true; } @@ -536,13 +477,79 @@ public final class InventoryUtils } } } + else if(tileEntity instanceof IInventory) + { + IInventory inventory = checkChestInv((IInventory)tileEntity); + + for(int i = 0; i <= inventory.getSizeInventory() - 1; i++) + { + if(!force) + { + if(!inventory.isItemValidForSlot(i, itemStack)) + { + continue; + } + } + + ItemStack inSlot = inventory.getStackInSlot(i); + + if(inSlot.isEmpty()) + { + if(itemStack.getCount() <= inventory.getInventoryStackLimit()) + { + return true; + } + else { + int rejects = itemStack.getCount() - inventory.getInventoryStackLimit(); + + if(rejects < itemStack.getCount()) + { + return true; + } + } + } + else if(areItemsStackable(itemStack, inSlot) && inSlot.getCount() < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit())) + { + int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()); + + if(inSlot.getCount() + itemStack.getCount() <= max) + { + return true; + } + else { + int rejects = (inSlot.getCount() + itemStack.getCount()) - max; + + if(rejects < itemStack.getCount()) + { + return true; + } + } + } + } + } return false; } + + public static ItemStack loadFromNBT(NBTTagCompound nbtTags) + { + ItemStack ret = new ItemStack(nbtTags); + return ret; + } + + public static boolean isItemHandler(TileEntity tile, EnumFacing side) + { + return CapabilityUtils.hasCapability(tile, CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side); + } + + public static IItemHandler getItemHandler(TileEntity tile, EnumFacing side) + { + return CapabilityUtils.getCapability(tile, CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side); + } /*TODO From CCLib -- go back to that version when we're using dependencies again*/ public static boolean canStack(ItemStack stack1, ItemStack stack2) { - return stack1 == null || stack2 == null || + return stack1.isEmpty() || stack2.isEmpty() || (stack1.getItem() == stack2.getItem() && (!stack2.getHasSubtypes() || stack2.getItemDamage() == stack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(stack2, stack1)) && diff --git a/src/main/java/mekanism/common/util/ItemRegistryUtils.java b/src/main/java/mekanism/common/util/ItemRegistryUtils.java index 26e6343ea..d5b92dfb5 100644 --- a/src/main/java/mekanism/common/util/ItemRegistryUtils.java +++ b/src/main/java/mekanism/common/util/ItemRegistryUtils.java @@ -27,7 +27,7 @@ public final class ItemRegistryUtils /* Mod ID lookup thanks to JEI */ public static String getMod(ItemStack stack) { - if(stack == null || stack.getItem() == null) + if(stack.isEmpty() || stack.getItem() == null) { return "null"; } diff --git a/src/main/java/mekanism/common/util/LangUtils.java b/src/main/java/mekanism/common/util/LangUtils.java index 172253907..d91a7898f 100644 --- a/src/main/java/mekanism/common/util/LangUtils.java +++ b/src/main/java/mekanism/common/util/LangUtils.java @@ -1,5 +1,7 @@ package mekanism.common.util; +import java.util.IllegalFormatException; + import mekanism.api.gas.GasStack; import net.minecraft.util.text.translation.I18n; import net.minecraftforge.fluids.FluidStack; @@ -40,4 +42,15 @@ public final class LangUtils { return I18n.translateToLocal(s); } + + public static String localizeWithFormat(String key, Object... format) + { + String s = localize(key); + + try { + return String.format(s, format); + } catch(IllegalFormatException e) { + return "Format error: " + s; + } + } } diff --git a/src/main/java/mekanism/api/util/ListUtils.java b/src/main/java/mekanism/common/util/ListUtils.java similarity index 99% rename from src/main/java/mekanism/api/util/ListUtils.java rename to src/main/java/mekanism/common/util/ListUtils.java index e20807c53..2efc7a658 100644 --- a/src/main/java/mekanism/api/util/ListUtils.java +++ b/src/main/java/mekanism/common/util/ListUtils.java @@ -1,4 +1,4 @@ -package mekanism.api.util; +package mekanism.common.util; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/main/java/mekanism/common/util/MekanismUtils.java b/src/main/java/mekanism/common/util/MekanismUtils.java index 74e4ba3bc..950b9ef3d 100644 --- a/src/main/java/mekanism/common/util/MekanismUtils.java +++ b/src/main/java/mekanism/common/util/MekanismUtils.java @@ -13,21 +13,16 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import mcmultipart.multipart.Multipart; import mekanism.api.Chunk3D; import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.IMekWrench; -import mekanism.api.MekanismConfig.client; -import mekanism.api.MekanismConfig.general; import mekanism.api.gas.Gas; import mekanism.api.gas.GasStack; import mekanism.api.transmitters.TransmissionType; -import mekanism.api.util.UnitDisplayUtils; -import mekanism.api.util.UnitDisplayUtils.ElectricUnit; -import mekanism.api.util.UnitDisplayUtils.TemperatureUnit; import mekanism.common.Mekanism; import mekanism.common.MekanismBlocks; +import mekanism.common.MekanismFluids; import mekanism.common.MekanismItems; import mekanism.common.OreDictCache; import mekanism.common.Tier.BaseTier; @@ -47,17 +42,24 @@ import mekanism.common.base.IModule; import mekanism.common.base.IRedstoneControl; import mekanism.common.base.ISideConfiguration; import mekanism.common.base.IUpgradeTile; +import mekanism.common.block.states.BlockStateMachine.MachineType; +import mekanism.common.block.states.BlockStateTransmitter.TransmitterType; +import mekanism.common.config.MekanismConfig.client; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.inventory.InventoryPersonalChest; import mekanism.common.inventory.container.ContainerPersonalChest; import mekanism.common.item.ItemBlockBasic; import mekanism.common.item.ItemBlockEnergyCube; import mekanism.common.item.ItemBlockGasTank; import mekanism.common.item.ItemBlockMachine; +import mekanism.common.item.ItemBlockTransmitter; import mekanism.common.network.PacketPersonalChest.PersonalChestMessage; import mekanism.common.network.PacketPersonalChest.PersonalChestPacketType; import mekanism.common.tile.TileEntityAdvancedBoundingBlock; import mekanism.common.tile.TileEntityBoundingBlock; import mekanism.common.tile.TileEntityPersonalChest; +import mekanism.common.util.UnitDisplayUtils.ElectricUnit; +import mekanism.common.util.UnitDisplayUtils.TemperatureUnit; import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; import net.minecraft.block.state.IBlockState; @@ -74,6 +76,7 @@ import net.minecraft.item.crafting.IRecipe; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing.Axis; +import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; @@ -91,7 +94,6 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; -import buildcraft.api.tools.IToolWrench; import cofh.api.item.IToolHammer; /** @@ -127,28 +129,28 @@ public final class MekanismUtils if(Version.get(Mekanism.latestVersionNumber).comparedState(Mekanism.versionNumber) == 1 || !list.isEmpty()) { - entityplayer.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------")); - entityplayer.addChatMessage(new TextComponentString(EnumColor.GREY + " " + LangUtils.localize("update.outdated") + ".")); + entityplayer.sendMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------")); + entityplayer.sendMessage(new TextComponentString(EnumColor.GREY + " " + LangUtils.localize("update.outdated") + ".")); if(Version.get(Mekanism.latestVersionNumber).comparedState(Mekanism.versionNumber) == 1) { - entityplayer.addChatMessage(new TextComponentString(EnumColor.INDIGO + " Mekanism: " + EnumColor.DARK_RED + Mekanism.versionNumber)); + entityplayer.sendMessage(new TextComponentString(EnumColor.INDIGO + " Mekanism: " + EnumColor.DARK_RED + Mekanism.versionNumber)); } for(IModule module : list) { - entityplayer.addChatMessage(new TextComponentString(EnumColor.INDIGO + " Mekanism" + module.getName() + ": " + EnumColor.DARK_RED + module.getVersion())); + entityplayer.sendMessage(new TextComponentString(EnumColor.INDIGO + " Mekanism" + module.getName() + ": " + EnumColor.DARK_RED + module.getVersion())); } - entityplayer.addChatMessage(new TextComponentString(EnumColor.GREY + " " + LangUtils.localize("update.consider") + " " + EnumColor.DARK_GREY + Mekanism.latestVersionNumber)); - entityplayer.addChatMessage(new TextComponentString(EnumColor.GREY + " " + LangUtils.localize("update.newFeatures") + ": " + EnumColor.INDIGO + Mekanism.recentNews)); - entityplayer.addChatMessage(new TextComponentString(EnumColor.GREY + " " + LangUtils.localize("update.visit") + " " + EnumColor.DARK_GREY + "aidancbrady.com/mekanism" + EnumColor.GREY + " " + LangUtils.localize("update.toDownload") + ".")); - entityplayer.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); + entityplayer.sendMessage(new TextComponentString(EnumColor.GREY + " " + LangUtils.localize("update.consider") + " " + EnumColor.DARK_GREY + Mekanism.latestVersionNumber)); + entityplayer.sendMessage(new TextComponentString(EnumColor.GREY + " " + LangUtils.localize("update.newFeatures") + ": " + EnumColor.INDIGO + Mekanism.recentNews)); + entityplayer.sendMessage(new TextComponentString(EnumColor.GREY + " " + LangUtils.localize("update.visit") + " " + EnumColor.DARK_GREY + "aidancbrady.com/mekanism" + EnumColor.GREY + " " + LangUtils.localize("update.toDownload") + ".")); + entityplayer.sendMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); return true; } else if(Version.get(Mekanism.latestVersionNumber).comparedState(Mekanism.versionNumber) == -1) { - entityplayer.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("update.devBuild") + " " + EnumColor.DARK_GREY + Mekanism.versionNumber)); + entityplayer.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("update.devBuild") + " " + EnumColor.DARK_GREY + Mekanism.versionNumber)); return true; } } @@ -255,7 +257,7 @@ public final class MekanismUtils } /** - * Copies an ItemStack and returns it with a defined stackSize. + * Copies an ItemStack and returns it with a defined getCount(). * @param itemstack - stack to change size * @param size - size to change to * @return resized ItemStack @@ -263,7 +265,7 @@ public final class MekanismUtils public static ItemStack size(ItemStack itemstack, int size) { ItemStack newStack = itemstack.copy(); - newStack.stackSize = size; + newStack.setCount(size); return newStack; } @@ -347,6 +349,15 @@ public final class MekanismUtils return stack; } + + public static ItemStack getTransmitter(TransmitterType type, BaseTier tier, int amount) + { + ItemStack stack = new ItemStack(MekanismBlocks.Transmitter, amount, type.ordinal()); + ItemBlockTransmitter itemTransmitter = (ItemBlockTransmitter)stack.getItem(); + itemTransmitter.setBaseTier(stack, tier); + + return stack; + } /** * Retrieves a Factory with a defined tier and recipe type. @@ -356,7 +367,7 @@ public final class MekanismUtils */ public static ItemStack getFactory(FactoryTier tier, RecipeType type) { - ItemStack itemstack = new ItemStack(MekanismBlocks.MachineBlock, 1, 5+tier.ordinal()); + ItemStack itemstack = new ItemStack(MekanismBlocks.MachineBlock, 1, MachineType.BASIC_FACTORY.ordinal()+tier.ordinal()); ((IFactory)itemstack.getItem()).setRecipeType(type.ordinal(), itemstack); return itemstack; } @@ -782,7 +793,7 @@ public final class MekanismUtils { if(!(world.getTileEntity(pos) instanceof IActiveState) || ((IActiveState)world.getTileEntity(pos)).renderUpdate()) { - world.markBlockRangeForRenderUpdate(pos, pos.add(1, 1, 1)); + world.markBlockRangeForRenderUpdate(pos, pos); } if(!(world.getTileEntity(pos) instanceof IActiveState) || ((IActiveState)world.getTileEntity(pos)).lightUpdate() && client.machineEffects) @@ -836,7 +847,7 @@ public final class MekanismUtils return new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME); } else { - return new FluidStack(FluidRegistry.getFluid("heavywater"), 10); + return new FluidStack(MekanismFluids.HeavyWater, 10); } } else if((block == Blocks.LAVA || block == Blocks.FLOWING_LAVA) && state.getValue(BlockLiquid.LEVEL) == 0) @@ -985,16 +996,6 @@ public final class MekanismUtils tileEntity.getWorld().markChunkDirty(tileEntity.getPos(), tileEntity); } - - public static void saveChunk(Multipart multipart) - { - if(multipart == null || multipart.getWorld() == null) - { - return; - } - - multipart.getWorld().markChunkDirty(multipart.getPos(), null); - } /** * Whether or not a certain TileEntity can function with redstone logic. Illogical to use unless the defined TileEntity implements @@ -1054,7 +1055,7 @@ public final class MekanismUtils double posY = player.posY; double posZ = player.posZ; - if(!player.worldObj.isRemote) + if(!player.world.isRemote) { posY += player.getEyeHeight(); @@ -1187,6 +1188,15 @@ public final class MekanismUtils { return Mekanism.hooks.TeslaLoaded && !general.blacklistTesla; } + + /** + * Whether or not Forge power should be used. + * @return if Forge power should be used + */ + public static boolean useForge() + { + return !general.blacklistForge; + } /** * Gets a clean view of a coordinate value without the dimension ID. @@ -1206,7 +1216,7 @@ public final class MekanismUtils try { FontRenderer renderer = (FontRenderer)Mekanism.proxy.getFontRenderer(); - if(stack != null && stack.getItem().getFontRenderer(stack) != null) + if(!stack.isEmpty() && stack.getItem().getFontRenderer(stack) != null) { renderer = stack.getItem().getFontRenderer(stack); } @@ -1304,37 +1314,37 @@ public final class MekanismUtils */ public static ItemStack findMatchingRecipe(InventoryCrafting inv, World world) { - ItemStack[] dmgItems = new ItemStack[2]; + NonNullList dmgItems = NonNullList.withSize(2, ItemStack.EMPTY); for(int i = 0; i < inv.getSizeInventory(); i++) { - if(inv.getStackInSlot(i) != null) + if(!inv.getStackInSlot(i).isEmpty()) { - if(dmgItems[0] == null) + if(dmgItems.get(0).isEmpty()) { - dmgItems[0] = inv.getStackInSlot(i); + dmgItems.set(0, inv.getStackInSlot(i)); } else { - dmgItems[1] = inv.getStackInSlot(i); + dmgItems.set(1, inv.getStackInSlot(i)); break; } } } - if((dmgItems[0] == null) || (dmgItems[0].getItem() == null)) + if((dmgItems.get(0).isEmpty()) || (dmgItems.get(0).getItem() == null)) { - return null; + return ItemStack.EMPTY; } - if((dmgItems[1] != null) && (dmgItems[0].getItem() == dmgItems[1].getItem()) && (dmgItems[0].stackSize == 1) && (dmgItems[1].stackSize == 1) && dmgItems[0].getItem().isRepairable()) + if((!dmgItems.get(1).isEmpty()) && (dmgItems.get(0).getItem() == dmgItems.get(1).getItem()) && (dmgItems.get(0).getCount() == 1) && (dmgItems.get(1).getCount() == 1) && dmgItems.get(0).getItem().isRepairable()) { - Item theItem = dmgItems[0].getItem(); - int dmgDiff0 = theItem.getMaxDamage() - dmgItems[0].getItemDamage(); - int dmgDiff1 = theItem.getMaxDamage() - dmgItems[1].getItemDamage(); + Item theItem = dmgItems.get(0).getItem(); + int dmgDiff0 = theItem.getMaxDamage() - dmgItems.get(0).getItemDamage(); + int dmgDiff1 = theItem.getMaxDamage() - dmgItems.get(1).getItemDamage(); int value = dmgDiff0 + dmgDiff1 + theItem.getMaxDamage() * 5 / 100; int solve = Math.max(0, theItem.getMaxDamage() - value); - return new ItemStack(dmgItems[0].getItem(), 1, solve); + return new ItemStack(dmgItems.get(0).getItem(), 1, solve); } List list = (List)((ArrayList)CraftingManager.getInstance().getRecipeList()).clone(); @@ -1347,7 +1357,7 @@ public final class MekanismUtils } } - return null; + return ItemStack.EMPTY; } /** @@ -1370,7 +1380,7 @@ public final class MekanismUtils /** * Whether or not a given EntityPlayer is considered an Op. - * @param player - player to check + * @param p - player to check * @return if the player has operator privileges */ public static boolean isOp(EntityPlayer p) @@ -1392,7 +1402,7 @@ public final class MekanismUtils */ public static int getID(ItemStack itemStack) { - if(itemStack == null) + if(itemStack.isEmpty()) { return -1; } @@ -1464,7 +1474,7 @@ public final class MekanismUtils { ItemStack tool = player.inventory.getCurrentItem(); - if(tool == null) + if(tool.isEmpty()) { return false; } @@ -1475,7 +1485,7 @@ public final class MekanismUtils } try { - if(isBCWrench(tool.getItem()) && ((IToolWrench)tool.getItem()).canWrench(player, pos)) + if(isBCWrench(tool.getItem())) //TODO too much hassle to check BC wrench-ability { return true; } diff --git a/src/main/java/mekanism/common/util/MinerUtils.java b/src/main/java/mekanism/common/util/MinerUtils.java index 6923c46c9..036a96c9e 100644 --- a/src/main/java/mekanism/common/util/MinerUtils.java +++ b/src/main/java/mekanism/common/util/MinerUtils.java @@ -5,10 +5,10 @@ import java.util.LinkedList; import java.util.List; import mekanism.api.Coord4D; -import mekanism.api.util.ListUtils; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -31,8 +31,10 @@ public final class MinerUtils return block.getDrops(world, obj.getPos(), state, 0); } else { - List ret = new LinkedList<>(); - ret.add(new ItemStack(block, 1, block.getMetaFromState(state))); + List ret = new ArrayList(); + Item item = Item.getItemFromBlock(block); + int meta = item.getHasSubtypes() ? block.getMetaFromState(state) : 0; + ret.add(new ItemStack(item, 1, meta)); if(specialSilkIDs.contains(block) || (block.getDrops(world, obj.getPos(), state, 0) != null && block.getDrops(world, obj.getPos(), state, 0).size() > 0)) { diff --git a/src/main/java/mekanism/common/util/MultipartUtils.java b/src/main/java/mekanism/common/util/MultipartUtils.java new file mode 100644 index 000000000..a53989875 --- /dev/null +++ b/src/main/java/mekanism/common/util/MultipartUtils.java @@ -0,0 +1,142 @@ +package mekanism.common.util; + +import java.util.Collection; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; + +import org.apache.commons.lang3.tuple.Pair; + +public final class MultipartUtils +{ + public static AxisAlignedBB rotate(AxisAlignedBB aabb, EnumFacing side) + { + Vec3d v1 = rotate(new Vec3d(aabb.minX, aabb.minY, aabb.minZ), side); + Vec3d v2 = rotate(new Vec3d(aabb.maxX, aabb.maxY, aabb.maxZ), side); + + return new AxisAlignedBB(v1.xCoord, v1.yCoord, v1.zCoord, v2.xCoord, v2.yCoord, v2.zCoord); + } + + public static Vec3d rotate(Vec3d vec, EnumFacing side) + { + switch(side) + { + case DOWN: + return new Vec3d(vec.xCoord, vec.yCoord, vec.zCoord); + case UP: + return new Vec3d(vec.xCoord, -vec.yCoord, -vec.zCoord); + case NORTH: + return new Vec3d(vec.xCoord, -vec.zCoord, vec.yCoord); + case SOUTH: + return new Vec3d(vec.xCoord, vec.zCoord, -vec.yCoord); + case WEST: + return new Vec3d(vec.yCoord, -vec.xCoord, vec.zCoord); + case EAST: + return new Vec3d(-vec.yCoord, vec.xCoord, vec.zCoord); + } + + return null; + } + + /* taken from MCMP */ + public static Pair getRayTraceVectors(EntityPlayer player) + { + float pitch = player.rotationPitch; + float yaw = player.rotationYaw; + Vec3d start = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ); + float f1 = MathHelper.cos(-yaw * 0.017453292F - (float) Math.PI); + float f2 = MathHelper.sin(-yaw * 0.017453292F - (float) Math.PI); + float f3 = -MathHelper.cos(-pitch * 0.017453292F); + float f4 = MathHelper.sin(-pitch * 0.017453292F); + float f5 = f2 * f3; + float f6 = f1 * f3; + double d3 = 5.0D; + + if(player instanceof EntityPlayerMP) + { + d3 = ((EntityPlayerMP)player).interactionManager.getBlockReachDistance(); + } + + Vec3d end = start.addVector(f5 * d3, f4 * d3, f6 * d3); + return Pair.of(start, end); + } + + public static AdvancedRayTraceResult collisionRayTrace(BlockPos pos, Vec3d start, Vec3d end, Collection boxes) + { + double minDistance = Double.POSITIVE_INFINITY; + AdvancedRayTraceResult hit = null; + int i = -1; + + for(AxisAlignedBB aabb : boxes) + { + AdvancedRayTraceResult result = aabb == null ? null : collisionRayTrace(pos, start, end, aabb, i, null); + + if(result != null) + { + double d = result.squareDistanceTo(start); + + if(d < minDistance) + { + minDistance = d; + hit = result; + } + } + + i++; + } + + return hit; + } + + public static AdvancedRayTraceResult collisionRayTrace(BlockPos pos, Vec3d start, Vec3d end, AxisAlignedBB bounds, int subHit, Object hitInfo) + { + RayTraceResult result = bounds.offset(pos).calculateIntercept(start, end); + + if(result == null) + { + return null; + } + + result = new RayTraceResult(RayTraceResult.Type.BLOCK, result.hitVec, result.sideHit, pos); + result.subHit = subHit; + result.hitInfo = hitInfo; + + return new AdvancedRayTraceResult(result, bounds); + } + + private static class AdvancedRayTraceResultBase + { + public final AxisAlignedBB bounds; + public final T hit; + + public AdvancedRayTraceResultBase(T mop, AxisAlignedBB aabb) + { + hit = mop; + bounds = aabb; + } + + public boolean valid() + { + return hit != null && bounds != null; + } + + public double squareDistanceTo(Vec3d vec) + { + return hit.hitVec.squareDistanceTo(vec); + } + } + + public static class AdvancedRayTraceResult extends AdvancedRayTraceResultBase + { + public AdvancedRayTraceResult(RayTraceResult mop, AxisAlignedBB bounds) + { + super(mop, bounds); + } + } +} diff --git a/src/main/java/mekanism/common/util/PipeUtils.java b/src/main/java/mekanism/common/util/PipeUtils.java index 5b33e5f1c..aaa1156bc 100644 --- a/src/main/java/mekanism/common/util/PipeUtils.java +++ b/src/main/java/mekanism/common/util/PipeUtils.java @@ -5,7 +5,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import mekanism.api.util.CapabilityUtils; import mekanism.common.capabilities.Capabilities; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; diff --git a/src/main/java/mekanism/common/util/RecipeUtils.java b/src/main/java/mekanism/common/util/RecipeUtils.java index 189750ebb..04e98a53f 100644 --- a/src/main/java/mekanism/common/util/RecipeUtils.java +++ b/src/main/java/mekanism/common/util/RecipeUtils.java @@ -9,7 +9,6 @@ import java.util.Map; import mekanism.api.energy.IEnergizedItem; import mekanism.api.gas.GasStack; import mekanism.api.gas.IGasItem; -import mekanism.api.util.StackUtils; import mekanism.common.Upgrade; import mekanism.common.base.IFactory; import mekanism.common.base.ITierItem; @@ -36,11 +35,11 @@ public class RecipeUtils { public static boolean areItemsEqualForCrafting(ItemStack target, ItemStack input) { - if(target == null && input != null || target != null && input == null) + if(target.isEmpty() && !input.isEmpty() || !target.isEmpty() && input.isEmpty()) { return false; } - else if(target == null && input == null) + else if(target.isEmpty() && input.isEmpty()) { return true; } @@ -92,7 +91,7 @@ public class RecipeUtils { ItemStack itemstack = inv.getStackInSlot(i); - if(itemstack != null && itemstack.getItem() instanceof IEnergizedItem) + if(!itemstack.isEmpty() && itemstack.getItem() instanceof IEnergizedItem) { energyFound += ((IEnergizedItem)itemstack.getItem()).getEnergy(itemstack); } @@ -109,7 +108,7 @@ public class RecipeUtils { ItemStack itemstack = inv.getStackInSlot(i); - if(itemstack != null && itemstack.getItem() instanceof IGasItem) + if(!itemstack.isEmpty() && itemstack.getItem() instanceof IGasItem) { GasStack stored = ((IGasItem)itemstack.getItem()).getGas(itemstack); @@ -149,9 +148,9 @@ public class RecipeUtils { ItemStack itemstack = inv.getStackInSlot(i); - if(itemstack != null && itemstack.getItem() instanceof ISecurityItem) + if(!itemstack.isEmpty() && itemstack.getItem() instanceof ISecurityItem) { - ((ISecurityItem)toReturn.getItem()).setOwner(toReturn, ((ISecurityItem)itemstack.getItem()).getOwner(itemstack)); + ((ISecurityItem)toReturn.getItem()).setOwnerUUID(toReturn, ((ISecurityItem)itemstack.getItem()).getOwnerUUID(itemstack)); ((ISecurityItem)toReturn.getItem()).setSecurity(toReturn, ((ISecurityItem)itemstack.getItem()).getSecurity(itemstack)); break; @@ -203,13 +202,13 @@ public class RecipeUtils if(BasicBlockType.get(toReturn) == BasicBlockType.BIN) { int foundCount = 0; - ItemStack foundType = null; + ItemStack foundType = ItemStack.EMPTY; for(int i = 0; i < 9; i++) { ItemStack itemstack = inv.getStackInSlot(i); - if(itemstack != null && BasicBlockType.get(itemstack) == BasicBlockType.BIN) + if(!itemstack.isEmpty() && BasicBlockType.get(itemstack) == BasicBlockType.BIN) { InventoryBin binInv = new InventoryBin(itemstack); @@ -218,7 +217,7 @@ public class RecipeUtils } } - if(foundCount > 0 && foundType != null) + if(foundCount > 0 && !foundType.isEmpty()) { InventoryBin binInv = new InventoryBin(toReturn); binInv.setItemCount(foundCount); @@ -234,7 +233,7 @@ public class RecipeUtils { ItemStack itemstack = inv.getStackInSlot(i); - if(itemstack != null && BlockStateMachine.MachineType.get(itemstack) != null && BlockStateMachine.MachineType.get(itemstack).supportsUpgrades) + if(!itemstack.isEmpty() && BlockStateMachine.MachineType.get(itemstack) != null && BlockStateMachine.MachineType.get(itemstack).supportsUpgrades) { Map stackMap = Upgrade.buildMap(ItemDataUtils.getDataMap(itemstack)); @@ -273,7 +272,7 @@ public class RecipeUtils if(nbtTags.hasKey("itemstack")) { - return ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("itemstack")); + return InventoryUtils.loadFromNBT(nbtTags.getCompoundTag("itemstack")); } else if(nbtTags.hasKey("itemname")) { @@ -294,7 +293,7 @@ public class RecipeUtils } } - return null; + return ItemStack.EMPTY; } public static boolean removeRecipes(ItemStack stack) diff --git a/src/main/java/mekanism/api/util/ReflectionUtils.java b/src/main/java/mekanism/common/util/ReflectionUtils.java similarity index 98% rename from src/main/java/mekanism/api/util/ReflectionUtils.java rename to src/main/java/mekanism/common/util/ReflectionUtils.java index 459ddf84c..36e57c44b 100644 --- a/src/main/java/mekanism/api/util/ReflectionUtils.java +++ b/src/main/java/mekanism/common/util/ReflectionUtils.java @@ -1,4 +1,4 @@ -package mekanism.api.util; +package mekanism.common.util; import java.lang.reflect.Field; import java.lang.reflect.Method; diff --git a/src/main/java/mekanism/common/util/SecurityUtils.java b/src/main/java/mekanism/common/util/SecurityUtils.java index 836d5d5c4..652c5e104 100644 --- a/src/main/java/mekanism/common/util/SecurityUtils.java +++ b/src/main/java/mekanism/common/util/SecurityUtils.java @@ -1,5 +1,7 @@ package mekanism.common.util; +import java.util.UUID; + import mekanism.api.EnumColor; import mekanism.client.MekanismClient; import mekanism.common.Mekanism; @@ -14,6 +16,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextComponentString; +import net.minecraftforge.common.UsernameCache; import net.minecraftforge.fml.relauncher.Side; public final class SecurityUtils @@ -22,12 +25,12 @@ public final class SecurityUtils { if(!(stack.getItem() instanceof ISecurityItem) && stack.getItem() instanceof IOwnerItem) { - String owner = ((IOwnerItem)stack.getItem()).getOwner(stack); + UUID owner = ((IOwnerItem)stack.getItem()).getOwnerUUID(stack); - return owner == null || owner.equals(player.getName()); + return owner == null || owner.equals(player.getUniqueID()); } - if(stack == null || !(stack.getItem() instanceof ISecurityItem)) + if(stack.isEmpty() || !(stack.getItem() instanceof ISecurityItem)) { return true; } @@ -39,7 +42,7 @@ public final class SecurityUtils return true; } - return canAccess(security.getSecurity(stack), player.getName(), security.getOwner(stack)); + return canAccess(security.getSecurity(stack), player, security.getOwnerUUID(stack)); } public static boolean canAccess(EntityPlayer player, TileEntity tile) @@ -56,12 +59,12 @@ public final class SecurityUtils return true; } - return canAccess(security.getSecurity().getMode(), player.getName(), security.getSecurity().getOwner()); + return canAccess(security.getSecurity().getMode(), player, security.getSecurity().getOwnerUUID()); } - private static boolean canAccess(SecurityMode mode, String username, String owner) + private static boolean canAccess(SecurityMode mode, EntityPlayer player, UUID owner) { - if(owner == null || username.equals(owner)) + if(owner == null || player.getUniqueID().equals(owner)) { return true; } @@ -84,7 +87,7 @@ public final class SecurityUtils } else if(mode == SecurityMode.TRUSTED) { - if(freq.trusted.contains(username)) + if(freq.trusted.contains(player.getName())) { return true; } @@ -93,13 +96,13 @@ public final class SecurityUtils return false; } - public static SecurityFrequency getFrequency(String owner) + public static SecurityFrequency getFrequency(UUID uuid) { - if(owner != null) + if(uuid != null) { for(Frequency f : Mekanism.securityFrequencies.getFrequencies()) { - if(f instanceof SecurityFrequency && f.owner.equals(owner)) + if(f instanceof SecurityFrequency && f.ownerUUID.equals(uuid)) { return (SecurityFrequency)f; } @@ -109,19 +112,19 @@ public final class SecurityUtils return null; } - public static String getOwnerDisplay(String user, String owner) + public static String getOwnerDisplay(EntityPlayer player, String ownerName) { - if(owner == null) + if(ownerName == null) { return EnumColor.RED + LangUtils.localize("gui.noOwner"); } - return EnumColor.GREY + LangUtils.localize("gui.owner") + ": " + (user.equals(owner) ? EnumColor.BRIGHT_GREEN : EnumColor.RED) + owner; + return EnumColor.GREY + LangUtils.localize("gui.owner") + ": " + (player.getName().equals(ownerName) ? EnumColor.BRIGHT_GREEN : EnumColor.RED) + ownerName; } public static void displayNoAccess(EntityPlayer player) { - player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.RED + LangUtils.localize("gui.noAccessDesc"))); + player.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.RED + LangUtils.localize("gui.noAccessDesc"))); } public static SecurityMode getSecurity(ISecurityTile security, Side side) @@ -137,7 +140,7 @@ public final class SecurityUtils } else if(side == Side.CLIENT) { - SecurityData data = MekanismClient.clientSecurityMap.get(security.getSecurity().getOwner()); + SecurityData data = MekanismClient.clientSecurityMap.get(security.getSecurity().getOwnerUUID()); if(data != null && data.override) { @@ -153,11 +156,11 @@ public final class SecurityUtils ISecurityItem security = (ISecurityItem)stack.getItem(); SecurityMode mode = security.getSecurity(stack); - if(security.getOwner(stack) != null) + if(security.getOwnerUUID(stack) != null) { if(side == Side.SERVER) { - SecurityFrequency freq = getFrequency(security.getOwner(stack)); + SecurityFrequency freq = getFrequency(security.getOwnerUUID(stack)); if(freq != null && freq.override) { @@ -166,7 +169,7 @@ public final class SecurityUtils } else if(side == Side.CLIENT) { - SecurityData data = MekanismClient.clientSecurityMap.get(security.getOwner(stack)); + SecurityData data = MekanismClient.clientSecurityMap.get(security.getOwnerUUID(stack)); if(data != null && data.override) { @@ -183,11 +186,11 @@ public final class SecurityUtils ISecurityTile security = (ISecurityTile)tile; SecurityMode mode = security.getSecurity().getMode(); - if(security.getSecurity().getOwner() != null) + if(security.getSecurity().getOwnerUUID() != null) { if(side == Side.SERVER) { - SecurityFrequency freq = getFrequency(security.getSecurity().getOwner()); + SecurityFrequency freq = getFrequency(security.getSecurity().getOwnerUUID()); if(freq != null && freq.override) { @@ -196,7 +199,7 @@ public final class SecurityUtils } else if(side == Side.CLIENT) { - SecurityData data = MekanismClient.clientSecurityMap.get(security.getSecurity().getOwner()); + SecurityData data = MekanismClient.clientSecurityMap.get(security.getSecurity().getOwnerUUID()); if(data != null && data.override) { @@ -212,19 +215,19 @@ public final class SecurityUtils { ISecurityItem security = (ISecurityItem)stack.getItem(); - if(security.getOwner(stack) == null) + if(security.getOwnerUUID(stack) == null) { return false; } if(side == Side.SERVER) { - SecurityFrequency freq = getFrequency(security.getOwner(stack)); + SecurityFrequency freq = getFrequency(security.getOwnerUUID(stack)); return freq != null && freq.override; } else { - SecurityData data = MekanismClient.clientSecurityMap.get(security.getOwner(stack)); + SecurityData data = MekanismClient.clientSecurityMap.get(security.getOwnerUUID(stack)); return data != null && data.override; } @@ -234,19 +237,19 @@ public final class SecurityUtils { ISecurityTile security = (ISecurityTile)tile; - if(security.getSecurity().getOwner() == null) + if(security.getSecurity().getOwnerUUID() == null) { return false; } if(side == Side.SERVER) { - SecurityFrequency freq = getFrequency(security.getSecurity().getOwner()); + SecurityFrequency freq = getFrequency(security.getSecurity().getOwnerUUID()); return freq != null && freq.override; } else { - SecurityData data = MekanismClient.clientSecurityMap.get(security.getSecurity().getOwner()); + SecurityData data = MekanismClient.clientSecurityMap.get(security.getSecurity().getOwnerUUID()); return data != null && data.override; } diff --git a/src/main/java/mekanism/api/util/StackUtils.java b/src/main/java/mekanism/common/util/StackUtils.java similarity index 73% rename from src/main/java/mekanism/api/util/StackUtils.java rename to src/main/java/mekanism/common/util/StackUtils.java index 01f2815f8..de037dfb3 100644 --- a/src/main/java/mekanism/api/util/StackUtils.java +++ b/src/main/java/mekanism/common/util/StackUtils.java @@ -1,31 +1,32 @@ -package mekanism.api.util; +package mekanism.common.util; import java.util.ArrayList; import java.util.List; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; import net.minecraftforge.oredict.OreDictionary; public final class StackUtils { public static List split(ItemStack stack) { - if(stack == null || stack.stackSize == 0) + if(stack.isEmpty() || stack.getCount() == 0) { return null; } List ret = new ArrayList(); - if(stack.stackSize == 1) + if(stack.getCount() == 1) { ret.add(stack); return ret; } - int remain = stack.stackSize % 2; - int split = (int)((float)(stack.stackSize)/2F); + int remain = stack.getCount() % 2; + int split = (int)((float)(stack.getCount())/2F); ret.add(size(stack, split+remain)); ret.add(size(stack, split)); @@ -35,7 +36,7 @@ public final class StackUtils public static Item getItem(ItemStack stack) { - if(stack == null) + if(stack.isEmpty()) { return null; } @@ -45,7 +46,7 @@ public final class StackUtils public static boolean diffIgnoreNull(ItemStack stack1, ItemStack stack2) { - if(stack1 == null || stack2 == null) + if(stack1.isEmpty() || stack2.isEmpty()) { return false; } @@ -55,7 +56,7 @@ public final class StackUtils public static boolean equalsWildcard(ItemStack wild, ItemStack check) { - if(wild == null || check == null) + if(wild.isEmpty() || check.isEmpty()) { return check == wild; } @@ -67,7 +68,7 @@ public final class StackUtils { boolean wildcard = equalsWildcard(wild, check); - if(wild == null || check == null) + if(wild.isEmpty() || check.isEmpty()) { return wildcard; } @@ -111,11 +112,11 @@ public final class StackUtils public static ItemStack add(ItemStack stack1, ItemStack stack2) { - if(stack1 == null) + if(stack1.isEmpty()) { return stack2; } - else if(stack2 == null) + else if(stack2.isEmpty()) { return stack1; } @@ -125,11 +126,11 @@ public final class StackUtils public static ItemStack subtract(ItemStack stack1, ItemStack stack2) { - if(stack1 == null) + if(stack1.isEmpty()) { - return null; + return ItemStack.EMPTY; } - else if(stack2 == null) + else if(stack2.isEmpty()) { return stack1; } @@ -139,22 +140,22 @@ public final class StackUtils public static ItemStack size(ItemStack stack, int size) { - if(size <= 0 || stack == null) + if(size <= 0 || stack.isEmpty()) { - return null; + return ItemStack.EMPTY; } ItemStack ret = stack.copy(); - ret.stackSize = size; + ret.setCount(size); return ret; } public static ItemStack copy(ItemStack stack) { - if(stack == null) + if(stack.isEmpty()) { - return null; + return ItemStack.EMPTY; } return stack.copy(); @@ -162,20 +163,20 @@ public final class StackUtils public static int getSize(ItemStack stack) { - return stack != null ? stack.stackSize : 0; + return !stack.isEmpty() ? stack.getCount() : 0; } - public static List getMergeRejects(ItemStack[] orig, ItemStack[] toAdd) + public static List getMergeRejects(NonNullList orig, NonNullList toAdd) { List ret = new ArrayList(); - for(int i = 0; i < toAdd.length; i++) + for(int i = 0; i < toAdd.size(); i++) { - if(toAdd[i] != null) + if(!toAdd.get(i).isEmpty()) { - ItemStack reject = getMergeReject(orig[i], toAdd[i]); + ItemStack reject = getMergeReject(orig.get(i), toAdd.get(i)); - if(reject != null) + if(!reject.isEmpty()) { ret.add(reject); } @@ -185,25 +186,25 @@ public final class StackUtils return ret; } - public static void merge(ItemStack[] orig, ItemStack[] toAdd) + public static void merge(NonNullList orig, NonNullList toAdd) { - for(int i = 0; i < toAdd.length; i++) + for(int i = 0; i < toAdd.size(); i++) { - if(toAdd[i] != null) + if(!toAdd.get(i).isEmpty()) { - orig[i] = merge(orig[i], toAdd[i]); + orig.set(i, merge(orig.get(i), toAdd.get(i))); } } } public static ItemStack merge(ItemStack orig, ItemStack toAdd) { - if(orig == null) + if(orig.isEmpty()) { return toAdd; } - if(toAdd == null) + if(toAdd.isEmpty()) { return orig; } @@ -213,17 +214,17 @@ public final class StackUtils return orig; } - return StackUtils.size(orig, Math.min(orig.getMaxStackSize(), orig.stackSize+toAdd.stackSize)); + return StackUtils.size(orig, Math.min(orig.getMaxStackSize(), orig.getCount()+toAdd.getCount())); } public static ItemStack getMergeReject(ItemStack orig, ItemStack toAdd) { - if(orig == null) + if(orig.isEmpty()) { - return null; + return ItemStack.EMPTY; } - if(toAdd == null) + if(toAdd.isEmpty()) { return orig; } @@ -233,7 +234,7 @@ public final class StackUtils return orig; } - int newSize = orig.stackSize+toAdd.stackSize; + int newSize = orig.getCount()+toAdd.getCount(); if(newSize > orig.getMaxStackSize()) { @@ -246,7 +247,7 @@ public final class StackUtils public static int hashItemStack(ItemStack stack) { - if(stack == null || stack.getItem() == null) + if(stack.isEmpty() || stack.getItem() == null) { return -1; } diff --git a/src/main/java/mekanism/common/util/TransporterUtils.java b/src/main/java/mekanism/common/util/TransporterUtils.java index caa891e0b..40737ad63 100644 --- a/src/main/java/mekanism/common/util/TransporterUtils.java +++ b/src/main/java/mekanism/common/util/TransporterUtils.java @@ -4,17 +4,16 @@ import java.util.List; import mekanism.api.Coord4D; import mekanism.api.EnumColor; -import mekanism.api.util.CapabilityUtils; -import mekanism.api.util.ListUtils; import mekanism.common.base.ILogisticalTransporter; import mekanism.common.capabilities.Capabilities; +import mekanism.common.content.transporter.TransitRequest; +import mekanism.common.content.transporter.TransitRequest.TransitResponse; import mekanism.common.content.transporter.TransporterManager; import mekanism.common.content.transporter.TransporterStack; import mekanism.common.tile.TileEntityLogisticalSorter; import net.minecraft.entity.item.EntityItem; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -25,36 +24,43 @@ public final class TransporterUtils public static boolean isValidAcceptorOnSide(TileEntity tile, EnumFacing side) { - if(CapabilityUtils.hasCapability(tile, Capabilities.GRID_TRANSMITTER_CAPABILITY, side.getOpposite()) || !(tile instanceof IInventory)) + if(CapabilityUtils.hasCapability(tile, Capabilities.GRID_TRANSMITTER_CAPABILITY, side.getOpposite())) { return false; } - IInventory inventory = (IInventory)tile; - - if(inventory.getSizeInventory() > 0) + if(tile instanceof IInventory) { - if(!(inventory instanceof ISidedInventory)) + IInventory inventory = (IInventory)tile; + + if(inventory.getSizeInventory() > 0) { - return true; + if(!(inventory instanceof ISidedInventory)) + { + return true; + } + + int[] slots = ((ISidedInventory)inventory).getSlotsForFace(side.getOpposite()); + + return (slots != null && slots.length > 0); } - - int[] slots = ((ISidedInventory)inventory).getSlotsForFace(side.getOpposite()); - - return (slots != null && slots.length > 0); + } + else if(InventoryUtils.isItemHandler(tile, side.getOpposite())) + { + return true; } return false; } - public static ItemStack insert(TileEntity outputter, ILogisticalTransporter transporter, ItemStack itemStack, EnumColor color, boolean doEmit, int min) + public static TransitResponse insert(TileEntity outputter, ILogisticalTransporter transporter, TransitRequest request, EnumColor color, boolean doEmit, int min) { - return transporter.insert(Coord4D.get(outputter), itemStack.copy(), color, doEmit, min); + return transporter.insert(Coord4D.get(outputter), request, color, doEmit, min); } - public static ItemStack insertRR(TileEntityLogisticalSorter outputter, ILogisticalTransporter transporter, ItemStack itemStack, EnumColor color, boolean doEmit, int min) + public static TransitResponse insertRR(TileEntityLogisticalSorter outputter, ILogisticalTransporter transporter, TransitRequest request, EnumColor color, boolean doEmit, int min) { - return transporter.insertRR(outputter, itemStack.copy(), color, doEmit, min); + return transporter.insertRR(outputter, request, color, doEmit, min); } public static EnumColor increment(EnumColor color) @@ -105,7 +111,7 @@ public final class TransporterUtils entityItem.motionY = 0; entityItem.motionZ = 0; - tileEntity.world().spawnEntityInWorld(entityItem); + tileEntity.world().spawnEntity(entityItem); } public static float[] getStackPosition(ILogisticalTransporter tileEntity, TransporterStack stack, float partial) @@ -132,4 +138,4 @@ public final class TransporterUtils int index = colors.indexOf(tileEntity.getColor()); tileEntity.setColor(colors.get(index+1)); } -} \ No newline at end of file +} diff --git a/src/main/java/mekanism/api/util/UnitDisplayUtils.java b/src/main/java/mekanism/common/util/UnitDisplayUtils.java similarity index 99% rename from src/main/java/mekanism/api/util/UnitDisplayUtils.java rename to src/main/java/mekanism/common/util/UnitDisplayUtils.java index c4ce5cbc5..560d9e4eb 100644 --- a/src/main/java/mekanism/api/util/UnitDisplayUtils.java +++ b/src/main/java/mekanism/common/util/UnitDisplayUtils.java @@ -1,4 +1,4 @@ -package mekanism.api.util; +package mekanism.common.util; /** * Code taken from UE and modified to fit Mekanism. diff --git a/src/main/java/mekanism/common/voice/VoiceConnection.java b/src/main/java/mekanism/common/voice/VoiceConnection.java index 8c64909b9..008bfdd2e 100644 --- a/src/main/java/mekanism/common/voice/VoiceConnection.java +++ b/src/main/java/mekanism/common/voice/VoiceConnection.java @@ -48,7 +48,7 @@ public class VoiceConnection extends Thread while(username == null && retryCount <= 100) { try { - List l = Collections.synchronizedList((List)((ArrayList)server.getPlayerList().getPlayerList()).clone()); + List l = Collections.synchronizedList((List)((ArrayList)server.getPlayerList().getPlayers()).clone()); for(Object obj : l) { @@ -177,7 +177,7 @@ public class VoiceConnection extends Thread public boolean canListen(int channel, ItemStack itemStack) { - if(itemStack != null) + if(!itemStack.isEmpty()) { if(itemStack.getItem() instanceof ItemWalkieTalkie) { @@ -198,7 +198,7 @@ public class VoiceConnection extends Thread { ItemStack itemStack = getPlayer().inventory.getCurrentItem(); - if(itemStack != null) + if(!itemStack.isEmpty()) { ItemWalkieTalkie walkieTalkie = (ItemWalkieTalkie)itemStack.getItem(); diff --git a/src/main/java/mekanism/common/voice/VoiceServerManager.java b/src/main/java/mekanism/common/voice/VoiceServerManager.java index eac64775d..cc4453492 100644 --- a/src/main/java/mekanism/common/voice/VoiceServerManager.java +++ b/src/main/java/mekanism/common/voice/VoiceServerManager.java @@ -6,8 +6,8 @@ import java.net.SocketException; import java.util.HashSet; import java.util.Set; -import mekanism.api.MekanismConfig.general; import mekanism.common.Mekanism; +import mekanism.common.config.MekanismConfig.general; public class VoiceServerManager { diff --git a/src/main/java/mekanism/common/world/GenHandler.java b/src/main/java/mekanism/common/world/GenHandler.java index 4e7d03ab7..a93769bae 100644 --- a/src/main/java/mekanism/common/world/GenHandler.java +++ b/src/main/java/mekanism/common/world/GenHandler.java @@ -2,8 +2,8 @@ package mekanism.common.world; import java.util.Random; -import mekanism.api.MekanismConfig.general; import mekanism.common.MekanismBlocks; +import mekanism.common.config.MekanismConfig.general; import net.minecraft.block.state.pattern.BlockMatcher; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; @@ -42,8 +42,8 @@ public class GenHandler implements IWorldGenerator for(int i = 0; i < general.saltPerChunk; i++) { - int randPosX = (chunkX*16) + random.nextInt(16); - int randPosZ = (chunkZ*16) + random.nextInt(16); + int randPosX = (chunkX*16) + random.nextInt(16) + 8; + int randPosZ = (chunkZ*16) + random.nextInt(16) + 8; BlockPos pos = world.getTopSolidOrLiquidBlock(new BlockPos(randPosX, 60, randPosZ)); new WorldGenSalt(6).generate(world, random, pos); } diff --git a/src/main/java/mekanism/generators/client/GeneratorsClientProxy.java b/src/main/java/mekanism/generators/client/GeneratorsClientProxy.java index 6380dad46..9bba49203 100644 --- a/src/main/java/mekanism/generators/client/GeneratorsClientProxy.java +++ b/src/main/java/mekanism/generators/client/GeneratorsClientProxy.java @@ -8,7 +8,6 @@ import mekanism.generators.client.gui.GuiBioGenerator; import mekanism.generators.client.gui.GuiGasGenerator; import mekanism.generators.client.gui.GuiHeatGenerator; import mekanism.generators.client.gui.GuiIndustrialTurbine; -import mekanism.generators.client.gui.GuiNeutronCapture; import mekanism.generators.client.gui.GuiReactorController; import mekanism.generators.client.gui.GuiReactorFuel; import mekanism.generators.client.gui.GuiReactorHeat; @@ -42,7 +41,6 @@ import mekanism.generators.common.tile.TileEntitySolarGenerator; import mekanism.generators.common.tile.TileEntityWindGenerator; import mekanism.generators.common.tile.reactor.TileEntityReactorController; import mekanism.generators.common.tile.reactor.TileEntityReactorLogicAdapter; -import mekanism.generators.common.tile.reactor.TileEntityReactorNeutronCapture; import mekanism.generators.common.tile.turbine.TileEntityTurbineCasing; import mekanism.generators.common.tile.turbine.TileEntityTurbineRotor; import mekanism.generators.common.tile.turbine.TileEntityTurbineValve; @@ -112,10 +110,7 @@ public class GeneratorsClientProxy extends GeneratorsCommonProxy for(ReactorBlockType type : ReactorBlockType.values()) { - if(type.isValidReactorBlock()) - { - ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(type.blockType.getBlock()), type.meta, new ModelResourceLocation("mekanismgenerators:" + type.getName(), "inventory")); - } + ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(type.blockType.getBlock()), type.meta, new ModelResourceLocation("mekanismgenerators:" + type.getName(), "inventory")); } } @@ -178,8 +173,6 @@ public class GeneratorsClientProxy extends GeneratorsCommonProxy return new GuiReactorFuel(player.inventory, (TileEntityReactorController)tileEntity); case 13: return new GuiReactorStats(player.inventory, (TileEntityReactorController)tileEntity); - case 14: - return new GuiNeutronCapture(player.inventory, (TileEntityReactorNeutronCapture)tileEntity); case 15: return new GuiReactorLogicAdapter(player.inventory, (TileEntityReactorLogicAdapter)tileEntity); } diff --git a/src/main/java/mekanism/generators/client/gui/GeneratorsGuiFactory.java b/src/main/java/mekanism/generators/client/gui/GeneratorsGuiFactory.java index bc28d95a9..47458d1cb 100644 --- a/src/main/java/mekanism/generators/client/gui/GeneratorsGuiFactory.java +++ b/src/main/java/mekanism/generators/client/gui/GeneratorsGuiFactory.java @@ -31,4 +31,16 @@ public class GeneratorsGuiFactory implements IModGuiFactory { return null; } + + @Override + public boolean hasConfigGui() + { + return true; + } + + @Override + public GuiScreen createConfigGui(GuiScreen parentScreen) + { + return new GuiGeneratorsConfig(parentScreen); + } } diff --git a/src/main/java/mekanism/generators/client/gui/GuiBioGenerator.java b/src/main/java/mekanism/generators/client/gui/GuiBioGenerator.java index 9df59314b..6943c3e06 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiBioGenerator.java +++ b/src/main/java/mekanism/generators/client/gui/GuiBioGenerator.java @@ -2,8 +2,6 @@ package mekanism.generators.client.gui; import java.util.List; -import mekanism.api.MekanismConfig.generators; -import mekanism.api.util.ListUtils; import mekanism.client.gui.GuiMekanism; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; @@ -13,7 +11,9 @@ import mekanism.client.gui.element.GuiSecurityTab; import mekanism.client.gui.element.GuiSlot; import mekanism.client.gui.element.GuiSlot.SlotOverlay; import mekanism.client.gui.element.GuiSlot.SlotType; +import mekanism.common.config.MekanismConfig.generators; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.generators.common.inventory.container.ContainerBioGenerator; diff --git a/src/main/java/mekanism/generators/client/gui/GuiGasGenerator.java b/src/main/java/mekanism/generators/client/gui/GuiGasGenerator.java index 8209ab1a8..6993c6824 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiGasGenerator.java +++ b/src/main/java/mekanism/generators/client/gui/GuiGasGenerator.java @@ -3,7 +3,6 @@ package mekanism.generators.client.gui; import java.util.List; import mekanism.api.gas.GasTank; -import mekanism.api.util.ListUtils; import mekanism.client.gui.GuiMekanism; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; @@ -17,6 +16,7 @@ import mekanism.client.gui.element.GuiSlot; import mekanism.client.gui.element.GuiSlot.SlotOverlay; import mekanism.client.gui.element.GuiSlot.SlotType; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.generators.common.inventory.container.ContainerGasGenerator; diff --git a/src/main/java/mekanism/generators/client/gui/GuiGeneratorsConfig.java b/src/main/java/mekanism/generators/client/gui/GuiGeneratorsConfig.java index d0fad2119..ea5648260 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiGeneratorsConfig.java +++ b/src/main/java/mekanism/generators/client/gui/GuiGeneratorsConfig.java @@ -1,9 +1,18 @@ package mekanism.generators.client.gui; +import java.util.ArrayList; +import java.util.List; + import mekanism.common.Mekanism; +import mekanism.common.util.LangUtils; import net.minecraft.client.gui.GuiScreen; import net.minecraftforge.common.config.ConfigElement; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.fml.client.config.DummyConfigElement.DummyCategoryElement; import net.minecraftforge.fml.client.config.GuiConfig; +import net.minecraftforge.fml.client.config.GuiConfigEntries; +import net.minecraftforge.fml.client.config.GuiConfigEntries.CategoryEntry; +import net.minecraftforge.fml.client.config.IConfigElement; /** * Created by ben on 27/06/14. @@ -12,7 +21,66 @@ public class GuiGeneratorsConfig extends GuiConfig { public GuiGeneratorsConfig(GuiScreen parent) { - super(parent, new ConfigElement(Mekanism.configuration.getCategory("generation")).getChildElements(), - "MekanismGenerators", false, false, "MekanismGenerators"); + super(parent, getConfigElements(), "MekanismGenerators", false, false, "MekanismGenerators"); + } + + private static List getConfigElements() + { + List list = new ArrayList(); + list.add(new DummyCategoryElement(LangUtils.localize("mekanism.configgui.ctgy.generators.general"), "mekanism.configgui.ctgy.generators.general", GeneralEntry.class)); + list.add(new DummyCategoryElement(LangUtils.localize("mekanism.configgui.ctgy.generators.generators"), "mekanism.configgui.ctgy.generators.generators", GeneratorsEntry.class)); + list.add(new DummyCategoryElement(LangUtils.localize("mekanism.configgui.ctgy.generators.generation"), "mekanism.configgui.ctgy.generators.generation", GenerationEntry.class)); + return list; + } + + public static class GeneralEntry extends CategoryEntry + { + public GeneralEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) + { + super(owningScreen, owningEntryList, prop); + } + + @Override + protected GuiScreen buildChildScreen() + { + return new GuiConfig(owningScreen, + new ConfigElement(Mekanism.configuration.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), + owningScreen.modID, Configuration.CATEGORY_GENERAL, false, false, + GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString())); + } + } + + public static class GeneratorsEntry extends CategoryEntry + { + public GeneratorsEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) + { + super(owningScreen, owningEntryList, prop); + } + + @Override + protected GuiScreen buildChildScreen() + { + return new GuiConfig(owningScreen, + new ConfigElement(Mekanism.configuration.getCategory("generators")).getChildElements(), + owningScreen.modID, Configuration.CATEGORY_GENERAL, false, false, + GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString())); + } + } + + public static class GenerationEntry extends CategoryEntry + { + public GenerationEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) + { + super(owningScreen, owningEntryList, prop); + } + + @Override + protected GuiScreen buildChildScreen() + { + return new GuiConfig(owningScreen, + new ConfigElement(Mekanism.configuration.getCategory("generation")).getChildElements(), + owningScreen.modID, Configuration.CATEGORY_GENERAL, false, false, + GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString())); + } } } diff --git a/src/main/java/mekanism/generators/client/gui/GuiHeatGenerator.java b/src/main/java/mekanism/generators/client/gui/GuiHeatGenerator.java index fd7729b94..c763535bb 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiHeatGenerator.java +++ b/src/main/java/mekanism/generators/client/gui/GuiHeatGenerator.java @@ -2,10 +2,6 @@ package mekanism.generators.client.gui; import java.util.List; -import mekanism.api.MekanismConfig.general; -import mekanism.api.util.ListUtils; -import mekanism.api.util.UnitDisplayUtils; -import mekanism.api.util.UnitDisplayUtils.TemperatureUnit; import mekanism.client.gui.GuiMekanism; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; @@ -19,9 +15,13 @@ import mekanism.client.gui.element.GuiSecurityTab; import mekanism.client.gui.element.GuiSlot; import mekanism.client.gui.element.GuiSlot.SlotOverlay; import mekanism.client.gui.element.GuiSlot.SlotType; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.UnitDisplayUtils; import mekanism.common.util.MekanismUtils.ResourceType; +import mekanism.common.util.UnitDisplayUtils.TemperatureUnit; import mekanism.generators.common.inventory.container.ContainerHeatGenerator; import mekanism.generators.common.tile.TileEntityHeatGenerator; import net.minecraft.entity.player.InventoryPlayer; diff --git a/src/main/java/mekanism/generators/client/gui/GuiIndustrialTurbine.java b/src/main/java/mekanism/generators/client/gui/GuiIndustrialTurbine.java index 064a7ea81..7b485ac41 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiIndustrialTurbine.java +++ b/src/main/java/mekanism/generators/client/gui/GuiIndustrialTurbine.java @@ -5,9 +5,6 @@ import java.util.ArrayList; import java.util.List; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.generators; -import mekanism.api.util.ListUtils; import mekanism.client.gui.GuiMekanism; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; @@ -18,10 +15,13 @@ import mekanism.client.render.MekanismRenderer; import mekanism.client.render.MekanismRenderer.FluidType; import mekanism.client.sound.SoundHandler; import mekanism.common.Mekanism; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.config.MekanismConfig.generators; import mekanism.common.inventory.container.ContainerFilter; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.tile.TileEntityGasTank; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.generators.client.gui.element.GuiTurbineTab; diff --git a/src/main/java/mekanism/generators/client/gui/GuiNeutronCapture.java b/src/main/java/mekanism/generators/client/gui/GuiNeutronCapture.java deleted file mode 100644 index 17f1b79a2..000000000 --- a/src/main/java/mekanism/generators/client/gui/GuiNeutronCapture.java +++ /dev/null @@ -1,70 +0,0 @@ -package mekanism.generators.client.gui; - -import java.util.List; - -import mekanism.api.util.ListUtils; -import mekanism.client.gui.GuiMekanism; -import mekanism.client.gui.element.GuiElement.IInfoHandler; -import mekanism.client.gui.element.GuiEnergyInfo; -import mekanism.client.gui.element.GuiPowerBar; -import mekanism.client.gui.element.GuiRedstoneControl; -import mekanism.client.gui.element.GuiSlot; -import mekanism.client.gui.element.GuiSlot.SlotOverlay; -import mekanism.client.gui.element.GuiSlot.SlotType; -import mekanism.common.util.LangUtils; -import mekanism.common.util.MekanismUtils; -import mekanism.common.util.MekanismUtils.ResourceType; -import mekanism.generators.common.inventory.container.ContainerNeutronCapture; -import mekanism.generators.common.tile.reactor.TileEntityReactorNeutronCapture; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import org.lwjgl.opengl.GL11; - -@SideOnly(Side.CLIENT) -public class GuiNeutronCapture extends GuiMekanism -{ - public TileEntityReactorNeutronCapture tileEntity; - - public GuiNeutronCapture(InventoryPlayer inventory, TileEntityReactorNeutronCapture tentity) - { - super(new ContainerNeutronCapture(inventory, tentity)); - tileEntity = tentity; - guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"))); - guiElements.add(new GuiEnergyInfo(new IInfoHandler() - { - @Override - public List getInfo() - { - return ListUtils.asList( - LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), - LangUtils.localize("gui.maxOutput") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t"); - } - }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"))); - guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 164, 15)); - guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 142, 34).with(SlotOverlay.POWER)); - } - - @Override - protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) - { - super.drawGuiContainerForegroundLayer(mouseX, mouseY); - - fontRendererObj.drawString(tileEntity.getName(), 30, 6, 0x404040); - fontRendererObj.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040); - fontRendererObj.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), 51, 26, 0x00CD00); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY) - { - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - int guiWidth = (width - xSize) / 2; - int guiHeight = (height - ySize) / 2; - drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize); - - super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY); - } -} diff --git a/src/main/java/mekanism/generators/client/gui/GuiReactorController.java b/src/main/java/mekanism/generators/client/gui/GuiReactorController.java index 1a47e2d74..511179fdd 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiReactorController.java +++ b/src/main/java/mekanism/generators/client/gui/GuiReactorController.java @@ -3,13 +3,13 @@ package mekanism.generators.client.gui; import java.util.ArrayList; import java.util.List; -import mekanism.api.util.ListUtils; import mekanism.client.gui.GuiMekanism; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; import mekanism.client.gui.element.GuiSlot; import mekanism.client.gui.element.GuiSlot.SlotType; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.generators.client.gui.element.GuiFuelTab; diff --git a/src/main/java/mekanism/generators/client/gui/GuiReactorFuel.java b/src/main/java/mekanism/generators/client/gui/GuiReactorFuel.java index 40fcd313f..53e8b53a6 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiReactorFuel.java +++ b/src/main/java/mekanism/generators/client/gui/GuiReactorFuel.java @@ -6,7 +6,6 @@ import java.util.List; import mekanism.api.Coord4D; import mekanism.api.gas.GasTank; -import mekanism.api.util.ListUtils; import mekanism.client.gui.GuiMekanism; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; @@ -22,6 +21,7 @@ import mekanism.common.inventory.container.ContainerNull; import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.generators.client.gui.element.GuiHeatTab; diff --git a/src/main/java/mekanism/generators/client/gui/GuiReactorHeat.java b/src/main/java/mekanism/generators/client/gui/GuiReactorHeat.java index 390bd365e..4fe494ec4 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiReactorHeat.java +++ b/src/main/java/mekanism/generators/client/gui/GuiReactorHeat.java @@ -6,8 +6,6 @@ import java.util.List; import mekanism.api.Coord4D; import mekanism.api.energy.IStrictEnergyStorage; -import mekanism.api.util.ListUtils; -import mekanism.api.util.UnitDisplayUtils.TemperatureUnit; import mekanism.client.gui.GuiMekanism; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyGauge; @@ -28,8 +26,10 @@ import mekanism.common.Mekanism; import mekanism.common.inventory.container.ContainerNull; import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; +import mekanism.common.util.UnitDisplayUtils.TemperatureUnit; import mekanism.generators.client.gui.element.GuiFuelTab; import mekanism.generators.client.gui.element.GuiStatTab; import mekanism.generators.common.tile.reactor.TileEntityReactorController; diff --git a/src/main/java/mekanism/generators/client/gui/GuiReactorStats.java b/src/main/java/mekanism/generators/client/gui/GuiReactorStats.java index d7f75e735..a538404d3 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiReactorStats.java +++ b/src/main/java/mekanism/generators/client/gui/GuiReactorStats.java @@ -7,8 +7,6 @@ import java.util.List; import mekanism.api.Coord4D; import mekanism.api.EnumColor; -import mekanism.api.util.ListUtils; -import mekanism.api.util.UnitDisplayUtils.TemperatureUnit; import mekanism.client.gui.GuiMekanism; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; @@ -17,8 +15,10 @@ import mekanism.common.Mekanism; import mekanism.common.inventory.container.ContainerNull; import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; +import mekanism.common.util.UnitDisplayUtils.TemperatureUnit; import mekanism.generators.client.gui.element.GuiFuelTab; import mekanism.generators.client.gui.element.GuiHeatTab; import mekanism.generators.common.tile.reactor.TileEntityReactorController; diff --git a/src/main/java/mekanism/generators/client/gui/GuiSolarGenerator.java b/src/main/java/mekanism/generators/client/gui/GuiSolarGenerator.java index 4ebe70202..3692534e6 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiSolarGenerator.java +++ b/src/main/java/mekanism/generators/client/gui/GuiSolarGenerator.java @@ -2,7 +2,6 @@ package mekanism.generators.client.gui; import java.util.List; -import mekanism.api.util.ListUtils; import mekanism.client.gui.GuiMekanism; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; @@ -13,6 +12,7 @@ import mekanism.client.gui.element.GuiSlot; import mekanism.client.gui.element.GuiSlot.SlotOverlay; import mekanism.client.gui.element.GuiSlot.SlotType; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.generators.common.inventory.container.ContainerSolarGenerator; diff --git a/src/main/java/mekanism/generators/client/gui/GuiTurbineStats.java b/src/main/java/mekanism/generators/client/gui/GuiTurbineStats.java index 0e0aa9706..961249ae9 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiTurbineStats.java +++ b/src/main/java/mekanism/generators/client/gui/GuiTurbineStats.java @@ -3,14 +3,14 @@ package mekanism.generators.client.gui; import java.util.List; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.generators; -import mekanism.api.util.ListUtils; import mekanism.client.gui.GuiMekanism; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.config.MekanismConfig.generators; import mekanism.common.inventory.container.ContainerNull; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.generators.client.gui.element.GuiTurbineTab; diff --git a/src/main/java/mekanism/generators/client/gui/GuiWindGenerator.java b/src/main/java/mekanism/generators/client/gui/GuiWindGenerator.java index cedd87feb..d4a10d34e 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiWindGenerator.java +++ b/src/main/java/mekanism/generators/client/gui/GuiWindGenerator.java @@ -4,8 +4,6 @@ import java.text.DecimalFormat; import java.util.List; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.generators; -import mekanism.api.util.ListUtils; import mekanism.client.gui.GuiMekanism; import mekanism.client.gui.element.GuiElement.IInfoHandler; import mekanism.client.gui.element.GuiEnergyInfo; @@ -15,7 +13,9 @@ import mekanism.client.gui.element.GuiSecurityTab; import mekanism.client.gui.element.GuiSlot; import mekanism.client.gui.element.GuiSlot.SlotOverlay; import mekanism.client.gui.element.GuiSlot.SlotType; +import mekanism.common.config.MekanismConfig.generators; import mekanism.common.util.LangUtils; +import mekanism.common.util.ListUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.generators.common.inventory.container.ContainerWindGenerator; diff --git a/src/main/java/mekanism/generators/client/jei/GeneratorsJEI.java b/src/main/java/mekanism/generators/client/jei/GeneratorsJEI.java index 384d9eb88..027868078 100644 --- a/src/main/java/mekanism/generators/client/jei/GeneratorsJEI.java +++ b/src/main/java/mekanism/generators/client/jei/GeneratorsJEI.java @@ -2,21 +2,17 @@ package mekanism.generators.client.jei; import mekanism.client.jei.MekanismJEI; import mekanism.generators.common.GeneratorsBlocks; -import mezz.jei.api.IJeiRuntime; -import mezz.jei.api.IModPlugin; -import mezz.jei.api.IModRegistry; +import mezz.jei.api.BlankModPlugin; +import mezz.jei.api.ISubtypeRegistry; import mezz.jei.api.JEIPlugin; import net.minecraft.item.Item; @JEIPlugin -public class GeneratorsJEI implements IModPlugin +public class GeneratorsJEI extends BlankModPlugin { @Override - public void register(IModRegistry registry) + public void registerItemSubtypes(ISubtypeRegistry registry) { - registry.getJeiHelpers().getSubtypeRegistry().registerNbtInterpreter(Item.getItemFromBlock(GeneratorsBlocks.Generator), MekanismJEI.NBT_INTERPRETER); + registry.registerSubtypeInterpreter(Item.getItemFromBlock(GeneratorsBlocks.Generator), MekanismJEI.NBT_INTERPRETER); } - - @Override - public void onRuntimeAvailable(IJeiRuntime runtime) {} } diff --git a/src/main/java/mekanism/generators/common/FusionReactor.java b/src/main/java/mekanism/generators/common/FusionReactor.java index 739400aaf..4cd72baa9 100644 --- a/src/main/java/mekanism/generators/common/FusionReactor.java +++ b/src/main/java/mekanism/generators/common/FusionReactor.java @@ -4,24 +4,22 @@ import static java.lang.Math.max; import static java.lang.Math.min; import java.util.ArrayList; -import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import mekanism.api.Coord4D; import mekanism.api.IHeatTransfer; -import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; -import mekanism.api.reactor.IFusionReactor; -import mekanism.api.reactor.INeutronCapture; -import mekanism.api.reactor.IReactorBlock; -import mekanism.api.util.UnitDisplayUtils.TemperatureUnit; import mekanism.common.LaserManager; import mekanism.common.Mekanism; +import mekanism.common.MekanismFluids; +import mekanism.common.config.MekanismConfig.generators; import mekanism.common.network.PacketTileEntity.TileEntityMessage; +import mekanism.common.util.UnitDisplayUtils.TemperatureUnit; import mekanism.generators.common.item.ItemHohlraum; +import mekanism.generators.common.tile.reactor.TileEntityReactorBlock; import mekanism.generators.common.tile.reactor.TileEntityReactorController; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; @@ -30,16 +28,16 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; -public class FusionReactor implements IFusionReactor +public class FusionReactor { public TileEntityReactorController controller; - public Set reactorBlocks = new HashSet(); - public Set neutronCaptors = new HashSet(); + public Set reactorBlocks = new HashSet(); public Set heatTransfers = new HashSet(); //Current stores of temperature - internally uses ambient-relative kelvin units @@ -55,7 +53,6 @@ public class FusionReactor implements IFusionReactor //Reaction characteristics public static double burnTemperature = TemperatureUnit.AMBIENT.convertFromK(1E8, true); public static double burnRatio = 1; - public static double energyPerFuel = 5E6; public int injectionRate = 0; //Thermal characteristics @@ -82,7 +79,6 @@ public class FusionReactor implements IFusionReactor controller = c; } - @Override public void addTemperatureFromEnergyInput(double energyAdded) { plasmaTemperature += energyAdded / plasmaHeatCapacity * (isBurning() ? 1 : 10); @@ -92,19 +88,18 @@ public class FusionReactor implements IFusionReactor { if(controller != null) { - ItemStack hohlraum = controller.inventory[0]; + ItemStack hohlraum = controller.inventory.get(0); - if(hohlraum != null && hohlraum.getItem() instanceof ItemHohlraum) + if(!hohlraum.isEmpty() && hohlraum.getItem() instanceof ItemHohlraum) { GasStack gasStack = ((ItemHohlraum)hohlraum.getItem()).getGas(hohlraum); - return gasStack != null && gasStack.getGas() == GasRegistry.getGas("fusionFuelDT") && gasStack.amount == ItemHohlraum.MAX_GAS; + return gasStack != null && gasStack.getGas() == MekanismFluids.FusionFuel && gasStack.amount == ItemHohlraum.MAX_GAS; } } return false; } - @Override public void simulate() { if(controller.getWorld().isRemote) @@ -131,7 +126,6 @@ public class FusionReactor implements IFusionReactor { injectFuel(); int fuelBurned = burnFuel(); - neutronFlux(fuelBurned); if(fuelBurned == 0) { @@ -154,7 +148,6 @@ public class FusionReactor implements IFusionReactor updateTemperatures(); } - @Override public void updateTemperatures() { lastPlasmaTemperature = plasmaTemperature < 1E-1 ? 0 : plasmaTemperature; @@ -163,10 +156,10 @@ public class FusionReactor implements IFusionReactor public void vaporiseHohlraum() { - getFuelTank().receive(((ItemHohlraum)controller.inventory[0].getItem()).getGas(controller.inventory[0]), true); + getFuelTank().receive(((ItemHohlraum)controller.inventory.get(0).getItem()).getGas(controller.inventory.get(0)), true); lastPlasmaTemperature = plasmaTemperature; - controller.inventory[0] = null; + controller.inventory.set(0, ItemStack.EMPTY); burning = true; } @@ -181,7 +174,7 @@ public class FusionReactor implements IFusionReactor getDeuteriumTank().draw(amountToInject / 2, true); getTritiumTank().draw(amountToInject / 2, true); - getFuelTank().receive(new GasStack(GasRegistry.getGas("fusionFuelDT"), amountToInject), true); + getFuelTank().receive(new GasStack(MekanismFluids.FusionFuel, amountToInject), true); } public int burnFuel() @@ -189,30 +182,11 @@ public class FusionReactor implements IFusionReactor int fuelBurned = (int)min(getFuelTank().getStored(), max(0, lastPlasmaTemperature - burnTemperature)*burnRatio); getFuelTank().draw(fuelBurned, true); - plasmaTemperature += energyPerFuel * fuelBurned / plasmaHeatCapacity; + plasmaTemperature += generators.energyPerFusionFuel * fuelBurned / plasmaHeatCapacity; return fuelBurned; } - public void neutronFlux(int fuelBurned) - { - int neutronsRemaining = fuelBurned; - List list = new ArrayList(neutronCaptors); - Collections.shuffle(list); - - for(INeutronCapture captor: neutronCaptors) - { - if(neutronsRemaining <= 0) - { - break; - } - - neutronsRemaining = captor.absorbNeutrons(neutronsRemaining); - } - - controller.radiateNeutrons(neutronsRemaining); - } - public void transferHeat() { //Transfer from plasma to casing @@ -251,73 +225,61 @@ public class FusionReactor implements IFusionReactor setBufferedEnergy(getBufferedEnergy() + caseAirHeat * thermocoupleEfficiency); } - @Override public FluidTank getWaterTank() { return controller != null ? controller.waterTank : null; } - @Override public FluidTank getSteamTank() { return controller.steamTank; } - @Override public GasTank getDeuteriumTank() { return controller.deuteriumTank; } - @Override public GasTank getTritiumTank() { return controller.tritiumTank; } - @Override public GasTank getFuelTank() { return controller.fuelTank; } - @Override public double getBufferedEnergy() { return controller.getEnergy(); } - @Override public void setBufferedEnergy(double energy) { controller.setEnergy(energy); } - @Override public double getPlasmaTemp() { return lastPlasmaTemperature; } - @Override public void setPlasmaTemp(double temp) { plasmaTemperature = temp; } - @Override public double getCaseTemp() { return lastCaseTemperature; } - @Override public void setCaseTemp(double temp) { caseTemperature = temp; } - @Override public double getBufferSize() { return controller.getMaxEnergy(); @@ -330,13 +292,13 @@ public class FusionReactor implements IFusionReactor for(Entity entity : entitiesToDie) { - entity.attackEntityFrom(DamageSource.magic, 50000F); + entity.attackEntityFrom(DamageSource.MAGIC, 50000F); } } public void unformMultiblock(boolean keepBurning) { - for(IReactorBlock block : reactorBlocks) + for(TileEntityReactorBlock block : reactorBlocks) { block.setReactor(null); } @@ -344,7 +306,6 @@ public class FusionReactor implements IFusionReactor //Don't remove from controller controller.setReactor(this); reactorBlocks.clear(); - neutronCaptors.clear(); formed = false; burning = burning && keepBurning; @@ -354,7 +315,6 @@ public class FusionReactor implements IFusionReactor } } - @Override public void formMultiblock(boolean keepBurning) { updatedThisTick = true; @@ -406,10 +366,10 @@ public class FusionReactor implements IFusionReactor { TileEntity tile = centre.clone().translate(coords[0], coords[1], coords[2]).getTileEntity(controller.getWorld()); - if(tile instanceof IReactorBlock && ((IReactorBlock)tile).isFrame()) + if(tile instanceof TileEntityReactorBlock && ((TileEntityReactorBlock)tile).isFrame()) { - reactorBlocks.add((IReactorBlock)tile); - ((IReactorBlock)tile).setReactor(this); + reactorBlocks.add((TileEntityReactorBlock)tile); + ((TileEntityReactorBlock)tile).setReactor(this); } else { return false; @@ -439,15 +399,10 @@ public class FusionReactor implements IFusionReactor return false; } - if(tile instanceof IReactorBlock) + if(tile instanceof TileEntityReactorBlock) { - reactorBlocks.add((IReactorBlock)tile); - ((IReactorBlock)tile).setReactor(this); - - if(tile instanceof INeutronCapture) - { - neutronCaptors.add((INeutronCapture)tile); - } + reactorBlocks.add((TileEntityReactorBlock)tile); + ((TileEntityReactorBlock)tile).setReactor(this); if(tile instanceof IHeatTransfer) { @@ -485,13 +440,11 @@ public class FusionReactor implements IFusionReactor return true; } - @Override public boolean isFormed() { return formed; } - @Override public void setInjectionRate(int rate) { injectionRate = rate; @@ -512,54 +465,46 @@ public class FusionReactor implements IFusionReactor } } - @Override public int getInjectionRate() { return injectionRate; } - @Override public boolean isBurning() { return burning; } - @Override public void setBurning(boolean burn) { burning = burn; } - @Override public int getMinInjectionRate(boolean active) { double k = active ? caseWaterConductivity : 0; - double aMin = burnTemperature * burnRatio * plasmaCaseConductivity * (k+caseAirConductivity) / (energyPerFuel * burnRatio * (plasmaCaseConductivity+k+caseAirConductivity) - plasmaCaseConductivity * (k + caseAirConductivity)); + double aMin = burnTemperature * burnRatio * plasmaCaseConductivity * (k+caseAirConductivity) / (generators.energyPerFusionFuel * burnRatio * (plasmaCaseConductivity+k+caseAirConductivity) - plasmaCaseConductivity * (k + caseAirConductivity)); return (int)(2 * Math.ceil(aMin/2D)); } - @Override public double getMaxPlasmaTemperature(boolean active) { double k = active ? caseWaterConductivity : 0; - return injectionRate * energyPerFuel/plasmaCaseConductivity * (plasmaCaseConductivity+k+caseAirConductivity) / (k+caseAirConductivity); + return injectionRate * generators.energyPerFusionFuel/plasmaCaseConductivity * (plasmaCaseConductivity+k+caseAirConductivity) / (k+caseAirConductivity); } - @Override public double getMaxCasingTemperature(boolean active) { double k = active ? caseWaterConductivity : 0; - return injectionRate * energyPerFuel / (k+caseAirConductivity); + return injectionRate * generators.energyPerFusionFuel / (k+caseAirConductivity); } - @Override public double getIgnitionTemperature(boolean active) { double k = active ? caseWaterConductivity : 0; - return burnTemperature * energyPerFuel * burnRatio * (plasmaCaseConductivity+k+caseAirConductivity) / (energyPerFuel * burnRatio * (plasmaCaseConductivity+k+caseAirConductivity) - plasmaCaseConductivity * (k + caseAirConductivity)); + return burnTemperature * generators.energyPerFusionFuel * burnRatio * (plasmaCaseConductivity+k+caseAirConductivity) / (generators.energyPerFusionFuel * burnRatio * (plasmaCaseConductivity+k+caseAirConductivity) - plasmaCaseConductivity * (k + caseAirConductivity)); } - @Override public double getPassiveGeneration(boolean active, boolean current) { double temperature = current ? caseTemperature : getMaxCasingTemperature(active); @@ -567,7 +512,6 @@ public class FusionReactor implements IFusionReactor return thermocoupleEfficiency * caseAirConductivity * temperature; } - @Override public int getSteamPerTick(boolean current) { double temperature = current ? caseTemperature : getMaxCasingTemperature(true); @@ -575,37 +519,31 @@ public class FusionReactor implements IFusionReactor return (int)(steamTransferEfficiency * caseWaterConductivity * temperature / enthalpyOfVaporization); } - @Override public double getTemp() { return lastCaseTemperature; } - @Override public double getInverseConductionCoefficient() { return 1 / caseAirConductivity; } - @Override public double getInsulationCoefficient(EnumFacing side) { return 100000; } - @Override public void transferHeatTo(double heat) { heatToAbsorb += heat; } - @Override public double[] simulateHeat() { return null; } - @Override public double applyTemperatureChange() { caseTemperature += heatToAbsorb / caseHeatCapacity; @@ -614,20 +552,17 @@ public class FusionReactor implements IFusionReactor return caseTemperature; } - @Override public boolean canConnectHeat(EnumFacing side) { return false; } - @Override public IHeatTransfer getAdjacent(EnumFacing side) { return null; } - @Override - public ItemStack[] getInventory() + public NonNullList getInventory() { return isFormed() ? controller.inventory : null; } diff --git a/src/main/java/mekanism/generators/common/GeneratorsBlocks.java b/src/main/java/mekanism/generators/common/GeneratorsBlocks.java index f1d4c1067..b61857e0b 100644 --- a/src/main/java/mekanism/generators/common/GeneratorsBlocks.java +++ b/src/main/java/mekanism/generators/common/GeneratorsBlocks.java @@ -11,7 +11,7 @@ import net.minecraft.block.Block; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; -@ObjectHolder("MekanismGenerators") +@ObjectHolder("mekanismgenerators") public class GeneratorsBlocks { public static final Block Generator = BlockGenerator.getGeneratorBlock(GENERATOR_BLOCK_1); diff --git a/src/main/java/mekanism/generators/common/GeneratorsCommonProxy.java b/src/main/java/mekanism/generators/common/GeneratorsCommonProxy.java index 3cb5d3db9..cd5c64a3d 100644 --- a/src/main/java/mekanism/generators/common/GeneratorsCommonProxy.java +++ b/src/main/java/mekanism/generators/common/GeneratorsCommonProxy.java @@ -1,15 +1,15 @@ package mekanism.generators.common; -import mekanism.api.MekanismConfig.generators; import mekanism.common.Mekanism; import mekanism.common.base.IGuiProvider; +import mekanism.common.config.MekanismConfig.generators; import mekanism.common.inventory.container.ContainerFilter; import mekanism.common.inventory.container.ContainerNull; -import mekanism.common.tile.TileEntityContainerBlock; +import mekanism.common.tile.prefab.TileEntityContainerBlock; +import mekanism.generators.common.block.states.BlockStateGenerator.GeneratorType; import mekanism.generators.common.inventory.container.ContainerBioGenerator; import mekanism.generators.common.inventory.container.ContainerGasGenerator; import mekanism.generators.common.inventory.container.ContainerHeatGenerator; -import mekanism.generators.common.inventory.container.ContainerNeutronCapture; import mekanism.generators.common.inventory.container.ContainerReactorController; import mekanism.generators.common.inventory.container.ContainerSolarGenerator; import mekanism.generators.common.inventory.container.ContainerWindGenerator; @@ -24,7 +24,6 @@ import mekanism.generators.common.tile.reactor.TileEntityReactorFrame; import mekanism.generators.common.tile.reactor.TileEntityReactorGlass; import mekanism.generators.common.tile.reactor.TileEntityReactorLaserFocusMatrix; import mekanism.generators.common.tile.reactor.TileEntityReactorLogicAdapter; -import mekanism.generators.common.tile.reactor.TileEntityReactorNeutronCapture; import mekanism.generators.common.tile.reactor.TileEntityReactorPort; import mekanism.generators.common.tile.turbine.TileEntityElectromagneticCoil; import mekanism.generators.common.tile.turbine.TileEntityRotationalComplex; @@ -55,7 +54,6 @@ public class GeneratorsCommonProxy implements IGuiProvider GameRegistry.registerTileEntity(TileEntityReactorFrame.class, "ReactorFrame"); GameRegistry.registerTileEntity(TileEntityReactorGlass.class, "ReactorGlass"); GameRegistry.registerTileEntity(TileEntityReactorLaserFocusMatrix.class, "ReactorLaserFocus"); - GameRegistry.registerTileEntity(TileEntityReactorNeutronCapture.class, "ReactorNeutronCapture"); GameRegistry.registerTileEntity(TileEntityReactorPort.class, "ReactorPort"); GameRegistry.registerTileEntity(TileEntityReactorLogicAdapter.class, "ReactorLogicAdapter"); GameRegistry.registerTileEntity(TileEntityRotationalComplex.class, "RotationalComplex"); @@ -111,6 +109,13 @@ public class GeneratorsCommonProxy implements IGuiProvider generators.turbineVentGasFlow = Mekanism.configuration.get("generation", "TurbineVentGasFlow", 16000D).getDouble(); generators.turbineDisperserGasFlow = Mekanism.configuration.get("generation", "TurbineDisperserGasFlow", 640D).getDouble(); generators.condenserRate = Mekanism.configuration.get("generation", "TurbineCondenserFlowRate", 32000).getInt(); + + generators.energyPerFusionFuel = Mekanism.configuration.get("generation", "EnergyPerFusionFuel", 5E6D).getDouble(); + + for(GeneratorType type : GeneratorType.getGeneratorsForConfig()) + { + generators.generatorsManager.setEntry(type.blockName, Mekanism.configuration.get("generators", type.blockName + "Enabled", true).getBoolean()); + } if(Mekanism.configuration.hasChanged()) { @@ -164,8 +169,6 @@ public class GeneratorsCommonProxy implements IGuiProvider case 12: case 13: return new ContainerNull(player, (TileEntityContainerBlock)tileEntity); - case 14: - return new ContainerNeutronCapture(player.inventory, (TileEntityReactorNeutronCapture)tileEntity); case 15: return new ContainerNull(player, (TileEntityContainerBlock)tileEntity); } diff --git a/src/main/java/mekanism/generators/common/GeneratorsItems.java b/src/main/java/mekanism/generators/common/GeneratorsItems.java index 754bc2f42..af3d46d50 100644 --- a/src/main/java/mekanism/generators/common/GeneratorsItems.java +++ b/src/main/java/mekanism/generators/common/GeneratorsItems.java @@ -11,7 +11,7 @@ import net.minecraft.world.IBlockAccess; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; -@ObjectHolder("MekanismGenerators") +@ObjectHolder("mekanismgenerators") public class GeneratorsItems { public static final Item SolarPanel = new ItemMekanism(); diff --git a/src/main/java/mekanism/generators/common/MekanismGenerators.java b/src/main/java/mekanism/generators/common/MekanismGenerators.java index 10dab7361..35932e9af 100644 --- a/src/main/java/mekanism/generators/common/MekanismGenerators.java +++ b/src/main/java/mekanism/generators/common/MekanismGenerators.java @@ -4,24 +4,28 @@ import io.netty.buffer.ByteBuf; import java.io.IOException; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.generators; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; import mekanism.api.infuse.InfuseRegistry; import mekanism.common.FuelHandler; import mekanism.common.Mekanism; import mekanism.common.MekanismBlocks; +import mekanism.common.MekanismFluids; import mekanism.common.MekanismItems; import mekanism.common.Tier.BaseTier; import mekanism.common.Tier.GasTankTier; import mekanism.common.Version; import mekanism.common.base.IModule; +import mekanism.common.config.TypeConfigManager; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.config.MekanismConfig.generators; import mekanism.common.multiblock.MultiblockManager; import mekanism.common.network.PacketSimpleGui; import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.ShapedMekanismRecipe; import mekanism.common.util.MekanismUtils; +import mekanism.generators.common.block.states.BlockStateGenerator.GeneratorType; +import mekanism.generators.common.block.states.BlockStateReactor.ReactorBlockType; import mekanism.generators.common.content.turbine.SynchronizedTurbineData; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -29,7 +33,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; @@ -44,17 +47,17 @@ import net.minecraftforge.oredict.OreDictionary; import buildcraft.api.fuels.BuildcraftFuelRegistry; import buildcraft.api.fuels.IFuel; -@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "9.2.2", dependencies = "required-after:Mekanism", guiFactory = "mekanism.generators.client.gui.GeneratorsGuiFactory") +@Mod(modid = "mekanismgenerators", name = "MekanismGenerators", version = "9.3.2", dependencies = "required-after:mekanism", guiFactory = "mekanism.generators.client.gui.GeneratorsGuiFactory") public class MekanismGenerators implements IModule { @SidedProxy(clientSide = "mekanism.generators.client.GeneratorsClientProxy", serverSide = "mekanism.generators.common.GeneratorsCommonProxy") public static GeneratorsCommonProxy proxy; - @Instance("MekanismGenerators") + @Instance("mekanismgenerators") public static MekanismGenerators instance; /** MekanismGenerators version number */ - public static Version versionNumber = new Version(9, 2, 2); + public static Version versionNumber = new Version(9, 3, 2); public static MultiblockManager turbineManager = new MultiblockManager("industrialTurbine"); @@ -104,9 +107,12 @@ public class MekanismGenerators implements IModule } } - BuildcraftFuelRegistry.fuel.addFuel(FluidRegistry.getFluid("ethene"), (int)(240 * general.TO_RF), 40 * Fluid.BUCKET_VOLUME); + BuildcraftFuelRegistry.fuel.addFuel(MekanismFluids.Ethene.getFluid(), (int)(240 * general.TO_RF), 40 * Fluid.BUCKET_VOLUME); } + //Update the config-dependent recipes after the recipes have actually been added in the first place + TypeConfigManager.updateConfigRecipes(GeneratorType.getGeneratorsForConfig(), generators.generatorsManager); + for(ItemStack ore : OreDictionary.getOres("dustGold")) { RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("CARBON"), 10, MekanismUtils.size(ore, 4), GeneratorsItems.Hohlraum.getEmptyItem()); @@ -115,19 +121,19 @@ public class MekanismGenerators implements IModule public void addRecipes() { - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(GeneratorsBlocks.Generator, 1, 0), new Object[] { + GeneratorType.HEAT_GENERATOR.addRecipe(new ShapedMekanismRecipe(GeneratorType.HEAT_GENERATOR.getStack(), new Object[] { "III", "WOW", "CFC", Character.valueOf('I'), "ingotIron", Character.valueOf('C'), "ingotCopper", Character.valueOf('O'), "ingotOsmium", Character.valueOf('F'), Blocks.FURNACE, Character.valueOf('W'), "plankWood" })); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(GeneratorsBlocks.Generator, 1, 1), new Object[] { + GeneratorType.SOLAR_GENERATOR.addRecipe(new ShapedMekanismRecipe(GeneratorType.SOLAR_GENERATOR.getStack(), new Object[] { "SSS", "AIA", "PEP", Character.valueOf('S'), GeneratorsItems.SolarPanel, Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('I'), "ingotIron", Character.valueOf('P'), "dustOsmium", Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem() })); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(GeneratorsBlocks.Generator, 1, 5), new Object[] { - "SES", "SES", "III", Character.valueOf('S'), new ItemStack(GeneratorsBlocks.Generator, 1, 1), Character.valueOf('E'), MekanismItems.EnrichedAlloy, Character.valueOf('I'), "ingotIron" + GeneratorType.ADVANCED_SOLAR_GENERATOR.addRecipe(new ShapedMekanismRecipe(GeneratorType.ADVANCED_SOLAR_GENERATOR.getStack(), new Object[] { + "SES", "SES", "III", Character.valueOf('S'), GeneratorType.SOLAR_GENERATOR.getStack(), Character.valueOf('E'), MekanismItems.EnrichedAlloy, Character.valueOf('I'), "ingotIron" })); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(GeneratorsBlocks.Generator, 1, 4), new Object[] { + GeneratorType.BIO_GENERATOR.addRecipe(new ShapedMekanismRecipe(GeneratorType.BIO_GENERATOR.getStack(), new Object[] { "RER", "BCB", "NEN", Character.valueOf('R'), "dustRedstone", Character.valueOf('E'), MekanismItems.EnrichedAlloy, Character.valueOf('B'), MekanismItems.BioFuel, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('N'), "ingotIron" })); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(GeneratorsBlocks.Generator, 1, 3), new Object[] { + GeneratorType.GAS_GENERATOR.addRecipe(new ShapedMekanismRecipe(GeneratorType.GAS_GENERATOR.getStack(), new Object[] { "PEP", "ICI", "PEP", Character.valueOf('P'), "ingotOsmium", Character.valueOf('E'), MekanismItems.EnrichedAlloy, Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('C'), MekanismItems.ElectrolyticCore })); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(GeneratorsItems.SolarPanel), new Object[] { @@ -162,26 +168,26 @@ public class MekanismGenerators implements IModule })); //Reactor Recipes - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(GeneratorsBlocks.Reactor, 4, 1), new Object[] { + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(ReactorBlockType.REACTOR_FRAME.getStack(4), new Object[] { " C ", "CAC", " C ", Character.valueOf('C'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('A'), "alloyUltimate" })); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(GeneratorsBlocks.Reactor, 2, 3), new Object[] { - " I ", "ICI", " I ", Character.valueOf('I'), new ItemStack(GeneratorsBlocks.Reactor, 1, 1), Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ULTIMATE) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(ReactorBlockType.REACTOR_PORT.getStack(2), new Object[] { + " I ", "ICI", " I ", Character.valueOf('I'), ReactorBlockType.REACTOR_FRAME.getStack(1), Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ULTIMATE) })); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(GeneratorsBlocks.ReactorGlass, 4, 0), new Object[] { - " I ", "IGI", " I ", Character.valueOf('I'), new ItemStack(GeneratorsBlocks.Reactor, 1, 1), Character.valueOf('G'), "blockGlass" + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(ReactorBlockType.REACTOR_GLASS.getStack(4), new Object[] { + " I ", "IGI", " I ", Character.valueOf('I'), ReactorBlockType.REACTOR_FRAME.getStack(1), Character.valueOf('G'), "blockGlass" })); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(GeneratorsBlocks.Reactor, 1, 0), new Object[] { - "CGC", "ITI", "III", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ULTIMATE), Character.valueOf('G'), "paneGlass", Character.valueOf('I'), new ItemStack(GeneratorsBlocks.Reactor, 1, 1), Character.valueOf('T'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(ReactorBlockType.REACTOR_CONTROLLER.getStack(1), new Object[] { + "CGC", "ITI", "III", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ULTIMATE), Character.valueOf('G'), "paneGlass", Character.valueOf('I'), ReactorBlockType.REACTOR_FRAME.getStack(1), Character.valueOf('T'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC) })); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(GeneratorsBlocks.ReactorGlass, 2, 1), new Object[] { - " I ", "ILI", " I ", Character.valueOf('I'), new ItemStack(GeneratorsBlocks.ReactorGlass, 1, 0), Character.valueOf('L'), "blockRedstone" + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(ReactorBlockType.LASER_FOCUS_MATRIX.getStack(2), new Object[] { + " I ", "ILI", " I ", Character.valueOf('I'), ReactorBlockType.REACTOR_GLASS.getStack(1), Character.valueOf('L'), "blockRedstone" })); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(GeneratorsBlocks.Reactor, 1, 4), new Object[] { - " R ", "RFR", " R ", Character.valueOf('R'), "dustRedstone", Character.valueOf('F'), new ItemStack(GeneratorsBlocks.Reactor, 1, 1) + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(ReactorBlockType.REACTOR_LOGIC_ADAPTER.getStack(1), new Object[] { + " R ", "RFR", " R ", Character.valueOf('R'), "dustRedstone", Character.valueOf('F'), ReactorBlockType.REACTOR_FRAME.getStack(1) })); - FuelHandler.addGas(GasRegistry.getGas("ethene"), general.ETHENE_BURN_TIME, general.FROM_H2 + generators.bioGeneration * 2 * general.ETHENE_BURN_TIME); //1mB hydrogen + 2*bioFuel/tick*200ticks/100mB * 20x efficiency bonus + FuelHandler.addGas(MekanismFluids.Ethene, general.ETHENE_BURN_TIME, general.FROM_H2 + generators.bioGeneration * 2 * general.ETHENE_BURN_TIME); //1mB hydrogen + 2*bioFuel/tick*200ticks/100mB * 20x efficiency bonus } @Override @@ -216,6 +222,13 @@ public class MekanismGenerators implements IModule dataStream.writeDouble(generators.turbineVentGasFlow); dataStream.writeDouble(generators.turbineDisperserGasFlow); dataStream.writeInt(generators.condenserRate); + + dataStream.writeDouble(generators.energyPerFusionFuel); + + for(GeneratorType type : GeneratorType.getGeneratorsForConfig()) + { + dataStream.writeBoolean(generators.generatorsManager.isEnabled(type.blockName)); + } } @Override @@ -238,6 +251,13 @@ public class MekanismGenerators implements IModule generators.turbineVentGasFlow = dataStream.readDouble(); generators.turbineDisperserGasFlow = dataStream.readDouble(); generators.condenserRate = dataStream.readInt(); + + generators.energyPerFusionFuel = dataStream.readDouble(); + + for(GeneratorType type : GeneratorType.getGeneratorsForConfig()) + { + generators.generatorsManager.setEntry(type.blockName, dataStream.readBoolean()); + } } @Override @@ -249,9 +269,10 @@ public class MekanismGenerators implements IModule @SubscribeEvent public void onConfigChanged(OnConfigChangedEvent event) { - if(event.getModID().equals("MekanismGenerators")) + if(event.getModID().equals("mekanismgenerators")) { proxy.loadConfiguration(); + TypeConfigManager.updateConfigRecipes(GeneratorType.getGeneratorsForConfig(), generators.generatorsManager); } } } diff --git a/src/main/java/mekanism/generators/common/block/BlockGenerator.java b/src/main/java/mekanism/generators/common/block/BlockGenerator.java index 6f1ccc6f5..f1e7ff397 100644 --- a/src/main/java/mekanism/generators/common/block/BlockGenerator.java +++ b/src/main/java/mekanism/generators/common/block/BlockGenerator.java @@ -1,9 +1,7 @@ package mekanism.generators.common.block; -import java.util.List; import java.util.Random; -import mekanism.api.MekanismConfig.client; import mekanism.api.energy.IEnergizedItem; import mekanism.client.render.ctm.CTMBlockRenderContext; import mekanism.client.render.ctm.CTMData; @@ -16,13 +14,14 @@ import mekanism.common.base.ISustainedInventory; import mekanism.common.base.ISustainedTank; import mekanism.common.block.states.BlockStateBasic; import mekanism.common.block.states.BlockStateFacing; +import mekanism.common.config.MekanismConfig.client; import mekanism.common.multiblock.IMultiblock; import mekanism.common.security.ISecurityItem; import mekanism.common.security.ISecurityTile; -import mekanism.common.tile.TileEntityBasicBlock; -import mekanism.common.tile.TileEntityContainerBlock; -import mekanism.common.tile.TileEntityElectricBlock; import mekanism.common.tile.TileEntityMultiblock; +import mekanism.common.tile.prefab.TileEntityBasicBlock; +import mekanism.common.tile.prefab.TileEntityContainerBlock; +import mekanism.common.tile.prefab.TileEntityElectricBlock; import mekanism.common.util.MekanismUtils; import mekanism.common.util.SecurityUtils; import mekanism.generators.common.GeneratorsBlocks; @@ -52,10 +51,12 @@ import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.property.IExtendedBlockState; @@ -184,7 +185,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock } @Override - public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock) + public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock, BlockPos neighborPos) { if(!world.isRemote) { @@ -207,7 +208,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock { TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos); - int side = MathHelper.floor_double((double)(entityliving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + int side = MathHelper.floor((double)(entityliving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; int height = Math.round(entityliving.rotationPitch); int change = 3; @@ -284,11 +285,14 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item i, CreativeTabs creativetabs, List list) + public void getSubBlocks(Item i, CreativeTabs creativetabs, NonNullList list) { for(GeneratorType type : GeneratorType.values()) { - list.add(new ItemStack(i, 1, type.meta)); + if(type.isEnabled()) + { + list.add(new ItemStack(i, 1, type.meta)); + } } } @@ -388,7 +392,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, new ItemStack(GeneratorsItems.TurbineBlade, amount)); - world.spawnEntityInWorld(entityItem); + world.spawnEntity(entityItem); } } @@ -401,7 +405,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, ItemStack stack, EnumFacing side, float playerX, float playerY, float playerZ) + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if(world.isRemote) { @@ -410,8 +414,9 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos); int metadata = state.getBlock().getMetaFromState(state); + ItemStack stack = entityplayer.getHeldItem(hand); - if(stack != null) + if(!stack.isEmpty()) { Item tool = stack.getItem(); @@ -428,13 +433,13 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock if(MekanismUtils.isBCWrench(tool)) { - ((IToolWrench)tool).wrenchUsed(entityplayer, pos); + ((IToolWrench)tool).wrenchUsed(entityplayer, hand, stack, new RayTraceResult(new Vec3d(hitX, hitY, hitZ), side, pos)); } int change = tileEntity.facing.rotateY().ordinal(); tileEntity.setFacing((short)change); - world.notifyNeighborsOfStateChange(pos, this); + world.notifyNeighborsOfStateChange(pos, this, true); } else { SecurityUtils.displayNoAccess(entityplayer); @@ -455,17 +460,17 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock if(!entityplayer.isSneaking()) { - if(stack != null && stack.getItem() == GeneratorsItems.TurbineBlade) + if(!stack.isEmpty() && stack.getItem() == GeneratorsItems.TurbineBlade) { if(!world.isRemote && rod.editBlade(true)) { if(!entityplayer.capabilities.isCreativeMode) { - stack.stackSize--; + stack.shrink(1); - if(stack.stackSize == 0) + if(stack.getCount() == 0) { - entityplayer.setHeldItem(hand, null); + entityplayer.setHeldItem(hand, ItemStack.EMPTY); } } } @@ -476,7 +481,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock else { if(!world.isRemote) { - if(stack == null) + if(stack.isEmpty()) { if(rod.editBlade(false)) { @@ -489,13 +494,13 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock } else if(stack.getItem() == GeneratorsItems.TurbineBlade) { - if(stack.stackSize < stack.getMaxStackSize()) + if(stack.getCount() < stack.getMaxStackSize()) { if(rod.editBlade(false)) { if(!entityplayer.capabilities.isCreativeMode) { - stack.stackSize++; + stack.grow(1); entityplayer.inventory.markDirty(); } } @@ -615,7 +620,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(state, null, world, pos, player)); - world.spawnEntityInWorld(entityItem); + world.spawnEntity(entityItem); } return world.setBlockToAir(pos); @@ -643,7 +648,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock if(securityItem.hasSecurity(itemStack)) { - securityItem.setOwner(itemStack, ((ISecurityTile)tileEntity).getSecurity().getOwner()); + securityItem.setOwnerUUID(itemStack, ((ISecurityTile)tileEntity).getSecurity().getOwnerUUID()); securityItem.setSecurity(itemStack, ((ISecurityTile)tileEntity).getSecurity().getMode()); } } @@ -694,7 +699,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, itemStack); - world.spawnEntityInWorld(entityItem); + world.spawnEntity(entityItem); } return itemStack; diff --git a/src/main/java/mekanism/generators/common/block/BlockReactor.java b/src/main/java/mekanism/generators/common/block/BlockReactor.java index 5e2442482..00d86b305 100644 --- a/src/main/java/mekanism/generators/common/block/BlockReactor.java +++ b/src/main/java/mekanism/generators/common/block/BlockReactor.java @@ -1,15 +1,13 @@ package mekanism.generators.common.block; -import java.util.List; - import mekanism.client.render.ctm.CTMBlockRenderContext; import mekanism.client.render.ctm.CTMData; import mekanism.client.render.ctm.ICTMBlock; import mekanism.common.Mekanism; import mekanism.common.base.IActiveState; import mekanism.common.block.states.BlockStateBasic; -import mekanism.common.tile.TileEntityBasicBlock; -import mekanism.common.tile.TileEntityElectricBlock; +import mekanism.common.tile.prefab.TileEntityBasicBlock; +import mekanism.common.tile.prefab.TileEntityElectricBlock; import mekanism.common.util.MekanismUtils; import mekanism.generators.common.GeneratorsBlocks; import mekanism.generators.common.MekanismGenerators; @@ -20,7 +18,7 @@ import mekanism.generators.common.tile.reactor.TileEntityReactorController; import mekanism.generators.common.tile.reactor.TileEntityReactorLogicAdapter; import mekanism.generators.common.tile.reactor.TileEntityReactorPort; import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; +import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; @@ -35,7 +33,10 @@ import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.property.IExtendedBlockState; @@ -43,7 +44,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import buildcraft.api.tools.IToolWrench; -public abstract class BlockReactor extends BlockContainer implements ICTMBlock +public abstract class BlockReactor extends Block implements ICTMBlock, ITileEntityProvider { public CTMData[] ctmData = new CTMData[16]; @@ -94,11 +95,11 @@ public abstract class BlockReactor extends BlockContainer implements ICTMBlock switch(getReactorBlock()) { case REACTOR_BLOCK: - ctmData[0] = new CTMData(ReactorBlockType.REACTOR_CONTROLLER, ReactorBlockType.REACTOR_FRAME, ReactorBlockType.NEUTRON_CAPTURE, ReactorBlockType.REACTOR_PORT, ReactorBlockType.REACTOR_LOGIC_ADAPTER); - ctmData[1] = new CTMData(ReactorBlockType.REACTOR_CONTROLLER, ReactorBlockType.REACTOR_FRAME, ReactorBlockType.NEUTRON_CAPTURE, ReactorBlockType.REACTOR_PORT, ReactorBlockType.REACTOR_LOGIC_ADAPTER); - ctmData[2] = new CTMData(ReactorBlockType.REACTOR_CONTROLLER, ReactorBlockType.REACTOR_FRAME, ReactorBlockType.NEUTRON_CAPTURE, ReactorBlockType.REACTOR_PORT, ReactorBlockType.REACTOR_LOGIC_ADAPTER); - ctmData[3] = new CTMData(ReactorBlockType.REACTOR_CONTROLLER, ReactorBlockType.REACTOR_FRAME, ReactorBlockType.NEUTRON_CAPTURE, ReactorBlockType.REACTOR_PORT, ReactorBlockType.REACTOR_LOGIC_ADAPTER); - ctmData[4] = new CTMData(ReactorBlockType.REACTOR_CONTROLLER, ReactorBlockType.REACTOR_FRAME, ReactorBlockType.NEUTRON_CAPTURE, ReactorBlockType.REACTOR_PORT, ReactorBlockType.REACTOR_LOGIC_ADAPTER); + ctmData[0] = new CTMData(ReactorBlockType.REACTOR_CONTROLLER, ReactorBlockType.REACTOR_FRAME, ReactorBlockType.REACTOR_PORT, ReactorBlockType.REACTOR_LOGIC_ADAPTER); + ctmData[1] = new CTMData(ReactorBlockType.REACTOR_CONTROLLER, ReactorBlockType.REACTOR_FRAME, ReactorBlockType.REACTOR_PORT, ReactorBlockType.REACTOR_LOGIC_ADAPTER); + ctmData[2] = new CTMData(ReactorBlockType.REACTOR_CONTROLLER, ReactorBlockType.REACTOR_FRAME, ReactorBlockType.REACTOR_PORT, ReactorBlockType.REACTOR_LOGIC_ADAPTER); + ctmData[3] = new CTMData(ReactorBlockType.REACTOR_CONTROLLER, ReactorBlockType.REACTOR_FRAME, ReactorBlockType.REACTOR_PORT, ReactorBlockType.REACTOR_LOGIC_ADAPTER); + ctmData[4] = new CTMData(ReactorBlockType.REACTOR_CONTROLLER, ReactorBlockType.REACTOR_FRAME, ReactorBlockType.REACTOR_PORT, ReactorBlockType.REACTOR_LOGIC_ADAPTER); break; case REACTOR_GLASS: @@ -152,7 +153,7 @@ public abstract class BlockReactor extends BlockContainer implements ICTMBlock } @Override - public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock) + public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock, BlockPos neighborPos) { if(!world.isRemote) { @@ -166,7 +167,7 @@ public abstract class BlockReactor extends BlockContainer implements ICTMBlock } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, ItemStack stack, EnumFacing facing, float playerX, float playerY, float playerZ) + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if(world.isRemote) { @@ -175,8 +176,9 @@ public abstract class BlockReactor extends BlockContainer implements ICTMBlock TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getTileEntity(pos); int metadata = state.getBlock().getMetaFromState(state); + ItemStack stack = entityplayer.getHeldItem(hand); - if(stack != null) + if(!stack.isEmpty()) { if(MekanismUtils.isBCWrench(stack.getItem()) && !stack.getUnlocalizedName().contains("omniwrench")) { @@ -186,7 +188,7 @@ public abstract class BlockReactor extends BlockContainer implements ICTMBlock return true; } - ((IToolWrench)stack.getItem()).wrenchUsed(entityplayer, pos); + ((IToolWrench)stack.getItem()).wrenchUsed(entityplayer, hand, stack, new RayTraceResult(new Vec3d(hitX, hitY, hitZ), side, pos)); return true; } @@ -215,11 +217,11 @@ public abstract class BlockReactor extends BlockContainer implements ICTMBlock @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs creativetabs, List list) + public void getSubBlocks(Item item, CreativeTabs creativetabs, NonNullList list) { for(BlockStateReactor.ReactorBlockType type : BlockStateReactor.ReactorBlockType.values()) { - if(type.blockType == getReactorBlock() && type.isValidReactorBlock()) + if(type.blockType == getReactorBlock()) { list.add(new ItemStack(item, 1, type.meta)); } @@ -347,7 +349,7 @@ public abstract class BlockReactor extends BlockContainer implements ICTMBlock EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, itemStack); - world.spawnEntityInWorld(entityItem); + world.spawnEntity(entityItem); } return itemStack; diff --git a/src/main/java/mekanism/generators/common/block/states/BlockStateGenerator.java b/src/main/java/mekanism/generators/common/block/states/BlockStateGenerator.java index 46a95d475..6380ef963 100644 --- a/src/main/java/mekanism/generators/common/block/states/BlockStateGenerator.java +++ b/src/main/java/mekanism/generators/common/block/states/BlockStateGenerator.java @@ -1,9 +1,17 @@ package mekanism.generators.common.block.states; -import mekanism.api.MekanismConfig.general; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; + import mekanism.common.Mekanism; +import mekanism.common.base.IBlockType; import mekanism.common.block.states.BlockStateBasic; import mekanism.common.block.states.BlockStateFacing; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.config.MekanismConfig.generators; +import mekanism.common.recipe.ShapedMekanismRecipe; import mekanism.common.util.LangUtils; import mekanism.generators.common.GeneratorsBlocks; import mekanism.generators.common.block.BlockGenerator; @@ -92,7 +100,7 @@ public class BlockStateGenerator extends ExtendedBlockState } } - public static enum GeneratorType implements IStringSerializable + public static enum GeneratorType implements IStringSerializable, IBlockType { HEAT_GENERATOR(GeneratorBlock.GENERATOR_BLOCK_1, 0, "HeatGenerator", 0, 160000, TileEntityHeatGenerator.class, true, Plane.HORIZONTAL, false), SOLAR_GENERATOR(GeneratorBlock.GENERATOR_BLOCK_1, 1, "SolarGenerator", 1, 96000, TileEntitySolarGenerator.class, true, Plane.HORIZONTAL, false), @@ -110,11 +118,12 @@ public class BlockStateGenerator extends ExtendedBlockState public GeneratorBlock blockType; public int meta; - public String name; + public String blockName; public int guiId; public double maxEnergy; public Class tileEntityClass; public boolean hasModel; + public Collection blockRecipes = new HashSet(); public Predicate facingPredicate; public boolean activable; @@ -122,7 +131,7 @@ public class BlockStateGenerator extends ExtendedBlockState { blockType = block; meta = i; - name = s; + blockName = s; guiId = j; maxEnergy = k; tileEntityClass = tileClass; @@ -131,6 +140,56 @@ public class BlockStateGenerator extends ExtendedBlockState activable = hasActiveTexture; } + public static List getGeneratorsForConfig() + { + List ret = new ArrayList(); + + for(GeneratorType type : GeneratorType.values()) + { + if(type.ordinal() <= 5) + { + ret.add(type); + } + } + + return ret; + } + + @Override + public String getBlockName() + { + return blockName; + } + + @Override + public boolean isEnabled() + { + if(meta > WIND_GENERATOR.meta) + { + return true; + } + + return generators.generatorsManager.isEnabled(blockName); + } + + @Override + public void addRecipes(Collection recipes) + { + blockRecipes.addAll(recipes); + } + + @Override + public void addRecipe(ShapedMekanismRecipe recipe) + { + blockRecipes.add(recipe); + } + + @Override + public Collection getRecipes() + { + return blockRecipes; + } + public static GeneratorType get(IBlockState state) { if(state.getBlock() instanceof BlockGenerator) @@ -188,7 +247,7 @@ public class BlockStateGenerator extends ExtendedBlockState public String getDescription() { - return LangUtils.localize("tooltip." + name); + return LangUtils.localize("tooltip." + blockName); } public ItemStack getStack() diff --git a/src/main/java/mekanism/generators/common/block/states/BlockStateReactor.java b/src/main/java/mekanism/generators/common/block/states/BlockStateReactor.java index e3fb9d620..dbe6ade6f 100644 --- a/src/main/java/mekanism/generators/common/block/states/BlockStateReactor.java +++ b/src/main/java/mekanism/generators/common/block/states/BlockStateReactor.java @@ -2,7 +2,7 @@ package mekanism.generators.common.block.states; import mekanism.common.Mekanism; import mekanism.common.block.states.BlockStateBasic; -import mekanism.common.tile.TileEntityElectricBlock; +import mekanism.common.tile.prefab.TileEntityElectricBlock; import mekanism.common.util.LangUtils; import mekanism.generators.common.GeneratorsBlocks; import mekanism.generators.common.block.BlockReactor; @@ -11,7 +11,6 @@ import mekanism.generators.common.tile.reactor.TileEntityReactorFrame; import mekanism.generators.common.tile.reactor.TileEntityReactorGlass; import mekanism.generators.common.tile.reactor.TileEntityReactorLaserFocusMatrix; import mekanism.generators.common.tile.reactor.TileEntityReactorLogicAdapter; -import mekanism.generators.common.tile.reactor.TileEntityReactorNeutronCapture; import mekanism.generators.common.tile.reactor.TileEntityReactorPort; import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; @@ -81,7 +80,7 @@ public class BlockStateReactor extends ExtendedBlockState @Override public boolean apply(ReactorBlockType input) { - return input.blockType == basicBlock && input.isValidReactorBlock(); + return input.blockType == basicBlock; } } @@ -89,9 +88,8 @@ public class BlockStateReactor extends ExtendedBlockState { REACTOR_CONTROLLER(ReactorBlock.REACTOR_BLOCK, 0, "ReactorController", 10, TileEntityReactorController.class, false), REACTOR_FRAME(ReactorBlock.REACTOR_BLOCK, 1, "ReactorFrame", -1, TileEntityReactorFrame.class, false), - NEUTRON_CAPTURE(ReactorBlock.REACTOR_BLOCK, 2, "ReactorNeutronCapturePlate", 14, TileEntityReactorNeutronCapture.class, false), - REACTOR_PORT(ReactorBlock.REACTOR_BLOCK, 3, "ReactorPort", -1, TileEntityReactorPort.class, false), - REACTOR_LOGIC_ADAPTER(ReactorBlock.REACTOR_BLOCK, 4, "ReactorLogicAdapter", 15, TileEntityReactorLogicAdapter.class, false), + REACTOR_PORT(ReactorBlock.REACTOR_BLOCK, 2, "ReactorPort", -1, TileEntityReactorPort.class, false), + REACTOR_LOGIC_ADAPTER(ReactorBlock.REACTOR_BLOCK, 3, "ReactorLogicAdapter", 15, TileEntityReactorLogicAdapter.class, false), REACTOR_GLASS(ReactorBlock.REACTOR_GLASS, 0, "ReactorGlass", -1, TileEntityReactorGlass.class, false), LASER_FOCUS_MATRIX(ReactorBlock.REACTOR_GLASS, 1, "ReactorLaserFocusMatrix", -1, TileEntityReactorLaserFocusMatrix.class, true); @@ -111,11 +109,6 @@ public class BlockStateReactor extends ExtendedBlockState tileEntityClass = tileClass; activable = activeState; } - - public boolean isValidReactorBlock() - { - return this != NEUTRON_CAPTURE; - } public static ReactorBlockType get(Block block, int meta) { @@ -167,9 +160,9 @@ public class BlockStateReactor extends ExtendedBlockState return LangUtils.localize("tooltip." + name); } - public ItemStack getStack() + public ItemStack getStack(int amount) { - return new ItemStack(blockType.getBlock(), 1, meta); + return new ItemStack(blockType.getBlock(), amount, meta); } } diff --git a/src/main/java/mekanism/generators/common/inventory/container/ContainerBioGenerator.java b/src/main/java/mekanism/generators/common/inventory/container/ContainerBioGenerator.java index 5c06a01b0..19e3b77b0 100644 --- a/src/main/java/mekanism/generators/common/inventory/container/ContainerBioGenerator.java +++ b/src/main/java/mekanism/generators/common/inventory/container/ContainerBioGenerator.java @@ -51,13 +51,13 @@ public class ContainerBioGenerator extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -71,14 +71,14 @@ public class ContainerBioGenerator extends Container { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 1) { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } } @@ -88,13 +88,13 @@ public class ContainerBioGenerator extends Container { if (!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -103,38 +103,38 @@ public class ContainerBioGenerator extends Container { if(!mergeItemStack(slotStack, 29, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 28) { if(!mergeItemStack(slotStack, 2, 28, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/generators/common/inventory/container/ContainerGasGenerator.java b/src/main/java/mekanism/generators/common/inventory/container/ContainerGasGenerator.java index 307b238f2..b000c7597 100644 --- a/src/main/java/mekanism/generators/common/inventory/container/ContainerGasGenerator.java +++ b/src/main/java/mekanism/generators/common/inventory/container/ContainerGasGenerator.java @@ -1,7 +1,7 @@ package mekanism.generators.common.inventory.container; -import mekanism.api.gas.GasRegistry; import mekanism.api.gas.IGasItem; +import mekanism.common.MekanismFluids; import mekanism.common.inventory.slot.SlotEnergy.SlotCharge; import mekanism.common.util.ChargeUtils; import mekanism.generators.common.tile.TileEntityGasGenerator; @@ -50,13 +50,13 @@ public class ContainerGasGenerator extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -70,14 +70,14 @@ public class ContainerGasGenerator extends Container { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 1) { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } } @@ -85,18 +85,18 @@ public class ContainerGasGenerator extends Container { if(slotID != 0 && slotID != 1) { - if(((IGasItem)slotStack.getItem()).getGas(slotStack) != null && ((IGasItem)slotStack.getItem()).getGas(slotStack).getGas() == GasRegistry.getGas("hydrogen")) + if(((IGasItem)slotStack.getItem()).getGas(slotStack) != null && ((IGasItem)slotStack.getItem()).getGas(slotStack).getGas() == MekanismFluids.Hydrogen) { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -105,38 +105,38 @@ public class ContainerGasGenerator extends Container { if(!mergeItemStack(slotStack, 29, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 28) { if(!mergeItemStack(slotStack, 2, 28, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/generators/common/inventory/container/ContainerHeatGenerator.java b/src/main/java/mekanism/generators/common/inventory/container/ContainerHeatGenerator.java index 6ddf1d154..60c8d3c9b 100644 --- a/src/main/java/mekanism/generators/common/inventory/container/ContainerHeatGenerator.java +++ b/src/main/java/mekanism/generators/common/inventory/container/ContainerHeatGenerator.java @@ -49,13 +49,13 @@ public class ContainerHeatGenerator extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -69,14 +69,14 @@ public class ContainerHeatGenerator extends Container { if(!mergeItemStack(slotStack, 1, 2, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 1) { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } } @@ -86,13 +86,13 @@ public class ContainerHeatGenerator extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } @@ -101,38 +101,38 @@ public class ContainerHeatGenerator extends Container { if(!mergeItemStack(slotStack, 29, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 28) { if(!mergeItemStack(slotStack, 2, 28, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 2, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/generators/common/inventory/container/ContainerNeutronCapture.java b/src/main/java/mekanism/generators/common/inventory/container/ContainerNeutronCapture.java deleted file mode 100644 index a1035999a..000000000 --- a/src/main/java/mekanism/generators/common/inventory/container/ContainerNeutronCapture.java +++ /dev/null @@ -1,123 +0,0 @@ -package mekanism.generators.common.inventory.container; - -import mekanism.common.inventory.slot.SlotEnergy.SlotCharge; -import mekanism.common.util.ChargeUtils; -import mekanism.generators.common.tile.reactor.TileEntityReactorNeutronCapture; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class ContainerNeutronCapture extends Container -{ - private TileEntityReactorNeutronCapture tileEntity; - - public ContainerNeutronCapture(InventoryPlayer inventory, TileEntityReactorNeutronCapture tentity) - { - tileEntity = tentity; - addSlotToContainer(new SlotCharge(tentity, 0, 143, 35)); - int slotX; - - for(slotX = 0; slotX < 3; ++slotX) - { - for(int slotY = 0; slotY < 9; ++slotY) - { - addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18)); - } - } - - for(slotX = 0; slotX < 9; ++slotX) - { - addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142)); - } - - tileEntity.openInventory(inventory.player); - tileEntity.open(inventory.player); - } - - @Override - public void onContainerClosed(EntityPlayer entityplayer) - { - super.onContainerClosed(entityplayer); - - tileEntity.closeInventory(entityplayer); - tileEntity.close(entityplayer); - } - - @Override - public boolean canInteractWith(EntityPlayer entityplayer) - { - return tileEntity.isUseableByPlayer(entityplayer); - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotID) - { - ItemStack stack = null; - Slot currentSlot = (Slot)inventorySlots.get(slotID); - - if(currentSlot != null && currentSlot.getHasStack()) - { - ItemStack slotStack = currentSlot.getStack(); - stack = slotStack.copy(); - - if(ChargeUtils.canBeCharged(slotStack)) - { - if(slotID != 0) - { - if(!mergeItemStack(slotStack, 0, 1, false)) - { - return null; - } - } - else if(slotID == 0) - { - if(!mergeItemStack(slotStack, 1, inventorySlots.size(), false)) - { - return null; - } - } - } - else { - if(slotID >= 1 && slotID <= 27) - { - if(!mergeItemStack(slotStack, 28, inventorySlots.size(), false)) - { - return null; - } - } - else if(slotID > 27) - { - if(!mergeItemStack(slotStack, 1, 27, false)) - { - return null; - } - } - else { - if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) - { - return null; - } - } - } - - if(slotStack.stackSize == 0) - { - currentSlot.putStack((ItemStack)null); - } - else { - currentSlot.onSlotChanged(); - } - - if(slotStack.stackSize == stack.stackSize) - { - return null; - } - - currentSlot.onPickupFromSlot(player, slotStack); - } - - return stack; - } -} diff --git a/src/main/java/mekanism/generators/common/inventory/container/ContainerReactorController.java b/src/main/java/mekanism/generators/common/inventory/container/ContainerReactorController.java index 54d729b5c..f1b9405fa 100644 --- a/src/main/java/mekanism/generators/common/inventory/container/ContainerReactorController.java +++ b/src/main/java/mekanism/generators/common/inventory/container/ContainerReactorController.java @@ -51,13 +51,13 @@ public class ContainerReactorController extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -71,14 +71,14 @@ public class ContainerReactorController extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 0) { if(!mergeItemStack(slotStack, 1, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } } @@ -87,38 +87,38 @@ public class ContainerReactorController extends Container { if(!mergeItemStack(slotStack, 28, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 27) { if(!mergeItemStack(slotStack, 1, 27, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/generators/common/inventory/container/ContainerSolarGenerator.java b/src/main/java/mekanism/generators/common/inventory/container/ContainerSolarGenerator.java index c4f6e07d7..47730082a 100644 --- a/src/main/java/mekanism/generators/common/inventory/container/ContainerSolarGenerator.java +++ b/src/main/java/mekanism/generators/common/inventory/container/ContainerSolarGenerator.java @@ -48,13 +48,13 @@ public class ContainerSolarGenerator extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -68,14 +68,14 @@ public class ContainerSolarGenerator extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 0) { if(!mergeItemStack(slotStack, 1, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } } @@ -84,38 +84,38 @@ public class ContainerSolarGenerator extends Container { if(!mergeItemStack(slotStack, 28, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 27) { if(!mergeItemStack(slotStack, 1, 27, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/generators/common/inventory/container/ContainerWindGenerator.java b/src/main/java/mekanism/generators/common/inventory/container/ContainerWindGenerator.java index 9914a6456..6ac89c1d5 100644 --- a/src/main/java/mekanism/generators/common/inventory/container/ContainerWindGenerator.java +++ b/src/main/java/mekanism/generators/common/inventory/container/ContainerWindGenerator.java @@ -48,13 +48,13 @@ public class ContainerWindGenerator extends Container @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return tileEntity.isUseableByPlayer(entityplayer); + return tileEntity.isUsableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; Slot currentSlot = (Slot)inventorySlots.get(slotID); if(currentSlot != null && currentSlot.getHasStack()) @@ -68,14 +68,14 @@ public class ContainerWindGenerator extends Container { if(!mergeItemStack(slotStack, 0, 1, false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID == 0) { if(!mergeItemStack(slotStack, 1, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } } @@ -84,38 +84,38 @@ public class ContainerWindGenerator extends Container { if(!mergeItemStack(slotStack, 28, inventorySlots.size(), false)) { - return null; + return ItemStack.EMPTY; } } else if(slotID > 27) { if(!mergeItemStack(slotStack, 1, 27, false)) { - return null; + return ItemStack.EMPTY; } } else { if(!mergeItemStack(slotStack, 1, inventorySlots.size(), true)) { - return null; + return ItemStack.EMPTY; } } } - if(slotStack.stackSize == 0) + if(slotStack.getCount() == 0) { - currentSlot.putStack((ItemStack)null); + currentSlot.putStack(ItemStack.EMPTY); } else { currentSlot.onSlotChanged(); } - if(slotStack.stackSize == stack.stackSize) + if(slotStack.getCount() == stack.getCount()) { - return null; + return ItemStack.EMPTY; } - currentSlot.onPickupFromSlot(player, slotStack); + currentSlot.onTake(player, slotStack); } return stack; diff --git a/src/main/java/mekanism/generators/common/item/ItemBlockGenerator.java b/src/main/java/mekanism/generators/common/item/ItemBlockGenerator.java index 08056c7f0..096990f2b 100644 --- a/src/main/java/mekanism/generators/common/item/ItemBlockGenerator.java +++ b/src/main/java/mekanism/generators/common/item/ItemBlockGenerator.java @@ -4,21 +4,26 @@ import ic2.api.item.IElectricItemManager; import ic2.api.item.ISpecialElectricItem; import java.util.List; +import java.util.UUID; import mekanism.api.EnumColor; -import mekanism.api.MekanismConfig.general; import mekanism.api.energy.IEnergizedItem; import mekanism.client.MekKeyHandler; +import mekanism.client.MekanismClient; import mekanism.client.MekanismKeyHandler; import mekanism.common.base.ISustainedData; import mekanism.common.base.ISustainedInventory; import mekanism.common.base.ISustainedTank; -import mekanism.common.integration.IC2ItemManager; +import mekanism.common.capabilities.ItemCapabilityWrapper; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.integration.forgeenergy.ForgeEnergyItemWrapper; +import mekanism.common.integration.ic2.IC2ItemManager; +import mekanism.common.integration.tesla.TeslaItemWrapper; import mekanism.common.security.ISecurityItem; import mekanism.common.security.ISecurityTile; import mekanism.common.security.ISecurityTile.SecurityMode; -import mekanism.common.tile.TileEntityBasicBlock; -import mekanism.common.tile.TileEntityElectricBlock; +import mekanism.common.tile.prefab.TileEntityBasicBlock; +import mekanism.common.tile.prefab.TileEntityElectricBlock; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; @@ -35,6 +40,7 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.Optional.Interface; @@ -105,7 +111,7 @@ public class ItemBlockGenerator extends ItemBlock implements IEnergizedItem, ISp return "KillMe!"; } - return getUnlocalizedName() + "." + GeneratorType.get(itemstack).name; + return getUnlocalizedName() + "." + GeneratorType.get(itemstack).blockName; } @Override @@ -125,7 +131,7 @@ public class ItemBlockGenerator extends ItemBlock implements IEnergizedItem, ISp { if(hasSecurity(itemstack)) { - list.add(SecurityUtils.getOwnerDisplay(entityplayer.getName(), getOwner(itemstack))); + list.add(SecurityUtils.getOwnerDisplay(entityplayer, MekanismClient.clientUUIDMap.get(getOwnerUUID(itemstack)))); list.add(EnumColor.GREY + LangUtils.localize("gui.security") + ": " + SecurityUtils.getSecurityDisplay(itemstack, Side.CLIENT)); if(SecurityUtils.isOverridden(itemstack, Side.CLIENT)) @@ -212,16 +218,16 @@ public class ItemBlockGenerator extends ItemBlock implements IEnergizedItem, ISp if(tileEntity instanceof ISecurityTile) { ISecurityTile security = (ISecurityTile)tileEntity; - security.getSecurity().setOwner(getOwner(stack)); + security.getSecurity().setOwnerUUID(getOwnerUUID(stack)); if(hasSecurity(stack)) { security.getSecurity().setMode(getSecurity(stack)); } - if(getOwner(stack) == null) + if(getOwnerUUID(stack) == null) { - security.getSecurity().setOwner(player.getName()); + security.getSecurity().setOwnerUUID(player.getUniqueID()); } } @@ -412,26 +418,26 @@ public class ItemBlockGenerator extends ItemBlock implements IEnergizedItem, ISp } @Override - public String getOwner(ItemStack stack) + public UUID getOwnerUUID(ItemStack stack) { - if(ItemDataUtils.hasData(stack, "owner")) + if(ItemDataUtils.hasData(stack, "ownerUUID")) { - return ItemDataUtils.getString(stack, "owner"); + return UUID.fromString(ItemDataUtils.getString(stack, "ownerUUID")); } return null; } @Override - public void setOwner(ItemStack stack, String owner) + public void setOwnerUUID(ItemStack stack, UUID owner) { - if(owner == null || owner.isEmpty()) + if(owner == null) { - ItemDataUtils.removeData(stack, "owner"); + ItemDataUtils.removeData(stack, "ownerUUID"); return; } - ItemDataUtils.setString(stack, "owner", owner); + ItemDataUtils.setString(stack, "ownerUUID", owner.toString()); } @Override @@ -464,4 +470,10 @@ public class ItemBlockGenerator extends ItemBlock implements IEnergizedItem, ISp { return hasSecurity(stack); } + + @Override + public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) + { + return new ItemCapabilityWrapper(stack, new TeslaItemWrapper(), new ForgeEnergyItemWrapper()); + } } diff --git a/src/main/java/mekanism/generators/common/item/ItemHohlraum.java b/src/main/java/mekanism/generators/common/item/ItemHohlraum.java index 910394a8c..1760173bb 100644 --- a/src/main/java/mekanism/generators/common/item/ItemHohlraum.java +++ b/src/main/java/mekanism/generators/common/item/ItemHohlraum.java @@ -4,9 +4,9 @@ import java.util.List; import mekanism.api.EnumColor; import mekanism.api.gas.Gas; -import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.IGasItem; +import mekanism.common.MekanismFluids; import mekanism.common.item.ItemMekanism; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.LangUtils; @@ -15,6 +15,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.MathHelper; public class ItemHohlraum extends ItemMekanism implements IGasItem { @@ -70,7 +72,7 @@ public class ItemHohlraum extends ItemMekanism implements IGasItem return 0; } - if(stack.getGas() != GasRegistry.getGas("fusionFuelDT")) + if(stack.getGas() != MekanismFluids.FusionFuel) { return 0; } @@ -95,7 +97,7 @@ public class ItemHohlraum extends ItemMekanism implements IGasItem @Override public boolean canReceiveGas(ItemStack itemstack, Gas type) { - return type == GasRegistry.getGas("fusionFuelDT"); + return type == MekanismFluids.FusionFuel; } @Override @@ -115,6 +117,12 @@ public class ItemHohlraum extends ItemMekanism implements IGasItem { return 1D-((getGas(stack) != null ? (double)getGas(stack).amount : 0D)/(double)getMaxGas(stack)); } + + @Override + public int getRGBDurabilityForDisplay(ItemStack stack) + { + return MathHelper.hsvToRGB(Math.max(0.0F, (float)(1-getDurabilityForDisplay(stack))) / 3.0F, 1.0F, 1.0F); + } @Override public GasStack getGas(ItemStack itemstack) @@ -146,14 +154,14 @@ public class ItemHohlraum extends ItemMekanism implements IGasItem } @Override - public void getSubItems(Item item, CreativeTabs tabs, List list) + public void getSubItems(Item item, CreativeTabs tabs, NonNullList list) { ItemStack empty = new ItemStack(this); setGas(empty, null); list.add(empty); ItemStack filled = new ItemStack(this); - setGas(filled, new GasStack(GasRegistry.getGas("fusionFuelDT"), ((IGasItem)filled.getItem()).getMaxGas(filled))); + setGas(filled, new GasStack(MekanismFluids.FusionFuel, ((IGasItem)filled.getItem()).getMaxGas(filled))); list.add(filled); } } diff --git a/src/main/java/mekanism/generators/common/tile/TileEntityAdvancedSolarGenerator.java b/src/main/java/mekanism/generators/common/tile/TileEntityAdvancedSolarGenerator.java index 19263ebe8..6f0ba6784 100644 --- a/src/main/java/mekanism/generators/common/tile/TileEntityAdvancedSolarGenerator.java +++ b/src/main/java/mekanism/generators/common/tile/TileEntityAdvancedSolarGenerator.java @@ -4,9 +4,9 @@ import java.util.EnumSet; import mekanism.api.Coord4D; import mekanism.api.IEvaporationSolar; -import mekanism.api.MekanismConfig.generators; import mekanism.common.base.IBoundingBlock; import mekanism.common.capabilities.Capabilities; +import mekanism.common.config.MekanismConfig.generators; import mekanism.common.util.MekanismUtils; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; @@ -29,13 +29,13 @@ public class TileEntityAdvancedSolarGenerator extends TileEntitySolarGenerator i public void onPlace() { Coord4D current = Coord4D.get(this); - MekanismUtils.makeBoundingBlock(worldObj, getPos().add(0, 1, 0), current); + MekanismUtils.makeBoundingBlock(world, getPos().add(0, 1, 0), current); for(int x = -1; x <= 1; x++) { for(int z = -1; z <= 1; z++) { - MekanismUtils.makeBoundingBlock(worldObj, getPos().add(x, 2, z), current); + MekanismUtils.makeBoundingBlock(world, getPos().add(x, 2, z), current); } } } @@ -43,18 +43,18 @@ public class TileEntityAdvancedSolarGenerator extends TileEntitySolarGenerator i @Override public void onBreak() { - worldObj.setBlockToAir(getPos().add(0, 1, 0)); + world.setBlockToAir(getPos().add(0, 1, 0)); for(int x = -1; x <= 1; x++) { for(int z = -1; z <= 1; z++) { - worldObj.setBlockToAir(getPos().add(x, 2, z)); + world.setBlockToAir(getPos().add(x, 2, z)); } } invalidate(); - worldObj.setBlockToAir(getPos()); + world.setBlockToAir(getPos()); } @Override diff --git a/src/main/java/mekanism/generators/common/tile/TileEntityBioGenerator.java b/src/main/java/mekanism/generators/common/tile/TileEntityBioGenerator.java index 37370ea33..a289fce05 100644 --- a/src/main/java/mekanism/generators/common/tile/TileEntityBioGenerator.java +++ b/src/main/java/mekanism/generators/common/tile/TileEntityBioGenerator.java @@ -4,18 +4,20 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; -import mekanism.api.MekanismConfig.generators; import mekanism.common.FluidSlot; import mekanism.common.MekanismItems; import mekanism.common.base.FluidHandlerWrapper; import mekanism.common.base.IFluidHandlerWrapper; import mekanism.common.base.ISustainedData; +import mekanism.common.config.MekanismConfig.generators; import mekanism.common.util.ChargeUtils; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.MekanismUtils; +import mekanism.common.util.PipeUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; @@ -34,7 +36,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IFlui public TileEntityBioGenerator() { super("bio", "BioGenerator", 160000, generators.bioGeneration*2); - inventory = new ItemStack[2]; + inventory = NonNullList.withSize(2, ItemStack.EMPTY); } @Override @@ -42,33 +44,27 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IFlui { super.onUpdate(); - if(inventory[0] != null) + if(!inventory.get(0).isEmpty()) { ChargeUtils.charge(1, this); - FluidStack fluid = FluidUtil.getFluidContained(inventory[0]); + FluidStack fluid = FluidUtil.getFluidContained(inventory.get(0)); if(fluid != null && FluidRegistry.isFluidRegistered("bioethanol")) { if(fluid.getFluid() == FluidRegistry.getFluid("bioethanol")) { - IFluidHandler handler = FluidUtil.getFluidHandler(inventory[0]); + IFluidHandler handler = FluidUtil.getFluidHandler(inventory.get(0)); FluidStack drained = handler.drain(bioFuelSlot.MAX_FLUID-bioFuelSlot.fluidStored, true); if(drained != null) { bioFuelSlot.fluidStored += drained.amount; - - if(inventory[0].stackSize == 0) - { - inventory[0] = null; - } } } } else { - int fuel = getFuel(inventory[0]); - ItemStack prevStack = inventory[0].copy(); + int fuel = getFuel(inventory.get(0)); if(fuel > 0) { @@ -78,17 +74,12 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IFlui { bioFuelSlot.fluidStored += fuel; - if(inventory[0].getItem().getContainerItem(inventory[0]) != null) + if(!inventory.get(0).getItem().getContainerItem(inventory.get(0)).isEmpty()) { - inventory[0] = inventory[0].getItem().getContainerItem(inventory[0]); + inventory.set(0, inventory.get(0).getItem().getContainerItem(inventory.get(0))); } else { - inventory[0].stackSize--; - } - - if(inventory[0].stackSize == 0) - { - inventory[0] = null; + inventory.get(0).shrink(1); } } } @@ -97,7 +88,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IFlui if(canOperate()) { - if(!worldObj.isRemote) + if(!world.isRemote) { setActive(true); } @@ -106,7 +97,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IFlui setEnergy(electricityStored + generators.bioGeneration); } else { - if(!worldObj.isRemote) + if(!world.isRemote) { setActive(false); } @@ -303,7 +294,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IFlui @Override public FluidTankInfo[] getTankInfo(EnumFacing from) { - return null; + return PipeUtils.EMPTY; } @Override diff --git a/src/main/java/mekanism/generators/common/tile/TileEntityGasGenerator.java b/src/main/java/mekanism/generators/common/tile/TileEntityGasGenerator.java index f7191960e..00bccad0c 100644 --- a/src/main/java/mekanism/generators/common/tile/TileEntityGasGenerator.java +++ b/src/main/java/mekanism/generators/common/tile/TileEntityGasGenerator.java @@ -4,12 +4,10 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; -import mekanism.api.MekanismConfig.general; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; -import mekanism.api.gas.GasTransmission; import mekanism.api.gas.IGasHandler; import mekanism.api.gas.IGasItem; import mekanism.api.gas.ITubeConnection; @@ -17,12 +15,15 @@ import mekanism.common.FuelHandler; import mekanism.common.FuelHandler.FuelGas; import mekanism.common.base.ISustainedData; import mekanism.common.capabilities.Capabilities; +import mekanism.common.config.MekanismConfig.general; import mekanism.common.util.ChargeUtils; +import mekanism.common.util.GasUtils; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -43,7 +44,7 @@ public class TileEntityGasGenerator extends TileEntityGenerator implements IGasH public TileEntityGasGenerator() { super("gas", "GasGenerator", general.FROM_H2*100, general.FROM_H2*2); - inventory = new ItemStack[2]; + inventory = NonNullList.withSize(2, ItemStack.EMPTY); fuelTank = new GasTank(MAX_GAS); } @@ -52,11 +53,11 @@ public class TileEntityGasGenerator extends TileEntityGenerator implements IGasH { super.onUpdate(); - if(!worldObj.isRemote) + if(!world.isRemote) { ChargeUtils.charge(1, this); - if(inventory[0] != null && fuelTank.getStored() < MAX_GAS) + if(!inventory.get(0).isEmpty() && fuelTank.getStored() < MAX_GAS) { Gas gasType = null; @@ -64,17 +65,17 @@ public class TileEntityGasGenerator extends TileEntityGenerator implements IGasH { gasType = fuelTank.getGas().getGas(); } - else if(inventory[0] != null && inventory[0].getItem() instanceof IGasItem) + else if(!inventory.get(0).isEmpty() && inventory.get(0).getItem() instanceof IGasItem) { - if(((IGasItem)inventory[0].getItem()).getGas(inventory[0]) != null) + if(((IGasItem)inventory.get(0).getItem()).getGas(inventory.get(0)) != null) { - gasType = ((IGasItem)inventory[0].getItem()).getGas(inventory[0]).getGas(); + gasType = ((IGasItem)inventory.get(0).getItem()).getGas(inventory.get(0)).getGas(); } } if(gasType != null && FuelHandler.getFuel(gasType) != null) { - GasStack removed = GasTransmission.removeGas(inventory[0], gasType, fuelTank.getNeeded()); + GasStack removed = GasUtils.removeGas(inventory.get(0), gasType, fuelTank.getNeeded()); boolean isTankEmpty = (fuelTank.getGas() == null); int fuelReceived = fuelTank.receive(removed, true); diff --git a/src/main/java/mekanism/generators/common/tile/TileEntityGenerator.java b/src/main/java/mekanism/generators/common/tile/TileEntityGenerator.java index 0e7b5f50a..08c1f5a29 100644 --- a/src/main/java/mekanism/generators/common/tile/TileEntityGenerator.java +++ b/src/main/java/mekanism/generators/common/tile/TileEntityGenerator.java @@ -6,20 +6,22 @@ import java.util.ArrayList; import java.util.EnumSet; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; import mekanism.api.Range4D; import mekanism.client.sound.ISoundSource; import mekanism.common.Mekanism; import mekanism.common.base.IActiveState; import mekanism.common.base.IHasSound; import mekanism.common.base.IRedstoneControl; -import mekanism.common.integration.IComputerIntegration; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.integration.computer.IComputerIntegration; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.security.ISecurityTile; -import mekanism.common.tile.TileEntityNoisyElectricBlock; import mekanism.common.tile.component.TileComponentSecurity; +import mekanism.common.tile.prefab.TileEntityNoisyBlock; import mekanism.common.util.CableUtils; import mekanism.common.util.MekanismUtils; +import mekanism.generators.common.block.states.BlockStateGenerator; +import mekanism.generators.common.block.states.BlockStateGenerator.GeneratorType; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; @@ -27,7 +29,7 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public abstract class TileEntityGenerator extends TileEntityNoisyElectricBlock implements IComputerIntegration, IActiveState, IHasSound, ISoundSource, IRedstoneControl, ISecurityTile +public abstract class TileEntityGenerator extends TileEntityNoisyBlock implements IComputerIntegration, IActiveState, IHasSound, ISoundSource, IRedstoneControl, ISecurityTile { /** Output per tick this generator can transfer. */ public double output; @@ -65,18 +67,18 @@ public abstract class TileEntityGenerator extends TileEntityNoisyElectricBlock i { super.onUpdate(); - if(worldObj.isRemote && updateDelay > 0) + if(world.isRemote && updateDelay > 0) { updateDelay--; if(updateDelay == 0 && clientActive != isActive) { isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } - if(!worldObj.isRemote) + if(!world.isRemote) { if(updateDelay > 0) { @@ -88,6 +90,18 @@ public abstract class TileEntityGenerator extends TileEntityNoisyElectricBlock i Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); } } + + if(!world.isRemote && general.destroyDisabledBlocks) + { + GeneratorType type = BlockStateGenerator.GeneratorType.get(getBlockType(), getBlockMetadata()); + + if(type != null && !type.isEnabled()) + { + Mekanism.logger.info("[Mekanism] Destroying generator of type '" + type.blockName + "' at coords " + Coord4D.get(this) + " as according to config."); + world.setBlockToAir(getPos()); + return; + } + } if(MekanismUtils.canFunction(this)) { @@ -160,7 +174,7 @@ public abstract class TileEntityGenerator extends TileEntityNoisyElectricBlock i { updateDelay = general.UPDATE_DELAY; isActive = clientActive; - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } } diff --git a/src/main/java/mekanism/generators/common/tile/TileEntityHeatGenerator.java b/src/main/java/mekanism/generators/common/tile/TileEntityHeatGenerator.java index c9eaccea5..1c496d388 100644 --- a/src/main/java/mekanism/generators/common/tile/TileEntityHeatGenerator.java +++ b/src/main/java/mekanism/generators/common/tile/TileEntityHeatGenerator.java @@ -6,15 +6,15 @@ import java.util.ArrayList; import mekanism.api.Coord4D; import mekanism.api.IHeatTransfer; -import mekanism.api.MekanismConfig.generators; -import mekanism.api.util.CapabilityUtils; import mekanism.common.base.FluidHandlerWrapper; import mekanism.common.base.IFluidHandlerWrapper; import mekanism.common.base.ISustainedData; import mekanism.common.capabilities.Capabilities; +import mekanism.common.config.MekanismConfig.generators; import mekanism.common.util.ChargeUtils; import mekanism.common.util.FluidContainerUtils; import mekanism.common.util.FluidContainerUtils.FluidChecker; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.HeatUtils; import mekanism.common.util.ItemDataUtils; import mekanism.common.util.MekanismUtils; @@ -25,6 +25,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.Fluid; @@ -57,7 +58,7 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements IFlu public TileEntityHeatGenerator() { super("heat", "HeatGenerator", 160000, generators.heatGeneration*2); - inventory = new ItemStack[2]; + inventory = NonNullList.withSize(2, ItemStack.EMPTY); } @Override @@ -65,18 +66,18 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements IFlu { super.onUpdate(); - if(!worldObj.isRemote) + if(!world.isRemote) { ChargeUtils.charge(1, this); - if(inventory[0] != null) + if(!inventory.get(0).isEmpty()) { - if(FluidContainerUtils.isFluidContainer(inventory[0])) + if(FluidContainerUtils.isFluidContainer(inventory.get(0))) { - lavaTank.fill(FluidContainerUtils.extractFluid(lavaTank, inventory[0], FluidChecker.check(FluidRegistry.LAVA)), true); + lavaTank.fill(FluidContainerUtils.extractFluid(lavaTank, this, 0, FluidChecker.check(FluidRegistry.LAVA)), true); } else { - int fuel = getFuel(inventory[0]); + int fuel = getFuel(inventory.get(0)); if(fuel > 0) { @@ -86,17 +87,12 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements IFlu { lavaTank.fill(new FluidStack(FluidRegistry.LAVA, fuel), true); - if(inventory[0].getItem().getContainerItem(inventory[0]) != null) + if(!inventory.get(0).getItem().getContainerItem(inventory.get(0)).isEmpty()) { - inventory[0] = inventory[0].getItem().getContainerItem(inventory[0]); + inventory.set(0, inventory.get(0).getItem().getContainerItem(inventory.get(0))); } else { - inventory[0].stackSize--; - } - - if(inventory[0].stackSize == 0) - { - inventory[0] = null; + inventory.get(0).shrink(1); } } } @@ -203,7 +199,7 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements IFlu } } - if(worldObj.provider.getDimension() == -1) + if(world.provider.getDimension() == -1) { netherBoost = generators.heatGenerationNether; } @@ -213,7 +209,7 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements IFlu private boolean isLava(BlockPos pos) { - return worldObj.getBlockState(pos).getBlock() == Blocks.LAVA; + return world.getBlockState(pos).getBlock() == Blocks.LAVA; } public int getFuel(ItemStack itemstack) @@ -432,7 +428,7 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements IFlu { if(canConnectHeat(side)) { - TileEntity adj = Coord4D.get(this).offset(side).getTileEntity(worldObj); + TileEntity adj = Coord4D.get(this).offset(side).getTileEntity(world); if(CapabilityUtils.hasCapability(adj, Capabilities.HEAT_TRANSFER_CAPABILITY, side.getOpposite())) { diff --git a/src/main/java/mekanism/generators/common/tile/TileEntitySolarGenerator.java b/src/main/java/mekanism/generators/common/tile/TileEntitySolarGenerator.java index 2967cd8d6..2a60e490a 100644 --- a/src/main/java/mekanism/generators/common/tile/TileEntitySolarGenerator.java +++ b/src/main/java/mekanism/generators/common/tile/TileEntitySolarGenerator.java @@ -5,12 +5,13 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; import java.util.EnumSet; -import mekanism.api.MekanismConfig.generators; +import mekanism.common.config.MekanismConfig.generators; import mekanism.common.util.ChargeUtils; import mekanism.common.util.MekanismUtils; import micdoodle8.mods.galacticraft.api.world.ISolarLevel; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.world.biome.BiomeDesert; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; @@ -33,7 +34,7 @@ public class TileEntitySolarGenerator extends TileEntityGenerator public TileEntitySolarGenerator(String name, double maxEnergy, double output) { super("solar", name, maxEnergy, output); - inventory = new ItemStack[1]; + inventory = NonNullList.withSize(1, ItemStack.EMPTY); } @Override @@ -60,11 +61,11 @@ public class TileEntitySolarGenerator extends TileEntityGenerator { super.onUpdate(); - if(!worldObj.isRemote) + if(!world.isRemote) { ChargeUtils.charge(0, this); - if(worldObj.isDaytime() && ((!worldObj.isRaining() && !worldObj.isThundering()) || isDesert()) && !worldObj.provider.getHasNoSky() && worldObj.canSeeSky(getPos().add(0, 4, 0))) + if(world.isDaytime() && ((!world.isRaining() && !world.isThundering()) || isDesert()) && !world.provider.hasNoSky() && world.canSeeSky(getPos().add(0, 4, 0))) { seesSun = true; } @@ -85,7 +86,7 @@ public class TileEntitySolarGenerator extends TileEntityGenerator public boolean isDesert() { - return worldObj.provider.getBiomeForCoords(getPos()).getBiomeClass() == BiomeDesert.class; + return world.provider.getBiomeForCoords(getPos()).getBiomeClass() == BiomeDesert.class; } @Override @@ -124,9 +125,9 @@ public class TileEntitySolarGenerator extends TileEntityGenerator { ret = GENERATION_RATE; - if(MekanismUtils.existsAndInstance(worldObj.provider, "micdoodle8.mods.galacticraft.api.world.ISolarLevel")) + if(MekanismUtils.existsAndInstance(world.provider, "micdoodle8.mods.galacticraft.api.world.ISolarLevel")) { - ret *= ((ISolarLevel)worldObj.provider).getSolarEnergyMultiplier(); + ret *= ((ISolarLevel)world.provider).getSolarEnergyMultiplier(); } if(isDesert()) diff --git a/src/main/java/mekanism/generators/common/tile/TileEntityWindGenerator.java b/src/main/java/mekanism/generators/common/tile/TileEntityWindGenerator.java index 93ec13faf..a8df3f4d0 100644 --- a/src/main/java/mekanism/generators/common/tile/TileEntityWindGenerator.java +++ b/src/main/java/mekanism/generators/common/tile/TileEntityWindGenerator.java @@ -5,12 +5,13 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.generators; import mekanism.common.base.IBoundingBlock; +import mekanism.common.config.MekanismConfig.generators; import mekanism.common.util.ChargeUtils; import mekanism.common.util.MekanismUtils; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -27,7 +28,7 @@ public class TileEntityWindGenerator extends TileEntityGenerator implements IBou public TileEntityWindGenerator() { super("wind", "WindGenerator", 200000, (generators.windGenerationMax)*2); - inventory = new ItemStack[1]; + inventory = NonNullList.withSize(1, ItemStack.EMPTY); } @Override @@ -35,7 +36,7 @@ public class TileEntityWindGenerator extends TileEntityGenerator implements IBou { super.onUpdate(); - if(!worldObj.isRemote) + if(!world.isRemote) { ChargeUtils.charge(0, this); @@ -62,7 +63,7 @@ public class TileEntityWindGenerator extends TileEntityGenerator implements IBou { super.handlePacketData(dataStream); - if(worldObj.isRemote) + if(world.isRemote) { currentMultiplier = dataStream.readFloat(); } @@ -81,7 +82,7 @@ public class TileEntityWindGenerator extends TileEntityGenerator implements IBou /** Determines the current output multiplier, taking sky visibility and height into account. **/ public float getMultiplier() { - if(worldObj.canSeeSky(getPos().add(0, 4, 0))) + if(world.canSeeSky(getPos().add(0, 4, 0))) { final float minY = (float)generators.windGenerationMinY; final float maxY = (float)generators.windGenerationMaxY; @@ -146,21 +147,21 @@ public class TileEntityWindGenerator extends TileEntityGenerator implements IBou public void onPlace() { Coord4D current = Coord4D.get(this); - MekanismUtils.makeBoundingBlock(worldObj, getPos().offset(EnumFacing.UP, 1), current); - MekanismUtils.makeBoundingBlock(worldObj, getPos().offset(EnumFacing.UP, 2), current); - MekanismUtils.makeBoundingBlock(worldObj, getPos().offset(EnumFacing.UP, 3), current); - MekanismUtils.makeBoundingBlock(worldObj, getPos().offset(EnumFacing.UP, 4), current); + MekanismUtils.makeBoundingBlock(world, getPos().offset(EnumFacing.UP, 1), current); + MekanismUtils.makeBoundingBlock(world, getPos().offset(EnumFacing.UP, 2), current); + MekanismUtils.makeBoundingBlock(world, getPos().offset(EnumFacing.UP, 3), current); + MekanismUtils.makeBoundingBlock(world, getPos().offset(EnumFacing.UP, 4), current); } @Override public void onBreak() { - worldObj.setBlockToAir(getPos().add(0, 1, 0)); - worldObj.setBlockToAir(getPos().add(0, 2, 0)); - worldObj.setBlockToAir(getPos().add(0, 3, 0)); - worldObj.setBlockToAir(getPos().add(0, 4, 0)); + world.setBlockToAir(getPos().add(0, 1, 0)); + world.setBlockToAir(getPos().add(0, 2, 0)); + world.setBlockToAir(getPos().add(0, 3, 0)); + world.setBlockToAir(getPos().add(0, 4, 0)); - worldObj.setBlockToAir(getPos()); + world.setBlockToAir(getPos()); } @Override diff --git a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorBlock.java b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorBlock.java index 76cb83cca..6f92bf465 100644 --- a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorBlock.java +++ b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorBlock.java @@ -5,15 +5,15 @@ import java.util.HashSet; import java.util.Set; import mekanism.api.Coord4D; -import mekanism.api.reactor.IFusionReactor; -import mekanism.api.reactor.IReactorBlock; -import mekanism.common.tile.TileEntityElectricBlock; +import mekanism.common.tile.prefab.TileEntityElectricBlock; +import mekanism.generators.common.FusionReactor; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; -public abstract class TileEntityReactorBlock extends TileEntityElectricBlock implements IReactorBlock +public abstract class TileEntityReactorBlock extends TileEntityElectricBlock { - public IFusionReactor fusionReactor; + public FusionReactor fusionReactor; public boolean attempted; @@ -22,16 +22,17 @@ public abstract class TileEntityReactorBlock extends TileEntityElectricBlock imp public TileEntityReactorBlock() { super("ReactorBlock", 0); - inventory = new ItemStack[0]; + inventory = NonNullList.withSize(0, ItemStack.EMPTY); } + + public abstract boolean isFrame(); public TileEntityReactorBlock(String name, double maxEnergy) { super(name, maxEnergy); } - @Override - public void setReactor(IFusionReactor reactor) + public void setReactor(FusionReactor reactor) { if(reactor != fusionReactor) { @@ -41,8 +42,7 @@ public abstract class TileEntityReactorBlock extends TileEntityElectricBlock imp fusionReactor = reactor; } - @Override - public IFusionReactor getReactor() + public FusionReactor getReactor() { return fusionReactor; } @@ -68,7 +68,7 @@ public abstract class TileEntityReactorBlock extends TileEntityElectricBlock imp changed = false; } - if(!worldObj.isRemote && ticker == 5 && !attempted && (getReactor() == null || !getReactor().isFormed())) + if(!world.isRemote && ticker == 5 && !attempted && (getReactor() == null || !getReactor().isFormed())) { updateController(); } @@ -104,7 +104,7 @@ public abstract class TileEntityReactorBlock extends TileEntityElectricBlock imp { super.onAdded(); - if(!worldObj.isRemote) + if(!world.isRemote) { if(getReactor() != null) { @@ -148,13 +148,13 @@ public abstract class TileEntityReactorBlock extends TileEntityElectricBlock imp { Coord4D coord = pos.offset(side); - if(!iterated.contains(coord) && coord.getTileEntity(worldObj) instanceof TileEntityReactorBlock) + if(!iterated.contains(coord) && coord.getTileEntity(world) instanceof TileEntityReactorBlock) { - ((TileEntityReactorBlock)coord.getTileEntity(worldObj)).attempted = true; + ((TileEntityReactorBlock)coord.getTileEntity(world)).attempted = true; - if(coord.getTileEntity(worldObj) instanceof TileEntityReactorController) + if(coord.getTileEntity(world) instanceof TileEntityReactorController) { - found = (TileEntityReactorController)coord.getTileEntity(worldObj); + found = (TileEntityReactorController)coord.getTileEntity(world); return; } diff --git a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorController.java b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorController.java index c63dda4a3..222c02668 100644 --- a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorController.java +++ b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorController.java @@ -5,16 +5,17 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.client; import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; import mekanism.client.SparkleAnimation.INodeChecker; import mekanism.client.sound.ISoundSource; import mekanism.common.Mekanism; +import mekanism.common.MekanismFluids; import mekanism.common.base.IActiveState; import mekanism.common.base.IHasSound; import mekanism.common.base.SoundWrapper; +import mekanism.common.config.MekanismConfig.client; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.util.MekanismUtils; import mekanism.generators.common.FusionReactor; @@ -22,6 +23,7 @@ import net.minecraft.client.audio.ISound.AttenuationType; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.Vec3d; @@ -60,10 +62,9 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen public TileEntityReactorController() { super("ReactorController", 1000000000); - inventory = new ItemStack[1]; + inventory = NonNullList.withSize(1, ItemStack.EMPTY); } - @Override public boolean isFrame() { return false; @@ -106,7 +107,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen { super.onUpdate(); - if(worldObj.isRemote) + if(world.isRemote) { updateSound(); } @@ -115,7 +116,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen { getReactor().simulate(); - if(!worldObj.isRemote && (getReactor().isBurning() != clientBurning || Math.abs(getReactor().getPlasmaTemp() - clientTemp) > 1000000)) + if(!world.isRemote && (getReactor().isBurning() != clientBurning || Math.abs(getReactor().getPlasmaTemp() - clientTemp) > 1000000)) { Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D)); clientBurning = getReactor().isBurning(); @@ -205,7 +206,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen } @Override - public ArrayList getNetworkedData(ArrayList data) + public ArrayList getNetworkedData(ArrayList data) { super.getNetworkedData(data); @@ -268,7 +269,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen if(getReactor() == null) { setReactor(new FusionReactor(this)); - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } ((FusionReactor)getReactor()).formed = true; @@ -276,9 +277,9 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen getReactor().setCaseTemp(dataStream.readDouble()); getReactor().setInjectionRate(dataStream.readInt()); getReactor().setBurning(dataStream.readBoolean()); - fuelTank.setGas(new GasStack(GasRegistry.getGas("fusionFuelDT"), dataStream.readInt())); - deuteriumTank.setGas(new GasStack(GasRegistry.getGas("deuterium"), dataStream.readInt())); - tritiumTank.setGas(new GasStack(GasRegistry.getGas("tritium"), dataStream.readInt())); + fuelTank.setGas(new GasStack(MekanismFluids.FusionFuel, dataStream.readInt())); + deuteriumTank.setGas(new GasStack(MekanismFluids.Deuterium, dataStream.readInt())); + tritiumTank.setGas(new GasStack(MekanismFluids.Tritium, dataStream.readInt())); waterTank.setCapacity(dataStream.readInt()); waterTank.setFluid(new FluidStack(FluidRegistry.getFluid("water"), dataStream.readInt())); steamTank.setCapacity(dataStream.readInt()); @@ -287,7 +288,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen else if(getReactor() != null) { setReactor(null); - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } } @@ -409,7 +410,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen { super.validate(); - if(worldObj.isRemote) + if(world.isRemote) { initSounds(); } diff --git a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorLogicAdapter.java b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorLogicAdapter.java index 677f5be99..6d29bebaa 100644 --- a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorLogicAdapter.java +++ b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorLogicAdapter.java @@ -4,13 +4,12 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; -import mekanism.common.integration.IComputerIntegration; +import mekanism.common.integration.computer.IComputerIntegration; import mekanism.common.util.LangUtils; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fml.common.FMLCommonHandler; -import dan200.computercraft.api.lua.LuaException; public class TileEntityReactorLogicAdapter extends TileEntityReactorBlock implements IComputerIntegration { @@ -31,20 +30,19 @@ public class TileEntityReactorLogicAdapter extends TileEntityReactorBlock implem { super.onUpdate(); - if(!worldObj.isRemote) + if(!world.isRemote) { boolean outputting = checkMode(); if(outputting != prevOutputting) { - worldObj.notifyNeighborsOfStateChange(getPos(), getBlockType()); + world.notifyNeighborsOfStateChange(getPos(), getBlockType(), true); } prevOutputting = outputting; } } - @Override public boolean isFrame() { return false; @@ -52,7 +50,7 @@ public class TileEntityReactorLogicAdapter extends TileEntityReactorBlock implem public boolean checkMode() { - if(worldObj.isRemote) + if(world.isRemote) { return prevOutputting; } @@ -140,7 +138,7 @@ public class TileEntityReactorLogicAdapter extends TileEntityReactorBlock implem } private static final String[] methods = new String[] {"isIgnited", "canIgnite", "getPlasmaHeat", "getMaxPlasmaHeat", "getCaseHeat", "getMaxCaseHeat", "getInjectionRate", "setInjectionRate", "hasFuel", "getProducing", "getIgnitionTemp", - "getEnergy", "getMaxEnergy", "getWater", "getSteam", "getFuel"}; + "getEnergy", "getMaxEnergy", "getWater", "getSteam", "getFuel", "getDeuterium", "getTritium"}; @Override public String[] getMethods() @@ -149,7 +147,7 @@ public class TileEntityReactorLogicAdapter extends TileEntityReactorBlock implem } @Override - public Object[] invoke(int method, Object[] arguments) throws LuaException, InterruptedException + public Object[] invoke(int method, Object[] arguments) throws Exception { if(getReactor() == null || !getReactor().isFormed()) { @@ -198,8 +196,12 @@ public class TileEntityReactorLogicAdapter extends TileEntityReactorBlock implem return new Object[] {getReactor().getSteamTank().getFluidAmount()}; case 15: return new Object[] {getReactor().getFuelTank().getStored()}; + case 16: + return new Object[] {getReactor().getDeuteriumTank().getStored()}; + case 17: + return new Object[] {getReactor().getTritiumTank().getStored()}; default: - return new Object[] {"Unknown command."}; + throw new NoSuchMethodException(); } } diff --git a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorNeutronCapture.java b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorNeutronCapture.java deleted file mode 100644 index 265f17ac4..000000000 --- a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorNeutronCapture.java +++ /dev/null @@ -1,18 +0,0 @@ -package mekanism.generators.common.tile.reactor; - -import mekanism.api.reactor.INeutronCapture; - -public class TileEntityReactorNeutronCapture extends TileEntityReactorBlock implements INeutronCapture -{ - @Override - public boolean isFrame() - { - return false; - } - - @Override - public int absorbNeutrons(int neutrons) - { - return 0; - } -} diff --git a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorPort.java b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorPort.java index 319d153f0..5495c540c 100644 --- a/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorPort.java +++ b/src/main/java/mekanism/generators/common/tile/reactor/TileEntityReactorPort.java @@ -15,14 +15,14 @@ import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasStack; import mekanism.api.gas.IGasHandler; import mekanism.api.gas.ITubeConnection; -import mekanism.api.reactor.IReactorBlock; -import mekanism.api.util.CapabilityUtils; import mekanism.common.Mekanism; +import mekanism.common.MekanismFluids; import mekanism.common.base.FluidHandlerWrapper; import mekanism.common.base.IFluidHandlerWrapper; import mekanism.common.capabilities.Capabilities; import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.util.CableUtils; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.HeatUtils; import mekanism.common.util.InventoryUtils; import mekanism.common.util.LangUtils; @@ -35,6 +35,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.text.TextComponentString; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.Fluid; @@ -54,7 +55,7 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl { super("name", 1); - inventory = new ItemStack[0]; + inventory = NonNullList.withSize(0, ItemStack.EMPTY); } @Override @@ -86,12 +87,12 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl { if(changed) { - worldObj.notifyNeighborsOfStateChange(getPos(), getBlockType()); + world.notifyNeighborsOfStateChange(getPos(), getBlockType(), true); } super.onUpdate(); - if(!worldObj.isRemote) + if(!world.isRemote) { CableUtils.emit(this); @@ -101,7 +102,7 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl for(EnumFacing side : EnumFacing.values()) { - TileEntity tile = Coord4D.get(this).offset(side).getTileEntity(worldObj); + TileEntity tile = Coord4D.get(this).offset(side).getTileEntity(world); if(tile != null && !(tile instanceof TileEntityReactorPort) && CapabilityUtils.hasCapability(tile, CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side.getOpposite())) { @@ -178,15 +179,15 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl { if(getReactor() != null) { - if(stack.getGas() == GasRegistry.getGas("deuterium")) + if(stack.getGas() == MekanismFluids.Deuterium) { return getReactor().getDeuteriumTank().receive(stack, doTransfer); } - else if(stack.getGas() == GasRegistry.getGas("tritium")) + else if(stack.getGas() == MekanismFluids.Tritium) { return getReactor().getTritiumTank().receive(stack, doTransfer); } - else if(stack.getGas() == GasRegistry.getGas("fusionFuelDT")) + else if(stack.getGas() == MekanismFluids.FusionFuel) { return getReactor().getFuelTank().receive(stack, doTransfer); } @@ -204,7 +205,7 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl @Override public boolean canReceiveGas(EnumFacing side, Gas type) { - return (type == GasRegistry.getGas("deuterium") || type == GasRegistry.getGas("tritium") || type == GasRegistry.getGas("fusionFuelDT")); + return (type == MekanismFluids.Deuterium || type == MekanismFluids.Tritium || type == MekanismFluids.FusionFuel); } @Override @@ -245,7 +246,7 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl } @Override - public boolean canOutputTo(EnumFacing side) + public boolean canOutputEnergy(EnumFacing side) { return true; } @@ -364,11 +365,11 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl @Override public IHeatTransfer getAdjacent(EnumFacing side) { - TileEntity adj = Coord4D.get(this).offset(side).getTileEntity(worldObj); + TileEntity adj = Coord4D.get(this).offset(side).getTileEntity(world); if(CapabilityUtils.hasCapability(adj, Capabilities.HEAT_TRANSFER_CAPABILITY, side.getOpposite())) { - if(!(adj instanceof IReactorBlock)) + if(!(adj instanceof TileEntityReactorBlock)) { return CapabilityUtils.getCapability(adj, Capabilities.HEAT_TRANSFER_CAPABILITY, side.getOpposite()); } @@ -380,7 +381,7 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl @Override public ItemStack getStackInSlot(int slotID) { - return getReactor() != null && getReactor().isFormed() ? getReactor().getInventory()[slotID] : null; + return getReactor() != null && getReactor().isFormed() ? getReactor().getInventory().get(slotID) : ItemStack.EMPTY; } @Override @@ -394,11 +395,11 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl { if(getReactor() != null && getReactor().isFormed()) { - getReactor().getInventory()[slotID] = itemstack; + getReactor().getInventory().set(slotID, itemstack); - if(itemstack != null && itemstack.stackSize > getInventoryStackLimit()) + if(!itemstack.isEmpty() && itemstack.getCount() > getInventoryStackLimit()) { - itemstack.stackSize = getInventoryStackLimit(); + itemstack.setCount(getInventoryStackLimit()); } } } @@ -447,7 +448,7 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl if(prevEject != fluidEject) { - MekanismUtils.updateBlock(worldObj, getPos()); + MekanismUtils.updateBlock(world, getPos()); } } } @@ -465,12 +466,11 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl @Override public EnumActionResult onSneakRightClick(EntityPlayer player, EnumFacing side) { - if(!worldObj.isRemote) + if(!world.isRemote) { fluidEject = !fluidEject; String modeText = " " + (fluidEject ? EnumColor.DARK_RED : EnumColor.DARK_GREEN) + LangUtils.transOutputInput(fluidEject) + "."; - player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.configurator.reactorPortEject") + modeText)); - + player.sendMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.configurator.reactorPortEject") + modeText)); Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); markDirty(); } diff --git a/src/main/java/mekanism/generators/common/tile/turbine/TileEntityElectromagneticCoil.java b/src/main/java/mekanism/generators/common/tile/turbine/TileEntityElectromagneticCoil.java index 4c99f3bf1..630465491 100644 --- a/src/main/java/mekanism/generators/common/tile/turbine/TileEntityElectromagneticCoil.java +++ b/src/main/java/mekanism/generators/common/tile/turbine/TileEntityElectromagneticCoil.java @@ -1,6 +1,6 @@ package mekanism.generators.common.tile.turbine; -import mekanism.common.tile.TileEntityBasicBlock; +import mekanism.common.tile.prefab.TileEntityBasicBlock; public class TileEntityElectromagneticCoil extends TileEntityBasicBlock { diff --git a/src/main/java/mekanism/generators/common/tile/turbine/TileEntityRotationalComplex.java b/src/main/java/mekanism/generators/common/tile/turbine/TileEntityRotationalComplex.java index 61e14acf5..74b8eb1c3 100644 --- a/src/main/java/mekanism/generators/common/tile/turbine/TileEntityRotationalComplex.java +++ b/src/main/java/mekanism/generators/common/tile/turbine/TileEntityRotationalComplex.java @@ -19,7 +19,7 @@ public class TileEntityRotationalComplex extends TileEntityInternalMultiblock super.setMultiblock(id); Coord4D coord = Coord4D.get(this).offset(EnumFacing.DOWN); - TileEntity tile = coord.getTileEntity(worldObj); + TileEntity tile = coord.getTileEntity(world); if(tile instanceof TileEntityTurbineRotor) { diff --git a/src/main/java/mekanism/generators/common/tile/turbine/TileEntitySaturatingCondenser.java b/src/main/java/mekanism/generators/common/tile/turbine/TileEntitySaturatingCondenser.java index e2450155a..40351c118 100644 --- a/src/main/java/mekanism/generators/common/tile/turbine/TileEntitySaturatingCondenser.java +++ b/src/main/java/mekanism/generators/common/tile/turbine/TileEntitySaturatingCondenser.java @@ -1,6 +1,6 @@ package mekanism.generators.common.tile.turbine; -import mekanism.common.tile.TileEntityBasicBlock; +import mekanism.common.tile.prefab.TileEntityBasicBlock; public class TileEntitySaturatingCondenser extends TileEntityBasicBlock { diff --git a/src/main/java/mekanism/generators/common/tile/turbine/TileEntityTurbineCasing.java b/src/main/java/mekanism/generators/common/tile/turbine/TileEntityTurbineCasing.java index ed96a6b0d..446aec6b6 100644 --- a/src/main/java/mekanism/generators/common/tile/turbine/TileEntityTurbineCasing.java +++ b/src/main/java/mekanism/generators/common/tile/turbine/TileEntityTurbineCasing.java @@ -5,12 +5,12 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; -import mekanism.api.MekanismConfig.generators; import mekanism.api.Range4D; import mekanism.api.energy.IStrictEnergyStorage; import mekanism.common.Mekanism; import mekanism.common.PacketHandler; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.config.MekanismConfig.generators; import mekanism.common.multiblock.MultiblockCache; import mekanism.common.multiblock.MultiblockManager; import mekanism.common.multiblock.UpdateProtocol; @@ -47,7 +47,7 @@ public class TileEntityTurbineCasing extends TileEntityMultiblock 0) { @@ -174,12 +174,12 @@ public class TileEntityTurbineRotor extends TileEntityBasicBlock private boolean isRotor(Coord4D coord) { - return coord.getTileEntity(worldObj) instanceof TileEntityTurbineRotor; + return coord.getTileEntity(world) instanceof TileEntityTurbineRotor; } private boolean isComplex(Coord4D coord) { - return coord.getTileEntity(worldObj) instanceof TileEntityRotationalComplex; + return coord.getTileEntity(world) instanceof TileEntityRotationalComplex; } @Override @@ -187,7 +187,7 @@ public class TileEntityTurbineRotor extends TileEntityBasicBlock { super.onChunkLoad(); - if(!worldObj.isRemote) + if(!world.isRemote) { updateRotors(); } diff --git a/src/main/java/mekanism/generators/common/tile/turbine/TileEntityTurbineValve.java b/src/main/java/mekanism/generators/common/tile/turbine/TileEntityTurbineValve.java index 95b9fcba1..0753b2951 100644 --- a/src/main/java/mekanism/generators/common/tile/turbine/TileEntityTurbineValve.java +++ b/src/main/java/mekanism/generators/common/tile/turbine/TileEntityTurbineValve.java @@ -11,13 +11,16 @@ import ic2.api.energy.tile.IEnergyTile; import java.util.EnumSet; import mekanism.api.Coord4D; -import mekanism.api.MekanismConfig.general; import mekanism.common.base.FluidHandlerWrapper; import mekanism.common.base.IEnergyWrapper; import mekanism.common.base.IFluidHandlerWrapper; import mekanism.common.capabilities.Capabilities; import mekanism.common.capabilities.CapabilityWrapperManager; -import mekanism.common.integration.TeslaIntegration; +import mekanism.common.config.MekanismConfig.general; +import mekanism.common.config.MekanismConfig.generators; +import mekanism.common.integration.computer.IComputerIntegration; +import mekanism.common.integration.forgeenergy.ForgeEnergyIntegration; +import mekanism.common.integration.tesla.TeslaIntegration; import mekanism.common.tile.TileEntityGasTank.GasMode; import mekanism.common.util.CableUtils; import mekanism.common.util.LangUtils; @@ -27,6 +30,7 @@ import mekanism.generators.common.content.turbine.TurbineFluidTank; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -34,11 +38,13 @@ import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fml.common.Optional.Method; -public class TileEntityTurbineValve extends TileEntityTurbineCasing implements IFluidHandlerWrapper, IEnergyWrapper +public class TileEntityTurbineValve extends TileEntityTurbineCasing implements IFluidHandlerWrapper, IEnergyWrapper, IComputerIntegration { public boolean ic2Registered = false; public TurbineFluidTank fluidTank; + + public Fluid STEAM = FluidRegistry.getFluid("steam"); public TileEntityTurbineValve() { @@ -56,7 +62,7 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I register(); } - if(!worldObj.isRemote) + if(!world.isRemote) { if(structure != null) { @@ -96,9 +102,9 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I @Method(modid = "IC2") public void register() { - if(!worldObj.isRemote) + if(!world.isRemote) { - IEnergyTile registered = EnergyNet.instance.getTile(worldObj, getPos()); + IEnergyTile registered = EnergyNet.instance.getTile(world, getPos()); if(registered != this) { @@ -118,9 +124,9 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I @Method(modid = "IC2") public void deregister() { - if(!worldObj.isRemote) + if(!world.isRemote) { - IEnergyTile registered = EnergyNet.instance.getTile(worldObj, getPos()); + IEnergyTile registered = EnergyNet.instance.getTile(world, getPos()); if(registered instanceof IEnergyTile) { @@ -186,7 +192,7 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I setEnergy(getEnergy() - toSend); } - return (int)Math.round(toSend*general.TO_RF); + return (int)Math.round(Math.min(Integer.MAX_VALUE, toSend*general.TO_RF)); } return 0; @@ -201,13 +207,13 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I @Override public int getEnergyStored(EnumFacing from) { - return (int)Math.round(getEnergy()*general.TO_RF); + return (int)Math.round(Math.min(Integer.MAX_VALUE, getEnergy()*general.TO_RF)); } @Override public int getMaxEnergyStored(EnumFacing from) { - return (int)Math.round(getMaxEnergy()*general.TO_RF); + return (int)Math.round(Math.min(Integer.MAX_VALUE, getMaxEnergy()*general.TO_RF)); } @Override @@ -242,11 +248,11 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I @Method(modid = "IC2") public boolean isTeleporterCompatible(EnumFacing side) { - return canOutputTo(side); + return canOutputEnergy(side); } @Override - public boolean canOutputTo(EnumFacing side) + public boolean canOutputEnergy(EnumFacing side) { return getOutputtingSides().contains(side); } @@ -269,21 +275,21 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I @Method(modid = "IC2") public int getStored() { - return (int)Math.round(getEnergy()*general.TO_IC2); + return (int)Math.round(Math.min(Integer.MAX_VALUE, getEnergy()*general.TO_IC2)); } @Override @Method(modid = "IC2") public int getCapacity() { - return (int)Math.round(getMaxEnergy()*general.TO_IC2); + return (int)Math.round(Math.min(Integer.MAX_VALUE, getMaxEnergy()*general.TO_IC2)); } @Override @Method(modid = "IC2") public int getOutput() { - return (int)Math.round(getMaxOutput()*general.TO_IC2); + return (int)Math.round(Math.min(Integer.MAX_VALUE, getMaxOutput()*general.TO_IC2)); } @Override @@ -332,13 +338,13 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I } @Override - public double transferEnergyToAcceptor(EnumFacing side, double amount) + public double acceptEnergy(EnumFacing side, double amount, boolean simulate) { return 0; } @Override - public double removeEnergyFromProvider(EnumFacing side, double amount) + public double pullEnergy(EnumFacing side, double amount, boolean simulate) { if(!getOutputtingSides().contains(side)) { @@ -346,7 +352,11 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I } double toGive = Math.min(getEnergy(), amount); - setEnergy(getEnergy() - toGive); + + if(!simulate) + { + setEnergy(getEnergy() - toGive); + } return toGive; } @@ -354,13 +364,13 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I @Override public FluidTankInfo[] getTankInfo(EnumFacing from) { - return ((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure)) ? new FluidTankInfo[] {fluidTank.getInfo()} : PipeUtils.EMPTY; + return ((!world.isRemote && structure != null) || (world.isRemote && clientHasStructure)) ? new FluidTankInfo[] {fluidTank.getInfo()} : PipeUtils.EMPTY; } @Override public int fill(EnumFacing from, FluidStack resource, boolean doFill) { - if(structure == null) + if(!canFill(from, resource != null ? resource.getFluid() : null)) { return 0; } @@ -395,9 +405,9 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I @Override public boolean canFill(EnumFacing from, Fluid fluid) { - if(fluid == FluidRegistry.getFluid("steam")) + if(fluid == STEAM) { - return ((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure)); + return ((!world.isRemote && structure != null) || (world.isRemote && clientHasStructure)); } return false; @@ -415,16 +425,56 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I return LangUtils.localize("gui.industrialTurbine"); } + private static final String[] methods = new String[] {"isFormed", "getSteam", "getFlowRate", "getMaxFlow", "getSteamInput"}; + + @Override + public String[] getMethods() + { + return methods; + } + + @Override + public Object[] invoke(int method, Object[] arguments) throws Exception + { + if(method == 0) + { + return new Object[] {structure != null}; + } + else { + if(structure == null) + { + return new Object[] {"Unformed"}; + } + + switch(method) + { + case 1: + return new Object[] {structure.fluidStored != null ? structure.fluidStored.amount : 0}; + case 2: + return new Object[] {structure.clientFlow}; + case 3: + double rate = structure.lowerVolume*(structure.clientDispersers*generators.turbineDisperserGasFlow); + rate = Math.min(rate, structure.vents*generators.turbineVentGasFlow); + return new Object[] {rate}; + case 4: + return new Object[] {structure.lastSteamInput}; + } + } + + throw new NoSuchMethodException(); + } + @Override public boolean hasCapability(Capability capability, EnumFacing side) { - if((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure)) + if((!world.isRemote && structure != null) || (world.isRemote && clientHasStructure)) { if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || capability == Capabilities.ENERGY_STORAGE_CAPABILITY - || capability == Capabilities.CABLE_OUTPUTTER_CAPABILITY + || capability == Capabilities.ENERGY_OUTPUTTER_CAPABILITY || capability == Capabilities.TESLA_HOLDER_CAPABILITY - || (capability == Capabilities.TESLA_PRODUCER_CAPABILITY && getOutputtingSides().contains(facing))) + || (capability == Capabilities.TESLA_PRODUCER_CAPABILITY && getOutputtingSides().contains(facing)) + || capability == CapabilityEnergy.ENERGY) { return true; } @@ -434,13 +484,14 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I } private CapabilityWrapperManager teslaManager = new CapabilityWrapperManager(IEnergyWrapper.class, TeslaIntegration.class); + private CapabilityWrapperManager forgeEnergyManager = new CapabilityWrapperManager(IEnergyWrapper.class, ForgeEnergyIntegration.class); @Override public T getCapability(Capability capability, EnumFacing side) { - if((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure)) + if((!world.isRemote && structure != null) || (world.isRemote && clientHasStructure)) { - if(capability == Capabilities.ENERGY_STORAGE_CAPABILITY || capability == Capabilities.CABLE_OUTPUTTER_CAPABILITY) + if(capability == Capabilities.ENERGY_STORAGE_CAPABILITY || capability == Capabilities.ENERGY_OUTPUTTER_CAPABILITY) { return (T)this; } @@ -455,6 +506,11 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I { return (T)teslaManager.getWrapper(this, facing); } + + if(capability == CapabilityEnergy.ENERGY) + { + return (T)forgeEnergyManager.getWrapper(this, facing); + } } return super.getCapability(capability, side); diff --git a/src/main/java/mekanism/generators/common/tile/turbine/TileEntityTurbineVent.java b/src/main/java/mekanism/generators/common/tile/turbine/TileEntityTurbineVent.java index fd71fd1ad..cb13df9c8 100644 --- a/src/main/java/mekanism/generators/common/tile/turbine/TileEntityTurbineVent.java +++ b/src/main/java/mekanism/generators/common/tile/turbine/TileEntityTurbineVent.java @@ -1,9 +1,9 @@ package mekanism.generators.common.tile.turbine; import mekanism.api.Coord4D; -import mekanism.api.util.CapabilityUtils; import mekanism.common.base.FluidHandlerWrapper; import mekanism.common.base.IFluidHandlerWrapper; +import mekanism.common.util.CapabilityUtils; import mekanism.common.util.PipeUtils; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; @@ -35,7 +35,7 @@ public class TileEntityTurbineVent extends TileEntityTurbineCasing implements IF for(EnumFacing side : EnumFacing.VALUES) { - TileEntity tile = Coord4D.get(this).offset(side).getTileEntity(worldObj); + TileEntity tile = Coord4D.get(this).offset(side).getTileEntity(world); if(tile != null && CapabilityUtils.hasCapability(tile, CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side.getOpposite())) { @@ -53,7 +53,7 @@ public class TileEntityTurbineVent extends TileEntityTurbineCasing implements IF @Override public FluidTankInfo[] getTankInfo(EnumFacing from) { - return ((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure)) ? new FluidTankInfo[] {fakeInfo} : PipeUtils.EMPTY; + return ((!world.isRemote && structure != null) || (world.isRemote && clientHasStructure)) ? new FluidTankInfo[] {fakeInfo} : PipeUtils.EMPTY; } @Override @@ -89,7 +89,7 @@ public class TileEntityTurbineVent extends TileEntityTurbineCasing implements IF @Override public boolean hasCapability(Capability capability, EnumFacing side) { - if((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure)) + if((!world.isRemote && structure != null) || (world.isRemote && clientHasStructure)) { if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) { @@ -103,7 +103,7 @@ public class TileEntityTurbineVent extends TileEntityTurbineCasing implements IF @Override public T getCapability(Capability capability, EnumFacing side) { - if((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure)) + if((!world.isRemote && structure != null) || (world.isRemote && clientHasStructure)) { if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) { diff --git a/src/main/java/mekanism/tools/client/gui/ToolsGuiFactory.java b/src/main/java/mekanism/tools/client/gui/ToolsGuiFactory.java index 263aa2fe5..8b2066fd4 100644 --- a/src/main/java/mekanism/tools/client/gui/ToolsGuiFactory.java +++ b/src/main/java/mekanism/tools/client/gui/ToolsGuiFactory.java @@ -31,5 +31,17 @@ public class ToolsGuiFactory implements IModGuiFactory { return null; } + + @Override + public boolean hasConfigGui() + { + return true; + } + + @Override + public GuiScreen createConfigGui(GuiScreen parentScreen) + { + return new GuiToolsConfig(parentScreen); + } } diff --git a/src/main/java/mekanism/tools/common/MekanismTools.java b/src/main/java/mekanism/tools/common/MekanismTools.java index 4fc3eb3ce..c04f05e23 100644 --- a/src/main/java/mekanism/tools/common/MekanismTools.java +++ b/src/main/java/mekanism/tools/common/MekanismTools.java @@ -6,10 +6,10 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; -import mekanism.api.MekanismConfig.tools; import mekanism.common.Mekanism; import mekanism.common.Version; import mekanism.common.base.IModule; +import mekanism.common.config.MekanismConfig.tools; import mekanism.common.recipe.ShapedMekanismRecipe; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntityZombie; @@ -32,17 +32,17 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -@Mod(modid = "MekanismTools", name = "MekanismTools", version = "9.2.2", dependencies = "required-after:Mekanism", guiFactory = "mekanism.tools.client.gui.ToolsGuiFactory") +@Mod(modid = "mekanismtools", name = "MekanismTools", version = "9.3.2", dependencies = "required-after:mekanism", guiFactory = "mekanism.tools.client.gui.ToolsGuiFactory") public class MekanismTools implements IModule { @SidedProxy(clientSide = "mekanism.tools.client.ToolsClientProxy", serverSide = "mekanism.tools.common.ToolsCommonProxy") public static ToolsCommonProxy proxy; - @Instance("MekanismTools") + @Instance("mekanismtools") public static MekanismTools instance; /** MekanismTools version number */ - public static Version versionNumber = new Version(9, 2, 2); + public static Version versionNumber = new Version(9, 3, 2); //Enums: Tools public static ToolMaterial toolOBSIDIAN; diff --git a/src/main/java/mekanism/tools/common/ToolsCommonProxy.java b/src/main/java/mekanism/tools/common/ToolsCommonProxy.java index dfdbd39b9..f6df3ceb5 100644 --- a/src/main/java/mekanism/tools/common/ToolsCommonProxy.java +++ b/src/main/java/mekanism/tools/common/ToolsCommonProxy.java @@ -1,7 +1,7 @@ package mekanism.tools.common; -import mekanism.api.MekanismConfig.tools; import mekanism.common.Mekanism; +import mekanism.common.config.MekanismConfig.tools; public class ToolsCommonProxy { diff --git a/src/main/java/mekanism/tools/common/ToolsItems.java b/src/main/java/mekanism/tools/common/ToolsItems.java index fb09288bf..6234c0c5a 100644 --- a/src/main/java/mekanism/tools/common/ToolsItems.java +++ b/src/main/java/mekanism/tools/common/ToolsItems.java @@ -13,7 +13,7 @@ import net.minecraft.item.Item.ToolMaterial; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; -@ObjectHolder("MekanismTools") +@ObjectHolder("mekanismtools") public class ToolsItems { //Vanilla Material Paxels diff --git a/src/main/java/mekanism/tools/item/ItemMekanismArmor.java b/src/main/java/mekanism/tools/item/ItemMekanismArmor.java index 6ccae7f20..549429d91 100644 --- a/src/main/java/mekanism/tools/item/ItemMekanismArmor.java +++ b/src/main/java/mekanism/tools/item/ItemMekanismArmor.java @@ -2,11 +2,11 @@ package mekanism.tools.item; import java.util.List; -import mekanism.api.util.StackUtils; import mekanism.client.render.ModelCustomArmor; import mekanism.common.Mekanism; import mekanism.common.MekanismItems; import mekanism.common.util.LangUtils; +import mekanism.common.util.StackUtils; import mekanism.tools.common.MekanismTools; import mekanism.tools.common.ToolsItems; import net.minecraft.client.model.ModelBiped; diff --git a/src/main/java/mekanism/tools/item/ItemMekanismAxe.java b/src/main/java/mekanism/tools/item/ItemMekanismAxe.java index a763b3acb..2771b026b 100644 --- a/src/main/java/mekanism/tools/item/ItemMekanismAxe.java +++ b/src/main/java/mekanism/tools/item/ItemMekanismAxe.java @@ -1,34 +1,32 @@ package mekanism.tools.item; -import java.util.Set; +import java.util.List; +import mekanism.common.Mekanism; +import mekanism.common.util.LangUtils; +import mekanism.common.util.StackUtils; import mekanism.tools.common.MekanismTools; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemStack; -import com.google.common.collect.Sets; - -public class ItemMekanismAxe extends ItemMekanismTool +public class ItemMekanismAxe extends ItemAxe { - private static final Set EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE}); - public ItemMekanismAxe(ToolMaterial tool) { - super(MekanismTools.AXE_DAMAGE.get(tool), MekanismTools.AXE_SPEED.get(tool), tool, EFFECTIVE_ON); + super(tool, MekanismTools.AXE_DAMAGE.get(tool), MekanismTools.AXE_SPEED.get(tool)); + setCreativeTab(Mekanism.tabMekanism); } @Override - public float getStrVsBlock(ItemStack itemstack, IBlockState blockState) + public void addInformation(ItemStack itemstack, EntityPlayer playerIn, List list, boolean advanced) { - if(blockState != null && blockState.getBlock() != null && blockState.getMaterial() == Material.WOOD) - { - return efficiencyOnProperMaterial; - } - else { - return super.getStrVsBlock(itemstack, blockState); - } + list.add(LangUtils.localize("tooltip.hp") + ": " + (itemstack.getMaxDamage() - itemstack.getItemDamage())); + } + + @Override + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) + { + return StackUtils.equalsWildcard(ItemMekanismTool.getRepairStack(toolMaterial), repair) || super.getIsRepairable(toRepair, repair); } } diff --git a/src/main/java/mekanism/tools/item/ItemMekanismHoe.java b/src/main/java/mekanism/tools/item/ItemMekanismHoe.java index 9c344de3e..18ff9ce9b 100644 --- a/src/main/java/mekanism/tools/item/ItemMekanismHoe.java +++ b/src/main/java/mekanism/tools/item/ItemMekanismHoe.java @@ -2,9 +2,9 @@ package mekanism.tools.item; import java.util.List; -import mekanism.api.util.StackUtils; import mekanism.common.item.ItemMekanism; import mekanism.common.util.LangUtils; +import mekanism.common.util.StackUtils; import net.minecraft.block.Block; import net.minecraft.block.BlockDirt; import net.minecraft.block.state.IBlockState; @@ -38,7 +38,7 @@ public class ItemMekanismHoe extends ItemMekanism { super(); toolMaterial = enumtoolmaterial; - maxStackSize = 1; + setMaxStackSize(1); setMaxDamage(enumtoolmaterial.getMaxUses()); setCreativeTab(CreativeTabs.TOOLS); speed = enumtoolmaterial.getDamageVsEntity() + 1.0F; @@ -52,8 +52,10 @@ public class ItemMekanismHoe extends ItemMekanism @Override @SuppressWarnings("incomplete-switch") - public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) + public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + ItemStack stack = playerIn.getHeldItem(hand); + if(!playerIn.canPlayerEdit(pos.offset(facing), facing, stack)) { return EnumActionResult.FAIL; @@ -109,8 +111,8 @@ public class ItemMekanismHoe extends ItemMekanism if(equipmentSlot == EntityEquipmentSlot.MAINHAND) { - multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", 0.0D, 0)); - multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", (double)(this.speed - 4.0F), 0)); + multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", 0.0D, 0)); + multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", (double)(this.speed - 4.0F), 0)); } return multimap; diff --git a/src/main/java/mekanism/tools/item/ItemMekanismShovel.java b/src/main/java/mekanism/tools/item/ItemMekanismShovel.java index 091679e02..978e4bac3 100644 --- a/src/main/java/mekanism/tools/item/ItemMekanismShovel.java +++ b/src/main/java/mekanism/tools/item/ItemMekanismShovel.java @@ -35,8 +35,10 @@ public class ItemMekanismShovel extends ItemMekanismTool } @Override - public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) + public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + ItemStack stack = playerIn.getHeldItem(hand); + if(!playerIn.canPlayerEdit(pos.offset(facing), facing, stack)) { return EnumActionResult.FAIL; diff --git a/src/main/java/mekanism/tools/item/ItemMekanismSword.java b/src/main/java/mekanism/tools/item/ItemMekanismSword.java index 9505fe232..70bf0cb28 100644 --- a/src/main/java/mekanism/tools/item/ItemMekanismSword.java +++ b/src/main/java/mekanism/tools/item/ItemMekanismSword.java @@ -2,9 +2,9 @@ package mekanism.tools.item; import java.util.List; -import mekanism.api.util.StackUtils; import mekanism.common.Mekanism; import mekanism.common.util.LangUtils; +import mekanism.common.util.StackUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; diff --git a/src/main/java/mekanism/tools/item/ItemMekanismTool.java b/src/main/java/mekanism/tools/item/ItemMekanismTool.java index d71f534e0..d5fff20da 100644 --- a/src/main/java/mekanism/tools/item/ItemMekanismTool.java +++ b/src/main/java/mekanism/tools/item/ItemMekanismTool.java @@ -3,10 +3,10 @@ package mekanism.tools.item; import java.util.List; import java.util.Set; -import mekanism.api.util.StackUtils; import mekanism.common.Mekanism; import mekanism.common.MekanismItems; import mekanism.common.util.LangUtils; +import mekanism.common.util.StackUtils; import mekanism.tools.common.MekanismTools; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/resources/assets/mekanism/blockstates/BoundingBlock.json b/src/main/resources/assets/mekanism/blockstates/boundingblock.json similarity index 100% rename from src/main/resources/assets/mekanism/blockstates/BoundingBlock.json rename to src/main/resources/assets/mekanism/blockstates/boundingblock.json diff --git a/src/main/resources/assets/mekanism/blockstates/CardboardBox.json b/src/main/resources/assets/mekanism/blockstates/cardboardbox.json similarity index 100% rename from src/main/resources/assets/mekanism/blockstates/CardboardBox.json rename to src/main/resources/assets/mekanism/blockstates/cardboardbox.json diff --git a/src/main/resources/assets/mekanism/blockstates/diversion_transporter.json b/src/main/resources/assets/mekanism/blockstates/diversion_transporter.json index 5a9e30341..ea7517d56 100644 --- a/src/main/resources/assets/mekanism/blockstates/diversion_transporter.json +++ b/src/main/resources/assets/mekanism/blockstates/diversion_transporter.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/EnergyCube.json b/src/main/resources/assets/mekanism/blockstates/energycube.json similarity index 100% rename from src/main/resources/assets/mekanism/blockstates/EnergyCube.json rename to src/main/resources/assets/mekanism/blockstates/energycube.json diff --git a/src/main/resources/assets/mekanism/blockstates/GasTank.json b/src/main/resources/assets/mekanism/blockstates/gastank.json similarity index 100% rename from src/main/resources/assets/mekanism/blockstates/GasTank.json rename to src/main/resources/assets/mekanism/blockstates/gastank.json diff --git a/src/main/resources/assets/mekanism/blockstates/glow_panel.json b/src/main/resources/assets/mekanism/blockstates/glowpanel.json similarity index 100% rename from src/main/resources/assets/mekanism/blockstates/glow_panel.json rename to src/main/resources/assets/mekanism/blockstates/glowpanel.json diff --git a/src/main/resources/assets/mekanism/blockstates/logistical_transporter_advanced.json b/src/main/resources/assets/mekanism/blockstates/logistical_transporter_advanced.json index 9107d917d..9926280ad 100644 --- a/src/main/resources/assets/mekanism/blockstates/logistical_transporter_advanced.json +++ b/src/main/resources/assets/mekanism/blockstates/logistical_transporter_advanced.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/logistical_transporter_basic.json b/src/main/resources/assets/mekanism/blockstates/logistical_transporter_basic.json index b660d1f70..800010b53 100644 --- a/src/main/resources/assets/mekanism/blockstates/logistical_transporter_basic.json +++ b/src/main/resources/assets/mekanism/blockstates/logistical_transporter_basic.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/logistical_transporter_elite.json b/src/main/resources/assets/mekanism/blockstates/logistical_transporter_elite.json index 31368496b..16c0f2fe3 100644 --- a/src/main/resources/assets/mekanism/blockstates/logistical_transporter_elite.json +++ b/src/main/resources/assets/mekanism/blockstates/logistical_transporter_elite.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/logistical_transporter_ultimate.json b/src/main/resources/assets/mekanism/blockstates/logistical_transporter_ultimate.json index e8f4aa1f5..13245ead4 100644 --- a/src/main/resources/assets/mekanism/blockstates/logistical_transporter_ultimate.json +++ b/src/main/resources/assets/mekanism/blockstates/logistical_transporter_ultimate.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/mechanical_pipe_advanced.json b/src/main/resources/assets/mekanism/blockstates/mechanical_pipe_advanced.json index 4f194afcf..7928e3e9b 100644 --- a/src/main/resources/assets/mekanism/blockstates/mechanical_pipe_advanced.json +++ b/src/main/resources/assets/mekanism/blockstates/mechanical_pipe_advanced.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/mechanical_pipe_basic.json b/src/main/resources/assets/mekanism/blockstates/mechanical_pipe_basic.json index 6a3e15183..021540596 100644 --- a/src/main/resources/assets/mekanism/blockstates/mechanical_pipe_basic.json +++ b/src/main/resources/assets/mekanism/blockstates/mechanical_pipe_basic.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/mechanical_pipe_elite.json b/src/main/resources/assets/mekanism/blockstates/mechanical_pipe_elite.json index 3a2161152..f9db9a06e 100644 --- a/src/main/resources/assets/mekanism/blockstates/mechanical_pipe_elite.json +++ b/src/main/resources/assets/mekanism/blockstates/mechanical_pipe_elite.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/mechanical_pipe_ultimate.json b/src/main/resources/assets/mekanism/blockstates/mechanical_pipe_ultimate.json index b0a53eb5d..7a402e700 100644 --- a/src/main/resources/assets/mekanism/blockstates/mechanical_pipe_ultimate.json +++ b/src/main/resources/assets/mekanism/blockstates/mechanical_pipe_ultimate.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/ObsidianTNT.json b/src/main/resources/assets/mekanism/blockstates/obsidiantnt.json similarity index 100% rename from src/main/resources/assets/mekanism/blockstates/ObsidianTNT.json rename to src/main/resources/assets/mekanism/blockstates/obsidiantnt.json diff --git a/src/main/resources/assets/mekanism/blockstates/OreBlock.json b/src/main/resources/assets/mekanism/blockstates/oreblock.json similarity index 100% rename from src/main/resources/assets/mekanism/blockstates/OreBlock.json rename to src/main/resources/assets/mekanism/blockstates/oreblock.json diff --git a/src/main/resources/assets/mekanism/blockstates/PlasticFence.json b/src/main/resources/assets/mekanism/blockstates/plasticfence.json similarity index 100% rename from src/main/resources/assets/mekanism/blockstates/PlasticFence.json rename to src/main/resources/assets/mekanism/blockstates/plasticfence.json diff --git a/src/main/resources/assets/mekanism/blockstates/pressurized_tube_advanced.json b/src/main/resources/assets/mekanism/blockstates/pressurized_tube_advanced.json index 2bd6cd96a..522670125 100644 --- a/src/main/resources/assets/mekanism/blockstates/pressurized_tube_advanced.json +++ b/src/main/resources/assets/mekanism/blockstates/pressurized_tube_advanced.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/pressurized_tube_basic.json b/src/main/resources/assets/mekanism/blockstates/pressurized_tube_basic.json index 8e3e7bf44..0dd4b2eb3 100644 --- a/src/main/resources/assets/mekanism/blockstates/pressurized_tube_basic.json +++ b/src/main/resources/assets/mekanism/blockstates/pressurized_tube_basic.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/pressurized_tube_elite.json b/src/main/resources/assets/mekanism/blockstates/pressurized_tube_elite.json index 9c0dbc9fc..096d17ebd 100644 --- a/src/main/resources/assets/mekanism/blockstates/pressurized_tube_elite.json +++ b/src/main/resources/assets/mekanism/blockstates/pressurized_tube_elite.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/pressurized_tube_ultimate.json b/src/main/resources/assets/mekanism/blockstates/pressurized_tube_ultimate.json index ebb7080cc..4f5d48da2 100644 --- a/src/main/resources/assets/mekanism/blockstates/pressurized_tube_ultimate.json +++ b/src/main/resources/assets/mekanism/blockstates/pressurized_tube_ultimate.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/restrictive_transporter.json b/src/main/resources/assets/mekanism/blockstates/restrictive_transporter.json index c6d94cbcf..e7d0d79df 100644 --- a/src/main/resources/assets/mekanism/blockstates/restrictive_transporter.json +++ b/src/main/resources/assets/mekanism/blockstates/restrictive_transporter.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/SaltBlock.json b/src/main/resources/assets/mekanism/blockstates/saltblock.json similarity index 100% rename from src/main/resources/assets/mekanism/blockstates/SaltBlock.json rename to src/main/resources/assets/mekanism/blockstates/saltblock.json diff --git a/src/main/resources/assets/mekanism/blockstates/thermodynamic_conductor_advanced.json b/src/main/resources/assets/mekanism/blockstates/thermodynamic_conductor_advanced.json index 008b70726..044d43329 100644 --- a/src/main/resources/assets/mekanism/blockstates/thermodynamic_conductor_advanced.json +++ b/src/main/resources/assets/mekanism/blockstates/thermodynamic_conductor_advanced.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/thermodynamic_conductor_basic.json b/src/main/resources/assets/mekanism/blockstates/thermodynamic_conductor_basic.json index b7d33f9f7..c18c13bf7 100644 --- a/src/main/resources/assets/mekanism/blockstates/thermodynamic_conductor_basic.json +++ b/src/main/resources/assets/mekanism/blockstates/thermodynamic_conductor_basic.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } \ No newline at end of file diff --git a/src/main/resources/assets/mekanism/blockstates/thermodynamic_conductor_elite.json b/src/main/resources/assets/mekanism/blockstates/thermodynamic_conductor_elite.json index 737219bd2..d70aa846a 100644 --- a/src/main/resources/assets/mekanism/blockstates/thermodynamic_conductor_elite.json +++ b/src/main/resources/assets/mekanism/blockstates/thermodynamic_conductor_elite.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/thermodynamic_conductor_ultimate.json b/src/main/resources/assets/mekanism/blockstates/thermodynamic_conductor_ultimate.json index 8aa617d39..7581aff21 100644 --- a/src/main/resources/assets/mekanism/blockstates/thermodynamic_conductor_ultimate.json +++ b/src/main/resources/assets/mekanism/blockstates/thermodynamic_conductor_ultimate.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/universal_cable_advanced.json b/src/main/resources/assets/mekanism/blockstates/universal_cable_advanced.json index 834da1bba..2d86992b8 100644 --- a/src/main/resources/assets/mekanism/blockstates/universal_cable_advanced.json +++ b/src/main/resources/assets/mekanism/blockstates/universal_cable_advanced.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/universal_cable_basic.json b/src/main/resources/assets/mekanism/blockstates/universal_cable_basic.json index dc333bd01..069caff5d 100644 --- a/src/main/resources/assets/mekanism/blockstates/universal_cable_basic.json +++ b/src/main/resources/assets/mekanism/blockstates/universal_cable_basic.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } \ No newline at end of file diff --git a/src/main/resources/assets/mekanism/blockstates/universal_cable_elite.json b/src/main/resources/assets/mekanism/blockstates/universal_cable_elite.json index 47a0415d2..63493bb56 100644 --- a/src/main/resources/assets/mekanism/blockstates/universal_cable_elite.json +++ b/src/main/resources/assets/mekanism/blockstates/universal_cable_elite.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/blockstates/universal_cable_ultimate.json b/src/main/resources/assets/mekanism/blockstates/universal_cable_ultimate.json index 0aadfd0bb..e7c658f04 100644 --- a/src/main/resources/assets/mekanism/blockstates/universal_cable_ultimate.json +++ b/src/main/resources/assets/mekanism/blockstates/universal_cable_ultimate.json @@ -13,7 +13,7 @@ } }, "variants": { - "multipart": [{}], + "normal": [{}], "inventory": [{}] } } diff --git a/src/main/resources/assets/mekanism/gui/GuiFormulaicAssemblicator.png b/src/main/resources/assets/mekanism/gui/GuiFormulaicAssemblicator.png deleted file mode 100644 index 12b4246bb..000000000 Binary files a/src/main/resources/assets/mekanism/gui/GuiFormulaicAssemblicator.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/gui/GuiTItemStackFilter.png b/src/main/resources/assets/mekanism/gui/GuiTItemStackFilter.png deleted file mode 100644 index a5b02a0b2..000000000 Binary files a/src/main/resources/assets/mekanism/gui/GuiTItemStackFilter.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/gui/GuiTMaterialFilter.png b/src/main/resources/assets/mekanism/gui/GuiTMaterialFilter.png deleted file mode 100644 index d0e80cfbc..000000000 Binary files a/src/main/resources/assets/mekanism/gui/GuiTMaterialFilter.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/gui/GuiTModIDFilter.png b/src/main/resources/assets/mekanism/gui/GuiTModIDFilter.png deleted file mode 100644 index 6c6c2188d..000000000 Binary files a/src/main/resources/assets/mekanism/gui/GuiTModIDFilter.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/gui/GuiTOreDictFilter.png b/src/main/resources/assets/mekanism/gui/GuiTOreDictFilter.png deleted file mode 100644 index 9e047b30a..000000000 Binary files a/src/main/resources/assets/mekanism/gui/GuiTOreDictFilter.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiAmplifierTab.png b/src/main/resources/assets/mekanism/gui/elements/guiamplifiertab.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiAmplifierTab.png rename to src/main/resources/assets/mekanism/gui/elements/guiamplifiertab.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiBucket.png b/src/main/resources/assets/mekanism/gui/elements/guibucket.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiBucket.png rename to src/main/resources/assets/mekanism/gui/elements/guibucket.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiConfigurationTab.png b/src/main/resources/assets/mekanism/gui/elements/guiconfigurationtab.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiConfigurationTab.png rename to src/main/resources/assets/mekanism/gui/elements/guiconfigurationtab.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiContainerEditMode.png b/src/main/resources/assets/mekanism/gui/elements/guicontainereditmode.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiContainerEditMode.png rename to src/main/resources/assets/mekanism/gui/elements/guicontainereditmode.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiEnergyInfo.png b/src/main/resources/assets/mekanism/gui/elements/guienergyinfo.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiEnergyInfo.png rename to src/main/resources/assets/mekanism/gui/elements/guienergyinfo.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiEnergyTab.png b/src/main/resources/assets/mekanism/gui/elements/guienergytab.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiEnergyTab.png rename to src/main/resources/assets/mekanism/gui/elements/guienergytab.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiFluidsTab.png b/src/main/resources/assets/mekanism/gui/elements/guifluidstab.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiFluidsTab.png rename to src/main/resources/assets/mekanism/gui/elements/guifluidstab.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiFuelTab.png b/src/main/resources/assets/mekanism/gui/elements/guifueltab.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiFuelTab.png rename to src/main/resources/assets/mekanism/gui/elements/guifueltab.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiGasesTab.png b/src/main/resources/assets/mekanism/gui/elements/guigasestab.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiGasesTab.png rename to src/main/resources/assets/mekanism/gui/elements/guigasestab.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiGaugeSmall.png b/src/main/resources/assets/mekanism/gui/elements/guigaugesmall.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiGaugeSmall.png rename to src/main/resources/assets/mekanism/gui/elements/guigaugesmall.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiGaugeStandard.png b/src/main/resources/assets/mekanism/gui/elements/guigaugestandard.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiGaugeStandard.png rename to src/main/resources/assets/mekanism/gui/elements/guigaugestandard.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiGaugeWide.png b/src/main/resources/assets/mekanism/gui/elements/guigaugewide.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiGaugeWide.png rename to src/main/resources/assets/mekanism/gui/elements/guigaugewide.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiGraph.png b/src/main/resources/assets/mekanism/gui/elements/guigraph.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiGraph.png rename to src/main/resources/assets/mekanism/gui/elements/guigraph.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiHeatInfo.png b/src/main/resources/assets/mekanism/gui/elements/guiheatinfo.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiHeatInfo.png rename to src/main/resources/assets/mekanism/gui/elements/guiheatinfo.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiHeatTab.png b/src/main/resources/assets/mekanism/gui/elements/guiheattab.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiHeatTab.png rename to src/main/resources/assets/mekanism/gui/elements/guiheattab.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiItemsTab.png b/src/main/resources/assets/mekanism/gui/elements/guiitemstab.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiItemsTab.png rename to src/main/resources/assets/mekanism/gui/elements/guiitemstab.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiPowerBar.png b/src/main/resources/assets/mekanism/gui/elements/guipowerbar.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiPowerBar.png rename to src/main/resources/assets/mekanism/gui/elements/guipowerbar.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiProgress.png b/src/main/resources/assets/mekanism/gui/elements/guiprogress.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiProgress.png rename to src/main/resources/assets/mekanism/gui/elements/guiprogress.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiRateBar.png b/src/main/resources/assets/mekanism/gui/elements/guiratebar.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiRateBar.png rename to src/main/resources/assets/mekanism/gui/elements/guiratebar.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiRecipeType.png b/src/main/resources/assets/mekanism/gui/elements/guirecipetype.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiRecipeType.png rename to src/main/resources/assets/mekanism/gui/elements/guirecipetype.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiRedstoneControl.png b/src/main/resources/assets/mekanism/gui/elements/guiredstonecontrol.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiRedstoneControl.png rename to src/main/resources/assets/mekanism/gui/elements/guiredstonecontrol.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiScrollList.png b/src/main/resources/assets/mekanism/gui/elements/guiscrolllist.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiScrollList.png rename to src/main/resources/assets/mekanism/gui/elements/guiscrolllist.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiSecurityTab.png b/src/main/resources/assets/mekanism/gui/elements/guisecuritytab.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiSecurityTab.png rename to src/main/resources/assets/mekanism/gui/elements/guisecuritytab.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiSlot.png b/src/main/resources/assets/mekanism/gui/elements/guislot.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiSlot.png rename to src/main/resources/assets/mekanism/gui/elements/guislot.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiSortingTab.png b/src/main/resources/assets/mekanism/gui/elements/guisortingtab.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiSortingTab.png rename to src/main/resources/assets/mekanism/gui/elements/guisortingtab.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiStatsTab.png b/src/main/resources/assets/mekanism/gui/elements/guistatstab.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiStatsTab.png rename to src/main/resources/assets/mekanism/gui/elements/guistatstab.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiTooltips.png b/src/main/resources/assets/mekanism/gui/elements/guitooltips.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiTooltips.png rename to src/main/resources/assets/mekanism/gui/elements/guitooltips.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiTransporterConfigTab.png b/src/main/resources/assets/mekanism/gui/elements/guitransporterconfigtab.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiTransporterConfigTab.png rename to src/main/resources/assets/mekanism/gui/elements/guitransporterconfigtab.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiUpgradeManagement.png b/src/main/resources/assets/mekanism/gui/elements/guiupgrademanagement.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiUpgradeManagement.png rename to src/main/resources/assets/mekanism/gui/elements/guiupgrademanagement.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiUpgradeTab.png b/src/main/resources/assets/mekanism/gui/elements/guiupgradetab.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiUpgradeTab.png rename to src/main/resources/assets/mekanism/gui/elements/guiupgradetab.png diff --git a/src/main/resources/assets/mekanism/gui/elements/GuiVisualsTab.png b/src/main/resources/assets/mekanism/gui/elements/guivisualstab.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/elements/GuiVisualsTab.png rename to src/main/resources/assets/mekanism/gui/elements/guivisualstab.png diff --git a/src/main/resources/assets/mekanism/gui/factory/GuiAdvancedFactory.png b/src/main/resources/assets/mekanism/gui/factory/guiadvancedfactory.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/factory/GuiAdvancedFactory.png rename to src/main/resources/assets/mekanism/gui/factory/guiadvancedfactory.png diff --git a/src/main/resources/assets/mekanism/gui/factory/GuiBasicFactory.png b/src/main/resources/assets/mekanism/gui/factory/guibasicfactory.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/factory/GuiBasicFactory.png rename to src/main/resources/assets/mekanism/gui/factory/guibasicfactory.png diff --git a/src/main/resources/assets/mekanism/gui/factory/GuiEliteFactory.png b/src/main/resources/assets/mekanism/gui/factory/guielitefactory.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/factory/GuiEliteFactory.png rename to src/main/resources/assets/mekanism/gui/factory/guielitefactory.png diff --git a/src/main/resources/assets/mekanism/gui/GuiAdvancedMachine.png b/src/main/resources/assets/mekanism/gui/guiadvancedmachine.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiAdvancedMachine.png rename to src/main/resources/assets/mekanism/gui/guiadvancedmachine.png diff --git a/src/main/resources/assets/mekanism/gui/GuiBasicMachine.png b/src/main/resources/assets/mekanism/gui/guibasicmachine.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiBasicMachine.png rename to src/main/resources/assets/mekanism/gui/guibasicmachine.png diff --git a/src/main/resources/assets/mekanism/gui/GuiBioGenerator.png b/src/main/resources/assets/mekanism/gui/guibiogenerator.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiBioGenerator.png rename to src/main/resources/assets/mekanism/gui/guibiogenerator.png diff --git a/src/main/resources/assets/mekanism/gui/GuiBlank.png b/src/main/resources/assets/mekanism/gui/guiblank.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiBlank.png rename to src/main/resources/assets/mekanism/gui/guiblank.png diff --git a/src/main/resources/assets/mekanism/gui/GuiBoilerStats.png b/src/main/resources/assets/mekanism/gui/guiboilerstats.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiBoilerStats.png rename to src/main/resources/assets/mekanism/gui/guiboilerstats.png diff --git a/src/main/resources/assets/mekanism/gui/GuiChemicalCrystallizer.png b/src/main/resources/assets/mekanism/gui/guichemicalcrystallizer.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiChemicalCrystallizer.png rename to src/main/resources/assets/mekanism/gui/guichemicalcrystallizer.png diff --git a/src/main/resources/assets/mekanism/gui/GuiChemicalDissolutionChamber.png b/src/main/resources/assets/mekanism/gui/guichemicaldissolutionchamber.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiChemicalDissolutionChamber.png rename to src/main/resources/assets/mekanism/gui/guichemicaldissolutionchamber.png diff --git a/src/main/resources/assets/mekanism/gui/GuiChemicalInfuser.png b/src/main/resources/assets/mekanism/gui/guichemicalinfuser.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiChemicalInfuser.png rename to src/main/resources/assets/mekanism/gui/guichemicalinfuser.png diff --git a/src/main/resources/assets/mekanism/gui/GuiChemicalOxidizer.png b/src/main/resources/assets/mekanism/gui/guichemicaloxidizer.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiChemicalOxidizer.png rename to src/main/resources/assets/mekanism/gui/guichemicaloxidizer.png diff --git a/src/main/resources/assets/mekanism/gui/GuiChemicalWasher.png b/src/main/resources/assets/mekanism/gui/guichemicalwasher.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiChemicalWasher.png rename to src/main/resources/assets/mekanism/gui/guichemicalwasher.png diff --git a/src/main/resources/assets/mekanism/gui/GuiConfiguration.png b/src/main/resources/assets/mekanism/gui/guiconfiguration.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiConfiguration.png rename to src/main/resources/assets/mekanism/gui/guiconfiguration.png diff --git a/src/main/resources/assets/mekanism/gui/GuiControlPanel.png b/src/main/resources/assets/mekanism/gui/guicontrolpanel.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiControlPanel.png rename to src/main/resources/assets/mekanism/gui/guicontrolpanel.png diff --git a/src/main/resources/assets/mekanism/gui/GuiDictionary.png b/src/main/resources/assets/mekanism/gui/guidictionary.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiDictionary.png rename to src/main/resources/assets/mekanism/gui/guidictionary.png diff --git a/src/main/resources/assets/mekanism/gui/GuiDigitalMiner.png b/src/main/resources/assets/mekanism/gui/guidigitalminer.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiDigitalMiner.png rename to src/main/resources/assets/mekanism/gui/guidigitalminer.png diff --git a/src/main/resources/assets/mekanism/gui/GuiDigitalMinerConfig.png b/src/main/resources/assets/mekanism/gui/guidigitalminerconfig.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiDigitalMinerConfig.png rename to src/main/resources/assets/mekanism/gui/guidigitalminerconfig.png diff --git a/src/main/resources/assets/mekanism/gui/GuiDigitalMinerConfig.xcf b/src/main/resources/assets/mekanism/gui/guidigitalminerconfig.xcf similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiDigitalMinerConfig.xcf rename to src/main/resources/assets/mekanism/gui/guidigitalminerconfig.xcf diff --git a/src/main/resources/assets/mekanism/gui/GuiDynamicTank.png b/src/main/resources/assets/mekanism/gui/guidynamictank.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiDynamicTank.png rename to src/main/resources/assets/mekanism/gui/guidynamictank.png diff --git a/src/main/resources/assets/mekanism/gui/GuiElectricChest.png b/src/main/resources/assets/mekanism/gui/guielectricchest.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiElectricChest.png rename to src/main/resources/assets/mekanism/gui/guielectricchest.png diff --git a/src/main/resources/assets/mekanism/gui/GuiElectricPump.png b/src/main/resources/assets/mekanism/gui/guielectricpump.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiElectricPump.png rename to src/main/resources/assets/mekanism/gui/guielectricpump.png diff --git a/src/main/resources/assets/mekanism/gui/GuiElectrolyticSeparator.png b/src/main/resources/assets/mekanism/gui/guielectrolyticseparator.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiElectrolyticSeparator.png rename to src/main/resources/assets/mekanism/gui/guielectrolyticseparator.png diff --git a/src/main/resources/assets/mekanism/gui/GuiEnergyCube.png b/src/main/resources/assets/mekanism/gui/guienergycube.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiEnergyCube.png rename to src/main/resources/assets/mekanism/gui/guienergycube.png diff --git a/src/main/resources/assets/mekanism/gui/GuiFilterSelect.png b/src/main/resources/assets/mekanism/gui/guifilterselect.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiFilterSelect.png rename to src/main/resources/assets/mekanism/gui/guifilterselect.png diff --git a/src/main/resources/assets/mekanism/gui/guiformulaicassemblicator.png b/src/main/resources/assets/mekanism/gui/guiformulaicassemblicator.png new file mode 100644 index 000000000..5664c28d2 Binary files /dev/null and b/src/main/resources/assets/mekanism/gui/guiformulaicassemblicator.png differ diff --git a/src/main/resources/assets/mekanism/gui/GuiFuelwoodHeater.png b/src/main/resources/assets/mekanism/gui/guifuelwoodheater.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiFuelwoodHeater.png rename to src/main/resources/assets/mekanism/gui/guifuelwoodheater.png diff --git a/src/main/resources/assets/mekanism/gui/GuiFullInv.png b/src/main/resources/assets/mekanism/gui/guifullinv.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiFullInv.png rename to src/main/resources/assets/mekanism/gui/guifullinv.png diff --git a/src/main/resources/assets/mekanism/gui/GuiGasGenerator.png b/src/main/resources/assets/mekanism/gui/guigasgenerator.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiGasGenerator.png rename to src/main/resources/assets/mekanism/gui/guigasgenerator.png diff --git a/src/main/resources/assets/mekanism/gui/GuiGasTank.png b/src/main/resources/assets/mekanism/gui/guigastank.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiGasTank.png rename to src/main/resources/assets/mekanism/gui/guigastank.png diff --git a/src/main/resources/assets/mekanism/gui/GuiHeatGenerator.png b/src/main/resources/assets/mekanism/gui/guiheatgenerator.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiHeatGenerator.png rename to src/main/resources/assets/mekanism/gui/guiheatgenerator.png diff --git a/src/main/resources/assets/mekanism/gui/GuiInductionMatrix.png b/src/main/resources/assets/mekanism/gui/guiinductionmatrix.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiInductionMatrix.png rename to src/main/resources/assets/mekanism/gui/guiinductionmatrix.png diff --git a/src/main/resources/assets/mekanism/gui/GuiIndustrialTurbine.png b/src/main/resources/assets/mekanism/gui/guiindustrialturbine.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiIndustrialTurbine.png rename to src/main/resources/assets/mekanism/gui/guiindustrialturbine.png diff --git a/src/main/resources/assets/mekanism/gui/GuiLogisticalSorter.png b/src/main/resources/assets/mekanism/gui/guilogisticalsorter.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiLogisticalSorter.png rename to src/main/resources/assets/mekanism/gui/guilogisticalsorter.png diff --git a/src/main/resources/assets/mekanism/gui/GuiLogisticalSorter.xcf b/src/main/resources/assets/mekanism/gui/guilogisticalsorter.xcf similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiLogisticalSorter.xcf rename to src/main/resources/assets/mekanism/gui/guilogisticalsorter.xcf diff --git a/src/main/resources/assets/mekanism/gui/GuiMatrixStats.png b/src/main/resources/assets/mekanism/gui/guimatrixstats.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiMatrixStats.png rename to src/main/resources/assets/mekanism/gui/guimatrixstats.png diff --git a/src/main/resources/assets/mekanism/gui/GuiMetallurgicInfuser.png b/src/main/resources/assets/mekanism/gui/guimetallurgicinfuser.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiMetallurgicInfuser.png rename to src/main/resources/assets/mekanism/gui/guimetallurgicinfuser.png diff --git a/src/main/resources/assets/mekanism/gui/GuiMItemStackFilter.png b/src/main/resources/assets/mekanism/gui/guimitemstackfilter.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiMItemStackFilter.png rename to src/main/resources/assets/mekanism/gui/guimitemstackfilter.png diff --git a/src/main/resources/assets/mekanism/gui/GuiMMaterialFilter.png b/src/main/resources/assets/mekanism/gui/guimmaterialfilter.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiMMaterialFilter.png rename to src/main/resources/assets/mekanism/gui/guimmaterialfilter.png diff --git a/src/main/resources/assets/mekanism/gui/GuiMModIDFilter.png b/src/main/resources/assets/mekanism/gui/guimmodidfilter.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiMModIDFilter.png rename to src/main/resources/assets/mekanism/gui/guimmodidfilter.png diff --git a/src/main/resources/assets/mekanism/gui/GuiMOreDictFilter.png b/src/main/resources/assets/mekanism/gui/guimoredictfilter.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiMOreDictFilter.png rename to src/main/resources/assets/mekanism/gui/guimoredictfilter.png diff --git a/src/main/resources/assets/mekanism/gui/GuiNull.png b/src/main/resources/assets/mekanism/gui/guinull.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiNull.png rename to src/main/resources/assets/mekanism/gui/guinull.png diff --git a/src/main/resources/assets/mekanism/gui/GuiOredictionificator.png b/src/main/resources/assets/mekanism/gui/guioredictionificator.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiOredictionificator.png rename to src/main/resources/assets/mekanism/gui/guioredictionificator.png diff --git a/src/main/resources/assets/mekanism/gui/GuiOredictionificatorFilter.png b/src/main/resources/assets/mekanism/gui/guioredictionificatorfilter.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiOredictionificatorFilter.png rename to src/main/resources/assets/mekanism/gui/guioredictionificatorfilter.png diff --git a/src/main/resources/assets/mekanism/gui/GuiPasswordEnter.png b/src/main/resources/assets/mekanism/gui/guipasswordenter.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiPasswordEnter.png rename to src/main/resources/assets/mekanism/gui/guipasswordenter.png diff --git a/src/main/resources/assets/mekanism/gui/GuiPasswordModify.png b/src/main/resources/assets/mekanism/gui/guipasswordmodify.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiPasswordModify.png rename to src/main/resources/assets/mekanism/gui/guipasswordmodify.png diff --git a/src/main/resources/assets/mekanism/gui/GuiPersonalChest.png b/src/main/resources/assets/mekanism/gui/guipersonalchest.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiPersonalChest.png rename to src/main/resources/assets/mekanism/gui/guipersonalchest.png diff --git a/src/main/resources/assets/mekanism/gui/GuiPortableTeleporter.png b/src/main/resources/assets/mekanism/gui/guiportableteleporter.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiPortableTeleporter.png rename to src/main/resources/assets/mekanism/gui/guiportableteleporter.png diff --git a/src/main/resources/assets/mekanism/gui/GuiReactorLogicAdapter.png b/src/main/resources/assets/mekanism/gui/guireactorlogicadapter.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiReactorLogicAdapter.png rename to src/main/resources/assets/mekanism/gui/guireactorlogicadapter.png diff --git a/src/main/resources/assets/mekanism/gui/GuiResistiveHeater.png b/src/main/resources/assets/mekanism/gui/guiresistiveheater.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiResistiveHeater.png rename to src/main/resources/assets/mekanism/gui/guiresistiveheater.png diff --git a/src/main/resources/assets/mekanism/gui/GuiRobitCrafting.png b/src/main/resources/assets/mekanism/gui/guirobitcrafting.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiRobitCrafting.png rename to src/main/resources/assets/mekanism/gui/guirobitcrafting.png diff --git a/src/main/resources/assets/mekanism/gui/GuiRobitInventory.png b/src/main/resources/assets/mekanism/gui/guirobitinventory.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiRobitInventory.png rename to src/main/resources/assets/mekanism/gui/guirobitinventory.png diff --git a/src/main/resources/assets/mekanism/gui/GuiRobitMain.png b/src/main/resources/assets/mekanism/gui/guirobitmain.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiRobitMain.png rename to src/main/resources/assets/mekanism/gui/guirobitmain.png diff --git a/src/main/resources/assets/mekanism/gui/GuiRobitRepair.png b/src/main/resources/assets/mekanism/gui/guirobitrepair.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiRobitRepair.png rename to src/main/resources/assets/mekanism/gui/guirobitrepair.png diff --git a/src/main/resources/assets/mekanism/gui/GuiRobitSmelting.png b/src/main/resources/assets/mekanism/gui/guirobitsmelting.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiRobitSmelting.png rename to src/main/resources/assets/mekanism/gui/guirobitsmelting.png diff --git a/src/main/resources/assets/mekanism/gui/GuiRotaryCondensentrator.png b/src/main/resources/assets/mekanism/gui/guirotarycondensentrator.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiRotaryCondensentrator.png rename to src/main/resources/assets/mekanism/gui/guirotarycondensentrator.png diff --git a/src/main/resources/assets/mekanism/gui/GuiSecurityDesk.png b/src/main/resources/assets/mekanism/gui/guisecuritydesk.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiSecurityDesk.png rename to src/main/resources/assets/mekanism/gui/guisecuritydesk.png diff --git a/src/main/resources/assets/mekanism/gui/GuiSeismicReader.png b/src/main/resources/assets/mekanism/gui/guiseismicreader.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiSeismicReader.png rename to src/main/resources/assets/mekanism/gui/guiseismicreader.png diff --git a/src/main/resources/assets/mekanism/gui/GuiSeismicVibrator.png b/src/main/resources/assets/mekanism/gui/guiseismicvibrator.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiSeismicVibrator.png rename to src/main/resources/assets/mekanism/gui/guiseismicvibrator.png diff --git a/src/main/resources/assets/mekanism/gui/GuiSolarEvaporationController.png b/src/main/resources/assets/mekanism/gui/guisolarevaporationcontroller.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiSolarEvaporationController.png rename to src/main/resources/assets/mekanism/gui/guisolarevaporationcontroller.png diff --git a/src/main/resources/assets/mekanism/gui/GuiSolarGenerator.png b/src/main/resources/assets/mekanism/gui/guisolargenerator.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiSolarGenerator.png rename to src/main/resources/assets/mekanism/gui/guisolargenerator.png diff --git a/src/main/resources/assets/mekanism/gui/GuiTall.png b/src/main/resources/assets/mekanism/gui/guitall.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiTall.png rename to src/main/resources/assets/mekanism/gui/guitall.png diff --git a/src/main/resources/assets/mekanism/gui/GuiTeleporter.png b/src/main/resources/assets/mekanism/gui/guiteleporter.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiTeleporter.png rename to src/main/resources/assets/mekanism/gui/guiteleporter.png diff --git a/src/main/resources/assets/mekanism/gui/GuiThermalEvaporationController.png b/src/main/resources/assets/mekanism/gui/guithermalevaporationcontroller.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiThermalEvaporationController.png rename to src/main/resources/assets/mekanism/gui/guithermalevaporationcontroller.png diff --git a/src/main/resources/assets/mekanism/gui/GuiThermoelectricBoiler.png b/src/main/resources/assets/mekanism/gui/guithermoelectricboiler.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiThermoelectricBoiler.png rename to src/main/resources/assets/mekanism/gui/guithermoelectricboiler.png diff --git a/src/main/resources/assets/mekanism/gui/guititemstackfilter.png b/src/main/resources/assets/mekanism/gui/guititemstackfilter.png new file mode 100644 index 000000000..99fe7c7ac Binary files /dev/null and b/src/main/resources/assets/mekanism/gui/guititemstackfilter.png differ diff --git a/src/main/resources/assets/mekanism/gui/guitmaterialfilter.png b/src/main/resources/assets/mekanism/gui/guitmaterialfilter.png new file mode 100644 index 000000000..372771132 Binary files /dev/null and b/src/main/resources/assets/mekanism/gui/guitmaterialfilter.png differ diff --git a/src/main/resources/assets/mekanism/gui/guitmodidfilter.png b/src/main/resources/assets/mekanism/gui/guitmodidfilter.png new file mode 100644 index 000000000..c467edd43 Binary files /dev/null and b/src/main/resources/assets/mekanism/gui/guitmodidfilter.png differ diff --git a/src/main/resources/assets/mekanism/gui/guitoredictfilter.png b/src/main/resources/assets/mekanism/gui/guitoredictfilter.png new file mode 100644 index 000000000..c467edd43 Binary files /dev/null and b/src/main/resources/assets/mekanism/gui/guitoredictfilter.png differ diff --git a/src/main/resources/assets/mekanism/gui/GuiTransporterConfig.png b/src/main/resources/assets/mekanism/gui/guitransporterconfig.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiTransporterConfig.png rename to src/main/resources/assets/mekanism/gui/guitransporterconfig.png diff --git a/src/main/resources/assets/mekanism/gui/GuiUpgradeManagement.png b/src/main/resources/assets/mekanism/gui/guiupgrademanagement.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiUpgradeManagement.png rename to src/main/resources/assets/mekanism/gui/guiupgrademanagement.png diff --git a/src/main/resources/assets/mekanism/gui/GuiWindTurbine.png b/src/main/resources/assets/mekanism/gui/guiwindturbine.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/GuiWindTurbine.png rename to src/main/resources/assets/mekanism/gui/guiwindturbine.png diff --git a/src/main/resources/assets/mekanism/gui/nei/GuiChemicalCrystallizer.png b/src/main/resources/assets/mekanism/gui/nei/guichemicalcrystallizer.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/nei/GuiChemicalCrystallizer.png rename to src/main/resources/assets/mekanism/gui/nei/guichemicalcrystallizer.png diff --git a/src/main/resources/assets/mekanism/gui/nei/GuiChemicalDissolutionChamber.png b/src/main/resources/assets/mekanism/gui/nei/guichemicaldissolutionchamber.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/nei/GuiChemicalDissolutionChamber.png rename to src/main/resources/assets/mekanism/gui/nei/guichemicaldissolutionchamber.png diff --git a/src/main/resources/assets/mekanism/gui/nei/GuiChemicalInfuser.png b/src/main/resources/assets/mekanism/gui/nei/guichemicalinfuser.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/nei/GuiChemicalInfuser.png rename to src/main/resources/assets/mekanism/gui/nei/guichemicalinfuser.png diff --git a/src/main/resources/assets/mekanism/gui/nei/GuiChemicalWasher.png b/src/main/resources/assets/mekanism/gui/nei/guichemicalwasher.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/nei/GuiChemicalWasher.png rename to src/main/resources/assets/mekanism/gui/nei/guichemicalwasher.png diff --git a/src/main/resources/assets/mekanism/gui/nei/GuiPRC.png b/src/main/resources/assets/mekanism/gui/nei/guiprc.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/nei/GuiPRC.png rename to src/main/resources/assets/mekanism/gui/nei/guiprc.png diff --git a/src/main/resources/assets/mekanism/gui/nei/GuiRotaryCondensentrator.png b/src/main/resources/assets/mekanism/gui/nei/guirotarycondensentrator.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/nei/GuiRotaryCondensentrator.png rename to src/main/resources/assets/mekanism/gui/nei/guirotarycondensentrator.png diff --git a/src/main/resources/assets/mekanism/gui/nei/GuiSalinationController.png b/src/main/resources/assets/mekanism/gui/nei/guisalinationcontroller.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/nei/GuiSalinationController.png rename to src/main/resources/assets/mekanism/gui/nei/guisalinationcontroller.png diff --git a/src/main/resources/assets/mekanism/gui/nei/GuiSolarEvaporationController.png b/src/main/resources/assets/mekanism/gui/nei/guisolarevaporationcontroller.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/nei/GuiSolarEvaporationController.png rename to src/main/resources/assets/mekanism/gui/nei/guisolarevaporationcontroller.png diff --git a/src/main/resources/assets/mekanism/gui/nei/GuiSolarNeutronActivator.png b/src/main/resources/assets/mekanism/gui/nei/guisolarneutronactivator.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/nei/GuiSolarNeutronActivator.png rename to src/main/resources/assets/mekanism/gui/nei/guisolarneutronactivator.png diff --git a/src/main/resources/assets/mekanism/gui/nei/GuiThermalEvaporationController.png b/src/main/resources/assets/mekanism/gui/nei/guithermalevaporationcontroller.png similarity index 100% rename from src/main/resources/assets/mekanism/gui/nei/GuiThermalEvaporationController.png rename to src/main/resources/assets/mekanism/gui/nei/guithermalevaporationcontroller.png diff --git a/src/main/resources/assets/mekanism/lang/cs_CZ.lang b/src/main/resources/assets/mekanism/lang/cs_cz.lang similarity index 100% rename from src/main/resources/assets/mekanism/lang/cs_CZ.lang rename to src/main/resources/assets/mekanism/lang/cs_cz.lang diff --git a/src/main/resources/assets/mekanism/lang/da_DK.lang b/src/main/resources/assets/mekanism/lang/da_dk.lang similarity index 100% rename from src/main/resources/assets/mekanism/lang/da_DK.lang rename to src/main/resources/assets/mekanism/lang/da_dk.lang diff --git a/src/main/resources/assets/mekanism/lang/de_DE.lang b/src/main/resources/assets/mekanism/lang/de_de.lang similarity index 100% rename from src/main/resources/assets/mekanism/lang/de_DE.lang rename to src/main/resources/assets/mekanism/lang/de_de.lang diff --git a/src/main/resources/assets/mekanism/lang/en_GB.lang b/src/main/resources/assets/mekanism/lang/en_gb.lang similarity index 100% rename from src/main/resources/assets/mekanism/lang/en_GB.lang rename to src/main/resources/assets/mekanism/lang/en_gb.lang diff --git a/src/main/resources/assets/mekanism/lang/en_US.lang b/src/main/resources/assets/mekanism/lang/en_us.lang similarity index 92% rename from src/main/resources/assets/mekanism/lang/en_US.lang rename to src/main/resources/assets/mekanism/lang/en_us.lang index 1d3d02e30..3fbb0ccec 100644 --- a/src/main/resources/assets/mekanism/lang/en_US.lang +++ b/src/main/resources/assets/mekanism/lang/en_us.lang @@ -187,31 +187,31 @@ tile.OreBlock.CopperOre.name=Copper Ore tile.OreBlock.TinOre.name=Tin Ore //Transmitters -item.MultipartTransmitter.BasicPressurizedTube.name=Basic Pressurized Tube -item.MultipartTransmitter.AdvancedPressurizedTube.name=Advanced Pressurized Tube -item.MultipartTransmitter.ElitePressurizedTube.name=Elite Pressurized Tube -item.MultipartTransmitter.UltimatePressurizedTube.name=Ultimate Pressurized Tube -item.MultipartTransmitter.BasicUniversalCable.name=Basic Universal Cable -item.MultipartTransmitter.AdvancedUniversalCable.name=Advanced Universal Cable -item.MultipartTransmitter.EliteUniversalCable.name=Elite Universal Cable -item.MultipartTransmitter.UltimateUniversalCable.name=Ultimate Universal Cable -item.MultipartTransmitter.BasicMechanicalPipe.name=Basic Mechanical Pipe -item.MultipartTransmitter.AdvancedMechanicalPipe.name=Advanced Mechanical Pipe -item.MultipartTransmitter.EliteMechanicalPipe.name=Elite Mechanical Pipe -item.MultipartTransmitter.UltimateMechanicalPipe.name=Ultimate Mechanical Pipe -item.MultipartTransmitter.BasicLogisticalTransporter.name=Basic Logistical Transporter -item.MultipartTransmitter.AdvancedLogisticalTransporter.name=Advanced Logistical Transporter -item.MultipartTransmitter.EliteLogisticalTransporter.name=Elite Logistical Transporter -item.MultipartTransmitter.UltimateLogisticalTransporter.name=Ultimate Logistical Transporter -item.MultipartTransmitter.RestrictiveTransporter.name=Restrictive Transporter -item.MultipartTransmitter.DiversionTransporter.name=Diversion Transporter -item.MultipartTransmitter.BasicThermodynamicConductor.name=Basic Thermodynamic Conductor -item.MultipartTransmitter.AdvancedThermodynamicConductor.name=Advanced Thermodynamic Conductor -item.MultipartTransmitter.EliteThermodynamicConductor.name=Elite Thermodynamic Conductor -item.MultipartTransmitter.UltimateThermodynamicConductor.name=Ultimate Thermodynamic Conductor +tile.Transmitter.BasicPressurizedTube.name=Basic Pressurized Tube +tile.Transmitter.AdvancedPressurizedTube.name=Advanced Pressurized Tube +tile.Transmitter.ElitePressurizedTube.name=Elite Pressurized Tube +tile.Transmitter.UltimatePressurizedTube.name=Ultimate Pressurized Tube +tile.Transmitter.BasicUniversalCable.name=Basic Universal Cable +tile.Transmitter.AdvancedUniversalCable.name=Advanced Universal Cable +tile.Transmitter.EliteUniversalCable.name=Elite Universal Cable +tile.Transmitter.UltimateUniversalCable.name=Ultimate Universal Cable +tile.Transmitter.BasicMechanicalPipe.name=Basic Mechanical Pipe +tile.Transmitter.AdvancedMechanicalPipe.name=Advanced Mechanical Pipe +tile.Transmitter.EliteMechanicalPipe.name=Elite Mechanical Pipe +tile.Transmitter.UltimateMechanicalPipe.name=Ultimate Mechanical Pipe +tile.Transmitter.BasicLogisticalTransporter.name=Basic Logistical Transporter +tile.Transmitter.AdvancedLogisticalTransporter.name=Advanced Logistical Transporter +tile.Transmitter.EliteLogisticalTransporter.name=Elite Logistical Transporter +tile.Transmitter.UltimateLogisticalTransporter.name=Ultimate Logistical Transporter +tile.Transmitter.RestrictiveTransporter.name=Restrictive Transporter +tile.Transmitter.DiversionTransporter.name=Diversion Transporter +tile.Transmitter.BasicThermodynamicConductor.name=Basic Thermodynamic Conductor +tile.Transmitter.AdvancedThermodynamicConductor.name=Advanced Thermodynamic Conductor +tile.Transmitter.EliteThermodynamicConductor.name=Elite Thermodynamic Conductor +tile.Transmitter.UltimateThermodynamicConductor.name=Ultimate Thermodynamic Conductor //Glow Panel -item.GlowPanel.name=Glow Panel +tile.GlowPanel.name=Glow Panel //Energy Cubes tile.EnergyCubeBasic.name=Basic Energy Cube @@ -291,19 +291,19 @@ gas.hydrogen=Hydrogen gas.oxygen=Oxygen gas.water=Water Vapor gas.chlorine=Chlorine -gas.sulfurDioxideGas=Sulfur Dioxide -gas.sulfurTrioxideGas=Sulfur Trioxide -gas.sulfuricAcid=Sulfuric Acid -gas.hydrogenChloride=Hydrogen Chloride -gas.liquidOsmium=Liquid Osmium -gas.liquidStone=Liquid Stone +gas.sulfurdioxide=Sulfur Dioxide +gas.sulfurtrioxide=Sulfur Trioxide +gas.sulfuricacid=Sulfuric Acid +gas.hydrogenchloride=Hydrogen Chloride +gas.liquidosmium=Liquid Osmium +gas.liquidstone=Liquid Stone gas.ethene=Ethylene gas.sodium=Sodium gas.brine=Gaseous Brine gas.deuterium=Deuterium gas.tritium=Tritium gas.lithium=Lithium -gas.fusionFuelDT=D-T Fuel +gas.fusionfuel=D-T Fuel gas.iron=Iron Slurry gas.gold=Gold Slurry @@ -328,21 +328,21 @@ gas.fuel=Vaporized Fuel gas.oil=Vaporized Oil //Fluids -fluid.hydrogen=Liquid Hydrogen -fluid.oxygen=Liquid Oxygen -fluid.chlorine=Liquid Chlorine -fluid.sulfurDioxideGas=Liquid Sulfur Dioxide -fluid.sulfurTrioxideGas=Liquid Sulfur Trioxide -fluid.sulfuricAcid=Liquid Sulfuric Acid -fluid.hydrogenChloride=Liquid Hydrogen Chloride +fluid.liquidhydrogen=Liquid Hydrogen +fluid.liquidoxygen=Liquid Oxygen +fluid.liquidchlorine=Liquid Chlorine +fluid.liquidsulfurdioxide=Liquid Sulfur Dioxide +fluid.liquidsulfurtrioxide=Liquid Sulfur Trioxide +fluid.sulfuricacid=Sulfuric Acid +fluid.liquidhydrogenchloride=Liquid Hydrogen Chloride fluid.brine=Brine -fluid.ethene=Liquid Ethylene -fluid.sodium=Liquid Sodium -fluid.heavyWater=Heavy Water -fluid.lithium=Liquid Lithium -fluid.deuterium=Liquid Deuterium -fluid.tritium=Liquid Tritium -fluid.fusionFuelDT=Liquid D-T Fuel +fluid.liquidethene=Liquid Ethylene +fluid.liquidsodium=Liquid Sodium +fluid.heavywater=Heavy Water +fluid.liquidlithium=Liquid Lithium +fluid.liquiddeuterium=Liquid Deuterium +fluid.liquidtritium=Liquid Tritium +fluid.liquidfusionfuel=Liquid D-T Fuel fluid.steam=Steam //OreGas names @@ -401,7 +401,7 @@ entity.Mekanism.Robit.name=Robit entity.Mekanism.BabySkeleton.name=Baby Skeleton //Config Gui -mekanism.configgui.ctgy.general=Mekanism General Settings +mekanism.configgui.ctgy.general=General Settings mekanism.configgui.ctgy.machines=Machine Settings mekanism.configgui.ctgy.tier=Tier Settings mekanism.configgui.ctgy.usage=Usage Settings @@ -544,7 +544,7 @@ gui.heatTransfer=Heat Transfer gui.superheaters=Superheaters gui.boilCapacity=Boil Capacity gui.encodeFormula=Encode Formula -gui.autoModeToggle=Turn Auto-Mode +gui.autoModeToggle=Auto-Mode gui.craftSingle=Craft Single Item gui.craftAvailable=Craft Available Items gui.fillEmpty=Fill/Empty Grid @@ -566,6 +566,9 @@ gui.entityDetection=Entity Detection gui.energyContents=Energy Contents gui.redstoneOutput=Redstone Output gui.maxWaterOutput=Max Water Output +gui.stockControl=Stock Control +gui.allowDefault=Allow Default +gui.sizeMode=Size Mode gui.reactor.injectionRate=Injection Rate @@ -760,6 +763,9 @@ tooltip.itemAmount=Item amount tooltip.invalid=Invalid tooltip.encoded=Encoded tooltip.ingredients=Ingredients +tooltip.conduction=Conduction +tooltip.insulation=Insulation +tooltip.heatCapacity=Heat Capacity tooltip.portableTank.bucketMode=Bucket Mode @@ -1004,6 +1010,16 @@ gui.maxCasing=Max. Casing Temp gui.passiveGeneration=Passive Generation gui.steamProduction=Steam Production +//Config Gui +mekanism.configgui.ctgy.generators.general=General Settings +mekanism.configgui.ctgy.generators.generators=Generator Settings +mekanism.configgui.ctgy.generators.generation=Generation Settings + +//Config Tooltips +mekanism.configgui.ctgy.generators.general.tooltip=Settings regarding MekanismGenerators' general configuration +mekanism.configgui.ctgy.generators.generators.tooltip=Settings regarding enabling and disabling of specific generators +mekanism.configgui.ctgy.generators.generation.tooltip=Settings regarding the energy usage of generators + //*****// //TOOLS// //*****// @@ -1027,18 +1043,6 @@ item.ObsidianShovel.name=Obsidian Shovel item.ObsidianHoe.name=Obsidian Hoe item.ObsidianSword.name=Obsidian Sword -//Lapis Lazuli -item.LazuliHelmet.name=Lapis Lazuli Helmet -item.LazuliChestplate.name=Lapis Lazuli Chestplate -item.LazuliLeggings.name=Lapis Lazuli Leggings -item.LazuliBoots.name=Lapis Lazuli Boots -item.LazuliPaxel.name=Lapis Lazuli Paxel -item.LazuliPickaxe.name=Lapis Lazuli Pickaxe -item.LazuliAxe.name=Lapis Lazuli Axe -item.LazuliShovel.name=Lapis Lazuli Shovel -item.LazuliHoe.name=Lapis Lazuli Hoe -item.LazuliSword.name=Lapis Lazuli Sword - //Osmium item.OsmiumHelmet.name=Osmium Helmet item.OsmiumChestplate.name=Osmium Chestplate @@ -1095,12 +1099,12 @@ item.LapisLazuliBoots.name=Lapis Lazuli Boots item.LapisLazuliPaxel.name=Lapis Lazuli Paxel item.LapisLazuliPickaxe.name=Lapis Lazuli Pickaxe item.LapisLazuliAxe.name=Lapis Lazuli Axe -item.LapisLazliShovel.name=Lapis Lazuli Shovel +item.LapisLazuliShovel.name=Lapis Lazuli Shovel item.LapisLazuliHoe.name=Lapis Lazuli Hoe item.LapisLazuliSword.name=Lapis Lazuli Sword //Config Gui -mekanism.configgui.ctgy.tools.general=General +mekanism.configgui.ctgy.tools.general=General Settings mekanism.configgui.ctgy.tools.armor=Armor Balance mekanism.configgui.ctgy.tools.tools=Tools Balance diff --git a/src/main/resources/assets/mekanism/lang/en_ZA.lang b/src/main/resources/assets/mekanism/lang/en_za.lang similarity index 100% rename from src/main/resources/assets/mekanism/lang/en_ZA.lang rename to src/main/resources/assets/mekanism/lang/en_za.lang diff --git a/src/main/resources/assets/mekanism/lang/fr_FR.lang b/src/main/resources/assets/mekanism/lang/fr_fr.lang similarity index 100% rename from src/main/resources/assets/mekanism/lang/fr_FR.lang rename to src/main/resources/assets/mekanism/lang/fr_fr.lang diff --git a/src/main/resources/assets/mekanism/lang/it_IT.lang b/src/main/resources/assets/mekanism/lang/it_it.lang similarity index 100% rename from src/main/resources/assets/mekanism/lang/it_IT.lang rename to src/main/resources/assets/mekanism/lang/it_it.lang diff --git a/src/main/resources/assets/mekanism/lang/ja_JP.lang b/src/main/resources/assets/mekanism/lang/ja_jp.lang similarity index 100% rename from src/main/resources/assets/mekanism/lang/ja_JP.lang rename to src/main/resources/assets/mekanism/lang/ja_jp.lang diff --git a/src/main/resources/assets/mekanism/lang/ko_KR.lang b/src/main/resources/assets/mekanism/lang/ko_kr.lang similarity index 100% rename from src/main/resources/assets/mekanism/lang/ko_KR.lang rename to src/main/resources/assets/mekanism/lang/ko_kr.lang diff --git a/src/main/resources/assets/mekanism/lang/no_NO.lang b/src/main/resources/assets/mekanism/lang/no_no.lang similarity index 100% rename from src/main/resources/assets/mekanism/lang/no_NO.lang rename to src/main/resources/assets/mekanism/lang/no_no.lang diff --git a/src/main/resources/assets/mekanism/lang/pl_PL.lang b/src/main/resources/assets/mekanism/lang/pl_pl.lang similarity index 100% rename from src/main/resources/assets/mekanism/lang/pl_PL.lang rename to src/main/resources/assets/mekanism/lang/pl_pl.lang diff --git a/src/main/resources/assets/mekanism/lang/pt_BR.lang b/src/main/resources/assets/mekanism/lang/pt_br.lang similarity index 100% rename from src/main/resources/assets/mekanism/lang/pt_BR.lang rename to src/main/resources/assets/mekanism/lang/pt_br.lang diff --git a/src/main/resources/assets/mekanism/lang/pt_PT.lang b/src/main/resources/assets/mekanism/lang/pt_pt.lang similarity index 100% rename from src/main/resources/assets/mekanism/lang/pt_PT.lang rename to src/main/resources/assets/mekanism/lang/pt_pt.lang diff --git a/src/main/resources/assets/mekanism/lang/ru_RU.lang b/src/main/resources/assets/mekanism/lang/ru_ru.lang similarity index 77% rename from src/main/resources/assets/mekanism/lang/ru_RU.lang rename to src/main/resources/assets/mekanism/lang/ru_ru.lang index 6258e9f6b..69f6638c2 100644 --- a/src/main/resources/assets/mekanism/lang/ru_RU.lang +++ b/src/main/resources/assets/mekanism/lang/ru_ru.lang @@ -1,4 +1,4 @@ -//********// +//********// //MEKANISM// //********// @@ -8,20 +8,21 @@ item.EnrichedAlloy.name=Обогащённый сплав item.ReinforcedAlloy.name=Укреплённый сплав item.AtomicAlloy.name=Атомный сплав item.EnergyTablet.name=Энергетический планшет -item.SpeedUpgrade.name=Улучшение: «Скорость» -item.EnergyUpgrade.name=Улучшение: «Энергия» -item.FilterUpgrade.name=Улучшение: «Фильтр» -item.GasUpgrade.name=Улучшение: «Газ» -item.MufflingUpgrade.name=Улучшение: «Затишье» +item.SpeedUpgrade.name=Улучшение: Скорость +item.EnergyUpgrade.name=Улучшение: Энергия +item.FilterUpgrade.name=Улучшение: Фильтр +item.MufflingUpgrade.name=Улучшение: Шум +item.GasUpgrade.name=Улучшение: Газ +item.AnchorUpgrade.name=Улучшение: Якорь item.Robit.name=Робит item.AtomicDisassembler.name=Атомный разборщик item.ElectricBow.name=Электрический лук item.EnrichedIron.name=Обогащённое железо item.CompressedCarbon.name=Сжатый уголь -item.CompressedRedstone.name=Сжатый красный камень +item.CompressedRedstone.name=Сжатый редстоун item.CompressedDiamond.name=Сжатый алмаз item.CompressedObsidian.name=Сжатый обсидиан -item.PortableTeleporter.name=Переносной телепортер +item.PortableTeleporter.name=Переносной телепорт item.TeleportationCore.name=Ядро телепортации item.Configurator.name=Конфигуратор item.NetworkReader.name=Считыватель сети @@ -33,16 +34,16 @@ item.Dictionary.name=Словарь item.ElectrolyticCore.name=Электролитическое ядро item.Sawdust.name=Опилки item.Salt.name=Соль -item.BrineBucket.name=Ведро рапы +item.BrineBucket.name=Ведро рассола item.LithiumBucket.name=Ведро лития item.HeavyWaterBucket.name=Ведро тяжелой воды item.FreeRunners.name=Свободные бегунки item.ArmoredJetpack.name=Бронированный реактивный ранец item.ConfigurationCard.name=Карта настройки item.SeismicReader.name=Сейсмический считыватель -item.HDPEPellet.name=Шарик полиэтилена НД -item.HDPERod.name=Стержень полиэтилена НД -item.HDPESheet.name=Лист полиэтилена НД +item.HDPEPellet.name=Полиэтилен +item.HDPERod.name=Полиэтиленовый стержень +item.HDPESheet.name=Полиэтиленовый лист item.PlaStick.name=Пластиковая палка item.Substrate.name=Субстрат item.Flamethrower.name=Огнемёт @@ -61,12 +62,14 @@ tile.GasTankBasic.name=Базовый газовый баллон tile.GasTankAdvanced.name=Продвинутый газовый баллон tile.GasTankElite.name=Элитный газовый баллон tile.GasTankUltimate.name=Совершенный газовый баллон +tile.GasTankCreative.name=Творческий газовый баллон //Fluid Tank (part of MachineBlock2, naming handled differently) tile.FluidTankBasic.name=Базовый жидкостный бак tile.FluidTankAdvanced.name=Продвинутый жидкостный бак tile.FluidTankElite.name=Элитный жидкостный бак tile.FluidTankUltimate.name=Совершенный жидкостный бак +tile.FluidTankCreative.name=Творческий жидкостный бак //Cardboard Box tile.CardboardBox.name=Картонная коробка @@ -82,12 +85,13 @@ tile.BasicBlock.OsmiumBlock.name=Осмиевый блок tile.BasicBlock.BronzeBlock.name=Бронзовый блок tile.BasicBlock.RefinedObsidian.name=Очищенный обсидиан tile.BasicBlock.CharcoalBlock.name=Древесноугольный блок -tile.BasicBlock.RefinedGlowstone.name=Очищенный светящийся камень +tile.BasicBlock.RefinedGlowstone.name=Очищенный светокамень tile.BasicBlock.SteelBlock.name=Стальной блок tile.BasicBlock.BinBasic.name=Основной ящик tile.BasicBlock.BinAdvanced.name=Продвинутый ящик tile.BasicBlock.BinElite.name=Элитный ящик tile.BasicBlock.BinUltimate.name=Совершенный ящик +tile.BasicBlock.BinCreative.name=Творческий ящик tile.BasicBlock.TeleporterFrame.name=Каркас телепорта tile.BasicBlock.SteelCasing.name=Стальной корпус tile.BasicBlock.DynamicTank.name=Динамический резервуар @@ -99,19 +103,19 @@ tile.BasicBlock.ThermalEvaporationController.name=Контроллер тепл tile.BasicBlock.ThermalEvaporationValve.name=Вентиль теплового испарителя //Basic Block 2 (second ID iteration) -tile.BasicBlock2.ThermalEvaporationBlock.name=Блок теплового испарителя +tile.BasicBlock2.ThermalEvaporationBlock.name=Тепловой испаритель tile.BasicBlock2.InductionCasing.name=Индукционный корпус tile.BasicBlock2.InductionPort.name=Индукционный порт tile.BasicBlock2.InductionCellBasic.name=Базовая индукционная ячейка tile.BasicBlock2.InductionCellAdvanced.name=Продвинутая индукционная ячейка tile.BasicBlock2.InductionCellElite.name=Элитная индукционная ячейка -tile.BasicBlock2.InductionCellUltimate.name=Максимальная индукционная ячейка +tile.BasicBlock2.InductionCellUltimate.name=Совершенная индукционная ячейка tile.BasicBlock2.InductionProviderBasic.name=Базовый индукционный поставщик tile.BasicBlock2.InductionProviderAdvanced.name=Продвинутый индукционный поставщик tile.BasicBlock2.InductionProviderElite.name=Элитный индукционный поставщик -tile.BasicBlock2.InductionProviderUltimate.name=Максимальный индукционный поставщик +tile.BasicBlock2.InductionProviderUltimate.name=Совершенный индукционный поставщик tile.BasicBlock2.SuperheatingElement.name=Сверхмощный нагревательный элемент -tile.BasicBlock2.PressureDisperser.name=Распылитель давления +tile.BasicBlock2.PressureDisperser.name=Рассеиватель давления tile.BasicBlock2.BoilerCasing.name=Обшивка бойлера tile.BasicBlock2.BoilerValve.name=Вентиль бойлера tile.BasicBlock2.SecurityDesk.name=Защитный блок @@ -121,14 +125,14 @@ tile.MachineBlock.EnrichmentChamber.name=Камера обогащения tile.MachineBlock.OsmiumCompressor.name=Осмиевый компрессор tile.MachineBlock.Combiner.name=Объединитель tile.MachineBlock.Crusher.name=Дробитель -tile.MachineBlock.Factory.name=Фабрика +tile.MachineBlock.Factory.name=Механизм tile.MachineBlock.MetallurgicInfuser.name=Металлургический наполнитель tile.MachineBlock.PurificationChamber.name=Камера очистки tile.MachineBlock.EnergizedSmelter.name=Энергетическая плавильня tile.MachineBlock.Teleporter.name=Телепорт tile.MachineBlock.ElectricPump.name=Электрическая помпа -tile.MachineBlock.ElectricChest.name=Электрический сундук -tile.MachineBlock.Chargepad.name=Заряжающая панель +tile.MachineBlock.PersonalChest.name=Электрический сундук +tile.MachineBlock.Chargepad.name=Зарядник tile.MachineBlock.LogisticalSorter.name=Логистический сортировщик tile.MachineBlock.DigitalMiner.name=Цифровой шахтёр @@ -172,7 +176,7 @@ tile.PlasticFence.name=Пластиковый забор infuse.carbon=Углерод infuse.tin=Олово infuse.diamond=Алмаз -infuse.redstone=Красный камень +infuse.redstone=Редстоун infuse.fungi=Грибок infuse.obsidian=Обсидиан infuse.bio=Биомасса @@ -183,31 +187,31 @@ tile.OreBlock.CopperOre.name=Медная руда tile.OreBlock.TinOre.name=Оловянная руда //Transmitters -item.MultipartTransmitter.BasicPressurizedTube.name=Базовая герметичная труба -item.MultipartTransmitter.AdvancedPressurizedTube.name=Продвинутая герметичная труба -item.MultipartTransmitter.ElitePressurizedTube.name=Элитная герметичная труба -item.MultipartTransmitter.UltimatePressurizedTube.name=Совершенная герметичная труба -item.MultipartTransmitter.BasicUniversalCable.name=Базовый универсальный провод -item.MultipartTransmitter.AdvancedUniversalCable.name=Продвинутый универсальный провод -item.MultipartTransmitter.EliteUniversalCable.name=Элитный универсальный провод -item.MultipartTransmitter.UltimateUniversalCable.name=Совершенный универсальный провод -item.MultipartTransmitter.BasicMechanicalPipe.name=Базовая механическая труба -item.MultipartTransmitter.AdvancedMechanicalPipe.name=Продвинутая механическая труба -item.MultipartTransmitter.EliteMechanicalPipe.name=Элитная механическая труба -item.MultipartTransmitter.UltimateMechanicalPipe.name=Совершенная механическая труба -item.MultipartTransmitter.BasicLogisticalTransporter.name=Базовый логистический транспортер -item.MultipartTransmitter.AdvancedLogisticalTransporter.name=Продвинутый логистический транспортер -item.MultipartTransmitter.EliteLogisticalTransporter.name=Элитный логистический транспортер -item.MultipartTransmitter.UltimateLogisticalTransporter.name=Совершенный логистический транспортер -item.MultipartTransmitter.RestrictiveTransporter.name=Ограничительный транспортер -item.MultipartTransmitter.DiversionTransporter.name=Отклоняющий транспортер -item.MultipartTransmitter.BasicThermodynamicConductor.name=Базовый теплопровод -item.MultipartTransmitter.AdvancedThermodynamicConductor.name=Продвинутый теплопровод -item.MultipartTransmitter.EliteThermodynamicConductor.name=Элитный теплопровод -item.MultipartTransmitter.UltimateThermodynamicConductor.name=Совершенный теплопровод +tile.Transmitter.BasicPressurizedTube.name=Базовая герметичная труба +tile.Transmitter.AdvancedPressurizedTube.name=Продвинутая герметичная труба +tile.Transmitter.ElitePressurizedTube.name=Элитная герметичная труба +tile.Transmitter.UltimatePressurizedTube.name=Совершенная герметичная труба +tile.Transmitter.BasicUniversalCable.name=Базовый универсальный провод +tile.Transmitter.AdvancedUniversalCable.name=Продвинутый универсальный провод +tile.Transmitter.EliteUniversalCable.name=Элитный универсальный провод +tile.Transmitter.UltimateUniversalCable.name=Совершенный универсальный провод +tile.Transmitter.BasicMechanicalPipe.name=Базовая механическая труба +tile.Transmitter.AdvancedMechanicalPipe.name=Продвинутая механическая труба +tile.Transmitter.EliteMechanicalPipe.name=Элитная механическая труба +tile.Transmitter.UltimateMechanicalPipe.name=Совершенная механическая труба +tile.Transmitter.BasicLogisticalTransporter.name=Базовый логистический транспортер +tile.Transmitter.AdvancedLogisticalTransporter.name=Продвинутый логистический транспортер +tile.Transmitter.EliteLogisticalTransporter.name=Элитный логистический транспортер +tile.Transmitter.UltimateLogisticalTransporter.name=Совершенный логистический транспортер +tile.Transmitter.RestrictiveTransporter.name=Ограничительный транспортер +tile.Transmitter.DiversionTransporter.name=Отклоняющий транспортер +tile.Transmitter.BasicThermodynamicConductor.name=Базовый теплопровод +tile.Transmitter.AdvancedThermodynamicConductor.name=Продвинутый теплопровод +tile.Transmitter.EliteThermodynamicConductor.name=Элитный теплопровод +tile.Transmitter.UltimateThermodynamicConductor.name=Совершенный теплопровод //Glow Panel -item.GlowPanel.name=Cветящийся полублок +tile.GlowPanel.name=Cветящийся полублок //Energy Cubes tile.EnergyCubeBasic.name=Основной энергетический куб @@ -216,10 +220,11 @@ tile.EnergyCubeElite.name=Элитный энергетический куб tile.EnergyCubeUltimate.name=Совершенный энергетический куб tile.EnergyCubeCreative.name=Творческий энергетический куб -//Factory Installers -item.basicFactoryInstaller.name=Основной установщик фабрик -item.advancedFactoryInstaller.name=Продвинутый установщик фабрик -item.eliteFactoryInstaller.name=Элитный установщик фабрик +//Tier Installers +item.basicTierInstaller.name=Установщик основного уровня +item.advancedTierInstaller.name=Установщик продвинутого уровня +item.eliteTierInstaller.name=Установщик элитного уровня +item.ultimateTierInstaller.name=Установщик совершенного уровня //Dust item.ironDust.name=Железная пыль @@ -276,7 +281,7 @@ item.dirtyLeadDust.name=Загрязненная свинцовая пыль item.obsidianIngot.name=Обсидиановый слиток item.osmiumIngot.name=Осмиевый слиток item.bronzeIngot.name=Бронзовый слиток -item.glowstoneIngot.name=Слиток светящегося камня +item.glowstoneIngot.name=Светокаменный слиток item.steelIngot.name=Стальной слиток item.copperIngot.name=Медный слиток item.tinIngot.name=Оловянный слиток @@ -286,58 +291,58 @@ gas.hydrogen=Водород gas.oxygen=Кислород gas.water=Водяной пар gas.chlorine=Хлор -gas.sulfurDioxideGas=Диоксид серы -gas.sulfurTrioxideGas=Триоксид серы -gas.sulfuricAcid=Серная кислота -gas.hydrogenChloride=Хлороводород -gas.liquidOsmium=Жидкий осмий -gas.liquidStone=Разжиженный камень +gas.sulfurdioxide=Диоксид серы +gas.sulfurtrioxide=Триоксид серы +gas.sulfuricacid=Серная кислота +gas.hydrogenchloride=Хлороводород +gas.liquidosmium=Жидкий осмий +gas.liquidstone=Разжиженный камень gas.ethene=Этилен gas.sodium=Натрий -gas.brine=Газообразная рапа +gas.brine=Газообразный рассол gas.deuterium=Дейтерий gas.tritium=Тритий gas.lithium=Литий -gas.fusionFuelDT=Дейтерий-тритиевое топливо +gas.fusionfuel=Д-Т топливо -gas.iron=Сульфат железа -gas.gold=Сульфат золота -gas.osmium=Сульфат осмия -gas.copper=Сульфат меди -gas.tin=Сульфат олова -gas.silver=Сульфат серебра -gas.obsidian=Серный раствор обсидиана -gas.lead=Сульфат свинца +gas.iron=Взвесь железа +gas.gold=Взвесь золота +gas.osmium=Взвесь осмия +gas.copper=Взвесь меди +gas.tin=Взвесь олова +gas.silver=Взвесь серебра +gas.obsidian=Взвесь обсидиана +gas.lead=Взвесь свинца -gas.cleanIron=Очищенный сульфат железа -gas.cleanGold=Очищенный сульфат золота -gas.cleanOsmium=Очищенный сульфат осмия -gas.cleanCopper=Очищенный сульфат меди -gas.cleanTin=Очищенный сульфат олова -gas.cleanSilver=Очищенный сульфат серебра -gas.cleanObsidian=Очищенный серный раствор обсидиана -gas.cleanLead=Очищенный сульфат свинца +gas.cleanIron=Очищенная взвесь железа +gas.cleanGold=Очищенная взвесь золота +gas.cleanOsmium=Очищенная взвесь осмия +gas.cleanCopper=Очищенная взвесь меди +gas.cleanTin=Очищенная взвесь олова +gas.cleanSilver=Очищенная взвесь серебра +gas.cleanObsidian=Очищенная взвесь обсидиана +gas.cleanLead=Очищенная взвесь свинца //BC Fuel Gases gas.fuel=Парообразное топливо gas.oil=Парообразная нефть //Fluids -fluid.hydrogen=Жидкий водород -fluid.oxygen=Жидкий кислород -fluid.chlorine=Жидкий хлор -fluid.sulfurDioxideGas=Жидкий диоксид серы -fluid.sulfurTrioxideGas=Жидкий триоксид серы -fluid.sulfuricAcid=Жидкая серная кислота -fluid.hydrogenChloride=Жидкий хлороводород -fluid.brine=Рапа -fluid.ethene=Жидкий этилен -fluid.sodium=Жидкий натрий -fluid.heavyWater=Тяжёлая вода -fluid.lithium=Жидкий литий -fluid.deuterium=Жидкий дейтерий -fluid.tritium=Жидкий тритий -fluid.fusionFuelDT=Жидкое дейтерий-тритиевое топливо +fluid.liquidhydrogen=Жидкий водород +fluid.liquidoxygen=Жидкий кислород +fluid.liquidchlorine=Жидкий хлор +fluid.liquidsulfurdioxide=Жидкий диоксид серы +fluid.liquidsulfurtrioxide=Жидкий триоксид серы +fluid.sulfuricacid=Серная кислота +fluid.liquidhydrogenchloride=Жидкий хлороводород +fluid.brine=Рассол +fluid.liquidethene=Жидкий этилен +fluid.liquidsodium=Жидкий натрий +fluid.heavywater=Тяжёлая вода +fluid.liquidlithium=Жидкий литий +fluid.liquiddeuterium=Жидкий дейтерий +fluid.liquidtritium=Жидкий тритий +fluid.liquidfusionfuel=Жидкое Д-Т топливо fluid.steam=Пар //OreGas names @@ -351,11 +356,11 @@ oregas.obsidian=Обсидиановая руда oregas.lead=Свинцовая руда //Tier names -tier.Basic=(Базовый) -tier.Advanced=(Продвинутый) -tier.Elite=(Элитный) -tier.Ultimate=(Совершенный) -tier.Creative=(Творческий) +tier.Basic=Базовый +tier.Advanced=Продвинутый +tier.Elite=Элитный +tier.Ultimate=Совершенный +tier.Creative=Творческий //Transmission types transmission.Energy=Энергия @@ -368,7 +373,7 @@ transmission.Heat=Нагрев update.consider=Подумайте о обновлении до версии update.newFeatures=Нововведения update.visit=Посетите -update.toDownload=Чтобы загрузить +update.toDownload=чтобы загрузить update.devBuild=Используется сборка разработчиков update.outdated=Используется устаревшая версия одного или нескольких модулей @@ -381,8 +386,10 @@ upgrade.filter=Фильтр upgrade.filter.desc=Фильтр, который отделяет тяжёлую воду от обычной воды. upgrade.gas=Газ upgrade.gas.desc=Увеличивает эффективность газоиспользующих механизмов. -upgrade.muffling=Затишье +upgrade.muffling=Шум upgrade.muffling.desc=Уменьшает громкость механизмов. +upgrade.anchor=Якорь +upgrade.anchor.desc=Сохраняет чанк с машиной загруженным. //Key description text key.mode=Переключить режим предмета @@ -394,7 +401,7 @@ entity.Mekanism.Robit.name=Робит entity.Mekanism.BabySkeleton.name=Скелет-ребёнок //Config Gui -mekanism.configgui.ctgy.general=Общие настройки Mekanism +mekanism.configgui.ctgy.general=Общие настройки mekanism.configgui.ctgy.machines=Настройки механизмов mekanism.configgui.ctgy.tier=Настройки уровней mekanism.configgui.ctgy.usage=Настройки потребления @@ -431,7 +438,7 @@ gui.empty=Пусто gui.volume=Звук gui.start=Запуск gui.stop=Стоп -gui.config=Настройки +gui.config=Настройка gui.teleport=Телепорт gui.eject=Извлечение gui.input=Вход @@ -473,17 +480,17 @@ gui.outputting=Выход gui.receiving=Вход gui.dimensions=Измерения gui.constituents=Составляющие -gui.cells=Ячейки -gui.providers=Поставщики +gui.cells=ячеек +gui.providers=поставщики gui.structure=Структура -gui.dynamicTank=Динам. резервуар +gui.dynamicTank=Динамический резервуар gui.industrialTurbine=Промышленная турбина gui.thermoelectricBoiler=Термоэлектрический бойлер gui.visuals=Визуальные gui.noEject=Невозможно извлечь gui.undefined=Неопределенно gui.owner=Владелец -gui.public=Общественный +gui.public=Общий gui.private=Частный gui.add=Добавить gui.set=Установить @@ -508,8 +515,7 @@ gui.lastItem=Послед. предмет gui.oreDictCompat=Совместимый OreDict ключ gui.toggleCooling=Переключить измерение охлаждения gui.coolingMeasurements=Активное охлаждение -gui.redstoneOutputMode=Режим красного камня -gui.entityDetection=Обнаружение сущностей +gui.redstoneOutputMode=Режим редстоуна gui.moveUp=Двигаться вверх gui.moveDown=Двигаться вниз gui.flowRate=Поток @@ -524,7 +530,7 @@ gui.vents=Вентилей gui.maxProduction=Макс. генерация gui.limiting=Ограничение gui.steamInput=Вход пара -gui.capacity=Вместимость +gui.capacity=Ёмкость gui.unit=Единица gui.temp=Температура gui.usage=Использование @@ -538,29 +544,36 @@ gui.heatTransfer=Передача тепла gui.superheaters=Сверхмощные нагреватели gui.boilCapacity=Вместимость нагрева gui.encodeFormula=Записать формулу -gui.autoModeToggle=Переключить автоматический режим +gui.autoModeToggle=Авто-режим gui.craftSingle=Создать 1 предмет gui.craftAvailable=Создать доступные предметы gui.fillEmpty=Заполнить/очистить окно создания gui.noOwner=Нет владельца gui.securityOverride=Перезапись защиты gui.remove=Убрать -gui.trustedPlayers=Доверенный игроки -gui.publicMode=Свободный режим -gui.privateMode=Закрытый режим -gui.trustedMode=Режим доверия +gui.trustedPlayers=Доверенные игроки +gui.publicMode=Общий режим +gui.privateMode=Частный режим +gui.trustedMode=Доверенный режим gui.securityOffline=Откл. защита -gui.noAccessDesc=Нет доступа +gui.noAccessDesc=У Вас нет доступа. gui.overridden=Перезаписано -gui.nowOwn=Теперь вы - владелец +gui.nowOwn=Теперь вы - владелец. gui.frequency=Частота gui.mode=Режим gui.burnRate=Скорость горения +gui.entityDetection=Обнаружение сущностей +gui.energyContents=Энергия +gui.redstoneOutput=Выход редстоуна +gui.maxWaterOutput=Макс. выход воды +gui.stockControl=Складской учет +gui.allowDefault=Разрешить по умолчанию +gui.sizeMode=Режим размера gui.reactor.injectionRate=Скорость инъекции gui.upgrades=Улучшения -gui.upgrades.supported=Поддерживается +gui.upgrades.supported=Работает с gui.upgrades.noSelection=Не выбрано gui.upgrades.amount=Количество gui.upgrades.max=Макс. @@ -570,7 +583,7 @@ gui.chemicalInfuser.short=Хим. наполнитель gui.chemicalDissolutionChamber.short=Хим. камера растворения gui.thermalEvaporationController.short=Контроллер Т. испарителя -gui.dictionary.noKey=Нет ключа +gui.dictionary.noKey=Нет ключа. gui.configuration=Конфигурация gui.config=Настройка @@ -584,14 +597,14 @@ gui.factory.secondaryEnergy=Вторичная энергия gui.factory.autoSort=Авто-сортировка //Recipe types -gui.factory.Smelting=Плавящая -gui.factory.Enriching=Обогащающая -gui.factory.Crushing=Дробящая -gui.factory.Compressing=Сжимающая -gui.factory.Combining=Объединяющая -gui.factory.Purifying=Очищающая -gui.factory.Injecting=Впрыскивающая -gui.factory.Infusing=Наполняющая +gui.factory.Smelting=Плавящий +gui.factory.Enriching=Обогащающий +gui.factory.Crushing=Дробящий +gui.factory.Compressing=Сжимающий +gui.factory.Combining=Объединяющий +gui.factory.Purifying=Очищающий +gui.factory.Injecting=Впрыскивающий +gui.factory.Infusing=Наполняющий gui.seismicReader.short=Сейсм. считыватель gui.seismicReader.solids=Твёрдые @@ -601,7 +614,7 @@ gui.seismicReader.reading=Считывание gui.filterSelect.title=Создать новый фильтр gui.oredictFilter=Фильтр по словарю руд -gui.oredictFilter.noKey=Нет введённых ключей +gui.oredictFilter.noKey=Нет ключа gui.oredictFilter.sameKey=Одинаковый ключ gui.modIDFilter=Фильтр по ID мода @@ -639,7 +652,7 @@ gui.password.enterPassword=Ввести пароль gui.password.fieldsEmpty=Поле(я) пусты gui.password.notMatching=Не совпадает gui.password.identical=Идентичный -gui.password.invalid=Неправильный +gui.password.invalid=Неверный gui.password=Пароль gui.logisticalSorter.default=По умолчанию @@ -652,10 +665,10 @@ gui.teleporter.noFrame=Нет каркаса gui.teleporter.noLink=Нет соединения gui.teleporter.exceeds=Соединений > 2 gui.teleporter.needsEnergy=Требуется энергия -gui.teleporter.noAccess=У Вас нет доступа к этому телепорту +gui.teleporter.noAccess=У Вас нет доступа к этому телепорту. gui.teleporter.noFreq=Нет частоты -gui.entangloporter.noAccess=У вас нет доступа к этому квантовому телепорту +gui.entangloporter.noAccess=У вас нет доступа к этому квантовому телепорту. gui.digitalMinerConfig=Настройки цифрового шахтёра @@ -677,13 +690,13 @@ recipe.mekanismShaped=Форменное создание recipe.mekanismShapeless=Бесформенное создание //Security types -security.public=Свободный режим -security.private=Закрытый режим -security.trusted=Доверенный режим +security.public=Общий +security.private=Частный +security.trusted=Доверенный //Item and block tooltip text tooltip.configurator.configurate=Настройка -tooltip.configurator.empty=Пусто +tooltip.configurator.empty=Опустошать tooltip.configurator.rotate=Вращение tooltip.configurator.wrench=Ключ tooltip.configurator.pumpReset=Сбросить расчёт электрической помпы @@ -692,12 +705,13 @@ tooltip.configurator.toggleMode=Режим %s изменён на tooltip.configurator.viewMode=Текущий режим: %s tooltip.configurator.noLink=Нет соединения tooltip.configurator.linkMsg=Связан с -tooltip.configurator.dim=Измерение +tooltip.configurator.dim=измерение tooltip.configurator.setLink=Установить соединение с блоком tooltip.configurator.plenisherReset=Сбросить расчёт жидкостного снабжателя tooltip.configurator.inductionPortMode=Режим передачи индукционного порта переключен на tooltip.configurator.toggleColor=Цвет изменён на tooltip.configurator.viewColor=Текущий цвет +tooltip.configurator.reactorPortEject=Режим передачи порта реактора переключен на tooltip.upgrade.speed=Скорость tooltip.upgrade.energy=Энергия @@ -708,28 +722,28 @@ tooltip.auth=Проверенный tooltip.locked=Закрытый tooltip.recipeType=Тип рецепта tooltip.hold=Зажмите -tooltip.forDesc=Для описания -tooltip.forDetails=Для деталей +tooltip.forDesc=для описания +tooltip.forDetails=для подробностей tooltip.fireMode=Режим огня tooltip.capacity=Ёмкость tooltip.pumpRate=Скорость откачки tooltip.items=Предметы tooltip.blocks=Блоки -tooltip.universal=Любые +tooltip.universal=любые tooltip.fluids=Жидкости tooltip.gasses=Газы tooltip.capableTrans=Подходит для передачи tooltip.restrictiveDesc=Используется только если нет других доступных путей -tooltip.diversionDesc=Контролируется красным камнем +tooltip.diversionDesc=Контролируется редстоуном tooltip.noGas=Нет газа -tooltip.stored=Хранится: +tooltip.stored=Хранится tooltip.channel=Канал tooltip.mode=Режим tooltip.efficiency=Эффективность tooltip.modeToggle=Режим изменён на tooltip.flowing=Текущий -tooltip.yes=Да -tooltip.no=Нет +tooltip.yes=да +tooltip.no=нет tooltip.name=Имя tooltip.blockData=Данные блока tooltip.block=Блок @@ -744,23 +758,26 @@ tooltip.insufficientFuel=Недостаточно топлива tooltip.readyForReaction=Готово к реакции tooltip.speed=Скорость tooltip.and=и -tooltip.heat=Тепло +tooltip.heat=Нагрев tooltip.itemAmount=Кол-во предметов -tooltip.invalid=Некоррект. +tooltip.invalid=Неверный tooltip.encoded=Закодировано tooltip.ingredients=Ингридиенты +tooltip.conduction=Проводимость +tooltip.insulation=Изоляция +tooltip.heatCapacity=Теплоемкость tooltip.portableTank.bucketMode=Режим ведра -tooltip.disassembler.normal=Обычный -tooltip.disassembler.slow=Медленный -tooltip.disassembler.fast=Быстрый -tooltip.disassembler.vein=Жила -tooltip.disassembler.off=Откл. - -tooltip.filterCard.got=Получены данные фильтра из %s -tooltip.filterCard.set=Введены данные фильтра типа %s -tooltip.filterCard.unequal=Неравные форматы данных фильтров +tooltip.disassembler.normal=нормальный +tooltip.disassembler.slow=медленный +tooltip.disassembler.fast=быстрый +tooltip.disassembler.vein=жила +tooltip.disassembler.off=выкл. + +tooltip.configurationCard.got=Получена конфигурация из %s +tooltip.configurationCard.set=Введена конфигурация типа %s +tooltip.configurationCard.unequal=Неравные форматы конфигураций tooltip.balloon=Воздушный шар @@ -784,7 +801,7 @@ tooltip.StructuralGlass=Продвинутое укрепленное стекл tooltip.DynamicValve=Вентиль для динамического резервуара, используется для ввода и вывода жидкости. tooltip.ThermalEvaporationController=Контроллер для теплового испарителя, в структуре может быть только один. tooltip.ThermalEvaporationValve=Вентиль для теплового испарителя, используется для ввода и вывода жидкости. -tooltip.ThermalEvaporationBlock=Обшивка из сплава меди, используется в тепловом испарителе благодаря теплопроводимости меди. +tooltip.ThermalEvaporationBlock=Обшивка из сплава меди, используется в тепловом испарителе благодаря теплопроводности меди. tooltip.InductionCasing=Энергозащитная обшивка, основанная на литии. Используется в создании индукционной матрицы. tooltip.InductionPort=Порт для индукционной матрицы, используется для ввода и вывода энергии. tooltip.InductionCell=Мощный конденсатор с высокой проводимостью, используется для увеличения вместимости индукционной матрицы. @@ -800,49 +817,51 @@ tooltip.OsmiumCompressor=Довольно продвинутый механиз tooltip.Combiner=Механизм, используемый для объединения пыли и булыжника, чтобы формировать рудные аналоги. tooltip.Crusher=Механизм, используемый для дробления слитков в пыльные аналоги, а также для выполнения множества других операций. tooltip.DigitalMiner=Высоко продвинутый, основанный на фильтре, авто-шахтёр, который может добывать любые блоки, на которые Вы укажите в пределах 32 блоков (макс). -tooltip.BasicFactory=Самый низкий уровень из ветки фабрик, используемый для обработки нескольких механических операций одновременно. -tooltip.AdvancedFactory=Средний уровень из ветки фабрик, используемый для обработки нескольких механических операций одновременно. -tooltip.EliteFactory=Самый высокий уровень из ветки фабрик, используемый для обработки нескольких механических операций одновременно. tooltip.MetallurgicInfuser=Механизм, используемый для "наполнения" металлов (как правило) различными материалами, для создания металлических сплавов и других соединений. tooltip.PurificationChamber=Продвинутый механизм, способный перерабатывать руды в три глыбы, выступающий в качестве начальной стадии 300% переработки руды. tooltip.EnergizedSmelter=Простой механизм, который служит в качестве базовой Mekanism-печи, работающей от энергии. tooltip.Teleporter=Механизм, способный телепортировать игроков в различные места, определённые другим телепортом. tooltip.ElectricPump=Продвинутая помпа, способная выкачать целое озеро лавы. -tooltip.ElectricChest=Переносной 54-слотовый сундук, который использует энергию для блокировки содержимого паролем. +tooltip.PersonalChest=Переносной 54-слотовый сундук, который использует энергию для блокировки содержимого паролем. tooltip.Chargepad=Универсальная зарядная панель, которая может заряжать любой заряжаемый предмет из любой модификации. tooltip.LogisticalSorter=Основанный на фильтре, продвинутый сортировочный механизм, который может автоматически извлекать указанные предметы в мир и соседние инвентари, а также в логистические транспортеры. tooltip.RotaryCondensentrator=Механизм, способный конвертировать газы в жидкость и наоборот. -tooltip.ChemicalInjectionChamber=Сложный механизм, способный перерабатывать руды в четыре осколка, выступающие в качестве начальной стадии 400% переработки руды. +tooltip.ChemicalInjectionChamber=Элитный механизм, способный перерабатывать руды в четыре осколка, выступающие в качестве начальной стадии 400% переработки руды. tooltip.ElectrolyticSeparator=Механизм, который использует процесс электролиза для разделения газа или жидкости на два других газа. tooltip.PrecisionSawmill=Этот механизм используется для обработки древесины и других деревянных предметов, а также для получения опилок. -tooltip.ChemicalDissolutionChamber=Очень сложный механизм, используемый для химического растворения всех примесей руды, оставляя необработанный расплав. -tooltip.ChemicalWasher=Очень сложный механизм, который очищает необработанные расплавленные руды и подготавливает их для кристаллизации. -tooltip.ChemicalCrystalizer=Очень сложный механизм, который используется для кристаллизации очищенной расплавленной руды в кристаллы. +tooltip.ChemicalDissolutionChamber=Совершенный механизм, используемый для химического растворения всех примесей руды, оставляя необработанную взвесь. +tooltip.ChemicalWasher=Совершенный механизм, который очищает необработанные взвеси руд и подготавливает их для кристаллизации. +tooltip.ChemicalCrystallizer=Совершенная машина, используемая для кристаллизации очищенной рудной взвеси в рудные кристаллы. tooltip.ChemicalOxidizer=Механизм, который окисляет твёрдые материалы до газа. tooltip.ChemicalInfuser=Механизм, который производит новый газ путём объединения двух других газов. tooltip.SeismicVibrator=Механизм, который использует сейсмические колебания для предоставления информации о различных слоях мира. tooltip.PressurizedReactionChamber=Продвинутый механизм, который обрабатывает твёрдые, жидкие и газообразные смеси, и создаёт как газообразный, так и твёрдый продукт. -tooltip.PortableTank=Удобный, переносной резервуар, который позволяет переносить от 14 до 112 вёдер жидкости, где бы Вы не были. Также работает как ведро! +tooltip.FluidTank=Удобный, переносной резервуар, который позволяет переносить несколько вёдер жидкости, где бы Вы не были. Также работает как ведро! tooltip.FluidicPlenisher=Механизм, который способен создавать целые озёра, заполняя неровности жидкостями. tooltip.Laser=Продвинутая форма линейной передачи энергии, которая использует чрезвычайно коллимированный пучок света. tooltip.LaserAmplifier=Блок, используемый для объединения, перенаправления и усиления лазерных лучей, с прекрасным управлением во время использования луча. tooltip.LaserTractorBeam=Блок, используемый для объединения и перенаправления лазерных лучей. Собирает предметы/блоки, которые добывает лазерный луч. tooltip.SolarNeutronActivator=Механизм, который направляет нейтронное излучение солнца в свой внутренний резервуар, медленно создавая различные изотопы. tooltip.Oredictionificator=Механизм, используемый для унифицирования и переключения между различными предметами и блоками, используя словарь руд. +tooltip.Factory=Машина, используемая как улучшение обычных механизмов для выполнения нескольких операций одновременно. +tooltip.ResistiveHeater=Спираль, способная преобразовывать электрическую энергию непосредственно в тепловую энергию. +tooltip.FormulaicAssemblicator=Машина, которая использует энергию для быстрого изготовления предметов и блоков по Формулам создания. Также работает как продвинутый верстак. tooltip.FuelwoodHeater=Механизм, производящий большое кол-во тепла сжиганием различных горючих предметов. +tooltip.QuantumEntangloporter=Продвинутый блок, способный передавать любые ресурсы на большие расстояния и в другие измерения. tooltip.HeatGenerator=Генератор, который использует тепло лавы или другие горючие ресурсы для производства энергии. Также может работать от тепла. tooltip.SolarGenerator=Генератор, который использует энергию солнца для производства энергии. tooltip.GasGenerator=Генератор, который использует молекулы различных газов для производства энергии. tooltip.BioGenerator=Генератор, который сжигает органические материалы мира для производства энергии. tooltip.AdvancedSolarGenerator=Продвинутый генератор, который напрямую поглощает солнечные лучи с небольшой потерей, для производства энергии. -tooltip.WindTurbine=Генератор, который использует силу ветра для производства энергии, с большей эффективностью на большой высоте. +tooltip.WindGenerator=Генератор, который использует силу ветра для производства энергии, с большей эффективностью на большой высоте. tooltip.TurbineRotor=Стальной стержень изнутри промышленной турбины, к которому крепятся лезвия ротора. tooltip.RotationalComplex=Блок, помещаемый на верхний ротор турбины, передающий кинетическую энергию к электромагнитным катушкам. tooltip.ElectromagneticCoil=Блок, превращающий кинетическую энергию от вращательного комплекса в электроэнергию. tooltip.TurbineCasing=Устойчивая к давлению обшивка для создания промышленной турбины. tooltip.TurbineValve=Обшивка турбины с портом для передачи пара и энергии. tooltip.TurbineVent=Обшивка турбины с вентилем для выпуска пара, должна быть выше вращательного комплекса. +tooltip.SaturatingCondenser=Блок, конденсирующий пар, использованный промышленной турбиной, обратно в воду. Размещаются в любом месте над вращательным комплексом. tooltip.ReactorGlass=Укреплённое стекло, которое используется при строительстве термоядерного реактора. tooltip.ReactorLaserFocusMatrix=Панель из реакторного стекла, которая способна поглощать оптическую энергию, нагревая термоядерный реактор. @@ -850,7 +869,7 @@ tooltip.ReactorController=Блок управления для всего тер tooltip.ReactorFrame=Укреплённый каркас, который используется при строительстве термоядерного реактора. tooltip.ReactorNeutronCapturePlate=Блок, который используется как для блокирования излучения термоядерного реактора, так и для получения трития. tooltip.ReactorPort=Блок укреплённого каркаса, который способен управлять передачей газа и энергии термоядерного реактора. -tooltip.ReactorLogicAdapter=Блок, который может быть использован для мониторинга основных функций реактора с помощью красного камня. +tooltip.ReactorLogicAdapter=Блок, который может быть использован для мониторинга основных функций реактора с помощью редстоуна. tooltip.OsmiumOre=Крепкий минерал, который можно найти почти на любой высоте в мире. Он, как известно, имеет множество применений в производстве механизмов. tooltip.CopperOre=Общий проводящий материал, который может быть использован при производстве проводов. Способность выдерживать высокие температуры делает его незаменимым в современном оборудовании. @@ -865,13 +884,13 @@ sideData.Gas=Газ sideData.Extra=Дополнительно sideData.Infuse=Наполнение sideData.Fluid=Жидкость -sideData.Fill=Наполнение -sideData.Empty=Опустошение +sideData.Fill=Заполнять +sideData.Empty=Опустошать sideData.Charge=Зарядка sideData.Discharge=Разрядка //Redstone control -control.disabled=Отключён +control.disabled=Отключен control.high=Высокий control.low=Низкий control.pulse=Импульс @@ -957,19 +976,20 @@ tile.Generator.SolarGenerator.name=Солнечный генератор tile.Generator.GasGenerator.name=Газовый генератор tile.Generator.BioGenerator.name=Биогенератор tile.Generator.AdvancedSolarGenerator.name=Продвинутый солнечный генератор -tile.Generator.WindTurbine.name=Ветровая турбина +tile.Generator.WindGenerator.name=Ветровая турбина tile.Generator.TurbineRotor.name=Ротор турбины tile.Generator.RotationalComplex.name=Вращательный комплекс tile.Generator.ElectromagneticCoil.name=Электромагнитная катушка tile.Generator.TurbineCasing.name=Обшивка турбины tile.Generator.TurbineValve.name=Порт турбины tile.Generator.TurbineVent.name=Вентиль турбины +tile.Generator.SaturatingCondenser.name=Насыщающий конденсатор tile.Reactor.ReactorController.name=Панель управления реактором tile.Reactor.ReactorFrame.name=Каркас реактора tile.Reactor.ReactorNeutronCapturePlate.name=Пластина нейтронного захвата tile.Reactor.ReactorPort.name=Порт реактора -tile.Reactor.ReactorLogicAdapter.name=Логический адаптер реактора +tile.Reactor.ReactorLogicAdapter.name=Логический адаптер реактора tile.ReactorGlass.ReactorGlass.name=Стекло реактора tile.ReactorGlass.ReactorLaserFocusMatrix.name=Матрица лазерного фокуса @@ -990,6 +1010,16 @@ gui.maxCasing=Макс. темп. корпуса gui.passiveGeneration=Пассивное генерирование gui.steamProduction=Производство пара +//Config Gui +mekanism.configgui.ctgy.generators.general=Общие настройки +mekanism.configgui.ctgy.generators.generators=Настройки генератора +mekanism.configgui.ctgy.generators.generation=Настройки генерации + +//Config Tooltips +mekanism.configgui.ctgy.generators.general.tooltip=Настройки, касающиеся конфигурации MekanismGenerators +mekanism.configgui.ctgy.generators.generators.tooltip=Настройки, касающиеся включения и отключения определённых генераторов +mekanism.configgui.ctgy.generators.generation.tooltip=Настройки, касающиеся использования энергии генераторов + //*****// //TOOLS// //*****// @@ -1013,18 +1043,6 @@ item.ObsidianShovel.name=Обсидиановая лопата item.ObsidianHoe.name=Обсидиановая мотыга item.ObsidianSword.name=Обсидиановый меч -//Lapis Lazuli -item.LazuliHelmet.name=Лазуритовый шлем -item.LazuliChestplate.name=Лазуритовая кираса -item.LazuliLeggings.name=Лазуритовые поножи -item.LazuliBoots.name=Лазуритовые ботинки -item.LazuliPaxel.name=Лазуритовый мульти-инcтрумент -item.LazuliPickaxe.name=Лазуритовая кирка -item.LazuliAxe.name=Лазуритовый топор -item.LazuliShovel.name=Лазуритовая лопата -item.LazuliHoe.name=Лазуритовая мотыга -item.LazuliSword.name=Лазуритовый меч - //Osmium item.OsmiumHelmet.name=Осмиевый шлем item.OsmiumChestplate.name=Осмиевая кираса @@ -1050,16 +1068,16 @@ item.BronzeHoe.name=Бронзовая мотыга item.BronzeSword.name=Бронзовый меч //Glow -item.GlowstoneHelmet.name=Шлем из светящегося камня -item.GlowstoneChestplate.name=Кираса из светящегося камня -item.GlowstoneLeggings.name=Поножи из светящегося камня -item.GlowstoneBoots.name=Ботинки из светящегося камня -item.GlowstonePaxel.name=Мульти-инcтрумент из светящегося камня -item.GlowstonePickaxe.name=Кирка из светящегося камня -item.GlowstoneAxe.name=Топор из светящегося камня -item.GlowstoneShovel.name=Лопата из светящегося камня -item.GlowstoneHoe.name=Мотыга из светящегося камня -item.GlowstoneSword.name=Меч из светящегося камня +item.GlowstoneHelmet.name=Светокаменный шлем +item.GlowstoneChestplate.name=Светокаменная кираса +item.GlowstoneLeggings.name=Светокаменные поножи +item.GlowstoneBoots.name=Светокаменные ботинки +item.GlowstonePaxel.name=Светокаменный мульти-инcтрумент +item.GlowstonePickaxe.name=Светокаменная кирка +item.GlowstoneAxe.name=Светокаменный топор +item.GlowstoneShovel.name=Светокаменная лопата +item.GlowstoneHoe.name=Светокаменная мотыга +item.GlowstoneSword.name=Светокаменный меч //Steel item.SteelHelmet.name=Стальной шлем @@ -1073,8 +1091,20 @@ item.SteelShovel.name=Стальная лопата item.SteelHoe.name=Стальная мотыга item.SteelSword.name=Стальной меч +//Lapis Lazuli +item.LapisLazuliHelmet.name=Лазуритовый шлем +item.LapisLazuliChestplate.name=Лазуритовая кираса +item.LapisLazuliLeggings.name=Лазуритовые поножи +item.LapisLazuliBoots.name=Лазуритовые ботинки +item.LapisLazuliPaxel.name=Лазуритовый мульти-инcтрумент +item.LapisLazuliPickaxe.name=Лазуритовая кирка +item.LapisLazuliAxe.name=Лазуритовый топор +item.LapisLazuliShovel.name=Лазуритовая лопата +item.LapisLazuliHoe.name=Лазуритовая мотыга +item.LapisLazuliSword.name=Лазуритовый меч + //Config Gui -mekanism.configgui.ctgy.tools.general=Общие +mekanism.configgui.ctgy.tools.general=Общие настройки mekanism.configgui.ctgy.tools.armor=Баланс брони mekanism.configgui.ctgy.tools.tools=Баланс инструментов diff --git a/src/main/resources/assets/mekanism/lang/zh_CN.lang b/src/main/resources/assets/mekanism/lang/zh_cn.lang similarity index 100% rename from src/main/resources/assets/mekanism/lang/zh_CN.lang rename to src/main/resources/assets/mekanism/lang/zh_cn.lang diff --git a/src/main/resources/assets/mekanism/lang/zh_TW.lang b/src/main/resources/assets/mekanism/lang/zh_tw.lang similarity index 100% rename from src/main/resources/assets/mekanism/lang/zh_TW.lang rename to src/main/resources/assets/mekanism/lang/zh_tw.lang diff --git a/src/main/resources/assets/mekanism/models/item/AdvancedControlCircuit.json b/src/main/resources/assets/mekanism/models/item/advancedcontrolcircuit.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/AdvancedControlCircuit.json rename to src/main/resources/assets/mekanism/models/item/advancedcontrolcircuit.json diff --git a/src/main/resources/assets/mekanism/models/item/AdvancedTierInstaller.json b/src/main/resources/assets/mekanism/models/item/advancedtierinstaller.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/AdvancedTierInstaller.json rename to src/main/resources/assets/mekanism/models/item/advancedtierinstaller.json diff --git a/src/main/resources/assets/mekanism/models/item/AnchorUpgrade.json b/src/main/resources/assets/mekanism/models/item/anchorupgrade.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/AnchorUpgrade.json rename to src/main/resources/assets/mekanism/models/item/anchorupgrade.json diff --git a/src/main/resources/assets/mekanism/models/item/ArmoredJetpack.json b/src/main/resources/assets/mekanism/models/item/armoredjetpack.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/ArmoredJetpack.json rename to src/main/resources/assets/mekanism/models/item/armoredjetpack.json diff --git a/src/main/resources/assets/mekanism/models/item/AtomicAlloy.json b/src/main/resources/assets/mekanism/models/item/atomicalloy.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/AtomicAlloy.json rename to src/main/resources/assets/mekanism/models/item/atomicalloy.json diff --git a/src/main/resources/assets/mekanism/models/item/AtomicDisassembler.json b/src/main/resources/assets/mekanism/models/item/atomicdisassembler.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/AtomicDisassembler.json rename to src/main/resources/assets/mekanism/models/item/atomicdisassembler.json diff --git a/src/main/resources/assets/mekanism/models/item/Balloon.json b/src/main/resources/assets/mekanism/models/item/balloon.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/Balloon.json rename to src/main/resources/assets/mekanism/models/item/balloon.json diff --git a/src/main/resources/assets/mekanism/models/item/BasicControlCircuit.json b/src/main/resources/assets/mekanism/models/item/basiccontrolcircuit.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/BasicControlCircuit.json rename to src/main/resources/assets/mekanism/models/item/basiccontrolcircuit.json diff --git a/src/main/resources/assets/mekanism/models/item/BasicTierInstaller.json b/src/main/resources/assets/mekanism/models/item/basictierinstaller.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/BasicTierInstaller.json rename to src/main/resources/assets/mekanism/models/item/basictierinstaller.json diff --git a/src/main/resources/assets/mekanism/models/item/BioFuel.json b/src/main/resources/assets/mekanism/models/item/biofuel.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/BioFuel.json rename to src/main/resources/assets/mekanism/models/item/biofuel.json diff --git a/src/main/resources/assets/mekanism/models/item/BronzeIngot.json b/src/main/resources/assets/mekanism/models/item/bronzeingot.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/BronzeIngot.json rename to src/main/resources/assets/mekanism/models/item/bronzeingot.json diff --git a/src/main/resources/assets/mekanism/models/item/CompressedCarbon.json b/src/main/resources/assets/mekanism/models/item/compressedcarbon.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/CompressedCarbon.json rename to src/main/resources/assets/mekanism/models/item/compressedcarbon.json diff --git a/src/main/resources/assets/mekanism/models/item/CompressedDiamond.json b/src/main/resources/assets/mekanism/models/item/compresseddiamond.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/CompressedDiamond.json rename to src/main/resources/assets/mekanism/models/item/compresseddiamond.json diff --git a/src/main/resources/assets/mekanism/models/item/CompressedObsidian.json b/src/main/resources/assets/mekanism/models/item/compressedobsidian.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/CompressedObsidian.json rename to src/main/resources/assets/mekanism/models/item/compressedobsidian.json diff --git a/src/main/resources/assets/mekanism/models/item/CompressedRedstone.json b/src/main/resources/assets/mekanism/models/item/compressedredstone.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/CompressedRedstone.json rename to src/main/resources/assets/mekanism/models/item/compressedredstone.json diff --git a/src/main/resources/assets/mekanism/models/item/ConfigurationCard.json b/src/main/resources/assets/mekanism/models/item/configurationcard.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/ConfigurationCard.json rename to src/main/resources/assets/mekanism/models/item/configurationcard.json diff --git a/src/main/resources/assets/mekanism/models/item/Configurator.json b/src/main/resources/assets/mekanism/models/item/configurator.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/Configurator.json rename to src/main/resources/assets/mekanism/models/item/configurator.json diff --git a/src/main/resources/assets/mekanism/models/item/CopperClump.json b/src/main/resources/assets/mekanism/models/item/copperclump.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/CopperClump.json rename to src/main/resources/assets/mekanism/models/item/copperclump.json diff --git a/src/main/resources/assets/mekanism/models/item/CopperCrystal.json b/src/main/resources/assets/mekanism/models/item/coppercrystal.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/CopperCrystal.json rename to src/main/resources/assets/mekanism/models/item/coppercrystal.json diff --git a/src/main/resources/assets/mekanism/models/item/CopperDust.json b/src/main/resources/assets/mekanism/models/item/copperdust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/CopperDust.json rename to src/main/resources/assets/mekanism/models/item/copperdust.json diff --git a/src/main/resources/assets/mekanism/models/item/CopperIngot.json b/src/main/resources/assets/mekanism/models/item/copperingot.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/CopperIngot.json rename to src/main/resources/assets/mekanism/models/item/copperingot.json diff --git a/src/main/resources/assets/mekanism/models/item/CopperShard.json b/src/main/resources/assets/mekanism/models/item/coppershard.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/CopperShard.json rename to src/main/resources/assets/mekanism/models/item/coppershard.json diff --git a/src/main/resources/assets/mekanism/models/item/CraftingFormula.json b/src/main/resources/assets/mekanism/models/item/craftingformula.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/CraftingFormula.json rename to src/main/resources/assets/mekanism/models/item/craftingformula.json diff --git a/src/main/resources/assets/mekanism/models/item/CraftingFormulaEncoded.json b/src/main/resources/assets/mekanism/models/item/craftingformulaencoded.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/CraftingFormulaEncoded.json rename to src/main/resources/assets/mekanism/models/item/craftingformulaencoded.json diff --git a/src/main/resources/assets/mekanism/models/item/CraftingFormulaInvalid.json b/src/main/resources/assets/mekanism/models/item/craftingformulainvalid.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/CraftingFormulaInvalid.json rename to src/main/resources/assets/mekanism/models/item/craftingformulainvalid.json diff --git a/src/main/resources/assets/mekanism/models/item/DiamondDust.json b/src/main/resources/assets/mekanism/models/item/diamonddust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/DiamondDust.json rename to src/main/resources/assets/mekanism/models/item/diamonddust.json diff --git a/src/main/resources/assets/mekanism/models/item/Dictionary.json b/src/main/resources/assets/mekanism/models/item/dictionary.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/Dictionary.json rename to src/main/resources/assets/mekanism/models/item/dictionary.json diff --git a/src/main/resources/assets/mekanism/models/item/DirtyCopperDust.json b/src/main/resources/assets/mekanism/models/item/dirtycopperdust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/DirtyCopperDust.json rename to src/main/resources/assets/mekanism/models/item/dirtycopperdust.json diff --git a/src/main/resources/assets/mekanism/models/item/DirtyGoldDust.json b/src/main/resources/assets/mekanism/models/item/dirtygolddust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/DirtyGoldDust.json rename to src/main/resources/assets/mekanism/models/item/dirtygolddust.json diff --git a/src/main/resources/assets/mekanism/models/item/DirtyIronDust.json b/src/main/resources/assets/mekanism/models/item/dirtyirondust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/DirtyIronDust.json rename to src/main/resources/assets/mekanism/models/item/dirtyirondust.json diff --git a/src/main/resources/assets/mekanism/models/item/DirtyLeadDust.json b/src/main/resources/assets/mekanism/models/item/dirtyleaddust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/DirtyLeadDust.json rename to src/main/resources/assets/mekanism/models/item/dirtyleaddust.json diff --git a/src/main/resources/assets/mekanism/models/item/DirtyOsmiumDust.json b/src/main/resources/assets/mekanism/models/item/dirtyosmiumdust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/DirtyOsmiumDust.json rename to src/main/resources/assets/mekanism/models/item/dirtyosmiumdust.json diff --git a/src/main/resources/assets/mekanism/models/item/DirtySilverDust.json b/src/main/resources/assets/mekanism/models/item/dirtysilverdust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/DirtySilverDust.json rename to src/main/resources/assets/mekanism/models/item/dirtysilverdust.json diff --git a/src/main/resources/assets/mekanism/models/item/DirtyTinDust.json b/src/main/resources/assets/mekanism/models/item/dirtytindust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/DirtyTinDust.json rename to src/main/resources/assets/mekanism/models/item/dirtytindust.json diff --git a/src/main/resources/assets/mekanism/models/item/ElectricBow.json b/src/main/resources/assets/mekanism/models/item/electricbow.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/ElectricBow.json rename to src/main/resources/assets/mekanism/models/item/electricbow.json diff --git a/src/main/resources/assets/mekanism/models/item/ElectrolyticCore.json b/src/main/resources/assets/mekanism/models/item/electrolyticcore.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/ElectrolyticCore.json rename to src/main/resources/assets/mekanism/models/item/electrolyticcore.json diff --git a/src/main/resources/assets/mekanism/models/item/EliteControlCircuit.json b/src/main/resources/assets/mekanism/models/item/elitecontrolcircuit.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/EliteControlCircuit.json rename to src/main/resources/assets/mekanism/models/item/elitecontrolcircuit.json diff --git a/src/main/resources/assets/mekanism/models/item/EliteTierInstaller.json b/src/main/resources/assets/mekanism/models/item/elitetierinstaller.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/EliteTierInstaller.json rename to src/main/resources/assets/mekanism/models/item/elitetierinstaller.json diff --git a/src/main/resources/assets/mekanism/models/item/EnergyTablet.json b/src/main/resources/assets/mekanism/models/item/energytablet.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/EnergyTablet.json rename to src/main/resources/assets/mekanism/models/item/energytablet.json diff --git a/src/main/resources/assets/mekanism/models/item/EnergyUpgrade.json b/src/main/resources/assets/mekanism/models/item/energyupgrade.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/EnergyUpgrade.json rename to src/main/resources/assets/mekanism/models/item/energyupgrade.json diff --git a/src/main/resources/assets/mekanism/models/item/EnrichedAlloy.json b/src/main/resources/assets/mekanism/models/item/enrichedalloy.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/EnrichedAlloy.json rename to src/main/resources/assets/mekanism/models/item/enrichedalloy.json diff --git a/src/main/resources/assets/mekanism/models/item/EnrichedIron.json b/src/main/resources/assets/mekanism/models/item/enrichediron.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/EnrichedIron.json rename to src/main/resources/assets/mekanism/models/item/enrichediron.json diff --git a/src/main/resources/assets/mekanism/models/item/FilterUpgrade.json b/src/main/resources/assets/mekanism/models/item/filterupgrade.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/FilterUpgrade.json rename to src/main/resources/assets/mekanism/models/item/filterupgrade.json diff --git a/src/main/resources/assets/mekanism/models/item/Flamethrower.json b/src/main/resources/assets/mekanism/models/item/flamethrower.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/Flamethrower.json rename to src/main/resources/assets/mekanism/models/item/flamethrower.json diff --git a/src/main/resources/assets/mekanism/models/item/FreeRunners.json b/src/main/resources/assets/mekanism/models/item/freerunners.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/FreeRunners.json rename to src/main/resources/assets/mekanism/models/item/freerunners.json diff --git a/src/main/resources/assets/mekanism/models/item/GasMask.json b/src/main/resources/assets/mekanism/models/item/gasmask.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/GasMask.json rename to src/main/resources/assets/mekanism/models/item/gasmask.json diff --git a/src/main/resources/assets/mekanism/models/item/GasUpgrade.json b/src/main/resources/assets/mekanism/models/item/gasupgrade.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/GasUpgrade.json rename to src/main/resources/assets/mekanism/models/item/gasupgrade.json diff --git a/src/main/resources/assets/mekanism/models/item/GaugeDropper.json b/src/main/resources/assets/mekanism/models/item/gaugedropper.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/GaugeDropper.json rename to src/main/resources/assets/mekanism/models/item/gaugedropper.json diff --git a/src/main/resources/assets/mekanism/models/item/GlowstoneIngot.json b/src/main/resources/assets/mekanism/models/item/glowstoneingot.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/GlowstoneIngot.json rename to src/main/resources/assets/mekanism/models/item/glowstoneingot.json diff --git a/src/main/resources/assets/mekanism/models/item/GoldClump.json b/src/main/resources/assets/mekanism/models/item/goldclump.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/GoldClump.json rename to src/main/resources/assets/mekanism/models/item/goldclump.json diff --git a/src/main/resources/assets/mekanism/models/item/GoldCrystal.json b/src/main/resources/assets/mekanism/models/item/goldcrystal.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/GoldCrystal.json rename to src/main/resources/assets/mekanism/models/item/goldcrystal.json diff --git a/src/main/resources/assets/mekanism/models/item/GoldDust.json b/src/main/resources/assets/mekanism/models/item/golddust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/GoldDust.json rename to src/main/resources/assets/mekanism/models/item/golddust.json diff --git a/src/main/resources/assets/mekanism/models/item/GoldShard.json b/src/main/resources/assets/mekanism/models/item/goldshard.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/GoldShard.json rename to src/main/resources/assets/mekanism/models/item/goldshard.json diff --git a/src/main/resources/assets/mekanism/models/item/HDPEPellet.json b/src/main/resources/assets/mekanism/models/item/hdpepellet.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/HDPEPellet.json rename to src/main/resources/assets/mekanism/models/item/hdpepellet.json diff --git a/src/main/resources/assets/mekanism/models/item/HDPERod.json b/src/main/resources/assets/mekanism/models/item/hdperod.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/HDPERod.json rename to src/main/resources/assets/mekanism/models/item/hdperod.json diff --git a/src/main/resources/assets/mekanism/models/item/HDPESheet.json b/src/main/resources/assets/mekanism/models/item/hdpesheet.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/HDPESheet.json rename to src/main/resources/assets/mekanism/models/item/hdpesheet.json diff --git a/src/main/resources/assets/mekanism/models/item/IronClump.json b/src/main/resources/assets/mekanism/models/item/ironclump.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/IronClump.json rename to src/main/resources/assets/mekanism/models/item/ironclump.json diff --git a/src/main/resources/assets/mekanism/models/item/IronCrystal.json b/src/main/resources/assets/mekanism/models/item/ironcrystal.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/IronCrystal.json rename to src/main/resources/assets/mekanism/models/item/ironcrystal.json diff --git a/src/main/resources/assets/mekanism/models/item/IronDust.json b/src/main/resources/assets/mekanism/models/item/irondust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/IronDust.json rename to src/main/resources/assets/mekanism/models/item/irondust.json diff --git a/src/main/resources/assets/mekanism/models/item/IronShard.json b/src/main/resources/assets/mekanism/models/item/ironshard.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/IronShard.json rename to src/main/resources/assets/mekanism/models/item/ironshard.json diff --git a/src/main/resources/assets/mekanism/models/item/ItemProxy.json b/src/main/resources/assets/mekanism/models/item/itemproxy.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/ItemProxy.json rename to src/main/resources/assets/mekanism/models/item/itemproxy.json diff --git a/src/main/resources/assets/mekanism/models/item/Jetpack.json b/src/main/resources/assets/mekanism/models/item/jetpack.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/Jetpack.json rename to src/main/resources/assets/mekanism/models/item/jetpack.json diff --git a/src/main/resources/assets/mekanism/models/item/LeadClump.json b/src/main/resources/assets/mekanism/models/item/leadclump.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/LeadClump.json rename to src/main/resources/assets/mekanism/models/item/leadclump.json diff --git a/src/main/resources/assets/mekanism/models/item/LeadCrystal.json b/src/main/resources/assets/mekanism/models/item/leadcrystal.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/LeadCrystal.json rename to src/main/resources/assets/mekanism/models/item/leadcrystal.json diff --git a/src/main/resources/assets/mekanism/models/item/LeadDust.json b/src/main/resources/assets/mekanism/models/item/leaddust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/LeadDust.json rename to src/main/resources/assets/mekanism/models/item/leaddust.json diff --git a/src/main/resources/assets/mekanism/models/item/LeadShard.json b/src/main/resources/assets/mekanism/models/item/leadshard.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/LeadShard.json rename to src/main/resources/assets/mekanism/models/item/leadshard.json diff --git a/src/main/resources/assets/mekanism/models/item/LithiumDust.json b/src/main/resources/assets/mekanism/models/item/lithiumdust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/LithiumDust.json rename to src/main/resources/assets/mekanism/models/item/lithiumdust.json diff --git a/src/main/resources/assets/mekanism/models/item/MufflingUpgrade.json b/src/main/resources/assets/mekanism/models/item/mufflingupgrade.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/MufflingUpgrade.json rename to src/main/resources/assets/mekanism/models/item/mufflingupgrade.json diff --git a/src/main/resources/assets/mekanism/models/item/NetworkReader.json b/src/main/resources/assets/mekanism/models/item/networkreader.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/NetworkReader.json rename to src/main/resources/assets/mekanism/models/item/networkreader.json diff --git a/src/main/resources/assets/mekanism/models/item/ObsidianDust.json b/src/main/resources/assets/mekanism/models/item/obsidiandust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/ObsidianDust.json rename to src/main/resources/assets/mekanism/models/item/obsidiandust.json diff --git a/src/main/resources/assets/mekanism/models/item/ObsidianIngot.json b/src/main/resources/assets/mekanism/models/item/obsidianingot.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/ObsidianIngot.json rename to src/main/resources/assets/mekanism/models/item/obsidianingot.json diff --git a/src/main/resources/assets/mekanism/models/item/ObsidianTNT.json b/src/main/resources/assets/mekanism/models/item/obsidiantnt.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/ObsidianTNT.json rename to src/main/resources/assets/mekanism/models/item/obsidiantnt.json diff --git a/src/main/resources/assets/mekanism/models/item/OsmiumClump.json b/src/main/resources/assets/mekanism/models/item/osmiumclump.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/OsmiumClump.json rename to src/main/resources/assets/mekanism/models/item/osmiumclump.json diff --git a/src/main/resources/assets/mekanism/models/item/OsmiumCrystal.json b/src/main/resources/assets/mekanism/models/item/osmiumcrystal.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/OsmiumCrystal.json rename to src/main/resources/assets/mekanism/models/item/osmiumcrystal.json diff --git a/src/main/resources/assets/mekanism/models/item/OsmiumDust.json b/src/main/resources/assets/mekanism/models/item/osmiumdust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/OsmiumDust.json rename to src/main/resources/assets/mekanism/models/item/osmiumdust.json diff --git a/src/main/resources/assets/mekanism/models/item/OsmiumIngot.json b/src/main/resources/assets/mekanism/models/item/osmiumingot.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/OsmiumIngot.json rename to src/main/resources/assets/mekanism/models/item/osmiumingot.json diff --git a/src/main/resources/assets/mekanism/models/item/OsmiumShard.json b/src/main/resources/assets/mekanism/models/item/osmiumshard.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/OsmiumShard.json rename to src/main/resources/assets/mekanism/models/item/osmiumshard.json diff --git a/src/main/resources/assets/mekanism/models/item/PlaStick.json b/src/main/resources/assets/mekanism/models/item/plastick.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/PlaStick.json rename to src/main/resources/assets/mekanism/models/item/plastick.json diff --git a/src/main/resources/assets/mekanism/models/item/PortableTeleporter.json b/src/main/resources/assets/mekanism/models/item/portableteleporter.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/PortableTeleporter.json rename to src/main/resources/assets/mekanism/models/item/portableteleporter.json diff --git a/src/main/resources/assets/mekanism/models/item/RefinedObsidianDust.json b/src/main/resources/assets/mekanism/models/item/refinedobsidiandust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/RefinedObsidianDust.json rename to src/main/resources/assets/mekanism/models/item/refinedobsidiandust.json diff --git a/src/main/resources/assets/mekanism/models/item/ReinforcedAlloy.json b/src/main/resources/assets/mekanism/models/item/reinforcedalloy.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/ReinforcedAlloy.json rename to src/main/resources/assets/mekanism/models/item/reinforcedalloy.json diff --git a/src/main/resources/assets/mekanism/models/item/Robit.json b/src/main/resources/assets/mekanism/models/item/robit.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/Robit.json rename to src/main/resources/assets/mekanism/models/item/robit.json diff --git a/src/main/resources/assets/mekanism/models/item/Salt.json b/src/main/resources/assets/mekanism/models/item/salt.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/Salt.json rename to src/main/resources/assets/mekanism/models/item/salt.json diff --git a/src/main/resources/assets/mekanism/models/item/Sawdust.json b/src/main/resources/assets/mekanism/models/item/sawdust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/Sawdust.json rename to src/main/resources/assets/mekanism/models/item/sawdust.json diff --git a/src/main/resources/assets/mekanism/models/item/ScubaTank.json b/src/main/resources/assets/mekanism/models/item/scubatank.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/ScubaTank.json rename to src/main/resources/assets/mekanism/models/item/scubatank.json diff --git a/src/main/resources/assets/mekanism/models/item/SeismicReader.json b/src/main/resources/assets/mekanism/models/item/seismicreader.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/SeismicReader.json rename to src/main/resources/assets/mekanism/models/item/seismicreader.json diff --git a/src/main/resources/assets/mekanism/models/item/SilverClump.json b/src/main/resources/assets/mekanism/models/item/silverclump.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/SilverClump.json rename to src/main/resources/assets/mekanism/models/item/silverclump.json diff --git a/src/main/resources/assets/mekanism/models/item/SilverCrystal.json b/src/main/resources/assets/mekanism/models/item/silvercrystal.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/SilverCrystal.json rename to src/main/resources/assets/mekanism/models/item/silvercrystal.json diff --git a/src/main/resources/assets/mekanism/models/item/SilverDust.json b/src/main/resources/assets/mekanism/models/item/silverdust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/SilverDust.json rename to src/main/resources/assets/mekanism/models/item/silverdust.json diff --git a/src/main/resources/assets/mekanism/models/item/SilverShard.json b/src/main/resources/assets/mekanism/models/item/silvershard.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/SilverShard.json rename to src/main/resources/assets/mekanism/models/item/silvershard.json diff --git a/src/main/resources/assets/mekanism/models/item/SpeedUpgrade.json b/src/main/resources/assets/mekanism/models/item/speedupgrade.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/SpeedUpgrade.json rename to src/main/resources/assets/mekanism/models/item/speedupgrade.json diff --git a/src/main/resources/assets/mekanism/models/item/SteelDust.json b/src/main/resources/assets/mekanism/models/item/steeldust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/SteelDust.json rename to src/main/resources/assets/mekanism/models/item/steeldust.json diff --git a/src/main/resources/assets/mekanism/models/item/SteelIngot.json b/src/main/resources/assets/mekanism/models/item/steelingot.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/SteelIngot.json rename to src/main/resources/assets/mekanism/models/item/steelingot.json diff --git a/src/main/resources/assets/mekanism/models/item/Substrate.json b/src/main/resources/assets/mekanism/models/item/substrate.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/Substrate.json rename to src/main/resources/assets/mekanism/models/item/substrate.json diff --git a/src/main/resources/assets/mekanism/models/item/SulfurDust.json b/src/main/resources/assets/mekanism/models/item/sulfurdust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/SulfurDust.json rename to src/main/resources/assets/mekanism/models/item/sulfurdust.json diff --git a/src/main/resources/assets/mekanism/models/item/TeleportationCore.json b/src/main/resources/assets/mekanism/models/item/teleportationcore.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/TeleportationCore.json rename to src/main/resources/assets/mekanism/models/item/teleportationcore.json diff --git a/src/main/resources/assets/mekanism/models/item/TinClump.json b/src/main/resources/assets/mekanism/models/item/tinclump.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/TinClump.json rename to src/main/resources/assets/mekanism/models/item/tinclump.json diff --git a/src/main/resources/assets/mekanism/models/item/TinCrystal.json b/src/main/resources/assets/mekanism/models/item/tincrystal.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/TinCrystal.json rename to src/main/resources/assets/mekanism/models/item/tincrystal.json diff --git a/src/main/resources/assets/mekanism/models/item/TinDust.json b/src/main/resources/assets/mekanism/models/item/tindust.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/TinDust.json rename to src/main/resources/assets/mekanism/models/item/tindust.json diff --git a/src/main/resources/assets/mekanism/models/item/TinIngot.json b/src/main/resources/assets/mekanism/models/item/tiningot.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/TinIngot.json rename to src/main/resources/assets/mekanism/models/item/tiningot.json diff --git a/src/main/resources/assets/mekanism/models/item/TinShard.json b/src/main/resources/assets/mekanism/models/item/tinshard.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/TinShard.json rename to src/main/resources/assets/mekanism/models/item/tinshard.json diff --git a/src/main/resources/assets/mekanism/models/item/UltimateControlCircuit.json b/src/main/resources/assets/mekanism/models/item/ultimatecontrolcircuit.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/UltimateControlCircuit.json rename to src/main/resources/assets/mekanism/models/item/ultimatecontrolcircuit.json diff --git a/src/main/resources/assets/mekanism/models/item/UltimateTierInstaller.json b/src/main/resources/assets/mekanism/models/item/ultimatetierinstaller.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/UltimateTierInstaller.json rename to src/main/resources/assets/mekanism/models/item/ultimatetierinstaller.json diff --git a/src/main/resources/assets/mekanism/models/item/WalkieTalkie.json b/src/main/resources/assets/mekanism/models/item/walkietalkie.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/WalkieTalkie.json rename to src/main/resources/assets/mekanism/models/item/walkietalkie.json diff --git a/src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch1.json b/src/main/resources/assets/mekanism/models/item/walkietalkie_ch1.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch1.json rename to src/main/resources/assets/mekanism/models/item/walkietalkie_ch1.json diff --git a/src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch2.json b/src/main/resources/assets/mekanism/models/item/walkietalkie_ch2.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch2.json rename to src/main/resources/assets/mekanism/models/item/walkietalkie_ch2.json diff --git a/src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch3.json b/src/main/resources/assets/mekanism/models/item/walkietalkie_ch3.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch3.json rename to src/main/resources/assets/mekanism/models/item/walkietalkie_ch3.json diff --git a/src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch4.json b/src/main/resources/assets/mekanism/models/item/walkietalkie_ch4.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch4.json rename to src/main/resources/assets/mekanism/models/item/walkietalkie_ch4.json diff --git a/src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch5.json b/src/main/resources/assets/mekanism/models/item/walkietalkie_ch5.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch5.json rename to src/main/resources/assets/mekanism/models/item/walkietalkie_ch5.json diff --git a/src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch6.json b/src/main/resources/assets/mekanism/models/item/walkietalkie_ch6.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch6.json rename to src/main/resources/assets/mekanism/models/item/walkietalkie_ch6.json diff --git a/src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch7.json b/src/main/resources/assets/mekanism/models/item/walkietalkie_ch7.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch7.json rename to src/main/resources/assets/mekanism/models/item/walkietalkie_ch7.json diff --git a/src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch8.json b/src/main/resources/assets/mekanism/models/item/walkietalkie_ch8.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch8.json rename to src/main/resources/assets/mekanism/models/item/walkietalkie_ch8.json diff --git a/src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch9.json b/src/main/resources/assets/mekanism/models/item/walkietalkie_ch9.json similarity index 100% rename from src/main/resources/assets/mekanism/models/item/WalkieTalkie_ch9.json rename to src/main/resources/assets/mekanism/models/item/walkietalkie_ch9.json diff --git a/src/main/resources/assets/mekanism/render/QuantumEntangloporter.png b/src/main/resources/assets/mekanism/render/QuantumEntangloporter.png deleted file mode 100644 index a1e1d5ecf..000000000 Binary files a/src/main/resources/assets/mekanism/render/QuantumEntangloporter.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/render/AdvancedSolarGenerator.png b/src/main/resources/assets/mekanism/render/advancedsolargenerator.png similarity index 100% rename from src/main/resources/assets/mekanism/render/AdvancedSolarGenerator.png rename to src/main/resources/assets/mekanism/render/advancedsolargenerator.png diff --git a/src/main/resources/assets/mekanism/render/AtomicDisassembler.png b/src/main/resources/assets/mekanism/render/atomicdisassembler.png similarity index 100% rename from src/main/resources/assets/mekanism/render/AtomicDisassembler.png rename to src/main/resources/assets/mekanism/render/atomicdisassembler.png diff --git a/src/main/resources/assets/mekanism/render/Balloon.png b/src/main/resources/assets/mekanism/render/balloon.png similarity index 100% rename from src/main/resources/assets/mekanism/render/Balloon.png rename to src/main/resources/assets/mekanism/render/balloon.png diff --git a/src/main/resources/assets/mekanism/render/BioGenerator.png b/src/main/resources/assets/mekanism/render/biogenerator.png similarity index 100% rename from src/main/resources/assets/mekanism/render/BioGenerator.png rename to src/main/resources/assets/mekanism/render/biogenerator.png diff --git a/src/main/resources/assets/mekanism/render/Chargepad.png b/src/main/resources/assets/mekanism/render/chargepad.png similarity index 100% rename from src/main/resources/assets/mekanism/render/Chargepad.png rename to src/main/resources/assets/mekanism/render/chargepad.png diff --git a/src/main/resources/assets/mekanism/render/Chargepad_Overlay.png b/src/main/resources/assets/mekanism/render/chargepad_overlay.png similarity index 100% rename from src/main/resources/assets/mekanism/render/Chargepad_Overlay.png rename to src/main/resources/assets/mekanism/render/chargepad_overlay.png diff --git a/src/main/resources/assets/mekanism/render/ChemicalCrystallizer.png b/src/main/resources/assets/mekanism/render/chemicalcrystallizer.png similarity index 100% rename from src/main/resources/assets/mekanism/render/ChemicalCrystallizer.png rename to src/main/resources/assets/mekanism/render/chemicalcrystallizer.png diff --git a/src/main/resources/assets/mekanism/render/ChemicalDissolutionChamber.png b/src/main/resources/assets/mekanism/render/chemicaldissolutionchamber.png similarity index 100% rename from src/main/resources/assets/mekanism/render/ChemicalDissolutionChamber.png rename to src/main/resources/assets/mekanism/render/chemicaldissolutionchamber.png diff --git a/src/main/resources/assets/mekanism/render/ChemicalInfuser.png b/src/main/resources/assets/mekanism/render/chemicalinfuser.png similarity index 100% rename from src/main/resources/assets/mekanism/render/ChemicalInfuser.png rename to src/main/resources/assets/mekanism/render/chemicalinfuser.png diff --git a/src/main/resources/assets/mekanism/render/ChemicalOxidizer.png b/src/main/resources/assets/mekanism/render/chemicaloxidizer.png similarity index 100% rename from src/main/resources/assets/mekanism/render/ChemicalOxidizer.png rename to src/main/resources/assets/mekanism/render/chemicaloxidizer.png diff --git a/src/main/resources/assets/mekanism/render/ChemicalWasher.png b/src/main/resources/assets/mekanism/render/chemicalwasher.png similarity index 100% rename from src/main/resources/assets/mekanism/render/ChemicalWasher.png rename to src/main/resources/assets/mekanism/render/chemicalwasher.png diff --git a/src/main/resources/assets/mekanism/render/Crusher.png b/src/main/resources/assets/mekanism/render/crusher.png similarity index 100% rename from src/main/resources/assets/mekanism/render/Crusher.png rename to src/main/resources/assets/mekanism/render/crusher.png diff --git a/src/main/resources/assets/mekanism/render/DigitalMiner.png b/src/main/resources/assets/mekanism/render/digitalminer.png similarity index 100% rename from src/main/resources/assets/mekanism/render/DigitalMiner.png rename to src/main/resources/assets/mekanism/render/digitalminer.png diff --git a/src/main/resources/assets/mekanism/render/DigitalMiner_OverlayOff.png b/src/main/resources/assets/mekanism/render/digitalminer_overlayoff.png similarity index 100% rename from src/main/resources/assets/mekanism/render/DigitalMiner_OverlayOff.png rename to src/main/resources/assets/mekanism/render/digitalminer_overlayoff.png diff --git a/src/main/resources/assets/mekanism/render/DigitalMiner_OverlayOn.png b/src/main/resources/assets/mekanism/render/digitalminer_overlayon.png similarity index 100% rename from src/main/resources/assets/mekanism/render/DigitalMiner_OverlayOn.png rename to src/main/resources/assets/mekanism/render/digitalminer_overlayon.png diff --git a/src/main/resources/assets/mekanism/render/ElectricPump.png b/src/main/resources/assets/mekanism/render/electricpump.png similarity index 100% rename from src/main/resources/assets/mekanism/render/ElectricPump.png rename to src/main/resources/assets/mekanism/render/electricpump.png diff --git a/src/main/resources/assets/mekanism/render/ElectrolyticSeparator.png b/src/main/resources/assets/mekanism/render/electrolyticseparator.png similarity index 100% rename from src/main/resources/assets/mekanism/render/ElectrolyticSeparator.png rename to src/main/resources/assets/mekanism/render/electrolyticseparator.png diff --git a/src/main/resources/assets/mekanism/render/EnergyCore.png b/src/main/resources/assets/mekanism/render/energycore.png similarity index 100% rename from src/main/resources/assets/mekanism/render/EnergyCore.png rename to src/main/resources/assets/mekanism/render/energycore.png diff --git a/src/main/resources/assets/mekanism/render/EnergyCube.png b/src/main/resources/assets/mekanism/render/energycube.png similarity index 100% rename from src/main/resources/assets/mekanism/render/EnergyCube.png rename to src/main/resources/assets/mekanism/render/energycube.png diff --git a/src/main/resources/assets/mekanism/render/EnergyCube_OverlayOff.png b/src/main/resources/assets/mekanism/render/energycube_overlayoff.png similarity index 100% rename from src/main/resources/assets/mekanism/render/EnergyCube_OverlayOff.png rename to src/main/resources/assets/mekanism/render/energycube_overlayoff.png diff --git a/src/main/resources/assets/mekanism/render/EnergyCube_OverlayOn.png b/src/main/resources/assets/mekanism/render/energycube_overlayon.png similarity index 100% rename from src/main/resources/assets/mekanism/render/EnergyCube_OverlayOn.png rename to src/main/resources/assets/mekanism/render/energycube_overlayon.png diff --git a/src/main/resources/assets/mekanism/render/EnergyCubeAdvanced.png b/src/main/resources/assets/mekanism/render/energycubeadvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/render/EnergyCubeAdvanced.png rename to src/main/resources/assets/mekanism/render/energycubeadvanced.png diff --git a/src/main/resources/assets/mekanism/render/EnergyCubeBasic.png b/src/main/resources/assets/mekanism/render/energycubebasic.png similarity index 100% rename from src/main/resources/assets/mekanism/render/EnergyCubeBasic.png rename to src/main/resources/assets/mekanism/render/energycubebasic.png diff --git a/src/main/resources/assets/mekanism/render/EnergyCubeCreative.png b/src/main/resources/assets/mekanism/render/energycubecreative.png similarity index 100% rename from src/main/resources/assets/mekanism/render/EnergyCubeCreative.png rename to src/main/resources/assets/mekanism/render/energycubecreative.png diff --git a/src/main/resources/assets/mekanism/render/EnergyCubeElite.png b/src/main/resources/assets/mekanism/render/energycubeelite.png similarity index 100% rename from src/main/resources/assets/mekanism/render/EnergyCubeElite.png rename to src/main/resources/assets/mekanism/render/energycubeelite.png diff --git a/src/main/resources/assets/mekanism/render/EnergyCubeUltimate.png b/src/main/resources/assets/mekanism/render/energycubeultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/render/EnergyCubeUltimate.png rename to src/main/resources/assets/mekanism/render/energycubeultimate.png diff --git a/src/main/resources/assets/mekanism/render/FadedSphere.png b/src/main/resources/assets/mekanism/render/fadedsphere.png similarity index 100% rename from src/main/resources/assets/mekanism/render/FadedSphere.png rename to src/main/resources/assets/mekanism/render/fadedsphere.png diff --git a/src/main/resources/assets/mekanism/render/Flame.png b/src/main/resources/assets/mekanism/render/flame.png similarity index 100% rename from src/main/resources/assets/mekanism/render/Flame.png rename to src/main/resources/assets/mekanism/render/flame.png diff --git a/src/main/resources/assets/mekanism/render/Flamethrower.png b/src/main/resources/assets/mekanism/render/flamethrower.png similarity index 100% rename from src/main/resources/assets/mekanism/render/Flamethrower.png rename to src/main/resources/assets/mekanism/render/flamethrower.png diff --git a/src/main/resources/assets/mekanism/render/FluidicPlenisher.png b/src/main/resources/assets/mekanism/render/fluidicplenisher.png similarity index 100% rename from src/main/resources/assets/mekanism/render/FluidicPlenisher.png rename to src/main/resources/assets/mekanism/render/fluidicplenisher.png diff --git a/src/main/resources/assets/mekanism/render/FluidTank.png b/src/main/resources/assets/mekanism/render/fluidtank.png similarity index 100% rename from src/main/resources/assets/mekanism/render/FluidTank.png rename to src/main/resources/assets/mekanism/render/fluidtank.png diff --git a/src/main/resources/assets/mekanism/render/FluidTankOn.png b/src/main/resources/assets/mekanism/render/fluidtankon.png similarity index 100% rename from src/main/resources/assets/mekanism/render/FluidTankOn.png rename to src/main/resources/assets/mekanism/render/fluidtankon.png diff --git a/src/main/resources/assets/mekanism/render/FreeRunners.png b/src/main/resources/assets/mekanism/render/freerunners.png similarity index 100% rename from src/main/resources/assets/mekanism/render/FreeRunners.png rename to src/main/resources/assets/mekanism/render/freerunners.png diff --git a/src/main/resources/assets/mekanism/render/GasGenerator.png b/src/main/resources/assets/mekanism/render/gasgenerator.png similarity index 100% rename from src/main/resources/assets/mekanism/render/GasGenerator.png rename to src/main/resources/assets/mekanism/render/gasgenerator.png diff --git a/src/main/resources/assets/mekanism/render/GasTankAdvanced.png b/src/main/resources/assets/mekanism/render/gastankadvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/render/GasTankAdvanced.png rename to src/main/resources/assets/mekanism/render/gastankadvanced.png diff --git a/src/main/resources/assets/mekanism/render/GasTankBasic.png b/src/main/resources/assets/mekanism/render/gastankbasic.png similarity index 100% rename from src/main/resources/assets/mekanism/render/GasTankBasic.png rename to src/main/resources/assets/mekanism/render/gastankbasic.png diff --git a/src/main/resources/assets/mekanism/render/GasTankElite.png b/src/main/resources/assets/mekanism/render/gastankelite.png similarity index 100% rename from src/main/resources/assets/mekanism/render/GasTankElite.png rename to src/main/resources/assets/mekanism/render/gastankelite.png diff --git a/src/main/resources/assets/mekanism/render/GasTankUltimate.png b/src/main/resources/assets/mekanism/render/gastankultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/render/GasTankUltimate.png rename to src/main/resources/assets/mekanism/render/gastankultimate.png diff --git a/src/main/resources/assets/mekanism/render/HeatGenerator.png b/src/main/resources/assets/mekanism/render/heatgenerator.png similarity index 100% rename from src/main/resources/assets/mekanism/render/HeatGenerator.png rename to src/main/resources/assets/mekanism/render/heatgenerator.png diff --git a/src/main/resources/assets/mekanism/render/HeatGenerator_OverlayOff.png b/src/main/resources/assets/mekanism/render/heatgenerator_overlayoff.png similarity index 100% rename from src/main/resources/assets/mekanism/render/HeatGenerator_OverlayOff.png rename to src/main/resources/assets/mekanism/render/heatgenerator_overlayoff.png diff --git a/src/main/resources/assets/mekanism/render/HeatGenerator_OverlayOn.png b/src/main/resources/assets/mekanism/render/heatgenerator_overlayon.png similarity index 100% rename from src/main/resources/assets/mekanism/render/HeatGenerator_OverlayOn.png rename to src/main/resources/assets/mekanism/render/heatgenerator_overlayon.png diff --git a/src/main/resources/assets/mekanism/render/Jetpack.png b/src/main/resources/assets/mekanism/render/jetpack.png similarity index 100% rename from src/main/resources/assets/mekanism/render/Jetpack.png rename to src/main/resources/assets/mekanism/render/jetpack.png diff --git a/src/main/resources/assets/mekanism/render/Laser.png b/src/main/resources/assets/mekanism/render/laser.png similarity index 100% rename from src/main/resources/assets/mekanism/render/Laser.png rename to src/main/resources/assets/mekanism/render/laser.png diff --git a/src/main/resources/assets/mekanism/render/LogisticalSorter.png b/src/main/resources/assets/mekanism/render/logisticalsorter.png similarity index 100% rename from src/main/resources/assets/mekanism/render/LogisticalSorter.png rename to src/main/resources/assets/mekanism/render/logisticalsorter.png diff --git a/src/main/resources/assets/mekanism/render/LogisticalSorterOn.png b/src/main/resources/assets/mekanism/render/logisticalsorteron.png similarity index 100% rename from src/main/resources/assets/mekanism/render/LogisticalSorterOn.png rename to src/main/resources/assets/mekanism/render/logisticalsorteron.png diff --git a/src/main/resources/assets/mekanism/render/MetallurgicInfuser.png b/src/main/resources/assets/mekanism/render/metallurgicinfuser.png similarity index 100% rename from src/main/resources/assets/mekanism/render/MetallurgicInfuser.png rename to src/main/resources/assets/mekanism/render/metallurgicinfuser.png diff --git a/src/main/resources/assets/mekanism/render/NullArmor.png b/src/main/resources/assets/mekanism/render/nullarmor.png similarity index 100% rename from src/main/resources/assets/mekanism/render/NullArmor.png rename to src/main/resources/assets/mekanism/render/nullarmor.png diff --git a/src/main/resources/assets/mekanism/render/ObsidianTNT.png b/src/main/resources/assets/mekanism/render/obsidiantnt.png similarity index 100% rename from src/main/resources/assets/mekanism/render/ObsidianTNT.png rename to src/main/resources/assets/mekanism/render/obsidiantnt.png diff --git a/src/main/resources/assets/mekanism/render/PersonalChest.png b/src/main/resources/assets/mekanism/render/personalchest.png similarity index 100% rename from src/main/resources/assets/mekanism/render/PersonalChest.png rename to src/main/resources/assets/mekanism/render/personalchest.png diff --git a/src/main/resources/assets/mekanism/render/PressurizedReactionChamber.png b/src/main/resources/assets/mekanism/render/pressurizedreactionchamber.png similarity index 100% rename from src/main/resources/assets/mekanism/render/PressurizedReactionChamber.png rename to src/main/resources/assets/mekanism/render/pressurizedreactionchamber.png diff --git a/src/main/resources/assets/mekanism/render/quantumentangloporter.png b/src/main/resources/assets/mekanism/render/quantumentangloporter.png new file mode 100644 index 000000000..f6e4ea7f7 Binary files /dev/null and b/src/main/resources/assets/mekanism/render/quantumentangloporter.png differ diff --git a/src/main/resources/assets/mekanism/render/QuantumEntangloporter_Overlay.png b/src/main/resources/assets/mekanism/render/quantumentangloporter_overlay.png similarity index 100% rename from src/main/resources/assets/mekanism/render/QuantumEntangloporter_Overlay.png rename to src/main/resources/assets/mekanism/render/quantumentangloporter_overlay.png diff --git a/src/main/resources/assets/mekanism/render/ResistiveHeater.png b/src/main/resources/assets/mekanism/render/resistiveheater.png similarity index 100% rename from src/main/resources/assets/mekanism/render/ResistiveHeater.png rename to src/main/resources/assets/mekanism/render/resistiveheater.png diff --git a/src/main/resources/assets/mekanism/render/ResistiveHeater_OverlayOff.png b/src/main/resources/assets/mekanism/render/resistiveheater_overlayoff.png similarity index 100% rename from src/main/resources/assets/mekanism/render/ResistiveHeater_OverlayOff.png rename to src/main/resources/assets/mekanism/render/resistiveheater_overlayoff.png diff --git a/src/main/resources/assets/mekanism/render/ResistiveHeater_OverlayOn.png b/src/main/resources/assets/mekanism/render/resistiveheater_overlayon.png similarity index 100% rename from src/main/resources/assets/mekanism/render/ResistiveHeater_OverlayOn.png rename to src/main/resources/assets/mekanism/render/resistiveheater_overlayon.png diff --git a/src/main/resources/assets/mekanism/render/Robit.png b/src/main/resources/assets/mekanism/render/robit.png similarity index 100% rename from src/main/resources/assets/mekanism/render/Robit.png rename to src/main/resources/assets/mekanism/render/robit.png diff --git a/src/main/resources/assets/mekanism/render/Robit2.png b/src/main/resources/assets/mekanism/render/robit2.png similarity index 100% rename from src/main/resources/assets/mekanism/render/Robit2.png rename to src/main/resources/assets/mekanism/render/robit2.png diff --git a/src/main/resources/assets/mekanism/render/RotaryCondensentrator.png b/src/main/resources/assets/mekanism/render/rotarycondensentrator.png similarity index 100% rename from src/main/resources/assets/mekanism/render/RotaryCondensentrator.png rename to src/main/resources/assets/mekanism/render/rotarycondensentrator.png diff --git a/src/main/resources/assets/mekanism/render/ScubaSet.png b/src/main/resources/assets/mekanism/render/scubaset.png similarity index 100% rename from src/main/resources/assets/mekanism/render/ScubaSet.png rename to src/main/resources/assets/mekanism/render/scubaset.png diff --git a/src/main/resources/assets/mekanism/render/SecurityDesk.png b/src/main/resources/assets/mekanism/render/securitydesk.png similarity index 100% rename from src/main/resources/assets/mekanism/render/SecurityDesk.png rename to src/main/resources/assets/mekanism/render/securitydesk.png diff --git a/src/main/resources/assets/mekanism/render/SecurityDesk_Overlay.png b/src/main/resources/assets/mekanism/render/securitydesk_overlay.png similarity index 100% rename from src/main/resources/assets/mekanism/render/SecurityDesk_Overlay.png rename to src/main/resources/assets/mekanism/render/securitydesk_overlay.png diff --git a/src/main/resources/assets/mekanism/render/SeismicVibrator.png b/src/main/resources/assets/mekanism/render/seismicvibrator.png similarity index 100% rename from src/main/resources/assets/mekanism/render/SeismicVibrator.png rename to src/main/resources/assets/mekanism/render/seismicvibrator.png diff --git a/src/main/resources/assets/mekanism/render/SideConfigOverlay.png b/src/main/resources/assets/mekanism/render/sideconfigoverlay.png similarity index 100% rename from src/main/resources/assets/mekanism/render/SideConfigOverlay.png rename to src/main/resources/assets/mekanism/render/sideconfigoverlay.png diff --git a/src/main/resources/assets/mekanism/render/SolarGenerator.png b/src/main/resources/assets/mekanism/render/solargenerator.png similarity index 100% rename from src/main/resources/assets/mekanism/render/SolarGenerator.png rename to src/main/resources/assets/mekanism/render/solargenerator.png diff --git a/src/main/resources/assets/mekanism/render/SolarNeutronActivator.png b/src/main/resources/assets/mekanism/render/solarneutronactivator.png similarity index 100% rename from src/main/resources/assets/mekanism/render/SolarNeutronActivator.png rename to src/main/resources/assets/mekanism/render/solarneutronactivator.png diff --git a/src/main/resources/assets/mekanism/render/TransporterBox.png b/src/main/resources/assets/mekanism/render/transporterbox.png similarity index 100% rename from src/main/resources/assets/mekanism/render/TransporterBox.png rename to src/main/resources/assets/mekanism/render/transporterbox.png diff --git a/src/main/resources/assets/mekanism/render/Turbine.png b/src/main/resources/assets/mekanism/render/turbine.png similarity index 100% rename from src/main/resources/assets/mekanism/render/Turbine.png rename to src/main/resources/assets/mekanism/render/turbine.png diff --git a/src/main/resources/assets/mekanism/render/WindGenerator.png b/src/main/resources/assets/mekanism/render/windgenerator.png similarity index 100% rename from src/main/resources/assets/mekanism/render/WindGenerator.png rename to src/main/resources/assets/mekanism/render/windgenerator.png diff --git a/src/main/resources/assets/mekanism/sounds.json b/src/main/resources/assets/mekanism/sounds.json index 75e60a50f..812130740 100644 --- a/src/main/resources/assets/mekanism/sounds.json +++ b/src/main/resources/assets/mekanism/sounds.json @@ -33,11 +33,13 @@ "tile.machine.metalinfuser": {"category": "block", "sounds": [{"name": "mekanism:MetallurgicInfuser", "stream": false}]}, "tile.machine.sawmill": {"category": "block", "sounds": [{"name": "mekanism:PrecisionSawmill", "stream": false}]}, "tile.machine.prc": {"category": "block", "sounds": [{"name": "mekanism:PressurizedReactionChamber", "stream": false}]}, - "tile.machine.purification": {"category": "block", "sounds": [{"name": "mekanism:PurificationChamber", "stream": false}]}, + "tile.machine.purifier": {"category": "block", "sounds": [{"name": "mekanism:PurificationChamber", "stream": false}]}, "tile.machine.smelter": {"category": "block", "sounds": [{"name": "mekanism:Smelter", "stream": false}]}, "tile.machine.laser": {"category": "block", "sounds": [{"name": "mekanism:Laser", "stream": false}]}, "tile.machine.fusionreactor": {"category": "block", "sounds": [{"name": "mekanism:FusionReactor", "stream": false}]}, "tile.machine.resistiveheater": {"category": "block", "sounds": [{"name": "mekanism:ResistiveHeater", "stream": false}]}, + "tile.machine.electrolyticseparator": {"category": "block", "sounds": [{"name": "mekanism:ElectrolyticSeparator", "stream": false}]}, + "tile.machine.rotarycondensentrator": {"category": "block", "sounds": [{"name": "mekanism:RotaryCondensentrator", "stream": false}]}, "tile.christmas.1": {"category": "block", "sounds": [{"name": "mekanism:holiday/Nutcracker1", "stream": false}]}, "tile.christmas.2": {"category": "block", "sounds": [{"name": "mekanism:holiday/Nutcracker2", "stream": false}]}, @@ -55,4 +57,4 @@ "item.flamethrower.active": {"category": "player", "sounds": [{"name": "mekanism:FlamethrowerActive", "stream": false}]}, "item.gasMask": {"category": "player", "sounds": [{"name": "mekanism:GasMask", "stream": false}]}, "item.jetpack": {"category": "player", "sounds": [{"name": "mekanism:Jetpack", "stream": false}]} -} \ No newline at end of file +} diff --git a/src/main/resources/assets/mekanism/sounds/BioGenerator.ogg b/src/main/resources/assets/mekanism/sounds/biogenerator.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/BioGenerator.ogg rename to src/main/resources/assets/mekanism/sounds/biogenerator.ogg diff --git a/src/main/resources/assets/mekanism/sounds/Chargepad.ogg b/src/main/resources/assets/mekanism/sounds/chargepad.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/Chargepad.ogg rename to src/main/resources/assets/mekanism/sounds/chargepad.ogg diff --git a/src/main/resources/assets/mekanism/sounds/ChemicalCrystallizer.ogg b/src/main/resources/assets/mekanism/sounds/chemicalcrystallizer.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/ChemicalCrystallizer.ogg rename to src/main/resources/assets/mekanism/sounds/chemicalcrystallizer.ogg diff --git a/src/main/resources/assets/mekanism/sounds/ChemicalDissolutionChamber.ogg b/src/main/resources/assets/mekanism/sounds/chemicaldissolutionchamber.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/ChemicalDissolutionChamber.ogg rename to src/main/resources/assets/mekanism/sounds/chemicaldissolutionchamber.ogg diff --git a/src/main/resources/assets/mekanism/sounds/ChemicalInfuser.ogg b/src/main/resources/assets/mekanism/sounds/chemicalinfuser.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/ChemicalInfuser.ogg rename to src/main/resources/assets/mekanism/sounds/chemicalinfuser.ogg diff --git a/src/main/resources/assets/mekanism/sounds/ChemicalInjectionChamber.ogg b/src/main/resources/assets/mekanism/sounds/chemicalinjectionchamber.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/ChemicalInjectionChamber.ogg rename to src/main/resources/assets/mekanism/sounds/chemicalinjectionchamber.ogg diff --git a/src/main/resources/assets/mekanism/sounds/ChemicalOxidizer.ogg b/src/main/resources/assets/mekanism/sounds/chemicaloxidizer.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/ChemicalOxidizer.ogg rename to src/main/resources/assets/mekanism/sounds/chemicaloxidizer.ogg diff --git a/src/main/resources/assets/mekanism/sounds/ChemicalWasher.ogg b/src/main/resources/assets/mekanism/sounds/chemicalwasher.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/ChemicalWasher.ogg rename to src/main/resources/assets/mekanism/sounds/chemicalwasher.ogg diff --git a/src/main/resources/assets/mekanism/sounds/cj/CJ_1.ogg b/src/main/resources/assets/mekanism/sounds/cj/cj_1.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/cj/CJ_1.ogg rename to src/main/resources/assets/mekanism/sounds/cj/cj_1.ogg diff --git a/src/main/resources/assets/mekanism/sounds/cj/CJ_2.ogg b/src/main/resources/assets/mekanism/sounds/cj/cj_2.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/cj/CJ_2.ogg rename to src/main/resources/assets/mekanism/sounds/cj/cj_2.ogg diff --git a/src/main/resources/assets/mekanism/sounds/cj/CJ_3.ogg b/src/main/resources/assets/mekanism/sounds/cj/cj_3.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/cj/CJ_3.ogg rename to src/main/resources/assets/mekanism/sounds/cj/cj_3.ogg diff --git a/src/main/resources/assets/mekanism/sounds/cj/CJ_4.ogg b/src/main/resources/assets/mekanism/sounds/cj/cj_4.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/cj/CJ_4.ogg rename to src/main/resources/assets/mekanism/sounds/cj/cj_4.ogg diff --git a/src/main/resources/assets/mekanism/sounds/cj/CJ_5.ogg b/src/main/resources/assets/mekanism/sounds/cj/cj_5.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/cj/CJ_5.ogg rename to src/main/resources/assets/mekanism/sounds/cj/cj_5.ogg diff --git a/src/main/resources/assets/mekanism/sounds/cj/CJ_6.ogg b/src/main/resources/assets/mekanism/sounds/cj/cj_6.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/cj/CJ_6.ogg rename to src/main/resources/assets/mekanism/sounds/cj/cj_6.ogg diff --git a/src/main/resources/assets/mekanism/sounds/cj/CJ_7.ogg b/src/main/resources/assets/mekanism/sounds/cj/cj_7.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/cj/CJ_7.ogg rename to src/main/resources/assets/mekanism/sounds/cj/cj_7.ogg diff --git a/src/main/resources/assets/mekanism/sounds/cj/CJ_8.ogg b/src/main/resources/assets/mekanism/sounds/cj/cj_8.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/cj/CJ_8.ogg rename to src/main/resources/assets/mekanism/sounds/cj/cj_8.ogg diff --git a/src/main/resources/assets/mekanism/sounds/Combiner.ogg b/src/main/resources/assets/mekanism/sounds/combiner.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/Combiner.ogg rename to src/main/resources/assets/mekanism/sounds/combiner.ogg diff --git a/src/main/resources/assets/mekanism/sounds/Compressor.ogg b/src/main/resources/assets/mekanism/sounds/compressor.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/Compressor.ogg rename to src/main/resources/assets/mekanism/sounds/compressor.ogg diff --git a/src/main/resources/assets/mekanism/sounds/Crusher.ogg b/src/main/resources/assets/mekanism/sounds/crusher.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/Crusher.ogg rename to src/main/resources/assets/mekanism/sounds/crusher.ogg diff --git a/src/main/resources/assets/mekanism/sounds/electrolyticseparator.ogg b/src/main/resources/assets/mekanism/sounds/electrolyticseparator.ogg new file mode 100644 index 000000000..873665334 Binary files /dev/null and b/src/main/resources/assets/mekanism/sounds/electrolyticseparator.ogg differ diff --git a/src/main/resources/assets/mekanism/sounds/EnrichmentChamber.ogg b/src/main/resources/assets/mekanism/sounds/enrichmentchamber.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/EnrichmentChamber.ogg rename to src/main/resources/assets/mekanism/sounds/enrichmentchamber.ogg diff --git a/src/main/resources/assets/mekanism/sounds/etc/Beep.ogg b/src/main/resources/assets/mekanism/sounds/etc/beep.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/etc/Beep.ogg rename to src/main/resources/assets/mekanism/sounds/etc/beep.ogg diff --git a/src/main/resources/assets/mekanism/sounds/etc/Click.ogg b/src/main/resources/assets/mekanism/sounds/etc/click.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/etc/Click.ogg rename to src/main/resources/assets/mekanism/sounds/etc/click.ogg diff --git a/src/main/resources/assets/mekanism/sounds/etc/Ding.ogg b/src/main/resources/assets/mekanism/sounds/etc/ding.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/etc/Ding.ogg rename to src/main/resources/assets/mekanism/sounds/etc/ding.ogg diff --git a/src/main/resources/assets/mekanism/sounds/etc/Error.ogg b/src/main/resources/assets/mekanism/sounds/etc/error.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/etc/Error.ogg rename to src/main/resources/assets/mekanism/sounds/etc/error.ogg diff --git a/src/main/resources/assets/mekanism/sounds/etc/GasMask.ogg b/src/main/resources/assets/mekanism/sounds/etc/gasmask.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/etc/GasMask.ogg rename to src/main/resources/assets/mekanism/sounds/etc/gasmask.ogg diff --git a/src/main/resources/assets/mekanism/sounds/etc/Hydraulic.ogg b/src/main/resources/assets/mekanism/sounds/etc/hydraulic.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/etc/Hydraulic.ogg rename to src/main/resources/assets/mekanism/sounds/etc/hydraulic.ogg diff --git a/src/main/resources/assets/mekanism/sounds/etc/Pop.ogg b/src/main/resources/assets/mekanism/sounds/etc/pop.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/etc/Pop.ogg rename to src/main/resources/assets/mekanism/sounds/etc/pop.ogg diff --git a/src/main/resources/assets/mekanism/sounds/etc/Success.ogg b/src/main/resources/assets/mekanism/sounds/etc/success.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/etc/Success.ogg rename to src/main/resources/assets/mekanism/sounds/etc/success.ogg diff --git a/src/main/resources/assets/mekanism/sounds/FlamethrowerActive.ogg b/src/main/resources/assets/mekanism/sounds/flamethroweractive.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/FlamethrowerActive.ogg rename to src/main/resources/assets/mekanism/sounds/flamethroweractive.ogg diff --git a/src/main/resources/assets/mekanism/sounds/FlamethrowerIdle.ogg b/src/main/resources/assets/mekanism/sounds/flamethroweridle.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/FlamethrowerIdle.ogg rename to src/main/resources/assets/mekanism/sounds/flamethroweridle.ogg diff --git a/src/main/resources/assets/mekanism/sounds/FusionReactor.ogg b/src/main/resources/assets/mekanism/sounds/fusionreactor.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/FusionReactor.ogg rename to src/main/resources/assets/mekanism/sounds/fusionreactor.ogg diff --git a/src/main/resources/assets/mekanism/sounds/GasGenerator.ogg b/src/main/resources/assets/mekanism/sounds/gasgenerator.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/GasGenerator.ogg rename to src/main/resources/assets/mekanism/sounds/gasgenerator.ogg diff --git a/src/main/resources/assets/mekanism/sounds/GasMask.ogg b/src/main/resources/assets/mekanism/sounds/gasmask.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/GasMask.ogg rename to src/main/resources/assets/mekanism/sounds/gasmask.ogg diff --git a/src/main/resources/assets/mekanism/sounds/HeatGenerator.ogg b/src/main/resources/assets/mekanism/sounds/heatgenerator.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/HeatGenerator.ogg rename to src/main/resources/assets/mekanism/sounds/heatgenerator.ogg diff --git a/src/main/resources/assets/mekanism/sounds/holiday/Nutcracker1.ogg b/src/main/resources/assets/mekanism/sounds/holiday/nutcracker1.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/holiday/Nutcracker1.ogg rename to src/main/resources/assets/mekanism/sounds/holiday/nutcracker1.ogg diff --git a/src/main/resources/assets/mekanism/sounds/holiday/Nutcracker2.ogg b/src/main/resources/assets/mekanism/sounds/holiday/nutcracker2.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/holiday/Nutcracker2.ogg rename to src/main/resources/assets/mekanism/sounds/holiday/nutcracker2.ogg diff --git a/src/main/resources/assets/mekanism/sounds/holiday/Nutcracker3.ogg b/src/main/resources/assets/mekanism/sounds/holiday/nutcracker3.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/holiday/Nutcracker3.ogg rename to src/main/resources/assets/mekanism/sounds/holiday/nutcracker3.ogg diff --git a/src/main/resources/assets/mekanism/sounds/holiday/Nutcracker4.ogg b/src/main/resources/assets/mekanism/sounds/holiday/nutcracker4.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/holiday/Nutcracker4.ogg rename to src/main/resources/assets/mekanism/sounds/holiday/nutcracker4.ogg diff --git a/src/main/resources/assets/mekanism/sounds/holiday/Nutcracker5.ogg b/src/main/resources/assets/mekanism/sounds/holiday/nutcracker5.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/holiday/Nutcracker5.ogg rename to src/main/resources/assets/mekanism/sounds/holiday/nutcracker5.ogg diff --git a/src/main/resources/assets/mekanism/sounds/Jetpack.ogg b/src/main/resources/assets/mekanism/sounds/jetpack.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/Jetpack.ogg rename to src/main/resources/assets/mekanism/sounds/jetpack.ogg diff --git a/src/main/resources/assets/mekanism/sounds/Laser.ogg b/src/main/resources/assets/mekanism/sounds/laser.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/Laser.ogg rename to src/main/resources/assets/mekanism/sounds/laser.ogg diff --git a/src/main/resources/assets/mekanism/sounds/MetallurgicInfuser.ogg b/src/main/resources/assets/mekanism/sounds/metallurgicinfuser.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/MetallurgicInfuser.ogg rename to src/main/resources/assets/mekanism/sounds/metallurgicinfuser.ogg diff --git a/src/main/resources/assets/mekanism/sounds/PrecisionSawmill.ogg b/src/main/resources/assets/mekanism/sounds/precisionsawmill.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/PrecisionSawmill.ogg rename to src/main/resources/assets/mekanism/sounds/precisionsawmill.ogg diff --git a/src/main/resources/assets/mekanism/sounds/PressurizedReactionChamber.ogg b/src/main/resources/assets/mekanism/sounds/pressurizedreactionchamber.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/PressurizedReactionChamber.ogg rename to src/main/resources/assets/mekanism/sounds/pressurizedreactionchamber.ogg diff --git a/src/main/resources/assets/mekanism/sounds/PurificationChamber.ogg b/src/main/resources/assets/mekanism/sounds/purificationchamber.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/PurificationChamber.ogg rename to src/main/resources/assets/mekanism/sounds/purificationchamber.ogg diff --git a/src/main/resources/assets/mekanism/sounds/ResistiveHeater.ogg b/src/main/resources/assets/mekanism/sounds/resistiveheater.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/ResistiveHeater.ogg rename to src/main/resources/assets/mekanism/sounds/resistiveheater.ogg diff --git a/src/main/resources/assets/mekanism/sounds/rotarycondensentrator.ogg b/src/main/resources/assets/mekanism/sounds/rotarycondensentrator.ogg new file mode 100644 index 000000000..ea65f31b2 Binary files /dev/null and b/src/main/resources/assets/mekanism/sounds/rotarycondensentrator.ogg differ diff --git a/src/main/resources/assets/mekanism/sounds/Smelter.ogg b/src/main/resources/assets/mekanism/sounds/smelter.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/Smelter.ogg rename to src/main/resources/assets/mekanism/sounds/smelter.ogg diff --git a/src/main/resources/assets/mekanism/sounds/SolarGenerator.ogg b/src/main/resources/assets/mekanism/sounds/solargenerator.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/SolarGenerator.ogg rename to src/main/resources/assets/mekanism/sounds/solargenerator.ogg diff --git a/src/main/resources/assets/mekanism/sounds/WindTurbine.ogg b/src/main/resources/assets/mekanism/sounds/windturbine.ogg similarity index 100% rename from src/main/resources/assets/mekanism/sounds/WindTurbine.ogg rename to src/main/resources/assets/mekanism/sounds/windturbine.ogg diff --git a/src/main/resources/assets/mekanism/textures/blocks/AmbientAccumulator.png b/src/main/resources/assets/mekanism/textures/blocks/ambientaccumulator.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/AmbientAccumulator.png rename to src/main/resources/assets/mekanism/textures/blocks/ambientaccumulator.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedBack.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedBack.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedbackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedbackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedBottom.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedbottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedbottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedFront.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedFront.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedLeft.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedlefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedlefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedRight.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedRight.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedTop.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedtop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedTop.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedtop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedtopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinAdvancedTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binadvancedtopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicBack.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binbasicback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicBack.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binbasicback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binbasicbackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binbasicbackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicBottom.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binbasicbottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binbasicbottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicFront.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binbasicfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicFront.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binbasicfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binbasicfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binbasicfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicLeft.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binbasicleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binbasicleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binbasiclefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binbasiclefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicRight.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binbasicright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicRight.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binbasicright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binbasicrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binbasicrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicTop.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binbasictop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicTop.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binbasictop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binbasictopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinBasicTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binbasictopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinBottom.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binbottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binbottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeBack.png b/src/main/resources/assets/mekanism/textures/blocks/bin/bincreativeback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeBack.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/bincreativeback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/bincreativebackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/bincreativebackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeBottom.png b/src/main/resources/assets/mekanism/textures/blocks/bin/bincreativebottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/bincreativebottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeFront.png b/src/main/resources/assets/mekanism/textures/blocks/bin/bincreativefront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeFront.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/bincreativefront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/bincreativefronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/bincreativefronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeLeft.png b/src/main/resources/assets/mekanism/textures/blocks/bin/bincreativeleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/bincreativeleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/bincreativelefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/bincreativelefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeRight.png b/src/main/resources/assets/mekanism/textures/blocks/bin/bincreativeright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeRight.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/bincreativeright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/bincreativerighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/bincreativerighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeTop.png b/src/main/resources/assets/mekanism/textures/blocks/bin/bincreativetop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeTop.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/bincreativetop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/bincreativetopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinCreativeTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/bincreativetopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteBack.png b/src/main/resources/assets/mekanism/textures/blocks/bin/bineliteback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteBack.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/bineliteback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binelitebackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binelitebackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteBottom.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binelitebottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binelitebottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteFront.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binelitefront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteFront.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binelitefront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binelitefronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binelitefronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteLeft.png b/src/main/resources/assets/mekanism/textures/blocks/bin/bineliteleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/bineliteleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binelitelefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binelitelefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteRight.png b/src/main/resources/assets/mekanism/textures/blocks/bin/bineliteright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteRight.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/bineliteright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/bineliterighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/bineliterighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteTop.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binelitetop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteTop.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binelitetop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binelitetopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinEliteTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binelitetopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinFront.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinFront.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinSide.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binside.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinSide.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binside.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinSideOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binsideon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinSideOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binsideon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinTop.png b/src/main/resources/assets/mekanism/textures/blocks/bin/bintop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinTop.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/bintop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/bintopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/bintopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateBack.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binultimateback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateBack.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binultimateback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binultimatebackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binultimatebackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateBottom.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binultimatebottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binultimatebottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateFront.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binultimatefront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateFront.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binultimatefront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binultimatefronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binultimatefronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateLeft.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binultimateleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binultimateleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binultimatelefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binultimatelefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateRight.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binultimateright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateRight.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binultimateright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binultimaterighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binultimaterighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateTop.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binultimatetop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateTop.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binultimatetop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/bin/binultimatetopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/bin/BinUltimateTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/bin/binultimatetopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/BronzeBlock.png b/src/main/resources/assets/mekanism/textures/blocks/bronzeblock.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/BronzeBlock.png rename to src/main/resources/assets/mekanism/textures/blocks/bronzeblock.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/CardboardBoxSide.png b/src/main/resources/assets/mekanism/textures/blocks/cardboardboxside.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/CardboardBoxSide.png rename to src/main/resources/assets/mekanism/textures/blocks/cardboardboxside.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/CardboardBoxSideStorage.png b/src/main/resources/assets/mekanism/textures/blocks/cardboardboxsidestorage.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/CardboardBoxSideStorage.png rename to src/main/resources/assets/mekanism/textures/blocks/cardboardboxsidestorage.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/CardboardBoxTop.png b/src/main/resources/assets/mekanism/textures/blocks/cardboardboxtop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/CardboardBoxTop.png rename to src/main/resources/assets/mekanism/textures/blocks/cardboardboxtop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberBack.png b/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberBack.png rename to src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberbackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberbackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberBottom.png b/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberbottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberbottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberFront.png b/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberFront.png rename to src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberLeft.png b/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberlefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberlefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberRight.png b/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberRight.png rename to src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchamberrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberTop.png b/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchambertop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberTop.png rename to src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchambertop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchambertopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/ChemicalInjectionChamberTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/chemical_injection_chamber/chemicalinjectionchambertopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/CoalBlock.png b/src/main/resources/assets/mekanism/textures/blocks/coalblock.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/CoalBlock.png rename to src/main/resources/assets/mekanism/textures/blocks/coalblock.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerBack.png b/src/main/resources/assets/mekanism/textures/blocks/combiner/combinerback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerBack.png rename to src/main/resources/assets/mekanism/textures/blocks/combiner/combinerback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/combiner/combinerbackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/combiner/combinerbackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerBottom.png b/src/main/resources/assets/mekanism/textures/blocks/combiner/combinerbottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/combiner/combinerbottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerFront.png b/src/main/resources/assets/mekanism/textures/blocks/combiner/combinerfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerFront.png rename to src/main/resources/assets/mekanism/textures/blocks/combiner/combinerfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/combiner/combinerfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/combiner/combinerfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/combiner/combinerfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/combiner/combinerfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerLeft.png b/src/main/resources/assets/mekanism/textures/blocks/combiner/combinerleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/combiner/combinerleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/combiner/combinerlefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/combiner/combinerlefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerRight.png b/src/main/resources/assets/mekanism/textures/blocks/combiner/combinerright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerRight.png rename to src/main/resources/assets/mekanism/textures/blocks/combiner/combinerright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/combiner/combinerrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/combiner/combinerrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerTop.png b/src/main/resources/assets/mekanism/textures/blocks/combiner/combinertop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerTop.png rename to src/main/resources/assets/mekanism/textures/blocks/combiner/combinertop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/combiner/combinertopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/combiner/CombinerTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/combiner/combinertopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/CopperBlock.png b/src/main/resources/assets/mekanism/textures/blocks/copperblock.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/CopperBlock.png rename to src/main/resources/assets/mekanism/textures/blocks/copperblock.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/CopperOre.png b/src/main/resources/assets/mekanism/textures/blocks/copperore.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/CopperOre.png rename to src/main/resources/assets/mekanism/textures/blocks/copperore.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherBack.png b/src/main/resources/assets/mekanism/textures/blocks/crusher/crusherback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherBack.png rename to src/main/resources/assets/mekanism/textures/blocks/crusher/crusherback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/crusher/crusherbackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/crusher/crusherbackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherBottom.png b/src/main/resources/assets/mekanism/textures/blocks/crusher/crusherbottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/crusher/crusherbottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherFront.png b/src/main/resources/assets/mekanism/textures/blocks/crusher/crusherfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherFront.png rename to src/main/resources/assets/mekanism/textures/blocks/crusher/crusherfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/crusher/crusherfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/crusher/crusherfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/crusher/crusherfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/crusher/crusherfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherLeft.png b/src/main/resources/assets/mekanism/textures/blocks/crusher/crusherleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/crusher/crusherleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/crusher/crusherlefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/crusher/crusherlefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherLeftOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/crusher/crusherlefton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherLeftOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/crusher/crusherlefton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherRight.png b/src/main/resources/assets/mekanism/textures/blocks/crusher/crusherright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherRight.png rename to src/main/resources/assets/mekanism/textures/blocks/crusher/crusherright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/crusher/crusherrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/crusher/crusherrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherRightOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/crusher/crusherrighton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherRightOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/crusher/crusherrighton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherTop.png b/src/main/resources/assets/mekanism/textures/blocks/crusher/crushertop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherTop.png rename to src/main/resources/assets/mekanism/textures/blocks/crusher/crushertop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/crusher/crushertopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/crusher/CrusherTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/crusher/crushertopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterBack.png b/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterBack.png rename to src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterbackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterbackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterBottom.png b/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterbottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterbottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterBottomOn.png b/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterbottomon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterBottomOn.png rename to src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterbottomon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterFront.png b/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterFront.png rename to src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterLeft.png b/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterlefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterlefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterRight.png b/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterRight.png rename to src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmelterrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterTop.png b/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmeltertop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterTop.png rename to src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmeltertop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmeltertopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/energized_smelter/EnergizedSmelterTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/energized_smelter/energizedsmeltertopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberBack.png b/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberBack.png rename to src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberbackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberbackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberBottom.png b/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberbottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberbottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberFront.png b/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberFront.png rename to src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberLeft.png b/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberlefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberlefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberRight.png b/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberRight.png rename to src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchamberrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberTop.png b/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchambertop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberTop.png rename to src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchambertop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchambertopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/EnrichmentChamberTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/enrichment_chamber/enrichmentchambertopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/AdvancedFactoryBottom.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/advancedfactorybottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/AdvancedFactoryBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/advancedfactorybottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactoryfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactoryfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/AdvancedCombiningFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/combining/advancedcombiningfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactoryfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactoryfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/AdvancedCompressingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/compressing/advancedcompressingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactoryfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactoryfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryLeftOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactorylefton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryLeftOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactorylefton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryRightOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactoryrighton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryRightOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactoryrighton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/AdvancedCrushingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/crushing/advancedcrushingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/AdvancedEnrichingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/enriching/advancedenrichingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/AdvancedInfusingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/infusing/advancedinfusingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/AdvancedInjectingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/injecting/advancedinjectingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/AdvancedPurifyingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/purifying/advancedpurifyingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactoryfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactoryfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/AdvancedSmeltingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/advanced/smelting/advancedsmeltingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/BasicFactoryBottom.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/basicfactorybottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/BasicFactoryBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/basicfactorybottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactoryfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactoryfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/BasicCombiningFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/combining/basiccombiningfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactoryfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactoryfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/BasicCompressingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/compressing/basiccompressingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactoryfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactoryfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryLeftOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactorylefton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryLeftOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactorylefton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryRightOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactoryrighton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryRightOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactoryrighton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/BasicCrushingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/crushing/basiccrushingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/BasicEnrichingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/enriching/basicenrichingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/BasicInfusingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/infusing/basicinfusingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/BasicInjectingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/injecting/basicinjectingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/BasicPurifyingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/purifying/basicpurifyingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactoryfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactoryfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/BasicSmeltingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/basic/smelting/basicsmeltingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactoryfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactoryfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/EliteCombiningFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/combining/elitecombiningfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactoryfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactoryfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/EliteCompressingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/compressing/elitecompressingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactoryfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactoryfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryLeftOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactorylefton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryLeftOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactorylefton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryRightOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactoryrighton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryRightOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactoryrighton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/EliteCrushingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/crushing/elitecrushingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/EliteFactoryBottom.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/elitefactorybottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/EliteFactoryBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/elitefactorybottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/EliteEnrichingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/enriching/eliteenrichingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/EliteInfusingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/infusing/eliteinfusingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/EliteInjectingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/injecting/eliteinjectingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/ElitePurifyingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/purifying/elitepurifyingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryBack.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactoryback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryBack.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactoryback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactorybackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactorybackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryFront.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactoryfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryFront.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactoryfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactoryfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactoryfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactoryfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactoryfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryLeft.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactoryleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactoryleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactorylefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactorylefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryRight.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactoryright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryRight.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactoryright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactoryrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactoryrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryTop.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactorytop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryTop.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactorytop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactorytopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/EliteSmeltingFactoryTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/factory/elite/smelting/elitesmeltingfactorytopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/FormulaicAssemblicatorBack.png b/src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/formulaicassemblicatorback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/FormulaicAssemblicatorBack.png rename to src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/formulaicassemblicatorback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/FormulaicAssemblicatorBottom.png b/src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/formulaicassemblicatorbottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/FormulaicAssemblicatorBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/formulaicassemblicatorbottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/FormulaicAssemblicatorFront.png b/src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/formulaicassemblicatorfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/FormulaicAssemblicatorFront.png rename to src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/formulaicassemblicatorfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/FormulaicAssemblicatorLeft.png b/src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/formulaicassemblicatorleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/FormulaicAssemblicatorLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/formulaicassemblicatorleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/FormulaicAssemblicatorRight.png b/src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/formulaicassemblicatorright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/FormulaicAssemblicatorRight.png rename to src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/formulaicassemblicatorright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/FormulaicAssemblicatorTop.png b/src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/formulaicassemblicatortop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/FormulaicAssemblicatorTop.png rename to src/main/resources/assets/mekanism/textures/blocks/formulaic_assemblicator/formulaicassemblicatortop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterBack.png b/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterBack.png rename to src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterbackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterbackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterBottom.png b/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterbottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterbottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterBottomOn.png b/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterbottomon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterBottomOn.png rename to src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterbottomon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterFront.png b/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterFront.png rename to src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterLeft.png b/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterlefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterlefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterRight.png b/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterRight.png rename to src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheaterrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterTop.png b/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheatertop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterTop.png rename to src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheatertop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheatertopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/FuelwoodHeaterTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/fuelwood_heater/fuelwoodheatertopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/GlowPlasticBlock.png b/src/main/resources/assets/mekanism/textures/blocks/glowplasticblock.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/GlowPlasticBlock.png rename to src/main/resources/assets/mekanism/textures/blocks/glowplasticblock.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/infuse/Bio.png b/src/main/resources/assets/mekanism/textures/blocks/infuse/bio.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/infuse/Bio.png rename to src/main/resources/assets/mekanism/textures/blocks/infuse/bio.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/infuse/Carbon.png b/src/main/resources/assets/mekanism/textures/blocks/infuse/carbon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/infuse/Carbon.png rename to src/main/resources/assets/mekanism/textures/blocks/infuse/carbon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/infuse/Diamond.png b/src/main/resources/assets/mekanism/textures/blocks/infuse/diamond.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/infuse/Diamond.png rename to src/main/resources/assets/mekanism/textures/blocks/infuse/diamond.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/infuse/Fungi.png b/src/main/resources/assets/mekanism/textures/blocks/infuse/fungi.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/infuse/Fungi.png rename to src/main/resources/assets/mekanism/textures/blocks/infuse/fungi.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/infuse/Obsidian.png b/src/main/resources/assets/mekanism/textures/blocks/infuse/obsidian.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/infuse/Obsidian.png rename to src/main/resources/assets/mekanism/textures/blocks/infuse/obsidian.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/infuse/Redstone.png b/src/main/resources/assets/mekanism/textures/blocks/infuse/redstone.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/infuse/Redstone.png rename to src/main/resources/assets/mekanism/textures/blocks/infuse/redstone.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/infuse/Tin.png b/src/main/resources/assets/mekanism/textures/blocks/infuse/tin.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/infuse/Tin.png rename to src/main/resources/assets/mekanism/textures/blocks/infuse/tin.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/Laser.png b/src/main/resources/assets/mekanism/textures/blocks/laser.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/Laser.png rename to src/main/resources/assets/mekanism/textures/blocks/laser.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidBrine.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidbrine.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidBrine.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidbrine.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidBrine.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidbrine.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidBrine.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidbrine.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidChlorine.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidchlorine.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidChlorine.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidchlorine.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidChlorine.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidchlorine.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidChlorine.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidchlorine.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidCleanOre.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidcleanore.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidCleanOre.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidcleanore.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidCleanOre.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidcleanore.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidCleanOre.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidcleanore.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidDeuterium.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquiddeuterium.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidDeuterium.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquiddeuterium.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidDT.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquiddeuterium.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidDT.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquiddeuterium.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidDT.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquiddt.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidDT.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquiddt.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidDeuterium.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquiddt.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidDeuterium.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquiddt.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidEnergy.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidenergy.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidEnergy.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidenergy.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidEnergy.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidenergy.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidEnergy.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidenergy.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidEthene.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidethene.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidEthene.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidethene.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidEthene.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidethene.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidEthene.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidethene.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidHeat.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidheat.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidHeat.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidheat.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidHeat.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidheat.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidHeat.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidheat.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidHeavyWater.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidheavywater.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidHeavyWater.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidheavywater.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidHeavyWater.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidheavywater.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidHeavyWater.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidheavywater.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidHydrogen.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidhydrogen.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidHydrogen.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidhydrogen.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidHydrogen.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidhydrogen.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidHydrogen.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidhydrogen.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidHydrogenChloride.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidhydrogenchloride.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidHydrogenChloride.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidhydrogenchloride.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidHydrogenChloride.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidhydrogenchloride.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidHydrogenChloride.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidhydrogenchloride.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidLithium.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidlithium.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidLithium.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidlithium.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidLithium.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidlithium.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidLithium.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidlithium.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidOre.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidore.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidOre.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidore.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidOre.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidore.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidOre.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidore.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidOsmium.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidosmium.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidOsmium.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidosmium.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidOsmium.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidosmium.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidOsmium.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidosmium.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidOxygen.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidoxygen.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidOxygen.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidoxygen.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidOxygen.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidoxygen.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidOxygen.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidoxygen.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSodium.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsodium.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSodium.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsodium.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSodium.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsodium.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSodium.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsodium.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSteam.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsteam.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSteam.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsteam.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSteam.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsteam.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSteam.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsteam.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidStone.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidstone.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidStone.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidstone.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidStone.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidstone.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidStone.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidstone.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSulfurDioxide.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsulfurdioxide.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSulfurDioxide.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsulfurdioxide.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSulfurDioxide.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsulfurdioxide.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSulfurDioxide.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsulfurdioxide.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSulfuricAcid.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsulfuricacid.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSulfuricAcid.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsulfuricacid.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSulfurTrioxide.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsulfuricacid.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSulfurTrioxide.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsulfuricacid.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSulfurTrioxide.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsulfurtrioxide.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSulfurTrioxide.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsulfurtrioxide.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSulfuricAcid.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsulfurtrioxide.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidSulfuricAcid.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidsulfurtrioxide.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidTritium.png b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidtritium.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidTritium.png rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidtritium.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidTritium.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/liquid/liquidtritium.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/liquid/LiquidTritium.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/liquid/liquidtritium.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/DiversionTransporter.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/diversiontransporter.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/DiversionTransporter.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/diversiontransporter.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/DiversionTransporterVertical.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/diversiontransportervertical.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/DiversionTransporterVertical.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/diversiontransportervertical.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/GlowPanel.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/glowpanel.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/GlowPanel.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/glowpanel.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporteradvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporteradvanced.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterbasic.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterBasic.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterbasic.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterelite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterelite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterGlass.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterglass.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterGlass.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterglass.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterGlassColored.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterglasscolored.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterGlassColored.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterglasscolored.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterultimate.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterVerticalAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterverticaladvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterVerticalAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterverticaladvanced.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterVerticalBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterverticalbasic.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterVerticalBasic.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterverticalbasic.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterVerticalElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterverticalelite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterVerticalElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterverticalelite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterVerticalGlass.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterverticalglass.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterVerticalGlass.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterverticalglass.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterVerticalGlassColored.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterverticalglasscolored.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterVerticalGlassColored.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterverticalglasscolored.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterVerticalUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterverticalultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/LogisticalTransporterVerticalUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/logisticaltransporterverticalultimate.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/MechanicalPipeAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/mechanicalpipeadvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/MechanicalPipeAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/mechanicalpipeadvanced.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/MechanicalPipeBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/mechanicalpipebasic.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/MechanicalPipeBasic.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/mechanicalpipebasic.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/MechanicalPipeElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/mechanicalpipeelite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/MechanicalPipeElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/mechanicalpipeelite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/MechanicalPipeUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/mechanicalpipeultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/MechanicalPipeUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/mechanicalpipeultimate.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/MechanicalPipeVerticalAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/mechanicalpipeverticaladvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/MechanicalPipeVerticalAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/mechanicalpipeverticaladvanced.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/MechanicalPipeVerticalBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/mechanicalpipeverticalbasic.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/MechanicalPipeVerticalBasic.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/mechanicalpipeverticalbasic.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/MechanicalPipeVerticalElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/mechanicalpipeverticalelite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/MechanicalPipeVerticalElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/mechanicalpipeverticalelite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/MechanicalPipeVerticalUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/mechanicalpipeverticalultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/MechanicalPipeVerticalUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/mechanicalpipeverticalultimate.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeVerticalBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeVerticalBasic.png deleted file mode 100644 index c24f4709b..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeVerticalBasic.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorVerticalAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorVerticalAdvanced.png deleted file mode 100644 index ca42645b9..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorVerticalAdvanced.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorVerticalBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorVerticalBasic.png deleted file mode 100644 index f37c9ed06..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorVerticalBasic.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorVerticalElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorVerticalElite.png deleted file mode 100644 index 650d217eb..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorVerticalElite.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableVerticalAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableVerticalAdvanced.png deleted file mode 100644 index aee09b335..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableVerticalAdvanced.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableVerticalBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableVerticalBasic.png deleted file mode 100644 index 9a3aba9ab..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableVerticalBasic.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableVerticalElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableVerticalElite.png deleted file mode 100644 index 83d7856cd..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableVerticalElite.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableVerticalUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableVerticalUltimate.png deleted file mode 100644 index f91f28830..000000000 Binary files a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableVerticalUltimate.png and /dev/null differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/DiversionTransporter.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/diversiontransporter.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/DiversionTransporter.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/diversiontransporter.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/DiversionTransporterVertical.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/diversiontransportervertical.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/DiversionTransporterVertical.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/diversiontransportervertical.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporteradvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporteradvanced.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterbasic.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterBasic.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterbasic.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterelite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterelite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterGlass.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterglass.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterGlass.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterglass.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterGlassColored.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterglasscolored.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterGlassColored.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterglasscolored.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterultimate.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterVerticalAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterverticaladvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterVerticalAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterverticaladvanced.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterVerticalBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterverticalbasic.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterVerticalBasic.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterverticalbasic.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterVerticalElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterverticalelite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterVerticalElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterverticalelite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterVerticalGlass.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterverticalglass.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterVerticalGlass.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterverticalglass.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterVerticalGlassColored.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterverticalglasscolored.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterVerticalGlassColored.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterverticalglasscolored.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterVerticalUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterverticalultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/LogisticalTransporterVerticalUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/logisticaltransporterverticalultimate.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/MechanicalPipeAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/mechanicalpipeadvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/MechanicalPipeAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/mechanicalpipeadvanced.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/MechanicalPipeBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/mechanicalpipebasic.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/MechanicalPipeBasic.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/mechanicalpipebasic.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/MechanicalPipeElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/mechanicalpipeelite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/MechanicalPipeElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/mechanicalpipeelite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/MechanicalPipeUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/mechanicalpipeultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/MechanicalPipeUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/mechanicalpipeultimate.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/MechanicalPipeVerticalAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/mechanicalpipeverticaladvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/MechanicalPipeVerticalAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/mechanicalpipeverticaladvanced.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/MechanicalPipeVerticalBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/mechanicalpipeverticalbasic.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/MechanicalPipeVerticalBasic.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/mechanicalpipeverticalbasic.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/MechanicalPipeVerticalElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/mechanicalpipeverticalelite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/MechanicalPipeVerticalElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/mechanicalpipeverticalelite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/MechanicalPipeVerticalUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/mechanicalpipeverticalultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/MechanicalPipeVerticalUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/mechanicalpipeverticalultimate.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/PressurizedTubeAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeadvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/PressurizedTubeAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeadvanced.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/PressurizedTubeBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubebasic.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/PressurizedTubeBasic.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubebasic.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/PressurizedTubeElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeelite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/PressurizedTubeElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeelite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/PressurizedTubeUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/PressurizedTubeUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeultimate.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeVerticalAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeverticaladvanced.png similarity index 69% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeVerticalAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeverticaladvanced.png index 44497054a..fa0f5fd8c 100644 Binary files a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeVerticalAdvanced.png and b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeverticaladvanced.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorVerticalUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeverticalbasic.png similarity index 69% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorVerticalUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeverticalbasic.png index 1a082971f..4cb6fd232 100644 Binary files a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorVerticalUltimate.png and b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeverticalbasic.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeVerticalUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeverticalelite.png similarity index 69% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeVerticalUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeverticalelite.png index 5cd7e1c8f..d5129eab0 100644 Binary files a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeVerticalUltimate.png and b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeverticalelite.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeVerticalElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeverticalultimate.png similarity index 68% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeVerticalElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeverticalultimate.png index ffde48b01..3b01d901d 100644 Binary files a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeVerticalElite.png and b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/pressurizedtubeverticalultimate.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/RestrictiveTransporter.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/restrictivetransporter.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/RestrictiveTransporter.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/restrictivetransporter.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/RestrictiveTransporterVertical.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/restrictivetransportervertical.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/RestrictiveTransporterVertical.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/restrictivetransportervertical.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/ThermodynamicConductorAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductoradvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/ThermodynamicConductorAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductoradvanced.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/ThermodynamicConductorBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorbasic.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/ThermodynamicConductorBasic.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorbasic.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/ThermodynamicConductorElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorelite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/ThermodynamicConductorElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorelite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/ThermodynamicConductorUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/ThermodynamicConductorUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorultimate.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorverticaladvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorverticaladvanced.png new file mode 100644 index 000000000..70a830e78 Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorverticaladvanced.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorverticalbasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorverticalbasic.png new file mode 100644 index 000000000..e2bba0da0 Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorverticalbasic.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorverticalelite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorverticalelite.png new file mode 100644 index 000000000..799ddbb8e Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorverticalelite.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorverticalultimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorverticalultimate.png new file mode 100644 index 000000000..81d9f08f5 Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/thermodynamicconductorverticalultimate.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/UniversalCableAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableadvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/UniversalCableAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableadvanced.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/UniversalCableBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcablebasic.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/UniversalCableBasic.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcablebasic.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/UniversalCableElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableelite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/UniversalCableElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableelite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/UniversalCableUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/UniversalCableUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableultimate.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableverticaladvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableverticaladvanced.png new file mode 100644 index 000000000..578511e81 Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableverticaladvanced.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableverticalbasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableverticalbasic.png new file mode 100644 index 000000000..079599a67 Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableverticalbasic.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableverticalelite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableverticalelite.png new file mode 100644 index 000000000..d321c97b2 Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableverticalelite.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableverticalultimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableverticalultimate.png new file mode 100644 index 000000000..c9b47052e Binary files /dev/null and b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/universalcableverticalultimate.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/pressurizedtubeadvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/pressurizedtubeadvanced.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/pressurizedtubebasic.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeBasic.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/pressurizedtubebasic.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/pressurizedtubeelite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/pressurizedtubeelite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/pressurizedtubeultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/PressurizedTubeUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/pressurizedtubeultimate.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/PressurizedTubeVerticalAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/pressurizedtubeverticaladvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/PressurizedTubeVerticalAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/pressurizedtubeverticaladvanced.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/PressurizedTubeVerticalBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/pressurizedtubeverticalbasic.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/PressurizedTubeVerticalBasic.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/pressurizedtubeverticalbasic.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/PressurizedTubeVerticalElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/pressurizedtubeverticalelite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/PressurizedTubeVerticalElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/pressurizedtubeverticalelite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/PressurizedTubeVerticalUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/pressurizedtubeverticalultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/PressurizedTubeVerticalUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/pressurizedtubeverticalultimate.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/RestrictiveTransporter.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/restrictivetransporter.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/RestrictiveTransporter.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/restrictivetransporter.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/RestrictiveTransporterVertical.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/restrictivetransportervertical.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/RestrictiveTransporterVertical.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/restrictivetransportervertical.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/thermodynamicconductoradvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/thermodynamicconductoradvanced.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/thermodynamicconductorbasic.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorBasic.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/thermodynamicconductorbasic.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/thermodynamicconductorelite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/thermodynamicconductorelite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/thermodynamicconductorultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/ThermodynamicConductorUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/thermodynamicconductorultimate.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/ThermodynamicConductorVerticalAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/thermodynamicconductorverticaladvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/ThermodynamicConductorVerticalAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/thermodynamicconductorverticaladvanced.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/ThermodynamicConductorVerticalBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/thermodynamicconductorverticalbasic.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/ThermodynamicConductorVerticalBasic.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/thermodynamicconductorverticalbasic.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/ThermodynamicConductorVerticalElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/thermodynamicconductorverticalelite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/ThermodynamicConductorVerticalElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/thermodynamicconductorverticalelite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/ThermodynamicConductorVerticalUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/thermodynamicconductorverticalultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/ThermodynamicConductorVerticalUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/thermodynamicconductorverticalultimate.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/universalcableadvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/universalcableadvanced.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/universalcablebasic.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableBasic.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/universalcablebasic.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/universalcableelite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/universalcableelite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/universalcableultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/opaque/UniversalCableUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/universalcableultimate.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/UniversalCableVerticalAdvanced.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/universalcableverticaladvanced.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/UniversalCableVerticalAdvanced.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/universalcableverticaladvanced.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/UniversalCableVerticalBasic.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/universalcableverticalbasic.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/UniversalCableVerticalBasic.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/universalcableverticalbasic.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/UniversalCableVerticalElite.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/universalcableverticalelite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/UniversalCableVerticalElite.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/universalcableverticalelite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/multipart/UniversalCableVerticalUltimate.png b/src/main/resources/assets/mekanism/textures/blocks/models/multipart/universalcableverticalultimate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/models/multipart/UniversalCableVerticalUltimate.png rename to src/main/resources/assets/mekanism/textures/blocks/models/multipart/universalcableverticalultimate.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/models/quantum_entangloporter.png b/src/main/resources/assets/mekanism/textures/blocks/models/quantum_entangloporter.png index a99747beb..517104037 100644 Binary files a/src/main/resources/assets/mekanism/textures/blocks/models/quantum_entangloporter.png and b/src/main/resources/assets/mekanism/textures/blocks/models/quantum_entangloporter.png differ diff --git a/src/main/resources/assets/mekanism/textures/blocks/oredictionificator/OredictionificatorBack.png b/src/main/resources/assets/mekanism/textures/blocks/oredictionificator/oredictionificatorback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/oredictionificator/OredictionificatorBack.png rename to src/main/resources/assets/mekanism/textures/blocks/oredictionificator/oredictionificatorback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/oredictionificator/OredictionificatorBottom.png b/src/main/resources/assets/mekanism/textures/blocks/oredictionificator/oredictionificatorbottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/oredictionificator/OredictionificatorBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/oredictionificator/oredictionificatorbottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/oredictionificator/OredictionificatorFront.png b/src/main/resources/assets/mekanism/textures/blocks/oredictionificator/oredictionificatorfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/oredictionificator/OredictionificatorFront.png rename to src/main/resources/assets/mekanism/textures/blocks/oredictionificator/oredictionificatorfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/oredictionificator/OredictionificatorLeft.png b/src/main/resources/assets/mekanism/textures/blocks/oredictionificator/oredictionificatorleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/oredictionificator/OredictionificatorLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/oredictionificator/oredictionificatorleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/oredictionificator/OredictionificatorRight.png b/src/main/resources/assets/mekanism/textures/blocks/oredictionificator/oredictionificatorright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/oredictionificator/OredictionificatorRight.png rename to src/main/resources/assets/mekanism/textures/blocks/oredictionificator/oredictionificatorright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/oredictionificator/OredictionificatorTop.png b/src/main/resources/assets/mekanism/textures/blocks/oredictionificator/oredictionificatortop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/oredictionificator/OredictionificatorTop.png rename to src/main/resources/assets/mekanism/textures/blocks/oredictionificator/oredictionificatortop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorBack.png b/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorBack.png rename to src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorbackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorbackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorBottom.png b/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorbottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorbottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorFront.png b/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorFront.png rename to src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorLeft.png b/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorlefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorlefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorRight.png b/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorRight.png rename to src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressorrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorTop.png b/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressortop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorTop.png rename to src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressortop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressortopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/OsmiumCompressorTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/osmium_compressor/osmiumcompressortopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/OsmiumBlock.png b/src/main/resources/assets/mekanism/textures/blocks/osmiumblock.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/OsmiumBlock.png rename to src/main/resources/assets/mekanism/textures/blocks/osmiumblock.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/OsmiumOre.png b/src/main/resources/assets/mekanism/textures/blocks/osmiumore.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/OsmiumOre.png rename to src/main/resources/assets/mekanism/textures/blocks/osmiumore.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/EnergyOverlay.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/energyoverlay.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/EnergyOverlay.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/energyoverlay.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/FluidsOverlay.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/fluidsoverlay.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/FluidsOverlay.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/fluidsoverlay.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/GasesOverlay.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/gasesoverlay.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/GasesOverlay.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/gasesoverlay.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/HeatOverlay.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/heatoverlay.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/HeatOverlay.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/heatoverlay.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/ItemsOverlay.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/itemsoverlay.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/ItemsOverlay.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/itemsoverlay.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayBrightGreen.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_brightgreen.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayBrightGreen.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_brightgreen.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayBrightPink.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_brightpink.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayBrightPink.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_brightpink.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayDarkAqua.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkaqua.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayDarkAqua.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkaqua.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayDarkBlue.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkblue.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayDarkBlue.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkblue.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayDarkGreen.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkgreen.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayDarkGreen.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkgreen.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayDarkGrey.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkgrey.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayDarkGrey.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkgrey.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayDarkRed.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkred.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayDarkRed.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkred.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayAqua.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlayaqua.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayAqua.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlayaqua.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayBlack.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlayblack.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayBlack.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlayblack.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_brightGreen.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlaybrightgreen.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_brightGreen.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlaybrightgreen.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_brightPink.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlaybrightpink.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_brightPink.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlaybrightpink.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayBrown.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlaybrown.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayBrown.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlaybrown.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkAqua.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlaydarkaqua.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkAqua.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlaydarkaqua.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkBlue.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlaydarkblue.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkBlue.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlaydarkblue.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkGreen.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlaydarkgreen.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkGreen.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlaydarkgreen.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkGrey.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlaydarkgrey.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkGrey.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlaydarkgrey.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkRed.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlaydarkred.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/overlay_darkRed.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlaydarkred.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayGrey.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlaygrey.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayGrey.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlaygrey.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayIndigo.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlayindigo.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayIndigo.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlayindigo.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayOrange.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlayorange.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayOrange.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlayorange.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayPink.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlaypink.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayPink.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlaypink.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayPurple.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlaypurple.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayPurple.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlaypurple.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayRed.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlayred.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayRed.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlayred.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayWhite.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlaywhite.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayWhite.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlaywhite.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayYellow.png b/src/main/resources/assets/mekanism/textures/blocks/overlay/overlayyellow.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/overlay/OverlayYellow.png rename to src/main/resources/assets/mekanism/textures/blocks/overlay/overlayyellow.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/PlasticBlock.png b/src/main/resources/assets/mekanism/textures/blocks/plasticblock.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/PlasticBlock.png rename to src/main/resources/assets/mekanism/textures/blocks/plasticblock.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/PlasticFence.png b/src/main/resources/assets/mekanism/textures/blocks/plasticfence.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/PlasticFence.png rename to src/main/resources/assets/mekanism/textures/blocks/plasticfence.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillBack.png b/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillBack.png rename to src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillbackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillbackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillBackOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillbackon.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillBackOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillbackon.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillBottom.png b/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillbottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillbottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillFront.png b/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillFront.png rename to src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillLeft.png b/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmilllefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmilllefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillLeftOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmilllefton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillLeftOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmilllefton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillRight.png b/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillRight.png rename to src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillRightOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillrighton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillRightOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmillrighton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillTop.png b/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmilltop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillTop.png rename to src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmilltop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmilltopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmilltopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillTopOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmilltopon.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/PrecisionSawmillTopOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/precision_sawmill/precisionsawmilltopon.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/PressureDisperser.png b/src/main/resources/assets/mekanism/textures/blocks/pressuredisperser.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/PressureDisperser.png rename to src/main/resources/assets/mekanism/textures/blocks/pressuredisperser.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberBack.png b/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberback.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberBack.png rename to src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberback.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberBackOn.png b/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberbackon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberBackOn.png rename to src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberbackon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberBottom.png b/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberbottom.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberBottom.png rename to src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberbottom.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberFront.png b/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberfront.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberFront.png rename to src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberfront.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberFrontOn.png b/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberfronton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberFrontOn.png rename to src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberfronton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberFrontOn.png.mcmeta b/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberfronton.png.mcmeta similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberFrontOn.png.mcmeta rename to src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberfronton.png.mcmeta diff --git a/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberLeft.png b/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberleft.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberLeft.png rename to src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberleft.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberLeftOn.png b/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberlefton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberLeftOn.png rename to src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberlefton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberRight.png b/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberright.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberRight.png rename to src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberright.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberRightOn.png b/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberrighton.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberRightOn.png rename to src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchamberrighton.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberTop.png b/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchambertop.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberTop.png rename to src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchambertop.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberTopOn.png b/src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchambertopon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/purification_chamber/PurificationChamberTopOn.png rename to src/main/resources/assets/mekanism/textures/blocks/purification_chamber/purificationchambertopon.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/RefinedGlowstone.png b/src/main/resources/assets/mekanism/textures/blocks/refinedglowstone.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/RefinedGlowstone.png rename to src/main/resources/assets/mekanism/textures/blocks/refinedglowstone.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/RefinedObsidian.png b/src/main/resources/assets/mekanism/textures/blocks/refinedobsidian.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/RefinedObsidian.png rename to src/main/resources/assets/mekanism/textures/blocks/refinedobsidian.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/ReinforcedPlasticBlock.png b/src/main/resources/assets/mekanism/textures/blocks/reinforcedplasticblock.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/ReinforcedPlasticBlock.png rename to src/main/resources/assets/mekanism/textures/blocks/reinforcedplasticblock.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/RoadPlasticBlock.png b/src/main/resources/assets/mekanism/textures/blocks/roadplasticblock.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/RoadPlasticBlock.png rename to src/main/resources/assets/mekanism/textures/blocks/roadplasticblock.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/SaltBlock.png b/src/main/resources/assets/mekanism/textures/blocks/saltblock.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/SaltBlock.png rename to src/main/resources/assets/mekanism/textures/blocks/saltblock.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/SlickPlasticBlock.png b/src/main/resources/assets/mekanism/textures/blocks/slickplasticblock.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/SlickPlasticBlock.png rename to src/main/resources/assets/mekanism/textures/blocks/slickplasticblock.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/SteelBlock.png b/src/main/resources/assets/mekanism/textures/blocks/steelblock.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/SteelBlock.png rename to src/main/resources/assets/mekanism/textures/blocks/steelblock.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/SteelCasing.png b/src/main/resources/assets/mekanism/textures/blocks/steelcasing.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/SteelCasing.png rename to src/main/resources/assets/mekanism/textures/blocks/steelcasing.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/TinBlock.png b/src/main/resources/assets/mekanism/textures/blocks/tinblock.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/TinBlock.png rename to src/main/resources/assets/mekanism/textures/blocks/tinblock.png diff --git a/src/main/resources/assets/mekanism/textures/blocks/TinOre.png b/src/main/resources/assets/mekanism/textures/blocks/tinore.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/blocks/TinOre.png rename to src/main/resources/assets/mekanism/textures/blocks/tinore.png diff --git a/src/main/resources/assets/mekanism/textures/entities/Balloon.png b/src/main/resources/assets/mekanism/textures/entities/balloon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/entities/Balloon.png rename to src/main/resources/assets/mekanism/textures/entities/balloon.png diff --git a/src/main/resources/assets/mekanism/textures/entities/Robit.png b/src/main/resources/assets/mekanism/textures/entities/robit.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/entities/Robit.png rename to src/main/resources/assets/mekanism/textures/entities/robit.png diff --git a/src/main/resources/assets/mekanism/textures/items/AdvancedControlCircuit.png b/src/main/resources/assets/mekanism/textures/items/advancedcontrolcircuit.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/AdvancedControlCircuit.png rename to src/main/resources/assets/mekanism/textures/items/advancedcontrolcircuit.png diff --git a/src/main/resources/assets/mekanism/textures/items/AdvancedTierInstaller.png b/src/main/resources/assets/mekanism/textures/items/advancedtierinstaller.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/AdvancedTierInstaller.png rename to src/main/resources/assets/mekanism/textures/items/advancedtierinstaller.png diff --git a/src/main/resources/assets/mekanism/textures/items/AnchorUpgrade.png b/src/main/resources/assets/mekanism/textures/items/anchorupgrade.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/AnchorUpgrade.png rename to src/main/resources/assets/mekanism/textures/items/anchorupgrade.png diff --git a/src/main/resources/assets/mekanism/textures/items/AtomicAlloy.png b/src/main/resources/assets/mekanism/textures/items/atomicalloy.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/AtomicAlloy.png rename to src/main/resources/assets/mekanism/textures/items/atomicalloy.png diff --git a/src/main/resources/assets/mekanism/textures/items/BasicControlCircuit.png b/src/main/resources/assets/mekanism/textures/items/basiccontrolcircuit.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/BasicControlCircuit.png rename to src/main/resources/assets/mekanism/textures/items/basiccontrolcircuit.png diff --git a/src/main/resources/assets/mekanism/textures/items/BasicTierInstaller.png b/src/main/resources/assets/mekanism/textures/items/basictierinstaller.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/BasicTierInstaller.png rename to src/main/resources/assets/mekanism/textures/items/basictierinstaller.png diff --git a/src/main/resources/assets/mekanism/textures/items/BioFuel.png b/src/main/resources/assets/mekanism/textures/items/biofuel.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/BioFuel.png rename to src/main/resources/assets/mekanism/textures/items/biofuel.png diff --git a/src/main/resources/assets/mekanism/textures/items/BronzeIngot.png b/src/main/resources/assets/mekanism/textures/items/bronzeingot.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/BronzeIngot.png rename to src/main/resources/assets/mekanism/textures/items/bronzeingot.png diff --git a/src/main/resources/assets/mekanism/textures/items/CompressedCarbon.png b/src/main/resources/assets/mekanism/textures/items/compressedcarbon.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/CompressedCarbon.png rename to src/main/resources/assets/mekanism/textures/items/compressedcarbon.png diff --git a/src/main/resources/assets/mekanism/textures/items/CompressedDiamond.png b/src/main/resources/assets/mekanism/textures/items/compresseddiamond.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/CompressedDiamond.png rename to src/main/resources/assets/mekanism/textures/items/compresseddiamond.png diff --git a/src/main/resources/assets/mekanism/textures/items/CompressedObsidian.png b/src/main/resources/assets/mekanism/textures/items/compressedobsidian.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/CompressedObsidian.png rename to src/main/resources/assets/mekanism/textures/items/compressedobsidian.png diff --git a/src/main/resources/assets/mekanism/textures/items/CompressedRedstone.png b/src/main/resources/assets/mekanism/textures/items/compressedredstone.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/CompressedRedstone.png rename to src/main/resources/assets/mekanism/textures/items/compressedredstone.png diff --git a/src/main/resources/assets/mekanism/textures/items/ConfigurationCard.png b/src/main/resources/assets/mekanism/textures/items/configurationcard.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/ConfigurationCard.png rename to src/main/resources/assets/mekanism/textures/items/configurationcard.png diff --git a/src/main/resources/assets/mekanism/textures/items/Configurator.png b/src/main/resources/assets/mekanism/textures/items/configurator.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/Configurator.png rename to src/main/resources/assets/mekanism/textures/items/configurator.png diff --git a/src/main/resources/assets/mekanism/textures/items/CopperClump.png b/src/main/resources/assets/mekanism/textures/items/copperclump.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/CopperClump.png rename to src/main/resources/assets/mekanism/textures/items/copperclump.png diff --git a/src/main/resources/assets/mekanism/textures/items/CopperCrystal.png b/src/main/resources/assets/mekanism/textures/items/coppercrystal.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/CopperCrystal.png rename to src/main/resources/assets/mekanism/textures/items/coppercrystal.png diff --git a/src/main/resources/assets/mekanism/textures/items/CopperDust.png b/src/main/resources/assets/mekanism/textures/items/copperdust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/CopperDust.png rename to src/main/resources/assets/mekanism/textures/items/copperdust.png diff --git a/src/main/resources/assets/mekanism/textures/items/CopperIngot.png b/src/main/resources/assets/mekanism/textures/items/copperingot.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/CopperIngot.png rename to src/main/resources/assets/mekanism/textures/items/copperingot.png diff --git a/src/main/resources/assets/mekanism/textures/items/CopperShard.png b/src/main/resources/assets/mekanism/textures/items/coppershard.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/CopperShard.png rename to src/main/resources/assets/mekanism/textures/items/coppershard.png diff --git a/src/main/resources/assets/mekanism/textures/items/CraftingFormula.png b/src/main/resources/assets/mekanism/textures/items/craftingformula.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/CraftingFormula.png rename to src/main/resources/assets/mekanism/textures/items/craftingformula.png diff --git a/src/main/resources/assets/mekanism/textures/items/CraftingFormulaEncoded.png b/src/main/resources/assets/mekanism/textures/items/craftingformulaencoded.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/CraftingFormulaEncoded.png rename to src/main/resources/assets/mekanism/textures/items/craftingformulaencoded.png diff --git a/src/main/resources/assets/mekanism/textures/items/CraftingFormulaInvalid.png b/src/main/resources/assets/mekanism/textures/items/craftingformulainvalid.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/CraftingFormulaInvalid.png rename to src/main/resources/assets/mekanism/textures/items/craftingformulainvalid.png diff --git a/src/main/resources/assets/mekanism/textures/items/DiamondDust.png b/src/main/resources/assets/mekanism/textures/items/diamonddust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/DiamondDust.png rename to src/main/resources/assets/mekanism/textures/items/diamonddust.png diff --git a/src/main/resources/assets/mekanism/textures/items/Dictionary.png b/src/main/resources/assets/mekanism/textures/items/dictionary.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/Dictionary.png rename to src/main/resources/assets/mekanism/textures/items/dictionary.png diff --git a/src/main/resources/assets/mekanism/textures/items/DirtyCopperDust.png b/src/main/resources/assets/mekanism/textures/items/dirtycopperdust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/DirtyCopperDust.png rename to src/main/resources/assets/mekanism/textures/items/dirtycopperdust.png diff --git a/src/main/resources/assets/mekanism/textures/items/DirtyGoldDust.png b/src/main/resources/assets/mekanism/textures/items/dirtygolddust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/DirtyGoldDust.png rename to src/main/resources/assets/mekanism/textures/items/dirtygolddust.png diff --git a/src/main/resources/assets/mekanism/textures/items/DirtyIronDust.png b/src/main/resources/assets/mekanism/textures/items/dirtyirondust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/DirtyIronDust.png rename to src/main/resources/assets/mekanism/textures/items/dirtyirondust.png diff --git a/src/main/resources/assets/mekanism/textures/items/DirtyLeadDust.png b/src/main/resources/assets/mekanism/textures/items/dirtyleaddust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/DirtyLeadDust.png rename to src/main/resources/assets/mekanism/textures/items/dirtyleaddust.png diff --git a/src/main/resources/assets/mekanism/textures/items/DirtyObsidianDust.png b/src/main/resources/assets/mekanism/textures/items/dirtyobsidiandust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/DirtyObsidianDust.png rename to src/main/resources/assets/mekanism/textures/items/dirtyobsidiandust.png diff --git a/src/main/resources/assets/mekanism/textures/items/DirtyOsmiumDust.png b/src/main/resources/assets/mekanism/textures/items/dirtyosmiumdust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/DirtyOsmiumDust.png rename to src/main/resources/assets/mekanism/textures/items/dirtyosmiumdust.png diff --git a/src/main/resources/assets/mekanism/textures/items/DirtySilverDust.png b/src/main/resources/assets/mekanism/textures/items/dirtysilverdust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/DirtySilverDust.png rename to src/main/resources/assets/mekanism/textures/items/dirtysilverdust.png diff --git a/src/main/resources/assets/mekanism/textures/items/DirtyTinDust.png b/src/main/resources/assets/mekanism/textures/items/dirtytindust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/DirtyTinDust.png rename to src/main/resources/assets/mekanism/textures/items/dirtytindust.png diff --git a/src/main/resources/assets/mekanism/textures/items/ElectricBow.png b/src/main/resources/assets/mekanism/textures/items/electricbow.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/ElectricBow.png rename to src/main/resources/assets/mekanism/textures/items/electricbow.png diff --git a/src/main/resources/assets/mekanism/textures/items/ElectrolyticCore.png b/src/main/resources/assets/mekanism/textures/items/electrolyticcore.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/ElectrolyticCore.png rename to src/main/resources/assets/mekanism/textures/items/electrolyticcore.png diff --git a/src/main/resources/assets/mekanism/textures/items/EliteControlCircuit.png b/src/main/resources/assets/mekanism/textures/items/elitecontrolcircuit.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/EliteControlCircuit.png rename to src/main/resources/assets/mekanism/textures/items/elitecontrolcircuit.png diff --git a/src/main/resources/assets/mekanism/textures/items/EliteTierInstaller.png b/src/main/resources/assets/mekanism/textures/items/elitetierinstaller.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/EliteTierInstaller.png rename to src/main/resources/assets/mekanism/textures/items/elitetierinstaller.png diff --git a/src/main/resources/assets/mekanism/textures/items/EnergyTablet.png b/src/main/resources/assets/mekanism/textures/items/energytablet.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/EnergyTablet.png rename to src/main/resources/assets/mekanism/textures/items/energytablet.png diff --git a/src/main/resources/assets/mekanism/textures/items/EnergyUpgrade.png b/src/main/resources/assets/mekanism/textures/items/energyupgrade.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/EnergyUpgrade.png rename to src/main/resources/assets/mekanism/textures/items/energyupgrade.png diff --git a/src/main/resources/assets/mekanism/textures/items/EnrichedAlloy.png b/src/main/resources/assets/mekanism/textures/items/enrichedalloy.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/EnrichedAlloy.png rename to src/main/resources/assets/mekanism/textures/items/enrichedalloy.png diff --git a/src/main/resources/assets/mekanism/textures/items/EnrichedIron.png b/src/main/resources/assets/mekanism/textures/items/enrichediron.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/EnrichedIron.png rename to src/main/resources/assets/mekanism/textures/items/enrichediron.png diff --git a/src/main/resources/assets/mekanism/textures/items/EnrichedIron_alt.png b/src/main/resources/assets/mekanism/textures/items/enrichediron_alt.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/EnrichedIron_alt.png rename to src/main/resources/assets/mekanism/textures/items/enrichediron_alt.png diff --git a/src/main/resources/assets/mekanism/textures/items/FilterUpgrade.png b/src/main/resources/assets/mekanism/textures/items/filterupgrade.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/FilterUpgrade.png rename to src/main/resources/assets/mekanism/textures/items/filterupgrade.png diff --git a/src/main/resources/assets/mekanism/textures/items/GasUpgrade.png b/src/main/resources/assets/mekanism/textures/items/gasupgrade.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/GasUpgrade.png rename to src/main/resources/assets/mekanism/textures/items/gasupgrade.png diff --git a/src/main/resources/assets/mekanism/textures/items/GaugeDropper.png b/src/main/resources/assets/mekanism/textures/items/gaugedropper.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/GaugeDropper.png rename to src/main/resources/assets/mekanism/textures/items/gaugedropper.png diff --git a/src/main/resources/assets/mekanism/textures/items/GlowstoneIngot.png b/src/main/resources/assets/mekanism/textures/items/glowstoneingot.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/GlowstoneIngot.png rename to src/main/resources/assets/mekanism/textures/items/glowstoneingot.png diff --git a/src/main/resources/assets/mekanism/textures/items/GoldClump.png b/src/main/resources/assets/mekanism/textures/items/goldclump.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/GoldClump.png rename to src/main/resources/assets/mekanism/textures/items/goldclump.png diff --git a/src/main/resources/assets/mekanism/textures/items/GoldCrystal.png b/src/main/resources/assets/mekanism/textures/items/goldcrystal.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/GoldCrystal.png rename to src/main/resources/assets/mekanism/textures/items/goldcrystal.png diff --git a/src/main/resources/assets/mekanism/textures/items/GoldDust.png b/src/main/resources/assets/mekanism/textures/items/golddust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/GoldDust.png rename to src/main/resources/assets/mekanism/textures/items/golddust.png diff --git a/src/main/resources/assets/mekanism/textures/items/GoldShard.png b/src/main/resources/assets/mekanism/textures/items/goldshard.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/GoldShard.png rename to src/main/resources/assets/mekanism/textures/items/goldshard.png diff --git a/src/main/resources/assets/mekanism/textures/items/HDPEPellet.png b/src/main/resources/assets/mekanism/textures/items/hdpepellet.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/HDPEPellet.png rename to src/main/resources/assets/mekanism/textures/items/hdpepellet.png diff --git a/src/main/resources/assets/mekanism/textures/items/HDPERod.png b/src/main/resources/assets/mekanism/textures/items/hdperod.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/HDPERod.png rename to src/main/resources/assets/mekanism/textures/items/hdperod.png diff --git a/src/main/resources/assets/mekanism/textures/items/HDPESheet.png b/src/main/resources/assets/mekanism/textures/items/hdpesheet.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/HDPESheet.png rename to src/main/resources/assets/mekanism/textures/items/hdpesheet.png diff --git a/src/main/resources/assets/mekanism/textures/items/IronClump.png b/src/main/resources/assets/mekanism/textures/items/ironclump.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/IronClump.png rename to src/main/resources/assets/mekanism/textures/items/ironclump.png diff --git a/src/main/resources/assets/mekanism/textures/items/IronCrystal.png b/src/main/resources/assets/mekanism/textures/items/ironcrystal.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/IronCrystal.png rename to src/main/resources/assets/mekanism/textures/items/ironcrystal.png diff --git a/src/main/resources/assets/mekanism/textures/items/IronDust.png b/src/main/resources/assets/mekanism/textures/items/irondust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/IronDust.png rename to src/main/resources/assets/mekanism/textures/items/irondust.png diff --git a/src/main/resources/assets/mekanism/textures/items/IronShard.png b/src/main/resources/assets/mekanism/textures/items/ironshard.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/IronShard.png rename to src/main/resources/assets/mekanism/textures/items/ironshard.png diff --git a/src/main/resources/assets/mekanism/textures/items/LeadClump.png b/src/main/resources/assets/mekanism/textures/items/leadclump.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/LeadClump.png rename to src/main/resources/assets/mekanism/textures/items/leadclump.png diff --git a/src/main/resources/assets/mekanism/textures/items/LeadCrystal.png b/src/main/resources/assets/mekanism/textures/items/leadcrystal.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/LeadCrystal.png rename to src/main/resources/assets/mekanism/textures/items/leadcrystal.png diff --git a/src/main/resources/assets/mekanism/textures/items/LeadDust.png b/src/main/resources/assets/mekanism/textures/items/leaddust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/LeadDust.png rename to src/main/resources/assets/mekanism/textures/items/leaddust.png diff --git a/src/main/resources/assets/mekanism/textures/items/LeadShard.png b/src/main/resources/assets/mekanism/textures/items/leadshard.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/LeadShard.png rename to src/main/resources/assets/mekanism/textures/items/leadshard.png diff --git a/src/main/resources/assets/mekanism/textures/items/LithiumDust.png b/src/main/resources/assets/mekanism/textures/items/lithiumdust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/LithiumDust.png rename to src/main/resources/assets/mekanism/textures/items/lithiumdust.png diff --git a/src/main/resources/assets/mekanism/textures/items/MufflingUpgrade.png b/src/main/resources/assets/mekanism/textures/items/mufflingupgrade.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/MufflingUpgrade.png rename to src/main/resources/assets/mekanism/textures/items/mufflingupgrade.png diff --git a/src/main/resources/assets/mekanism/textures/items/NetworkReader.png b/src/main/resources/assets/mekanism/textures/items/networkreader.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/NetworkReader.png rename to src/main/resources/assets/mekanism/textures/items/networkreader.png diff --git a/src/main/resources/assets/mekanism/textures/items/ObsidianDust.png b/src/main/resources/assets/mekanism/textures/items/obsidiandust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/ObsidianDust.png rename to src/main/resources/assets/mekanism/textures/items/obsidiandust.png diff --git a/src/main/resources/assets/mekanism/textures/items/ObsidianIngot.png b/src/main/resources/assets/mekanism/textures/items/obsidianingot.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/ObsidianIngot.png rename to src/main/resources/assets/mekanism/textures/items/obsidianingot.png diff --git a/src/main/resources/assets/mekanism/textures/items/OsmiumClump.png b/src/main/resources/assets/mekanism/textures/items/osmiumclump.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/OsmiumClump.png rename to src/main/resources/assets/mekanism/textures/items/osmiumclump.png diff --git a/src/main/resources/assets/mekanism/textures/items/OsmiumCrystal.png b/src/main/resources/assets/mekanism/textures/items/osmiumcrystal.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/OsmiumCrystal.png rename to src/main/resources/assets/mekanism/textures/items/osmiumcrystal.png diff --git a/src/main/resources/assets/mekanism/textures/items/OsmiumDust.png b/src/main/resources/assets/mekanism/textures/items/osmiumdust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/OsmiumDust.png rename to src/main/resources/assets/mekanism/textures/items/osmiumdust.png diff --git a/src/main/resources/assets/mekanism/textures/items/OsmiumIngot.png b/src/main/resources/assets/mekanism/textures/items/osmiumingot.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/OsmiumIngot.png rename to src/main/resources/assets/mekanism/textures/items/osmiumingot.png diff --git a/src/main/resources/assets/mekanism/textures/items/OsmiumShard.png b/src/main/resources/assets/mekanism/textures/items/osmiumshard.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/OsmiumShard.png rename to src/main/resources/assets/mekanism/textures/items/osmiumshard.png diff --git a/src/main/resources/assets/mekanism/textures/items/PlaStick.png b/src/main/resources/assets/mekanism/textures/items/plastick.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/PlaStick.png rename to src/main/resources/assets/mekanism/textures/items/plastick.png diff --git a/src/main/resources/assets/mekanism/textures/items/PortableTeleporter.png b/src/main/resources/assets/mekanism/textures/items/portableteleporter.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/PortableTeleporter.png rename to src/main/resources/assets/mekanism/textures/items/portableteleporter.png diff --git a/src/main/resources/assets/mekanism/textures/items/RefinedObsidianDust.png b/src/main/resources/assets/mekanism/textures/items/refinedobsidiandust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/RefinedObsidianDust.png rename to src/main/resources/assets/mekanism/textures/items/refinedobsidiandust.png diff --git a/src/main/resources/assets/mekanism/textures/items/ReinforcedAlloy.png b/src/main/resources/assets/mekanism/textures/items/reinforcedalloy.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/ReinforcedAlloy.png rename to src/main/resources/assets/mekanism/textures/items/reinforcedalloy.png diff --git a/src/main/resources/assets/mekanism/textures/items/Salt.png b/src/main/resources/assets/mekanism/textures/items/salt.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/Salt.png rename to src/main/resources/assets/mekanism/textures/items/salt.png diff --git a/src/main/resources/assets/mekanism/textures/items/Sawdust.png b/src/main/resources/assets/mekanism/textures/items/sawdust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/Sawdust.png rename to src/main/resources/assets/mekanism/textures/items/sawdust.png diff --git a/src/main/resources/assets/mekanism/textures/items/SeismicReader.png b/src/main/resources/assets/mekanism/textures/items/seismicreader.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/SeismicReader.png rename to src/main/resources/assets/mekanism/textures/items/seismicreader.png diff --git a/src/main/resources/assets/mekanism/textures/items/SilverClump.png b/src/main/resources/assets/mekanism/textures/items/silverclump.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/SilverClump.png rename to src/main/resources/assets/mekanism/textures/items/silverclump.png diff --git a/src/main/resources/assets/mekanism/textures/items/SilverCrystal.png b/src/main/resources/assets/mekanism/textures/items/silvercrystal.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/SilverCrystal.png rename to src/main/resources/assets/mekanism/textures/items/silvercrystal.png diff --git a/src/main/resources/assets/mekanism/textures/items/SilverDust.png b/src/main/resources/assets/mekanism/textures/items/silverdust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/SilverDust.png rename to src/main/resources/assets/mekanism/textures/items/silverdust.png diff --git a/src/main/resources/assets/mekanism/textures/items/SilverShard.png b/src/main/resources/assets/mekanism/textures/items/silvershard.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/SilverShard.png rename to src/main/resources/assets/mekanism/textures/items/silvershard.png diff --git a/src/main/resources/assets/mekanism/textures/items/SpeedUpgrade.png b/src/main/resources/assets/mekanism/textures/items/speedupgrade.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/SpeedUpgrade.png rename to src/main/resources/assets/mekanism/textures/items/speedupgrade.png diff --git a/src/main/resources/assets/mekanism/textures/items/SteelDust.png b/src/main/resources/assets/mekanism/textures/items/steeldust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/SteelDust.png rename to src/main/resources/assets/mekanism/textures/items/steeldust.png diff --git a/src/main/resources/assets/mekanism/textures/items/SteelIngot.png b/src/main/resources/assets/mekanism/textures/items/steelingot.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/SteelIngot.png rename to src/main/resources/assets/mekanism/textures/items/steelingot.png diff --git a/src/main/resources/assets/mekanism/textures/items/Substrate.png b/src/main/resources/assets/mekanism/textures/items/substrate.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/Substrate.png rename to src/main/resources/assets/mekanism/textures/items/substrate.png diff --git a/src/main/resources/assets/mekanism/textures/items/SulfurDust.png b/src/main/resources/assets/mekanism/textures/items/sulfurdust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/SulfurDust.png rename to src/main/resources/assets/mekanism/textures/items/sulfurdust.png diff --git a/src/main/resources/assets/mekanism/textures/items/TeleportationCore.png b/src/main/resources/assets/mekanism/textures/items/teleportationcore.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/TeleportationCore.png rename to src/main/resources/assets/mekanism/textures/items/teleportationcore.png diff --git a/src/main/resources/assets/mekanism/textures/items/TinClump.png b/src/main/resources/assets/mekanism/textures/items/tinclump.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/TinClump.png rename to src/main/resources/assets/mekanism/textures/items/tinclump.png diff --git a/src/main/resources/assets/mekanism/textures/items/TinCrystal.png b/src/main/resources/assets/mekanism/textures/items/tincrystal.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/TinCrystal.png rename to src/main/resources/assets/mekanism/textures/items/tincrystal.png diff --git a/src/main/resources/assets/mekanism/textures/items/TinDust.png b/src/main/resources/assets/mekanism/textures/items/tindust.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/TinDust.png rename to src/main/resources/assets/mekanism/textures/items/tindust.png diff --git a/src/main/resources/assets/mekanism/textures/items/TinIngot.png b/src/main/resources/assets/mekanism/textures/items/tiningot.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/TinIngot.png rename to src/main/resources/assets/mekanism/textures/items/tiningot.png diff --git a/src/main/resources/assets/mekanism/textures/items/TinShard.png b/src/main/resources/assets/mekanism/textures/items/tinshard.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/TinShard.png rename to src/main/resources/assets/mekanism/textures/items/tinshard.png diff --git a/src/main/resources/assets/mekanism/textures/items/UltimateControlCircuit.png b/src/main/resources/assets/mekanism/textures/items/ultimatecontrolcircuit.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/UltimateControlCircuit.png rename to src/main/resources/assets/mekanism/textures/items/ultimatecontrolcircuit.png diff --git a/src/main/resources/assets/mekanism/textures/items/UltimateTierInstaller.png b/src/main/resources/assets/mekanism/textures/items/ultimatetierinstaller.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/UltimateTierInstaller.png rename to src/main/resources/assets/mekanism/textures/items/ultimatetierinstaller.png diff --git a/src/main/resources/assets/mekanism/textures/items/WalkieTalkie.png b/src/main/resources/assets/mekanism/textures/items/walkietalkie.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/WalkieTalkie.png rename to src/main/resources/assets/mekanism/textures/items/walkietalkie.png diff --git a/src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch1.png b/src/main/resources/assets/mekanism/textures/items/walkietalkie_ch1.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch1.png rename to src/main/resources/assets/mekanism/textures/items/walkietalkie_ch1.png diff --git a/src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch2.png b/src/main/resources/assets/mekanism/textures/items/walkietalkie_ch2.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch2.png rename to src/main/resources/assets/mekanism/textures/items/walkietalkie_ch2.png diff --git a/src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch3.png b/src/main/resources/assets/mekanism/textures/items/walkietalkie_ch3.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch3.png rename to src/main/resources/assets/mekanism/textures/items/walkietalkie_ch3.png diff --git a/src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch4.png b/src/main/resources/assets/mekanism/textures/items/walkietalkie_ch4.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch4.png rename to src/main/resources/assets/mekanism/textures/items/walkietalkie_ch4.png diff --git a/src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch5.png b/src/main/resources/assets/mekanism/textures/items/walkietalkie_ch5.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch5.png rename to src/main/resources/assets/mekanism/textures/items/walkietalkie_ch5.png diff --git a/src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch6.png b/src/main/resources/assets/mekanism/textures/items/walkietalkie_ch6.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch6.png rename to src/main/resources/assets/mekanism/textures/items/walkietalkie_ch6.png diff --git a/src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch7.png b/src/main/resources/assets/mekanism/textures/items/walkietalkie_ch7.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch7.png rename to src/main/resources/assets/mekanism/textures/items/walkietalkie_ch7.png diff --git a/src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch8.png b/src/main/resources/assets/mekanism/textures/items/walkietalkie_ch8.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch8.png rename to src/main/resources/assets/mekanism/textures/items/walkietalkie_ch8.png diff --git a/src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch9.png b/src/main/resources/assets/mekanism/textures/items/walkietalkie_ch9.png similarity index 100% rename from src/main/resources/assets/mekanism/textures/items/WalkieTalkie_ch9.png rename to src/main/resources/assets/mekanism/textures/items/walkietalkie_ch9.png diff --git a/src/main/resources/assets/mekanismgenerators/models/item/Hohlraum.json b/src/main/resources/assets/mekanismgenerators/models/item/hohlraum.json similarity index 100% rename from src/main/resources/assets/mekanismgenerators/models/item/Hohlraum.json rename to src/main/resources/assets/mekanismgenerators/models/item/hohlraum.json diff --git a/src/main/resources/assets/mekanismgenerators/models/item/SolarPanel.json b/src/main/resources/assets/mekanismgenerators/models/item/solarpanel.json similarity index 100% rename from src/main/resources/assets/mekanismgenerators/models/item/SolarPanel.json rename to src/main/resources/assets/mekanismgenerators/models/item/solarpanel.json diff --git a/src/main/resources/assets/mekanismgenerators/models/item/TurbineBlade.json b/src/main/resources/assets/mekanismgenerators/models/item/turbineblade.json similarity index 100% rename from src/main/resources/assets/mekanismgenerators/models/item/TurbineBlade.json rename to src/main/resources/assets/mekanismgenerators/models/item/turbineblade.json diff --git a/src/main/resources/assets/mekanismgenerators/textures/blocks/RotationalComplexSide.png b/src/main/resources/assets/mekanismgenerators/textures/blocks/rotationalcomplexside.png similarity index 100% rename from src/main/resources/assets/mekanismgenerators/textures/blocks/RotationalComplexSide.png rename to src/main/resources/assets/mekanismgenerators/textures/blocks/rotationalcomplexside.png diff --git a/src/main/resources/assets/mekanismgenerators/textures/blocks/RotationalComplexTop.png b/src/main/resources/assets/mekanismgenerators/textures/blocks/rotationalcomplextop.png similarity index 100% rename from src/main/resources/assets/mekanismgenerators/textures/blocks/RotationalComplexTop.png rename to src/main/resources/assets/mekanismgenerators/textures/blocks/rotationalcomplextop.png diff --git a/src/main/resources/assets/mekanismgenerators/textures/blocks/TurbineRotor.png b/src/main/resources/assets/mekanismgenerators/textures/blocks/turbinerotor.png similarity index 100% rename from src/main/resources/assets/mekanismgenerators/textures/blocks/TurbineRotor.png rename to src/main/resources/assets/mekanismgenerators/textures/blocks/turbinerotor.png diff --git a/src/main/resources/assets/mekanismgenerators/textures/items/Hohlraum.png b/src/main/resources/assets/mekanismgenerators/textures/items/hohlraum.png similarity index 100% rename from src/main/resources/assets/mekanismgenerators/textures/items/Hohlraum.png rename to src/main/resources/assets/mekanismgenerators/textures/items/hohlraum.png diff --git a/src/main/resources/assets/mekanismgenerators/textures/items/SolarPanel.png b/src/main/resources/assets/mekanismgenerators/textures/items/solarpanel.png similarity index 100% rename from src/main/resources/assets/mekanismgenerators/textures/items/SolarPanel.png rename to src/main/resources/assets/mekanismgenerators/textures/items/solarpanel.png diff --git a/src/main/resources/assets/mekanismgenerators/textures/items/TurbineBlade.png b/src/main/resources/assets/mekanismgenerators/textures/items/turbineblade.png similarity index 100% rename from src/main/resources/assets/mekanismgenerators/textures/items/TurbineBlade.png rename to src/main/resources/assets/mekanismgenerators/textures/items/turbineblade.png diff --git a/src/main/resources/assets/mekanismtools/models/item/BronzeAxe.json b/src/main/resources/assets/mekanismtools/models/item/bronzeaxe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/BronzeAxe.json rename to src/main/resources/assets/mekanismtools/models/item/bronzeaxe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/BronzeBoots.json b/src/main/resources/assets/mekanismtools/models/item/bronzeboots.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/BronzeBoots.json rename to src/main/resources/assets/mekanismtools/models/item/bronzeboots.json diff --git a/src/main/resources/assets/mekanismtools/models/item/BronzeChestplate.json b/src/main/resources/assets/mekanismtools/models/item/bronzechestplate.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/BronzeChestplate.json rename to src/main/resources/assets/mekanismtools/models/item/bronzechestplate.json diff --git a/src/main/resources/assets/mekanismtools/models/item/BronzeHelmet.json b/src/main/resources/assets/mekanismtools/models/item/bronzehelmet.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/BronzeHelmet.json rename to src/main/resources/assets/mekanismtools/models/item/bronzehelmet.json diff --git a/src/main/resources/assets/mekanismtools/models/item/BronzeHoe.json b/src/main/resources/assets/mekanismtools/models/item/bronzehoe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/BronzeHoe.json rename to src/main/resources/assets/mekanismtools/models/item/bronzehoe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/BronzeLeggings.json b/src/main/resources/assets/mekanismtools/models/item/bronzeleggings.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/BronzeLeggings.json rename to src/main/resources/assets/mekanismtools/models/item/bronzeleggings.json diff --git a/src/main/resources/assets/mekanismtools/models/item/BronzePaxel.json b/src/main/resources/assets/mekanismtools/models/item/bronzepaxel.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/BronzePaxel.json rename to src/main/resources/assets/mekanismtools/models/item/bronzepaxel.json diff --git a/src/main/resources/assets/mekanismtools/models/item/BronzePickaxe.json b/src/main/resources/assets/mekanismtools/models/item/bronzepickaxe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/BronzePickaxe.json rename to src/main/resources/assets/mekanismtools/models/item/bronzepickaxe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/BronzeShovel.json b/src/main/resources/assets/mekanismtools/models/item/bronzeshovel.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/BronzeShovel.json rename to src/main/resources/assets/mekanismtools/models/item/bronzeshovel.json diff --git a/src/main/resources/assets/mekanismtools/models/item/BronzeSword.json b/src/main/resources/assets/mekanismtools/models/item/bronzesword.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/BronzeSword.json rename to src/main/resources/assets/mekanismtools/models/item/bronzesword.json diff --git a/src/main/resources/assets/mekanismtools/models/item/DiamondPaxel.json b/src/main/resources/assets/mekanismtools/models/item/diamondpaxel.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/DiamondPaxel.json rename to src/main/resources/assets/mekanismtools/models/item/diamondpaxel.json diff --git a/src/main/resources/assets/mekanismtools/models/item/GlowstoneAxe.json b/src/main/resources/assets/mekanismtools/models/item/glowstoneaxe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/GlowstoneAxe.json rename to src/main/resources/assets/mekanismtools/models/item/glowstoneaxe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/GlowstoneBoots.json b/src/main/resources/assets/mekanismtools/models/item/glowstoneboots.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/GlowstoneBoots.json rename to src/main/resources/assets/mekanismtools/models/item/glowstoneboots.json diff --git a/src/main/resources/assets/mekanismtools/models/item/GlowstoneChestplate.json b/src/main/resources/assets/mekanismtools/models/item/glowstonechestplate.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/GlowstoneChestplate.json rename to src/main/resources/assets/mekanismtools/models/item/glowstonechestplate.json diff --git a/src/main/resources/assets/mekanismtools/models/item/GlowstoneHelmet.json b/src/main/resources/assets/mekanismtools/models/item/glowstonehelmet.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/GlowstoneHelmet.json rename to src/main/resources/assets/mekanismtools/models/item/glowstonehelmet.json diff --git a/src/main/resources/assets/mekanismtools/models/item/GlowstoneHoe.json b/src/main/resources/assets/mekanismtools/models/item/glowstonehoe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/GlowstoneHoe.json rename to src/main/resources/assets/mekanismtools/models/item/glowstonehoe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/GlowstoneLeggings.json b/src/main/resources/assets/mekanismtools/models/item/glowstoneleggings.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/GlowstoneLeggings.json rename to src/main/resources/assets/mekanismtools/models/item/glowstoneleggings.json diff --git a/src/main/resources/assets/mekanismtools/models/item/GlowstonePaxel.json b/src/main/resources/assets/mekanismtools/models/item/glowstonepaxel.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/GlowstonePaxel.json rename to src/main/resources/assets/mekanismtools/models/item/glowstonepaxel.json diff --git a/src/main/resources/assets/mekanismtools/models/item/GlowstonePickaxe.json b/src/main/resources/assets/mekanismtools/models/item/glowstonepickaxe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/GlowstonePickaxe.json rename to src/main/resources/assets/mekanismtools/models/item/glowstonepickaxe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/GlowstoneShovel.json b/src/main/resources/assets/mekanismtools/models/item/glowstoneshovel.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/GlowstoneShovel.json rename to src/main/resources/assets/mekanismtools/models/item/glowstoneshovel.json diff --git a/src/main/resources/assets/mekanismtools/models/item/GlowstoneSword.json b/src/main/resources/assets/mekanismtools/models/item/glowstonesword.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/GlowstoneSword.json rename to src/main/resources/assets/mekanismtools/models/item/glowstonesword.json diff --git a/src/main/resources/assets/mekanismtools/models/item/GoldPaxel.json b/src/main/resources/assets/mekanismtools/models/item/goldpaxel.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/GoldPaxel.json rename to src/main/resources/assets/mekanismtools/models/item/goldpaxel.json diff --git a/src/main/resources/assets/mekanismtools/models/item/IronPaxel.json b/src/main/resources/assets/mekanismtools/models/item/ironpaxel.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/IronPaxel.json rename to src/main/resources/assets/mekanismtools/models/item/ironpaxel.json diff --git a/src/main/resources/assets/mekanismtools/models/item/LapisLazuliAxe.json b/src/main/resources/assets/mekanismtools/models/item/lapislazuliaxe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/LapisLazuliAxe.json rename to src/main/resources/assets/mekanismtools/models/item/lapislazuliaxe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/LapisLazuliBoots.json b/src/main/resources/assets/mekanismtools/models/item/lapislazuliboots.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/LapisLazuliBoots.json rename to src/main/resources/assets/mekanismtools/models/item/lapislazuliboots.json diff --git a/src/main/resources/assets/mekanismtools/models/item/LapisLazuliChestplate.json b/src/main/resources/assets/mekanismtools/models/item/lapislazulichestplate.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/LapisLazuliChestplate.json rename to src/main/resources/assets/mekanismtools/models/item/lapislazulichestplate.json diff --git a/src/main/resources/assets/mekanismtools/models/item/LapisLazuliHelmet.json b/src/main/resources/assets/mekanismtools/models/item/lapislazulihelmet.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/LapisLazuliHelmet.json rename to src/main/resources/assets/mekanismtools/models/item/lapislazulihelmet.json diff --git a/src/main/resources/assets/mekanismtools/models/item/LapisLazuliHoe.json b/src/main/resources/assets/mekanismtools/models/item/lapislazulihoe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/LapisLazuliHoe.json rename to src/main/resources/assets/mekanismtools/models/item/lapislazulihoe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/LapisLazuliLeggings.json b/src/main/resources/assets/mekanismtools/models/item/lapislazulileggings.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/LapisLazuliLeggings.json rename to src/main/resources/assets/mekanismtools/models/item/lapislazulileggings.json diff --git a/src/main/resources/assets/mekanismtools/models/item/LapisLazuliPaxel.json b/src/main/resources/assets/mekanismtools/models/item/lapislazulipaxel.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/LapisLazuliPaxel.json rename to src/main/resources/assets/mekanismtools/models/item/lapislazulipaxel.json diff --git a/src/main/resources/assets/mekanismtools/models/item/LapisLazuliPickaxe.json b/src/main/resources/assets/mekanismtools/models/item/lapislazulipickaxe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/LapisLazuliPickaxe.json rename to src/main/resources/assets/mekanismtools/models/item/lapislazulipickaxe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/LapisLazuliShovel.json b/src/main/resources/assets/mekanismtools/models/item/lapislazulishovel.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/LapisLazuliShovel.json rename to src/main/resources/assets/mekanismtools/models/item/lapislazulishovel.json diff --git a/src/main/resources/assets/mekanismtools/models/item/LapisLazuliSword.json b/src/main/resources/assets/mekanismtools/models/item/lapislazulisword.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/LapisLazuliSword.json rename to src/main/resources/assets/mekanismtools/models/item/lapislazulisword.json diff --git a/src/main/resources/assets/mekanismtools/models/item/ObsidianAxe.json b/src/main/resources/assets/mekanismtools/models/item/obsidianaxe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/ObsidianAxe.json rename to src/main/resources/assets/mekanismtools/models/item/obsidianaxe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/ObsidianBoots.json b/src/main/resources/assets/mekanismtools/models/item/obsidianboots.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/ObsidianBoots.json rename to src/main/resources/assets/mekanismtools/models/item/obsidianboots.json diff --git a/src/main/resources/assets/mekanismtools/models/item/ObsidianChestplate.json b/src/main/resources/assets/mekanismtools/models/item/obsidianchestplate.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/ObsidianChestplate.json rename to src/main/resources/assets/mekanismtools/models/item/obsidianchestplate.json diff --git a/src/main/resources/assets/mekanismtools/models/item/ObsidianHelmet.json b/src/main/resources/assets/mekanismtools/models/item/obsidianhelmet.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/ObsidianHelmet.json rename to src/main/resources/assets/mekanismtools/models/item/obsidianhelmet.json diff --git a/src/main/resources/assets/mekanismtools/models/item/ObsidianHoe.json b/src/main/resources/assets/mekanismtools/models/item/obsidianhoe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/ObsidianHoe.json rename to src/main/resources/assets/mekanismtools/models/item/obsidianhoe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/ObsidianLeggings.json b/src/main/resources/assets/mekanismtools/models/item/obsidianleggings.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/ObsidianLeggings.json rename to src/main/resources/assets/mekanismtools/models/item/obsidianleggings.json diff --git a/src/main/resources/assets/mekanismtools/models/item/ObsidianPaxel.json b/src/main/resources/assets/mekanismtools/models/item/obsidianpaxel.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/ObsidianPaxel.json rename to src/main/resources/assets/mekanismtools/models/item/obsidianpaxel.json diff --git a/src/main/resources/assets/mekanismtools/models/item/ObsidianPickaxe.json b/src/main/resources/assets/mekanismtools/models/item/obsidianpickaxe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/ObsidianPickaxe.json rename to src/main/resources/assets/mekanismtools/models/item/obsidianpickaxe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/ObsidianShovel.json b/src/main/resources/assets/mekanismtools/models/item/obsidianshovel.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/ObsidianShovel.json rename to src/main/resources/assets/mekanismtools/models/item/obsidianshovel.json diff --git a/src/main/resources/assets/mekanismtools/models/item/ObsidianSword.json b/src/main/resources/assets/mekanismtools/models/item/obsidiansword.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/ObsidianSword.json rename to src/main/resources/assets/mekanismtools/models/item/obsidiansword.json diff --git a/src/main/resources/assets/mekanismtools/models/item/OsmiumAxe.json b/src/main/resources/assets/mekanismtools/models/item/osmiumaxe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/OsmiumAxe.json rename to src/main/resources/assets/mekanismtools/models/item/osmiumaxe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/OsmiumBoots.json b/src/main/resources/assets/mekanismtools/models/item/osmiumboots.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/OsmiumBoots.json rename to src/main/resources/assets/mekanismtools/models/item/osmiumboots.json diff --git a/src/main/resources/assets/mekanismtools/models/item/OsmiumChestplate.json b/src/main/resources/assets/mekanismtools/models/item/osmiumchestplate.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/OsmiumChestplate.json rename to src/main/resources/assets/mekanismtools/models/item/osmiumchestplate.json diff --git a/src/main/resources/assets/mekanismtools/models/item/OsmiumHelmet.json b/src/main/resources/assets/mekanismtools/models/item/osmiumhelmet.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/OsmiumHelmet.json rename to src/main/resources/assets/mekanismtools/models/item/osmiumhelmet.json diff --git a/src/main/resources/assets/mekanismtools/models/item/OsmiumHoe.json b/src/main/resources/assets/mekanismtools/models/item/osmiumhoe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/OsmiumHoe.json rename to src/main/resources/assets/mekanismtools/models/item/osmiumhoe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/OsmiumLeggings.json b/src/main/resources/assets/mekanismtools/models/item/osmiumleggings.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/OsmiumLeggings.json rename to src/main/resources/assets/mekanismtools/models/item/osmiumleggings.json diff --git a/src/main/resources/assets/mekanismtools/models/item/OsmiumPaxel.json b/src/main/resources/assets/mekanismtools/models/item/osmiumpaxel.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/OsmiumPaxel.json rename to src/main/resources/assets/mekanismtools/models/item/osmiumpaxel.json diff --git a/src/main/resources/assets/mekanismtools/models/item/OsmiumPickaxe.json b/src/main/resources/assets/mekanismtools/models/item/osmiumpickaxe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/OsmiumPickaxe.json rename to src/main/resources/assets/mekanismtools/models/item/osmiumpickaxe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/OsmiumShovel.json b/src/main/resources/assets/mekanismtools/models/item/osmiumshovel.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/OsmiumShovel.json rename to src/main/resources/assets/mekanismtools/models/item/osmiumshovel.json diff --git a/src/main/resources/assets/mekanismtools/models/item/OsmiumSword.json b/src/main/resources/assets/mekanismtools/models/item/osmiumsword.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/OsmiumSword.json rename to src/main/resources/assets/mekanismtools/models/item/osmiumsword.json diff --git a/src/main/resources/assets/mekanismtools/models/item/SteelAxe.json b/src/main/resources/assets/mekanismtools/models/item/steelaxe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/SteelAxe.json rename to src/main/resources/assets/mekanismtools/models/item/steelaxe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/SteelBoots.json b/src/main/resources/assets/mekanismtools/models/item/steelboots.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/SteelBoots.json rename to src/main/resources/assets/mekanismtools/models/item/steelboots.json diff --git a/src/main/resources/assets/mekanismtools/models/item/SteelChestplate.json b/src/main/resources/assets/mekanismtools/models/item/steelchestplate.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/SteelChestplate.json rename to src/main/resources/assets/mekanismtools/models/item/steelchestplate.json diff --git a/src/main/resources/assets/mekanismtools/models/item/SteelHelmet.json b/src/main/resources/assets/mekanismtools/models/item/steelhelmet.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/SteelHelmet.json rename to src/main/resources/assets/mekanismtools/models/item/steelhelmet.json diff --git a/src/main/resources/assets/mekanismtools/models/item/SteelHoe.json b/src/main/resources/assets/mekanismtools/models/item/steelhoe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/SteelHoe.json rename to src/main/resources/assets/mekanismtools/models/item/steelhoe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/SteelLeggings.json b/src/main/resources/assets/mekanismtools/models/item/steelleggings.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/SteelLeggings.json rename to src/main/resources/assets/mekanismtools/models/item/steelleggings.json diff --git a/src/main/resources/assets/mekanismtools/models/item/SteelPaxel.json b/src/main/resources/assets/mekanismtools/models/item/steelpaxel.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/SteelPaxel.json rename to src/main/resources/assets/mekanismtools/models/item/steelpaxel.json diff --git a/src/main/resources/assets/mekanismtools/models/item/SteelPickaxe.json b/src/main/resources/assets/mekanismtools/models/item/steelpickaxe.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/SteelPickaxe.json rename to src/main/resources/assets/mekanismtools/models/item/steelpickaxe.json diff --git a/src/main/resources/assets/mekanismtools/models/item/SteelShovel.json b/src/main/resources/assets/mekanismtools/models/item/steelshovel.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/SteelShovel.json rename to src/main/resources/assets/mekanismtools/models/item/steelshovel.json diff --git a/src/main/resources/assets/mekanismtools/models/item/SteelSword.json b/src/main/resources/assets/mekanismtools/models/item/steelsword.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/SteelSword.json rename to src/main/resources/assets/mekanismtools/models/item/steelsword.json diff --git a/src/main/resources/assets/mekanismtools/models/item/StonePaxel.json b/src/main/resources/assets/mekanismtools/models/item/stonepaxel.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/StonePaxel.json rename to src/main/resources/assets/mekanismtools/models/item/stonepaxel.json diff --git a/src/main/resources/assets/mekanismtools/models/item/WoodPaxel.json b/src/main/resources/assets/mekanismtools/models/item/woodpaxel.json similarity index 100% rename from src/main/resources/assets/mekanismtools/models/item/WoodPaxel.json rename to src/main/resources/assets/mekanismtools/models/item/woodpaxel.json diff --git a/src/main/resources/assets/mekanismtools/textures/items/BronzeAxe.png b/src/main/resources/assets/mekanismtools/textures/items/bronzeaxe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/BronzeAxe.png rename to src/main/resources/assets/mekanismtools/textures/items/bronzeaxe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/BronzeBoots.png b/src/main/resources/assets/mekanismtools/textures/items/bronzeboots.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/BronzeBoots.png rename to src/main/resources/assets/mekanismtools/textures/items/bronzeboots.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/BronzeChestplate.png b/src/main/resources/assets/mekanismtools/textures/items/bronzechestplate.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/BronzeChestplate.png rename to src/main/resources/assets/mekanismtools/textures/items/bronzechestplate.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/BronzeHelmet.png b/src/main/resources/assets/mekanismtools/textures/items/bronzehelmet.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/BronzeHelmet.png rename to src/main/resources/assets/mekanismtools/textures/items/bronzehelmet.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/BronzeHoe.png b/src/main/resources/assets/mekanismtools/textures/items/bronzehoe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/BronzeHoe.png rename to src/main/resources/assets/mekanismtools/textures/items/bronzehoe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/BronzeLeggings.png b/src/main/resources/assets/mekanismtools/textures/items/bronzeleggings.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/BronzeLeggings.png rename to src/main/resources/assets/mekanismtools/textures/items/bronzeleggings.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/BronzePaxel.png b/src/main/resources/assets/mekanismtools/textures/items/bronzepaxel.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/BronzePaxel.png rename to src/main/resources/assets/mekanismtools/textures/items/bronzepaxel.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/BronzePickaxe.png b/src/main/resources/assets/mekanismtools/textures/items/bronzepickaxe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/BronzePickaxe.png rename to src/main/resources/assets/mekanismtools/textures/items/bronzepickaxe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/BronzeShovel.png b/src/main/resources/assets/mekanismtools/textures/items/bronzeshovel.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/BronzeShovel.png rename to src/main/resources/assets/mekanismtools/textures/items/bronzeshovel.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/BronzeSword.png b/src/main/resources/assets/mekanismtools/textures/items/bronzesword.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/BronzeSword.png rename to src/main/resources/assets/mekanismtools/textures/items/bronzesword.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/DiamondPaxel.png b/src/main/resources/assets/mekanismtools/textures/items/diamondpaxel.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/DiamondPaxel.png rename to src/main/resources/assets/mekanismtools/textures/items/diamondpaxel.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/GlowstoneAxe.png b/src/main/resources/assets/mekanismtools/textures/items/glowstoneaxe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/GlowstoneAxe.png rename to src/main/resources/assets/mekanismtools/textures/items/glowstoneaxe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/GlowstoneBoots.png b/src/main/resources/assets/mekanismtools/textures/items/glowstoneboots.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/GlowstoneBoots.png rename to src/main/resources/assets/mekanismtools/textures/items/glowstoneboots.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/GlowstoneChestplate.png b/src/main/resources/assets/mekanismtools/textures/items/glowstonechestplate.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/GlowstoneChestplate.png rename to src/main/resources/assets/mekanismtools/textures/items/glowstonechestplate.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/GlowstoneHelmet.png b/src/main/resources/assets/mekanismtools/textures/items/glowstonehelmet.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/GlowstoneHelmet.png rename to src/main/resources/assets/mekanismtools/textures/items/glowstonehelmet.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/GlowstoneHoe.png b/src/main/resources/assets/mekanismtools/textures/items/glowstonehoe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/GlowstoneHoe.png rename to src/main/resources/assets/mekanismtools/textures/items/glowstonehoe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/GlowstoneLeggings.png b/src/main/resources/assets/mekanismtools/textures/items/glowstoneleggings.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/GlowstoneLeggings.png rename to src/main/resources/assets/mekanismtools/textures/items/glowstoneleggings.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/GlowstonePaxel.png b/src/main/resources/assets/mekanismtools/textures/items/glowstonepaxel.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/GlowstonePaxel.png rename to src/main/resources/assets/mekanismtools/textures/items/glowstonepaxel.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/GlowstonePickaxe.png b/src/main/resources/assets/mekanismtools/textures/items/glowstonepickaxe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/GlowstonePickaxe.png rename to src/main/resources/assets/mekanismtools/textures/items/glowstonepickaxe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/GlowstoneShovel.png b/src/main/resources/assets/mekanismtools/textures/items/glowstoneshovel.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/GlowstoneShovel.png rename to src/main/resources/assets/mekanismtools/textures/items/glowstoneshovel.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/GlowstoneSword.png b/src/main/resources/assets/mekanismtools/textures/items/glowstonesword.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/GlowstoneSword.png rename to src/main/resources/assets/mekanismtools/textures/items/glowstonesword.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/GoldPaxel.png b/src/main/resources/assets/mekanismtools/textures/items/goldpaxel.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/GoldPaxel.png rename to src/main/resources/assets/mekanismtools/textures/items/goldpaxel.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/IronPaxel.png b/src/main/resources/assets/mekanismtools/textures/items/ironpaxel.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/IronPaxel.png rename to src/main/resources/assets/mekanismtools/textures/items/ironpaxel.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/LapisLazuliAxe.png b/src/main/resources/assets/mekanismtools/textures/items/lapislazuliaxe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/LapisLazuliAxe.png rename to src/main/resources/assets/mekanismtools/textures/items/lapislazuliaxe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/LapisLazuliBoots.png b/src/main/resources/assets/mekanismtools/textures/items/lapislazuliboots.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/LapisLazuliBoots.png rename to src/main/resources/assets/mekanismtools/textures/items/lapislazuliboots.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/LapisLazuliChestplate.png b/src/main/resources/assets/mekanismtools/textures/items/lapislazulichestplate.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/LapisLazuliChestplate.png rename to src/main/resources/assets/mekanismtools/textures/items/lapislazulichestplate.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/LapisLazuliHelmet.png b/src/main/resources/assets/mekanismtools/textures/items/lapislazulihelmet.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/LapisLazuliHelmet.png rename to src/main/resources/assets/mekanismtools/textures/items/lapislazulihelmet.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/LapisLazuliHoe.png b/src/main/resources/assets/mekanismtools/textures/items/lapislazulihoe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/LapisLazuliHoe.png rename to src/main/resources/assets/mekanismtools/textures/items/lapislazulihoe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/LapisLazuliLeggings.png b/src/main/resources/assets/mekanismtools/textures/items/lapislazulileggings.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/LapisLazuliLeggings.png rename to src/main/resources/assets/mekanismtools/textures/items/lapislazulileggings.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/LapisLazuliPaxel.png b/src/main/resources/assets/mekanismtools/textures/items/lapislazulipaxel.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/LapisLazuliPaxel.png rename to src/main/resources/assets/mekanismtools/textures/items/lapislazulipaxel.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/LapisLazuliPickaxe.png b/src/main/resources/assets/mekanismtools/textures/items/lapislazulipickaxe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/LapisLazuliPickaxe.png rename to src/main/resources/assets/mekanismtools/textures/items/lapislazulipickaxe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/LapisLazuliShovel.png b/src/main/resources/assets/mekanismtools/textures/items/lapislazulishovel.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/LapisLazuliShovel.png rename to src/main/resources/assets/mekanismtools/textures/items/lapislazulishovel.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/LapisLazuliSword.png b/src/main/resources/assets/mekanismtools/textures/items/lapislazulisword.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/LapisLazuliSword.png rename to src/main/resources/assets/mekanismtools/textures/items/lapislazulisword.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/ObsidianAxe.png b/src/main/resources/assets/mekanismtools/textures/items/obsidianaxe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/ObsidianAxe.png rename to src/main/resources/assets/mekanismtools/textures/items/obsidianaxe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/ObsidianBoots.png b/src/main/resources/assets/mekanismtools/textures/items/obsidianboots.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/ObsidianBoots.png rename to src/main/resources/assets/mekanismtools/textures/items/obsidianboots.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/ObsidianChestplate.png b/src/main/resources/assets/mekanismtools/textures/items/obsidianchestplate.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/ObsidianChestplate.png rename to src/main/resources/assets/mekanismtools/textures/items/obsidianchestplate.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/ObsidianHelmet.png b/src/main/resources/assets/mekanismtools/textures/items/obsidianhelmet.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/ObsidianHelmet.png rename to src/main/resources/assets/mekanismtools/textures/items/obsidianhelmet.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/ObsidianHoe.png b/src/main/resources/assets/mekanismtools/textures/items/obsidianhoe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/ObsidianHoe.png rename to src/main/resources/assets/mekanismtools/textures/items/obsidianhoe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/ObsidianLeggings.png b/src/main/resources/assets/mekanismtools/textures/items/obsidianleggings.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/ObsidianLeggings.png rename to src/main/resources/assets/mekanismtools/textures/items/obsidianleggings.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/ObsidianPaxel.png b/src/main/resources/assets/mekanismtools/textures/items/obsidianpaxel.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/ObsidianPaxel.png rename to src/main/resources/assets/mekanismtools/textures/items/obsidianpaxel.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/ObsidianPickaxe.png b/src/main/resources/assets/mekanismtools/textures/items/obsidianpickaxe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/ObsidianPickaxe.png rename to src/main/resources/assets/mekanismtools/textures/items/obsidianpickaxe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/ObsidianShovel.png b/src/main/resources/assets/mekanismtools/textures/items/obsidianshovel.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/ObsidianShovel.png rename to src/main/resources/assets/mekanismtools/textures/items/obsidianshovel.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/ObsidianSword.png b/src/main/resources/assets/mekanismtools/textures/items/obsidiansword.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/ObsidianSword.png rename to src/main/resources/assets/mekanismtools/textures/items/obsidiansword.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/OsmiumAxe.png b/src/main/resources/assets/mekanismtools/textures/items/osmiumaxe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/OsmiumAxe.png rename to src/main/resources/assets/mekanismtools/textures/items/osmiumaxe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/OsmiumBoots.png b/src/main/resources/assets/mekanismtools/textures/items/osmiumboots.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/OsmiumBoots.png rename to src/main/resources/assets/mekanismtools/textures/items/osmiumboots.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/OsmiumChestplate.png b/src/main/resources/assets/mekanismtools/textures/items/osmiumchestplate.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/OsmiumChestplate.png rename to src/main/resources/assets/mekanismtools/textures/items/osmiumchestplate.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/OsmiumHelmet.png b/src/main/resources/assets/mekanismtools/textures/items/osmiumhelmet.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/OsmiumHelmet.png rename to src/main/resources/assets/mekanismtools/textures/items/osmiumhelmet.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/OsmiumHoe.png b/src/main/resources/assets/mekanismtools/textures/items/osmiumhoe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/OsmiumHoe.png rename to src/main/resources/assets/mekanismtools/textures/items/osmiumhoe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/OsmiumLeggings.png b/src/main/resources/assets/mekanismtools/textures/items/osmiumleggings.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/OsmiumLeggings.png rename to src/main/resources/assets/mekanismtools/textures/items/osmiumleggings.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/OsmiumPaxel.png b/src/main/resources/assets/mekanismtools/textures/items/osmiumpaxel.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/OsmiumPaxel.png rename to src/main/resources/assets/mekanismtools/textures/items/osmiumpaxel.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/OsmiumPickaxe.png b/src/main/resources/assets/mekanismtools/textures/items/osmiumpickaxe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/OsmiumPickaxe.png rename to src/main/resources/assets/mekanismtools/textures/items/osmiumpickaxe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/OsmiumShovel.png b/src/main/resources/assets/mekanismtools/textures/items/osmiumshovel.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/OsmiumShovel.png rename to src/main/resources/assets/mekanismtools/textures/items/osmiumshovel.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/OsmiumSword.png b/src/main/resources/assets/mekanismtools/textures/items/osmiumsword.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/OsmiumSword.png rename to src/main/resources/assets/mekanismtools/textures/items/osmiumsword.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/SteelAxe.png b/src/main/resources/assets/mekanismtools/textures/items/steelaxe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/SteelAxe.png rename to src/main/resources/assets/mekanismtools/textures/items/steelaxe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/SteelBoots.png b/src/main/resources/assets/mekanismtools/textures/items/steelboots.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/SteelBoots.png rename to src/main/resources/assets/mekanismtools/textures/items/steelboots.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/SteelChestplate.png b/src/main/resources/assets/mekanismtools/textures/items/steelchestplate.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/SteelChestplate.png rename to src/main/resources/assets/mekanismtools/textures/items/steelchestplate.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/SteelHelmet.png b/src/main/resources/assets/mekanismtools/textures/items/steelhelmet.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/SteelHelmet.png rename to src/main/resources/assets/mekanismtools/textures/items/steelhelmet.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/SteelHoe.png b/src/main/resources/assets/mekanismtools/textures/items/steelhoe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/SteelHoe.png rename to src/main/resources/assets/mekanismtools/textures/items/steelhoe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/SteelLeggings.png b/src/main/resources/assets/mekanismtools/textures/items/steelleggings.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/SteelLeggings.png rename to src/main/resources/assets/mekanismtools/textures/items/steelleggings.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/SteelPaxel.png b/src/main/resources/assets/mekanismtools/textures/items/steelpaxel.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/SteelPaxel.png rename to src/main/resources/assets/mekanismtools/textures/items/steelpaxel.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/SteelPickaxe.png b/src/main/resources/assets/mekanismtools/textures/items/steelpickaxe.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/SteelPickaxe.png rename to src/main/resources/assets/mekanismtools/textures/items/steelpickaxe.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/SteelShovel.png b/src/main/resources/assets/mekanismtools/textures/items/steelshovel.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/SteelShovel.png rename to src/main/resources/assets/mekanismtools/textures/items/steelshovel.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/SteelSword.png b/src/main/resources/assets/mekanismtools/textures/items/steelsword.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/SteelSword.png rename to src/main/resources/assets/mekanismtools/textures/items/steelsword.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/StonePaxel.png b/src/main/resources/assets/mekanismtools/textures/items/stonepaxel.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/StonePaxel.png rename to src/main/resources/assets/mekanismtools/textures/items/stonepaxel.png diff --git a/src/main/resources/assets/mekanismtools/textures/items/WoodPaxel.png b/src/main/resources/assets/mekanismtools/textures/items/woodpaxel.png similarity index 100% rename from src/main/resources/assets/mekanismtools/textures/items/WoodPaxel.png rename to src/main/resources/assets/mekanismtools/textures/items/woodpaxel.png diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 0c254ce66..4cd95205f 100755 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,6 +1,6 @@ [ { - "modid": "Mekanism", + "modid": "mekanism", "name": "Mekanism", "description": "Energy, Armor, Tools, Weapons, Machines, Magic.", "version": "${version}", @@ -15,7 +15,7 @@ ] }, { - "modid": "MekanismGenerators", + "modid": "mekanismgenerators", "name": "MekanismGenerators", "description": "Generators module of Mekanism.", "version": "${version}", @@ -30,7 +30,7 @@ ] }, { - "modid": "MekanismTools", + "modid": "mekanismtools", "name": "MekanismTools", "description": "Tools module for Mekanism.", "version": "${version}",