diff --git a/build.gradle b/build.gradle index 390a5c45e..31d5d58c3 100644 --- a/build.gradle +++ b/build.gradle @@ -61,6 +61,10 @@ repositories { name 'CoFH Maven' url = 'http://maven.covers1624.net' } + maven { + name 'buildcraft' + url 'https://mod-buildcraft.com/maven/' + } } // Define properties file @@ -96,6 +100,7 @@ dependencies { compile "li.cil.oc:OpenComputers:MC1.11.2-${config.opencomputers_version}:api" // Not updated yet deobfCompile "mcp.mobius.waila:Hwyla:${config.hwyla_version}" deobfCompile "cofh:RedstoneFlux:${config.minecraft_version}-${config.redstoneflux_version}:universal" + deobfCompile "com.mod-buildcraft:buildcraft-api:${config.buildcraft_version}" } processResources diff --git a/build.properties b/build.properties index 6fbbcb06c..e4bb302eb 100644 --- a/build.properties +++ b/build.properties @@ -9,3 +9,4 @@ invtweak_version=1.62+beta.89 opencomputers_version=1.7.0.24 hwyla_version=1.8.18-B32_1.12 redstoneflux_version=2.0.0.1 +buildcraft_version=7.99.6 diff --git a/src/api/java/buildcraft/api/blocks/CustomPaintHelper.java b/src/api/java/buildcraft/api/blocks/CustomPaintHelper.java deleted file mode 100755 index 2517af2bb..000000000 --- a/src/api/java/buildcraft/api/blocks/CustomPaintHelper.java +++ /dev/null @@ -1,115 +0,0 @@ -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 deleted file mode 100755 index 235c0de11..000000000 --- a/src/api/java/buildcraft/api/blocks/CustomRotationHelper.java +++ /dev/null @@ -1,76 +0,0 @@ -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 deleted file mode 100755 index fd79c910a..000000000 --- a/src/api/java/buildcraft/api/blocks/ICustomPaintHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100755 index 9076f8fd0..000000000 --- a/src/api/java/buildcraft/api/blocks/ICustomRotationHandler.java +++ /dev/null @@ -1,11 +0,0 @@ -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 deleted file mode 100755 index c3bc6eac1..000000000 --- a/src/api/java/buildcraft/api/blocks/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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 deleted file mode 100755 index dad91b98f..000000000 --- a/src/api/java/buildcraft/api/blueprints/BlueprintDeployer.java +++ /dev/null @@ -1,30 +0,0 @@ -/** 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 deleted file mode 100755 index ac15b474b..000000000 --- a/src/api/java/buildcraft/api/blueprints/BuilderAPI.java +++ /dev/null @@ -1,16 +0,0 @@ -/** 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 deleted file mode 100755 index 8661240c4..000000000 --- a/src/api/java/buildcraft/api/blueprints/BuildingPermission.java +++ /dev/null @@ -1,21 +0,0 @@ -/** 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 deleted file mode 100755 index e5eb8900b..000000000 --- a/src/api/java/buildcraft/api/blueprints/IBuilderContext.java +++ /dev/null @@ -1,22 +0,0 @@ -/** 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 deleted file mode 100755 index 7327f2e20..000000000 --- a/src/api/java/buildcraft/api/blueprints/ISchematicHelper.java +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100755 index 503c315d5..000000000 --- a/src/api/java/buildcraft/api/blueprints/ISchematicRegistry.java +++ /dev/null @@ -1,19 +0,0 @@ -/** 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 deleted file mode 100755 index 2c06f64c3..000000000 --- a/src/api/java/buildcraft/api/blueprints/ITileBuilder.java +++ /dev/null @@ -1,13 +0,0 @@ -/** 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 deleted file mode 100755 index f84cee627..000000000 --- a/src/api/java/buildcraft/api/blueprints/MappingNotFoundException.java +++ /dev/null @@ -1,13 +0,0 @@ -/** 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 deleted file mode 100755 index d97f13afd..000000000 --- a/src/api/java/buildcraft/api/blueprints/MappingRegistry.java +++ /dev/null @@ -1,422 +0,0 @@ -/** 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 deleted file mode 100755 index a0bb497b9..000000000 --- a/src/api/java/buildcraft/api/blueprints/Schematic.java +++ /dev/null @@ -1,196 +0,0 @@ -/** 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 deleted file mode 100755 index fe3af0acf..000000000 --- a/src/api/java/buildcraft/api/blueprints/SchematicBlock.java +++ /dev/null @@ -1,193 +0,0 @@ -/** 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 deleted file mode 100755 index 69f18a2eb..000000000 --- a/src/api/java/buildcraft/api/blueprints/SchematicBlockBase.java +++ /dev/null @@ -1,9 +0,0 @@ -/** 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 deleted file mode 100755 index de8f78c4e..000000000 --- a/src/api/java/buildcraft/api/blueprints/SchematicEntity.java +++ /dev/null @@ -1,193 +0,0 @@ -/** 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.x, pos.y, pos.z)); - } - - @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.x, pos.y, pos.z)); - } - - @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.x, pos.y, pos.z)); - - 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 deleted file mode 100755 index 878b15714..000000000 --- a/src/api/java/buildcraft/api/blueprints/SchematicFactory.java +++ /dev/null @@ -1,51 +0,0 @@ -/** 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 deleted file mode 100755 index f044bf021..000000000 --- a/src/api/java/buildcraft/api/blueprints/SchematicFluid.java +++ /dev/null @@ -1,83 +0,0 @@ -/** 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 deleted file mode 100755 index 3432e5cad..000000000 --- a/src/api/java/buildcraft/api/blueprints/SchematicMask.java +++ /dev/null @@ -1,83 +0,0 @@ -/** 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.getBlock().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 deleted file mode 100755 index 318e27eb3..000000000 --- a/src/api/java/buildcraft/api/blueprints/SchematicTile.java +++ /dev/null @@ -1,109 +0,0 @@ -/** 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 deleted file mode 100755 index 3b3632424..000000000 --- a/src/api/java/buildcraft/api/blueprints/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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 deleted file mode 100755 index 2aa375e92..000000000 --- a/src/api/java/buildcraft/api/boards/IRedstoneBoard.java +++ /dev/null @@ -1,12 +0,0 @@ -/** 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 deleted file mode 100755 index 0ced64a8b..000000000 --- a/src/api/java/buildcraft/api/boards/RedstoneBoardNBT.java +++ /dev/null @@ -1,45 +0,0 @@ -/** 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 deleted file mode 100755 index edfe79cb5..000000000 --- a/src/api/java/buildcraft/api/boards/RedstoneBoardRegistry.java +++ /dev/null @@ -1,32 +0,0 @@ -/** 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 deleted file mode 100755 index b0ed0638f..000000000 --- a/src/api/java/buildcraft/api/boards/RedstoneBoardRobot.java +++ /dev/null @@ -1,29 +0,0 @@ -/** 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 deleted file mode 100755 index 4a4161b19..000000000 --- a/src/api/java/buildcraft/api/boards/RedstoneBoardRobotNBT.java +++ /dev/null @@ -1,23 +0,0 @@ -/** 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 deleted file mode 100755 index 6253f5b79..000000000 --- a/src/api/java/buildcraft/api/boards/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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/core/APIHelper.java b/src/api/java/buildcraft/api/core/APIHelper.java deleted file mode 100755 index 9d8613201..000000000 --- a/src/api/java/buildcraft/api/core/APIHelper.java +++ /dev/null @@ -1,81 +0,0 @@ -/** 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; - -import org.apache.commons.lang3.StringUtils; - -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.LoaderState; - -public class APIHelper { - public static T getInstance(String clsName, Class baseVersion) { - return getNamedInstance(clsName, "INSTANCE", baseVersion); - } - - public static T getInstance(String clsName, Class baseVersion, T nullVersion) { - return getNamedInstance(clsName, "INSTANCE", baseVersion, nullVersion); - } - - @SuppressWarnings("unchecked") - public static T getNamedInstance(String clsName, String enumName, Class baseVersion) { - T instance = getNamedInstance(clsName, enumName, baseVersion, null); - if (instance != null) return instance; - - Class[] types = baseVersion.getClasses(); - Class voidType = null; - for (Class class1 : types) { - if (baseVersion.isAssignableFrom(class1)) voidType = class1; - } - if (voidType != null) { - Object[] arr = voidType.getEnumConstants(); - if (arr == null) return null; - Enum[] eArr = ((Class>) voidType).getEnumConstants(); - for (Enum e : eArr) { - if (e.name().equals(enumName) && baseVersion.isInstance(e)) return (T) e; - } - } - return null; - } - - @SuppressWarnings("unchecked") - public static T getNamedInstance(String clsName, String enumName, Class baseVersion, T nullVersion) { - if (!Loader.instance().hasReachedState(LoaderState.PREINITIALIZATION)) throw new IllegalStateException( - "Called this API too early, you are not allowed to use BC api before pre init!"); - try { - Class cls = Class.forName(clsName); - Object[] arr = cls.getEnumConstants(); - if (arr == null) { - return fail(clsName, nullVersion); - } - Enum[] enumArr = ((Class>) cls).getEnumConstants(); - - for (Enum e : enumArr) { - if (e.name().equals(enumName) && baseVersion.isInstance(e)) return (T) e; - } - return fail(clsName, nullVersion); - } catch (ClassNotFoundException e) { - return fail(clsName, nullVersion); - } - } - - private static M fail(String clsName, M failure) { - String[] split = clsName.split("\\."); - String module; - if (split.length < 2) { - BCLog.logger.warn("Tried and failed to get the module name from " + Arrays.toString(split) + " (" + clsName + ")!"); - module = "invalid"; - } else { - module = split[1]; - } - module = StringUtils.capitalize(module); - String bcMod = "BuildCraft|" + module; - if (Loader.isModLoaded(bcMod)) { - BCLog.logger.warn("Failed to load the " + clsName + " dispite the appropriate buildcraft module being installed (" + module + ")"); - } - return failure; - } -} diff --git a/src/api/java/buildcraft/api/core/BCDebugging.java b/src/api/java/buildcraft/api/core/BCDebugging.java deleted file mode 100755 index 3badeb901..000000000 --- a/src/api/java/buildcraft/api/core/BCDebugging.java +++ /dev/null @@ -1,112 +0,0 @@ -/** 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/BCLog.java b/src/api/java/buildcraft/api/core/BCLog.java deleted file mode 100755 index f74509173..000000000 --- a/src/api/java/buildcraft/api/core/BCLog.java +++ /dev/null @@ -1,43 +0,0 @@ -/** 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 org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public final class BCLog { - public static final Logger logger = LogManager.getLogger("BuildCraft"); - - /** Deactivate constructor */ - private BCLog() {} - - @Deprecated - public static void logErrorAPI(String mod, Throwable error, Class classFile) { - logErrorAPI(error, classFile); - } - - public static void logErrorAPI(Throwable error, Class classFile) { - StringBuilder msg = new StringBuilder("API error! Please update your mods. Error: "); - msg.append(error); - StackTraceElement[] stackTrace = error.getStackTrace(); - if (stackTrace.length > 0) { - msg.append(", ").append(stackTrace[0]); - } - - logger.log(Level.ERROR, msg.toString()); - - if (classFile != null) { - msg.append("API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain() - .getCodeSource().getLocation()); - logger.log(Level.ERROR, msg.toString()); - } - } - - @Deprecated - public static String getVersion() { - return BuildCraftAPI.getVersion(); - } -} diff --git a/src/api/java/buildcraft/api/core/BuildCraftAPI.java b/src/api/java/buildcraft/api/core/BuildCraftAPI.java deleted file mode 100755 index 19e9e9c79..000000000 --- a/src/api/java/buildcraft/api/core/BuildCraftAPI.java +++ /dev/null @@ -1,52 +0,0 @@ -/** 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.lang.reflect.Method; -import java.util.HashMap; -import java.util.Set; - -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; - -import net.minecraft.block.Block; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -public final class BuildCraftAPI { - - public static IBCFakePlayer fakePlayerProvider; - - public static final Set softBlocks = Sets.newHashSet(); - public static final HashMap worldProperties = Maps.newHashMap(); - - /** Deactivate constructor */ - private BuildCraftAPI() {} - - public static String getVersion() { - try { - Class clazz = Class.forName("buildcraft.core.Version"); - Method method = clazz.getDeclaredMethod("getVersion"); - return String.valueOf(method.invoke(null)); - } catch (Exception e) { - return "UNKNOWN VERSION"; - } - } - - public static IWorldProperty getWorldProperty(String name) { - return worldProperties.get(name); - } - - public static void registerWorldProperty(String name, IWorldProperty property) { - if (worldProperties.containsKey(name)) { - BCLog.logger.warn("The WorldProperty key '" + name + "' is being overidden with " + property.getClass().getSimpleName() + "!"); - } - worldProperties.put(name, property); - } - - public static boolean isSoftBlock(World world, BlockPos pos) { - return worldProperties.get("soft").get(world, pos); - } -} diff --git a/src/api/java/buildcraft/api/core/ConfigAccessor.java b/src/api/java/buildcraft/api/core/ConfigAccessor.java deleted file mode 100755 index a66346ac5..000000000 --- a/src/api/java/buildcraft/api/core/ConfigAccessor.java +++ /dev/null @@ -1,48 +0,0 @@ -package buildcraft.api.core; - -import java.util.Map; - -import com.google.common.collect.Maps; - -import net.minecraftforge.common.config.Property; - -/** Use this to access the various config options. It is recommended that you use this as opposed to the variables in - * the mod, as users may only install the modules that they want, and not the one you may have refereed to. */ -@Deprecated -public final class ConfigAccessor { - public enum EMod { - CORE, - BUILDERS, - ENERGY, - FACTORY, - ROBITICS, - SILICON, - TRANSPORT - } - - private static Map mods = Maps.newHashMap(); - - private ConfigAccessor() {} - - public static Property getOption(EMod mod, String name) { - if (mods.containsKey(mod)) { - return mods.get(mod).getOption(name); - } else { - return null; - } - } - - public static boolean getBoolean(EMod mod, String name, boolean defaultBoolean) { - Property prop = getOption(mod, name); - if (prop == null) { - return defaultBoolean; - } else { - return prop.getBoolean(defaultBoolean); - } - } - - /** WARNING: INTERNAL USE ONLY! */ - public static void addMod(EMod mod, IBuildCraftMod actual) { - mods.put(mod, actual); - } -} diff --git a/src/api/java/buildcraft/api/core/EnumColor.java b/src/api/java/buildcraft/api/core/EnumColor.java deleted file mode 100755 index 028843870..000000000 --- a/src/api/java/buildcraft/api/core/EnumColor.java +++ /dev/null @@ -1,147 +0,0 @@ -/** 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 java.util.Random; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.IStringSerializable; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.translation.I18n; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** Use minecraft's EnumDyeColor in as many places as possible. */ -@Deprecated -public enum EnumColor implements IStringSerializable { - - BLACK, - RED, - GREEN, - BROWN, - BLUE, - PURPLE, - CYAN, - LIGHT_GRAY, - GRAY, - PINK, - LIME, - YELLOW, - LIGHT_BLUE, - MAGENTA, - ORANGE, - WHITE; - - public static final EnumColor[] VALUES = values(); - public static final String[] DYES = { "dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", - "dyePink", "dyeLime", "dyeYellow", "dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite" }; - public static final String[] NAMES = { "Black", "Red", "Green", "Brown", "Blue", "Purple", "Cyan", "LightGray", "Gray", "Pink", "Lime", "Yellow", - "LightBlue", "Magenta", "Orange", "White" }; - public static final int[] DARK_HEX = { 0x2D2D2D, 0xA33835, 0x394C1E, 0x5C3A24, 0x3441A2, 0x843FBF, 0x36809E, 0x888888, 0x444444, 0xE585A0, - 0x3FAA36, 0xCFC231, 0x7F9AD1, 0xFF64FF, 0xFF6A00, 0xFFFFFF }; - public static final int[] LIGHT_HEX = { 0x181414, 0xBE2B27, 0x007F0E, 0x89502D, 0x253193, 0x7e34bf, 0x299799, 0xa0a7a7, 0x7A7A7A, 0xD97199, - 0x39D52E, 0xFFD91C, 0x66AAFF, 0xD943C6, 0xEA7835, 0xe4e4e4 }; - - @SideOnly(Side.CLIENT) - private static ResourceLocation iconSheet; - - @SideOnly(Side.CLIENT) - private static TextureAtlasSprite[] brushSprites; - - public int getDarkHex() { - return DARK_HEX[ordinal()]; - } - - public int getLightHex() { - return LIGHT_HEX[ordinal()]; - } - - public static EnumColor fromId(int id) { - if (id < 0 || id >= VALUES.length) { - return WHITE; - } - return VALUES[id]; - } - - public static EnumColor fromDye(String dyeTag) { - for (int id = 0; id < DYES.length; id++) { - if (DYES[id].equals(dyeTag)) { - return VALUES[id]; - } - } - return null; - } - - public static EnumColor fromName(String name) { - for (int id = 0; id < NAMES.length; id++) { - if (NAMES[id].equals(name)) { - return VALUES[id]; - } - } - return null; - } - - public static EnumColor getRand() { - return VALUES[new Random().nextInt(VALUES.length)]; - } - - public EnumColor getNext() { - EnumColor next = VALUES[(ordinal() + 1) % VALUES.length]; - return next; - } - - public EnumColor getPrevious() { - EnumColor previous = VALUES[(ordinal() + VALUES.length - 1) % VALUES.length]; - return previous; - } - - public EnumColor inverse() { - return EnumColor.VALUES[15 - ordinal()]; - } - - public String getTag() { - return "color." + name().replace("_", ".").toLowerCase(Locale.ENGLISH); - } - - public String getBasicTag() { - return name().replace("_", ".").toLowerCase(Locale.ENGLISH); - } - - @Override - public String getName() { - return NAMES[ordinal()]; - } - - public String getLocalizedName() { - return I18n.translateToLocal(getTag()); - } - - public String getDye() { - return DYES[ordinal()]; - } - - @Override - public String toString() { - String s = name().replace("_", " "); - String[] words = s.split(" "); - StringBuilder b = new StringBuilder(); - for (String word : words) { - b.append(word.charAt(0)).append(word.substring(1).toLowerCase(Locale.ENGLISH)).append(" "); - } - return b.toString().trim(); - } - - @SideOnly(Side.CLIENT) - public static void registerSprites(TextureAtlasSprite[] sprites) { - brushSprites = sprites; - } - - @SideOnly(Side.CLIENT) - public TextureAtlasSprite getSprite() { - return brushSprites[ordinal()]; - } -} diff --git a/src/api/java/buildcraft/api/core/EnumPipePart.java b/src/api/java/buildcraft/api/core/EnumPipePart.java deleted file mode 100755 index 13b1ffc3f..000000000 --- a/src/api/java/buildcraft/api/core/EnumPipePart.java +++ /dev/null @@ -1,124 +0,0 @@ -package buildcraft.api.core; - -import java.util.Locale; -import java.util.Map; - -import com.google.common.collect.Maps; - -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTPrimitive; -import net.minecraft.nbt.NBTTagString; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.IStringSerializable; - -import io.netty.buffer.ByteBuf; - -public enum EnumPipePart implements IStringSerializable, INetworkLoadable_BC8 { - DOWN(EnumFacing.DOWN), - UP(EnumFacing.UP), - NORTH(EnumFacing.NORTH), - SOUTH(EnumFacing.SOUTH), - WEST(EnumFacing.WEST), - EAST(EnumFacing.EAST), - /** CENTER, UNKNOWN and ALL are all valid uses of this. */ - CENTER(null); - - public static final EnumPipePart[] VALUES = values(); - public static final EnumPipePart[] FACES = { DOWN, UP, NORTH, SOUTH, WEST, EAST }; - private static final Map facingMap = Maps.newEnumMap(EnumFacing.class); - private static final Map nameMap = Maps.newHashMap(); - private static final int MAX_VALUES = values().length; - - public final EnumFacing face; - - static { - for (EnumPipePart part : values()) { - nameMap.put(part.name(), part); - if (part.face != null) facingMap.put(part.face, part); - } - } - - public static int ordinal(EnumFacing face) { - return face == null ? 6 : face.ordinal(); - } - - public static EnumPipePart fromFacing(EnumFacing face) { - if (face == null) return EnumPipePart.CENTER; - return facingMap.get(face); - } - - public static EnumPipePart[] validFaces() { - return FACES; - } - - public static EnumPipePart fromMeta(int meta) { - if (meta < 0 || meta >= MAX_VALUES) return EnumPipePart.CENTER; - return VALUES[meta]; - } - - private EnumPipePart(EnumFacing face) { - this.face = face; - } - - public int getIndex() { - if (face == null) return 6; - return face.getIndex(); - } - - @Override - public String getName() { - return name().toLowerCase(Locale.ROOT); - } - - public EnumPipePart next() { - switch (this) { - case DOWN: - return EAST; - case EAST: - return NORTH; - case NORTH: - return SOUTH; - case SOUTH: - return UP; - case UP: - return WEST; - case WEST: - return DOWN; - default: - return DOWN; - } - } - - public EnumPipePart opposite() { - if (this == CENTER) return CENTER; - return fromFacing(face.getOpposite()); - } - - public static EnumPipePart readFromNBT(NBTBase base) { - if (base == null) return CENTER; - if (base instanceof NBTTagString) { - NBTTagString nbtString = (NBTTagString) base; - String string = nbtString.getString(); - return nameMap.containsKey(string) ? nameMap.get(string) : CENTER; - } else { - byte ord = ((NBTPrimitive) base).getByte(); - if (ord < 0 || ord > 6) return CENTER; - return values()[ord]; - } - } - - public NBTBase writeToNBT() { - return new NBTTagString(name()); - } - - @Override - public EnumPipePart readFromByteBuf(ByteBuf buf) { - byte ord = buf.readByte(); - return fromMeta(ord); - } - - @Override - public void writeToByteBuf(ByteBuf buf) { - buf.writeByte(ordinal()); - } -} diff --git a/src/api/java/buildcraft/api/core/IAreaProvider.java b/src/api/java/buildcraft/api/core/IAreaProvider.java deleted file mode 100755 index 02bcf0ca9..000000000 --- a/src/api/java/buildcraft/api/core/IAreaProvider.java +++ /dev/null @@ -1,17 +0,0 @@ -/** 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 net.minecraft.util.math.BlockPos; - -/** To be implemented by TileEntities able to provide a square area on the world, typically BuildCraft markers. */ -public interface IAreaProvider { - BlockPos min(); - - BlockPos max(); - - /** Remove from the world all objects used to define the area. */ - void removeFromWorld(); -} diff --git a/src/api/java/buildcraft/api/core/IBCFakePlayer.java b/src/api/java/buildcraft/api/core/IBCFakePlayer.java deleted file mode 100755 index 893547214..000000000 --- a/src/api/java/buildcraft/api/core/IBCFakePlayer.java +++ /dev/null @@ -1,25 +0,0 @@ -/** 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 com.mojang.authlib.GameProfile; - -import net.minecraft.world.WorldServer; - -import net.minecraftforge.common.util.FakePlayer; - -public interface IBCFakePlayer { - - /** 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 deleted file mode 100755 index 2c6a4a3bb..000000000 --- a/src/api/java/buildcraft/api/core/IBox.java +++ /dev/null @@ -1,17 +0,0 @@ -/** 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 net.minecraft.util.math.BlockPos; - -public interface IBox extends IZone { - IBox expand(int amount); - - IBox contract(int amount); - - BlockPos min(); - - BlockPos max(); -} diff --git a/src/api/java/buildcraft/api/core/IBuildCraftMod.java b/src/api/java/buildcraft/api/core/IBuildCraftMod.java deleted file mode 100755 index d7774c99e..000000000 --- a/src/api/java/buildcraft/api/core/IBuildCraftMod.java +++ /dev/null @@ -1,8 +0,0 @@ -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/IFluidFilter.java b/src/api/java/buildcraft/api/core/IFluidFilter.java deleted file mode 100755 index 0cd10d669..000000000 --- a/src/api/java/buildcraft/api/core/IFluidFilter.java +++ /dev/null @@ -1,12 +0,0 @@ -/** 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.core; - -import net.minecraftforge.fluids.FluidStack; - -public interface IFluidFilter { - - boolean matches(FluidStack fluid); -} diff --git a/src/api/java/buildcraft/api/core/IFluidHandlerAdv.java b/src/api/java/buildcraft/api/core/IFluidHandlerAdv.java deleted file mode 100755 index aba2d8a64..000000000 --- a/src/api/java/buildcraft/api/core/IFluidHandlerAdv.java +++ /dev/null @@ -1,18 +0,0 @@ -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/IInvSlot.java b/src/api/java/buildcraft/api/core/IInvSlot.java deleted file mode 100755 index a047a2f87..000000000 --- a/src/api/java/buildcraft/api/core/IInvSlot.java +++ /dev/null @@ -1,26 +0,0 @@ -/** 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 net.minecraft.item.ItemStack; - -public interface IInvSlot { - /** Returns the slot number of the underlying Inventory. - * - * @return the slot number */ - int getIndex(); - - boolean canPutStackInSlot(ItemStack stack); - - boolean canTakeStackFromSlot(ItemStack stack); - - boolean isItemValidForSlot(ItemStack stack); - - ItemStack decreaseStackInSlot(int amount); - - ItemStack getStackInSlot(); - - void setStackInSlot(ItemStack stack); -} diff --git a/src/api/java/buildcraft/api/core/INBTLoadable_BC8.java b/src/api/java/buildcraft/api/core/INBTLoadable_BC8.java deleted file mode 100755 index 8005bcf53..000000000 --- a/src/api/java/buildcraft/api/core/INBTLoadable_BC8.java +++ /dev/null @@ -1,14 +0,0 @@ -package buildcraft.api.core; - -import net.minecraft.nbt.NBTBase; - -/** @param The type that will be loaded from and saved too. This essentially allows Immutable objects to be safely - * loaded without helper methods everywhere. However you are allowed to return this if you are a mutable - * object */ -public interface INBTLoadable_BC8 { - /** @return An object that has the properties loaded. WARNIG! This might be the same object as the one this method - * was called on! (You should always replace the object you have stored with whatever this returns) */ - T readFromNBT(NBTBase nbt); - - NBTBase writeToNBT(); -} diff --git a/src/api/java/buildcraft/api/core/INBTStoreable.java b/src/api/java/buildcraft/api/core/INBTStoreable.java deleted file mode 100755 index c34c134ac..000000000 --- a/src/api/java/buildcraft/api/core/INBTStoreable.java +++ /dev/null @@ -1,12 +0,0 @@ -package buildcraft.api.core; - -import net.minecraft.nbt.NBTTagCompound; - -/** Use {@link INBTLoadable_BC8} instead of this, as this gives you more control over what NBT goes where, and what - * objects are allowed to do. */ -@Deprecated -public interface INBTStoreable { - void readFromNBT(NBTTagCompound tag); - - void writeToNBT(NBTTagCompound tag); -} diff --git a/src/api/java/buildcraft/api/core/INetworkLoadable_BC8.java b/src/api/java/buildcraft/api/core/INetworkLoadable_BC8.java deleted file mode 100755 index 42d0d2469..000000000 --- a/src/api/java/buildcraft/api/core/INetworkLoadable_BC8.java +++ /dev/null @@ -1,10 +0,0 @@ -package buildcraft.api.core; - -import io.netty.buffer.ByteBuf; - -@Deprecated -public interface INetworkLoadable_BC8 { - T readFromByteBuf(ByteBuf buf); - - void writeToByteBuf(ByteBuf buf); -} diff --git a/src/api/java/buildcraft/api/core/IPathProvider.java b/src/api/java/buildcraft/api/core/IPathProvider.java deleted file mode 100755 index f21ef36c5..000000000 --- a/src/api/java/buildcraft/api/core/IPathProvider.java +++ /dev/null @@ -1,17 +0,0 @@ -package buildcraft.api.core; - -import java.util.List; - -import net.minecraft.util.math.BlockPos; - -import buildcraft.api.items.IMapLocation.MapLocationType; - -/** To be implemented by TileEntities able to provide a path on the world, typically BuildCraft path markers. */ -public interface IPathProvider { - /** @return The completed path. This should loop back onto itself (The last position is the same as the first - * position) if you are {@link MapLocationType#PATH_REPEATING} */ - List getPath(); - - /** Remove from the world all objects used to define the path. */ - void removeFromWorld(); -} diff --git a/src/api/java/buildcraft/api/core/ISerializable.java b/src/api/java/buildcraft/api/core/ISerializable.java deleted file mode 100755 index 77d56d541..000000000 --- a/src/api/java/buildcraft/api/core/ISerializable.java +++ /dev/null @@ -1,21 +0,0 @@ -/** 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.core; - -import io.netty.buffer.ByteBuf; - -/** Use {@link INetworkLoadable_BC8} instead, as that gives you more control over how you use objects */ -@Deprecated -public interface ISerializable { - /** Serializes the state to the stream - * - * @param data */ - void writeData(ByteBuf data); - - /** Deserializes the state from the stream - * - * @param data */ - void readData(ByteBuf data); -} diff --git a/src/api/java/buildcraft/api/core/IStackFilter.java b/src/api/java/buildcraft/api/core/IStackFilter.java deleted file mode 100755 index 815861c44..000000000 --- a/src/api/java/buildcraft/api/core/IStackFilter.java +++ /dev/null @@ -1,20 +0,0 @@ -/** 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.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 { - - /** 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/IWorldProperty.java b/src/api/java/buildcraft/api/core/IWorldProperty.java deleted file mode 100755 index 415dc12d1..000000000 --- a/src/api/java/buildcraft/api/core/IWorldProperty.java +++ /dev/null @@ -1,14 +0,0 @@ -/** 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 net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -public interface IWorldProperty { - boolean get(World world, BlockPos pos); - - void clear(); -} diff --git a/src/api/java/buildcraft/api/core/IZone.java b/src/api/java/buildcraft/api/core/IZone.java deleted file mode 100755 index 21a5df210..000000000 --- a/src/api/java/buildcraft/api/core/IZone.java +++ /dev/null @@ -1,26 +0,0 @@ -/** 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.Random; - -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; - -public interface IZone { - /** Returns the smallest possible distance that the index would have to be changed by in order for - * {@link #contains(Vec3d)} to return true. If the position is already inside then this will return 0 */ - double distanceTo(BlockPos index); - - /** Returns {@link #distanceTo(BlockPos)} but squared. Usually this will be quicker to calculate. */ - double distanceToSquared(BlockPos index); - - /** Returns true if the point is enclosed by this zone, such that none of the coordinates lie outside the range - * specified by this zone. */ - boolean contains(Vec3d point); - - /** Gets a random position that {@link #contains(Vec3d)} will return true. */ - BlockPos getRandomBlockPos(Random rand); -} diff --git a/src/api/java/buildcraft/api/core/JavaTools.java b/src/api/java/buildcraft/api/core/JavaTools.java deleted file mode 100755 index 7b7eb513c..000000000 --- a/src/api/java/buildcraft/api/core/JavaTools.java +++ /dev/null @@ -1,39 +0,0 @@ -/** 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; - -public final class JavaTools { - private JavaTools() { - - } - - public static T[] concat(T[] first, T[] second) { - T[] result = Arrays.copyOf(first, first.length + second.length); - System.arraycopy(second, 0, result, first.length, second.length); - return result; - } - - public static int[] concat(int[] first, int[] second) { - int[] result = Arrays.copyOf(first, first.length + second.length); - System.arraycopy(second, 0, result, first.length, second.length); - return result; - } - - public static float[] concat(float[] first, float[] second) { - float[] result = Arrays.copyOf(first, first.length + second.length); - System.arraycopy(second, 0, result, first.length, second.length); - return result; - } - - public static String surroundWithQuotes(String stringToSurroundWithQuotes) { - return String.format("\"%s\"", stringToSurroundWithQuotes); - } - - public static String stripSurroundingQuotes(String stringToStripQuotes) { - return stringToStripQuotes.replaceAll("^\"|\"$", ""); - } -} diff --git a/src/api/java/buildcraft/api/core/SafeTimeTracker.java b/src/api/java/buildcraft/api/core/SafeTimeTracker.java deleted file mode 100755 index 30593bef0..000000000 --- a/src/api/java/buildcraft/api/core/SafeTimeTracker.java +++ /dev/null @@ -1,70 +0,0 @@ -/** 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 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; - private long duration = -1; - private long randomRange = 0; - private long lastRandomDelay = 0; - private long internalDelay = 1; - - /** Only use this if the delay time changes (say, if you use this to determine when a refining should be complete */ - public SafeTimeTracker() { - - } - - public SafeTimeTracker(long delay) { - internalDelay = delay; - } - - /** In many situations, it is a bad idea to have all objects of the same kind to be waiting for the exact same - * amount of time, as that can lead to some situation where they're all synchronized and got to work all at the same - * time. When created with a random range, the mark that is set when reaching the expect delay will be added with a - * random number between [0, range[, meaning that the event will take between 0 and range more tick to run. */ - public SafeTimeTracker(long delay, long random) { - internalDelay = delay; - 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); - } - - /** Return true if a given delay has passed since last time marked was called successfully. */ - public boolean markTimeIfDelay(World world, long delay) { - if (world == null) { - return false; - } - - long currentTime = world.getTotalWorldTime(); - - if (currentTime < lastMark) { - lastMark = currentTime; - return false; - } else if (lastMark + delay + lastRandomDelay <= currentTime) { - duration = currentTime - lastMark; - lastMark = currentTime; - lastRandomDelay = (int) (Math.random() * randomRange); - - return true; - } else { - return false; - } - } - - public long durationOfLastDelay() { - return duration > 0 ? duration : 0; - } - - public void markTime(World world) { - lastMark = world.getTotalWorldTime(); - } -} diff --git a/src/api/java/buildcraft/api/core/StackKey.java b/src/api/java/buildcraft/api/core/StackKey.java deleted file mode 100755 index d8c2c44cc..000000000 --- a/src/api/java/buildcraft/api/core/StackKey.java +++ /dev/null @@ -1,124 +0,0 @@ -/** 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 net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -/** This class is used whenever stacks needs to be stored as keys. */ -public final class StackKey { - public final ItemStack stack; - public final FluidStack fluidStack; - - public StackKey(FluidStack fluidStack) { - this(null, fluidStack); - } - - public StackKey(ItemStack stack) { - this(stack, null); - } - - public StackKey(ItemStack stack, FluidStack fluidStack) { - this.stack = stack; - this.fluidStack = fluidStack; - } - - public static StackKey stack(Item item, int amount, int damage) { - return new StackKey(new ItemStack(item, amount, damage)); - } - - public static StackKey stack(Block block, int amount, int damage) { - return new StackKey(new ItemStack(block, amount, damage)); - } - - public static StackKey stack(Item item) { - return new StackKey(new ItemStack(item, 1, 0)); - } - - public static StackKey stack(Block block) { - return new StackKey(new ItemStack(block, 1, 0)); - } - - public static StackKey stack(ItemStack itemStack) { - return new StackKey(itemStack); - } - - public static StackKey fluid(Fluid fluid, int amount) { - return new StackKey(new FluidStack(fluid, amount)); - } - - public static StackKey fluid(Fluid fluid) { - return new StackKey(new FluidStack(fluid, 1000)); - } - - public static StackKey fluid(FluidStack fluidStack) { - return new StackKey(fluidStack); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || o.getClass() != StackKey.class) { - return false; - } - StackKey k = (StackKey) o; - if ((stack == null ^ k.stack == null) || (fluidStack == null ^ k.fluidStack == null)) { - return false; - } - if (stack != null) { - if (stack.getItem() != k.stack.getItem() || stack.getHasSubtypes() && stack.getItemDamage() != k.stack.getItemDamage() || !objectsEqual( - stack.getTagCompound(), k.stack.getTagCompound())) { - return false; - } - } - if (fluidStack != null) { - if (!fluidStack.isFluidEqual(k.fluidStack) || fluidStack.amount != k.fluidStack.amount) { - return false; - } - } - return true; - } - - @Override - public int hashCode() { - int result = 7; - if (stack != null) { - result = 31 * result + stack.getItem().hashCode(); - result = 31 * result + stack.getItemDamage(); - result = 31 * result + objectHashCode(stack.getTagCompound()); - } - result = 31 * result + 7; - if (fluidStack != null) { - result = 31 * result + fluidStack.getFluid().getName().hashCode(); - result = 31 * result + fluidStack.amount; - result = 31 * result + objectHashCode(fluidStack.tag); - } - return result; - } - - private boolean objectsEqual(Object o1, Object o2) { - if (o1 == null && o2 == null) { - return true; - } else if (o1 == null || o2 == null) { - return false; - } else { - return o1.equals(o2); - } - } - - private int objectHashCode(Object o) { - return o != null ? o.hashCode() : 0; - } - - public StackKey copy() { - return new StackKey(stack != null ? stack.copy() : null, fluidStack != null ? fluidStack.copy() : null); - } -} diff --git a/src/api/java/buildcraft/api/core/package-info.java b/src/api/java/buildcraft/api/core/package-info.java deleted file mode 100755 index dde5377cc..000000000 --- a/src/api/java/buildcraft/api/core/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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.2", owner = "buildcraftlib", provides = "BuildCraftAPI|core") -package buildcraft.api.core; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/core/render/ICullable.java b/src/api/java/buildcraft/api/core/render/ICullable.java deleted file mode 100755 index 2399a6927..000000000 --- a/src/api/java/buildcraft/api/core/render/ICullable.java +++ /dev/null @@ -1,27 +0,0 @@ -/** 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.core.render; - -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; - -/* This interface designates a block as a state machine responsible for culling For implementation details look into - * FakeBlock implementation */ -public interface ICullable { - - // Side Rendering States - // They are used to effectively cull obstructed sides while processing facades. - // Make sure your implementation is correct otherwise expect FPS drop - - void setRenderSide(EnumFacing side, boolean render); - - void setRenderAllSides(); - - boolean shouldSideBeRendered(IBlockAccess blockAccess, BlockPos pos, int side); - - void setRenderMask(int mask); - -} diff --git a/src/api/java/buildcraft/api/core/render/ITextureStateManager.java b/src/api/java/buildcraft/api/core/render/ITextureStateManager.java deleted file mode 100755 index e401b3e2e..000000000 --- a/src/api/java/buildcraft/api/core/render/ITextureStateManager.java +++ /dev/null @@ -1,7 +0,0 @@ -package buildcraft.api.core.render; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; - -public interface ITextureStateManager { - void set(TextureAtlasSprite icon); -} diff --git a/src/api/java/buildcraft/api/core/render/ITextureStates.java b/src/api/java/buildcraft/api/core/render/ITextureStates.java deleted file mode 100755 index 593534f6c..000000000 --- a/src/api/java/buildcraft/api/core/render/ITextureStates.java +++ /dev/null @@ -1,18 +0,0 @@ -/** 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.core.render; - -import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; - -public interface ITextureStates extends ICullable { - - ITextureStateManager getTextureState(); - - TextureAtlasSprite getIcon(int side, int meta); - - Block getBlock(); - -} diff --git a/src/api/java/buildcraft/api/crops/CropManager.java b/src/api/java/buildcraft/api/crops/CropManager.java deleted file mode 100755 index 97879829f..000000000 --- a/src/api/java/buildcraft/api/crops/CropManager.java +++ /dev/null @@ -1,86 +0,0 @@ -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 deleted file mode 100755 index 6b2324ac8..000000000 --- a/src/api/java/buildcraft/api/crops/ICropHandler.java +++ /dev/null @@ -1,55 +0,0 @@ -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/crops/package-info.java b/src/api/java/buildcraft/api/crops/package-info.java deleted file mode 100755 index 803ce050a..000000000 --- a/src/api/java/buildcraft/api/crops/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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|crops") -package buildcraft.api.crops; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/enums/EnumBlueprintType.java b/src/api/java/buildcraft/api/enums/EnumBlueprintType.java deleted file mode 100755 index 8d6217797..000000000 --- a/src/api/java/buildcraft/api/enums/EnumBlueprintType.java +++ /dev/null @@ -1,29 +0,0 @@ -package buildcraft.api.enums; - -import net.minecraft.item.ItemStack; - -import buildcraft.api.items.IBlueprintItem; - -public enum EnumBlueprintType { - NONE, - BLUEPRINT, - TEMPLATE; - - public static EnumBlueprintType valueOf(int index) { - if (index <= 0 || index >= values().length) { - return NONE; - } else { - return values()[index]; - } - } - - public static EnumBlueprintType getType(ItemStack item) { - if (item == null) { - return NONE; - } else if (item.getItem() instanceof IBlueprintItem) { - return ((IBlueprintItem) item.getItem()).getType(item); - } else { - return NONE; - } - } -} diff --git a/src/api/java/buildcraft/api/enums/EnumDecoratedBlock.java b/src/api/java/buildcraft/api/enums/EnumDecoratedBlock.java deleted file mode 100755 index f161e2ba8..000000000 --- a/src/api/java/buildcraft/api/enums/EnumDecoratedBlock.java +++ /dev/null @@ -1,34 +0,0 @@ -package buildcraft.api.enums; - -import java.util.Locale; - -import net.minecraft.util.IStringSerializable; - -public enum EnumDecoratedBlock implements IStringSerializable { - DESTROY(0), - BLUEPRINT(10), - TEMPLATE(10), - PAPER(10), - LEATHER(10), - LASER_BACK(0); - - public static final EnumDecoratedBlock[] VALUES = values(); - - public final int lightValue; - - private EnumDecoratedBlock(int lightValue) { - this.lightValue = lightValue; - } - - @Override - 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/EnumEngineType.java b/src/api/java/buildcraft/api/enums/EnumEngineType.java deleted file mode 100755 index 16e2714b7..000000000 --- a/src/api/java/buildcraft/api/enums/EnumEngineType.java +++ /dev/null @@ -1,32 +0,0 @@ -package buildcraft.api.enums; - -import net.minecraft.util.IStringSerializable; - -public enum EnumEngineType implements IStringSerializable { - WOOD("core", "wood"), - STONE("energy", "stone"), - IRON("energy", "iron"), - CREATIVE("energy", "creative"); - - public final String unlocalizedTag; - public final String resourceLocation; - - public static final EnumEngineType[] VALUES = values(); - - EnumEngineType(String mod, String loc) { - unlocalizedTag = loc; - resourceLocation = "buildcraft" + mod + ":blocks/engine/inv/" + loc + "/"; - } - - @Override - public String getName() { - return unlocalizedTag; - } - - public static EnumEngineType fromMeta(int meta) { - if (meta < 0 || meta >= VALUES.length) { - meta = 0; - } - return VALUES[meta]; - } -} diff --git a/src/api/java/buildcraft/api/enums/EnumFillerPattern.java b/src/api/java/buildcraft/api/enums/EnumFillerPattern.java deleted file mode 100755 index 4570f0c79..000000000 --- a/src/api/java/buildcraft/api/enums/EnumFillerPattern.java +++ /dev/null @@ -1,28 +0,0 @@ -package buildcraft.api.enums; - -import java.util.Locale; - -import net.minecraft.util.IStringSerializable; - -public enum EnumFillerPattern implements IStringSerializable { - NONE, - BOX, - CLEAR, - CYLINDER, - FILL, - FLATTEN, - FRAME, - HORIZON, - PYRAMID, - STAIRS; - - @Override - public String toString() { - return getName(); - } - - @Override - public String getName() { - return name().toLowerCase(Locale.ROOT); - } -} diff --git a/src/api/java/buildcraft/api/enums/EnumLaserTableType.java b/src/api/java/buildcraft/api/enums/EnumLaserTableType.java deleted file mode 100755 index dbf99a5c7..000000000 --- a/src/api/java/buildcraft/api/enums/EnumLaserTableType.java +++ /dev/null @@ -1,16 +0,0 @@ -package buildcraft.api.enums; - -import net.minecraft.util.IStringSerializable; - -public enum EnumLaserTableType implements IStringSerializable { - ASSEMBLY_TABLE, - ADVANCED_CRAFTING_TABLE, - INTEGRATION_TABLE, - CHARGING_TABLE, - PROGRAMMING_TABLE; - - @Override - public String getName() { - return name(); - } -} diff --git a/src/api/java/buildcraft/api/enums/EnumMachineState.java b/src/api/java/buildcraft/api/enums/EnumMachineState.java deleted file mode 100755 index 6a215c235..000000000 --- a/src/api/java/buildcraft/api/enums/EnumMachineState.java +++ /dev/null @@ -1,21 +0,0 @@ -package buildcraft.api.enums; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.IStringSerializable; - -import buildcraft.api.properties.BuildCraftProperties; - -public enum EnumMachineState implements IStringSerializable { - OFF, - ON, - DONE; - - public static EnumMachineState getType(IBlockState state) { - return (EnumMachineState) state.getValue(BuildCraftProperties.MACHINE_STATE); - } - - @Override - public String getName() { - return name(); - } -} diff --git a/src/api/java/buildcraft/api/enums/EnumPowerStage.java b/src/api/java/buildcraft/api/enums/EnumPowerStage.java deleted file mode 100755 index 0a88baecd..000000000 --- a/src/api/java/buildcraft/api/enums/EnumPowerStage.java +++ /dev/null @@ -1,27 +0,0 @@ -package buildcraft.api.enums; - -import java.util.Locale; - -import net.minecraft.util.IStringSerializable; - -public enum EnumPowerStage implements IStringSerializable { - BLUE, - GREEN, - YELLOW, - RED, - OVERHEAT, - BLACK; - - public static final EnumPowerStage[] VALUES = values(); - - private final String modelName = name().toLowerCase(Locale.ROOT); - - public String getModelName() { - return modelName; - } - - @Override - public String getName() { - return getModelName(); - } -} diff --git a/src/api/java/buildcraft/api/enums/EnumRedstoneChipset.java b/src/api/java/buildcraft/api/enums/EnumRedstoneChipset.java deleted file mode 100755 index 68ecb2515..000000000 --- a/src/api/java/buildcraft/api/enums/EnumRedstoneChipset.java +++ /dev/null @@ -1,42 +0,0 @@ -package buildcraft.api.enums; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public enum EnumRedstoneChipset { - RED, - IRON, - GOLD, - DIAMOND, - PULSATING, - QUARTZ, - COMP, - EMERALD; - - public ItemStack getStack(int stackSize) { - Item chipset = Item.getByNameOrId("buildcraft|silicon:redstoneChipset"); - if (chipset == null) { - return null; - } - - return new ItemStack(chipset, stackSize, ordinal()); - } - - public ItemStack getStack() { - return getStack(1); - } - - public static EnumRedstoneChipset fromStack(ItemStack stack) { - if (stack == null) { - return RED; - } - return fromOrdinal(stack.getMetadata()); - } - - public static EnumRedstoneChipset fromOrdinal(int ordinal) { - if (ordinal < 0 || ordinal >= values().length) { - return RED; - } - return values()[ordinal]; - } -} diff --git a/src/api/java/buildcraft/api/enums/EnumSpring.java b/src/api/java/buildcraft/api/enums/EnumSpring.java deleted file mode 100755 index 478b5cae8..000000000 --- a/src/api/java/buildcraft/api/enums/EnumSpring.java +++ /dev/null @@ -1,35 +0,0 @@ -package buildcraft.api.enums; - -import java.util.Locale; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; -import net.minecraft.util.IStringSerializable; - -import buildcraft.api.properties.BuildCraftProperties; - -public enum EnumSpring implements IStringSerializable { - - WATER(5, -1, Blocks.WATER.getDefaultState()), - OIL(6000, 8, null); // Set in BuildCraftEnergy - public static final EnumSpring[] VALUES = values(); - 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; - this.chance = chance; - this.liquidBlock = liquidBlock; - } - - public static EnumSpring fromState(IBlockState state) { - return state.getValue(BuildCraftProperties.SPRING_TYPE); - } - - @Override - public String getName() { - return lowerCaseName; - } -} diff --git a/src/api/java/buildcraft/api/enums/package-info.java b/src/api/java/buildcraft/api/enums/package-info.java deleted file mode 100755 index 8c585be95..000000000 --- a/src/api/java/buildcraft/api/enums/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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|enums") -package buildcraft.api.enums; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/events/BlockInteractionEvent.java b/src/api/java/buildcraft/api/events/BlockInteractionEvent.java deleted file mode 100755 index 4a4d8b7bd..000000000 --- a/src/api/java/buildcraft/api/events/BlockInteractionEvent.java +++ /dev/null @@ -1,22 +0,0 @@ -/** 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 deleted file mode 100755 index 22a8a74fa..000000000 --- a/src/api/java/buildcraft/api/events/BlockPlacedDownEvent.java +++ /dev/null @@ -1,25 +0,0 @@ -/** 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 deleted file mode 100755 index 3664a57d2..000000000 --- a/src/api/java/buildcraft/api/events/PipePlacedEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -/** 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 deleted file mode 100755 index 9b12b64d2..000000000 --- a/src/api/java/buildcraft/api/events/RobotEvent.java +++ /dev/null @@ -1,53 +0,0 @@ -/** 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 deleted file mode 100755 index b0abc44d8..000000000 --- a/src/api/java/buildcraft/api/events/RobotPlacementEvent.java +++ /dev/null @@ -1,22 +0,0 @@ -/** 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 deleted file mode 100755 index 06cd25fea..000000000 --- a/src/api/java/buildcraft/api/events/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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 deleted file mode 100755 index b3e214ea8..000000000 --- a/src/api/java/buildcraft/api/facades/FacadeAPI.java +++ /dev/null @@ -1,9 +0,0 @@ -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 deleted file mode 100755 index c88d89ff4..000000000 --- a/src/api/java/buildcraft/api/facades/FacadeType.java +++ /dev/null @@ -1,14 +0,0 @@ -/** 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 deleted file mode 100755 index 1fe981a3b..000000000 --- a/src/api/java/buildcraft/api/facades/IFacadeItem.java +++ /dev/null @@ -1,16 +0,0 @@ -/** 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 deleted file mode 100755 index 2c79167b3..000000000 --- a/src/api/java/buildcraft/api/facades/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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 deleted file mode 100755 index 03567c45a..000000000 --- a/src/api/java/buildcraft/api/filler/FillerManager.java +++ /dev/null @@ -1,13 +0,0 @@ -/** 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 deleted file mode 100755 index db52b51f0..000000000 --- a/src/api/java/buildcraft/api/filler/IFillerPattern.java +++ /dev/null @@ -1,12 +0,0 @@ -/** 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 deleted file mode 100755 index f9e588f62..000000000 --- a/src/api/java/buildcraft/api/filler/IFillerRegistry.java +++ /dev/null @@ -1,19 +0,0 @@ -/** 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 deleted file mode 100755 index 3e9d907de..000000000 --- a/src/api/java/buildcraft/api/filler/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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/BuildcraftFuelRegistry.java b/src/api/java/buildcraft/api/fuels/BuildcraftFuelRegistry.java deleted file mode 100755 index 545ac3d3b..000000000 --- a/src/api/java/buildcraft/api/fuels/BuildcraftFuelRegistry.java +++ /dev/null @@ -1,12 +0,0 @@ -/** 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.fuels; - -public final class BuildcraftFuelRegistry { - public static IFuelManager fuel; - public static ICoolantManager coolant; - - private BuildcraftFuelRegistry() {} -} diff --git a/src/api/java/buildcraft/api/fuels/ICoolant.java b/src/api/java/buildcraft/api/fuels/ICoolant.java deleted file mode 100755 index 5d038c8d5..000000000 --- a/src/api/java/buildcraft/api/fuels/ICoolant.java +++ /dev/null @@ -1,13 +0,0 @@ -/** 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.fuels; - -import net.minecraftforge.fluids.Fluid; - -public interface ICoolant { - Fluid getFluid(); - - float getDegreesCoolingPerMB(float heat); -} diff --git a/src/api/java/buildcraft/api/fuels/ICoolantManager.java b/src/api/java/buildcraft/api/fuels/ICoolantManager.java deleted file mode 100755 index fb535c438..000000000 --- a/src/api/java/buildcraft/api/fuels/ICoolantManager.java +++ /dev/null @@ -1,32 +0,0 @@ -/** 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.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; - -public interface ICoolantManager { - ICoolant addCoolant(ICoolant coolant); - - ICoolant addCoolant(Fluid fluid, float degreesCoolingPerMB); - - ISolidCoolant addSolidCoolant(ISolidCoolant solidCoolant); - - ISolidCoolant addSolidCoolant(ItemStack solid, FluidStack fluid, float multiplier); - - Collection getCoolants(); - - Collection getSolidCoolants(); - - ICoolant getCoolant(Fluid fluid); - - ISolidCoolant getSolidCoolant(ItemStack solid); -} diff --git a/src/api/java/buildcraft/api/fuels/IFuel.java b/src/api/java/buildcraft/api/fuels/IFuel.java deleted file mode 100755 index 65891f75a..000000000 --- a/src/api/java/buildcraft/api/fuels/IFuel.java +++ /dev/null @@ -1,17 +0,0 @@ -/** 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.fuels; - -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(); - - /** @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 deleted file mode 100755 index 137882139..000000000 --- a/src/api/java/buildcraft/api/fuels/IFuelManager.java +++ /dev/null @@ -1,27 +0,0 @@ -/** 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.fuels; - -import java.util.Collection; - -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -public interface IFuelManager { - IFuel addFuel(IFuel fuel); - - IFuel addFuel(Fluid fluid, long powerPerCycle, int totalBurningTime); - - IDirtyFuel addDirtyFuel(Fluid fuel, long powerPerCycle, int totalBurningTime, FluidStack residue); - - Collection getFuels(); - - IFuel getFuel(Fluid fluid); - - public interface IDirtyFuel extends IFuel { - /** @return The residue fluidstack, per bucket of original fuel. */ - FluidStack getResidue(); - } -} diff --git a/src/api/java/buildcraft/api/fuels/ISolidCoolant.java b/src/api/java/buildcraft/api/fuels/ISolidCoolant.java deleted file mode 100755 index 2b466efeb..000000000 --- a/src/api/java/buildcraft/api/fuels/ISolidCoolant.java +++ /dev/null @@ -1,13 +0,0 @@ -/** 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.fuels; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fluids.FluidStack; - -public interface ISolidCoolant { - FluidStack getFluidFromSolidCoolant(ItemStack stack); -} diff --git a/src/api/java/buildcraft/api/fuels/package-info.java b/src/api/java/buildcraft/api/fuels/package-info.java deleted file mode 100755 index 93d524dbf..000000000 --- a/src/api/java/buildcraft/api/fuels/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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|fuels") -package buildcraft.api.fuels; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/gates/IGate.java b/src/api/java/buildcraft/api/gates/IGate.java deleted file mode 100755 index 2d9302c3c..000000000 --- a/src/api/java/buildcraft/api/gates/IGate.java +++ /dev/null @@ -1,28 +0,0 @@ -/** 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 deleted file mode 100755 index b86ad48bd..000000000 --- a/src/api/java/buildcraft/api/gates/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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/IBlueprintItem.java b/src/api/java/buildcraft/api/items/IBlueprintItem.java deleted file mode 100755 index d67bc39fd..000000000 --- a/src/api/java/buildcraft/api/items/IBlueprintItem.java +++ /dev/null @@ -1,9 +0,0 @@ -package buildcraft.api.items; - -import net.minecraft.item.ItemStack; - -import buildcraft.api.enums.EnumBlueprintType; - -public interface IBlueprintItem extends INamedItem { - EnumBlueprintType getType(ItemStack stack); -} diff --git a/src/api/java/buildcraft/api/items/IItemCustomPipeRender.java b/src/api/java/buildcraft/api/items/IItemCustomPipeRender.java deleted file mode 100755 index 697b87597..000000000 --- a/src/api/java/buildcraft/api/items/IItemCustomPipeRender.java +++ /dev/null @@ -1,14 +0,0 @@ -package buildcraft.api.items; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public interface IItemCustomPipeRender { - float getPipeRenderScale(ItemStack stack); - - /** @return False to use the default renderer, true otherwise. */ - @SideOnly(Side.CLIENT) - boolean renderItemInPipe(ItemStack stack, double x, double y, double z); -} diff --git a/src/api/java/buildcraft/api/items/IList.java b/src/api/java/buildcraft/api/items/IList.java deleted file mode 100755 index 1456d2468..000000000 --- a/src/api/java/buildcraft/api/items/IList.java +++ /dev/null @@ -1,9 +0,0 @@ -package buildcraft.api.items; - -import javax.annotation.Nonnull; - -import net.minecraft.item.ItemStack; - -public interface IList extends INamedItem { - 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 deleted file mode 100755 index b10adecd0..000000000 --- a/src/api/java/buildcraft/api/items/IMapLocation.java +++ /dev/null @@ -1,69 +0,0 @@ -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; - -import buildcraft.api.core.IBox; -import buildcraft.api.core.IZone; - -/** Created by asie on 2/28/15. */ -public interface IMapLocation extends INamedItem { - public enum MapLocationType { - CLEAN, - SPOT, - AREA, - PATH, - ZONE, - /** Like PATH but repeats around in a loop. */ - PATH_REPEATING; - - public final int meta = ordinal(); - - public static MapLocationType getFromStack(@Nonnull ItemStack stack) { - int dam = stack.getItemDamage(); - if (dam < 0 || dam >= values().length) { - return MapLocationType.CLEAN; - } - return values()[dam]; - } - - public void setToStack(@Nonnull ItemStack stack) { - stack.setItemDamage(meta); - } - } - - /** This function can be used for SPOT types. - * - * @param stack - * @return The point representing the map location. */ - 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(@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(@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(@Nonnull ItemStack stack); - - /** This function can be used for SPOT types only. - * - * @param stack - * @return The side of the spot. */ - 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 deleted file mode 100755 index 87c342075..000000000 --- a/src/api/java/buildcraft/api/items/INamedItem.java +++ /dev/null @@ -1,11 +0,0 @@ -package buildcraft.api.items; - -import javax.annotation.Nonnull; - -import net.minecraft.item.ItemStack; - -public interface INamedItem { - String getName(@Nonnull ItemStack stack); - - boolean setName(@Nonnull ItemStack stack, String name); -} diff --git a/src/api/java/buildcraft/api/items/package-info.java b/src/api/java/buildcraft/api/items/package-info.java deleted file mode 100755 index f6d2835d6..000000000 --- a/src/api/java/buildcraft/api/items/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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|items") -package buildcraft.api.items; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/library/ILibraryTypeHandler.java b/src/api/java/buildcraft/api/library/ILibraryTypeHandler.java deleted file mode 100755 index 8616d10fe..000000000 --- a/src/api/java/buildcraft/api/library/ILibraryTypeHandler.java +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100755 index b3b1e84f8..000000000 --- a/src/api/java/buildcraft/api/library/LibraryAPI.java +++ /dev/null @@ -1,30 +0,0 @@ -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 deleted file mode 100755 index 08db4f6f3..000000000 --- a/src/api/java/buildcraft/api/library/LibraryTypeHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100755 index c7c5e2317..000000000 --- a/src/api/java/buildcraft/api/library/LibraryTypeHandlerByteArray.java +++ /dev/null @@ -1,13 +0,0 @@ -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 deleted file mode 100755 index a656ff7c7..000000000 --- a/src/api/java/buildcraft/api/library/LibraryTypeHandlerNBT.java +++ /dev/null @@ -1,14 +0,0 @@ -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 deleted file mode 100755 index e41a0dc0f..000000000 --- a/src/api/java/buildcraft/api/library/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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 deleted file mode 100755 index 339176ed9..000000000 --- a/src/api/java/buildcraft/api/lists/ListMatchHandler.java +++ /dev/null @@ -1,28 +0,0 @@ -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 deleted file mode 100755 index 1f3655244..000000000 --- a/src/api/java/buildcraft/api/lists/ListRegistry.java +++ /dev/null @@ -1,26 +0,0 @@ -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 deleted file mode 100755 index 603c33587..000000000 --- a/src/api/java/buildcraft/api/lists/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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 deleted file mode 100755 index 26adb399c..000000000 --- a/src/api/java/buildcraft/api/mj/ILaserTarget.java +++ /dev/null @@ -1,26 +0,0 @@ -/** 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 deleted file mode 100755 index 3e511f7d5..000000000 --- a/src/api/java/buildcraft/api/mj/ILaserTargetBlock.java +++ /dev/null @@ -1,12 +0,0 @@ -/** 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 deleted file mode 100755 index 3c5f997a3..000000000 --- a/src/api/java/buildcraft/api/mj/IMjConnector.java +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100755 index c7fb899b0..000000000 --- a/src/api/java/buildcraft/api/mj/IMjEffectManager.java +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100755 index 55b33c685..000000000 --- a/src/api/java/buildcraft/api/mj/IMjPassiveProvider.java +++ /dev/null @@ -1,11 +0,0 @@ -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 deleted file mode 100755 index 616592263..000000000 --- a/src/api/java/buildcraft/api/mj/IMjReadable.java +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100755 index fe9eadd0b..000000000 --- a/src/api/java/buildcraft/api/mj/IMjReceiver.java +++ /dev/null @@ -1,19 +0,0 @@ -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 deleted file mode 100755 index 11eb5de63..000000000 --- a/src/api/java/buildcraft/api/mj/IMjRedstoneReceiver.java +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100755 index 8bf317e1f..000000000 --- a/src/api/java/buildcraft/api/mj/MjAPI.java +++ /dev/null @@ -1,184 +0,0 @@ -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 deleted file mode 100755 index ca86ce1f3..000000000 --- a/src/api/java/buildcraft/api/mj/MjBattery.java +++ /dev/null @@ -1,116 +0,0 @@ -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 deleted file mode 100755 index 41f78747d..000000000 --- a/src/api/java/buildcraft/api/mj/MjCapabilityHelper.java +++ /dev/null @@ -1,57 +0,0 @@ -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 deleted file mode 100755 index c2670e4cf..000000000 --- a/src/api/java/buildcraft/api/mj/package-info.java +++ /dev/null @@ -1,26 +0,0 @@ -/** 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 deleted file mode 100755 index 0fa178d2b..000000000 --- a/src/api/java/buildcraft/api/permission/IOwner.java +++ /dev/null @@ -1,24 +0,0 @@ -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 deleted file mode 100755 index b6c4350bb..000000000 --- a/src/api/java/buildcraft/api/permission/IPlayerOwned.java +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100755 index c25037cc4..000000000 --- a/src/api/java/buildcraft/api/power/IEngine.java +++ /dev/null @@ -1,26 +0,0 @@ -/** 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 deleted file mode 100755 index 3fc534d45..000000000 --- a/src/api/java/buildcraft/api/power/IRedstoneEngine.java +++ /dev/null @@ -1,7 +0,0 @@ -/** 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 deleted file mode 100755 index c20c3ee4c..000000000 --- a/src/api/java/buildcraft/api/power/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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/BuildCraftExtendedProperty.java b/src/api/java/buildcraft/api/properties/BuildCraftExtendedProperty.java deleted file mode 100755 index e0ba3a62d..000000000 --- a/src/api/java/buildcraft/api/properties/BuildCraftExtendedProperty.java +++ /dev/null @@ -1,65 +0,0 @@ -package buildcraft.api.properties; - -import java.util.List; - -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; - -import net.minecraftforge.common.property.IExtendedBlockState; -import net.minecraftforge.common.property.IUnlistedProperty; - -public class BuildCraftExtendedProperty> extends BuildCraftProperty implements IUnlistedProperty { - private final Predicate function; - - public BuildCraftExtendedProperty(String name, Class clazz, Predicate allowingFunction) { - super(name, clazz); - function = allowingFunction; - } - - public BuildCraftExtendedProperty(String name, Class clazz, List allowedValues) { - super(name, clazz, allowedValues); - function = null; - } - - public static BuildCraftExtendedProperty create(String name, final double min, final double max) { - return new BuildCraftExtendedProperty(name, Double.class, new Predicate() { - @Override - public boolean apply(Double input) { - return input >= min && input <= max; - } - }); - } - - /** This is useful if you want to use a particular class for this property, but don't care what the class contains - * (it will never contain an incorrect value) */ - public static > BuildCraftExtendedProperty createExtended(String name, Class clazz) { - return new BuildCraftExtendedProperty(name, clazz, Predicates. alwaysTrue()); - } - - @Override - public boolean isValid(T value) { - if (function == null) { - return values.contains(value); - } - return function.apply(value); - } - - @Override - public Class getType() { - return getValueClass(); - } - - @Override - public String valueToString(T value) { - return valueName(value); - } - - public T getUnlistedValue(IExtendedBlockState state) { - return state.getValue(asUnlistedProperty()); - } - - // Helper methods for arguments - public IUnlistedProperty asUnlistedProperty() { - return this; - } -} diff --git a/src/api/java/buildcraft/api/properties/BuildCraftProperties.java b/src/api/java/buildcraft/api/properties/BuildCraftProperties.java deleted file mode 100755 index d7f883b7b..000000000 --- a/src/api/java/buildcraft/api/properties/BuildCraftProperties.java +++ /dev/null @@ -1,84 +0,0 @@ -package buildcraft.api.properties; - -import java.util.Map; - -import com.google.common.collect.Maps; - -import net.minecraft.item.EnumDyeColor; -import net.minecraft.util.EnumFacing; - -import buildcraft.api.enums.*; - -public final class BuildCraftProperties { - public static final BuildCraftProperty BLOCK_FACING = BuildCraftProperty.create("facing", EnumFacing.Plane.HORIZONTAL.facings()); - public static final BuildCraftProperty BLOCK_FACING_6 = BuildCraftProperty.create("facing", EnumFacing.class); - - public static final BuildCraftProperty BLOCK_COLOR = BuildCraftProperty.create("color", EnumDyeColor.class); - public static final BuildCraftProperty SPRING_TYPE = BuildCraftProperty.create("type", EnumSpring.class); - 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", 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); - - public static final BuildCraftProperty GENERIC_PIPE_DATA = BuildCraftProperty.create("pipe_data", 0, 15); - public static final BuildCraftProperty LED_POWER = BuildCraftProperty.create("led_power", 0, 3); - - public static final BuildCraftProperty JOINED_BELOW = BuildCraftProperty.create("joined_below", false); - 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); - public static final BuildCraftProperty CONNECTED_EAST = BuildCraftProperty.create("connected_east", false); - public static final BuildCraftProperty CONNECTED_WEST = BuildCraftProperty.create("connected_west", false); - public static final BuildCraftProperty CONNECTED_NORTH = BuildCraftProperty.create("connected_north", false); - public static final BuildCraftProperty CONNECTED_SOUTH = BuildCraftProperty.create("connected_south", false); - - public static final Map> CONNECTED_MAP; - - // Unlisted properties - // public static final PropertyDouble FLUID_HEIGHT_NE = new PropertyDouble("height_ne", 0, 1); - // public static final PropertyDouble FLUID_HEIGHT_NW = new PropertyDouble("height_nw", 0, 1); - // public static final PropertyDouble FLUID_HEIGHT_SE = new PropertyDouble("height_se", 0, 1); - // public static final PropertyDouble FLUID_HEIGHT_SW = new PropertyDouble("height_sw", 0, 1); - // public static final PropertyDouble FLUID_FLOW_DIRECTION = new PropertyDouble("direction", - // Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY); - public static final BuildCraftProperty FILLER_PATTERN = BuildCraftProperty.create("pattern", EnumFillerPattern.class); - - // Block state setting flags -these are used by World.markAndNotifyBlock and World.setBlockState. These flags can be - // added together to pass the additions - public static final int UPDATE_NONE = 0; - /** This updates the neighbouring blocks that the new block is set. It also updates the comparator output of this - * block. */ - public static final int UPDATE_NEIGHBOURS = 1; - /** This will mark the block for an update next tick, as well as send an update to the client (if this is a server - * world). */ - public static final int MARK_BLOCK_FOR_UPDATE = 2; - /** This will mark the block for an update, even if this is a client world. It is useless to use this if - * world.isRemote returns false. */ - public static final int UPDATE_EVEN_CLIENT = 4 + MARK_BLOCK_FOR_UPDATE; // 6 - - // Pre-added flags- pass these as-is to the World.markAndNotifyBlock and World.setBlockState methods. - /** This will do what both {@link #UPDATE_NEIGHBOURS} and {@link #MARK_BLOCK_FOR_UPDATE} do. */ - public static final int MARK_THIS_AND_NEIGHBOURS = UPDATE_NEIGHBOURS + MARK_BLOCK_FOR_UPDATE; - /** This will update everything about this block. */ - public static final int UPDATE_ALL = UPDATE_NEIGHBOURS + MARK_BLOCK_FOR_UPDATE + UPDATE_EVEN_CLIENT; - - static { - Map> map = Maps.newEnumMap(EnumFacing.class); - map.put(EnumFacing.DOWN, CONNECTED_DOWN); - map.put(EnumFacing.UP, CONNECTED_UP); - map.put(EnumFacing.EAST, CONNECTED_EAST); - map.put(EnumFacing.WEST, CONNECTED_WEST); - map.put(EnumFacing.NORTH, CONNECTED_NORTH); - map.put(EnumFacing.SOUTH, CONNECTED_SOUTH); - CONNECTED_MAP = Maps.immutableEnumMap(map); - } - - /** Deactivate constructor */ - private BuildCraftProperties() {} -} diff --git a/src/api/java/buildcraft/api/properties/BuildCraftProperty.java b/src/api/java/buildcraft/api/properties/BuildCraftProperty.java deleted file mode 100755 index f13f82c5b..000000000 --- a/src/api/java/buildcraft/api/properties/BuildCraftProperty.java +++ /dev/null @@ -1,147 +0,0 @@ -package buildcraft.api.properties; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Locale; - -import com.google.common.base.Optional; - -import net.minecraft.block.properties.PropertyHelper; -import net.minecraft.util.IStringSerializable; -import net.minecraft.util.math.MathHelper; - -/** This class exists primarily to allow for a property to be used as either a normal IProperty, or an - * IUnlistedProperty. It also exists to give IProperty's generic types. */ -public class BuildCraftProperty> extends PropertyHelper { - private final String name; - private final Class clazz; - protected final List values; - - public BuildCraftProperty(String name, Class clazz, T[] values) { - this(name, clazz, Arrays.asList(values)); - } - - public BuildCraftProperty(String name, Class clazz, List values) { - super(name, clazz); - this.name = name; - this.clazz = clazz; - this.values = values; - } - - /** Used for BuildCraftInifiniteProperty */ - protected BuildCraftProperty(String name, Class clazz) { - super(name, clazz); - this.name = name; - this.clazz = clazz; - this.values = Collections.emptyList(); - } - - public static > BuildCraftProperty create(String name, Class enumeration) { - List values = Arrays.asList(enumeration.getEnumConstants()); - return new BuildCraftProperty(name, enumeration, values); - } - - public static > BuildCraftProperty create(String name, E... values) { - Class clazz = values[0].getDeclaringClass(); - List list = Arrays.asList(values); - return new BuildCraftProperty(name, clazz, list); - } - - public static BuildCraftProperty create(String name, boolean first) { - return new BuildCraftProperty(name, Boolean.class, new Boolean[] { first, !first }); - } - - /** first and last are both inclusive values (use 0, 4 to create an array of [0, 1, 2, 3, 4]) */ - public static BuildCraftProperty create(String name, int first, int last) { - return create(name, first, last, 1); - } - - /** 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(Math.abs(first - last) / (float) actualDiff + 1); - Integer[] array = new Integer[number]; - int addedDiff = actualDiff * (first > last ? -1 : 1); - int current = first; - for (int i = 0; i < array.length; i++) { - array[i] = current; - current += addedDiff; - } - return new BuildCraftProperty(name, Integer.class, array); - } - - public static BuildCraftProperty create(String name, double first, double last) { - return create(name, first, last, 1); - } - - public static BuildCraftProperty create(String name, double first, double last, double difference) { - double actualDiff = Math.abs(difference); - Double[] array = new Double[(int) (Math.abs(first - last) / actualDiff)]; - double addedDiff = actualDiff * (first > last ? -1 : 1); - for (int i = 0; i <= array.length; i++) { - array[i] = first + (first - last) / addedDiff * i; - } - return new BuildCraftProperty(name, Double.class, array); - } - - @Override - public String getName() { - return name; - } - - @Override - public List getAllowedValues() { - return values; - } - - @Override - public Class getValueClass() { - return clazz; - } - - @Override - public String getName(@SuppressWarnings("rawtypes") Comparable value) { - return valueName(value); - } - - protected String valueName(Object value) { - if (value == null) { - return "null"; - } else if (value instanceof IStringSerializable) { - return ((IStringSerializable) value).getName(); - } else if (value instanceof Enum) { - return ((Enum) value).name().toLowerCase(Locale.ROOT); - } else { - return value.toString().toLowerCase(Locale.ROOT); - } - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("BuildCraftProperty [name="); - builder.append(name); - builder.append(", clazz="); - builder.append(clazz); - builder.append(", values="); - builder.append(values); - builder.append("]"); - return builder.toString(); - } - - @Override - public Optional parseValue(String value) { - if (clazz.isEnum()) { - return parseEnum(value, (BuildCraftProperty) this); - } - return Optional.absent(); - } - - public static > Optional parseEnum(String name, BuildCraftProperty prop) { - for (E e : prop.values) { - if (e.name().equalsIgnoreCase(name)) return Optional.of(e); - } - return Optional.absent(); - } -} diff --git a/src/api/java/buildcraft/api/recipes/AssemblyRecipe.java b/src/api/java/buildcraft/api/recipes/AssemblyRecipe.java deleted file mode 100755 index 0baba21c0..000000000 --- a/src/api/java/buildcraft/api/recipes/AssemblyRecipe.java +++ /dev/null @@ -1,109 +0,0 @@ -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 deleted file mode 100755 index fd0838ab5..000000000 --- a/src/api/java/buildcraft/api/recipes/BuildcraftRecipeRegistry.java +++ /dev/null @@ -1,14 +0,0 @@ -/** 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 deleted file mode 100755 index 4e051d78d..000000000 --- a/src/api/java/buildcraft/api/recipes/IAssemblyRecipeProvider.java +++ /dev/null @@ -1,20 +0,0 @@ -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 deleted file mode 100755 index 9665f40d7..000000000 --- a/src/api/java/buildcraft/api/recipes/IAssemblyRecipeRegistry.java +++ /dev/null @@ -1,19 +0,0 @@ -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 deleted file mode 100755 index 5623b5eaa..000000000 --- a/src/api/java/buildcraft/api/recipes/IComplexRefineryRecipeManager.java +++ /dev/null @@ -1,66 +0,0 @@ -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 deleted file mode 100755 index 77b1cfc22..000000000 --- a/src/api/java/buildcraft/api/recipes/IIntegrationRecipeProvider.java +++ /dev/null @@ -1,20 +0,0 @@ -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 deleted file mode 100755 index 7e4c55b72..000000000 --- a/src/api/java/buildcraft/api/recipes/IIntegrationRecipeRegistry.java +++ /dev/null @@ -1,17 +0,0 @@ -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 deleted file mode 100755 index afaac2dd8..000000000 --- a/src/api/java/buildcraft/api/recipes/IntegrationRecipe.java +++ /dev/null @@ -1,120 +0,0 @@ -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 deleted file mode 100755 index f8cc9942a..000000000 --- a/src/api/java/buildcraft/api/recipes/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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 deleted file mode 100755 index 0fad58245..000000000 --- a/src/api/java/buildcraft/api/robots/AIRobot.java +++ /dev/null @@ -1,222 +0,0 @@ -/** 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 deleted file mode 100755 index 28ecb0830..000000000 --- a/src/api/java/buildcraft/api/robots/DockingStation.java +++ /dev/null @@ -1,225 +0,0 @@ -/** 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 deleted file mode 100755 index 0e6439d04..000000000 --- a/src/api/java/buildcraft/api/robots/EntityRobotBase.java +++ /dev/null @@ -1,86 +0,0 @@ -/** 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 deleted file mode 100755 index 0cbd3c3b8..000000000 --- a/src/api/java/buildcraft/api/robots/IDockingStationProvider.java +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100755 index 2e56148a8..000000000 --- a/src/api/java/buildcraft/api/robots/IRequestProvider.java +++ /dev/null @@ -1,32 +0,0 @@ -/** 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 deleted file mode 100755 index fa39ee1a1..000000000 --- a/src/api/java/buildcraft/api/robots/IRobotOverlayItem.java +++ /dev/null @@ -1,14 +0,0 @@ -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 deleted file mode 100755 index 96360f564..000000000 --- a/src/api/java/buildcraft/api/robots/IRobotRegistry.java +++ /dev/null @@ -1,56 +0,0 @@ -/** 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 deleted file mode 100755 index 001249453..000000000 --- a/src/api/java/buildcraft/api/robots/IRobotRegistryProvider.java +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100755 index 539503a0f..000000000 --- a/src/api/java/buildcraft/api/robots/ResourceId.java +++ /dev/null @@ -1,39 +0,0 @@ -/** 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 deleted file mode 100755 index 4e89a5826..000000000 --- a/src/api/java/buildcraft/api/robots/ResourceIdBlock.java +++ /dev/null @@ -1,71 +0,0 @@ -/** 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 deleted file mode 100755 index d224b8e76..000000000 --- a/src/api/java/buildcraft/api/robots/ResourceIdRequest.java +++ /dev/null @@ -1,54 +0,0 @@ -/** 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 deleted file mode 100755 index aa59fc4d7..000000000 --- a/src/api/java/buildcraft/api/robots/RobotManager.java +++ /dev/null @@ -1,114 +0,0 @@ -/** 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 deleted file mode 100755 index 4fd622b34..000000000 --- a/src/api/java/buildcraft/api/robots/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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 deleted file mode 100755 index 2cd0c359f..000000000 --- a/src/api/java/buildcraft/api/statements/IAction.java +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100755 index 9086612ca..000000000 --- a/src/api/java/buildcraft/api/statements/IActionExternal.java +++ /dev/null @@ -1,12 +0,0 @@ -/** 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 deleted file mode 100755 index 1ec5260f3..000000000 --- a/src/api/java/buildcraft/api/statements/IActionInternal.java +++ /dev/null @@ -1,10 +0,0 @@ -/** 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 deleted file mode 100755 index 0ae3d70d3..000000000 --- a/src/api/java/buildcraft/api/statements/IActionInternalSided.java +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100755 index fa550ff83..000000000 --- a/src/api/java/buildcraft/api/statements/IActionProvider.java +++ /dev/null @@ -1,20 +0,0 @@ -/** 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 deleted file mode 100755 index 34155b86a..000000000 --- a/src/api/java/buildcraft/api/statements/IActionReceptor.java +++ /dev/null @@ -1,9 +0,0 @@ -/** 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 deleted file mode 100755 index 861e37eb2..000000000 --- a/src/api/java/buildcraft/api/statements/IActionSingle.java +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100755 index c7386dd69..000000000 --- a/src/api/java/buildcraft/api/statements/IGuiSlot.java +++ /dev/null @@ -1,20 +0,0 @@ -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 deleted file mode 100755 index cb2dc78e1..000000000 --- a/src/api/java/buildcraft/api/statements/IOverrideDefaultStatements.java +++ /dev/null @@ -1,13 +0,0 @@ -/** 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 deleted file mode 100755 index 70c20836e..000000000 --- a/src/api/java/buildcraft/api/statements/IStatement.java +++ /dev/null @@ -1,26 +0,0 @@ -/** 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 deleted file mode 100755 index 2e7652fd8..000000000 --- a/src/api/java/buildcraft/api/statements/IStatementContainer.java +++ /dev/null @@ -1,15 +0,0 @@ -/** 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 deleted file mode 100755 index 8e15b9c46..000000000 --- a/src/api/java/buildcraft/api/statements/IStatementParameter.java +++ /dev/null @@ -1,33 +0,0 @@ -/** 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 deleted file mode 100755 index cdb65c971..000000000 --- a/src/api/java/buildcraft/api/statements/ITrigger.java +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100755 index 87a848fef..000000000 --- a/src/api/java/buildcraft/api/statements/ITriggerExternal.java +++ /dev/null @@ -1,14 +0,0 @@ -/** 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 deleted file mode 100755 index 5b8ce9ee2..000000000 --- a/src/api/java/buildcraft/api/statements/ITriggerExternalOverride.java +++ /dev/null @@ -1,16 +0,0 @@ -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 deleted file mode 100755 index 8ca49961d..000000000 --- a/src/api/java/buildcraft/api/statements/ITriggerInternal.java +++ /dev/null @@ -1,11 +0,0 @@ -/** 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 deleted file mode 100755 index 73459f004..000000000 --- a/src/api/java/buildcraft/api/statements/ITriggerInternalSided.java +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100755 index 8f3bf0317..000000000 --- a/src/api/java/buildcraft/api/statements/ITriggerProvider.java +++ /dev/null @@ -1,21 +0,0 @@ -/** 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 deleted file mode 100755 index 61266e583..000000000 --- a/src/api/java/buildcraft/api/statements/StatementManager.java +++ /dev/null @@ -1,144 +0,0 @@ -/** 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 deleted file mode 100755 index c39ed336f..000000000 --- a/src/api/java/buildcraft/api/statements/StatementMouseClick.java +++ /dev/null @@ -1,23 +0,0 @@ -/** 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 deleted file mode 100755 index 5ed9c4088..000000000 --- a/src/api/java/buildcraft/api/statements/StatementParameterItemStack.java +++ /dev/null @@ -1,108 +0,0 @@ -/** 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 deleted file mode 100755 index b3306b4bd..000000000 --- a/src/api/java/buildcraft/api/statements/StatementSlot.java +++ /dev/null @@ -1,45 +0,0 @@ -/** 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 deleted file mode 100755 index 1d7989aa0..000000000 --- a/src/api/java/buildcraft/api/statements/containers/IRedstoneStatementContainer.java +++ /dev/null @@ -1,17 +0,0 @@ -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 deleted file mode 100755 index b65ace45a..000000000 --- a/src/api/java/buildcraft/api/statements/containers/ISidedStatementContainer.java +++ /dev/null @@ -1,10 +0,0 @@ -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 deleted file mode 100755 index 7dd2c74e6..000000000 --- a/src/api/java/buildcraft/api/statements/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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 deleted file mode 100755 index e88a4cf36..000000000 --- a/src/api/java/buildcraft/api/tablet/ITablet.java +++ /dev/null @@ -1,19 +0,0 @@ -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 deleted file mode 100755 index 529862790..000000000 --- a/src/api/java/buildcraft/api/tablet/TabletAPI.java +++ /dev/null @@ -1,20 +0,0 @@ -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 deleted file mode 100755 index 82b236b9f..000000000 --- a/src/api/java/buildcraft/api/tablet/TabletBitmap.java +++ /dev/null @@ -1,55 +0,0 @@ -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 deleted file mode 100755 index ea098f47c..000000000 --- a/src/api/java/buildcraft/api/tablet/TabletProgram.java +++ /dev/null @@ -1,17 +0,0 @@ -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 deleted file mode 100755 index 8f3bb414c..000000000 --- a/src/api/java/buildcraft/api/tablet/TabletProgramFactory.java +++ /dev/null @@ -1,19 +0,0 @@ -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 deleted file mode 100755 index 33656fb80..000000000 --- a/src/api/java/buildcraft/api/tablet/TabletTicker.java +++ /dev/null @@ -1,36 +0,0 @@ -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 deleted file mode 100755 index cc87d8657..000000000 --- a/src/api/java/buildcraft/api/tablet/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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 deleted file mode 100755 index 633d1fc28..000000000 --- a/src/api/java/buildcraft/api/tiles/IControllable.java +++ /dev/null @@ -1,37 +0,0 @@ -/** 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 deleted file mode 100755 index 4e5cb3d5d..000000000 --- a/src/api/java/buildcraft/api/tiles/IDebuggable.java +++ /dev/null @@ -1,17 +0,0 @@ -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 deleted file mode 100755 index fa8719644..000000000 --- a/src/api/java/buildcraft/api/tiles/IHasWork.java +++ /dev/null @@ -1,14 +0,0 @@ -/** 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 deleted file mode 100755 index 1af6d6b59..000000000 --- a/src/api/java/buildcraft/api/tiles/IHeatable.java +++ /dev/null @@ -1,26 +0,0 @@ -/** 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 deleted file mode 100755 index 89a7c1456..000000000 --- a/src/api/java/buildcraft/api/tiles/ITileAreaProvider.java +++ /dev/null @@ -1,10 +0,0 @@ -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 deleted file mode 100755 index d4c217fc3..000000000 --- a/src/api/java/buildcraft/api/tiles/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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 deleted file mode 100755 index 9201b5560..000000000 --- a/src/api/java/buildcraft/api/tools/IToolWrench.java +++ /dev/null @@ -1,32 +0,0 @@ -/** 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.tools; - -import net.minecraft.entity.player.EntityPlayer; -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. - * - * @param player - The player doing the wrenching - * @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, EnumHand hand, ItemStack wrench, RayTraceResult rayTrace); - - /*** 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 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/tools/package-info.java b/src/api/java/buildcraft/api/tools/package-info.java deleted file mode 100755 index 873fba1b0..000000000 --- a/src/api/java/buildcraft/api/tools/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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|tools") -package buildcraft.api.tools; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/transport/EnumWirePart.java b/src/api/java/buildcraft/api/transport/EnumWirePart.java deleted file mode 100755 index 6b4e971e5..000000000 --- a/src/api/java/buildcraft/api/transport/EnumWirePart.java +++ /dev/null @@ -1,80 +0,0 @@ -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.x, center.y, center.z, edge.x, edge.y, edge.z); - } - - 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 deleted file mode 100755 index 0292ae2ef..000000000 --- a/src/api/java/buildcraft/api/transport/IInjectable.java +++ /dev/null @@ -1,28 +0,0 @@ -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 deleted file mode 100755 index f18df6344..000000000 --- a/src/api/java/buildcraft/api/transport/IItemPluggable.java +++ /dev/null @@ -1,22 +0,0 @@ -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 deleted file mode 100755 index a0dd7c878..000000000 --- a/src/api/java/buildcraft/api/transport/IStripesActivator.java +++ /dev/null @@ -1,16 +0,0 @@ -/** 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 deleted file mode 100755 index 888cac43e..000000000 --- a/src/api/java/buildcraft/api/transport/IStripesHandlerBlock.java +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100755 index 6512be8cb..000000000 --- a/src/api/java/buildcraft/api/transport/IStripesHandlerItem.java +++ /dev/null @@ -1,30 +0,0 @@ -/** 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 deleted file mode 100755 index 73e881993..000000000 --- a/src/api/java/buildcraft/api/transport/IStripesRegistry.java +++ /dev/null @@ -1,36 +0,0 @@ -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 deleted file mode 100755 index 942c3ab58..000000000 --- a/src/api/java/buildcraft/api/transport/IWireManager.java +++ /dev/null @@ -1,24 +0,0 @@ -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 deleted file mode 100755 index 5430b6438..000000000 --- a/src/api/java/buildcraft/api/transport/WireNode.java +++ /dev/null @@ -1,61 +0,0 @@ -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 deleted file mode 100755 index 004c271a1..000000000 --- a/src/api/java/buildcraft/api/transport/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** 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 deleted file mode 100755 index ded7b2e22..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/ICustomPipeConnection.java +++ /dev/null @@ -1,13 +0,0 @@ -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 deleted file mode 100755 index 25bc329ca..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/IFlowFluid.java +++ /dev/null @@ -1,25 +0,0 @@ -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 deleted file mode 100755 index 91a8b3afa..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/IFlowItems.java +++ /dev/null @@ -1,32 +0,0 @@ -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 deleted file mode 100755 index 051d0ad1c..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/IFlowPower.java +++ /dev/null @@ -1,17 +0,0 @@ -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 deleted file mode 100755 index fbff67747..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/IItemPipe.java +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100755 index 2a7a15c30..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/IPipe.java +++ /dev/null @@ -1,36 +0,0 @@ -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 deleted file mode 100755 index 390a29c19..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java +++ /dev/null @@ -1,11 +0,0 @@ -package buildcraft.api.transport.pipe; - -import net.minecraft.client.renderer.BufferBuilder; - -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, BufferBuilder vb); -} diff --git a/src/api/java/buildcraft/api/transport/pipe/IPipeConnection.java b/src/api/java/buildcraft/api/transport/pipe/IPipeConnection.java deleted file mode 100755 index 55a514286..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/IPipeConnection.java +++ /dev/null @@ -1,26 +0,0 @@ -/** 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 deleted file mode 100755 index 2cbc61d75..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/IPipeFlowRenderer.java +++ /dev/null @@ -1,12 +0,0 @@ -package buildcraft.api.transport.pipe; - -import net.minecraft.client.renderer.BufferBuilder; - -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, BufferBuilder vb); -} diff --git a/src/api/java/buildcraft/api/transport/pipe/IPipeHolder.java b/src/api/java/buildcraft/api/transport/pipe/IPipeHolder.java deleted file mode 100755 index 5ce5173b4..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/IPipeHolder.java +++ /dev/null @@ -1,95 +0,0 @@ -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 deleted file mode 100755 index 23672c6bf..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/IPipeRegistry.java +++ /dev/null @@ -1,17 +0,0 @@ -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 deleted file mode 100755 index f401dc48f..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeApi.java +++ /dev/null @@ -1,52 +0,0 @@ -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 deleted file mode 100755 index 04650bfb2..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeApiClient.java +++ /dev/null @@ -1,26 +0,0 @@ -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 deleted file mode 100755 index 624d75b99..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeBehaviour.java +++ /dev/null @@ -1,67 +0,0 @@ -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 deleted file mode 100755 index 336ce551a..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeConnectionAPI.java +++ /dev/null @@ -1,51 +0,0 @@ -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 deleted file mode 100755 index 845d6b70b..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeDefinition.java +++ /dev/null @@ -1,159 +0,0 @@ -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 deleted file mode 100755 index a5c41062c..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -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 deleted file mode 100755 index ea6b37acc..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeEventActionActivate.java +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100755 index f31714203..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeEventFluid.java +++ /dev/null @@ -1,130 +0,0 @@ -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 deleted file mode 100755 index 1ef3667a6..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeEventHandler.java +++ /dev/null @@ -1,29 +0,0 @@ -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 deleted file mode 100755 index 6e1d44820..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeEventItem.java +++ /dev/null @@ -1,349 +0,0 @@ -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 deleted file mode 100755 index 1a91c517c..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeEventPower.java +++ /dev/null @@ -1,73 +0,0 @@ -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 deleted file mode 100755 index cedaaa83f..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeEventPriority.java +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100755 index 5d96cafc2..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeEventStatement.java +++ /dev/null @@ -1,66 +0,0 @@ -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 deleted file mode 100755 index d35e34a22..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeFlow.java +++ /dev/null @@ -1,82 +0,0 @@ -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 deleted file mode 100755 index 290517012..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeFlowType.java +++ /dev/null @@ -1,23 +0,0 @@ -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 deleted file mode 100755 index a3ad9f329..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/IFacadePluggable.java +++ /dev/null @@ -1,11 +0,0 @@ -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 deleted file mode 100755 index 0d19c0777..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/IPlugDynamicRenderer.java +++ /dev/null @@ -1,7 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import net.minecraft.client.renderer.BufferBuilder; - -public interface IPlugDynamicRenderer

