├── .gitignore ├── .travis.yml ├── README.md ├── api └── buildcraft │ └── api │ ├── BCBlocks.java │ ├── BCItems.java │ ├── BCModules.java │ ├── IBuildCraftMod.java │ ├── blocks │ ├── CustomPaintHelper.java │ ├── CustomRotationHelper.java │ ├── ICustomPaintHandler.java │ ├── ICustomRotationHandler.java │ └── package-info.java │ ├── boards │ ├── IRedstoneBoard.java │ ├── RedstoneBoardNBT.java │ ├── RedstoneBoardRegistry.java │ ├── RedstoneBoardRobot.java │ ├── RedstoneBoardRobotNBT.java │ └── package-info.java │ ├── core │ ├── AreaProviders.java │ ├── BCDebugging.java │ ├── BCLog.java │ ├── BuildCraftAPI.java │ ├── CapabilitiesHelper.java │ ├── EnumColor.java │ ├── EnumHandlerPriority.java │ ├── EnumPipePart.java │ ├── EnumWireColour.java │ ├── IAreaProvider.java │ ├── IBox.java │ ├── IConvertable.java │ ├── IEngineType.java │ ├── IFakePlayerProvider.java │ ├── IFluidFilter.java │ ├── IFluidHandlerAdv.java │ ├── IInvSlot.java │ ├── IPathProvider.java │ ├── IPlayerOwned.java │ ├── IStackFilter.java │ ├── IWorldProperty.java │ ├── IZone.java │ ├── InvalidInputDataException.java │ ├── JavaTools.java │ ├── SafeTimeTracker.java │ ├── StackKey.java │ ├── package-info.java │ └── render │ │ └── ISprite.java │ ├── crops │ ├── CropManager.java │ ├── ICropHandler.java │ └── package-info.java │ ├── data │ └── NbtSquishConstants.java │ ├── enums │ ├── EnumDecoratedBlock.java │ ├── EnumEngineType.java │ ├── EnumLaserTableType.java │ ├── EnumMachineState.java │ ├── EnumOptionalSnapshotType.java │ ├── EnumPowerStage.java │ ├── EnumRedstoneChipset.java │ ├── EnumSnapshotType.java │ ├── EnumSpring.java │ └── package-info.java │ ├── events │ ├── BlockInteractionEvent.java │ ├── BlockPlacedDownEvent.java │ ├── PipePlacedEvent.java │ ├── RobotEvent.java │ ├── RobotPlacementEvent.java │ └── package-info.java │ ├── facades │ ├── FacadeAPI.java │ ├── FacadeType.java │ ├── IFacade.java │ ├── IFacadeItem.java │ ├── IFacadePhasedState.java │ ├── IFacadeRegistry.java │ ├── IFacadeState.java │ └── package-info.java │ ├── filler │ ├── FillerManager.java │ ├── IFilledTemplate.java │ ├── IFillerPattern.java │ ├── IFillerPatternShape.java │ ├── IFillerRegistry.java │ └── package-info.java │ ├── fuels │ ├── BuildcraftFuelRegistry.java │ ├── ICoolant.java │ ├── ICoolantManager.java │ ├── IFuel.java │ ├── IFuelManager.java │ ├── ISolidCoolant.java │ └── package-info.java │ ├── gates │ ├── IGate.java │ └── package-info.java │ ├── inventory │ ├── IItemHandlerFiltered.java │ └── IItemTransactor.java │ ├── items │ ├── FluidItemDrops.java │ ├── IItemCustomPipeRender.java │ ├── IItemFluidShard.java │ ├── IList.java │ ├── IMapLocation.java │ ├── INamedItem.java │ └── package-info.java │ ├── library │ ├── ILibraryTypeHandler.java │ ├── LibraryAPI.java │ ├── LibraryTypeHandler.java │ ├── LibraryTypeHandlerByteArray.java │ ├── LibraryTypeHandlerNBT.java │ └── package-info.java │ ├── lists │ ├── ListMatchHandler.java │ ├── ListRegistry.java │ └── package-info.java │ ├── mj │ ├── ILaserTarget.java │ ├── ILaserTargetBlock.java │ ├── IMjConnector.java │ ├── IMjEffectManager.java │ ├── IMjPassiveProvider.java │ ├── IMjReadable.java │ ├── IMjReceiver.java │ ├── IMjRedstoneReceiver.java │ ├── IMjToRfStatus.java │ ├── MjAPI.java │ ├── MjBattery.java │ ├── MjCapabilityHelper.java │ ├── MjRfConversion.java │ ├── MjToRfAutoConvertor.java │ └── package-info.java │ ├── power │ ├── IEngine.java │ ├── IRedstoneEngine.java │ └── package-info.java │ ├── properties │ └── BuildCraftProperties.java │ ├── recipes │ ├── AssemblyRecipe.java │ ├── AssemblyRecipeBasic.java │ ├── BuildcraftRecipeRegistry.java │ ├── IIntegrationRecipeProvider.java │ ├── IIntegrationRecipeRegistry.java │ ├── IRefineryRecipeManager.java │ ├── IngredientStack.java │ ├── IntegrationRecipe.java │ ├── StackDefinition.java │ └── package-info.java │ ├── registry │ ├── BuildCraftRegistryManager.java │ ├── EventBuildCraftReload.java │ ├── IReloadableRegistry.java │ ├── IReloadableRegistryManager.java │ └── IScriptableRegistry.java │ ├── robots │ ├── AIRobot.java │ ├── DockingStation.java │ ├── EntityRobotBase.java │ ├── IDockingStationProvider.java │ ├── IRequestProvider.java │ ├── IRobotOverlayItem.java │ ├── IRobotRegistry.java │ ├── IRobotRegistryProvider.java │ ├── ResourceId.java │ ├── ResourceIdBlock.java │ ├── ResourceIdRequest.java │ ├── RobotManager.java │ └── package-info.java │ ├── schematics │ ├── ISchematicBlock.java │ ├── ISchematicEntity.java │ ├── SchematicBlockContext.java │ ├── SchematicBlockFactory.java │ ├── SchematicBlockFactoryRegistry.java │ ├── SchematicEntityContext.java │ ├── SchematicEntityFactory.java │ └── SchematicEntityFactoryRegistry.java │ ├── statements │ ├── IAction.java │ ├── IActionExternal.java │ ├── IActionInternal.java │ ├── IActionInternalSided.java │ ├── IActionProvider.java │ ├── IActionReceptor.java │ ├── IActionSingle.java │ ├── IGuiSlot.java │ ├── IOverrideDefaultStatements.java │ ├── IStatement.java │ ├── IStatementContainer.java │ ├── IStatementParameter.java │ ├── ITrigger.java │ ├── ITriggerExternal.java │ ├── ITriggerExternalOverride.java │ ├── ITriggerInternal.java │ ├── ITriggerInternalSided.java │ ├── ITriggerProvider.java │ ├── StatementManager.java │ ├── StatementMouseClick.java │ ├── StatementParameterItemStack.java │ ├── StatementSlot.java │ ├── containers │ │ ├── IFillerStatementContainer.java │ │ ├── IRedstoneStatementContainer.java │ │ └── ISidedStatementContainer.java │ └── package-info.java │ ├── template │ ├── ITemplateHandler.java │ ├── ITemplateRegistry.java │ └── TemplateApi.java │ ├── tiles │ ├── IControllable.java │ ├── IDebuggable.java │ ├── IHasWork.java │ ├── IHeatable.java │ ├── ITileAreaProvider.java │ ├── TilesAPI.java │ └── package-info.java │ ├── tools │ ├── IToolWrench.java │ └── package-info.java │ └── transport │ ├── EnumWirePart.java │ ├── IInjectable.java │ ├── IItemPluggable.java │ ├── IStripesActivator.java │ ├── IStripesHandlerBlock.java │ ├── IStripesHandlerItem.java │ ├── IStripesRegistry.java │ ├── IWireEmitter.java │ ├── IWireManager.java │ ├── WireNode.java │ ├── package-info.java │ ├── pipe │ ├── EnumPipeColourType.java │ ├── ICustomPipeConnection.java │ ├── IFlowFluid.java │ ├── IFlowItems.java │ ├── IFlowPower.java │ ├── IFlowPowerLike.java │ ├── IFlowRedstoneFlux.java │ ├── IItemPipe.java │ ├── IPipe.java │ ├── IPipeBehaviourBaker.java │ ├── IPipeBehaviourRenderer.java │ ├── IPipeConnection.java │ ├── IPipeExtensionManager.java │ ├── IPipeFlowBaker.java │ ├── IPipeFlowRenderer.java │ ├── IPipeHolder.java │ ├── IPipeRegistry.java │ ├── PipeApi.java │ ├── PipeApiClient.java │ ├── PipeBehaviour.java │ ├── PipeConnectionAPI.java │ ├── PipeDefinition.java │ ├── PipeEvent.java │ ├── PipeEventActionActivate.java │ ├── PipeEventConnectionChange.java │ ├── PipeEventFluid.java │ ├── PipeEventHandler.java │ ├── PipeEventItem.java │ ├── PipeEventPower.java │ ├── PipeEventPriority.java │ ├── PipeEventRedstoneFlux.java │ ├── PipeEventStatement.java │ ├── PipeEventTileState.java │ ├── PipeFaceTex.java │ ├── PipeFlow.java │ └── PipeFlowType.java │ └── pluggable │ ├── IPlugDynamicRenderer.java │ ├── IPluggableRegistry.java │ ├── IPluggableStaticBaker.java │ ├── PipePluggable.java │ ├── PluggableDefinition.java │ └── PluggableModelKey.java ├── build.gradle ├── build.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── guidelines └── buildcraft.checkstyle └── resources └── LICENSE.API /.gitignore: -------------------------------------------------------------------------------- 1 | # eclipse 2 | bin 3 | *.launch 4 | .settings 5 | .metadata 6 | .classpath 7 | .project 8 | 9 | # idea 10 | out 11 | *.ipr 12 | *.iws 13 | *.iml 14 | .idea 15 | 16 | # gradle 17 | build 18 | .gradle 19 | 20 | # other 21 | eclipse 22 | run 23 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - openjdk8 4 | 5 | jobs: 6 | include: 7 | - stage: build 8 | install: ./gradlew setupCiWorkspace -S 9 | script: ./gradlew build 10 | - stage: checkstyle 11 | install: echo "skipping default ./gradlew assemble" 12 | script: ./gradlew checkstyle 13 | 14 | env: 15 | global: 16 | TERM=dumb 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BuildCraftAPI 2 | The API for BuildCraft. Versions 7.2.0 and above. 3 | -------------------------------------------------------------------------------- /api/buildcraft/api/BCBlocks.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api; 2 | 3 | import net.minecraft.block.Block; 4 | 5 | import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; 6 | 7 | public class BCBlocks { 8 | 9 | @ObjectHolder("buildcraftcore") 10 | public static class Core { 11 | public static final Block SPRING = null; 12 | public static final Block DECORATED = null; 13 | public static final Block ENGINE = null; 14 | public static final Block MARKER_VOLUME = null; 15 | public static final Block MARKER_PATH = null; 16 | } 17 | 18 | @ObjectHolder("buildcraftbuilders") 19 | public static class Builders { 20 | public static final Block ARCHITECT = null; 21 | public static final Block BUILDER = null; 22 | public static final Block FILLER = null; 23 | public static final Block LIBRARY = null; 24 | public static final Block REPLACER = null; 25 | public static final Block QUARRY = null; 26 | public static final Block FRAME = null; 27 | } 28 | 29 | @ObjectHolder("buildcraftenergy") 30 | public static class Energy { 31 | // Fluid blocks can be accessed ~somewhere else~ 32 | } 33 | 34 | @ObjectHolder("buildcraftfactory") 35 | public static class Factory { 36 | public static final Block AUTOWORKBENCH_ITEM = null; 37 | public static final Block MINING_WELL = null; 38 | public static final Block PUMP = null; 39 | public static final Block TUBE = null; 40 | public static final Block FLOOD_GATE = null; 41 | public static final Block TANK = null; 42 | public static final Block CHUTE = null; 43 | public static final Block WATER_GEL = null; 44 | public static final Block DISTILLER = null; 45 | public static final Block HEAT_EXCHANGE = null; 46 | } 47 | 48 | @ObjectHolder("buildcrafttransport") 49 | public static class Transport { 50 | public static final Block FILTERED_BUFFER = null; 51 | public static final Block PIPE_HOLDER = null; 52 | } 53 | 54 | @ObjectHolder("buildcraftsilicon") 55 | public static class Silicon { 56 | public static final Block LASER = null; 57 | public static final Block ASSEMBLY_TABLE = null; 58 | public static final Block ADVANCED_CRAFTING_TABLE = null; 59 | public static final Block INTEGRATION_TABLE = null; 60 | public static final Block CHARGING_TABLE = null; 61 | public static final Block PROGRAMMING_TABLE = null; 62 | } 63 | 64 | @ObjectHolder("buildcraftrobotics") 65 | public static class Robotics { 66 | 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /api/buildcraft/api/IBuildCraftMod.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api; 2 | 3 | /** Allows a mod (or addon) to register networking packets in the message manager. */ 4 | public interface IBuildCraftMod { 5 | /** @return The modid to use when registering this as a channel. */ 6 | String getModId(); 7 | } 8 | -------------------------------------------------------------------------------- /api/buildcraft/api/blocks/ICustomPaintHandler.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.blocks; 2 | 3 | import javax.annotation.Nullable; 4 | 5 | import net.minecraft.block.state.IBlockState; 6 | import net.minecraft.item.EnumDyeColor; 7 | import net.minecraft.util.EnumActionResult; 8 | import net.minecraft.util.EnumFacing; 9 | import net.minecraft.util.math.BlockPos; 10 | import net.minecraft.util.math.Vec3d; 11 | import net.minecraft.world.World; 12 | 13 | /** Provides a way to paint blocks from any position. You can either implement this on a block, or register an instance 14 | * for a block with {@link CustomPaintHelper} */ 15 | public interface ICustomPaintHandler { 16 | /** Attempts to paint the given block. This can also only paint a specific part of the block (as the hit position is 17 | * given). 18 | * 19 | * @param world The world that the block is contained within. 20 | * @param pos The position of the block. 21 | * @param state The current state of the block. 22 | * @param hitPos The absolute hit position of the paintbrush, relative the world's origin. 23 | * @param hitSide The side of the block that was hit. 24 | * @param paintColour The paint colour to attempt to paint with, null if the paint should be cleared (so if this was 25 | * a stained glass block, and null was passed, this would set it to a normal, clear, non-stained glass 26 | * block. 27 | * @return The result of attempting to paint. SUCCESS means that you changed the block from before to a new value, 28 | * FAIL means you COULD have handled the block, but it was already painted to that colour, or PASS if you 29 | * have no idea how to handle the block in question. */ 30 | EnumActionResult attemptPaint(World world, BlockPos pos, IBlockState state, Vec3d hitPos, @Nullable EnumFacing hitSide, @Nullable EnumDyeColor paintColour); 31 | } 32 | -------------------------------------------------------------------------------- /api/buildcraft/api/blocks/ICustomRotationHandler.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.blocks; 2 | 3 | import net.minecraft.block.state.IBlockState; 4 | import net.minecraft.util.EnumActionResult; 5 | import net.minecraft.util.EnumFacing; 6 | import net.minecraft.util.math.BlockPos; 7 | import net.minecraft.world.World; 8 | 9 | public interface ICustomRotationHandler { 10 | EnumActionResult attemptRotation(World world, BlockPos pos, IBlockState state, EnumFacing sideWrenched); 11 | } 12 | -------------------------------------------------------------------------------- /api/buildcraft/api/blocks/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "1.0", owner = "buildcraftapi_core", provides = "buildcraftapi_blocks") 6 | package buildcraft.api.blocks; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/boards/IRedstoneBoard.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.boards; 6 | 7 | public interface IRedstoneBoard { 8 | 9 | void updateBoard(T container); 10 | 11 | RedstoneBoardNBT getNBTHandler(); 12 | } 13 | -------------------------------------------------------------------------------- /api/buildcraft/api/boards/RedstoneBoardNBT.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.boards; 6 | 7 | import java.util.List; 8 | import java.util.Random; 9 | 10 | import net.minecraft.entity.player.EntityPlayer; 11 | import net.minecraft.item.ItemStack; 12 | import net.minecraft.nbt.NBTTagCompound; 13 | 14 | import net.minecraftforge.common.util.Constants; 15 | 16 | public abstract class RedstoneBoardNBT { 17 | 18 | private static Random rand = new Random(); 19 | 20 | public abstract String getID(); 21 | 22 | public abstract void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced); 23 | 24 | public abstract String getDisplayName(); 25 | 26 | public abstract IRedstoneBoard create(NBTTagCompound nbt, T object); 27 | 28 | public abstract String getItemModelLocation(); 29 | 30 | public void createBoard(NBTTagCompound nbt) { 31 | nbt.setString("id", getID()); 32 | } 33 | 34 | public int getParameterNumber(NBTTagCompound nbt) { 35 | if (!nbt.hasKey("parameters")) { 36 | return 0; 37 | } else { 38 | return nbt.getTagList("parameters", Constants.NBT.TAG_COMPOUND).tagCount(); 39 | } 40 | } 41 | 42 | public float nextFloat(int difficulty) { 43 | return 1F - (float) Math.pow(rand.nextFloat(), 1F / difficulty); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /api/buildcraft/api/boards/RedstoneBoardRegistry.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.boards; 6 | 7 | import java.util.Collection; 8 | 9 | import net.minecraft.nbt.NBTTagCompound; 10 | 11 | public abstract class RedstoneBoardRegistry { 12 | 13 | public static RedstoneBoardRegistry instance; 14 | 15 | /** Register a redstone board type. 16 | * 17 | * @param redstoneBoardNBT The RedstoneBoardNBT instance containing the board information. 18 | * @param microJoules MJ price of the board, in micro MJ. */ 19 | public abstract void registerBoardType(RedstoneBoardNBT redstoneBoardNBT, long microJoules); 20 | 21 | public abstract void setEmptyRobotBoard(RedstoneBoardRobotNBT redstoneBoardNBT); 22 | 23 | public abstract RedstoneBoardRobotNBT getEmptyRobotBoard(); 24 | 25 | public abstract RedstoneBoardNBT getRedstoneBoard(NBTTagCompound nbt); 26 | 27 | public abstract RedstoneBoardNBT getRedstoneBoard(String id); 28 | 29 | public abstract Collection> getAllBoardNBTs(); 30 | 31 | public abstract long getPowerCost(RedstoneBoardNBT board); 32 | } 33 | -------------------------------------------------------------------------------- /api/buildcraft/api/boards/RedstoneBoardRobot.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.boards; 6 | 7 | import buildcraft.api.robots.AIRobot; 8 | import buildcraft.api.robots.EntityRobotBase; 9 | 10 | public abstract class RedstoneBoardRobot extends AIRobot implements IRedstoneBoard { 11 | 12 | public RedstoneBoardRobot(EntityRobotBase iRobot) { 13 | super(iRobot); 14 | } 15 | 16 | @Override 17 | public abstract RedstoneBoardRobotNBT getNBTHandler(); 18 | 19 | @Override 20 | public final void updateBoard(EntityRobotBase container) { 21 | 22 | } 23 | 24 | @Override 25 | public boolean canLoadFromNBT() { 26 | return true; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /api/buildcraft/api/boards/RedstoneBoardRobotNBT.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.boards; 6 | 7 | import net.minecraft.nbt.NBTTagCompound; 8 | import net.minecraft.util.ResourceLocation; 9 | 10 | import buildcraft.api.robots.EntityRobotBase; 11 | 12 | public abstract class RedstoneBoardRobotNBT extends RedstoneBoardNBT { 13 | 14 | @Override 15 | public RedstoneBoardRobot create(NBTTagCompound nbt, EntityRobotBase robot) { 16 | return create(robot); 17 | } 18 | 19 | public abstract RedstoneBoardRobot create(EntityRobotBase robot); 20 | 21 | public abstract ResourceLocation getRobotTexture(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /api/buildcraft/api/boards/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "2.0", owner = "buildcraftapi_core", provides = "buildcraftapi_boards") 6 | package buildcraft.api.boards; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/AreaProviders.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.core; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import net.minecraft.util.math.BlockPos; 7 | import net.minecraft.world.World; 8 | 9 | public class AreaProviders { 10 | public static final List providers = new ArrayList<>(); 11 | 12 | public interface IAreaProviderGetter { 13 | /** @return All of the {@link IAreaProvider}'s that contain the specified block psoition. */ 14 | List getAreaProviders(World world, BlockPos at); 15 | } 16 | 17 | public static List getAreaProviders(World world, BlockPos at) { 18 | List list = new ArrayList<>(); 19 | for (IAreaProviderGetter getter : providers) { 20 | list.addAll(getter.getAreaProviders(world, at)); 21 | } 22 | return list; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/BCLog.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.core; 6 | 7 | import org.apache.logging.log4j.Level; 8 | import org.apache.logging.log4j.LogManager; 9 | import org.apache.logging.log4j.Logger; 10 | 11 | public final class BCLog { 12 | public static final Logger logger = LogManager.getLogger("BuildCraft"); 13 | 14 | /** Deactivate constructor */ 15 | private BCLog() {} 16 | 17 | @Deprecated 18 | public static void logErrorAPI(String mod, Throwable error, Class classFile) { 19 | logErrorAPI(error, classFile); 20 | } 21 | 22 | public static void logErrorAPI(Throwable error, Class classFile) { 23 | StringBuilder msg = new StringBuilder("API error! Please update your mods. Error: "); 24 | msg.append(error); 25 | StackTraceElement[] stackTrace = error.getStackTrace(); 26 | if (stackTrace.length > 0) { 27 | msg.append(", ").append(stackTrace[0]); 28 | } 29 | 30 | logger.log(Level.ERROR, msg.toString()); 31 | 32 | if (classFile != null) { 33 | msg.append("API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain() 34 | .getCodeSource().getLocation()); 35 | logger.log(Level.ERROR, msg.toString()); 36 | } 37 | } 38 | 39 | @Deprecated 40 | public static String getVersion() { 41 | return BuildCraftAPI.getVersion(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/BuildCraftAPI.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.core; 6 | 7 | import java.util.HashMap; 8 | import java.util.Set; 9 | 10 | import com.google.common.collect.Maps; 11 | import com.google.common.collect.Sets; 12 | 13 | import net.minecraft.block.Block; 14 | import net.minecraft.util.ResourceLocation; 15 | import net.minecraft.util.math.BlockPos; 16 | import net.minecraft.world.World; 17 | 18 | import net.minecraftforge.fml.common.Loader; 19 | import net.minecraftforge.fml.common.ModContainer; 20 | 21 | public final class BuildCraftAPI { 22 | public static IFakePlayerProvider fakePlayerProvider; 23 | 24 | public static final Set softBlocks = Sets.newHashSet(); 25 | public static final HashMap worldProperties = Maps.newHashMap(); 26 | 27 | /** Deactivate constructor */ 28 | private BuildCraftAPI() {} 29 | 30 | public static String getVersion() { 31 | ModContainer container = Loader.instance().getIndexedModList().get("buildcraftlib"); 32 | if (container != null) { 33 | return container.getDisplayVersion(); 34 | } 35 | return "UNKNOWN VERSION"; 36 | } 37 | 38 | public static IWorldProperty getWorldProperty(String name) { 39 | return worldProperties.get(name); 40 | } 41 | 42 | public static void registerWorldProperty(String name, IWorldProperty property) { 43 | if (worldProperties.containsKey(name)) { 44 | BCLog.logger.warn("The WorldProperty key '" + name + "' is being overridden with " + property.getClass().getSimpleName() + "!"); 45 | } 46 | worldProperties.put(name, property); 47 | } 48 | 49 | public static boolean isSoftBlock(World world, BlockPos pos) { 50 | return worldProperties.get("soft").get(world, pos); 51 | } 52 | 53 | public static ResourceLocation nameToResourceLocation(String name) { 54 | if (name.indexOf(':') > 0) return new ResourceLocation(name); 55 | ModContainer modContainer = Loader.instance().activeModContainer(); 56 | if (modContainer == null) { 57 | throw new IllegalStateException("Illegal recipe name " + name + ". Provide domain id to register it correctly."); 58 | } 59 | return new ResourceLocation(modContainer.getModId(), name); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/EnumHandlerPriority.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 SpaceToad and the BuildCraft team 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. 5 | */ 6 | 7 | package buildcraft.api.core; 8 | 9 | public enum EnumHandlerPriority implements Comparable { 10 | HIGHEST, 11 | HIGH, 12 | NORMAL, 13 | LOW, 14 | LOWEST; 15 | 16 | public static final EnumHandlerPriority[] VALUES = values(); 17 | } 18 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/IAreaProvider.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.core; 6 | 7 | import net.minecraft.util.math.BlockPos; 8 | 9 | /** To be implemented by TileEntities able to provide a square area on the world, typically BuildCraft markers. */ 10 | public interface IAreaProvider { 11 | BlockPos min(); 12 | 13 | BlockPos max(); 14 | 15 | /** Remove from the world all objects used to define the area. */ 16 | void removeFromWorld(); 17 | } 18 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/IBox.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.core; 6 | 7 | import net.minecraft.util.math.BlockPos; 8 | 9 | /** A cuboid volume. BuildCraft's default implementation is mutable, so you should not cache instances that you do not 10 | * own as-is, without making an immutable copy first. */ 11 | public interface IBox extends IZone { 12 | IBox expand(int amount); 13 | 14 | IBox contract(int amount); 15 | 16 | BlockPos min(); 17 | 18 | BlockPos max(); 19 | 20 | default BlockPos size() { 21 | return max().subtract(min()).add(1, 1, 1); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/IConvertable.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.core; 2 | 3 | import javax.annotation.Nullable; 4 | 5 | /** An object that can be converted into another type. Implementing this interface makes no guarantees that 6 | * {@link #convertTo(Class)} will actually return anything other than this or null. */ 7 | public interface IConvertable { 8 | 9 | /** Attempts to convert this object to the given class. Returns this object if it is already an instance of the 10 | * given class, a separate object if it can be converted, or null if no conversion is possible. */ 11 | @Nullable 12 | default T convertTo(Class clazz) { 13 | if (clazz.isInstance(this)) { 14 | return clazz.cast(this); 15 | } 16 | return null; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/IEngineType.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.core; 2 | 3 | public interface IEngineType { 4 | String getItemModelLocation(); 5 | } 6 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/IFakePlayerProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 3 | *

