diff --git a/build.gradle b/build.gradle index 029b88844..11dc58195 100644 --- a/build.gradle +++ b/build.gradle @@ -57,6 +57,10 @@ repositories { name 'hwyla' url 'http://tehnut.info/maven' } + maven { + name 'buildcraft' + url 'https://mod-buildcraft.com/maven/' + } } // Define properties file @@ -90,6 +94,7 @@ dependencies { compile "inventory-tweaks:InventoryTweaks:${config.invtweak_version}:api" compile "li.cil.oc:OpenComputers:MC${config.minecraft_version}-${config.opencomputers_version}:api" deobfCompile "mcp.mobius.waila:Hwyla:${config.hwyla_version}" + deobfCompile "com.mod-buildcraft:buildcraft-api:${config.buildcraft_version}" } processResources diff --git a/build.properties b/build.properties index db230f8a1..d85a5e3de 100644 --- a/build.properties +++ b/build.properties @@ -8,3 +8,4 @@ tesla_version=1.11-1.3.0.52 invtweak_version=1.62+beta.89 opencomputers_version=1.7.0.24 hwyla_version=1.8.13-B26_1.11 +buildcraft_version=7.99.6 diff --git a/src/api/java/buildcraft/api/BCBlocks.java b/src/api/java/buildcraft/api/BCBlocks.java deleted file mode 100644 index c864fd797..000000000 --- a/src/api/java/buildcraft/api/BCBlocks.java +++ /dev/null @@ -1,122 +0,0 @@ -package buildcraft.api; - -import java.util.HashSet; -import java.util.Set; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.util.ResourceLocation; - -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.LoaderState; - -import buildcraft.api.core.BCDebugging; -import buildcraft.api.core.BCLog; - -/** Stores all of BuildCraft's blocks, from all of its modules. If any of them have been disabled by the user (or it the - * module is not installed) then they will be null. This is the equivalent of {@link Blocks} */ -public class BCBlocks { - private static final boolean DEBUG = BCDebugging.shouldDebugLog("api.blocks"); - - // BC Core - public static final Block CORE_DECORATED; - public static final Block CORE_ENGINE; - public static final Block CORE_MARKER_VOLUME; - public static final Block CORE_MARKER_PATH; - - // BC Builders - - // BC Energy - - // BC Factory - public static final Block FACTORY_TANK; - public static final Block FACTORY_PUMP; - public static final Block FACTORY_CHUTE; - public static final Block FACTORY_FLOOD_GATE; - public static final Block FACTORY_MINING_WELL; - public static final Block FACTORY_AUTOWORKBENCH_ITEM; - public static final Block FACTORY_DISTILLER; - public static final Block FACTORY_HEAT_EXCHANGE_START; - public static final Block FACTORY_HEAT_EXCHANGE_MIDDLE; - public static final Block FACTORY_HEAT_EXCHANGE_END; - - // BC Robotics - - // BC Silicon - public static final Block SILICON_LASER; - public static final Block SILICON_TABLE_ASSEMBLY; - public static final Block SILICON_TABLE_INTEGRATION; - public static final Block SILICON_TABLE_ADV_CRAFT; - public static final Block SILICON_TABLE_CHARGING; - public static final Block SILICON_TABLE_PROGRAMMING; - - // BC Transport - - // Set of items scanned - private static final Set SCANNED = DEBUG ? new HashSet<>() : null; - - static { - if (!Loader.instance().hasReachedState(LoaderState.INITIALIZATION)) { - throw new RuntimeException("Accessed BC blocks too early! You can only use them from init onwards!"); - } - String core = "core"; - CORE_DECORATED = getRegisteredBlock(core, "decorated"); - CORE_ENGINE = getRegisteredBlock(core, "engine"); - CORE_MARKER_VOLUME = getRegisteredBlock(core, "marker_volume"); - CORE_MARKER_PATH = getRegisteredBlock(core, "marker_path"); - - String energy = "energy"; - - String factory = "factory"; - FACTORY_TANK = getRegisteredBlock(factory, "tank"); - FACTORY_PUMP = getRegisteredBlock(factory, "pump"); - FACTORY_CHUTE = getRegisteredBlock(factory, "chute"); - FACTORY_FLOOD_GATE = getRegisteredBlock(factory, "flood_gate"); - FACTORY_MINING_WELL = getRegisteredBlock(factory, "mining_well"); - FACTORY_AUTOWORKBENCH_ITEM = getRegisteredBlock(factory, "autoworkbench_item"); - FACTORY_DISTILLER = getRegisteredBlock(factory, "distiller"); - FACTORY_HEAT_EXCHANGE_START = getRegisteredBlock(factory, "heat_exchange_start"); - FACTORY_HEAT_EXCHANGE_MIDDLE = getRegisteredBlock(factory, "heat_exchange_middle"); - FACTORY_HEAT_EXCHANGE_END = getRegisteredBlock(factory, "heat_exchange_end"); - - String silicon = "silicon"; - SILICON_LASER = getRegisteredBlock(silicon, "laser"); - SILICON_TABLE_ASSEMBLY = getRegisteredBlock(silicon, "assembly_table"); - SILICON_TABLE_INTEGRATION = getRegisteredBlock(silicon, "integration_table"); - SILICON_TABLE_ADV_CRAFT = getRegisteredBlock(silicon, "advanced_crafting_table"); - SILICON_TABLE_CHARGING = getRegisteredBlock(silicon, "charging_table"); - SILICON_TABLE_PROGRAMMING = getRegisteredBlock(silicon, "programming_table"); - - if (DEBUG) { - for (Block block : Block.REGISTRY) { - ResourceLocation id = block.getRegistryName(); - if (id.getResourceDomain().startsWith("buildcraft")) { - if (!SCANNED.contains(id.toString())) { - BCLog.logger.warn("[api.blocks] Found a block " + id.toString() + " that was not registered with the API! Is this a bug?"); - } - } - } - } - } - - private static Block getRegisteredBlock(String module, String regName) { - String modid = "buildcraft" + module; - Block block = Block.REGISTRY.getObject(new ResourceLocation(modid, regName)); - - if (block != Blocks.AIR) { - if (DEBUG) { - BCLog.logger.info("[api.blocks] Found the block " + regName + " from the module " + module); - SCANNED.add(modid + ":" + regName); - } - return block; - } - if (DEBUG) { - if (Loader.isModLoaded(modid)) { - BCLog.logger.info("[api.blocks] Did not find the block " + regName + " despite the appropriate mod being loaded (" + modid + ")"); - } else { - BCLog.logger.info("[api.blocks] Did not find the block " + regName + " probably because the mod is not loaded (" + modid + ")"); - } - } - return null; - } -} diff --git a/src/api/java/buildcraft/api/BCItems.java b/src/api/java/buildcraft/api/BCItems.java deleted file mode 100644 index 2497aff15..000000000 --- a/src/api/java/buildcraft/api/BCItems.java +++ /dev/null @@ -1,167 +0,0 @@ -package buildcraft.api; - -import java.util.HashSet; -import java.util.Set; - -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.util.ResourceLocation; - -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.LoaderState; - -import buildcraft.api.core.BCDebugging; -import buildcraft.api.core.BCLog; - -/** Stores all of BuildCraft's items, from all of its modules. If any of them have been disabled by the user (or it the - * module is not installed) then they will be null. This is the equivalent of {@link Items} */ -public class BCItems { - private static final boolean DEBUG = BCDebugging.shouldDebugLog("api.items"); - - // The (optional) items in BC LIB, and has other rules for when they are enabled. - public static final Item LIB_GUIDE; - public static final Item LIB_DEBUGGER; - - // BC Core - public static final Item CORE_WRENCH; - public static final Item CORE_DIAMOND_SHARD; - public static final Item CORE_LIST; - public static final Item CORE_MAP_LOCATION; - public static final Item CORE_PAINTBRUSH; - public static final Item CORE_GEAR_WOOD; - public static final Item CORE_GEAR_STONE; - public static final Item CORE_GEAR_IRON; - public static final Item CORE_GEAR_GOLD; - public static final Item CORE_GEAR_DIAMOND; - public static final Item CORE_MARKER_CONNECTOR; - public static final Item CORE_GOGGLES; - - // BC Builders - public static final Item BUILDERS_SINGLE_SCHEMATIC; - public static final Item BUILDERS_SNAPSHOT; - - // BC Energy - public static final Item ENERGY_GLOB_OF_OIL; - - // BC Factory - public static final Item FACTORY_PLASTIC_SHEET; - - // BC Robotics - public static final Item ROBOTICS_REDSTONE_BOARD; - public static final Item ROBOTICS_ROBOT; - public static final Item ROBOTICS_ROBOT_GOGGLES; - public static final Item ROBOTICS_PLUGGABLE_ROBOT_STATION; - - // BC Silicon - public static final Item SILICON_REDSTONE_CHIPSET; - - // BC Transport - public static final Item TRANSPORT_WATERPROOF; - public static final Item TRANSPORT_GATE_COPIER; - public static final Item TRANSPORT_PLUGGABLE_GATE; - public static final Item TRANSPORT_PLUGGABLE_WIRE; - public static final Item TRANSPORT_PLUGGABLE_BLOCKER; - public static final Item TRANSPORT_PLUGGABLE_LENS; - public static final Item TRANSPORT_PLUGGABLE_POWER_ADAPTOR; - public static final Item TRANSPORT_PLUGGABLE_FACADE; - - public static final Item TRANSPORT_PIPE_WOOD_ITEM; - public static final Item TRANSPORT_PIPE_WOOD_FLUID; - public static final Item TRANSPORT_PIPE_WOOD_POWER; - - // ... a few more needed... - - public static final Item TRANSPORT_PIPE_DIAMOND_ITEM; - - // Set of items scanned - private static final Set SCANNED = DEBUG ? new HashSet<>() : null; - - static { - if (!Loader.instance().hasReachedState(LoaderState.INITIALIZATION)) { - throw new RuntimeException("Accessed BC items too early! You can only use them from init onwards!"); - } - final String lib = "lib"; - LIB_GUIDE = getRegisteredItem(lib, "guide"); - LIB_DEBUGGER = getRegisteredItem(lib, "debugger"); - - final String core = "core"; - CORE_WRENCH = getRegisteredItem(core, "wrench"); - CORE_DIAMOND_SHARD = getRegisteredItem(core, "diamond_shard"); - CORE_LIST = getRegisteredItem(core, "list"); - CORE_MAP_LOCATION = getRegisteredItem(core, "map_location"); - CORE_PAINTBRUSH = getRegisteredItem(core, "paintbrush"); - CORE_GEAR_WOOD = getRegisteredItem(core, "gear_wood"); - CORE_GEAR_STONE = getRegisteredItem(core, "gear_stone"); - CORE_GEAR_IRON = getRegisteredItem(core, "gear_iron"); - CORE_GEAR_GOLD = getRegisteredItem(core, "gear_gold"); - CORE_GEAR_DIAMOND = getRegisteredItem(core, "gear_diamond"); - CORE_MARKER_CONNECTOR = getRegisteredItem(core, "marker_connector"); - CORE_GOGGLES = getRegisteredItem(core, "goggles"); - - final String builders = "builders"; - BUILDERS_SINGLE_SCHEMATIC = getRegisteredItem(builders, "single_schematic"); - BUILDERS_SNAPSHOT = getRegisteredItem(builders, "snapshot"); - - final String energy = "energy"; - ENERGY_GLOB_OF_OIL = getRegisteredItem(energy, "glob_oil"); - - final String factory = "factory"; - FACTORY_PLASTIC_SHEET = getRegisteredItem(factory, "plastic_sheet"); - - final String robotics = "robotics"; - ROBOTICS_REDSTONE_BOARD = getRegisteredItem(robotics, "redstone_board"); - ROBOTICS_ROBOT = getRegisteredItem(robotics, "robot"); - ROBOTICS_PLUGGABLE_ROBOT_STATION = getRegisteredItem(robotics, "robot_station"); - ROBOTICS_ROBOT_GOGGLES = getRegisteredItem(robotics, "robot_goggles"); - - final String silicon = "silicon"; - SILICON_REDSTONE_CHIPSET = getRegisteredItem(silicon, "redstone_chipset"); - - final String transport = "transport"; - TRANSPORT_WATERPROOF = getRegisteredItem(transport, "waterproof"); - TRANSPORT_GATE_COPIER = getRegisteredItem(transport, "gate_copier"); - TRANSPORT_PLUGGABLE_GATE = getRegisteredItem(transport, "plug_gate"); - TRANSPORT_PLUGGABLE_WIRE = getRegisteredItem(transport, "plug_wire"); - TRANSPORT_PLUGGABLE_BLOCKER = getRegisteredItem(transport, "plug_blocker"); - TRANSPORT_PLUGGABLE_LENS = getRegisteredItem(transport, "plug_lens"); - TRANSPORT_PLUGGABLE_FACADE = getRegisteredItem(transport, "plug_facade"); - TRANSPORT_PLUGGABLE_POWER_ADAPTOR = getRegisteredItem(transport, "plug_power_adapter"); - TRANSPORT_PIPE_WOOD_ITEM = getRegisteredItem(transport, "pipe_wood_item"); - TRANSPORT_PIPE_WOOD_FLUID = getRegisteredItem(transport, "pipe_wood_fluid"); - TRANSPORT_PIPE_WOOD_POWER = getRegisteredItem(transport, "pipe_wood_power"); - - TRANSPORT_PIPE_DIAMOND_ITEM = getRegisteredItem(transport, "pipe_diamond_item"); - - if (DEBUG) { - for (Item item : Item.REGISTRY) { - ResourceLocation id = item.getRegistryName(); - if (id.getResourceDomain().startsWith("buildcraft")) { - if (!SCANNED.contains(id.toString())) { - BCLog.logger.warn("[api.items] Found an item " + id.toString() + " that was not registered with the API! Is this a bug?"); - } - } - } - } - } - - private static Item getRegisteredItem(String module, String regName) { - String modid = "buildcraft" + module; - Item item = Item.REGISTRY.getObject(new ResourceLocation(modid, regName)); - if (item != null) { - if (DEBUG) { - BCLog.logger.info("[api.items] Found the item " + regName + " from the module " + module); - SCANNED.add(modid + ":" + regName); - } - return item; - } - if (DEBUG) { - if (Loader.isModLoaded(modid)) { - BCLog.logger.info("[api.items] Did not find the item " + regName + " despite the appropriate mod being loaded (" + modid + ")"); - } else { - BCLog.logger.info("[api.items] Did not find the item " + regName + " probably because the mod is not loaded (" + modid + ")"); - } - } - - return null; - } -} diff --git a/src/api/java/buildcraft/api/BCModules.java b/src/api/java/buildcraft/api/BCModules.java deleted file mode 100644 index 73e769690..000000000 --- a/src/api/java/buildcraft/api/BCModules.java +++ /dev/null @@ -1,67 +0,0 @@ -package buildcraft.api; - -import java.util.Locale; - -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.LoaderState; - -import buildcraft.api.core.BCLog; - -public enum BCModules { - LIB, - // Base module for all BC. - CORE, - // Potentially optional modules for adding more BC functionality - BUILDERS, - ENERGY, - FACTORY, - ROBOTICS, - SILICON, - TRANSPORT, - // Optional module for compatibility with other mods - COMPAT; - - public static final BCModules[] VALUES = values(); - - private static final String MODID_START = "buildcraft"; - private final String modid, part; - - BCModules() { - part = name().toLowerCase(Locale.ROOT); - this.modid = MODID_START + part; - } - - public static void fmlPreInit() {} - - public static boolean isBcMod(String modid) { - if (!modid.startsWith(MODID_START)) return false; - String post = modid.substring(MODID_START.length()); - for (BCModules module : VALUES) { - if (post.equals(module.part)) { - return true; - } - } - return false; - } - - public boolean isLoaded() { - return Loader.isModLoaded(modid); - } - - public String getModId() { - return modid; - } - - static { - if (!Loader.instance().hasReachedState(LoaderState.CONSTRUCTING)) { - throw new RuntimeException("Accessed BC modules too early! You can only use them from construction onwards!"); - } - for (BCModules module : values()) { - if (module.isLoaded()) { - BCLog.logger.info("[api.modules] Module " + module.name().toLowerCase(Locale.ROOT) + " is loaded!"); - } else { - BCLog.logger.warn("[api.modules] Module " + module.name().toLowerCase(Locale.ROOT) + " is NOT loaded!"); - } - } - } -} 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/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/BCDebugging.java b/src/api/java/buildcraft/api/core/BCDebugging.java deleted file mode 100755 index 732be03d0..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 (").append(type).append(")."); - 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 f7f24c0cb..000000000 --- a/src/api/java/buildcraft/api/core/BuildCraftAPI.java +++ /dev/null @@ -1,61 +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.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.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModContainer; - -public final class BuildCraftAPI { - public static IFakePlayerProvider fakePlayerProvider; - - public static final Set softBlocks = Sets.newHashSet(); - public static final HashMap worldProperties = Maps.newHashMap(); - - /** Deactivate constructor */ - private BuildCraftAPI() {} - - public static String getVersion() { - ModContainer container = Loader.instance().getIndexedModList().get("buildcraftlib"); - if (container != null) { - return container.getDisplayVersion(); - } - 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 overridden with " + property.getClass().getSimpleName() + "!"); - } - worldProperties.put(name, property); - } - - public static boolean isSoftBlock(World world, BlockPos pos) { - return worldProperties.get("soft").get(world, pos); - } - - public static ResourceLocation nameToResourceLocation(String name) { - if (name.indexOf(':') > 0) return new ResourceLocation(name); - ModContainer modContainer = Loader.instance().activeModContainer(); - if (modContainer == null) { - throw new IllegalStateException("Illegal recipe name " + name + ". Provide domain id to register it correctly."); - } - return new ResourceLocation(modContainer.getModId(), name); - } -} diff --git a/src/api/java/buildcraft/api/core/CapabilitiesHelper.java b/src/api/java/buildcraft/api/core/CapabilitiesHelper.java deleted file mode 100644 index d5795c935..000000000 --- a/src/api/java/buildcraft/api/core/CapabilitiesHelper.java +++ /dev/null @@ -1,37 +0,0 @@ -package buildcraft.api.core; - -import javax.annotation.Nonnull; - -import net.minecraft.nbt.NBTBase; -import net.minecraft.util.EnumFacing; - -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.CapabilityManager; - -public class CapabilitiesHelper { - public static void registerCapability(Class clazz) { - CapabilityManager.INSTANCE.register(clazz, new VoidStorage<>(), () -> { - throw new IllegalStateException("You must create your own instances!"); - }); - } - - @Nonnull - public static Capability ensureRegistration(Capability cap, Class clazz) { - if (cap == null) { - throw new Error("Capability registration failed for " + clazz); - } - return cap; - } - - public 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!"); - } - } -} 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/EnumHandlerPriority.java b/src/api/java/buildcraft/api/core/EnumHandlerPriority.java deleted file mode 100644 index 66145a2f5..000000000 --- a/src/api/java/buildcraft/api/core/EnumHandlerPriority.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2017 SpaceToad and the BuildCraft team - * 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; - -public enum EnumHandlerPriority implements Comparable { - HIGHEST, - HIGH, - NORMAL, - LOW, - LOWEST; - - public static final EnumHandlerPriority[] VALUES = values(); -} 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 3eb3731b0..000000000 --- a/src/api/java/buildcraft/api/core/EnumPipePart.java +++ /dev/null @@ -1,133 +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; - -public enum EnumPipePart implements IStringSerializable { - 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; - public static final EnumPipePart[] HORIZONTALS; - - 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); - } - FACES = fromFacingArray(EnumFacing.VALUES); - HORIZONTALS = fromFacingArray(EnumFacing.HORIZONTALS); - } - - private static EnumPipePart[] fromFacingArray(EnumFacing... faces) { - EnumPipePart[] arr = new EnumPipePart[faces.length]; - for (int i = 0; i < faces.length; i++) { - arr[i] = fromFacing(faces[i]); - } - return arr; - } - - 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]; - } - - 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.getOrDefault(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()); - } -} 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/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/IEngineType.java b/src/api/java/buildcraft/api/core/IEngineType.java deleted file mode 100644 index b8710961a..000000000 --- a/src/api/java/buildcraft/api/core/IEngineType.java +++ /dev/null @@ -1,5 +0,0 @@ -package buildcraft.api.core; - -public interface IEngineType { - String getItemModelLocation(); -} diff --git a/src/api/java/buildcraft/api/core/IFakePlayerProvider.java b/src/api/java/buildcraft/api/core/IFakePlayerProvider.java deleted file mode 100644 index c8bed734b..000000000 --- a/src/api/java/buildcraft/api/core/IFakePlayerProvider.java +++ /dev/null @@ -1,40 +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.util.math.BlockPos; -import net.minecraft.world.WorldServer; - -import net.minecraftforge.common.util.FakePlayer; - -public interface IFakePlayerProvider { - /** - * 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); - - /** - * @param world - * @param profile The owner's profile. - * @param pos - * @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, BlockPos pos); -} 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/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/IPlayerOwned.java b/src/api/java/buildcraft/api/core/IPlayerOwned.java deleted file mode 100644 index 8aa80fe4f..000000000 --- a/src/api/java/buildcraft/api/core/IPlayerOwned.java +++ /dev/null @@ -1,8 +0,0 @@ -package buildcraft.api.core; - -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/core/IStackFilter.java b/src/api/java/buildcraft/api/core/IStackFilter.java deleted file mode 100755 index 2c810c9f6..000000000 --- a/src/api/java/buildcraft/api/core/IStackFilter.java +++ /dev/null @@ -1,28 +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; -import net.minecraft.util.NonNullList; - -/** 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); - - /** - * Returns example stack to match this filter - */ - default NonNullList getExamples() { - return NonNullList.withSize(0, ItemStack.EMPTY); - } -} 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/InvalidInputDataException.java b/src/api/java/buildcraft/api/core/InvalidInputDataException.java deleted file mode 100644 index 866c36cb1..000000000 --- a/src/api/java/buildcraft/api/core/InvalidInputDataException.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2017 SpaceToad and the BuildCraft team - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not - * distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/ - */ - -package buildcraft.api.core; - -import java.io.IOException; - -/** - * Indicates that we failed to load from NBT or some other file. - */ -public class InvalidInputDataException extends IOException { - public InvalidInputDataException() { - } - - public InvalidInputDataException(String message) { - super(message); - } - - public InvalidInputDataException(Throwable cause) { - super(cause); - } - - public InvalidInputDataException(String message, Throwable cause) { - super(message, cause); - } -} 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/crops/CropManager.java b/src/api/java/buildcraft/api/crops/CropManager.java deleted file mode 100755 index 68a430201..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 845108fe0..000000000 --- a/src/api/java/buildcraft/api/crops/ICropHandler.java +++ /dev/null @@ -1,53 +0,0 @@ -package buildcraft.api.crops; - -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/data/NbtSquishConstants.java b/src/api/java/buildcraft/api/data/NbtSquishConstants.java deleted file mode 100644 index 942f0a8e4..000000000 --- a/src/api/java/buildcraft/api/data/NbtSquishConstants.java +++ /dev/null @@ -1,50 +0,0 @@ -package buildcraft.api.data; - -import java.util.zip.GZIPInputStream; - -import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; - -public class NbtSquishConstants { - /** Default written NBT Tag type- this is provided by - * {@link CompressedStreamTools#write(NBTTagCompound, java.io.DataOutput)} and - * {@link CompressedStreamTools#read(java.io.DataInput, net.minecraft.nbt.NBTSizeTracker)}. - * - * Generally more suited to smaller NBT tags, and it writes fairly quickly. Can quickly use up a lot of space for - * larger/more complex tags so it is recommended that you also pass it through a GZIP compressor to take up a much - * smaller space. */ - public static final int VANILLA = 0; - public static final int VANILLA_COMPRESSED = 1; - /** Buildcraft provided NBT compressor - puts every tag type into a dictionary and then refers to the dictionary for - * every tag which is written out. Can get much better space usage than {@link #VANILLA}, but at the cost of - * time. */ - public static final int BUILDCRAFT_V1 = 2; - public static final int BUILDCRAFT_V1_COMPRESSED = 3; - - public static final int BUILDCRAFT_MAGIC_1 = 0xbc; - public static final int BUILDCRAFT_MAGIC_2 = 0xa1; - /** The magic identifier for this type of file. First byte is BC, second is A1. */ - public static final int BUILDCRAFT_MAGIC = (BUILDCRAFT_MAGIC_1 << 8) | BUILDCRAFT_MAGIC_2; - - // GZIP uses the opposite byte order to us, so swap it around for us - public static final int GZIP_MAGIC_1 = GZIPInputStream.GZIP_MAGIC & 0xff; - public static final int GZIP_MAGIC_2 = GZIPInputStream.GZIP_MAGIC >> 8; - public static final int GZIP_MAGIC = (GZIP_MAGIC_1 << 8) | GZIP_MAGIC_2; - - // The flags used by BUILDCRAFT_V1 to check the existence of each dictionary - public static final int FLAG_HAS_BYTES = 1 << 0; - public static final int FLAG_HAS_SHORTS = 1 << 1; - public static final int FLAG_HAS_INTS = 1 << 2; - public static final int FLAG_HAS_LONGS = 1 << 3; - public static final int FLAG_HAS_FLOATS = 1 << 4; - public static final int FLAG_HAS_DOUBLES = 1 << 5; - public static final int FLAG_HAS_BYTE_ARRAYS = 1 << 6; - public static final int FLAG_HAS_INT_ARRAYS = 1 << 7; - public static final int FLAG_HAS_STRINGS = 1 << 8; - public static final int FLAG_HAS_COMPLEX = 1 << 9; - - // Complex types - public static final int COMPLEX_COMPOUND = 0; - public static final int COMPLEX_LIST = 1; - public static final int COMPLEX_LIST_PACKED = 2; -} 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 0a6b53feb..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; - - 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 38cdc62f7..000000000 --- a/src/api/java/buildcraft/api/enums/EnumEngineType.java +++ /dev/null @@ -1,39 +0,0 @@ -package buildcraft.api.enums; - -import net.minecraft.util.IStringSerializable; - -import buildcraft.api.core.IEngineType; - -public enum EnumEngineType implements IStringSerializable, IEngineType { - 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 getItemModelLocation() { - return resourceLocation; - } - - @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 7b7caf740..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 state.getValue(BuildCraftProperties.MACHINE_STATE); - } - - @Override - public String getName() { - return name(); - } -} diff --git a/src/api/java/buildcraft/api/enums/EnumOptionalSnapshotType.java b/src/api/java/buildcraft/api/enums/EnumOptionalSnapshotType.java deleted file mode 100644 index 283ca0b02..000000000 --- a/src/api/java/buildcraft/api/enums/EnumOptionalSnapshotType.java +++ /dev/null @@ -1,36 +0,0 @@ -package buildcraft.api.enums; - -import java.util.Locale; - -import net.minecraft.util.IStringSerializable; - -public enum EnumOptionalSnapshotType implements IStringSerializable { - NONE(null), - TEMPLATE(EnumSnapshotType.TEMPLATE), - BLUEPRINT(EnumSnapshotType.BLUEPRINT); - - public final EnumSnapshotType type; - - EnumOptionalSnapshotType(EnumSnapshotType type) { - this.type = type; - } - - public static EnumOptionalSnapshotType fromNullable(EnumSnapshotType type) { - if (type == null) { - return NONE; - } - switch (type) { - case TEMPLATE: - return TEMPLATE; - case BLUEPRINT: - return BLUEPRINT; - default: - return NONE; - } - } - - @Override - public String getName() { - return name().toLowerCase(Locale.ROOT); - } -} 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 95c648fe1..000000000 --- a/src/api/java/buildcraft/api/enums/EnumRedstoneChipset.java +++ /dev/null @@ -1,51 +0,0 @@ -package buildcraft.api.enums; - -import java.util.Locale; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IStringSerializable; - -import buildcraft.api.BCItems; - -public enum EnumRedstoneChipset implements IStringSerializable { - RED, - IRON, - GOLD, - QUARTZ, - DIAMOND; - - private final String name = name().toLowerCase(Locale.ROOT); - - public ItemStack getStack(int stackSize) { - Item chipset = BCItems.SILICON_REDSTONE_CHIPSET; - if (chipset == null) { - return ItemStack.EMPTY; - } - - 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]; - } - - @Override - public String getName() { - return name; - } -} diff --git a/src/api/java/buildcraft/api/enums/EnumSnapshotType.java b/src/api/java/buildcraft/api/enums/EnumSnapshotType.java deleted file mode 100644 index b3c21245c..000000000 --- a/src/api/java/buildcraft/api/enums/EnumSnapshotType.java +++ /dev/null @@ -1,12 +0,0 @@ -package buildcraft.api.enums; - -public enum EnumSnapshotType { - TEMPLATE(9), - BLUEPRINT(3); - - public final int maxPerTick; - - EnumSnapshotType(int maxPerTick) { - this.maxPerTick = maxPerTick; - } -} 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 21e4cf21c..000000000 --- a/src/api/java/buildcraft/api/enums/EnumSpring.java +++ /dev/null @@ -1,40 +0,0 @@ -package buildcraft.api.enums; - -import java.util.Locale; -import java.util.function.Supplier; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; -import net.minecraft.tileentity.TileEntity; -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; - public Supplier tileConstructor; - - private final String lowerCaseName = name().toLowerCase(Locale.ROOT); - - 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 ce4cb8f06..000000000 --- a/src/api/java/buildcraft/api/facades/FacadeAPI.java +++ /dev/null @@ -1,35 +0,0 @@ -package buildcraft.api.facades; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import net.minecraftforge.fml.common.event.FMLInterModComms; - -public final class FacadeAPI { - public static final String IMC_MOD_TARGET = "buildcrafttransport"; - public static final String IMC_FACADE_DISABLE = "facade_disable_block"; - public static final String IMC_FACADE_CUSTOM = "facade_custom_map_block_item"; - public static final String NBT_CUSTOM_BLOCK_REG_KEY = "block_registry_name"; - public static final String NBT_CUSTOM_BLOCK_META = "block_meta"; - public static final String NBT_CUSTOM_ITEM_STACK = "item_stack"; - - public static IFacadeItem facadeItem; - - private FacadeAPI() { - - } - - public static void disableBlock(Block block) { - FMLInterModComms.sendMessage(IMC_MOD_TARGET, IMC_FACADE_DISABLE, block.getRegistryName()); - } - - public static void mapStateToStack(IBlockState state, ItemStack stack) { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setString(NBT_CUSTOM_BLOCK_REG_KEY, state.getBlock().getRegistryName().toString()); - nbt.setInteger(NBT_CUSTOM_BLOCK_META, state.getBlock().getMetaFromState(state)); - nbt.setTag(NBT_CUSTOM_ITEM_STACK, stack.serializeNBT()); - FMLInterModComms.sendMessage(IMC_MOD_TARGET, IMC_FACADE_CUSTOM, nbt); - } -} 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 7f4362b49..000000000 --- a/src/api/java/buildcraft/api/facades/IFacadeItem.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.facades; - -import javax.annotation.Nonnull; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.item.ItemStack; - -public interface IFacadeItem { - FacadeType getFacadeType(@Nonnull ItemStack facade); - - @Nonnull - ItemStack getFacadeForBlock(IBlockState state); - - IBlockState[] getBlockStatesForFacade(@Nonnull 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 f81a863e0..000000000 --- a/src/api/java/buildcraft/api/fuels/ICoolant.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.fuels; - -import net.minecraftforge.fluids.FluidStack; - -public interface ICoolant { - boolean matchesFluid(FluidStack fluid); - - /** @param fluid - * @param heat - * @return 0 if the input fluid provides no cooling, or a value greater than 0 if it does. */ - float getDegreesCoolingPerMB(FluidStack fluid, 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 dfcf78b6d..000000000 --- a/src/api/java/buildcraft/api/fuels/ICoolantManager.java +++ /dev/null @@ -1,36 +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; - -public interface ICoolantManager { - ICoolant addCoolant(ICoolant coolant); - - ICoolant addCoolant(FluidStack fluid, float degreesCoolingPerMb); - - default ICoolant addCoolant(Fluid fluid, float degreesCoolingPerMb) { - return addCoolant(new FluidStack(fluid, 1), degreesCoolingPerMb); - } - - ISolidCoolant addSolidCoolant(ISolidCoolant solidCoolant); - - ISolidCoolant addSolidCoolant(ItemStack solid, FluidStack fluid, float multiplier); - - Collection getCoolants(); - - Collection getSolidCoolants(); - - ICoolant getCoolant(FluidStack fluid); - - float getDegreesPerMb(FluidStack fluid, float heat); - - 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 382eb2a28..000000000 --- a/src/api/java/buildcraft/api/fuels/IFuel.java +++ /dev/null @@ -1,18 +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.FluidStack; - -public interface IFuel { - /** @return The input fluid. The {@link FluidStack#amount} is ignored. */ - FluidStack 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 cb02063e0..000000000 --- a/src/api/java/buildcraft/api/fuels/IFuelManager.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.fuels; - -import java.util.Collection; - -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -public interface IFuelManager { - F addFuel(F fuel); - - IFuel addFuel(FluidStack fluid, long powerPerCycle, int totalBurningTime); - - default IFuel addFuel(Fluid fluid, long powerPerCycle, int totalBurningTime) { - return addFuel(new FluidStack(fluid, 1), powerPerCycle, totalBurningTime); - } - - /** @param residue The residue fluidstack, per bucket of the original fuel. */ - IDirtyFuel addDirtyFuel(FluidStack fuel, long powerPerCycle, int totalBurningTime, FluidStack residue); - - /** @param residue The residue fluidstack, per bucket of the original fuel. */ - default IDirtyFuel addDirtyFuel(Fluid fuel, long powerPerCycle, int totalBurningTime, FluidStack residue) { - return addDirtyFuel(new FluidStack(fuel, 1), powerPerCycle, totalBurningTime, residue); - } - - Collection getFuels(); - - IFuel getFuel(FluidStack fluid); - - 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/inventory/IItemTransactor.java b/src/api/java/buildcraft/api/inventory/IItemTransactor.java deleted file mode 100644 index 212d2e35f..000000000 --- a/src/api/java/buildcraft/api/inventory/IItemTransactor.java +++ /dev/null @@ -1,72 +0,0 @@ -package buildcraft.api.inventory; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; - -import buildcraft.api.core.IStackFilter; - -/** A simple way to define something that deals with item insertion and extraction, without caring about slots. */ -public interface IItemTransactor { - /** @param stack The stack to insert. Must not be null! - * @param allOrNone If true then either the entire stack will be used or none of it. - * @param simulate If true then the in-world state of this will not be changed. - * @return The overflow stack. Will be {@link ItemStack#EMPTY} if all of it was accepted. */ - @Nonnull - ItemStack insert(@Nonnull ItemStack stack, boolean allOrNone, boolean simulate); - - /** Similar to {@link #insert(ItemStack, boolean, boolean)} but probably be more efficient at inserting lots of - * items. - * - * @param stacks The stacks to insert. Must not be null! - * @param simulate If true then the in-world state of this will not be changed. - * @return The overflow stacks. Will be an empty list if all of it was accepted. */ - default NonNullList insert(NonNullList stacks, boolean simulate) { - NonNullList leftOver = NonNullList.create(); - for (ItemStack stack : stacks) { - ItemStack leftOverStack = insert(stack, false, simulate); - if (!leftOverStack.isEmpty()) { - leftOver.add(leftOverStack); - } - } - return leftOver; - } - - /** Extracts a number of items that match the given filter - * - * @param filter The filter that MUST be met by the extracted stack. Null means no filter - it can be any item. - * @param min The minimum number of items to extract, or 0 if not enough items can be extracted - * @param max The maximum number of items to extract. - * @param simulate If true then the in-world state of this will not be changed. - * @return The stack that was extracted, or {@link ItemStack#EMPTY} if it could not be. */ - @Nonnull - ItemStack extract(@Nullable IStackFilter filter, int min, int max, boolean simulate); - - default boolean canFullyAccept(@Nonnull ItemStack stack) { - return insert(stack, true, true).isEmpty(); - } - - default boolean canPartiallyAccept(@Nonnull ItemStack stack) { - return insert(stack, false, true).getCount() < stack.getCount(); - } - - @FunctionalInterface - interface IItemInsertable extends IItemTransactor { - @Nonnull - @Override - default ItemStack extract(IStackFilter filter, int min, int max, boolean simulate) { - return ItemStack.EMPTY; - } - } - - @FunctionalInterface - interface IItemExtractable extends IItemTransactor { - @Nonnull - @Override - default ItemStack insert(@Nonnull ItemStack stack, boolean allOrNone, boolean simulate) { - return 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 cb5dba538..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 { - 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 b8997930a..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 38a916694..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 e1fbfb48f..000000000 --- a/src/api/java/buildcraft/api/mj/ILaserTarget.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.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 The amount of power this target currently needs. - * - * @return The amount of power required, or 0 if no power is required. */ - long getRequiredLaserPower(); - - /** Transfers power from the laser to the target. - * - * @param microJoules The number of micro Minecraft Joules to accept - * @return The excess power. If the input is less than or equal to {@link #getRequiredLaserPower()} then this will return 0. */ - long 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 a8cecd7d4..000000000 --- a/src/api/java/buildcraft/api/mj/IMjReceiver.java +++ /dev/null @@ -1,30 +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). - *
- * - * Note that callers are NOT expected to call {@link #canReceive()} before calling this - implementors should check - * all of the conditions in {@link #canReceive()} before accepting power. - * - * @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); - - /** Checks to see if {@link #receivePower(long, boolean)} *might* accept any power right now, ignoring the amount of - * power contained right now (if any). - * - * @return True if this {@link IMjReceiver} can receive power right now. */ - default boolean canReceive() { - return true; - } -} 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 87d74e897..000000000 --- a/src/api/java/buildcraft/api/mj/MjAPI.java +++ /dev/null @@ -1,119 +0,0 @@ -package buildcraft.api.mj; - -import java.text.DecimalFormat; - -import javax.annotation.Nonnull; - -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 buildcraft.api.core.CapabilitiesHelper; - -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 IMjEffectManager EFFECT_MANAGER = NullaryEffectManager.INSTANCE; - - // ############### - // - // 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); - } - - private static String formatMjInternal(double val) { - return MJ_DISPLAY_FORMAT.format(val); - } - - // ######################################## - // - // 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 - - // ############### - // - // 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; - - // #################### - // - // 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 { - CapabilitiesHelper.registerCapability(IMjConnector.class); - CapabilitiesHelper.registerCapability(IMjReceiver.class); - CapabilitiesHelper.registerCapability(IMjRedstoneReceiver.class); - CapabilitiesHelper.registerCapability(IMjReadable.class); - CapabilitiesHelper.registerCapability(IMjPassiveProvider.class); - - CAP_CONNECTOR = CapabilitiesHelper.ensureRegistration(CAP_CONNECTOR_FIRST, IMjConnector.class); - CAP_RECEIVER = CapabilitiesHelper.ensureRegistration(CAP_RECEIVER_FIRST, IMjReceiver.class); - CAP_REDSTONE_RECEIVER = CapabilitiesHelper.ensureRegistration(CAP_REDSTONE_RECEIVER_FIRST, IMjRedstoneReceiver.class); - CAP_READABLE = CapabilitiesHelper.ensureRegistration(CAP_READABLE_FIRST, IMjReadable.class); - CAP_PASSIVE_PROVIDER = CapabilitiesHelper.ensureRegistration(CAP_PASSIVE_PROVIDER_FIRST, IMjPassiveProvider.class); - } -} 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 68c2ea12e..000000000 --- a/src/api/java/buildcraft/api/mj/MjBattery.java +++ /dev/null @@ -1,116 +0,0 @@ -package buildcraft.api.mj; - -import io.netty.buffer.ByteBuf; - -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; - -/** 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 c70c74cb2..000000000 --- a/src/api/java/buildcraft/api/mj/MjCapabilityHelper.java +++ /dev/null @@ -1,61 +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(@Nonnull Capability capability, EnumFacing facing) { - return getCapability(capability, facing) != null; - } - - @Override - public T getCapability(@Nonnull Capability capability, EnumFacing facing) { - if (capability == MjAPI.CAP_CONNECTOR) { - return MjAPI.CAP_CONNECTOR.cast(connector); - } - if (capability == MjAPI.CAP_RECEIVER) { - return MjAPI.CAP_RECEIVER.cast(receiver); - } - if (capability == MjAPI.CAP_REDSTONE_RECEIVER) { - return MjAPI.CAP_REDSTONE_RECEIVER.cast(rsReceiver); - } - if (capability == MjAPI.CAP_READABLE) { - return MjAPI.CAP_READABLE.cast(readable); - } - if (capability == MjAPI.CAP_PASSIVE_PROVIDER) { - return MjAPI.CAP_PASSIVE_PROVIDER.cast(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 8afa7544e..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 a player - * formatter {@link buildcraft.api.mj.MjAPI#formatMj(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/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/BuildCraftProperties.java b/src/api/java/buildcraft/api/properties/BuildCraftProperties.java deleted file mode 100755 index 63a519ad0..000000000 --- a/src/api/java/buildcraft/api/properties/BuildCraftProperties.java +++ /dev/null @@ -1,88 +0,0 @@ -package buildcraft.api.properties; - -import java.util.Map; - -import com.google.common.collect.Maps; - -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.properties.PropertyBool; -import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.properties.PropertyInteger; -import net.minecraft.item.EnumDyeColor; -import net.minecraft.util.EnumFacing; - -import buildcraft.api.enums.EnumDecoratedBlock; -import buildcraft.api.enums.EnumEngineType; -import buildcraft.api.enums.EnumFillerPattern; -import buildcraft.api.enums.EnumLaserTableType; -import buildcraft.api.enums.EnumMachineState; -import buildcraft.api.enums.EnumOptionalSnapshotType; -import buildcraft.api.enums.EnumPowerStage; -import buildcraft.api.enums.EnumSpring; - -public final class BuildCraftProperties { - public static final IProperty BLOCK_FACING = PropertyEnum.create("facing", EnumFacing.class, EnumFacing.Plane.HORIZONTAL.facings()); - public static final IProperty BLOCK_FACING_6 = PropertyEnum.create("facing", EnumFacing.class); - - public static final IProperty BLOCK_COLOR = PropertyEnum.create("color", EnumDyeColor.class); - public static final IProperty SPRING_TYPE = PropertyEnum.create("type", EnumSpring.class); - public static final IProperty ENGINE_TYPE = PropertyEnum.create("type", EnumEngineType.class); - public static final IProperty LASER_TABLE_TYPE = PropertyEnum.create("type", EnumLaserTableType.class); - public static final IProperty MACHINE_STATE = PropertyEnum.create("state", EnumMachineState.class); - public static final IProperty ENERGY_STAGE = PropertyEnum.create("stage", EnumPowerStage.class); - public static final IProperty SNAPSHOT_TYPE = PropertyEnum.create("snapshot_type", EnumOptionalSnapshotType.class); - public static final IProperty DECORATED_BLOCK = PropertyEnum.create("decoration_type", EnumDecoratedBlock.class); - - public static final IProperty GENERIC_PIPE_DATA = PropertyInteger.create("pipe_data", 0, 15); - public static final IProperty LED_POWER = PropertyInteger.create("led_power", 0, 3); - - public static final IProperty JOINED_BELOW = PropertyBool.create("joined_below"); - public static final IProperty MOVING = PropertyBool.create("moving"); - public static final IProperty LED_DONE = PropertyBool.create("led_done"); - public static final IProperty ACTIVE = PropertyBool.create("active"); - public static final IProperty VALID = PropertyBool.create("valid"); - - public static final IProperty CONNECTED_UP = PropertyBool.create("connected_up"); - public static final IProperty CONNECTED_DOWN = PropertyBool.create("connected_down"); - public static final IProperty CONNECTED_EAST = PropertyBool.create("connected_east"); - public static final IProperty CONNECTED_WEST = PropertyBool.create("connected_west"); - public static final IProperty CONNECTED_NORTH = PropertyBool.create("connected_north"); - public static final IProperty CONNECTED_SOUTH = PropertyBool.create("connected_south"); - - public static final Map> CONNECTED_MAP; - - public static final IProperty FILLER_PATTERN = PropertyEnum.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/recipes/AssemblyRecipe.java b/src/api/java/buildcraft/api/recipes/AssemblyRecipe.java deleted file mode 100755 index 44a2b01ff..000000000 --- a/src/api/java/buildcraft/api/recipes/AssemblyRecipe.java +++ /dev/null @@ -1,72 +0,0 @@ -package buildcraft.api.recipes; - -import java.util.Set; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.google.common.collect.ImmutableSet; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ResourceLocation; - -import buildcraft.api.core.BuildCraftAPI; - -/** Provides an immutable assembly recipe */ -public final class AssemblyRecipe implements Comparable { - public final ResourceLocation name; - public final long requiredMicroJoules; - public final ImmutableSet requiredStacks; - public final @Nonnull ItemStack output; - /** - * Additional tag used to restore network-transmitted recipe to same state.
- * You need to register own {@link IAssemblyRecipeProvider} using {@link IAssemblyRecipeRegistry#addRecipeProvider(IAssemblyRecipeProvider)} - * to handle this and declare {@link IAssemblyRecipeProvider#getRecipe(ResourceLocation, NBTTagCompound)} method - */ - public final @Nullable NBTTagCompound recipeTag; - - public AssemblyRecipe(ResourceLocation name, long requiredMicroJoules, Set requiredStacks, @Nonnull ItemStack output, @Nullable NBTTagCompound recipeTag) { - this.name = name; - this.requiredMicroJoules = requiredMicroJoules; - this.requiredStacks = ImmutableSet.copyOf(requiredStacks); - this.output = output; - this.recipeTag = recipeTag; - } - - public AssemblyRecipe(String name, long requiredMicroJoules, Set requiredStacks, @Nonnull ItemStack output, @Nullable NBTTagCompound recipeTag) { - this(BuildCraftAPI.nameToResourceLocation(name), requiredMicroJoules, requiredStacks, output, recipeTag); - } - - public AssemblyRecipe(ResourceLocation name, long requiredMicroJoules, Set requiredStacks, @Nonnull ItemStack output) { - this(name, requiredMicroJoules, requiredStacks, output, null); - } - - public AssemblyRecipe(String name, long requiredMicroJoules, Set requiredStacks, @Nonnull ItemStack output) { - this(name, requiredMicroJoules, requiredStacks, output, null); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - AssemblyRecipe that = (AssemblyRecipe) o; - - return name.equals(that.name); - } - - @Override - public int hashCode() { - return name.hashCode(); - } - - @Override - public int compareTo(AssemblyRecipe o) { - return name.toString().compareTo(o.name.toString()); - } -} 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 1c074e9db..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 IRefineryRecipeManager refineryRecipes; - - 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 f98567653..000000000 --- a/src/api/java/buildcraft/api/recipes/IAssemblyRecipeProvider.java +++ /dev/null @@ -1,32 +0,0 @@ -package buildcraft.api.recipes; - -import java.util.List; -import java.util.Optional; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.NonNullList; -import net.minecraft.util.ResourceLocation; - -/** 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 - * IRecipeViewable. */ -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 possible); - - /** - * Returns recipe by it's name - * @param recipeTag Additional tag attached to network-transmitted recipe definition - */ - default Optional getRecipe(@Nonnull ResourceLocation name, @Nullable NBTTagCompound recipeTag) { - return Optional.empty(); - } -} 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/IIntegrationRecipeProvider.java b/src/api/java/buildcraft/api/recipes/IIntegrationRecipeProvider.java deleted file mode 100755 index 5c3d6446f..000000000 --- a/src/api/java/buildcraft/api/recipes/IIntegrationRecipeProvider.java +++ /dev/null @@ -1,32 +0,0 @@ -package buildcraft.api.recipes; - -import java.util.Optional; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.NonNullList; -import net.minecraft.util.ResourceLocation; - -/** 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); - - /** - * Returns recipe by it's name - * @param recipeTag Additional tag attached to network-transmitted recipe definition - */ - default Optional getRecipe(@Nonnull ResourceLocation name, @Nullable NBTTagCompound recipeTag) { - return Optional.empty(); - } -} 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/IRefineryRecipeManager.java b/src/api/java/buildcraft/api/recipes/IRefineryRecipeManager.java deleted file mode 100644 index 65b523bd8..000000000 --- a/src/api/java/buildcraft/api/recipes/IRefineryRecipeManager.java +++ /dev/null @@ -1,81 +0,0 @@ -package buildcraft.api.recipes; - -import java.util.Collection; -import java.util.function.Predicate; -import java.util.stream.Stream; - -import javax.annotation.Nullable; - -import net.minecraftforge.fluids.FluidStack; - -public interface IRefineryRecipeManager { - IHeatableRecipe createHeatingRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo); - - default IHeatableRecipe addHeatableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo) { - return getHeatableRegistry().addRecipe(createHeatingRecipe(in, out, heatFrom, heatTo)); - } - - ICoolableRecipe createCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo); - - default ICoolableRecipe addCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo) { - return getCoolableRegistry().addRecipe(createCoolableRecipe(in, out, heatFrom, heatTo)); - } - - IDistillationRecipe createDistillationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired); - - default IDistillationRecipe addDistillationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, long powerRequired) { - return getDistillationRegistry().addRecipe(createDistillationRecipe(in, outGas, outLiquid, powerRequired)); - } - - IRefineryRegistry getHeatableRegistry(); - - IRefineryRegistry getCoolableRegistry(); - - IRefineryRegistry getDistillationRegistry(); - - interface IRefineryRegistry { - /** @return an unmodifiable collection containing all of the distillation recipes that satisfy the given - * predicate. All of the recipe objects are guaranteed to never be null. */ - Stream getRecipes(Predicate toReturn); - - /** @return an unmodifiable set containing all of the distillation recipes. */ - Collection getAllRecipes(); - - @Nullable - R getRecipeForInput(@Nullable FluidStack fluid); - - Collection removeRecipes(Predicate toRemove); - - /** Adds the given recipe to the registry. Note that this will remove any existing recipes for the passed - * recipe's {@link IRefineryRecipe#in()} - * - * @param recipe The recipe to add. - * @return The input recipe. */ - R addRecipe(R recipe); - } - - interface IRefineryRecipe { - FluidStack in(); - } - - interface IHeatExchangerRecipe extends IRefineryRecipe { - @Nullable - FluidStack out(); - - int heatFrom(); - - int heatTo(); - } - - interface IHeatableRecipe extends IHeatExchangerRecipe {} - - interface ICoolableRecipe extends IHeatExchangerRecipe {} - - interface IDistillationRecipe extends IRefineryRecipe { - long powerRequired(); - - FluidStack outGas(); - - FluidStack outLiquid(); - } -} 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 b2e36aad2..000000000 --- a/src/api/java/buildcraft/api/recipes/IntegrationRecipe.java +++ /dev/null @@ -1,68 +0,0 @@ -package buildcraft.api.recipes; - -import java.util.List; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.google.common.collect.ImmutableList; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ResourceLocation; - -import buildcraft.api.core.BuildCraftAPI; - -public final class IntegrationRecipe { - public final ResourceLocation name; - public final long requiredMicroJoules; - public final StackDefinition target; - public final ImmutableList toIntegrate; - public final @Nonnull ItemStack output; - /** - * Additional tag used to restore network-transmitted recipe to same state - * You need to register own {@link IIntegrationRecipeProvider} using {@link IIntegrationRecipeRegistry#addRecipeProvider(IIntegrationRecipeProvider)} - * to handle this and declare {@link IIntegrationRecipeProvider#getRecipe(ResourceLocation, NBTTagCompound)} method - */ - public final @Nullable NBTTagCompound recipeTag; - - public IntegrationRecipe(ResourceLocation name, long requiredMicroJoules, StackDefinition target, List toIntegrate, @Nonnull ItemStack output, @Nullable NBTTagCompound recipeTag) { - this.name = name; - this.requiredMicroJoules = requiredMicroJoules; - this.target = target; - this.toIntegrate = ImmutableList.copyOf(toIntegrate); - this.output = output; - this.recipeTag = recipeTag; - } - - public IntegrationRecipe(String name, long requiredMicroJoules, StackDefinition target, List toIntegrate, @Nonnull ItemStack output, @Nullable NBTTagCompound recipeTag) { - this(BuildCraftAPI.nameToResourceLocation(name), requiredMicroJoules, target, toIntegrate, output, recipeTag); - } - - public IntegrationRecipe(ResourceLocation name, long requiredMicroJoules, StackDefinition target, List toIntegrate, @Nonnull ItemStack output) { - this(name, requiredMicroJoules, target, toIntegrate, output, null); - } - - public IntegrationRecipe(String name, long requiredMicroJoules, StackDefinition target, List toIntegrate, @Nonnull ItemStack output) { - this(name, requiredMicroJoules, target, toIntegrate, output, null); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - IntegrationRecipe that = (IntegrationRecipe) o; - - return name.equals(that.name); - } - - @Override - public int hashCode() { - return name.hashCode(); - } -} diff --git a/src/api/java/buildcraft/api/recipes/StackDefinition.java b/src/api/java/buildcraft/api/recipes/StackDefinition.java deleted file mode 100644 index ae1a6b3b8..000000000 --- a/src/api/java/buildcraft/api/recipes/StackDefinition.java +++ /dev/null @@ -1,20 +0,0 @@ -package buildcraft.api.recipes; - -import buildcraft.api.core.IStackFilter; - -/** - * Stack definition for recipe input - */ -public final class StackDefinition { - public final IStackFilter filter; - public final int count; - - public StackDefinition(IStackFilter filter, int count) { - this.filter = filter; - this.count = count; - } - - public StackDefinition(IStackFilter filter) { - this(filter, 1); - } -} 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 d3237a018..000000000 --- a/src/api/java/buildcraft/api/robots/DockingStation.java +++ /dev/null @@ -1,227 +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.Arrays; - -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 was not the right length! (" + Arrays.toString(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 7c712c91f..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<>(); - aiRobotsByLegacyClassNames = new HashMap<>(); - resourceIdNames = new HashMap<>(); - resourceIdByNames = new HashMap<>(); - resourceIdLegacyClassNames = new HashMap<>(); - dockingStationNames = new HashMap<>(); - 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 constructor! 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 resourceIdClass) { - return resourceIdNames.get(resourceIdClass); - } - - 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/schematics/ISchematicBlock.java b/src/api/java/buildcraft/api/schematics/ISchematicBlock.java deleted file mode 100644 index 01475eb48..000000000 --- a/src/api/java/buildcraft/api/schematics/ISchematicBlock.java +++ /dev/null @@ -1,46 +0,0 @@ -package buildcraft.api.schematics; - -import java.util.List; -import java.util.Set; - -import javax.annotation.Nonnull; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.Rotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import net.minecraftforge.fluids.FluidStack; - -import buildcraft.api.core.InvalidInputDataException; - -public interface ISchematicBlock> { - void init(SchematicBlockContext context); - - boolean isAir(); - - @Nonnull - Set getRequiredBlockOffsets(); - - @Nonnull - List computeRequiredItems(SchematicBlockContext context); - - @Nonnull - List computeRequiredFluids(SchematicBlockContext context); - - S getRotated(Rotation rotation); - - boolean canBuild(World world, BlockPos blockPos); - - boolean build(World world, BlockPos blockPos); - - boolean buildWithoutChecks(World world, BlockPos blockPos); - - boolean isBuilt(World world, BlockPos blockPos); - - NBTTagCompound serializeNBT(); - - /** @throws InvalidInputDataException If the input data wasn't correct or didn't make sense. */ - void deserializeNBT(NBTTagCompound nbt) throws InvalidInputDataException; -} diff --git a/src/api/java/buildcraft/api/schematics/ISchematicEntity.java b/src/api/java/buildcraft/api/schematics/ISchematicEntity.java deleted file mode 100644 index 1f087ca68..000000000 --- a/src/api/java/buildcraft/api/schematics/ISchematicEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package buildcraft.api.schematics; - -import java.util.List; - -import javax.annotation.Nonnull; - -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.Rotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; - -import net.minecraftforge.fluids.FluidStack; - -import buildcraft.api.core.InvalidInputDataException; - -public interface ISchematicEntity> { - void init(SchematicEntityContext context); - - Vec3d getPos(); - - @Nonnull - List computeRequiredItems(SchematicEntityContext context); - - @Nonnull - List computeRequiredFluids(SchematicEntityContext context); - - S getRotated(Rotation rotation); - - Entity build(World world, BlockPos basePos); - - Entity buildWithoutChecks(World world, BlockPos basePos); - - NBTTagCompound serializeNBT(); - - /** @throws InvalidInputDataException If the input data wasn't correct or didn't make sense. */ - void deserializeNBT(NBTTagCompound nbt) throws InvalidInputDataException; -} diff --git a/src/api/java/buildcraft/api/schematics/SchematicBlockContext.java b/src/api/java/buildcraft/api/schematics/SchematicBlockContext.java deleted file mode 100644 index 0ca98532a..000000000 --- a/src/api/java/buildcraft/api/schematics/SchematicBlockContext.java +++ /dev/null @@ -1,33 +0,0 @@ -package buildcraft.api.schematics; - -import javax.annotation.Nonnull; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -public class SchematicBlockContext { - @Nonnull - public final World world; - @Nonnull - public final BlockPos basePos; - @Nonnull - public final BlockPos pos; - @Nonnull - public final IBlockState blockState; - @Nonnull - public final Block block; - - public SchematicBlockContext(@Nonnull World world, - @Nonnull BlockPos basePos, - @Nonnull BlockPos pos, - @Nonnull IBlockState blockState, - @Nonnull Block block) { - this.world = world; - this.basePos = basePos; - this.pos = pos; - this.blockState = blockState; - this.block = block; - } -} diff --git a/src/api/java/buildcraft/api/schematics/SchematicBlockFactory.java b/src/api/java/buildcraft/api/schematics/SchematicBlockFactory.java deleted file mode 100644 index e88d6cd4f..000000000 --- a/src/api/java/buildcraft/api/schematics/SchematicBlockFactory.java +++ /dev/null @@ -1,39 +0,0 @@ -package buildcraft.api.schematics; - -import java.util.function.Predicate; -import java.util.function.Supplier; - -import javax.annotation.Nonnull; - -import net.minecraft.util.ResourceLocation; - -public class SchematicBlockFactory> implements Comparable { - @Nonnull - public final ResourceLocation name; - public final int priority; - @Nonnull - public final Predicate predicate; - @Nonnull - public final Supplier supplier; - @Nonnull - public final Class clazz; - - @SuppressWarnings("unchecked") - public SchematicBlockFactory(@Nonnull ResourceLocation name, - int priority, - @Nonnull Predicate predicate, - @Nonnull Supplier supplier) { - this.name = name; - this.priority = priority; - this.predicate = predicate; - this.supplier = supplier; - clazz = (Class) supplier.get().getClass(); - } - - @Override - public int compareTo(@Nonnull SchematicBlockFactory o) { - return priority != o.priority - ? Integer.compare(priority, o.priority) - : name.toString().compareTo(o.name.toString()); - } -} diff --git a/src/api/java/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java b/src/api/java/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java deleted file mode 100644 index 541c2777e..000000000 --- a/src/api/java/buildcraft/api/schematics/SchematicBlockFactoryRegistry.java +++ /dev/null @@ -1,65 +0,0 @@ -package buildcraft.api.schematics; - -import java.util.List; -import java.util.Set; -import java.util.TreeSet; -import java.util.function.Predicate; -import java.util.function.Supplier; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.google.common.collect.ImmutableList; - -import net.minecraft.block.Block; -import net.minecraft.util.ResourceLocation; - -import buildcraft.api.core.BuildCraftAPI; - -public class SchematicBlockFactoryRegistry { - private static final Set> FACTORIES = new TreeSet<>(); - - public static > void registerFactory(String name, - int priority, - Predicate predicate, - Supplier supplier) { - FACTORIES.add(new SchematicBlockFactory<>( - BuildCraftAPI.nameToResourceLocation(name), - priority, - predicate, - supplier - )); - } - - public static > void registerFactory(String name, - int priority, - List blocks, - Supplier supplier) { - registerFactory( - name, - priority, - context -> blocks.contains(context.block), - supplier - ); - } - - public static List> getFactories() { - return ImmutableList.copyOf(FACTORIES); - } - - @Nonnull - public static SchematicBlockFactory getFactoryByInstance(ISchematicBlock instance) { - return FACTORIES.stream() - .filter(schematicBlockFactory -> schematicBlockFactory.clazz == instance.getClass()) - .findFirst() - .orElseThrow(() -> new IllegalStateException("Didn't find a factory for " + instance.getClass())); - } - - @Nullable - public static SchematicBlockFactory getFactoryByName(ResourceLocation name) { - return FACTORIES.stream() - .filter(schematicBlockFactory -> schematicBlockFactory.name.equals(name)) - .findFirst() - .orElse(null); - } -} diff --git a/src/api/java/buildcraft/api/schematics/SchematicEntityContext.java b/src/api/java/buildcraft/api/schematics/SchematicEntityContext.java deleted file mode 100644 index b812556a0..000000000 --- a/src/api/java/buildcraft/api/schematics/SchematicEntityContext.java +++ /dev/null @@ -1,24 +0,0 @@ -package buildcraft.api.schematics; - -import javax.annotation.Nonnull; - -import net.minecraft.entity.Entity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -public class SchematicEntityContext { - @Nonnull - public final World world; - @Nonnull - public final BlockPos basePos; - @Nonnull - public final Entity entity; - - public SchematicEntityContext(@Nonnull World world, - @Nonnull BlockPos basePos, - @Nonnull Entity entity) { - this.world = world; - this.basePos = basePos; - this.entity = entity; - } -} diff --git a/src/api/java/buildcraft/api/schematics/SchematicEntityFactory.java b/src/api/java/buildcraft/api/schematics/SchematicEntityFactory.java deleted file mode 100644 index 285f05819..000000000 --- a/src/api/java/buildcraft/api/schematics/SchematicEntityFactory.java +++ /dev/null @@ -1,39 +0,0 @@ -package buildcraft.api.schematics; - -import java.util.function.Predicate; -import java.util.function.Supplier; - -import javax.annotation.Nonnull; - -import net.minecraft.util.ResourceLocation; - -public class SchematicEntityFactory> implements Comparable { - @Nonnull - public final ResourceLocation name; - public final int priority; - @Nonnull - public final Predicate predicate; - @Nonnull - public final Supplier supplier; - @Nonnull - public final Class clazz; - - @SuppressWarnings("unchecked") - public SchematicEntityFactory(@Nonnull ResourceLocation name, - int priority, - @Nonnull Predicate predicate, - @Nonnull Supplier supplier) { - this.name = name; - this.priority = priority; - this.predicate = predicate; - this.supplier = supplier; - clazz = (Class) supplier.get().getClass(); - } - - @Override - public int compareTo(@Nonnull SchematicEntityFactory o) { - return priority != o.priority - ? Integer.compare(priority, o.priority) - : name.toString().compareTo(o.name.toString()); - } -} diff --git a/src/api/java/buildcraft/api/schematics/SchematicEntityFactoryRegistry.java b/src/api/java/buildcraft/api/schematics/SchematicEntityFactoryRegistry.java deleted file mode 100644 index 7bfc97cb0..000000000 --- a/src/api/java/buildcraft/api/schematics/SchematicEntityFactoryRegistry.java +++ /dev/null @@ -1,65 +0,0 @@ -package buildcraft.api.schematics; - -import java.util.List; -import java.util.Set; -import java.util.TreeSet; -import java.util.function.Predicate; -import java.util.function.Supplier; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.google.common.collect.ImmutableList; - -import net.minecraft.entity.EntityList; -import net.minecraft.util.ResourceLocation; - -import buildcraft.api.core.BuildCraftAPI; - -public class SchematicEntityFactoryRegistry { - private static final Set> FACTORIES = new TreeSet<>(); - - public static > void registerFactory(String name, - int priority, - Predicate predicate, - Supplier supplier) { - FACTORIES.add(new SchematicEntityFactory<>( - BuildCraftAPI.nameToResourceLocation(name), - priority, - predicate, - supplier - )); - } - - public static > void registerFactory(String name, - int priority, - List entities, - Supplier supplier) { - registerFactory( - name, - priority, - context -> entities.contains(EntityList.getKey(context.entity)), - supplier - ); - } - - public static List> getFactories() { - return ImmutableList.copyOf(FACTORIES); - } - - @Nonnull - public static SchematicEntityFactory getFactoryByInstance(ISchematicEntity instance) { - return FACTORIES.stream() - .filter(schematicEntityFactory -> schematicEntityFactory.clazz == instance.getClass()) - .findFirst() - .orElseThrow(() -> new IllegalStateException("Didn't find a factory for " + instance.getClass())); - } - - @Nullable - public static SchematicEntityFactory getFactoryByName(ResourceLocation name) { - return FACTORIES.stream() - .filter(schematicEntityFactory -> schematicEntityFactory.name.equals(name)) - .findFirst() - .orElse(null); - } -} 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 0dec933c1..000000000 --- a/src/api/java/buildcraft/api/statements/IGuiSlot.java +++ /dev/null @@ -1,21 +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 in-world (so this must be stitched into the block texture atlas), 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 e08a7e85b..000000000 --- a/src/api/java/buildcraft/api/statements/IStatementContainer.java +++ /dev/null @@ -1,18 +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.Nullable; - -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(); - - @Nullable - 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 9b1fd1e19..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 { - 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 1cd30f130..000000000 --- a/src/api/java/buildcraft/api/statements/StatementManager.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.statements; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -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 | 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 ad55c9909..000000000 --- a/src/api/java/buildcraft/api/statements/StatementParameterItemStack.java +++ /dev/null @@ -1,109 +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; - } - - @Nonnull - @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 3d669838f..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/template/ITemplateHandler.java b/src/api/java/buildcraft/api/template/ITemplateHandler.java deleted file mode 100644 index e0dac1bf8..000000000 --- a/src/api/java/buildcraft/api/template/ITemplateHandler.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2017 SpaceToad and the BuildCraft team - * 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.template; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -public interface ITemplateHandler { - boolean handle(World world, BlockPos pos, EntityPlayer player, ItemStack stack); -} diff --git a/src/api/java/buildcraft/api/template/ITemplateRegistry.java b/src/api/java/buildcraft/api/template/ITemplateRegistry.java deleted file mode 100644 index ec6d25049..000000000 --- a/src/api/java/buildcraft/api/template/ITemplateRegistry.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2017 SpaceToad and the BuildCraft team - * 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.template; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import buildcraft.api.core.EnumHandlerPriority; - -public interface ITemplateRegistry { - /** Adds a handler with a {@link EnumHandlerPriority} of {@linkplain EnumHandlerPriority#NORMAL} */ - default void addHandler(ITemplateHandler handler) { - addHandler(handler, EnumHandlerPriority.NORMAL); - } - - void addHandler(ITemplateHandler handler, EnumHandlerPriority priority); - - boolean handle(World world, BlockPos pos, EntityPlayer player, ItemStack stack); -} diff --git a/src/api/java/buildcraft/api/template/TemplateApi.java b/src/api/java/buildcraft/api/template/TemplateApi.java deleted file mode 100644 index 423c70eaf..000000000 --- a/src/api/java/buildcraft/api/template/TemplateApi.java +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (c) 2017 SpaceToad and the BuildCraft team - * 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.template; - -public class TemplateApi { - public static ITemplateRegistry templateRegistry; -} 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 ac9483635..000000000 --- a/src/api/java/buildcraft/api/tiles/IControllable.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.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 { - enum Mode { - ON, - OFF, - LOOP; - - public static final Mode[] VALUES = values(); - } - - /** Get the current control mode of the Tile Entity. - * - * @return */ - Mode getControlMode(); - - /** Set the mode of the Tile Entity. - * - * @param mode - * @return True if this control mode is accepted. */ - boolean setControlMode(Mode mode, boolean simulate); -} 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 d789ab564..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 maximum 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/TilesAPI.java b/src/api/java/buildcraft/api/tiles/TilesAPI.java deleted file mode 100644 index 38478d512..000000000 --- a/src/api/java/buildcraft/api/tiles/TilesAPI.java +++ /dev/null @@ -1,46 +0,0 @@ -package buildcraft.api.tiles; - -import javax.annotation.Nonnull; - -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.CapabilityInject; - -import buildcraft.api.core.CapabilitiesHelper; - -public class TilesAPI { - @Nonnull - public static final Capability CAP_CONTROLLABLE; - - @Nonnull - public static final Capability CAP_HAS_WORK; - - @Nonnull - public static final Capability CAP_HEATABLE; - - @Nonnull - public static final Capability CAP_TILE_AREA_PROVIDER; - - @CapabilityInject(IControllable.class) - private static final Capability CAP_CONTROLLABLE_FIRST = null; - - @CapabilityInject(IHasWork.class) - private static final Capability CAP_HAS_WORK_FIRST = null; - - @CapabilityInject(IHeatable.class) - private static final Capability CAP_HEATABLE_FIRST = null; - - @CapabilityInject(ITileAreaProvider.class) - private static final Capability CAP_TILE_AREA_PROVIDER_FIRST = null; - - static { - CapabilitiesHelper.registerCapability(IControllable.class); - CapabilitiesHelper.registerCapability(IHasWork.class); - CapabilitiesHelper.registerCapability(IHeatable.class); - CapabilitiesHelper.registerCapability(ITileAreaProvider.class); - - CAP_CONTROLLABLE = CapabilitiesHelper.ensureRegistration(CAP_CONTROLLABLE_FIRST, IControllable.class); - CAP_HAS_WORK = CapabilitiesHelper.ensureRegistration(CAP_HAS_WORK_FIRST, IHasWork.class); - CAP_HEATABLE = CapabilitiesHelper.ensureRegistration(CAP_HEATABLE_FIRST, IHeatable.class); - CAP_TILE_AREA_PROVIDER = CapabilitiesHelper.ensureRegistration(CAP_TILE_AREA_PROVIDER_FIRST, ITileAreaProvider.class); - } -} 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 f05ff8e44..000000000 --- a/src/api/java/buildcraft/api/transport/EnumWirePart.java +++ /dev/null @@ -1,81 +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.xCoord, center.yCoord, center.zCoord, edge.xCoord, - edge.yCoord, edge.zCoord); - } - - public AxisDirection getDirection(EnumFacing.Axis axis) { - switch (axis) { - case X: - return x; - case Y: - return y; - case Z: - return z; - default: - return null; - } - } - - public static EnumWirePart get(int x, int y, int z) { - boolean bx = (x % 2 + 2) % 2 == 1; - boolean by = (y % 2 + 2) % 2 == 1; - boolean bz = (z % 2 + 2) % 2 == 1; - return get(bx, by, bz); - } - - 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 2aeebd671..000000000 --- a/src/api/java/buildcraft/api/transport/IInjectable.java +++ /dev/null @@ -1,27 +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. */ -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 704318e67..000000000 --- a/src/api/java/buildcraft/api/transport/IItemPluggable.java +++ /dev/null @@ -1,24 +0,0 @@ -package buildcraft.api.transport; - -import javax.annotation.Nonnull; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; - -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 *definitely* 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, EntityPlayer player, EnumHand hand); -} 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 ae6980603..000000000 --- a/src/api/java/buildcraft/api/transport/IStripesRegistry.java +++ /dev/null @@ -1,41 +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; - -import buildcraft.api.core.EnumHandlerPriority; - -public interface IStripesRegistry { - /** Adds a handler with a {@link EnumHandlerPriority} of {@linkplain EnumHandlerPriority#NORMAL} */ - default void addHandler(IStripesHandlerItem handler) { - addHandler(handler, EnumHandlerPriority.NORMAL); - } - - void addHandler(IStripesHandlerItem handler, EnumHandlerPriority priority); - - /** Adds a handler with a {@link EnumHandlerPriority} of {@linkplain EnumHandlerPriority#NORMAL NORMAL} */ - default void addHandler(IStripesHandlerBlock handler) { - addHandler(handler, EnumHandlerPriority.NORMAL); - } - - void addHandler(IStripesHandlerBlock handler, EnumHandlerPriority 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); -} 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 d4ca9ab26..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.0f indicate that the pipe will not connect at all, and will render - * as it it was not connected. */ - 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 bded1911d..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/IFlowFluid.java +++ /dev/null @@ -1,30 +0,0 @@ -package buildcraft.api.transport.pipe; - -import net.minecraft.util.ActionResult; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; - -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.IFluidHandler; - -import buildcraft.api.core.IFluidFilter; -import buildcraft.api.core.IFluidHandlerAdv; - -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 {@link IFluidHandlerAdv} - * - * @param millibuckets - * @param from - * @param filter A filter to try and match fluids. - * @return The fluidstack extracted and inserted into the pipe. If {@link ActionResult#getType()} equals - * {@link EnumActionResult#PASS} then it means that the {@link IFluidHandler} didn't implement - * {@link IFluidHandlerAdv} and you should call the basic version, if you can. */ - ActionResult 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 1d2d37700..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 getDefinition(); -} 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 8f3d51e15..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); - - 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 f981c9ea2..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.VertexBuffer; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public interface IPipeBehaviourRenderer { - void render(B behaviour, double x, double y, double z, float partialTicks, VertexBuffer vb); -} diff --git a/src/api/java/buildcraft/api/transport/pipe/IPipeConnection.java b/src/api/java/buildcraft/api/transport/pipe/IPipeConnection.java 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 787f9e99d..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.VertexBuffer; - -public interface IPipeFlowRenderer { - /** @param flow The flow to render - * @param x - * @param y - * @param z - * @param vb The (optional) vertex buffer that you can render into. Note that you can still do GL stuff. */ - void render(F flow, double x, double y, double z, float partialTicks, VertexBuffer vb); -} diff --git a/src/api/java/buildcraft/api/transport/pipe/IPipeHolder.java b/src/api/java/buildcraft/api/transport/pipe/IPipeHolder.java deleted file mode 100755 index 9d75f8777..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/IPipeHolder.java +++ /dev/null @@ -1,108 +0,0 @@ -package buildcraft.api.transport.pipe; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -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 net.minecraftforge.common.capabilities.Capability; - -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(); - - @Nullable - PipePluggable getPluggable(EnumFacing side); - - @Nullable - TileEntity getNeighbourTile(EnumFacing side); - - @Nullable - IPipe getNeighbourPipe(EnumFacing side); - - /** Gets the given capability going outwards from the pipe. This will test the - * {@link PipePluggable#getInternalCapability(Capability)} first, and the look at the neighbouring tile. */ - @Nullable - T getCapabilityFromPipe(EnumFacing side, @Nonnull Capability capability); - - 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); - - 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; - } - } - - 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 7fffadd16..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeApi.java +++ /dev/null @@ -1,149 +0,0 @@ -package buildcraft.api.transport.pipe; - -import java.util.IdentityHashMap; -import java.util.Map; - -import javax.annotation.Nonnull; - -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.CapabilityInject; - -import buildcraft.api.core.CapabilitiesHelper; -import buildcraft.api.mj.MjAPI; -import buildcraft.api.transport.IInjectable; -import buildcraft.api.transport.IStripesRegistry; -import buildcraft.api.transport.pluggable.IPluggableRegistry; -import buildcraft.api.transport.pluggable.PipePluggable; - -/** 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 fluidInfoDefault = new FluidTransferInfo(20, 10); - - /** 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 PowerTransferInfo powerInfoDefault = PowerTransferInfo.createFromResistance(8 * MjAPI.MJ, MjAPI.MJ / 32, false); - - public static final Map fluidTransferData = new IdentityHashMap<>(); - public static final Map powerTransferData = new IdentityHashMap<>(); - - @Nonnull - public static final Capability CAP_PIPE_HOLDER; - - @Nonnull - public static final Capability CAP_PIPE; - - @Nonnull - public static final Capability CAP_PLUG; - - @Nonnull - public static final Capability CAP_INJECTABLE; - - public static FluidTransferInfo getFluidTransferInfo(PipeDefinition def) { - FluidTransferInfo info = fluidTransferData.get(def); - if (info == null) { - return fluidInfoDefault; - } else { - return info; - } - } - - public static PowerTransferInfo getPowerTransferInfo(PipeDefinition def) { - PowerTransferInfo info = powerTransferData.get(def); - if (info == null) { - return powerInfoDefault; - } else { - return info; - } - } - - public static class FluidTransferInfo { - /** Controls the maximum amount of fluid that can be transferred 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; - } - } - - public static class PowerTransferInfo { - public final long transferPerTick; - public final long lossPerTick; - /** The percentage resistance per tick. Should be a value between 0 and {@link MjAPI#MJ} */ - public final long resistancePerTick; - public final boolean isReceiver; - - /** Sets resistancePerTick to be equal to lossPerTick when full power is being transferred, scaling down to 0. - * - * @param transferPerTick - * @param lossPerTick - * @param isReceiver */ - public static PowerTransferInfo createFromLoss(long transferPerTick, long lossPerTick, boolean isReceiver) { - return new PowerTransferInfo(transferPerTick, lossPerTick, lossPerTick * MjAPI.MJ / transferPerTick, isReceiver); - } - - /** Sets lossPerTick to be equal to resistancePerTick when full power is being transferred. - * - * @param transferPerTick - * @param resistancePerTick - * @param isReceiver */ - public static PowerTransferInfo createFromResistance(long transferPerTick, long resistancePerTick, boolean isReceiver) { - return new PowerTransferInfo(transferPerTick, resistancePerTick, resistancePerTick * transferPerTick / MjAPI.MJ, isReceiver); - } - - public PowerTransferInfo(long transferPerTick, long lossPerTick, long resistancePerTick, boolean isReceiver) { - if (transferPerTick < 10) { - transferPerTick = 10; - } - this.transferPerTick = transferPerTick; - this.lossPerTick = lossPerTick; - this.resistancePerTick = resistancePerTick; - this.isReceiver = isReceiver; - } - } - - // Internals - - @CapabilityInject(IPipeHolder.class) - private static Capability capPipeHolder; - - @CapabilityInject(IPipe.class) - private static Capability capPipe; - - @CapabilityInject(PipePluggable.class) - private static Capability capPlug; - - @CapabilityInject(IInjectable.class) - private static Capability capInjectable; - - static { - CapabilitiesHelper.registerCapability(IPipe.class); - CapabilitiesHelper.registerCapability(IPipeHolder.class); - CapabilitiesHelper.registerCapability(IInjectable.class); - CapabilitiesHelper.registerCapability(PipePluggable.class); - - CAP_PIPE = CapabilitiesHelper.ensureRegistration(capPipe, IPipe.class); - CAP_PLUG = CapabilitiesHelper.ensureRegistration(capPlug, PipePluggable.class); - CAP_PIPE_HOLDER = CapabilitiesHelper.ensureRegistration(capPipeHolder, IPipeHolder.class); - CAP_INJECTABLE = CapabilitiesHelper.ensureRegistration(capInjectable, IInjectable.class); - } -} 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 2e919038f..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeBehaviour.java +++ /dev/null @@ -1,72 +0,0 @@ -package buildcraft.api.transport.pipe; - -import javax.annotation.Nonnull; - -import net.minecraft.entity.Entity; -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 onEntityCollide(Entity entity) {} - - public void onTick() {} - - @Override - public boolean hasCapability(@Nonnull Capability capability, EnumFacing facing) { - return getCapability(capability, facing) != null; - } - - @Override - public T getCapability(@Nonnull 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 987203442..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeConnectionAPI.java +++ /dev/null @@ -1,42 +0,0 @@ -package buildcraft.api.transport.pipe; - -import java.util.Map; - -import com.google.common.collect.Maps; - -import net.minecraft.block.Block; - -/** 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 = (world, pos, face, state) -> 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 6e223512d..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 actively 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 1c6935e5e..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeEvent.java +++ /dev/null @@ -1,41 +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 individual classes for information on if they can - * be cancelled, and what cancelling the event does. */ -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; - } - - /** Called after every event handler has received this pipe event, to pick up simple mistakes when implementing pipe - * event handlers. - * - * @return Null if there are no state errors, or a message containing information about what is wrong (although this - * may be incomplete) */ - public String checkStateForErrors() { - if (canceled & !canBeCancelled) { - return "Somehow cancelled an event that isn't marked as such!"; - } - return null; - } -} 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 e557bccfd..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeEventFluid.java +++ /dev/null @@ -1,225 +0,0 @@ -package buildcraft.api.transport.pipe; - -import java.util.Arrays; -import java.util.Collection; -import java.util.EnumSet; - -import javax.annotation.Nonnull; - -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 TryInsert extends PipeEventFluid { - public final EnumFacing from; - /** The incoming fluidstack. Currently changing this does nothing. */ - @Nonnull - public final FluidStack fluid; - - public TryInsert(IPipeHolder holder, IFlowFluid flow, EnumFacing from, @Nonnull FluidStack fluid) { - super(true, holder, flow); - this.from = from; - this.fluid = fluid; - } - } - - /** Fired after collecting the amounts of fluid that can be moved from each pipe part into the centre. */ - public static class PreMoveToCentre extends PipeEventFluid { - /** The fluid that is being moved. Future versions of BC *might* allow more than one fluid type per pipe, but - * for the moment the API doesn't allow pipes to do this. */ - public final FluidStack fluid; - - /** The maximum amount of fluid that the centre pipe could accept. */ - public final int totalAcceptable; - - /** Array of {@link EnumFacing#getIndex()} to the maximum amount of fluid that a given side can offer. DO NOT - * CHANGE THIS! */ - public final int[] totalOffered; - - // Used for checking the state - private final int[] totalOfferedCheck; - - /** Array of {@link EnumFacing#getIndex()} to the amount of fluid that the given side will actually offer to the - * centre. This should *never* be larger than */ - public final int[] actuallyOffered; - - public PreMoveToCentre(IPipeHolder holder, IFlowFluid flow, FluidStack fluid, int totalAcceptable, int[] totalOffered, int[] actuallyOffered) { - super(holder, flow); - this.fluid = fluid; - this.totalAcceptable = totalAcceptable; - this.totalOffered = totalOffered; - totalOfferedCheck = Arrays.copyOf(totalOffered, totalOffered.length); - this.actuallyOffered = actuallyOffered; - } - - @Override - public String checkStateForErrors() { - for (int i = 0; i < totalOffered.length; i++) { - if (totalOffered[i] != totalOfferedCheck[i]) { - return "Changed totalOffered"; - } - if (actuallyOffered[i] > totalOffered[i]) { - return "actuallyOffered[" + i + "](=" + actuallyOffered[i] + ") shouldn't be greater than totalOffered[" + i + "](=" + totalOffered[i] + ")"; - } - } - return super.checkStateForErrors(); - } - } - - /** Fired after {@link PreMoveToCentre} when all of the amounts have been totalled up. */ - public static class OnMoveToCentre extends PipeEventFluid { - /** The fluid that is being moved. Future versions of BC *might* allow more than one fluid type per pipe, but - * for the moment the API doesn't allow pipes to do this. */ - public final FluidStack fluid; - - public final int[] fluidLeavingSide; - public final int[] fluidEnteringCentre; - - // Used for checking the state maximums - private final int[] fluidLeaveCheck, fluidEnterCheck; - - public OnMoveToCentre(IPipeHolder holder, IFlowFluid flow, FluidStack fluid, int[] fluidLeavingSide, int[] fluidEnteringCentre) { - super(holder, flow); - this.fluid = fluid; - this.fluidLeavingSide = fluidLeavingSide; - this.fluidEnteringCentre = fluidEnteringCentre; - fluidLeaveCheck = Arrays.copyOf(fluidLeavingSide, fluidLeavingSide.length); - fluidEnterCheck = Arrays.copyOf(fluidEnteringCentre, fluidEnteringCentre.length); - } - - @Override - public String checkStateForErrors() { - for (int i = 0; i < fluidLeavingSide.length; i++) { - if (fluidLeavingSide[i] > fluidLeaveCheck[i]) { - return "fluidLeavingSide[" + i + "](=" + fluidLeavingSide[i] + ") shouldn't be bigger than its original value!(=" + fluidLeaveCheck[i] + ")"; - } - if (fluidEnteringCentre[i] > fluidEnterCheck[i]) { - return "fluidEnteringCentre[" + i + "](=" + fluidEnteringCentre[i] + ") shouldn't be bigger than its original value!(=" + fluidEnterCheck[i] + ")"; - } - if (fluidEnteringCentre[i] > fluidLeavingSide[i]) { - return "fluidEnteringCentre[" + i + "](=" + fluidEnteringCentre[i] + ") shouldn't be bigger than fluidLeavingSide[" + i + "](=" + fluidLeavingSide[i] + ")"; - } - } - return super.checkStateForErrors(); - } - } - - 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 15eaecaf5..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeEventHandler.java +++ /dev/null @@ -1,28 +0,0 @@ -package buildcraft.api.transport.pipe; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -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 omitted
- } - * - *
*/ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.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 ab33955d9..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeEventItem.java +++ /dev/null @@ -1,371 +0,0 @@ -package buildcraft.api.transport.pipe; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.EnumSet; -import java.util.List; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; - -import net.minecraft.entity.item.EntityItem; -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 { - private final EntityItem entity; - - public Drop(IPipeHolder holder, IFlowItems flow, EntityItem entity) { - super(holder, flow); - this.entity = entity; - } - - @Nonnull - public ItemStack getStack() { - ItemStack item = entity.getEntityItem(); - return item.isEmpty() ? ItemStack.EMPTY : item; - } - - public void setStack(ItemStack stack) { - if (stack == null) { - throw new NullPointerException("stack"); - } else if (stack.isEmpty()) { - entity.setEntityItemStack(ItemStack.EMPTY); - } else { - entity.setEntityItemStack(stack); - } - } - - public EntityItem getEntity() { - return this.entity; - } - } - - /** 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 EnumSet getAllPossibleDestinations() { - EnumSet set = EnumSet.noneOf(EnumFacing.class); - for (EnumSet e : orderedDestinations) { - set.addAll(e); - } - return set; - } - - 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; - /** The list of the destinations to try, in order. */ - @Nullable - 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 21f78937a..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 b941b4e73..000000000 --- a/src/api/java/buildcraft/api/transport/pipe/PipeFlow.java +++ /dev/null @@ -1,81 +0,0 @@ -package buildcraft.api.transport.pipe; - -import java.io.IOException; - -import javax.annotation.Nonnull; - -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, 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(@Nonnull Capability capability, EnumFacing facing) { - return getCapability(capability, facing) != null; - } - - @Override - public T getCapability(@Nonnull 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 916f4fe69..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.VertexBuffer; - -public interface IPlugDynamicRenderer

{ - void render(P plug, double x, double y, double z, float partialTicks, VertexBuffer vb); -} diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPluggableRegistry.java b/src/api/java/buildcraft/api/transport/pluggable/IPluggableRegistry.java 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 8ddb478bf..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/PipePluggable.java +++ /dev/null @@ -1,149 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import java.io.IOException; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.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.BlockPos; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.world.Explosion; -import net.minecraft.world.World; - -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 net.minecraftforge.fml.relauncher.SideOnly; - -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; - } - - /** Gets the {@link Capability} that is accessible from the pipe that this is attached to. - * - * @param cap - * @return */ - public T getInternalCapability(@Nonnull Capability cap) { - return null; - } - - /** Called whenever this pluggable is removed from the pipe. */ - public void onRemove() {} - - /** @param toDrop A list containing all the items to drop (so you should add your items to this list) * */ - public void getDrops(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; - } - - /** Called if the {@link IPluggableStaticBaker} returns quads with tint indexes set to - * data * 6 + key.side.ordinal(). "data" is passed in here as "tintIndex". - * - * @return The tint index to render the quad with, or -1 for default. */ - @SideOnly(Side.CLIENT) - public int getBlockColor(int tintIndex) { - return -1; - } - - /** PipePluggable version of - * {@link Block#canBeConnectedTo(net.minecraft.world.IBlockAccess, net.minecraft.util.math.BlockPos, EnumFacing)}. */ - public boolean canBeConnected() { - return false; - } - - /** PipePluggable version of - * {@link Block#isBlockSolid(net.minecraft.world.IBlockAccess, net.minecraft.util.math.BlockPos, EnumFacing)} */ - public boolean isSideSolid() { - return false; - } - - /** PipePluggable version of {@link Block#getExplosionResistance(World, BlockPos, Entity, Explosion)} */ - public float getExplosionResistance(@Nullable Entity exploder, Explosion explosion) { - return 0; - } - - public boolean canConnectToRedstone(@Nullable EnumFacing to) { - return false; - } -} 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 61884a668..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, @Nullable 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/generators/common/MekanismGenerators.java b/src/main/java/mekanism/generators/common/MekanismGenerators.java index 9e84541cf..23fa9e84c 100644 --- a/src/main/java/mekanism/generators/common/MekanismGenerators.java +++ b/src/main/java/mekanism/generators/common/MekanismGenerators.java @@ -1,5 +1,6 @@ package mekanism.generators.common; +import buildcraft.api.mj.MjAPI; import io.netty.buffer.ByteBuf; import java.io.IOException; @@ -107,7 +108,7 @@ public class MekanismGenerators implements IModule } } - BuildcraftFuelRegistry.fuel.addFuel(MekanismFluids.Ethene.getFluid(), 240, 40 * Fluid.BUCKET_VOLUME); + BuildcraftFuelRegistry.fuel.addFuel(MekanismFluids.Ethene.getFluid(), 240 * MjAPI.MJ, 40 * Fluid.BUCKET_VOLUME); } //Update the config-dependent recipes after the recipes have actually been added in the first place