{ - void render(P plug, double x, double y, double z, float partialTicks, BufferBuilder vb); -} diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPluggableRegistry.java b/src/api/java/buildcraft/api/transport/pluggable/IPluggableRegistry.java deleted file mode 100755 index 300b575bf..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/IPluggableRegistry.java +++ /dev/null @@ -1,9 +0,0 @@ -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 deleted file mode 100755 index a3f001214..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/IPluggableStaticBaker.java +++ /dev/null @@ -1,13 +0,0 @@ -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 deleted file mode 100755 index a1b180519..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/PipePluggable.java +++ /dev/null @@ -1,104 +0,0 @@ -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 deleted file mode 100755 index f6e371c3d..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/PluggableDefinition.java +++ /dev/null @@ -1,69 +0,0 @@ -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 deleted file mode 100755 index 7c832c195..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/PluggableModelKey.java +++ /dev/null @@ -1,38 +0,0 @@ -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/main/java/mekanism/client/ClientPlayerTracker.java b/src/main/java/mekanism/client/ClientPlayerTracker.java index 20ef79bb0..c0e7cc6da 100644 --- a/src/main/java/mekanism/client/ClientPlayerTracker.java +++ b/src/main/java/mekanism/client/ClientPlayerTracker.java @@ -15,5 +15,6 @@ public class ClientPlayerTracker Mekanism.jetpackOn.remove(event.player); Mekanism.gasmaskOn.remove(event.player); Mekanism.flamethrowerActive.remove(event.player); + Mekanism.freeRunnerOn.remove(event.player); } } diff --git a/src/main/java/mekanism/client/ClientTickHandler.java b/src/main/java/mekanism/client/ClientTickHandler.java index 83647a516..4a284ffba 100644 --- a/src/main/java/mekanism/client/ClientTickHandler.java +++ b/src/main/java/mekanism/client/ClientTickHandler.java @@ -35,6 +35,7 @@ import mekanism.common.item.ItemJetpack.JetpackMode; import mekanism.common.item.ItemScubaTank; import mekanism.common.network.PacketFlamethrowerData; import mekanism.common.network.PacketFlamethrowerData.FlamethrowerDataMessage; +import mekanism.common.network.PacketFreeRunnerData; import mekanism.common.network.PacketItemStack.ItemStackMessage; import mekanism.common.network.PacketJetpackData.JetpackDataMessage; import mekanism.common.network.PacketJetpackData.JetpackPacket; @@ -220,10 +221,24 @@ public class ClientTickHandler } } } - + + if(Mekanism.freeRunnerOn.contains(mc.player.getName()) != isFreeRunnerOn(mc.player)) + { + if(isFreeRunnerOn(mc.player) && mc.currentScreen == null) + { + Mekanism.freeRunnerOn.add(mc.player.getName()); + } + else + { + Mekanism.freeRunnerOn.remove(mc.player.getName()); + } + + Mekanism.packetHandler.sendToServer(new PacketFreeRunnerData.FreeRunnerDataMessage(PacketFreeRunnerData.FreeRunnerPacket.UPDATE, mc.player.getName(), isFreeRunnerOn(mc.player))); + } + ItemStack bootStack = mc.player.getItemStackFromSlot(EntityEquipmentSlot.FEET); - if(!bootStack.isEmpty() && bootStack.getItem() instanceof ItemFreeRunners) + if(!bootStack.isEmpty() && bootStack.getItem() instanceof ItemFreeRunners && isFreeRunnerOn(mc.player)) { mc.player.stepHeight = 1.002F; } @@ -562,6 +577,28 @@ public class ClientTickHandler return false; } + + public static boolean isFreeRunnerOn(EntityPlayer player) + { + if(player != mc.player) + { + return Mekanism.freeRunnerOn.contains(player.getName()); + } + + ItemStack stack = player.getItemStackFromSlot(EntityEquipmentSlot.FEET); + + if(!stack.isEmpty() && stack.getItem() instanceof ItemFreeRunners) + { + ItemFreeRunners freeRunners = (ItemFreeRunners) stack.getItem(); + + if(/*freeRunners.getEnergy(stack) > 0 && */freeRunners.getMode(stack) == ItemFreeRunners.FreeRunnerMode.NORMAL) + { + return true; + } + } + + return false; + } public static boolean isFlamethrowerOn(EntityPlayer player) { diff --git a/src/main/java/mekanism/client/MekanismClient.java b/src/main/java/mekanism/client/MekanismClient.java index b61f107e2..dcbf3beb6 100644 --- a/src/main/java/mekanism/client/MekanismClient.java +++ b/src/main/java/mekanism/client/MekanismClient.java @@ -65,6 +65,7 @@ public class MekanismClient extends Mekanism Mekanism.gasmaskOn.clear(); Mekanism.flamethrowerActive.clear(); Mekanism.activeVibrators.clear(); + Mekanism.freeRunnerOn.clear(); SynchronizedBoilerData.clientHotMap.clear(); diff --git a/src/main/java/mekanism/client/MekanismKeyHandler.java b/src/main/java/mekanism/client/MekanismKeyHandler.java index a9166a75d..cf9fa63f7 100644 --- a/src/main/java/mekanism/client/MekanismKeyHandler.java +++ b/src/main/java/mekanism/client/MekanismKeyHandler.java @@ -10,11 +10,13 @@ import mekanism.common.item.ItemConfigurator; import mekanism.common.item.ItemConfigurator.ConfiguratorMode; import mekanism.common.item.ItemElectricBow; import mekanism.common.item.ItemFlamethrower; +import mekanism.common.item.ItemFreeRunners; import mekanism.common.item.ItemJetpack; import mekanism.common.item.ItemJetpack.JetpackMode; import mekanism.common.item.ItemScubaTank; import mekanism.common.item.ItemWalkieTalkie; import mekanism.common.network.PacketFlamethrowerData; +import mekanism.common.network.PacketFreeRunnerData; import mekanism.common.network.PacketItemStack.ItemStackMessage; import mekanism.common.network.PacketJetpackData.JetpackDataMessage; import mekanism.common.network.PacketJetpackData.JetpackPacket; @@ -46,17 +48,19 @@ public class MekanismKeyHandler extends MekKeyHandler { public static final String keybindCategory = "Mekanism"; public static KeyBinding modeSwitchKey = new KeyBinding("Mekanism " + LangUtils.localize("key.mode"), Keyboard.KEY_M, keybindCategory); - public static KeyBinding armorModeSwitchKey = new KeyBinding("Mekanism " + LangUtils.localize("key.armorMode"), Keyboard.KEY_F, keybindCategory); + public static KeyBinding armorModeSwitchKey = new KeyBinding("Mekanism " + LangUtils.localize("key.armorMode"), Keyboard.KEY_G, keybindCategory); + public static KeyBinding freeRunnerModeSwitchKey = new KeyBinding("Mekanism " + LangUtils.localize("key.feetMode"), Keyboard.KEY_H, keybindCategory); public static KeyBinding voiceKey = new KeyBinding("Mekanism " + LangUtils.localize("key.voice"), Keyboard.KEY_U, keybindCategory); public static KeyBinding sneakKey = Minecraft.getMinecraft().gameSettings.keyBindSneak; public static KeyBinding jumpKey = Minecraft.getMinecraft().gameSettings.keyBindJump; public MekanismKeyHandler() { - super(new KeyBinding[] {modeSwitchKey, armorModeSwitchKey, voiceKey}, new boolean[] {false, false, true}); + super(new KeyBinding[] {modeSwitchKey, armorModeSwitchKey, freeRunnerModeSwitchKey, voiceKey}, new boolean[] {false, false, true}); ClientRegistry.registerKeyBinding(modeSwitchKey); ClientRegistry.registerKeyBinding(armorModeSwitchKey); + ClientRegistry.registerKeyBinding(freeRunnerModeSwitchKey); ClientRegistry.registerKeyBinding(voiceKey); MinecraftForge.EVENT_BUS.register(this); @@ -157,6 +161,29 @@ public class MekanismKeyHandler extends MekKeyHandler SoundHandler.playSound(MekanismSounds.HYDRAULIC); } } + else if(kb == freeRunnerModeSwitchKey) + { + EntityPlayer player = FMLClientHandler.instance().getClient().player; + ItemStack feetStack = player.getItemStackFromSlot(EntityEquipmentSlot.FEET); + Item feetItem = StackUtils.getItem(feetStack); + + if(feetItem instanceof ItemFreeRunners) + { + ItemFreeRunners freeRunners = (ItemFreeRunners)feetItem; + + if(player.isSneaking()) + { + freeRunners.setMode(feetStack, ItemFreeRunners.FreeRunnerMode.DISABLED); + } + else + { + freeRunners.incrementMode(feetStack); + } + + Mekanism.packetHandler.sendToServer(new PacketFreeRunnerData.FreeRunnerDataMessage(PacketFreeRunnerData.FreeRunnerPacket.MODE, null, player.isSneaking())); + SoundHandler.playSound(MekanismSounds.HYDRAULIC); + } + } } @Override diff --git a/src/main/java/mekanism/client/gui/GuiChemicalDissolutionChamber.java b/src/main/java/mekanism/client/gui/GuiChemicalDissolutionChamber.java index 851fc007b..dd7460cc1 100644 --- a/src/main/java/mekanism/client/gui/GuiChemicalDissolutionChamber.java +++ b/src/main/java/mekanism/client/gui/GuiChemicalDissolutionChamber.java @@ -90,7 +90,7 @@ public class GuiChemicalDissolutionChamber extends GuiMekanism if(xAxis >= 116 && xAxis <= 168 && yAxis >= 76 && yAxis <= 80) { - drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis); + drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis, yAxis); } super.drawGuiContainerForegroundLayer(mouseX, mouseY); diff --git a/src/main/java/mekanism/client/gui/GuiChemicalInfuser.java b/src/main/java/mekanism/client/gui/GuiChemicalInfuser.java index 1b3231255..96cf203af 100644 --- a/src/main/java/mekanism/client/gui/GuiChemicalInfuser.java +++ b/src/main/java/mekanism/client/gui/GuiChemicalInfuser.java @@ -106,7 +106,7 @@ public class GuiChemicalInfuser extends GuiMekanism if(xAxis >= 116 && xAxis <= 168 && yAxis >= 76 && yAxis <= 80) { - drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis); + drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis, yAxis); } super.drawGuiContainerForegroundLayer(mouseX, mouseY); diff --git a/src/main/java/mekanism/client/gui/GuiChemicalOxidizer.java b/src/main/java/mekanism/client/gui/GuiChemicalOxidizer.java index d2e18da1d..4bc0f393e 100644 --- a/src/main/java/mekanism/client/gui/GuiChemicalOxidizer.java +++ b/src/main/java/mekanism/client/gui/GuiChemicalOxidizer.java @@ -83,7 +83,7 @@ public class GuiChemicalOxidizer extends GuiMekanism if(xAxis >= 116 && xAxis <= 168 && yAxis >= 76 && yAxis <= 80) { - drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis); + drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis, yAxis); } super.drawGuiContainerForegroundLayer(mouseX, mouseY); diff --git a/src/main/java/mekanism/client/gui/GuiChemicalWasher.java b/src/main/java/mekanism/client/gui/GuiChemicalWasher.java index 849804cae..63d657f18 100644 --- a/src/main/java/mekanism/client/gui/GuiChemicalWasher.java +++ b/src/main/java/mekanism/client/gui/GuiChemicalWasher.java @@ -102,7 +102,7 @@ public class GuiChemicalWasher extends GuiMekanism if(xAxis >= 116 && xAxis <= 168 && yAxis >= 76 && yAxis <= 80) { - drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis); + drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis, yAxis); } super.drawGuiContainerForegroundLayer(mouseX, mouseY); diff --git a/src/main/java/mekanism/client/gui/GuiDigitalMiner.java b/src/main/java/mekanism/client/gui/GuiDigitalMiner.java index 8853685bf..11ef91c66 100644 --- a/src/main/java/mekanism/client/gui/GuiDigitalMiner.java +++ b/src/main/java/mekanism/client/gui/GuiDigitalMiner.java @@ -205,7 +205,7 @@ public class GuiDigitalMiner extends GuiMekanism if(xAxis >= 164 && xAxis <= 168 && yAxis >= 25 && yAxis <= 77) { - drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis); + drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis, yAxis); } if(xAxis >= 147 && xAxis <= 161 && yAxis >= 47 && yAxis <= 61) diff --git a/src/main/java/mekanism/client/gui/GuiElectricPump.java b/src/main/java/mekanism/client/gui/GuiElectricPump.java index 39643fbcd..b5d573196 100644 --- a/src/main/java/mekanism/client/gui/GuiElectricPump.java +++ b/src/main/java/mekanism/client/gui/GuiElectricPump.java @@ -69,7 +69,7 @@ public class GuiElectricPump extends GuiMekanism { fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040); fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 94) + 2, 0x404040); - fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), 51, 26, 0x00CD00); + fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), 51, 26, 0x00CD00); String text = tileEntity.fluidTank.getFluid() != null ? LangUtils.localizeFluidStack(tileEntity.fluidTank.getFluid()) + ": " + tileEntity.fluidTank.getFluid().amount : LangUtils.localize("gui.noFluid"); renderScaledText(text, 51, 35, 0x00CD00, 74); diff --git a/src/main/java/mekanism/client/gui/GuiEnergyCube.java b/src/main/java/mekanism/client/gui/GuiEnergyCube.java index ee9cb9af3..35288cb02 100644 --- a/src/main/java/mekanism/client/gui/GuiEnergyCube.java +++ b/src/main/java/mekanism/client/gui/GuiEnergyCube.java @@ -53,7 +53,7 @@ public class GuiEnergyCube extends GuiMekanism public List getInfo() { return ListUtils.asList( - LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), + LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), LangUtils.localize("gui.maxOutput") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t"); } }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiEnergyCube.png"))); diff --git a/src/main/java/mekanism/client/gui/GuiFactory.java b/src/main/java/mekanism/client/gui/GuiFactory.java index 46ae24c04..db833d915 100644 --- a/src/main/java/mekanism/client/gui/GuiFactory.java +++ b/src/main/java/mekanism/client/gui/GuiFactory.java @@ -76,7 +76,7 @@ public class GuiFactory extends GuiMekanism if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69) { - drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis); + drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis, yAxis); } if(xAxis >= 8 && xAxis <= 168 && yAxis >= 78 && yAxis <= 83) diff --git a/src/main/java/mekanism/client/gui/GuiFluidicPlenisher.java b/src/main/java/mekanism/client/gui/GuiFluidicPlenisher.java index fc630bf07..6466a762f 100644 --- a/src/main/java/mekanism/client/gui/GuiFluidicPlenisher.java +++ b/src/main/java/mekanism/client/gui/GuiFluidicPlenisher.java @@ -69,7 +69,7 @@ public class GuiFluidicPlenisher extends GuiMekanism { fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040); fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 94) + 2, 0x404040); - fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), 51, 26, 0x00CD00); + fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), 51, 26, 0x00CD00); fontRenderer.drawString(LangUtils.localize("gui.finished") + ": " + LangUtils.transYesNo(tileEntity.finishedCalc), 51, 35, 0x00CD00); fontRenderer.drawString(tileEntity.fluidTank.getFluid() != null ? LangUtils.localizeFluidStack(tileEntity.fluidTank.getFluid()) + ": " + tileEntity.fluidTank.getFluid().amount : LangUtils.localize("gui.noFluid"), 51, 44, 0x00CD00); diff --git a/src/main/java/mekanism/client/gui/GuiInductionMatrix.java b/src/main/java/mekanism/client/gui/GuiInductionMatrix.java index 204ed7275..e40c9a411 100644 --- a/src/main/java/mekanism/client/gui/GuiInductionMatrix.java +++ b/src/main/java/mekanism/client/gui/GuiInductionMatrix.java @@ -35,7 +35,7 @@ public class GuiInductionMatrix extends GuiMekanism public List getInfo() { return ListUtils.asList( - LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), + LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), LangUtils.localize("gui.input") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.lastInput) + "/t", LangUtils.localize("gui.output") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.lastOutput) + "/t"); } @@ -57,7 +57,7 @@ public class GuiInductionMatrix extends GuiMekanism if(xAxis >= 7 && xAxis <= 39 && yAxis >= 14 && yAxis <= 72) { - drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis); + drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis, yAxis); } super.drawGuiContainerForegroundLayer(mouseX, mouseY); diff --git a/src/main/java/mekanism/client/gui/GuiLaserAmplifier.java b/src/main/java/mekanism/client/gui/GuiLaserAmplifier.java index 58bb329dd..5ad4afd1c 100644 --- a/src/main/java/mekanism/client/gui/GuiLaserAmplifier.java +++ b/src/main/java/mekanism/client/gui/GuiLaserAmplifier.java @@ -64,7 +64,7 @@ public class GuiLaserAmplifier extends GuiMekanism @Override public String getText(double level) { - return LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(level); + return LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(level, tileEntity.getMaxEnergy()); } }, Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 6, 10)); guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"))); diff --git a/src/main/java/mekanism/client/gui/GuiMatrixStats.java b/src/main/java/mekanism/client/gui/GuiMatrixStats.java index 147e6693c..a6e02fa4d 100644 --- a/src/main/java/mekanism/client/gui/GuiMatrixStats.java +++ b/src/main/java/mekanism/client/gui/GuiMatrixStats.java @@ -75,7 +75,7 @@ public class GuiMatrixStats extends GuiMekanism public List getInfo() { return ListUtils.asList( - LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), + LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), LangUtils.localize("gui.input") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.lastInput) + "/t", LangUtils.localize("gui.output") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.lastOutput) + "/t"); } diff --git a/src/main/java/mekanism/client/gui/GuiRobitMain.java b/src/main/java/mekanism/client/gui/GuiRobitMain.java index ce0fe2641..76f2d9536 100644 --- a/src/main/java/mekanism/client/gui/GuiRobitMain.java +++ b/src/main/java/mekanism/client/gui/GuiRobitMain.java @@ -111,7 +111,7 @@ public class GuiRobitMain extends GuiMekanism { CharSequence owner = robit.getOwnerName().length() > 14 ? robit.getOwnerName().subSequence(0, 14) : robit.getOwnerName(); fontRenderer.drawString(LangUtils.localize("gui.robit.greeting") + " " + robit.getName() + "!", 29, 18, 0x00CD00); - fontRenderer.drawString(LangUtils.localize("gui.energy") + ": " + MekanismUtils.getEnergyDisplay(robit.getEnergy()), 29, 36-4, 0x00CD00); + fontRenderer.drawString(LangUtils.localize("gui.energy") + ": " + MekanismUtils.getEnergyDisplay(robit.getEnergy(), robit.MAX_ELECTRICITY), 29, 36-4, 0x00CD00); fontRenderer.drawString(LangUtils.localize("gui.robit.following") + ": " + robit.getFollowing(), 29, 45-4, 0x00CD00); fontRenderer.drawString(LangUtils.localize("gui.robit.dropPickup") + ": " + robit.getDropPickup(), 29, 54-4, 0x00CD00); fontRenderer.drawString(LangUtils.localize("gui.robit.owner") + ": " + owner, 29, 63-4, 0x00CD00); @@ -122,7 +122,7 @@ public class GuiRobitMain extends GuiMekanism if(xAxis >= 28 && xAxis <= 148 && yAxis >= 75 && yAxis <= 79) { - drawHoveringText(MekanismUtils.getEnergyDisplay(robit.getEnergy()), xAxis, yAxis); + drawHoveringText(MekanismUtils.getEnergyDisplay(robit.getEnergy(), robit.MAX_ELECTRICITY), xAxis, yAxis); } else if(xAxis >= 152 && xAxis <= 170 && yAxis >= 54 && yAxis <= 72) { diff --git a/src/main/java/mekanism/client/gui/GuiRotaryCondensentrator.java b/src/main/java/mekanism/client/gui/GuiRotaryCondensentrator.java index 06e0c2bfe..caec36d78 100644 --- a/src/main/java/mekanism/client/gui/GuiRotaryCondensentrator.java +++ b/src/main/java/mekanism/client/gui/GuiRotaryCondensentrator.java @@ -124,7 +124,7 @@ public class GuiRotaryCondensentrator extends GuiMekanism if(xAxis >= 116 && xAxis <= 168 && yAxis >= 76 && yAxis <= 80) { - drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis); + drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis, yAxis); } if(xAxis >= 4 && xAxis <= 22 && yAxis >= 4 && yAxis <= 22) diff --git a/src/main/java/mekanism/client/gui/GuiTeleporter.java b/src/main/java/mekanism/client/gui/GuiTeleporter.java index 3c0470304..8b04ae12d 100644 --- a/src/main/java/mekanism/client/gui/GuiTeleporter.java +++ b/src/main/java/mekanism/client/gui/GuiTeleporter.java @@ -92,7 +92,7 @@ public class GuiTeleporter extends GuiMekanism @Override public String getTooltip() { - return MekanismUtils.getEnergyDisplay(getEnergy()); + return MekanismUtils.getEnergyDisplay(getEnergy(), getMaxEnergy()); } @Override @@ -124,7 +124,7 @@ public class GuiTeleporter extends GuiMekanism @Override public String getTooltip() { - return MekanismUtils.getEnergyDisplay(getEnergy()); + return MekanismUtils.getEnergyDisplay(getEnergy(), getMaxEnergy()); } @Override diff --git a/src/main/java/mekanism/client/gui/element/GuiEnergyGauge.java b/src/main/java/mekanism/client/gui/element/GuiEnergyGauge.java index 0f14e864f..e4105fc40 100644 --- a/src/main/java/mekanism/client/gui/element/GuiEnergyGauge.java +++ b/src/main/java/mekanism/client/gui/element/GuiEnergyGauge.java @@ -52,7 +52,7 @@ public class GuiEnergyGauge extends GuiGauge @Override public String getTooltipText() { - return infoHandler.getEnergyStorage().getEnergy() > 0 ? MekanismUtils.getEnergyDisplay(infoHandler.getEnergyStorage().getEnergy()) : LangUtils.localize("gui.empty"); + return infoHandler.getEnergyStorage().getEnergy() > 0 ? MekanismUtils.getEnergyDisplay(infoHandler.getEnergyStorage().getEnergy(), infoHandler.getEnergyStorage().getMaxEnergy()) : LangUtils.localize("gui.empty"); } public static interface IEnergyInfoHandler diff --git a/src/main/java/mekanism/client/gui/element/GuiPowerBar.java b/src/main/java/mekanism/client/gui/element/GuiPowerBar.java index 8e07de717..98f513b84 100644 --- a/src/main/java/mekanism/client/gui/element/GuiPowerBar.java +++ b/src/main/java/mekanism/client/gui/element/GuiPowerBar.java @@ -31,7 +31,7 @@ public class GuiPowerBar extends GuiElement @Override public String getTooltip() { - return MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()); + return MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()); } @Override diff --git a/src/main/java/mekanism/common/CommonPlayerTracker.java b/src/main/java/mekanism/common/CommonPlayerTracker.java index bc293c82f..be4e60651 100644 --- a/src/main/java/mekanism/common/CommonPlayerTracker.java +++ b/src/main/java/mekanism/common/CommonPlayerTracker.java @@ -2,6 +2,7 @@ package mekanism.common; import mekanism.common.network.PacketBoxBlacklist.BoxBlacklistMessage; import mekanism.common.network.PacketConfigSync.ConfigSyncMessage; +import mekanism.common.network.PacketFreeRunnerData; import mekanism.common.network.PacketJetpackData.JetpackDataMessage; import mekanism.common.network.PacketJetpackData.JetpackPacket; import mekanism.common.network.PacketScubaTankData.ScubaTankDataMessage; @@ -32,8 +33,9 @@ public class CommonPlayerTracker Mekanism.packetHandler.sendTo(new JetpackDataMessage(JetpackPacket.FULL, null, false), (EntityPlayerMP)event.player); Mekanism.packetHandler.sendTo(new ScubaTankDataMessage(ScubaTankPacket.FULL, null, false), (EntityPlayerMP)event.player); Mekanism.packetHandler.sendTo(new SecurityUpdateMessage(SecurityPacket.FULL, null, null), (EntityPlayerMP)event.player); + Mekanism.packetHandler.sendTo(new PacketFreeRunnerData.FreeRunnerDataMessage(PacketFreeRunnerData.FreeRunnerPacket.FULL, null, false), (EntityPlayerMP)event.player); - Mekanism.logger.info("Sent config to '" + event.player.getDisplayName() + ".'"); + Mekanism.logger.info("Sent config to '" + event.player.getDisplayNameString() + ".'"); } } @@ -43,6 +45,7 @@ public class CommonPlayerTracker Mekanism.jetpackOn.remove(event.player.getName()); Mekanism.gasmaskOn.remove(event.player.getName()); Mekanism.flamethrowerActive.remove(event.player.getName()); + Mekanism.freeRunnerOn.remove(event.player.getName()); } @SubscribeEvent @@ -51,11 +54,13 @@ public class CommonPlayerTracker Mekanism.jetpackOn.remove(event.player.getName()); Mekanism.gasmaskOn.remove(event.player.getName()); Mekanism.flamethrowerActive.remove(event.player.getName()); + Mekanism.freeRunnerOn.remove(event.player.getName()); 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); + Mekanism.packetHandler.sendTo(new PacketFreeRunnerData.FreeRunnerDataMessage(PacketFreeRunnerData.FreeRunnerPacket.FULL, null, false), (EntityPlayerMP)event.player); } } } diff --git a/src/main/java/mekanism/common/FuelHandler.java b/src/main/java/mekanism/common/FuelHandler.java index d4fded57b..5f984b3ce 100644 --- a/src/main/java/mekanism/common/FuelHandler.java +++ b/src/main/java/mekanism/common/FuelHandler.java @@ -2,10 +2,12 @@ package mekanism.common; import java.util.HashMap; +import buildcraft.api.mj.MjAPI; import mekanism.api.gas.Gas; import mekanism.common.config.MekanismConfig.general; import mekanism.common.util.MekanismUtils; import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.ModAPIManager; import buildcraft.api.fuels.BuildcraftFuelRegistry; import buildcraft.api.fuels.IFuel; @@ -28,7 +30,7 @@ public class FuelHandler if(BCPresent() && gas.hasFluid() && BuildcraftFuelRegistry.fuel != null) { - IFuel bcFuel = BuildcraftFuelRegistry.fuel.getFuel(gas.getFluid()); + IFuel bcFuel = BuildcraftFuelRegistry.fuel.getFuel(new FluidStack(gas.getFluid(), 1)); if(bcFuel != null) { @@ -56,7 +58,10 @@ public class FuelHandler public FuelGas(IFuel bcFuel) { burnTicks = bcFuel.getTotalBurningTime() / Fluid.BUCKET_VOLUME; - energyPerTick = bcFuel.getPowerPerCycle() * general.FROM_RF; + + // getPowerPerCycle returns value in 1 BuildCraft micro MJ + // 1 BuildCraft MJ equals 20 RF + energyPerTick = bcFuel.getPowerPerCycle() / (double) MjAPI.MJ * 20 * general.FROM_RF; } } diff --git a/src/main/java/mekanism/common/Mekanism.java b/src/main/java/mekanism/common/Mekanism.java index 2240b04e3..5e6e608a6 100644 --- a/src/main/java/mekanism/common/Mekanism.java +++ b/src/main/java/mekanism/common/Mekanism.java @@ -237,11 +237,12 @@ public class Mekanism public static KeySync keyMap = new KeySync(); - public static Set jetpackOn = new HashSet(); - public static Set gasmaskOn = new HashSet(); - public static Set flamethrowerActive = new HashSet(); + public static Set jetpackOn = new HashSet<>(); + public static Set gasmaskOn = new HashSet<>(); + public static Set freeRunnerOn = new HashSet<>(); + public static Set flamethrowerActive = new HashSet<>(); - public static Set activeVibrators = new HashSet(); + public static Set activeVibrators = new HashSet<>(); static { MekanismFluids.register(); @@ -677,6 +678,7 @@ public class Mekanism worldTickHandler.resetRegenChunks(); privateTeleporters.clear(); privateEntangloporters.clear(); + freeRunnerOn.clear(); //Reset consistent managers MultiblockManager.reset(); @@ -897,11 +899,21 @@ public class Mekanism public void onBlacklistUpdate(BoxBlacklistEvent event) { MekanismAPI.addBoxBlacklist(MekanismBlocks.CardboardBox, OreDictionary.WILDCARD_VALUE); + + // Mekanism multiblock structures MekanismAPI.addBoxBlacklist(MekanismBlocks.BoundingBlock, OreDictionary.WILDCARD_VALUE); + MekanismAPI.addBoxBlacklist(MekanismBlocks.BasicBlock2, 9); // Security Desk + MekanismAPI.addBoxBlacklist(MekanismBlocks.MachineBlock, 4); // Digital Miner + MekanismAPI.addBoxBlacklist(MekanismBlocks.MachineBlock2, 9); // Seismic Vibrator + MekanismAPI.addBoxBlacklist(MekanismBlocks.MachineBlock3, 1); // Solar Neutron Activator + + // Minecraft unobtainable MekanismAPI.addBoxBlacklist(Blocks.BEDROCK, 0); MekanismAPI.addBoxBlacklist(Blocks.PORTAL, OreDictionary.WILDCARD_VALUE); MekanismAPI.addBoxBlacklist(Blocks.END_PORTAL, OreDictionary.WILDCARD_VALUE); MekanismAPI.addBoxBlacklist(Blocks.END_PORTAL_FRAME, OreDictionary.WILDCARD_VALUE); + + // Minecraft multiblock structures MekanismAPI.addBoxBlacklist(Blocks.BED, OreDictionary.WILDCARD_VALUE); MekanismAPI.addBoxBlacklist(Blocks.OAK_DOOR, OreDictionary.WILDCARD_VALUE); MekanismAPI.addBoxBlacklist(Blocks.SPRUCE_DOOR, OreDictionary.WILDCARD_VALUE); diff --git a/src/main/java/mekanism/common/PacketHandler.java b/src/main/java/mekanism/common/PacketHandler.java index a31ae3d53..633e0e10b 100644 --- a/src/main/java/mekanism/common/PacketHandler.java +++ b/src/main/java/mekanism/common/PacketHandler.java @@ -28,6 +28,7 @@ import mekanism.common.network.PacketEntityMove; import mekanism.common.network.PacketEntityMove.EntityMoveMessage; import mekanism.common.network.PacketFlamethrowerData; import mekanism.common.network.PacketFlamethrowerData.FlamethrowerDataMessage; +import mekanism.common.network.PacketFreeRunnerData; import mekanism.common.network.PacketItemStack; import mekanism.common.network.PacketItemStack.ItemStackMessage; import mekanism.common.network.PacketJetpackData; @@ -132,6 +133,8 @@ public class PacketHandler netHandler.registerMessage(PacketDropperUse.class, DropperUseMessage.class, 28, Side.SERVER); netHandler.registerMessage(PacketEntityMove.class, EntityMoveMessage.class, 29, Side.CLIENT); netHandler.registerMessage(PacketSecurityUpdate.class, SecurityUpdateMessage.class, 30, Side.CLIENT); + netHandler.registerMessage(PacketFreeRunnerData.class, PacketFreeRunnerData.FreeRunnerDataMessage.class, 31, Side.CLIENT); + netHandler.registerMessage(PacketFreeRunnerData.class, PacketFreeRunnerData.FreeRunnerDataMessage.class, 31, Side.SERVER); } /** diff --git a/src/main/java/mekanism/common/block/BlockBasic.java b/src/main/java/mekanism/common/block/BlockBasic.java index 737968922..df907e6cd 100644 --- a/src/main/java/mekanism/common/block/BlockBasic.java +++ b/src/main/java/mekanism/common/block/BlockBasic.java @@ -51,6 +51,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -59,6 +60,7 @@ import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.NonNullList; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; @@ -158,8 +160,8 @@ public abstract class BlockBasic extends Block implements ICTMBlock @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { - TileEntity tile = worldIn.getTileEntity(pos); - + TileEntity tile = MekanismUtils.getTileEntitySafe(worldIn, pos); + if(tile instanceof TileEntityBasicBlock && ((TileEntityBasicBlock)tile).facing != null) { state = state.withProperty(BlockStateFacing.facingProperty, ((TileEntityBasicBlock)tile).facing); @@ -343,7 +345,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock return false; case 9: case 11: - TileEntityDynamicTank tileEntity = (TileEntityDynamicTank)world.getTileEntity(pos); + TileEntityDynamicTank tileEntity = (TileEntityDynamicTank) MekanismUtils.getTileEntitySafe(world, pos); if(tileEntity != null) { @@ -371,7 +373,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock case 2: case 7: case 8: - TileEntityMultiblock tileEntity = (TileEntityMultiblock)world.getTileEntity(pos); + TileEntityMultiblock tileEntity = (TileEntityMultiblock) MekanismUtils.getTileEntitySafe(world, pos); if(tileEntity != null) { @@ -411,12 +413,27 @@ public abstract class BlockBasic extends Block implements ICTMBlock { if(!bin.bottomStack.isEmpty()) { - if(!player.isSneaking()) + ItemStack stack; + if(player.isSneaking()) { - world.spawnEntity(new EntityItem(world, player.posX, player.posY, player.posZ, bin.removeStack().copy())); + stack = bin.remove(1).copy(); } - else { - world.spawnEntity(new EntityItem(world, player.posX, player.posY, player.posZ, bin.remove(1).copy())); + else + { + stack = bin.removeStack().copy(); + } + + if(!player.inventory.addItemStackToInventory(stack)) + { + BlockPos dropPos = pos.offset(bin.facing); + Entity item = new EntityItem(world, dropPos.getX() + .5f, dropPos.getY() + .3f, dropPos.getZ() + .5f, stack); + item.addVelocity(-item.motionX, -item.motionY, -item.motionZ); + world.spawnEntity(item); + } + else + { + world.playSound(null, pos.getX() + .5f, pos.getY() + .5f, pos.getZ() + .5f, + SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); } } } @@ -715,7 +732,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock @Override public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) { - TileEntity tileEntity = world.getTileEntity(pos); + TileEntity tileEntity = MekanismUtils.getTileEntitySafe(world, pos); int metadata = state.getBlock().getMetaFromState(state); if(tileEntity instanceof IActiveState) diff --git a/src/main/java/mekanism/common/block/BlockEnergyCube.java b/src/main/java/mekanism/common/block/BlockEnergyCube.java index e214bc593..67e9bf8b7 100644 --- a/src/main/java/mekanism/common/block/BlockEnergyCube.java +++ b/src/main/java/mekanism/common/block/BlockEnergyCube.java @@ -87,7 +87,7 @@ public class BlockEnergyCube extends BlockContainer @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { - TileEntity tile = worldIn.getTileEntity(pos); + TileEntity tile = MekanismUtils.getTileEntitySafe(worldIn, pos); if(tile instanceof TileEntityEnergyCube) { diff --git a/src/main/java/mekanism/common/block/BlockGasTank.java b/src/main/java/mekanism/common/block/BlockGasTank.java index e85012c71..188863569 100644 --- a/src/main/java/mekanism/common/block/BlockGasTank.java +++ b/src/main/java/mekanism/common/block/BlockGasTank.java @@ -74,7 +74,7 @@ public class BlockGasTank extends BlockContainer @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { - TileEntity tile = worldIn.getTileEntity(pos); + TileEntity tile = MekanismUtils.getTileEntitySafe(worldIn, pos); if(tile instanceof TileEntityGasTank) { diff --git a/src/main/java/mekanism/common/block/BlockGlowPanel.java b/src/main/java/mekanism/common/block/BlockGlowPanel.java index fa41d83ba..49a17d6f5 100644 --- a/src/main/java/mekanism/common/block/BlockGlowPanel.java +++ b/src/main/java/mekanism/common/block/BlockGlowPanel.java @@ -9,6 +9,7 @@ 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.MekanismUtils; import mekanism.common.util.MultipartUtils; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; @@ -71,7 +72,7 @@ public class BlockGlowPanel extends Block implements ITileEntityProvider @Override public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) { - TileEntityGlowPanel tileEntity = (TileEntityGlowPanel)world.getTileEntity(pos); + TileEntityGlowPanel tileEntity = (TileEntityGlowPanel) MekanismUtils.getTileEntitySafe(world, pos); return tileEntity != null ? state.withProperty(BlockStateFacing.facingProperty, tileEntity.side) : state; } @@ -79,8 +80,8 @@ public class BlockGlowPanel extends Block implements ITileEntityProvider @Override public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { - TileEntityGlowPanel tileEntity = (TileEntityGlowPanel)world.getTileEntity(pos); - + TileEntityGlowPanel tileEntity = (TileEntityGlowPanel) MekanismUtils.getTileEntitySafe(world, pos); + if(tileEntity != null) { state = state.withProperty(BlockStateFacing.facingProperty, tileEntity.side); @@ -117,7 +118,7 @@ public class BlockGlowPanel extends Block implements ITileEntityProvider @Override public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) { - TileEntityGlowPanel tileEntity = (TileEntityGlowPanel)world.getTileEntity(pos); + TileEntityGlowPanel tileEntity = (TileEntityGlowPanel) MekanismUtils.getTileEntitySafe(world, pos); if(!tileEntity.getWorld().isRemote && !canStay(tileEntity)) { @@ -137,7 +138,7 @@ public class BlockGlowPanel extends Block implements ITileEntityProvider @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) { - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = MekanismUtils.getTileEntitySafe(world, pos); if(tile != null && tile instanceof TileEntityGlowPanel) { diff --git a/src/main/java/mekanism/common/block/BlockMachine.java b/src/main/java/mekanism/common/block/BlockMachine.java index d1d8e563c..ddfeb95e7 100644 --- a/src/main/java/mekanism/common/block/BlockMachine.java +++ b/src/main/java/mekanism/common/block/BlockMachine.java @@ -206,7 +206,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { - TileEntity tile = worldIn.getTileEntity(pos); + TileEntity tile = MekanismUtils.getTileEntitySafe(worldIn, pos); if(tile instanceof TileEntityBasicBlock && ((TileEntityBasicBlock)tile).facing != null) { @@ -383,7 +383,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock { if(client.enableAmbientLighting) { - TileEntity tileEntity = world.getTileEntity(pos); + TileEntity tileEntity = MekanismUtils.getTileEntitySafe(world, pos); if(tileEntity instanceof IActiveState) { @@ -991,7 +991,7 @@ 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); + TileEntity tile = MekanismUtils.getTileEntitySafe(world, pos); if(type == null) { @@ -1024,12 +1024,6 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock { return false; } - - @Override - public AxisAlignedBB getCollisionBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) - { - return super.getCollisionBoundingBox(state, world, pos); - } @Override public boolean isSideSolid(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) @@ -1110,7 +1104,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock @Override public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = MekanismUtils.getTileEntitySafe(world, pos); if(tile instanceof TileEntityLaserAmplifier) { diff --git a/src/main/java/mekanism/common/block/BlockPlastic.java b/src/main/java/mekanism/common/block/BlockPlastic.java index 46a14eeba..864be07ec 100644 --- a/src/main/java/mekanism/common/block/BlockPlastic.java +++ b/src/main/java/mekanism/common/block/BlockPlastic.java @@ -14,9 +14,7 @@ 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; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/mekanism/common/block/BlockTransmitter.java b/src/main/java/mekanism/common/block/BlockTransmitter.java index 8cbf91a20..5838e5cc3 100644 --- a/src/main/java/mekanism/common/block/BlockTransmitter.java +++ b/src/main/java/mekanism/common/block/BlockTransmitter.java @@ -95,7 +95,7 @@ public class BlockTransmitter extends Block implements ITileEntityProvider @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { - TileEntity tile = worldIn.getTileEntity(pos); + TileEntity tile = MekanismUtils.getTileEntitySafe(worldIn, pos); if(tile instanceof TileEntitySidedPipe) { @@ -129,7 +129,7 @@ public class BlockTransmitter extends Block implements ITileEntityProvider @Override public IBlockState getExtendedState(IBlockState state, IBlockAccess w, BlockPos pos) { - TileEntitySidedPipe tile = (TileEntitySidedPipe)w.getTileEntity(pos); + TileEntitySidedPipe tile = (TileEntitySidedPipe) MekanismUtils.getTileEntitySafe(w, pos); if(tile != null) { @@ -147,7 +147,7 @@ public class BlockTransmitter extends Block implements ITileEntityProvider @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) { - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = MekanismUtils.getTileEntitySafe(world, pos); if(tile instanceof TileEntitySidedPipe && ((TileEntitySidedPipe)tile).getTransmitterType().getSize() == Size.SMALL) { @@ -300,7 +300,7 @@ public class BlockTransmitter extends Block implements ITileEntityProvider @Override public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) { - TileEntitySidedPipe tile = (TileEntitySidedPipe)world.getTileEntity(pos); + TileEntitySidedPipe tile = (TileEntitySidedPipe) MekanismUtils.getTileEntitySafe(world, pos); EnumFacing side = EnumFacing.getFacingFromVector(neighbor.getX() - pos.getX(), neighbor.getY() - pos.getY(), neighbor.getZ() - pos.getZ()); tile.onNeighborTileChange(side); } diff --git a/src/main/java/mekanism/common/content/transporter/TransporterManager.java b/src/main/java/mekanism/common/content/transporter/TransporterManager.java index ca9cd31ed..9609b648b 100644 --- a/src/main/java/mekanism/common/content/transporter/TransporterManager.java +++ b/src/main/java/mekanism/common/content/transporter/TransporterManager.java @@ -9,6 +9,7 @@ import java.util.Set; import mekanism.api.Coord4D; import mekanism.api.EnumColor; +import mekanism.common.Mekanism; import mekanism.common.base.ISideConfiguration; import mekanism.common.content.transporter.TransitRequest.TransitResponse; import mekanism.common.content.transporter.TransporterStack.Path; @@ -113,6 +114,11 @@ public class TransporterManager { int slotID = slots[get]; + if (slotID >= ret.size()){ + Mekanism.logger.error("Inventory {} gave slot number >= the number of slots it reported! {} >= {} ", inv.getClass().getName(), slotID, ret.size()); + continue; + } + ret.set(slotID, !sidedInventory.getStackInSlot(slotID).isEmpty() ? sidedInventory.getStackInSlot(slotID).copy() : ItemStack.EMPTY); } diff --git a/src/main/java/mekanism/common/entity/EntityRobit.java b/src/main/java/mekanism/common/entity/EntityRobit.java index a6fe3a2cc..f48a61bde 100644 --- a/src/main/java/mekanism/common/entity/EntityRobit.java +++ b/src/main/java/mekanism/common/entity/EntityRobit.java @@ -578,7 +578,7 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine public void setOwnerUUID(UUID uuid) { dataManager.set(OWNER_UUID, uuid.toString()); - dataManager.set(OWNER_NAME, UsernameCache.getLastKnownUsername(uuid)); + dataManager.set(OWNER_NAME, MekanismUtils.getLastKnownUsername(uuid)); } public boolean getFollowing() diff --git a/src/main/java/mekanism/common/frequency/Frequency.java b/src/main/java/mekanism/common/frequency/Frequency.java index b4d76e39e..059b80db7 100644 --- a/src/main/java/mekanism/common/frequency/Frequency.java +++ b/src/main/java/mekanism/common/frequency/Frequency.java @@ -9,6 +9,7 @@ import java.util.UUID; import mekanism.api.Coord4D; import mekanism.common.PacketHandler; +import mekanism.common.util.MekanismUtils; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.UsernameCache; @@ -118,7 +119,7 @@ public class Frequency { data.add(name); data.add(ownerUUID.toString()); - data.add(UsernameCache.getLastKnownUsername(ownerUUID)); + data.add(MekanismUtils.getLastKnownUsername(ownerUUID)); data.add(publicFreq); } diff --git a/src/main/java/mekanism/common/item/ItemBlockCardboardBox.java b/src/main/java/mekanism/common/item/ItemBlockCardboardBox.java index 29a462c2b..0bedb2e08 100644 --- a/src/main/java/mekanism/common/item/ItemBlockCardboardBox.java +++ b/src/main/java/mekanism/common/item/ItemBlockCardboardBox.java @@ -39,7 +39,7 @@ public class ItemBlockCardboardBox extends ItemBlock public ItemBlockCardboardBox(Block block) { super(block); - setMaxStackSize(1); + setMaxStackSize(16); metaBlock = block; MinecraftForge.EVENT_BUS.register(this); @@ -169,4 +169,15 @@ public class ItemBlockCardboardBox extends ItemBlock event.setCanceled(true); } } + + @Override + public int getItemStackLimit(ItemStack stack) + { + BlockData blockData = getBlockData(stack); + if(blockData != null) + { + return 1; + } + return super.getItemStackLimit(stack); + } } diff --git a/src/main/java/mekanism/common/item/ItemBlockGasTank.java b/src/main/java/mekanism/common/item/ItemBlockGasTank.java index 05b42d02d..66035ac86 100644 --- a/src/main/java/mekanism/common/item/ItemBlockGasTank.java +++ b/src/main/java/mekanism/common/item/ItemBlockGasTank.java @@ -64,7 +64,7 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI super(block); metaBlock = block; setHasSubtypes(true); - setMaxStackSize(1); + setMaxStackSize(16); setCreativeTab(Mekanism.tabMekanism); } @@ -338,7 +338,7 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI @Override public boolean showDurabilityBar(ItemStack stack) { - return true; + return getGas(stack) != null; // No bar for empty containers as bars are drawn on top of stack count number } @Override @@ -404,4 +404,15 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI { return hasSecurity(stack); } + + @Override + public int getItemStackLimit(ItemStack stack) + { + GasStack gasStack = getGas(stack); + if(gasStack != null) + { + return 1; + } + return super.getItemStackLimit(stack); + } } diff --git a/src/main/java/mekanism/common/item/ItemBlockMachine.java b/src/main/java/mekanism/common/item/ItemBlockMachine.java index c01b5c648..54b270aab 100644 --- a/src/main/java/mekanism/common/item/ItemBlockMachine.java +++ b/src/main/java/mekanism/common/item/ItemBlockMachine.java @@ -245,7 +245,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec if(type.isElectric) { - list.add(EnumColor.BRIGHT_GREEN + LangUtils.localize("tooltip.storedEnergy") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(getEnergy(itemstack))); + list.add(EnumColor.BRIGHT_GREEN + LangUtils.localize("tooltip.storedEnergy") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(getEnergy(itemstack), getMaxEnergy(itemstack))); } if(hasTank(itemstack) && type != MachineType.FLUID_TANK) @@ -972,4 +972,18 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec } } } + + @Override + public int getItemStackLimit(ItemStack stack) + { + if(MachineType.get(stack) == MachineType.FLUID_TANK) + { + if(getFluidStack(stack) != null) + { + return 1; + } + return 16; + } + return super.getItemStackLimit(stack); + } } diff --git a/src/main/java/mekanism/common/item/ItemEnergized.java b/src/main/java/mekanism/common/item/ItemEnergized.java index 160a3cdc5..f6ad58039 100644 --- a/src/main/java/mekanism/common/item/ItemEnergized.java +++ b/src/main/java/mekanism/common/item/ItemEnergized.java @@ -69,7 +69,7 @@ public class ItemEnergized extends ItemMekanism implements IEnergizedItem, ISpec @SideOnly(Side.CLIENT) public void addInformation(ItemStack itemstack, World world, List list, ITooltipFlag flag) { - list.add(EnumColor.AQUA + LangUtils.localize("tooltip.storedEnergy") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(getEnergy(itemstack))); + list.add(EnumColor.AQUA + LangUtils.localize("tooltip.storedEnergy") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(getEnergy(itemstack), getMaxEnergy(itemstack))); } public ItemStack getUnchargedItem() diff --git a/src/main/java/mekanism/common/item/ItemFreeRunners.java b/src/main/java/mekanism/common/item/ItemFreeRunners.java index 30d494304..b200f8d42 100644 --- a/src/main/java/mekanism/common/item/ItemFreeRunners.java +++ b/src/main/java/mekanism/common/item/ItemFreeRunners.java @@ -83,7 +83,8 @@ public class ItemFreeRunners extends ItemArmor implements IEnergizedItem, ISpeci @SideOnly(Side.CLIENT) public void addInformation(ItemStack itemstack, World world, List list, ITooltipFlag flag) { - list.add(EnumColor.AQUA + LangUtils.localize("tooltip.storedEnergy") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(getEnergy(itemstack))); + list.add(EnumColor.AQUA + LangUtils.localize("tooltip.storedEnergy") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(getEnergy(itemstack), getMaxEnergy(itemstack))); + list.add(EnumColor.GREY + LangUtils.localize("tooltip.mode") + ": " + EnumColor.GREY + getMode(itemstack).getName()); } public ItemStack getUnchargedItem() @@ -223,7 +224,7 @@ public class ItemFreeRunners extends ItemArmor implements IEnergizedItem, ISpeci { ItemFreeRunners boots = (ItemFreeRunners)stack.getItem(); - if(boots.getEnergy(stack) > 0 && event.getSource() == DamageSource.FALL) + if(boots.getMode(stack) == FreeRunnerMode.NORMAL && boots.getEnergy(stack) > 0 && event.getSource() == DamageSource.FALL) { boots.setEnergy(stack, boots.getEnergy(stack)-event.getAmount()*50); event.setCanceled(true); @@ -236,4 +237,44 @@ public class ItemFreeRunners extends ItemArmor implements IEnergizedItem, ISpeci { return new ItemCapabilityWrapper(stack, new TeslaItemWrapper(), new ForgeEnergyItemWrapper()); } + + public enum FreeRunnerMode + { + NORMAL("tooltip.freerunner.regular", EnumColor.DARK_GREEN), + DISABLED("tooltip.freerunner.disabled", EnumColor.DARK_RED); + + private String unlocalized; + private EnumColor color; + + FreeRunnerMode(String unlocalized, EnumColor color) + { + this.unlocalized = unlocalized; + this.color = color; + } + + public FreeRunnerMode increment() + { + return ordinal() < values().length-1 ? values()[ordinal()+1] : values()[0]; + } + + public String getName() + { + return color + LangUtils.localize(unlocalized); + } + } + + public FreeRunnerMode getMode(ItemStack itemStack) + { + return FreeRunnerMode.values()[ItemDataUtils.getInt(itemStack, "mode")]; + } + + public void setMode(ItemStack itemStack, FreeRunnerMode mode) + { + ItemDataUtils.setInt(itemStack, "mode", mode.ordinal()); + } + + public void incrementMode(ItemStack itemStack) + { + setMode(itemStack, getMode(itemStack).increment()); + } } diff --git a/src/main/java/mekanism/common/network/PacketFreeRunnerData.java b/src/main/java/mekanism/common/network/PacketFreeRunnerData.java new file mode 100644 index 000000000..18e23a93c --- /dev/null +++ b/src/main/java/mekanism/common/network/PacketFreeRunnerData.java @@ -0,0 +1,140 @@ +package mekanism.common.network; + +import io.netty.buffer.ByteBuf; +import mekanism.common.Mekanism; +import mekanism.common.PacketHandler; +import mekanism.common.item.ItemFreeRunners; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.EntityEquipmentSlot; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.network.simpleimpl.IMessage; +import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; + +public class PacketFreeRunnerData implements IMessageHandler +{ + @Override + public IMessage onMessage(FreeRunnerDataMessage message, MessageContext ctx) + { + EntityPlayer entityPlayer = PacketHandler.getPlayer(ctx); + + PacketHandler.handlePacket(() -> { + if(message.packetType == FreeRunnerPacket.UPDATE) + { + if(message.value) + { + Mekanism.freeRunnerOn.add(message.username); + } + else + { + Mekanism.freeRunnerOn.remove(message.username); + } + + if(!entityPlayer.world.isRemote) + { + Mekanism.packetHandler.sendToDimension(new FreeRunnerDataMessage(FreeRunnerPacket.UPDATE, message.username, message.value), entityPlayer.world.provider.getDimension()); + } + } + else if(message.packetType == FreeRunnerPacket.MODE) + { + ItemStack stack = entityPlayer.getItemStackFromSlot(EntityEquipmentSlot.FEET); + + if(!stack.isEmpty() && stack.getItem() instanceof ItemFreeRunners) + { + if(!message.value) + { + ((ItemFreeRunners)stack.getItem()).incrementMode(stack); + } + else + { + ((ItemFreeRunners)stack.getItem()).setMode(stack, ItemFreeRunners.FreeRunnerMode.DISABLED); + } + } + } + }, entityPlayer); + + return null; + } + + public static class FreeRunnerDataMessage implements IMessage + { + public FreeRunnerPacket packetType; + + public String username; + public boolean value; + + public FreeRunnerDataMessage() {} + + public FreeRunnerDataMessage(FreeRunnerPacket packetType, String username, boolean value) + { + this.packetType = packetType; + this.value = value; + + if(packetType == FreeRunnerPacket.UPDATE) + { + this.username = username; + } + } + + @Override + public void toBytes(ByteBuf buf) + { + buf.writeInt(packetType.ordinal()); + + if(packetType == FreeRunnerPacket.MODE) + { + buf.writeBoolean(value); + } + else if(packetType == FreeRunnerPacket.UPDATE) + { + PacketHandler.writeString(buf, username); + buf.writeBoolean(value); + } + else if(packetType == FreeRunnerPacket.FULL) + { + buf.writeInt(Mekanism.freeRunnerOn.size()); + + synchronized (Mekanism.freeRunnerOn) + { + for(String usernameToSend : Mekanism.freeRunnerOn) + { + PacketHandler.writeString(buf, usernameToSend); + } + } + } + } + + @Override + public void fromBytes(ByteBuf buf) { + packetType = FreeRunnerPacket.values()[buf.readInt()]; + + if(packetType == FreeRunnerPacket.MODE) + { + value = buf.readBoolean(); + } + else if(packetType == FreeRunnerPacket.UPDATE) + { + username = PacketHandler.readString(buf); + value = buf.readBoolean(); + } + else if(packetType == FreeRunnerPacket.FULL) + { + Mekanism.freeRunnerOn.clear(); + + int amount = buf.readInt(); + + for(int i = 0; i < amount; i++) + { + Mekanism.freeRunnerOn.add(PacketHandler.readString(buf)); + } + } + } + } + + public enum FreeRunnerPacket + { + UPDATE, + FULL, + MODE + } +} diff --git a/src/main/java/mekanism/common/network/PacketSecurityUpdate.java b/src/main/java/mekanism/common/network/PacketSecurityUpdate.java index 4146b91b4..4c4c26e21 100644 --- a/src/main/java/mekanism/common/network/PacketSecurityUpdate.java +++ b/src/main/java/mekanism/common/network/PacketSecurityUpdate.java @@ -13,6 +13,7 @@ import mekanism.common.frequency.Frequency; import mekanism.common.network.PacketSecurityUpdate.SecurityUpdateMessage; import mekanism.common.security.SecurityData; import mekanism.common.security.SecurityFrequency; +import mekanism.common.util.MekanismUtils; import net.minecraftforge.common.UsernameCache; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; @@ -51,7 +52,7 @@ public class PacketSecurityUpdate implements IMessageHandler toRemove = new HashSet(); boolean did = false; - for(Chunk3D chunk : oresToMine.keySet()) + for(Iterator it = oresToMine.keySet().iterator(); it.hasNext();) { + Chunk3D chunk = it.next(); BitSet set = oresToMine.get(chunk); int next = 0; - while(true) + while(!did) { int index = set.nextSetBit(next); Coord4D coord = getCoordFromIndex(index); if(index == -1) { - toRemove.add(chunk); + it.remove(); break; } @@ -215,7 +215,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I if(set.cardinality() == 0) { - toRemove.add(chunk); + it.remove(); } next = index + 1; @@ -232,7 +232,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I if(set.cardinality() == 0) { - toRemove.add(chunk); + it.remove(); } next = index + 1; @@ -256,7 +256,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I if(set.cardinality() == 0) { - toRemove.add(chunk); + it.remove(); break; } @@ -274,7 +274,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I if(set.cardinality() == 0) { - toRemove.add(chunk); + it.remove(); } world.playEvent(null, 2001, coord.getPos(), Block.getStateId(state)); @@ -284,16 +284,6 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I break; } - - if(did) - { - break; - } - } - - for(Chunk3D chunk : toRemove) - { - oresToMine.remove(chunk); } delay = getDelay(); diff --git a/src/main/java/mekanism/common/tile/TileEntityFluidicPlenisher.java b/src/main/java/mekanism/common/tile/TileEntityFluidicPlenisher.java index 70489899b..41770eb8a 100644 --- a/src/main/java/mekanism/common/tile/TileEntityFluidicPlenisher.java +++ b/src/main/java/mekanism/common/tile/TileEntityFluidicPlenisher.java @@ -200,12 +200,9 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen toRemove.add(coord); } } - - for(Coord4D coord : toRemove) - { - activeNodes.remove(coord); - usedNodes.add(coord); - } + + usedNodes.addAll(toRemove); + activeNodes.removeAll(toRemove); } public boolean canReplace(Coord4D coord, boolean checkNodes, boolean isPathfinding) diff --git a/src/main/java/mekanism/common/tile/TileEntitySecurityDesk.java b/src/main/java/mekanism/common/tile/TileEntitySecurityDesk.java index 1a2c383d1..c4274f92c 100644 --- a/src/main/java/mekanism/common/tile/TileEntitySecurityDesk.java +++ b/src/main/java/mekanism/common/tile/TileEntitySecurityDesk.java @@ -262,7 +262,7 @@ public class TileEntitySecurityDesk extends TileEntityContainerBlock implements if(ownerUUID != null) { data.add(true); - data.add(UsernameCache.getLastKnownUsername(ownerUUID)); + data.add(MekanismUtils.getLastKnownUsername(ownerUUID)); } else { data.add(false); diff --git a/src/main/java/mekanism/common/tile/component/TileComponentSecurity.java b/src/main/java/mekanism/common/tile/component/TileComponentSecurity.java index a2af50f49..3bf566b34 100644 --- a/src/main/java/mekanism/common/tile/component/TileComponentSecurity.java +++ b/src/main/java/mekanism/common/tile/component/TileComponentSecurity.java @@ -214,7 +214,7 @@ public class TileComponentSecurity implements ITileComponent { data.add(true); data.add(ownerUUID.toString()); - data.add(UsernameCache.getLastKnownUsername(ownerUUID)); + data.add(MekanismUtils.getLastKnownUsername(ownerUUID)); } else { data.add(false); diff --git a/src/main/java/mekanism/common/util/CableUtils.java b/src/main/java/mekanism/common/util/CableUtils.java index 4e559dd2c..7c908bca3 100644 --- a/src/main/java/mekanism/common/util/CableUtils.java +++ b/src/main/java/mekanism/common/util/CableUtils.java @@ -1,8 +1,6 @@ package mekanism.common.util; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; +import java.util.*; import cofh.redstoneflux.api.IEnergyConnection; import cofh.redstoneflux.api.IEnergyProvider; @@ -186,7 +184,7 @@ public final class CableUtils if(energyToSend > 0) { - List outputtingSides = new ArrayList(); + List outputtingSides = new LinkedList<>(); boolean[] connectable = getConnections((TileEntity)emitter, emitter.getOutputtingSides()); for(EnumFacing side : emitter.getOutputtingSides()) @@ -197,7 +195,7 @@ public final class CableUtils } } - if(outputtingSides.size() > 0) + if(!outputtingSides.isEmpty()) { double sent = 0; boolean tryAgain = false; @@ -224,10 +222,10 @@ public final class CableUtils double splitSend = (totalToSend-remains)/outputtingSides.size(); double sent = 0; - List toRemove = new ArrayList(); - - for(EnumFacing side : outputtingSides) + for(Iterator it = outputtingSides.iterator(); it.hasNext();) { + EnumFacing side = it.next(); + TileEntity tileEntity = Coord4D.get((TileEntity)emitter).offset(side).getTileEntity(((TileEntity)emitter).getWorld()); double toSend = splitSend+remains; remains = 0; @@ -237,15 +235,10 @@ public final class CableUtils if(sent-prev == 0) { - toRemove.add(side); + it.remove(); } } - for(EnumFacing side : toRemove) - { - outputtingSides.remove(side); - } - return sent; } diff --git a/src/main/java/mekanism/common/util/MekanismUtils.java b/src/main/java/mekanism/common/util/MekanismUtils.java index 5c7e05fe0..4b07b3dac 100644 --- a/src/main/java/mekanism/common/util/MekanismUtils.java +++ b/src/main/java/mekanism/common/util/MekanismUtils.java @@ -1,5 +1,6 @@ package mekanism.common.util; +import com.mojang.authlib.GameProfile; import ic2.api.energy.EnergyNet; import java.io.BufferedReader; @@ -11,6 +12,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.UUID; import mekanism.api.Chunk3D; import mekanism.api.Coord4D; @@ -79,18 +81,24 @@ 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.ChunkCache; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.UsernameCache; +import net.minecraft.world.chunk.Chunk; import net.minecraftforge.fluids.BlockFluidBase; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidBlock; +import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.oredict.OreDictionary; +import javax.annotation.Nonnull; + /** * Utilities used by Mekanism. All miscellaneous methods are located here. * @author AidanBrady @@ -102,6 +110,8 @@ public final class MekanismUtils public static final Map> classesFound = new HashMap>(); + private static final List warnedFails = new ArrayList<>(); + /** * Checks for a new version of Mekanism. */ @@ -164,11 +174,7 @@ public final class MekanismUtils public static void updateDonators() { Mekanism.donators.clear(); - - for(String s : getHTML("https://dl.dropbox.com/u/90411166/Donators/Mekanism.txt")) - { - Mekanism.donators.add(s); - } + Mekanism.donators.addAll(getHTML("https://dl.dropbox.com/u/90411166/Donators/Mekanism.txt")); } /** @@ -1093,6 +1099,19 @@ public final class MekanismUtils return "error"; } + + public static String getEnergyDisplay(double energy, double max) + { + if(energy == Double.MAX_VALUE) + { + return LangUtils.localize("gui.infinite"); + } + + String energyString = getEnergyDisplay(energy); + String maxString = getEnergyDisplay(max); + + return energyString + "/" + maxString; + } /** * Convert from the unit defined in the configuration to joules. @@ -1498,6 +1517,30 @@ public final class MekanismUtils return false; } + @Nonnull + public static String getLastKnownUsername(UUID uuid) + { + String ret = UsernameCache.getLastKnownUsername(uuid); + + if(ret == null && !warnedFails.contains(uuid) && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) + { // see if MC/Yggdrasil knows about it?! + GameProfile gp = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerProfileCache().getProfileByUUID(uuid); + + if(gp != null) + { + ret = gp.getName(); + } + } + + if(ret == null && !warnedFails.contains(uuid)) + { + Mekanism.logger.warn("Failed to retrieve username for UUID {}, you might want to add it to the JSON cache", uuid); + warnedFails.add(uuid); + } + + return ret != null ? ret : ""; + } + public static enum ResourceType { GUI("gui"), @@ -1521,4 +1564,9 @@ public final class MekanismUtils return prefix + "/"; } } + + public static TileEntity getTileEntitySafe(IBlockAccess worldIn, BlockPos pos) + { + return worldIn instanceof ChunkCache ? ((ChunkCache)worldIn).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : worldIn.getTileEntity(pos); + } } diff --git a/src/main/java/mekanism/common/util/MinerUtils.java b/src/main/java/mekanism/common/util/MinerUtils.java index 2535b4b59..036a96c9e 100644 --- a/src/main/java/mekanism/common/util/MinerUtils.java +++ b/src/main/java/mekanism/common/util/MinerUtils.java @@ -1,6 +1,7 @@ package mekanism.common.util; import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; import mekanism.api.Coord4D; @@ -22,7 +23,7 @@ public final class MinerUtils if(block == null || block.isAir(state, world, obj.getPos())) { - return new ArrayList(); + return new LinkedList<>(); } if(!silk) @@ -41,6 +42,6 @@ public final class MinerUtils } } - return new ArrayList(); + return new LinkedList<>(); } } diff --git a/src/main/java/mekanism/generators/client/gui/GuiIndustrialTurbine.java b/src/main/java/mekanism/generators/client/gui/GuiIndustrialTurbine.java index 065f84723..0a3cc0444 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiIndustrialTurbine.java +++ b/src/main/java/mekanism/generators/client/gui/GuiIndustrialTurbine.java @@ -77,7 +77,7 @@ public class GuiIndustrialTurbine extends GuiMekanism double energyMultiplier = (general.maxEnergyPerSteam/TurbineUpdateProtocol.MAX_BLADES)*Math.min(tileEntity.structure.blades, tileEntity.structure.coils*generators.turbineBladesPerCoil); return ListUtils.asList( - LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), + LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), LangUtils.localize("gui.producing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.clientFlow*energyMultiplier) + "/t"); } }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiIndustrialTurbine.png"))); diff --git a/src/main/java/mekanism/generators/client/gui/GuiReactorController.java b/src/main/java/mekanism/generators/client/gui/GuiReactorController.java index 8f54906e7..90dfeb0b2 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiReactorController.java +++ b/src/main/java/mekanism/generators/client/gui/GuiReactorController.java @@ -41,7 +41,7 @@ public class GuiReactorController extends GuiMekanism public List getInfo() { return tileEntity.isFormed() ? ListUtils.asList( - LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), + LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), LangUtils.localize("gui.producing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getReactor().getPassiveGeneration(false, true)) + "/t") : new ArrayList(); } }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"))); diff --git a/src/main/java/mekanism/generators/client/gui/GuiReactorFuel.java b/src/main/java/mekanism/generators/client/gui/GuiReactorFuel.java index 47134165e..5a4ab1a40 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiReactorFuel.java +++ b/src/main/java/mekanism/generators/client/gui/GuiReactorFuel.java @@ -53,7 +53,7 @@ public class GuiReactorFuel extends GuiMekanism public List getInfo() { return tileEntity.isFormed() ? ListUtils.asList( - LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), + LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), LangUtils.localize("gui.producing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getReactor().getPassiveGeneration(false, true)) + "/t") : new ArrayList(); } }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png"))); diff --git a/src/main/java/mekanism/generators/client/gui/GuiReactorHeat.java b/src/main/java/mekanism/generators/client/gui/GuiReactorHeat.java index 3b0666a48..fdae5c8f0 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiReactorHeat.java +++ b/src/main/java/mekanism/generators/client/gui/GuiReactorHeat.java @@ -58,7 +58,7 @@ public class GuiReactorHeat extends GuiMekanism public List getInfo() { return tileEntity.isFormed() ? ListUtils.asList( - LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), + LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), LangUtils.localize("gui.producing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getReactor().getPassiveGeneration(false, true)) + "/t") : new ArrayList(); } }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png"))); diff --git a/src/main/java/mekanism/generators/client/gui/GuiReactorStats.java b/src/main/java/mekanism/generators/client/gui/GuiReactorStats.java index c96a0578f..7174a3089 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiReactorStats.java +++ b/src/main/java/mekanism/generators/client/gui/GuiReactorStats.java @@ -45,7 +45,7 @@ public class GuiReactorStats extends GuiMekanism public List getInfo() { return tileEntity.isFormed() ? ListUtils.asList( - LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), + LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), LangUtils.localize("gui.producing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getReactor().getPassiveGeneration(false, true)) + "/t") : new ArrayList(); } }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png"))); diff --git a/src/main/java/mekanism/generators/client/gui/GuiSolarGenerator.java b/src/main/java/mekanism/generators/client/gui/GuiSolarGenerator.java index f92e71910..49fc6d7a3 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiSolarGenerator.java +++ b/src/main/java/mekanism/generators/client/gui/GuiSolarGenerator.java @@ -56,7 +56,7 @@ public class GuiSolarGenerator extends GuiMekanism fontRenderer.drawString(tileEntity.getName(), !tileEntity.fullName.contains("Advanced") ? 45 : 30, 6, 0x404040); fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040); - fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), 51, 26, 0x00CD00); + fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), 51, 26, 0x00CD00); fontRenderer.drawString(LangUtils.localize("gui.solarGenerator.sun") + ": " + tileEntity.seesSun, 51, 35, 0x00CD00); fontRenderer.drawString(LangUtils.localize("gui.out") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t", 51, 44, 0x00CD00); diff --git a/src/main/java/mekanism/generators/client/gui/GuiTurbineStats.java b/src/main/java/mekanism/generators/client/gui/GuiTurbineStats.java index 7b847ad69..ad0e041b9 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiTurbineStats.java +++ b/src/main/java/mekanism/generators/client/gui/GuiTurbineStats.java @@ -41,7 +41,7 @@ public class GuiTurbineStats extends GuiMekanism double energyMultiplier = (general.maxEnergyPerSteam/TurbineUpdateProtocol.MAX_BLADES)*Math.min(tileEntity.structure.blades, tileEntity.structure.coils*generators.turbineBladesPerCoil); return ListUtils.asList( - LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), + LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), LangUtils.localize("gui.producing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.clientFlow*energyMultiplier) + "/t"); } }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiNull.png"))); diff --git a/src/main/java/mekanism/generators/client/gui/GuiWindGenerator.java b/src/main/java/mekanism/generators/client/gui/GuiWindGenerator.java index fa1f68ba9..abd9f816a 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiWindGenerator.java +++ b/src/main/java/mekanism/generators/client/gui/GuiWindGenerator.java @@ -58,7 +58,7 @@ public class GuiWindGenerator extends GuiMekanism { fontRenderer.drawString(tileEntity.getName(), 45, 6, 0x404040); fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040); - fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), 51, 26, 0x00CD00); + fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), 51, 26, 0x00CD00); fontRenderer.drawString(LangUtils.localize("gui.power") + ": " + powerFormat.format(MekanismUtils.convertToDisplay(generators.windGenerationMin*tileEntity.currentMultiplier)), 51, 35, 0x00CD00); fontRenderer.drawString(LangUtils.localize("gui.out") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t", 51, 44, 0x00CD00); diff --git a/src/main/java/mekanism/generators/common/GeneratorsItems.java b/src/main/java/mekanism/generators/common/GeneratorsItems.java index 7adafa0a4..fba279e79 100644 --- a/src/main/java/mekanism/generators/common/GeneratorsItems.java +++ b/src/main/java/mekanism/generators/common/GeneratorsItems.java @@ -1,6 +1,7 @@ package mekanism.generators.common; import mekanism.common.item.ItemMekanism; +import mekanism.common.util.MekanismUtils; import mekanism.generators.common.item.ItemHohlraum; import mekanism.generators.common.tile.turbine.TileEntityTurbineRotor; import net.minecraft.entity.player.EntityPlayer; @@ -21,7 +22,7 @@ public class GeneratorsItems @Override public boolean doesSneakBypassUse(ItemStack stack, IBlockAccess world, BlockPos pos, EntityPlayer player) { - return world.getTileEntity(pos) instanceof TileEntityTurbineRotor; + return MekanismUtils.getTileEntitySafe(world, pos) instanceof TileEntityTurbineRotor; } }; diff --git a/src/main/java/mekanism/generators/common/MekanismGenerators.java b/src/main/java/mekanism/generators/common/MekanismGenerators.java index c232ac02c..fec47e8e1 100644 --- a/src/main/java/mekanism/generators/common/MekanismGenerators.java +++ b/src/main/java/mekanism/generators/common/MekanismGenerators.java @@ -1,9 +1,11 @@ package mekanism.generators.common; +import buildcraft.api.mj.MjAPI; import io.netty.buffer.ByteBuf; import java.io.IOException; +import mekanism.api.MekanismAPI; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; import mekanism.api.infuse.InfuseRegistry; @@ -117,13 +119,13 @@ public class MekanismGenerators implements IModule { for(IFuel s : BuildcraftFuelRegistry.fuel.getFuels()) { - if(!(s.getFluid() == null || GasRegistry.containsGas(s.getFluid().getName()))) + if(s.getFluid() != null && !GasRegistry.containsGas(s.getFluid().getFluid().getName())) { - GasRegistry.register(new Gas(s.getFluid())); + GasRegistry.register(new Gas(s.getFluid().getFluid())); } } - BuildcraftFuelRegistry.fuel.addFuel(MekanismFluids.Ethene.getFluid(), (int)(240 * general.TO_RF), 40 * Fluid.BUCKET_VOLUME); + BuildcraftFuelRegistry.fuel.addFuel(MekanismFluids.Ethene.getFluid(), (long)(240 * general.TO_RF / 20 * MjAPI.MJ), 40 * Fluid.BUCKET_VOLUME); } for(ItemStack ore : OreDictionary.getOres("dustGold")) @@ -221,4 +223,12 @@ public class MekanismGenerators implements IModule proxy.loadConfiguration(); } } + + @SubscribeEvent + public void onBlacklistUpdate(MekanismAPI.BoxBlacklistEvent event) + { + // Mekanism Generators multiblock structures + MekanismAPI.addBoxBlacklist(GeneratorsBlocks.Generator, 5); // Advanced Solar Generator + MekanismAPI.addBoxBlacklist(GeneratorsBlocks.Generator, 6); // Wind Generator + } } diff --git a/src/main/java/mekanism/generators/common/block/BlockGenerator.java b/src/main/java/mekanism/generators/common/block/BlockGenerator.java index b1e8a11cb..7427278e8 100644 --- a/src/main/java/mekanism/generators/common/block/BlockGenerator.java +++ b/src/main/java/mekanism/generators/common/block/BlockGenerator.java @@ -169,7 +169,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { - TileEntity tile = worldIn.getTileEntity(pos); + TileEntity tile = MekanismUtils.getTileEntitySafe(worldIn, pos); if(tile instanceof TileEntityBasicBlock && ((TileEntityBasicBlock)tile).facing != null) { @@ -254,7 +254,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock { if(client.enableAmbientLighting) { - TileEntity tileEntity = world.getTileEntity(pos); + TileEntity tileEntity = MekanismUtils.getTileEntitySafe(world, pos); if(tileEntity instanceof IActiveState && !(tileEntity instanceof TileEntitySolarGenerator)) { diff --git a/src/main/java/mekanism/generators/common/block/BlockReactor.java b/src/main/java/mekanism/generators/common/block/BlockReactor.java index 68eae4b7c..d290683cf 100644 --- a/src/main/java/mekanism/generators/common/block/BlockReactor.java +++ b/src/main/java/mekanism/generators/common/block/BlockReactor.java @@ -75,7 +75,7 @@ public abstract class BlockReactor extends Block implements ICTMBlock, ITileEnti @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { - TileEntity tile = worldIn.getTileEntity(pos); + TileEntity tile = MekanismUtils.getTileEntitySafe(worldIn, pos); if(tile instanceof TileEntityReactorController) { @@ -292,7 +292,7 @@ public abstract class BlockReactor extends Block implements ICTMBlock, ITileEnti @Override public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = MekanismUtils.getTileEntitySafe(world, pos); if(tile instanceof TileEntityReactorLogicAdapter) { diff --git a/src/main/java/mekanism/generators/common/item/ItemBlockGenerator.java b/src/main/java/mekanism/generators/common/item/ItemBlockGenerator.java index 110995b55..bb6b3e60c 100644 --- a/src/main/java/mekanism/generators/common/item/ItemBlockGenerator.java +++ b/src/main/java/mekanism/generators/common/item/ItemBlockGenerator.java @@ -142,7 +142,7 @@ public class ItemBlockGenerator extends ItemBlock implements IEnergizedItem, ISp } } - list.add(EnumColor.BRIGHT_GREEN + LangUtils.localize("tooltip.storedEnergy") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(getEnergy(itemstack))); + list.add(EnumColor.BRIGHT_GREEN + LangUtils.localize("tooltip.storedEnergy") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(getEnergy(itemstack), getMaxEnergy(itemstack))); if(hasTank(itemstack)) { diff --git a/src/main/resources/assets/mekanism/lang/en_us.lang b/src/main/resources/assets/mekanism/lang/en_us.lang index eb119a49d..cc727ec0c 100644 --- a/src/main/resources/assets/mekanism/lang/en_us.lang +++ b/src/main/resources/assets/mekanism/lang/en_us.lang @@ -394,6 +394,7 @@ upgrade.anchor.desc=Keeps a machine's chunk loaded. //Key description text key.mode=Item Mode Switch key.armorMode=Armor Mode Switch +key.feetMode=Feet Mode Switch key.voice=Voice //Entities @@ -785,6 +786,9 @@ tooltip.jetpack.regular=Regular tooltip.jetpack.hover=Hover tooltip.jetpack.disabled=Disabled +tooltip.freerunner.regular=Regular +tooltip.freerunner.disabled=Disabled + tooltip.flamethrower.combat=Combat tooltip.flamethrower.heat=Heat tooltip.flamethrower.inferno=Inferno