4 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 5 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. 6 | */ 7 | package buildcraft.api.core; 8 | 9 | import com.mojang.authlib.GameProfile; 10 | 11 | import net.minecraft.util.math.BlockPos; 12 | import net.minecraft.world.WorldServer; 13 | 14 | import net.minecraftforge.common.util.FakePlayer; 15 | 16 | public interface IFakePlayerProvider { 17 | /** 18 | * Returns the generic buildcraft fake player. Note that you shouldn't use this anymore, as you should store the 19 | * UUID of the real player who created the block or entity that calls this. 20 | */ 21 | @Deprecated 22 | FakePlayer getBuildCraftPlayer(WorldServer world); 23 | 24 | /** 25 | * @param world 26 | * @param profile The owner's profile. 27 | * @return A fake player that can be used IN THE CURRENT METHOD CONTEXT ONLY! This will cause problems if this 28 | * player is left around as it holds a reference to the world object. 29 | */ 30 | FakePlayer getFakePlayer(WorldServer world, GameProfile profile); 31 | 32 | /** 33 | * @param world 34 | * @param profile The owner's profile. 35 | * @param pos 36 | * @return A fake player that can be used IN THE CURRENT METHOD CONTEXT ONLY! This will cause problems if this 37 | * player is left around as it holds a reference to the world object. 38 | */ 39 | FakePlayer getFakePlayer(WorldServer world, GameProfile profile, BlockPos pos); 40 | } 41 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/IFluidFilter.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | *

3 | * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents 4 | * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ 5 | package buildcraft.api.core; 6 | 7 | import net.minecraftforge.fluids.FluidStack; 8 | 9 | public interface IFluidFilter { 10 | 11 | boolean matches(FluidStack fluid); 12 | } 13 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/IFluidHandlerAdv.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.core; 2 | 3 | import javax.annotation.Nullable; 4 | 5 | import net.minecraftforge.fluids.FluidStack; 6 | import net.minecraftforge.fluids.capability.IFluidHandler; 7 | 8 | /** A version of {@link IFluidHandler} that can drain a fluid that a fluid filter accepts. */ 9 | public interface IFluidHandlerAdv extends IFluidHandler { 10 | /** Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler. 11 | * 12 | * @param filter A filter to filter the possible fluids that can be extracted. 13 | * @param maxDrain The maximum amount of fluid to drain 14 | * @param doDrain If false, drain will only be simulated. 15 | * @return FluidStack representing the Fluid and amount that was (or would have been, if simulated) drained. */ 16 | @Nullable 17 | FluidStack drain(IFluidFilter filter, int maxDrain, boolean doDrain); 18 | } 19 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/IInvSlot.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.core; 6 | 7 | import net.minecraft.item.ItemStack; 8 | 9 | public interface IInvSlot { 10 | /** Returns the slot number of the underlying Inventory. 11 | * 12 | * @return the slot number */ 13 | int getIndex(); 14 | 15 | boolean canPutStackInSlot(ItemStack stack); 16 | 17 | boolean canTakeStackFromSlot(ItemStack stack); 18 | 19 | boolean isItemValidForSlot(ItemStack stack); 20 | 21 | ItemStack decreaseStackInSlot(int amount); 22 | 23 | ItemStack getStackInSlot(); 24 | 25 | void setStackInSlot(ItemStack stack); 26 | } 27 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/IPathProvider.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.core; 2 | 3 | import java.util.List; 4 | 5 | import net.minecraft.util.math.BlockPos; 6 | 7 | import buildcraft.api.items.IMapLocation.MapLocationType; 8 | 9 | /** To be implemented by TileEntities able to provide a path on the world, typically BuildCraft path markers. */ 10 | public interface IPathProvider { 11 | /** @return The completed path. This should loop back onto itself (The last position is the same as the first 12 | * position) if you are {@link MapLocationType#PATH_REPEATING} */ 13 | List getPath(); 14 | 15 | /** Remove from the world all objects used to define the path. */ 16 | void removeFromWorld(); 17 | } 18 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/IPlayerOwned.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.core; 2 | 3 | import com.mojang.authlib.GameProfile; 4 | 5 | /** Defines an entity or tile that is owned by a specific player. */ 6 | public interface IPlayerOwned { 7 | GameProfile getOwner(); 8 | } 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/IStackFilter.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | *

3 | * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents 4 | * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ 5 | package buildcraft.api.core; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | import net.minecraft.item.ItemStack; 10 | import net.minecraft.util.NonNullList; 11 | 12 | /** This interface provides a convenient means of dealing with entire classes of items without having to specify each 13 | * item individually. */ 14 | public interface IStackFilter { 15 | 16 | /** Check to see if a given stack matches this filter. 17 | * 18 | * @param stack The stack to test. stack.isEmpty will always return false. 19 | * @return True if it does match, false otherwise. */ 20 | boolean matches(@Nonnull ItemStack stack); 21 | 22 | default IStackFilter and(IStackFilter filter) { 23 | IStackFilter before = this; 24 | return (stack) -> before.matches(stack) && filter.matches(stack); 25 | } 26 | 27 | /** 28 | * Returns example stack to match this filter 29 | */ 30 | default NonNullList getExamples() { 31 | return NonNullList.withSize(0, ItemStack.EMPTY); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/IWorldProperty.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.core; 6 | 7 | import net.minecraft.util.math.BlockPos; 8 | import net.minecraft.world.World; 9 | 10 | public interface IWorldProperty { 11 | boolean get(World world, BlockPos pos); 12 | 13 | void clear(); 14 | } 15 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/IZone.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.core; 6 | 7 | import java.util.Random; 8 | 9 | import net.minecraft.util.math.BlockPos; 10 | import net.minecraft.util.math.Vec3d; 11 | 12 | /** Defines some volume in the world. This is not guaranteed to be fully connected to itself. */ 13 | public interface IZone { 14 | /** Returns the smallest possible distance that the pos would have to be changed by in order for 15 | * {@link #contains(Vec3d)} to return true. If the position is already inside then this will return 0 */ 16 | double distanceTo(BlockPos pos); 17 | 18 | /** Returns {@link #distanceTo(BlockPos)} but squared. Usually this will be quicker to calculate. */ 19 | double distanceToSquared(BlockPos pos); 20 | 21 | /** Returns true if the point is enclosed by this zone, such that none of the coordinates lie outside the range 22 | * specified by this zone. */ 23 | boolean contains(Vec3d point); 24 | 25 | /** Gets a random position that {@link #contains(Vec3d)} will return true. */ 26 | BlockPos getRandomBlockPos(Random rand); 27 | } 28 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/InvalidInputDataException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 SpaceToad and the BuildCraft team 3 | * 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 4 | * distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/ 5 | */ 6 | 7 | package buildcraft.api.core; 8 | 9 | import java.io.IOException; 10 | 11 | /** 12 | * Indicates that we failed to load from NBT or some other file. 13 | */ 14 | public class InvalidInputDataException extends IOException { 15 | public InvalidInputDataException() { 16 | } 17 | 18 | public InvalidInputDataException(String message) { 19 | super(message); 20 | } 21 | 22 | public InvalidInputDataException(Throwable cause) { 23 | super(cause); 24 | } 25 | 26 | public InvalidInputDataException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/JavaTools.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.core; 6 | 7 | import java.util.Arrays; 8 | 9 | public final class JavaTools { 10 | private JavaTools() { 11 | 12 | } 13 | 14 | public static T[] concat(T[] first, T[] second) { 15 | T[] result = Arrays.copyOf(first, first.length + second.length); 16 | System.arraycopy(second, 0, result, first.length, second.length); 17 | return result; 18 | } 19 | 20 | public static int[] concat(int[] first, int[] second) { 21 | int[] result = Arrays.copyOf(first, first.length + second.length); 22 | System.arraycopy(second, 0, result, first.length, second.length); 23 | return result; 24 | } 25 | 26 | public static float[] concat(float[] first, float[] second) { 27 | float[] result = Arrays.copyOf(first, first.length + second.length); 28 | System.arraycopy(second, 0, result, first.length, second.length); 29 | return result; 30 | } 31 | 32 | public static String surroundWithQuotes(String stringToSurroundWithQuotes) { 33 | return String.format("\"%s\"", stringToSurroundWithQuotes); 34 | } 35 | 36 | public static String stripSurroundingQuotes(String stringToStripQuotes) { 37 | return stringToStripQuotes.replaceAll("^\"|\"$", ""); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "2.2", owner = "buildcraftlib", provides = "buildcraftapi_core") 6 | package buildcraft.api.core; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/core/render/ISprite.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.core.render; 2 | 3 | import net.minecraft.client.renderer.texture.TextureAtlasSprite; 4 | 5 | /** Holds information on some sort of sprite. These might not be part of the main texture atlas (they might be from a 6 | * GUI texture), in which case {@link #bindTexture()} should be called before using the results from 7 | * {@link #getInterpU(double)} or {@link #getInterpV(double)} 8 | *

9 | * IMPORTANT: Unlike Minecraft's {@link TextureAtlasSprite} this uses co-ordinates between 0 and 1, rather than 0 10 | * and 16! */ 11 | public interface ISprite { 12 | /** Binds this sprites backing texture so that this sprite will be referenced when you use the results of 13 | * {@link #getInterpU(double)} and {@link #getInterpV(double)} */ 14 | void bindTexture(); 15 | 16 | /** @param u A value between 0 and 1 17 | * @return */ 18 | double getInterpU(double u); 19 | 20 | /** @param v A value between 0 and 1 21 | * @return */ 22 | double getInterpV(double v); 23 | } 24 | -------------------------------------------------------------------------------- /api/buildcraft/api/crops/ICropHandler.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.crops; 2 | 3 | import net.minecraft.block.state.IBlockState; 4 | import net.minecraft.entity.player.EntityPlayer; 5 | import net.minecraft.item.ItemStack; 6 | import net.minecraft.util.NonNullList; 7 | import net.minecraft.util.math.BlockPos; 8 | import net.minecraft.world.IBlockAccess; 9 | import net.minecraft.world.World; 10 | 11 | public interface ICropHandler { 12 | 13 | /** Check if an item is a seed. 14 | * 15 | * @param stack 16 | * @return true if the item can be planted. */ 17 | boolean isSeed(ItemStack stack); 18 | 19 | /** Check if the item can be planted. You can assume canSustainPlant() will only be called if isSeed() returned 20 | * true. 21 | * 22 | * @param world 23 | * @param seed 24 | * @param pos 25 | * @return true if the item can be planted at pos. */ 26 | boolean canSustainPlant(World world, ItemStack seed, BlockPos pos); 27 | 28 | /** Plant the item in the block. You can assume plantCrop() will only be called if canSustainPlant() returned true. 29 | * 30 | * @param world 31 | * @param player 32 | * @param seed 33 | * @param pos 34 | * @return true if the item was planted at pos. */ 35 | boolean plantCrop(World world, EntityPlayer player, ItemStack seed, BlockPos pos); 36 | 37 | /** Check if a crop is mature and can be harvested. 38 | * 39 | * @param blockAccess 40 | * @param state 41 | * @param pos 42 | * @return true if the block at pos is mature and can be harvested. */ 43 | boolean isMature(IBlockAccess blockAccess, IBlockState state, BlockPos pos); 44 | 45 | /** Harvest the crop. You can assume harvestCrop() will only be called if isMature() returned true. 46 | * 47 | * @param world 48 | * @param pos 49 | * @param drops a list to return the harvest's drops. 50 | * @return true if the block was successfully harvested. */ 51 | boolean harvestCrop(World world, BlockPos pos, NonNullList drops); 52 | 53 | } 54 | -------------------------------------------------------------------------------- /api/buildcraft/api/crops/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "1.1", owner = "buildcraftapi_core", provides = "buildcraftapi_crops") 6 | package buildcraft.api.crops; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/enums/EnumDecoratedBlock.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.enums; 2 | 3 | import java.util.Locale; 4 | 5 | import net.minecraft.util.IStringSerializable; 6 | 7 | public enum EnumDecoratedBlock implements IStringSerializable { 8 | DESTROY(0), 9 | BLUEPRINT(10), 10 | TEMPLATE(10), 11 | PAPER(10), 12 | LEATHER(10), 13 | LASER_BACK(0); 14 | 15 | public static final EnumDecoratedBlock[] VALUES = values(); 16 | 17 | public final int lightValue; 18 | 19 | EnumDecoratedBlock(int lightValue) { 20 | this.lightValue = lightValue; 21 | } 22 | 23 | @Override 24 | public String getName() { 25 | return name().toLowerCase(Locale.ROOT); 26 | } 27 | 28 | public static EnumDecoratedBlock fromMeta(int meta) { 29 | if (meta < 0 || meta >= VALUES.length) { 30 | return EnumDecoratedBlock.DESTROY; 31 | } 32 | return VALUES[meta]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /api/buildcraft/api/enums/EnumEngineType.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.enums; 2 | 3 | import net.minecraft.util.IStringSerializable; 4 | 5 | import buildcraft.api.core.IEngineType; 6 | 7 | public enum EnumEngineType implements IStringSerializable, IEngineType { 8 | WOOD("core", "wood"), 9 | STONE("energy", "stone"), 10 | IRON("energy", "iron"), 11 | CREATIVE("energy", "creative"), 12 | RF("energy", "rf"); 13 | 14 | public final String unlocalizedTag; 15 | public final String resourceLocation; 16 | 17 | public static final EnumEngineType[] VALUES = values(); 18 | 19 | EnumEngineType(String mod, String loc) { 20 | unlocalizedTag = loc; 21 | resourceLocation = "buildcraft" + mod + ":blocks/engine/inv/" + loc; 22 | } 23 | 24 | @Override 25 | public String getItemModelLocation() { 26 | return resourceLocation; 27 | } 28 | 29 | @Override 30 | public String getName() { 31 | return unlocalizedTag; 32 | } 33 | 34 | public static EnumEngineType fromMeta(int meta) { 35 | if (meta < 0 || meta >= VALUES.length) { 36 | meta = 0; 37 | } 38 | return VALUES[meta]; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /api/buildcraft/api/enums/EnumLaserTableType.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.enums; 2 | 3 | import net.minecraft.util.IStringSerializable; 4 | 5 | public enum EnumLaserTableType implements IStringSerializable { 6 | ASSEMBLY_TABLE, 7 | ADVANCED_CRAFTING_TABLE, 8 | INTEGRATION_TABLE, 9 | CHARGING_TABLE, 10 | PROGRAMMING_TABLE; 11 | 12 | @Override 13 | public String getName() { 14 | return name(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /api/buildcraft/api/enums/EnumMachineState.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.enums; 2 | 3 | import net.minecraft.block.state.IBlockState; 4 | import net.minecraft.util.IStringSerializable; 5 | 6 | import buildcraft.api.properties.BuildCraftProperties; 7 | 8 | public enum EnumMachineState implements IStringSerializable { 9 | OFF, 10 | ON, 11 | DONE; 12 | 13 | public static EnumMachineState getType(IBlockState state) { 14 | return state.getValue(BuildCraftProperties.MACHINE_STATE); 15 | } 16 | 17 | @Override 18 | public String getName() { 19 | return name(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /api/buildcraft/api/enums/EnumOptionalSnapshotType.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.enums; 2 | 3 | import java.util.Locale; 4 | 5 | import net.minecraft.util.IStringSerializable; 6 | 7 | /** 8 | * Version of {@link EnumSnapshotType} with {@link EnumOptionalSnapshotType#NONE} value. 9 | * Shouldn't be used where it's possible to use {@link EnumSnapshotType}. 10 | */ 11 | public enum EnumOptionalSnapshotType implements IStringSerializable { 12 | NONE(null), 13 | TEMPLATE(EnumSnapshotType.TEMPLATE), 14 | BLUEPRINT(EnumSnapshotType.BLUEPRINT); 15 | 16 | public final EnumSnapshotType type; 17 | 18 | EnumOptionalSnapshotType(EnumSnapshotType type) { 19 | this.type = type; 20 | } 21 | 22 | public static EnumOptionalSnapshotType fromNullable(EnumSnapshotType type) { 23 | if (type == null) { 24 | return NONE; 25 | } 26 | switch (type) { 27 | case TEMPLATE: 28 | return TEMPLATE; 29 | case BLUEPRINT: 30 | return BLUEPRINT; 31 | default: 32 | return NONE; 33 | } 34 | } 35 | 36 | @Override 37 | public String getName() { 38 | return name().toLowerCase(Locale.ROOT); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /api/buildcraft/api/enums/EnumPowerStage.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.enums; 2 | 3 | import java.util.Locale; 4 | 5 | import net.minecraft.util.IStringSerializable; 6 | 7 | public enum EnumPowerStage implements IStringSerializable { 8 | BLUE, 9 | GREEN, 10 | YELLOW, 11 | RED, 12 | OVERHEAT, 13 | BLACK; 14 | 15 | public static final EnumPowerStage[] VALUES = values(); 16 | 17 | private final String modelName = name().toLowerCase(Locale.ROOT); 18 | 19 | public String getModelName() { 20 | return modelName; 21 | } 22 | 23 | @Override 24 | public String getName() { 25 | return getModelName(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /api/buildcraft/api/enums/EnumRedstoneChipset.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.enums; 2 | 3 | import java.util.Locale; 4 | 5 | import net.minecraft.item.Item; 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraft.util.IStringSerializable; 8 | 9 | import buildcraft.api.BCItems; 10 | 11 | public enum EnumRedstoneChipset implements IStringSerializable { 12 | RED, 13 | IRON, 14 | GOLD, 15 | QUARTZ, 16 | DIAMOND; 17 | 18 | private final String name = name().toLowerCase(Locale.ROOT); 19 | 20 | public ItemStack getStack(int stackSize) { 21 | Item chipset = BCItems.Silicon.REDSTONE_CHIPSET; 22 | if (chipset == null) { 23 | return ItemStack.EMPTY; 24 | } 25 | 26 | return new ItemStack(chipset, stackSize, ordinal()); 27 | } 28 | 29 | public ItemStack getStack() { 30 | return getStack(1); 31 | } 32 | 33 | public static EnumRedstoneChipset fromStack(ItemStack stack) { 34 | if (stack == null) { 35 | return RED; 36 | } 37 | return fromOrdinal(stack.getMetadata()); 38 | } 39 | 40 | public static EnumRedstoneChipset fromOrdinal(int ordinal) { 41 | if (ordinal < 0 || ordinal >= values().length) { 42 | return RED; 43 | } 44 | return values()[ordinal]; 45 | } 46 | 47 | @Override 48 | public String getName() { 49 | return name; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /api/buildcraft/api/enums/EnumSnapshotType.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.enums; 2 | 3 | public enum EnumSnapshotType { 4 | TEMPLATE(900), 5 | BLUEPRINT(300); 6 | 7 | public final int maxPerTick; 8 | 9 | EnumSnapshotType(int maxPerTick) { 10 | this.maxPerTick = maxPerTick; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /api/buildcraft/api/enums/EnumSpring.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.enums; 2 | 3 | import java.util.Locale; 4 | import java.util.function.Supplier; 5 | 6 | import net.minecraft.block.state.IBlockState; 7 | import net.minecraft.init.Blocks; 8 | import net.minecraft.tileentity.TileEntity; 9 | import net.minecraft.util.IStringSerializable; 10 | 11 | import buildcraft.api.properties.BuildCraftProperties; 12 | 13 | public enum EnumSpring implements IStringSerializable { 14 | WATER(5, -1, Blocks.WATER.getDefaultState()), 15 | OIL(6000, 8, null); // Set in BuildCraftEnergy 16 | 17 | public static final EnumSpring[] VALUES = values(); 18 | 19 | public final int tickRate, chance; 20 | public IBlockState liquidBlock; 21 | public boolean canGen = true; 22 | public Supplier tileConstructor; 23 | 24 | private final String lowerCaseName = name().toLowerCase(Locale.ROOT); 25 | 26 | EnumSpring(int tickRate, int chance, IBlockState liquidBlock) { 27 | this.tickRate = tickRate; 28 | this.chance = chance; 29 | this.liquidBlock = liquidBlock; 30 | } 31 | 32 | public static EnumSpring fromState(IBlockState state) { 33 | return state.getValue(BuildCraftProperties.SPRING_TYPE); 34 | } 35 | 36 | @Override 37 | public String getName() { 38 | return lowerCaseName; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /api/buildcraft/api/enums/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "1.0", owner = "buildcraftapi_core", provides = "buildcraftapi_enums") 6 | package buildcraft.api.enums; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/events/BlockInteractionEvent.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.events; 6 | 7 | import net.minecraft.block.state.IBlockState; 8 | import net.minecraft.entity.player.EntityPlayer; 9 | 10 | import net.minecraftforge.fml.common.eventhandler.Cancelable; 11 | import net.minecraftforge.fml.common.eventhandler.Event; 12 | 13 | @Cancelable 14 | public class BlockInteractionEvent extends Event { 15 | public final EntityPlayer player; 16 | public final IBlockState state; 17 | 18 | public BlockInteractionEvent(EntityPlayer player, IBlockState state) { 19 | this.player = player; 20 | this.state = state; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /api/buildcraft/api/events/BlockPlacedDownEvent.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.events; 6 | 7 | import net.minecraft.block.state.IBlockState; 8 | import net.minecraft.entity.player.EntityPlayer; 9 | import net.minecraft.util.math.BlockPos; 10 | 11 | import net.minecraftforge.fml.common.eventhandler.Cancelable; 12 | import net.minecraftforge.fml.common.eventhandler.Event; 13 | 14 | @Cancelable 15 | public class BlockPlacedDownEvent extends Event { 16 | public final EntityPlayer player; 17 | public final IBlockState state; 18 | public final BlockPos pos; 19 | 20 | public BlockPlacedDownEvent(EntityPlayer player, BlockPos pos, IBlockState state) { 21 | this.player = player; 22 | this.state = state; 23 | this.pos = pos; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /api/buildcraft/api/events/PipePlacedEvent.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.events; 6 | 7 | import net.minecraft.entity.player.EntityPlayer; 8 | import net.minecraft.item.Item; 9 | import net.minecraft.util.math.BlockPos; 10 | 11 | import net.minecraftforge.fml.common.eventhandler.Event; 12 | 13 | public class PipePlacedEvent extends Event { 14 | public EntityPlayer player; 15 | public Item pipeType; 16 | public BlockPos pos; 17 | 18 | public PipePlacedEvent(EntityPlayer player, Item pipeType, BlockPos pos) { 19 | this.player = player; 20 | this.pipeType = pipeType; 21 | this.pos = pos; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /api/buildcraft/api/events/RobotEvent.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.events; 6 | 7 | import net.minecraft.entity.player.EntityPlayer; 8 | import net.minecraft.item.ItemStack; 9 | 10 | import net.minecraftforge.fml.common.eventhandler.Cancelable; 11 | import net.minecraftforge.fml.common.eventhandler.Event; 12 | 13 | import buildcraft.api.robots.EntityRobotBase; 14 | 15 | public abstract class RobotEvent extends Event { 16 | public final EntityRobotBase robot; 17 | 18 | public RobotEvent(EntityRobotBase robot) { 19 | this.robot = robot; 20 | } 21 | 22 | @Cancelable 23 | public static class Place extends RobotEvent { 24 | public final EntityPlayer player; 25 | 26 | public Place(EntityRobotBase robot, EntityPlayer player) { 27 | super(robot); 28 | this.player = player; 29 | } 30 | } 31 | 32 | @Cancelable 33 | public static class Interact extends RobotEvent { 34 | public final EntityPlayer player; 35 | public final ItemStack item; 36 | 37 | public Interact(EntityRobotBase robot, EntityPlayer player, ItemStack item) { 38 | super(robot); 39 | this.player = player; 40 | this.item = item; 41 | } 42 | } 43 | 44 | @Cancelable 45 | public static class Dismantle extends RobotEvent { 46 | public final EntityPlayer player; 47 | 48 | public Dismantle(EntityRobotBase robot, EntityPlayer player) { 49 | super(robot); 50 | this.player = player; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /api/buildcraft/api/events/RobotPlacementEvent.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.events; 6 | 7 | import net.minecraft.entity.player.EntityPlayer; 8 | 9 | import net.minecraftforge.fml.common.eventhandler.Cancelable; 10 | import net.minecraftforge.fml.common.eventhandler.Event; 11 | 12 | @Cancelable 13 | public class RobotPlacementEvent extends Event { 14 | public EntityPlayer player; 15 | public String robotProgram; 16 | 17 | public RobotPlacementEvent(EntityPlayer player, String robotProgram) { 18 | this.player = player; 19 | this.robotProgram = robotProgram; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /api/buildcraft/api/events/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "2.0", owner = "buildcraftapi_core", provides = "buildcraftapi_events") 6 | package buildcraft.api.events; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/facades/FacadeAPI.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.facades; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.block.state.IBlockState; 5 | import net.minecraft.item.ItemStack; 6 | import net.minecraft.nbt.NBTTagCompound; 7 | 8 | import net.minecraftforge.fml.common.event.FMLInterModComms; 9 | 10 | public final class FacadeAPI { 11 | public static final String IMC_MOD_TARGET = "buildcraftsilicon"; 12 | public static final String IMC_FACADE_DISABLE = "facade_disable_block"; 13 | public static final String IMC_FACADE_CUSTOM = "facade_custom_map_block_item"; 14 | public static final String NBT_CUSTOM_BLOCK_REG_KEY = "block_registry_name"; 15 | public static final String NBT_CUSTOM_BLOCK_META = "block_meta"; 16 | public static final String NBT_CUSTOM_ITEM_STACK = "item_stack"; 17 | 18 | public static IFacadeItem facadeItem; 19 | public static IFacadeRegistry registry; 20 | 21 | private FacadeAPI() { 22 | 23 | } 24 | 25 | public static void disableBlock(Block block) { 26 | FMLInterModComms.sendMessage(IMC_MOD_TARGET, IMC_FACADE_DISABLE, block.getRegistryName()); 27 | } 28 | 29 | public static void mapStateToStack(IBlockState state, ItemStack stack) { 30 | NBTTagCompound nbt = new NBTTagCompound(); 31 | nbt.setString(NBT_CUSTOM_BLOCK_REG_KEY, state.getBlock().getRegistryName().toString()); 32 | nbt.setInteger(NBT_CUSTOM_BLOCK_META, state.getBlock().getMetaFromState(state)); 33 | nbt.setTag(NBT_CUSTOM_ITEM_STACK, stack.serializeNBT()); 34 | FMLInterModComms.sendMessage(IMC_MOD_TARGET, IMC_FACADE_CUSTOM, nbt); 35 | } 36 | 37 | public static boolean isFacadeMessageId(String id) { 38 | return IMC_FACADE_CUSTOM.equals(id) // 39 | || IMC_FACADE_DISABLE.equals(id); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /api/buildcraft/api/facades/FacadeType.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.facades; 6 | 7 | public enum FacadeType { 8 | Basic, 9 | Phased; 10 | 11 | public static FacadeType fromOrdinal(int ordinal) { 12 | return ordinal == 1 ? Phased : Basic; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /api/buildcraft/api/facades/IFacade.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.facades; 2 | 3 | public interface IFacade { 4 | FacadeType getType(); 5 | 6 | boolean isHollow(); 7 | 8 | IFacadePhasedState[] getPhasedStates(); 9 | } 10 | -------------------------------------------------------------------------------- /api/buildcraft/api/facades/IFacadeItem.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.facades; 6 | 7 | import javax.annotation.Nonnull; 8 | import javax.annotation.Nullable; 9 | 10 | import net.minecraft.block.state.IBlockState; 11 | import net.minecraft.item.ItemStack; 12 | 13 | public interface IFacadeItem { 14 | 15 | @Nullable 16 | default FacadeType getFacadeType(@Nonnull ItemStack stack) { 17 | IFacade facade = getFacade(stack); 18 | if (facade == null) { 19 | return null; 20 | } 21 | return facade.getType(); 22 | } 23 | 24 | @Nonnull 25 | ItemStack getFacadeForBlock(IBlockState state); 26 | 27 | /** @param facade The {@link IFacade} instance. NOTE: This MUST be an object returned from 28 | * {@link IFacadeRegistry#createBasicFacade(IFacadeState, boolean)} or 29 | * {@link IFacadeRegistry#createPhasedFacade(IFacadePhasedState[], boolean)}, otherwise a 30 | * {@link ClassCastException} will be thrown! */ 31 | ItemStack createFacadeStack(IFacade facade); 32 | 33 | @Nullable 34 | IFacade getFacade(@Nonnull ItemStack facade); 35 | } 36 | -------------------------------------------------------------------------------- /api/buildcraft/api/facades/IFacadePhasedState.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.facades; 2 | 3 | import javax.annotation.Nullable; 4 | 5 | import net.minecraft.item.EnumDyeColor; 6 | 7 | public interface IFacadePhasedState { 8 | IFacadeState getState(); 9 | 10 | @Nullable 11 | EnumDyeColor getActiveColor(); 12 | } 13 | -------------------------------------------------------------------------------- /api/buildcraft/api/facades/IFacadeRegistry.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.facades; 2 | 3 | import java.util.Collection; 4 | 5 | import javax.annotation.Nullable; 6 | 7 | import net.minecraft.item.EnumDyeColor; 8 | 9 | public interface IFacadeRegistry { 10 | 11 | Collection getValidFacades(); 12 | 13 | IFacadePhasedState createPhasedState(IFacadeState state, @Nullable EnumDyeColor activeColor); 14 | 15 | IFacade createPhasedFacade(IFacadePhasedState[] states, boolean isHollow); 16 | 17 | default IFacade createBasicFacade(IFacadeState state, boolean isHollow) { 18 | return createPhasedFacade(new IFacadePhasedState[] { createPhasedState(state, null) }, isHollow); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /api/buildcraft/api/facades/IFacadeState.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.facades; 2 | 3 | import net.minecraft.block.state.IBlockState; 4 | import net.minecraft.item.ItemStack; 5 | 6 | public interface IFacadeState { 7 | boolean isTransparent(); 8 | 9 | IBlockState getBlockState(); 10 | 11 | ItemStack getRequiredStack(); 12 | } 13 | -------------------------------------------------------------------------------- /api/buildcraft/api/facades/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "1.1", owner = "buildcraftapi_core", provides = "buildcraftapi_facades") 6 | package buildcraft.api.facades; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/filler/FillerManager.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.filler; 2 | 3 | public final class FillerManager { 4 | public static IFillerRegistry registry; 5 | } 6 | -------------------------------------------------------------------------------- /api/buildcraft/api/filler/IFillerPattern.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.filler; 6 | 7 | import javax.annotation.Nullable; 8 | 9 | import net.minecraft.util.math.BlockPos; 10 | 11 | import buildcraft.api.core.render.ISprite; 12 | import buildcraft.api.statements.IStatement; 13 | import buildcraft.api.statements.IStatementParameter; 14 | import buildcraft.api.statements.containers.IFillerStatementContainer; 15 | 16 | /** A type of statement that is used for filler patterns. */ 17 | public interface IFillerPattern extends IStatement { 18 | /** @param filler The filler to create the pattern for. 19 | *
20 | * NOTE: This method should never be called when {@link IFillerStatementContainer#hasBox()} returns 21 | * false 22 | * @return The template to fill (should be created with 23 | * {@link IFillerRegistry#createFilledTemplate(BlockPos, BlockPos)}), 24 | * or {@code null} if this shouldn't make a template for the given filer. */ 25 | @Nullable 26 | IFilledTemplate createTemplate(IFillerStatementContainer filler, IStatementParameter[] params); 27 | 28 | @Override 29 | IFillerPattern[] getPossible(); 30 | 31 | /** Note that this sprite *must* be stitched to the texture atlas, as it is drawn on the side of the filler 32 | * block. */ 33 | @Override 34 | ISprite getSprite(); 35 | } 36 | -------------------------------------------------------------------------------- /api/buildcraft/api/filler/IFillerPatternShape.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.filler; 6 | 7 | import javax.annotation.Nullable; 8 | 9 | import net.minecraft.world.World; 10 | 11 | import buildcraft.api.statements.IStatementParameter; 12 | import buildcraft.api.statements.containers.IFillerStatementContainer; 13 | 14 | /** {@code IFillerPattern} independent from {@link World} */ 15 | public interface IFillerPatternShape extends IFillerPattern { 16 | /** 17 | * @param filledTemplate empty template 18 | * @return {@code true} if the template filled, or {@code false} if this shouldn't make a template for the given params. 19 | */ 20 | boolean fillTemplate(IFilledTemplate filledTemplate, IStatementParameter[] params); 21 | 22 | @Nullable 23 | @Override 24 | default IFilledTemplate createTemplate(IFillerStatementContainer filler, IStatementParameter[] params) { 25 | IFilledTemplate template = FillerManager.registry.createFilledTemplate( 26 | filler.getBox().min(), 27 | filler.getBox().size() 28 | ); 29 | if (!fillTemplate(template, params)) { 30 | return null; 31 | } 32 | return template; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /api/buildcraft/api/filler/IFillerRegistry.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.filler; 2 | 3 | import java.util.Collection; 4 | 5 | import javax.annotation.Nullable; 6 | 7 | import net.minecraft.util.math.BlockPos; 8 | 9 | import buildcraft.api.statements.IStatement; 10 | 11 | public interface IFillerRegistry { 12 | void addPattern(IFillerPattern pattern); 13 | 14 | /** @return An {@link IFillerPattern} from its {@link IStatement#getUniqueTag()} */ 15 | @Nullable 16 | IFillerPattern getPattern(String name); 17 | 18 | Collection getPatterns(); 19 | 20 | IFilledTemplate createFilledTemplate(BlockPos pos, BlockPos size); 21 | } 22 | -------------------------------------------------------------------------------- /api/buildcraft/api/filler/package-info.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "5.0", owner = "buildcraftapi_core", provides = "buildcraftapi_filler") 6 | package buildcraft.api.filler; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/fuels/BuildcraftFuelRegistry.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.fuels; 6 | 7 | public final class BuildcraftFuelRegistry { 8 | public static IFuelManager fuel; 9 | public static ICoolantManager coolant; 10 | 11 | private BuildcraftFuelRegistry() {} 12 | } 13 | -------------------------------------------------------------------------------- /api/buildcraft/api/fuels/ICoolant.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.fuels; 6 | 7 | import net.minecraftforge.fluids.FluidStack; 8 | 9 | public interface ICoolant { 10 | boolean matchesFluid(FluidStack fluid); 11 | 12 | /** @param fluid 13 | * @param heat 14 | * @return 0 if the input fluid provides no cooling, or a value greater than 0 if it does. */ 15 | float getDegreesCoolingPerMB(FluidStack fluid, float heat); 16 | } 17 | -------------------------------------------------------------------------------- /api/buildcraft/api/fuels/ICoolantManager.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.fuels; 6 | 7 | import java.util.Collection; 8 | 9 | import net.minecraft.item.ItemStack; 10 | 11 | import net.minecraftforge.fluids.Fluid; 12 | import net.minecraftforge.fluids.FluidStack; 13 | 14 | public interface ICoolantManager { 15 | ICoolant addCoolant(ICoolant coolant); 16 | 17 | ICoolant addCoolant(FluidStack fluid, float degreesCoolingPerMb); 18 | 19 | default ICoolant addCoolant(Fluid fluid, float degreesCoolingPerMb) { 20 | return addCoolant(new FluidStack(fluid, 1), degreesCoolingPerMb); 21 | } 22 | 23 | ISolidCoolant addSolidCoolant(ISolidCoolant solidCoolant); 24 | 25 | ISolidCoolant addSolidCoolant(ItemStack solid, FluidStack fluid, float multiplier); 26 | 27 | Collection getCoolants(); 28 | 29 | Collection getSolidCoolants(); 30 | 31 | ICoolant getCoolant(FluidStack fluid); 32 | 33 | float getDegreesPerMb(FluidStack fluid, float heat); 34 | 35 | ISolidCoolant getSolidCoolant(ItemStack solid); 36 | } 37 | -------------------------------------------------------------------------------- /api/buildcraft/api/fuels/IFuel.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.fuels; 6 | 7 | import net.minecraftforge.fluids.FluidStack; 8 | 9 | public interface IFuel { 10 | /** @return The input fluid. The {@link FluidStack#amount} is ignored. */ 11 | FluidStack getFluid(); 12 | 13 | /** @return The number of ticks that a single bucket (1000mb) of this fuel will burn for. */ 14 | int getTotalBurningTime(); 15 | 16 | /** @return The amount (in micro mj) of power that this fuel will give off in 1 tick. */ 17 | long getPowerPerCycle(); 18 | } 19 | -------------------------------------------------------------------------------- /api/buildcraft/api/fuels/IFuelManager.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.fuels; 6 | 7 | import java.util.Collection; 8 | 9 | import net.minecraftforge.fluids.Fluid; 10 | import net.minecraftforge.fluids.FluidStack; 11 | 12 | public interface IFuelManager { 13 | F addFuel(F fuel); 14 | 15 | IFuel addFuel(FluidStack fluid, long powerPerCycle, int totalBurningTime); 16 | 17 | default IFuel addFuel(Fluid fluid, long powerPerCycle, int totalBurningTime) { 18 | return addFuel(new FluidStack(fluid, 1), powerPerCycle, totalBurningTime); 19 | } 20 | 21 | /** @param residue The residue fluidstack, per bucket of the original fuel. */ 22 | IDirtyFuel addDirtyFuel(FluidStack fuel, long powerPerCycle, int totalBurningTime, FluidStack residue); 23 | 24 | /** @param residue The residue fluidstack, per bucket of the original fuel. */ 25 | default IDirtyFuel addDirtyFuel(Fluid fuel, long powerPerCycle, int totalBurningTime, FluidStack residue) { 26 | return addDirtyFuel(new FluidStack(fuel, 1), powerPerCycle, totalBurningTime, residue); 27 | } 28 | 29 | Collection getFuels(); 30 | 31 | IFuel getFuel(FluidStack fluid); 32 | 33 | interface IDirtyFuel extends IFuel { 34 | /** @return The residue fluidstack, per bucket of original fuel. */ 35 | FluidStack getResidue(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /api/buildcraft/api/fuels/ISolidCoolant.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.fuels; 6 | 7 | import net.minecraft.item.ItemStack; 8 | 9 | import net.minecraftforge.fluids.FluidStack; 10 | 11 | public interface ISolidCoolant { 12 | FluidStack getFluidFromSolidCoolant(ItemStack stack); 13 | } 14 | -------------------------------------------------------------------------------- /api/buildcraft/api/fuels/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "2.0", owner = "buildcraftapi_core", provides = "buildcraftapi_fuels") 6 | package buildcraft.api.fuels; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/gates/IGate.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.gates; 6 | 7 | import java.util.List; 8 | 9 | import buildcraft.api.statements.IStatement; 10 | import buildcraft.api.statements.IStatementParameter; 11 | import buildcraft.api.statements.StatementSlot; 12 | import buildcraft.api.statements.containers.ISidedStatementContainer; 13 | import buildcraft.api.transport.pipe.IPipeHolder; 14 | 15 | public interface IGate extends ISidedStatementContainer { 16 | 17 | IPipeHolder getPipeHolder(); 18 | 19 | List getTriggers(); 20 | 21 | List getActions(); 22 | 23 | List getActiveActions(); 24 | 25 | List getTriggerParameters(int slot); 26 | 27 | List getActionParameters(int slot); 28 | } 29 | -------------------------------------------------------------------------------- /api/buildcraft/api/gates/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "4.1", owner = "buildcraftapi_core", provides = "buildcraftapi_gates") 6 | package buildcraft.api.gates; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/inventory/IItemHandlerFiltered.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.inventory; 2 | 3 | import net.minecraft.item.ItemStack; 4 | 5 | import net.minecraftforge.items.IItemHandler; 6 | 7 | /** A type of {@link IItemHandler} that has a single valid stack per slot, as specified by {@link #getFilter(int)}. Note 8 | * that any {@link IItemHandler} can implement this (even if the filter behaviour is more complex, or their isn't 9 | * actually a filter at all) */ 10 | public interface IItemHandlerFiltered extends IItemHandler { 11 | 12 | /** @param slot the slot to test 13 | * @return The filter in that slot. Will be {@link ItemStack#EMPTY} if this is not filtered to a single item (for 14 | * example if this will match against a few stacks, or nothing is allowed, or a wide range of stacks are 15 | * allowed). Will be equal to {@link #getStackInSlot(int)} if the slot currently contains an item. */ 16 | default ItemStack getFilter(int slot) { 17 | return getStackInSlot(slot); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /api/buildcraft/api/items/FluidItemDrops.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.items; 2 | 3 | import net.minecraft.item.ItemStack; 4 | import net.minecraft.util.NonNullList; 5 | 6 | import net.minecraftforge.fluids.FluidStack; 7 | import net.minecraftforge.fluids.IFluidTank; 8 | 9 | public class FluidItemDrops { 10 | 11 | public static IItemFluidShard item; 12 | 13 | public static void addFluidDrops(NonNullList toDrop, FluidStack... fluids) { 14 | if (item != null) { 15 | for (FluidStack fluid : fluids) { 16 | item.addFluidDrops(toDrop, fluid); 17 | } 18 | } 19 | } 20 | 21 | public static void addFluidDrops(NonNullList toDrop, IFluidTank... tanks) { 22 | if (item != null) { 23 | for (IFluidTank tank : tanks) { 24 | item.addFluidDrops(toDrop, tank.getFluid()); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /api/buildcraft/api/items/IItemCustomPipeRender.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.items; 2 | 3 | import net.minecraft.item.ItemStack; 4 | 5 | import net.minecraftforge.fml.relauncher.Side; 6 | import net.minecraftforge.fml.relauncher.SideOnly; 7 | 8 | public interface IItemCustomPipeRender { 9 | float getPipeRenderScale(ItemStack stack); 10 | 11 | /** @return False to use the default renderer, true otherwise. */ 12 | @SideOnly(Side.CLIENT) 13 | boolean renderItemInPipe(ItemStack stack, double x, double y, double z); 14 | } 15 | -------------------------------------------------------------------------------- /api/buildcraft/api/items/IItemFluidShard.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.items; 2 | 3 | import javax.annotation.Nullable; 4 | 5 | import net.minecraft.item.ItemStack; 6 | import net.minecraft.util.NonNullList; 7 | 8 | import net.minecraftforge.fluids.FluidStack; 9 | 10 | public interface IItemFluidShard { 11 | void addFluidDrops(NonNullList toDrop, @Nullable FluidStack fluid); 12 | } 13 | -------------------------------------------------------------------------------- /api/buildcraft/api/items/IList.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.items; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | import net.minecraft.item.ItemStack; 6 | 7 | public interface IList extends INamedItem { 8 | boolean matches(@Nonnull ItemStack stackList, @Nonnull ItemStack item); 9 | } 10 | -------------------------------------------------------------------------------- /api/buildcraft/api/items/IMapLocation.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.items; 2 | 3 | import java.util.List; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraft.util.EnumFacing; 9 | import net.minecraft.util.math.BlockPos; 10 | 11 | import buildcraft.api.core.IBox; 12 | import buildcraft.api.core.IZone; 13 | 14 | /** Created by asie on 2/28/15. */ 15 | public interface IMapLocation extends INamedItem { 16 | enum MapLocationType { 17 | CLEAN, 18 | SPOT, 19 | AREA, 20 | PATH, 21 | ZONE, 22 | /** Like PATH but repeats around in a loop. */ 23 | PATH_REPEATING; 24 | 25 | public final int meta = ordinal(); 26 | 27 | public static MapLocationType getFromStack(@Nonnull ItemStack stack) { 28 | int dam = stack.getItemDamage(); 29 | if (dam < 0 || dam >= values().length) { 30 | return MapLocationType.CLEAN; 31 | } 32 | return values()[dam]; 33 | } 34 | 35 | public void setToStack(@Nonnull ItemStack stack) { 36 | stack.setItemDamage(meta); 37 | } 38 | } 39 | 40 | /** This function can be used for SPOT types. 41 | * 42 | * @param stack 43 | * @return The point representing the map location. */ 44 | BlockPos getPoint(@Nonnull ItemStack stack); 45 | 46 | /** This function can be used for SPOT and AREA types. 47 | * 48 | * @param stack 49 | * @return The box representing the map location. */ 50 | IBox getBox(@Nonnull ItemStack stack); 51 | 52 | /** This function can be used for SPOT, AREA and ZONE types. The PATH type needs to be handled separately. 53 | * 54 | * @param stack 55 | * @return An IZone representing the map location - also an instance of IBox for SPOT and AREA types. */ 56 | IZone getZone(@Nonnull ItemStack stack); 57 | 58 | /** This function can be used for SPOT and PATH types. 59 | * 60 | * @param stack 61 | * @return A list of BlockPoses representing the path the Map Location stores. */ 62 | List getPath(@Nonnull ItemStack stack); 63 | 64 | /** This function can be used for SPOT types only. 65 | * 66 | * @param stack 67 | * @return The side of the spot. */ 68 | EnumFacing getPointSide(@Nonnull ItemStack stack); 69 | } 70 | -------------------------------------------------------------------------------- /api/buildcraft/api/items/INamedItem.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.items; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | import net.minecraft.item.ItemStack; 6 | 7 | public interface INamedItem { 8 | String getName(@Nonnull ItemStack stack); 9 | 10 | boolean setName(@Nonnull ItemStack stack, String name); 11 | } 12 | -------------------------------------------------------------------------------- /api/buildcraft/api/items/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "1.1", owner = "buildcraftapi_core", provides = "buildcraftapi_items") 6 | package buildcraft.api.items; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/library/ILibraryTypeHandler.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.library; 2 | 3 | import net.minecraft.item.ItemStack; 4 | import net.minecraft.nbt.NBTTagCompound; 5 | 6 | public interface ILibraryTypeHandler { 7 | boolean isHandler(ItemStack stack, boolean store); 8 | 9 | String getFileExtension(); 10 | 11 | int getTextColor(); 12 | 13 | String getName(ItemStack stack); 14 | 15 | ItemStack load(ItemStack stack, NBTTagCompound compound); 16 | 17 | boolean store(ItemStack stack, NBTTagCompound compound); 18 | } 19 | -------------------------------------------------------------------------------- /api/buildcraft/api/library/LibraryAPI.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.library; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | @Deprecated 7 | public final class LibraryAPI { 8 | private static final Set handlers = new HashSet<>(); 9 | 10 | private LibraryAPI() { 11 | 12 | } 13 | 14 | public static Set getHandlerSet() { 15 | return handlers; 16 | } 17 | 18 | public static void registerHandler(LibraryTypeHandler handler) { 19 | handlers.add(handler); 20 | } 21 | 22 | public static LibraryTypeHandler getHandlerFor(String extension) { 23 | for (LibraryTypeHandler h : handlers) { 24 | if (h.isInputExtension(extension)) { 25 | return h; 26 | } 27 | } 28 | return null; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /api/buildcraft/api/library/LibraryTypeHandler.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.library; 2 | 3 | import net.minecraft.item.ItemStack; 4 | 5 | @Deprecated 6 | public abstract class LibraryTypeHandler { 7 | public enum HandlerType { 8 | LOAD, 9 | STORE 10 | } 11 | 12 | private final String extension; 13 | 14 | public LibraryTypeHandler(String extension) { 15 | this.extension = extension; 16 | } 17 | 18 | public abstract boolean isHandler(ItemStack stack, HandlerType type); 19 | 20 | public boolean isInputExtension(String ext) { 21 | return extension.equals(ext); 22 | } 23 | 24 | public String getOutputExtension() { 25 | return extension; 26 | } 27 | 28 | public abstract int getTextColor(); 29 | 30 | public abstract String getName(ItemStack stack); 31 | } 32 | -------------------------------------------------------------------------------- /api/buildcraft/api/library/LibraryTypeHandlerByteArray.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.library; 2 | 3 | import net.minecraft.item.ItemStack; 4 | 5 | public abstract class LibraryTypeHandlerByteArray extends LibraryTypeHandler { 6 | public LibraryTypeHandlerByteArray(String extension) { 7 | super(extension); 8 | } 9 | 10 | public abstract ItemStack load(ItemStack stack, byte[] data); 11 | 12 | public abstract byte[] store(ItemStack stack); 13 | } 14 | -------------------------------------------------------------------------------- /api/buildcraft/api/library/LibraryTypeHandlerNBT.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.library; 2 | 3 | import net.minecraft.item.ItemStack; 4 | import net.minecraft.nbt.NBTTagCompound; 5 | 6 | public abstract class LibraryTypeHandlerNBT extends LibraryTypeHandler { 7 | public LibraryTypeHandlerNBT(String extension) { 8 | super(extension); 9 | } 10 | 11 | public abstract ItemStack load(ItemStack stack, NBTTagCompound nbt); 12 | 13 | public abstract boolean store(ItemStack stack, NBTTagCompound nbt); 14 | } 15 | -------------------------------------------------------------------------------- /api/buildcraft/api/library/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "2.0", owner = "buildcraftapi_core", provides = "buildcraftapi_library") 6 | package buildcraft.api.library; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/lists/ListMatchHandler.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.lists; 2 | 3 | import javax.annotation.Nonnull; 4 | import javax.annotation.Nullable; 5 | 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraft.util.NonNullList; 8 | 9 | public abstract class ListMatchHandler { 10 | public enum Type { 11 | TYPE, 12 | MATERIAL, 13 | CLASS 14 | } 15 | 16 | public abstract boolean matches(Type type, @Nonnull ItemStack stack, @Nonnull ItemStack target, boolean precise); 17 | 18 | public abstract boolean isValidSource(Type type, @Nonnull ItemStack stack); 19 | 20 | /** Get custom client examples. 21 | * 22 | * @param type 23 | * @param stack 24 | * @return A List (even empty!) if the examples satisfy this handler, null if iteration and .matches should be used 25 | * instead. */ 26 | @Nullable 27 | public NonNullList getClientExamples(Type type, @Nonnull ItemStack stack) { 28 | return null; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /api/buildcraft/api/lists/ListRegistry.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.lists; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.List; 6 | 7 | import net.minecraft.item.Item; 8 | 9 | public final class ListRegistry { 10 | public static final List> itemClassAsType = new ArrayList<>(); 11 | private static final List handlers = new ArrayList<>(); 12 | 13 | private ListRegistry() { 14 | 15 | } 16 | 17 | public static void registerHandler(ListMatchHandler h) { 18 | if (h != null) { 19 | handlers.add(h); 20 | } 21 | } 22 | 23 | public static List getHandlers() { 24 | return Collections.unmodifiableList(handlers); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /api/buildcraft/api/lists/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "1.0", owner = "buildcraftapi_core", provides = "buildcraftapi_lists") 6 | package buildcraft.api.lists; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/mj/ILaserTarget.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.mj; 6 | 7 | /** This interface should be defined by any Tile which wants to receive power from BuildCraft lasers. 8 | * 9 | * The respective Block MUST implement ILaserTargetBlock! */ 10 | public interface ILaserTarget { 11 | 12 | /** Returns The amount of power this target currently needs. 13 | * 14 | * @return The amount of power required, or 0 if no power is required. */ 15 | long getRequiredLaserPower(); 16 | 17 | /** Transfers power from the laser to the target. 18 | * 19 | * @param microJoules The number of micro Minecraft Joules to accept 20 | * @return The excess power. If the input is less than or equal to {@link #getRequiredLaserPower()} then this will return 0. */ 21 | long receiveLaserPower(long microJoules); 22 | 23 | /** Return true if the Tile Entity object is no longer a valid target. For example, if its been invalidated. 24 | * 25 | * @return true if no longer a valid target object */ 26 | boolean isInvalidTarget(); 27 | } 28 | -------------------------------------------------------------------------------- /api/buildcraft/api/mj/ILaserTargetBlock.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.mj; 6 | 7 | /** This is a marker interface for laser targets. Implement it on your Block. 8 | * 9 | * It is used by BuildCraft Lasers for optimization purposes. */ 10 | public interface ILaserTargetBlock { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /api/buildcraft/api/mj/IMjConnector.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.mj; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | /** Signifies that this should visibly connect to other Mj handling entities/tiles. This should NEVER be the tile 6 | * entity, but an encapsulated class that refers back to it. Use {@link buildcraft.api.mj.MjAPI#CAP_CONNECTOR} to access 7 | * this. */ 8 | public interface IMjConnector { 9 | /** Checks to see if this connector can connect to the other connector. By default this should check that the other 10 | * connector is the same power system. 11 | * 12 | * @param other 13 | * @return */ 14 | boolean canConnect(@Nonnull IMjConnector other); 15 | } 16 | -------------------------------------------------------------------------------- /api/buildcraft/api/mj/IMjEffectManager.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.mj; 2 | 3 | import net.minecraft.util.EnumFacing; 4 | import net.minecraft.util.math.Vec3d; 5 | import net.minecraft.world.World; 6 | 7 | /** Various effects for showing power loss visibly, and for large amounts of power, causes some damage to nearby 8 | * entities. */ 9 | public interface IMjEffectManager { 10 | void createPowerLossEffect(World world, Vec3d center, long microJoulesLost); 11 | 12 | void createPowerLossEffect(World world, Vec3d center, EnumFacing direction, long microJoulesLost); 13 | 14 | void createPowerLossEffect(World world, Vec3d center, Vec3d direction, long microJoulesLost); 15 | } 16 | -------------------------------------------------------------------------------- /api/buildcraft/api/mj/IMjPassiveProvider.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.mj; 2 | 3 | /** Designates a machine that provides power passively- it does not attempt to manually output its power (like an 4 | * engine). Power can be extracted from this by powered wooden kinesis pipes, for example. */ 5 | public interface IMjPassiveProvider extends IMjConnector { 6 | /** Attempts to extract power from this provider 7 | * 8 | * @param simulate 9 | * @return Either 0, min, max, or a value between min and max. */ 10 | long extractPower(long min, long max, boolean simulate); 11 | } 12 | -------------------------------------------------------------------------------- /api/buildcraft/api/mj/IMjReadable.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.mj; 2 | 3 | /** Indicates an MJ consumer that has readable information. */ 4 | public interface IMjReadable extends IMjConnector { 5 | long getStored(); 6 | 7 | long getCapacity(); 8 | } 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/mj/IMjReceiver.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.mj; 2 | 3 | /** Designates a machine that can receive power. */ 4 | public interface IMjReceiver extends IMjConnector { 5 | /** @return The number of microjoules that this receiver currently wants, and can accept. */ 6 | long getPowerRequested(); 7 | 8 | /** Receives power. You are encouraged to either: 9 | *

    10 | *
  • Use up all power immediately, or when you next tick. 11 | *
  • Store all power in something like an {@link MjBattery} for later usage. 12 | *
  • Refuse all power (if you have no more work to do or your {@link MjBattery} is full). 13 | *
14 | * 15 | * Note that callers are NOT expected to call {@link #canReceive()} before calling this - implementors should check 16 | * all of the conditions in {@link #canReceive()} before accepting power. 17 | * 18 | * @param microJoules The number of micro joules to add. 19 | * @param simulate If true then just pretend you received power- don't actually change any of your internal state. 20 | * @return The excess power. */ 21 | long receivePower(long microJoules, boolean simulate); 22 | 23 | /** Checks to see if {@link #receivePower(long, boolean)} *might* accept any power right now, ignoring the amount of 24 | * power contained right now (if any). 25 | * 26 | * @return True if this {@link IMjReceiver} can receive power right now. */ 27 | default boolean canReceive() { 28 | return true; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /api/buildcraft/api/mj/IMjRedstoneReceiver.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.mj; 2 | 3 | /** Designates that a receiver can receive redstone power (cheap, free, small amounts) */ 4 | public interface IMjRedstoneReceiver extends IMjReceiver {} 5 | -------------------------------------------------------------------------------- /api/buildcraft/api/mj/IMjToRfStatus.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.mj; 2 | 3 | import buildcraft.api.BCModules; 4 | 5 | public interface IMjToRfStatus { 6 | 7 | public static IMjToRfStatus get() { 8 | return MjToRfStatusHolder.STATUS; 9 | } 10 | 11 | MjRfConversion getConversion(); 12 | 13 | boolean isAutoconvertEnabled(); 14 | } 15 | 16 | final class MjToRfStatusHolder implements IMjToRfStatus { 17 | 18 | static final IMjToRfStatus STATUS = get0(); 19 | 20 | private static IMjToRfStatus get0() { 21 | if (BCModules.LIB.isLoaded()) { 22 | try { 23 | return (IMjToRfStatus) Class.forName("buildcraft.lib.BCLibConfig$MjToRfStatus").newInstance(); 24 | } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { 25 | throw new Error(e); 26 | } 27 | } else { 28 | return new MjToRfStatusHolder(); 29 | } 30 | } 31 | 32 | private final MjRfConversion defaultConversion = MjRfConversion.createDefault(); 33 | 34 | @Override 35 | public MjRfConversion getConversion() { 36 | return defaultConversion; 37 | } 38 | 39 | @Override 40 | public boolean isAutoconvertEnabled() { 41 | return false; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /api/buildcraft/api/mj/MjRfConversion.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.mj; 2 | 3 | public class MjRfConversion { 4 | 5 | /** Maximum MJ per RF, or minimum of 5 RF to make 1 MJ. */ 6 | public static final long MAX_MJ_PER_RF = MjAPI.MJ / 5; 7 | 8 | /** Minimum MJ per RF, or maximum of 10,000 RF to make 1 MJ */ 9 | public static final long MIN_MJ_PER_RF = MjAPI.MJ / 10_000; 10 | 11 | /** Default MJ per RF. */ 12 | public static final long DEFAULT_MJ_PER_RF = MjAPI.MJ / 10; 13 | 14 | /** micro MJ per 1 int rf. */ 15 | public final long mjPerRf; 16 | 17 | /** Set to true if {@link #mjPerRf} has been set to the {@link #DEFAULT_MJ_PER_RF} because the passed in value was 18 | * out-of-bounds. (This is used to differentiate between it being explicitly set to the default value). */ 19 | public final boolean usingDefaultValue; 20 | 21 | private MjRfConversion(long mjPerRf) { 22 | if (MIN_MJ_PER_RF <= mjPerRf && mjPerRf <= MAX_MJ_PER_RF) { 23 | usingDefaultValue = false; 24 | this.mjPerRf = mjPerRf; 25 | } else { 26 | usingDefaultValue = true; 27 | this.mjPerRf = DEFAULT_MJ_PER_RF; 28 | } 29 | } 30 | 31 | /** @param mjPerRf Micro Minecraft Joules per 1 RF */ 32 | public static MjRfConversion createRaw(long mjPerRf) { 33 | return new MjRfConversion(mjPerRf); 34 | } 35 | 36 | /** @param configMjPerRf {@link MjAPI#MJ} per RF. This is rounded to the nearest 100 micro MJ */ 37 | public static MjRfConversion createParsed(double configMjPerRf) { 38 | long value = Math.round(configMjPerRf * 10_000); 39 | return new MjRfConversion(value * MjAPI.MJ / 10_000); 40 | } 41 | 42 | public static MjRfConversion createDefault() { 43 | // -10 is always out of range 44 | return new MjRfConversion(-10); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /api/buildcraft/api/mj/package-info.java: -------------------------------------------------------------------------------- 1 | /** Contains the Minecraft Joule API (shortened to Mj), reborn. 2 | *

3 | * 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 4 | * 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 5 | * million. 6 | *

7 | * A single MJ as a constant is available in {@link buildcraft.api.mj.MjAPI#ONE_MINECRAFT_JOULE}, and a player 8 | * formatter {@link buildcraft.api.mj.MjAPI#formatMj(long)} 9 | *

10 | *

Capability's

11 | *

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

    14 | *
  • {@link buildcraft.api.mj.IMjConnector} for *anything* that can (potentially) connect to any other Mj type. All 15 | * other types extend this. You should expose this with the capability 16 | * {@link buildcraft.api.mj.MjAPI#CAP_CONNECTOR}
  • 17 | *
  • {@link buildcraft.api.mj.IMjReadable} for something that has an internal battery. This is used for adding gate 18 | * triggers. This should be exposed with the capability {@link buildcraft.api.mj.MjAPI#CAP_READABLE}
  • 19 | *
  • {@link buildcraft.api.mj.IMjReceiver} for something that receives power. This should be exposed with the 20 | * capability {@link buildcraft.api.mj.MjAPI#CAP_RECEIVER}
  • 21 | *
22 | * Note that you *must* expose the base interface types as capabilities as well as the top type so if you have an 23 | * instance of {@link buildcraft.api.mj.IMjReceiver} then you must return it for both of the capability's 24 | * {@link buildcraft.api.mj.MjAPI#CAP_CONNECTOR} and {@link buildcraft.api.mj.MjAPI#CAP_RECEIVER}. A simple way to do 25 | * this is provided in {@link buildcraft.api.mj.MjCapabilityHelper}. */ 26 | package buildcraft.api.mj; 27 | -------------------------------------------------------------------------------- /api/buildcraft/api/power/IEngine.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.power; 6 | 7 | import net.minecraft.util.EnumFacing; 8 | 9 | /** Engines should implement this interface if they want to support BuildCraft's behaviour of passing power between 10 | * engines without using receivePower() (which has other issues). */ 11 | public interface IEngine { 12 | /** Returns true if the engine wants to receive power from another engine on this side. 13 | * 14 | * @param side 15 | * @return */ 16 | boolean canReceiveFromEngine(EnumFacing side); 17 | 18 | /** Receives power from an engine. 19 | * 20 | * @param microJoules The number of micro joules to add. 21 | * @param simulate If true then just pretend you received power- don't actually change any of your internal state. 22 | * @return True if all the power was accepted, false if not. 23 | * 24 | * @see buildcraft.api.mj.IMjReceiver#receivePower(long, boolean) */ 25 | boolean receivePower(long microJoules, boolean simulate); 26 | } 27 | -------------------------------------------------------------------------------- /api/buildcraft/api/power/IRedstoneEngine.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.power; 6 | 7 | public interface IRedstoneEngine {} 8 | -------------------------------------------------------------------------------- /api/buildcraft/api/power/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "1.3", owner = "buildcraftapi_core", provides = "buildcraftapi_power") 6 | package buildcraft.api.power; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/recipes/AssemblyRecipeBasic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 SpaceToad and the BuildCraft team 3 | * 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 4 | * distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/ 5 | */ 6 | 7 | package buildcraft.api.recipes; 8 | 9 | import java.util.Collections; 10 | import java.util.Set; 11 | 12 | import javax.annotation.Nonnull; 13 | 14 | import com.google.common.collect.ImmutableSet; 15 | 16 | import net.minecraft.item.ItemStack; 17 | import net.minecraft.util.NonNullList; 18 | import net.minecraft.util.ResourceLocation; 19 | 20 | import buildcraft.api.core.BuildCraftAPI; 21 | 22 | /** 23 | * @deprecated TEMPORARY CLASS DO NOT USE! 24 | */ 25 | @Deprecated 26 | public class AssemblyRecipeBasic extends AssemblyRecipe { 27 | private final long requiredMicroJoules; 28 | private final ImmutableSet requiredStacks; 29 | private final ImmutableSet output; 30 | 31 | public AssemblyRecipeBasic(ResourceLocation name, long requiredMicroJoules, ImmutableSet requiredStacks, @Nonnull ItemStack output) { 32 | this.requiredMicroJoules = requiredMicroJoules; 33 | this.requiredStacks = ImmutableSet.copyOf(requiredStacks); 34 | this.output = ImmutableSet.of(output); 35 | setRegistryName(name); 36 | } 37 | 38 | public AssemblyRecipeBasic(String name, long requiredMicroJoules, ImmutableSet requiredStacks, @Nonnull ItemStack output) { 39 | this(BuildCraftAPI.nameToResourceLocation(name), requiredMicroJoules, requiredStacks, output); 40 | } 41 | 42 | public AssemblyRecipeBasic(String name, long requiredMicroJoules, Set requiredStacks, @Nonnull ItemStack output) { 43 | this(name, requiredMicroJoules, ImmutableSet.copyOf(requiredStacks), output); 44 | } 45 | 46 | @Override 47 | public Set getOutputs(NonNullList inputs) { 48 | if (requiredStacks.stream().allMatch((definition) -> inputs.stream().anyMatch((stack) -> !stack.isEmpty() && definition.ingredient.apply(stack) && stack.getCount() >= definition.count))) 49 | return output; 50 | return Collections.emptySet(); 51 | } 52 | 53 | @Override 54 | public Set getOutputPreviews() { 55 | return output; 56 | } 57 | 58 | @Override 59 | public Set getInputsFor(@Nonnull ItemStack output) { 60 | return requiredStacks; 61 | } 62 | 63 | @Override 64 | public long getRequiredMicroJoulesFor(@Nonnull ItemStack output) { 65 | return requiredMicroJoules; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /api/buildcraft/api/recipes/BuildcraftRecipeRegistry.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.recipes; 6 | 7 | public final class BuildcraftRecipeRegistry { 8 | 9 | public static IIntegrationRecipeRegistry integrationRecipes; 10 | public static IRefineryRecipeManager refineryRecipes; 11 | 12 | private BuildcraftRecipeRegistry() {} 13 | } 14 | -------------------------------------------------------------------------------- /api/buildcraft/api/recipes/IIntegrationRecipeProvider.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.recipes; 2 | 3 | import javax.annotation.Nonnull; 4 | import javax.annotation.Nullable; 5 | 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraft.util.NonNullList; 8 | import net.minecraft.util.ResourceLocation; 9 | 10 | /** Provides a way of registering complex recipes without needing to register every possible variant. If you want the 11 | * recipes to be viewable in JEI and the guide book then you will *also* need to implement the bc lib class 12 | * IIntegrationRecipeViewable. */ 13 | public interface IIntegrationRecipeProvider { 14 | /** Gets an integration recipe for the given ingredients. 15 | * 16 | * @param target The center itemstack. 17 | * @param toIntegrate A list of stacks to try to integrate to the 18 | * @return */ 19 | @Nullable 20 | IntegrationRecipe getRecipeFor(@Nonnull ItemStack target, @Nonnull NonNullList toIntegrate); 21 | 22 | /** 23 | * Returns recipe by it's name 24 | */ 25 | IntegrationRecipe getRecipe(@Nonnull ResourceLocation name); 26 | } 27 | -------------------------------------------------------------------------------- /api/buildcraft/api/recipes/IIntegrationRecipeRegistry.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.recipes; 2 | 3 | import java.util.Iterator; 4 | 5 | public interface IIntegrationRecipeRegistry extends IIntegrationRecipeProvider { 6 | void addRecipe(IntegrationRecipe recipe); 7 | 8 | /** 9 | * Gets all of the simple recipes that are registered. Note that you *can* use the returned iterator's 10 | * {@link Iterator#remove()} method to remove recipes from this registry. 11 | */ 12 | Iterable getAllRecipes(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /api/buildcraft/api/recipes/IngredientStack.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 SpaceToad and the BuildCraft team 3 | * 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 4 | * distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/ 5 | */ 6 | 7 | package buildcraft.api.recipes; 8 | 9 | import net.minecraft.item.crafting.Ingredient; 10 | 11 | import net.minecraftforge.common.crafting.CraftingHelper; 12 | 13 | public final class IngredientStack { 14 | public final Ingredient ingredient; 15 | public final int count; 16 | 17 | public IngredientStack(Ingredient ingredient, int count) { 18 | this.ingredient = ingredient; 19 | this.count = count; 20 | } 21 | 22 | public IngredientStack(Ingredient ingredient) { 23 | this(ingredient, 1); 24 | } 25 | 26 | public static IngredientStack of(Object o) { 27 | return new IngredientStack(CraftingHelper.getIngredient(o)); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /api/buildcraft/api/recipes/IntegrationRecipe.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.recipes; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | import com.google.common.collect.ImmutableList; 6 | 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraft.util.NonNullList; 9 | import net.minecraft.util.ResourceLocation; 10 | 11 | public abstract class IntegrationRecipe { 12 | public final ResourceLocation name; 13 | 14 | public IntegrationRecipe(ResourceLocation name) { 15 | this.name = name; 16 | } 17 | 18 | /** 19 | * Determines the output of this recipe 20 | * @param target the stack in the middle to integrate the components into 21 | * @param toIntegrate All available stacks to integrate (not all have to be used up in this recipe) 22 | * @return The output to produce based on the inputs provided or an empty stack if the recipe isn't valid 23 | */ 24 | public abstract ItemStack getOutput(@Nonnull ItemStack target, NonNullList toIntegrate); 25 | 26 | /** 27 | * Determines the components to use when crafting finishes 28 | * @param output The generated outputted, determined by getOutput 29 | * @return The components to use up 30 | */ 31 | public abstract ImmutableList getRequirements(@Nonnull ItemStack output); 32 | 33 | /** 34 | * Determines the amount of MJ required to integrate 35 | * @param output The output that would be generated 36 | * @return The powercost in microjoules 37 | */ 38 | public abstract long getRequiredMicroJoules(ItemStack output); 39 | 40 | public abstract IngredientStack getCenterStack(); 41 | 42 | @Override 43 | public boolean equals(Object o) { 44 | if (this == o) { 45 | return true; 46 | } 47 | if (o == null || getClass() != o.getClass()) { 48 | return false; 49 | } 50 | 51 | IntegrationRecipe that = (IntegrationRecipe) o; 52 | 53 | return name.equals(that.name); 54 | } 55 | 56 | @Override 57 | public int hashCode() { 58 | return name.hashCode(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /api/buildcraft/api/recipes/StackDefinition.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.recipes; 2 | 3 | import buildcraft.api.core.IStackFilter; 4 | 5 | /** 6 | * @deprecated TEMPORARY CLASS DO NOT USE! 7 | */ 8 | @Deprecated 9 | public final class StackDefinition { 10 | public final IStackFilter filter; 11 | public final int count; 12 | 13 | public StackDefinition(IStackFilter filter, int count) { 14 | this.filter = filter; 15 | this.count = count; 16 | } 17 | 18 | public StackDefinition(IStackFilter filter) { 19 | this(filter, 1); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /api/buildcraft/api/recipes/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "3.0", owner = "buildcraftapi_core", provides = "buildcraftapi_recipes") 6 | package buildcraft.api.recipes; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/registry/BuildCraftRegistryManager.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.registry; 2 | 3 | public class BuildCraftRegistryManager { 4 | public static IReloadableRegistryManager managerDataPacks; 5 | 6 | /** Null on the dedicated server. */ 7 | public static IReloadableRegistryManager managerResourcePacks; 8 | } 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/registry/IReloadableRegistry.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.registry; 2 | 3 | import java.util.Collection; 4 | import java.util.Map; 5 | 6 | import net.minecraft.util.ResourceLocation; 7 | 8 | /** A registry of any Java object. This does not perform serialisation of any kind to the entries. */ 9 | public interface IReloadableRegistry { 10 | 11 | public enum PackType { 12 | RESOURCE_PACK("assets"), 13 | DATA_PACK("data"); 14 | 15 | public final String prefix; 16 | 17 | PackType(String prefix) { 18 | this.prefix = prefix; 19 | } 20 | } 21 | 22 | IReloadableRegistryManager getManager(); 23 | 24 | default void reload() { 25 | getManager().reload(this); 26 | } 27 | 28 | /** Adds an entry permanently to this reloadable manager. This will throw an exception if used during 29 | * {@link EventBuildCraftReload} event firings. */ 30 | T addPermanent(T recipe); 31 | 32 | /** @return A collection of every permanent entry added via {@link #addPermanent(Object)}. */ 33 | Collection getPermanent(); 34 | 35 | /** @return A map of all the reloadable entries, mapped from name to value. */ 36 | Map getReloadableEntryMap(); 37 | 38 | /** @return An iterable that has both {@link #getPermanent()} and 39 | * {@link #getReloadableEntryMap()}.{@link Map#values() values()}. */ 40 | Iterable getAllEntries(); 41 | } 42 | -------------------------------------------------------------------------------- /api/buildcraft/api/registry/IReloadableRegistryManager.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.registry; 2 | 3 | import java.util.Map; 4 | import java.util.Set; 5 | 6 | import buildcraft.api.registry.IReloadableRegistry.PackType; 7 | 8 | public interface IReloadableRegistryManager { 9 | 10 | PackType getType(); 11 | 12 | /** @return True if this is loading everything during post-init, false otherwise. */ 13 | boolean isLoadingAll(); 14 | 15 | void reload(IReloadableRegistry registry); 16 | 17 | void reload(IReloadableRegistry... registries); 18 | 19 | void reload(Set> registries); 20 | 21 | /** @return True if any of the calls to reload ({@link #reload(IReloadableRegistry) a}, 22 | * {@link #reload(IReloadableRegistry...) b}, or {@link #reload(Set) c}) haven't completed yet. */ 23 | boolean isInReload(); 24 | 25 | /*** @return The number of times that this reload manager has reloaded any of the registries this contains. Note 26 | * that this might be negative if the value has overflowed. This is intended to be used for checking if this 27 | * registry has reloaded while something cached a recipe, so that the cache can be cleared. This is a fairly 28 | * cheap way to see if a reload had happened, especially as reload listeners might be temporary (for example 29 | * tile entities or pipes). */ 30 | int getReloadCount(); 31 | 32 | /** @return All registries that this manager tracks. */ 33 | Map> getAllRegistries(); 34 | 35 | /** Creates and registers a basic {@link IReloadableRegistry}. 36 | * 37 | * @param name The name for the given registry. This should be unique, and the best way of doing that is to prefix 38 | * it with the modid, followed by a slash, and then the mod-unique name. 39 | * @throws IllegalArgumentException if name contains a colon. */ 40 | IReloadableRegistry createRegistry(String name); 41 | 42 | /** Scripts will be loaded from "[pack_type.prefix]/[pack_name]/compat/[entry_path]/". The entryPath parameter 43 | * should start with the modid. 44 | * 45 | * @param entryPath */ 46 | IScriptableRegistry createScriptableRegistry(String entryPath); 47 | 48 | void registerRegistry(String entryType, IScriptableRegistry registry); 49 | 50 | /** Delegates to {@link #registerRegistry(String, IScriptableRegistry)}, but uses 51 | * {@link IScriptableRegistry#getEntryType()} as the key. */ 52 | default void registerRegistry(IScriptableRegistry registry) { 53 | registerRegistry(registry.getEntryType(), registry); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /api/buildcraft/api/robots/IDockingStationProvider.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.robots; 2 | 3 | /** By default, this can be either an IPipePluggable or a TileEntity. */ 4 | public interface IDockingStationProvider { 5 | DockingStation getStation(); 6 | } 7 | -------------------------------------------------------------------------------- /api/buildcraft/api/robots/IRequestProvider.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.robots; 6 | 7 | import net.minecraft.item.ItemStack; 8 | 9 | /** Provide requests of items that need to be fulfilled. 10 | * 11 | * Requests are organized as an linear array, where null entries mark slots without a requests. A request in a slot, or 12 | * the amount of slots, is allowed to change before a call to {@link #offerItem(int, ItemStack)}, but it is not 13 | * recommended that this is frequent, since the request delivery won't fail until it is offered the previous request. */ 14 | public interface IRequestProvider { 15 | /** Return the total number of request slots available from this provider. 16 | * 17 | * @return */ 18 | int getRequestsCount(); 19 | 20 | /** Return a stack with the request in the slot. 21 | * 22 | * @param slot 23 | * @return the request in the slot, or null if there's no request. */ 24 | ItemStack getRequest(int slot); 25 | 26 | /** Fulfill the request in slot with the stack given and return any excess. 27 | * 28 | * @param slot 29 | * @param stack 30 | * @return any excess that was not used to fulfill the request. */ 31 | ItemStack offerItem(int slot, ItemStack stack); 32 | } 33 | -------------------------------------------------------------------------------- /api/buildcraft/api/robots/IRobotOverlayItem.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.robots; 2 | 3 | import net.minecraft.client.renderer.texture.TextureManager; 4 | import net.minecraft.item.ItemStack; 5 | 6 | import net.minecraftforge.fml.relauncher.Side; 7 | import net.minecraftforge.fml.relauncher.SideOnly; 8 | 9 | public interface IRobotOverlayItem { 10 | boolean isValidRobotOverlay(ItemStack stack); 11 | 12 | @SideOnly(Side.CLIENT) 13 | void renderRobotOverlay(ItemStack stack, TextureManager textureManager); 14 | } 15 | -------------------------------------------------------------------------------- /api/buildcraft/api/robots/IRobotRegistry.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.robots; 6 | 7 | import java.util.Collection; 8 | 9 | import net.minecraft.nbt.NBTTagCompound; 10 | import net.minecraft.util.EnumFacing; 11 | import net.minecraft.util.math.BlockPos; 12 | 13 | public interface IRobotRegistry { 14 | 15 | long getNextRobotId(); 16 | 17 | void registerRobot(EntityRobotBase robot); 18 | 19 | void killRobot(EntityRobotBase robot); 20 | 21 | void unloadRobot(EntityRobotBase robot); 22 | 23 | EntityRobotBase getLoadedRobot(long id); 24 | 25 | boolean isTaken(ResourceId resourceId); 26 | 27 | long robotIdTaking(ResourceId resourceId); 28 | 29 | EntityRobotBase robotTaking(ResourceId resourceId); 30 | 31 | boolean take(ResourceId resourceId, EntityRobotBase robot); 32 | 33 | boolean take(ResourceId resourceId, long robotId); 34 | 35 | void release(ResourceId resourceId); 36 | 37 | void releaseResources(EntityRobotBase robot); 38 | 39 | DockingStation getStation(BlockPos pos, EnumFacing side); 40 | 41 | Collection getStations(); 42 | 43 | void registerStation(DockingStation station); 44 | 45 | void removeStation(DockingStation station); 46 | 47 | void take(DockingStation station, long robotId); 48 | 49 | void release(DockingStation station, long robotId); 50 | 51 | void writeToNBT(NBTTagCompound nbt); 52 | 53 | void readFromNBT(NBTTagCompound nbt); 54 | 55 | void registryMarkDirty(); 56 | } 57 | -------------------------------------------------------------------------------- /api/buildcraft/api/robots/IRobotRegistryProvider.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.robots; 2 | 3 | import net.minecraft.world.World; 4 | 5 | public interface IRobotRegistryProvider { 6 | IRobotRegistry getRegistry(World world); 7 | } 8 | -------------------------------------------------------------------------------- /api/buildcraft/api/robots/ResourceId.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.robots; 6 | 7 | import net.minecraft.nbt.NBTTagCompound; 8 | 9 | public abstract class ResourceId { 10 | 11 | protected ResourceId() {} 12 | 13 | public void writeToNBT(NBTTagCompound nbt) { 14 | nbt.setString("resourceName", RobotManager.getResourceIdName(getClass())); 15 | } 16 | 17 | protected void readFromNBT(NBTTagCompound nbt) {} 18 | 19 | public static ResourceId load(NBTTagCompound nbt) { 20 | try { 21 | Class cls; 22 | if (nbt.hasKey("class")) { 23 | // Migration support for 6.4.x 24 | cls = RobotManager.getResourceIdByLegacyClassName(nbt.getString("class")); 25 | } else { 26 | cls = RobotManager.getResourceIdByName(nbt.getString("resourceName")); 27 | } 28 | 29 | ResourceId id = (ResourceId) cls.newInstance(); 30 | id.readFromNBT(nbt); 31 | 32 | return id; 33 | } catch (Throwable e) { 34 | e.printStackTrace(); 35 | } 36 | 37 | return null; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /api/buildcraft/api/robots/ResourceIdBlock.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents 4 | * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ 5 | package buildcraft.api.robots; 6 | 7 | import org.apache.commons.lang3.builder.HashCodeBuilder; 8 | 9 | import net.minecraft.nbt.NBTTagCompound; 10 | import net.minecraft.tileentity.TileEntity; 11 | import net.minecraft.util.math.BlockPos; 12 | 13 | import buildcraft.api.core.EnumPipePart; 14 | 15 | public class ResourceIdBlock extends ResourceId { 16 | 17 | public BlockPos pos = new BlockPos(0, 0, 0); 18 | public EnumPipePart side = EnumPipePart.CENTER; 19 | 20 | public ResourceIdBlock() { 21 | 22 | } 23 | 24 | public ResourceIdBlock(int x, int y, int z) { 25 | pos = new BlockPos(x, y, z); 26 | } 27 | 28 | public ResourceIdBlock(BlockPos iIndex) { 29 | pos = iIndex; 30 | } 31 | 32 | public ResourceIdBlock(TileEntity tile) { 33 | pos = tile.getPos(); 34 | } 35 | 36 | @Override 37 | public boolean equals(Object obj) { 38 | if (this == obj) return true; 39 | if (obj == null || obj.getClass() != getClass()) { 40 | return false; 41 | } 42 | 43 | ResourceIdBlock compareId = (ResourceIdBlock) obj; 44 | 45 | return pos.equals(compareId.pos) && side == compareId.side; 46 | } 47 | 48 | @Override 49 | public int hashCode() { 50 | return new HashCodeBuilder().append(pos.hashCode()).append(side != null ? side.ordinal() : 0).build(); 51 | } 52 | 53 | @Override 54 | public void writeToNBT(NBTTagCompound nbt) { 55 | super.writeToNBT(nbt); 56 | 57 | int[] arr = new int[] { pos.getX(), pos.getY(), pos.getZ() }; 58 | nbt.setIntArray("pos", arr); 59 | 60 | nbt.setTag("side", side.writeToNBT()); 61 | } 62 | 63 | @Override 64 | protected void readFromNBT(NBTTagCompound nbt) { 65 | super.readFromNBT(nbt); 66 | int[] arr = nbt.getIntArray("pos"); 67 | pos = new BlockPos(arr[0], arr[1], arr[2]); 68 | 69 | side = EnumPipePart.readFromNBT(nbt.getTag("side")); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /api/buildcraft/api/robots/ResourceIdRequest.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents 4 | * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ 5 | package buildcraft.api.robots; 6 | 7 | import org.apache.commons.lang3.builder.HashCodeBuilder; 8 | 9 | import net.minecraft.nbt.NBTTagCompound; 10 | 11 | import buildcraft.api.core.EnumPipePart; 12 | 13 | public class ResourceIdRequest extends ResourceIdBlock { 14 | 15 | private int slot; 16 | 17 | public ResourceIdRequest() { 18 | 19 | } 20 | 21 | public ResourceIdRequest(DockingStation station, int slot) { 22 | pos = station.index(); 23 | side = EnumPipePart.fromFacing(station.side()); 24 | this.slot = slot; 25 | } 26 | 27 | @Override 28 | public boolean equals(Object obj) { 29 | if (obj == null) return false; 30 | if (!super.equals(obj)) return false; 31 | ResourceIdRequest compareId = (ResourceIdRequest) obj; 32 | 33 | return slot == compareId.slot; 34 | } 35 | 36 | @Override 37 | public int hashCode() { 38 | return new HashCodeBuilder().append(super.hashCode()).append(slot).build(); 39 | } 40 | 41 | @Override 42 | public void writeToNBT(NBTTagCompound nbt) { 43 | super.writeToNBT(nbt); 44 | 45 | nbt.setInteger("localId", slot); 46 | } 47 | 48 | @Override 49 | protected void readFromNBT(NBTTagCompound nbt) { 50 | super.readFromNBT(nbt); 51 | 52 | slot = nbt.getInteger("localId"); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /api/buildcraft/api/robots/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "3.0", owner = "buildcraftapi_core", provides = "buildcraftapi_robotics") 6 | package buildcraft.api.robots; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/schematics/ISchematicBlock.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.schematics; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | import java.util.Set; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | import net.minecraft.item.ItemStack; 10 | import net.minecraft.nbt.NBTTagCompound; 11 | import net.minecraft.util.Rotation; 12 | import net.minecraft.util.math.BlockPos; 13 | import net.minecraft.world.World; 14 | 15 | import net.minecraftforge.fluids.FluidStack; 16 | 17 | import buildcraft.api.core.InvalidInputDataException; 18 | 19 | public interface ISchematicBlock { 20 | void init(SchematicBlockContext context); 21 | 22 | default boolean isAir() { 23 | return false; 24 | } 25 | 26 | @Nonnull 27 | default Set getRequiredBlockOffsets() { 28 | return Collections.emptySet(); 29 | } 30 | 31 | @Nonnull 32 | default List computeRequiredItems() { 33 | return Collections.emptyList(); 34 | } 35 | 36 | @Nonnull 37 | default List computeRequiredFluids() { 38 | return Collections.emptyList(); 39 | } 40 | 41 | ISchematicBlock getRotated(Rotation rotation); 42 | 43 | boolean canBuild(World world, BlockPos blockPos); 44 | 45 | default boolean isReadyToBuild(World world, BlockPos blockPos) { 46 | return true; 47 | } 48 | 49 | boolean build(World world, BlockPos blockPos); 50 | 51 | boolean buildWithoutChecks(World world, BlockPos blockPos); 52 | 53 | boolean isBuilt(World world, BlockPos blockPos); 54 | 55 | NBTTagCompound serializeNBT(); 56 | 57 | /** @throws InvalidInputDataException If the input data wasn't correct or didn't make sense. */ 58 | void deserializeNBT(NBTTagCompound nbt) throws InvalidInputDataException; 59 | } 60 | -------------------------------------------------------------------------------- /api/buildcraft/api/schematics/ISchematicEntity.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.schematics; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | import net.minecraft.entity.Entity; 9 | import net.minecraft.item.ItemStack; 10 | import net.minecraft.nbt.NBTTagCompound; 11 | import net.minecraft.util.Rotation; 12 | import net.minecraft.util.math.BlockPos; 13 | import net.minecraft.util.math.Vec3d; 14 | import net.minecraft.world.World; 15 | 16 | import net.minecraftforge.fluids.FluidStack; 17 | 18 | import buildcraft.api.core.InvalidInputDataException; 19 | 20 | public interface ISchematicEntity { 21 | void init(SchematicEntityContext context); 22 | 23 | Vec3d getPos(); 24 | 25 | @Nonnull 26 | default List computeRequiredItems() { 27 | return Collections.emptyList(); 28 | } 29 | 30 | @Nonnull 31 | default List computeRequiredFluids() { 32 | return Collections.emptyList(); 33 | } 34 | 35 | ISchematicEntity getRotated(Rotation rotation); 36 | 37 | Entity build(World world, BlockPos basePos); 38 | 39 | Entity buildWithoutChecks(World world, BlockPos basePos); 40 | 41 | NBTTagCompound serializeNBT(); 42 | 43 | /** @throws InvalidInputDataException If the input data wasn't correct or didn't make sense. */ 44 | void deserializeNBT(NBTTagCompound nbt) throws InvalidInputDataException; 45 | } 46 | -------------------------------------------------------------------------------- /api/buildcraft/api/schematics/SchematicBlockContext.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.schematics; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | import net.minecraft.block.Block; 6 | import net.minecraft.block.state.IBlockState; 7 | import net.minecraft.util.math.BlockPos; 8 | import net.minecraft.world.World; 9 | 10 | public class SchematicBlockContext { 11 | @Nonnull 12 | public final World world; 13 | @Nonnull 14 | public final BlockPos basePos; 15 | @Nonnull 16 | public final BlockPos pos; 17 | @Nonnull 18 | public final IBlockState blockState; 19 | @Nonnull 20 | public final Block block; 21 | 22 | public SchematicBlockContext(@Nonnull World world, 23 | @Nonnull BlockPos basePos, 24 | @Nonnull BlockPos pos, 25 | @Nonnull IBlockState blockState, 26 | @Nonnull Block block) { 27 | this.world = world; 28 | this.basePos = basePos; 29 | this.pos = pos; 30 | this.blockState = blockState; 31 | this.block = block; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /api/buildcraft/api/schematics/SchematicBlockFactory.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.schematics; 2 | 3 | import java.util.function.Predicate; 4 | import java.util.function.Supplier; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | import net.minecraft.util.ResourceLocation; 9 | 10 | public class SchematicBlockFactory implements Comparable> { 11 | @Nonnull 12 | public final ResourceLocation name; 13 | public final int priority; 14 | @Nonnull 15 | public final Predicate predicate; 16 | @Nonnull 17 | public final Supplier supplier; 18 | @Nonnull 19 | public final Class clazz; 20 | 21 | @SuppressWarnings("unchecked") 22 | public SchematicBlockFactory(@Nonnull ResourceLocation name, 23 | int priority, 24 | @Nonnull Predicate predicate, 25 | @Nonnull Supplier supplier) { 26 | this.name = name; 27 | this.priority = priority; 28 | this.predicate = predicate; 29 | this.supplier = supplier; 30 | clazz = (Class) supplier.get().getClass(); 31 | } 32 | 33 | @Override 34 | public int compareTo(@Nonnull SchematicBlockFactory o) { 35 | return priority != o.priority 36 | ? Integer.compare(priority, o.priority) 37 | : name.toString().compareTo(o.name.toString()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /api/buildcraft/api/schematics/SchematicEntityContext.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.schematics; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | import net.minecraft.entity.Entity; 6 | import net.minecraft.util.math.BlockPos; 7 | import net.minecraft.world.World; 8 | 9 | public class SchematicEntityContext { 10 | @Nonnull 11 | public final World world; 12 | @Nonnull 13 | public final BlockPos basePos; 14 | @Nonnull 15 | public final Entity entity; 16 | 17 | public SchematicEntityContext(@Nonnull World world, 18 | @Nonnull BlockPos basePos, 19 | @Nonnull Entity entity) { 20 | this.world = world; 21 | this.basePos = basePos; 22 | this.entity = entity; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /api/buildcraft/api/schematics/SchematicEntityFactory.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.schematics; 2 | 3 | import java.util.function.Predicate; 4 | import java.util.function.Supplier; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | import net.minecraft.util.ResourceLocation; 9 | 10 | public class SchematicEntityFactory implements Comparable> { 11 | @Nonnull 12 | public final ResourceLocation name; 13 | public final int priority; 14 | @Nonnull 15 | public final Predicate predicate; 16 | @Nonnull 17 | public final Supplier supplier; 18 | @Nonnull 19 | public final Class clazz; 20 | 21 | @SuppressWarnings("unchecked") 22 | public SchematicEntityFactory(@Nonnull ResourceLocation name, 23 | int priority, 24 | @Nonnull Predicate predicate, 25 | @Nonnull Supplier supplier) { 26 | this.name = name; 27 | this.priority = priority; 28 | this.predicate = predicate; 29 | this.supplier = supplier; 30 | clazz = (Class) supplier.get().getClass(); 31 | } 32 | 33 | @Override 34 | public int compareTo(@Nonnull SchematicEntityFactory o) { 35 | return priority != o.priority 36 | ? Integer.compare(priority, o.priority) 37 | : name.toString().compareTo(o.name.toString()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/IAction.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.statements; 2 | 3 | /** Marker interface that designates a class as being an action. Note that you *must* implement ONE of the following 4 | * interfaces to be recognised as an action: {@link IActionInternal}, {@link IActionInternalSided}, or 5 | * {@link IActionExternal} */ 6 | public interface IAction extends IStatement {} 7 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/IActionExternal.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.statements; 6 | 7 | import net.minecraft.tileentity.TileEntity; 8 | import net.minecraft.util.EnumFacing; 9 | 10 | public interface IActionExternal extends IAction { 11 | void actionActivate(TileEntity target, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); 12 | } 13 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/IActionInternal.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.statements; 6 | 7 | public interface IActionInternal extends IAction { 8 | 9 | void actionActivate(IStatementContainer source, IStatementParameter[] parameters); 10 | } 11 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/IActionInternalSided.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.statements; 2 | 3 | import net.minecraft.util.EnumFacing; 4 | 5 | public interface IActionInternalSided extends IAction { 6 | void actionActivate(EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); 7 | } 8 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/IActionProvider.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.statements; 6 | 7 | import java.util.Collection; 8 | 9 | import javax.annotation.Nonnull; 10 | 11 | import net.minecraft.tileentity.TileEntity; 12 | import net.minecraft.util.EnumFacing; 13 | 14 | public interface IActionProvider { 15 | void addInternalActions(Collection actions, IStatementContainer container); 16 | 17 | void addInternalSidedActions(Collection actions, IStatementContainer container, @Nonnull EnumFacing side); 18 | 19 | void addExternalActions(Collection actions, @Nonnull EnumFacing side, TileEntity tile); 20 | } 21 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/IActionReceptor.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.statements; 6 | 7 | public interface IActionReceptor { 8 | void actionActivated(IStatement statement, IStatementParameter[] parameters); 9 | } 10 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/IActionSingle.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.statements; 2 | 3 | public interface IActionSingle extends IAction { 4 | /** @return True if this action should only be fired for the first tick of it being active. */ 5 | boolean singleActionTick(); 6 | } 7 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/IGuiSlot.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.statements; 2 | 3 | import java.util.List; 4 | 5 | import javax.annotation.Nullable; 6 | 7 | import com.google.common.collect.ImmutableList; 8 | 9 | import net.minecraftforge.fml.relauncher.Side; 10 | import net.minecraftforge.fml.relauncher.SideOnly; 11 | 12 | import buildcraft.api.core.IConvertable; 13 | import buildcraft.api.core.render.ISprite; 14 | 15 | public interface IGuiSlot extends IConvertable { 16 | /** Every statement needs a unique tag, it should be in the format of "<modid>:<name>". 17 | * 18 | * @return the unique id */ 19 | String getUniqueTag(); 20 | 21 | /** Return the description in the UI. Note that this should NEVER be called directly, instead this acts as a bridge 22 | * for {@link #getTooltip()}. (As such this might return null or throw an exception) */ 23 | @SideOnly(Side.CLIENT) 24 | String getDescription(); 25 | 26 | /** @return The full tooltip for the UI. */ 27 | @SideOnly(Side.CLIENT) 28 | default List getTooltip() { 29 | String desc = getDescription(); 30 | if (desc == null) { 31 | return ImmutableList.of(); 32 | } 33 | return ImmutableList.of(desc); 34 | } 35 | 36 | /** @return A sprite to show in a GUI, or null if this should not render a sprite. */ 37 | @SideOnly(Side.CLIENT) 38 | @Nullable 39 | ISprite getSprite(); 40 | } 41 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/IOverrideDefaultStatements.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.statements; 6 | 7 | import java.util.List; 8 | 9 | public interface IOverrideDefaultStatements { 10 | List overrideTriggers(); 11 | 12 | List overrideActions(); 13 | } 14 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/IStatement.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.statements; 6 | 7 | /** Designates some sort of statement. Most of the time you should implement {@link ITriggerExternal}, 8 | * {@link ITriggerInternal}, {@link IActionExternal} or {@link IActionInternal} though. */ 9 | public interface IStatement extends IGuiSlot { 10 | 11 | /** Return the maximum number of parameter this statement can have, 0 if none. */ 12 | int maxParameters(); 13 | 14 | /** Return the minimum number of parameter this statement can have, 0 if none. */ 15 | int minParameters(); 16 | 17 | /** Create parameters for the statement. */ 18 | IStatementParameter createParameter(int index); 19 | 20 | /** Creates a parameter for the given index, optionally returning the old param if it is still valid. By default 21 | * this checks the classes of the old and new parameters, however it is sensible to override this check in case the 22 | * parameters given no longer match. For example if you return {@link StatementParameterItemStack} from 23 | * {@link #createParameter(int)} and require the stack to match a filter, but the incoming stack might not. 24 | * 25 | * @param old 26 | * @param index 27 | * @return */ 28 | default IStatementParameter createParameter(IStatementParameter old, int index) { 29 | IStatementParameter _new = createParameter(index); 30 | if (old == null || _new == null) { 31 | return _new; 32 | } else if (old.getClass() == _new.getClass()) { 33 | return old; 34 | } 35 | return _new; 36 | } 37 | 38 | /** This returns the statement after a left rotation. Used in particular in blueprints orientation. */ 39 | IStatement rotateLeft(); 40 | 41 | /** This returns a group of related statements. For example "redstone signal input" should probably return an array 42 | * of "RS_SIGNAL_ON" and "RS_SIGNAL_OFF". It is recommended to return an array containing this object. */ 43 | IStatement[] getPossible(); 44 | 45 | default boolean isPossibleOrdered() { 46 | return false; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/IStatementContainer.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.statements; 6 | 7 | import javax.annotation.Nullable; 8 | 9 | import net.minecraft.tileentity.TileEntity; 10 | import net.minecraft.util.EnumFacing; 11 | 12 | /** This is implemented by objects containing Statements, such as Gates and TileEntities. */ 13 | public interface IStatementContainer { 14 | TileEntity getTile(); 15 | 16 | @Nullable 17 | TileEntity getNeighbourTile(EnumFacing side); 18 | } 19 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/ITrigger.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.statements; 2 | 3 | /** Marker interface that designates a class as being a trigger. Note that you *must* implement ONE of the following 4 | * interfaces to be recognised as a trigger: {@link ITriggerInternal}, {@link ITriggerInternalSided}, or 5 | * {@link ITriggerExternal} */ 6 | public interface ITrigger extends IStatement {} 7 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/ITriggerExternal.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.statements; 6 | 7 | import net.minecraft.tileentity.TileEntity; 8 | import net.minecraft.util.EnumFacing; 9 | 10 | public interface ITriggerExternal extends ITrigger { 11 | 12 | boolean isTriggerActive(TileEntity target, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/ITriggerExternalOverride.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.statements; 2 | 3 | import net.minecraft.util.EnumFacing; 4 | 5 | /** This interface can be used by tiles to override external trigger behaviour. 6 | * 7 | * Please use wisely. */ 8 | public interface ITriggerExternalOverride { 9 | enum Result { 10 | TRUE, 11 | FALSE, 12 | IGNORE 13 | } 14 | 15 | Result override(EnumFacing side, IStatementContainer source, ITriggerExternal trigger, IStatementParameter[] parameters); 16 | } 17 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/ITriggerInternal.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.statements; 6 | 7 | public interface ITriggerInternal extends ITrigger { 8 | 9 | boolean isTriggerActive(IStatementContainer source, IStatementParameter[] parameters); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/ITriggerInternalSided.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.statements; 2 | 3 | import net.minecraft.util.EnumFacing; 4 | 5 | public interface ITriggerInternalSided extends ITrigger { 6 | boolean isTriggerActive(EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); 7 | } 8 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/ITriggerProvider.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.statements; 6 | 7 | import java.util.Collection; 8 | 9 | import javax.annotation.Nonnull; 10 | 11 | import net.minecraft.tileentity.TileEntity; 12 | import net.minecraft.util.EnumFacing; 13 | 14 | public interface ITriggerProvider { 15 | void addInternalTriggers(Collection triggers, IStatementContainer container); 16 | 17 | void addInternalSidedTriggers(Collection triggers, IStatementContainer container, @Nonnull EnumFacing side); 18 | 19 | /** Returns the list of triggers available to a gate next to the given block. */ 20 | void addExternalTriggers(Collection triggers, @Nonnull EnumFacing side, TileEntity tile); 21 | } 22 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/StatementMouseClick.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.statements; 6 | 7 | public final class StatementMouseClick { 8 | private int button; 9 | private boolean shift; 10 | 11 | public StatementMouseClick(int button, boolean shift) { 12 | this.button = button; 13 | this.shift = shift; 14 | } 15 | 16 | public boolean isShift() { 17 | return shift; 18 | } 19 | 20 | public int getButton() { 21 | return button; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/StatementSlot.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents 4 | * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ 5 | package buildcraft.api.statements; 6 | 7 | import java.util.Arrays; 8 | import java.util.Objects; 9 | 10 | import buildcraft.api.core.EnumPipePart; 11 | 12 | public class StatementSlot { 13 | public IStatement statement; 14 | public IStatementParameter[] parameters; 15 | public EnumPipePart part = EnumPipePart.CENTER; 16 | 17 | @Override 18 | public boolean equals(Object o) { 19 | if (!(o instanceof StatementSlot)) { 20 | return false; 21 | } 22 | StatementSlot s = (StatementSlot) o; 23 | if (s.statement != statement || parameters.length != s.parameters.length) { 24 | return false; 25 | } 26 | for (int i = 0; i < parameters.length; i++) { 27 | IStatementParameter p1 = parameters[i]; 28 | IStatementParameter p2 = s.parameters[i]; 29 | if (p1 == null) { 30 | if (p2 != null) return false; 31 | continue; 32 | } 33 | if (p2 == null) return false; 34 | if (!(p1.equals(p2))) { 35 | return false; 36 | } 37 | } 38 | return true; 39 | } 40 | 41 | @Override 42 | public int hashCode() { 43 | return Objects.hash(statement, Arrays.deepHashCode(parameters)); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/containers/IFillerStatementContainer.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.statements.containers; 2 | 3 | import javax.annotation.Nullable; 4 | 5 | import net.minecraft.tileentity.TileEntity; 6 | import net.minecraft.world.World; 7 | 8 | import buildcraft.api.core.IBox; 9 | import buildcraft.api.filler.IFillerPattern; 10 | import buildcraft.api.statements.IStatementContainer; 11 | import buildcraft.api.statements.IStatementParameter; 12 | 13 | public interface IFillerStatementContainer extends IStatementContainer { 14 | 15 | /** Unlike in {@link IStatementContainer} some containers might not be tile based (for example the volume box). */ 16 | @Override 17 | @Nullable 18 | TileEntity getTile(); 19 | 20 | World getFillerWorld(); 21 | 22 | /** @return True if this filler has a non-zero sized box. */ 23 | boolean hasBox(); 24 | 25 | /** @return The box that the filler will (default) to building in. 26 | * @throws IllegalStateException if {@link #hasBox()} returns false. */ 27 | IBox getBox() throws IllegalStateException; 28 | 29 | void setPattern(IFillerPattern pattern, IStatementParameter[] params); 30 | } 31 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/containers/IRedstoneStatementContainer.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.statements.containers; 2 | 3 | import net.minecraft.util.EnumFacing; 4 | 5 | public interface IRedstoneStatementContainer { 6 | /** Get the redstone input from a given side. 7 | * 8 | * @param side The side - use "null" for maximum input. 9 | * @return The redstone input, from 0 to 15. */ 10 | int getRedstoneInput(EnumFacing side); 11 | 12 | /** Set the redstone input for a given side. 13 | * 14 | * @param side The side - use "null" for all sides. 15 | * @return Whether the set was successful. */ 16 | boolean setRedstoneOutput(EnumFacing side, int value); 17 | } 18 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/containers/ISidedStatementContainer.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.statements.containers; 2 | 3 | import net.minecraft.util.EnumFacing; 4 | 5 | import buildcraft.api.statements.IStatementContainer; 6 | 7 | /** Created by asie on 3/14/15. */ 8 | public interface ISidedStatementContainer extends IStatementContainer { 9 | EnumFacing getSide(); 10 | } 11 | -------------------------------------------------------------------------------- /api/buildcraft/api/statements/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "1.1", owner = "buildcraftapi_core", provides = "buildcraftapi_statements") 6 | package buildcraft.api.statements; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/template/ITemplateHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 SpaceToad and the BuildCraft team 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. 5 | */ 6 | 7 | package buildcraft.api.template; 8 | 9 | import net.minecraft.entity.player.EntityPlayer; 10 | import net.minecraft.item.ItemStack; 11 | import net.minecraft.util.math.BlockPos; 12 | import net.minecraft.world.World; 13 | 14 | public interface ITemplateHandler { 15 | boolean handle(World world, BlockPos pos, EntityPlayer player, ItemStack stack); 16 | } 17 | -------------------------------------------------------------------------------- /api/buildcraft/api/template/ITemplateRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 SpaceToad and the BuildCraft team 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. 5 | */ 6 | 7 | package buildcraft.api.template; 8 | 9 | import net.minecraft.entity.player.EntityPlayer; 10 | import net.minecraft.item.ItemStack; 11 | import net.minecraft.util.math.BlockPos; 12 | import net.minecraft.world.World; 13 | 14 | import buildcraft.api.core.EnumHandlerPriority; 15 | 16 | public interface ITemplateRegistry { 17 | /** Adds a handler with a {@link EnumHandlerPriority} of {@linkplain EnumHandlerPriority#NORMAL} */ 18 | default void addHandler(ITemplateHandler handler) { 19 | addHandler(handler, EnumHandlerPriority.NORMAL); 20 | } 21 | 22 | void addHandler(ITemplateHandler handler, EnumHandlerPriority priority); 23 | 24 | boolean handle(World world, BlockPos pos, EntityPlayer player, ItemStack stack); 25 | } 26 | -------------------------------------------------------------------------------- /api/buildcraft/api/template/TemplateApi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 SpaceToad and the BuildCraft team 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. 5 | */ 6 | 7 | package buildcraft.api.template; 8 | 9 | public class TemplateApi { 10 | public static ITemplateRegistry templateRegistry; 11 | } 12 | -------------------------------------------------------------------------------- /api/buildcraft/api/tiles/IControllable.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.tiles; 6 | 7 | import java.util.Locale; 8 | 9 | /** This interface should be implemented by any Tile Entity which wishes to have non-redstone automation (for example, 10 | * BuildCraft Gates, but also other mods which implement it, e.g. OpenComputers). */ 11 | public interface IControllable { 12 | enum Mode { 13 | ON, 14 | OFF, 15 | LOOP; 16 | 17 | public static final Mode[] VALUES = values(); 18 | 19 | public final String lowerCaseName = name().toLowerCase(Locale.ROOT); 20 | } 21 | 22 | Mode getControlMode(); 23 | 24 | void setControlMode(Mode mode); 25 | 26 | default boolean acceptsControlMode(Mode mode) { 27 | return mode != null; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /api/buildcraft/api/tiles/IDebuggable.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.tiles; 2 | 3 | import java.util.List; 4 | 5 | import net.minecraft.util.EnumFacing; 6 | 7 | import net.minecraftforge.fml.relauncher.Side; 8 | import net.minecraftforge.fml.relauncher.SideOnly; 9 | 10 | public interface IDebuggable { 11 | /** Get the debug information from a tile entity as a list of strings, used for the F3 debug menu. The left and 12 | * right parameters correspond to the sides of the F3 screen. 13 | * 14 | * @param side The side the block was clicked on, may be null if we don't know, or is the "centre" side */ 15 | void getDebugInfo(List left, List right, EnumFacing side); 16 | 17 | /** Same as {@link #getDebugInfo(List, List, EnumFacing)}, but only for client 18 | * 19 | * @param side same as for {@link #getDebugInfo(List, List, EnumFacing)} */ 20 | @SideOnly(Side.CLIENT) 21 | default void getClientDebugInfo(List left, List right, EnumFacing side) { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /api/buildcraft/api/tiles/IHasWork.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.tiles; 6 | 7 | /** This interface should be implemented by any Tile Entity which carries out work (crafting, ore processing, mining, et 8 | * cetera). */ 9 | public interface IHasWork { 10 | /** Check if the Tile Entity is currently doing any work. 11 | * 12 | * @return True if the Tile Entity is doing work. */ 13 | boolean hasWork(); 14 | } 15 | -------------------------------------------------------------------------------- /api/buildcraft/api/tiles/IHeatable.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.tiles; 6 | 7 | /** This interface should be implemented by Tile Entities which have an internal heat value. */ 8 | public interface IHeatable { 9 | /** @return The minimum heat value, in degrees. */ 10 | double getMinHeatValue(); 11 | 12 | /** @return The preferred heat value, in degrees. */ 13 | double getIdealHeatValue(); 14 | 15 | /** @return The maximum heat value, in degrees. */ 16 | double getMaxHeatValue(); 17 | 18 | /** @return The current heat value, in degrees. */ 19 | double getCurrentHeatValue(); 20 | 21 | /** Set the heat of the tile. 22 | * 23 | * @param value Heat value, in degrees. 24 | * @return The heat the tile has after the set. */ 25 | double setHeatValue(double value); 26 | } 27 | -------------------------------------------------------------------------------- /api/buildcraft/api/tiles/ITileAreaProvider.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.tiles; 2 | 3 | import net.minecraft.util.math.BlockPos; 4 | 5 | import buildcraft.api.core.IAreaProvider; 6 | 7 | /** Used for more fine-grained control of whether or not a machine connects to the provider here. */ 8 | public interface ITileAreaProvider extends IAreaProvider { 9 | boolean isValidFromLocation(BlockPos pos); 10 | } 11 | -------------------------------------------------------------------------------- /api/buildcraft/api/tiles/TilesAPI.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.tiles; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | import net.minecraftforge.common.capabilities.Capability; 6 | 7 | import buildcraft.api.core.CapabilitiesHelper; 8 | 9 | public class TilesAPI { 10 | @Nonnull 11 | public static final Capability CAP_CONTROLLABLE; 12 | 13 | @Nonnull 14 | public static final Capability CAP_HAS_WORK; 15 | 16 | @Nonnull 17 | public static final Capability CAP_HEATABLE; 18 | 19 | @Nonnull 20 | public static final Capability CAP_TILE_AREA_PROVIDER; 21 | 22 | static { 23 | CAP_CONTROLLABLE = CapabilitiesHelper.registerCapability(IControllable.class); 24 | CAP_HAS_WORK = CapabilitiesHelper.registerCapability(IHasWork.class); 25 | CAP_HEATABLE = CapabilitiesHelper.registerCapability(IHeatable.class); 26 | CAP_TILE_AREA_PROVIDER = CapabilitiesHelper.registerCapability(ITileAreaProvider.class); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /api/buildcraft/api/tiles/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "1.2", owner = "buildcraftapi_core", provides = "buildcraftapi_tiles") 6 | package buildcraft.api.tiles; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/tools/IToolWrench.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.tools; 6 | 7 | import net.minecraft.entity.player.EntityPlayer; 8 | import net.minecraft.item.ItemStack; 9 | import net.minecraft.util.EnumHand; 10 | import net.minecraft.util.math.RayTraceResult; 11 | 12 | /*** Implement this interface on subclasses of Item to have that item work as a wrench for buildcraft */ 13 | public interface IToolWrench { 14 | 15 | /*** Called to ensure that the wrench can be used. 16 | * 17 | * @param player - The player doing the wrenching 18 | * @param hand - Which hand was holding the wrench 19 | * @param wrench - The item stack that holds the wrench 20 | * @param rayTrace - The object that is being wrenched 21 | * 22 | * @return true if wrenching is allowed, false if not */ 23 | boolean canWrench(EntityPlayer player, EnumHand hand, ItemStack wrench, RayTraceResult rayTrace); 24 | 25 | /*** Callback after the wrench has been used. This can be used to decrease durability or for other purposes. 26 | * 27 | * @param player - The player doing the wrenching 28 | * @param hand - Which hand was holding the wrench 29 | * @param wrench - The item stack that holds the wrench 30 | * @param rayTrace - The object that is being wrenched */ 31 | void wrenchUsed(EntityPlayer player, EnumHand hand, ItemStack wrench, RayTraceResult rayTrace); 32 | } 33 | -------------------------------------------------------------------------------- /api/buildcraft/api/tools/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "1.0", owner = "buildcraftapi_core", provides = "buildcraftapi_tools") 6 | package buildcraft.api.tools; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/IInjectable.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | import net.minecraft.item.EnumDyeColor; 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraft.util.EnumFacing; 8 | 9 | /** Interface for pipes to implement if they can accept items in a similar fashion to BC pipes. */ 10 | public interface IInjectable { 11 | /** Tests to see if this pipe can accept items from the given direction. Useless to call this if you are going to 12 | * call {@link #injectItem(ItemStack, boolean, EnumFacing, EnumDyeColor, double)} straight after. */ 13 | boolean canInjectItems(EnumFacing from); 14 | 15 | /** Offers an ItemStack for addition to the pipe. Will be rejected if the pipe doesn't accept items from that side. 16 | * This should never be called on the client side! Implementors are free to throw an exception if be called on the 17 | * client side. 18 | * 19 | * @param stack ItemStack offered for addition. Do not manipulate this! 20 | * @param doAdd If false no actual addition should take place. Implementors should simulate. 21 | * @param from Orientation the ItemStack is offered from. 22 | * @param color The color of the item to be added to the pipe, or null for no color. 23 | * @param speed The speed of the item to be added (in blocks per tick) or {@code <=0} if a default should be used. 24 | * @return The left over stack that was not accepted. */ 25 | @Nonnull 26 | ItemStack injectItem(@Nonnull ItemStack stack, boolean doAdd, EnumFacing from, EnumDyeColor color, double speed); 27 | } 28 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/IItemPluggable.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport; 2 | 3 | import javax.annotation.Nonnull; 4 | import javax.annotation.Nullable; 5 | 6 | import net.minecraft.entity.player.EntityPlayer; 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraft.util.EnumFacing; 9 | import net.minecraft.util.EnumHand; 10 | 11 | import buildcraft.api.transport.pipe.IPipeHolder; 12 | import buildcraft.api.transport.pluggable.PipePluggable; 13 | 14 | /** Designates an item that can be placed onto a pipe as a {@link PipePluggable}. */ 15 | public interface IItemPluggable { 16 | /** Called when this item is placed onto a pipe holder. This can return null if this item does not make a valid 17 | * pluggable. Note that if you return a non-null pluggable then it will *definitely* be added to the pipe, and you 18 | * are responsible for making all the effects yourself (like the sound effect). 19 | * 20 | * @param stack The stack that holds this item 21 | * @param holder The pipe holder 22 | * @param side The side that the pluggable should be placed on 23 | * @return A pluggable to place onto the pipe */ 24 | @Nullable 25 | PipePluggable onPlace(@Nonnull ItemStack stack, IPipeHolder holder, EnumFacing side, EntityPlayer player, 26 | EnumHand hand); 27 | } 28 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/IStripesActivator.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.transport; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | import net.minecraft.item.ItemStack; 10 | import net.minecraft.util.EnumFacing; 11 | 12 | public interface IStripesActivator { 13 | boolean sendItem(@Nonnull ItemStack itemStack, EnumFacing from); 14 | 15 | void dropItem(@Nonnull ItemStack itemStack, EnumFacing from); 16 | } 17 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/IStripesHandlerBlock.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | import net.minecraft.util.EnumFacing; 5 | import net.minecraft.util.math.BlockPos; 6 | import net.minecraft.world.World; 7 | 8 | public interface IStripesHandlerBlock { 9 | 10 | /** @param world 11 | * @param pos 12 | * @param direction 13 | * @param player 14 | * @param activator 15 | * @return True if this broke a block, false otherwise (note that this handler MUST NOT return false if it has 16 | * changed the world in any way) */ 17 | boolean handle(World world, BlockPos pos, EnumFacing direction, EntityPlayer player, IStripesActivator activator); 18 | } 19 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/IStripesHandlerItem.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.transport; 6 | 7 | import net.minecraft.entity.player.EntityPlayer; 8 | import net.minecraft.item.ItemStack; 9 | import net.minecraft.util.EnumFacing; 10 | import net.minecraft.util.EnumHand; 11 | import net.minecraft.util.math.BlockPos; 12 | import net.minecraft.world.World; 13 | 14 | public interface IStripesHandlerItem { 15 | 16 | /** Called to handle the given {@link ItemStack} within the world. Note that the player's inventory will be empty, 17 | * except that the target stack will be set into its {@link EnumHand#MAIN_HAND}. Any items left in the players 18 | * inventory will be returned back through the activator with 19 | * {@link IStripesActivator#sendItem(ItemStack, EnumFacing)} 20 | * 21 | * @param world 22 | * @param pos 23 | * @param direction 24 | * @param stack The {@link ItemStack} being used 25 | * @param player 26 | * @param activator 27 | * @return True if this used the item, false otherwise (note that this handler MUST NOT return false if it has 28 | * changed the world in any way) */ 29 | boolean handle(World world, BlockPos pos, EnumFacing direction, ItemStack stack, EntityPlayer player, IStripesActivator activator); 30 | } 31 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/IStripesRegistry.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport; 2 | 3 | import net.minecraft.entity.player.EntityPlayer; 4 | import net.minecraft.item.ItemStack; 5 | import net.minecraft.util.EnumFacing; 6 | import net.minecraft.util.math.BlockPos; 7 | import net.minecraft.world.World; 8 | 9 | import buildcraft.api.core.EnumHandlerPriority; 10 | 11 | public interface IStripesRegistry { 12 | /** Adds a handler with a {@link EnumHandlerPriority} of {@linkplain EnumHandlerPriority#NORMAL} */ 13 | default void addHandler(IStripesHandlerItem handler) { 14 | addHandler(handler, EnumHandlerPriority.NORMAL); 15 | } 16 | 17 | void addHandler(IStripesHandlerItem handler, EnumHandlerPriority priority); 18 | 19 | /** Adds a handler with a {@link EnumHandlerPriority} of {@linkplain EnumHandlerPriority#NORMAL NORMAL} */ 20 | default void addHandler(IStripesHandlerBlock handler) { 21 | addHandler(handler, EnumHandlerPriority.NORMAL); 22 | } 23 | 24 | void addHandler(IStripesHandlerBlock handler, EnumHandlerPriority priority); 25 | 26 | /** @param pos The position of the stripes pipe. 27 | * @return True if a handler handled the itemstack, false otherwise (and so nothing has been done) */ 28 | boolean handleItem(World world, 29 | BlockPos pos, 30 | EnumFacing direction, 31 | ItemStack stack, 32 | EntityPlayer player, 33 | IStripesActivator activator); 34 | 35 | /** @return True if a handler broke a block, false otherwise (and so nothing has been done) */ 36 | boolean handleBlock(World world, 37 | BlockPos pos, 38 | EnumFacing direction, 39 | EntityPlayer player, 40 | IStripesActivator activator); 41 | } 42 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/IWireEmitter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 SpaceToad and the BuildCraft team 3 | * 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 4 | * distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/ 5 | */ 6 | 7 | package buildcraft.api.transport; 8 | 9 | import net.minecraft.item.EnumDyeColor; 10 | 11 | public interface IWireEmitter { 12 | /** Checks to see if this wire emitter is currently emitting the given colour. Only used to check if a given emitter 13 | * is still active. */ 14 | boolean isEmitting(EnumDyeColor colour); 15 | 16 | /** Emits the given wire colour this tick. */ 17 | void emitWire(EnumDyeColor colour); 18 | } 19 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/IWireManager.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport; 2 | 3 | import net.minecraft.item.EnumDyeColor; 4 | 5 | import buildcraft.api.transport.pipe.IPipeHolder; 6 | 7 | public interface IWireManager { 8 | 9 | IPipeHolder getHolder(); 10 | 11 | void updateBetweens(boolean recursive); 12 | 13 | EnumDyeColor getColorOfPart(EnumWirePart part); 14 | 15 | EnumDyeColor removePart(EnumWirePart part); 16 | 17 | boolean addPart(EnumWirePart part, EnumDyeColor colour); 18 | 19 | boolean hasPartOfColor(EnumDyeColor color); 20 | 21 | boolean isPowered(EnumWirePart part); 22 | 23 | boolean isAnyPowered(EnumDyeColor color); 24 | } 25 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/WireNode.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport; 2 | 3 | import java.util.EnumMap; 4 | import java.util.Map; 5 | 6 | import net.minecraft.util.EnumFacing; 7 | import net.minecraft.util.EnumFacing.AxisDirection; 8 | import net.minecraft.util.math.BlockPos; 9 | 10 | public class WireNode { 11 | public final BlockPos pos; 12 | public final EnumWirePart part; 13 | private final int hash; 14 | 15 | public WireNode(BlockPos pos, EnumWirePart part) { 16 | this.pos = pos; 17 | this.part = part; 18 | hash = pos.hashCode() * 31 + part.hashCode(); 19 | } 20 | 21 | @Override 22 | public int hashCode() { 23 | return hash; 24 | } 25 | 26 | @Override 27 | public boolean equals(Object obj) { 28 | if (this == obj) return true; 29 | if (obj == null) return false; 30 | if (getClass() != obj.getClass()) return false; 31 | WireNode other = (WireNode) obj; 32 | return part == other.part // 33 | && pos.equals(other.pos); 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return "(" + pos.getX() + ", " + pos.getY() + ", " + pos.getZ() + ", " + part + ")"; 39 | } 40 | 41 | public WireNode offset(EnumFacing face) { 42 | int nx = (part.x == AxisDirection.POSITIVE ? 1 : 0) + face.getFrontOffsetX(); 43 | int ny = (part.y == AxisDirection.POSITIVE ? 1 : 0) + face.getFrontOffsetY(); 44 | int nz = (part.z == AxisDirection.POSITIVE ? 1 : 0) + face.getFrontOffsetZ(); 45 | EnumWirePart nPart = EnumWirePart.get(nx, ny, nz); 46 | if (nx < 0 || ny < 0 || nz < 0 || nx > 1 || ny > 1 || nz > 1) { 47 | return new WireNode(pos.offset(face), nPart); 48 | } else { 49 | return new WireNode(pos, nPart); 50 | } 51 | } 52 | 53 | public Map getAllPossibleConnections() { 54 | Map map = new EnumMap<>(EnumFacing.class); 55 | 56 | for (EnumFacing face : EnumFacing.VALUES) { 57 | map.put(face, offset(face)); 58 | } 59 | return map; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/package-info.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | @API(apiVersion = "5.0", owner = "buildcraftapi_core", provides = "buildcraftapi_transport") 6 | package buildcraft.api.transport; 7 | 8 | import net.minecraftforge.fml.common.API; 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/EnumPipeColourType.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | public enum EnumPipeColourType { 4 | TRANSLUCENT, 5 | BORDER_OUTER, 6 | BORDER_INNER, 7 | CUSTOM; 8 | } 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/ICustomPipeConnection.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import net.minecraft.block.state.IBlockState; 4 | import net.minecraft.util.EnumFacing; 5 | import net.minecraft.util.math.BlockPos; 6 | import net.minecraft.world.World; 7 | 8 | public interface ICustomPipeConnection { 9 | /** @return How long the connecting pipe should extend for, in addition to its normal 4/16f connection. Values less 10 | * than or equal to -4 / 16.0f indicate that the pipe will not connect at all, and will render 11 | * as it it was not connected. */ 12 | float getExtension(World world, BlockPos pos, EnumFacing face, IBlockState state); 13 | } 14 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/IFlowItems.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import javax.annotation.Nonnull; 4 | import javax.annotation.Nullable; 5 | 6 | import net.minecraft.item.EnumDyeColor; 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraft.util.EnumFacing; 9 | 10 | import buildcraft.api.core.IStackFilter; 11 | import buildcraft.api.transport.IInjectable; 12 | 13 | public interface IFlowItems extends IInjectable { 14 | 15 | /** @deprecated Use the version below with a simulate paramater. */ 16 | @Deprecated 17 | default int tryExtractItems(int count, EnumFacing from, @Nullable EnumDyeColor colour, IStackFilter filter) { 18 | return tryExtractItems(count, from, colour, filter, false); 19 | } 20 | 21 | /** Attempts to extract items from the inventory connected to this pipe on the given side. 22 | * 23 | * @param count The maximum number of items to extract 24 | * @param from The direction to extract from. 25 | * @param colour The colour that extracted items should be painted. 26 | * @param filter The filter to determine what can be extracted. 27 | * @param simulate If true then only simulate the extraction. 28 | * @return The number of items extracted. */ 29 | int tryExtractItems(int count, EnumFacing from, @Nullable EnumDyeColor colour, IStackFilter filter, boolean simulate); 30 | 31 | /** Inserts an item directly into the centre of this pipe, going in the given direction. This should ONLY be called 32 | * from an instance of {@link PipeBehaviour}, as otherwise it can lead to problems. (For example crashing if a pipe 33 | * contains an item that the pipe behaviour doesn't expect). 34 | * 35 | * @param stack ItemStack offered for addition. Do not manipulate this! 36 | * @param from Orientation the ItemStack should pretend to be coming from. 37 | * @param colour The colour of the item to be added to the pipe, or null for no colour. 38 | * @param speed The speed of the item to be added (in blocks per tick) or {@code <=0} if a default should be 39 | * used. */ 40 | void insertItemsForce(@Nonnull ItemStack stack, EnumFacing from, @Nullable EnumDyeColor colour, double speed); 41 | 42 | /** Sends a phantom (fake) item from the given facing, to the other facing. If from is null then it will start at 43 | * the center, or if to is null then it will end at the center. */ 44 | void sendPhantomItem(@Nonnull ItemStack stack, @Nullable EnumFacing from, @Nullable EnumFacing to, @Nullable EnumDyeColor colour); 45 | } 46 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/IFlowPower.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import net.minecraft.util.EnumFacing; 4 | 5 | import buildcraft.api.mj.IMjPassiveProvider; 6 | 7 | public interface IFlowPower extends IFlowPowerLike { 8 | /** Makes this pipe reconfigure itself, possibly due to the addition of new modules. */ 9 | @Override 10 | void reconfigure(); 11 | 12 | /** Attempts to extract power from the {@link IMjPassiveProvider} connected to this pipe on the given side. 13 | * 14 | * @param maxPower The Maximum amount of power that can be extracted. 15 | * @param from The side (of this pipe) to take power from. 16 | * @return The amount of power extracted. */ 17 | long tryExtractPower(long maxPower, EnumFacing from); 18 | } 19 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/IFlowPowerLike.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | public interface IFlowPowerLike { 4 | /** Makes this pipe reconfigure itself, possibly due to the addition of new modules. */ 5 | void reconfigure(); 6 | } 7 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/IFlowRedstoneFlux.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import net.minecraft.util.EnumFacing; 4 | 5 | import net.minecraftforge.energy.IEnergyStorage; 6 | 7 | public interface IFlowRedstoneFlux extends IFlowPowerLike { 8 | /** Makes this pipe reconfigure itself, possibly due to the addition of new modules. */ 9 | @Override 10 | void reconfigure(); 11 | 12 | /** Attempts to extract power from the {@link IEnergyStorage} connected to this pipe on the given side. 13 | * 14 | * @param maxPower The Maximum amount of power that can be extracted. 15 | * @param from The side (of this pipe) to take power from. 16 | * @return The amount of power extracted. */ 17 | int tryExtractPower(int maxPower, EnumFacing from); 18 | } 19 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/IItemPipe.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | /** To be implemented by the real item pipe in Transport mod, but leaves knowledge for classes that do not have direct 4 | * dependency on transport. */ 5 | public interface IItemPipe { 6 | PipeDefinition getDefinition(); 7 | } 8 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/IPipe.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import net.minecraft.item.EnumDyeColor; 4 | import net.minecraft.tileentity.TileEntity; 5 | import net.minecraft.util.EnumFacing; 6 | 7 | import net.minecraftforge.common.capabilities.ICapabilityProvider; 8 | 9 | public interface IPipe extends ICapabilityProvider { 10 | IPipeHolder getHolder(); 11 | 12 | PipeDefinition getDefinition(); 13 | 14 | PipeBehaviour getBehaviour(); 15 | 16 | PipeFlow getFlow(); 17 | 18 | EnumDyeColor getColour(); 19 | 20 | void setColour(EnumDyeColor colour); 21 | 22 | void markForUpdate(); 23 | 24 | TileEntity getConnectedTile(EnumFacing side); 25 | 26 | IPipe getConnectedPipe(EnumFacing side); 27 | 28 | boolean isConnected(EnumFacing side); 29 | 30 | ConnectedType getConnectedType(EnumFacing side); 31 | 32 | enum ConnectedType { 33 | TILE, 34 | PIPE 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/IPipeBehaviourBaker.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import java.util.List; 4 | 5 | import net.minecraft.client.renderer.block.model.BakedQuad; 6 | 7 | public interface IPipeBehaviourBaker { 8 | List bake(B behaviour); 9 | } 10 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/IPipeBehaviourRenderer.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | 4 | import net.minecraft.client.renderer.BufferBuilder; 5 | 6 | import net.minecraftforge.fml.relauncher.Side; 7 | import net.minecraftforge.fml.relauncher.SideOnly; 8 | 9 | @SideOnly(Side.CLIENT) 10 | public interface IPipeBehaviourRenderer { 11 | void render(B behaviour, double x, double y, double z, float partialTicks, BufferBuilder bb); 12 | } 13 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/IPipeConnection.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.transport.pipe; 6 | 7 | import net.minecraft.util.EnumFacing; 8 | 9 | @Deprecated 10 | // TODO: Test to see if this is necessary! (Or perhaps make it a capability) 11 | public interface IPipeConnection { 12 | 13 | enum ConnectOverride { 14 | 15 | CONNECT, 16 | DISCONNECT, 17 | DEFAULT 18 | } 19 | 20 | /** Allows you to override pipe connection logic. 21 | * 22 | * @param type 23 | * @param with 24 | * @return CONNECT to force a connection, DISCONNECT to force no connection, and DEFAULT to let the pipe decide. */ 25 | ConnectOverride overridePipeConnection(Object/*IPipeTile.PipeType*/ type, EnumFacing with); 26 | } 27 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/IPipeExtensionManager.java: -------------------------------------------------------------------------------- 1 | /** Copyright (c) 2011-2017, SpaceToad and the BuildCraft Team https://mod-buildcraft.com/ 2 | * 3 | * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which 4 | * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ 5 | package buildcraft.api.transport.pipe; 6 | 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraft.util.EnumFacing; 9 | import net.minecraft.util.math.BlockPos; 10 | import net.minecraft.world.World; 11 | 12 | import buildcraft.api.transport.IStripesActivator; 13 | 14 | public interface IPipeExtensionManager { 15 | 16 | /** 17 | * Requests an extension by one block from a IStripesActivator (usually a stripes transport pipe) with the pipe supplied 18 | * by the stack by moving the stripes pipe to the front and placing the new transport pipe behind. 19 | * If the pipe is a registered retraction pipe (per default only the void transport pipe is - register one with {@link #registerRetractionPipe(PipeDefinition)}) it retracts the pipeline instead by moving the stripes pipe one block 20 | * in the opposite direction, replacing the previous transport pipe. 21 | * 22 | * @param world the world 23 | * @param pos the position or origin of the request (usually the stripes pipe position) 24 | * @param dir the direction of the proposed extension 25 | * @param stripes the stripes pipe 26 | * @param stack the pipe stack to use (Note: only uses one item and sends the rest back) 27 | * @return true on success, false otherwise 28 | */ 29 | boolean requestPipeExtension(World world, BlockPos pos, EnumFacing dir, IStripesActivator stripes, ItemStack stack); 30 | 31 | /** 32 | * Registers a pipe as a retraction trigger for pipe extension requests 33 | * 34 | * @param pipeDefinition the pipe definition 35 | */ 36 | void registerRetractionPipe(PipeDefinition pipeDefinition); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/IPipeFlowBaker.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import java.util.List; 4 | 5 | import net.minecraft.client.renderer.block.model.BakedQuad; 6 | 7 | public interface IPipeFlowBaker { 8 | List bake(F flow); 9 | } 10 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/IPipeFlowRenderer.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import net.minecraft.client.renderer.BufferBuilder; 4 | 5 | public interface IPipeFlowRenderer { 6 | /** @param flow The flow to render 7 | * @param x 8 | * @param y 9 | * @param z 10 | * @param bufferBuilder The (optional) vertex buffer that you can render into. Note that you can still do GL stuff. */ 11 | void render(F flow, double x, double y, double z, float partialTicks, BufferBuilder bufferBuilder); 12 | } 13 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/IPipeRegistry.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import java.util.Map; 4 | import java.util.function.Consumer; 5 | 6 | import javax.annotation.Nullable; 7 | 8 | import net.minecraft.item.Item; 9 | import net.minecraft.util.ResourceLocation; 10 | 11 | public interface IPipeRegistry { 12 | PipeDefinition getDefinition(ResourceLocation identifier); 13 | 14 | void registerPipe(PipeDefinition definition); 15 | 16 | /** Maps the given {@link PipeDefinition} to an {@link IItemPipe}. This acts exactly akin to 17 | * {@link Map#put(Object, Object)}. */ 18 | void setItemForPipe(PipeDefinition definition, @Nullable IItemPipe item); 19 | 20 | IItemPipe getItemForPipe(PipeDefinition definition); 21 | 22 | /** Creates an {@link IItemPipe} for the given {@link PipeDefinition}. If the {@link PipeDefinition} has been 23 | * registered with {@link #registerPipe(PipeDefinition)} then it will also be registered with 24 | * {@link #setItemForPipe(PipeDefinition, IItemPipe)}. The returned item will be automatically registered with 25 | * forge. */ 26 | IItemPipe createItemForPipe(PipeDefinition definition); 27 | 28 | /** Identical to {@link #createItemForPipe(PipeDefinition)}, but doesn't require registering tags with buildcraft 29 | * lib in order to register. 30 | * 31 | * @param postCreate A function to call in order to setup the {@link Item#setRegistryName(ResourceLocation)} and 32 | * {@link Item#setUnlocalizedName(String)}. */ 33 | IItemPipe createUnnamedItemForPipe(PipeDefinition definition, Consumer postCreate); 34 | 35 | Iterable getAllRegisteredPipes(); 36 | } 37 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/PipeApiClient.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import net.minecraftforge.fml.relauncher.Side; 4 | import net.minecraftforge.fml.relauncher.SideOnly; 5 | 6 | import buildcraft.api.transport.pluggable.IPlugDynamicRenderer; 7 | import buildcraft.api.transport.pluggable.IPluggableStaticBaker; 8 | import buildcraft.api.transport.pluggable.PipePluggable; 9 | import buildcraft.api.transport.pluggable.PluggableModelKey; 10 | 11 | @SideOnly(Side.CLIENT) 12 | public enum PipeApiClient { 13 | INSTANCE; 14 | 15 | public static IClientRegistry registry; 16 | 17 | public interface IClientRegistry { 18 | 19 | /** Registers a dynamic renderer for the given pipe flow. Most {@link PipeFlow} types will have no use for 20 | * this. */ 21 | void registerRenderer(Class flowClass, IPipeFlowRenderer renderer); 22 | 23 | /** Registers a dynamic renderer for the given pipe behaviour. Most {@link PipeBehaviour} types will have no use 24 | * for this. */ 25 | void registerRenderer(Class behaviourClass, 26 | IPipeBehaviourRenderer renderer); 27 | 28 |

void registerRenderer(Class plugClass, IPlugDynamicRenderer

renderer); 29 | 30 |

void registerBaker(Class keyClass, 31 | IPluggableStaticBaker

renderer); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/PipeConnectionAPI.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import java.util.Map; 4 | 5 | import com.google.common.collect.Maps; 6 | 7 | import net.minecraft.block.Block; 8 | 9 | /** Use this class to register blocks with custom block sizes so that pipes can connect to them properly. Note that you 10 | * do not need to register a custom pipe connection if your block implements ICustomPipeConnection. The registered 11 | * version does not override your own implementation. */ 12 | public final class PipeConnectionAPI { 13 | private static final Map connections = Maps.newHashMap(); 14 | private static final ICustomPipeConnection NOTHING = (world, pos, face, state) -> 0; 15 | 16 | /** Register a block with a custom connection. Useful if you don't own the block class or are adding it for some-one 17 | * else. 18 | * 19 | * @param block The block instance 20 | * @param connection The connection instance */ 21 | public static void registerConnection(Block block, ICustomPipeConnection connection) { 22 | connections.put(block, connection); 23 | } 24 | 25 | /** Ensures that a particular block will always have the default connection, no matter what the bounding box the the 26 | * block is. */ 27 | public static void registerConnectionAsNothing(Block block) { 28 | connections.put(block, NOTHING); 29 | } 30 | 31 | /** Gets the current custom connection that the block uses. Will be null if nothing has been set. */ 32 | public static ICustomPipeConnection getCustomConnection(Block block) { 33 | if (block instanceof ICustomPipeConnection) { 34 | return (ICustomPipeConnection) block; 35 | } 36 | ICustomPipeConnection connection = connections.get(block); 37 | if (connection != null) { 38 | return connection; 39 | } 40 | return null; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/PipeEvent.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | /** The base class for all pipe events. Some event classes can be cancelled with {@link #cancel()}, however this will 4 | * only have an effect if {@link #canBeCancelled} is true. Refer to individual classes for information on if they can 5 | * be cancelled, and what cancelling the event does. */ 6 | public abstract class PipeEvent { 7 | public final boolean canBeCancelled; 8 | public final IPipeHolder holder; 9 | private boolean canceled = false; 10 | 11 | public PipeEvent(IPipeHolder holder) { 12 | this.canBeCancelled = false; 13 | this.holder = holder; 14 | } 15 | 16 | /** deprecated: Because cancellation is going to be removed (at some point in the future) */ 17 | protected PipeEvent(boolean canBeCancelled, IPipeHolder holder) { 18 | this.canBeCancelled = canBeCancelled; 19 | this.holder = holder; 20 | } 21 | 22 | public void cancel() { 23 | if (canBeCancelled) { 24 | canceled = true; 25 | } 26 | } 27 | 28 | public boolean isCanceled() { 29 | return canceled; 30 | } 31 | 32 | /** Called after every event handler has received this pipe event, to pick up simple mistakes when implementing pipe 33 | * event handlers. 34 | * 35 | * @return Null if there are no state errors, or a message containing information about what is wrong (although this 36 | * may be incomplete) */ 37 | public String checkStateForErrors() { 38 | if (canceled & !canBeCancelled) { 39 | return "Somehow cancelled an event that isn't marked as such!"; 40 | } 41 | return null; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/PipeEventActionActivate.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import buildcraft.api.core.EnumPipePart; 4 | import buildcraft.api.statements.IAction; 5 | import buildcraft.api.statements.IStatementParameter; 6 | 7 | public class PipeEventActionActivate extends PipeEvent { 8 | public final IAction action; 9 | public final IStatementParameter[] params; 10 | public final EnumPipePart part; 11 | 12 | public PipeEventActionActivate(IPipeHolder holder, IAction action, IStatementParameter[] params, EnumPipePart part) { 13 | super(holder); 14 | this.action = action; 15 | this.params = params; 16 | this.part = part; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/PipeEventConnectionChange.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import net.minecraft.util.EnumFacing; 4 | 5 | /** Fired whenever a connection change is picked up by an {@link IPipe}. This even doesn't include the new value 6 | * (boolean isConnected) as it can be accessed via {@link IPipe#isConnected(EnumFacing)}. */ 7 | public class PipeEventConnectionChange extends PipeEvent { 8 | 9 | public final EnumFacing direction; 10 | 11 | public PipeEventConnectionChange(IPipeHolder holder, EnumFacing direction) { 12 | super(holder); 13 | this.direction = direction; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/PipeEventHandler.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** Designates a method that will receive a pipe event. The method must be public and take a single parameter that 9 | * extends {@link PipeEvent}.
10 | * An example is:
11 | * 12 | @PipeEventHandler
13 | public void sideCheck(PipeEventItem.SideCheck sideCheck) {
14 | // Logic omitted
15 | } 16 | * 17 | *
*/ 18 | @Retention(RetentionPolicy.RUNTIME) 19 | @Target(ElementType.METHOD) 20 | public @interface PipeEventHandler { 21 | /** Designates the priority that the handler will be given. All handlers in vanilla BuildCraft use 22 | * {@link PipeEventPriority#NORMAL}, so this is given for other pipe mods to fire before or after all BC logic has 23 | * taken place. */ 24 | PipeEventPriority priority() default PipeEventPriority.NORMAL; 25 | 26 | /** If true then the event handler will be called even if an event has already been cancelled. */ 27 | boolean receiveCancelled() default false; 28 | } 29 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/PipeEventPriority.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | public enum PipeEventPriority { 4 | PRE, 5 | NORMAL, 6 | POST 7 | } 8 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/PipeEventRedstoneFlux.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import net.minecraft.util.EnumFacing; 4 | 5 | public abstract class PipeEventRedstoneFlux extends PipeEvent { 6 | public final IFlowRedstoneFlux flow; 7 | 8 | protected PipeEventRedstoneFlux(IPipeHolder holder, IFlowRedstoneFlux flow) { 9 | super(holder); 10 | this.flow = flow; 11 | } 12 | 13 | protected PipeEventRedstoneFlux(boolean canBeCancelled, IPipeHolder holder, IFlowRedstoneFlux flow) { 14 | super(canBeCancelled, holder); 15 | this.flow = flow; 16 | } 17 | 18 | public static class Configure extends PipeEventRedstoneFlux { 19 | private int maxPower = 100; 20 | private boolean receiver = false; 21 | private boolean disabled = false; 22 | 23 | public Configure(IPipeHolder holder, IFlowRedstoneFlux flow) { 24 | super(holder, flow); 25 | } 26 | 27 | public int getMaxPower() { 28 | return this.maxPower; 29 | } 30 | 31 | public void setMaxPower(int maxPower) { 32 | this.maxPower = maxPower; 33 | } 34 | 35 | public boolean isReceiver() { 36 | return this.receiver; 37 | } 38 | 39 | /** Sets this pipe to be one that receives power from external sources. */ 40 | public void setReceiver(boolean receiver) { 41 | this.receiver = receiver; 42 | } 43 | 44 | public void disableTransfer() { 45 | disabled = true; 46 | } 47 | 48 | public boolean isTransferDisabled() { 49 | return disabled; 50 | } 51 | } 52 | 53 | public static class PrimaryDirection extends PipeEventRedstoneFlux { 54 | private EnumFacing facing; 55 | 56 | public PrimaryDirection(IPipeHolder holder, IFlowRedstoneFlux flow, EnumFacing facing) { 57 | super(holder, flow); 58 | this.facing = facing; 59 | } 60 | 61 | public EnumFacing getFacing() { 62 | return facing; 63 | } 64 | 65 | public void setFacing(EnumFacing facing) { 66 | this.facing = facing; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/PipeEventStatement.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import java.util.Collection; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | import net.minecraft.util.EnumFacing; 8 | 9 | import buildcraft.api.statements.IActionInternal; 10 | import buildcraft.api.statements.IActionInternalSided; 11 | import buildcraft.api.statements.ITriggerInternal; 12 | import buildcraft.api.statements.ITriggerInternalSided; 13 | 14 | public abstract class PipeEventStatement extends PipeEvent { 15 | public PipeEventStatement(IPipeHolder holder) { 16 | super(holder); 17 | } 18 | 19 | /** Fired when a pipe should add internal triggers to the list of all possible triggers */ 20 | public static class AddTriggerInternal extends PipeEventStatement { 21 | public final Collection triggers; 22 | 23 | public AddTriggerInternal(IPipeHolder holder, Collection triggers) { 24 | super(holder); 25 | this.triggers = triggers; 26 | } 27 | } 28 | 29 | /** Fired when a pipe should add internal sided triggers to the list of all possible triggers */ 30 | public static class AddTriggerInternalSided extends PipeEventStatement { 31 | public final Collection triggers; 32 | 33 | @Nonnull 34 | public final EnumFacing side; 35 | 36 | public AddTriggerInternalSided(IPipeHolder holder, Collection triggers, @Nonnull EnumFacing side) { 37 | super(holder); 38 | this.triggers = triggers; 39 | this.side = side; 40 | } 41 | } 42 | 43 | /** Fired when a pipe should add internal actions to the list of all possible actions */ 44 | public static class AddActionInternal extends PipeEventStatement { 45 | public final Collection actions; 46 | 47 | public AddActionInternal(IPipeHolder holder, Collection actions) { 48 | super(holder); 49 | this.actions = actions; 50 | } 51 | } 52 | 53 | /** Fired when a pipe should add internal actions to the list of all possible actions */ 54 | public static class AddActionInternalSided extends PipeEventStatement { 55 | public final Collection actions; 56 | 57 | @Nonnull 58 | public final EnumFacing side; 59 | 60 | public AddActionInternalSided(IPipeHolder holder, Collection actions, @Nonnull EnumFacing side) { 61 | super(holder); 62 | this.actions = actions; 63 | this.side = side; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/PipeEventTileState.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import net.minecraft.tileentity.TileEntity; 4 | 5 | /** Fired when the state of a pipe's tile entity changes. Listen for subclasses, not this one! */ 6 | public abstract class PipeEventTileState extends PipeEvent { 7 | PipeEventTileState(IPipeHolder holder) { 8 | super(holder); 9 | } 10 | 11 | /** Fired in {@link TileEntity#invalidate()} */ 12 | public static class Invalidate extends PipeEventTileState { 13 | public Invalidate(IPipeHolder holder) { 14 | super(holder); 15 | } 16 | } 17 | 18 | /** Fired in {@link TileEntity#validate()} */ 19 | public static class Validate extends PipeEventTileState { 20 | public Validate(IPipeHolder holder) { 21 | super(holder); 22 | } 23 | } 24 | 25 | /** Fired in {@link TileEntity#onChunkUnload()} */ 26 | public static class ChunkUnload extends PipeEventTileState { 27 | public ChunkUnload(IPipeHolder holder) { 28 | super(holder); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pipe/PipeFlowType.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pipe; 2 | 3 | import net.minecraft.nbt.NBTTagCompound; 4 | 5 | public final class PipeFlowType { 6 | public final IFlowCreator creator; 7 | public final IFlowLoader loader; 8 | 9 | /** The default colour type, if none is given in {@link PipeDefinition}. if this is also null then the final 10 | * fallback type is {@link EnumPipeColourType#TRANSLUCENT}. */ 11 | public EnumPipeColourType fallbackColourType; 12 | 13 | public PipeFlowType(IFlowCreator creator, IFlowLoader loader) { 14 | this(creator, loader, null); 15 | } 16 | 17 | public PipeFlowType(IFlowCreator creator, IFlowLoader loader, EnumPipeColourType colourType) { 18 | this.creator = creator; 19 | this.loader = loader; 20 | this.fallbackColourType = colourType; 21 | } 22 | 23 | @FunctionalInterface 24 | public interface IFlowCreator { 25 | PipeFlow createFlow(IPipe t); 26 | } 27 | 28 | @FunctionalInterface 29 | public interface IFlowLoader { 30 | PipeFlow loadFlow(IPipe t, NBTTagCompound u); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pluggable/IPlugDynamicRenderer.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pluggable; 2 | 3 | 4 | import net.minecraft.client.renderer.BufferBuilder; 5 | 6 | public interface IPlugDynamicRenderer

{ 7 | void render(P plug, double x, double y, double z, float partialTicks, BufferBuilder bb); 8 | } 9 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pluggable/IPluggableRegistry.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pluggable; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | 5 | public interface IPluggableRegistry { 6 | default void register(PluggableDefinition definition) { 7 | register(definition.identifier, definition); 8 | } 9 | 10 | void register(ResourceLocation identifier, PluggableDefinition definition); 11 | 12 | PluggableDefinition getDefinition(ResourceLocation identifier); 13 | } 14 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pluggable/IPluggableStaticBaker.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pluggable; 2 | 3 | import java.util.List; 4 | 5 | import net.minecraft.client.renderer.block.model.BakedQuad; 6 | 7 | import net.minecraftforge.fml.relauncher.Side; 8 | import net.minecraftforge.fml.relauncher.SideOnly; 9 | 10 | @SideOnly(Side.CLIENT) 11 | public interface IPluggableStaticBaker { 12 | List bake(K key); 13 | } 14 | -------------------------------------------------------------------------------- /api/buildcraft/api/transport/pluggable/PluggableModelKey.java: -------------------------------------------------------------------------------- 1 | package buildcraft.api.transport.pluggable; 2 | 3 | import java.util.Objects; 4 | 5 | import net.minecraft.util.BlockRenderLayer; 6 | import net.minecraft.util.EnumFacing; 7 | 8 | public abstract class PluggableModelKey { 9 | public final BlockRenderLayer layer; 10 | public final EnumFacing side; 11 | private final int hash; 12 | 13 | public PluggableModelKey(BlockRenderLayer layer, EnumFacing side) { 14 | if (layer != BlockRenderLayer.CUTOUT && layer != BlockRenderLayer.TRANSLUCENT) { 15 | throw new IllegalArgumentException("Can only use CUTOUT or TRANSLUCENT at the moment (was " + layer + ")"); 16 | } 17 | if (side == null) throw new NullPointerException("side"); 18 | this.layer = layer; 19 | this.side = side; 20 | this.hash = Objects.hash(layer, side); 21 | } 22 | 23 | @Override 24 | public boolean equals(Object obj) { 25 | if (obj == this) return true; 26 | if (obj == null) return false; 27 | if (getClass() != obj.getClass()) return false; 28 | PluggableModelKey other = (PluggableModelKey) obj; 29 | if (layer != other.layer) return false; 30 | if (side != other.side) return false; 31 | return true; 32 | } 33 | 34 | @Override 35 | public int hashCode() { 36 | return hash; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /build.properties: -------------------------------------------------------------------------------- 1 | mc_version=1.12.2 2 | forge_version=14.23.0.2532 3 | mappings_version=snapshot_20170629 4 | mod_version=7.99 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BuildCraft/BuildCraftAPI/8a1c55c1aac3ff74f6111341a803f230b28d4729/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Sep 14 12:28:28 PDT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip 7 | -------------------------------------------------------------------------------- /guidelines/buildcraft.checkstyle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /resources/LICENSE.API: -------------------------------------------------------------------------------- 1 | BuildCraft API License 2 | 3 | Copyright (c) 2011-2016 SpaceToad and the BuildCraft team 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | --------------------------------------------------------------------------------