From cccc40ccdf40fc8bb02e9b6d3646c609187b3742 Mon Sep 17 00:00:00 2001 From: nekosune Date: Fri, 21 Mar 2014 23:20:32 +0000 Subject: [PATCH] More 1.7.2 stuff --- src/main/java/appeng/api/AEApi.java | 38 ++ src/main/java/appeng/api/Blocks.java | 75 --- .../java/appeng/api/DimentionalCoord.java | 58 -- src/main/java/appeng/api/IAEItemStack.java | 175 ----- src/main/java/appeng/api/IAppEngApi.java | 217 ++----- .../java/appeng/api/IAppEngGrinderRecipe.java | 45 -- src/main/java/appeng/api/ICellHandler.java | 25 - src/main/java/appeng/api/ICellRegistry.java | 31 - .../appeng/api/IExternalStorageHandler.java | 27 - .../appeng/api/IExternalStorageRegistry.java | 22 - .../java/appeng/api/IGridCacheRegistry.java | 24 - .../appeng/api/IItemComparisionProvider.java | 25 - src/main/java/appeng/api/IItemComparison.java | 10 - src/main/java/appeng/api/IItemList.java | 32 - .../api/ISpecialComparisonRegistry.java | 24 - .../java/appeng/api/IWirelessTermHandler.java | 49 -- .../appeng/api/IWirelessTermRegistery.java | 38 -- src/main/java/appeng/api/Items.java | 40 -- src/main/java/appeng/api/Materials.java | 62 -- src/main/java/appeng/api/README.txt | 46 -- src/main/java/appeng/api/TileRef.java | 69 -- src/main/java/appeng/api/Util.java | 231 ------- src/main/java/appeng/api/WorldCoord.java | 132 ---- .../appeng/api/config/AccessRestriction.java | 48 ++ .../java/appeng/api/config/ActionItems.java | 17 +- .../java/appeng/api/config/Actionable.java | 14 + .../appeng/api/config/CondenserOuput.java | 24 +- .../java/appeng/api/config/EnableDisable.java | 18 - .../java/appeng/api/config/FullnessMode.java | 19 +- .../java/appeng/api/config/FuzzyMode.java | 34 +- .../java/appeng/api/config/IConfigEnum.java | 11 - .../appeng/api/config/IncludeExclude.java | 6 + .../api/config/InterfaceBlockingMode.java | 17 - .../api/config/InterfaceCraftingMode.java | 17 - src/main/java/appeng/api/config/ItemFlow.java | 18 - .../appeng/api/config/LevelEmitterMode.java | 10 + .../java/appeng/api/config/LevelType.java | 10 + src/main/java/appeng/api/config/ListMode.java | 18 - .../java/appeng/api/config/MatchingMode.java | 17 - .../java/appeng/api/config/ModSettings.java | 6 + .../appeng/api/config/NetworkEmitterMode.java | 12 + .../java/appeng/api/config/OperationMode.java | 18 +- .../java/appeng/api/config/OutputMode.java | 6 + .../appeng/api/config/PowerMultiplier.java | 21 + .../java/appeng/api/config/PowerUnits.java | 48 +- .../java/appeng/api/config/RedstoneMode.java | 6 + .../appeng/api/config/RedstoneModeInput.java | 20 - .../api/config/RedstoneModeInputOnOff.java | 19 - .../appeng/api/config/RedstoneModeOutput.java | 18 - .../appeng/api/config/RelativeDirection.java | 6 + .../java/appeng/api/config/SearchBoxMode.java | 25 +- .../api/config/SecurityPermissions.java | 47 ++ src/main/java/appeng/api/config/Settings.java | 44 ++ src/main/java/appeng/api/config/SortDir.java | 16 +- .../java/appeng/api/config/SortOrder.java | 18 +- .../appeng/api/config/StackModeInput.java | 18 - .../appeng/api/config/StackModeOutput.java | 20 - .../java/appeng/api/config/TransferDir.java | 18 - .../java/appeng/api/config/TunnelType.java | 11 + src/main/java/appeng/api/config/Upgrades.java | 39 ++ .../java/appeng/api/config/ViewItems.java | 17 +- src/main/java/appeng/api/config/YesNo.java | 6 + .../appeng/api/crafting/ICraftingMedium.java | 25 + .../appeng/api/crafting/ICraftingPattern.java | 16 + .../api/crafting/ICraftingPatternMAC.java | 12 + .../api/crafting/ICraftingProvider.java | 19 + .../api/crafting/ICraftingProviderHelper.java | 15 + .../java/appeng/api/definitions/Blocks.java | 75 +++ .../java/appeng/api/definitions/Items.java | 47 ++ .../appeng/api/definitions/Materials.java | 78 +++ .../java/appeng/api/definitions/Parts.java | 47 ++ .../java/appeng/api/events/AEWorldEvent.java | 17 - .../appeng/api/events/GridErrorEvent.java | 18 - .../api/events/GridPatternUpdateEvent.java | 22 - .../api/events/GridStorageUpdateEvent.java | 22 - .../api/events/GridTileConnectivityEvent.java | 22 - .../appeng/api/events/GridTileLoadEvent.java | 22 - .../api/events/GridTileUnloadEvent.java | 22 - .../api/events/LocatableEventAnnounce.java | 28 + .../api/events/LocateableEventAnnounce.java | 25 - .../api/events/MultiBlockUpdateEvent.java | 22 - .../api/exceptions/AppEngException.java | 9 +- .../AppEngTileMissingException.java | 30 - .../api/exceptions/FailedConnection.java | 10 + .../exceptions/MissingIngredientError.java | 11 + .../api/exceptions/ModNotInstalled.java | 12 + .../appeng/api/exceptions/RecipeError.java | 12 + .../api/exceptions/RegistrationError.java | 12 + .../appeng/api/features/IGrinderEntry.java | 74 +++ .../IGrinderRegistry.java} | 34 +- .../features/IItemComparisionProvider.java | 30 + .../appeng/api/features/IItemComparison.java | 10 + .../java/appeng/api/features/ILocatable.java | 17 + .../{ => features}/ILocateableRegistry.java | 9 +- .../features/IMatterCannonAmmoRegistry.java | 24 + .../api/features/INetworkEncodable.java | 28 + .../api/features/IP2PTunnelRegistry.java | 31 + .../appeng/api/features/IPlayerRegistry.java | 30 + .../api/features/IRecipeHandlerRegistry.java | 48 ++ .../api/features/IRegistryContainer.java | 72 +++ .../features/ISpecialComparisonRegistry.java | 27 + .../api/features/IWirelessTermHandler.java | 46 ++ .../api/features/IWirelessTermRegistery.java | 39 ++ .../implementations/ICraftingPatternItem.java | 21 + .../implementations/IPowerChannelState.java | 19 + .../api/implementations/IUpgradeableHost.java | 23 + .../api/implementations/TransitionResult.java | 18 + .../implementations/guiobjects/IGuiItem.java | 15 + .../guiobjects/IGuiItemObject.java | 9 + .../guiobjects/INetworkTool.java | 14 + .../guiobjects/IPortableCell.java | 14 + .../items/IAEItemPowerStorage.java | 48 ++ .../api/implementations/items/IAEWrench.java | 24 + .../implementations/items/IBiometricCard.java | 51 ++ .../items/IGrowableCrystal.java | 14 + .../api/implementations/items/IItemGroup.java | 19 + .../implementations/items/IMemoryCard.java | 56 ++ .../items/ISpatialStorageCell.java | 69 ++ .../implementations/items/IStorageCell.java | 82 +++ .../items/IStorageComponent.java | 30 + .../implementations/items/IUpgradeModule.java | 15 + .../items/MemoryCardMessages.java | 9 + .../api/implementations/parts/IPartCable.java | 53 ++ .../implementations/parts/IPartMonitor.java | 18 + .../parts/IPartStorageMonitor.java | 25 + .../implementations/tiles/IChestOrDrive.java | 40 ++ .../api/implementations/tiles/ICrankable.java | 35 + .../api/implementations/tiles/IMEChest.java | 8 + .../tiles/ISegmentedInventory.java | 17 + .../tiles/ITileStorageMonitorable.java | 14 + .../tiles/IViewCellStorage.java | 15 + .../api/integration/IBeeComparison.java | 22 + .../api/me/items/IAEChargeableItem.java | 25 - .../java/appeng/api/me/items/IAEWrench.java | 9 - .../java/appeng/api/me/items/IMemoryCard.java | 41 -- .../appeng/api/me/items/ISpatialStorage.java | 26 - .../appeng/api/me/items/IStorageCell.java | 55 -- .../api/me/items/IStorageComponent.java | 21 - .../appeng/api/me/tiles/IAssemblerMB.java | 20 - .../me/tiles/IAssemblerPatternProvider.java | 11 - .../appeng/api/me/tiles/ICellContainer.java | 24 - .../appeng/api/me/tiles/ICellProvider.java | 23 - .../appeng/api/me/tiles/IColoredMETile.java | 68 -- .../api/me/tiles/IConfigureableTile.java | 28 - .../api/me/tiles/IConnectionSensitive.java | 11 - .../appeng/api/me/tiles/ICraftingTracker.java | 10 - .../api/me/tiles/IDirectionalMETile.java | 20 - .../api/me/tiles/IExtendedCellProvider.java | 13 - .../api/me/tiles/IFulllyOptionalMETile.java | 11 - .../appeng/api/me/tiles/IGridMachine.java | 25 - .../appeng/api/me/tiles/IGridTeleport.java | 11 - .../appeng/api/me/tiles/IGridTileEntity.java | 49 -- .../java/appeng/api/me/tiles/ILocateable.java | 10 - .../appeng/api/me/tiles/IMEPowerStorage.java | 55 -- .../appeng/api/me/tiles/INonSignalBlock.java | 9 - .../appeng/api/me/tiles/IOptionalMETile.java | 14 - .../appeng/api/me/tiles/IOrientableTile.java | 26 - .../appeng/api/me/tiles/IPriorityTile.java | 17 - .../appeng/api/me/tiles/IStorageAware.java | 14 - .../appeng/api/me/tiles/IStorageMonitor.java | 20 - .../java/appeng/api/me/tiles/ITileCable.java | 7 - .../appeng/api/me/tiles/ITileIOCable.java | 30 - .../api/me/tiles/ITileInterfaceApi.java | 78 --- .../appeng/api/me/tiles/ITilePushable.java | 30 - .../me/tiles/InterfaceCraftingPattern.java | 19 - src/main/java/appeng/api/me/util/Grid.java | 84 --- .../appeng/api/me/util/IAssemblerCluster.java | 37 -- .../appeng/api/me/util/IConfigManager.java | 10 - .../appeng/api/me/util/ICraftRequest.java | 9 - .../appeng/api/me/util/ICraftWatcher.java | 12 - .../appeng/api/me/util/ICraftingPattern.java | 53 -- .../api/me/util/ICraftingPatternMAC.java | 52 -- .../java/appeng/api/me/util/IGridCache.java | 46 -- .../appeng/api/me/util/IGridInterface.java | 241 ------- .../java/appeng/api/me/util/IMEInventory.java | 77 --- .../api/me/util/IMEInventoryHandler.java | 76 --- .../appeng/api/me/util/IMEInventoryUtil.java | 19 - .../api/me/util/ITileCraftingProvider.java | 17 - .../me/util/InterfaceCraftingResponse.java | 13 - .../appeng/api/me/util/TransitionResult.java | 21 - .../appeng/api/movable/IMovableHandler.java | 41 +- .../appeng/api/movable/IMovableRegistry.java | 96 +-- .../java/appeng/api/movable/IMovableTile.java | 17 +- .../api/networkevents/MENetworkEvent.java | 69 -- .../MENetworkEventSubscribe.java | 9 - .../networkevents/MENetworkPowerStorage.java | 23 - .../networkevents/MENetworkStorageEvent.java | 16 - .../java/appeng/api/networking/GridFlags.java | 38 ++ .../api/networking/GridNotification.java | 9 + .../java/appeng/api/networking/IGrid.java | 71 ++ .../appeng/api/networking/IGridBlock.java | 88 +++ .../appeng/api/networking/IGridCache.java | 71 ++ .../api/networking/IGridCacheRegistry.java | 28 + .../networking/IGridConnecitonVisitor.java | 14 + .../api/networking/IGridConnection.java | 58 ++ .../java/appeng/api/networking/IGridHost.java | 43 ++ .../api/networking/IGridMultiblock.java | 20 + .../java/appeng/api/networking/IGridNode.java | 141 ++++ .../appeng/api/networking/IGridStorage.java | 18 + .../appeng/api/networking/IGridVisitor.java | 21 + .../appeng/api/networking/IMachineSet.java | 13 + .../networking/energy/IAEPowerStorage.java | 46 ++ .../api/networking/energy/IEnergyGrid.java | 82 +++ .../energy/IEnergyGridProvider.java | 18 + .../api/networking/energy/IEnergySource.java | 19 + .../api/networking/energy/IEnergyWatcher.java | 8 + .../networking/energy/IEnergyWatcherHost.java | 21 + .../events/MENetworkBootingStatusChange.java | 14 + .../events/MENetworkCellArrayUpdate.java | 15 + .../events/MENetworkChannelChanged.java | 18 + .../events/MENetworkChannelsChanged.java | 13 + .../events/MENetworkControllerChange.java | 11 + .../events/MENetworkCraftingChange.java | 15 + .../api/networking/events/MENetworkEvent.java | 53 ++ .../events/MENetworkEventSubscribe.java | 15 + .../MENetworkPostCacheConstruction.java | 10 + .../events/MENetworkPowerIdleChange.java | 21 + .../events/MENetworkPowerStatusChange.java | 16 + .../events/MENetworkPowerStorage.java | 38 ++ .../events/MENetworkSecurityChange.java | 9 + .../events/MENetworkSpatialEvent.java | 26 + .../events/MENetworkStorageEvent.java | 25 + .../networking/pathing/ControllerState.java | 19 + .../api/networking/pathing/IPathingGrid.java | 24 + .../networking/security/BaseActionSource.java | 16 + .../api/networking/security/IActionHost.java | 19 + .../networking/security/ISecurityGrid.java | 40 ++ .../networking/security/MachineSource.java | 18 + .../api/networking/security/PlayerSource.java | 22 + .../api/networking/spatial/ISpatialCache.java | 39 ++ .../api/networking/storage/IStackWatcher.java | 10 + .../networking/storage/IStackWatcherHost.java | 30 + .../api/networking/storage/IStorageGrid.java | 27 + .../api/networking/ticking/IGridTickable.java | 56 ++ .../api/networking/ticking/ITickManager.java | 44 ++ .../ticking/TickRateModulation.java | 34 + .../networking/ticking/TickingRequest.java | 54 ++ src/main/java/appeng/api/package-info.java | 4 + .../java/appeng/api/parts/BusSupport.java | 10 + .../appeng/api/parts/IFacadeContainer.java | 30 + .../java/appeng/api/parts/IFacadePart.java | 72 +++ src/main/java/appeng/api/parts/IPart.java | 265 ++++++++ .../appeng/api/parts/IPartCollsionHelper.java | 42 ++ .../java/appeng/api/parts/IPartHelper.java | 58 ++ src/main/java/appeng/api/parts/IPartHost.java | 135 ++++ src/main/java/appeng/api/parts/IPartItem.java | 37 ++ .../appeng/api/parts/IPartRenderHelper.java | 152 +++++ .../appeng/api/parts/ISimplifiedBundle.java | 7 + src/main/java/appeng/api/parts/LayerBase.java | 46 ++ .../java/appeng/api/parts/LayerFlags.java | 8 + .../java/appeng/api/parts/PartItemStack.java | 14 + .../java/appeng/api/parts/SelectedPart.java | 44 ++ .../java/appeng/api/parts/layers/InvSot.java | 47 ++ .../api/parts/layers/LayerIEnergySink.java | 143 ++++ .../api/parts/layers/LayerIEnergySource.java | 137 ++++ .../api/parts/layers/LayerIFluidHandler.java | 69 ++ .../parts/layers/LayerIPipeConnection.java | 21 + .../api/parts/layers/LayerIPowerEmitter.java | 19 + .../api/parts/layers/LayerIPowerReceptor.java | 36 ++ .../parts/layers/LayerISidedInventory.java | 227 +++++++ .../layers/LayerITileStorageMonitorable.java | 21 + .../appeng/api/recipes/ICraftHandler.java | 29 + .../java/appeng/api/recipes/IIngredient.java | 57 ++ .../appeng/api/recipes/IRecipeHandler.java | 22 + .../appeng/api/recipes/IRecipeLoader.java | 10 + .../appeng/api/recipes/ISubItemResolver.java | 13 + .../appeng/api/recipes/ResolverResult.java | 14 + .../appeng/api/recipes/ResolverResultSet.java | 19 + .../appeng/api/storage/ICellContainer.java | 37 ++ .../java/appeng/api/storage/ICellHandler.java | 81 +++ .../appeng/api/storage/ICellRegistry.java | 47 ++ .../api/storage/ICellWorkbenchItem.java | 45 ++ .../api/storage/IExternalStorageHandler.java | 30 + .../api/storage/IExternalStorageRegistry.java | 30 + .../java/appeng/api/storage/IMEInventory.java | 56 ++ .../api/storage/IMEInventoryHandler.java | 60 ++ .../java/appeng/api/storage/IMEMonitor.java | 33 + .../storage/IMEMonitorHandlerReceiver.java | 24 + .../appeng/api/storage/IStorageHelper.java | 84 +++ .../api/storage/IStorageMonitorable.java | 25 + .../appeng/api/storage/ITerminalHost.java | 8 + .../appeng/api/storage/MEMonitorHandler.java | 156 +++++ .../appeng/api/storage/StorageChannel.java | 33 + .../api/storage/data/IAEFluidStack.java | 52 ++ .../appeng/api/storage/data/IAEItemStack.java | 82 +++ .../appeng/api/storage/data/IAEStack.java | 179 +++++ .../{ => storage/data}/IAETagCompound.java | 27 +- .../appeng/api/storage/data/IItemList.java | 87 +++ .../java/appeng/api/util/AECableType.java | 30 + src/main/java/appeng/api/util/AEColor.java | 90 +++ .../api/util/AEColoredItemDefinition.java | 46 ++ .../appeng/api/util/AEItemDefinition.java | 42 ++ .../appeng/api/util/DimensionalCoord.java | 73 +++ .../java/appeng/api/util/ICommonTile.java | 23 + .../java/appeng/api/util/IConfigManager.java | 62 ++ .../appeng/api/util/IConfigureableObject.java | 14 + .../java/appeng/api/util/IOrientable.java | 37 ++ .../appeng/api/util/IOrientableBlock.java | 20 + .../appeng/api/util/IReadOnlyCollection.java | 21 + src/main/java/appeng/api/util/WorldCoord.java | 138 ++++ .../api/blueprints/BlockSignature.java | 76 +++ .../api/blueprints/BlueprintManager.java | 44 ++ .../buildcraft/api/blueprints/BptBlock.java | 234 +++++++ .../api/blueprints/BptBlockUtils.java | 84 +++ .../api/blueprints/BptSlotInfo.java | 55 ++ .../api/blueprints/IBptContext.java | 47 ++ .../api/blueprints/ItemSignature.java | 47 ++ .../api/blueprints/package-info.java | 3 + .../buildcraft/api/bptblocks/BptBlockBed.java | 88 +++ .../api/bptblocks/BptBlockCustomStack.java | 33 + .../api/bptblocks/BptBlockDelegate.java | 69 ++ .../api/bptblocks/BptBlockDirt.java | 42 ++ .../api/bptblocks/BptBlockDoor.java | 70 ++ .../api/bptblocks/BptBlockFluid.java | 60 ++ .../api/bptblocks/BptBlockIgnore.java | 44 ++ .../api/bptblocks/BptBlockIgnoreMeta.java | 34 + .../api/bptblocks/BptBlockInventory.java | 37 ++ .../api/bptblocks/BptBlockLever.java | 37 ++ .../api/bptblocks/BptBlockPiston.java | 28 + .../api/bptblocks/BptBlockPumpkin.java | 53 ++ .../bptblocks/BptBlockRedstoneRepeater.java | 49 ++ .../bptblocks/BptBlockRotateInventory.java | 35 + .../api/bptblocks/BptBlockRotateMeta.java | 84 +++ .../api/bptblocks/BptBlockSign.java | 63 ++ .../api/bptblocks/BptBlockStairs.java | 53 ++ .../api/bptblocks/BptBlockWallSide.java | 51 ++ .../api/bptblocks/package-info.java | 3 + .../buildcraft/api/core/BuildCraftAPI.java | 22 + .../buildcraft/api/core/IAreaProvider.java | 33 + src/main/java/buildcraft/api/core/IBox.java | 29 + .../buildcraft/api/core/IIconProvider.java | 32 + .../java/buildcraft/api/core/LaserKind.java | 13 + .../java/buildcraft/api/core/Position.java | 141 ++++ .../buildcraft/api/core/SafeTimeTracker.java | 52 +- .../buildcraft/api/core/StackWrapper.java | 52 ++ .../buildcraft/api/core/package-info.java | 3 + .../buildcraft/api/filler/FillerManager.java | 15 + .../buildcraft/api/filler/IFillerPattern.java | 37 ++ .../api/filler/IFillerRegistry.java | 25 + .../api/filler/IPatternIterator.java | 16 + .../buildcraft/api/filler/package-info.java | 3 + .../api/fuels/IronEngineCoolant.java | 91 +++ .../buildcraft/api/fuels/IronEngineFuel.java | 51 ++ .../buildcraft/api/fuels/package-info.java | 3 + .../buildcraft/api/gates/ActionManager.java | 99 +++ .../api/gates/GateExpansionController.java | 58 ++ .../buildcraft/api/gates/GateExpansions.java | 65 ++ .../java/buildcraft/api/gates/IAction.java | 29 + .../buildcraft/api/gates/IActionProvider.java | 22 + .../buildcraft/api/gates/IActionReceptor.java | 15 + .../buildcraft/api/gates/IGateExpansion.java | 30 + .../api/gates/IOverrideDefaultTriggers.java | 20 + .../buildcraft/api/gates/ITileTrigger.java | 21 + .../java/buildcraft/api/gates/ITrigger.java | 52 ++ .../api/gates/ITriggerParameter.java | 27 + .../api/gates/ITriggerProvider.java | 28 + .../api/gates/TriggerParameter.java | 79 +++ .../buildcraft/api/gates/package-info.java | 3 + .../api/inventory/ISpecialInventory.java | 45 ++ .../api/inventory/package-info.java | 3 + .../java/buildcraft/api/package-info.java | 3 + .../buildcraft/api/power/ILaserTarget.java | 41 ++ .../buildcraft/api/power/IPowerEmitter.java | 22 + .../buildcraft/api/power/IPowerReceptor.java | 14 +- .../buildcraft/api/power/PowerHandler.java | 163 +++-- .../buildcraft/api/power/package-info.java | 3 + .../api/recipes/BuildcraftRecipes.java | 19 + .../api/recipes/IAssemblyRecipeManager.java | 36 ++ .../recipes/IIntegrationRecipeManager.java | 43 ++ .../api/recipes/IRefineryRecipeManager.java | 36 ++ .../buildcraft/api/recipes/package-info.java | 3 + .../buildcraft/api/tools/IToolPipette.java | 48 ++ .../buildcraft/api/tools/IToolWrench.java | 40 ++ .../buildcraft/api/tools/package-info.java | 3 + .../api/transport/IExtractionHandler.java | 29 + .../api/transport/IPipeConnection.java | 30 + .../api/transport/IPipeDefinition.java | 26 + .../buildcraft/api/transport/IPipeTile.java | 50 ++ .../api/transport/PipeBehavior.java | 47 ++ .../buildcraft/api/transport/PipeManager.java | 44 ++ .../buildcraft/api/transport/PipeWire.java | 61 ++ .../api/transport/package-info.java | 3 + .../java/cofh/api/energy/IEnergyHandler.java | 3 +- .../dan200/computer/api/ComputerCraftAPI.java | 158 ----- .../dan200/computer/api/IComputerAccess.java | 89 --- .../computer/api/IHostedPeripheral.java | 44 -- .../java/dan200/computer/api/ILuaContext.java | 45 -- .../java/dan200/computer/api/ILuaObject.java | 26 - src/main/java/dan200/computer/api/IMedia.java | 57 -- src/main/java/dan200/computer/api/IMount.java | 57 -- .../java/dan200/computer/api/IPeripheral.java | 106 --- .../computer/api/IPeripheralHandler.java | 17 - .../dan200/computer/api/IWritableMount.java | 53 -- .../java/dan200/turtle/api/ITurtleAccess.java | 158 ----- .../turtle/api/ITurtleCommandHandler.java | 25 - .../dan200/turtle/api/ITurtleUpgrade.java | 92 --- .../java/dan200/turtle/api/TurtleAPI.java | 78 --- .../java/dan200/turtle/api/TurtleSide.java | 23 - .../dan200/turtle/api/TurtleUpgradeType.java | 27 - .../java/dan200/turtle/api/TurtleVerb.java | 26 - src/main/java/ic2/api/energy/EnergyNet.java | 18 - src/main/java/ic2/api/energy/IEnergyNet.java | 64 -- .../ic2/api/energy/event/EnergyTileEvent.java | 23 - .../api/energy/event/EnergyTileLoadEvent.java | 26 - .../energy/event/EnergyTileUnloadEvent.java | 27 - .../ic2/api/energy/tile/IEnergyAcceptor.java | 27 - .../ic2/api/energy/tile/IEnergyConductor.java | 53 -- .../ic2/api/energy/tile/IEnergyEmitter.java | 28 - .../java/ic2/api/energy/tile/IEnergySink.java | 46 -- .../ic2/api/energy/tile/IEnergySource.java | 26 - .../java/ic2/api/energy/tile/IEnergyTile.java | 15 - .../ic2/api/energy/tile/IMetaDelegate.java | 34 - src/main/java/ic2/api/energy/usage.txt | 144 ----- src/main/java/ic2/api/item/IBoxable.java | 14 - .../ic2/api/item/ICustomElectricItem.java | 68 -- src/main/java/ic2/api/item/IElectricItem.java | 54 -- .../ic2/api/item/IElectricItemManager.java | 93 --- .../ic2/api/item/ISpecialElectricItem.java | 14 - src/main/java/ic2/api/item/Items.java | 609 ------------------ .../java/mods/battlegear2/api/IAllowItem.java | 11 - .../java/mods/battlegear2/api/IDyable.java | 31 - .../mods/battlegear2/api/IOffhandDual.java | 55 -- .../java/mods/battlegear2/api/ISheathed.java | 12 - .../java/mods/battlegear2/api/IShield.java | 62 -- .../battlegear2/api/PlayerEventChild.java | 32 - .../api/quiver/IArrowContainer2.java | 99 --- .../api/quiver/QuiverArrowEvent.java | 30 - .../api/quiver/QuiverArrowRegistry.java | 62 -- .../api/weapons/IBackStabbable.java | 14 - .../api/weapons/IBattlegearWeapon.java | 12 - .../api/weapons/IExtendedReachWeapon.java | 12 - .../api/weapons/IHitTimeModifier.java | 15 - .../api/weapons/IPenetrateWeapon.java | 13 - .../api/weapons/IPotionEffect.java | 23 - .../api/weapons/ISpecialEffect.java | 16 - .../api/weapons/OffhandAttackEvent.java | 22 - .../mods/battlegear2/items/ItemShield.java | 11 - .../core/handler/ClientTickHandler.java | 47 +- .../core/handler/GemArmorKeyHandler.java | 65 +- .../client/core/handler/HUDHandler.java | 4 +- .../handler/kami/SoulHeartClientHandler.java | 5 +- .../core/handler/kami/ToolModeHUDHandler.java | 14 +- .../client/gui/GuiAnimationTablet.java | 16 +- .../client/gui/GuiAspectAnalyzer.java | 14 +- .../tinkerer/client/gui/GuiMobMagnet.java | 15 +- .../tinkerer/client/gui/kami/GuiWarpGate.java | 5 +- .../client/render/block/RenderMagnet.java | 12 +- .../client/render/block/RenderRepairer.java | 16 +- .../render/block/kami/RenderWarpGate.java | 19 +- .../client/render/item/RenderMobAspect.java | 6 +- .../client/render/item/RenderMobDisplay.java | 8 - .../item/kami/RenderPlacementMirror.java | 6 +- .../render/tile/RenderTileEnchanter.java | 10 +- .../client/render/tile/RenderTileMagnet.java | 14 +- .../common/block/kami/BlockWarpGate.java | 26 +- .../common/block/tile/TileAspectAnalyzer.java | 58 +- .../tinkerer/common/block/tile/TileCamo.java | 15 +- .../common/block/tile/TileEnchanter.java | 78 +-- .../common/block/tile/TileFunnel.java | 61 +- .../common/block/tile/TileRepairer.java | 63 +- .../common/block/tile/kami/TileWarpGate.java | 59 +- .../tile/tablet/TileAnimationTablet.java | 167 +++-- .../TileTransvectorDislocator.java | 27 +- .../BlockTransvectorDislocator.java | 38 +- .../common/compat/EnderStorageFunctions.java | 18 +- .../enchantment/EnchantmentAutoSmelt.java | 2 +- .../enchantment/ModEnchantmentHandler.java | 31 +- .../common/research/EnderStorageRecepie.java | 14 +- src/main/resources/ThaumicTinkerer_at.cfg | 5 +- 469 files changed, 11277 insertions(+), 7405 deletions(-) create mode 100644 src/main/java/appeng/api/AEApi.java delete mode 100755 src/main/java/appeng/api/Blocks.java delete mode 100755 src/main/java/appeng/api/DimentionalCoord.java delete mode 100755 src/main/java/appeng/api/IAEItemStack.java mode change 100755 => 100644 src/main/java/appeng/api/IAppEngApi.java delete mode 100755 src/main/java/appeng/api/IAppEngGrinderRecipe.java delete mode 100755 src/main/java/appeng/api/ICellHandler.java delete mode 100755 src/main/java/appeng/api/ICellRegistry.java delete mode 100755 src/main/java/appeng/api/IExternalStorageHandler.java delete mode 100755 src/main/java/appeng/api/IExternalStorageRegistry.java delete mode 100755 src/main/java/appeng/api/IGridCacheRegistry.java delete mode 100755 src/main/java/appeng/api/IItemComparisionProvider.java delete mode 100755 src/main/java/appeng/api/IItemComparison.java delete mode 100755 src/main/java/appeng/api/IItemList.java delete mode 100755 src/main/java/appeng/api/ISpecialComparisonRegistry.java delete mode 100755 src/main/java/appeng/api/IWirelessTermHandler.java delete mode 100755 src/main/java/appeng/api/IWirelessTermRegistery.java delete mode 100755 src/main/java/appeng/api/Items.java delete mode 100755 src/main/java/appeng/api/Materials.java delete mode 100755 src/main/java/appeng/api/README.txt delete mode 100755 src/main/java/appeng/api/TileRef.java delete mode 100755 src/main/java/appeng/api/Util.java delete mode 100755 src/main/java/appeng/api/WorldCoord.java create mode 100644 src/main/java/appeng/api/config/AccessRestriction.java mode change 100755 => 100644 src/main/java/appeng/api/config/ActionItems.java create mode 100644 src/main/java/appeng/api/config/Actionable.java mode change 100755 => 100644 src/main/java/appeng/api/config/CondenserOuput.java delete mode 100755 src/main/java/appeng/api/config/EnableDisable.java mode change 100755 => 100644 src/main/java/appeng/api/config/FullnessMode.java mode change 100755 => 100644 src/main/java/appeng/api/config/FuzzyMode.java delete mode 100755 src/main/java/appeng/api/config/IConfigEnum.java create mode 100644 src/main/java/appeng/api/config/IncludeExclude.java delete mode 100755 src/main/java/appeng/api/config/InterfaceBlockingMode.java delete mode 100755 src/main/java/appeng/api/config/InterfaceCraftingMode.java delete mode 100755 src/main/java/appeng/api/config/ItemFlow.java create mode 100644 src/main/java/appeng/api/config/LevelEmitterMode.java create mode 100644 src/main/java/appeng/api/config/LevelType.java delete mode 100755 src/main/java/appeng/api/config/ListMode.java delete mode 100755 src/main/java/appeng/api/config/MatchingMode.java create mode 100644 src/main/java/appeng/api/config/ModSettings.java create mode 100644 src/main/java/appeng/api/config/NetworkEmitterMode.java mode change 100755 => 100644 src/main/java/appeng/api/config/OperationMode.java create mode 100644 src/main/java/appeng/api/config/OutputMode.java create mode 100644 src/main/java/appeng/api/config/PowerMultiplier.java mode change 100755 => 100644 src/main/java/appeng/api/config/PowerUnits.java create mode 100644 src/main/java/appeng/api/config/RedstoneMode.java delete mode 100755 src/main/java/appeng/api/config/RedstoneModeInput.java delete mode 100755 src/main/java/appeng/api/config/RedstoneModeInputOnOff.java delete mode 100755 src/main/java/appeng/api/config/RedstoneModeOutput.java create mode 100644 src/main/java/appeng/api/config/RelativeDirection.java mode change 100755 => 100644 src/main/java/appeng/api/config/SearchBoxMode.java create mode 100644 src/main/java/appeng/api/config/SecurityPermissions.java create mode 100644 src/main/java/appeng/api/config/Settings.java mode change 100755 => 100644 src/main/java/appeng/api/config/SortDir.java mode change 100755 => 100644 src/main/java/appeng/api/config/SortOrder.java delete mode 100755 src/main/java/appeng/api/config/StackModeInput.java delete mode 100755 src/main/java/appeng/api/config/StackModeOutput.java delete mode 100755 src/main/java/appeng/api/config/TransferDir.java create mode 100644 src/main/java/appeng/api/config/TunnelType.java create mode 100644 src/main/java/appeng/api/config/Upgrades.java mode change 100755 => 100644 src/main/java/appeng/api/config/ViewItems.java create mode 100644 src/main/java/appeng/api/config/YesNo.java create mode 100644 src/main/java/appeng/api/crafting/ICraftingMedium.java create mode 100644 src/main/java/appeng/api/crafting/ICraftingPattern.java create mode 100644 src/main/java/appeng/api/crafting/ICraftingPatternMAC.java create mode 100644 src/main/java/appeng/api/crafting/ICraftingProvider.java create mode 100644 src/main/java/appeng/api/crafting/ICraftingProviderHelper.java create mode 100644 src/main/java/appeng/api/definitions/Blocks.java create mode 100644 src/main/java/appeng/api/definitions/Items.java create mode 100644 src/main/java/appeng/api/definitions/Materials.java create mode 100644 src/main/java/appeng/api/definitions/Parts.java delete mode 100755 src/main/java/appeng/api/events/AEWorldEvent.java delete mode 100755 src/main/java/appeng/api/events/GridErrorEvent.java delete mode 100755 src/main/java/appeng/api/events/GridPatternUpdateEvent.java delete mode 100755 src/main/java/appeng/api/events/GridStorageUpdateEvent.java delete mode 100755 src/main/java/appeng/api/events/GridTileConnectivityEvent.java delete mode 100755 src/main/java/appeng/api/events/GridTileLoadEvent.java delete mode 100755 src/main/java/appeng/api/events/GridTileUnloadEvent.java create mode 100644 src/main/java/appeng/api/events/LocatableEventAnnounce.java delete mode 100755 src/main/java/appeng/api/events/LocateableEventAnnounce.java delete mode 100755 src/main/java/appeng/api/events/MultiBlockUpdateEvent.java mode change 100755 => 100644 src/main/java/appeng/api/exceptions/AppEngException.java delete mode 100755 src/main/java/appeng/api/exceptions/AppEngTileMissingException.java create mode 100644 src/main/java/appeng/api/exceptions/FailedConnection.java create mode 100644 src/main/java/appeng/api/exceptions/MissingIngredientError.java create mode 100644 src/main/java/appeng/api/exceptions/ModNotInstalled.java create mode 100644 src/main/java/appeng/api/exceptions/RecipeError.java create mode 100644 src/main/java/appeng/api/exceptions/RegistrationError.java create mode 100644 src/main/java/appeng/api/features/IGrinderEntry.java rename src/main/java/appeng/api/{IGrinderRecipeManager.java => features/IGrinderRegistry.java} (50%) mode change 100755 => 100644 create mode 100644 src/main/java/appeng/api/features/IItemComparisionProvider.java create mode 100644 src/main/java/appeng/api/features/IItemComparison.java create mode 100644 src/main/java/appeng/api/features/ILocatable.java rename src/main/java/appeng/api/{ => features}/ILocateableRegistry.java (53%) mode change 100755 => 100644 create mode 100644 src/main/java/appeng/api/features/IMatterCannonAmmoRegistry.java create mode 100644 src/main/java/appeng/api/features/INetworkEncodable.java create mode 100644 src/main/java/appeng/api/features/IP2PTunnelRegistry.java create mode 100644 src/main/java/appeng/api/features/IPlayerRegistry.java create mode 100644 src/main/java/appeng/api/features/IRecipeHandlerRegistry.java create mode 100644 src/main/java/appeng/api/features/IRegistryContainer.java create mode 100644 src/main/java/appeng/api/features/ISpecialComparisonRegistry.java create mode 100644 src/main/java/appeng/api/features/IWirelessTermHandler.java create mode 100644 src/main/java/appeng/api/features/IWirelessTermRegistery.java create mode 100644 src/main/java/appeng/api/implementations/ICraftingPatternItem.java create mode 100644 src/main/java/appeng/api/implementations/IPowerChannelState.java create mode 100644 src/main/java/appeng/api/implementations/IUpgradeableHost.java create mode 100644 src/main/java/appeng/api/implementations/TransitionResult.java create mode 100644 src/main/java/appeng/api/implementations/guiobjects/IGuiItem.java create mode 100644 src/main/java/appeng/api/implementations/guiobjects/IGuiItemObject.java create mode 100644 src/main/java/appeng/api/implementations/guiobjects/INetworkTool.java create mode 100644 src/main/java/appeng/api/implementations/guiobjects/IPortableCell.java create mode 100644 src/main/java/appeng/api/implementations/items/IAEItemPowerStorage.java create mode 100644 src/main/java/appeng/api/implementations/items/IAEWrench.java create mode 100644 src/main/java/appeng/api/implementations/items/IBiometricCard.java create mode 100644 src/main/java/appeng/api/implementations/items/IGrowableCrystal.java create mode 100644 src/main/java/appeng/api/implementations/items/IItemGroup.java create mode 100644 src/main/java/appeng/api/implementations/items/IMemoryCard.java create mode 100644 src/main/java/appeng/api/implementations/items/ISpatialStorageCell.java create mode 100644 src/main/java/appeng/api/implementations/items/IStorageCell.java create mode 100644 src/main/java/appeng/api/implementations/items/IStorageComponent.java create mode 100644 src/main/java/appeng/api/implementations/items/IUpgradeModule.java create mode 100644 src/main/java/appeng/api/implementations/items/MemoryCardMessages.java create mode 100644 src/main/java/appeng/api/implementations/parts/IPartCable.java create mode 100644 src/main/java/appeng/api/implementations/parts/IPartMonitor.java create mode 100644 src/main/java/appeng/api/implementations/parts/IPartStorageMonitor.java create mode 100644 src/main/java/appeng/api/implementations/tiles/IChestOrDrive.java create mode 100644 src/main/java/appeng/api/implementations/tiles/ICrankable.java create mode 100644 src/main/java/appeng/api/implementations/tiles/IMEChest.java create mode 100644 src/main/java/appeng/api/implementations/tiles/ISegmentedInventory.java create mode 100644 src/main/java/appeng/api/implementations/tiles/ITileStorageMonitorable.java create mode 100644 src/main/java/appeng/api/implementations/tiles/IViewCellStorage.java create mode 100644 src/main/java/appeng/api/integration/IBeeComparison.java delete mode 100755 src/main/java/appeng/api/me/items/IAEChargeableItem.java delete mode 100755 src/main/java/appeng/api/me/items/IAEWrench.java delete mode 100755 src/main/java/appeng/api/me/items/IMemoryCard.java delete mode 100755 src/main/java/appeng/api/me/items/ISpatialStorage.java delete mode 100755 src/main/java/appeng/api/me/items/IStorageCell.java delete mode 100755 src/main/java/appeng/api/me/items/IStorageComponent.java delete mode 100755 src/main/java/appeng/api/me/tiles/IAssemblerMB.java delete mode 100755 src/main/java/appeng/api/me/tiles/IAssemblerPatternProvider.java delete mode 100755 src/main/java/appeng/api/me/tiles/ICellContainer.java delete mode 100755 src/main/java/appeng/api/me/tiles/ICellProvider.java delete mode 100755 src/main/java/appeng/api/me/tiles/IColoredMETile.java delete mode 100755 src/main/java/appeng/api/me/tiles/IConfigureableTile.java delete mode 100755 src/main/java/appeng/api/me/tiles/IConnectionSensitive.java delete mode 100755 src/main/java/appeng/api/me/tiles/ICraftingTracker.java delete mode 100755 src/main/java/appeng/api/me/tiles/IDirectionalMETile.java delete mode 100755 src/main/java/appeng/api/me/tiles/IExtendedCellProvider.java delete mode 100755 src/main/java/appeng/api/me/tiles/IFulllyOptionalMETile.java delete mode 100755 src/main/java/appeng/api/me/tiles/IGridMachine.java delete mode 100755 src/main/java/appeng/api/me/tiles/IGridTeleport.java delete mode 100755 src/main/java/appeng/api/me/tiles/IGridTileEntity.java delete mode 100755 src/main/java/appeng/api/me/tiles/ILocateable.java delete mode 100755 src/main/java/appeng/api/me/tiles/IMEPowerStorage.java delete mode 100755 src/main/java/appeng/api/me/tiles/INonSignalBlock.java delete mode 100755 src/main/java/appeng/api/me/tiles/IOptionalMETile.java delete mode 100755 src/main/java/appeng/api/me/tiles/IOrientableTile.java delete mode 100755 src/main/java/appeng/api/me/tiles/IPriorityTile.java delete mode 100755 src/main/java/appeng/api/me/tiles/IStorageAware.java delete mode 100755 src/main/java/appeng/api/me/tiles/IStorageMonitor.java delete mode 100755 src/main/java/appeng/api/me/tiles/ITileCable.java delete mode 100755 src/main/java/appeng/api/me/tiles/ITileIOCable.java delete mode 100755 src/main/java/appeng/api/me/tiles/ITileInterfaceApi.java delete mode 100755 src/main/java/appeng/api/me/tiles/ITilePushable.java delete mode 100755 src/main/java/appeng/api/me/tiles/InterfaceCraftingPattern.java delete mode 100755 src/main/java/appeng/api/me/util/Grid.java delete mode 100755 src/main/java/appeng/api/me/util/IAssemblerCluster.java delete mode 100755 src/main/java/appeng/api/me/util/IConfigManager.java delete mode 100755 src/main/java/appeng/api/me/util/ICraftRequest.java delete mode 100755 src/main/java/appeng/api/me/util/ICraftWatcher.java delete mode 100755 src/main/java/appeng/api/me/util/ICraftingPattern.java delete mode 100755 src/main/java/appeng/api/me/util/ICraftingPatternMAC.java delete mode 100755 src/main/java/appeng/api/me/util/IGridCache.java delete mode 100755 src/main/java/appeng/api/me/util/IGridInterface.java delete mode 100755 src/main/java/appeng/api/me/util/IMEInventory.java delete mode 100755 src/main/java/appeng/api/me/util/IMEInventoryHandler.java delete mode 100755 src/main/java/appeng/api/me/util/IMEInventoryUtil.java delete mode 100755 src/main/java/appeng/api/me/util/ITileCraftingProvider.java delete mode 100755 src/main/java/appeng/api/me/util/InterfaceCraftingResponse.java delete mode 100755 src/main/java/appeng/api/me/util/TransitionResult.java mode change 100755 => 100644 src/main/java/appeng/api/movable/IMovableRegistry.java mode change 100755 => 100644 src/main/java/appeng/api/movable/IMovableTile.java delete mode 100755 src/main/java/appeng/api/networkevents/MENetworkEvent.java delete mode 100755 src/main/java/appeng/api/networkevents/MENetworkEventSubscribe.java delete mode 100755 src/main/java/appeng/api/networkevents/MENetworkPowerStorage.java delete mode 100755 src/main/java/appeng/api/networkevents/MENetworkStorageEvent.java create mode 100644 src/main/java/appeng/api/networking/GridFlags.java create mode 100644 src/main/java/appeng/api/networking/GridNotification.java create mode 100644 src/main/java/appeng/api/networking/IGrid.java create mode 100644 src/main/java/appeng/api/networking/IGridBlock.java create mode 100644 src/main/java/appeng/api/networking/IGridCache.java create mode 100644 src/main/java/appeng/api/networking/IGridCacheRegistry.java create mode 100644 src/main/java/appeng/api/networking/IGridConnecitonVisitor.java create mode 100644 src/main/java/appeng/api/networking/IGridConnection.java create mode 100644 src/main/java/appeng/api/networking/IGridHost.java create mode 100644 src/main/java/appeng/api/networking/IGridMultiblock.java create mode 100644 src/main/java/appeng/api/networking/IGridNode.java create mode 100644 src/main/java/appeng/api/networking/IGridStorage.java create mode 100644 src/main/java/appeng/api/networking/IGridVisitor.java create mode 100644 src/main/java/appeng/api/networking/IMachineSet.java create mode 100644 src/main/java/appeng/api/networking/energy/IAEPowerStorage.java create mode 100644 src/main/java/appeng/api/networking/energy/IEnergyGrid.java create mode 100644 src/main/java/appeng/api/networking/energy/IEnergyGridProvider.java create mode 100644 src/main/java/appeng/api/networking/energy/IEnergySource.java create mode 100644 src/main/java/appeng/api/networking/energy/IEnergyWatcher.java create mode 100644 src/main/java/appeng/api/networking/energy/IEnergyWatcherHost.java create mode 100644 src/main/java/appeng/api/networking/events/MENetworkBootingStatusChange.java create mode 100644 src/main/java/appeng/api/networking/events/MENetworkCellArrayUpdate.java create mode 100644 src/main/java/appeng/api/networking/events/MENetworkChannelChanged.java create mode 100644 src/main/java/appeng/api/networking/events/MENetworkChannelsChanged.java create mode 100644 src/main/java/appeng/api/networking/events/MENetworkControllerChange.java create mode 100644 src/main/java/appeng/api/networking/events/MENetworkCraftingChange.java create mode 100644 src/main/java/appeng/api/networking/events/MENetworkEvent.java create mode 100644 src/main/java/appeng/api/networking/events/MENetworkEventSubscribe.java create mode 100644 src/main/java/appeng/api/networking/events/MENetworkPostCacheConstruction.java create mode 100644 src/main/java/appeng/api/networking/events/MENetworkPowerIdleChange.java create mode 100644 src/main/java/appeng/api/networking/events/MENetworkPowerStatusChange.java create mode 100644 src/main/java/appeng/api/networking/events/MENetworkPowerStorage.java create mode 100644 src/main/java/appeng/api/networking/events/MENetworkSecurityChange.java create mode 100644 src/main/java/appeng/api/networking/events/MENetworkSpatialEvent.java create mode 100644 src/main/java/appeng/api/networking/events/MENetworkStorageEvent.java create mode 100644 src/main/java/appeng/api/networking/pathing/ControllerState.java create mode 100644 src/main/java/appeng/api/networking/pathing/IPathingGrid.java create mode 100644 src/main/java/appeng/api/networking/security/BaseActionSource.java create mode 100644 src/main/java/appeng/api/networking/security/IActionHost.java create mode 100644 src/main/java/appeng/api/networking/security/ISecurityGrid.java create mode 100644 src/main/java/appeng/api/networking/security/MachineSource.java create mode 100644 src/main/java/appeng/api/networking/security/PlayerSource.java create mode 100644 src/main/java/appeng/api/networking/spatial/ISpatialCache.java create mode 100644 src/main/java/appeng/api/networking/storage/IStackWatcher.java create mode 100644 src/main/java/appeng/api/networking/storage/IStackWatcherHost.java create mode 100644 src/main/java/appeng/api/networking/storage/IStorageGrid.java create mode 100644 src/main/java/appeng/api/networking/ticking/IGridTickable.java create mode 100644 src/main/java/appeng/api/networking/ticking/ITickManager.java create mode 100644 src/main/java/appeng/api/networking/ticking/TickRateModulation.java create mode 100644 src/main/java/appeng/api/networking/ticking/TickingRequest.java create mode 100644 src/main/java/appeng/api/package-info.java create mode 100644 src/main/java/appeng/api/parts/BusSupport.java create mode 100644 src/main/java/appeng/api/parts/IFacadeContainer.java create mode 100644 src/main/java/appeng/api/parts/IFacadePart.java create mode 100644 src/main/java/appeng/api/parts/IPart.java create mode 100644 src/main/java/appeng/api/parts/IPartCollsionHelper.java create mode 100644 src/main/java/appeng/api/parts/IPartHelper.java create mode 100644 src/main/java/appeng/api/parts/IPartHost.java create mode 100644 src/main/java/appeng/api/parts/IPartItem.java create mode 100644 src/main/java/appeng/api/parts/IPartRenderHelper.java create mode 100644 src/main/java/appeng/api/parts/ISimplifiedBundle.java create mode 100644 src/main/java/appeng/api/parts/LayerBase.java create mode 100644 src/main/java/appeng/api/parts/LayerFlags.java create mode 100644 src/main/java/appeng/api/parts/PartItemStack.java create mode 100644 src/main/java/appeng/api/parts/SelectedPart.java create mode 100644 src/main/java/appeng/api/parts/layers/InvSot.java create mode 100644 src/main/java/appeng/api/parts/layers/LayerIEnergySink.java create mode 100644 src/main/java/appeng/api/parts/layers/LayerIEnergySource.java create mode 100644 src/main/java/appeng/api/parts/layers/LayerIFluidHandler.java create mode 100644 src/main/java/appeng/api/parts/layers/LayerIPipeConnection.java create mode 100644 src/main/java/appeng/api/parts/layers/LayerIPowerEmitter.java create mode 100644 src/main/java/appeng/api/parts/layers/LayerIPowerReceptor.java create mode 100644 src/main/java/appeng/api/parts/layers/LayerISidedInventory.java create mode 100644 src/main/java/appeng/api/parts/layers/LayerITileStorageMonitorable.java create mode 100644 src/main/java/appeng/api/recipes/ICraftHandler.java create mode 100644 src/main/java/appeng/api/recipes/IIngredient.java create mode 100644 src/main/java/appeng/api/recipes/IRecipeHandler.java create mode 100644 src/main/java/appeng/api/recipes/IRecipeLoader.java create mode 100644 src/main/java/appeng/api/recipes/ISubItemResolver.java create mode 100644 src/main/java/appeng/api/recipes/ResolverResult.java create mode 100644 src/main/java/appeng/api/recipes/ResolverResultSet.java create mode 100644 src/main/java/appeng/api/storage/ICellContainer.java create mode 100644 src/main/java/appeng/api/storage/ICellHandler.java create mode 100644 src/main/java/appeng/api/storage/ICellRegistry.java create mode 100644 src/main/java/appeng/api/storage/ICellWorkbenchItem.java create mode 100644 src/main/java/appeng/api/storage/IExternalStorageHandler.java create mode 100644 src/main/java/appeng/api/storage/IExternalStorageRegistry.java create mode 100644 src/main/java/appeng/api/storage/IMEInventory.java create mode 100644 src/main/java/appeng/api/storage/IMEInventoryHandler.java create mode 100644 src/main/java/appeng/api/storage/IMEMonitor.java create mode 100644 src/main/java/appeng/api/storage/IMEMonitorHandlerReceiver.java create mode 100644 src/main/java/appeng/api/storage/IStorageHelper.java create mode 100644 src/main/java/appeng/api/storage/IStorageMonitorable.java create mode 100644 src/main/java/appeng/api/storage/ITerminalHost.java create mode 100644 src/main/java/appeng/api/storage/MEMonitorHandler.java create mode 100644 src/main/java/appeng/api/storage/StorageChannel.java create mode 100644 src/main/java/appeng/api/storage/data/IAEFluidStack.java create mode 100644 src/main/java/appeng/api/storage/data/IAEItemStack.java create mode 100644 src/main/java/appeng/api/storage/data/IAEStack.java rename src/main/java/appeng/api/{ => storage/data}/IAETagCompound.java (54%) mode change 100755 => 100644 create mode 100644 src/main/java/appeng/api/storage/data/IItemList.java create mode 100644 src/main/java/appeng/api/util/AECableType.java create mode 100644 src/main/java/appeng/api/util/AEColor.java create mode 100644 src/main/java/appeng/api/util/AEColoredItemDefinition.java create mode 100644 src/main/java/appeng/api/util/AEItemDefinition.java create mode 100644 src/main/java/appeng/api/util/DimensionalCoord.java create mode 100644 src/main/java/appeng/api/util/ICommonTile.java create mode 100644 src/main/java/appeng/api/util/IConfigManager.java create mode 100644 src/main/java/appeng/api/util/IConfigureableObject.java create mode 100644 src/main/java/appeng/api/util/IOrientable.java create mode 100644 src/main/java/appeng/api/util/IOrientableBlock.java create mode 100644 src/main/java/appeng/api/util/IReadOnlyCollection.java create mode 100644 src/main/java/appeng/api/util/WorldCoord.java create mode 100644 src/main/java/buildcraft/api/blueprints/BlockSignature.java create mode 100644 src/main/java/buildcraft/api/blueprints/BlueprintManager.java create mode 100644 src/main/java/buildcraft/api/blueprints/BptBlock.java create mode 100644 src/main/java/buildcraft/api/blueprints/BptBlockUtils.java create mode 100644 src/main/java/buildcraft/api/blueprints/BptSlotInfo.java create mode 100644 src/main/java/buildcraft/api/blueprints/IBptContext.java create mode 100644 src/main/java/buildcraft/api/blueprints/ItemSignature.java create mode 100644 src/main/java/buildcraft/api/blueprints/package-info.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockBed.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockCustomStack.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockDelegate.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockDirt.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockDoor.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockFluid.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockIgnore.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockIgnoreMeta.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockInventory.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockLever.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockPiston.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockPumpkin.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockRedstoneRepeater.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockRotateInventory.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockRotateMeta.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockSign.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockStairs.java create mode 100644 src/main/java/buildcraft/api/bptblocks/BptBlockWallSide.java create mode 100644 src/main/java/buildcraft/api/bptblocks/package-info.java create mode 100644 src/main/java/buildcraft/api/core/BuildCraftAPI.java create mode 100644 src/main/java/buildcraft/api/core/IAreaProvider.java create mode 100644 src/main/java/buildcraft/api/core/IBox.java create mode 100644 src/main/java/buildcraft/api/core/IIconProvider.java create mode 100644 src/main/java/buildcraft/api/core/LaserKind.java create mode 100644 src/main/java/buildcraft/api/core/Position.java create mode 100644 src/main/java/buildcraft/api/core/StackWrapper.java create mode 100644 src/main/java/buildcraft/api/core/package-info.java create mode 100644 src/main/java/buildcraft/api/filler/FillerManager.java create mode 100644 src/main/java/buildcraft/api/filler/IFillerPattern.java create mode 100644 src/main/java/buildcraft/api/filler/IFillerRegistry.java create mode 100644 src/main/java/buildcraft/api/filler/IPatternIterator.java create mode 100644 src/main/java/buildcraft/api/filler/package-info.java create mode 100644 src/main/java/buildcraft/api/fuels/IronEngineCoolant.java create mode 100644 src/main/java/buildcraft/api/fuels/IronEngineFuel.java create mode 100644 src/main/java/buildcraft/api/fuels/package-info.java create mode 100644 src/main/java/buildcraft/api/gates/ActionManager.java create mode 100644 src/main/java/buildcraft/api/gates/GateExpansionController.java create mode 100644 src/main/java/buildcraft/api/gates/GateExpansions.java create mode 100644 src/main/java/buildcraft/api/gates/IAction.java create mode 100644 src/main/java/buildcraft/api/gates/IActionProvider.java create mode 100644 src/main/java/buildcraft/api/gates/IActionReceptor.java create mode 100644 src/main/java/buildcraft/api/gates/IGateExpansion.java create mode 100644 src/main/java/buildcraft/api/gates/IOverrideDefaultTriggers.java create mode 100644 src/main/java/buildcraft/api/gates/ITileTrigger.java create mode 100644 src/main/java/buildcraft/api/gates/ITrigger.java create mode 100644 src/main/java/buildcraft/api/gates/ITriggerParameter.java create mode 100644 src/main/java/buildcraft/api/gates/ITriggerProvider.java create mode 100644 src/main/java/buildcraft/api/gates/TriggerParameter.java create mode 100644 src/main/java/buildcraft/api/gates/package-info.java create mode 100644 src/main/java/buildcraft/api/inventory/ISpecialInventory.java create mode 100644 src/main/java/buildcraft/api/inventory/package-info.java create mode 100644 src/main/java/buildcraft/api/package-info.java create mode 100644 src/main/java/buildcraft/api/power/ILaserTarget.java create mode 100644 src/main/java/buildcraft/api/power/IPowerEmitter.java create mode 100644 src/main/java/buildcraft/api/power/package-info.java create mode 100644 src/main/java/buildcraft/api/recipes/BuildcraftRecipes.java create mode 100644 src/main/java/buildcraft/api/recipes/IAssemblyRecipeManager.java create mode 100644 src/main/java/buildcraft/api/recipes/IIntegrationRecipeManager.java create mode 100644 src/main/java/buildcraft/api/recipes/IRefineryRecipeManager.java create mode 100644 src/main/java/buildcraft/api/recipes/package-info.java create mode 100644 src/main/java/buildcraft/api/tools/IToolPipette.java create mode 100644 src/main/java/buildcraft/api/tools/IToolWrench.java create mode 100644 src/main/java/buildcraft/api/tools/package-info.java create mode 100644 src/main/java/buildcraft/api/transport/IExtractionHandler.java create mode 100644 src/main/java/buildcraft/api/transport/IPipeConnection.java create mode 100644 src/main/java/buildcraft/api/transport/IPipeDefinition.java create mode 100644 src/main/java/buildcraft/api/transport/IPipeTile.java create mode 100644 src/main/java/buildcraft/api/transport/PipeBehavior.java create mode 100644 src/main/java/buildcraft/api/transport/PipeManager.java create mode 100644 src/main/java/buildcraft/api/transport/PipeWire.java create mode 100644 src/main/java/buildcraft/api/transport/package-info.java delete mode 100644 src/main/java/dan200/computer/api/ComputerCraftAPI.java delete mode 100644 src/main/java/dan200/computer/api/IComputerAccess.java delete mode 100644 src/main/java/dan200/computer/api/IHostedPeripheral.java delete mode 100644 src/main/java/dan200/computer/api/ILuaContext.java delete mode 100644 src/main/java/dan200/computer/api/ILuaObject.java delete mode 100644 src/main/java/dan200/computer/api/IMedia.java delete mode 100644 src/main/java/dan200/computer/api/IMount.java delete mode 100644 src/main/java/dan200/computer/api/IPeripheral.java delete mode 100644 src/main/java/dan200/computer/api/IPeripheralHandler.java delete mode 100644 src/main/java/dan200/computer/api/IWritableMount.java delete mode 100644 src/main/java/dan200/turtle/api/ITurtleAccess.java delete mode 100644 src/main/java/dan200/turtle/api/ITurtleCommandHandler.java delete mode 100644 src/main/java/dan200/turtle/api/ITurtleUpgrade.java delete mode 100644 src/main/java/dan200/turtle/api/TurtleAPI.java delete mode 100644 src/main/java/dan200/turtle/api/TurtleSide.java delete mode 100644 src/main/java/dan200/turtle/api/TurtleUpgradeType.java delete mode 100644 src/main/java/dan200/turtle/api/TurtleVerb.java delete mode 100644 src/main/java/ic2/api/energy/EnergyNet.java delete mode 100644 src/main/java/ic2/api/energy/IEnergyNet.java delete mode 100644 src/main/java/ic2/api/energy/event/EnergyTileEvent.java delete mode 100644 src/main/java/ic2/api/energy/event/EnergyTileLoadEvent.java delete mode 100644 src/main/java/ic2/api/energy/event/EnergyTileUnloadEvent.java delete mode 100644 src/main/java/ic2/api/energy/tile/IEnergyAcceptor.java delete mode 100644 src/main/java/ic2/api/energy/tile/IEnergyConductor.java delete mode 100644 src/main/java/ic2/api/energy/tile/IEnergyEmitter.java delete mode 100644 src/main/java/ic2/api/energy/tile/IEnergySink.java delete mode 100644 src/main/java/ic2/api/energy/tile/IEnergySource.java delete mode 100644 src/main/java/ic2/api/energy/tile/IEnergyTile.java delete mode 100644 src/main/java/ic2/api/energy/tile/IMetaDelegate.java delete mode 100644 src/main/java/ic2/api/energy/usage.txt delete mode 100644 src/main/java/ic2/api/item/IBoxable.java delete mode 100644 src/main/java/ic2/api/item/ICustomElectricItem.java delete mode 100644 src/main/java/ic2/api/item/IElectricItem.java delete mode 100644 src/main/java/ic2/api/item/IElectricItemManager.java delete mode 100644 src/main/java/ic2/api/item/ISpecialElectricItem.java delete mode 100644 src/main/java/ic2/api/item/Items.java delete mode 100644 src/main/java/mods/battlegear2/api/IAllowItem.java delete mode 100644 src/main/java/mods/battlegear2/api/IDyable.java delete mode 100644 src/main/java/mods/battlegear2/api/IOffhandDual.java delete mode 100644 src/main/java/mods/battlegear2/api/ISheathed.java delete mode 100644 src/main/java/mods/battlegear2/api/IShield.java delete mode 100644 src/main/java/mods/battlegear2/api/PlayerEventChild.java delete mode 100644 src/main/java/mods/battlegear2/api/quiver/IArrowContainer2.java delete mode 100644 src/main/java/mods/battlegear2/api/quiver/QuiverArrowEvent.java delete mode 100644 src/main/java/mods/battlegear2/api/quiver/QuiverArrowRegistry.java delete mode 100644 src/main/java/mods/battlegear2/api/weapons/IBackStabbable.java delete mode 100644 src/main/java/mods/battlegear2/api/weapons/IBattlegearWeapon.java delete mode 100644 src/main/java/mods/battlegear2/api/weapons/IExtendedReachWeapon.java delete mode 100644 src/main/java/mods/battlegear2/api/weapons/IHitTimeModifier.java delete mode 100644 src/main/java/mods/battlegear2/api/weapons/IPenetrateWeapon.java delete mode 100644 src/main/java/mods/battlegear2/api/weapons/IPotionEffect.java delete mode 100644 src/main/java/mods/battlegear2/api/weapons/ISpecialEffect.java delete mode 100644 src/main/java/mods/battlegear2/api/weapons/OffhandAttackEvent.java delete mode 100644 src/main/java/mods/battlegear2/items/ItemShield.java diff --git a/src/main/java/appeng/api/AEApi.java b/src/main/java/appeng/api/AEApi.java new file mode 100644 index 00000000..398133dd --- /dev/null +++ b/src/main/java/appeng/api/AEApi.java @@ -0,0 +1,38 @@ +package appeng.api; + +/** + * + * Entry point for api. + * + * Available IMCs: + * + */ +public class AEApi +{ + + static private IAppEngApi api = null; + + /** + * API Entry Point. + * + * @return the {@link IAppEngApi} + */ + public static IAppEngApi instance() + { + if ( api == null ) + { + try + { + Class c = Class.forName( "appeng.core.Api" ); + api = (IAppEngApi) c.getField( "instance" ).get( c ); + } + catch (Throwable e) + { + return null; + } + } + + return api; + } + +} diff --git a/src/main/java/appeng/api/Blocks.java b/src/main/java/appeng/api/Blocks.java deleted file mode 100755 index c2177275..00000000 --- a/src/main/java/appeng/api/Blocks.java +++ /dev/null @@ -1,75 +0,0 @@ -package appeng.api; - -import net.minecraft.item.ItemStack; - -/** - * Blocks, all of the Blocks in AE. - * DO NOT USE THESE WITHOUT COPYING THEM : ItemStack.copy() - is your friend. - */ - -public class Blocks -{ - // World Gen - public static ItemStack blkQuartzOre; - public static ItemStack blkQuartz; - - // Tech 1 ( non-ME ) - public static ItemStack blkGrinder; - - // Tech 4? ( ME Storage ) - public static ItemStack blkCable_Colored[]; - - public static ItemStack blkAssembler; - public static ItemStack blkController; - public static ItemStack blkDrive; - public static ItemStack blkPatternEncoder; - public static ItemStack blkWireless; - public static ItemStack blkTerminal; - public static ItemStack blkChest; - public static ItemStack blkInterface; - public static ItemStack blkPartitioner; - public static ItemStack blkCraftingTerminal; - public static ItemStack blkStorageBus; - - public static ItemStack blkAssemblerFieldWall; - public static ItemStack blkHeatVent; - public static ItemStack blkCraftingAccelerator; - - public static ItemStack blkInputCablePrecision; - public static ItemStack blkInputCableFuzzy; - public static ItemStack blkInputCableBasic; - - public static ItemStack blkOutputCablePrecision; - public static ItemStack blkOutputCableFuzzy; - public static ItemStack blkOutputCableBasic; - public static ItemStack blkStorageBusFuzzy; - - public static ItemStack blkLevelEmitter; - public static ItemStack blkDarkCable; - public static ItemStack blkIOPort; - public static ItemStack blkCraftingMonitor; - public static ItemStack blkStorageMonitor; - public static ItemStack blkColorlessCable; - public static ItemStack blkColorlessCableCovered; - - public static ItemStack blkTransitionPlane; - public static ItemStack blkCondenser; - public static ItemStack blkEnergyCell; - public static ItemStack blkPowerRelay; - public static ItemStack blkQuantumRing; - public static ItemStack blkQuantumLink; - public static ItemStack blkSpatialPylon; - public static ItemStack blkP2PTunnel; - public static ItemStack blkSpatialIOPort; - - public static ItemStack blkQuartzGlass; - public static ItemStack blkQuartzLamp; - public static ItemStack blkMatrixFrame; - public static ItemStack blkQuartzPiller; - public static ItemStack blkQuartzChiseled; - - - // Used internally, best not to mess with this one... - public static ItemStack blkPhantom; - -} diff --git a/src/main/java/appeng/api/DimentionalCoord.java b/src/main/java/appeng/api/DimentionalCoord.java deleted file mode 100755 index acf17c2b..00000000 --- a/src/main/java/appeng/api/DimentionalCoord.java +++ /dev/null @@ -1,58 +0,0 @@ -package appeng.api; - -import net.minecraft.world.World; - -public class DimentionalCoord extends WorldCoord -{ - private World w; - private int dimId; - - public DimentionalCoord( DimentionalCoord s ) - { - super( s.x, s.y, s.z ); - w = s.w; - dimId = s.dimId; - } - - public DimentionalCoord( World _w, int _x, int _y, int _z ) - { - super(_x, _y, _z); - w = _w; - dimId = _w.provider.dimensionId; - } - - @Override - public DimentionalCoord copy() - { - return new DimentionalCoord( this ); - } - - public boolean isEqual( DimentionalCoord c ) - { - return x == c.x && y == c.y && z == c.z && c.w == this.w; - } - - @Override - public boolean equals(Object obj) - { - if ( obj instanceof DimentionalCoord ) - return isEqual( (DimentionalCoord)obj ); - return false; - } - - @Override - public int hashCode() - { - return super.hashCode() ^ dimId; - } - - public boolean isInWorld(World world) - { - return w == world; - } - - public World getWorld() - { - return w; - } -} diff --git a/src/main/java/appeng/api/IAEItemStack.java b/src/main/java/appeng/api/IAEItemStack.java deleted file mode 100755 index 4b55ab5e..00000000 --- a/src/main/java/appeng/api/IAEItemStack.java +++ /dev/null @@ -1,175 +0,0 @@ -package appeng.api; - -import java.io.DataOutputStream; -import java.io.IOException; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -/** - * An alternate version of ItemStack for AE to keep tabs on things easier, and to support larger storage. - * stackSizes of getItemStack will be capped. - * - * You may hold on to these if you want, just make sure you let go of them when your not using them. - * - * Don't Implement. - * - * Construct with Util.createItemStack( ItemStack ) - * - */ -public interface IAEItemStack -{ - /** - * seriously? - * @return the item id of the requested item. - */ - public int getItemID(); - - /** - * the item's damage. - * @return - */ - public int getItemDamage(); - - /** - * obtain the NBT Data for the item. - * @return - */ - public IAETagCompound getTagCompound(); - - /** - * creates a standard MC ItemStack for the item. - * @return new itemstack - */ - public ItemStack getItemStack(); - - /** - * create a AE Item clone. - * @return the copy. - */ - public IAEItemStack copy(); - - /** - * number of items in the stack. - * @return basically ItemStack.stackSize - */ - public long getStackSize(); - - /** - * changes the number of items in the stack. - * @param basically, ItemStack.stackSize = N - */ - public void setStackSize( long stackSize ); - - /** - * Same as getStackSize, but for requestable items. ( LP ) - * @return basically itemStack.stackSize but for requestable items. - */ - long getCountRequestable(); - - /** - * Same as setStackSize, but for requestable items. ( LP ) - * @return basically itemStack.stackSize = N but for setStackSize items. - */ - void setCountRequestable(long countRequestable); - - /** - * true, if the item can be crafted. - * @return true, if it can be crafted. - */ - boolean isCraftable(); - - /** - * change weather the item can be crafted. - * @param isCraftable - */ - void setCraftable(boolean isCraftable); - - /** - * basically itemid and damage in one number.. - * @return - */ - int getDef(); - - /** - * clears, requsetable, craftable, and stack sizes. - */ - public void reset(); - - /** - * returns true, if the item can be crafted, requested, or extracted. - * @return isThisRecordMeaningful - */ - boolean isMeaninful(); - - /** - * is there NBT Data for this item? - * @return if there is. - */ - boolean hasTagCompound(); - - /** - * Combines two IAEItemStacks via addition. - * @param option, to add to the current one. - */ - void add(IAEItemStack option); - - /** - * Adds more to the stack size... - * @param i - */ - void incStackSize(long i); - - /** - * removes some from the stack size. - */ - void decStackSize(long i); - - /** - * adds items to the requestable - * @param i - */ - void incCountRequestable(long i); - - /** - * removes items from the requsetable - * @param i - */ - void decCountRequestable(long i); - - /** - * quick way to get access to the MC Item Definition. - * @return - */ - Item getItem(); - - /** - * write to a NBTTagCompound. - * @param i - */ - void writeToNBT(NBTTagCompound i); - - /** - * Compare a IAEItemStack to another AEItemStack or a ItemStack. - * @param obj - * @return true if they are the same. - */ - @Override - public boolean equals(Object obj); - - /** - * Compare the Ore Dictionary ID for this to another item. - * @param oreID - * @return - */ - public boolean sameOre( Object oreID ); - - /** - * Slower for disk saving, but smaller/more efficient for packets. - * @param data - * @throws IOException - */ - public void writeToPacket(DataOutputStream data) throws IOException; - -} diff --git a/src/main/java/appeng/api/IAppEngApi.java b/src/main/java/appeng/api/IAppEngApi.java old mode 100755 new mode 100644 index 14035c87..c9082cf8 --- a/src/main/java/appeng/api/IAppEngApi.java +++ b/src/main/java/appeng/api/IAppEngApi.java @@ -1,178 +1,71 @@ package appeng.api; -import appeng.api.me.items.IMemoryCard; -import appeng.api.me.items.ISpatialStorage; -import appeng.api.me.tiles.IColoredMETile; -import appeng.api.me.util.ICraftingPattern; -import appeng.api.me.util.ICraftingPatternMAC; -import appeng.api.me.util.IMEInventory; -import appeng.api.me.util.IMEInventoryUtil; -import appeng.api.movable.IMovableRegistry; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; +import appeng.api.definitions.Blocks; +import appeng.api.definitions.Items; +import appeng.api.definitions.Materials; +import appeng.api.definitions.Parts; +import appeng.api.exceptions.FailedConnection; +import appeng.api.features.IRegistryContainer; +import appeng.api.networking.IGridBlock; +import appeng.api.networking.IGridConnection; +import appeng.api.networking.IGridHost; +import appeng.api.networking.IGridNode; +import appeng.api.parts.IPartHelper; +import appeng.api.storage.IStorageHelper; -public interface IAppEngApi { +public interface IAppEngApi +{ /** - * Attempts to paint the block at the specified coords, the specified color, colors are based off of IColoredMETile.Colors - * @param world - * @param x - * @param y - * @param z - * @param color - * @return if the block was painted, or not you can use this to damage your item if you want. + * @return Registry Container for the numerous registries in AE2. */ - boolean paintBlock(World world, int x, int y, int z, int color); - - /** - * Use the movable registry to white list your tiles. - * @param c - */ - IMovableRegistry getMovableRegistry(); - - /** - * Add new Grid Caches for use during run time, only use during loading phase. - * @return - */ - IGridCacheRegistry getGridCacheRegistry(); - - /** - * Add additional storage bus handlers to improve interplay with mod blocks that contains special inventories that function unlike vanilla chests. - * AE uses this internally for barrels, dsu's, quantum chests, AE Networks and more. * - * @return IExternalStorageRegistry - */ - IExternalStorageRegistry getExternalStorageRegistry(); + IRegistryContainer registries(); /** - * Add additional special comparison functionality, AE Uses this internally for Bees. - * @return ISpecialComparisonRegistry + * @return helper for working with storage data types. */ - ISpecialComparisonRegistry getSpecialComparsonRegistry(); - + IStorageHelper storage(); + /** - * gives you access to extractItemsByRecipe, other then this theres not much use for this. - * @param mei + * @return helper for working with grids, and buses. + */ + IPartHelper partHelper(); + + /** + * @return an accessible list of all of AE's Items + */ + Items items(); + + /** + * @return an accessible list of all of AE's materials; materials are items + */ + Materials materials(); + + /** + * @return an accessible list of all of AE's blocks + */ + Blocks blocks(); + + /** + * @return an accessible list of all of AE's parts, parts are items + */ + Parts parts(); + + /** + * create a grid node for your {@link appeng.api.networking.IGridHost} + * + * @param block * @return */ - IMEInventoryUtil getIMEInventoryUtil(IMEInventory mei); + IGridNode createGridNode(IGridBlock block); /** - * Lets you register your items as wireless terminals - * @return + * create a connection between two {@link appeng.api.networking.IGridNode} + * + * @param a + * @param b + * @throws appeng.api.exceptions.FailedConnection */ - IWirelessTermRegistery getWirelessRegistry(); + IGridConnection createGridConnection(IGridNode a, IGridNode b) throws FailedConnection; - /** - * return an locateable object by its serial - * used internally by AE for QNBs / Network Controllers - * @param serial - * @return - */ - Object getLocateableBySerial(Long serial); - - /** - * creates a new instance of IAEItemStack from a MC ItemStack - * @param is - * @return - */ - IAEItemStack createItemStack(ItemStack is); - - /** - * Creates a new instance of IItemList - * @return - */ - IItemList createItemList(); - - /** - * Allows you to register new cell types, these will function in drives - * @return - */ - ICellRegistry getCellRegistry(); - - /** - * Manage grinder recipes via API - * @return - */ - IGrinderRecipeManager getGrinderRecipeManage(); - - /** - * get access to the locatable registry - * @return - */ - ILocateableRegistry getLocateableRegistry(); - - /** - * a simple wrapper around the AEItemStack version on IMEInventory - * @param inv - * @param is - * @return - */ - ItemStack addItemsToInv(IMEInventory inv, ItemStack is); - - /** - * a simple wrapper around the AEItemStack version on IMEInventory - * @param inv - * @param is - * @return - */ - ItemStack extractItems(IMEInventory inv, ItemStack is); - - /** - * Blacklist this item from vanilla AE Terminals / IStorageCell - * @param itemID - * @param meta - if you use OreDictionary.WILDCARD_VALUE it will blacklist the entire itemID. - */ - void addBasicBlackList(int itemID, int meta); - - /** - * Acquire the inventory for a IStorageCell - * @param i - * @return - */ - IMEInventory getBasicCell(ItemStack i); - - /** - * checks if the item is a basic storage cell. - * @param i - * @return - */ - Boolean isBasicCell(ItemStack i); - - /** - * gives you access to assembler pattern inventories. - * @param i - * @return - */ - ICraftingPatternMAC getAssemblerPattern(ItemStack i); - - /** - * allows you to check if an item is an assembler pattern. - * @param i - * @return - */ - Boolean isAssemblerPattern(ItemStack i); - - /** - * allows you to check if a pattern is blank. - * @param i - * @return - */ - Boolean isBlankPattern(ItemStack i); - - /** - * gives you the ability to interface with AE Memory Cards. - * @return - */ - IMemoryCard getMemoryCardHandler(); - - /** - * returns the ISpatialStorage for the ItemStack, if it can get from form its item ( or from AE ) - * @param is - * @return - */ - ISpatialStorage getSpatialStorageForItem( ItemStack is ); - -} +} \ No newline at end of file diff --git a/src/main/java/appeng/api/IAppEngGrinderRecipe.java b/src/main/java/appeng/api/IAppEngGrinderRecipe.java deleted file mode 100755 index b8a3f058..00000000 --- a/src/main/java/appeng/api/IAppEngGrinderRecipe.java +++ /dev/null @@ -1,45 +0,0 @@ -package appeng.api; - -import net.minecraft.item.ItemStack; - -/** - * Lets you manipulate existing recipes. - */ -public interface IAppEngGrinderRecipe { - - /** - * the current input - * @return input that the grinder will accept. - */ - public ItemStack getInput(); - - /** - * lets you change the grinder recipe by changing its input. - * @param input - */ - public void setInput( ItemStack input ); - - /** - * gets the current output - * @return output that the grinder will produce - */ - public ItemStack getOutput(); - - /** - * allows you to change the output. - * @param output - */ - public void setOutput( ItemStack output ); - - /** - * Energy cost, in turns. - * @return number of turns it takes to produce the output from the input. - */ - public int getEnergyCost(); - - /** - * Allows you to adjust the number of turns - * @param new number of turns to produce output. - */ - public void setEnergyCost(int c); -} diff --git a/src/main/java/appeng/api/ICellHandler.java b/src/main/java/appeng/api/ICellHandler.java deleted file mode 100755 index e0070b1e..00000000 --- a/src/main/java/appeng/api/ICellHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -package appeng.api; - -import net.minecraft.item.ItemStack; -import appeng.api.me.util.IMEInventoryHandler; - -/** - * Registratio record for a Custom Cell handler. - */ -public interface ICellHandler { - - /** - * return true if the provided item is handled by your cell handler. ( AE May choose to skip this method, and just request a handler ) - * @param is - * @return return true, if getCellHandler will not return null. - */ - boolean isCell( ItemStack is ); - - /** - * return a new IMEHandler for the provided item. - * @param is - * @return if you cannot handle the provided item, return null. - */ - IMEInventoryHandler getCellHandler( ItemStack is ); - -} diff --git a/src/main/java/appeng/api/ICellRegistry.java b/src/main/java/appeng/api/ICellRegistry.java deleted file mode 100755 index 2e609301..00000000 --- a/src/main/java/appeng/api/ICellRegistry.java +++ /dev/null @@ -1,31 +0,0 @@ -package appeng.api; - -import net.minecraft.item.ItemStack; -import appeng.api.me.util.IMEInventoryHandler; - -/** - * Storage Cell Registry, used for specially implemented cells, if you just want to make a item act like a cell, or new cell with diffrent bytes, then you should probobly consider IStorageCell instead its consideriablly simpler. - */ -public interface ICellRegistry { - - /** - * Register a new handler. - * @param h - */ - void addCellHandler( ICellHandler h ); - - /** - * returns true if the provided item, can be handled by a handler in AE, ( AE May choose to skip this and just get the handler instead. ) - * @param is - * @return returns true, if you can get a InventoryHandler for the item passed. - */ - boolean isCellHandled( ItemStack is ); - - /** - * returns an IMEInventoryHandler for the provided item. - * @param is - * @return new IMEInventoryHandler, or null if there isn't one. - */ - IMEInventoryHandler getHandlerForCell( ItemStack is ); - -} diff --git a/src/main/java/appeng/api/IExternalStorageHandler.java b/src/main/java/appeng/api/IExternalStorageHandler.java deleted file mode 100755 index be14dcc6..00000000 --- a/src/main/java/appeng/api/IExternalStorageHandler.java +++ /dev/null @@ -1,27 +0,0 @@ -package appeng.api; - -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; -import appeng.api.me.util.IMEInventory; - -/** - * A Registration for a special storage handler. - * - */ -public interface IExternalStorageHandler { - - /** - * if this can handle the provided inventory, return true. ( Generally skipped by AE, and it just calls getInventory ) - * @param te - * @return true, if it can get a handler via getInventory - */ - boolean canHandle( TileEntity te, ForgeDirection d ); - - /** - * if this can handle the given inventory, return the a IMEInventory implemnting class for it, if not return null - * @param te - * @return HandlerFor Inventory. - */ - IMEInventory getInventory( TileEntity te, ForgeDirection d ); - -} diff --git a/src/main/java/appeng/api/IExternalStorageRegistry.java b/src/main/java/appeng/api/IExternalStorageRegistry.java deleted file mode 100755 index 0f4c6352..00000000 --- a/src/main/java/appeng/api/IExternalStorageRegistry.java +++ /dev/null @@ -1,22 +0,0 @@ -package appeng.api; - -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; - -public interface IExternalStorageRegistry { - - /** - * A registry for StorageBus interactions - * @param ei - */ - void addExternalStorageInterface( IExternalStorageHandler ei ); - - /** - * returns the handler for a given tile / forge direction. - * @param te - * @param opposite - * @return - */ - IExternalStorageHandler getHandler(TileEntity te, ForgeDirection opposite); - -} diff --git a/src/main/java/appeng/api/IGridCacheRegistry.java b/src/main/java/appeng/api/IGridCacheRegistry.java deleted file mode 100755 index 44c50982..00000000 --- a/src/main/java/appeng/api/IGridCacheRegistry.java +++ /dev/null @@ -1,24 +0,0 @@ -package appeng.api; - -import appeng.api.me.util.IGridCache; - -/** - * A registry of grid caches to extend grid functionality. - */ -public interface IGridCacheRegistry { - - /** - * Register a new grid cache for use during operation, must be called during the loading phase. - * @param cl - * @return cache id ( can be used later to ask the grid for you cache. ) - */ - int registerGridCache( Class cl ); - - /** - * requests a new instance of a grid cache for use, used internally - * @param id - * @return - */ - IGridCache[] createCacheInstance(); - -} diff --git a/src/main/java/appeng/api/IItemComparisionProvider.java b/src/main/java/appeng/api/IItemComparisionProvider.java deleted file mode 100755 index b93194e0..00000000 --- a/src/main/java/appeng/api/IItemComparisionProvider.java +++ /dev/null @@ -1,25 +0,0 @@ -package appeng.api; - -import net.minecraft.item.ItemStack; - -/** - * Provider for special comparisons. - * when an item is encountered AE Will request if the comparison function handles the item, by trying to request a IItemComparison class. - */ -public interface IItemComparisionProvider { - - /** - * should return a new IItemComparison, or return null if it dosn't handle the supplied item. - * @param is - * @return IItemComparison, or null - */ - IItemComparison getComparison( ItemStack is ); - - /** - * Simple test for support ( AE generally skips this and calls the above function. ) - * @param stack - * @return true, if getComparison will return a valid IItemComparison Object. - */ - public boolean canHandle( ItemStack stack); - -} diff --git a/src/main/java/appeng/api/IItemComparison.java b/src/main/java/appeng/api/IItemComparison.java deleted file mode 100755 index 4bfc35f9..00000000 --- a/src/main/java/appeng/api/IItemComparison.java +++ /dev/null @@ -1,10 +0,0 @@ -package appeng.api; - - -public interface IItemComparison { - - public boolean sameAsPrecise( IItemComparison comp); - - public boolean sameAsFuzzy(IItemComparison comp); - -} diff --git a/src/main/java/appeng/api/IItemList.java b/src/main/java/appeng/api/IItemList.java deleted file mode 100755 index 9f722000..00000000 --- a/src/main/java/appeng/api/IItemList.java +++ /dev/null @@ -1,32 +0,0 @@ -package appeng.api; - -import java.util.Iterator; -import java.util.List; - -import net.minecraft.item.ItemStack; - -/** - * Represents a list of items in AE. - * - * Don't Implement. - * - * Construct with Util.createItemList() - * - */ -public interface IItemList extends Iterable -{ - public void addStorage( IAEItemStack option ); // adds a stack as stored. - public void addCrafting( IAEItemStack option ); // adds a stack as craftable. - public void addRequestable( IAEItemStack option ); // adds a stack as requestable. - public void add( IAEItemStack option ); // adds stack as is. - - IAEItemStack getFirstItem(); - - public List getItems(); - IAEItemStack findItem(IAEItemStack i); - int size(); - - @Override - public Iterator iterator(); - public void setCurrentPriority(int priority); -} diff --git a/src/main/java/appeng/api/ISpecialComparisonRegistry.java b/src/main/java/appeng/api/ISpecialComparisonRegistry.java deleted file mode 100755 index 0a30baec..00000000 --- a/src/main/java/appeng/api/ISpecialComparisonRegistry.java +++ /dev/null @@ -1,24 +0,0 @@ -package appeng.api; - -import net.minecraft.item.ItemStack; - -/** - * A Registry of any special comparison handlers for AE To use. - * - */ -public interface ISpecialComparisonRegistry { - - /** - * returns a handler it found for a specific item. - * @param stack - * @return TheHandler or null - */ - IItemComparison getSpecialComparion( ItemStack stack ); - - /** - * Register a new cpecial comparison function with AE. - * @param prov - */ - public void addComparisonProvider( IItemComparisionProvider prov ); - -} diff --git a/src/main/java/appeng/api/IWirelessTermHandler.java b/src/main/java/appeng/api/IWirelessTermHandler.java deleted file mode 100755 index c38c7ee0..00000000 --- a/src/main/java/appeng/api/IWirelessTermHandler.java +++ /dev/null @@ -1,49 +0,0 @@ -package appeng.api; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.network.Player; - -/** - * A handler for a wireless terminal. - */ -public interface IWirelessTermHandler { - - /** - * return true, if usePower, hasPower, ect... can be called for the provided item. - * @param is - * @return - */ - boolean canHandle( ItemStack is ); - - /** - * use an amount of power, in AE units - * @param amount is in AE units ( 5 per MJ ), if you return false, the item should be dead and return false for hasPower - * @param is - * @return - */ - boolean usePower( Player player, float amount, ItemStack is ); - - /** - * gets the power status of the item. - * @param is - * @return returns true if there is any power left. - */ - boolean hasPower( Player player, ItemStack is ); - - /** - * Used to get the current key from the item. - * @param player - * @param item - * @return - */ - String getEncryptionKey( ItemStack item ); - - /** - * Encode the wireless frequency via the Controller. - * @param item - the wireless terminal. - * @param encKey - the wireless encryption key. - * @param name - null for now. - */ - void setEncryptionKey( ItemStack item, String encKey, String name ); -} diff --git a/src/main/java/appeng/api/IWirelessTermRegistery.java b/src/main/java/appeng/api/IWirelessTermRegistery.java deleted file mode 100755 index b9b0a483..00000000 --- a/src/main/java/appeng/api/IWirelessTermRegistery.java +++ /dev/null @@ -1,38 +0,0 @@ -package appeng.api; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import appeng.api.me.util.IMEInventoryHandler; - -/** - * Registratio record for a Custom Cell handler. - */ -public interface IWirelessTermRegistery { - - /** - * add thsi handler to the list of other wireless handler. - * @param handler - */ - void registerWirelessHandler( IWirelessTermHandler handler ); - - /** - * returns true if theres a handler for this item. - * @param is - * @return - */ - boolean isWirelessTerminal( ItemStack is ); - - /** - * returns a register handler for the item in question, or null if there isn't one. - * @param is - * @return - */ - IWirelessTermHandler getWirelessTerminalHandler( ItemStack is ); - - /** - * opens the wireless terminal gui, the wireless terminal item, must be in the active slot on the tool bar. - */ - void OpenWirelessTermainlGui( ItemStack item, World w, EntityPlayer player ); - -} diff --git a/src/main/java/appeng/api/Items.java b/src/main/java/appeng/api/Items.java deleted file mode 100755 index f4627257..00000000 --- a/src/main/java/appeng/api/Items.java +++ /dev/null @@ -1,40 +0,0 @@ -package appeng.api; - -import net.minecraft.item.ItemStack; - -/** - * Items that have data, actions, or other interesting properties... - * DO NOT USE THESE WITHOUT COPYING THEM : ItemStack.copy() - is your friend. - */ -public class Items -{ - public static ItemStack toolQuartzAxe; - public static ItemStack toolQuartzHoe; - public static ItemStack toolQuartzShovel; - public static ItemStack toolQuartzPick; - public static ItemStack toolQuartzSword; - public static ItemStack toolQuartzWrench; - - public static ItemStack toolEntropyAccelerator; - public static ItemStack toolVibrationCatalyst; - public static ItemStack toolMassCannon; - - public static ItemStack toolQuartzKnife; - - public static ItemStack itemMemoryCard; - - public static ItemStack itemCell1k; - public static ItemStack itemCell4k; - public static ItemStack itemCell16k; - public static ItemStack itemCell64k; - - public static ItemStack itemSpatialCell2; - public static ItemStack itemSpatialCell16; - public static ItemStack itemSpatialCell128; - - public static ItemStack itemEncodedAsemblerPattern; - public static ItemStack toolWirelessTerminal; - - @Deprecated - public static ItemStack itemWirelessTerminal; -} diff --git a/src/main/java/appeng/api/Materials.java b/src/main/java/appeng/api/Materials.java deleted file mode 100755 index a1bd2387..00000000 --- a/src/main/java/appeng/api/Materials.java +++ /dev/null @@ -1,62 +0,0 @@ -package appeng.api; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -/** - * Access to stack-able simple items, these include resources... - * Craftable ingredients, and a few simple items that don't have log of their own... - * DO NOT USE THESE WITHOUT COPYING THEM : ItemStack.copy() - is your friend. - */ -public class Materials -{ - // Tech 1 - public static ItemStack matWoodenGear; - public static ItemStack matIronNugget; - public static ItemStack matCrank; - - // Grinder... - public static ItemStack matQuartzDustNether; - public static ItemStack matQuartzDust; - public static ItemStack matIronDust; - public static ItemStack matGoldDust; - public static ItemStack matFlour; - - // Tech 3 - public static ItemStack matSilicon; - public static ItemStack matProcessorBasicUncooked; - public static ItemStack matProcessorAdvancedUncooked; - public static ItemStack matProcessorBasic; - public static ItemStack matProcessorAdvanced; - - // ME Construction... - public static ItemStack matConversionMatrix; - public static ItemStack matStorageCell; - public static ItemStack matStorageBlock; - public static ItemStack matStorageCluster; - public static ItemStack matWireless; - public static ItemStack matStorageCellHouseing; - public static ItemStack matStorageCellHouseingFuzzy; - public static ItemStack matBlankPattern; - public static ItemStack matStorageSegment; - public static ItemStack matFluxDust; - public static ItemStack matFluxCrystal; - public static ItemStack matFluxPearl; - - public static ItemStack matSpatialStorageCell; - public static ItemStack matSpatialStorageBlock; - public static ItemStack matSpatialStorageCluster; - - // World gen... - public static ItemStack matQuartz; - - // Other items, such as upgrades. - public static ItemStack matWirelessBooster; - public static ItemStack matMatterBall; - public static ItemStack matSingularity; - public static ItemStack matEnderPearlDust; - public static ItemStack matQuantumEntangledSingularity; - - // TEST ITEMS! - public static ItemStack testItem; -} diff --git a/src/main/java/appeng/api/README.txt b/src/main/java/appeng/api/README.txt deleted file mode 100755 index bcd69c4e..00000000 --- a/src/main/java/appeng/api/README.txt +++ /dev/null @@ -1,46 +0,0 @@ -If your considering using the AE API, please take a moment to read though the following. - -Before we begin, - AE's API will change as new features are added to the mod, I try to keep - the changes to a minimum and try to prevent breaking changes, however it will - probably happen at some point, and it can't truly be avoided in some cases. - -The Grid - AE refers to the "ME Network" internally as "The Grid" you will see methods such - as getGrid(), setGrid() commonly, most interaction with networks, and creating new - network blocks will involve the grid. - -Network Enumeration - If your trying to add a new ME Network Block, you must at minimum implement - IGridTileEntity, and post the GridTileLoadEvent, and GridTileUnloadEvent when your - tile is added / removed respectfully, if you fail to do this correctly, your tile, - may ghost in the network, or cause invalid behaviour. You must inform AE that your - tiles is joining and exiting the Network, with these events or you will not get notified - of any network related features. - -Thread Safety - AE is not thread safe, do not attempt to use the API from other threads, this will - result in crashes, and CME exceptions - and will not end well. - -Blocks / Items / Materials - AE Exposes its Original Item stacks via the Blocks, Items, Materials classes for easy access, - don't change these, if you need to use an item make sure you .copy() it and use the copy, if - failing to do so can result in dupe bugs irregular crafting patterns, and other issues. - -AE and ItemStacks / Item Lists - AE's API commonly refers to IAEItemStacks, and IItemLists this are internally implemented - classes in AE, Do not Implement IAEItemstack, or IItemList, use the util methods to - construct new instances them. - -API Conflicts / Inclusion - Refrain from including portions of the API as class files in your mod, unless required - because your implementing an interface, even then its greatly appreciated if you put in - the effort to get around this. - - If you are not sure how to do this and plan on releasing your mod, I will be happy to explain - what steps you can take to improve compatibility, and prevent conflicts no one likes crashes, - and these cause crashes. - -I've been trying to improve the documentation included in the API java files however things can be -confusing or misleading, if you have questions after trying to figure something out I'm usually -available on IRC. \ No newline at end of file diff --git a/src/main/java/appeng/api/TileRef.java b/src/main/java/appeng/api/TileRef.java deleted file mode 100755 index d5429429..00000000 --- a/src/main/java/appeng/api/TileRef.java +++ /dev/null @@ -1,69 +0,0 @@ -package appeng.api; - -import net.minecraft.client.Minecraft; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import appeng.api.events.GridTileUnloadEvent; -import appeng.api.exceptions.AppEngTileMissingException; -import appeng.api.me.tiles.IGridTileEntity; - -public class TileRef extends WorldCoord { - - //private int dimension; - private World w; - private Class myType; - - boolean wasGrid; - - public TileRef( TileEntity gte ) { - super( gte.xCoord, gte.yCoord, gte.zCoord ); - TileEntity te = gte; - myType = gte.getClass(); - wasGrid = te instanceof IGridTileEntity; - w = te.worldObj; - if ( te.worldObj == null ) - throw new RuntimeException("Tile has no world."); - } - - @SuppressWarnings("unchecked") - public T getTile() throws AppEngTileMissingException - { - // there might be a possible tick where we have TileRefs for unloaded tiles? - if ( w.getChunkProvider().chunkExists(x >> 4, z >> 4) ) - { - TileEntity te = w.getBlockTileEntity( x, y, z ); - if ( te != null && myType.isInstance( te ) ) - return (T)te; - } - - /** - * was this a grid tile? if so inform the grid enum that something has derped. - */ - if ( wasGrid ) - { - wasGrid = false; // no need to keep this up.. - MinecraftForge.EVENT_BUS.post( new GridTileUnloadEvent( null, w, this ) ); - } - - throw new AppEngTileMissingException( w, x,y,z); - } - - public DimentionalCoord getCoord() { - return new DimentionalCoord( w, x, y, z ); - } - - @Override - public boolean equals(Object obj) { - - // is it the same? - if ( obj instanceof TileEntity ) - { - TileEntity te = (TileEntity) obj; - return w == te.worldObj && te.xCoord == x && te.yCoord == y && te.zCoord == z; - } - - return super.equals( obj ); - } - -}; diff --git a/src/main/java/appeng/api/Util.java b/src/main/java/appeng/api/Util.java deleted file mode 100755 index b228830f..00000000 --- a/src/main/java/appeng/api/Util.java +++ /dev/null @@ -1,231 +0,0 @@ -package appeng.api; - -import java.lang.reflect.InvocationTargetException; - -import cpw.mods.fml.relauncher.ReflectionHelper; -import net.minecraft.item.ItemStack; -import appeng.api.me.util.ICraftingPattern; -import appeng.api.me.util.ICraftingPatternMAC; -import appeng.api.me.util.IMEInventory; -import appeng.api.me.util.IMEInventoryHandler; -import appeng.api.me.util.IMEInventoryUtil; - -/** - * Returns useful stuff of various sorts to access internal features and stuff, the meat of the important stuff is accessed here... - * - * Available IMCs: - * "AppliedEnergistics", "add-grindable", "itemid,meta,itemid,meta,rotations" - AE uses the standard 8 for ores, 4 for ingots. - * "AppliedEnergistics", "blacklist-cell" "itemid[,meta]" - * "AppliedEnergistics", "blacklist-transitionplane" "itemid[,meta]" - * "AppliedEnergistics", "whitelist-transitionplane" "itemid[,meta]" - * - */ -public class Util -{ - static private IAppEngApi api = null; - - /** - * All future API calls should be made via this method. - * @return - */ - public static IAppEngApi getAppEngApi() - { - try { - Class c = ReflectionHelper.getClass( Util.class.getClassLoader(), "appeng.common.AppEngApi" ); - api = (IAppEngApi) c.getMethod( "getInstance" ).invoke( c ); - } catch ( Throwable e) { - return null; - } - return api; - } - - /** - * returns the wireless terminal registry. - * @return - */ - public static IWirelessTermRegistery getWirelessTermRegistery() - { - if ( api == null ) return null; - return api.getWirelessRegistry(); - } - - /** - * Find an object by its serial. - * @param ser - * @return LocatedObject or null - */ - public static Object getLocateableBySerial( long ser ) - { - if ( api == null ) return null; - return api.getLocateableBySerial( ser ); - } - - /** - * Creates a new AEItemstack. - * @param is - * @return newly generated AE Itemstack - */ - public static IAEItemStack createItemStack( ItemStack is ) - { - if ( api == null ) return null; - return api.createItemStack( is ); - } - - /** - * Simple Wrapper of the insertion process.. - * @param inv - * @param is - * @return ItemsNotInserted or null - */ - public static ItemStack addItemsToInv( IMEInventory inv, ItemStack is ) - { - if ( api == null ) return null; - return api.addItemsToInv( inv, is ); - } - - /** - * Simple Wrapper of the extraction process - * @param inv - * @param is - * @return ItemsExtracted or null - */ - public static ItemStack extractItemsFromInv( IMEInventory inv, ItemStack is ) - { - if ( api == null ) return null; - return api.extractItems( inv, is ); - } - - /** - * Create a new Blank ItemList - * @return new itemlist. - */ - public static IItemList createItemList() - { - if ( api == null ) return null; - return api.createItemList(); - } - - /** - * creates a new IMEInventoryUtil, only useful if you want to use the fancy get items by recipe functionaility. - * @param ime - * @return created InvUtil - */ - public static IMEInventoryUtil getIMEInventoryUtil( IMEInventory ime ) - { - if ( api == null ) return null; - return api.getIMEInventoryUtil( ime ); - } - - /** - * Gets the instance of the special comparison registry ( Bees / Trees ) that sort of stuff - * @return specialComparisonRegistry - */ - public static ISpecialComparisonRegistry getSpecialComparisonRegistry() - { - if ( api == null ) return null; - return api.getSpecialComparsonRegistry(); - } - - /** - * Gets the instance of the external storage registry - Storage Bus - * @return externStorgeRegitry - */ - public static IExternalStorageRegistry getExternalStorageRegistry() - { - if ( api == null ) return null; - return api.getExternalStorageRegistry(); - } - - /** - * Gets the instance of the Cell Registry - * @return returns the cell registry - */ - public static ICellRegistry getCellRegistry() - { - if ( api == null ) return null; - return api.getCellRegistry(); - } - - /** - * Gets instance for the grinder recipe manager. - * @return the grinder manager instance. - */ - public static IGrinderRecipeManager getGrinderRecipeManage() - { - if ( api == null ) return null; - return api.getGrinderRecipeManage(); - } - - /** Is it a Blank Pattern? */ - public static Boolean isBlankPattern(ItemStack i) - { - if ( api == null ) return null; - return api.isBlankPattern( i ); - } - - /** Is it an IAssemblerPattern? */ - public static Boolean isAssemblerPattern(ItemStack i) - { - if ( api == null ) return null; - return api.isAssemblerPattern( i ); - } - - /** Gets the IAssemblerPattern of the Assembly Pattern. */ - public static ICraftingPatternMAC getAssemblerPattern(ItemStack i) - { - if ( api == null ) return null; - return api.getAssemblerPattern( i ); - } - - /** Is it a IStorageCell, this will only return true for IStoreCells and not custom cells, you should probobly not use it unless you have a specific case. */ - public static Boolean isBasicCell(ItemStack i) - { - if ( api == null ) return null; - return api.isBasicCell( i ); - } - - /** - * if the item is a ME Compatible Storage Cell of any type. - * @param i - * @return true, if it is a storage call. - */ - public static Boolean isCell(ItemStack i) - { - if ( api == null ) return null; - return getCellRegistry().isCellHandled( i ); - } - - /** - * Gets the Interface to insert/extract from the Storage Cell for the item. - * @param i - * @return newly procured cell handler. - */ - public static IMEInventoryHandler getCell(ItemStack i) - { - if ( api == null ) return null; - return getCellRegistry().getHandlerForCell( i ); - } - - /** - * Lets you access internal storage of IStorageCell's - * @param i - * @return only works with Basic Cells, not custom ones, suggested not to use. - */ - public static IMEInventory getBasicCell(ItemStack i) - { - if ( api == null ) return null; - return api.getBasicCell( i ); - } - - /** - * Lets you blast list a specific item from being stored in basic cells, this works on any mod cells that use IStorageCell as well. - * @param ItemID - * @param Meta - */ - public static void addBasicBlackList( int ItemID, int Meta ) - { - if ( api == null ) return; - api.addBasicBlackList( ItemID, Meta ); - } - -} diff --git a/src/main/java/appeng/api/WorldCoord.java b/src/main/java/appeng/api/WorldCoord.java deleted file mode 100755 index 4e525647..00000000 --- a/src/main/java/appeng/api/WorldCoord.java +++ /dev/null @@ -1,132 +0,0 @@ -package appeng.api; - -import net.minecraftforge.common.ForgeDirection; - -/** - * This is used internally to return a location, in a few places, just use as is... - */ -public class WorldCoord -{ - public int x; - public int y; - public int z; - - public WorldCoord add(ForgeDirection direction, int length) - { - x += direction.offsetX * length; - y += direction.offsetY * length; - z += direction.offsetZ * length; - return this; - } - - public WorldCoord subtract(ForgeDirection direction, int length) - { - x -= direction.offsetX * length; - y -= direction.offsetY * length; - z -= direction.offsetZ * length; - return this; - } - - public WorldCoord add(int _x, int _y, int _z) - { - x += _x; - y += _y; - z += _z; - return this; - } - - public WorldCoord subtract(int _x, int _y, int _z) - { - x -= _x; - y -= _y; - z -= _z; - return this; - } - - public WorldCoord multiple(int _x, int _y, int _z) - { - x *= _x; - y *= _y; - z *= _z; - return this; - } - - public WorldCoord divide(int _x, int _y, int _z) - { - x /= _x; - y /= _y; - z /= _z; - return this; - } - - public WorldCoord(int _x, int _y, int _z) - { - x = _x; - y = _y; - z = _z; - } - - /** - * Will Return NULL if it's at some diagonal! - */ - public ForgeDirection DirectionTo(WorldCoord loc) - { - int ox = x - loc.x; - int oy = y - loc.y; - int oz = z - loc.z; - - int xlen = Math.abs( ox ); - int ylen = Math.abs( oy ); - int zlen = Math.abs( oz ); - - if ( loc.isEqual( this.copy().add( ForgeDirection.EAST, xlen ) ) ) - return ForgeDirection.EAST; - - if ( loc.isEqual( this.copy().add( ForgeDirection.WEST, xlen ) ) ) - return ForgeDirection.WEST; - - if ( loc.isEqual( this.copy().add( ForgeDirection.NORTH, zlen ) ) ) - return ForgeDirection.NORTH; - - if ( loc.isEqual( this.copy().add( ForgeDirection.SOUTH, zlen ) ) ) - return ForgeDirection.SOUTH; - - if ( loc.isEqual( this.copy().add( ForgeDirection.UP, ylen ) ) ) - return ForgeDirection.UP; - - if ( loc.isEqual( this.copy().add( ForgeDirection.DOWN, ylen ) ) ) - return ForgeDirection.DOWN; - - return null; - } - - public boolean isEqual( WorldCoord c ) - { - return x == c.x && y == c.y && z == c.z; - } - - public WorldCoord copy() - { - return new WorldCoord( x, y, z ); - } - - @Override - public boolean equals(Object obj) - { - if ( obj instanceof WorldCoord ) - return isEqual( (WorldCoord)obj ); - return false; - } - - @Override - public String toString() - { - return "" + x + "," + y + "," + z; - } - - @Override - public int hashCode() - { - return (y << 24) ^ x ^ z; - } -} diff --git a/src/main/java/appeng/api/config/AccessRestriction.java b/src/main/java/appeng/api/config/AccessRestriction.java new file mode 100644 index 00000000..56fac0f9 --- /dev/null +++ b/src/main/java/appeng/api/config/AccessRestriction.java @@ -0,0 +1,48 @@ +package appeng.api.config; + +public enum AccessRestriction +{ + NO_ACCESS(0), READ(1), WRITE(2), READ_WRITE(3); + + private final int permisionBit; + + private AccessRestriction(int v) { + permisionBit = v; + } + + public boolean hasPermission(AccessRestriction ar) + { + return (permisionBit & ar.permisionBit) == ar.permisionBit; + } + + public AccessRestriction restrictPermissions(AccessRestriction ar) + { + return getPermByBit( permisionBit & ar.permisionBit ); + } + + public AccessRestriction addPermissions(AccessRestriction ar) + { + return getPermByBit( permisionBit | ar.permisionBit ); + } + + public AccessRestriction removePermissions(AccessRestriction ar) + { + return getPermByBit( permisionBit & (~ar.permisionBit) ); + } + + private AccessRestriction getPermByBit(int bit) + { + switch (bit) + { + default: + case 0: + return NO_ACCESS; + case 1: + return READ; + case 2: + return WRITE; + case 3: + return READ_WRITE; + } + } +} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/ActionItems.java b/src/main/java/appeng/api/config/ActionItems.java old mode 100755 new mode 100644 index ff4559de..58fb989f --- a/src/main/java/appeng/api/config/ActionItems.java +++ b/src/main/java/appeng/api/config/ActionItems.java @@ -1,17 +1,6 @@ package appeng.api.config; - -public enum ActionItems implements IConfigEnum { - Wrench, - Close; - - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "FuzzyMode"; - } +public enum ActionItems +{ + WRENCH, CLOSE } \ No newline at end of file diff --git a/src/main/java/appeng/api/config/Actionable.java b/src/main/java/appeng/api/config/Actionable.java new file mode 100644 index 00000000..ce798f62 --- /dev/null +++ b/src/main/java/appeng/api/config/Actionable.java @@ -0,0 +1,14 @@ +package appeng.api.config; + +public enum Actionable +{ + /** + * Perform the intended action. + */ + MODULATE, + + /** + * Pretend to perform the action. + */ + SIMULATE +} diff --git a/src/main/java/appeng/api/config/CondenserOuput.java b/src/main/java/appeng/api/config/CondenserOuput.java old mode 100755 new mode 100644 index 2c187dae..db84fc27 --- a/src/main/java/appeng/api/config/CondenserOuput.java +++ b/src/main/java/appeng/api/config/CondenserOuput.java @@ -1,19 +1,15 @@ package appeng.api.config; -public enum CondenserOuput implements IConfigEnum { - Trash, - MatterBalls, - Singularity; - - @Override - public IConfigEnum[] getValues() { - return values(); - } +public enum CondenserOuput +{ + + TRASH, // 0 + + MATTER_BALLS, // 256 + + SINGULARITY; // 250,000 + + public int requiredPower = 0; - @Override - public String getName() { - return "CondenserOutput"; - } - } \ No newline at end of file diff --git a/src/main/java/appeng/api/config/EnableDisable.java b/src/main/java/appeng/api/config/EnableDisable.java deleted file mode 100755 index 20c195bb..00000000 --- a/src/main/java/appeng/api/config/EnableDisable.java +++ /dev/null @@ -1,18 +0,0 @@ -package appeng.api.config; - - -public enum EnableDisable implements IConfigEnum { - Enabled, - Disabled; - - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "CondenserOutput"; - } - -} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/FullnessMode.java b/src/main/java/appeng/api/config/FullnessMode.java old mode 100755 new mode 100644 index a3f79f4b..43b22bc4 --- a/src/main/java/appeng/api/config/FullnessMode.java +++ b/src/main/java/appeng/api/config/FullnessMode.java @@ -1,19 +1,6 @@ package appeng.api.config; - -// do not change names.. -public enum FullnessMode implements IConfigEnum { - Empty, - Half, - Full; - - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "FullnessMode"; - } +public enum FullnessMode +{ + EMPTY, HALF, FULL } \ No newline at end of file diff --git a/src/main/java/appeng/api/config/FuzzyMode.java b/src/main/java/appeng/api/config/FuzzyMode.java old mode 100755 new mode 100644 index 40d57127..daa79ceb --- a/src/main/java/appeng/api/config/FuzzyMode.java +++ b/src/main/java/appeng/api/config/FuzzyMode.java @@ -1,27 +1,21 @@ package appeng.api.config; +public enum FuzzyMode +{ + // Note that percentage damaged, is the inverse of percentage durability. + IGNORE_ALL(-1), PERCENT_99(0), PERCENT_75(25), PERCENT_50(50), PERCENT_25(75); -public enum FuzzyMode implements IConfigEnum { - IgnoreAll(-1.0F), - Percent_99(1.0F), - Percent_75(0.75F), - Percent_50(0.5F), - Percent_25(0.25F); - - public float breakPoint; - - private FuzzyMode( float p ) + final public float breakPoint; + final public int percentage; + + private FuzzyMode(int p) { + percentage = p; + breakPoint = calculateBreakPoint( 1 ); + } + + public int calculateBreakPoint(int maxDamage) { - breakPoint = p; + return (percentage * maxDamage) / 100; } - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "FuzzyMode"; - } } \ No newline at end of file diff --git a/src/main/java/appeng/api/config/IConfigEnum.java b/src/main/java/appeng/api/config/IConfigEnum.java deleted file mode 100755 index 18bafec7..00000000 --- a/src/main/java/appeng/api/config/IConfigEnum.java +++ /dev/null @@ -1,11 +0,0 @@ -package appeng.api.config; - -public interface IConfigEnum { - - IConfigEnum[] getValues(); - - int ordinal(); - - String getName(); - -} diff --git a/src/main/java/appeng/api/config/IncludeExclude.java b/src/main/java/appeng/api/config/IncludeExclude.java new file mode 100644 index 00000000..3e74db9a --- /dev/null +++ b/src/main/java/appeng/api/config/IncludeExclude.java @@ -0,0 +1,6 @@ +package appeng.api.config; + +public enum IncludeExclude +{ + WHITELIST, BLACKLIST +} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/InterfaceBlockingMode.java b/src/main/java/appeng/api/config/InterfaceBlockingMode.java deleted file mode 100755 index 08978d20..00000000 --- a/src/main/java/appeng/api/config/InterfaceBlockingMode.java +++ /dev/null @@ -1,17 +0,0 @@ -package appeng.api.config; - -public enum InterfaceBlockingMode implements IConfigEnum { - NonBlocking, - Blocking; - - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "InterfaceBlockingMode"; - } - -} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/InterfaceCraftingMode.java b/src/main/java/appeng/api/config/InterfaceCraftingMode.java deleted file mode 100755 index ce783b42..00000000 --- a/src/main/java/appeng/api/config/InterfaceCraftingMode.java +++ /dev/null @@ -1,17 +0,0 @@ -package appeng.api.config; - -public enum InterfaceCraftingMode implements IConfigEnum { - Craft, - DontCraft; - - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "InterfaceCraftingMode"; - } - -} diff --git a/src/main/java/appeng/api/config/ItemFlow.java b/src/main/java/appeng/api/config/ItemFlow.java deleted file mode 100755 index b7d60cd6..00000000 --- a/src/main/java/appeng/api/config/ItemFlow.java +++ /dev/null @@ -1,18 +0,0 @@ -package appeng.api.config; - - -public enum ItemFlow implements IConfigEnum { - - READ, WRITE, READ_WRITE; - - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "ItemFlow"; - } - -} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/LevelEmitterMode.java b/src/main/java/appeng/api/config/LevelEmitterMode.java new file mode 100644 index 00000000..4fafbf96 --- /dev/null +++ b/src/main/java/appeng/api/config/LevelEmitterMode.java @@ -0,0 +1,10 @@ +package appeng.api.config; + +public enum LevelEmitterMode +{ + + STORED_AMOUNT, + + STOREABLE_AMOUNT + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/LevelType.java b/src/main/java/appeng/api/config/LevelType.java new file mode 100644 index 00000000..58d1a6b1 --- /dev/null +++ b/src/main/java/appeng/api/config/LevelType.java @@ -0,0 +1,10 @@ +package appeng.api.config; + +public enum LevelType +{ + + ITEM_LEVEL, + + ENERGY_LEVEL + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/ListMode.java b/src/main/java/appeng/api/config/ListMode.java deleted file mode 100755 index 71bf9377..00000000 --- a/src/main/java/appeng/api/config/ListMode.java +++ /dev/null @@ -1,18 +0,0 @@ -package appeng.api.config; - - -public enum ListMode implements IConfigEnum { - - WHITELIST, BLACKLIST; - - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "ListMode"; - } - -} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/MatchingMode.java b/src/main/java/appeng/api/config/MatchingMode.java deleted file mode 100755 index 8ce433a8..00000000 --- a/src/main/java/appeng/api/config/MatchingMode.java +++ /dev/null @@ -1,17 +0,0 @@ -package appeng.api.config; - - -public enum MatchingMode implements IConfigEnum { - Fuzzy, - Precision; - - @Override - public IConfigEnum[] getValues() { - return MatchingMode.values(); - } - - @Override - public String getName() { - return "MatchingMode"; - } -} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/ModSettings.java b/src/main/java/appeng/api/config/ModSettings.java new file mode 100644 index 00000000..9b578dc0 --- /dev/null +++ b/src/main/java/appeng/api/config/ModSettings.java @@ -0,0 +1,6 @@ +package appeng.api.config; + +public enum ModSettings +{ + +} diff --git a/src/main/java/appeng/api/config/NetworkEmitterMode.java b/src/main/java/appeng/api/config/NetworkEmitterMode.java new file mode 100644 index 00000000..19ae7023 --- /dev/null +++ b/src/main/java/appeng/api/config/NetworkEmitterMode.java @@ -0,0 +1,12 @@ +package appeng.api.config; + +public enum NetworkEmitterMode +{ + + POWER_LEVEL, + + BOOTING, + + CHANNEL_ERROR + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/OperationMode.java b/src/main/java/appeng/api/config/OperationMode.java old mode 100755 new mode 100644 index 6a3f94e1..f6d80ea5 --- a/src/main/java/appeng/api/config/OperationMode.java +++ b/src/main/java/appeng/api/config/OperationMode.java @@ -1,18 +1,6 @@ package appeng.api.config; - -// do not change names.. -public enum OperationMode implements IConfigEnum { - Fill, - Empty; - - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "OperationMode"; - } +public enum OperationMode +{ + FILL, EMPTY } \ No newline at end of file diff --git a/src/main/java/appeng/api/config/OutputMode.java b/src/main/java/appeng/api/config/OutputMode.java new file mode 100644 index 00000000..ebb8cda8 --- /dev/null +++ b/src/main/java/appeng/api/config/OutputMode.java @@ -0,0 +1,6 @@ +package appeng.api.config; + +public enum OutputMode +{ + EXPORT_ONLY, EXPORT_OR_CRAFT, CRAFT_ONLY +} diff --git a/src/main/java/appeng/api/config/PowerMultiplier.java b/src/main/java/appeng/api/config/PowerMultiplier.java new file mode 100644 index 00000000..d1a6800c --- /dev/null +++ b/src/main/java/appeng/api/config/PowerMultiplier.java @@ -0,0 +1,21 @@ +package appeng.api.config; + +public enum PowerMultiplier +{ + ONE, CONFIG; + + /** + * please do not edit this value, it is set when AE loads its config files. + */ + public double multiplier = 1.0; + + public double multiply(double in) + { + return in * multiplier; + } + + public double divide(double in) + { + return in / multiplier; + } +} diff --git a/src/main/java/appeng/api/config/PowerUnits.java b/src/main/java/appeng/api/config/PowerUnits.java old mode 100755 new mode 100644 index e227f42b..46dbefac --- a/src/main/java/appeng/api/config/PowerUnits.java +++ b/src/main/java/appeng/api/config/PowerUnits.java @@ -1,20 +1,42 @@ package appeng.api.config; +public enum PowerUnits +{ + AE("gui.appliedenergistics2.units.appliedenergstics"), // Native Units - AE Energy + MJ("gui.appliedenergistics2.units.buildcraft"), // BuildCraft - Minecraft Joules + EU("gui.appliedenergistics2.units.ic2"), // IndustrialCraft 2 - Energy Units + KJ("gui.appliedenergistics2.units.universalelectricity"), // Universal Electricity - KiloJoules + WA("gui.appliedenergistics2.units.rotarycraft"), // RotaryCraft - Watts + RF("gui.appliedenergistics2.units.thermalexpansion"); // ThermalExpansion - Redstone Flux -public enum PowerUnits implements IConfigEnum { - AE, - MJ, - EU, - UE, - WA; - - @Override - public IConfigEnum[] getValues() { - return values(); + private PowerUnits(String un) { + unlocalizedName = un; } - @Override - public String getName() { - return "PowerUnits"; + /** + * please do not edit this value, it is set when AE loads its config files. + */ + public double conversionRatio = 1.0; + + /** + * unlocalized name for the power unit. + */ + final public String unlocalizedName; + + /** + * do power conversion using AE's conversion rates. + * + * Example: PowerUnits.EU.convertTo( PowerUnits.AE, 32 ); + * + * will normally returns 64, as it will convert the EU, to AE with AE's power settings. + * + * @param target + * @param value + * @return value converted to target units, from this units. + */ + public double convertTo(PowerUnits target, double value) + { + return (value * conversionRatio) / target.conversionRatio; } + } \ No newline at end of file diff --git a/src/main/java/appeng/api/config/RedstoneMode.java b/src/main/java/appeng/api/config/RedstoneMode.java new file mode 100644 index 00000000..91be1156 --- /dev/null +++ b/src/main/java/appeng/api/config/RedstoneMode.java @@ -0,0 +1,6 @@ +package appeng.api.config; + +public enum RedstoneMode +{ + IGNORE, LOW_SIGNAL, HIGH_SIGNAL, SIGNAL_PULSE +} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/RedstoneModeInput.java b/src/main/java/appeng/api/config/RedstoneModeInput.java deleted file mode 100755 index edbc51f9..00000000 --- a/src/main/java/appeng/api/config/RedstoneModeInput.java +++ /dev/null @@ -1,20 +0,0 @@ -package appeng.api.config; - - -// do not change names.. -public enum RedstoneModeInput implements IConfigEnum { - Ignore, - WhenOff, - WhenOn, - OnPulse; - - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "RedstoneMode"; - } -} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/RedstoneModeInputOnOff.java b/src/main/java/appeng/api/config/RedstoneModeInputOnOff.java deleted file mode 100755 index e01cad66..00000000 --- a/src/main/java/appeng/api/config/RedstoneModeInputOnOff.java +++ /dev/null @@ -1,19 +0,0 @@ -package appeng.api.config; - - -// do not change names.. -public enum RedstoneModeInputOnOff implements IConfigEnum { - Ignore, - WhenOff, - WhenOn; - - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "RedstoneMode"; - } -} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/RedstoneModeOutput.java b/src/main/java/appeng/api/config/RedstoneModeOutput.java deleted file mode 100755 index b94b116f..00000000 --- a/src/main/java/appeng/api/config/RedstoneModeOutput.java +++ /dev/null @@ -1,18 +0,0 @@ -package appeng.api.config; - - -// do not change names.. -public enum RedstoneModeOutput implements IConfigEnum { - WhenOff, - WhenOn; - - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "RedstoneMode"; - } -} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/RelativeDirection.java b/src/main/java/appeng/api/config/RelativeDirection.java new file mode 100644 index 00000000..6b02c3de --- /dev/null +++ b/src/main/java/appeng/api/config/RelativeDirection.java @@ -0,0 +1,6 @@ +package appeng.api.config; + +public enum RelativeDirection +{ + LEFT, RIGHT, UP, DOW +} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/SearchBoxMode.java b/src/main/java/appeng/api/config/SearchBoxMode.java old mode 100755 new mode 100644 index 5fd545e9..64fc28f6 --- a/src/main/java/appeng/api/config/SearchBoxMode.java +++ b/src/main/java/appeng/api/config/SearchBoxMode.java @@ -1,23 +1,6 @@ package appeng.api.config; -import cpw.mods.fml.common.Loader; - - -public enum SearchBoxMode implements IConfigEnum { - Autosearch, - Standard, - NEIAutoSearch, - NEIStandard; - - @Override - public IConfigEnum[] getValues() { - if ( Loader.isModLoaded( "NotEnoughItems" ) ) - return values(); - return new SearchBoxMode[]{ Autosearch, Standard }; - } - - @Override - public String getName() { - return "SearchBoxMode"; - } -} \ No newline at end of file +public enum SearchBoxMode +{ + AUTOSEARCH, MANUAL_SEARCH, NEI_AUTOSEARCH, NEI_MANUAL_SEARCH +} diff --git a/src/main/java/appeng/api/config/SecurityPermissions.java b/src/main/java/appeng/api/config/SecurityPermissions.java new file mode 100644 index 00000000..85d35740 --- /dev/null +++ b/src/main/java/appeng/api/config/SecurityPermissions.java @@ -0,0 +1,47 @@ +package appeng.api.config; + +/** + * Represent the security systems basic permissions, these are not for anti-griefing, they are part of the mod as a + * gameplay feature. + */ +public enum SecurityPermissions +{ + /** + * required to insert items into the network via terminal ( also used for machines based on the owner of the + * network, which is determined by its Security Block. ) + */ + INJECT, + + /** + * required to extract items from the network via terminal ( also used for machines based on the owner of the + * network, which is determined by its Security Block. ) + */ + EXTRACT, + + /** + * required to request crafting from the network via terminal. + */ + CRAFT, + + /** + * required to modify automation, and make modifications to the networks physical layout. + */ + BUILD, + + /** + * required to modify the security blocks settings. + */ + SECURITY; + + final private String unlocalizedName = "gui.appliedenergistics2.security." + name().toLowerCase(); + + public String getUnlocalizedName() + { + return unlocalizedName + ".name"; + } + + public String getUnlocalizedTip() + { + return unlocalizedName + ".tip"; + } +} diff --git a/src/main/java/appeng/api/config/Settings.java b/src/main/java/appeng/api/config/Settings.java new file mode 100644 index 00000000..a101ab1d --- /dev/null +++ b/src/main/java/appeng/api/config/Settings.java @@ -0,0 +1,44 @@ +package appeng.api.config; + +import java.util.EnumSet; + +public enum Settings +{ + LEVEL_EMITTER_MODE(EnumSet.allOf( LevelEmitterMode.class )), + + NETWORK_EMITTER_MODE(EnumSet.allOf( NetworkEmitterMode.class )), + + REDSTONE_EMITTER(EnumSet.of( RedstoneMode.HIGH_SIGNAL, RedstoneMode.LOW_SIGNAL )), REDSTONE_CONTROLLED(EnumSet.allOf( RedstoneMode.class )), + + CONDENSER_OUTPUT(EnumSet.allOf( CondenserOuput.class )), + + POWER_UNITS(EnumSet.allOf( PowerUnits.class )), ACCESS(EnumSet.of( AccessRestriction.READ_WRITE, AccessRestriction.READ, AccessRestriction.WRITE )), + + SORT_DIRECTION(EnumSet.allOf( SortDir.class )), SORT_BY(EnumSet.allOf( SortOrder.class )), + + SEARCH_TOOLTIPS(EnumSet.of( YesNo.YES, YesNo.NO )), VIEW_MODE(EnumSet.allOf( ViewItems.class )), SEARCH_MODE(EnumSet.allOf( SearchBoxMode.class )), + + ACTIONS(EnumSet.allOf( ActionItems.class )), IO_DIRECTION(EnumSet.of( RelativeDirection.LEFT, RelativeDirection.RIGHT )), + + INCLUSION(EnumSet.allOf( IncludeExclude.class )), CRAFT(EnumSet.of( YesNo.YES, YesNo.NO )), BLOCK(EnumSet.of( YesNo.YES, YesNo.NO )), + + OPERATION_MODE(EnumSet.allOf( OperationMode.class )), FULLNESS_MODE(EnumSet.allOf( FullnessMode.class )), + + TRASH_CATCH(EnumSet.of( YesNo.YES, YesNo.NO )), FUZZY_MODE(EnumSet.allOf( FuzzyMode.class )), + + LEVEL_TYPE(EnumSet.allOf( LevelType.class )); + + private EnumSet values; + + public EnumSet getPossibleValues() + { + return values; + } + + private Settings(EnumSet set) { + if ( set == null || set.isEmpty() ) + throw new RuntimeException( "Invalid configuration." ); + values = set; + } + +} diff --git a/src/main/java/appeng/api/config/SortDir.java b/src/main/java/appeng/api/config/SortDir.java old mode 100755 new mode 100644 index d09904e5..305ebfb4 --- a/src/main/java/appeng/api/config/SortDir.java +++ b/src/main/java/appeng/api/config/SortDir.java @@ -1,18 +1,6 @@ package appeng.api.config; - -public enum SortDir implements IConfigEnum +public enum SortDir { - ASC, - DESC; - - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "SortDir"; - } + ASCENDING, DESCENDING; } \ No newline at end of file diff --git a/src/main/java/appeng/api/config/SortOrder.java b/src/main/java/appeng/api/config/SortOrder.java old mode 100755 new mode 100644 index fc18c4a4..da005857 --- a/src/main/java/appeng/api/config/SortOrder.java +++ b/src/main/java/appeng/api/config/SortOrder.java @@ -1,20 +1,6 @@ package appeng.api.config; - -public enum SortOrder implements IConfigEnum +public enum SortOrder { - Name, - Size, - Priority, - ItemID; - - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "SortOrder"; - } + NAME, AMOUNT, INVTWEAKS } \ No newline at end of file diff --git a/src/main/java/appeng/api/config/StackModeInput.java b/src/main/java/appeng/api/config/StackModeInput.java deleted file mode 100755 index d99dda19..00000000 --- a/src/main/java/appeng/api/config/StackModeInput.java +++ /dev/null @@ -1,18 +0,0 @@ -package appeng.api.config; - - -// do not change names.. -public enum StackModeInput implements IConfigEnum { - Single, - Stack; - - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "StackMode"; - } -} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/StackModeOutput.java b/src/main/java/appeng/api/config/StackModeOutput.java deleted file mode 100755 index 546b283a..00000000 --- a/src/main/java/appeng/api/config/StackModeOutput.java +++ /dev/null @@ -1,20 +0,0 @@ -package appeng.api.config; - - -// do not change names.. -public enum StackModeOutput implements IConfigEnum { - Single, - Stack, - Craft, - CraftOnly; - - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "StackMode"; - } -} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/TransferDir.java b/src/main/java/appeng/api/config/TransferDir.java deleted file mode 100755 index ed8cd4e1..00000000 --- a/src/main/java/appeng/api/config/TransferDir.java +++ /dev/null @@ -1,18 +0,0 @@ -package appeng.api.config; - - -public enum TransferDir implements IConfigEnum -{ - LEFT, - RIGHT; - - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "TransferDir"; - } -} \ No newline at end of file diff --git a/src/main/java/appeng/api/config/TunnelType.java b/src/main/java/appeng/api/config/TunnelType.java new file mode 100644 index 00000000..ac79c74e --- /dev/null +++ b/src/main/java/appeng/api/config/TunnelType.java @@ -0,0 +1,11 @@ +package appeng.api.config; + +public enum TunnelType +{ + ME, // Network Tunnel + BC_POWER, // MJ Tunnel + IC2_POWER, // EU Tunnel + REDSTONE, // Redstone Tunnel + FLUID, // Fluid Tunnel + ITEM // Item Tunnel +} diff --git a/src/main/java/appeng/api/config/Upgrades.java b/src/main/java/appeng/api/config/Upgrades.java new file mode 100644 index 00000000..fd73e964 --- /dev/null +++ b/src/main/java/appeng/api/config/Upgrades.java @@ -0,0 +1,39 @@ +package appeng.api.config; + +import java.util.HashMap; + +import net.minecraft.item.ItemStack; + +public enum Upgrades +{ + /** + * Gold Tier Upgrades. + */ + CAPACITY(0), REDSTONE(0), + + /** + * Diamond Tier Upgrades. + */ + FUZZY(1), SPEED(1), INVERTER(1); + + public final int myTier; + public final HashMap supportedMax = new HashMap(); + + private Upgrades(int tier) { + myTier = tier; + } + + /** + * @return list of Items/Blocks that support this upgrade, and how many it supports. + */ + public HashMap getSupported() + { + return supportedMax; + } + + public void registerItem(ItemStack myItem, int maxSupported) + { + if ( myItem != null ) + supportedMax.put( myItem, maxSupported ); + } +} diff --git a/src/main/java/appeng/api/config/ViewItems.java b/src/main/java/appeng/api/config/ViewItems.java old mode 100755 new mode 100644 index ec5c2d0f..ffb2e203 --- a/src/main/java/appeng/api/config/ViewItems.java +++ b/src/main/java/appeng/api/config/ViewItems.java @@ -1,19 +1,6 @@ package appeng.api.config; - -public enum ViewItems implements IConfigEnum +public enum ViewItems { - ALL, - STORED, - CRAFTABLE; - - @Override - public IConfigEnum[] getValues() { - return values(); - } - - @Override - public String getName() { - return "ViewItems"; - } + ALL, STORED, CRAFTABLE } \ No newline at end of file diff --git a/src/main/java/appeng/api/config/YesNo.java b/src/main/java/appeng/api/config/YesNo.java new file mode 100644 index 00000000..ccb35bd5 --- /dev/null +++ b/src/main/java/appeng/api/config/YesNo.java @@ -0,0 +1,6 @@ +package appeng.api.config; + +public enum YesNo +{ + YES, NO, UNDECIDED +} diff --git a/src/main/java/appeng/api/crafting/ICraftingMedium.java b/src/main/java/appeng/api/crafting/ICraftingMedium.java new file mode 100644 index 00000000..77025478 --- /dev/null +++ b/src/main/java/appeng/api/crafting/ICraftingMedium.java @@ -0,0 +1,25 @@ +package appeng.api.crafting; + +import appeng.api.config.Actionable; +import net.minecraft.item.ItemStack; + +/** + * A place to send Items for crafting purposes, this is considered part of AE's External crafting system. + */ +public interface ICraftingMedium +{ + + /** + * @return true if this crafting medium cannot take new requests at this time. + */ + boolean isBusy(); + + /** + * Attempt to send an item. + * + * @param itemToInject + * @return the amount of the item that could not be handled at this time, or null if it was fully injected. + */ + ItemStack InjectItem(ItemStack itemToInject, Actionable mode); + +} diff --git a/src/main/java/appeng/api/crafting/ICraftingPattern.java b/src/main/java/appeng/api/crafting/ICraftingPattern.java new file mode 100644 index 00000000..8a4a62ee --- /dev/null +++ b/src/main/java/appeng/api/crafting/ICraftingPattern.java @@ -0,0 +1,16 @@ +package appeng.api.crafting; + +import appeng.api.storage.data.IAEItemStack; + +/** + * this class can be implemented if you wish to implement a TileCraftingProvider. + */ +public interface ICraftingPattern +{ + + /** + * @return the outcome, MUST have a value + */ + IAEItemStack getOutput(); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/crafting/ICraftingPatternMAC.java b/src/main/java/appeng/api/crafting/ICraftingPatternMAC.java new file mode 100644 index 00000000..bc557f62 --- /dev/null +++ b/src/main/java/appeng/api/crafting/ICraftingPatternMAC.java @@ -0,0 +1,12 @@ +package appeng.api.crafting; + +import net.minecraft.world.World; + +public interface ICraftingPatternMAC extends ICraftingPattern +{ + + boolean isEncoded(); + + boolean isCraftable(World theWorld); + +} diff --git a/src/main/java/appeng/api/crafting/ICraftingProvider.java b/src/main/java/appeng/api/crafting/ICraftingProvider.java new file mode 100644 index 00000000..509e25a2 --- /dev/null +++ b/src/main/java/appeng/api/crafting/ICraftingProvider.java @@ -0,0 +1,19 @@ +package appeng.api.crafting; + +import appeng.api.networking.events.MENetworkCraftingChange; + +/** + * Allows a IGridHost to provide crafting patterns to the network, post a + * {@link MENetworkCraftingChange} to tell AE to update. + */ +public interface ICraftingProvider extends ICraftingMedium +{ + + /** + * called when the network is looking for possible crafting jobs. + * + * @param craftingTracker + */ + void provideCrafting(ICraftingProviderHelper craftingTracker); + +} diff --git a/src/main/java/appeng/api/crafting/ICraftingProviderHelper.java b/src/main/java/appeng/api/crafting/ICraftingProviderHelper.java new file mode 100644 index 00000000..1284261b --- /dev/null +++ b/src/main/java/appeng/api/crafting/ICraftingProviderHelper.java @@ -0,0 +1,15 @@ +package appeng.api.crafting; + +/** + * Passed to a ICraftingProvider as a interface to manipulate the available + * crafting jobs. + */ +public interface ICraftingProviderHelper +{ + + /** + * Add new Pattern to AE's crafting cache. + */ + void addCraftingOption(ICraftingPattern api); + +} diff --git a/src/main/java/appeng/api/definitions/Blocks.java b/src/main/java/appeng/api/definitions/Blocks.java new file mode 100644 index 00000000..74a250c7 --- /dev/null +++ b/src/main/java/appeng/api/definitions/Blocks.java @@ -0,0 +1,75 @@ +package appeng.api.definitions; + +import appeng.api.util.AEItemDefinition; + +public class Blocks +{ + + /* + * World Gen + */ + public AEItemDefinition blockQuartzOre; + public AEItemDefinition blockQuartzOreCharged; + public AEItemDefinition blockMatrixFrame; + + /* + * Decorative + */ + public AEItemDefinition blockQuartz; + public AEItemDefinition blockQuartzPiller; + public AEItemDefinition blockQuartzChiseled; + public AEItemDefinition blockQuartzGlass; + public AEItemDefinition blockQuartzVibrantGlass; + public AEItemDefinition blockQuartzTorch; + public AEItemDefinition blockFluix; + public AEItemDefinition blockSkyStone; + public AEItemDefinition blockSkyChest; + public AEItemDefinition blockSkyCompass; + + /* + * Misc + */ + public AEItemDefinition blockGrindStone; + public AEItemDefinition blockCrankHandle; + public AEItemDefinition blockInscriber; + public AEItemDefinition blockWireless; + public AEItemDefinition blockCharger; + public AEItemDefinition blockTinyTNT; + public AEItemDefinition blockSecurity; + + /* + * Quantum Network Bridge + */ + public AEItemDefinition blockQuantumRing; + public AEItemDefinition blockQuantumLink; + + /* + * Spatial IO + */ + public AEItemDefinition blockSpatialPylon; + public AEItemDefinition blockSpatialIOPort; + + /* + * Bus / Cables + */ + public AEItemDefinition blockMultiPart; + + /* + * Machines + */ + public AEItemDefinition blockController; + public AEItemDefinition blockDrive; + public AEItemDefinition blockChest; + public AEItemDefinition blockInterface; + public AEItemDefinition blockCellWorkbench; + public AEItemDefinition blockIOPort; + public AEItemDefinition blockCondenser; + public AEItemDefinition blockEnergyAcceptor; + public AEItemDefinition blockVibrationChamber; + public AEItemDefinition blockQuartzGrowthAccelerator; + + public AEItemDefinition blockEnergyCell; + public AEItemDefinition blockEnergyCellDense; + public AEItemDefinition blockEnergyCellCreative; + +} diff --git a/src/main/java/appeng/api/definitions/Items.java b/src/main/java/appeng/api/definitions/Items.java new file mode 100644 index 00000000..c0167e7c --- /dev/null +++ b/src/main/java/appeng/api/definitions/Items.java @@ -0,0 +1,47 @@ +package appeng.api.definitions; + +import appeng.api.util.AEItemDefinition; + +public class Items +{ + + public AEItemDefinition itemCertusQuartzAxe; + public AEItemDefinition itemCertusQuartzHoe; + public AEItemDefinition itemCertusQuartzShovel; + public AEItemDefinition itemCertusQuartzPick; + public AEItemDefinition itemCertusQuartzSword; + public AEItemDefinition itemCertusQuartzWrench; + public AEItemDefinition itemCertusQuartzKnife; + + public AEItemDefinition itemNetherQuartzAxe; + public AEItemDefinition itemNetherQuartzHoe; + public AEItemDefinition itemNetherQuartzShovel; + public AEItemDefinition itemNetherQuartzPick; + public AEItemDefinition itemNetherQuartzSword; + public AEItemDefinition itemNetherQuartzWrench; + public AEItemDefinition itemNetherQuartzKnife; + + public AEItemDefinition itemEntropyManipulator; + public AEItemDefinition itemWirelessTerminal; + public AEItemDefinition itemBiometricCard; + public AEItemDefinition itemChargedStaff; + public AEItemDefinition itemMassCannon; + public AEItemDefinition itemMemoryCard; + public AEItemDefinition itemNetworkTool; + public AEItemDefinition itemPortableCell; + + public AEItemDefinition itemCellCreative; + public AEItemDefinition itemViewCell; + + public AEItemDefinition itemCell1k; + public AEItemDefinition itemCell4k; + public AEItemDefinition itemCell16k; + public AEItemDefinition itemCell64k; + + public AEItemDefinition itemSpatialCell2; + public AEItemDefinition itemSpatialCell16; + public AEItemDefinition itemSpatialCell128; + + public AEItemDefinition itemFacade; + public AEItemDefinition itemCrystalSeed; +} diff --git a/src/main/java/appeng/api/definitions/Materials.java b/src/main/java/appeng/api/definitions/Materials.java new file mode 100644 index 00000000..071a2872 --- /dev/null +++ b/src/main/java/appeng/api/definitions/Materials.java @@ -0,0 +1,78 @@ +package appeng.api.definitions; + +import appeng.api.util.AEItemDefinition; + +public class Materials +{ + + public AEItemDefinition materialCell2SpatialPart; + public AEItemDefinition materialCell16SpatialPart; + public AEItemDefinition materialCell128SpatialPart; + + public AEItemDefinition materialSilicon; + public AEItemDefinition materialSkyDust; + + public AEItemDefinition materialCalcProcessorPress; + public AEItemDefinition materialEngProcessorPress; + public AEItemDefinition materialLogicProcessorPress; + + public AEItemDefinition materialCalcProcessorPrint; + public AEItemDefinition materialEngProcessorPrint; + public AEItemDefinition materialLogicProcessorPrint; + + public AEItemDefinition materialSiliconPress; + public AEItemDefinition materialSiliconPrint; + + public AEItemDefinition materialNamePress; + + public AEItemDefinition materialLogicProcessor; + public AEItemDefinition materialCalcProcessor; + public AEItemDefinition materialEngProcessor; + + public AEItemDefinition materialBasicCard; + public AEItemDefinition materialAdvCard; + + public AEItemDefinition materialPureifiedCertusQuartzCrystal; + public AEItemDefinition materialPureifiedNetherQuartzCrystal; + public AEItemDefinition materialPureifiedFluixCrystal; + + public AEItemDefinition materialCell1kPart; + public AEItemDefinition materialCell4kPart; + public AEItemDefinition materialCell16kPart; + public AEItemDefinition materialCell64kPart; + public AEItemDefinition materialEmptyStorageCell; + + public AEItemDefinition materialCardRedstone; + public AEItemDefinition materialCardSpeed; + public AEItemDefinition materialCardCapacity; + public AEItemDefinition materialCardFuzzy; + public AEItemDefinition materialCardInverter; + + public AEItemDefinition materialEnderDust; + public AEItemDefinition materialFlour; + public AEItemDefinition materialGoldDust; + public AEItemDefinition materialIronDust; + public AEItemDefinition materialFluixDust; + public AEItemDefinition materialCertusQuartzDust; + public AEItemDefinition materialNetherQuartzDust; + + public AEItemDefinition materialMatterBall; + public AEItemDefinition materialIronNugget; + + public AEItemDefinition materialCertusQuartzCrystal; + public AEItemDefinition materialCertusQuartzCrystalCharged; + public AEItemDefinition materialFluixCrystal; + public AEItemDefinition materialFluixPearl; + + public AEItemDefinition materialWoodenGear; + + public AEItemDefinition materialWireless; + public AEItemDefinition materialWirelessBooster; + + public AEItemDefinition materialAnnihilationCore; + public AEItemDefinition materialFormationCore; + + public AEItemDefinition materialSingularity; + public AEItemDefinition materialQESingularity; + +} diff --git a/src/main/java/appeng/api/definitions/Parts.java b/src/main/java/appeng/api/definitions/Parts.java new file mode 100644 index 00000000..11ffd916 --- /dev/null +++ b/src/main/java/appeng/api/definitions/Parts.java @@ -0,0 +1,47 @@ +package appeng.api.definitions; + +import appeng.api.util.AEColoredItemDefinition; +import appeng.api.util.AEItemDefinition; + +public class Parts +{ + + public AEColoredItemDefinition partCableSmart; + public AEColoredItemDefinition partCableCovered; + public AEColoredItemDefinition partCableGlass; + public AEColoredItemDefinition partCableDense; + + public AEItemDefinition partQuartzFiber; + public AEItemDefinition partToggleBus; + public AEItemDefinition partInvertedToggleBus; + + public AEItemDefinition partStorageBus; + public AEItemDefinition partImportBus; + public AEItemDefinition partExportBus; + public AEItemDefinition partInterface; + + public AEItemDefinition partLevelEmitter; + + public AEItemDefinition partAnnihilationPlane; + public AEItemDefinition partFormationPlane; + + public AEItemDefinition partP2PTunnelME; + public AEItemDefinition partP2PTunnelRedstone; + public AEItemDefinition partP2PTunnelItems; + public AEItemDefinition partP2PTunnelLiquids; + public AEItemDefinition partP2PTunnelMJ; + public AEItemDefinition partP2PTunnelEU; + + public AEItemDefinition partCableAnchor; + public AEItemDefinition partMonitor; + public AEItemDefinition partSemiDarkMonitor; + public AEItemDefinition partDarkMonitor; + + public AEItemDefinition partCraftingMonitor; + public AEItemDefinition partPatternTerminal; + public AEItemDefinition partCraftingTerminal; + public AEItemDefinition partTerminal; + public AEItemDefinition partStorageMonitor; + public AEItemDefinition partConversionMonitor; + +} diff --git a/src/main/java/appeng/api/events/AEWorldEvent.java b/src/main/java/appeng/api/events/AEWorldEvent.java deleted file mode 100755 index d4cb74b0..00000000 --- a/src/main/java/appeng/api/events/AEWorldEvent.java +++ /dev/null @@ -1,17 +0,0 @@ -package appeng.api.events; - -import net.minecraft.world.World; -import net.minecraftforge.event.Event; - -/** - * Simple Alternative to WorldEvent, thanks to a certain mod that wants to crash on WorldEvents - */ -public class AEWorldEvent extends Event -{ - final public World world; - - public AEWorldEvent( World w ) - { - world = w; - } -} diff --git a/src/main/java/appeng/api/events/GridErrorEvent.java b/src/main/java/appeng/api/events/GridErrorEvent.java deleted file mode 100755 index 748f1a6e..00000000 --- a/src/main/java/appeng/api/events/GridErrorEvent.java +++ /dev/null @@ -1,18 +0,0 @@ -package appeng.api.events; - -import net.minecraft.world.World; -import net.minecraftforge.event.world.WorldEvent; -import appeng.api.WorldCoord; - -/** - * an error, basically just causes an update, use it if there is really an error, other wise just ignore it. - */ -public class GridErrorEvent extends AEWorldEvent { - - public WorldCoord coord; - public GridErrorEvent(World world, WorldCoord wc ) { - super(world); - coord = wc; - } - -} diff --git a/src/main/java/appeng/api/events/GridPatternUpdateEvent.java b/src/main/java/appeng/api/events/GridPatternUpdateEvent.java deleted file mode 100755 index 413b13e9..00000000 --- a/src/main/java/appeng/api/events/GridPatternUpdateEvent.java +++ /dev/null @@ -1,22 +0,0 @@ -package appeng.api.events; - -import net.minecraft.world.World; -import net.minecraftforge.event.world.WorldEvent; -import appeng.api.WorldCoord; -import appeng.api.me.util.IGridInterface; - -/** - * Posted when crafting options in a AE Network update, you can watch for them if you want to. - */ -public class GridPatternUpdateEvent extends AEWorldEvent { - - final public WorldCoord coord; - final public IGridInterface grid; - - public GridPatternUpdateEvent(World world, WorldCoord wc, IGridInterface gi ) { - super(world); - grid = gi; - coord = wc; - } - -} diff --git a/src/main/java/appeng/api/events/GridStorageUpdateEvent.java b/src/main/java/appeng/api/events/GridStorageUpdateEvent.java deleted file mode 100755 index aab73c42..00000000 --- a/src/main/java/appeng/api/events/GridStorageUpdateEvent.java +++ /dev/null @@ -1,22 +0,0 @@ -package appeng.api.events; - -import net.minecraft.world.World; -import net.minecraftforge.event.world.WorldEvent; -import appeng.api.WorldCoord; -import appeng.api.me.util.IGridInterface; - -/** - * Posted when storage options in a AE Network update, such as a new Storage Bus or Cell is added, or removed. - */ -public class GridStorageUpdateEvent extends AEWorldEvent { - - final public WorldCoord coord; - final public IGridInterface grid; - - public GridStorageUpdateEvent(World world, WorldCoord wc, IGridInterface gi ) { - super(world); - grid = gi; - coord = wc; - } - -} diff --git a/src/main/java/appeng/api/events/GridTileConnectivityEvent.java b/src/main/java/appeng/api/events/GridTileConnectivityEvent.java deleted file mode 100755 index 9d793899..00000000 --- a/src/main/java/appeng/api/events/GridTileConnectivityEvent.java +++ /dev/null @@ -1,22 +0,0 @@ -package appeng.api.events; - -import net.minecraft.world.World; -import net.minecraftforge.event.world.WorldEvent; -import appeng.api.WorldCoord; -import appeng.api.me.tiles.IGridTileEntity; - -/** - * The network has changed, and must be updated. - */ -public class GridTileConnectivityEvent extends AEWorldEvent { - - public WorldCoord coord; - public IGridTileEntity te; - - public GridTileConnectivityEvent( IGridTileEntity _te, World world, WorldCoord wc ) { - super(world); - te = _te; - coord = wc; - } - -} diff --git a/src/main/java/appeng/api/events/GridTileLoadEvent.java b/src/main/java/appeng/api/events/GridTileLoadEvent.java deleted file mode 100755 index 2293f56a..00000000 --- a/src/main/java/appeng/api/events/GridTileLoadEvent.java +++ /dev/null @@ -1,22 +0,0 @@ -package appeng.api.events; - -import net.minecraft.world.World; -import net.minecraftforge.event.world.WorldEvent; -import appeng.api.WorldCoord; -import appeng.api.me.tiles.IGridTileEntity; - -/** - * A Tile has been added to the world, and should be evaluated for Network Connectivity. - */ -public class GridTileLoadEvent extends AEWorldEvent { - - public WorldCoord coord; - public IGridTileEntity te; - - public GridTileLoadEvent(IGridTileEntity _te, World world, WorldCoord wc ) { - super(world); - te = _te; - coord = wc; - } - -} diff --git a/src/main/java/appeng/api/events/GridTileUnloadEvent.java b/src/main/java/appeng/api/events/GridTileUnloadEvent.java deleted file mode 100755 index d96ccefb..00000000 --- a/src/main/java/appeng/api/events/GridTileUnloadEvent.java +++ /dev/null @@ -1,22 +0,0 @@ -package appeng.api.events; - -import net.minecraft.world.World; -import net.minecraftforge.event.world.WorldEvent; -import appeng.api.WorldCoord; -import appeng.api.me.tiles.IGridTileEntity; - -/** - * A Tile has been removed from the world, and should no longer be considered for connectivity. - */ -public class GridTileUnloadEvent extends AEWorldEvent { - - public WorldCoord coord; - public IGridTileEntity te; - - public GridTileUnloadEvent(IGridTileEntity _te,World world, WorldCoord wc ) { - super(world); - te = _te; - coord = wc; - } - -} diff --git a/src/main/java/appeng/api/events/LocatableEventAnnounce.java b/src/main/java/appeng/api/events/LocatableEventAnnounce.java new file mode 100644 index 00000000..681fa380 --- /dev/null +++ b/src/main/java/appeng/api/events/LocatableEventAnnounce.java @@ -0,0 +1,28 @@ +package appeng.api.events; + +import cpw.mods.fml.common.eventhandler.Event; +import appeng.api.features.ILocatable; + +/** + * Input Event: + * + * Used to Notify the Location Registry of objects, and their availability. + */ +public class LocatableEventAnnounce extends Event +{ + + public enum LocatableEvent + { + Register, // Adds the locatable to the registry + Unregister // Removes the locatable from the registry + }; + + final public ILocatable target; + final public LocatableEvent change; + + public LocatableEventAnnounce(ILocatable o, LocatableEvent ev) { + target = o; + change = ev; + } + +} diff --git a/src/main/java/appeng/api/events/LocateableEventAnnounce.java b/src/main/java/appeng/api/events/LocateableEventAnnounce.java deleted file mode 100755 index 2605629e..00000000 --- a/src/main/java/appeng/api/events/LocateableEventAnnounce.java +++ /dev/null @@ -1,25 +0,0 @@ -package appeng.api.events; - -import net.minecraftforge.event.Event; -import appeng.api.me.tiles.ILocateable; - -/** - * Used to Notify the Location Registry of objects, and their availability. - */ -public class LocateableEventAnnounce extends Event { - - public enum LocateableEvent { - Register, // Adds the locateable to the registry - Unregister // Removes the Locatable from the registry - }; - - final public ILocateable target; - final public LocateableEvent change; - - public LocateableEventAnnounce( ILocateable o, LocateableEvent ev ) - { - target = o; - change = ev; - } - -} diff --git a/src/main/java/appeng/api/events/MultiBlockUpdateEvent.java b/src/main/java/appeng/api/events/MultiBlockUpdateEvent.java deleted file mode 100755 index 280abddd..00000000 --- a/src/main/java/appeng/api/events/MultiBlockUpdateEvent.java +++ /dev/null @@ -1,22 +0,0 @@ -package appeng.api.events; - -import net.minecraft.world.World; -import net.minecraftforge.event.world.WorldEvent; -import appeng.api.WorldCoord; -import appeng.api.me.tiles.IGridTileEntity; - -/** - * Used by the MAC to trigger updates in its structure. - */ -public class MultiBlockUpdateEvent extends AEWorldEvent { - - public WorldCoord coord; - public IGridTileEntity te; - - public MultiBlockUpdateEvent( IGridTileEntity _te, World world, WorldCoord wc ) { - super(world); - coord = wc; - te = _te; - } - -} diff --git a/src/main/java/appeng/api/exceptions/AppEngException.java b/src/main/java/appeng/api/exceptions/AppEngException.java old mode 100755 new mode 100644 index 940e7bee..9c3d9ea9 --- a/src/main/java/appeng/api/exceptions/AppEngException.java +++ b/src/main/java/appeng/api/exceptions/AppEngException.java @@ -2,11 +2,10 @@ package appeng.api.exceptions; public class AppEngException extends Exception { - + private static final long serialVersionUID = -9051434206368465494L; - public AppEngException(String t) - { - super(t); - } + public AppEngException(String t) { + super( t ); + } } diff --git a/src/main/java/appeng/api/exceptions/AppEngTileMissingException.java b/src/main/java/appeng/api/exceptions/AppEngTileMissingException.java deleted file mode 100755 index 067e47f1..00000000 --- a/src/main/java/appeng/api/exceptions/AppEngTileMissingException.java +++ /dev/null @@ -1,30 +0,0 @@ -package appeng.api.exceptions; - -import cpw.mods.fml.common.FMLLog; -import net.minecraft.world.World; -import appeng.api.DimentionalCoord; - -public class AppEngTileMissingException extends Exception { - - private static final long serialVersionUID = -3502227742711078681L; - public DimentionalCoord dc; - - @Override - public void printStackTrace() { - try - { - FMLLog.info( "[AppEng] Missing Tile at "+dc.x+", "+dc.y+", "+dc.z+" in +"+dc.getWorld().getWorldInfo().getVanillaDimension() ); - } - catch( Throwable _ ) - { - FMLLog.info( "[AppEng] Missing Tile at "+dc.x+", "+dc.y+", "+dc.z ); - } - super.printStackTrace(); - } - - public AppEngTileMissingException(World w, int x, int y, int z) - { - dc = new DimentionalCoord( w, x, y, z ); - } - -} diff --git a/src/main/java/appeng/api/exceptions/FailedConnection.java b/src/main/java/appeng/api/exceptions/FailedConnection.java new file mode 100644 index 00000000..f4abed64 --- /dev/null +++ b/src/main/java/appeng/api/exceptions/FailedConnection.java @@ -0,0 +1,10 @@ +package appeng.api.exceptions; + +public class FailedConnection extends Exception +{ + + private static final long serialVersionUID = -2544208090248293753L; + + public FailedConnection() { + } +} diff --git a/src/main/java/appeng/api/exceptions/MissingIngredientError.java b/src/main/java/appeng/api/exceptions/MissingIngredientError.java new file mode 100644 index 00000000..51a200a0 --- /dev/null +++ b/src/main/java/appeng/api/exceptions/MissingIngredientError.java @@ -0,0 +1,11 @@ +package appeng.api.exceptions; + +public class MissingIngredientError extends Exception { + + private static final long serialVersionUID = -998858343831371697L; + + public MissingIngredientError(String n) { + super( n ); + } + +} diff --git a/src/main/java/appeng/api/exceptions/ModNotInstalled.java b/src/main/java/appeng/api/exceptions/ModNotInstalled.java new file mode 100644 index 00000000..7744a1fb --- /dev/null +++ b/src/main/java/appeng/api/exceptions/ModNotInstalled.java @@ -0,0 +1,12 @@ +package appeng.api.exceptions; + +public class ModNotInstalled extends Exception +{ + + private static final long serialVersionUID = -9052435206368425494L; + + public ModNotInstalled(String t) { + super( t ); + } + +} diff --git a/src/main/java/appeng/api/exceptions/RecipeError.java b/src/main/java/appeng/api/exceptions/RecipeError.java new file mode 100644 index 00000000..a07f6438 --- /dev/null +++ b/src/main/java/appeng/api/exceptions/RecipeError.java @@ -0,0 +1,12 @@ +package appeng.api.exceptions; + +public class RecipeError extends Exception +{ + + private static final long serialVersionUID = -6602870588617670262L; + + public RecipeError(String n) { + super( n ); + } + +} diff --git a/src/main/java/appeng/api/exceptions/RegistrationError.java b/src/main/java/appeng/api/exceptions/RegistrationError.java new file mode 100644 index 00000000..30592ba0 --- /dev/null +++ b/src/main/java/appeng/api/exceptions/RegistrationError.java @@ -0,0 +1,12 @@ +package appeng.api.exceptions; + +public class RegistrationError extends Exception +{ + + private static final long serialVersionUID = -6602870588617670263L; + + public RegistrationError(String n) { + super( n ); + } + +} diff --git a/src/main/java/appeng/api/features/IGrinderEntry.java b/src/main/java/appeng/api/features/IGrinderEntry.java new file mode 100644 index 00000000..f5d72032 --- /dev/null +++ b/src/main/java/appeng/api/features/IGrinderEntry.java @@ -0,0 +1,74 @@ +package appeng.api.features; + +import net.minecraft.item.ItemStack; + +/** + * Registration Records for {@link IGrinderRegistry} + */ +public interface IGrinderEntry +{ + + /** + * the current input + * + * @return input that the grinder will accept. + */ + public ItemStack getInput(); + + /** + * lets you change the grinder recipe by changing its input. + * + * @param input + */ + public void setInput(ItemStack input); + + /** + * gets the current output + * + * @return output that the grinder will produce + */ + public ItemStack getOutput(); + + /** + * gets the current output + * + * @return output that the grinder will produce + */ + public ItemStack getOptionalOutput(); + + /** + * allows you to change the output. + * + * @param output + */ + public void setOutput(ItemStack output); + + /** + * stack, and 0.0-1.0 chance that it will be generated. + * + * @param output + * @param chance + */ + public void setOptionalOutput(ItemStack output, float chance); + + /** + * 0.0 - 1.0 the chance that the optional output will be generated. + * + * @return + */ + public float getOptionalChance(); + + /** + * Energy cost, in turns. + * + * @return number of turns it takes to produce the output from the input. + */ + public int getEnergyCost(); + + /** + * Allows you to adjust the number of turns + * + * @param new number of turns to produce output. + */ + public void setEnergyCost(int c); +} diff --git a/src/main/java/appeng/api/IGrinderRecipeManager.java b/src/main/java/appeng/api/features/IGrinderRegistry.java old mode 100755 new mode 100644 similarity index 50% rename from src/main/java/appeng/api/IGrinderRecipeManager.java rename to src/main/java/appeng/api/features/IGrinderRegistry.java index 16b60830..9faec35a --- a/src/main/java/appeng/api/IGrinderRecipeManager.java +++ b/src/main/java/appeng/api/features/IGrinderRegistry.java @@ -1,4 +1,4 @@ -package appeng.api; +package appeng.api.features; import java.util.List; @@ -7,26 +7,42 @@ import net.minecraft.item.ItemStack; /** * Lets you manipulate Grinder Recipes, by adding or editing existing ones. */ -public interface IGrinderRecipeManager { - +public interface IGrinderRegistry +{ + /** * Current list of registered recipes, you can modify this if you want too. + * * @return currentlyRegistredRecipes */ - public List getRecipes(); - + public List getRecipes(); + /** * add a new recipe the easy way, in -> out, how many turns. + * * @param in * @param out - * @param cost + * @param turns */ - public void addRecipe( ItemStack in, ItemStack out, int cost ); - + public void addRecipe(ItemStack in, ItemStack out, int turns); + + /** + * add a new recipe with optional outputs + * + * @param in + * @param out + * @param optional + * @param chance + * @param turns + */ + void addRecipe(ItemStack in, ItemStack out, ItemStack optional, float chance, int turns); + /** * Searches for a recipe for a given input, and returns it. + * * @param input * @return identified recipe, or null */ - public IAppEngGrinderRecipe getRecipeForInput(ItemStack input); + public IGrinderEntry getRecipeForInput(ItemStack input); + } diff --git a/src/main/java/appeng/api/features/IItemComparisionProvider.java b/src/main/java/appeng/api/features/IItemComparisionProvider.java new file mode 100644 index 00000000..a64bf215 --- /dev/null +++ b/src/main/java/appeng/api/features/IItemComparisionProvider.java @@ -0,0 +1,30 @@ +package appeng.api.features; + +import net.minecraft.item.ItemStack; + +/** + * Provider for special comparisons. when an item is encountered AE Will request + * if the comparison function handles the item, by trying to request a + * IItemComparison class. + */ +public interface IItemComparisionProvider +{ + + /** + * should return a new IItemComparison, or return null if it doesn't handle + * the supplied item. + * + * @param is + * @return IItemComparison, or null + */ + IItemComparison getComparison(ItemStack is); + + /** + * Simple test for support ( AE generally skips this and calls the above function. ) + * + * @param stack + * @return true, if getComparison will return a valid IItemComparison Object + */ + public boolean canHandle(ItemStack stack); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/features/IItemComparison.java b/src/main/java/appeng/api/features/IItemComparison.java new file mode 100644 index 00000000..856049cc --- /dev/null +++ b/src/main/java/appeng/api/features/IItemComparison.java @@ -0,0 +1,10 @@ +package appeng.api.features; + +public interface IItemComparison +{ + + public boolean sameAsPrecise(IItemComparison comp); + + public boolean sameAsFuzzy(IItemComparison comp); + +} diff --git a/src/main/java/appeng/api/features/ILocatable.java b/src/main/java/appeng/api/features/ILocatable.java new file mode 100644 index 00000000..ec064ab1 --- /dev/null +++ b/src/main/java/appeng/api/features/ILocatable.java @@ -0,0 +1,17 @@ +package appeng.api.features; + +import appeng.api.events.LocatableEventAnnounce; + +/** + * A registration record for the {@link ILocateableRegistry} use the {@link appeng.api.events.LocatableEventAnnounce} event on the Forge + * Event bus to update the registry. + */ +public interface ILocatable +{ + + /** + * @return the serial for a locatable object + */ + long getLocatableSerial(); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/ILocateableRegistry.java b/src/main/java/appeng/api/features/ILocateableRegistry.java old mode 100755 new mode 100644 similarity index 53% rename from src/main/java/appeng/api/ILocateableRegistry.java rename to src/main/java/appeng/api/features/ILocateableRegistry.java index 8e75cbef..e7592903 --- a/src/main/java/appeng/api/ILocateableRegistry.java +++ b/src/main/java/appeng/api/features/ILocateableRegistry.java @@ -1,12 +1,15 @@ -package appeng.api; +package appeng.api.features; /** * A Registry for locatable items, works based on serial numbers. */ -public interface ILocateableRegistry { +public interface ILocateableRegistry +{ /** - * Attempts to find the object with the serial specifed, if it can it returns the object. + * Attempts to find the object with the serial specified, if it can it + * returns the object. + * * @param ser * @return requestedObject, or null */ diff --git a/src/main/java/appeng/api/features/IMatterCannonAmmoRegistry.java b/src/main/java/appeng/api/features/IMatterCannonAmmoRegistry.java new file mode 100644 index 00000000..fd6051a7 --- /dev/null +++ b/src/main/java/appeng/api/features/IMatterCannonAmmoRegistry.java @@ -0,0 +1,24 @@ +package appeng.api.features; + +import net.minecraft.item.ItemStack; + +public interface IMatterCannonAmmoRegistry +{ + + /** + * register a new ammo, generally speaking this is based off of atomic weight to make it easier to guess at + * + * @param ammo + * @param weight + */ + void registerAmmo(ItemStack ammo, double weight); + + /** + * get the penetration value for a particular ammo, 0 indicates a non-ammo. + * + * @param is + * @return 0 or a valid penetration value. + */ + float getPenetration(ItemStack is); + +} diff --git a/src/main/java/appeng/api/features/INetworkEncodable.java b/src/main/java/appeng/api/features/INetworkEncodable.java new file mode 100644 index 00000000..57ef647f --- /dev/null +++ b/src/main/java/appeng/api/features/INetworkEncodable.java @@ -0,0 +1,28 @@ +package appeng.api.features; + +import net.minecraft.item.ItemStack; + +public interface INetworkEncodable { + + /** + * Used to get the current key from the item. + * + * @param player + * @param item + * @return + */ + String getEncryptionKey(ItemStack item); + + /** + * Encode the wireless frequency via the Controller. + * + * @param item + * the wireless terminal. + * @param encKey + * the wireless encryption key. + * @param name + * null for now. + */ + void setEncryptionKey(ItemStack item, String encKey, String name); + +} diff --git a/src/main/java/appeng/api/features/IP2PTunnelRegistry.java b/src/main/java/appeng/api/features/IP2PTunnelRegistry.java new file mode 100644 index 00000000..7717ce38 --- /dev/null +++ b/src/main/java/appeng/api/features/IP2PTunnelRegistry.java @@ -0,0 +1,31 @@ +package appeng.api.features; + +import net.minecraft.item.ItemStack; +import appeng.api.config.TunnelType; + +/** + * A Registry for how p2p Tunnels are attuned + */ +public interface IP2PTunnelRegistry +{ + + /** + * Allows third parties to register items from their mod as potential + * attunements for AE's P2P Tunnels + * + * @param trigger + * - the item which triggers attunement + * @param type + * - the type of tunnel + */ + public abstract void addNewAttunement(ItemStack trigger, TunnelType type); + + /** + * returns null if no attunement can be found. + * + * @param trigger + * @return + */ + TunnelType getTunnelTypeByItem(ItemStack trigger); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/features/IPlayerRegistry.java b/src/main/java/appeng/api/features/IPlayerRegistry.java new file mode 100644 index 00000000..3fa6b4b6 --- /dev/null +++ b/src/main/java/appeng/api/features/IPlayerRegistry.java @@ -0,0 +1,30 @@ +package appeng.api.features; + +import net.minecraft.entity.player.EntityPlayer; + +/** + * Maintains a save specific list of userids and username combinations this greatly simplifies storage internally and + * gives a common place to look up and get IDs for the security framework. + */ +public interface IPlayerRegistry +{ + + /** + * @param player + * @return user id of a username. + */ + int getID(String username); + + /** + * @param player + * @return user id of a player entity. + */ + int getID(EntityPlayer player); + + /** + * @param id + * @return Username of an ID + */ + String getUsername(int id); + +} diff --git a/src/main/java/appeng/api/features/IRecipeHandlerRegistry.java b/src/main/java/appeng/api/features/IRecipeHandlerRegistry.java new file mode 100644 index 00000000..5b8fe543 --- /dev/null +++ b/src/main/java/appeng/api/features/IRecipeHandlerRegistry.java @@ -0,0 +1,48 @@ +package appeng.api.features; + +import appeng.api.recipes.ICraftHandler; +import appeng.api.recipes.IRecipeHandler; +import appeng.api.recipes.ISubItemResolver; + +public interface IRecipeHandlerRegistry +{ + + /** + * Add a new Recipe Handler to the parser. + * + * MUST BE CALLED IN PRE-INIT + * + * @param name + * @param handler + */ + void addNewCraftHandler(String name, Class handler); + + /** + * Add a new resolver to the parser. + * + * MUST BE CALLED IN PRE-INIT + * + * @param sir + */ + void addNewSubItemResolver(ISubItemResolver sir); + + /** + * @param name + * @return A recipe handler by name, returns null on failure. + */ + ICraftHandler getCraftHandlerFor(String name); + + /** + * @return a new recipe handler, which can be used to parse, and read recipe files. + */ + public IRecipeHandler createNewRecipehandler(); + + /** + * resolve sub items by name. + * + * @param tmpName + * @return ResolerResult or ResolverResultSet + */ + Object resolveItem(String nameSpace, String itemName); + +} diff --git a/src/main/java/appeng/api/features/IRegistryContainer.java b/src/main/java/appeng/api/features/IRegistryContainer.java new file mode 100644 index 00000000..400e29a5 --- /dev/null +++ b/src/main/java/appeng/api/features/IRegistryContainer.java @@ -0,0 +1,72 @@ +package appeng.api.features; + +import appeng.api.movable.IMovableRegistry; +import appeng.api.networking.IGridCacheRegistry; +import appeng.api.storage.ICellRegistry; +import appeng.api.storage.IExternalStorageRegistry; + +public interface IRegistryContainer +{ + + /** + * Use the movable registry to white list your tiles. + */ + IMovableRegistry moveable(); + + /** + * Add new Grid Caches for use during run time, only use during loading phase. + */ + IGridCacheRegistry gridCache(); + + /** + * Add additional storage bus handlers to improve interplay with mod blocks that contains special inventories that + * function unlike vanilla chests. AE uses this internally for barrels, dsu's, quantum chests, AE Networks and more. + */ + IExternalStorageRegistry externalStorage(); + + /** + * Add additional special comparison functionality, AE Uses this internally for Bees. + */ + ISpecialComparisonRegistry specialComparson(); + + /** + * Lets you register your items as wireless terminals + */ + IWirelessTermRegistery wireless(); + + /** + * Allows you to register new cell types, these will function in drives + */ + ICellRegistry cell(); + + /** + * Manage grinder recipes via API + */ + IGrinderRegistry grinder(); + + /** + * get access to the locatable registry + */ + ILocateableRegistry locateable(); + + /** + * get access to the p2p tunnel registry. + */ + IP2PTunnelRegistry p2pTunnel(); + + /** + * get access to the ammo registry. + */ + IMatterCannonAmmoRegistry matterCannon(); + + /** + * get access to the player registry + */ + IPlayerRegistry players(); + + /** + * get access to the ae2 recipe api + */ + IRecipeHandlerRegistry recipes(); + +} diff --git a/src/main/java/appeng/api/features/ISpecialComparisonRegistry.java b/src/main/java/appeng/api/features/ISpecialComparisonRegistry.java new file mode 100644 index 00000000..300a511e --- /dev/null +++ b/src/main/java/appeng/api/features/ISpecialComparisonRegistry.java @@ -0,0 +1,27 @@ +package appeng.api.features; + +import net.minecraft.item.ItemStack; + +/** + * A Registry of any special comparison handlers for AE To use. + * + */ +public interface ISpecialComparisonRegistry +{ + + /** + * return TheHandler or null. + * + * @param stack + * @return a handler it found for a specific item + */ + IItemComparison getSpecialComparion(ItemStack stack); + + /** + * Register a new special comparison function with AE. + * + * @param prov + */ + public void addComparisonProvider(IItemComparisionProvider prov); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/features/IWirelessTermHandler.java b/src/main/java/appeng/api/features/IWirelessTermHandler.java new file mode 100644 index 00000000..84ab938e --- /dev/null +++ b/src/main/java/appeng/api/features/IWirelessTermHandler.java @@ -0,0 +1,46 @@ +package appeng.api.features; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import appeng.api.util.IConfigManager; + +/** + * A handler for a wireless terminal. + */ +public interface IWirelessTermHandler extends INetworkEncodable +{ + + /** + * @param is + * @return true, if usePower, hasPower, etc... can be called for the provided item + */ + boolean canHandle(ItemStack is); + + /** + * use an amount of power, in AE units + * + * @param amount + * is in AE units ( 5 per MJ ), if you return false, the item should be dead and return false for + * hasPower + * @param is + * @return + */ + boolean usePower(EntityPlayer player, double amount, ItemStack is); + + /** + * gets the power status of the item. + * + * @param is + * @return returns true if there is any power left. + */ + boolean hasPower(EntityPlayer player, double amount, ItemStack is); + + /** + * Return the config manage for the wireless terminal. + * + * @param is + * @return + */ + IConfigManager getConfigManager(ItemStack is); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/features/IWirelessTermRegistery.java b/src/main/java/appeng/api/features/IWirelessTermRegistery.java new file mode 100644 index 00000000..0f14ce94 --- /dev/null +++ b/src/main/java/appeng/api/features/IWirelessTermRegistery.java @@ -0,0 +1,39 @@ +package appeng.api.features; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +/** + * Registration record for a Custom Cell handler. + */ +public interface IWirelessTermRegistery +{ + + /** + * add this handler to the list of other wireless handler. + * + * @param handler + */ + void registerWirelessHandler(IWirelessTermHandler handler); + + /** + * @param is + * @return true if there is a handler for this item + */ + boolean isWirelessTerminal(ItemStack is); + + /** + * @param is + * @return a register handler for the item in question, or null if there + * isn't one + */ + IWirelessTermHandler getWirelessTerminalHandler(ItemStack is); + + /** + * opens the wireless terminal gui, the wireless terminal item, must be in + * the active slot on the tool bar. + */ + void OpenWirelessTermainlGui(ItemStack item, World w, EntityPlayer player); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/implementations/ICraftingPatternItem.java b/src/main/java/appeng/api/implementations/ICraftingPatternItem.java new file mode 100644 index 00000000..739f01af --- /dev/null +++ b/src/main/java/appeng/api/implementations/ICraftingPatternItem.java @@ -0,0 +1,21 @@ +package appeng.api.implementations; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import appeng.api.crafting.ICraftingPatternMAC; + +/** + * Implemented on {@link net.minecraft.item.Item} + */ +public interface ICraftingPatternItem +{ + + /** + * Get information about the contents of a crafting pattern. + * + * @param is + * potential crafting pattern. + * @return the MAC Crafting Pattern, or null + */ + ICraftingPatternMAC getPatternForItem(ItemStack is); +} diff --git a/src/main/java/appeng/api/implementations/IPowerChannelState.java b/src/main/java/appeng/api/implementations/IPowerChannelState.java new file mode 100644 index 00000000..9927685b --- /dev/null +++ b/src/main/java/appeng/api/implementations/IPowerChannelState.java @@ -0,0 +1,19 @@ +package appeng.api.implementations; + +/** + * This is intended for use on the client side to provide details to Waila. + */ +public interface IPowerChannelState +{ + + /** + * @return true if the part/tile is powered. + */ + boolean isPowered(); + + /** + * @return true if the part/tile isActive + */ + boolean isActive(); + +} diff --git a/src/main/java/appeng/api/implementations/IUpgradeableHost.java b/src/main/java/appeng/api/implementations/IUpgradeableHost.java new file mode 100644 index 00000000..45c5a718 --- /dev/null +++ b/src/main/java/appeng/api/implementations/IUpgradeableHost.java @@ -0,0 +1,23 @@ +package appeng.api.implementations; + +import net.minecraft.tileentity.TileEntity; +import appeng.api.config.Upgrades; +import appeng.api.implementations.tiles.ISegmentedInventory; +import appeng.api.util.IConfigureableObject; + +public interface IUpgradeableHost extends IConfigureableObject, ISegmentedInventory +{ + + /** + * determine how many of an upgrade are installed. + */ + int getInstalledUpgrades(Upgrades u); + + /** + * the tile... + * + * @return + */ + TileEntity getTile(); + +} diff --git a/src/main/java/appeng/api/implementations/TransitionResult.java b/src/main/java/appeng/api/implementations/TransitionResult.java new file mode 100644 index 00000000..4e0f9831 --- /dev/null +++ b/src/main/java/appeng/api/implementations/TransitionResult.java @@ -0,0 +1,18 @@ +package appeng.api.implementations; + +/** + * Defines the result of performing a transition from the world into a storage + * cell, if its possible, and what the energy usage is. + */ +public class TransitionResult +{ + + public TransitionResult(boolean _success, double power) { + success = _success; + energyUsage = power; + } + + public final boolean success; + public final double energyUsage; + +} diff --git a/src/main/java/appeng/api/implementations/guiobjects/IGuiItem.java b/src/main/java/appeng/api/implementations/guiobjects/IGuiItem.java new file mode 100644 index 00000000..5ee7a832 --- /dev/null +++ b/src/main/java/appeng/api/implementations/guiobjects/IGuiItem.java @@ -0,0 +1,15 @@ +package appeng.api.implementations.guiobjects; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +/** + * Implemented on Item objects, to return objects used to manage, and interact + * with the contents. + */ +public interface IGuiItem +{ + + IGuiItemObject getGuiObject(ItemStack is, World world, int x, int y, int z); + +} diff --git a/src/main/java/appeng/api/implementations/guiobjects/IGuiItemObject.java b/src/main/java/appeng/api/implementations/guiobjects/IGuiItemObject.java new file mode 100644 index 00000000..1b1dfe64 --- /dev/null +++ b/src/main/java/appeng/api/implementations/guiobjects/IGuiItemObject.java @@ -0,0 +1,9 @@ +package appeng.api.implementations.guiobjects; + +import net.minecraft.item.ItemStack; + +public interface IGuiItemObject +{ + + public ItemStack getItemStack(); +} diff --git a/src/main/java/appeng/api/implementations/guiobjects/INetworkTool.java b/src/main/java/appeng/api/implementations/guiobjects/INetworkTool.java new file mode 100644 index 00000000..be0c54a2 --- /dev/null +++ b/src/main/java/appeng/api/implementations/guiobjects/INetworkTool.java @@ -0,0 +1,14 @@ +package appeng.api.implementations.guiobjects; + +import net.minecraft.inventory.IInventory; +import appeng.api.networking.IGridHost; + +/** + * Obtained via {@link appeng.api.implementations.guiobjects.IGuiItem} getGuiObject + */ +public interface INetworkTool extends IInventory, IGuiItemObject +{ + + IGridHost getGridHost(); // null for most purposes. + +} diff --git a/src/main/java/appeng/api/implementations/guiobjects/IPortableCell.java b/src/main/java/appeng/api/implementations/guiobjects/IPortableCell.java new file mode 100644 index 00000000..3f2bc885 --- /dev/null +++ b/src/main/java/appeng/api/implementations/guiobjects/IPortableCell.java @@ -0,0 +1,14 @@ +package appeng.api.implementations.guiobjects; + +import appeng.api.networking.energy.IEnergySource; +import appeng.api.storage.IMEMonitor; +import appeng.api.storage.ITerminalHost; +import appeng.api.storage.data.IAEItemStack; + +/** + * Obtained via {@link appeng.api.implementations.guiobjects.IGuiItem} getGuiObject + */ +public interface IPortableCell extends ITerminalHost, IMEMonitor, IEnergySource, IGuiItemObject +{ + +} diff --git a/src/main/java/appeng/api/implementations/items/IAEItemPowerStorage.java b/src/main/java/appeng/api/implementations/items/IAEItemPowerStorage.java new file mode 100644 index 00000000..8647bd8a --- /dev/null +++ b/src/main/java/appeng/api/implementations/items/IAEItemPowerStorage.java @@ -0,0 +1,48 @@ +package appeng.api.implementations.items; + +import net.minecraft.item.ItemStack; +import appeng.api.config.AccessRestriction; +import appeng.api.networking.energy.IAEPowerStorage; + +/** + * Basically the same as {@link appeng.api.networking.energy.IAEPowerStorage}, but for items. + */ +public interface IAEItemPowerStorage +{ + + /** + * Inject amt, power into the device, it will store what it can, and return + * the amount unable to be stored. + * + * @return + */ + public double injectAEPower(ItemStack is, double amt); + + /** + * Attempt to extract power from the device, it will extract what it can and + * return it. + * + * @param amt + * @return + */ + public double extractAEPower(ItemStack is, double amt); + + /** + * @return the current maximum power ( this can change :P ) + */ + public double getAEMaxPower(ItemStack is); + + /** + * @return the current AE Power Level, this may exceed getMEMaxPower() + */ + public double getAECurrentPower(ItemStack is); + + /** + * Control the power flow by telling what the network can do, either add? or + * subtract? or both! + * + * @return + */ + public AccessRestriction getPowerFlow(ItemStack is); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/implementations/items/IAEWrench.java b/src/main/java/appeng/api/implementations/items/IAEWrench.java new file mode 100644 index 00000000..b18100e7 --- /dev/null +++ b/src/main/java/appeng/api/implementations/items/IAEWrench.java @@ -0,0 +1,24 @@ +package appeng.api.implementations.items; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +/** + * Implemented on AE's wrench(s) as a substitute for if BC's API is not + * available. + */ +public interface IAEWrench +{ + + /** + * Check if the wrench can be used. + * + * @param player + * @param x + * @param y + * @param z + * @return + */ + boolean canWrench(ItemStack wrench, EntityPlayer player, int x, int y, int z); + +} diff --git a/src/main/java/appeng/api/implementations/items/IBiometricCard.java b/src/main/java/appeng/api/implementations/items/IBiometricCard.java new file mode 100644 index 00000000..42fa47a3 --- /dev/null +++ b/src/main/java/appeng/api/implementations/items/IBiometricCard.java @@ -0,0 +1,51 @@ +package appeng.api.implementations.items; + +import java.util.EnumSet; + +import net.minecraft.item.ItemStack; +import appeng.api.config.SecurityPermissions; + +public interface IBiometricCard +{ + + /** + * Set the username to blank, to clear it. + */ + void setUsername(ItemStack itemStack, String username); + + /** + * @return username of the player encoded on this card, or a blank string. + */ + String getUsername(ItemStack is); + + /** + * @param itemStack + * @return the full list of permissions encoded on the card. + */ + EnumSet getPermissions(ItemStack itemStack); + + /** + * Check if a permission is encoded on the card. + * + * @param permission + * @return true if this permission is set on the card. + */ + boolean hasPermission(ItemStack is, SecurityPermissions permission); + + /** + * remove a permission from the item stack. + * + * @param itemStack + * @param permission + */ + void removePermission(ItemStack itemStack, SecurityPermissions permission); + + /** + * add a permission to the item stack. + * + * @param itemStack + * @param permission + */ + void addPermission(ItemStack itemStack, SecurityPermissions permission); + +} diff --git a/src/main/java/appeng/api/implementations/items/IGrowableCrystal.java b/src/main/java/appeng/api/implementations/items/IGrowableCrystal.java new file mode 100644 index 00000000..391482ee --- /dev/null +++ b/src/main/java/appeng/api/implementations/items/IGrowableCrystal.java @@ -0,0 +1,14 @@ +package appeng.api.implementations.items; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.item.ItemStack; + +public interface IGrowableCrystal +{ + + ItemStack triggerGrowth(ItemStack is); + + float getMultiplier(Block blk, Material mat); + +} diff --git a/src/main/java/appeng/api/implementations/items/IItemGroup.java b/src/main/java/appeng/api/implementations/items/IItemGroup.java new file mode 100644 index 00000000..868ed720 --- /dev/null +++ b/src/main/java/appeng/api/implementations/items/IItemGroup.java @@ -0,0 +1,19 @@ +package appeng.api.implementations.items; + +import net.minecraft.item.ItemStack; + +/** + * Lets you specify the name of the group of items this falls under. + */ +public interface IItemGroup +{ + + /** + * returning null, is the same as not implementing the interface at all. + * + * @param is + * @return an unlocalized string to use for the items group name. + */ + String getUnlocalizedGroupName(ItemStack is); + +} diff --git a/src/main/java/appeng/api/implementations/items/IMemoryCard.java b/src/main/java/appeng/api/implementations/items/IMemoryCard.java new file mode 100644 index 00000000..34a9d845 --- /dev/null +++ b/src/main/java/appeng/api/implementations/items/IMemoryCard.java @@ -0,0 +1,56 @@ +package appeng.api.implementations.items; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +/** + * Memory Card API + * + * AE's Memory Card Item Class implements this interface. + */ +public interface IMemoryCard +{ + + /** + * Configures the data stored on the memory card, the SettingsName, will be + * localized when displayed. + * + * @param is + * @param SettingsName + * unlocalized string that represents the tile entity. + * @param data + * may contain a String called "tooltip" which is is a + * unlocalized string displayed after the settings name, optional + * but can be used to add details to the card for later. + */ + void setMemoryCardContents(ItemStack is, String SettingsName, NBTTagCompound data); + + /** + * returns the settings name provided by a pervious call to + * setMemoryCardContents, or "AppEng.GuiITooltip.Blank" if there was no + * previous call to setMemoryCardContents. + * + * @param is + * @return + */ + String getSettingsName(ItemStack is); + + /** + * @param is + * @return the NBT Data previously saved by setMemoryCardContents, or an + * empty NBTCompound + */ + NBTTagCompound getData(ItemStack is); + + /** + * notify the user of a outcome related to the memory card. + * + * @param player + * that used the card. + * @param settingsSaved + * which message to send. + */ + void notifyUser(EntityPlayer player, MemoryCardMessages msg); + +} diff --git a/src/main/java/appeng/api/implementations/items/ISpatialStorageCell.java b/src/main/java/appeng/api/implementations/items/ISpatialStorageCell.java new file mode 100644 index 00000000..fe16df38 --- /dev/null +++ b/src/main/java/appeng/api/implementations/items/ISpatialStorageCell.java @@ -0,0 +1,69 @@ +package appeng.api.implementations.items; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import appeng.api.implementations.TransitionResult; +import appeng.api.util.WorldCoord; + +/** + * Implemented on a {@link net.minecraft.item.Item} + */ +public interface ISpatialStorageCell +{ + + /** + * @param is + * @return true if this item is a spatial storage cell + */ + boolean isSpatialStorage(ItemStack is); + + /** + * @param is + * @return the maximum size of the spatial storage cell along any given axis + */ + int getMaxStoredDim(ItemStack is); + + /** + * @param is + * @return the world for this cell + */ + World getWorld(ItemStack is); + + /** + * get the currently stored size. + * + * @param is + * @return + */ + WorldCoord getStoredSize(ItemStack is); + + /** + * Minimum coordinates in its world for the storage cell. + * + * @param is + * @return + */ + WorldCoord getMin(ItemStack is); + + /** + * Maximum coordinates in its world for the storage cell. + * + * @param is + * @return + */ + WorldCoord getMax(ItemStack is); + + /** + * Perform a spatial swap with the contents of the cell, and the world. + * + * @param is + * @param w + * @param min + * @param max + * @param doTransition + * @return + */ + TransitionResult doSpatialTransition(ItemStack is, World w, WorldCoord min, WorldCoord max, boolean doTransition); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/implementations/items/IStorageCell.java b/src/main/java/appeng/api/implementations/items/IStorageCell.java new file mode 100644 index 00000000..425e5b19 --- /dev/null +++ b/src/main/java/appeng/api/implementations/items/IStorageCell.java @@ -0,0 +1,82 @@ +package appeng.api.implementations.items; + +import net.minecraft.item.ItemStack; +import appeng.api.storage.ICellWorkbenchItem; +import appeng.api.storage.data.IAEItemStack; + +/** + * Any item which implements this can be treated as an IMEInventory via + * Util.getCell / Util.isCell It automatically handles the internals and NBT + * data, which is both nice, and bad for you! + * + * Good cause it means you don't have to do anything, bad because you have + * little to no control over it. + * + * The standard AE implementation only provides 1-63 Types + * + */ +public interface IStorageCell extends ICellWorkbenchItem +{ + + /** + * If this returns something where N % 8 != 0 Then you will be shot on + * sight, or your car will explode, something like that least... + * + * @param cellItem + * @return numberofBytes + */ + int getBytes(ItemStack cellItem); + + /** + * Determines the number of bytes used for any type included on the cell. + * + * @param cellItem + * @return numberOfBytes + */ + int BytePerType(ItemStack cellItem); + + /** + * Must be between 1 and 63, indicates how many types you want to store on + * the item. + * + * @param cellItem + * @return numberOfTypes + */ + int getTotalTypes(ItemStack cellItem); + + /** + * Allows you to fine tune which items are allowed on a given cell, if you + * don't care, just return false; As the handler for this type of cell is + * still the default cells, the normal AE black list is also applied. + * + * @param cellItem + * @param requestedAddition + * @return true to preventAdditionOfItem + */ + boolean isBlackListed(ItemStack cellItem, IAEItemStack requestedAddition); + + /** + * Allows you to specify if this storage cell can be stored inside other + * storage cells, only set this for special items like the matter cannon + * that are not general purpose storage. + * + * @return true if the storage cell can be stored inside other storage + * cells, this is generally false, except for certain situations + * such as the matter cannon. + */ + boolean storableInStorageCell(); + + /** + * Allows an item to selectively enable or disable its status as a storage + * cell. + * + * @param i + * @return if the ItemStack should behavior as a storage cell. + */ + boolean isStorageCell(ItemStack i); + + /** + * @return drain in ae/t this storage cell will use. + */ + double getIdleDrain(); +} diff --git a/src/main/java/appeng/api/implementations/items/IStorageComponent.java b/src/main/java/appeng/api/implementations/items/IStorageComponent.java new file mode 100644 index 00000000..641ff429 --- /dev/null +++ b/src/main/java/appeng/api/implementations/items/IStorageComponent.java @@ -0,0 +1,30 @@ +package appeng.api.implementations.items; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +/** + * Implemented on a {@link net.minecraft.item.Item} + */ +public interface IStorageComponent +{ + + /** + * This isn't necessarily the same as if you make a storage cell out of it, + * but all of AE's default cells do it that way, its currently only used for + * the condenser. + * + * @param cellItem + * @return numberofBytes + */ + int getBytes(ItemStack is); + + /** + * Just true or false for the item stack. + * + * @param is + * @return + */ + boolean isStorageComponent(ItemStack is); + +} diff --git a/src/main/java/appeng/api/implementations/items/IUpgradeModule.java b/src/main/java/appeng/api/implementations/items/IUpgradeModule.java new file mode 100644 index 00000000..b950f5e1 --- /dev/null +++ b/src/main/java/appeng/api/implementations/items/IUpgradeModule.java @@ -0,0 +1,15 @@ +package appeng.api.implementations.items; + +import net.minecraft.item.ItemStack; +import appeng.api.config.Upgrades; + +public interface IUpgradeModule +{ + + /** + * @param itemstack + * @return null, or a valid upgrade type. + */ + Upgrades getType(ItemStack itemstack); + +} diff --git a/src/main/java/appeng/api/implementations/items/MemoryCardMessages.java b/src/main/java/appeng/api/implementations/items/MemoryCardMessages.java new file mode 100644 index 00000000..e40f563a --- /dev/null +++ b/src/main/java/appeng/api/implementations/items/MemoryCardMessages.java @@ -0,0 +1,9 @@ +package appeng.api.implementations.items; + +/** + * Status Results for use with {@link appeng.api.implementations.items.IMemoryCard} + */ +public enum MemoryCardMessages +{ + INVALID_MACHINE, SETTINGS_LOADED, SETTINGS_SAVED +} diff --git a/src/main/java/appeng/api/implementations/parts/IPartCable.java b/src/main/java/appeng/api/implementations/parts/IPartCable.java new file mode 100644 index 00000000..3cefe25f --- /dev/null +++ b/src/main/java/appeng/api/implementations/parts/IPartCable.java @@ -0,0 +1,53 @@ +package appeng.api.implementations.parts; + +import java.util.EnumSet; + +import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.networking.IGridHost; +import appeng.api.parts.BusSupport; +import appeng.api.parts.IPart; +import appeng.api.parts.IPartHost; +import appeng.api.util.AECableType; +import appeng.api.util.AEColor; + +/** + * Implemented on the {@link appeng.api.parts.IPart}s cable objects that can be placed at + * {@link net.minecraftforge.common.util.ForgeDirection}.UNKNWON in {@link appeng.api.parts.IPartHost}s + */ +public interface IPartCable extends IPart, IGridHost +{ + + /** + * does this cable support buses? + */ + BusSupport supportsBuses(); + + /** + * @return the current color of the cable. + */ + AEColor getCableColor(); + + /** + * @return the Cable type. + */ + AECableType getCableConnectionType(); + + /** + * Change the color of the cable, this should cost a small amount of dye, or + * something. + * + * @param newColor + * @return if the color change was successful. + */ + boolean changeColor(AEColor newColor); + + /** + * Change sides on the cables node. + * + * Called by AE, do not invoke. + * + * @param sides + */ + void setValidSides(EnumSet sides); + +} diff --git a/src/main/java/appeng/api/implementations/parts/IPartMonitor.java b/src/main/java/appeng/api/implementations/parts/IPartMonitor.java new file mode 100644 index 00000000..2bf93661 --- /dev/null +++ b/src/main/java/appeng/api/implementations/parts/IPartMonitor.java @@ -0,0 +1,18 @@ +package appeng.api.implementations.parts; + +import appeng.api.networking.IGridHost; +import appeng.api.parts.IPart; + +/** + * Implemented by all screen like parts provided by AE. + */ +public interface IPartMonitor extends IPart, IGridHost +{ + + /** + * @return if the device is online you should check this before providing + * any other information. + */ + boolean isPowered(); + +} diff --git a/src/main/java/appeng/api/implementations/parts/IPartStorageMonitor.java b/src/main/java/appeng/api/implementations/parts/IPartStorageMonitor.java new file mode 100644 index 00000000..b898700e --- /dev/null +++ b/src/main/java/appeng/api/implementations/parts/IPartStorageMonitor.java @@ -0,0 +1,25 @@ +package appeng.api.implementations.parts; + +import appeng.api.networking.IGridHost; +import appeng.api.parts.IPart; +import appeng.api.storage.data.IAEStack; + +/** + * The Storage monitor is a {@link appeng.api.parts.IPart} located on the sides of a IPartHost + */ +public interface IPartStorageMonitor extends IPartMonitor, IPart, IGridHost +{ + + /** + * @return the item being displayed on the storage monitor, in AEStack Form, can be either a IAEItemStack or an + * IAEFluidStack the quantity is important remember to use getStackSize() on the IAEStack, and not on the + * FluidStack/ItemStack acquired from it. + */ + IAEStack getDisplayed(); + + /** + * @return the current locked state of the Storage Monitor + */ + boolean isLocked(); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/implementations/tiles/IChestOrDrive.java b/src/main/java/appeng/api/implementations/tiles/IChestOrDrive.java new file mode 100644 index 00000000..76524f69 --- /dev/null +++ b/src/main/java/appeng/api/implementations/tiles/IChestOrDrive.java @@ -0,0 +1,40 @@ +package appeng.api.implementations.tiles; + +import appeng.api.networking.IGridHost; +import appeng.api.storage.ICellContainer; +import appeng.api.util.IOrientable; + +public interface IChestOrDrive extends ICellContainer, IGridHost, IOrientable +{ + + /** + * @return how many slots are available. Chest has 1, Drive has 10. + */ + int getCellCount(); + + /** + * 0 - cell is missing. + * + * 1 - green, + * + * 2 - orange, + * + * 3 - red + * + * @param slot + * @return status of the slot, one of the above indices. + */ + int getCellStatus(int slot); + + /** + * @return if the device is online you should check this before providing any other information. + */ + boolean isPowered(); + + /** + * @param slot + * @return is the cell currently blinking to show activity. + */ + boolean isCellBlinking(int slot); + +} diff --git a/src/main/java/appeng/api/implementations/tiles/ICrankable.java b/src/main/java/appeng/api/implementations/tiles/ICrankable.java new file mode 100644 index 00000000..b709e23d --- /dev/null +++ b/src/main/java/appeng/api/implementations/tiles/ICrankable.java @@ -0,0 +1,35 @@ +package appeng.api.implementations.tiles; + +import net.minecraftforge.common.util.ForgeDirection; + +/** + * Crank/Crankable API, + * + * Tiles that Implement this can receive power, from the crank, and have the + * crank placed on them. + * + * Tiles that access other tiles that implement this method can act as Cranks. + * + * This interface must be implemented by a tile entity. + */ +public interface ICrankable +{ + + /** + * Test if the crank can turn, return false if there is no work to be done. + * + * @return if crank should be allowed to turn. + */ + boolean canTurn(); + + /** + * The crank has completed one turn. + */ + void applyTurn(); + + /** + * @return true if the crank can attach on the given side. + */ + boolean canCrankAttach(ForgeDirection directionToCrank); + +} diff --git a/src/main/java/appeng/api/implementations/tiles/IMEChest.java b/src/main/java/appeng/api/implementations/tiles/IMEChest.java new file mode 100644 index 00000000..71a7ec3a --- /dev/null +++ b/src/main/java/appeng/api/implementations/tiles/IMEChest.java @@ -0,0 +1,8 @@ +package appeng.api.implementations.tiles; + +import appeng.api.networking.energy.IEnergySource; + +public interface IMEChest extends IChestOrDrive, ITileStorageMonitorable, IEnergySource +{ + +} diff --git a/src/main/java/appeng/api/implementations/tiles/ISegmentedInventory.java b/src/main/java/appeng/api/implementations/tiles/ISegmentedInventory.java new file mode 100644 index 00000000..6d001771 --- /dev/null +++ b/src/main/java/appeng/api/implementations/tiles/ISegmentedInventory.java @@ -0,0 +1,17 @@ +package appeng.api.implementations.tiles; + +import net.minecraft.inventory.IInventory; + +public interface ISegmentedInventory +{ + + /** + * Access an internal inventory, note, not all inventories contain real items, some may be ghost items, and treating + * them a real inventories will result in duplication. + * + * @param name + * @return + */ + IInventory getInventoryByName(String name); + +} diff --git a/src/main/java/appeng/api/implementations/tiles/ITileStorageMonitorable.java b/src/main/java/appeng/api/implementations/tiles/ITileStorageMonitorable.java new file mode 100644 index 00000000..0fa33e1e --- /dev/null +++ b/src/main/java/appeng/api/implementations/tiles/ITileStorageMonitorable.java @@ -0,0 +1,14 @@ +package appeng.api.implementations.tiles; + +import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.storage.IStorageMonitorable; + +/** + * Implemented on inventories that can share their inventories with other networks, best example, ME Interface. + */ +public interface ITileStorageMonitorable +{ + + IStorageMonitorable getMonitorable(ForgeDirection side); + +} diff --git a/src/main/java/appeng/api/implementations/tiles/IViewCellStorage.java b/src/main/java/appeng/api/implementations/tiles/IViewCellStorage.java new file mode 100644 index 00000000..ab926a4e --- /dev/null +++ b/src/main/java/appeng/api/implementations/tiles/IViewCellStorage.java @@ -0,0 +1,15 @@ +package appeng.api.implementations.tiles; + +import net.minecraft.inventory.IInventory; + +public interface IViewCellStorage +{ + + /** + * should contains at least 5 slot, the first 5 + * + * @return inventory with at least 5 slot + */ + IInventory getViewCellStorage(); + +} diff --git a/src/main/java/appeng/api/integration/IBeeComparison.java b/src/main/java/appeng/api/integration/IBeeComparison.java new file mode 100644 index 00000000..96946237 --- /dev/null +++ b/src/main/java/appeng/api/integration/IBeeComparison.java @@ -0,0 +1,22 @@ +package appeng.api.integration; + +import forestry.api.genetics.IIndividual; + +/** + * An interface to get access to the individual settings for AE's Internal Bee + * Comparison handler. + * + * Assessable via: ( IBeeComparison ) + * IAEItemStack.getTagCompound().getSpecialComparison() + * + * If you don't have the forestry API, just delete this file when using the API. + */ +public interface IBeeComparison +{ + + /** + * @return the Forestry IIndividual for this comparison object + */ + IIndividual getIndividual(); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/me/items/IAEChargeableItem.java b/src/main/java/appeng/api/me/items/IAEChargeableItem.java deleted file mode 100755 index 8619a8b7..00000000 --- a/src/main/java/appeng/api/me/items/IAEChargeableItem.java +++ /dev/null @@ -1,25 +0,0 @@ - -package appeng.api.me.items; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -/* - * A simple AE interface used internally for PowerRelay charging. - */ -public interface IAEChargeableItem { - - /* - * Return the amount of energy not used. - * - * if you return the same amount out, as was passed in, then it will consider charging done. - * - */ - public float addEnergy( ItemStack target, float energy ); - - /* - * Must return true for the target item for it to be considered a charageable item. - */ - public boolean isChargeable( ItemStack it ); - -} diff --git a/src/main/java/appeng/api/me/items/IAEWrench.java b/src/main/java/appeng/api/me/items/IAEWrench.java deleted file mode 100755 index 6abead7b..00000000 --- a/src/main/java/appeng/api/me/items/IAEWrench.java +++ /dev/null @@ -1,9 +0,0 @@ -package appeng.api.me.items; - -import net.minecraft.entity.player.EntityPlayer; - -public interface IAEWrench { - - boolean canWrench(EntityPlayer player, int x, int y, int z); - -} diff --git a/src/main/java/appeng/api/me/items/IMemoryCard.java b/src/main/java/appeng/api/me/items/IMemoryCard.java deleted file mode 100755 index 9e9a685e..00000000 --- a/src/main/java/appeng/api/me/items/IMemoryCard.java +++ /dev/null @@ -1,41 +0,0 @@ -package appeng.api.me.items; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -/** - * used to interact with memory card items. - */ -public interface IMemoryCard { - - /** - * returns true if the item is in fact a memory card. - * @param is - * @return - */ - boolean isMemoryCard( ItemStack is ); - - /** - * Configures the data stored on the memory card, the SettingsName, will be localized when displayed. - * @param is - * @param SettingsName - * @param data - * - tooltip - is a unlocalized string displayed after the settings name. - */ - void setMemoryCardContents( ItemStack is, String SettingsName, NBTTagCompound data ); - - /** - * returns the settings name provided previously by setMemoryCardContents, or "AppEng.GuiITooltip.Blank" if there is no settings. - * @param is - * @return - */ - String getSettingsName( ItemStack is ); - - /** - * returns the NBT Data previously saved by setMemoryCardContents, or an empty NBTCompound - * @param is - * @return - */ - NBTTagCompound getData( ItemStack is ); - -} diff --git a/src/main/java/appeng/api/me/items/ISpatialStorage.java b/src/main/java/appeng/api/me/items/ISpatialStorage.java deleted file mode 100755 index 4f4863c1..00000000 --- a/src/main/java/appeng/api/me/items/ISpatialStorage.java +++ /dev/null @@ -1,26 +0,0 @@ -package appeng.api.me.items; - -import appeng.api.WorldCoord; -import appeng.api.me.util.TransitionResult; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public interface ISpatialStorage { - - boolean isSpatialStorage( ItemStack is ); - - int getMaxStoredDim( ItemStack is ); - - World getWorld( ItemStack is ); - - WorldCoord getStoredSize( ItemStack is ); - - WorldCoord getMin( ItemStack is ); - - WorldCoord getMax( ItemStack is ); - - TransitionResult doSpatialTransition( ItemStack is, World w, WorldCoord min, WorldCoord max, boolean doTransition ); - - World createNewWorld(ItemStack is); - -} diff --git a/src/main/java/appeng/api/me/items/IStorageCell.java b/src/main/java/appeng/api/me/items/IStorageCell.java deleted file mode 100755 index 33968a71..00000000 --- a/src/main/java/appeng/api/me/items/IStorageCell.java +++ /dev/null @@ -1,55 +0,0 @@ -package appeng.api.me.items; - -import appeng.api.IAEItemStack; -import net.minecraft.item.ItemStack; - -/** - * Any item which implements this can be treated as an IMEInventory via Util.getCell / Util.isCell - * It automatically handles the internals and NBT data, which is both nice, and bad for you! - */ -public interface IStorageCell -{ - /** - * rv0 - If this returns something where N % 8 != 0 Then you will be shot on sight, or your car will explode, something like that least... - * @param cellItem - * @return numberofBytes - */ - int getBytes( ItemStack cellItem ); - - /** - * rv0 - Determines the number of bytes used for any type included on the cell. - * @param cellItem - * @return numberOfBytes - */ - int BytePerType( ItemStack iscellItem ); - - /** - * rv11 - Must be between 1 and 63, indicates how many types you want to store on the item. - * @param cellItem - * @return numberOfTypes - */ - int getTotalTypes( ItemStack cellItem ); - - /** - * rv11 - allows you to fine tune which items are allowed on a given cell, - * if you don't care, just return false; - * As the handler for this type of cell is still the default cells, the normal AE black list is also applied. - * @param cellItem - * @param requsetedAddition - * @return preventAdditionOfItem - */ - boolean isBlackListed( ItemStack cellItem, IAEItemStack requsetedAddition ); - - /** - * rv11 - allows you to specify if this storage cell can be stored inside other storage cells, only set this for special items like the matter cannon that are not general purpose storage. - * @return - */ - boolean storableInStorageCell(); - - /** - * rv14 - allows an item to selectivly enable or disable its status as a storage cell. - * @param i - * @return - */ - boolean isStorageCell( ItemStack i ); -} diff --git a/src/main/java/appeng/api/me/items/IStorageComponent.java b/src/main/java/appeng/api/me/items/IStorageComponent.java deleted file mode 100755 index f905373f..00000000 --- a/src/main/java/appeng/api/me/items/IStorageComponent.java +++ /dev/null @@ -1,21 +0,0 @@ -package appeng.api.me.items; - -import net.minecraft.item.ItemStack; - -public interface IStorageComponent { - - /** - * rv11 - This isn't necessarily the same as if you make a storage cell out of it, but all of AE's default cells do it that way, its currently only used for the condenser. - * @param cellItem - * @return numberofBytes - */ - int getBytes( ItemStack is ); - - /** - * rv11 - just true or false for the item stack. - * @param is - * @return - */ - boolean isStorageComponent( ItemStack is ); - -} diff --git a/src/main/java/appeng/api/me/tiles/IAssemblerMB.java b/src/main/java/appeng/api/me/tiles/IAssemblerMB.java deleted file mode 100755 index 9b7cf72a..00000000 --- a/src/main/java/appeng/api/me/tiles/IAssemblerMB.java +++ /dev/null @@ -1,20 +0,0 @@ -package appeng.api.me.tiles; - -import appeng.api.WorldCoord; -import appeng.api.me.util.IAssemblerCluster; - -public interface IAssemblerMB { - - /** - * Do this: - * return new WorldCoord( TileEntity.xCoord, TileEntity.yCoord, TileEntity.zCoord ); - */ - public WorldCoord getLocation(); - public IAssemblerCluster getCluster(); - public void updateStatus( IAssemblerCluster ac ); - public boolean isComplete(); - - void calculateMultiblock( long instanceCalc ); - public long markViewed(long inst); - -} diff --git a/src/main/java/appeng/api/me/tiles/IAssemblerPatternProvider.java b/src/main/java/appeng/api/me/tiles/IAssemblerPatternProvider.java deleted file mode 100755 index d8a5f53b..00000000 --- a/src/main/java/appeng/api/me/tiles/IAssemblerPatternProvider.java +++ /dev/null @@ -1,11 +0,0 @@ -package appeng.api.me.tiles; - -import appeng.api.me.util.ICraftingPattern; - -/** - * Both useless and incredibly useful, maybe... - */ -public interface IAssemblerPatternProvider -{ - public ICraftingPattern provideAssemblerPattern(); -} diff --git a/src/main/java/appeng/api/me/tiles/ICellContainer.java b/src/main/java/appeng/api/me/tiles/ICellContainer.java deleted file mode 100755 index 40481a5e..00000000 --- a/src/main/java/appeng/api/me/tiles/ICellContainer.java +++ /dev/null @@ -1,24 +0,0 @@ -package appeng.api.me.tiles; - -import java.util.List; - -import appeng.api.me.util.IMEInventoryHandler; - -/** - * Represents a tile that contributes to storage, such as a ME Chest, or ME Drive. - * - * Remember to trigger the appropriate storage update vents, when your getCellArray Changes. * - */ -public interface ICellContainer { - - /** - * Inventory of the tile for use with ME, should always return an valid list, never NULL. - */ - List getCellArray(); - - /** - * the storage's priority. - */ - int getPriority(); - -} diff --git a/src/main/java/appeng/api/me/tiles/ICellProvider.java b/src/main/java/appeng/api/me/tiles/ICellProvider.java deleted file mode 100755 index e65d09ad..00000000 --- a/src/main/java/appeng/api/me/tiles/ICellProvider.java +++ /dev/null @@ -1,23 +0,0 @@ -package appeng.api.me.tiles; - -import appeng.api.me.util.IMEInventoryHandler; - -/** - * Both useless and incredibly useful, maybe... - */ -public interface ICellProvider -{ - /** - * consume power to add an item to the storage system. - * @param items - * @param multiplier - * @return - */ - public int usePowerForAddition( int items, int multiplier ); - - /** - * returns a ME Inventory for interaction. - */ - public IMEInventoryHandler provideCell(); - -} diff --git a/src/main/java/appeng/api/me/tiles/IColoredMETile.java b/src/main/java/appeng/api/me/tiles/IColoredMETile.java deleted file mode 100755 index 2c54757d..00000000 --- a/src/main/java/appeng/api/me/tiles/IColoredMETile.java +++ /dev/null @@ -1,68 +0,0 @@ -package appeng.api.me.tiles; - -import net.minecraftforge.common.ForgeDirection; - -/** - * Used to signify which color a particular IGridTileEntity or IGridMachine is, you must implement both, if you wish to have color bias. - */ -public interface IColoredMETile -{ - /** - * Named Colors by int - */ - public static String[] Colors = { - "Blue", - "Black", - "White", - "Brown", - "Red", - "Yellow", - "Green" - }; - - public static int[] ColorValues = { - 0x514AFF, - 0x666666, - 0xDBDBDB, - 0x724E35, - 0xFF003C, - 0xFFC651, - 0x7CFF4A - }; - - public static int[] ColorValuesBright = { - 0xCAEAFC, - 0xE7E7E7, - 0xFCFCFC, - 0xD5AD91, - 0xFCECF0, - 0xFCF2C7, - 0xDBFCCF - }; - - /** - * Fluix Colored, color for isColored() == false - */ - public static String ClearName = "Clear"; - public static int ClearColor = 0x895CA8; - public static int ClearColorBright = 0xBFADD8; - - /** - * return true, if your block has a color, or false, if it dosn't. - * this allows you to have a colored block that can pretend to be colorless. - * @return true, if colored, false if not. - */ - boolean isColored( ForgeDirection dir ); - - /** - * Change the color, AE dosn't call this except for its own blocks, its simply included for completeness. - * @param offset - */ - void setColor( int offset ); - - /** - * which color is this tile? - * @return index into the above ColorsList. - */ - int getColor(); -} diff --git a/src/main/java/appeng/api/me/tiles/IConfigureableTile.java b/src/main/java/appeng/api/me/tiles/IConfigureableTile.java deleted file mode 100755 index fbaa38de..00000000 --- a/src/main/java/appeng/api/me/tiles/IConfigureableTile.java +++ /dev/null @@ -1,28 +0,0 @@ -package appeng.api.me.tiles; - -import java.util.List; - -/** - * Some ME Tiles can be configured, generally via interface, but these let you do this programatically. - */ -public interface IConfigureableTile { - - /** Switches configuration to next option... ( returns new configuration. ) */ - String prevConfiguration(String name); - - /** Switches configuration to next option... ( returns new configuration. ) */ - String nextConfiguration(String name); - - /** Gets a list off all the configurations... */ - List getConfigurations(); - - /** Gets the options of a particular configuration. */ - List getConfiguationOptions( String name ); - - /** Set a configuration to a specific option... ( returns the old one. ) */ - String setConfiguration(String name, String value); - - /** The the current value for a configuration. */ - String getConfiguration(String name); - -} diff --git a/src/main/java/appeng/api/me/tiles/IConnectionSensitive.java b/src/main/java/appeng/api/me/tiles/IConnectionSensitive.java deleted file mode 100755 index 723401c1..00000000 --- a/src/main/java/appeng/api/me/tiles/IConnectionSensitive.java +++ /dev/null @@ -1,11 +0,0 @@ -package appeng.api.me.tiles; - -import java.util.Set; - -import net.minecraftforge.common.ForgeDirection; - -public interface IConnectionSensitive { - - void onMEConnectionsChanged( Set connections, Set visualConnections ); - -} diff --git a/src/main/java/appeng/api/me/tiles/ICraftingTracker.java b/src/main/java/appeng/api/me/tiles/ICraftingTracker.java deleted file mode 100755 index 779ea903..00000000 --- a/src/main/java/appeng/api/me/tiles/ICraftingTracker.java +++ /dev/null @@ -1,10 +0,0 @@ -package appeng.api.me.tiles; - -import appeng.api.me.util.ICraftingPattern; -import appeng.api.me.util.ITileCraftingProvider; - -public interface ICraftingTracker { - - void addCraftingOption( ITileCraftingProvider provider, ICraftingPattern api ); - -} diff --git a/src/main/java/appeng/api/me/tiles/IDirectionalMETile.java b/src/main/java/appeng/api/me/tiles/IDirectionalMETile.java deleted file mode 100755 index 1cccdc63..00000000 --- a/src/main/java/appeng/api/me/tiles/IDirectionalMETile.java +++ /dev/null @@ -1,20 +0,0 @@ -package appeng.api.me.tiles; - -import net.minecraftforge.common.ForgeDirection; - -/** - * Used to signify which directions a particular IGridTileEntity or IGridMachine can connect to/from, - * you must implement both, if you wish to have this functionality. - * - * Example Buses, that do not conenct in the direction of the bus. - */ -public interface IDirectionalMETile -{ - - /** - * return true if this tile can connect in a specific direction. - * @param dir - * @return true, if it can connect. - */ - boolean canConnect( ForgeDirection dir ); -} diff --git a/src/main/java/appeng/api/me/tiles/IExtendedCellProvider.java b/src/main/java/appeng/api/me/tiles/IExtendedCellProvider.java deleted file mode 100755 index 5df4532b..00000000 --- a/src/main/java/appeng/api/me/tiles/IExtendedCellProvider.java +++ /dev/null @@ -1,13 +0,0 @@ -package appeng.api.me.tiles; - -import appeng.api.me.util.IMEInventoryHandler; - -/** - * Both useless and incredibly useful, maybe... - */ -public interface IExtendedCellProvider extends ICellProvider -{ - - public IMEInventoryHandler provideCell( String Filter ); - -} diff --git a/src/main/java/appeng/api/me/tiles/IFulllyOptionalMETile.java b/src/main/java/appeng/api/me/tiles/IFulllyOptionalMETile.java deleted file mode 100755 index 664bd228..00000000 --- a/src/main/java/appeng/api/me/tiles/IFulllyOptionalMETile.java +++ /dev/null @@ -1,11 +0,0 @@ -package appeng.api.me.tiles; - -/** - * Cables will disconnect if its not enabled, - * this means that they will fail to appear connected, example - MAC - */ -public interface IFulllyOptionalMETile extends IOptionalMETile { - - boolean isSeperated(); - -} diff --git a/src/main/java/appeng/api/me/tiles/IGridMachine.java b/src/main/java/appeng/api/me/tiles/IGridMachine.java deleted file mode 100755 index 383902dd..00000000 --- a/src/main/java/appeng/api/me/tiles/IGridMachine.java +++ /dev/null @@ -1,25 +0,0 @@ -package appeng.api.me.tiles; - -/** - * Allows you to drain energy via ME Cables, if you only care if the grid is powered you only need IGridTileEntity. - */ -public abstract interface IGridMachine extends IGridTileEntity -{ - /** - * how much power this entity drains to run constantly. - */ - public float getPowerDrainPerTick(); - - /** - * when a network is reset, this is trigger false, until booting is complete, please respect this and disable - * network related activity during that time. - * @param isReady - */ - public void setNetworkReady( boolean isReady ); - - /** - * return true, when the machine is properly powered, the network is ready, and any other conditions required for running are met. - * @return - */ - public boolean isMachineActive(); -} diff --git a/src/main/java/appeng/api/me/tiles/IGridTeleport.java b/src/main/java/appeng/api/me/tiles/IGridTeleport.java deleted file mode 100755 index 6703b4e1..00000000 --- a/src/main/java/appeng/api/me/tiles/IGridTeleport.java +++ /dev/null @@ -1,11 +0,0 @@ -package appeng.api.me.tiles; - -import appeng.api.DimentionalCoord; - -/** - * Create a connection to a normally not connected tile - */ -public interface IGridTeleport -{ - DimentionalCoord[] findRemoteSide(); -} diff --git a/src/main/java/appeng/api/me/tiles/IGridTileEntity.java b/src/main/java/appeng/api/me/tiles/IGridTileEntity.java deleted file mode 100755 index 7b956302..00000000 --- a/src/main/java/appeng/api/me/tiles/IGridTileEntity.java +++ /dev/null @@ -1,49 +0,0 @@ -package appeng.api.me.tiles; - -import net.minecraft.world.World; -import appeng.api.WorldCoord; -import appeng.api.me.util.IGridInterface; - -/** - * Basic ME Grid Interface, informs you of the Grid power status, and other details. - */ -public abstract interface IGridTileEntity -{ - /** - * Do this: - * return new WorldCoord( TileEntity.xCoord, TileEntity.yCoord, TileEntity.zCoord ); - */ - public abstract WorldCoord getLocation(); - - /** - * If your tile entity is valid return true. - */ - public boolean isValid(); - - /** - * Informs you of either true or false. - * if the power feed has stopped, or been continued, only called when changes happens, or when grid updates happen. - */ - public abstract void setPowerStatus(boolean hasPower); - - /** - * Yes if the device has a powered status. - */ - public abstract boolean isPowered(); - - /** - * Return your last grid you got via setGrid. - */ - public IGridInterface getGrid(); - - /** - * Informs you of your new grid, YOU MUST return this via getGrid. - * Store for later. - */ - public void setGrid(IGridInterface gi); - - /** - * Return worldObj - */ - public World getWorld(); -} diff --git a/src/main/java/appeng/api/me/tiles/ILocateable.java b/src/main/java/appeng/api/me/tiles/ILocateable.java deleted file mode 100755 index 18417876..00000000 --- a/src/main/java/appeng/api/me/tiles/ILocateable.java +++ /dev/null @@ -1,10 +0,0 @@ -package appeng.api.me.tiles; - -public interface ILocateable -{ - /** - * returns the serial for a locateable object. - * @return - */ - long getLocatableSerial(); -} diff --git a/src/main/java/appeng/api/me/tiles/IMEPowerStorage.java b/src/main/java/appeng/api/me/tiles/IMEPowerStorage.java deleted file mode 100755 index f92b3e44..00000000 --- a/src/main/java/appeng/api/me/tiles/IMEPowerStorage.java +++ /dev/null @@ -1,55 +0,0 @@ -package appeng.api.me.tiles; - -import appeng.api.config.ItemFlow; - -/** - * Used to access information about AE's various power accepting blocks for monitoring purposes. - * - */ -public interface IMEPowerStorage { - - /** - * ME power storage asset, pass the amount you want to use, and what you want to use it for. - * @param use - * @param for_what - * @return if you can use it. - */ - boolean useMEEnergy( float use, String for_what ); - - /** - * Add energy to an ME Power storage. - * @param amt that was not added to storage myEnergy = addMEPower( myEnergy ); // pushes your power into the network. - * @return - */ - public double addMEPower( double amt ); - - /** - * returns the current maximum power ( this can change :P ) - */ - public double getMEMaxPower(); - - /** - * returns the current AE Power Level, this may exceed getMEMaxPower() - */ - public double getMECurrentPower(); - - /** - * Checked on network reset to see if your block can be used as a public power storage ( use getPowerFlow to control the behavior ) - * @return - */ - public boolean isPublicPowerStorage(); - - /** - * Control the power flow by telling what the controller can do, either add? or subtract? or both! - * @return - */ - public ItemFlow getPowerFlow(); - - /** - * Drains power from this storage, it returns the power it was able to obtain. - * @param amt - amount of power to drain. - * @return amount of power obtained. - */ - double drainMEPower(double amt); - -} diff --git a/src/main/java/appeng/api/me/tiles/INonSignalBlock.java b/src/main/java/appeng/api/me/tiles/INonSignalBlock.java deleted file mode 100755 index eb0fb801..00000000 --- a/src/main/java/appeng/api/me/tiles/INonSignalBlock.java +++ /dev/null @@ -1,9 +0,0 @@ -package appeng.api.me.tiles; - -/** - * By simply implenting this, the networks can be become aware of a block they touch, but they don't propogate signal or really belong to a network. - * Not sure what it would be used for to be honest beyond the power relay. - */ -public interface INonSignalBlock { - -} diff --git a/src/main/java/appeng/api/me/tiles/IOptionalMETile.java b/src/main/java/appeng/api/me/tiles/IOptionalMETile.java deleted file mode 100755 index ff0d525d..00000000 --- a/src/main/java/appeng/api/me/tiles/IOptionalMETile.java +++ /dev/null @@ -1,14 +0,0 @@ -package appeng.api.me.tiles; - -/** - * Cables will connect, but signal will not propagate. ( IFulllyOptionalMETile disconnects ) - */ -public interface IOptionalMETile { - - /** - * if false, the signal will not propigate via this tile, remember to use connectivity events. - * @return - */ - public boolean isEnabled(); - -} diff --git a/src/main/java/appeng/api/me/tiles/IOrientableTile.java b/src/main/java/appeng/api/me/tiles/IOrientableTile.java deleted file mode 100755 index 26336736..00000000 --- a/src/main/java/appeng/api/me/tiles/IOrientableTile.java +++ /dev/null @@ -1,26 +0,0 @@ -package appeng.api.me.tiles; - -import net.minecraftforge.common.ForgeDirection; - -/** - * Please note that none of these methods will cause a block update, - * if you use set ori/spin/cycle, must mark the block for update if it was already sent to the client. - */ -public interface IOrientableTile { - - // returns the main direction for rotation. - ForgeDirection getPrimaryOrientation(); - - // used for up or down orientation to spin the tile around, 0 - 3 clockwise ( probobly ) - int getSpin(); - - // returns the main direction for rotation. - void setPrimaryOrientation( ForgeDirection s ); - - // used for up or down orientation. - void setSpin( int spin ); - - // acts like a wrench was used on it, if a wrench does nothing, this does nothing. - void cycleOrientation(); - -} diff --git a/src/main/java/appeng/api/me/tiles/IPriorityTile.java b/src/main/java/appeng/api/me/tiles/IPriorityTile.java deleted file mode 100755 index b4243a3f..00000000 --- a/src/main/java/appeng/api/me/tiles/IPriorityTile.java +++ /dev/null @@ -1,17 +0,0 @@ -package appeng.api.me.tiles; - -public interface IPriorityTile -{ - /** - * gets the current priroity, can be negitive or positive. - * implemented by storage systems, and is used for sorting. - * @return - */ - int getPriority(); - - /** - * change the priority. - * @param p - */ - void setPriority( int p ); -} diff --git a/src/main/java/appeng/api/me/tiles/IStorageAware.java b/src/main/java/appeng/api/me/tiles/IStorageAware.java deleted file mode 100755 index c5d7c433..00000000 --- a/src/main/java/appeng/api/me/tiles/IStorageAware.java +++ /dev/null @@ -1,14 +0,0 @@ -package appeng.api.me.tiles; - -import appeng.api.IItemList; - -@Deprecated -public interface IStorageAware { - - /** - * if your GridTile Implements this interface, the Network will notify it of changes, and send you a list of the contents so you can updates statues, WAY BETTER then polling. - * @param iss - */ - void onNetworkInventoryChange( IItemList iss ); - -} diff --git a/src/main/java/appeng/api/me/tiles/IStorageMonitor.java b/src/main/java/appeng/api/me/tiles/IStorageMonitor.java deleted file mode 100755 index f8886b10..00000000 --- a/src/main/java/appeng/api/me/tiles/IStorageMonitor.java +++ /dev/null @@ -1,20 +0,0 @@ -package appeng.api.me.tiles; - -import appeng.api.IAEItemStack; - -public interface IStorageMonitor { - - /** - * Get the item being displayed on the storage monitor, in AEItemstack Form, you can use that to get the equivalent MC ItemStack, if you need it. - * If the quantity is important remember to use getStackSize() on the IAEItemStack,and not ItemStack.stackSize - * @return - */ - IAEItemStack getItem(); - - /** - * Get the current locked state of the access terminal. - * @return - */ - boolean isLocked(); - -} diff --git a/src/main/java/appeng/api/me/tiles/ITileCable.java b/src/main/java/appeng/api/me/tiles/ITileCable.java deleted file mode 100755 index ed64d54d..00000000 --- a/src/main/java/appeng/api/me/tiles/ITileCable.java +++ /dev/null @@ -1,7 +0,0 @@ -package appeng.api.me.tiles; - -public interface ITileCable { - - public boolean coveredConnections(); - -} diff --git a/src/main/java/appeng/api/me/tiles/ITileIOCable.java b/src/main/java/appeng/api/me/tiles/ITileIOCable.java deleted file mode 100755 index d63dd2be..00000000 --- a/src/main/java/appeng/api/me/tiles/ITileIOCable.java +++ /dev/null @@ -1,30 +0,0 @@ -package appeng.api.me.tiles; - -import net.minecraft.inventory.IInventory; - -/** - * used to allow you to inspect, and configure a Export / Import / Storage Bus - * Export and Import buses also implement IConfigureableTile, which may be of interest. - */ -public interface ITileIOCable { - - public enum Version { - Basic, Precision, Fuzzy - }; - - /** - * returns one of the above, to indicate which version of the bus it is. - */ - Version getVersion(); - - /** - * Returns an IInventory that represents the configuration. - */ - IInventory getConfiguration(); - - /** - * Returns the name of the bus.. - */ - String getName(); - -} diff --git a/src/main/java/appeng/api/me/tiles/ITileInterfaceApi.java b/src/main/java/appeng/api/me/tiles/ITileInterfaceApi.java deleted file mode 100755 index f4a2855b..00000000 --- a/src/main/java/appeng/api/me/tiles/ITileInterfaceApi.java +++ /dev/null @@ -1,78 +0,0 @@ -package appeng.api.me.tiles; - -import java.util.List; - -import net.minecraft.item.ItemStack; -import appeng.api.me.util.IMEInventory; -import appeng.api.me.util.InterfaceCraftingResponse; - -/** - * Implemented by the ME Interface - * give direct access to some more complicated logic, in a simpler way, was used for earily LP integration. - */ -public interface ITileInterfaceApi { - - /** - * how much space is available. - * @param i - * @param MaxNeeded, a cut off where you stop caring - * @return totalAmountNeeded - */ - int apiCurrentAvailableSpace(ItemStack i, int MaxNeeded); - - /** - * Attempt to extract an item from the network. - * @param i, item to extract. - * @param doExtract, if you don't its just a simulation. - * @return anyExtracted Items, or null - */ - ItemStack apiExtractNetworkItem(ItemStack i, boolean doExtract); - - /** - * Adds an item to the network - * @param i - * @param doAdd, or simulate - * @return any items that couldn't be added, or nul - */ - ItemStack apiAddNetworkItem(ItemStack i, boolean doAdd); - - /** - * returns a list of ItemStacks that are contined in the network. - * @return - */ - List apiGetNetworkContents(); - - /** - * get access to the networks IMEInventory. - * @return - */ - IMEInventory getApiArray(); - - /** - * get a list of items that can be crafted by the network. - * @return - */ - List getCraftingOptions(); - - /** - * get access to the crafting patterns. - * @param req - * @return - */ - List findCraftingPatterns( ItemStack req ); - - /** - * issue a new crafting request. - * @param req - * @param enableRecursive - * @return - */ - InterfaceCraftingResponse requestCrafting( ItemStack req, boolean enableRecursive ); - - /** - * if there is anything at all available it returns true. - * @return - */ - boolean containsItems(); - -} diff --git a/src/main/java/appeng/api/me/tiles/ITilePushable.java b/src/main/java/appeng/api/me/tiles/ITilePushable.java deleted file mode 100755 index 8d98b6f4..00000000 --- a/src/main/java/appeng/api/me/tiles/ITilePushable.java +++ /dev/null @@ -1,30 +0,0 @@ -package appeng.api.me.tiles; - -import net.minecraft.item.ItemStack; - -/** - * An IPushable should return what dosn't fit, so that the crafting request cannot complete, - * stalling the action and saving your resources. - */ -public interface ITilePushable -{ - /** - * is this pushable busy? - * @return - */ - boolean isBusy(); - - /** - * Attempt to send an item. - * @param out - * @return - */ - ItemStack pushItem( ItemStack out ); - - /** - * Test if a push is possible. - * @param out - * @return - */ - boolean canPushItem(ItemStack out); -} diff --git a/src/main/java/appeng/api/me/tiles/InterfaceCraftingPattern.java b/src/main/java/appeng/api/me/tiles/InterfaceCraftingPattern.java deleted file mode 100755 index 3ba69b43..00000000 --- a/src/main/java/appeng/api/me/tiles/InterfaceCraftingPattern.java +++ /dev/null @@ -1,19 +0,0 @@ -package appeng.api.me.tiles; - -import java.util.List; - -import net.minecraft.item.ItemStack; - -public class InterfaceCraftingPattern { - - /** - * list of all the inputs. - */ - public List Inputs; - - /** - * the output of the pattern. - */ - public ItemStack Output; - -} diff --git a/src/main/java/appeng/api/me/util/Grid.java b/src/main/java/appeng/api/me/util/Grid.java deleted file mode 100755 index 74a81349..00000000 --- a/src/main/java/appeng/api/me/util/Grid.java +++ /dev/null @@ -1,84 +0,0 @@ -package appeng.api.me.util; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import appeng.api.me.tiles.IGridTileEntity; - -/** - * ME Network, aka Grid related features and functionality. - */ -public class Grid -{ - /** - * Attempts to find a grid interface for the specified location. - * @param w - * @param x - * @param y - * @param z - * @return interfaceForGrid - */ - public static IGridInterface getGridInterface(World w, int x, int y, int z) - { - IGridTileEntity te = getGridEntity(w, x, y, z); - - if (te != null) - { - return te.getGrid(); - } - - return null; - } - - /** - * Simple test to see if the tile at the specified location is in fact a grid entity. - * @param w - * @param x - * @param y - * @param z - * @return isTileGridEntity - */ - public static boolean isGridEntity(World w, int x, int y, int z) - { - return getGridEntity(w, x, y, z) != null; - } - - /** - * Returns the grid entity at the given location, or null if its not a grid entity. - * @param w - * @param x - * @param y - * @param z - * @return gridEntity - */ - public static IGridTileEntity getGridEntity(World w, int x, int y, int z) - { - TileEntity te = w.getBlockTileEntity(x, y, z); - - if (te instanceof IGridTileEntity) - { - return (IGridTileEntity)te; - } - - return null; - } - - /** - * Tests if the given grid entity is on a Network. - * @param w - * @param x - * @param y - * @param z - * @return isOnNetwork - */ - public static boolean isOnGrid(World w, int x, int y, int z) - { - IGridTileEntity te = getGridEntity(w, x, y, z); - - if (te != null) - { - return te.getGrid() != null; - } - - return false; - } -} diff --git a/src/main/java/appeng/api/me/util/IAssemblerCluster.java b/src/main/java/appeng/api/me/util/IAssemblerCluster.java deleted file mode 100755 index 39902290..00000000 --- a/src/main/java/appeng/api/me/util/IAssemblerCluster.java +++ /dev/null @@ -1,37 +0,0 @@ -package appeng.api.me.util; - -import net.minecraft.tileentity.TileEntity; - -/** - * Definition for a MAC - * - */ -public interface IAssemblerCluster { - - /** - * cycles the cpus, should be called once a tick, if called more, crafting will accelerate. - */ - public void cycleCpus(); - - /** - * Tells the MAC one of the cpus was used. - */ - void addCraft(); - - /** - * is there a CPU available for Crafting? - * @return hasCPUReady - */ - boolean canCraft(); - - /** - * Gets a TileAssembler from the MAC - * @param assemblerOffset - * @return TileEntity for that Assembler or Null - */ - TileEntity getAssembler( int assemblerOffset ); - - public int getLastOffset(); - - public void setLastOffset( int x ); -} diff --git a/src/main/java/appeng/api/me/util/IConfigManager.java b/src/main/java/appeng/api/me/util/IConfigManager.java deleted file mode 100755 index 42f3ae4c..00000000 --- a/src/main/java/appeng/api/me/util/IConfigManager.java +++ /dev/null @@ -1,10 +0,0 @@ -package appeng.api.me.util; - -import appeng.api.config.IConfigEnum; -import appeng.api.me.tiles.IConfigureableTile; - -public interface IConfigManager extends IConfigureableTile -{ - - IConfigEnum getSetting( String sName ); -} diff --git a/src/main/java/appeng/api/me/util/ICraftRequest.java b/src/main/java/appeng/api/me/util/ICraftRequest.java deleted file mode 100755 index 2812e514..00000000 --- a/src/main/java/appeng/api/me/util/ICraftRequest.java +++ /dev/null @@ -1,9 +0,0 @@ -package appeng.api.me.util; - -/** - * Pretty much just a place holder right now - * - */ -public interface ICraftRequest { - -} diff --git a/src/main/java/appeng/api/me/util/ICraftWatcher.java b/src/main/java/appeng/api/me/util/ICraftWatcher.java deleted file mode 100755 index 2ba84108..00000000 --- a/src/main/java/appeng/api/me/util/ICraftWatcher.java +++ /dev/null @@ -1,12 +0,0 @@ -package appeng.api.me.util; - -/** - * Not used. - * - */ -public interface ICraftWatcher { - - void markChainCrafted(); - void markComplete( ICraftRequest cr ); - -} diff --git a/src/main/java/appeng/api/me/util/ICraftingPattern.java b/src/main/java/appeng/api/me/util/ICraftingPattern.java deleted file mode 100755 index 13a91f30..00000000 --- a/src/main/java/appeng/api/me/util/ICraftingPattern.java +++ /dev/null @@ -1,53 +0,0 @@ -package appeng.api.me.util; - -import java.util.List; - -import appeng.api.IItemList; -import appeng.api.me.tiles.ITilePushable; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -/** - * this class can be implemented if you wish to implement a TileCraftingProvider. - */ -public interface ICraftingPattern -{ - /** - * returns the outcome, MUST have a value. - * @return - */ - ItemStack getOutput(); - - /** - * Returns a condensed list of requirements. - * - * Example: sticks, will return a single stack of 2, rather then two stacks of 1. - * The same Item will not show more than one stack. - */ - public List getRequirements(); - - /** - * returns a list of all providers, called by AE - * @return - */ - List getProviders(); - - /** - * adds a provider to the pattern, called by AE - * @param a - */ - void addProviders(ITileCraftingProvider a); - - /** - * Compare to Patterns, make sure you check your class types. - * @param obj - * @return - */ - @Override - public boolean equals(Object obj); - -} - diff --git a/src/main/java/appeng/api/me/util/ICraftingPatternMAC.java b/src/main/java/appeng/api/me/util/ICraftingPatternMAC.java deleted file mode 100755 index 5c592893..00000000 --- a/src/main/java/appeng/api/me/util/ICraftingPatternMAC.java +++ /dev/null @@ -1,52 +0,0 @@ -package appeng.api.me.util; - -import java.util.List; - -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.world.World; -import appeng.api.IItemList; - -/** - * Interact with the internals of assembler patterns, get this via Util.getAssemblerPattern(...) - * - * Do not implement this version, implement ICraftingPattern - * - */ -public interface ICraftingPatternMAC extends ICraftingPattern { - - /** - * Encode a pattern. - * craftingMatrix - accepts a 3x3 grid of ItemStacks and Nulls. - * output - accepts a single ItemStack, NEVER SEND NULL - */ - void encodePattern(ItemStack[] craftingMatrix, ItemStack output); - - /** - * I have no idea what the World is for, its just part of IRecipe... - */ - boolean isCraftable(World w); - - /** Returns true if there is a pattern encoded. */ - boolean isEncoded(); - - IAssemblerCluster getCluster(); - - /** Returns a 3x3 matrix of nulls or ItemStacks, or null if it is not included. */ - ItemStack[] getCraftingMatrix(); - - /** - * Same as getCraftingMatrix(), but gets a crafting inventory for real crafting. - * - * Item pool is optional, null will work, but it won't be able to edit items... - */ - InventoryCrafting getCraftingInv( World w, IMEInventory itemPool, List missing, List used, IItemList all ); - - /** returns the output of the pattern */ - ItemStack getRecipeOutput( InventoryCrafting ic, World w ); - - /** returns the recipe for the patterns */ - IRecipe getMatchingRecipe( InventoryCrafting ic, World w ); - -} diff --git a/src/main/java/appeng/api/me/util/IGridCache.java b/src/main/java/appeng/api/me/util/IGridCache.java deleted file mode 100755 index 3dce582b..00000000 --- a/src/main/java/appeng/api/me/util/IGridCache.java +++ /dev/null @@ -1,46 +0,0 @@ -package appeng.api.me.util; - -import net.minecraft.nbt.NBTTagCompound; - -/** - * - * Allows you to cache information on the grid, for usage later, its up to you how you want to deal with saving/loading/resetting. - * - * Any Class that implements this, should have a default constructor that takes no arguments. - * - * Register this with Util.getAppEngApi().registerGridCache( MyGridCache.class ); - * - */ -public interface IGridCache { - - /** - * Called each time a network is reset ( changed ), the grid will persist your classes instance, but call this method. - * @param grid - */ - void reset( IGridInterface grid ); - - /** - * Called each tick for the controller, allows you to have active network wide behaviors. - * @param grid - */ - void onUpdateTick( IGridInterface grid ); - - /** - * used to uniquely identify your cache when saving/loading - * @return - */ - String getCacheName(); - - /** - * Save your caches state if necessary, if no saving is required, return null. - * @return - */ - NBTTagCompound savetoNBTData(); - - /** - * Load save cache data, this is called when a controller is loaded with previously saved data if there was no data, data will be an empty tag. - * @param data - */ - void loadfromNBTData( NBTTagCompound data ); - -} diff --git a/src/main/java/appeng/api/me/util/IGridInterface.java b/src/main/java/appeng/api/me/util/IGridInterface.java deleted file mode 100755 index d4d9a594..00000000 --- a/src/main/java/appeng/api/me/util/IGridInterface.java +++ /dev/null @@ -1,241 +0,0 @@ -package appeng.api.me.util; - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import appeng.api.IAEItemStack; -import appeng.api.TileRef; -import appeng.api.exceptions.AppEngTileMissingException; -import appeng.api.me.tiles.IGridMachine; -import appeng.api.me.tiles.IGridTileEntity; -import appeng.api.me.tiles.ITilePushable; -import appeng.api.networkevents.MENetworkEvent; -import appeng.api.networkevents.MENetworkPowerStorage; - -/** - * Lets you access network related features. You will mostly care about "getCellArray()" which returns the IMEInventory for the entire network... - */ -public interface IGridInterface -{ - /** - * Issue a new crafting request. - * @param whatToCraft - * @param showInMonitor - * @param enableRecursion - * @return the ICraftRequest - * @throws AppEngTileMissingException - */ - public ICraftRequest craftingRequest( ItemStack whatToCraft, boolean showInMonitor, boolean enableRecursion ) throws AppEngTileMissingException; - - /** - * deprecated version of creaftingRequest. - * @param what - * @return - * @throws AppEngTileMissingException - */ - public ICraftRequest craftingRequest( ItemStack what ) throws AppEngTileMissingException; - - /** - * opens the crafting gui. - * @param pmp - * @param gte - * @param s - * @throws AppEngTileMissingException - */ - public void craftGui( EntityPlayerMP pmp, IGridTileEntity gte, ItemStack s ) throws AppEngTileMissingException; - - /** - * Updates the interface requested, used internally - * @param te - */ - public void requestUpdate( IGridTileEntity te ); - - /** - * returns a list of all machines on the grid. - * @return - */ - List< TileRef > getMachines(); - - /** - * Labeled version for debugging... - */ - boolean useMEEnergy(float use, String for_what); - - /** - * returns energy to the system to prevent endless energy sinks. - */ - void refundMEEnergy( float use, String for_what ); - - /** - * Reports previous 20 ticks avg of energy usage. - * @return - */ - public float getPowerUsageAvg(); - - /** - * this is used for standard items, anything else just use useMEEnergy. - * @param items - * @param multipler - * @return - */ - int usePowerForAddition(int items, int multipler); - - /** - * returns a single IMEInventory that represents the entire networks. - * @return - */ - public IMEInventoryHandler getCellArray(); - - /** - * returns a single IMEInventory that represents the entire network, and all crafting available. - * @return - */ - public IMEInventoryHandler getFullCellArray(); - - /** - * add which users should be notified of terminal updates. - * @param p - */ - void addViewingPlayer(EntityPlayer p); - - /** - * remove which users should be notified of terminal updates. - * @param p - */ - void rmvViewingPlayer(EntityPlayer p); - - /** - * add which users should be notified of crafting queue updates. - * @param p - */ - void addCraftingPlayer(EntityPlayer p); - - /** - * remove which users should be notified of crafting queue updates. - * @param p - */ - void rmvCraftingPlayer(EntityPlayer p); - - /** - * aquire the controller tile entity. - * @return - */ - public TileEntity getController(); - - /** - * create a waiting job. - * @param what - * @return - */ - ICraftRequest waitingRequest(ItemStack what); - - /** - * creates a crafting job to push the item out of IPushable, and to enable crafting to acocomplish this goal. - * @param willAdd - * @param out - * @param allowCrafting - * @return - */ - ICraftRequest pushRequest( ItemStack willAdd, ITilePushable out, boolean allowCrafting ); - - /** - * is the grid valid? - * @return - */ - public boolean isValid(); - - /** - * tell AE to re-examin items in the waiting list. - */ - void resetWaitingQueue(); - - /** - * craftable items - * @return - */ - IMEInventoryHandler getCraftableArray(); - - /** - * get a numeric id for this grid, used internally for cable animations, and not much else. - * @return - */ - public int getGridIndex(); - - /** - * Try to find the pattern for the item in question. - * @param req - * @return - */ - public ICraftingPattern getPatternFor(ItemStack req); - - /** - * Inform the network that power costs have changed. - */ - public void triggerPowerUpdate(); - - /** - * Inform the netowrk that these items were removed from storage ( don't do this for items remove though the grid, it already knows about those. ) - * @param removed - */ - public void notifyExtractItems(IAEItemStack removed); - - /** - * Inform the network that these items were added to storage ( don't do this for items added via the grid, it already knows about those. ) - * @param vo - */ - public void notifyAddItems(IAEItemStack vo); - - /** - * return a cache by its identifier ( the number you get when you register your cache with AE ) - * @param id - * @return - */ - public IGridCache getCacheByID( int id ); - - /** - * Potential future use, for now just returns the network encryption key. - * @return - */ - public String getName(); - - /** - * inform the network that energy was transfered between two nodes on the network, - * this will be used to calculates future information, but also causes the network - * to flash presently. - * - * this will automatically be handled by the standard extractItem / addItem API in the future, only - * Processes that skip the vanilla AE storage system should use this. - * - * @param a - * @param b - * @param amt - */ - void signalEnergyTransfer(IGridTileEntity a, IGridTileEntity b, float amt); - - /** - * posts an event into the network, blocks with the event listeners on them will receive them. - * @param ev - * @return - */ - public MENetworkEvent postEvent( MENetworkEvent ev ); - - @Override - public boolean equals(Object obj); - - /** - * total amount of power available - * @return - */ - public double getAvailablePower(); - - /** - * Returns if the system can provide this much power, returns the amount of power the system can provide. - * @param powerRequired - * @return - */ - public float canUsePower( float powerRequired ); - -} diff --git a/src/main/java/appeng/api/me/util/IMEInventory.java b/src/main/java/appeng/api/me/util/IMEInventory.java deleted file mode 100755 index 3e369149..00000000 --- a/src/main/java/appeng/api/me/util/IMEInventory.java +++ /dev/null @@ -1,77 +0,0 @@ -package appeng.api.me.util; - -import appeng.api.IAEItemStack; -import appeng.api.IItemList; - -/** - * Lets you access Internal Cell Inventories. - */ -public interface IMEInventory -{ - /** - * The number of different item types stored in inventory. - */ - public long storedItemTypes(); - - /** - * The number of stored items total, regardless of type. - */ - public long storedItemCount(); - - /** - * The estimated number of additional items this inventory can hold, regardless of type. - */ - public long remainingItemCount(); - - /** - * The estimated number of additional types the inventory could hold. - */ - public long remainingItemTypes(); - - /** - * True or False if this item is inside this inventory. - */ - public boolean containsItemType(IAEItemStack i); - - /** - * The total number of types holdable in this inventory. - */ - public long getTotalItemTypes(); - - /** - * Returns how many of this item are in the inventory, regardless of a how many stacks / cells or anything else. - */ - public long countOfItemType(IAEItemStack i); - - /** - * Adds input, to the inventory, and returns items not added, complete failure yields a copy of the stack that was passed. - */ - public IAEItemStack addItems( IAEItemStack input ); - - /** - * Attempts to extract the requested item, in the count specified by the request, returns items extracted, complete failure yields NULL. - */ - public IAEItemStack extractItems( IAEItemStack request ); - - // DO NOT USE ItemStack.split, these are for information purpose ONLY! - // I you wan to remove items from the cell, use extractItemss - - /** - * Returns a list of all available items, with stackSize set to the real amount, without stack limits. - */ - public IItemList getAvailableItems( IItemList out ); - - /** - * Returns a list of all available items, with stackSize set to the real amount, without stack limits. - */ - public IItemList getAvailableItems(); - - /** - * Identical to addItems(...) but it don't change anything, its just a simulation. - * this is used when dealing with pipes/tubes, and routing. - */ - public IAEItemStack calculateItemAddition(IAEItemStack stack); - - // calculates available space for a specific item. - public long getAvailableSpaceByItem( IAEItemStack i, long maxNeeded ); -} diff --git a/src/main/java/appeng/api/me/util/IMEInventoryHandler.java b/src/main/java/appeng/api/me/util/IMEInventoryHandler.java deleted file mode 100755 index 947f5178..00000000 --- a/src/main/java/appeng/api/me/util/IMEInventoryHandler.java +++ /dev/null @@ -1,76 +0,0 @@ -package appeng.api.me.util; - -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import appeng.api.IAEItemStack; -import appeng.api.IItemList; -import appeng.api.config.FuzzyMode; -import appeng.api.config.IConfigEnum; -import appeng.api.config.ItemFlow; -import appeng.api.config.ListMode; - -public interface IMEInventoryHandler extends IMEInventory { - - public ItemFlow getFlow(); - public void setFlow( ItemFlow p ); - - public int getPriority(); - public void setPriority( int p ); - - /** - * Returns estimated number of total bytes represented by the inventory, used mainly for display. - */ - public long totalBytes(); - - /** - * Returns estimated number of free bytes represented by inventory, used mainly for display. - */ - public long freeBytes(); - - /** - * Returns number of used bytes represented by the inventory, used mainly for display. - */ - public long usedBytes(); - - /** - * The number of items you could add before the freeBytes() decreases. - */ - public long unusedItemCount(); - - /** - * True of False, if you could add a new item type. - */ - public boolean canHoldNewItem(); - - /** - * This tells you where it found your cell, so if your cell changes, you should update this block... - */ - void setUpdateTarget(TileEntity e); - - List getPreformattedItems(); - void setPreformattedItems(IItemList in, FuzzyMode mode, ListMode m); - - boolean isPreformatted(); - boolean isFuzzyPreformatted(); - - ListMode getListMode(); - FuzzyMode getFuzzyModePreformatted(); - - void setFuzzyPreformatted( boolean nf ); - - public void setName(String name); - String getName(); - - void setGrid( IGridInterface grid ); - IGridInterface getGrid(); - - void setParent( IMEInventoryHandler p ); - IMEInventoryHandler getParent(); - - void removeGrid(IGridInterface grid, IMEInventoryHandler ignore, List duplicates ); - public void validate( List duplicates ); - public boolean canAccept(IAEItemStack input); - -} diff --git a/src/main/java/appeng/api/me/util/IMEInventoryUtil.java b/src/main/java/appeng/api/me/util/IMEInventoryUtil.java deleted file mode 100755 index e43bce07..00000000 --- a/src/main/java/appeng/api/me/util/IMEInventoryUtil.java +++ /dev/null @@ -1,19 +0,0 @@ -package appeng.api.me.util; - -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.world.World; -import appeng.api.IAEItemStack; -import appeng.api.IItemList; - -public interface IMEInventoryUtil { - - // ignores meta data - is always Fuzzy... - // will only remove single items, this ignores your stack size... - public ItemStack extractItemsByRecipe(World w, IRecipe r, ItemStack output, InventoryCrafting ci, ItemStack providedTemplate, int slot, IItemList all ); - - // ignores meta data - is always Fuzzy... - //public ItemStack extractItemsByType( ItemStack is ); // will only remove single items, this ignores your stack size... - -} diff --git a/src/main/java/appeng/api/me/util/ITileCraftingProvider.java b/src/main/java/appeng/api/me/util/ITileCraftingProvider.java deleted file mode 100755 index cafb63fb..00000000 --- a/src/main/java/appeng/api/me/util/ITileCraftingProvider.java +++ /dev/null @@ -1,17 +0,0 @@ -package appeng.api.me.util; - -import appeng.api.me.tiles.ICraftingTracker; -import appeng.api.me.tiles.ITilePushable; - -/** - * Allows a tile to provide crafting patterns to the network, post a GridPatternUpdateEvent to tell AE to update. - */ -public interface ITileCraftingProvider extends ITilePushable { - - /** - * called when the network is looking for possible crafting jobs. - * @param craftingTracker - */ - void provideCrafting( ICraftingTracker craftingTracker ); - -} diff --git a/src/main/java/appeng/api/me/util/InterfaceCraftingResponse.java b/src/main/java/appeng/api/me/util/InterfaceCraftingResponse.java deleted file mode 100755 index 6a50915e..00000000 --- a/src/main/java/appeng/api/me/util/InterfaceCraftingResponse.java +++ /dev/null @@ -1,13 +0,0 @@ -package appeng.api.me.util; - -import java.util.List; - -import net.minecraft.item.ItemStack; - -public class InterfaceCraftingResponse { - - public ItemStack Request; - - public List UsedMaterials; - -} diff --git a/src/main/java/appeng/api/me/util/TransitionResult.java b/src/main/java/appeng/api/me/util/TransitionResult.java deleted file mode 100755 index b06c3d8d..00000000 --- a/src/main/java/appeng/api/me/util/TransitionResult.java +++ /dev/null @@ -1,21 +0,0 @@ -package appeng.api.me.util; - -import appeng.api.WorldCoord; -import net.minecraft.world.World; - -/** - * Defines the result of performing a transition from the world into a storage cell, if its possible, and what the energy usage is. - * - */ -public class TransitionResult { - - public TransitionResult( boolean _success, double power ) - { - success = _success; - energyUsage = power; - } - - public final boolean success; - public final double energyUsage; - -} diff --git a/src/main/java/appeng/api/movable/IMovableHandler.java b/src/main/java/appeng/api/movable/IMovableHandler.java index 6317939d..3706180d 100644 --- a/src/main/java/appeng/api/movable/IMovableHandler.java +++ b/src/main/java/appeng/api/movable/IMovableHandler.java @@ -3,40 +3,39 @@ package appeng.api.movable; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -public interface IMovableHandler { +public interface IMovableHandler +{ /** - * if you return true from this, your saying you can handle the class, not that single entity, - * you cannot opt out of single entities. - * + * if you return true from this, your saying you can handle the class, not + * that single entity, you cannot opt out of single entities. + * * @param myClass * @param tile * @return */ - boolean canHandle( Class myClass, TileEntity tile); + boolean canHandle(Class myClass, TileEntity tile); /** - * request that the handler move the the tile from its current location to the new one. - * the tile has already been invalidated, and the blocks have already been fully moved. - * + * request that the handler move the the tile from its current location to + * the new one. the tile has already been invalidated, and the blocks have + * already been fully moved. + * * Potential Example: - * - Chunk c = w.getChunkFromBlockCoords( x, z ); - c.setChunkBlockTileEntity( x & 0xF, y + y, z & 0xF, te ); - - if ( c.isChunkLoaded ) - { - w.addTileEntity( te ); - w.markBlockForUpdate( x, y, z ); - } - * + * + * Chunk c = world.getChunkFromBlockCoords( x, z ); c.setChunkBlockTileEntity( x + * & 0xF, y + y, z & 0xF, tile ); + * + * if ( c.isChunkLoaded ) { world.addTileEntity( tile ); world.markBlockForUpdate( x, + * y, z ); } + * * @param tile - * @param w + * @param world * @param x * @param y * @param z * @return */ - void moveTile( TileEntity tile, World w, int x, int y, int z ); + void moveTile(TileEntity tile, World world, int x, int y, int z); -} +} \ No newline at end of file diff --git a/src/main/java/appeng/api/movable/IMovableRegistry.java b/src/main/java/appeng/api/movable/IMovableRegistry.java old mode 100755 new mode 100644 index 3d05ec82..a10c46bc --- a/src/main/java/appeng/api/movable/IMovableRegistry.java +++ b/src/main/java/appeng/api/movable/IMovableRegistry.java @@ -3,80 +3,88 @@ package appeng.api.movable; import net.minecraft.tileentity.TileEntity; /** + * Used to determine if a tile is marked as movable, a block will be considered + * movable, if... + * + * 1. The Tile or its super classes have been white listed with + * whiteListTileEntity. + * + * 2. The Tile has been register with the IMC ( which + * basically calls whiteListTileEntity. ) * - * Used to determine if a tile is marked as movable, a block will be considered movable, if... - * - * 1. The Tile or its super classes have been white listed with whiteListTileEntity. - * 2. The Tile has been register with the ICM ( which basically calls whiteListTileEntity. ) - * 3. The Tile implements IMovableTile - * 4. A IMovableHandler is register that returns canHandle = true for the Tile Entity Class - * - * ICM Example: - * FMLInterModComms.sendMessage( "AppliedEnergistics", "movabletile", "appeng.common.AppEngTile" ); - * + * 3. The Tile implements IMovableTile 4. + * A IMovableHandler is register that returns canHandle = true for the Tile + * Entity Class + * + * IMC Example: FMLInterModComms.sendMessage( "AppliedEnergistics", + * "movabletile", "appeng.common.AppEngTile" ); + * * The movement process is as follows, - * - * 1. IMovableTile.prepareToMove() or TileEntity.invalidate() depending on your opt-in method. - * 2. The tile will be removed from the world. - * 3. Its world, coordinates will be changed. *** this can be overridden with a IMovableHandler *** - * 4. It will then be re-added to the world, or a new world. - * 5. TileEntity.validate() - * 6. IMovableTile.doneMoving ( if you implemented IMovableTile ) - * - * Please note, this is a 100% white list only feature, I will never opt in any non-vanilla, non-AE blocks. - * If you do not want to support your tiles being moved, you don't have to do anything. - * - * I appreciate anyone that takes the effort to get their tiles to work with this system to create a better use experience. - * + * + * 1. IMovableTile.prepareToMove() or TileEntity.invalidate() depending on your + * opt-in method. 2. The tile will be removed from the world. 3. Its world, + * coordinates will be changed. *** this can be overridden with a + * IMovableHandler *** 4. It will then be re-added to the world, or a new world. + * 5. TileEntity.validate() 6. IMovableTile.doneMoving ( if you implemented + * IMovableTile ) + * + * Please note, this is a 100% white list only feature, I will never opt in any + * non-vanilla, non-AE blocks. If you do not want to support your tiles being + * moved, you don't have to do anything. + * + * I appreciate anyone that takes the effort to get their tiles to work with + * this system to create a better use experience. + * * If you need a build of deobf build of AE for testing, do not hesitate to ask. - * */ -public interface IMovableRegistry { - +public interface IMovableRegistry +{ /** * White list your tile entity with the registry. - * - * You can also use the ICM, - * FMLInterModComms.sendMessage( "AppliedEnergistics", "movabletile", "appeng.common.AppEngTile" ); - * - * If you tile is handled with IMovableHandler or IMovableTile you do not need to white list it. - * + * + * You can also use the IMC, FMLInterModComms.sendMessage( + * "AppliedEnergistics", "movabletile", "appeng.common.AppEngTile" ); + * + * If you tile is handled with IMovableHandler or IMovableTile you do not + * need to white list it. */ - void whiteListTileEntity( Class c ); + void whiteListTileEntity(Class c); /** - * returns true if the tile has accepted your request to move it. * @param te - * @return + * @return true if the tile has accepted your request to move it */ - boolean askToMove( TileEntity te ); + boolean askToMove(TileEntity te); /** * tells the tile you are done moving it. + * * @param te */ - void doneMoveing( TileEntity te ); + void doneMoving(TileEntity te); /** * add a new handler movable handler. - * @param han + * + * @param handler */ - void addHandler( IMovableHandler han ); + void addHandler(IMovableHandler handler); /** - * handlers are used to perform movement, this allows you to override AE's internal version. - * + * handlers are used to perform movement, this allows you to override AE's + * internal version. + * * only valid after askToMove(...) = true + * * @param te * @return */ IMovableHandler getHandler(TileEntity te); /** - * returns a copy of the default handler - * @return + * @return a copy of the default handler */ IMovableHandler getDefaultHandler(); -} +} \ No newline at end of file diff --git a/src/main/java/appeng/api/movable/IMovableTile.java b/src/main/java/appeng/api/movable/IMovableTile.java old mode 100755 new mode 100644 index f830d897..dc65491d --- a/src/main/java/appeng/api/movable/IMovableTile.java +++ b/src/main/java/appeng/api/movable/IMovableTile.java @@ -1,18 +1,23 @@ package appeng.api.movable; /** - * You can implement this, or use the IMovableRegistry o white list your tile, please see the registry for more information. + * You can implement this, or use the IMovableRegistry to white list your tile, + * please see the registry for more information. */ -public interface IMovableTile { - +public interface IMovableTile +{ + /** - * notification that your block will be moved, called instead of invalidate, return false to prevent movement. - * @return + * notification that your block will be moved, called instead of invalidate, + * return false to prevent movement. + * + * @return */ boolean prepareToMove(); + /** * notification that your block was moved, called after validate. */ void doneMoving(); - + } diff --git a/src/main/java/appeng/api/networkevents/MENetworkEvent.java b/src/main/java/appeng/api/networkevents/MENetworkEvent.java deleted file mode 100755 index b5416295..00000000 --- a/src/main/java/appeng/api/networkevents/MENetworkEvent.java +++ /dev/null @@ -1,69 +0,0 @@ -package appeng.api.networkevents; - -import appeng.api.me.tiles.IGridTileEntity; -import appeng.api.me.util.IGridInterface; - -/** - * These events are posted via IGridInterface.PostEvent - */ -public class MENetworkEvent { - - private int visited = 0; - private int available = 0; - private boolean canceled; - - /** - * The tile omitting the event, not necessarily non-null, but included to suggest standard practice. - */ - public final IGridTileEntity tile; - - public MENetworkEvent( IGridTileEntity t ) { - tile = t; - } - - /** - * Call to prevent AE from posting the event to any further objects. - */ - public void cancel() - { - canceled = true; - } - - /** - * called by AE after each object is called to cancel any future calls. - * @return - */ - public boolean isCanceled() - { - return canceled; - } - - /** - * the number of objects that were visited by the event. - * @return - */ - public int getVisitedObjects() - { - return visited; - } - - /** - * May differ from visited is the event is canceled. - * @return - */ - public int getAvailableObjects() - { - return available; - } - - /** - * Called by AE after iterating the event subscribers. - * @param v - * @param a - */ - public void setVisitedObjects( int v, int a ) - { - visited = v; - available = a; - } -} diff --git a/src/main/java/appeng/api/networkevents/MENetworkEventSubscribe.java b/src/main/java/appeng/api/networkevents/MENetworkEventSubscribe.java deleted file mode 100755 index cb760483..00000000 --- a/src/main/java/appeng/api/networkevents/MENetworkEventSubscribe.java +++ /dev/null @@ -1,9 +0,0 @@ -package appeng.api.networkevents; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface MENetworkEventSubscribe { - -} diff --git a/src/main/java/appeng/api/networkevents/MENetworkPowerStorage.java b/src/main/java/appeng/api/networkevents/MENetworkPowerStorage.java deleted file mode 100755 index 4dcf4681..00000000 --- a/src/main/java/appeng/api/networkevents/MENetworkPowerStorage.java +++ /dev/null @@ -1,23 +0,0 @@ -package appeng.api.networkevents; - -import appeng.api.me.tiles.IGridTileEntity; -import appeng.api.me.util.IGridInterface; - -/** - * informs the controller, that a IMEPowerStorage block that had either run, out of power, or was full, is no longer in that state. - */ -public class MENetworkPowerStorage extends MENetworkEvent { - - public enum PowerEventType { - REQUEST_POWER, // informs the network this tile is ready to receive power again. - PROVIDE_POWER // informs the network this tile is ready to provide power again. - }; - - public final PowerEventType type; - - public MENetworkPowerStorage(IGridTileEntity t, PowerEventType y) { - super(t); - type = y; - } - -} diff --git a/src/main/java/appeng/api/networkevents/MENetworkStorageEvent.java b/src/main/java/appeng/api/networkevents/MENetworkStorageEvent.java deleted file mode 100755 index 6b8d50cc..00000000 --- a/src/main/java/appeng/api/networkevents/MENetworkStorageEvent.java +++ /dev/null @@ -1,16 +0,0 @@ -package appeng.api.networkevents; - -import appeng.api.IItemList; -import appeng.api.me.tiles.IGridTileEntity; -import appeng.api.me.util.IMEInventory; - -public class MENetworkStorageEvent extends MENetworkEvent { - - public final IItemList currentItems; - - public MENetworkStorageEvent(IGridTileEntity t, IItemList o ) { - super(t); - currentItems = o; - } - -} diff --git a/src/main/java/appeng/api/networking/GridFlags.java b/src/main/java/appeng/api/networking/GridFlags.java new file mode 100644 index 00000000..0e78d067 --- /dev/null +++ b/src/main/java/appeng/api/networking/GridFlags.java @@ -0,0 +1,38 @@ +package appeng.api.networking; + +/** + * Various flags to determine network node behavior. + */ +public enum GridFlags +{ + /** + * import/export buses, terminals, and other devices that use network features, will use this setting. + */ + REQUIRE_CHANNEL, + + /** + * MAC, and P2P ME tunnels use this setting. + */ + DENSE_CHANNEL, + + /** + * cannot carry channels over this node. + */ + CANNOT_CARRY, + + /** + * Used by P2P Tunnels to prevent tunnels from tunneling recursively. + */ + CANNOT_CARRY_DENSE, + + /** + * This block can transmit 32 signals, this should only apply to Tier2 Cable, P2P Tunnels, and Quantum Network Bridges. + */ + TIER_2_CAPACITY, + + /** + * This block is part of a multiblock, used in conjunction with REQUIRE_CANNEL, and {@link IGridMultiblock} see this + * interface for details. + */ + MULTIBLOCK +} diff --git a/src/main/java/appeng/api/networking/GridNotification.java b/src/main/java/appeng/api/networking/GridNotification.java new file mode 100644 index 00000000..78c4d19d --- /dev/null +++ b/src/main/java/appeng/api/networking/GridNotification.java @@ -0,0 +1,9 @@ +package appeng.api.networking; + +public enum GridNotification +{ + /** + * the visible connections for this node have changed, useful for cable. + */ + ConnectionsChanged, +} diff --git a/src/main/java/appeng/api/networking/IGrid.java b/src/main/java/appeng/api/networking/IGrid.java new file mode 100644 index 00000000..8ce3df19 --- /dev/null +++ b/src/main/java/appeng/api/networking/IGrid.java @@ -0,0 +1,71 @@ +package appeng.api.networking; + +import appeng.api.networking.events.MENetworkEvent; +import appeng.api.util.IReadOnlyCollection; + +/** + * Gives you access to Grid based information. + * + * Don't Implement. + */ +public interface IGrid +{ + + /** + * Get Access to various grid modules + * + * @param iface + * @return the IGridCache you requested. + */ + public C getCache(Class iface); + + /** + * Post an event into the network event bus. + * + * @param ev + * - event to post + * @return returns ev back to original poster + */ + public MENetworkEvent postEvent(MENetworkEvent ev); + + /** + * Post an event into the network event bus, but direct it at a single node. + * + * @param ev + * event to post + * @return returns ev back to original poster + */ + public MENetworkEvent postEventTo(IGridNode node, MENetworkEvent ev); + + /** + * get a list of the diversity of classes, you can use this to better detect which machines your interested in, + * rather then iterating the entire grid to test them. + * + * @return IReadOnlyCollection of all available host types (Of Type IGridHost). + */ + public IReadOnlyCollection> getMachinesClasses(); + + /** + * Get machines on the network. + * + * @param classofIGridHost + * @return IMachineSet of all nodes belonging to hosts of specified class. + */ + public IMachineSet getMachines(Class classofIGridHost); + + /** + * @return IReadOnlyCollection for all nodes on the network, node visitors are prefered. + */ + IReadOnlyCollection getNodes(); + + /** + * @return true if the last node has been removed from the grid. + */ + public boolean isEmpty(); + + /** + * @return the node considered the pivot point of the grid. + */ + public IGridNode getPivot(); + +} diff --git a/src/main/java/appeng/api/networking/IGridBlock.java b/src/main/java/appeng/api/networking/IGridBlock.java new file mode 100644 index 00000000..0c4fdc3f --- /dev/null +++ b/src/main/java/appeng/api/networking/IGridBlock.java @@ -0,0 +1,88 @@ +package appeng.api.networking; + +import java.util.EnumSet; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.parts.IPart; +import appeng.api.util.AEColor; +import appeng.api.util.DimensionalCoord; + +/** + * An Implementation is required to create your node for IGridHost + * + * Implement for use with IGridHost + */ +public interface IGridBlock +{ + + /** + * how much power to drain per tick as part of idle network usage. + * + * if the value of this changes, you must post a MENetworkPowerIdleChange + * + * @return ae/t to use. + */ + double getIdlePowerUsage(); + + /** + * Various flags that AE uses to modify basic behavior for various parts of the network. + * + * @return Set of flags for this IGridBlock + */ + EnumSet getFlags(); + + /** + * generally speaking you will return true for this, the one exception is buses, or worm holes where the node + * represents something that isn't a real connection in the world, but rather one represented internally to the + * block. + * + * @return if the world can connect to this node, and the node can connect to the world. + */ + boolean isWorldAccessable(); + + /** + * @return current location of this node + */ + DimensionalCoord getLocation(); + + /** + * @return Transparent, or a valid color, NULL IS NOT A VALID RETURN + */ + AEColor getGridColor(); + + /** + * Notifies your IGridBlock that changes were made to your connections + */ + void onGridNotification(GridNotification notification); + + /** + * Update Blocks network/connection/booting status. grid, + * + * @param isReady + */ + public void setNetworkStatus(IGrid grid, int channelsInUse); + + /** + * Determine which sides of the block can be connected too, only used when isWorldAccessable returns true, not used + * for {@link appeng.api.parts.IPart} implementations. + */ + EnumSet getConnectableSides(); + + /** + * @return the IGridHost for the node, this will be an IGridPart or a TileEntity generally speaking. + */ + IGridHost getMachine(); + + /** + * called when the grid for the node has changed, the general grid state should not be trusted at this point. + */ + void gridChanged(); + + /** + * Determines what item stack is used to render this node in the GUI. + * + * @return the render item stack to use to render this node, null is valid, and will not show this node. + */ + public ItemStack getMachineRepresentation(); +} diff --git a/src/main/java/appeng/api/networking/IGridCache.java b/src/main/java/appeng/api/networking/IGridCache.java new file mode 100644 index 00000000..7fe0d457 --- /dev/null +++ b/src/main/java/appeng/api/networking/IGridCache.java @@ -0,0 +1,71 @@ +package appeng.api.networking; + +/** + * + * Allows you to create a network wise service, AE2 uses these for providing + * item, spatial, and tunnel services. + * + * Any Class that implements this, should have a public default constructor that + * takes a single argument of type IGrid. + * + */ +public interface IGridCache +{ + + /** + * Called each tick for the network, allows you to have active network wide + * behaviors. + * + */ + void onUpdateTick(); + + /** + * inform your cache, that a machine was removed from the grid. + * + * Important: Do not trust the grids state in this method, interact only + * with the node you are passed, if you need to manage other grid + * information, do it on the next updateTick. + * + * @param gridNode + * @param machine + */ + void removeNode(IGridNode gridNode, IGridHost machine); + + /** + * informs you cache that a machine was added to the grid. + * + * Important: Do not trust the grids state in this method, interact only + * with the node you are passed, if you need to manage other grid + * information, do it on the next updateTick. + * + * @param gridNode + * @param machine + */ + void addNode(IGridNode gridNode, IGridHost machine); + + /** + * Called when a grid splits into two grids, AE will call a split as it + * Iteratively processes changes. The destination should receive half, and + * the current cache should receive half. + * + * @param destinationStorage + */ + void onSplit(IGridStorage destinationStorage); + + /** + * Called when two grids merge into one, AE will call a join as it + * Iteratively processes changes. Use this method to incorporate all the + * data from the source into your cache. + * + * @param sourceStorage + */ + void onJoin(IGridStorage sourceStorage); + + /** + * Called when saving changes, + * + * @param destinationStorage + */ + void populateGridStorage(IGridStorage destinationStorage); + +} diff --git a/src/main/java/appeng/api/networking/IGridCacheRegistry.java b/src/main/java/appeng/api/networking/IGridCacheRegistry.java new file mode 100644 index 00000000..d1b68b83 --- /dev/null +++ b/src/main/java/appeng/api/networking/IGridCacheRegistry.java @@ -0,0 +1,28 @@ +package appeng.api.networking; + +import java.util.HashMap; + +/** + * A registry of grid caches to extend grid functionality. + */ +public interface IGridCacheRegistry +{ + + /** + * Register a new grid cache for use during operation, must be called during the loading phase. + * + * @param cl + * @return cache id ( can be used later to ask the grid for you cache. ) + */ + void registerGridCache(Class iface, Class implementation); + + /** + * requests a new instance of a grid cache for use, used internally + * + * @param grid + * + * @return a new HashMap of IGridCaches from the registry, called from IGrid when constructing a new grid. + */ + HashMap, IGridCache> createCacheInstance(IGrid grid); + +} diff --git a/src/main/java/appeng/api/networking/IGridConnecitonVisitor.java b/src/main/java/appeng/api/networking/IGridConnecitonVisitor.java new file mode 100644 index 00000000..b3da721c --- /dev/null +++ b/src/main/java/appeng/api/networking/IGridConnecitonVisitor.java @@ -0,0 +1,14 @@ +package appeng.api.networking; + +public interface IGridConnecitonVisitor extends IGridVisitor +{ + + /** + * Called for each connection on the network. + * + * @param n + * the connection. + */ + public void visitConnection(IGridConnection n); + +} diff --git a/src/main/java/appeng/api/networking/IGridConnection.java b/src/main/java/appeng/api/networking/IGridConnection.java new file mode 100644 index 00000000..9e07090a --- /dev/null +++ b/src/main/java/appeng/api/networking/IGridConnection.java @@ -0,0 +1,58 @@ +package appeng.api.networking; + +import net.minecraftforge.common.util.ForgeDirection; + +/** + * Access to AE's internal grid connections. + * + * Messing with connection is generally completely unnecessary, you should be able to just use IGridNode.updateState() + * to have AE manage them for you. + * + * Don't Implement. + */ +public interface IGridConnection +{ + + /** + * lets you get the opposing node of the connection by passing your own node. + * + * @param gridNode + * @return the IGridNode which represents the opposite side of the connection. + */ + IGridNode getOtherSide(IGridNode gridNode); + + /** + * determine the direction of the connection based on your node. + * + * @param gridNode + * @return the direction of the connection, only valid for in world connections. + */ + ForgeDirection getDirection(IGridNode gridNode); + + /** + * by destroying a connection you may create new grids, and trigger un-expected behavior, you should only destroy + * connections if you created them. + */ + void destroy(); + + /** + * @return node A + */ + IGridNode a(); + + /** + * @return node B + */ + IGridNode b(); + + /** + * @return if the connection is invisible this returns false + */ + boolean hasDirection(); + + /** + * @return how many channels pass over this connections. + */ + int getUsedChannels(); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/networking/IGridHost.java b/src/main/java/appeng/api/networking/IGridHost.java new file mode 100644 index 00000000..749f01c1 --- /dev/null +++ b/src/main/java/appeng/api/networking/IGridHost.java @@ -0,0 +1,43 @@ +package appeng.api.networking; + +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.parts.IPart; +import appeng.api.util.AECableType; + +/** + * + * Implement to create a networked {@link net.minecraft.tileentity.TileEntity} or {@link appeng.api.parts.IPart} must + * be implemented for a part, or tile entity to become part of a grid. + * + */ +public interface IGridHost +{ + + /** + * get the grid node for a particular side of a block, you can return null, + * by returning a valid node later and calling updateState, you can join the + * Grid when your block is ready. + * + * @param dir + * feel free to ignore this, most blocks will use the same node + * for every side. + * @return a new IGridNode, create these with + * AEApi.instance().createGridNode( MyIGridBlock ) + */ + public IGridNode getGridNode(ForgeDirection dir); + + /** + * Determines how cables render when they connect to this block. Priority is + * Smart > Covered > Glass + * + * @param dir + */ + public AECableType getCableConnectionType(ForgeDirection dir); + + /** + * break this host, its violating security rules, just break your block, or part. + */ + public void securityBreak(); + +} diff --git a/src/main/java/appeng/api/networking/IGridMultiblock.java b/src/main/java/appeng/api/networking/IGridMultiblock.java new file mode 100644 index 00000000..83f580e7 --- /dev/null +++ b/src/main/java/appeng/api/networking/IGridMultiblock.java @@ -0,0 +1,20 @@ +package appeng.api.networking; + +import java.util.Iterator; + +/** + * An extension of IGridBlock, only means something when your getFlags() contains REQUIRE_CHANNEL, when done properly it + * will call the method to get a list of all related nodes and give each of them a channel simultaneously for the entire + * set. This means your entire Multiblock can work with a single channel, instead of one channel per block. + */ +public interface IGridMultiblock extends IGridBlock +{ + + /** + * Used to acquire a list of all nodes that are part of the multiblock. + * + * @return an iterator that will iterate all the nodes for the multiblock. ( read-only iterator expected. ) + */ + Iterator getMultiblockNodes(); + +} diff --git a/src/main/java/appeng/api/networking/IGridNode.java b/src/main/java/appeng/api/networking/IGridNode.java new file mode 100644 index 00000000..bb99e2c0 --- /dev/null +++ b/src/main/java/appeng/api/networking/IGridNode.java @@ -0,0 +1,141 @@ +package appeng.api.networking; + +import java.util.EnumSet; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.IAppEngApi; +import appeng.api.util.IReadOnlyCollection; + +/** + * + * Gives you a view into your Nodes connections and information. + * + * updateState, getGrid, destroy are required to implement a proper IGridHost. + * + * Don't Implement; Acquire from {@link IAppEngApi}.createGridNode + * + */ +public interface IGridNode +{ + + /** + * lets you walk the grid stating at the current node using a IGridVisitor, generally not needed, please use only if + * required. + * + * @param g + */ + void beginVisition(IGridVisitor g); + + /** + * inform the node that your IGridBlock has changed its internal state, and force the node to update. + * + * ALWAYS make sure that your tile entity is in the world, and has its node properly saved to be returned from the + * host before updating state, + * + * If your entity is not in the world, or if you IGridHost returns a different node for the same side you will + * likely crash the game. + * + */ + void updateState(); + + /** + * get the machine represented by the node. + * + * @return + */ + IGridHost getMachine(); + + /** + * get the grid for the node, this can change at a moments notice. + * + * @return + */ + IGrid getGrid(); + + /** + * By destroying your node, you destroy any connections, and its existence in the grid, use in invalidate, or + * onChunkUnload + */ + void destroy(); + + /** + * @return the world the node is located in + */ + World getWorld(); + + /** + * + * @return a set of the connected sides, UNKNOWN represents an invisible connection + */ + EnumSet getConnectedSides(); + + /** + * lets you iterate a nodes connections + * + * @return + */ + IReadOnlyCollection getConnections(); + + /** + * @return the IGridBlock for this node + */ + IGridBlock getGridBlock(); + + /** + * Reflects the networks status, returns true only if the network is powered, and the network is not booting, this + * also takes into account channels. + * + * @return true if is Network node active, and participating. + */ + boolean isActive(); + + /** + * this should be called for each node you create, if you have a nodeData compound to load from, you can store all + * your nods on a single compound using name. + * + * Important: You must call this before updateState. + * + * @param name + * @param nodeData + */ + void loadFromNBT(String name, NBTTagCompound nodeData); + + /** + * this should be called for each node you maintain, you can save all your nodes to the same tag with different + * names, if you fail to complete the load / save procedure, network state may be lost between game load/saves. + * + * @param name + * @param nodeData + */ + void saveToNBT(String name, NBTTagCompound nodeData); + + /** + * @return if the node's channel requirements are currently met, use this for display purposes, use isActive for + * status. + */ + boolean meetsChannelRequirements(); + + /** + * see if this node has a certain flag + * + * @param tier2Capacity + * @return + */ + boolean hasFlag(GridFlags flag); + + /** + * tell the node who was responsible for placing it, failure to do this may result in in-compatibility with the + * security system. Called instead of loadFromNBT when intialily placed, once set never required again, the value is saved with the Node NBT. + * + * @param p + */ + void setPlayerID(int playerID); + + /** + * @return the ownerID this represents the person who placed the node. + */ + int getPlayerID(); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/networking/IGridStorage.java b/src/main/java/appeng/api/networking/IGridStorage.java new file mode 100644 index 00000000..c4c7c1e7 --- /dev/null +++ b/src/main/java/appeng/api/networking/IGridStorage.java @@ -0,0 +1,18 @@ +package appeng.api.networking; + +import net.minecraft.nbt.NBTTagCompound; + +public interface IGridStorage +{ + + /** + * @return an NBTTagCompound that can be read, and written too. + */ + NBTTagCompound dataObject(); + + /** + * @return the id for this grid storage object, used internally + */ + long getID(); + +} diff --git a/src/main/java/appeng/api/networking/IGridVisitor.java b/src/main/java/appeng/api/networking/IGridVisitor.java new file mode 100644 index 00000000..2593160f --- /dev/null +++ b/src/main/java/appeng/api/networking/IGridVisitor.java @@ -0,0 +1,21 @@ +package appeng.api.networking; + +/** + * Simple Visitor pattern access to network nodes. + */ +public interface IGridVisitor +{ + + /** + * Called for each node on the network. + * + * By returning false your informing the host to stop visiting nodes beyond the current node. + * + * @param n + * the current node. + * + * @return true to continue visiting nodes beyond this node. + */ + public boolean visitNode(IGridNode n); + +} diff --git a/src/main/java/appeng/api/networking/IMachineSet.java b/src/main/java/appeng/api/networking/IMachineSet.java new file mode 100644 index 00000000..080eeb2b --- /dev/null +++ b/src/main/java/appeng/api/networking/IMachineSet.java @@ -0,0 +1,13 @@ +package appeng.api.networking; + +import appeng.api.util.IReadOnlyCollection; + +public interface IMachineSet extends IReadOnlyCollection +{ + + /** + * @return the machine class for this set. + */ + Class getMachineClass(); + +} diff --git a/src/main/java/appeng/api/networking/energy/IAEPowerStorage.java b/src/main/java/appeng/api/networking/energy/IAEPowerStorage.java new file mode 100644 index 00000000..3256ed27 --- /dev/null +++ b/src/main/java/appeng/api/networking/energy/IAEPowerStorage.java @@ -0,0 +1,46 @@ +package appeng.api.networking.energy; + +import appeng.api.config.AccessRestriction; +import appeng.api.config.Actionable; + +/** + * Used to access information about AE's various power accepting blocks for monitoring purposes. + */ +public interface IAEPowerStorage extends IEnergySource +{ + + /** + * Inject amt, power into the device, it will store what it can, and return the amount unable to be stored. + * + * @param simulate + * + * @return + */ + public double injectAEPower(double amt, Actionable mode); + + /** + * @return the current maximum power ( this can change :P ) + */ + public double getAEMaxPower(); + + /** + * @return the current AE Power Level, this may exceed getMEMaxPower() + */ + public double getAECurrentPower(); + + /** + * Checked on network reset to see if your block can be used as a public power storage ( use getPowerFlow to control + * the behavior ) + * + * @return + */ + public boolean isAEPublicPowerStorage(); + + /** + * Control the power flow by telling what the network can do, either add? or subtract? or both! + * + * @return + */ + public AccessRestriction getPowerFlow(); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/networking/energy/IEnergyGrid.java b/src/main/java/appeng/api/networking/energy/IEnergyGrid.java new file mode 100644 index 00000000..041cfebb --- /dev/null +++ b/src/main/java/appeng/api/networking/energy/IEnergyGrid.java @@ -0,0 +1,82 @@ +package appeng.api.networking.energy; + +import appeng.api.config.Actionable; +import appeng.api.networking.IGridCache; +import appeng.api.networking.events.MENetworkPowerStatusChange; + +/** + * AE's Power system. + */ +public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvider +{ + + /** + * @return the current calculated idle energy drain each tick, is used internally to drain power for each tick. + */ + public double getIdlePowerUsage(); + + /** + * @return the average power drain over the past 10 ticks, includes idle usage during this time, and all use of + * extractPower. + */ + public double getAvgPowerUsage(); + + /** + * @return the average energy injected into the system per tick, for the last 10 ticks. + */ + public double getAvgPowerInjection(); + + /** + * AE maintains an idle draw of power separate from active power draw, it condenses this into a single operation + * that determines the networks "powered state" if the network is considered off-line, your machines should not + * function. + * + * {@link MENetworkPowerStatusChange} events are posted when this value changes if you need to be notified of the + * change, most machines can simply test the value when they operate. + * + * @return if the network is powered or not. + */ + public boolean isNetworkPowered(); + + /** + * AE will accept any power, and store it, to maintain sanity please don't send more then 10,000 at a time. + * + * IMPORTANT: Network power knows no bounds, for less spamy power flow, networks can store more then their alloted + * storage, however, it should be kept to a minimum, to help with this, this method returns the networks current + * OVERFLOW, this is not energy you can store some where else, its already stored in the network, you can extract it + * if you want, however it it owned by the network, this is different then IAEEnergyStore + * + * Another important note, is that if a network that had overflow is deleted, its power is gone, this is one of the + * reasons why keeping overflow to a minimum is important. + * + * @param amt + * power to inject into the network + * @param mode + * should the action be simulated or performed? + * @return the amount of power that the network has OVER the limit. + */ + public double injectPower(double amt, Actionable mode); + + /** + * this is should be considered an estimate, and not relied upon for real calculations. + * + * @return estimated available power. + */ + public double getStoredPower(); + + /** + * this is should be considered an estimate, and not relied upon for real calculations. + * + * @return estimated available power. + */ + double getMaxStoredPower(); + + /** + * Calculation will be capped at maxRequired, this improves performance by limiting the number of nodes needed to + * calculate the demand. + * + * @return Amount of power required to charge the grid, in AE. + */ + public double getEnergyDemand(double maxRequired); + +} diff --git a/src/main/java/appeng/api/networking/energy/IEnergyGridProvider.java b/src/main/java/appeng/api/networking/energy/IEnergyGridProvider.java new file mode 100644 index 00000000..fc690932 --- /dev/null +++ b/src/main/java/appeng/api/networking/energy/IEnergyGridProvider.java @@ -0,0 +1,18 @@ +package appeng.api.networking.energy; + +import java.util.Set; + +import appeng.api.config.Actionable; + +/** + * internal use only. + */ +public interface IEnergyGridProvider +{ + + /** + * internal use only + */ + public double extractAEPower(double amt, Actionable mode, Set seen); + +} diff --git a/src/main/java/appeng/api/networking/energy/IEnergySource.java b/src/main/java/appeng/api/networking/energy/IEnergySource.java new file mode 100644 index 00000000..fa18d1e1 --- /dev/null +++ b/src/main/java/appeng/api/networking/energy/IEnergySource.java @@ -0,0 +1,19 @@ +package appeng.api.networking.energy; + +import appeng.api.config.Actionable; +import appeng.api.config.PowerMultiplier; + +public interface IEnergySource +{ + + /** + * Extract power from the network. + * + * @param amt + * @param mode + * should the action be simulated or performed? + * @return returns extracted power. + */ + public double extractAEPower(double amt, Actionable mode, PowerMultiplier usePowerMultiplier); + +} diff --git a/src/main/java/appeng/api/networking/energy/IEnergyWatcher.java b/src/main/java/appeng/api/networking/energy/IEnergyWatcher.java new file mode 100644 index 00000000..20e7a8ec --- /dev/null +++ b/src/main/java/appeng/api/networking/energy/IEnergyWatcher.java @@ -0,0 +1,8 @@ +package appeng.api.networking.energy; + +import java.util.Collection; + +public interface IEnergyWatcher extends Collection +{ + +} diff --git a/src/main/java/appeng/api/networking/energy/IEnergyWatcherHost.java b/src/main/java/appeng/api/networking/energy/IEnergyWatcherHost.java new file mode 100644 index 00000000..c844d73e --- /dev/null +++ b/src/main/java/appeng/api/networking/energy/IEnergyWatcherHost.java @@ -0,0 +1,21 @@ +package appeng.api.networking.energy; + +public interface IEnergyWatcherHost +{ + + /** + * provides the IEnergyWatcher for this host, for the current network, is called when the hot changes networks. You + * do not need to clear your old watcher, its already been removed by the time this gets called. + * + * @param newWatcher + */ + void updateWatcher(IEnergyWatcher newWatcher); + + /** + * Called when a threshold is crossed. + * + * @param energyGrid + */ + void onThreshholdPass(IEnergyGrid energyGrid); + +} diff --git a/src/main/java/appeng/api/networking/events/MENetworkBootingStatusChange.java b/src/main/java/appeng/api/networking/events/MENetworkBootingStatusChange.java new file mode 100644 index 00000000..284c64e4 --- /dev/null +++ b/src/main/java/appeng/api/networking/events/MENetworkBootingStatusChange.java @@ -0,0 +1,14 @@ +package appeng.api.networking.events; + +import appeng.api.networking.IGridNode; + +/** + * Posted by the network when the booting status of the network goes up + * or down, the change is reflected via {@link IGridNode}.isActive() + * + * Note: Most machines just need to check {@link IGridNode}.isActive() + */ +public class MENetworkBootingStatusChange extends MENetworkEvent +{ + +} diff --git a/src/main/java/appeng/api/networking/events/MENetworkCellArrayUpdate.java b/src/main/java/appeng/api/networking/events/MENetworkCellArrayUpdate.java new file mode 100644 index 00000000..1260216a --- /dev/null +++ b/src/main/java/appeng/api/networking/events/MENetworkCellArrayUpdate.java @@ -0,0 +1,15 @@ +package appeng.api.networking.events; + +/** + * Posted by storage devices to inform AE to refreash its storage structure. + * + * This is done in cases such as a storage cell being removed or added to a + * drive. + * + * you do not need to send this event when your node is added / removed from the + * grid. + */ +public class MENetworkCellArrayUpdate extends MENetworkEvent +{ + +} diff --git a/src/main/java/appeng/api/networking/events/MENetworkChannelChanged.java b/src/main/java/appeng/api/networking/events/MENetworkChannelChanged.java new file mode 100644 index 00000000..85409c52 --- /dev/null +++ b/src/main/java/appeng/api/networking/events/MENetworkChannelChanged.java @@ -0,0 +1,18 @@ +package appeng.api.networking.events; + +import appeng.api.networking.IGridNode; + +/** + * Posted by storage devices to inform AE he channel chache that the included node has changed its mind about its + * channel requirements. + */ +public class MENetworkChannelChanged extends MENetworkEvent +{ + + public final IGridNode node; + + public MENetworkChannelChanged(IGridNode n) { + node = n; + } + +} diff --git a/src/main/java/appeng/api/networking/events/MENetworkChannelsChanged.java b/src/main/java/appeng/api/networking/events/MENetworkChannelsChanged.java new file mode 100644 index 00000000..ebfed6cb --- /dev/null +++ b/src/main/java/appeng/api/networking/events/MENetworkChannelsChanged.java @@ -0,0 +1,13 @@ +package appeng.api.networking.events; + +import appeng.api.networking.IGridHost; + +/** + * Posted to the {@link IGridHost} when the channels on the node connections are altered. + * + * Never posted IGridCaches. + */ +public class MENetworkChannelsChanged extends MENetworkEvent +{ + +} diff --git a/src/main/java/appeng/api/networking/events/MENetworkControllerChange.java b/src/main/java/appeng/api/networking/events/MENetworkControllerChange.java new file mode 100644 index 00000000..97db1648 --- /dev/null +++ b/src/main/java/appeng/api/networking/events/MENetworkControllerChange.java @@ -0,0 +1,11 @@ +package appeng.api.networking.events; + +/** + * Event posted when the networks controller state changes, this can be from no + * controller to 1 controller, or any time the network changes from conflicted + * to not conflicted. + */ +public class MENetworkControllerChange extends MENetworkEvent +{ + +} diff --git a/src/main/java/appeng/api/networking/events/MENetworkCraftingChange.java b/src/main/java/appeng/api/networking/events/MENetworkCraftingChange.java new file mode 100644 index 00000000..0fbbc893 --- /dev/null +++ b/src/main/java/appeng/api/networking/events/MENetworkCraftingChange.java @@ -0,0 +1,15 @@ +package appeng.api.networking.events; + +import appeng.api.networking.IGridNode; + + +/** + * Posted by the network when the booting status of the network goes up + * or down, the change is reflected via {@link IGridNode}.isActive() + * + * Note: Most machines just need to check {@link IGridNode}.isActive() + */ +public class MENetworkCraftingChange extends MENetworkEvent +{ + +} diff --git a/src/main/java/appeng/api/networking/events/MENetworkEvent.java b/src/main/java/appeng/api/networking/events/MENetworkEvent.java new file mode 100644 index 00000000..3fb2dd36 --- /dev/null +++ b/src/main/java/appeng/api/networking/events/MENetworkEvent.java @@ -0,0 +1,53 @@ +package appeng.api.networking.events; + +import appeng.api.networking.IGrid; + +/** + * Part of AE's Event Bus. + * + * Posted via {@link IGrid}.postEvent or {@link IGrid}.postEventTo + */ +public class MENetworkEvent +{ + + private int visited = 0; + private boolean canceled = false; + + /** + * Call to prevent AE from posting the event to any further objects. + */ + public void cancel() + { + canceled = true; + } + + /** + * called by AE after each object is called to cancel any future calls. + * + * @return + */ + public boolean isCanceled() + { + return canceled; + } + + /** + * the number of objects that were visited by the event. + * + * @return + */ + public int getVisitedObjects() + { + return visited; + } + + /** + * Called by AE after iterating the event subscribers. + * + * @param v + */ + public void setVisitedObjects(int v) + { + visited = v; + } +} diff --git a/src/main/java/appeng/api/networking/events/MENetworkEventSubscribe.java b/src/main/java/appeng/api/networking/events/MENetworkEventSubscribe.java new file mode 100644 index 00000000..b3b8fb9a --- /dev/null +++ b/src/main/java/appeng/api/networking/events/MENetworkEventSubscribe.java @@ -0,0 +1,15 @@ +package appeng.api.networking.events; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import appeng.api.networking.IGridCache; +import appeng.api.networking.IGridHost; + +/** + * Usable on any {@link IGridHost}, or {@link IGridCache} + */ +@Retention(RetentionPolicy.RUNTIME) +public @interface MENetworkEventSubscribe { + +} diff --git a/src/main/java/appeng/api/networking/events/MENetworkPostCacheConstruction.java b/src/main/java/appeng/api/networking/events/MENetworkPostCacheConstruction.java new file mode 100644 index 00000000..05b28128 --- /dev/null +++ b/src/main/java/appeng/api/networking/events/MENetworkPostCacheConstruction.java @@ -0,0 +1,10 @@ +package appeng.api.networking.events; + +/** + * Posted after all the caches are available, but before the grid is fully + * constructed, can be used to perform cross cache construction processes. + */ +public class MENetworkPostCacheConstruction extends MENetworkEvent +{ + +} diff --git a/src/main/java/appeng/api/networking/events/MENetworkPowerIdleChange.java b/src/main/java/appeng/api/networking/events/MENetworkPowerIdleChange.java new file mode 100644 index 00000000..59366847 --- /dev/null +++ b/src/main/java/appeng/api/networking/events/MENetworkPowerIdleChange.java @@ -0,0 +1,21 @@ +package appeng.api.networking.events; + +import appeng.api.networking.IGridNode; + +/** + * Implementors of a IGridBlock must post this event when your getIdlePowerUsage + * starts returning a new value, if you do not post this event the network will + * not change the idle draw. + * + * you do not need to send this event when your node is added / removed from the grid. + */ +public class MENetworkPowerIdleChange extends MENetworkEvent +{ + + public final IGridNode node; + + public MENetworkPowerIdleChange(IGridNode nodeThatChanged) { + node = nodeThatChanged; + } + +} diff --git a/src/main/java/appeng/api/networking/events/MENetworkPowerStatusChange.java b/src/main/java/appeng/api/networking/events/MENetworkPowerStatusChange.java new file mode 100644 index 00000000..06d669cd --- /dev/null +++ b/src/main/java/appeng/api/networking/events/MENetworkPowerStatusChange.java @@ -0,0 +1,16 @@ +package appeng.api.networking.events; + +import appeng.api.networking.IGridNode; +import appeng.api.networking.energy.IEnergyGrid; + +/** + * Posted by the network when the power status of the network goes up or down, + * the change is reflected via the {@link appeng.api.networking.energy.IEnergyGrid}.isNetworkPowered() or via + * {@link IGridNode}.isActive() + * + * Note: Most machines just need to check {@link IGridNode}.isActive() + */ +public class MENetworkPowerStatusChange extends MENetworkEvent +{ + +} diff --git a/src/main/java/appeng/api/networking/events/MENetworkPowerStorage.java b/src/main/java/appeng/api/networking/events/MENetworkPowerStorage.java new file mode 100644 index 00000000..99c475e5 --- /dev/null +++ b/src/main/java/appeng/api/networking/events/MENetworkPowerStorage.java @@ -0,0 +1,38 @@ +package appeng.api.networking.events; + +import appeng.api.networking.energy.IAEPowerStorage; + +/** + * informs the network, that a {@link appeng.api.networking.energy.IAEPowerStorage} block that had either run, + * out of power, or was full, is no longer in that state. + * + * failure to post this event when your {@link appeng.api.networking.energy.IAEPowerStorage} changes state will + * result in your block not charging, or not-discharging. + * + * you do not need to send this event when your node is added / removed from the grid. + */ +public class MENetworkPowerStorage extends MENetworkEvent +{ + + public enum PowerEventType + { + /** + * informs the network this tile is ready to receive power again. + */ + REQUEST_POWER, + + /** + * informs the network this tile is ready to provide power again. + */ + PROVIDE_POWER + }; + + public final IAEPowerStorage storage; + public final PowerEventType type; + + public MENetworkPowerStorage(IAEPowerStorage t, PowerEventType y) { + storage = t; + type = y; + } + +} diff --git a/src/main/java/appeng/api/networking/events/MENetworkSecurityChange.java b/src/main/java/appeng/api/networking/events/MENetworkSecurityChange.java new file mode 100644 index 00000000..b872f03b --- /dev/null +++ b/src/main/java/appeng/api/networking/events/MENetworkSecurityChange.java @@ -0,0 +1,9 @@ +package appeng.api.networking.events; + +/** + * Posted by the security framework when permissions change + */ +public class MENetworkSecurityChange extends MENetworkEvent +{ + +} diff --git a/src/main/java/appeng/api/networking/events/MENetworkSpatialEvent.java b/src/main/java/appeng/api/networking/events/MENetworkSpatialEvent.java new file mode 100644 index 00000000..2ba0f7ba --- /dev/null +++ b/src/main/java/appeng/api/networking/events/MENetworkSpatialEvent.java @@ -0,0 +1,26 @@ +package appeng.api.networking.events; + +import appeng.api.networking.IGridHost; + +/** + * An event that is posted Whenever a spatial IO is Actived, called for IGridCache + * + * @param IGridHost ( instance of the SpatialIO block ) + * @param double ( the amount of energy that the SpatialIO uses) + */ + + +public class MENetworkSpatialEvent extends MENetworkEvent +{ + + public final IGridHost host; + public final double spatialEnergyUsage; + + + public MENetworkSpatialEvent(IGridHost SpatialIO, double EnergyUsage) { + host = SpatialIO; + spatialEnergyUsage = EnergyUsage; + + } + +} diff --git a/src/main/java/appeng/api/networking/events/MENetworkStorageEvent.java b/src/main/java/appeng/api/networking/events/MENetworkStorageEvent.java new file mode 100644 index 00000000..36a93624 --- /dev/null +++ b/src/main/java/appeng/api/networking/events/MENetworkStorageEvent.java @@ -0,0 +1,25 @@ +package appeng.api.networking.events; + +import appeng.api.storage.IMEMonitor; +import appeng.api.storage.StorageChannel; + +/** + * posted by the network when the networks Storage Changes, you can use the currentItems list to check levels, and + * update status. + * + * this is the least useful method of getting info about changes in the network. + * + * Do not modify the list or its contents in anyway. + */ +public class MENetworkStorageEvent extends MENetworkEvent +{ + + public final IMEMonitor monitor; + public final StorageChannel channel; + + public MENetworkStorageEvent(IMEMonitor o, StorageChannel chan) { + monitor = o; + channel = chan; + } + +} diff --git a/src/main/java/appeng/api/networking/pathing/ControllerState.java b/src/main/java/appeng/api/networking/pathing/ControllerState.java new file mode 100644 index 00000000..37042720 --- /dev/null +++ b/src/main/java/appeng/api/networking/pathing/ControllerState.java @@ -0,0 +1,19 @@ +package appeng.api.networking.pathing; + +public enum ControllerState +{ + /** + * No controller blocks are present in the network. + */ + NO_CONTROLLER, + + /** + * Controller rules followed, booting enabled. + */ + CONTROLLER_ONLINE, + + /** + * Controller rules not followed, lock up while booting. + */ + CONTROLLER_CONFLICT +} diff --git a/src/main/java/appeng/api/networking/pathing/IPathingGrid.java b/src/main/java/appeng/api/networking/pathing/IPathingGrid.java new file mode 100644 index 00000000..90f30e04 --- /dev/null +++ b/src/main/java/appeng/api/networking/pathing/IPathingGrid.java @@ -0,0 +1,24 @@ +package appeng.api.networking.pathing; + +import appeng.api.networking.IGridCache; + +public interface IPathingGrid extends IGridCache +{ + + /** + * @return true if the network is in its booting stage + */ + boolean isNetworkBooting(); + + /** + * @return the controller state of the network, useful if you want to + * require a controller for a feature. + */ + ControllerState getControllerState(); + + /** + * trigger a network reset, booting, pathfinding and all. + */ + void repath(); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/networking/security/BaseActionSource.java b/src/main/java/appeng/api/networking/security/BaseActionSource.java new file mode 100644 index 00000000..193b37e8 --- /dev/null +++ b/src/main/java/appeng/api/networking/security/BaseActionSource.java @@ -0,0 +1,16 @@ +package appeng.api.networking.security; + +public class BaseActionSource +{ + + public boolean isPlayer() + { + return false; + } + + public boolean isMachine() + { + return false; + } + +} diff --git a/src/main/java/appeng/api/networking/security/IActionHost.java b/src/main/java/appeng/api/networking/security/IActionHost.java new file mode 100644 index 00000000..e6aa7a19 --- /dev/null +++ b/src/main/java/appeng/api/networking/security/IActionHost.java @@ -0,0 +1,19 @@ +package appeng.api.networking.security; + +import appeng.api.networking.IGridHost; +import appeng.api.networking.IGridNode; + +public interface IActionHost extends IGridHost +{ + + /** + * Used to for calculating security rules, you must supply a node from your + * IGridHost for the security test, this should be the primary node for the + * machine, unless the action is preformed by a non primary node. + * + * @return the the gridnode that actions from this IGridHost are preformed + * by. + */ + IGridNode getActionableNode(); + +} diff --git a/src/main/java/appeng/api/networking/security/ISecurityGrid.java b/src/main/java/appeng/api/networking/security/ISecurityGrid.java new file mode 100644 index 00000000..6fb1d85d --- /dev/null +++ b/src/main/java/appeng/api/networking/security/ISecurityGrid.java @@ -0,0 +1,40 @@ +package appeng.api.networking.security; + +import net.minecraft.entity.player.EntityPlayer; +import appeng.api.config.SecurityPermissions; +import appeng.api.networking.IGridCache; + +public interface ISecurityGrid extends IGridCache +{ + + /** + * @return true if a security provider is in the network ( and only 1 ) + */ + boolean isAvailable(); + + /** + * Check if a player has permissions. + * + * @param player + * @param perm + * + * @return true if the player has permissions. + */ + boolean hasPermission(EntityPlayer player, SecurityPermissions perm); + + /** + * Check if a player has permissions. + * + * @param player + * @param perm + * + * @return true if the player has permissions. + */ + boolean hasPermission(int playerID, SecurityPermissions perm); + + /** + * @return PlayerID of the admin, or owner, this is the person who placed the security block. + */ + int getOwner(); + +} diff --git a/src/main/java/appeng/api/networking/security/MachineSource.java b/src/main/java/appeng/api/networking/security/MachineSource.java new file mode 100644 index 00000000..ddce68fa --- /dev/null +++ b/src/main/java/appeng/api/networking/security/MachineSource.java @@ -0,0 +1,18 @@ +package appeng.api.networking.security; + +public class MachineSource extends BaseActionSource +{ + + public final IActionHost via; + + @Override + public boolean isMachine() + { + return true; + } + + public MachineSource(IActionHost v) { + via = v; + } + +} diff --git a/src/main/java/appeng/api/networking/security/PlayerSource.java b/src/main/java/appeng/api/networking/security/PlayerSource.java new file mode 100644 index 00000000..335a16ae --- /dev/null +++ b/src/main/java/appeng/api/networking/security/PlayerSource.java @@ -0,0 +1,22 @@ +package appeng.api.networking.security; + +import net.minecraft.entity.player.EntityPlayer; + +public class PlayerSource extends BaseActionSource +{ + + public final EntityPlayer player; + public final IActionHost via; + + @Override + public boolean isPlayer() + { + return true; + } + + public PlayerSource(EntityPlayer p, IActionHost v) { + player = p; + via = v; + } + +} diff --git a/src/main/java/appeng/api/networking/spatial/ISpatialCache.java b/src/main/java/appeng/api/networking/spatial/ISpatialCache.java new file mode 100644 index 00000000..3a97868b --- /dev/null +++ b/src/main/java/appeng/api/networking/spatial/ISpatialCache.java @@ -0,0 +1,39 @@ +package appeng.api.networking.spatial; + +import appeng.api.networking.IGridCache; +import appeng.api.util.DimensionalCoord; + +public interface ISpatialCache extends IGridCache +{ + + /** + * @return true if a region is defined at all, it dosn't have to be valid, but all points must be in the same world. + */ + boolean hasRegion(); + + /** + * @return true if the region defined is valid according to all rules. + */ + boolean isValidRegion(); + + /** + * @return the minimum anchor point for the spatial region. + */ + DimensionalCoord getMin(); + + /** + * @return the maximum anchor point for the spatial region. + */ + DimensionalCoord getMax(); + + /** + * @return how many AE units are required to preform the activation + */ + long requiredPower(); + + /** + * @return current 100% - 0% effiency. + */ + float currentEffiency(); + +} diff --git a/src/main/java/appeng/api/networking/storage/IStackWatcher.java b/src/main/java/appeng/api/networking/storage/IStackWatcher.java new file mode 100644 index 00000000..f27ecf77 --- /dev/null +++ b/src/main/java/appeng/api/networking/storage/IStackWatcher.java @@ -0,0 +1,10 @@ +package appeng.api.networking.storage; + +import java.util.Collection; + +import appeng.api.storage.data.IAEStack; + +public interface IStackWatcher extends Collection +{ + +} diff --git a/src/main/java/appeng/api/networking/storage/IStackWatcherHost.java b/src/main/java/appeng/api/networking/storage/IStackWatcherHost.java new file mode 100644 index 00000000..f94ef3c9 --- /dev/null +++ b/src/main/java/appeng/api/networking/storage/IStackWatcherHost.java @@ -0,0 +1,30 @@ +package appeng.api.networking.storage; + +import appeng.api.networking.security.BaseActionSource; +import appeng.api.storage.StorageChannel; +import appeng.api.storage.data.IAEStack; +import appeng.api.storage.data.IItemList; + +public interface IStackWatcherHost +{ + + /** + * provides the IStackWatcher for this host, for the current network, is called when the hot changes networks. You + * do not need to clear your old watcher, its already been removed by the time this gets called. + * + * @param newWatcher + */ + void updateWatcher(IStackWatcher newWatcher); + + /** + * Called when a watched item changes amounts. + * + * @param o + * @param fullStack + * @param diffStack + * @param src + * @param chan + */ + void onStackChange(IItemList o, IAEStack fullStack, IAEStack diffStack, BaseActionSource src, StorageChannel chan); + +} diff --git a/src/main/java/appeng/api/networking/storage/IStorageGrid.java b/src/main/java/appeng/api/networking/storage/IStorageGrid.java new file mode 100644 index 00000000..ee3fcab5 --- /dev/null +++ b/src/main/java/appeng/api/networking/storage/IStorageGrid.java @@ -0,0 +1,27 @@ +package appeng.api.networking.storage; + +import appeng.api.networking.IGridCache; +import appeng.api.networking.security.BaseActionSource; +import appeng.api.storage.IStorageMonitorable; +import appeng.api.storage.StorageChannel; +import appeng.api.storage.data.IAEStack; + +/** + * Common base class for item / fluid storage caches. + */ +public interface IStorageGrid extends IGridCache, IStorageMonitorable +{ + + /** + * Used to inform the network of alterations to the storage system that fall outside of the standard Network + * operations, Examples, ME Chest inputs from the world, or a Storage Bus detecting modifications made to the chest + * by an outside force. + * + * Expects the input to have either a negative or a positive stack size to correspond to the injection, or + * extraction operation. + * + * @param input + */ + void postAlterationOfStoredItems(StorageChannel chan, IAEStack input, BaseActionSource src); + +} diff --git a/src/main/java/appeng/api/networking/ticking/IGridTickable.java b/src/main/java/appeng/api/networking/ticking/IGridTickable.java new file mode 100644 index 00000000..66d3c898 --- /dev/null +++ b/src/main/java/appeng/api/networking/ticking/IGridTickable.java @@ -0,0 +1,56 @@ +package appeng.api.networking.ticking; + +import appeng.api.networking.IGridNode; + +/** + * Implement on IGridHosts which want to use AE's Network Ticking Feature. + */ +public interface IGridTickable +{ + + /** + * Important note regarding IGridTickables with more then one one node, + * + * If your IGridHost hosts multiple nodes, it may be on multiple grids, or + * its node may be present on the same grid multiple times, this is as + * designed, however if you choose to use the grid to tick these Hosts you + * must be aware that they they should probably pick a single node to tick + * for, and not tick for each node. + * + */ + + /** + * You can return null, if you wish to tick using MC's ticking mechanism, or + * you can return a valid TickingRequest to tell AE a guide for which type + * of responsiveness your device wants. + * + * this will be called for your tile any time your tile changes grids, this + * can happen at any time, so if your using the sleep feature you may wish + * to preserve your sleep, in the result of this method. or you can simply + * reset it. + * + * @return null or a valid new TickingRequest + * + */ + TickingRequest getTickingRequest(IGridNode node); + + /** + * AE lets you adjust your tick rate based on the results of your tick, if + * your block as accomplished work you may wish to increase the ticking + * speed, if your block is idle you may wish to slow it down. + * + * Its up to you. + * + * Note: this is never called if you return null from getTickingRequest. + * + * @param TicksSinceLastCall + * the number of world ticks that were skipped since your last + * tick, you can use this to adjust speed of processing or adjust + * your tick rate. + * + * @return tick rate adjustment. + * + */ + TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall); + +} diff --git a/src/main/java/appeng/api/networking/ticking/ITickManager.java b/src/main/java/appeng/api/networking/ticking/ITickManager.java new file mode 100644 index 00000000..aa7c0325 --- /dev/null +++ b/src/main/java/appeng/api/networking/ticking/ITickManager.java @@ -0,0 +1,44 @@ +package appeng.api.networking.ticking; + +import appeng.api.networking.IGridCache; +import appeng.api.networking.IGridNode; + +/** + * + * The network tick manager. + * + */ +public interface ITickManager extends IGridCache +{ + + /** + * immediately sets the node to tick, only valid if your node is marked as "Alertable" in its TickingRequest + * + * Sleeping Devices Still Alertable, when your tile is alerted its new status is determined by the result of its + * tick. + * + * @param node + */ + boolean alertDevice(IGridNode node); + + /** + * + * disables ticking for your device. + * + * @param node + * + * @return if the call was successful. + */ + boolean sleepDevice(IGridNode node); + + /** + * + * enables ticking for your device, undoes a sleepDevice call. + * + * @param node + * + * @return if the call was successful. + */ + boolean wakeDevice(IGridNode node); + +} diff --git a/src/main/java/appeng/api/networking/ticking/TickRateModulation.java b/src/main/java/appeng/api/networking/ticking/TickRateModulation.java new file mode 100644 index 00000000..1298b5ab --- /dev/null +++ b/src/main/java/appeng/api/networking/ticking/TickRateModulation.java @@ -0,0 +1,34 @@ +package appeng.api.networking.ticking; + +public enum TickRateModulation +{ + /** + * same as idle, but also puts the node to sleep. + */ + SLEEP, + + /** + * set tick rate to maximum. + */ + IDLE, + + /** + * decrease the tick rate marginally. + */ + SLOWER, + + /** + * continue at current rate. + */ + SAME, + + /** + * increase the tick rate marginally. + */ + FASTER, + + /** + * changes the tick rate to the minimum tick rate. + */ + URGENT +} diff --git a/src/main/java/appeng/api/networking/ticking/TickingRequest.java b/src/main/java/appeng/api/networking/ticking/TickingRequest.java new file mode 100644 index 00000000..4e72eef9 --- /dev/null +++ b/src/main/java/appeng/api/networking/ticking/TickingRequest.java @@ -0,0 +1,54 @@ +package appeng.api.networking.ticking; + +/** + * + * Describes how your tiles ticking is executed. + * + */ +public class TickingRequest +{ + + /** + * the minimum number of ticks that must pass between ticks. + * + * Valid Values are : 1+ + * + * Suggested is 5-20 + * + */ + public final int minTickRate; + + /** + * the maximum number of ticks that can pass between ticks, if this value is + * exceeded the tile must tick. + * + * Valid Values are 1+ + * + * Suggested is 20-40 + * + */ + public final int maxTickRate; + + /** + * + * Determines the current expected state of your node, if your node expects + * to be sleeping, then return true. + * + */ + public final boolean isSleeping; + + /** + * + * True only if you call {@link appeng.api.networking.ticking.ITickManager}.alertDevice( IGridNode ); + * + */ + public final boolean canBeAlerted; + + public TickingRequest(int min, int max, boolean sleep, boolean alertable) { + minTickRate = min; + maxTickRate = max; + isSleeping = sleep; + canBeAlerted = alertable; + } + +} diff --git a/src/main/java/appeng/api/package-info.java b/src/main/java/appeng/api/package-info.java new file mode 100644 index 00000000..412c6d37 --- /dev/null +++ b/src/main/java/appeng/api/package-info.java @@ -0,0 +1,4 @@ +//@API(apiVersion = "1.0", owner = "appliedenergistics2", provides = "appliedenergistics2|API") +package appeng.api; + + diff --git a/src/main/java/appeng/api/parts/BusSupport.java b/src/main/java/appeng/api/parts/BusSupport.java new file mode 100644 index 00000000..1702bbce --- /dev/null +++ b/src/main/java/appeng/api/parts/BusSupport.java @@ -0,0 +1,10 @@ +package appeng.api.parts; + +public enum BusSupport +{ + CABLE, + + DENSE_CABLE, + + NO_PARTS +} diff --git a/src/main/java/appeng/api/parts/IFacadeContainer.java b/src/main/java/appeng/api/parts/IFacadeContainer.java new file mode 100644 index 00000000..0b9ef94e --- /dev/null +++ b/src/main/java/appeng/api/parts/IFacadeContainer.java @@ -0,0 +1,30 @@ +package appeng.api.parts; + +import net.minecraftforge.common.util.ForgeDirection; + +/** + * Used Internally. + * + * not intended for implementation. + */ +public interface IFacadeContainer +{ + + /** + * Attempts to add the {@link appeng.api.parts.IFacadePart} to the given side. + * + * @return true if the facade as successfully added. + */ + boolean addFacade(IFacadePart a); + + /** + * Removed the facade on the given side, or does nothing. + */ + void removeFacade(IPartHost host, ForgeDirection side); + + /** + * @return the {@link appeng.api.parts.IFacadePart} for a given side, or null. + */ + IFacadePart getFacade(ForgeDirection s); + +} diff --git a/src/main/java/appeng/api/parts/IFacadePart.java b/src/main/java/appeng/api/parts/IFacadePart.java new file mode 100644 index 00000000..c23523a9 --- /dev/null +++ b/src/main/java/appeng/api/parts/IFacadePart.java @@ -0,0 +1,72 @@ +package appeng.api.parts; + +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraftforge.common.util.ForgeDirection; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * Used Internally. + * + * not intended for implementation. + */ +public interface IFacadePart +{ + + /** + * used to save the part. + */ + ItemStack getItemStack(); + + /** + * used to collide, and pick the part + * + * @param ch + */ + void getBoxes(IPartCollsionHelper ch); + + /** + * render the part. + * + * @param xCoord + * @param yCoord + * @param zCoord + * @param instance + * @param renderer + * @param busBounds + * @param b + */ + @SideOnly(Side.CLIENT) + void renderStatic(int x, int y, int z, IPartRenderHelper instance, RenderBlocks renderer, IFacadeContainer fc, AxisAlignedBB busBounds, boolean renderStilt); + + /** + * render the part in inventory. + * + * @param instance + * @param renderer + */ + @SideOnly(Side.CLIENT) + void renderInventory(IPartRenderHelper instance, RenderBlocks renderer); + + /** + * @return side the facade is in + */ + ForgeDirection getSide(); + + /** + * @return the box for the face of the facade + */ + AxisAlignedBB getPrimaryBox(); + + Item getItem(); + + int getItemDamage(); + + boolean isBC(); + + void setThinFacades(boolean useThinFacades); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/parts/IPart.java b/src/main/java/appeng/api/parts/IPart.java new file mode 100644 index 00000000..b3bba63e --- /dev/null +++ b/src/main/java/appeng/api/parts/IPart.java @@ -0,0 +1,265 @@ +package appeng.api.parts; + +import io.netty.buffer.ByteBuf; + +import java.io.IOException; +import java.util.List; +import java.util.Random; + +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.networking.IGridNode; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public interface IPart +{ + + /** + * get an ItemStack that represents the bus, should contain the settings for whatever, can also be used in + * conjunction with removePart to take a part off and drop it or something. + * + * This is used to drop the bus, and to save the bus, when saving the bus, wrenched is false, and writeToNBT will be + * called to save improtant details about the part, if the part is wrenched include in your NBT Data any settings + * you might want to keep around, you can restore those settings when constructing your part. + * + * @param type + * , what kind of ItemStack to return? + * @return + */ + ItemStack getItemStack(PartItemStack type); + + /** + * render item form for inventory, or entity. + * + * GL Available + * + * @param te + * @param rh + */ + @SideOnly(Side.CLIENT) + void renderInventory(IPartRenderHelper rh, RenderBlocks renderer); + + /** + * render world renderer ( preferred ) + * + * GL is NOT Available + * + * @param x + * @param y + * @param z + * @param te + * @param rh + */ + @SideOnly(Side.CLIENT) + void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer); + + /** + * render TESR. + * + * GL Available + * + * @param x + * @param y + * @param z + * @param te + * @param rh + */ + @SideOnly(Side.CLIENT) + void renderDynamic(double x, double y, double z, IPartRenderHelper rh, RenderBlocks renderer); + + /** + * return true only if your part require dynamic rendering, must be consistent. + * + * @return true to enable renderDynamic + */ + boolean requireDynamicRender(); + + /** + * @return if the bus has a solid side, and you can place random stuff on it like torches or levers + */ + boolean isSolid(); + + /** + * @return true if this part can connect to redstone ( also MFR Rednet ) + */ + boolean canConnectRedstone(); + + /** + * Write the part information for saving, the part will be saved with getItemStack(false) and this method will be + * called after to load settings, inventory or other values from the world. + * + * @param data + */ + void writeToNBT(NBTTagCompound data); + + /** + * Read the previously written NBT Data. this is the mirror for writeToNBT + * + * @param data + */ + void readFromNBT(NBTTagCompound data); + + /** + * @return get the amount of light produced by the bus + */ + int getLightLevel(); + + /** + * does this part act like a ladder? + * + * @param entity + * @return + */ + boolean isLadder(EntityLivingBase entity); + + /** + * a block around the bus's host has been changed. + */ + void onNeighborChanged(); + + /** + * @return output redstone on facing side + */ + int isProvidingStrongPower(); + + /** + * @return output redstone on facing side + */ + int isProvidingWeakPower(); + + /** + * write data to bus packet. + * + * @param data + * @throws java.io.IOException + */ + void writeToStream(ByteBuf data) throws IOException; + + /** + * read data from bus packet. + * + * @param data + * @return true will re-draw the part. + * @throws java.io.IOException + */ + boolean readFromStream(ByteBuf data) throws IOException; + + /** + * get the Grid Node for the Bus, be sure your IGridBlock is NOT isWorldAccessable, if it is your going to cause + * crashes. + * + * or null if you don't have a grid node. + * + * @return + */ + IGridNode getGridNode(); + + /** + * called when an entity collides with the bus. + * + * @param entity + */ + void onEntityCollision(Entity entity); + + /** + * called when your part is being removed from the world. + */ + void removeFromWorld(); + + /** + * called when your part is being added to the world. + */ + void addToWorld(); + + /** + * used for tunnels. + * + * @return a grid node that represents the external facing side, these must be isWorldAccessable with the correct + * faces marked as external + */ + IGridNode getExternalFacingNode(); + + /** + * called by the Part host to keep your part informed. + * + * @param host + * @param tile + */ + void setPartHostInfo(ForgeDirection side, IPartHost host, TileEntity tile); + + /** + * add your collision information to the the list. + * + * @param boxes + */ + void getBoxes(IPartCollsionHelper bch); + + /** + * Called when you right click the part, very similar to Block.onActivateBlock + * + * @param player + * @param pos + * @return if your activate method performed something. + */ + boolean onActivate(EntityPlayer player, Vec3 pos); + + /** + * Called when you right click the part, very similar to Block.onActivateBlock + * + * @param player + * @param pos + * @return if your activate method performed something, you should use false unless you really need it. + */ + boolean onShiftActivate(EntityPlayer player, Vec3 pos); + + /** + * Add drops to the items being dropped into the world, if your item stores its contents when wrenched use the + * wrenched boolean to control what data is saved vs dropped when it is broken. + * + * @param drops + * @param wrenched + */ + void getDrops(List drops, boolean wrenched); + + /** + * @return 0 - 8, reasonable default 3-4, this controls the cable connection to the node. + */ + int cableConnectionRenderTo(); + + /** + * same as Block.randomDisplayTick, for but parts. + * + * @param world + * @param x + * @param y + * @param z + * @param r + */ + void randomDisplayTick(World world, int x, int y, int z, Random r); + + /** + * Called when placed in the world by a player, this happens before addWorld. + * + * @param player + * @param held + * @param side + */ + void onPlacement(EntityPlayer player, ItemStack held, ForgeDirection side); + + /** + * Used to determine which parts can be placed on what cables. + * + * @param what + * @return true if the part can be placed on this support. + */ + boolean canBePlacedOn(BusSupport what); +} \ No newline at end of file diff --git a/src/main/java/appeng/api/parts/IPartCollsionHelper.java b/src/main/java/appeng/api/parts/IPartCollsionHelper.java new file mode 100644 index 00000000..7aa4346b --- /dev/null +++ b/src/main/java/appeng/api/parts/IPartCollsionHelper.java @@ -0,0 +1,42 @@ +package appeng.api.parts; + +import net.minecraftforge.common.util.ForgeDirection; + +public interface IPartCollsionHelper +{ + + /** + * add a collision box, expects 0.0 - 16.0 block coords. + * + * No complaints about the size, I like using pixels :P + * + * @param minX + * @param minY + * @param minZ + * @param maxX + * @param maxY + * @param maxZ + */ + void addBox(double minX, double minY, double minZ, double maxX, double maxY, double maxZ); + + /** + * @return east in world space. + */ + ForgeDirection getWorldX(); + + /** + * @return up in world space. + */ + ForgeDirection getWorldY(); + + /** + * @return forward in world space. + */ + ForgeDirection getWorldZ(); + + /** + * @return true if this test is to get the BB Collision information. + */ + boolean isBBCollision(); + +} diff --git a/src/main/java/appeng/api/parts/IPartHelper.java b/src/main/java/appeng/api/parts/IPartHelper.java new file mode 100644 index 00000000..2abc4428 --- /dev/null +++ b/src/main/java/appeng/api/parts/IPartHelper.java @@ -0,0 +1,58 @@ +package appeng.api.parts; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public interface IPartHelper +{ + + /** + * Register a new layer with the part layer system, this allows you to write + * an in between between tile entities and parts. + * + * AE By Default includes, + * + * 1. ISidedInventory ( and by extension IInventory. ) + * + * 2. IFluidHandler Forge Fluids + * + * 3. IPowerEmitter BC Power output. + * + * 4. IPowerReceptor BC Power input. + * + * 5. IEnergySink IC2 Power input. + * + * 6. IEnergySource IC2 Power output. + * + * 7. IPipeConnection BC Pipe Connections + * + * As long as a valid layer is registered for a interface you can simply + * implement that interface on a part get implement it. + * + * @return true on success, false on failure, usually a error will be logged + * as well. + */ + boolean registerNewLayer(String string, String layerInterface); + + /** + * Register IBusItem with renderer + */ + void setItemBusRenderer(IPartItem i); + + /** + * use in use item, to try and place a IBusItem + * + * @param is + * ItemStack of an item which implements {@link appeng.api.parts.IPartItem} + * @param x + * @param y + * @param z + * @param side + * @param player + * @param world + * @return + */ + boolean placeBus(ItemStack is, int x, int y, int z, int side, EntityPlayer player, World world); + +} diff --git a/src/main/java/appeng/api/parts/IPartHost.java b/src/main/java/appeng/api/parts/IPartHost.java new file mode 100644 index 00000000..c1041dfc --- /dev/null +++ b/src/main/java/appeng/api/parts/IPartHost.java @@ -0,0 +1,135 @@ +package appeng.api.parts; + +import java.util.Set; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Vec3; +import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.util.AEColor; +import appeng.api.util.DimensionalCoord; + +/** + * Implemented on AE's TileEntity or AE's FMP Part. + * + * Do Not Implement + */ +public interface IPartHost +{ + + /** + * @return the facade container + */ + IFacadeContainer getFacadeContainer(); + + /** + * Test if you can add a part to the specified side of the Part Host, {@link net.minecraftforge.common.util.ForgeDirection}.UNKNOWN is used to + * represent the cable in the middle. + * + * @param is + * @param side + * @return returns false if the part cannot be added. + */ + boolean canAddPart(ItemStack part, ForgeDirection side); + + /** + * try to add a new part to the specified side, returns false if it failed to be added. + * + * @param is + * @param side + * @param owner + * @return null if the item failed to add, the side it was placed on other wise ( may different for cables, + * {@link net.minecraftforge.common.util.ForgeDirection}.UNKNOWN ) + */ + ForgeDirection addPart(ItemStack is, ForgeDirection side, EntityPlayer owner); + + /** + * Get part by side ( center is {@link net.minecraftforge.common.util.ForgeDirection}.UNKNOWN ) + * + * @param side + * @return the part located on the specified side, or null if there is no part. + */ + IPart getPart(ForgeDirection side); + + /** + * removes the part on the side, this doesn't drop it or anything, if you don't do something with it, its just + * "gone" and its never coming back; think about it. + * + * if you want to drop the part you must request it prior to removing it. + * + * @param side + * @param suppressUpdate + * - used if you need to replace a part's instance, without really removing it first. + */ + void removePart(ForgeDirection side, boolean suppressUpdate); + + /** + * something changed, might want to send a packet to clients to update state. + */ + void markForUpdate(); + + /** + * @return the physical location of the part host in the universe. + */ + DimensionalCoord getLocation(); + + /** + * @return the tile entity for the host, this can either be an FMP tile, or a AE tile + */ + TileEntity getTile(); + + /** + * @return the color of the host type ( this is determined by the middle cable. ) if no cable is present, it returns + * {@link appeng.api.util.AEColor} .Transparent other wise it returns the color of the cable in the center. + */ + AEColor getColor(); + + /** + * destroys the part container, for internal use. + */ + void clearContainer(); + + /** + * Used to test for FMP microblock blocking internally. + * + * @return returns if microblocks are blocking this cable path. + */ + boolean isBlocked(ForgeDirection side); + + /** + * finds the part located at the position ( pos must be relative, not global ) + * + * @param pos + * @return a new SelectedPart, this is never null. + */ + SelectedPart selectPart(Vec3 pos); + + /** + * can be used by parts to trigger the tile or part to save. + */ + void markForSave(); + + /** + * part of the {@link LayerBase} + */ + void partChanged(); + + /** + * get the redstone state of host on this side, this value is cached internally. + * + * @param side + * @return true of the part host is receieveing redstone from an external source. + */ + boolean hasRedstone(ForgeDirection side); + + /** + * returns false if this block contains any parts or facades, true other wise. + */ + boolean isEmpty(); + + /** + * @return a mutable list of flags you can adjust to track state. + */ + Set getLayerFlags(); +} \ No newline at end of file diff --git a/src/main/java/appeng/api/parts/IPartItem.java b/src/main/java/appeng/api/parts/IPartItem.java new file mode 100644 index 00000000..584e8c8e --- /dev/null +++ b/src/main/java/appeng/api/parts/IPartItem.java @@ -0,0 +1,37 @@ +package appeng.api.parts; + +import net.minecraft.item.ItemStack; + +//@formatter:off +/** + * This is a pretty basic requirement, once you implement the interface, and createPartFromItemStack + * + * you must register your bus with the Bus renderer, using AEApi.instance().partHelper().setItemBusRenderer( this ); + * + * then simply add these two methods, which tell MC to use the Block Textures, and call AE's Bus Placement Code. + * + * @Override + * @SideOnly(Side.CLIENT) + * public int getSpriteNumber() + * { + * return 0; + * } + * + * @Override + * public boolean onItemUse(ItemStack is, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) + * { + * return AEApi.instance().partHelper().placeBus( is, x, y, z, side, player, world ); + * } + */ +public interface IPartItem +{ + + /** + * create a new part instance, from the item stack. + * + * @param is + * @return + */ + IPart createPartFromItemStack(ItemStack is); + +} diff --git a/src/main/java/appeng/api/parts/IPartRenderHelper.java b/src/main/java/appeng/api/parts/IPartRenderHelper.java new file mode 100644 index 00000000..5b311aa4 --- /dev/null +++ b/src/main/java/appeng/api/parts/IPartRenderHelper.java @@ -0,0 +1,152 @@ +package appeng.api.parts; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public interface IPartRenderHelper +{ + + /** + * sets the Render Helpers Block Bounds. 0.0 - 16.0 block coords. + * + * No complaints about the size, I like using pixels :P + * + * @param minX + * @param minY + * @param minZ + * @param maxX + * @param maxY + * @param maxZ + */ + void setBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ); + + /** + * static renderer + * + * render a single face. + * + * @param x + * @param y + * @param z + * @param ico + * @param face + * @param renderer + */ + @SideOnly(Side.CLIENT) + void renderFace(int x, int y, int z, IIcon ico, ForgeDirection face, RenderBlocks renderer); + + /** + * static renderer + * + * render a box with a cut out box in the center. + * + * @param x + * @param y + * @param z + * @param ico + * @param face + * @param edgeThickness + * @param renderer + */ + @SideOnly(Side.CLIENT) + void renderFaceCutout(int x, int y, int z, IIcon ico, ForgeDirection face, float edgeThickness, RenderBlocks renderer); + + /** + * static renderer + * + * render a block of specified bounds. + * + * @param x + * @param y + * @param z + * @param renderer + */ + @SideOnly(Side.CLIENT) + void renderBlock(int x, int y, int z, RenderBlocks renderer); + + /** + * render a single face in inventory renderer. + * + * @param IIcon + * @param south + * @param renderer + */ + @SideOnly(Side.CLIENT) + void renderInventoryFace(IIcon IIcon, ForgeDirection south, RenderBlocks renderer); + + /** + * render a box in inventory renderer. + * + * @param renderer + */ + @SideOnly(Side.CLIENT) + void renderInventoryBox(RenderBlocks renderer); + + /** + * inventory, and static renderer. + * + * set unique icons for each side of the block. + * + * @param Down + * @param Up + * @param North + * @param South + * @param West + * @param East + */ + void setTexture(IIcon Down, IIcon Up, IIcon North, IIcon South, IIcon West, IIcon East); + + /** + * inventory, and static renderer. + * + * set all sides to a single IIcon. + * + * @param ico + */ + void setTexture(IIcon ico); + + /** + * configure the color multiplier for the inventory renderer. + * + * @param whiteVariant + */ + void setInvColor(int whiteVariant); + + /** + * @return the block used for rendering, might need it for some reason... + */ + Block getBlock(); + + /** + * @return the east vector in world directions, rather then renderer + */ + ForgeDirection getWorldX(); + + /** + * @return the up vector in world directions, rather then renderer. + */ + ForgeDirection getWorldY(); + + /** + * @return the forward vector in world directions, rather then renderer. + */ + ForgeDirection getWorldZ(); + + /** + * Pre-Calculates default lighting for the part, call this before using the render helper to render anything else to + * get simplified, but faster lighting for more then one block. + * + * Only worth it if you render more then 1 block. + */ + ISimplifiedBundle useSimpliedRendering(int x, int y, int z, IPart p, ISimplifiedBundle sim); + + /** + * disables, useSimpliedRendering. + */ + void normalRendering(); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/parts/ISimplifiedBundle.java b/src/main/java/appeng/api/parts/ISimplifiedBundle.java new file mode 100644 index 00000000..ad093459 --- /dev/null +++ b/src/main/java/appeng/api/parts/ISimplifiedBundle.java @@ -0,0 +1,7 @@ +package appeng.api.parts; + + +public interface ISimplifiedBundle +{ + +} diff --git a/src/main/java/appeng/api/parts/LayerBase.java b/src/main/java/appeng/api/parts/LayerBase.java new file mode 100644 index 00000000..0c59d2e7 --- /dev/null +++ b/src/main/java/appeng/api/parts/LayerBase.java @@ -0,0 +1,46 @@ +package appeng.api.parts; + +import java.util.Set; + +import net.minecraftforge.common.util.ForgeDirection; + +/** + * All Layers must extends this, this get part implementation is provided to interface with the parts, however a real + * implementation will be used at runtime. + */ +public class LayerBase // implements IPartHost +{ + + /** + * Grants access for the layer to the parts of the host. + * + * This Method looks silly, thats because its not used at runtime, a real implementation will be used instead. + * + * @param side + * @return the part for the requested side. + */ + public IPart getPart(ForgeDirection side) + { + return null; // place holder. + } + + /** + * called when the parts change in the container, YOU MUST CALL super.PartChanged(); + */ + public void partChanged() + { + } + + /** + * @return a mutable list of flags you can adjust to track state. + */ + public Set getLayerFlags() + { + return null; // place holder. + } + + public void markDirty() + { + // something! + } +} diff --git a/src/main/java/appeng/api/parts/LayerFlags.java b/src/main/java/appeng/api/parts/LayerFlags.java new file mode 100644 index 00000000..08d720be --- /dev/null +++ b/src/main/java/appeng/api/parts/LayerFlags.java @@ -0,0 +1,8 @@ +package appeng.api.parts; + +public enum LayerFlags +{ + + IC2_ENET + +} diff --git a/src/main/java/appeng/api/parts/PartItemStack.java b/src/main/java/appeng/api/parts/PartItemStack.java new file mode 100644 index 00000000..4c8c72dc --- /dev/null +++ b/src/main/java/appeng/api/parts/PartItemStack.java @@ -0,0 +1,14 @@ +package appeng.api.parts; + +public enum PartItemStack +{ + Pick, + + Break, + + Wrench, + + Network, + + World +} diff --git a/src/main/java/appeng/api/parts/SelectedPart.java b/src/main/java/appeng/api/parts/SelectedPart.java new file mode 100644 index 00000000..464be4b5 --- /dev/null +++ b/src/main/java/appeng/api/parts/SelectedPart.java @@ -0,0 +1,44 @@ +package appeng.api.parts; + +import net.minecraftforge.common.util.ForgeDirection; + +/** + * Reports a selected part from th IPartHost + */ +public class SelectedPart +{ + + /** + * selected part. + */ + public final IPart part; + + /** + * facade part. + */ + public final IFacadePart facade; + + /** + * side the part is mounted too, or {@link net.minecraftforge.common.util.ForgeDirection}.UNKNOWN for cables. + */ + public final ForgeDirection side; + + public SelectedPart() { + part = null; + facade = null; + side = ForgeDirection.UNKNOWN; + } + + public SelectedPart(IPart part, ForgeDirection side) { + this.part = part; + facade = null; + this.side = side; + } + + public SelectedPart(IFacadePart facade, ForgeDirection side) { + part = null; + this.facade = facade; + this.side = side; + } + +} diff --git a/src/main/java/appeng/api/parts/layers/InvSot.java b/src/main/java/appeng/api/parts/layers/InvSot.java new file mode 100644 index 00000000..320a7219 --- /dev/null +++ b/src/main/java/appeng/api/parts/layers/InvSot.java @@ -0,0 +1,47 @@ +package appeng.api.parts.layers; + +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; + +public class InvSot +{ + + final public ISidedInventory partInv; + final public int index; + + public InvSot(ISidedInventory part, int slot) { + partInv = part; + index = slot; + } + + public ItemStack decrStackSize(int j) + { + return partInv.decrStackSize( index, j ); + } + + public ItemStack getStackInSlot() + { + return partInv.getStackInSlot( index ); + } + + public boolean isItemValidForSlot(ItemStack itemstack) + { + return partInv.isItemValidForSlot( index, itemstack ); + } + + public void setInventorySlotContents(ItemStack itemstack) + { + partInv.setInventorySlotContents( index, itemstack ); + } + + public boolean canExtractItem(ItemStack itemstack, int side) + { + return partInv.canExtractItem( index, itemstack, side ); + } + + public boolean canInsertItem(ItemStack itemstack, int side) + { + return partInv.canInsertItem( index, itemstack, side ); + } + +} diff --git a/src/main/java/appeng/api/parts/layers/LayerIEnergySink.java b/src/main/java/appeng/api/parts/layers/LayerIEnergySink.java new file mode 100644 index 00000000..548a8710 --- /dev/null +++ b/src/main/java/appeng/api/parts/layers/LayerIEnergySink.java @@ -0,0 +1,143 @@ +package appeng.api.parts.layers; + +import ic2.api.energy.tile.IEnergySink; +import ic2.api.energy.tile.IEnergyTile; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.parts.IPart; +import appeng.api.parts.IPartHost; +import appeng.api.parts.LayerBase; +import appeng.api.parts.LayerFlags; +import appeng.util.Platform; + +public class LayerIEnergySink extends LayerBase implements IEnergySink +{ + + private boolean isInIC2() + { + return getLayerFlags().contains( LayerFlags.IC2_ENET ); + } + + private TileEntity getEnergySinkTile() + { + IPartHost host = (IPartHost) this; + return host.getTile(); + } + + private World getEnergySinkWorld() + { + return getEnergySinkTile().getWorldObj(); + } + + final private void addToENet() + { + if ( getEnergySinkWorld() == null ) + return; + + // re-add + removeFromENet(); + + if ( !isInIC2() && Platform.isServer() ) + { + getLayerFlags().add( LayerFlags.IC2_ENET ); + MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergySink) getEnergySinkTile() ) ); + } + } + + final private void removeFromENet() + { + if ( getEnergySinkWorld() == null ) + return; + + if ( isInIC2() && Platform.isServer() ) + { + getLayerFlags().remove( LayerFlags.IC2_ENET ); + MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergySink) getEnergySinkTile() ) ); + } + } + + final private boolean interestedInIC2() + { + int interested = 0; + for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) + { + IPart part = getPart( dir ); + if ( part instanceof IEnergyTile ) + { + interested++; + } + } + return interested == 1;// if more then one tile is interested we need to abandonship... + } + + @Override + public void partChanged() + { + super.partChanged(); + + if ( interestedInIC2() ) + addToENet(); + else + removeFromENet(); + } + + @Override + public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) + { + if ( !isInIC2() ) + return false; + + IPart part = getPart( direction ); + if ( part instanceof IEnergySink ) + return ((IEnergySink) part).acceptsEnergyFrom( emitter, direction ); + return false; + } + + @Override + public double demandedEnergyUnits() + { + if ( !isInIC2() ) + return 0; + + // this is a flawed implementation, that requires a change to the IC2 API. + + for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) + { + IPart part = getPart( dir ); + if ( part instanceof IEnergySink ) + { + // use lower number cause ic2 deletes power it sends that isn't recieved. + return ((IEnergySink) part).demandedEnergyUnits(); + } + } + + return 0; + } + + @Override + public double injectEnergyUnits(ForgeDirection directionFrom, double amount) + { + if ( !isInIC2() ) + return amount; + + for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) + { + IPart part = getPart( dir ); + if ( part instanceof IEnergySink ) + { + return ((IEnergySink) part).injectEnergyUnits( directionFrom, amount ); + } + } + + return amount; + } + + @Override + public int getMaxSafeInput() + { + return Integer.MAX_VALUE; // no real options here... + } + +} diff --git a/src/main/java/appeng/api/parts/layers/LayerIEnergySource.java b/src/main/java/appeng/api/parts/layers/LayerIEnergySource.java new file mode 100644 index 00000000..f619c605 --- /dev/null +++ b/src/main/java/appeng/api/parts/layers/LayerIEnergySource.java @@ -0,0 +1,137 @@ +package appeng.api.parts.layers; + +import ic2.api.energy.tile.IEnergyEmitter; +import ic2.api.energy.tile.IEnergySink; +import ic2.api.energy.tile.IEnergySource; +import ic2.api.energy.tile.IEnergyTile; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.parts.IPart; +import appeng.api.parts.IPartHost; +import appeng.api.parts.LayerBase; +import appeng.api.parts.LayerFlags; +import appeng.util.Platform; + +public class LayerIEnergySource extends LayerBase implements IEnergySource +{ + + private boolean isInIC2() + { + return getLayerFlags().contains( LayerFlags.IC2_ENET ); + } + + private TileEntity getEnergySourceTile() + { + IPartHost host = (IPartHost) this; + return host.getTile(); + } + + private World getEnergySourceWorld() + { + return getEnergySourceTile().getWorldObj(); + } + + final private void addToENet() + { + if ( getEnergySourceWorld() == null ) + return; + + // re-add + removeFromENet(); + + if ( !isInIC2() && Platform.isServer() ) + { + getLayerFlags().add( LayerFlags.IC2_ENET ); + MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergySink) getEnergySourceTile() ) ); + } + } + + final private void removeFromENet() + { + if ( getEnergySourceWorld() == null ) + return; + + if ( isInIC2() && Platform.isServer() ) + { + getLayerFlags().remove( LayerFlags.IC2_ENET ); + MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergySink) getEnergySourceTile() ) ); + } + } + + final private boolean interestedInIC2() + { + int interested = 0; + for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) + { + IPart part = getPart( dir ); + if ( part instanceof IEnergyTile ) + { + interested++; + } + } + return interested == 1;// if more then one tile is interested we need to abandonship... + } + + @Override + public void partChanged() + { + super.partChanged(); + + if ( interestedInIC2() ) + addToENet(); + else + removeFromENet(); + } + + @Override + public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction) + { + if ( !isInIC2() ) + return false; + + IPart part = getPart( direction ); + if ( part instanceof IEnergySink ) + return ((IEnergyEmitter) part).emitsEnergyTo( receiver, direction ); + return false; + } + + @Override + public double getOfferedEnergy() + { + if ( !isInIC2() ) + return 0; + + // this is a flawed implementation, that requires a change to the IC2 API. + + for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) + { + IPart part = getPart( dir ); + if ( part instanceof IEnergySource ) + { + // use lower number cause ic2 deletes power it sends that isn't recieved. + return ((IEnergySource) part).getOfferedEnergy(); + } + } + + return 0; + } + + @Override + public void drawEnergy(double amount) + { + // this is a flawed implementation, that requires a change to the IC2 API. + + for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) + { + IPart part = getPart( dir ); + if ( part instanceof IEnergySource ) + { + ((IEnergySource) part).drawEnergy( amount ); + return; + } + } + } + +} diff --git a/src/main/java/appeng/api/parts/layers/LayerIFluidHandler.java b/src/main/java/appeng/api/parts/layers/LayerIFluidHandler.java new file mode 100644 index 00000000..96168f2b --- /dev/null +++ b/src/main/java/appeng/api/parts/layers/LayerIFluidHandler.java @@ -0,0 +1,69 @@ +package appeng.api.parts.layers; + +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; +import net.minecraftforge.fluids.IFluidHandler; +import appeng.api.parts.IPart; +import appeng.api.parts.LayerBase; + +public class LayerIFluidHandler extends LayerBase implements IFluidHandler +{ + + static final FluidTankInfo[] emptyList = new FluidTankInfo[0]; + + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) + { + IPart part = getPart( from ); + if ( part instanceof IFluidHandler ) + return ((IFluidHandler) part).fill( from, resource, doFill ); + return 0; + } + + @Override + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) + { + IPart part = getPart( from ); + if ( part instanceof IFluidHandler ) + return ((IFluidHandler) part).drain( from, resource, doDrain ); + return null; + } + + @Override + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) + { + IPart part = getPart( from ); + if ( part instanceof IFluidHandler ) + return ((IFluidHandler) part).drain( from, maxDrain, doDrain ); + return null; + } + + @Override + public boolean canFill(ForgeDirection from, net.minecraftforge.fluids.Fluid fluid) + { + IPart part = getPart( from ); + if ( part instanceof IFluidHandler ) + return ((IFluidHandler) part).canFill( from, fluid ); + return false; + } + + @Override + public boolean canDrain(ForgeDirection from, net.minecraftforge.fluids.Fluid fluid) + { + IPart part = getPart( from ); + if ( part instanceof IFluidHandler ) + return ((IFluidHandler) part).canDrain( from, fluid ); + return false; + } + + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection from) + { + IPart part = getPart( from ); + if ( part instanceof IFluidHandler ) + return ((IFluidHandler) part).getTankInfo( from ); + return emptyList; + } + +} diff --git a/src/main/java/appeng/api/parts/layers/LayerIPipeConnection.java b/src/main/java/appeng/api/parts/layers/LayerIPipeConnection.java new file mode 100644 index 00000000..bbe939f5 --- /dev/null +++ b/src/main/java/appeng/api/parts/layers/LayerIPipeConnection.java @@ -0,0 +1,21 @@ +package appeng.api.parts.layers; + +import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.parts.IPart; +import appeng.api.parts.LayerBase; +import buildcraft.api.transport.IPipeConnection; +import buildcraft.api.transport.IPipeTile.PipeType; + +public class LayerIPipeConnection extends LayerBase implements IPipeConnection +{ + + @Override + public ConnectOverride overridePipeConnection(PipeType type, ForgeDirection with) + { + IPart part = getPart( with ); + if ( part instanceof IPipeConnection ) + return ((IPipeConnection) part).overridePipeConnection( type, with ); + return ConnectOverride.DEFAULT; + } + +} diff --git a/src/main/java/appeng/api/parts/layers/LayerIPowerEmitter.java b/src/main/java/appeng/api/parts/layers/LayerIPowerEmitter.java new file mode 100644 index 00000000..2d7b3407 --- /dev/null +++ b/src/main/java/appeng/api/parts/layers/LayerIPowerEmitter.java @@ -0,0 +1,19 @@ +package appeng.api.parts.layers; + +import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.parts.IPart; +import appeng.api.parts.LayerBase; +import buildcraft.api.power.IPowerEmitter; + +public class LayerIPowerEmitter extends LayerBase implements IPowerEmitter +{ + + @Override + public boolean canEmitPowerFrom(ForgeDirection side) + { + IPart part = getPart( side ); + if ( part instanceof IPowerEmitter ) + return ((IPowerEmitter) part).canEmitPowerFrom( side ); + return false; + } +} diff --git a/src/main/java/appeng/api/parts/layers/LayerIPowerReceptor.java b/src/main/java/appeng/api/parts/layers/LayerIPowerReceptor.java new file mode 100644 index 00000000..f82d658c --- /dev/null +++ b/src/main/java/appeng/api/parts/layers/LayerIPowerReceptor.java @@ -0,0 +1,36 @@ +package appeng.api.parts.layers; + +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.parts.IPart; +import appeng.api.parts.IPartHost; +import appeng.api.parts.LayerBase; +import buildcraft.api.power.IPowerReceptor; +import buildcraft.api.power.PowerHandler; +import buildcraft.api.power.PowerHandler.PowerReceiver; + +public class LayerIPowerReceptor extends LayerBase implements IPowerReceptor +{ + + @Override + public PowerReceiver getPowerReceiver(ForgeDirection side) + { + IPart part = getPart( side ); + if ( part instanceof IPowerReceptor ) + return ((IPowerReceptor) part).getPowerReceiver( side ); + return null; + } + + @Override + public void doWork(PowerHandler workProvider) + { + // do nothing, this seems pointless. + } + + @Override + public World getWorld() + { + return ((IPartHost) this).getTile().getWorldObj(); + } + +} diff --git a/src/main/java/appeng/api/parts/layers/LayerISidedInventory.java b/src/main/java/appeng/api/parts/layers/LayerISidedInventory.java new file mode 100644 index 00000000..133bccca --- /dev/null +++ b/src/main/java/appeng/api/parts/layers/LayerISidedInventory.java @@ -0,0 +1,227 @@ +package appeng.api.parts.layers; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.parts.IPart; +import appeng.api.parts.IPartHost; +import appeng.api.parts.LayerBase; + +/** + * Inventory wrapper for parts, + * + * this is considerably more complicated then the other wrappers as it requires creating a "unified inventory". + * + * You must use {@link net.minecraft.inventory.ISidedInventory} instead of {@link net.minecraft.inventory.IInventory}. + * + * If your inventory changes in between placement and removal, you must trigger a PartChange on the {@link IPartHost} so + * it can recalculate the inventory wrapper. + */ +public class LayerISidedInventory extends LayerBase implements ISidedInventory +{ + + // a simple empty array for empty stuff.. + private final static int[] nullSides = new int[] {}; + + // cache of inventory state. + private int sides[][] = null; + private List invs = null; + private List slots = null; + + /** + * Recalculate inventory wrapper cache. + */ + @Override + public void partChanged() + { + super.partChanged(); + + invs = new ArrayList(); + int slotCount = 0; + + for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) + { + IPart bp = getPart( side ); + if ( bp instanceof ISidedInventory ) + { + ISidedInventory part = (ISidedInventory) bp; + slotCount += part.getSizeInventory(); + invs.add( part ); + } + } + + if ( invs.isEmpty() || slotCount == 0 ) + { + invs = null; + sides = null; + slots = null; + } + else + { + sides = new int[][] { nullSides, nullSides, nullSides, nullSides, nullSides, nullSides }; + slots = new ArrayList( Collections.nCopies( slotCount, (InvSot) null ) ); + + int offsetForLayer = 0; + int offsetForPart = 0; + for (ISidedInventory sides : invs) + { + offsetForPart = 0; + slotCount = sides.getSizeInventory(); + + ForgeDirection currentSide = ForgeDirection.UNKNOWN; + for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) + if ( getPart( side ) == sides ) + { + currentSide = side; + break; + } + + int cSidesList[] = this.sides[currentSide.ordinal()] = new int[slotCount]; + for (int cSlot = 0; cSlot < slotCount; cSlot++) + { + cSidesList[cSlot] = offsetForLayer; + slots.set( offsetForLayer++, new InvSot( sides, offsetForPart++ ) ); + } + } + } + } + + /** + * check if a slot index is valid, prevent crashes from bad code :) + * + * @param slot + * @return true, if the slot exists. + */ + boolean isSlotValid(int slot) + { + return slots != null && slot >= 0 && slot < slots.size(); + } + + @Override + public ItemStack decrStackSize(int slot, int amount) + { + if ( isSlotValid( slot ) ) + return slots.get( slot ).decrStackSize( amount ); + + return null; + } + + @Override + public int getSizeInventory() + { + if ( slots == null ) + return 0; + + return slots.size(); + } + + @Override + public ItemStack getStackInSlot(int slot) + { + if ( isSlotValid( slot ) ) + return slots.get( slot ).getStackInSlot(); + + return null; + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack itemstack) + { + if ( isSlotValid( slot ) ) + return slots.get( slot ).isItemValidForSlot( itemstack ); + + return false; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack itemstack) + { + if ( isSlotValid( slot ) ) + slots.get( slot ).setInventorySlotContents( itemstack ); + } + + @Override + public boolean canExtractItem(int slot, ItemStack itemstack, int side) + { + if ( isSlotValid( slot ) ) + return slots.get( slot ).canExtractItem( itemstack, side ); + + return false; + } + + @Override + public boolean canInsertItem(int slot, ItemStack itemstack, int side) + { + if ( isSlotValid( slot ) ) + return slots.get( slot ).canInsertItem( itemstack, side ); + + return false; + } + + @Override + public void markDirty() + { + super.markDirty(); + + if ( invs != null ) + { + for (IInventory inv : invs) + inv.markDirty(); + } + } + + @Override + public int[] getAccessibleSlotsFromSide(int side) + { + if ( sides == null || side < 0 || side > 5 ) + return nullSides; + return sides[side]; + } + + @Override + public int getInventoryStackLimit() + { + return 64; // no options here. + } + + @Override + public String getInventoryName() + { + return "AEMultiPart"; + } + + @Override + public boolean hasCustomInventoryName() + { + return false; + } + + @Override + public ItemStack getStackInSlotOnClosing(int slot) + { + return null; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer entityplayer) + { + return false; + } + + @Override + public void closeInventory() + { + } + + @Override + public void openInventory() + { + } + +} diff --git a/src/main/java/appeng/api/parts/layers/LayerITileStorageMonitorable.java b/src/main/java/appeng/api/parts/layers/LayerITileStorageMonitorable.java new file mode 100644 index 00000000..4289665b --- /dev/null +++ b/src/main/java/appeng/api/parts/layers/LayerITileStorageMonitorable.java @@ -0,0 +1,21 @@ +package appeng.api.parts.layers; + +import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.implementations.tiles.ITileStorageMonitorable; +import appeng.api.parts.IPart; +import appeng.api.parts.LayerBase; +import appeng.api.storage.IStorageMonitorable; + +public class LayerITileStorageMonitorable extends LayerBase implements ITileStorageMonitorable +{ + + @Override + public IStorageMonitorable getMonitorable(ForgeDirection side) + { + IPart part = getPart( side ); + if ( part instanceof ITileStorageMonitorable ) + return ((ITileStorageMonitorable) part).getMonitorable( side ); + return null; + } + +} diff --git a/src/main/java/appeng/api/recipes/ICraftHandler.java b/src/main/java/appeng/api/recipes/ICraftHandler.java new file mode 100644 index 00000000..076768cc --- /dev/null +++ b/src/main/java/appeng/api/recipes/ICraftHandler.java @@ -0,0 +1,29 @@ +package appeng.api.recipes; + +import java.util.List; + +import appeng.api.exceptions.MissingIngredientError; +import appeng.api.exceptions.RecipeError; +import appeng.api.exceptions.RegistrationError; + +public interface ICraftHandler +{ + + /** + * Called when your recipe handler receives a newly parsed list of inputs/outputs. + * + * @param input + * @param output + * @throws RecipeError + */ + public void setup(List> input, List> output) throws RecipeError; + + /** + * called when all recipes are parsed, and your required to register your recipe. + * + * @throws RegistrationError + * @throws MissingIngredientError + */ + public void register() throws RegistrationError, MissingIngredientError; + +} diff --git a/src/main/java/appeng/api/recipes/IIngredient.java b/src/main/java/appeng/api/recipes/IIngredient.java new file mode 100644 index 00000000..985c9819 --- /dev/null +++ b/src/main/java/appeng/api/recipes/IIngredient.java @@ -0,0 +1,57 @@ +package appeng.api.recipes; + +import net.minecraft.item.ItemStack; +import appeng.api.exceptions.MissingIngredientError; +import appeng.api.exceptions.RegistrationError; + +public interface IIngredient { + + /** + * Acquire a single input stack for the current recipe, if more then one ItemStack is possible a + * RegistrationError exception will be thrown, ignore these and let the system handle the error. + * + * @return a single ItemStack for the recipe handler. + * + * @throws RegistrationError + * @throws MissingIngredientError + */ + ItemStack getItemStack() throws RegistrationError, MissingIngredientError; + + /** + * Acquire a list of all the input stacks for the current recipe, this is for handlers that support + * multiple inputs per slot. + * + * @return an array of ItemStacks for the recipe handler. + * @throws RegistrationError + * @throws MissingIngredientError + */ + ItemStack[] getItemStackSet() throws RegistrationError, MissingIngredientError; + + /** + * If you wish to support air, you must test before geting the ItemStack, or ItemStackSet + * + * @return true if this slot contains no ItemStack, this is passed as "_" + */ + public boolean isAir(); + + /** + * @return The Name Space of the item. Prefer getItemStack or getItemStackSet + */ + public String getNameSpace(); + + /** + * @return The Name of the item. Prefer getItemStack or getItemStackSet + */ + public String getItemName(); + + /** + * @return The Damage Value of the item. Prefer getItemStack or getItemStackSet + */ + public int getDamageValue(); + + /** + * @return The Damage Value of the item. Prefer getItemStack or getItemStackSet + */ + public int getQty(); + +} diff --git a/src/main/java/appeng/api/recipes/IRecipeHandler.java b/src/main/java/appeng/api/recipes/IRecipeHandler.java new file mode 100644 index 00000000..3b6e3959 --- /dev/null +++ b/src/main/java/appeng/api/recipes/IRecipeHandler.java @@ -0,0 +1,22 @@ +package appeng.api.recipes; + +/** + * Represents the AE2 Recipe Loading/Reading Class + */ +public interface IRecipeHandler +{ + + /** + * Call when you want to read recipes in from a file based on a loader + * + * @param loader + * @param path + */ + void parseRecipes(IRecipeLoader loader, String path); + + /** + * this loads the read recipes into minecraft. + */ + void registerHandlers(); + +} diff --git a/src/main/java/appeng/api/recipes/IRecipeLoader.java b/src/main/java/appeng/api/recipes/IRecipeLoader.java new file mode 100644 index 00000000..a85dbeba --- /dev/null +++ b/src/main/java/appeng/api/recipes/IRecipeLoader.java @@ -0,0 +1,10 @@ +package appeng.api.recipes; + +import java.io.BufferedReader; + +public interface IRecipeLoader +{ + + BufferedReader getFile(String s) throws Exception; + +} diff --git a/src/main/java/appeng/api/recipes/ISubItemResolver.java b/src/main/java/appeng/api/recipes/ISubItemResolver.java new file mode 100644 index 00000000..a6a481b7 --- /dev/null +++ b/src/main/java/appeng/api/recipes/ISubItemResolver.java @@ -0,0 +1,13 @@ +package appeng.api.recipes; + +public interface ISubItemResolver +{ + + /** + * @param namespace + * @param fullName + * @return either a ResolveReslult, or a ResolverResultSet + */ + public Object resolveItemByName(String namespace, String fullName); + +} diff --git a/src/main/java/appeng/api/recipes/ResolverResult.java b/src/main/java/appeng/api/recipes/ResolverResult.java new file mode 100644 index 00000000..ee4f5ceb --- /dev/null +++ b/src/main/java/appeng/api/recipes/ResolverResult.java @@ -0,0 +1,14 @@ +package appeng.api.recipes; + +public class ResolverResult +{ + + final public String itemName; + final public int damageValue; + + public ResolverResult(String name, int damage) { + itemName = name; + damageValue = damage; + } + +} diff --git a/src/main/java/appeng/api/recipes/ResolverResultSet.java b/src/main/java/appeng/api/recipes/ResolverResultSet.java new file mode 100644 index 00000000..d9e34aa4 --- /dev/null +++ b/src/main/java/appeng/api/recipes/ResolverResultSet.java @@ -0,0 +1,19 @@ +package appeng.api.recipes; + +import java.util.Arrays; +import java.util.List; + +import net.minecraft.item.ItemStack; + +public class ResolverResultSet +{ + + public final String name; + public final List results; + + public ResolverResultSet(String myName, ItemStack... set) { + results = Arrays.asList( set ); + name = myName; + } + +} diff --git a/src/main/java/appeng/api/storage/ICellContainer.java b/src/main/java/appeng/api/storage/ICellContainer.java new file mode 100644 index 00000000..5a8300ac --- /dev/null +++ b/src/main/java/appeng/api/storage/ICellContainer.java @@ -0,0 +1,37 @@ +package appeng.api.storage; + +import java.util.List; + +import appeng.api.networking.security.IActionHost; + +/** + * Represents a IGridhost that contributes to storage, such as a ME Chest, or ME Drive. + */ +public interface ICellContainer extends IActionHost +{ + + /** + * Inventory of the tile for use with ME, should always return an valid list, never NULL. + * + * You must return the correct Handler for the correct channel, if your handler returns a IAEItemStack handler, for + * a Fluid Channel stuffs going to explode, same with the reverse. + * + * @return a valid list of handlers, NEVER NULL + */ + List getCellArray(StorageChannel channel); + + /** + * the storage's priority. + * + * Positive and negative are supported + */ + int getPriority(); + + /** + * tell the Cell container that this slot should blink, the slot number is relative to the + * + * @param slot + */ + void blinkCell(int slot); + +} diff --git a/src/main/java/appeng/api/storage/ICellHandler.java b/src/main/java/appeng/api/storage/ICellHandler.java new file mode 100644 index 00000000..a944c473 --- /dev/null +++ b/src/main/java/appeng/api/storage/ICellHandler.java @@ -0,0 +1,81 @@ +package appeng.api.storage; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import appeng.api.implementations.tiles.IChestOrDrive; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * Registration record for {@link ICellRegistry} + */ +public interface ICellHandler +{ + + /** + * return true if the provided item is handled by your cell handler. ( AE May choose to skip this method, and just + * request a handler ) + * + * @param is + * @return return true, if getCellHandler will not return null. + */ + boolean isCell(ItemStack is); + + /** + * If you cannot handle the provided item, return null + * + * @param is + * a storage cell item. + * + * @return a new IMEHandler for the provided item + */ + IMEInventoryHandler getCellInventory(ItemStack is, StorageChannel channel); + + /** + * @return the ME Chest texture for this storage cell type, should be 10x10 with 3px of transparent padding on a + * 16x16 texture, null is valid if your cell cannot be used in the ME Chest. refer to the assets for + * examples and colors. + */ + @SideOnly(Side.CLIENT) + IIcon getTopTexture(); + + /** + * + * Called when the storage cell is planed in an ME Chest and the user tries to open the terminal side, if your item + * is not available via ME Chests simply tell the user they can't use it, or something, other wise you should open + * your gui and display the cell to the user. + * + * @param player + * @param chest + * @param cellHandler + * @param inv + * @param is + * @param chan + */ + void openChestGui(EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan); + + /** + * 0 - cell is missing. + * + * 1 - green, ( usually means available room for types or items. ) + * + * 2 - orange, ( usually means available room for items, but not types. ) + * + * 3 - red, ( usually means the cell is 100% full ) + * + * @param is + * the cell item. ( use the handler for any details you can ) + * @param the + * handler for the cell is provides for reference, you can cast this to your handler. + * + * @return get the status of the cell based on its contents. + */ + int getStatusForCell(ItemStack is, IMEInventory handler); + + /** + * @return the ae/t to drain for this storage cell inside a chest/drive. + */ + double cellIdleDrain(ItemStack is, IMEInventory handler); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/storage/ICellRegistry.java b/src/main/java/appeng/api/storage/ICellRegistry.java new file mode 100644 index 00000000..49a67466 --- /dev/null +++ b/src/main/java/appeng/api/storage/ICellRegistry.java @@ -0,0 +1,47 @@ +package appeng.api.storage; + +import net.minecraft.item.ItemStack; +import appeng.api.IAppEngApi; + +/** + * Storage Cell Registry, used for specially implemented cells, if you just want to make a item act like a cell, or new + * cell with different bytes, then you should probably consider IStorageCell instead its considerably simpler. + * + * Do not Implement, obtained via {@link IAppEngApi}.getCellRegistry() + */ +public interface ICellRegistry +{ + + /** + * Register a new handler. + * + * @param handler + */ + void addCellHandler(ICellHandler handler); + + /** + * return true, if you can get a InventoryHandler for the item passed. + * + * @param is + * @return true if the provided item, can be handled by a handler in AE, ( AE May choose to skip this and just get + * the handler instead. ) + */ + boolean isCellHandled(ItemStack is); + + /** + * get the handler, for the requested type. + * + * @param is + * @return the handler registered for this item type. + */ + ICellHandler getHander(ItemStack is); + + /** + * returns an IMEInventoryHandler for the provided item. + * + * @param is + * @return new IMEInventoryHandler, or null if there isn't one. + */ + IMEInventoryHandler getCellInventory(ItemStack is, StorageChannel chan); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/storage/ICellWorkbenchItem.java b/src/main/java/appeng/api/storage/ICellWorkbenchItem.java new file mode 100644 index 00000000..06824619 --- /dev/null +++ b/src/main/java/appeng/api/storage/ICellWorkbenchItem.java @@ -0,0 +1,45 @@ +package appeng.api.storage; + +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import appeng.api.config.FuzzyMode; + +public interface ICellWorkbenchItem +{ + + /** + * if this return false, the item will not be treated as a cell, and cannot be inserted into the work bench. + * + * @param is + * @return true if the item should be editable in the cell workbench. + */ + boolean isEditable(ItemStack is); + + /** + * used to edit the upgrade slots on your cell, should have a capacity of 0-24, you are also responsible for + * implementing the valid checks, and any storage/usage of them. + * + * onInventoryChange will be called when saving is needed. + */ + IInventory getUpgradesInventory(ItemStack is); + + /** + * Used to extract, or mirror the contents of the work bench onto the cell. + * + * - This should have exactly 63 slots, any more, or less might cause issues. + * + * onInventoryChange will be called when saving is needed. + */ + IInventory getConfigInventory(ItemStack is); + + /** + * @return the current fuzzy status. + */ + FuzzyMode getFuzzyMode(ItemStack is); + + /** + * sets the setting on the cell. + */ + void setFuzzyMode(ItemStack is, FuzzyMode fzMode); + +} diff --git a/src/main/java/appeng/api/storage/IExternalStorageHandler.java b/src/main/java/appeng/api/storage/IExternalStorageHandler.java new file mode 100644 index 00000000..2f834ada --- /dev/null +++ b/src/main/java/appeng/api/storage/IExternalStorageHandler.java @@ -0,0 +1,30 @@ +package appeng.api.storage; + +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + +/** + * A Registration Record for {@link IExternalStorageRegistry} + */ +public interface IExternalStorageHandler +{ + + /** + * if this can handle the provided inventory, return true. ( Generally + * skipped by AE, and it just calls getInventory ) + * + * @param te + * @return true, if it can get a handler via getInventory + */ + boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel); + + /** + * if this can handle the given inventory, return the a IMEInventory + * implementing class for it, if not return null + * + * @param te + * @return The Handler for the inventory + */ + IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/storage/IExternalStorageRegistry.java b/src/main/java/appeng/api/storage/IExternalStorageRegistry.java new file mode 100644 index 00000000..be0bf547 --- /dev/null +++ b/src/main/java/appeng/api/storage/IExternalStorageRegistry.java @@ -0,0 +1,30 @@ +package appeng.api.storage; + +import appeng.api.IAppEngApi; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + +/** + * A Registry of External Storage handlers. + * + * Do not implement obtain via {@link IAppEngApi}.registries().getExternalStorageRegistry() + */ +public interface IExternalStorageRegistry +{ + + /** + * A registry for StorageBus interactions + * + * @param esh + */ + void addExternalStorageInterface(IExternalStorageHandler esh); + + /** + * @param te + * @param opposite + * @param channel + * @return the handler for a given tile / forge direction + */ + IExternalStorageHandler getHandler(TileEntity te, ForgeDirection opposite, StorageChannel channel); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/storage/IMEInventory.java b/src/main/java/appeng/api/storage/IMEInventory.java new file mode 100644 index 00000000..5dd9b586 --- /dev/null +++ b/src/main/java/appeng/api/storage/IMEInventory.java @@ -0,0 +1,56 @@ +package appeng.api.storage; + +import appeng.api.config.Actionable; +import appeng.api.networking.security.BaseActionSource; +import appeng.api.storage.data.IAEStack; +import appeng.api.storage.data.IItemList; + +/** + * AE's Equivalent to IInventory, used to reading contents, and manipulating contents of ME Inventories. + * + * Implementations should COMPLETELY ignore stack size limits from an external view point, Meaning that you can inject + * Integer.MAX_VALUE items and it should work as defined, or be able to extract Integer.MAX_VALUE and have it work as + * defined, Translations to MC's max stack size are external to the AE API. + * + * If you want to request a stack of an item, you should should determine that prior to requesting the stack from the + * inventory. + */ +public interface IMEInventory +{ + + /** + * Store new items, or simulate the addition of new items into the ME Inventory. + * + * @param input + * item to add. + * @param mode + * @return returns the number of items not added. + */ + public StackType injectItems(StackType input, Actionable type, BaseActionSource src); + + /** + * Extract the specified item from the ME Inventory + * + * @param request + * item to request ( with stack size. ) + * @param mode + * simulate, or perform action? + * @return returns the number of items extracted, null + */ + public StackType extractItems(StackType request, Actionable mode, BaseActionSource src); + + /** + * request a full report of all available items, storage. + * + * @param out + * the IItemList the results will be written too + * @return returns same list that was passed in, is passed out + */ + public IItemList getAvailableItems(IItemList out); + + /** + * @return the type of channel your handler should be part of + */ + public StorageChannel getChannel(); + +} diff --git a/src/main/java/appeng/api/storage/IMEInventoryHandler.java b/src/main/java/appeng/api/storage/IMEInventoryHandler.java new file mode 100644 index 00000000..7cf9d26c --- /dev/null +++ b/src/main/java/appeng/api/storage/IMEInventoryHandler.java @@ -0,0 +1,60 @@ +package appeng.api.storage; + +import appeng.api.config.AccessRestriction; +import appeng.api.storage.data.IAEStack; + +/** + * Thin logic layer that can be swapped with different IMEInventory + * implementations, used to handle features related to storage, that are + * Separate from the storage medium itself. + * + * @param + */ +public interface IMEInventoryHandler extends + IMEInventory { + + /** + * determine if items can be injected/extracted. + * + * @return the access + */ + public AccessRestriction getAccess(); + + /** + * determine if a particular item is prioritized for this inventory handler, + * if it is, then it will be added to this inventory prior to any + * non-prioritized inventories. + * + * @param input + * - item that might be added + * @return if its prioritized + */ + public boolean isPrioritized(StackType input); + + /** + * determine if an item can be accepted and stored. + * + * @param input + * - item that might be added + * @return if the item can be added + */ + public boolean canAccept(StackType input); + + /** + * determine what the priority of the inventory is. + * + * @return the priority, zero is default, positive and negative are + * supported. + */ + public int getPriority(); + + /** + * pass back value for blinkCell. + * + * @return the slot index for the cell that this represents in the storage + * unit, the method on the {@link appeng.api.storage.ICellContainer} will be called + * with this value, only trust the return value of this mehod if you + * are the implementor of the {@link appeng.api.storage.IMEInventoryHandler}. + */ + public int getSlot(); +} diff --git a/src/main/java/appeng/api/storage/IMEMonitor.java b/src/main/java/appeng/api/storage/IMEMonitor.java new file mode 100644 index 00000000..e1317992 --- /dev/null +++ b/src/main/java/appeng/api/storage/IMEMonitor.java @@ -0,0 +1,33 @@ +package appeng.api.storage; + +import appeng.api.storage.data.IAEStack; +import appeng.api.storage.data.IItemList; + +public interface IMEMonitor extends IMEInventoryHandler +{ + + /** + * add a new Listener to the monitor, be sure to properly remove yourself when your done. + */ + void addListener(IMEMonitorHandlerReceiver l, Object verificationToken); + + /** + * remove a Listener to the monitor. + */ + void removeListener(IMEMonitorHandlerReceiver l); + + @Override + @Deprecated + /** + * This method is discouraged when accessing data via a IMEMonitor + */ + public IItemList getAvailableItems(IItemList out); + + /** + * Get access to the full item list of the network, preferred over {@link IMEInventory} .getAvaialbleItems(...) + * + * @return full storage list. + */ + IItemList getStorageList(); + +} diff --git a/src/main/java/appeng/api/storage/IMEMonitorHandlerReceiver.java b/src/main/java/appeng/api/storage/IMEMonitorHandlerReceiver.java new file mode 100644 index 00000000..a59fff68 --- /dev/null +++ b/src/main/java/appeng/api/storage/IMEMonitorHandlerReceiver.java @@ -0,0 +1,24 @@ +package appeng.api.storage; + +import appeng.api.networking.security.BaseActionSource; +import appeng.api.storage.data.IAEStack; + +public interface IMEMonitorHandlerReceiver +{ + + /** + * return true if this object should remain as a listener. + * + * @param verificationToken + * @return + */ + boolean isValid(Object verificationToken); + + /** + * called when changes are made to the Monitor, but only if listener is still valid. + * + * @param change + */ + void postChange(IMEMonitor monitor, StackType change, BaseActionSource actionSource); + +} diff --git a/src/main/java/appeng/api/storage/IStorageHelper.java b/src/main/java/appeng/api/storage/IStorageHelper.java new file mode 100644 index 00000000..b1679702 --- /dev/null +++ b/src/main/java/appeng/api/storage/IStorageHelper.java @@ -0,0 +1,84 @@ +package appeng.api.storage; + +import io.netty.buffer.ByteBuf; + +import java.io.IOException; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import appeng.api.networking.energy.IEnergySource; +import appeng.api.networking.security.BaseActionSource; +import appeng.api.storage.data.IAEFluidStack; +import appeng.api.storage.data.IAEItemStack; +import appeng.api.storage.data.IItemList; + +public interface IStorageHelper +{ + + /** + * @param is + * An ItemStack + * + * @return a new instance of {@link appeng.api.storage.data.IAEItemStack} from a MC {@link net.minecraft.item.ItemStack} + */ + IAEItemStack createItemStack(ItemStack is); + + /** + * @param is + * A FluidStack + * + * @return a new instance of {@link appeng.api.storage.data.IAEFluidStack} from a Forge {@link net.minecraftforge.fluids.FluidStack} + */ + IAEFluidStack createFluidStack(FluidStack is); + + /** + * @return a new instance of {@link appeng.api.storage.data.IItemList} for items + */ + IItemList createItemList(); + + /** + * @return a new instance of {@link appeng.api.storage.data.IItemList} for fluids + */ + IItemList createFluidList(); + + /** + * Read a AE Item Stack from a byte stream, returns a AE item stack or null. + * + * @param input + * @return + * @throws java.io.IOException + */ + IAEItemStack readItemFromPacket(ByteBuf input) throws IOException; + + /** + * Read a AE Fluid Stack from a byte stream, returns a AE fluid stack or null. + * + * @param input + * @return + * @throws java.io.IOException + */ + IAEFluidStack readFluidFromPacket(ByteBuf input) throws IOException; + + /** + * use energy from energy, to remove request items from cell, at the request of src. + * + * @param energy + * @param cell + * @param request + * @param src + * @return items that successfully extracted. + */ + IAEItemStack poweredExtraction(IEnergySource energy, IMEInventory cell, IAEItemStack request, BaseActionSource src); + + /** + * use energy from energy, to inject input items into cell, at the request of src + * + * @param energy + * @param cell + * @param input + * @param src + * @return items that failed to insert. + */ + IAEItemStack poweredInsert(IEnergySource energy, IMEInventory cell, IAEItemStack input, BaseActionSource src); + +} diff --git a/src/main/java/appeng/api/storage/IStorageMonitorable.java b/src/main/java/appeng/api/storage/IStorageMonitorable.java new file mode 100644 index 00000000..ea7293a8 --- /dev/null +++ b/src/main/java/appeng/api/storage/IStorageMonitorable.java @@ -0,0 +1,25 @@ +package appeng.api.storage; + +import appeng.api.implementations.tiles.ITileStorageMonitorable; +import appeng.api.storage.data.IAEFluidStack; +import appeng.api.storage.data.IAEItemStack; + +/** + * represents the internal behavior of a {@link ITileStorageMonitorable} use it to get this value for a tile, or part. + * + * never check a tile for this, always go though ITileStorageMonitorable if you wish to use this interface. + */ +public interface IStorageMonitorable +{ + + /** + * Access the item inventory for the monitorable storage. + */ + IMEMonitor getItemInventory(); + + /** + * Access the fluid inventory for the monitorable storage. + */ + IMEMonitor getFluidInventory(); + +} diff --git a/src/main/java/appeng/api/storage/ITerminalHost.java b/src/main/java/appeng/api/storage/ITerminalHost.java new file mode 100644 index 00000000..fbb7084e --- /dev/null +++ b/src/main/java/appeng/api/storage/ITerminalHost.java @@ -0,0 +1,8 @@ +package appeng.api.storage; + +import appeng.api.util.IConfigureableObject; + +public interface ITerminalHost extends IStorageMonitorable, IConfigureableObject +{ + +} diff --git a/src/main/java/appeng/api/storage/MEMonitorHandler.java b/src/main/java/appeng/api/storage/MEMonitorHandler.java new file mode 100644 index 00000000..ec87f95b --- /dev/null +++ b/src/main/java/appeng/api/storage/MEMonitorHandler.java @@ -0,0 +1,156 @@ +package appeng.api.storage; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map.Entry; + +import appeng.api.config.AccessRestriction; +import appeng.api.config.Actionable; +import appeng.api.networking.security.BaseActionSource; +import appeng.api.storage.data.IAEStack; +import appeng.api.storage.data.IItemList; + +/** + * Common implementation of a simple class that monitors injection/extraction of a inventory to send events to a list of + * listeners. + * + * @param + */ +public class MEMonitorHandler implements IMEMonitor +{ + + private final IMEInventoryHandler internalHandler; + private final IItemList cachedList; + private final HashMap, Object> listeners = new HashMap, Object>(); + + protected boolean hasChanged = true; + + protected IMEInventoryHandler getHandler() + { + return internalHandler; + } + + protected void postChange(StackType diff, BaseActionSource src) + { + hasChanged = true;// need to update the cache. + Iterator, Object>> i = listeners.entrySet().iterator(); + while (i.hasNext()) + { + Entry, Object> o = i.next(); + IMEMonitorHandlerReceiver recv = o.getKey(); + if ( recv.isValid( o.getValue() ) ) + recv.postChange( this, diff, src ); + else + i.remove(); + } + } + + private StackType monitorDiffrence(IAEStack original, StackType leftOvers, boolean extraction, BaseActionSource src) + { + StackType diff = (StackType) original.copy(); + + if ( extraction ) + diff.setStackSize( leftOvers == null ? 0 : -leftOvers.getStackSize() ); + else if ( leftOvers != null ) + diff.decStackSize( leftOvers.getStackSize() ); + + if ( diff.getStackSize() != 0 ) + postChange( diff, src ); + + return leftOvers; + } + + public MEMonitorHandler(IMEInventoryHandler t) { + internalHandler = t; + cachedList = (IItemList) t.getChannel().createList(); + } + + public MEMonitorHandler(IMEInventoryHandler t, StorageChannel chan) { + internalHandler = t; + cachedList = (IItemList) chan.createList(); + } + + @Override + public void addListener(IMEMonitorHandlerReceiver l, Object verificationToken) + { + listeners.put( l, verificationToken ); + } + + @Override + public void removeListener(IMEMonitorHandlerReceiver l) + { + listeners.remove( l ); + } + + @Override + public StackType injectItems(StackType input, Actionable mode, BaseActionSource src) + { + if ( mode == Actionable.SIMULATE ) + return getHandler().injectItems( input, mode, src ); + return monitorDiffrence( (StackType) input.copy(), getHandler().injectItems( input, mode, src ), false, src ); + } + + @Override + public StackType extractItems(StackType request, Actionable mode, BaseActionSource src) + { + if ( mode == Actionable.SIMULATE ) + return getHandler().extractItems( request, mode, src ); + return monitorDiffrence( (StackType) request.copy(), getHandler().extractItems( request, mode, src ), true, src ); + } + + @Override + public IItemList getStorageList() + { + if ( hasChanged ) + { + hasChanged = false; + cachedList.resetStatus(); + return getAvailableItems( cachedList ); + } + + return cachedList; + } + + @Override + public IItemList getAvailableItems(IItemList out) + { + return getHandler().getAvailableItems( out ); + } + + @Override + public StorageChannel getChannel() + { + return getHandler().getChannel(); + } + + @Override + public AccessRestriction getAccess() + { + return getHandler().getAccess(); + } + + @Override + public boolean isPrioritized(StackType input) + { + return getHandler().isPrioritized( input ); + } + + @Override + public boolean canAccept(StackType input) + { + return getHandler().canAccept( input ); + } + + @Override + public int getPriority() + { + return getHandler().getPriority(); + } + + @Override + public int getSlot() + { + return getHandler().getSlot(); + } + +} diff --git a/src/main/java/appeng/api/storage/StorageChannel.java b/src/main/java/appeng/api/storage/StorageChannel.java new file mode 100644 index 00000000..1ada1509 --- /dev/null +++ b/src/main/java/appeng/api/storage/StorageChannel.java @@ -0,0 +1,33 @@ +package appeng.api.storage; + +import appeng.api.AEApi; +import appeng.api.storage.data.IAEFluidStack; +import appeng.api.storage.data.IAEItemStack; +import appeng.api.storage.data.IAEStack; +import appeng.api.storage.data.IItemList; + +public enum StorageChannel +{ + /** + * AE2's Default Storage. + */ + ITEMS( IAEItemStack.class ), + + /** + * AE2's Fluid Based Storage ( mainly added to better support ExtraCells ) + */ + FLUIDS( IAEFluidStack.class ); + + public final Class type; + + private StorageChannel( Class t ) { + type = t; + } + + public IItemList createList() { + if ( this == ITEMS ) + return AEApi.instance().storage().createItemList(); + else + return AEApi.instance().storage().createFluidList(); + } +} diff --git a/src/main/java/appeng/api/storage/data/IAEFluidStack.java b/src/main/java/appeng/api/storage/data/IAEFluidStack.java new file mode 100644 index 00000000..5d134c05 --- /dev/null +++ b/src/main/java/appeng/api/storage/data/IAEFluidStack.java @@ -0,0 +1,52 @@ +package appeng.api.storage.data; + +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + +/** + * An alternate version of FluidStack for AE to keep tabs on things easier, and + * to support larger storage. stackSizes of getFluidStack will be capped. + * + * You may hold on to these if you want, just make sure you let go of them when + * your not using them. + * + * Don't Implement. + * + * Construct with Util.createFluidStack( FluidStack ) + * + */ +public interface IAEFluidStack extends IAEStack +{ + + /** + * creates a standard Forge FluidStack for the fluid. + * + * @return new FluidStack + */ + FluidStack getFluidStack(); + + /** + * create a AE Fluid clone. + * + * @return the copy. + */ + @Override + public IAEFluidStack copy(); + + /** + * Combines two IAEItemStacks via addition. + * + * @param option + * , to add to the current one. + */ + @Override + void add(IAEFluidStack option); + + /** + * quick way to get access to the Forge Fluid Definition. + * + * @return + */ + Fluid getFluid(); + +} diff --git a/src/main/java/appeng/api/storage/data/IAEItemStack.java b/src/main/java/appeng/api/storage/data/IAEItemStack.java new file mode 100644 index 00000000..5ccc0314 --- /dev/null +++ b/src/main/java/appeng/api/storage/data/IAEItemStack.java @@ -0,0 +1,82 @@ +package appeng.api.storage.data; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +/** + * An alternate version of ItemStack for AE to keep tabs on things easier, and to support larger storage. stackSizes of + * getItemStack will be capped. + * + * You may hold on to these if you want, just make sure you let go of them when your not using them. + * + * Don't Implement. + * + * Construct with Util.createItemStack( ItemStack ) + */ +public interface IAEItemStack extends IAEStack +{ + + /** + * creates a standard MC ItemStack for the item. + * + * @return new ItemStack + */ + public ItemStack getItemStack(); + + /** + * create a AE Item clone + * + * @return the copy + */ + @Override + public IAEItemStack copy(); + + /** + * is there NBT Data for this item? + * + * @return if there is + */ + boolean hasTagCompound(); + + /** + * Combines two IAEItemStacks via addition. + * + * @param option + * to add to the current one. + */ + @Override + void add(IAEItemStack option); + + /** + * quick way to get access to the MC Item Definition. + * + * @return + */ + Item getItem(); + + /** + * @return the items damage value + */ + int getItemDamage(); + + /** + * Compare the Ore Dictionary ID for this to another item. + */ + boolean sameOre(IAEItemStack is); + + /** + * compare the item/damage/nbt of the stack. + * + * @param otherStack + * @return + */ + boolean isSameType(IAEItemStack otherStack); + + /** + * compare the item/damage/nbt of the stack. + * + * @param otherStack + * @return + */ + boolean isSameType(ItemStack stored); +} \ No newline at end of file diff --git a/src/main/java/appeng/api/storage/data/IAEStack.java b/src/main/java/appeng/api/storage/data/IAEStack.java new file mode 100644 index 00000000..a5a9178d --- /dev/null +++ b/src/main/java/appeng/api/storage/data/IAEStack.java @@ -0,0 +1,179 @@ +package appeng.api.storage.data; + +import io.netty.buffer.ByteBuf; + +import java.io.IOException; + +import net.minecraft.nbt.NBTTagCompound; +import appeng.api.config.FuzzyMode; +import appeng.api.storage.StorageChannel; + +public interface IAEStack +{ + + /** + * add two stacks together + * + * @param is + */ + void add(StackType is); + + /** + * number of items in the stack. + * + * @return basically ItemStack.stackSize + */ + long getStackSize(); + + /** + * changes the number of items in the stack. + * + * @param basically + * , ItemStack.stackSize = N + */ + StackType setStackSize(long stackSize); + + /** + * Same as getStackSize, but for requestable items. ( LP ) + * + * @return basically itemStack.stackSize but for requestable items. + */ + long getCountRequestable(); + + /** + * Same as setStackSize, but for requestable items. ( LP ) + * + * @return basically itemStack.stackSize = N but for setStackSize items. + */ + StackType setCountRequestable(long countRequestable); + + /** + * true, if the item can be crafted. + * + * @return true, if it can be crafted. + */ + boolean isCraftable(); + + /** + * change weather the item can be crafted. + * + * @param isCraftable + */ + StackType setCraftable(boolean isCraftable); + + /** + * clears, requsetable, craftable, and stack sizes. + */ + StackType reset(); + + /** + * returns true, if the item can be crafted, requested, or extracted. + * + * @return isThisRecordMeaningful + */ + boolean isMeaninful(); + + /** + * Adds more to the stack size... + * + * @param i + */ + void incStackSize(long i); + + /** + * removes some from the stack size. + */ + void decStackSize(long i); + + /** + * adds items to the requestable + * + * @param i + */ + void incCountRequestable(long i); + + /** + * removes items from the requsetable + * + * @param i + */ + void decCountRequestable(long i); + + /** + * write to a NBTTagCompound. + * + * @param i + */ + void writeToNBT(NBTTagCompound i); + + /** + * Compare stacks using precise logic. + * + * a IAEItemStack to another AEItemStack or a ItemStack. + * + * or + * + * IAEFluidStack, FluidStack + * + * @param obj + * @return true if they are the same. + */ + @Override + boolean equals(Object obj); + + /** + * compare stacks using fuzzy logic + * + * a IAEItemStack to another AEItemStack or a ItemStack. + * + * @param st + * @param mode + * @return true if two stacks are equal based on AE Fuzzy Comparison. + */ + boolean fuzzyComparison(Object st, FuzzyMode mode); + + /** + * Slower for disk saving, but smaller/more efficient for packets. + * + * @param data + * @throws java.io.IOException + */ + void writeToPacket(ByteBuf data) throws IOException; + + /** + * Clone the Item / Fluid Stack + * + * @return a new Stack, which is copied from the original. + */ + StackType copy(); + + /** + * create an empty stack. + * + * @return a new stack, which represents an empty copy of the original. + */ + StackType empty(); + + /** + * obtain the NBT Data for the item. + * + * @return + */ + IAETagCompound getTagCompound(); + + /** + * @return true if the stack is a {@link IAEItemStack} + */ + boolean isItem(); + + /** + * @return true if the stack is a {@link IAEFluidStack} + */ + boolean isFluid(); + + /** + * @return ITEM or FLUID + */ + StorageChannel getChannel(); + +} diff --git a/src/main/java/appeng/api/IAETagCompound.java b/src/main/java/appeng/api/storage/data/IAETagCompound.java old mode 100755 new mode 100644 similarity index 54% rename from src/main/java/appeng/api/IAETagCompound.java rename to src/main/java/appeng/api/storage/data/IAETagCompound.java index 3674225b..8fe65e85 --- a/src/main/java/appeng/api/IAETagCompound.java +++ b/src/main/java/appeng/api/storage/data/IAETagCompound.java @@ -1,32 +1,33 @@ -package appeng.api; +package appeng.api.storage.data; -import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; +import appeng.api.features.IItemComparison; /** * Don't cast this... either compare with it, or copy it. * * Don't Implement. */ -public interface IAETagCompound { - +public interface IAETagCompound +{ + /** - * Create a copy ( the copy will not be a IAETagCompount, it will be a NBTTagCompound. ) - * @return + * @return a copy ( the copy will not be a IAETagCompount, it will be a NBTTagCompound ) */ public NBTTagCompound getNBTTagCompoundCopy(); - + /** * compare to other NBTTagCompounds or IAETagCompounds + * * @param a * @return true, if they are the same. */ - boolean equals( Object a ); - + @Override + boolean equals(Object a); + /** - * returns the special comparison for this tag. - * @return + * @return the special comparison for this tag */ IItemComparison getSpecialComparison(); - -} + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/storage/data/IItemList.java b/src/main/java/appeng/api/storage/data/IItemList.java new file mode 100644 index 00000000..4fdad431 --- /dev/null +++ b/src/main/java/appeng/api/storage/data/IItemList.java @@ -0,0 +1,87 @@ +package appeng.api.storage.data; + +import java.util.Collection; +import java.util.Iterator; + +import appeng.api.config.FuzzyMode; + +/** + * Represents a list of items in AE. + * + * Don't Implement. + * + * Construct with Util.createItemList() + */ +public interface IItemList extends Iterable +{ + + /** + * add a stack to the list stackSize is used to add to stackSize, this will merge the stack with an item already in + * the list if found. + * + * @param option + */ + public void addStorage(StackType option); // adds a stack as stored + + /** + * add a stack to the list as craftable, this will merge the stack with an item already in the list if found. + * + * @param option + */ + public void addCrafting(StackType option); + + /** + * add a stack to the list, stack size is used to add to requstable, this will merge the stack with an item already + * in the list if found. + * + * @param option + */ + public void addRequestable(StackType option); // adds a stack as requestable + + /** + * add a stack to the list, this will merge the stack with an item already in the list if found. + * + * @param option + */ + public void add(StackType option); // adds stack as is + + /** + * @return the first item in the list + */ + StackType getFirstItem(); + + /** + * @param i + * @return a stack equivalent to the stack passed in, but with the correct stack size information, or null if its + * not present + */ + StackType findPrecise(StackType i); + + /** + * @param input + * @return a list of relevant fuzzy matched stacks + */ + public Collection findFuzzy(StackType input, FuzzyMode fuzzy); + + /** + * @return the number of items in the list + */ + int size(); + + /** + * allows you to iterate the list. + */ + @Override + public Iterator iterator(); + + /** + * @return true if there are no items in the list + */ + public boolean isEmpty(); + + /** + * resets stack sizes to 0. + */ + void resetStatus(); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/util/AECableType.java b/src/main/java/appeng/api/util/AECableType.java new file mode 100644 index 00000000..c1ee4eed --- /dev/null +++ b/src/main/java/appeng/api/util/AECableType.java @@ -0,0 +1,30 @@ +package appeng.api.util; + +public enum AECableType +{ + /** + * No Cable present. + */ + NONE, + + /** + * Connections to this block should render as glass. + */ + GLASS, + + /** + * Connections to this block should render as covered. + */ + COVERED, + + /** + * Connections to this block should render as smart. + */ + SMART, + + /** + * Dense Cable, represents a tier 2 block that can carry 32 channels. + */ + DENSE, + +} diff --git a/src/main/java/appeng/api/util/AEColor.java b/src/main/java/appeng/api/util/AEColor.java new file mode 100644 index 00000000..f5f462e6 --- /dev/null +++ b/src/main/java/appeng/api/util/AEColor.java @@ -0,0 +1,90 @@ +package appeng.api.util; + +import net.minecraft.util.StatCollector; + +/** + * List of all colors supported by AE, their names, and various colors for display. + * + * Should be the same order as Dyes, excluding Transparent. + */ +public enum AEColor +{ + + White("gui.appliedenergistics2.White", 0xBEBEBE, 0xDBDBDB, 0xFAFAFA), + + Orange("gui.appliedenergistics2.Orange", 0xF99739, 0xFAAE44, 0xF4DEC3), + + Magenta("gui.appliedenergistics2.Magenta", 0x821E82, 0xB82AB8, 0xC598C8), + + LightBlue("gui.appliedenergistics2.LightBlue", 0x628DCB, 0x82ACE7, 0xD8F6FF), + + Yellow("gui.appliedenergistics2.Yellow", 0xFFF7AA, 0xF8FF4A, 0xFFFFE8), + + Lime("gui.appliedenergistics2.Lime", 0x7CFF4A, 0xBBFF51, 0xE7F7D7), + + Pink("gui.appliedenergistics2.Pink", 0xDC8DB5, 0xF8B5D7, 0xF7DEEB), + + Gray("gui.appliedenergistics2.Gray", 0x7C7C7C, 0xA0A0A0, 0xC9C9C9), + + LightGray("gui.appliedenergistics2.LightGray", 0x9D9D9D, 0xCDCDCD, 0xEFEFEF), + + Cyan("gui.appliedenergistics2.Cyan", 0x2F9BA5, 0x51AAC6, 0xAEDDF4), + + Purple("gui.appliedenergistics2.Purple", 0x8230B2, 0xA453CE, 0xC7A3CC), + + Blue("gui.appliedenergistics2.Blue", 0x2D29A0, 0x514AFF, 0xDDE6FF), + + Brown("gui.appliedenergistics2.Brown", 0x724E35, 0xB7967F, 0xE0D2C8), + + Green("gui.appliedenergistics2.Green", 0x45A021, 0x60E32E, 0xE3F2E3), + + Red("gui.appliedenergistics2.Red", 0xA50029, 0xFF003C, 0xFFE6ED), + + Black("gui.appliedenergistics2.Black", 0x2B2B2B, 0x565656, 0x848484), + + Transparent("gui.appliedenergistics2.Fluix", 0x1B2344, 0x895CA8, 0xDABDEF); + + /** + * Unlocalized name for color. + */ + final public String unlocalizedName; + + /** + * Darkest Variant of the color, nearly black; as a RGB HEX Integer + */ + final public int blackVariant; + + /** + * The Variant of the color that is used to represent the color normally; as a RGB HEX Integer + */ + final public int mediumVariant; + + /** + * Lightest Variant of the color, nearly white; as a RGB HEX Integer + */ + final public int whiteVariant; + + AEColor(String unlocalizedName, int blackHex, int medHex, int whiteHex) { + this.unlocalizedName = unlocalizedName; + blackVariant = blackHex; + mediumVariant = medHex; + whiteVariant = whiteHex; + } + + /** + * Logic to see which colors match each other.. special handle for Transparent + */ + public boolean matches(AEColor color) + { + if ( equals( Transparent ) || color.equals( Transparent ) ) + return true; + return equals( color ); + } + + @Override + public String toString() + { + return StatCollector.translateToLocal( unlocalizedName ); + } + +} diff --git a/src/main/java/appeng/api/util/AEColoredItemDefinition.java b/src/main/java/appeng/api/util/AEColoredItemDefinition.java new file mode 100644 index 00000000..d8e9e99c --- /dev/null +++ b/src/main/java/appeng/api/util/AEColoredItemDefinition.java @@ -0,0 +1,46 @@ +package appeng.api.util; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +public interface AEColoredItemDefinition +{ + + /** + * @return the {@link net.minecraft.block.Block} Implementation if applicable + */ + Block block(AEColor color); + + /** + * @return the {@link net.minecraft.item.Item} Implementation if applicable + */ + Item item(AEColor color); + + /** + * @return the {@link net.minecraft.tileentity.TileEntity} Class if applicable. + */ + Class entity(AEColor color); + + /** + * @return an {@link net.minecraft.item.ItemStack} with specified quantity of this item. + */ + ItemStack stack(AEColor color, int stackSize); + + /** + * @param stackSize + * - stack size of the result. + * @return an array of all colors. + */ + ItemStack[] allStacks(int stackSize); + + /** + * Compare {@link net.minecraft.item.ItemStack} with this {@link appeng.api.util.AEItemDefinition} + * + * @param comparableItem + * @return true if the item stack is a matching item. + */ + boolean sameAs(AEColor color, ItemStack comparableItem); + +} diff --git a/src/main/java/appeng/api/util/AEItemDefinition.java b/src/main/java/appeng/api/util/AEItemDefinition.java new file mode 100644 index 00000000..84984ffb --- /dev/null +++ b/src/main/java/appeng/api/util/AEItemDefinition.java @@ -0,0 +1,42 @@ +package appeng.api.util; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +/** + * Gives easy access to different part of the various, items/blocks/materials in AE. + */ +public interface AEItemDefinition +{ + + /** + * @return the {@link net.minecraft.block.Block} Implementation if applicable + */ + Block block(); + + /** + * @return the {@link net.minecraft.item.Item} Implementation if applicable + */ + Item item(); + + /** + * @return the {@link net.minecraft.tileentity.TileEntity} Class if applicable. + */ + Class entity(); + + /** + * @return an {@link net.minecraft.item.ItemStack} with specified quantity of this item. + */ + ItemStack stack(int stackSize); + + /** + * Compare {@link net.minecraft.item.ItemStack} with this {@link appeng.api.util.AEItemDefinition} + * + * @param comparableItem + * @return true if the item stack is a matching item. + */ + boolean sameAs(ItemStack comparableItem); + +} diff --git a/src/main/java/appeng/api/util/DimensionalCoord.java b/src/main/java/appeng/api/util/DimensionalCoord.java new file mode 100644 index 00000000..c6025395 --- /dev/null +++ b/src/main/java/appeng/api/util/DimensionalCoord.java @@ -0,0 +1,73 @@ +package appeng.api.util; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +/** + * Represents a location in the Minecraft Universe + */ +public class DimensionalCoord extends WorldCoord +{ + + private World w; + private int dimId; + + public DimensionalCoord(DimensionalCoord s) { + super( s.x, s.y, s.z ); + w = s.w; + dimId = s.dimId; + } + + public DimensionalCoord(TileEntity s) { + super( s ); + w = s.getWorldObj(); + dimId = w.provider.dimensionId; + } + + public DimensionalCoord(World _w, int _x, int _y, int _z) { + super( _x, _y, _z ); + w = _w; + dimId = _w.provider.dimensionId; + } + + @Override + public DimensionalCoord copy() + { + return new DimensionalCoord( this ); + } + + public boolean isEqual(DimensionalCoord c) + { + return x == c.x && y == c.y && z == c.z && c.w == this.w; + } + + @Override + public boolean equals(Object obj) + { + if ( obj instanceof DimensionalCoord ) + return isEqual( (DimensionalCoord) obj ); + return false; + } + + @Override + public int hashCode() + { + return super.hashCode() ^ dimId; + } + + public boolean isInWorld(World world) + { + return w == world; + } + + @Override + public String toString() + { + return dimId + "," + super.toString(); + } + + public World getWorld() + { + return w; + } +} diff --git a/src/main/java/appeng/api/util/ICommonTile.java b/src/main/java/appeng/api/util/ICommonTile.java new file mode 100644 index 00000000..82a52509 --- /dev/null +++ b/src/main/java/appeng/api/util/ICommonTile.java @@ -0,0 +1,23 @@ +package appeng.api.util; + +import java.util.ArrayList; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public interface ICommonTile +{ + + /** + * implemented on AE's Tile Entities, Gets a list of drops that the entity will normally drop, this doesn't include + * the block itself. + * + * @param world + * @param x + * @param y + * @param z + * @param drops + */ + void getDrops(World world, int x, int y, int z, ArrayList drops); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/util/IConfigManager.java b/src/main/java/appeng/api/util/IConfigManager.java new file mode 100644 index 00000000..f8cddb84 --- /dev/null +++ b/src/main/java/appeng/api/util/IConfigManager.java @@ -0,0 +1,62 @@ +package appeng.api.util; + +import java.util.Set; + +import net.minecraft.nbt.NBTTagCompound; + +/** + * Used to adjust settings on an object, + * + * Obtained via {@link IConfigureableObject} + */ +public interface IConfigManager +{ + + /** + * get a list of different settings + * + * @return + */ + Set getSettings(); + + /** + * used to initialize the configuration manager, should be called for all settings. + * + * @param settingName + * @param defaultValue + * @return + */ + void registerSetting(Enum settingName, Enum defaultValue); + + /** + * Get Value of a particlar setting + * + * @param settingName + * @return + */ + Enum getSetting(Enum settingName); + + /** + * Change setting + * + * @param settingName + * @param newValue + * @return + */ + Enum putSetting(Enum settingName, Enum newValue); + + /** + * write all settings to the NBT Tag so they can be read later. + * + * @param dest + */ + void writeToNBT(NBTTagCompound dest); + + /** + * Only works after settings have been registered + * + * @param src + */ + void readFromNBT(NBTTagCompound src); + +} diff --git a/src/main/java/appeng/api/util/IConfigureableObject.java b/src/main/java/appeng/api/util/IConfigureableObject.java new file mode 100644 index 00000000..4e36b3f2 --- /dev/null +++ b/src/main/java/appeng/api/util/IConfigureableObject.java @@ -0,0 +1,14 @@ +package appeng.api.util; + +/** + * Implemented by various Tiles or Parts in AE + */ +public interface IConfigureableObject +{ + + /** + * get the config manager for the object. + */ + IConfigManager getConfigManager(); + +} diff --git a/src/main/java/appeng/api/util/IOrientable.java b/src/main/java/appeng/api/util/IOrientable.java new file mode 100644 index 00000000..e130ccb1 --- /dev/null +++ b/src/main/java/appeng/api/util/IOrientable.java @@ -0,0 +1,37 @@ +package appeng.api.util; + +import net.minecraftforge.common.util.ForgeDirection; + +/** + * Nearly all of AE's Tile Entities implement IOrientable. + * + * and it can be used to manipulate the direction of some machines, most of these orientations are purely visual. + * + * AE also responds to {@link Block}.rotateBlock + */ +public interface IOrientable +{ + + /** + * @return true or false, if the tile rotation is meaningful, or even changeable + */ + boolean canBeRotated(); + + /** + * @return the direction the tile is facing + */ + ForgeDirection getForward(); + + /** + * @return the direction top of the tile + */ + ForgeDirection getUp(); + + /** + * Update the orientation + * @param Forward + * @param Up + */ + void setOrientation(ForgeDirection Forward, ForgeDirection Up); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/util/IOrientableBlock.java b/src/main/java/appeng/api/util/IOrientableBlock.java new file mode 100644 index 00000000..4ae16829 --- /dev/null +++ b/src/main/java/appeng/api/util/IOrientableBlock.java @@ -0,0 +1,20 @@ +package appeng.api.util; + +import net.minecraft.world.IBlockAccess; + +/** + * Implemented on many of AE's non Tile Entity Blocks as a way to get a IOrientable. + */ +public interface IOrientableBlock +{ + + /** + * @param world + * @param x + * @param y + * @param z + * @return a IOrientable if applicable + */ + IOrientable getOrientable(IBlockAccess world, int x, int y, int z); + +} \ No newline at end of file diff --git a/src/main/java/appeng/api/util/IReadOnlyCollection.java b/src/main/java/appeng/api/util/IReadOnlyCollection.java new file mode 100644 index 00000000..ab087ca7 --- /dev/null +++ b/src/main/java/appeng/api/util/IReadOnlyCollection.java @@ -0,0 +1,21 @@ +package appeng.api.util; + +public interface IReadOnlyCollection extends Iterable +{ + + /** + * @return the objects in in the set. + */ + int size(); + + /** + * @return true if there are objects in the set + */ + boolean isEmpty(); + + /** + * @return return true if the object is part of the set. + */ + boolean contains(Object node); + +} diff --git a/src/main/java/appeng/api/util/WorldCoord.java b/src/main/java/appeng/api/util/WorldCoord.java new file mode 100644 index 00000000..beb43b3c --- /dev/null +++ b/src/main/java/appeng/api/util/WorldCoord.java @@ -0,0 +1,138 @@ +package appeng.api.util; + +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + +/** + * Represents a relative coordinate, either relative to another object, or + * relative to the origin of a dimension. + */ +public class WorldCoord +{ + + public int x; + public int y; + public int z; + + public WorldCoord add(ForgeDirection direction, int length) + { + x += direction.offsetX * length; + y += direction.offsetY * length; + z += direction.offsetZ * length; + return this; + } + + public WorldCoord subtract(ForgeDirection direction, int length) + { + x -= direction.offsetX * length; + y -= direction.offsetY * length; + z -= direction.offsetZ * length; + return this; + } + + public WorldCoord add(int _x, int _y, int _z) + { + x += _x; + y += _y; + z += _z; + return this; + } + + public WorldCoord subtract(int _x, int _y, int _z) + { + x -= _x; + y -= _y; + z -= _z; + return this; + } + + public WorldCoord multiple(int _x, int _y, int _z) + { + x *= _x; + y *= _y; + z *= _z; + return this; + } + + public WorldCoord divide(int _x, int _y, int _z) + { + x /= _x; + y /= _y; + z /= _z; + return this; + } + + public WorldCoord(int _x, int _y, int _z) { + x = _x; + y = _y; + z = _z; + } + + public WorldCoord(TileEntity s) { + this( s.xCoord, s.yCoord, s.zCoord ); + } + + /** + * Will Return NULL if it's at some diagonal! + */ + public ForgeDirection directionTo(WorldCoord loc) + { + int ox = x - loc.x; + int oy = y - loc.y; + int oz = z - loc.z; + + int xlen = Math.abs( ox ); + int ylen = Math.abs( oy ); + int zlen = Math.abs( oz ); + + if ( loc.isEqual( this.copy().add( ForgeDirection.EAST, xlen ) ) ) + return ForgeDirection.EAST; + + if ( loc.isEqual( this.copy().add( ForgeDirection.WEST, xlen ) ) ) + return ForgeDirection.WEST; + + if ( loc.isEqual( this.copy().add( ForgeDirection.NORTH, zlen ) ) ) + return ForgeDirection.NORTH; + + if ( loc.isEqual( this.copy().add( ForgeDirection.SOUTH, zlen ) ) ) + return ForgeDirection.SOUTH; + + if ( loc.isEqual( this.copy().add( ForgeDirection.UP, ylen ) ) ) + return ForgeDirection.UP; + + if ( loc.isEqual( this.copy().add( ForgeDirection.DOWN, ylen ) ) ) + return ForgeDirection.DOWN; + + return null; + } + + public boolean isEqual(WorldCoord c) + { + return x == c.x && y == c.y && z == c.z; + } + + public WorldCoord copy() + { + return new WorldCoord( x, y, z ); + } + + @Override + public boolean equals(Object obj) + { + if ( obj instanceof WorldCoord ) + return isEqual( (WorldCoord) obj ); + return false; + } + + @Override + public String toString() + { + return "" + x + "," + y + "," + z; + } + + @Override + public int hashCode() + { + return (y << 24) ^ x ^ z; + } +} diff --git a/src/main/java/buildcraft/api/blueprints/BlockSignature.java b/src/main/java/buildcraft/api/blueprints/BlockSignature.java new file mode 100644 index 00000000..519ce016 --- /dev/null +++ b/src/main/java/buildcraft/api/blueprints/BlockSignature.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.blueprints; + +public class BlockSignature { + + public String blockClassName; + public String tileClassName; + public String blockName; + public String mod; + public String modVersion; + public String customField; + + public BlockSignature(String str) { + String[] values = str.split("/"); + + int i = 0; + + if (values[0].equals("#B")) { + i++; + } + + blockClassName = values[i]; + tileClassName = values[i + 1]; + blockName = values[i + 2]; + mod = values[i + 3]; + modVersion = values[i + 4]; + customField = values[i + 5]; + + replaceNullWithStar(); + + } + + public BlockSignature() { + replaceNullWithStar(); + } + + @Override + public String toString() { + replaceNullWithStar(); + + return "#B/" + blockClassName + "/" + tileClassName + "/" + blockName + "/" + mod + "/" + modVersion + "/" + customField; + } + + public void replaceNullWithStar() { + if (blockClassName == null) { + blockClassName = "*"; + } + + if (tileClassName == null) { + tileClassName = "*"; + } + + if (blockName == null) { + blockName = "*"; + } + + if (mod == null) { + mod = "*"; + } + + if (modVersion == null) { + modVersion = "*"; + } + + if (customField == null) { + customField = "*"; + } + } +} diff --git a/src/main/java/buildcraft/api/blueprints/BlueprintManager.java b/src/main/java/buildcraft/api/blueprints/BlueprintManager.java new file mode 100644 index 00000000..07df78d5 --- /dev/null +++ b/src/main/java/buildcraft/api/blueprints/BlueprintManager.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.blueprints; + +import buildcraft.api.core.BuildCraftAPI; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +@Deprecated +public class BlueprintManager { + + //public static BptBlock[] blockBptProps = new BptBlock[Block.blocksList.length]; + + public static ItemSignature getItemSignature(Item item) { + ItemSignature sig = new ItemSignature(); + + //if (item.itemID >= Block.blocksList.length + BuildCraftAPI.LAST_ORIGINAL_ITEM) { + // sig.itemClassName = item.getClass().getSimpleName(); + //} + + sig.itemName = item.getUnlocalizedName(new ItemStack(item)); + + return sig; + } + + public static BlockSignature getBlockSignature(Block block) { + //return BlueprintManager.blockBptProps[0].getSignature(block); + return null; + } + + static { + // Initialize defaults for block properties. + //for (int i = 0; i < BlueprintManager.blockBptProps.length; ++i) { + // new BptBlock(i); + //} + } +} diff --git a/src/main/java/buildcraft/api/blueprints/BptBlock.java b/src/main/java/buildcraft/api/blueprints/BptBlock.java new file mode 100644 index 00000000..305cdee4 --- /dev/null +++ b/src/main/java/buildcraft/api/blueprints/BptBlock.java @@ -0,0 +1,234 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.blueprints; + +import buildcraft.api.core.BuildCraftAPI; +import java.util.ArrayList; +import java.util.LinkedList; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +/** + * This class allow to specify specific behavior for blocks stored in blueprints: + * + * - what items needs to be used to create that block - how the block has to be built on the world - how to rotate the block - what extra data to store / load + * in the blueprint + * + * Default implementations of this can be seen in the package buildcraft.api.bptblocks. The class BptBlockUtils provide some additional utilities. + * + * Blueprints perform "id translation" in case the block ids between a blueprint and the world installation are different. In order to translate block ids, + * blocks needs to be uniquely identified. By default, this identification is done by: + * + * - the block simple class name - the tile simple class name (if any) - the block name + * + * In certain circumstances, the above is not enough (e.g. if several blocks share the same class and the same name, with no tile). In this case, additional + * data may be provided by children of this class: + * + * - mod name - custom signature + * + * At blueprint load time, BuildCraft will check that each block id of the blueprint corresponds to the block id in the installation. If not, it will perform a + * search through the block list, and upon matching signature, it will translate all blocks ids of the blueprint to the installation ones. If no such block id + * is found, BuildCraft will assume that the block is not installed and will not load the blueprint. + */ + +@Deprecated +public class BptBlock { + + public final int blockId; + + public BptBlock(int blockId) { + this.blockId = blockId; + + //BlueprintManager.blockBptProps[blockId] = this; + } + + /** + * Returns the requirements needed to build this block. When the requirements are met, they will be removed all at once from the builder, before calling + * buildBlock. + */ + public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList requirements) { + if (slot.block != null) { + if (slot.storedRequirements.size() != 0) { + requirements.addAll(slot.storedRequirements); + } else { + // requirements.add(new ItemStack(slot.blockId, 1, slot.meta)); + } + } + } + + /** + * This is called each time an item matches a reqquirement, that is: (req id == stack id) for damageable items (req id == stack id && req dmg == stack dmg) + * for other items by default, it will increase damage of damageable items by the amount of damage of the requirement, and remove the intended amount of non + * damageable item. + * + * Client may override this behavior for default items. Note that this subprogram may be called twice with the same parameters, once with a copy of + * requirements and stack to check if the entire requirements can be fullfilled, and once with the real inventory. Implementer is responsible for updating + * req (with the remaining requirements if any) and stack (after usage) + * + * returns: what was used (similer to req, but created from stack, so that any NBT based differences are drawn from the correct source) + */ + public ItemStack useItem(BptSlotInfo slot, IBptContext context, ItemStack req, ItemStack stack) { + ItemStack result = stack.copy(); + if (stack.isItemStackDamageable()) { + if (req.getItemDamage() + stack.getItemDamage() <= stack.getMaxDamage()) { + stack.setItemDamage(req.getItemDamage() + stack.getItemDamage()); + result.setItemDamage(req.getItemDamage()); + req.stackSize = 0; + } + + if (stack.getItemDamage() >= stack.getMaxDamage()) { + stack.stackSize = 0; + } + } else { + if (stack.stackSize >= req.stackSize) { + result.stackSize = req.stackSize; + stack.stackSize -= req.stackSize; + req.stackSize = 0; + } else { + req.stackSize -= stack.stackSize; + stack.stackSize = 0; + } + } + + if (stack.stackSize == 0 && stack.getItem().getContainerItem() != null) { + Item container = stack.getItem().getContainerItem(); + + //stack.itemID = container.itemID; + stack.stackSize = 1; + stack.setItemDamage(0); + } + return result; + } + + /** + * Return true if the block on the world correspond to the block stored in the blueprint at the location given by the slot. By default, this subprogram is + * permissive and doesn't take into account metadata. + * + * Added metadata sensitivity //Krapht + */ + public boolean isValid(BptSlotInfo slot, IBptContext context) { + //return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z) && slot.meta == context.world().getBlockMetadata(slot.x, slot.y, slot.z); + return false; + } + + /** + * Perform a 90 degree rotation to the slot. + */ + public void rotateLeft(BptSlotInfo slot, IBptContext context) { + + } + + /** + * Places the block in the world, at the location specified in the slot. + */ + public void buildBlock(BptSlotInfo slot, IBptContext context) { + // Meta needs to be specified twice, depending on the block behavior + context.world().setBlock(slot.x, slot.y, slot.z, slot.block, slot.meta, 0); + //context.world().setBlockMetadataWithNotify(slot.x, slot.y, slot.z, slot.meta,3); + + if (slot.block instanceof BlockContainer) { + TileEntity tile = context.world().getTileEntity(slot.x, slot.y, slot.z); + + //slot.cpt.setInteger("x", slot.x); + //slot.cpt.setInteger("y", slot.y); + //slot.cpt.setInteger("z", slot.z); + + //if (tile != null) { + // tile.readFromNBT(slot.cpt); + //} + } + } + + /** + * Return true if the block should not be placed to the world. Requirements will not be asked on such a block, and building will not be called. + */ + public boolean ignoreBuilding(BptSlotInfo slot) { + return false; + } + + /** + * Initializes a slot from the blueprint according to an objet placed on {x, y, z} on the world. This typically means adding entries in slot.cpt. Note that + * "id" and "meta" will be set automatically, corresponding to the block id and meta. + * + * By default, if the block is a BlockContainer, tile information will be to save / load the block. + */ + public void initializeFromWorld(BptSlotInfo slot, IBptContext context, int x, int y, int z) { + /*if (Block.blocksList[slot.blockId] instanceof BlockContainer) { + TileEntity tile = context.world().getTileEntity(x, y, z); + + if (tile != null) { + tile.writeToNBT(slot.cpt); + } + } + + if (Block.blocksList[slot.blockId] != null) { + ArrayList req = Block.blocksList[slot.blockId].getBlockDropped(context.world(), x, y, z, context.world().getBlockMetadata(x, y, z), 0); + + if (req != null) { + slot.storedRequirements.addAll(req); + } + }*/ + } + + /** + * Called on a block when the blueprint has finished to place all the blocks. This may be useful to adjust variable depending on surrounding blocks that may + * not be there already at initial building. + */ + public void postProcessing(BptSlotInfo slot, IBptContext context) { + + } + + /** + * By default, block class name, block tile name and block name are used to define block signature. Overriding this subprogram may allow to replace some of + * these with stars, specify the mod that this block kind is coming from or add custom data to the signature. + */ + public BlockSignature getSignature(Block block) { + BlockSignature sig = new BlockSignature(); + + /*if (block.blockID > BuildCraftAPI.LAST_ORIGINAL_BLOCK) { + sig.blockClassName = block.getClass().getSimpleName(); + + if (block instanceof BlockContainer) { + // TODO: Try to see if we can get a world instance to call with instead of null + TileEntity tile = ((BlockContainer) block).createNewTileEntity(null); + + if (tile != null) { + sig.tileClassName = tile.getClass().getSimpleName(); + } + } + }*/ + + sig.blockName = block.getUnlocalizedName(); + sig.replaceNullWithStar(); + + return sig; + } + + /** + * By default, block name, block and tile classes, mod name and custom signature are matched to verify if a blueprint block corresponds to the installation + * block - except for the default blocks which don't check for classes. For any value, * means match with anything. For compatibilty and evolution reasons, + * mods may want to write a different policy, allowing to migrate one format to the other. + */ + public boolean match(Block block, BlockSignature sig) { + if (block == null) + return false; + + BlockSignature inst = BlueprintManager.getBlockSignature(block); + + return starMatch(sig.blockName, inst.blockName) && starMatch(sig.blockClassName, inst.blockClassName) + && starMatch(sig.tileClassName, inst.tileClassName) && starMatch(sig.customField, inst.customField) && starMatch(sig.mod, inst.mod); + } + + private boolean starMatch(String s1, String s2) { + return s1.equals("*") || s2.equals("*") || s1.equals(s2); + } +} diff --git a/src/main/java/buildcraft/api/blueprints/BptBlockUtils.java b/src/main/java/buildcraft/api/blueprints/BptBlockUtils.java new file mode 100644 index 00000000..e5dfac7e --- /dev/null +++ b/src/main/java/buildcraft/api/blueprints/BptBlockUtils.java @@ -0,0 +1,84 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.blueprints; + +import java.util.LinkedList; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +@Deprecated +public class BptBlockUtils { + + public static void requestInventoryContents(BptSlotInfo slot, IBptContext context, LinkedList requirements) { + ItemStack[] stacks = getItemStacks(slot, context); + + for (ItemStack stack : stacks) { + if (stack != null) { + requirements.add(stack); + } + } + } + + public static void initializeInventoryContents(BptSlotInfo slot, IBptContext context, IInventory inventory) { + ItemStack[] stacks = new ItemStack[inventory.getSizeInventory()]; + + for (int i = 0; i < inventory.getSizeInventory(); ++i) { + stacks[i] = inventory.getStackInSlot(i); + } + + setItemStacks(slot, context, stacks); + } + + public static void buildInventoryContents(BptSlotInfo slot, IBptContext context, IInventory inventory) { + ItemStack[] stacks = getItemStacks(slot, context); + + for (int i = 0; i < stacks.length; ++i) { + inventory.setInventorySlotContents(i, stacks[i]); + } + } + + public static ItemStack[] getItemStacks(BptSlotInfo slot, IBptContext context) { + NBTTagList list = (NBTTagList) slot.cpt.getTag("inv"); + + if (list == null) + return new ItemStack[0]; + + ItemStack stacks[] = new ItemStack[list.tagCount()]; + + for (int i = 0; i < list.tagCount(); ++i) { + //ItemStack stack = ItemStack.loadItemStackFromNBT((NBTTagCompound) list.tagAt(i)); + + //if (stack != null && stack.itemID != 0 && stack.stackSize > 0) { + // stacks[i] = context.mapItemStack(stack); + //} + } + + return stacks; + } + + public static void setItemStacks(BptSlotInfo slot, IBptContext context, ItemStack[] stacks) { + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < stacks.length; ++i) { + NBTTagCompound cpt = new NBTTagCompound(); + nbttaglist.appendTag(cpt); + ItemStack stack = stacks[i]; + + if (stack != null && stack.stackSize != 0) { + stack.writeToNBT(cpt); + //context.storeId(stack.itemID); + } + } + + slot.cpt.setTag("inv", nbttaglist); + } + +} diff --git a/src/main/java/buildcraft/api/blueprints/BptSlotInfo.java b/src/main/java/buildcraft/api/blueprints/BptSlotInfo.java new file mode 100644 index 00000000..afa74156 --- /dev/null +++ b/src/main/java/buildcraft/api/blueprints/BptSlotInfo.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.blueprints; + +import java.util.LinkedList; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +/** + * This class records a slot, either from a blueprint or from a block placed in the world. + */ + +@Deprecated +public class BptSlotInfo { + + public Block block = null; + public int meta = 0; + public int x; + public int y; + public int z; + + /** + * This field contains requirements for a given block when stored in the blueprint. Modders can either rely on this list or compute their own int BptBlock. + */ + public LinkedList storedRequirements = new LinkedList(); + + /** + * This tree contains additional data to be stored in the blueprint. By default, it will be initialized from BptBlock.initializeFromWorld with the standard + * readNBT function of the corresponding tile (if any) and will be loaded from BptBlock.buildBlock using the standard writeNBT function. + */ + public NBTTagCompound cpt = new NBTTagCompound(); + + @Override + public BptSlotInfo clone() { + BptSlotInfo obj = new BptSlotInfo(); + + obj.x = x; + obj.y = y; + obj.z = z; + obj.block = block; + obj.meta = meta; + obj.cpt = (NBTTagCompound) cpt.copy(); + + return obj; + } + +} diff --git a/src/main/java/buildcraft/api/blueprints/IBptContext.java b/src/main/java/buildcraft/api/blueprints/IBptContext.java new file mode 100644 index 00000000..d785722b --- /dev/null +++ b/src/main/java/buildcraft/api/blueprints/IBptContext.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.blueprints; + +import buildcraft.api.core.IBox; +import buildcraft.api.core.Position; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +/** + * This interface provide contextual information when building or initializing blueprint slots. + */ + +@Deprecated +public interface IBptContext { + + /** + * If bptItemStack is an ItemStack extracted from the blueprint containing this mapping, this will return an item stack with the id of the current world + */ + public ItemStack mapItemStack(ItemStack bptItemStack); + + /** + * Blueprints may be created in a world with a given id setting, and then ported to a world with different ids. Heuristics are used to retreive these new + * ids automatically. This interface provide services to map ids from a blueprints to current ids in the world, and should be used whenever storing block + * numbers or item stacks in blueprints.. + */ + public int mapWorldId(int bptWorldId); + + /** + * This asks the id mapping to store a mapping from this Id, which may be either an itemId or a blockId. In effect, the blueprint will record it and make it + * available upon blueprint load. Note that block present in the blueprint are automatically stored upon blueprint save, so this is really only needed when + * writing ids that are e.g. in inventory stacks. + */ + public void storeId(int worldId); + + public Position rotatePositionLeft(Position pos); + + public IBox surroundingBox(); + + public World world(); +} diff --git a/src/main/java/buildcraft/api/blueprints/ItemSignature.java b/src/main/java/buildcraft/api/blueprints/ItemSignature.java new file mode 100644 index 00000000..b3fa2065 --- /dev/null +++ b/src/main/java/buildcraft/api/blueprints/ItemSignature.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.blueprints; + +@Deprecated +public class ItemSignature { + + public String itemClassName; + public String itemName; + + public ItemSignature(String str) { + String[] values = str.split("/"); + + itemClassName = values[1]; + itemName = values[2]; + + replaceNullWithStar(); + + } + + public ItemSignature() { + replaceNullWithStar(); + } + + @Override + public String toString() { + replaceNullWithStar(); + + return "#I/" + itemClassName + "/" + itemName; + } + + public void replaceNullWithStar() { + if (itemClassName == null) { + itemClassName = "*"; + } + + if (itemName == null) { + itemName = "*"; + } + } +} diff --git a/src/main/java/buildcraft/api/blueprints/package-info.java b/src/main/java/buildcraft/api/blueprints/package-info.java new file mode 100644 index 00000000..0604277f --- /dev/null +++ b/src/main/java/buildcraft/api/blueprints/package-info.java @@ -0,0 +1,3 @@ +@API(apiVersion="1.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|blueprints") +package buildcraft.api.blueprints; +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockBed.java b/src/main/java/buildcraft/api/bptblocks/BptBlockBed.java new file mode 100644 index 00000000..e2f22e0c --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockBed.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BptBlock; +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; + +import java.util.LinkedList; + +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +@Deprecated +public class BptBlockBed extends BptBlock { + + public BptBlockBed(int blockId) { + super(blockId); + } + + @Override + public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList requirements) { + if ((slot.meta & 8) == 0) { + requirements.add(new ItemStack(Items.bed)); + } + } + + @Override + public void rotateLeft(BptSlotInfo slot, IBptContext context) { + int orientation = (slot.meta & 7); + int others = slot.meta - orientation; + + switch (orientation) { + case 0: + slot.meta = 1 + others; + break; + case 1: + slot.meta = 2 + others; + break; + case 2: + slot.meta = 3 + others; + break; + case 3: + slot.meta = 0 + others; + break; + } + } + + @Override + public void buildBlock(BptSlotInfo slot, IBptContext context) { + if ((slot.meta & 8) != 0) + return; + + //context.world().setBlock(slot.x, slot.y, slot.z, slot.block, slot.meta,1); + + int x2 = slot.x; + int z2 = slot.z; + + switch (slot.meta) { + case 0: + z2++; + break; + case 1: + x2--; + break; + case 2: + z2--; + break; + case 3: + x2++; + break; + } + + //context.world().setBlock(x2, slot.y, z2, slot.block, slot.meta + 8,1); + } + + @Override + public boolean ignoreBuilding(BptSlotInfo slot) { + return (slot.meta & 8) != 0; + } +} diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockCustomStack.java b/src/main/java/buildcraft/api/bptblocks/BptBlockCustomStack.java new file mode 100644 index 00000000..1087520f --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockCustomStack.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BptBlock; +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; +import java.util.LinkedList; +import net.minecraft.item.ItemStack; + +@Deprecated +public class BptBlockCustomStack extends BptBlock { + + final ItemStack customStack; + + public BptBlockCustomStack(int blockId, ItemStack customStack) { + super(blockId); + + this.customStack = customStack; + } + + @Override + public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList requirements) { + requirements.add(customStack.copy()); + } + +} diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockDelegate.java b/src/main/java/buildcraft/api/bptblocks/BptBlockDelegate.java new file mode 100644 index 00000000..45c4891e --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockDelegate.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BlueprintManager; +import buildcraft.api.blueprints.BptBlock; +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; + +import java.util.LinkedList; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; + +@Deprecated +public class BptBlockDelegate extends BptBlock { + + final Block delegateTo; + + public BptBlockDelegate(int blockId, Block delegateTo) { + super(blockId); + + this.delegateTo = delegateTo; + } + + @Override + public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList requirements) { + BptSlotInfo newSlot = slot.clone(); + slot.block = delegateTo; + + //if (BlueprintManager.blockBptProps[delegateTo] != null) { + // BlueprintManager.blockBptProps[delegateTo].addRequirements(newSlot, context, requirements); + //} else { + // super.addRequirements(newSlot, context, requirements); + //} + } + + @Override + public boolean isValid(BptSlotInfo slot, IBptContext context) { + BptSlotInfo newSlot = slot.clone(); + slot.block = delegateTo; + + //if (BlueprintManager.blockBptProps[delegateTo] != null) + // return BlueprintManager.blockBptProps[delegateTo].isValid(newSlot, context); + //else + // return super.isValid(newSlot, context); + + return false; + } + + @Override + public void rotateLeft(BptSlotInfo slot, IBptContext context) { + BptSlotInfo newSlot = slot.clone(); + slot.block = delegateTo; + + //if (BlueprintManager.blockBptProps[delegateTo] != null) { + // BlueprintManager.blockBptProps[delegateTo].rotateLeft(newSlot, context); + //} else { + // super.rotateLeft(newSlot, context); + //} + } + +} diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockDirt.java b/src/main/java/buildcraft/api/bptblocks/BptBlockDirt.java new file mode 100644 index 00000000..12720bf3 --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockDirt.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BptBlock; +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; +import java.util.LinkedList; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; + +@Deprecated +public class BptBlockDirt extends BptBlock { + + public BptBlockDirt(int blockId) { + super(blockId); + } + + @Override + public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList requirements) { + //requirements.add(new ItemStack(Block.dirt)); + } + + @Override + public void buildBlock(BptSlotInfo slot, IBptContext context) { + //context.world().setBlock(slot.x, slot.y, slot.z, Block.dirt.blockID, slot.meta,1); + } + + @Override + public boolean isValid(BptSlotInfo slot, IBptContext context) { + //int id = context.world().getBlockId(slot.x, slot.y, slot.z); + + //return id == Block.dirt.blockID || id == Block.grass.blockID || id == Block.tilledField.blockID; + return false; + } +} diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockDoor.java b/src/main/java/buildcraft/api/bptblocks/BptBlockDoor.java new file mode 100644 index 00000000..dedb75e8 --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockDoor.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BptBlock; +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; +import java.util.LinkedList; +import net.minecraft.item.ItemStack; + +@Deprecated +public class BptBlockDoor extends BptBlock { + + final ItemStack stack; + + public BptBlockDoor(int blockId, ItemStack stack) { + super(blockId); + + this.stack = stack; + } + + @Override + public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList requirements) { + if ((slot.meta & 8) == 0) { + requirements.add(stack.copy()); + } + } + + @Override + public void rotateLeft(BptSlotInfo slot, IBptContext context) { + int orientation = (slot.meta & 3); + int others = slot.meta - orientation; + + switch (orientation) { + case 0: + slot.meta = 1 + others; + break; + case 1: + slot.meta = 2 + others; + break; + case 2: + slot.meta = 3 + others; + break; + case 3: + slot.meta = 0 + others; + break; + } + } + + @Override + public boolean ignoreBuilding(BptSlotInfo slot) { + return (slot.meta & 8) != 0; + } + + @Override + public void buildBlock(BptSlotInfo slot, IBptContext context) { + //context.world().setBlock(slot.x, slot.y, slot.z, slot.blockId, slot.meta,1); + //context.world().setBlock(slot.x, slot.y + 1, slot.z, slot.blockId, slot.meta + 8,1); + + context.world().setBlockMetadataWithNotify(slot.x, slot.y + 1, slot.z, slot.meta + 8,1); + context.world().setBlockMetadataWithNotify(slot.x, slot.y, slot.z, slot.meta,1); + + } +} diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockFluid.java b/src/main/java/buildcraft/api/bptblocks/BptBlockFluid.java new file mode 100644 index 00000000..dc5cd325 --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockFluid.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BptBlock; +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; +import java.util.LinkedList; +import net.minecraft.item.ItemStack; + +@Deprecated +public class BptBlockFluid extends BptBlock { + + private final ItemStack bucketStack; + + public BptBlockFluid(int blockId, ItemStack bucketStack) { + super(blockId); + + this.bucketStack = bucketStack; + } + + @Override + public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList requirements) { + if (slot.meta == 0) { + requirements.add(bucketStack.copy()); + } + } + + @Override + public boolean isValid(BptSlotInfo slot, IBptContext context) { + //if (slot.meta == 0) + // return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z) && context.world().getBlockMetadata(slot.x, slot.y, slot.z) == 0; + //else + return true; + } + + @Override + public void rotateLeft(BptSlotInfo slot, IBptContext context) { + + } + + @Override + public boolean ignoreBuilding(BptSlotInfo slot) { + return slot.meta != 0; + } + + @Override + public void buildBlock(BptSlotInfo slot, IBptContext context) { + //if (slot.meta == 0) { + // context.world().setBlock(slot.x, slot.y, slot.z, slot.blockId, 0,1); + //} + } + +} diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockIgnore.java b/src/main/java/buildcraft/api/bptblocks/BptBlockIgnore.java new file mode 100644 index 00000000..465143ca --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockIgnore.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BptBlock; +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; +import java.util.LinkedList; +import net.minecraft.item.ItemStack; + +@Deprecated +public class BptBlockIgnore extends BptBlock { + + public BptBlockIgnore(int blockId) { + super(blockId); + } + + @Override + public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList requirements) { + //requirements.add(new ItemStack(slot.blockId, 0, 0)); + } + + @Override + public boolean isValid(BptSlotInfo slot, IBptContext context) { + return true; + } + + @Override + public void rotateLeft(BptSlotInfo slot, IBptContext context) { + + } + + @Override + public boolean ignoreBuilding(BptSlotInfo slot) { + return true; + } + +} diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockIgnoreMeta.java b/src/main/java/buildcraft/api/bptblocks/BptBlockIgnoreMeta.java new file mode 100644 index 00000000..4f60fb2f --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockIgnoreMeta.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BptBlock; +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; +import java.util.LinkedList; +import net.minecraft.item.ItemStack; + +@Deprecated +public class BptBlockIgnoreMeta extends BptBlock { + + public BptBlockIgnoreMeta(int blockId) { + super(blockId); + } + + @Override + public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList requirements) { + //requirements.add(new ItemStack(slot.blockId, 1, 0)); + } + + @Override + public boolean isValid(BptSlotInfo slot, IBptContext context) { + //return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z); + return false; + } +} diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockInventory.java b/src/main/java/buildcraft/api/bptblocks/BptBlockInventory.java new file mode 100644 index 00000000..e307eb18 --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockInventory.java @@ -0,0 +1,37 @@ + +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BptBlock; +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; +import net.minecraft.inventory.IInventory; + +@Deprecated +public class BptBlockInventory extends BptBlock { + + public BptBlockInventory(int blockId) { + super(blockId); + + } + + @Override + public void buildBlock(BptSlotInfo slot, IBptContext context) { + super.buildBlock(slot, context); + + IInventory inv = (IInventory) context.world().getTileEntity(slot.x, slot.y, slot.z); + + for (int i = 0; i < inv.getSizeInventory(); ++i) { + inv.setInventorySlotContents(i, null); + } + + } + +} diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockLever.java b/src/main/java/buildcraft/api/bptblocks/BptBlockLever.java new file mode 100644 index 00000000..d731c238 --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockLever.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; +import java.util.LinkedList; +import net.minecraft.item.ItemStack; + +@Deprecated +public class BptBlockLever extends BptBlockWallSide { + + public BptBlockLever(int blockId) { + super(blockId); + } + + @Override + public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList requirements) { + //requirements.add(new ItemStack(slot.blockId, 1, 0)); + } + + @Override + public void rotateLeft(BptSlotInfo slot, IBptContext context) { + int status = slot.meta - (slot.meta & 7); + + slot.meta -= status; + super.rotateLeft(slot, context); + slot.meta += status; + + } +} diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockPiston.java b/src/main/java/buildcraft/api/bptblocks/BptBlockPiston.java new file mode 100644 index 00000000..8e3950cb --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockPiston.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; + +@Deprecated +public class BptBlockPiston extends BptBlockRotateMeta { + + public BptBlockPiston(int blockId) { + super(blockId, new int[] { 2, 5, 3, 4 }, true); + } + + @Override + public void buildBlock(BptSlotInfo slot, IBptContext context) { + int meta = slot.meta & 7; + + //context.world().setBlock(slot.x, slot.y, slot.z, slot.blockId, meta,1); + } + +} diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockPumpkin.java b/src/main/java/buildcraft/api/bptblocks/BptBlockPumpkin.java new file mode 100644 index 00000000..4eff9e4c --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockPumpkin.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BptBlock; +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; +import java.util.LinkedList; +import net.minecraft.item.ItemStack; + +@Deprecated +public class BptBlockPumpkin extends BptBlock { + + public BptBlockPumpkin(int blockId) { + super(blockId); + } + + @Override + public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList requirements) { + //requirements.add(new ItemStack(slot.blockId, 1, 0)); + } + + @Override + public boolean isValid(BptSlotInfo slot, IBptContext context) { + //return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z); + return false; + } + + @Override + public void rotateLeft(BptSlotInfo slot, IBptContext context) { + switch (slot.meta) { + case 0: + slot.meta = 1; + break; + case 1: + slot.meta = 2; + break; + case 2: + slot.meta = 3; + break; + case 3: + slot.meta = 0; + break; + } + } + +} diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockRedstoneRepeater.java b/src/main/java/buildcraft/api/bptblocks/BptBlockRedstoneRepeater.java new file mode 100644 index 00000000..8852cb98 --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockRedstoneRepeater.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BptBlock; +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; +import java.util.LinkedList; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +@Deprecated +public class BptBlockRedstoneRepeater extends BptBlock { + + public BptBlockRedstoneRepeater(int blockId) { + super(blockId); + } + + @Override + public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList requirements) { + //requirements.add(new ItemStack(Item.redstoneRepeater)); + } + + @Override + public void rotateLeft(BptSlotInfo slot, IBptContext context) { + int step = slot.meta - (slot.meta & 3); + + switch (slot.meta - step) { + case 0: + slot.meta = 1 + step; + break; + case 1: + slot.meta = 2 + step; + break; + case 2: + slot.meta = 3 + step; + break; + case 3: + slot.meta = 0 + step; + break; + } + } +} diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockRotateInventory.java b/src/main/java/buildcraft/api/bptblocks/BptBlockRotateInventory.java new file mode 100644 index 00000000..e0b9bd67 --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockRotateInventory.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; +import net.minecraft.inventory.IInventory; + +@Deprecated +public class BptBlockRotateInventory extends BptBlockRotateMeta { + + public BptBlockRotateInventory(int blockId, int[] rotations, boolean rotateForward) { + super(blockId, rotations, rotateForward); + + } + + @Override + public void buildBlock(BptSlotInfo slot, IBptContext context) { + super.buildBlock(slot, context); + + IInventory inv = (IInventory) context.world().getTileEntity(slot.x, slot.y, slot.z); + + for (int i = 0; i < inv.getSizeInventory(); ++i) { + inv.setInventorySlotContents(i, null); + } + + } + +} diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockRotateMeta.java b/src/main/java/buildcraft/api/bptblocks/BptBlockRotateMeta.java new file mode 100644 index 00000000..9066ee62 --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockRotateMeta.java @@ -0,0 +1,84 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BptBlock; +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; +import java.util.LinkedList; +import net.minecraft.item.ItemStack; + +@Deprecated +public class BptBlockRotateMeta extends BptBlock { + + int[] rot; + boolean rotateForward; + + int infoMask = 0; + + public BptBlockRotateMeta(int blockId, int[] rotations, boolean rotateForward) { + super(blockId); + + rot = rotations; + + for (int i = 0; i < rot.length; ++i) { + if (rot[i] < 4) { + infoMask = (infoMask < 3 ? 3 : infoMask); + } else if (rot[i] < 8) { + infoMask = (infoMask < 7 ? 7 : infoMask); + } else if (rot[i] < 16) { + infoMask = (infoMask < 15 ? 15 : infoMask); + } + } + + this.rotateForward = rotateForward; + } + + @Override + public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList requirements) { + //requirements.add(new ItemStack(slot.blockId, 1, 0)); + } + + @Override + public boolean isValid(BptSlotInfo slot, IBptContext context) { + //return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z); + return false; + } + + @Override + public void rotateLeft(BptSlotInfo slot, IBptContext context) { + int pos = slot.meta & infoMask; + int others = slot.meta - pos; + + if (rotateForward) { + if (pos == rot[0]) { + pos = rot[1]; + } else if (pos == rot[1]) { + pos = rot[2]; + } else if (pos == rot[2]) { + pos = rot[3]; + } else if (pos == rot[3]) { + pos = rot[0]; + } + } else { + if (pos == rot[0]) { + pos = rot[3]; + } else if (pos == rot[1]) { + pos = rot[2]; + } else if (pos == rot[2]) { + pos = rot[0]; + } else if (pos == rot[3]) { + pos = rot[1]; + } + } + + slot.meta = pos + others; + } + +} diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockSign.java b/src/main/java/buildcraft/api/bptblocks/BptBlockSign.java new file mode 100644 index 00000000..29af85d4 --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockSign.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BlockSignature; +import buildcraft.api.blueprints.BptBlock; +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; +import java.util.LinkedList; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +@Deprecated +public class BptBlockSign extends BptBlock { + + boolean isWall; + + public BptBlockSign(int blockId, boolean isWall) { + super(blockId); + + this.isWall = isWall; + } + + @Override + public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList requirements) { + //requirements.add(new ItemStack(Item.sign)); + } + + @Override + public void rotateLeft(BptSlotInfo slot, IBptContext context) { + if (!isWall) { + double angle = ((slot.meta) * 360.0) / 16.0; + angle += 90.0; + if (angle >= 360) { + angle -= 360; + } + slot.meta = (int) (angle / 360.0 * 16.0); + } else { + // slot.meta = ForgeDirection.values()[slot.meta].rotateLeft().ordinal(); + } + } + + @Override + public BlockSignature getSignature(Block block) { + BlockSignature sig = super.getSignature(block); + + if (isWall) { + sig.customField = "wall"; + } else { + sig.customField = "floor"; + } + + return sig; + } + +} diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockStairs.java b/src/main/java/buildcraft/api/bptblocks/BptBlockStairs.java new file mode 100644 index 00000000..391112c9 --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockStairs.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BptBlock; +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; +import java.util.LinkedList; +import net.minecraft.item.ItemStack; + +@Deprecated +public class BptBlockStairs extends BptBlock { + + public BptBlockStairs(int blockId) { + super(blockId); + } + + @Override + public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList requirements) { + //requirements.add(new ItemStack(slot.blockId, 1, 0)); + } + + @Override + public boolean isValid(BptSlotInfo slot, IBptContext context) { + //return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z); + return false; + } + + @Override + public void rotateLeft(BptSlotInfo slot, IBptContext context) { + switch (slot.meta) { + case 0: + slot.meta = 2; + break; + case 1: + slot.meta = 3; + break; + case 2: + slot.meta = 1; + break; + case 3: + slot.meta = 0; + break; + } + } + +} diff --git a/src/main/java/buildcraft/api/bptblocks/BptBlockWallSide.java b/src/main/java/buildcraft/api/bptblocks/BptBlockWallSide.java new file mode 100644 index 00000000..ac0d8ada --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/BptBlockWallSide.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.bptblocks; + +import buildcraft.api.blueprints.BptBlock; +import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.blueprints.IBptContext; +import java.util.LinkedList; +import net.minecraft.item.ItemStack; + +@Deprecated +public class BptBlockWallSide extends BptBlock { + + public BptBlockWallSide(int blockId) { + super(blockId); + } + + @Override + public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList requirements) { + //requirements.add(new ItemStack(slot.blockId, 1, 0)); + } + + @Override + public void rotateLeft(BptSlotInfo slot, IBptContext context) { + final int XPos = 2; + final int XNeg = 1; + final int ZPos = 4; + final int ZNeg = 3; + + switch (slot.meta) { + case XPos: + slot.meta = ZPos; + break; + case ZNeg: + slot.meta = XPos; + break; + case XNeg: + slot.meta = ZNeg; + break; + case ZPos: + slot.meta = XNeg; + break; + } + } +} diff --git a/src/main/java/buildcraft/api/bptblocks/package-info.java b/src/main/java/buildcraft/api/bptblocks/package-info.java new file mode 100644 index 00000000..227914c4 --- /dev/null +++ b/src/main/java/buildcraft/api/bptblocks/package-info.java @@ -0,0 +1,3 @@ +@API(apiVersion="1.0",owner="BuildCraftAPI|blueprints",provides="BuildCraftAPI|bptblocks") +package buildcraft.api.bptblocks; +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/buildcraft/api/core/BuildCraftAPI.java b/src/main/java/buildcraft/api/core/BuildCraftAPI.java new file mode 100644 index 00000000..4dadfae9 --- /dev/null +++ b/src/main/java/buildcraft/api/core/BuildCraftAPI.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.core; + +import java.util.HashSet; +import java.util.Set; + +import net.minecraft.block.Block; + +public class BuildCraftAPI { + + public static final int LAST_ORIGINAL_BLOCK = 122; + public static final int LAST_ORIGINAL_ITEM = 126; + + public static final Set softBlocks = new HashSet(); +} diff --git a/src/main/java/buildcraft/api/core/IAreaProvider.java b/src/main/java/buildcraft/api/core/IAreaProvider.java new file mode 100644 index 00000000..2338e0c7 --- /dev/null +++ b/src/main/java/buildcraft/api/core/IAreaProvider.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.core; + +/** + * To be implemented by TileEntities able to provide a square area on the world, typically BuildCraft markers. + */ +public interface IAreaProvider { + + public int xMin(); + + public int yMin(); + + public int zMin(); + + public int xMax(); + + public int yMax(); + + public int zMax(); + + /** + * Remove from the world all objects used to define the area. + */ + public void removeFromWorld(); + +} diff --git a/src/main/java/buildcraft/api/core/IBox.java b/src/main/java/buildcraft/api/core/IBox.java new file mode 100644 index 00000000..bfcafe6c --- /dev/null +++ b/src/main/java/buildcraft/api/core/IBox.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.core; + +import net.minecraft.world.World; + +public interface IBox { + + public void expand(int amount); + + public void contract(int amount); + + public boolean contains(int x, int y, int z); + + public Position pMin(); + + public Position pMax(); + + public void createLasers(World world, LaserKind kind); + + public void deleteLasers(); + +} diff --git a/src/main/java/buildcraft/api/core/IIconProvider.java b/src/main/java/buildcraft/api/core/IIconProvider.java new file mode 100644 index 00000000..3df0b6d9 --- /dev/null +++ b/src/main/java/buildcraft/api/core/IIconProvider.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.core; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.util.IIcon; + +public interface IIconProvider { + + /** + * @param iconIndex + * @return + */ + @SideOnly(Side.CLIENT) + public IIcon getIcon(int iconIndex); + + /** + * A call for the provider to register its Icons. This may be called multiple times but should only be executed once per provider + * @param iconRegister + */ + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister); + +} diff --git a/src/main/java/buildcraft/api/core/LaserKind.java b/src/main/java/buildcraft/api/core/LaserKind.java new file mode 100644 index 00000000..85f5ce8e --- /dev/null +++ b/src/main/java/buildcraft/api/core/LaserKind.java @@ -0,0 +1,13 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.core; + +public enum LaserKind { + Red, Blue, Stripes +} diff --git a/src/main/java/buildcraft/api/core/Position.java b/src/main/java/buildcraft/api/core/Position.java new file mode 100644 index 00000000..3ea1a731 --- /dev/null +++ b/src/main/java/buildcraft/api/core/Position.java @@ -0,0 +1,141 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.core; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + +public class Position { + + public double x, y, z; + public ForgeDirection orientation; + + public Position(double ci, double cj, double ck) { + x = ci; + y = cj; + z = ck; + orientation = ForgeDirection.UNKNOWN; + } + + public Position(double ci, double cj, double ck, ForgeDirection corientation) { + x = ci; + y = cj; + z = ck; + orientation = corientation; + } + + public Position(Position p) { + x = p.x; + y = p.y; + z = p.z; + orientation = p.orientation; + } + + public Position(NBTTagCompound nbttagcompound) { + x = nbttagcompound.getDouble("i"); + y = nbttagcompound.getDouble("j"); + z = nbttagcompound.getDouble("k"); + + orientation = ForgeDirection.UNKNOWN; + } + + public Position(TileEntity tile) { + x = tile.xCoord; + y = tile.yCoord; + z = tile.zCoord; + } + + public void moveRight(double step) { + switch (orientation) { + case SOUTH: + x = x - step; + break; + case NORTH: + x = x + step; + break; + case EAST: + z = z + step; + break; + case WEST: + z = z - step; + break; + default: + } + } + + public void moveLeft(double step) { + moveRight(-step); + } + + public void moveForwards(double step) { + switch (orientation) { + case UP: + y = y + step; + break; + case DOWN: + y = y - step; + break; + case SOUTH: + z = z + step; + break; + case NORTH: + z = z - step; + break; + case EAST: + x = x + step; + break; + case WEST: + x = x - step; + break; + default: + } + } + + public void moveBackwards(double step) { + moveForwards(-step); + } + + public void moveUp(double step) { + switch (orientation) { + case SOUTH: + case NORTH: + case EAST: + case WEST: + y = y + step; + break; + default: + } + + } + + public void moveDown(double step) { + moveUp(-step); + } + + public void writeToNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setDouble("i", x); + nbttagcompound.setDouble("j", y); + nbttagcompound.setDouble("k", z); + } + + @Override + public String toString() { + return "{" + x + ", " + y + ", " + z + "}"; + } + + public Position min(Position p) { + return new Position(p.x > x ? x : p.x, p.y > y ? y : p.y, p.z > z ? z : p.z); + } + + public Position max(Position p) { + return new Position(p.x < x ? x : p.x, p.y < y ? y : p.y, p.z < z ? z : p.z); + } + +} diff --git a/src/main/java/buildcraft/api/core/SafeTimeTracker.java b/src/main/java/buildcraft/api/core/SafeTimeTracker.java index 44e1531e..46ca2809 100644 --- a/src/main/java/buildcraft/api/core/SafeTimeTracker.java +++ b/src/main/java/buildcraft/api/core/SafeTimeTracker.java @@ -1,8 +1,9 @@ /** - * Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License - * 1.0, or MMPL. Please check the contents of the license located in + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in * http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.core; @@ -13,10 +14,45 @@ public class SafeTimeTracker { private long lastMark = Long.MIN_VALUE; private long duration = -1; + private long randomRange = 0; + private long lastRandomDelay = 0; + private long internalDelay = 1; + + /** + * @deprecated should use constructors with parameters instead + */ + public SafeTimeTracker () { + + } + + public SafeTimeTracker (long delay) { + internalDelay = delay; + } + + /** + * In many situations, it is a bad idea to have all objects of the same + * kind to be waiting for the exact same amount of time, as that can lead + * to some situation where they're all synchronized and got to work all + * at the same time. When created with a random range, the mark that is set + * when reaching the expect delay will be added with a random number + * between [0, range[, meaning that the event will take between 0 and range + * more tick to run. + */ + public SafeTimeTracker (long delay, long random) { + internalDelay = delay; + randomRange = random; + } + + public boolean markTimeIfDelay(World world) { + return markTimeIfDelay(world, internalDelay); + } /** * Return true if a given delay has passed since last time marked was called * successfully. + * + * @deprecated should use the constructor with a delay instead, and call + * this function without a parameter */ public boolean markTimeIfDelay(World world, long delay) { if (world == null) @@ -27,13 +63,15 @@ public class SafeTimeTracker { if (currentTime < lastMark) { lastMark = currentTime; return false; - } else if (lastMark + delay <= currentTime) { + } else if (lastMark + delay + lastRandomDelay <= currentTime) { duration = currentTime - lastMark; lastMark = currentTime; - return true; - } else - return false; + lastRandomDelay = (int) (Math.random() * randomRange); + return true; + } else { + return false; + } } public long durationOfLastDelay() { diff --git a/src/main/java/buildcraft/api/core/StackWrapper.java b/src/main/java/buildcraft/api/core/StackWrapper.java new file mode 100644 index 00000000..a155c1cd --- /dev/null +++ b/src/main/java/buildcraft/api/core/StackWrapper.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.core; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class StackWrapper { + + public final ItemStack stack; + + public StackWrapper(ItemStack stack) { + this.stack = stack; + } + + @Override + public int hashCode() { + int hash = 5; + + hash = 67 * hash + stack.getItem().hashCode(); + + hash = 67 * hash + stack.getItemDamage(); + + if (stack.stackTagCompound != null) { + hash = 67 * hash + stack.stackTagCompound.hashCode(); + } + + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final StackWrapper other = (StackWrapper) obj; + if (stack.getItem() != other.stack.getItem()) + return false; + if (stack.getHasSubtypes() && stack.getItemDamage() != other.stack.getItemDamage()) + return false; + if (stack.stackTagCompound != null && !stack.stackTagCompound.equals(other.stack.stackTagCompound)) + return false; + return true; + } +} diff --git a/src/main/java/buildcraft/api/core/package-info.java b/src/main/java/buildcraft/api/core/package-info.java new file mode 100644 index 00000000..bb494d53 --- /dev/null +++ b/src/main/java/buildcraft/api/core/package-info.java @@ -0,0 +1,3 @@ +@API(apiVersion="1.0",owner="BuildCraft|Core",provides="BuildCraftAPI|core") +package buildcraft.api.core; +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/buildcraft/api/filler/FillerManager.java b/src/main/java/buildcraft/api/filler/FillerManager.java new file mode 100644 index 00000000..cd774d46 --- /dev/null +++ b/src/main/java/buildcraft/api/filler/FillerManager.java @@ -0,0 +1,15 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.filler; + +public class FillerManager { + + public static IFillerRegistry registry; + +} diff --git a/src/main/java/buildcraft/api/filler/IFillerPattern.java b/src/main/java/buildcraft/api/filler/IFillerPattern.java new file mode 100644 index 00000000..6c1c4182 --- /dev/null +++ b/src/main/java/buildcraft/api/filler/IFillerPattern.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.filler; + +import buildcraft.api.core.IBox; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; + +public interface IFillerPattern { + + public String getUniqueTag(); + + /** + * Creates the object that does the pattern iteration. This object may be + * state-full and will be used until the pattern is done or changes. + * + * @param tile the Filler + * @param box the area to fill + * @param orientation not currently used, but may be in the future (the filler needs some orientation code) + * @return + */ + public IPatternIterator createPatternIterator(TileEntity tile, IBox box, ForgeDirection orientation); + + @SideOnly(Side.CLIENT) + public IIcon getIcon(); + + public String getDisplayName(); +} diff --git a/src/main/java/buildcraft/api/filler/IFillerRegistry.java b/src/main/java/buildcraft/api/filler/IFillerRegistry.java new file mode 100644 index 00000000..ec9bf29f --- /dev/null +++ b/src/main/java/buildcraft/api/filler/IFillerRegistry.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.filler; + +import buildcraft.api.gates.IAction; +import java.util.Set; + +public interface IFillerRegistry { + + public void addPattern(IFillerPattern pattern); + + public IFillerPattern getPattern(String patternName); + + public IFillerPattern getNextPattern(IFillerPattern currentPattern); + + public IFillerPattern getPreviousPattern(IFillerPattern currentPattern); + + public Set getActions(); +} diff --git a/src/main/java/buildcraft/api/filler/IPatternIterator.java b/src/main/java/buildcraft/api/filler/IPatternIterator.java new file mode 100644 index 00000000..efce4c43 --- /dev/null +++ b/src/main/java/buildcraft/api/filler/IPatternIterator.java @@ -0,0 +1,16 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.filler; + +import net.minecraft.item.ItemStack; + +public interface IPatternIterator { + + public boolean iteratePattern(ItemStack stackToPlace); +} diff --git a/src/main/java/buildcraft/api/filler/package-info.java b/src/main/java/buildcraft/api/filler/package-info.java new file mode 100644 index 00000000..ee52b320 --- /dev/null +++ b/src/main/java/buildcraft/api/filler/package-info.java @@ -0,0 +1,3 @@ +@API(apiVersion="2.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|filler") +package buildcraft.api.filler; +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/buildcraft/api/fuels/IronEngineCoolant.java b/src/main/java/buildcraft/api/fuels/IronEngineCoolant.java new file mode 100644 index 00000000..3e1de954 --- /dev/null +++ b/src/main/java/buildcraft/api/fuels/IronEngineCoolant.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.fuels; + +import buildcraft.api.core.StackWrapper; + +import java.util.HashMap; +import java.util.Map; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + +public final class IronEngineCoolant { + + public static Map liquidCoolants = new HashMap(); + public static Map solidCoolants = new HashMap(); + + public static FluidStack getFluidCoolant(ItemStack stack) { + return solidCoolants.get(new StackWrapper(stack)); + } + + public static Coolant getCoolant(ItemStack stack) { + return getCoolant(getFluidCoolant(stack)); + } + + public static Coolant getCoolant(FluidStack fluidStack) { + return fluidStack != null && fluidStack.getFluid() != null ? liquidCoolants.get(fluidStack.getFluid().getName()) : null; + } + + private IronEngineCoolant() { + } + + public static interface Coolant { + + float getDegreesCoolingPerMB(float currentHeat); + } + + public static void addCoolant(final Fluid fluid, final float degreesCoolingPerMB) { + if (fluid != null) { + liquidCoolants.put(fluid.getName(), new Coolant() { + @Override + public float getDegreesCoolingPerMB(float currentHeat) { + return degreesCoolingPerMB; + } + }); + } + } + + /** + * Adds a solid coolant like Ice Blocks. The FluidStack must contain a registered + * Coolant Fluid or nothing will happen. You do not need to call this for + * Fluid Containers. + * + * @param stack + * @param coolant + */ + public static void addCoolant(final ItemStack stack, final FluidStack coolant) { + if (stack != null && stack.getItem() != null && coolant != null) { + solidCoolants.put(new StackWrapper(stack), coolant); + } + } + + /** + * Adds a solid coolant like Ice Blocks. The FluidStack must contain a registered + * Coolant Fluid or nothing will happen. You do not need to call this for + * Fluid Containers. + * + * @param stack + * @param coolant + */ + public static void addCoolant(final Item item, final int metadata, final FluidStack coolant) { + addCoolant(new ItemStack(item, 1, metadata), coolant); + } + + public static void addCoolant(final Block block, final int metadata, final FluidStack coolant) { + addCoolant(new ItemStack(block, 1, metadata), coolant); + } + + public static boolean isCoolant(Fluid fluid) { + return liquidCoolants.containsKey(fluid.getName()); + } +} diff --git a/src/main/java/buildcraft/api/fuels/IronEngineFuel.java b/src/main/java/buildcraft/api/fuels/IronEngineFuel.java new file mode 100644 index 00000000..20b14eb5 --- /dev/null +++ b/src/main/java/buildcraft/api/fuels/IronEngineFuel.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.fuels; + +import java.util.HashMap; +import java.util.Map; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; + +public class IronEngineFuel { + + public static Map fuels = new HashMap(); + + public static Fuel getFuelForFluid(Fluid liquid) { + return liquid == null ? null : fuels.get(liquid.getName()); + } + + private IronEngineFuel() { + } + + public static class Fuel { + + public final Fluid liquid; + public final float powerPerCycle; + public final int totalBurningTime; + + private Fuel(String fluidName, float powerPerCycle, int totalBurningTime) { + this(FluidRegistry.getFluid(fluidName), powerPerCycle, totalBurningTime); + } + + private Fuel(Fluid liquid, float powerPerCycle, int totalBurningTime) { + this.liquid = liquid; + this.powerPerCycle = powerPerCycle; + this.totalBurningTime = totalBurningTime; + } + } + + public static void addFuel(Fluid fluid, float powerPerCycle, int totalBurningTime) { + fuels.put(fluid.getName(), new Fuel(fluid, powerPerCycle, totalBurningTime)); + } + + public static void addFuel(String fluidName, float powerPerCycle, int totalBurningTime) { + fuels.put(fluidName, new Fuel(fluidName, powerPerCycle, totalBurningTime)); + } +} diff --git a/src/main/java/buildcraft/api/fuels/package-info.java b/src/main/java/buildcraft/api/fuels/package-info.java new file mode 100644 index 00000000..48ad9319 --- /dev/null +++ b/src/main/java/buildcraft/api/fuels/package-info.java @@ -0,0 +1,3 @@ +@API(apiVersion="1.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|fuels") +package buildcraft.api.fuels; +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/buildcraft/api/gates/ActionManager.java b/src/main/java/buildcraft/api/gates/ActionManager.java new file mode 100644 index 00000000..44e4b741 --- /dev/null +++ b/src/main/java/buildcraft/api/gates/ActionManager.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.gates; + +import buildcraft.api.transport.IPipeTile; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import net.minecraft.block.Block; +import net.minecraft.tileentity.TileEntity; + +public class ActionManager { + + public static Map triggers = new HashMap(); + public static Map actions = new HashMap(); + private static List triggerProviders = new LinkedList(); + private static List actionProviders = new LinkedList(); + + public static void registerTriggerProvider(ITriggerProvider provider) { + if (provider != null && !triggerProviders.contains(provider)) { + triggerProviders.add(provider); + } + } + + public static void registerTrigger(ITrigger trigger) { + triggers.put(trigger.getUniqueTag(), trigger); + } + + public static void registerAction(IAction action) { + actions.put(action.getUniqueTag(), action); + } + + public static List getNeighborTriggers(Block block, TileEntity entity) { + List triggers = new LinkedList(); + + for (ITriggerProvider provider : triggerProviders) { + List toAdd = provider.getNeighborTriggers(block, entity); + + if (toAdd != null) { + for (ITrigger t : toAdd) { + if (!triggers.contains(t)) { + triggers.add(t); + } + } + } + } + + return triggers; + } + + public static void registerActionProvider(IActionProvider provider) { + if (provider != null && !actionProviders.contains(provider)) { + actionProviders.add(provider); + } + } + + public static List getNeighborActions(Block block, TileEntity entity) { + List actions = new LinkedList(); + + for (IActionProvider provider : actionProviders) { + List toAdd = provider.getNeighborActions(block, entity); + + if (toAdd != null) { + for (IAction t : toAdd) { + if (!actions.contains(t)) { + actions.add(t); + } + } + } + } + + return actions; + } + + public static List getPipeTriggers(IPipeTile pipe) { + List triggers = new LinkedList(); + + for (ITriggerProvider provider : triggerProviders) { + List toAdd = provider.getPipeTriggers(pipe); + + if (toAdd != null) { + for (ITrigger t : toAdd) { + if (!triggers.contains(t)) { + triggers.add(t); + } + } + } + } + + return triggers; + } +} diff --git a/src/main/java/buildcraft/api/gates/GateExpansionController.java b/src/main/java/buildcraft/api/gates/GateExpansionController.java new file mode 100644 index 00000000..20f38713 --- /dev/null +++ b/src/main/java/buildcraft/api/gates/GateExpansionController.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.gates; + +import java.util.List; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +public abstract class GateExpansionController { + + public final IGateExpansion type; + public final TileEntity pipeTile; + + public GateExpansionController(IGateExpansion type, TileEntity pipeTile) { + this.pipeTile = pipeTile; + this.type = type; + } + + public IGateExpansion getType() { + return type; + } + + public boolean isActive() { + return false; + } + + public void tick() { + } + + public void startResolution() { + } + + public boolean resolveAction(IAction action, int count) { + return false; + } + + public boolean isTriggerActive(ITrigger trigger, ITriggerParameter parameter) { + return false; + } + + public void addTriggers(List list) { + } + + public void addActions(List list) { + } + + public void writeToNBT(NBTTagCompound nbt) { + } + + public void readFromNBT(NBTTagCompound nbt) { + } +} diff --git a/src/main/java/buildcraft/api/gates/GateExpansions.java b/src/main/java/buildcraft/api/gates/GateExpansions.java new file mode 100644 index 00000000..b8732442 --- /dev/null +++ b/src/main/java/buildcraft/api/gates/GateExpansions.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.gates; + +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +public final class GateExpansions { + + private static final Map expansions = new HashMap(); + private static final BiMap serverIDMap = HashBiMap.create(); + private static final BiMap clientIDMap = HashBiMap.create(); + private static byte nextID = 0; + + private GateExpansions() { + } + + public static void registerExpansion(IGateExpansion expansion) { + registerExpansion(expansion.getUniqueIdentifier(), expansion); + } + + public static void registerExpansion(String identifier, IGateExpansion expansion) { + expansions.put(identifier, expansion); + serverIDMap.put(nextID++, identifier); + } + + public static IGateExpansion getExpansion(String identifier) { + return expansions.get(identifier); + } + + public static IGateExpansion getExpansionClient(int id) { + if (id < 0 || id >= 128) + return null; + return expansions.get(clientIDMap.get((byte) id)); + } + + public static byte getServerExpansionID(String identifier) { + return serverIDMap.inverse().get(identifier); + } + + public static Set getExpansions() { + Set set = new HashSet(); + set.addAll(expansions.values()); + return set; + } + + public static BiMap getServerMap() { + return serverIDMap; + } + + public static void setClientMap(BiMap map) { + clientIDMap.clear(); + clientIDMap.putAll(map); + } +} diff --git a/src/main/java/buildcraft/api/gates/IAction.java b/src/main/java/buildcraft/api/gates/IAction.java new file mode 100644 index 00000000..38f134eb --- /dev/null +++ b/src/main/java/buildcraft/api/gates/IAction.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.gates; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.util.IIcon; + +public interface IAction { + + String getUniqueTag(); + + @SideOnly(Side.CLIENT) + IIcon getIcon(); + + @SideOnly(Side.CLIENT) + void registerIcons(IIconRegister iconRegister); + + boolean hasParameter(); + + String getDescription(); +} diff --git a/src/main/java/buildcraft/api/gates/IActionProvider.java b/src/main/java/buildcraft/api/gates/IActionProvider.java new file mode 100644 index 00000000..6712ca6f --- /dev/null +++ b/src/main/java/buildcraft/api/gates/IActionProvider.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.gates; + +import java.util.LinkedList; +import net.minecraft.block.Block; +import net.minecraft.tileentity.TileEntity; + +public interface IActionProvider { + + /** + * Returns the list of actions available to a gate next to the given block. + */ + public abstract LinkedList getNeighborActions(Block block, TileEntity tile); + +} diff --git a/src/main/java/buildcraft/api/gates/IActionReceptor.java b/src/main/java/buildcraft/api/gates/IActionReceptor.java new file mode 100644 index 00000000..86916298 --- /dev/null +++ b/src/main/java/buildcraft/api/gates/IActionReceptor.java @@ -0,0 +1,15 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.gates; + +public interface IActionReceptor { + + public void actionActivated(IAction action); + +} diff --git a/src/main/java/buildcraft/api/gates/IGateExpansion.java b/src/main/java/buildcraft/api/gates/IGateExpansion.java new file mode 100644 index 00000000..361f0a4d --- /dev/null +++ b/src/main/java/buildcraft/api/gates/IGateExpansion.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.gates; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; + +public interface IGateExpansion { + + String getUniqueIdentifier(); + + String getDisplayName(); + + GateExpansionController makeController(TileEntity pipeTile); + + void registerBlockOverlay(IIconRegister iconRegister); + + void registerItemOverlay(IIconRegister iconRegister); + + IIcon getOverlayBlock(); + + IIcon getOverlayItem(); +} diff --git a/src/main/java/buildcraft/api/gates/IOverrideDefaultTriggers.java b/src/main/java/buildcraft/api/gates/IOverrideDefaultTriggers.java new file mode 100644 index 00000000..a105f52d --- /dev/null +++ b/src/main/java/buildcraft/api/gates/IOverrideDefaultTriggers.java @@ -0,0 +1,20 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.gates; + +import java.util.LinkedList; + +/** + * This interface has to be implemented by a TileEntity or a Pipe that wants to provide triggers different from the ones installed by default with BuildCraft. + */ +public interface IOverrideDefaultTriggers { + + LinkedList getTriggers(); + +} diff --git a/src/main/java/buildcraft/api/gates/ITileTrigger.java b/src/main/java/buildcraft/api/gates/ITileTrigger.java new file mode 100644 index 00000000..93c84e01 --- /dev/null +++ b/src/main/java/buildcraft/api/gates/ITileTrigger.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.gates; + +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + +public interface ITileTrigger extends ITrigger { + + /** + * Return true if the tile given in parameter activates the trigger, given + * the parameters. + */ + boolean isTriggerActive(ForgeDirection side, TileEntity tile, ITriggerParameter parameter); +} diff --git a/src/main/java/buildcraft/api/gates/ITrigger.java b/src/main/java/buildcraft/api/gates/ITrigger.java new file mode 100644 index 00000000..affc418b --- /dev/null +++ b/src/main/java/buildcraft/api/gates/ITrigger.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.gates; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.util.IIcon; + +public interface ITrigger { + + /** + * Every trigger needs a unique tag, it should be in the format of + * ":". + * + * @return the unique id + */ + String getUniqueTag(); + + @SideOnly(Side.CLIENT) + IIcon getIcon(); + + @SideOnly(Side.CLIENT) + void registerIcons(IIconRegister iconRegister); + + /** + * Return true if this trigger can accept parameters + */ + boolean hasParameter(); + + /** + * Return true if this trigger requires a parameter + */ + boolean requiresParameter(); + + /** + * Return the trigger description in the UI + */ + String getDescription(); + + /** + * Create parameters for the trigger. As for now, there is only one kind of + * trigger parameter available so this subprogram is final. + */ + ITriggerParameter createParameter(); +} diff --git a/src/main/java/buildcraft/api/gates/ITriggerParameter.java b/src/main/java/buildcraft/api/gates/ITriggerParameter.java new file mode 100644 index 00000000..8570cf0f --- /dev/null +++ b/src/main/java/buildcraft/api/gates/ITriggerParameter.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.gates; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public interface ITriggerParameter { + + public abstract ItemStack getItemStack(); + + public abstract void set(ItemStack stack); + + public abstract void writeToNBT(NBTTagCompound compound); + + public abstract void readFromNBT(NBTTagCompound compound); + + @Deprecated + public abstract ItemStack getItem(); + +} diff --git a/src/main/java/buildcraft/api/gates/ITriggerProvider.java b/src/main/java/buildcraft/api/gates/ITriggerProvider.java new file mode 100644 index 00000000..1966e73b --- /dev/null +++ b/src/main/java/buildcraft/api/gates/ITriggerProvider.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.gates; + +import buildcraft.api.transport.IPipeTile; +import java.util.LinkedList; +import net.minecraft.block.Block; +import net.minecraft.tileentity.TileEntity; + +public interface ITriggerProvider { + + /** + * Returns the list of triggers that are available from the pipe holding the gate. + */ + public abstract LinkedList getPipeTriggers(IPipeTile pipe); + + /** + * Returns the list of triggers available to a gate next to the given block. + */ + public abstract LinkedList getNeighborTriggers(Block block, TileEntity tile); + +} diff --git a/src/main/java/buildcraft/api/gates/TriggerParameter.java b/src/main/java/buildcraft/api/gates/TriggerParameter.java new file mode 100644 index 00000000..46336c15 --- /dev/null +++ b/src/main/java/buildcraft/api/gates/TriggerParameter.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.gates; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class TriggerParameter implements ITriggerParameter { + + protected ItemStack stack; + + /* + * (non-Javadoc) + * + * @see net.minecraft.src.buildcraft.api.gates.ITriggerParameter#getItemStack() + */ + @Override + public ItemStack getItemStack() { + return stack; + } + + /* + * (non-Javadoc) + * + * @see net.minecraft.src.buildcraft.api.gates.ITriggerParameter#set(net.minecraft.src.ItemStack) + */ + @Override + public void set(ItemStack stack) { + if (stack != null) { + this.stack = stack.copy(); + this.stack.stackSize = 1; + } + } + + /* + * (non-Javadoc) + * + * @see net.minecraft.src.buildcraft.api.gates.ITriggerParameter#writeToNBT(net.minecraft.src.NBTTagCompound) + */ + @Override + public void writeToNBT(NBTTagCompound compound) { + if (stack != null) { + NBTTagCompound tagCompound = new NBTTagCompound(); + stack.writeToNBT(tagCompound); + compound.setTag("stack", tagCompound); + } + } + + /* + * (non-Javadoc) + * + * @see net.minecraft.src.buildcraft.api.gates.ITriggerParameter#readFromNBT(net.minecraft.src.NBTTagCompound) + */ + @Override + public void readFromNBT(NBTTagCompound compound) { + // Legacy code to prevent existing gates from losing their contents + int itemID = compound.getInteger("itemID"); + if (itemID != 0) { + stack = new ItemStack((Item) Item.itemRegistry.getObject(itemID), 1, compound.getInteger("itemDMG")); + return; + } + + stack = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("stack")); + } + + @Override + @Deprecated + public ItemStack getItem() { + return stack; + } + +} diff --git a/src/main/java/buildcraft/api/gates/package-info.java b/src/main/java/buildcraft/api/gates/package-info.java new file mode 100644 index 00000000..01c1a66a --- /dev/null +++ b/src/main/java/buildcraft/api/gates/package-info.java @@ -0,0 +1,3 @@ +@API(apiVersion="2.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|gates") +package buildcraft.api.gates; +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/buildcraft/api/inventory/ISpecialInventory.java b/src/main/java/buildcraft/api/inventory/ISpecialInventory.java new file mode 100644 index 00000000..827a7a7d --- /dev/null +++ b/src/main/java/buildcraft/api/inventory/ISpecialInventory.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.inventory; + +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; + +@Deprecated +public interface ISpecialInventory extends IInventory { + + /** + * Offers an ItemStack for addition to the inventory. + * + * @param stack + * ItemStack offered for addition. Do not manipulate this! + * @param doAdd + * If false no actual addition should take place. Implementors should simulate. + * @param from + * Orientation the ItemStack is offered from. + * @return Amount of items used from the passed stack. + */ + int addItem(ItemStack stack, boolean doAdd, ForgeDirection from); + + /** + * Requests items to be extracted from the inventory + * + * @param doRemove + * If false no actual extraction may occur. Implementors should simulate. + * Can be used to "peek" at what the result would be + * @param from + * Orientation the ItemStack is requested from. + * @param maxItemCount + * Maximum amount of items to extract (spread over all returned item stacks) + * @return Array of item stacks that were/would be extracted from the inventory + */ + ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount); + +} diff --git a/src/main/java/buildcraft/api/inventory/package-info.java b/src/main/java/buildcraft/api/inventory/package-info.java new file mode 100644 index 00000000..5335e411 --- /dev/null +++ b/src/main/java/buildcraft/api/inventory/package-info.java @@ -0,0 +1,3 @@ +@API(apiVersion="1.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|inventory") +package buildcraft.api.inventory; +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/buildcraft/api/package-info.java b/src/main/java/buildcraft/api/package-info.java new file mode 100644 index 00000000..c1be5f46 --- /dev/null +++ b/src/main/java/buildcraft/api/package-info.java @@ -0,0 +1,3 @@ +@API(apiVersion="1.0",owner="BuildCraft|Core",provides="BuildCraftAPI|core") +package buildcraft.api; +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/buildcraft/api/power/ILaserTarget.java b/src/main/java/buildcraft/api/power/ILaserTarget.java new file mode 100644 index 00000000..8f859158 --- /dev/null +++ b/src/main/java/buildcraft/api/power/ILaserTarget.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.power; + +public interface ILaserTarget { + + /** + * Returns true if the target currently needs power. For example, if the Advanced + * Crafting Table has work to do. + * + * @return true if needs power + */ + boolean requiresLaserEnergy(); + + /** + * Transfers energy from the laser to the target. + * + * @param energy + */ + void receiveLaserEnergy(double energy); + + /** + * Return true if the Tile Entity object is no longer a valid target. For + * example, if its been invalidated. + * + * @return true if no longer a valid target object + */ + boolean isInvalidTarget(); + + int getXCoord(); + + int getYCoord(); + + int getZCoord(); +} diff --git a/src/main/java/buildcraft/api/power/IPowerEmitter.java b/src/main/java/buildcraft/api/power/IPowerEmitter.java new file mode 100644 index 00000000..4bb48497 --- /dev/null +++ b/src/main/java/buildcraft/api/power/IPowerEmitter.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.power; + +import net.minecraftforge.common.util.ForgeDirection; + +/** + * Essentially only used for Wooden Power Pipe connection rules. + * + * This Tile Entity interface allows you to indicate that a block can emit power + * from a specific side. + */ +public interface IPowerEmitter { + + public boolean canEmitPowerFrom(ForgeDirection side); +} diff --git a/src/main/java/buildcraft/api/power/IPowerReceptor.java b/src/main/java/buildcraft/api/power/IPowerReceptor.java index 7af53607..79586e9e 100644 --- a/src/main/java/buildcraft/api/power/IPowerReceptor.java +++ b/src/main/java/buildcraft/api/power/IPowerReceptor.java @@ -1,21 +1,19 @@ /** - * Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License - * 1.0, or MMPL. Please check the contents of the license located in + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in * http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.power; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; -import buildcraft.api.power.PowerHandler.PowerReceiver; +import net.minecraftforge.common.util.ForgeDirection; /** * This interface should be implemented by any Tile Entity that wishes to be * able to receive power. - * - * @author CovertJaguar */ public interface IPowerReceptor { @@ -31,7 +29,7 @@ public interface IPowerReceptor { * @param side * @return */ - public PowerReceiver getPowerReceiver(ForgeDirection side); + public PowerHandler.PowerReceiver getPowerReceiver(ForgeDirection side); /** * Call back from the PowerHandler that is called when the stored power diff --git a/src/main/java/buildcraft/api/power/PowerHandler.java b/src/main/java/buildcraft/api/power/PowerHandler.java index 7073bee9..8a3aa5fc 100644 --- a/src/main/java/buildcraft/api/power/PowerHandler.java +++ b/src/main/java/buildcraft/api/power/PowerHandler.java @@ -1,16 +1,33 @@ /** - * Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License - * 1.0, or MMPL. Please check the contents of the license located in + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in * http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.power; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.ForgeDirection; import buildcraft.api.core.SafeTimeTracker; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; +/** + * The PowerHandler is similar to FluidTank in that it holds your power and + * allows standardized interaction between machines. + * + * To receive power to your machine you needs create an instance of PowerHandler + * and implement IPowerReceptor on the TileEntity. + * + * If you plan emit power, you need only implement IPowerEmitter. You do not + * need a PowerHandler. Engines have a PowerHandler because they can also + * receive power from other Engines. + * + * See TileRefinery for a simple example of a power using machine. + * + * @see IPowerReceptor + * @see IPowerEmitter + */ public final class PowerHandler { public static enum Type { @@ -23,7 +40,7 @@ public final class PowerHandler { case STORAGE: return true; default: - return false; + return false; } } @@ -33,22 +50,32 @@ public final class PowerHandler { case STORAGE: return true; default: - return false; + return false; } } } + /** + * Extend this class to create custom Perdition algorithms (its not final). + * + * NOTE: It is not possible to create a Zero perdition algorithm. + */ public static class PerditionCalculator { public static final float DEFAULT_POWERLOSS = 1F; public static final float MIN_POWERLOSS = 0.01F; - private final float powerLoss; + private final double powerLoss; public PerditionCalculator() { powerLoss = DEFAULT_POWERLOSS; } - public PerditionCalculator(float powerLoss) { + /** + * Simple constructor for simple Perdition per tick. + * + * @param powerLoss power loss per tick + */ + public PerditionCalculator(double powerLoss) { if (powerLoss < MIN_POWERLOSS) { powerLoss = MIN_POWERLOSS; } @@ -65,20 +92,34 @@ public final class PowerHandler { * @param ticksPassed ticks since the last time this function was called * @return */ - public float applyPerdition(PowerHandler powerHandler, float current, long ticksPassed) { + public double applyPerdition(PowerHandler powerHandler, double current, long ticksPassed) { current -= powerLoss * ticksPassed; if (current < 0) { current = 0; } return current; } + + /** + * Taxes a flat rate on all incoming power. + * + * Defaults to 0% tax rate. + * + * @return percent of input to tax + */ + public double getTaxPercent() { + return 0; + } } public static final PerditionCalculator DEFAULT_PERDITION = new PerditionCalculator(); - private float minEnergyReceived; - private float maxEnergyReceived; - private float maxEnergyStored; - private float activationEnergy; - private float energyStored = 0; + public static final double ROLLING_AVERAGE_WEIGHT = 100.0; + public static final double ROLLING_AVERAGE_NUMERATOR = ROLLING_AVERAGE_WEIGHT - 1; + public static final double ROLLING_AVERAGE_DENOMINATOR = 1.0 / ROLLING_AVERAGE_WEIGHT; + private double minEnergyReceived; + private double maxEnergyReceived; + private double maxEnergyStored; + private double activationEnergy; + private double energyStored = 0; private final SafeTimeTracker doWorkTracker = new SafeTimeTracker(); private final SafeTimeTracker sourcesTracker = new SafeTimeTracker(); private final SafeTimeTracker perditionTracker = new SafeTimeTracker(); @@ -87,35 +128,39 @@ public final class PowerHandler { private PerditionCalculator perdition; private final PowerReceiver receiver; private final Type type; + // Tracking + private double averageLostPower = 0; + private double averageReceivedPower = 0; + private double averageUsedPower = 0; public PowerHandler(IPowerReceptor receptor, Type type) { this.receptor = receptor; this.type = type; - receiver = new PowerReceiver(); - perdition = DEFAULT_PERDITION; + this.receiver = new PowerReceiver(); + this.perdition = DEFAULT_PERDITION; } public PowerReceiver getPowerReceiver() { return receiver; } - public float getMinEnergyReceived() { + public double getMinEnergyReceived() { return minEnergyReceived; } - public float getMaxEnergyReceived() { + public double getMaxEnergyReceived() { return maxEnergyReceived; } - public float getMaxEnergyStored() { + public double getMaxEnergyStored() { return maxEnergyStored; } - public float getActivationEnergy() { + public double getActivationEnergy() { return activationEnergy; } - public float getEnergyStored() { + public double getEnergyStored() { return energyStored; } @@ -137,16 +182,26 @@ public final class PowerHandler { * store. Values tend to range between 100 and 5000. With 1000 and 1500 * being common. */ - public void configure(float minEnergyReceived, float maxEnergyReceived, float activationEnergy, float maxStoredEnergy) { + public void configure(double minEnergyReceived, double maxEnergyReceived, double activationEnergy, double maxStoredEnergy) { if (minEnergyReceived > maxEnergyReceived) { maxEnergyReceived = minEnergyReceived; } this.minEnergyReceived = minEnergyReceived; this.maxEnergyReceived = maxEnergyReceived; - maxEnergyStored = maxStoredEnergy; + this.maxEnergyStored = maxStoredEnergy; this.activationEnergy = activationEnergy; } + /** + * Allows you define perdition in terms of loss/ticks. + * + * This function is mostly for legacy implementations. See + * PerditionCalculator for more complex perdition formulas. + * + * @param powerLoss + * @param powerLossRegularity + * @see buildcraft.api.power.PowerHandler.PerditionCalculator + */ public void configurePowerPerdition(int powerLoss, int powerLossRegularity) { if (powerLoss == 0 || powerLossRegularity == 0) { perdition = new PerditionCalculator(0); @@ -193,12 +248,15 @@ public final class PowerHandler { private void applyPerdition() { if (perditionTracker.markTimeIfDelay(receptor.getWorld(), 1) && energyStored > 0) { - float newEnergy = getPerdition().applyPerdition(this, energyStored, perditionTracker.durationOfLastDelay()); + double prev = energyStored; + double newEnergy = getPerdition().applyPerdition(this, energyStored, perditionTracker.durationOfLastDelay()); if (newEnergy == 0 || newEnergy < energyStored) energyStored = newEnergy; else energyStored = DEFAULT_PERDITION.applyPerdition(this, energyStored, perditionTracker.durationOfLastDelay()); validateEnergy(); + + averageLostPower = (averageLostPower * ROLLING_AVERAGE_NUMERATOR + (prev - energyStored)) * ROLLING_AVERAGE_DENOMINATOR; } } @@ -233,10 +291,10 @@ public final class PowerHandler { * @param doUse * @return amount used */ - public float useEnergy(float min, float max, boolean doUse) { + public double useEnergy(double min, double max, boolean doUse) { applyPerdition(); - float result = 0; + double result = 0; if (energyStored >= min) { if (energyStored <= max) { @@ -254,6 +312,9 @@ public final class PowerHandler { validateEnergy(); + if (doUse) + averageUsedPower = (averageUsedPower * ROLLING_AVERAGE_NUMERATOR + result) * ROLLING_AVERAGE_DENOMINATOR; + return result; } @@ -263,7 +324,7 @@ public final class PowerHandler { public void readFromNBT(NBTTagCompound data, String tag) { NBTTagCompound nbt = data.getCompoundTag(tag); - energyStored = nbt.getFloat("storedEnergy"); + energyStored = nbt.getDouble("energyStored"); } public void writeToNBT(NBTTagCompound data) { @@ -272,8 +333,8 @@ public final class PowerHandler { public void writeToNBT(NBTTagCompound data, String tag) { NBTTagCompound nbt = new NBTTagCompound(); - nbt.setFloat("storedEnergy", energyStored); - data.setCompoundTag(tag, nbt); + nbt.setDouble("energyStored", energyStored); + data.setTag(tag, nbt); } public final class PowerReceiver { @@ -281,26 +342,38 @@ public final class PowerHandler { private PowerReceiver() { } - public float getMinEnergyReceived() { + public double getMinEnergyReceived() { return minEnergyReceived; } - public float getMaxEnergyReceived() { + public double getMaxEnergyReceived() { return maxEnergyReceived; } - public float getMaxEnergyStored() { + public double getMaxEnergyStored() { return maxEnergyStored; } - public float getActivationEnergy() { + public double getActivationEnergy() { return activationEnergy; } - public float getEnergyStored() { + public double getEnergyStored() { return energyStored; } + public double getAveragePowerReceived() { + return averageReceivedPower; + } + + public double getAveragePowerUsed() { + return averageUsedPower; + } + + public double getAveragePowerLost() { + return averageLostPower; + } + public Type getType() { return type; } @@ -314,7 +387,7 @@ public final class PowerHandler { * * @return */ - public float powerRequest() { + public double powerRequest() { update(); return Math.min(maxEnergyReceived, maxEnergyStored - energyStored); } @@ -322,12 +395,14 @@ public final class PowerHandler { /** * Add power to the PowerReceiver from an external source. * + * IPowerEmitters are responsible for calling this themselves. + * * @param quantity * @param from * @return the amount of power used */ - public float receiveEnergy(Type source, final float quantity, ForgeDirection from) { - float used = quantity; + public double receiveEnergy(Type source, final double quantity, ForgeDirection from) { + double used = quantity; if (source == Type.ENGINE) { if (used < minEnergyReceived) { return 0; @@ -338,14 +413,18 @@ public final class PowerHandler { updateSources(from); + used -= used * getPerdition().getTaxPercent(); + used = addEnergy(used); applyWork(); if (source == Type.ENGINE && type.eatsEngineExcess()) { - return Math.min(quantity, maxEnergyReceived); + used = Math.min(quantity, maxEnergyReceived); } + averageReceivedPower = (averageReceivedPower * ROLLING_AVERAGE_NUMERATOR + used) * ROLLING_AVERAGE_DENOMINATOR; + return used; } } @@ -354,7 +433,7 @@ public final class PowerHandler { * * @return the amount the power changed by */ - public float addEnergy(float quantity) { + public double addEnergy(double quantity) { energyStored += quantity; if (energyStored > maxEnergyStored) { @@ -370,8 +449,8 @@ public final class PowerHandler { return quantity; } - public void setEnergy(float quantity) { - energyStored = quantity; + public void setEnergy(double quantity) { + this.energyStored = quantity; validateEnergy(); } diff --git a/src/main/java/buildcraft/api/power/package-info.java b/src/main/java/buildcraft/api/power/package-info.java new file mode 100644 index 00000000..4a98dbbe --- /dev/null +++ b/src/main/java/buildcraft/api/power/package-info.java @@ -0,0 +1,3 @@ +@API(apiVersion="1.1",owner="BuildCraftAPI|core",provides="BuildCraftAPI|power") +package buildcraft.api.power; +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/buildcraft/api/recipes/BuildcraftRecipes.java b/src/main/java/buildcraft/api/recipes/BuildcraftRecipes.java new file mode 100644 index 00000000..0454944d --- /dev/null +++ b/src/main/java/buildcraft/api/recipes/BuildcraftRecipes.java @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.recipes; + +public final class BuildcraftRecipes { + + public static IAssemblyRecipeManager assemblyTable; + public static IIntegrationRecipeManager integrationTable; + public static IRefineryRecipeManager refinery; + + private BuildcraftRecipes() { + } +} diff --git a/src/main/java/buildcraft/api/recipes/IAssemblyRecipeManager.java b/src/main/java/buildcraft/api/recipes/IAssemblyRecipeManager.java new file mode 100644 index 00000000..30530919 --- /dev/null +++ b/src/main/java/buildcraft/api/recipes/IAssemblyRecipeManager.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.recipes; + +import java.util.List; +import net.minecraft.item.ItemStack; + +public interface IAssemblyRecipeManager { + + public static interface IAssemblyRecipe { + + ItemStack getOutput(); + + Object[] getInputs(); + + double getEnergyCost(); + } + + /** + * Add an Assembly Table recipe. + * + * @param input Object... containing either an ItemStack, or a paired string + * and integer(ex: "dyeBlue", 1) + * @param energy MJ cost to produce + * @param output resulting ItemStack + */ + void addRecipe(double energyCost, ItemStack output, Object... input); + + List getRecipes(); +} diff --git a/src/main/java/buildcraft/api/recipes/IIntegrationRecipeManager.java b/src/main/java/buildcraft/api/recipes/IIntegrationRecipeManager.java new file mode 100644 index 00000000..8b03055f --- /dev/null +++ b/src/main/java/buildcraft/api/recipes/IIntegrationRecipeManager.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.recipes; + +import java.util.List; +import net.minecraft.item.ItemStack; + +/** + * The Integration Table's primary purpose is to modify an input item's NBT + * data. As such its not a "traditional" type of recipe. Rather than predefined + * inputs and outputs, it takes an input and transforms it. + */ +public interface IIntegrationRecipeManager { + + public static interface IIntegrationRecipe { + + double getEnergyCost(); + + boolean isValidInputA(ItemStack inputA); + + boolean isValidInputB(ItemStack inputB); + + ItemStack getOutputForInputs(ItemStack inputA, ItemStack inputB); + + ItemStack[] getExampleInputsA(); + + ItemStack[] getExampleInputsB(); + } + + /** + * Add an Integration Table recipe. + * + */ + void addRecipe(IIntegrationRecipe recipe); + + List getRecipes(); +} diff --git a/src/main/java/buildcraft/api/recipes/IRefineryRecipeManager.java b/src/main/java/buildcraft/api/recipes/IRefineryRecipeManager.java new file mode 100644 index 00000000..5e353a11 --- /dev/null +++ b/src/main/java/buildcraft/api/recipes/IRefineryRecipeManager.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.recipes; + +import java.util.SortedSet; +import net.minecraftforge.fluids.FluidStack; + +public interface IRefineryRecipeManager { + + void addRecipe(FluidStack ingredient, FluidStack result, int energy, int delay); + + void addRecipe(FluidStack ingredient1, FluidStack ingredient2, FluidStack result, int energy, int delay); + + SortedSet getRecipes(); + + IRefineryRecipe findRefineryRecipe(FluidStack ingredient1, FluidStack ingredient2); + + public static interface IRefineryRecipe { + + FluidStack getIngredient1(); + + FluidStack getIngredient2(); + + FluidStack getResult(); + + int getEnergyCost(); + + int getTimeRequired(); + } +} diff --git a/src/main/java/buildcraft/api/recipes/package-info.java b/src/main/java/buildcraft/api/recipes/package-info.java new file mode 100644 index 00000000..3e41173c --- /dev/null +++ b/src/main/java/buildcraft/api/recipes/package-info.java @@ -0,0 +1,3 @@ +@API(apiVersion="2.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|recipes") +package buildcraft.api.recipes; +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/buildcraft/api/tools/IToolPipette.java b/src/main/java/buildcraft/api/tools/IToolPipette.java new file mode 100644 index 00000000..bca9d267 --- /dev/null +++ b/src/main/java/buildcraft/api/tools/IToolPipette.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.tools; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +public interface IToolPipette { + + /** + * @param pipette + * ItemStack of the pipette. + * @return Capacity of the pipette. + */ + int getCapacity(ItemStack pipette); + + /** + * @param pipette + * @return true if the pipette can pipette. + */ + boolean canPipette(ItemStack pipette); + + /** + * Fills the pipette with the given liquid stack. + * + * @param pipette + * @param liquid + * @param doFill + * @return Amount of liquid used in filling the pipette. + */ + int fill(ItemStack pipette, FluidStack liquid, boolean doFill); + + /** + * Drains liquid from the pipette + * + * @param pipette + * @param maxDrain + * @param doDrain + * @return Fluid stack representing the liquid and amount drained from the pipette. + */ + FluidStack drain(ItemStack pipette, int maxDrain, boolean doDrain); +} diff --git a/src/main/java/buildcraft/api/tools/IToolWrench.java b/src/main/java/buildcraft/api/tools/IToolWrench.java new file mode 100644 index 00000000..a6c56e8d --- /dev/null +++ b/src/main/java/buildcraft/api/tools/IToolWrench.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.tools; + +import net.minecraft.entity.player.EntityPlayer; + +/*** + * Implement this interface on subclasses of Item to have that item work as a wrench for buildcraft + */ +public interface IToolWrench { + + /*** + * Called to ensure that the wrench can be used. To get the ItemStack that is used, check player.inventory.getCurrentItem() + * + * @param player + * - The player doing the wrenching + * @param x + * ,y,z - The coordinates for the block being wrenched + * + * @return true if wrenching is allowed, false if not + */ + public boolean canWrench(EntityPlayer player, int x, int y, int z); + + /*** + * Callback after the wrench has been used. This can be used to decrease durability or for other purposes. To get the ItemStack that was used, check + * player.inventory.getCurrentItem() + * + * @param player + * - The player doing the wrenching + * @param x + * ,y,z - The coordinates of the block being wrenched + */ + public void wrenchUsed(EntityPlayer player, int x, int y, int z); +} diff --git a/src/main/java/buildcraft/api/tools/package-info.java b/src/main/java/buildcraft/api/tools/package-info.java new file mode 100644 index 00000000..a5e03a06 --- /dev/null +++ b/src/main/java/buildcraft/api/tools/package-info.java @@ -0,0 +1,3 @@ +@API(apiVersion="1.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|tools") +package buildcraft.api.tools; +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/buildcraft/api/transport/IExtractionHandler.java b/src/main/java/buildcraft/api/transport/IExtractionHandler.java new file mode 100644 index 00000000..4d56659e --- /dev/null +++ b/src/main/java/buildcraft/api/transport/IExtractionHandler.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.transport; + +import net.minecraft.world.World; + +/** + * Implement and register with the PipeManager if you want to suppress connections from wooden pipes. + */ +public interface IExtractionHandler { + + /** + * Can this pipe extract items from the block located at these coordinates? + * param extractor can be null + */ + boolean canExtractItems(Object extractor, World world, int i, int j, int k); + + /** + * Can this pipe extract liquids from the block located at these coordinates? + * param extractor can be null + */ + boolean canExtractFluids(Object extractor, World world, int i, int j, int k); +} diff --git a/src/main/java/buildcraft/api/transport/IPipeConnection.java b/src/main/java/buildcraft/api/transport/IPipeConnection.java new file mode 100644 index 00000000..39f14ee9 --- /dev/null +++ b/src/main/java/buildcraft/api/transport/IPipeConnection.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.transport; + +import buildcraft.api.transport.IPipeTile.PipeType; +import net.minecraftforge.common.util.ForgeDirection; + +public interface IPipeConnection { + + enum ConnectOverride { + + CONNECT, DISCONNECT, DEFAULT + }; + + /** + * Allows you to override pipe connection logic. + * + * @param type + * @param with + * @return CONNECT to force a connection, DISCONNECT to force no connection, + * and DEFAULT to let the pipe decide. + */ + public ConnectOverride overridePipeConnection(PipeType type, ForgeDirection with); +} diff --git a/src/main/java/buildcraft/api/transport/IPipeDefinition.java b/src/main/java/buildcraft/api/transport/IPipeDefinition.java new file mode 100644 index 00000000..73a1c890 --- /dev/null +++ b/src/main/java/buildcraft/api/transport/IPipeDefinition.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.transport; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; + +public interface IPipeDefinition { + + String getUniqueTag(); + + void registerIcons(IIconRegister iconRegister); + + IIcon getIcon(int index); + + IIcon getItemIcon(); + + PipeBehavior makePipeBehavior(TileEntity tile); +} diff --git a/src/main/java/buildcraft/api/transport/IPipeTile.java b/src/main/java/buildcraft/api/transport/IPipeTile.java new file mode 100644 index 00000000..22f287f2 --- /dev/null +++ b/src/main/java/buildcraft/api/transport/IPipeTile.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.transport; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; + +public interface IPipeTile { + + public enum PipeType { + + ITEM, FLUID, POWER, STRUCTURE; + } + + PipeType getPipeType(); + + /** + * Offers an ItemStack for addition to the pipe. Will be rejected if the + * pipe doesn't accept items from that side. + * + * @param stack ItemStack offered for addition. Do not manipulate this! + * @param doAdd If false no actual addition should take place. Implementors + * should simulate. + * @param from Orientation the ItemStack is offered from. + * @return Amount of items used from the passed stack. + */ + int injectItem(ItemStack stack, boolean doAdd, ForgeDirection from); + + /** + * True if the pipe is connected to the block/pipe in the specific direction + * + * @param wire + * @return true if connect + */ + boolean isPipeConnected(ForgeDirection with); + + /** + * True if the pipe has a powered wire of the specified color. + * + * @param wire + * @return true if powered + */ + boolean isWireActive(PipeWire wire); +} diff --git a/src/main/java/buildcraft/api/transport/PipeBehavior.java b/src/main/java/buildcraft/api/transport/PipeBehavior.java new file mode 100644 index 00000000..66c528cb --- /dev/null +++ b/src/main/java/buildcraft/api/transport/PipeBehavior.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.transport; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + +public abstract class PipeBehavior { + + public final TileEntity tile; + + public PipeBehavior(TileEntity tile) { + this.tile = tile; + } + + public void tick() { + } + + public int getIconIndex(ForgeDirection side) { + return 0; + } + + public void writeToNBT(NBTTagCompound nbt) { + } + + public void readFromNBT(NBTTagCompound nbt) { + } + + public boolean canPipeConnect(TileEntity tile, ForgeDirection side) { + return true; + } + + public boolean blockActivated(EntityPlayer player) { + return false; + } + + public void onNeighborBlockChange(int blockId) { + } +} diff --git a/src/main/java/buildcraft/api/transport/PipeManager.java b/src/main/java/buildcraft/api/transport/PipeManager.java new file mode 100644 index 00000000..ae7bd918 --- /dev/null +++ b/src/main/java/buildcraft/api/transport/PipeManager.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.transport; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.world.World; + +public abstract class PipeManager { + + public static List extractionHandlers = new ArrayList(); + + public static void registerExtractionHandler(IExtractionHandler handler) { + extractionHandlers.add(handler); + } + + /** + * param extractor can be null + */ + public static boolean canExtractItems(Object extractor, World world, int i, int j, int k) { + for (IExtractionHandler handler : extractionHandlers) + if (!handler.canExtractItems(extractor, world, i, j, k)) + return false; + + return true; + } + + /** + * param extractor can be null + */ + public static boolean canExtractFluids(Object extractor, World world, int i, int j, int k) { + for (IExtractionHandler handler : extractionHandlers) + if (!handler.canExtractFluids(extractor, world, i, j, k)) + return false; + + return true; + } +} diff --git a/src/main/java/buildcraft/api/transport/PipeWire.java b/src/main/java/buildcraft/api/transport/PipeWire.java new file mode 100644 index 00000000..8024e6bb --- /dev/null +++ b/src/main/java/buildcraft/api/transport/PipeWire.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ +package buildcraft.api.transport; + +import java.util.Locale; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public enum PipeWire { + + RED, BLUE, GREEN, YELLOW; + public static Item item; + public static final PipeWire[] VALUES = values(); + + public PipeWire reverse() { + switch (this) { + case RED: + return YELLOW; + case BLUE: + return GREEN; + case GREEN: + return BLUE; + default: + return RED; + } + } + + public String getTag() { + return name().toLowerCase(Locale.ENGLISH) + "PipeWire"; + } + + public ItemStack getStack() { + return getStack(1); + } + + public ItemStack getStack(int qty) { + if (item == null) + return null; + return new ItemStack(item, qty, ordinal()); + } + + public boolean isPipeWire(ItemStack stack) { + if (stack == null) + return false; + if (stack.getItem() != item) + return false; + return stack.getItemDamage() == ordinal(); + } + + public static PipeWire fromOrdinal(int ordinal) { + if (ordinal < 0 || ordinal >= VALUES.length) + return RED; + return VALUES[ordinal]; + } +} diff --git a/src/main/java/buildcraft/api/transport/package-info.java b/src/main/java/buildcraft/api/transport/package-info.java new file mode 100644 index 00000000..612eeaaa --- /dev/null +++ b/src/main/java/buildcraft/api/transport/package-info.java @@ -0,0 +1,3 @@ +@API(apiVersion="2.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|transport") +package buildcraft.api.transport; +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/cofh/api/energy/IEnergyHandler.java b/src/main/java/cofh/api/energy/IEnergyHandler.java index 07a37782..07d4cdc2 100644 --- a/src/main/java/cofh/api/energy/IEnergyHandler.java +++ b/src/main/java/cofh/api/energy/IEnergyHandler.java @@ -1,6 +1,7 @@ package cofh.api.energy; -import net.minecraftforge.common.ForgeDirection; + +import net.minecraftforge.common.util.ForgeDirection; /** * Implement this interface on TileEntities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects. diff --git a/src/main/java/dan200/computer/api/ComputerCraftAPI.java b/src/main/java/dan200/computer/api/ComputerCraftAPI.java deleted file mode 100644 index 4cb4c0ca..00000000 --- a/src/main/java/dan200/computer/api/ComputerCraftAPI.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computer.api; - -import net.minecraft.world.World; - -import java.lang.reflect.Method; - -/** - * The static entry point to the ComputerCraft API. - * Members in this class must be called after mod_ComputerCraft has been initialised, - * but may be called before it is fully loaded. - */ -public class ComputerCraftAPI -{ - private static boolean ccSearched = false; - private static Class computerCraft = null; - private static Method computerCraft_createUniqueNumberedSaveDir = null; - private static Method computerCraft_createSaveDirMount = null; - - // The functions below here are private, and are used to interface with the non-API ComputerCraft classes. - // Reflection is used here so you can develop your mod in MCP without decompiling ComputerCraft and including - // it in your solution. - private static Method computerCraft_createResourceMount = null; - private static Method computerCraft_registerExternalPeripheral = null; - - /** - * Creates a numbered directory in a subfolder of the save directory for a given world, and returns that number.
- * Use in conjuction with createSaveDirMount() to create a unique place for your peripherals or media items to store files.
- * - * @param world The world for which the save dir should be created. This should be the serverside world object. - * @param parentSubPath The folder path within the save directory where the new directory should be created. eg: "computer/disk" - * @return The numerical value of the name of the new folder, or -1 if the folder could not be created for some reason.
- * eg: if createUniqueNumberedSaveDir( world, "computer/disk" ) was called returns 42, then "computer/disk/42" is now available for writing. - * @see #createSaveDirMount(World, String) - */ - public static int createUniqueNumberedSaveDir(World world, String parentSubPath) { - findCC(); - if (computerCraft_createUniqueNumberedSaveDir != null) { - try { - return ((Integer) computerCraft_createUniqueNumberedSaveDir.invoke(null, world, parentSubPath)).intValue(); - } catch (Exception e) { - // It failed - } - } - return -1; - } - - /** - * Creates a file system mount that maps to a subfolder of the save directory for a given world, and returns it.
- * Use in conjuction with IComputerAccess.mount() or IComputerAccess.mountWritable() to mount a folder from the - * users save directory onto a computers file system.
- * - * @param world The world for which the save dir can be found. This should be the serverside world object. - * @param subPath The folder path within the save directory that the mount should map to. eg: "computer/disk/42".
- * Use createUniqueNumberedSaveDir() to create a new numbered folder to use. - * @param capacity The ammount of data that can be stored in the directory before it fills up, in bytes. - * @return The mount, or null if it could be created for some reason. Use IComputerAccess.mount() or IComputerAccess.mountWritable() - * to mount this on a Computers' file system. - * @see #createUniqueNumberedSaveDir(World, String) - * @see IComputerAccess#mount(String, IMount) - * @see IComputerAccess#mountWritable(String, IWritableMount) - * @see IMount - * @see IMountWritable - */ - public static IWritableMount createSaveDirMount(World world, String subPath, long capacity) { - findCC(); - if (computerCraft_createSaveDirMount != null) { - try { - return (IWritableMount) computerCraft_createSaveDirMount.invoke(null, world, subPath, capacity); - } catch (Exception e) { - // It failed - } - } - return null; - } - - /** - * Creates a file system mount to a resource folder, and returns it.
- * Use in conjuction with IComputerAccess.mount() or IComputerAccess.mountWritable() to mount a resource folder onto a computers file system.
- * The files in this mount will be a combination of files in the specified mod jar, and resource packs that contain resources with the same domain and path.
- * - * @param class A class in whose jar to look first for the resources to mount. Using your main mod class is recommended. eg: MyMod.class - * @param domain The domain under which to look for resources. eg: "mymod" - * @param subPath The domain under which to look for resources. eg: "mymod/lua/myfiles" - * @return The mount, or null if it could be created for some reason. Use IComputerAccess.mount() or IComputerAccess.mountWritable() - * to mount this on a Computers' file system. - * @see IComputerAccess#mount(String, IMount) - * @see IComputerAccess#mountWritable(String, IMountWritable) - * @see IMount - */ - public static IMount createResourceMount(Class modClass, String domain, String subPath) { - findCC(); - if (computerCraft_createResourceMount != null) { - try { - return (IMount) computerCraft_createResourceMount.invoke(null, modClass, domain, subPath); - } catch (Exception e) { - // It failed - } - } - return null; - } - - /** - * Registers a peripheral handler for a TileEntity that you do not have access to. Only - * use this if you want to expose IPeripheral on a TileEntity from another mod. For your own - * mod, just implement IPeripheral on the TileEntity directly. - * - * @see IPeripheral - * @see IPeripheralHandler - */ - public static void registerExternalPeripheral(Class clazz, IPeripheralHandler handler) { - findCC(); - if (computerCraft_registerExternalPeripheral != null) { - try { - computerCraft_registerExternalPeripheral.invoke(null, clazz, handler); - } catch (Exception e) { - } - } - } - - private static void findCC() { - if (!ccSearched) { - try { - computerCraft = Class.forName("dan200.ComputerCraft"); - computerCraft_createUniqueNumberedSaveDir = findCCMethod("createUniqueNumberedSaveDir", new Class[]{ - World.class, String.class - }); - computerCraft_createSaveDirMount = findCCMethod("createSaveDirMount", new Class[]{ - World.class, String.class, Long.TYPE - }); - computerCraft_createResourceMount = findCCMethod("createResourceMount", new Class[]{ - Class.class, String.class, String.class - }); - computerCraft_registerExternalPeripheral = findCCMethod("registerExternalPeripheral", new Class[]{ - Class.class, IPeripheralHandler.class - }); - } catch (Exception e) { - net.minecraft.server.MinecraftServer.getServer().logInfo("ComputerCraftAPI: ComputerCraft not found."); - } finally { - ccSearched = true; - } - } - } - - private static Method findCCMethod(String name, Class[] args) { - try { - return computerCraft.getMethod(name, args); - } catch (NoSuchMethodException e) { - net.minecraft.server.MinecraftServer.getServer().logInfo("ComputerCraftAPI: ComputerCraft method " + name + " not found."); - return null; - } - } -} diff --git a/src/main/java/dan200/computer/api/IComputerAccess.java b/src/main/java/dan200/computer/api/IComputerAccess.java deleted file mode 100644 index 72784a0a..00000000 --- a/src/main/java/dan200/computer/api/IComputerAccess.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computer.api; - -/** - * The interface passed to peripherals by computers or turtles, providing methods - * that they can call. This should not be implemented by your classes. Do not interact - * with computers except via this interface. - */ -public interface IComputerAccess -{ - /** - * Mount a mount onto the computers' file system in a read only mode.
- * @param desiredLoction The location on the computer's file system where you would like the mount to be mounted. - * @param mount The mount object to mount on the computer. These can be obtained by calling ComputerCraftAPI.createSaveDirMount(), ComputerCraftAPI.createResourceMount() or by creating your own objects that implement the IMount interface. - * @return The location on the computer's file system where you the mount mounted, or null if there was already a file in the desired location. Store this value if you wish to unmount the mount later. - * @see ComputerCraftAPI#createSaveDirMount(World, String) - * @see ComputerCraftAPI#createResourceMount(Class, String, String) - * @see #mountWritable(String, IWritableMount) - * @see #unmount(String) - * @see IMount - */ - public String mount( String desiredLocation, IMount mount ); - - /** - * Mount a mount onto the computers' file system in a writable mode.
- * @param desiredLoction The location on the computer's file system where you would like the mount to be mounted. - * @param mount The mount object to mount on the computer. These can be obtained by calling ComputerCraftAPI.createSaveDirMount() or by creating your own objects that implement the IWritableMount interface. - * @return The location on the computer's file system where you the mount mounted, or null if there was already a file in the desired location. Store this value if you wish to unmount the mount later. - * @see ComputerCraftAPI#createSaveDirMount(World, String) - * @see ComputerCraftAPI#createResourceMount(Class, String, String) - * @see #mount(String, IMount) - * @see #unmount(String) - * @see IMount - */ - public String mountWritable( String desiredLocation, IWritableMount mount ); - - /** - * Unmounts a directory previously mounted onto the computers file system by mount() or mountWritable().
- * When a directory is unmounted, it will disappear from the computers file system, and the user will no longer be able to - * access it. All directories mounted by a mount or mountWritable are automatically unmounted when the peripheral - * is attached if they have not been explicitly unmounted. - * @param location The desired location in the computers file system of the directory to unmount. - * This must be the location of a directory previously mounted by mount() or mountWritable(), as - * indicated by their return value. - * @see #mount(String, IMount) - * @see #mountWritable(String, IWritableMount) - */ - public void unmount( String location ); - - /** - * Returns the numerical ID of this computer.
- * This is the same number obtained by calling os.getComputerID() or running the "id" program from lua, - * and is guarunteed unique. This number will be positive. - * @return The identifier. - */ - public int getID(); - - /** - * Causes an event to be raised on this computer, which the computer can respond to by calling - * os.pullEvent(). This can be used to notify the computer when things happen in the world or to - * this peripheral. - * @param event A string identifying the type of event that has occurred, this will be - * returned as the first value from os.pullEvent(). It is recommended that you - * you choose a name that is unique, and recognisable as originating from your - * peripheral. eg: If your peripheral type is "button", a suitable event would be - * "button_pressed". - * @param arguments In addition to a name, you may pass an array of extra arguments to the event, that will - * be supplied as extra return values to os.pullEvent(). Objects in the array will be converted - * to lua data types in the same fashion as the return values of IPeripheral.callMethod().
- * You may supply null to indicate that no arguments are to be supplied. - * @see IPeripheral#callMethod - */ - public void queueEvent( String event, Object[] arguments ); - - /** - * Get a string, unique to the computer, by which the computer refers to this peripheral. - * For directly attached peripherals this will be "left","right","front","back",etc, but - * for peripherals attached remotely it will be different. It is good practice to supply - * this string when raising events to the computer, so that the computer knows from - * which peripheral the event came. - * @return A string unique to the computer, but not globally. - */ - public String getAttachmentName(); -} diff --git a/src/main/java/dan200/computer/api/IHostedPeripheral.java b/src/main/java/dan200/computer/api/IHostedPeripheral.java deleted file mode 100644 index 68cf3fd7..00000000 --- a/src/main/java/dan200/computer/api/IHostedPeripheral.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computer.api; -import dan200.computer.api.IPeripheral; - -/** - * A subclass of IPeripheral specifically for peripherals - * created by ITurtleUpgrade's of type Peripheral. When an - * IHostedPeripheral is created, its IPeripheral methods will be called - * just as if the peripheral was a seperate adjacent block in the world, - * and update() will be called once per tick. - * @see ITurtleUpgrade - */ -public interface IHostedPeripheral extends IPeripheral -{ - /** - * A method called on each hosted peripheral once per tick, on the main thread - * over the lifetime of the turtle or block. May be used to update the state - * of the peripheral, and may interact with IComputerAccess or ITurtleAccess - * however it likes at this time. - */ - public void update(); - - /** - * A method called whenever data is read from the Turtle's NBTTag, - * over the lifetime of the turtle. You should only use this for - * reading data you want to stay with the peripheral. - * @param nbttagcompound The peripheral's NBTTag - */ - public void readFromNBT( net.minecraft.nbt.NBTTagCompound nbttagcompound ); - - /** - * A method called whenever data is written to the Turtle's NBTTag, - * over the lifetime of the turtle. You should only use this for - * writing data you want to stay with the peripheral. - * @param nbttagcompound The peripheral's NBTTag. - * @param ID The turtle's ID. - */ - public void writeToNBT( net.minecraft.nbt.NBTTagCompound nbttagcompound ); -} diff --git a/src/main/java/dan200/computer/api/ILuaContext.java b/src/main/java/dan200/computer/api/ILuaContext.java deleted file mode 100644 index eb319390..00000000 --- a/src/main/java/dan200/computer/api/ILuaContext.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computer.api; - -/** - * An interface passed to peripherals and ILuaObjects' by computers or turtles, providing methods - * that allow the peripheral call to wait for events before returning, just like in lua. - * This is very useful if you need to signal work to be performed on the main thread, and don't want to return - * until the work has been completed. - */ -public interface ILuaContext -{ - /** - * Wait for an event to occur on the computer, suspending the thread until it arises. This method is exactly equivalent to os.pullEvent() in lua. - * @param filter A specific event to wait for, or null to wait for any event - * @return An object array containing the name of the event that occurred, and any event parameters - * @throws Exception If the user presses CTRL+T to terminate the current program while pullEvent() is waiting for an event, a "Terminated" exception will be thrown here. - * Do not attempt to block this exception, unless you wish to prevent termination, which is not recommended. - * @throws InterruptedException If the user shuts down or reboots the computer while pullEvent() is waiting for an event, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computer will leak memory and end up in a broken state. - */ - public Object[] pullEvent( String filter ) throws Exception, InterruptedException; - - /** - * The same as pullEvent(), except "terminated" events are ignored. Only use this if you want to prevent program termination, which is not recommended. This method is exactly equivalent to os.pullEventRaw() in lua. - * @param filter A specific event to wait for, or null to wait for any event - * @return An object array containing the name of the event that occurred, and any event parameters - * @throws InterruptedException If the user shuts down or reboots the computer while pullEventRaw() is waiting for an event, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computer will leak memory and end up in a broken state. - * @see #pullEvent(String) - */ - public Object[] pullEventRaw( String filter ) throws InterruptedException; - - - /** - * Yield the current coroutine with some arguments until it is resumed. This method is exactly equivalent to coroutine.yield() in lua. Use pullEvent() if you wish to wait for events. - * @param arguments An object array containing the arguments to pass to coroutine.yield() - * @return An object array containing the return values from coroutine.yield() - * @throws InterruptedException If the user shuts down or reboots the computer the coroutine is suspended, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computer will leak memory and end up in a broken state. - * @see #pullEvent(String) - */ - public Object[] yield( Object[] arguments ) throws InterruptedException; -} diff --git a/src/main/java/dan200/computer/api/ILuaObject.java b/src/main/java/dan200/computer/api/ILuaObject.java deleted file mode 100644 index a063fa5b..00000000 --- a/src/main/java/dan200/computer/api/ILuaObject.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computer.api; - -/** - * An interface for representing custom objects returned by IPeripheral.callMethod() calls. - * Return objects implementing this interface to expose objects with methods to lua. - */ -public interface ILuaObject -{ - /** - * Get the names of the methods that this object implements. This works the same as IPeripheral.getMethodNames(). See that method for detailed documentation. - * @see IPeripheral#getMethodNames() - */ - public String[] getMethodNames(); - - /** - * Called when a user calls one of the methods that this object implements. This works the same as IPeripheral.callMethod(). See that method for detailed documentation. - * @see IPeripheral#callMethod(IComputerAccess, ILuaContext, int, Object[]) - */ - public Object[] callMethod( ILuaContext context, int method, Object[] arguments ) throws Exception; -} diff --git a/src/main/java/dan200/computer/api/IMedia.java b/src/main/java/dan200/computer/api/IMedia.java deleted file mode 100644 index 52660af0..00000000 --- a/src/main/java/dan200/computer/api/IMedia.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computer.api; -import net.minecraft.world.World; -import net.minecraft.item.ItemStack; - -/** - * Represents an item that can be placed in a disk drive and used by a Computer. - * Implement this interface on your Item class to allow it to be used in the drive. - */ -public interface IMedia -{ - /** - * Get a string representing the label of this item. Will be called vi disk.getLabel() in lua. - * @param stack The itemstack to inspect - * @return The label. ie: "Dan's Programs" - */ - public String getLabel( ItemStack stack ); - - /** - * Set a string representing the label of this item. Will be called vi disk.setLabel() in lua. - * @param stack The itemstack to modify. - * @param label The string to set the label to. - * @return true if the label was updated, false if the label may not be modified. - */ - public boolean setLabel( ItemStack stack, String label ); - - /** - * If this disk represents an item with audio (like a record), get the readable name of the audio track. ie: "Jonathon Coulton - Still Alive" - * @param stack The itemstack to inspect. - * @return The name, or null if this item does not represent an item with audio. - */ - public String getAudioTitle( ItemStack stack ); - - /** - * If this disk represents an item with audio (like a record), get the resource name of the audio track to play. - * @param stack The itemstack to inspect. - * @return The name, or null if this item does not represent an item with audio. - */ - public String getAudioRecordName( ItemStack stack ); - - /** - * If this disk represents an item with data (like a floppy disk), get a mount representing it's contents. This will be mounted onto the filesystem of the computer while the media is in the disk drive. - * @param stack The itemstack to inspect. - * @param world The world in which the item and disk drive reside. - * @return The mount, or null if this item does not represent an item with data. If the IMount returned also implements IWritableMount, it will mounted using mountWritable() - * @see IMount - * @see IWritableMount - * @see ComputerCraftAPI#createSaveDirMount(World, String) - * @see ComputerCraftAPI#createResourceMount(Class, String, String) - */ - public IMount createDataMount( ItemStack stack, World world ); -} diff --git a/src/main/java/dan200/computer/api/IMount.java b/src/main/java/dan200/computer/api/IMount.java deleted file mode 100644 index 69ff3231..00000000 --- a/src/main/java/dan200/computer/api/IMount.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computer.api; - -import java.io.IOException; -import java.io.InputStream; -import java.util.List; - -/** - * Represents a read only part of a virtual filesystem that can be mounted onto a computer using IComputerAccess.mount(). - * Ready made implementations of this interface can be created using ComputerCraftAPI.createSaveDirMount() or ComputerCraftAPI.createResourceMount(), or you're free to implement it yourselves! - * @see ComputerCraftAPI#createSaveDirMount(World, String) - * @see ComputerCraftAPI#createResourceMount(Class, String, String) - * @see IComputerAccess#mount(String, IMount) - * @see IWritableMount - */ -public interface IMount -{ - /** - * Returns whether a file with a given path exists or not. - * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram" - * @return true if the file exists, false otherwise - */ - public boolean exists( String path ) throws IOException; - - /** - * Returns whether a file with a given path is a directory or not. - * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprograms" - * @return true if the file exists and is a directory, false otherwise - */ - public boolean isDirectory( String path ) throws IOException; - - /** - * Returns the file names of all the files in a directory. - * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprograms" - * @param contents A list of strings. Add all the file names to this list - */ - public void list( String path, List contents ) throws IOException; - - /** - * Returns the size of a file with a given path, in bytes - * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram" - * @return the size of the file, in bytes - */ - public long getSize( String path ) throws IOException; - - /** - * Opens a file with a given path, and returns an inputstream representing it's contents. - * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram" - * @return a stream representing the contents of the file - */ - public InputStream openForRead( String path ) throws IOException; -} diff --git a/src/main/java/dan200/computer/api/IPeripheral.java b/src/main/java/dan200/computer/api/IPeripheral.java deleted file mode 100644 index 67243180..00000000 --- a/src/main/java/dan200/computer/api/IPeripheral.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computer.api; - -/** - * The interface that defines a peripheral. This should be implemented by the - * TileEntity of any block that you wish to be interacted with by - * computer or turtle. - */ -public interface IPeripheral -{ - /** - * Should return a string that uniquely identifies this type of peripheral. - * This can be queried from lua by calling peripheral.getType() - * @return A string identifying the type of peripheral. - */ - public String getType(); - - /** - * Should return an array of strings that identify the methods that this - * peripheral exposes to Lua. This will be called once before each attachment, - * and should not change when called multiple times. - * @return An array of strings representing method names. - * @see #callMethod - */ - public String[] getMethodNames(); - - /** - * This is called when a lua program on an attached computer calls peripheral.call() with - * one of the methods exposed by getMethodNames().
- *
- * Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe - * when interacting with minecraft objects. - * @param computer The interface to the computer that is making the call. Remember that multiple - * computers can be attached to a peripheral at once. - * @param context The context of the currently running lua thread. This can be used to wait for events - * or otherwise yield. - * @param method An integer identifying which of the methods from getMethodNames() the computer - * wishes to call. The integer indicates the index into the getMethodNames() table - * that corresponds to the string passed into peripheral.call() - * @param arguments An array of objects, representing the arguments passed into peripheral.call().
- * Lua values of type "string" will be represented by Object type String.
- * Lua values of type "number" will be represented by Object type Double.
- * Lua values of type "boolean" will be represented by Object type Boolean.
- * Lua values of any other type will be represented by a null object.
- * This array will be empty if no arguments are passed. - * @return An array of objects, representing values you wish to return to the lua program.
- * Integers, Doubles, Floats, Strings, Booleans and null be converted to their corresponding lua type.
- * All other types will be converted to nil.
- * You may return null to indicate no values should be returned. - * @throws Exception If you throw any exception from this function, a lua error will be raised with the - * same message as your exception. Use this to throw appropriate errors if the wrong - * arguments are supplied to your method. - * @see #getMethodNames - */ - public Object[] callMethod( IComputerAccess computer, ILuaContext context, int method, Object[] arguments ) throws Exception; - - /** - * Is called before the computer attempts to attach to the peripheral, and should return whether to allow - * the attachment. Use this to restrict the number of computers that can attach, or to limit attachments to - * certain world directions.
- * If true is returned, attach() will be called shortly afterwards, and the computer will be able to make method calls. - * If false is returned, attach() will not be called, and the peripheral will be invisible to the computer. - * @param side The world direction (0=bottom, 1=top, etc) that the computer lies relative to the peripheral. - * @return Whether to allow the attachment, as a boolean. - * @see #attach - */ - public boolean canAttachToSide( int side ); - - /** - * Is called when canAttachToSide has returned true, and a computer is attaching to the peripheral. - * This will occur when a peripheral is placed next to an active computer, when a computer is turned on next to a peripheral, - * or when a turtle travels into a square next to a peripheral. - * Between calls to attach() and detach(), the attached computer can make method calls on the peripheral using peripheral.call(). - * This method can be used to keep track of which computers are attached to the peripheral, or to take action when attachment - * occurs.
- *
- * Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe - * when interacting with minecraft objects. - * @param computer The interface to the computer that is being attached. Remember that multiple - * computers can be attached to a peripheral at once. - * @see #canAttachToSide - * @see #detach - */ - public void attach( IComputerAccess computer ); - - /** - * Is called when a computer is detaching from the peripheral. - * This will occur when a computer shuts down, when the peripheral is removed while attached to computers, - * or when a turtle moves away from a square attached to a peripheral. - * This method can be used to keep track of which computers are attached to the peripheral, or to take action when detachment - * occurs.
- *
- * Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe - * when interacting with minecraft objects. - * @param computer The interface to the computer that is being detached. Remember that multiple - * computers can be attached to a peripheral at once. - * @see #canAttachToSide - * @see #detach - */ - public void detach( IComputerAccess computer ); -} diff --git a/src/main/java/dan200/computer/api/IPeripheralHandler.java b/src/main/java/dan200/computer/api/IPeripheralHandler.java deleted file mode 100644 index 062f15e3..00000000 --- a/src/main/java/dan200/computer/api/IPeripheralHandler.java +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computer.api; - -import net.minecraft.tileentity.TileEntity; - -/** - * TODO: Document me - */ -public interface IPeripheralHandler -{ - public IHostedPeripheral getPeripheral( TileEntity tile ); -} diff --git a/src/main/java/dan200/computer/api/IWritableMount.java b/src/main/java/dan200/computer/api/IWritableMount.java deleted file mode 100644 index 7fa8db3f..00000000 --- a/src/main/java/dan200/computer/api/IWritableMount.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.computer.api; - -import java.io.IOException; -import java.io.OutputStream; -import java.util.List; - -/** - * Represents a part of a virtual filesystem that can be mounted onto a computer using IComputerAccess.mount() or IComputerAccess.mountWritable(), that can also be written to. - * Ready made implementations of this interface can be created using ComputerCraftAPI.createSaveDirMount(), or you're free to implement it yourselves! - * @see ComputerCraftAPI#createSaveDirMount(World, String) - * @see IComputerAccess#mountWritable(String, IMount) - * @see IMount - */ -public interface IWritableMount extends IMount -{ - /** - * Creates a directory at a given path inside the virtual file system. - * @param path A file path in normalised format, relative to the mount location. ie: "programs/mynewprograms" - */ - public void makeDirectory( String path ) throws IOException; - - /** - * Deletes a directory at a given path inside the virtual file system. - * @param path A file path in normalised format, relative to the mount location. ie: "programs/myoldprograms" - */ - public void delete( String path ) throws IOException; - - /** - * Opens a file with a given path, and returns an outputstream for writing to it. - * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram" - * @return a stream for writing to - */ - public OutputStream openForWrite( String path ) throws IOException; - - /** - * Opens a file with a given path, and returns an outputstream for appending to it. - * @param path A file path in normalised format, relative to the mount location. ie: "programs/myprogram" - * @return a stream for writing to - */ - public OutputStream openForAppend( String path ) throws IOException; - - /** - * Get the ammount of free space on the mount, in bytes. You should decrease this value as the user writes to the mount, and write operations should fail once it reaches zero. - * @return The ammount of free space, in bytes. - */ - public long getRemainingSpace() throws IOException; -} diff --git a/src/main/java/dan200/turtle/api/ITurtleAccess.java b/src/main/java/dan200/turtle/api/ITurtleAccess.java deleted file mode 100644 index f996bf47..00000000 --- a/src/main/java/dan200/turtle/api/ITurtleAccess.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.turtle.api; -import dan200.computer.api.*; - -/** - * The interface passed to upgrades by turtles, providing methods that they can call. - * This should not be implemented by your classes. Do not interact with turtles except via this interface and ITurtleUpgrade. - */ -public interface ITurtleAccess -{ - /** - * Returns the world in which the turtle resides. - * @return the world in which the turtle resides. - */ - public net.minecraft.world.World getWorld(); - - /** - * Returns a vector containing the integer block co-ordinates at which the turtle resides. - * @return a vector containing the integer block co-ordinates at which the turtle resides. - */ - public net.minecraft.util.Vec3 getPosition(); - - /** - * Returns a vector containing the co-ordinates at which the turtle is rendered. - * This will shift when the turtle is moving. - * @param f The subframe fraction - * @return a vector containing the integer block co-ordinates at which the turtle resides. - */ - public net.minecraft.util.Vec3 getVisualPosition( float f ); - - /** - * Returns the world direction the turtle is currently facing. - * @return the world direction the turtle is currently facing. - */ - public int getFacingDir(); - - /** - * Returns the size of the turtles inventory, in number of slots. This will currently always be 16. - * @return the size of the turtles inventory, in number of slots. This will currently always be 16. - */ - public int getInventorySize(); - - /** - * Returns which slot the turtle currently has selected in its inventory using turtle.select(). - * Unlike the 1-based lua representation, this will be between 0 and getInventorySize() - 1. - * @return which slot the turtle currently has selected in its inventory - */ - public int getSelectedSlot(); - - /** - * Returns the item stack that the turtle has in one of its inventory slots. - * @param index which inventory slot to retreive, should be between 0 and getInventorySize() - 1 - * @return the item stack that the turtle has in one of its inventory slots. May be null. - */ - public net.minecraft.item.ItemStack getSlotContents( int index ); - - /** - * Changes the item stack that the turtle has in one of its inventory slots. - * @param index which inventory slot to change, should be between 0 and getInventorySize() - 1 - * @param stack an item stack to put in the slot. May be null. - */ - public void setSlotContents( int index, net.minecraft.item.ItemStack stack ); - - /** - * Tries to store an item stack into the turtles current inventory, starting from the turtles - * currently selected inventory slot. - * @param stack The item stack to try and store. - * @return true if the stack was completely stored in the inventory, false if - * it was only partially stored, or could not fit at all. If false is returned - * and the stack was partially stored, the ItemStack passed into "stack" will now - * represent the stack of items that is left over. - */ - public boolean storeItemStack( net.minecraft.item.ItemStack stack ); - - /** - * Drops an item stack from the turtle onto the floor, or into an inventory is there is one - * adjacent to the turtle in the direction specified. - * @param stack The item stack to drop. - * @param dir The world direction to drop the item - * @return true if the stack was dropped, or completely stored in the adjacent inventory, false if - * it was only partially stored in the adjacent inventory, or could not fit at all. If false is returned - * and the stack was partially stored, the ItemStack passed into "stack" will now - * represent the stack of items that is left over. - */ - public boolean dropItemStack( net.minecraft.item.ItemStack stack, int dir ); - - /** - * "Deploys" an item stack in the direction specified. This simulates a player right clicking, and calls onItemUse() on the Item class. - * Will return true if some kind of deployment happened, and may modify the item stack. For block item types, this can be - * used to place blocks. Some kinds of items (such as shears when facing a sheep) may modify the turtles inventory during this call. - * @param stack The item stack to deploy - * @param dir The world direction to deploy the item - * @return true if the stack was deployed, false if it was not. - */ - public boolean deployWithItemStack( net.minecraft.item.ItemStack stack, int dir ); - - /** - * Tries to "attack" entities with an item stack in the direction specified. This simulates a player left clicking, but will - * not affect blocks. If an entity is attacked and killed during this call, its dropped items will end up in the turtles - * inventory. - * @param stack The item stack to attack with - * @param dir The world direction to attack with the item - * @return true if something was attacked, false if it was not - */ - public boolean attackWithItemStack( net.minecraft.item.ItemStack stack, int dir, float damageMultiplier ); - - /** - * Returns the current fuel level of the turtle, this is the same integer returned by turtle.getFuelLevel(), - * that decreases by 1 every time the turtle moves. Can be used to have your tool or peripheral require or supply - * fuel to the turtle. - * @return the fuel level - */ - public int getFuelLevel(); - - /** - * Tries to increase the fuel level of a turtle by burning an item stack. If the item passed in is a fuel source, fuel - * will increase and true will be returned. Otherwise, nothing will happen and false will be returned. - * @param stack The stack to try to refuel with - * @return Whether the turtle was refueled - */ - public boolean refuelWithItemStack( net.minecraft.item.ItemStack stack ); - - /** - * Removes some fuel from the turtles fuel supply. Negative numbers can be passed in to INCREASE the fuel level of the turtle. - * @return Whether the turtle was able to consume the ammount of fuel specified. Will return false if you supply a number - * greater than the current fuel level of the turtle. - */ - public boolean consumeFuel( int fuel ); - - /** - * Adds a custom command to the turtles command queue. Unlike peripheral methods, these custom commands will be executed - * on the main thread, so are guaranteed to be able to access Minecraft objects safely, and will be queued up - * with the turtles standard movement and tool commands. An issued command will return an unique integer, which will - * be supplied as a parameter to a "turtle_response" event issued to the turtle after the command has completed. Look at the - * lua source code for "rom/apis/turtle" for how to build a lua wrapper around this functionality. - * @param handler an object which will execute the custom command when its point in the queue is reached - * @return the unique command identifier described above - * @see ITurtleCommandHandler - */ - public int issueCommand( ITurtleCommandHandler handler ); - - /** - * Returns the upgrade on the specified side of the turtle, if there is one. - * @return the upgrade on the specified side of the turtle, if there is one. - */ - public ITurtleUpgrade getUpgrade( TurtleSide side ); - - /** - * Returns the peripheral created by the upgrade on the specified side of the turtle, if there is one. - * @return the peripheral created by the upgrade on the specified side of the turtle, if there is one. - */ - public IHostedPeripheral getPeripheral( TurtleSide side ); -} diff --git a/src/main/java/dan200/turtle/api/ITurtleCommandHandler.java b/src/main/java/dan200/turtle/api/ITurtleCommandHandler.java deleted file mode 100644 index 255d28e2..00000000 --- a/src/main/java/dan200/turtle/api/ITurtleCommandHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.turtle.api; - -/** - * An interface for objects executing custom turtle commands, used with ITurtleAccess.issueCommand - * @see ITurtleAccess#issueCommand( ITurtleCommandHandler ) - */ -public interface ITurtleCommandHandler -{ - /** - * Will be called by the turtle on the main thread when it is time to execute the custom command. - * The handler should either perform the work of the command, and return true for success, or return - * false to indicate failure if the command cannot be executed at this time. - * @param turtle access to the turtle for whom the command was issued - * @return true for success, false for failure. If true is returned, the turtle will wait 0.4 seconds - * before executing the next command in its queue, as it does for the standard turtle commands. - * @see ITurtleAccess#issueCommand( ITurtleCommandHandler ) - */ - public boolean handleCommand( ITurtleAccess turtle ); -} diff --git a/src/main/java/dan200/turtle/api/ITurtleUpgrade.java b/src/main/java/dan200/turtle/api/ITurtleUpgrade.java deleted file mode 100644 index 3af5127b..00000000 --- a/src/main/java/dan200/turtle/api/ITurtleUpgrade.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.turtle.api; -import net.minecraft.util.Icon; -import dan200.computer.api.*; - -/** - * The primary interface for defining an upgrade for Turtles. A turtle upgrade - * can either be a new tool, or a new peripheral. - * @see TurtleAPI#registerUpgrade( ITurtleUpgrade ) - */ -public interface ITurtleUpgrade -{ - /** - * Gets a unique numerical identifier representing this type of turtle upgrade. - * Like Minecraft block and item IDs, you should strive to make this number unique - * among all turtle upgrades that have been released for ComputerCraft. - * The ID must be in the range 64 to 255, as the ID is stored as an 8-bit value, - * and 0-64 is reserved for future use by ComputerCraft. The upgrade will - * fail registration if an already used ID is specified. - * @see TurtleAPI#registerUpgrade( ITurtleUpgrade ) - */ - public int getUpgradeID(); - - /** - * Return a String to describe this type of upgrade in turtle item names. - * Examples of built-in adjectives are "Wireless", "Mining" and "Crafty". - */ - public String getAdjective(); - - /** - * Return whether this upgrade adds a tool or a peripheral to the turtle. - * Currently, turtle crafting is restricted to one tool & one peripheral per turtle. - * @see TurtleUpgradeType for the differences between the two. - */ - public TurtleUpgradeType getType(); - - /** - * Return an item stack representing the type of item that a turtle must be crafted - * with to create a turtle which holds this upgrade. - * Currently, turtle crafting is restricted to one tool & one peripheral per turtle. - */ - public net.minecraft.item.ItemStack getCraftingItem(); - - /** - * Return whether this turtle upgrade is an easter egg, and should be attempted to be hidden - * from the creative mode inventory and recipe book plugins. - */ - public boolean isSecret(); - - /** - * Will only be called for Peripheral upgrades. Creates a peripheral for a turtle - * being placed using this upgrade. The peripheral created will be stored - * for the lifetime of the turtle, will have update() called once-per-tick, and will be - * attach'd detach'd and have methods called in the same manner as a Computer peripheral. - * @param turtle Access to the turtle that the peripheral is being created for. - * @param side Which side of the turtle (left or right) that the upgrade resides on. - * @returns The newly created peripheral. You may return null if this upgrade is a Tool - * and this method is not expected to be called. - */ - public IHostedPeripheral createPeripheral( ITurtleAccess turtle, TurtleSide side ); - - /** - * Will only be called for Tool upgrades. Called when turtle.dig() or turtle.attack() is called - * by the turtle, and the tool is required to do some work. - * @param turtle Access to the turtle that the tool resides on. - * @param side Which side of the turtle (left or right) the tool resides on. - * @param verb Which action (dig or attack) the turtle is being called on to perform. - * @param direction Which world direction the action should be performed in, relative to the turtles - * position. This will either be up, down, or the direction the turtle is facing, depending on - * whether dig, digUp or digDown was called. - * @return Whether the turtle was able to perform the action, and hence whether the turtle.dig() - * or turtle.attack() lua method should return true. If true is returned, the tool will perform - * a swinging animation. You may return false if this upgrade is a Peripheral - * and this method is not expected to be called. - */ - public boolean useTool( ITurtleAccess turtle, TurtleSide side, TurtleVerb verb, int direction ); - - /** - * Called to obtain the Icon to be used when rendering a turtle peripheral. Needs to be a "block" - * type Icon for now, as there is no way to determine which texture sheet an Icon is from by the - * Icon itself. - * @param turtle Access to the turtle that the peripheral resides on. - * @param side Which side of the turtle (left or right) the peripheral resides on. - * @return The Icon that you wish to be used to render your turtle peripheral. - */ - public Icon getIcon( ITurtleAccess turtle, TurtleSide side ); -} diff --git a/src/main/java/dan200/turtle/api/TurtleAPI.java b/src/main/java/dan200/turtle/api/TurtleAPI.java deleted file mode 100644 index 3e3c5c1f..00000000 --- a/src/main/java/dan200/turtle/api/TurtleAPI.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.turtle.api; -import java.lang.reflect.Method; - -/** - * The static entry point to the ComputerCraft Turtle Upgrade API. - * Members in this class must be called after mod_CCTurtle has been initialised, - * but may be called before it is fully loaded. - */ -public class TurtleAPI -{ - /** - * Registers a new turtle upgrade for use in ComputerCraft. After calling this, - * users should be able to craft Turtles with your new upgrade. It is recommended to call - * this during the load() method of your mod. - * @throws Exception if you try to register an upgrade with an already used or reserved upgradeID - * @see ITurtleUpgrade - */ - public static void registerUpgrade( ITurtleUpgrade upgrade ) - { - if( upgrade != null ) - { - findCCTurtle(); - if( ccTurtle_registerTurtleUpgrade != null ) - { - try { - ccTurtle_registerTurtleUpgrade.invoke( null, new Object[]{ upgrade } ); - } catch( Exception e ) { - // It failed - } - } - } - } - - // The functions below here are private, and are used to interface with the non-API ComputerCraft classes. - // Reflection is used here so you can develop your mod in MCP without decompiling ComputerCraft and including - // it in your solution. - - private static void findCCTurtle() - { - if( !ccTurtleSearched ) { - // Search for CCTurtle - try { - ccTurtle = Class.forName( "dan200.CCTurtle" ); - ccTurtle_registerTurtleUpgrade = findCCTurtleMethod( "registerTurtleUpgrade", new Class[] { - ITurtleUpgrade.class - } ); - - } catch( ClassNotFoundException e ) { - System.out.println("ComputerCraftAPI: CCTurtle not found."); - - } finally { - ccTurtleSearched = true; - - } - } - } - - private static Method findCCTurtleMethod( String name, Class[] args ) - { - try { - return ccTurtle.getMethod( name, args ); - - } catch( NoSuchMethodException e ) { - System.out.println("ComputerCraftAPI: CCTurtle method " + name + " not found."); - return null; - } - } - - private static boolean ccTurtleSearched = false; - private static Class ccTurtle = null; - private static Method ccTurtle_registerTurtleUpgrade = null; -} diff --git a/src/main/java/dan200/turtle/api/TurtleSide.java b/src/main/java/dan200/turtle/api/TurtleSide.java deleted file mode 100644 index 3459d777..00000000 --- a/src/main/java/dan200/turtle/api/TurtleSide.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.turtle.api; - -/** - * An enum representing the two sides of the turtle that a turtle upgrade might reside. - */ -public enum TurtleSide -{ - /** - * The turtles left side (where the pickaxe usually is on a Wireless Mining Turtle) - */ - Left, - - /** - * The turtles right side (where the modem usually is on a Wireless Mining Turtle) - */ - Right, -} diff --git a/src/main/java/dan200/turtle/api/TurtleUpgradeType.java b/src/main/java/dan200/turtle/api/TurtleUpgradeType.java deleted file mode 100644 index a65fed8a..00000000 --- a/src/main/java/dan200/turtle/api/TurtleUpgradeType.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.turtle.api; - -/** - * An enum representing the two different types of upgrades that an ITurtleUpgrade - * implementation can add to a turtle. - * @see ITurtleUpgrade - */ -public enum TurtleUpgradeType -{ - /** - * A tool is rendered as an item on the side of the turtle, and responds to the turtle.dig() - * and turtle.attack() methods (Such as pickaxe or sword on Mining and Melee turtles). - */ - Tool, - - /** - * A peripheral adds a special peripheral which is attached to the side of the turtle, - * and can be interacted with the peripheral API (Such as the modem on Wireless Turtles). - */ - Peripheral, -} diff --git a/src/main/java/dan200/turtle/api/TurtleVerb.java b/src/main/java/dan200/turtle/api/TurtleVerb.java deleted file mode 100644 index a1b2531a..00000000 --- a/src/main/java/dan200/turtle/api/TurtleVerb.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the public ComputerCraft API - http://www.computercraft.info - * Copyright Daniel Ratcliffe, 2011-2013. This API may be redistributed unmodified and in full only. - * For help using the API, and posting your mods, visit the forums at computercraft.info. - */ - -package dan200.turtle.api; - -/** - * An enum representing the two different actions that an ITurtleUpgrade of type - * Tool may be called on to perform by a turtle. - * @see ITurtleUpgrade - * @see ITurtleUpgrade#useTool - */ -public enum TurtleVerb -{ - /** - * The turtle called turtle.dig(), turtle.digUp() or turtle.digDown() - */ - Dig, - - /** - * The turtle called turtle.attack(), turtle.attackUp() or turtle.attackDown() - */ - Attack, -} diff --git a/src/main/java/ic2/api/energy/EnergyNet.java b/src/main/java/ic2/api/energy/EnergyNet.java deleted file mode 100644 index 822bfc29..00000000 --- a/src/main/java/ic2/api/energy/EnergyNet.java +++ /dev/null @@ -1,18 +0,0 @@ -package ic2.api.energy; - - -/** - * Provides access to the energy network. - * - * The old EnergyNet methods missing in IEnergyNet have been migrated to events (load, unload) or - * removed (tiles no longer emit energy actively, the energy net implementation requests it). - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public final class EnergyNet { - /** - * Instance of the global EnergyNet class. - */ - public static IEnergyNet instance; -} - diff --git a/src/main/java/ic2/api/energy/IEnergyNet.java b/src/main/java/ic2/api/energy/IEnergyNet.java deleted file mode 100644 index e0d674ae..00000000 --- a/src/main/java/ic2/api/energy/IEnergyNet.java +++ /dev/null @@ -1,64 +0,0 @@ -package ic2.api.energy; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import net.minecraftforge.common.ForgeDirection; - -/** - * Interface representing the methods provided by the global EnergyNet class. - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public interface IEnergyNet { - /** - * Get the EnergyNet-registered tile entity at the specified position. - * - * This is not the same as World.getBlockTileEntity(), it's possible to register delegate tile - * entities with the energy net which are different from what's actually in the world. Those - * delegates allow to use separate TileEntity objects just for the EnergyNet interfaces, - * simplifying cross-mod dependencies and multi-blocks. - * - * @param world World containing the tile entity - * @param x x-coordinate - * @param y y-coordinate - * @param z z-coordinate - * @return tile entity registered to the energy net or null if none is registered - */ - TileEntity getTileEntity(World world, int x, int y, int z); - - /** - * Get the EnergyNet-registered neighbor tile entity at the specified position. - * - * @param te TileEntity indicating the world and position to search from - * @param dir direction the neighbor is to be found - * @return neighbor tile entity registered to the energy net or null if none is registered - */ - TileEntity getNeighbor(TileEntity te, ForgeDirection dir); - - /** - * determine how much energy has been emitted by the EnergyEmitter specified - * - * @note call this twice with x ticks delay to get the avg. emitted power p = (call2 - call1) / x EU/tick - * - * @param tileEntity energy emitter - */ - long getTotalEnergyEmitted(TileEntity tileEntity); - - /** - * determine how much energy has been sunken by the EnergySink specified - * - * @note call this twice with x ticks delay to get the avg. sunken power p = (call2 - call1) / x EU/tick - * - * @param tileEntity energy emitter - */ - long getTotalEnergySunken(TileEntity tileEntity); - - /** - * Determine the typical power used by the specific tier, e.g. 128 eu/t for tier 2. - * - * @param tier tier - * @return power in eu/t - */ - int getPowerFromTier(int tier); -} diff --git a/src/main/java/ic2/api/energy/event/EnergyTileEvent.java b/src/main/java/ic2/api/energy/event/EnergyTileEvent.java deleted file mode 100644 index 94b1b4a1..00000000 --- a/src/main/java/ic2/api/energy/event/EnergyTileEvent.java +++ /dev/null @@ -1,23 +0,0 @@ -package ic2.api.energy.event; - -import net.minecraft.tileentity.TileEntity; - -import net.minecraftforge.event.world.WorldEvent; - -import ic2.api.energy.tile.IEnergyTile; - -/** - * Base class for energy net events, don't use it directly. - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public class EnergyTileEvent extends WorldEvent { - public final IEnergyTile energyTile; - - public EnergyTileEvent(IEnergyTile energyTile1) { - super(((TileEntity) energyTile1).worldObj); - - this.energyTile = energyTile1; - } -} - diff --git a/src/main/java/ic2/api/energy/event/EnergyTileLoadEvent.java b/src/main/java/ic2/api/energy/event/EnergyTileLoadEvent.java deleted file mode 100644 index bf019ae3..00000000 --- a/src/main/java/ic2/api/energy/event/EnergyTileLoadEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -package ic2.api.energy.event; - -import ic2.api.energy.tile.IEnergyTile; - -/** - * Event announcing new energy tiles. - * - * This event notifies subscribers of loaded energy tiles, e.g. after getting - * loaded through the chunk they are in or after being placed down by the - * player or another deployer mechanism. - * - * Every energy tile which wants to get connected to the IC2 Energy Network has - * to either post this event or alternatively call EnergyNet.addTileEntity(). - * - * You may use this event to build a static representation of energy tiles for - * your own energy grid implementation if you need to. It's not required if you - * always lookup energy paths on demand. - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public class EnergyTileLoadEvent extends EnergyTileEvent { - public EnergyTileLoadEvent(IEnergyTile energyTile1) { - super(energyTile1); - } -} - diff --git a/src/main/java/ic2/api/energy/event/EnergyTileUnloadEvent.java b/src/main/java/ic2/api/energy/event/EnergyTileUnloadEvent.java deleted file mode 100644 index 2b22ae31..00000000 --- a/src/main/java/ic2/api/energy/event/EnergyTileUnloadEvent.java +++ /dev/null @@ -1,27 +0,0 @@ -package ic2.api.energy.event; - -import ic2.api.energy.tile.IEnergyTile; - -/** - * Event announcing terminated energy tiles. - * - * This event notifies subscribers of unloaded energy tiles, e.g. after getting - * unloaded through the chunk they are in or after being destroyed by the - * player or another block pick/destruction mechanism. - * - * Every energy tile which wants to get disconnected from the IC2 Energy - * Network has to either post this event or alternatively call - * EnergyNet.removeTileEntity(). - * - * You may use this event to build a static representation of energy tiles for - * your own energy grid implementation if you need to. It's not required if you - * always lookup energy paths on demand. - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public class EnergyTileUnloadEvent extends EnergyTileEvent { - public EnergyTileUnloadEvent(IEnergyTile energyTile1) { - super(energyTile1); - } -} - diff --git a/src/main/java/ic2/api/energy/tile/IEnergyAcceptor.java b/src/main/java/ic2/api/energy/tile/IEnergyAcceptor.java deleted file mode 100644 index 8b1d75e1..00000000 --- a/src/main/java/ic2/api/energy/tile/IEnergyAcceptor.java +++ /dev/null @@ -1,27 +0,0 @@ -package ic2.api.energy.tile; - -import net.minecraft.tileentity.TileEntity; - -import net.minecraftforge.common.ForgeDirection; - -/** - * For internal/multi-block usage only. - * - * @see IEnergySink - * @see IEnergyConductor - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public interface IEnergyAcceptor extends IEnergyTile { - /** - * Determine if this acceptor can accept current from an adjacent emitter in a direction. - * - * The TileEntity in the emitter parameter is what was originally added to the energy net, - * which may be normal in-world TileEntity, a delegate or an IMetaDelegate. - * - * @param emitter energy emitter - * @param direction direction the energy is being received from - */ - boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction); -} - diff --git a/src/main/java/ic2/api/energy/tile/IEnergyConductor.java b/src/main/java/ic2/api/energy/tile/IEnergyConductor.java deleted file mode 100644 index 16965afe..00000000 --- a/src/main/java/ic2/api/energy/tile/IEnergyConductor.java +++ /dev/null @@ -1,53 +0,0 @@ -package ic2.api.energy.tile; - -/** - * Tile entities which conduct energy pulses without buffering (mostly cables) have to implement this - * interface. - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public interface IEnergyConductor extends IEnergyAcceptor, IEnergyEmitter { - /** - * Energy loss for the conductor in EU per block. - * - * @return Energy loss - */ - double getConductionLoss(); - - /** - * Amount of energy the insulation will handle before shocking nearby players and mobs. - * - * @return Insulation energy absorption in EU - */ - int getInsulationEnergyAbsorption(); - - /** - * Amount of energy the insulation will handle before it is destroyed. - * Ensure that this value is greater than the insulation energy absorption + 64. - * - * @return Insulation-destroying energy in EU - */ - int getInsulationBreakdownEnergy(); - - /** - * Amount of energy the conductor will handle before it melts. - * - * @return Conductor-destroying energy in EU - */ - int getConductorBreakdownEnergy(); - - /** - * Remove the conductor's insulation if the insulation breakdown energy was exceeded. - * - * @see #getInsulationBreakdownEnergy() - */ - void removeInsulation(); - - /** - * Remove the conductor if the conductor breakdown energy was exceeded. - * - * @see #getConductorBreakdownEnergy() - */ - void removeConductor(); -} - diff --git a/src/main/java/ic2/api/energy/tile/IEnergyEmitter.java b/src/main/java/ic2/api/energy/tile/IEnergyEmitter.java deleted file mode 100644 index 2379252c..00000000 --- a/src/main/java/ic2/api/energy/tile/IEnergyEmitter.java +++ /dev/null @@ -1,28 +0,0 @@ -package ic2.api.energy.tile; - -import net.minecraft.tileentity.TileEntity; - -import net.minecraftforge.common.ForgeDirection; - -/** - * For internal/multi-block usage only. - * - * @see IEnergySource - * @see IEnergyConductor - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public interface IEnergyEmitter extends IEnergyTile { - /** - * Determine if this emitter can emit energy to an adjacent receiver. - * - * The TileEntity in the receiver parameter is what was originally added to the energy net, - * which may be normal in-world TileEntity, a delegate or an IMetaDelegate. - * - * @param receiver receiver, may be an IMetaDelegate - * @param direction direction the receiver is from the emitter - * @return Whether energy should be emitted - */ - boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction); -} - diff --git a/src/main/java/ic2/api/energy/tile/IEnergySink.java b/src/main/java/ic2/api/energy/tile/IEnergySink.java deleted file mode 100644 index 9826d54e..00000000 --- a/src/main/java/ic2/api/energy/tile/IEnergySink.java +++ /dev/null @@ -1,46 +0,0 @@ -package ic2.api.energy.tile; - -import net.minecraftforge.common.ForgeDirection; - -/** - * Allows a tile entity (mostly a machine) to receive energy. - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public interface IEnergySink extends IEnergyAcceptor { - /** - * Determine how much energy the sink accepts. - * - * This value is unrelated to getMaxSafeInput(). - * - * Make sure that injectEnergy() does accepts energy if demandsEnergy() returns anything > 0. - * - * @return max accepted input in eu - */ - double demandedEnergyUnits(); - - /** - * Transfer energy to the sink. - * - * It's highly recommended to accept all energy by letting the internal buffer overflow to - * increase the performance and accuracy of the distribution simulation. - * - * @param directionFrom direction from which the energy comes from - * @param amount energy to be transferred - * @return Energy not consumed (leftover) - */ - double injectEnergyUnits(ForgeDirection directionFrom, double amount); - - /** - * Determine the amount of eu which can be safely injected into the specific energy sink without exploding. - * - * Typical values are 32 for LV, 128 for MV, 512 for HV and 2048 for EV. A value of Integer.MAX_VALUE indicates no - * limit. - * - * This value is unrelated to demandsEnergy(). - * - * @return max safe input in eu - */ - int getMaxSafeInput(); -} - diff --git a/src/main/java/ic2/api/energy/tile/IEnergySource.java b/src/main/java/ic2/api/energy/tile/IEnergySource.java deleted file mode 100644 index 1a8bc0a5..00000000 --- a/src/main/java/ic2/api/energy/tile/IEnergySource.java +++ /dev/null @@ -1,26 +0,0 @@ -package ic2.api.energy.tile; - -/** - * Allows a tile entity (mostly a generator) to emit energy. - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public interface IEnergySource extends IEnergyEmitter { - /** - * Energy output provided by the source this tick. - * This is typically Math.min(stored energy, max output/tick). - * - * @return Energy offered this tick - */ - double getOfferedEnergy(); - - /** - * Draw energy from this source's buffer. - * - * If the source doesn't have a buffer, this is a no-op. - * - * @param amount amount of EU to draw, may be negative - */ - void drawEnergy(double amount); -} - diff --git a/src/main/java/ic2/api/energy/tile/IEnergyTile.java b/src/main/java/ic2/api/energy/tile/IEnergyTile.java deleted file mode 100644 index 3938190a..00000000 --- a/src/main/java/ic2/api/energy/tile/IEnergyTile.java +++ /dev/null @@ -1,15 +0,0 @@ -package ic2.api.energy.tile; - -/** - * For internal usage only, base class for all energy tiles. - * - * @see IEnergySink - * @see IEnergySource - * @see IEnergyConductor - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public interface IEnergyTile { - // -} - diff --git a/src/main/java/ic2/api/energy/tile/IMetaDelegate.java b/src/main/java/ic2/api/energy/tile/IMetaDelegate.java deleted file mode 100644 index 8f4e830c..00000000 --- a/src/main/java/ic2/api/energy/tile/IMetaDelegate.java +++ /dev/null @@ -1,34 +0,0 @@ -package ic2.api.energy.tile; - -import java.util.List; - -import net.minecraft.tileentity.TileEntity; - -/** - * Interface for grouping multi-block structures to a single energy net delegate. - * - * The energy net uses TileEntity to refer to a specific xyz+world position. If multiple of those - * positions should belong to the same functional structure, i.e. they consume or produce energy - * only once for the whole multi-block instead of once per every single block, this interface - * allows to do so. - * - * The tile entity implementing IMetaDelegate has to be added/removed to/from the energy net - * instead of every single sub-TileEntity. The energy net interaction will be handled by the - * IMetaDelegate TileEntity as well. - * - * The sub tile array TileEntity[] just provides optional connectivity (IEnergyAcceptor, - * IEnergyEmitter) and mandatory position (x, y, z, World) data. - * If the connectivity data on the sub tile is missing, the meta delegate is queried instead. - * - * See ic2/api/energy/usage.txt for an overall description of the energy net api. - */ -public interface IMetaDelegate extends IEnergyTile { - /** - * Get the sub-TileEntities belonging to this Meta TileEntity. - * - * @note the list has to be consistent between the EnergyNet Load and Unload events. - * - * @return sub-TileEntity array - */ - List getSubTiles(); -} diff --git a/src/main/java/ic2/api/energy/usage.txt b/src/main/java/ic2/api/energy/usage.txt deleted file mode 100644 index 49bd9955..00000000 --- a/src/main/java/ic2/api/energy/usage.txt +++ /dev/null @@ -1,144 +0,0 @@ --------------------------------- --- Energy Network Description -- --------------------------------- - -There are currently three different types of energy network blocks: -- energy sources, e.g. generators or the output side of a storage block/transformer -- energy sinks, e.g. machines or the input side of a storage block/transformer -- conductors, e.g. cables - -Note that storage blocks or transformers are both sources and sinks. - -All those blocks have to have a tile entity which has to implement the interface corresponding to -its function and also post events to the Forge event bus. - -The energy generation, distribution and consumption is strictly limited to the simulating (server) -side, use the proper side checks before posting the related events. One possibility is to check for -FMLCommonHandler.instance().getEffectiveSide().isClient() being false. - -The energy network works by calculating the energy flow between the sources which offer energy -through getOfferedEnergy() and the sinks which request energy through demandedEnergyUnits(). -Conductors will carry the energy over a distance. Once the energy distribution is calculated, the -energy net will update the sources and sinks through drawEnergy() and injectEnergyUnits() respectively. - - ---------------------------- --- Energy Network Events -- ---------------------------- - -The energy network currently requires 2 events to manage its internal representation of the grids: - --- EnergyTileLoadEvent -- - -For all energy network tiles (sources, sinks, conductors) you have to post an EnergyTileLoadEvent. - -The event has to be posted as soon as the implementing tile entity is fully loaded, usually after -loading the chunk which contains it or after the user placing the block. - -The energy net implementation will use the event to add it to its energy grid map, taking it into -account for further energy transfers. - -You can detect the loading by either using the 1st iteration of updateEntity() or by waiting for -the next world tick after TileEntity.validate(). The 2nd approach is obviously more sophisticated -and requires to use some tick queuing mechanism. - -The event can by posted as following: - MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); - --- EnergyTileUnloadEvent -- - -Another event every energy tile has to post is the EnergyTileUnloadEvent. - -The event has to be posted as soon as the implementing tile entity is being unloaded, either by -unloading the containing chunk or by destroying the block containing it. - -It's possible to detect the unloading by triggering on both the beginning of -TileEntity.invalidate() and the beginning of TileEntity.onChunkUnload(). - -It is important that the tile entity is still properly linked to the world while posting the unload -event, otherwise the energy net can't find all affected connections. - - --------------------------------------- --- Participating Block Requirements -- --------------------------------------- - -The energy net blocks have to do the following to work properly: - --- energy source -- - -An energy source has to post the following events: - - EnergyTileLoadEvent on load - - EnergyTileUnloadEvent on unload - -Additionally the interface IEnergySource has to be implemented. - --- energy sink -- - -An energy sink has to post the following events: - - EnergyTileLoadEvent on load - - EnergyTileUnloadEvent on unload - -Additionally the interface IEnergySink has to be implemented. - --- energy conductor -- - -An energy conductor has to post the following events: - - EnergyTileLoadEvent on load - - EnergyTileUnloadEvent on unload - -Additionally the interface IEnergyConductor has to be implemented. - - ------------------------------- --- Energy Network Delegates -- ------------------------------- - -A delegate is a separate object which performs tasks for the original object, in this case handling -the energy net interaction. - -The TileEntity instances used by the events don't have to be the same as the in-world TileEntity -instance for the corresponding position, it can be delegated to a separate TileEntity instance. -This separate instance (delegate) needs to have its world and xyz coordinate fields set to match -the in-world instance. The delegate implements the energy net interfaces and is added and removed -to/from the energy net through EnergyTileLoadEvent and EnergyTileUnloadEvent. - -Separating the interfaces through a delegate allows to isolate the IC2 API usage into separate -classes an potentially share common code like an input buffer with battery discharging outside the -class hierarchy. -It's even possible to use an ic2 energy net delegate alongside an in-world TileEntity which isn't -designed to work with ic2 energy at all, like making a furnace electric by receiving energy through -a delegate and adding the corresponding fuel amount to the in-world furnace TileEntity. - -Getting the in-world TileEntity for a delegate involves calling World.getBlockTileEntity() with the -delegate's world and xyz coordinate information. - - ------------------- --- Multi Blocks -- ------------------- - -Multi blocks are a group of blocks which act as one functional entity. - -The IMetaDelegate interface groups multiple TileEntity instances (=sub tiles) representing the -individual blocks to a single Energy Net relevant node. The sub tiles may be normal in-world or -delegate TileEntity instances. - -The meta delegate is added to energy net once for the whole multi block structure and implements -the energy net interfaces as well. The sub tiles may optionally implement IEnergyEmitter and/or -IEnergyAcceptor to specify their connectivity rules independently, otherwise the meta delegate will -be queried. - - --------------------------------------------------- --- How to implement/add your own energy network -- --------------------------------------------------- - -If you want to create an alternative way of distributing energy, e.g. to have different -distribution rules or to use energy networks provided by other mods, you can register to the energy -tile events and use the interfaces to handle the energy distribution yourself. It's no longer -required to use conversion blocks. - -IC2's EnergyNet itself is built on top of the api events and interfaces, providing their default -use case. - diff --git a/src/main/java/ic2/api/item/IBoxable.java b/src/main/java/ic2/api/item/IBoxable.java deleted file mode 100644 index 6214662c..00000000 --- a/src/main/java/ic2/api/item/IBoxable.java +++ /dev/null @@ -1,14 +0,0 @@ -package ic2.api.item; - -import net.minecraft.item.ItemStack; - -public interface IBoxable -{ - /** - * Determine whether an item can be stored in a toolbox or not. - * - * @param itemstack item to be stored - * @return Whether to store the item in the toolbox or not - */ - public abstract boolean canBeStoredInToolbox (ItemStack itemstack); -} diff --git a/src/main/java/ic2/api/item/ICustomElectricItem.java b/src/main/java/ic2/api/item/ICustomElectricItem.java deleted file mode 100644 index a65b4b29..00000000 --- a/src/main/java/ic2/api/item/ICustomElectricItem.java +++ /dev/null @@ -1,68 +0,0 @@ -package ic2.api.item; - -import net.minecraft.item.ItemStack; - -/** - * Provides the ability to store energy on the implementing item. - * - * This interface is a special version of IElectricItem which delegates the implementation of - * charge(), discharge() and canUse() to the implementing Item. - * - * The default implementation (when not using ICustomElectricItem) does the following: - * - store and retrieve the charge - * - handle charging, taking amount, tier, transfer limit, canProvideEnergy and simulate into account - * - replace item IDs if appropriate (getChargedItemId() and getEmptyItemId()) - * - update and manage the damage value for the visual charge indicator - * - * @note ICustomElectricItem must not call the ElectricItem methods charge, discharge or canUse - * - * @deprecated Use ISpecialElectricItem instead. - */ -@Deprecated -public interface ICustomElectricItem extends IElectricItem -{ - /** - * Charge an item with a specified amount of energy - * - * @param itemStack electric item's stack - * @param amount amount of energy to charge in EU - * @param tier tier of the charging device, has to be at least as high as the item to charge - * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() - * @param simulate don't actually change the item, just determine the return value - * @return Energy transferred into the electric item - */ - public int charge (ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate); - - /** - * Discharge an item by a specified amount of energy - * - * @param itemStack electric item's stack - * @param amount amount of energy to charge in EU - * @param tier tier of the discharging device, has to be at least as high as the item to discharge - * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() - * @param simulate don't actually discharge the item, just determine the return value - * @return Energy retrieved from the electric item - */ - public int discharge (ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate); - - /** - * Determine if the specified electric item has at least a specific amount of EU. - * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. - * BatPacks are not taken into account. - * - * @param itemStack electric item's stack - * @param amount minimum amount of energy required - * @return true if there's enough energy - */ - public boolean canUse (ItemStack itemStack, int amount); - - /** - * Determine whether to show the charge tool tip with NEI or other means. - * - * Return false if IC2's handler is incompatible, you want to implement your own or you don't - * want to display the charge at all. - * - * @return true to show the tool tip (x/y EU) - */ - public boolean canShowChargeToolTip (ItemStack itemStack); -} diff --git a/src/main/java/ic2/api/item/IElectricItem.java b/src/main/java/ic2/api/item/IElectricItem.java deleted file mode 100644 index 2b7fcce7..00000000 --- a/src/main/java/ic2/api/item/IElectricItem.java +++ /dev/null @@ -1,54 +0,0 @@ -package ic2.api.item; - -import net.minecraft.item.ItemStack; - -/** - * Provides the ability to store energy on the implementing item. - * - * The item should have a maximum damage of 13. - */ -public interface IElectricItem -{ - /** - * Determine if the item can be used in a machine or as an armor part to supply energy. - * - * @return Whether the item can supply energy - */ - boolean canProvideEnergy (ItemStack itemStack); - - /** - * Get the item ID to use for a charge energy greater than 0. - * - * @return Item ID to use - */ - int getChargedItemId (ItemStack itemStack); - - /** - * Get the item ID to use for a charge energy of 0. - * - * @return Item ID to use - */ - int getEmptyItemId (ItemStack itemStack); - - /** - * Get the item's maximum charge energy in EU. - * - * @return Maximum charge energy - */ - int getMaxCharge (ItemStack itemStack); - - /** - * Get the item's tier, lower tiers can't send energy to higher ones. - * Batteries are Tier 1, Energy Crystals are Tier 2, Lapotron Crystals are Tier 3. - * - * @return Item's tier - */ - int getTier (ItemStack itemStack); - - /** - * Get the item's transfer limit in EU per transfer operation. - * - * @return Transfer limit - */ - int getTransferLimit (ItemStack itemStack); -} diff --git a/src/main/java/ic2/api/item/IElectricItemManager.java b/src/main/java/ic2/api/item/IElectricItemManager.java deleted file mode 100644 index cdfb49e5..00000000 --- a/src/main/java/ic2/api/item/IElectricItemManager.java +++ /dev/null @@ -1,93 +0,0 @@ -package ic2.api.item; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; - -/** - * This interface specifies a manager to handle the various tasks for electric items. - * - * The default implementation does the following: - * - store and retrieve the charge - * - handle charging, taking amount, tier, transfer limit, canProvideEnergy and simulate into account - * - replace item IDs if appropriate (getChargedItemId() and getEmptyItemId()) - * - update and manage the damage value for the visual charge indicator - * - * @note If you're implementing your own variant (ISpecialElectricItem), you can delegate to the - * default implementations through ElectricItem.rawManager. The default implementation is designed - * to minimize its dependency on its own constraints/structure and delegates most work back to the - * more atomic features in the gateway manager. - */ -public interface IElectricItemManager -{ - /** - * Charge an item with a specified amount of energy - * - * @param itemStack electric item's stack - * @param amount amount of energy to charge in EU - * @param tier tier of the charging device, has to be at least as high as the item to charge - * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() - * @param simulate don't actually change the item, just determine the return value - * @return Energy transferred into the electric item - */ - int charge (ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate); - - /** - * Discharge an item by a specified amount of energy - * - * @param itemStack electric item's stack - * @param amount amount of energy to charge in EU - * @param tier tier of the discharging device, has to be at least as high as the item to discharge - * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() - * @param simulate don't actually discharge the item, just determine the return value - * @return Energy retrieved from the electric item - */ - int discharge (ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate); - - /** - * Determine the charge level for the specified item - * - * @param itemStack ItemStack containing the electric item - * @return charge level in EU - */ - int getCharge (ItemStack itemStack); - - /** - * Determine if the specified electric item has at least a specific amount of EU. - * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. - * BatPacks are not taken into account. - * - * @param itemStack electric item's stack - * @param amount minimum amount of energy required - * @return true if there's enough energy - */ - boolean canUse (ItemStack itemStack, int amount); - - /** - * Try to retrieve a specific amount of energy from an Item, and if applicable, a BatPack. - * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. - * - * @param itemStack electric item's stack - * @param amount amount of energy to discharge in EU - * @param entity entity holding the item - * @return true if the operation succeeded - */ - boolean use (ItemStack itemStack, int amount, EntityLivingBase entity); - - /** - * Charge an item from the BatPack a player is wearing. - * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. - * use() already contains this functionality. - * - * @param itemStack electric item's stack - * @param entity entity holding the item - */ - void chargeFromArmor (ItemStack itemStack, EntityLivingBase entity); - - /** - * Get the tool tip to display for electric items. - * - * @param itemStack ItemStack to determine the tooltip for - * @return tool tip string or null for none - */ - String getToolTip (ItemStack itemStack); -} diff --git a/src/main/java/ic2/api/item/ISpecialElectricItem.java b/src/main/java/ic2/api/item/ISpecialElectricItem.java deleted file mode 100644 index 86916eef..00000000 --- a/src/main/java/ic2/api/item/ISpecialElectricItem.java +++ /dev/null @@ -1,14 +0,0 @@ -package ic2.api.item; - -import net.minecraft.item.ItemStack; - -public interface ISpecialElectricItem extends IElectricItem -{ - /** - * Supply a custom IElectricItemManager. - * - * @param itemStack ItemStack to get the manager for - * @return IElectricItemManager instance - */ - IElectricItemManager getManager (ItemStack itemStack); -} diff --git a/src/main/java/ic2/api/item/Items.java b/src/main/java/ic2/api/item/Items.java deleted file mode 100644 index 1b7ed558..00000000 --- a/src/main/java/ic2/api/item/Items.java +++ /dev/null @@ -1,609 +0,0 @@ -package ic2.api.item; - -import net.minecraft.item.ItemStack; - -/** - * Provides access to IC2 blocks and items. - * - * Some items can be acquired through the ore dictionary which is the recommended way. - * The items are initialized while IC2 is being loaded - try to use ModsLoaded() or load your mod after IC2. - * Some blocks/items can be disabled by a config setting, so it's recommended to check if they're null first. - * - * Getting the associated Block/Item for an ItemStack x: - * Blocks: Block.blocksList[x.itemID] - * Items: x.getItem() - */ -public final class Items -{ - /** - * Get an ItemStack for a specific item name, example: Items.getItem("resin") - * See the list below for item names. - * Make sure to copy() the ItemStack if you want to modify it. - * - * @param name item name - * @return The item or null if the item does not exist or an error occurred - */ - public static ItemStack getItem (String name) - { - try - { - if (Ic2Items == null) - Ic2Items = Class.forName(getPackage() + ".core.Ic2Items"); - - Object ret = Ic2Items.getField(name).get(null); - - if (ret instanceof ItemStack) - { - return (ItemStack) ret; - } - else - { - return null; - } - } - catch (Exception e) - { - System.out.println("IC2 API: Call getItem failed for " + name); - - return null; - } - } - - /* Possible values: - - // ores - copperOre; // Copper Ore block, currently not meta sensitive, meta in ItemStack set to 0, ore dictionary: oreCopper, null with enableWorldGenOreCopper=false - tinOre; // Tin Ore block, currently not meta sensitive, meta in ItemStack set to 0, ore dictionary: oreTin, null with enableWorldGenOreTin=false - uraniumOre; // Tin Ore block, currently not meta sensitive, meta in ItemStack set to 0, ore dictionary: oreUranium, null with enableWorldGenOreUranium=false - leadOre; // Lead Ore Block, currently not meta sensitive, meta in ItemStack set to 0, ore dictionary: oreLead, null with enableWorldGenOreLead=false - - // rubber related - - Rubber wood block, meta reflects the state, meta in ItemStack set to 0, ore dictionary: woodRubber (with meta 0), null with enableWorldGenTreeRubber=false - dropped (as an item) -> metadata 0 - block, no resin spot -> metadata 0 or 1 - block, wet resin spot -> metadata 2-5 (according to the side) - block, dry resin spot -> metadata 8-11 (wet state + 6) - - rubberWood; - rubberLeaves; // Rubber Leaves block, currently not meta sensitive, meta in ItemStack set to 0, null with enableWorldGenTreeRubber=false - rubberSapling; // Rubber Sapling block, currently not meta sensitive, meta in ItemStack set to 0, null with enableWorldGenTreeRubber=false - resinSheet; // Resin Sheet block, currently not meta sensitive - rubberTrampoline; // Rubber Trampoline block, meta reflects internal state, meta in ItemStack set to 0 - - // building/storage - ironFence; // Iron Fence block, currently not meta sensitive - - reinforcedStone; // Reinforced Stone block, currently not meta sensitive - reinforcedGlass; // Reinforced Glass block, currently not meta sensitive - reinforcedDoorBlock; // Reinforced Door block, meta reflects the state (see vanilla doors), meta in ItemStack set to 0 - - constructionreinforcedFoam; // Construction Reinforced Foam block, currently not meta sensitive - constructionFoam; // Construction Foam block, currently not meta sensitive - constructionFoamWall; // Construction Foam Wall block, meta = color, implements IPaintableBlock - scaffold; // Scaffold block, meta reflects internal physical model data - ironScaffold; // Scaffold block, meta reflects internal physical model data - - bronzeBlock; // Bronze block, meta sensitive - copperBlock; // Copper block, meta sensitive - tinBlock; // Tin block, meta sensitive - uraniumBlock; // Uranium block, meta sensitive - leadBlock; // Uranium block, meta sensitive - - // cables (when placed as a block, inventory items are different; TE implements IEnergyConductor) - - copperCableBlock; // Copper Cable block, meta sensitive - insulatedCopperCableBlock; // Insulated Copper Cable block, meta sensitive - - goldCableBlock; // Gold Cable block, meta sensitive - insulatedGoldCableBlock; // Insulated Gold Cable block, meta sensitive - doubleInsulatedGoldCableBlock; // Double Insulated Gold Cable block, meta sensitive - - ironCableBlock; // Iron Cable block, meta sensitive - insulatedIronCableBlock; // Insulated Iron Cable block, meta sensitive - doubleInsulatedIronCableBlock; // Double Insulated Iron Cable block, meta sensitive - trippleInsulatedIronCableBlock; // Tripple Insulated Iron Cable block, meta sensitive - - glassFiberCableBlock; // Glass Fiber Cable block, meta sensitive - - tinCableBlock; // Tin Cable block, meta sensitive - insulatedtinCableBlock; // Insulated Tin Cable item, meta sensitive - detectorCableBlock; // Detector Cable block, meta sensitive - splitterCableBlock; // Splitter Cable block, meta sensitive - - // generators + related (TE implements IEnergySource ex. reactorChamber) - - generator; // Generator block, meta sensitive - geothermalGenerator; // Geothermal Generator block, meta sensitive - waterMill; // Water Mill block, meta sensitive - solarPanel; // Solar Panel block, meta sensitive - windMill; // Wind Mill block, meta sensitive - nuclearReactor; // Nuclear Reactor block, meta sensitive - reactorChamber; // Reactor Chamber block, currently not meta sensitive - RTGenerator; // Radioisotope Thermoelectric Generator block, meta sensitive - semifluidGenerator; // Semifluid Generator block, meta sensitive - - - // energy storages (TE implements IEnergySource and IEnergyConductor) - - batBox; // BatBox block, meta sensitive - cesuUnit; // CESU Unit block, meta sensitive - mfeUnit; // MFE Unit block, meta sensitive - mfsUnit; // MFS Unit block, meta sensitive - - // transformers (TE implements IEnergySource and IEnergyConductor) - - lvTransformer; // LV Transformer block, meta sensitive - mvTransformer; // MV Transformer block, meta sensitive - hvTransformer; // HV Transformer block, meta sensitive - evTransformer; // EV Transformer block, meta sensitive - - // machines + related (TE implements IEnergySink ex. machine, miningPipe, miningPipeTip) - - machine; // Machine block, meta sensitive - advancedMachine; // Advanced Machine block, meta sensitive - - ironFurnace; // Iron Furnace block, meta sensitive - electroFurnace; // Electro Furnace block, meta sensitive - macerator; // Macerator block, meta sensitive - extractor; // Extractor block, meta sensitive - compressor; // Compressor block, meta sensitive - canner; // Canner block, meta sensitive - miner; // Miner block, meta sensitive - pump; // Pump block, meta sensitive - magnetizer; // Magnetizer block, meta sensitive - electrolyzer; // Electrolyzer block, meta sensitive - recycler; // Recycler block, meta sensitive - inductionFurnace; // Induction Furnace block, meta sensitive - massFabricator; // Mass Fabricator block, meta sensitive - terraformer; // Terraformer block, meta sensitive - teleporter; // Teleporter block, meta sensitive - teslaCoil; // Tesla Coil block, meta sensitive - luminator; // Passive (dark) Luminator block, meta = facing - activeLuminator; // Active (bright) Luminator block, meta = facing - centrifuge; // Centrifuge block, meta sensitive - metalformer; // MetalFormer block ,meta sensitive - orewashingplant; // Ore Wasching Plant,Meta sensitive - patternstorage; // Pattern Storage,Meta sensitive - scanner; // Scanner,Meta sensitive - replicator; // Replicator,Meta sensitive - - miningPipe; // Mining Pipe block, currently not meta sensitive, meta in ItemStack set to 0 - miningPipeTip; // Mining Pipe Tip block, currently not meta sensitive, meta in ItemStack set to 0 - - - // personal blocks - - personalSafe; // Personal Safe block, meta sensitive - tradeOMat; // Trade-O-Mat block, meta sensitive - energyOMat; // Energy-O-Mat block, meta sensitive - - // explosives - - industrialTnt; // Industrial TNT block, currently not meta sensitive - nuke; // Nuke block, currently not meta sensitive - dynamiteStick; // Dynamite Stick block, meta = placement, meta in ItemStack set to 0 - dynamiteStickWithRemote; // Dynamite Stick with Remote block, meta = placement, meta in ItemStack set to 0 - - // Agriculture Stuff - - crop; // Crop Block, empty, not meta sensitive - cropmatron; // Cropmatron machien block, meta sensititve - - // ----- items ----- - - // rubber + related - resin; // Resin item, currently not meta sensitive - rubber; // Rubber item, currently not meta sensitive, ore dictionary: itemRubber - - FluidCell; - - // Lithium -> Tritium - - reactorLithiumCell; // LithiumCell use in Reaktor, , meta = damage value - TritiumCell; // Tritium, currently not meta sensitive - - // Nuclear Fuel - - UranFuel; // , currently not meta sensitive - MOXFuel; // , currently not meta sensitive - Plutonium; // , currently not meta sensitive - smallPlutonium; // , currently not meta sensitive - Uran235; // , currently not meta sensitive - smallUran235; // , currently not meta sensitive - Uran238; // , currently not meta sensitive - - reactorDepletedUraniumSimple; // Depleted Uranium Cell items, currently not meta sensitive - reactorDepletedUraniumDual; - reactorDepletedUraniumQuad; - reactorDepletedMOXSimple; // Depleted MOX Cell items, currently not meta sensitive - reactorDepletedMOXDual; - reactorDepletedMOXQuad; - reactorMOXSimple; // Depleted MOX Cell items, currently not meta sensitive - reactorMOXDual; - reactorMOXQuad; - RTGPellets; - - - // Recipe Parts - - coil; // Coil, meta sensitive - elemotor; // electric motor, meta sensitive - powerunit; // Item Power Unit, meta sensitive - powerunitsmall; // Item Power Unit, meta sensitive - - - // ItemCasing - - casingcopper; // Copper ItemCasing, meta sensitive - casingtin; // Tin ItemCasing, meta sensitive - casingbronze; // Bronze ItemCasing, meta sensitive - casinggold; // Gold ItemCasing, meta sensitive - casingiron; // Iron ItemCasing, meta sensitive - @Deprecated - casingadviron; // Refined Iron ItemCasing, meta sensitive - casinglead; // Lead ItemCasing, meta sensitive - - // Crushed Ore - crushedIronOre; // Crushed Iron Ore, meta sensitive - crushedCopperOre; // Crushed Copper Ore, meta sensitive - crushedGoldOre; // Crushed Gold Ore, meta sensitive - crushedTinOre; // Crushed Tin Ore, meta sensitive - crushedUraniumOre; // Crushed Uranium Ore, meta sensitive - crushedSilverOre; // Crushed Silver Ore, meta sensitive - crushedLeadOre; // Crushed Lead Ore, meta sensitive - - - //Purify Crushed Ore - purifiedCrushedIronOre; // Purify Crushed Iron Ore, meta sensitive - purifiedCrushedCopperOre; // Purify Crushed Copper Ore, meta sensitive - purifiedCrushedGoldOre; // Purify Crushed Gold Ore, meta sensitive - purifiedCrushedTinOre; // Purify Crushed Tin Ore, meta sensitive - purifiedCrushedUraniumOre; // Purify Crushed Uranium Ore, meta sensitive - purifiedCrushedSilverOre; // Purify Crushed Silver Ore, meta sensitive - purifiedCrushedLeadOre; // Purify Crushed Lead Ore, meta sensitive - - // dusts - stoneDust; - bronzeDust; // Bronze Dust item, meta sensitive, ore dictionary: dustBronze - clayDust; // Clay Dust item, meta sensitive, ore dictionary: dustClay - coalDust; // Coal Dust item, meta sensitive, ore dictionary: dustCoal - copperDust; // Copper Dust item, meta sensitive, ore dictionary: dustCopper - goldDust; // Gold Dust item, meta sensitive, ore dictionary: dustGold - ironDust; // Iron Dust item, meta sensitive, ore dictionary: dustIron - silverDust; // Silver Dust item, meta sensitive, ore dictionary: dustSilver - tinDust; // Tin Dust item, meta sensitive, ore dictionary: dustTin - hydratedCoalDust; // Hydrated Coal Dust item, meta sensitive - leadDust; // Lead Dust item, meta sensitive, ore dictionary: dustLead - obsidianDust; // Obsidian Dust item, meta sensitive, ore dictionary: dustObsidian - lapiDust; // Lapi Dust item, meta sensitive, ore dictionary: dustLapi - sulfurDust; // Sulfur Dust item, meta sensitive, ore dictionary: dustSulfur - lithiumDust; // Lithium dust, meta sensitive, ore dictionary: dustLithium - - // small dusts - - smallIronDust; // Small Iron Dust item, meta sensitive - smallCopperDust; // Small Copper Dust item, meta sensitive - smallGoldDust; // Small Gold Dust item, meta sensitive - smallTinDust; // Small Tin Dust item, meta sensitive - smallSilverDust; // Small Silver Dust item, meta sensitive - smallLeadDust; // Small Lead Dust item, meta sensitive - smallSulfurDust; // Small Sulfur Dust item, meta sensitive - smallLithiumDust; // Small Lithium Dust item, meta sensitive - - - // ingots - @Deprecated - refinedIronIngot; // Refined Iron Ingot item, currently not meta sensitive, ore dictionary: ingotRefinedIron - copperIngot; // Copper Ingot item, currently not meta sensitive, ore dictionary: ingotCopper - tinIngot; // Tin Ingot item, currently not meta sensitive, ore dictionary: ingotTin - bronzeIngot; // Bronze Ingot item, currently not meta sensitive, ore dictionary: ingotBronze - mixedMetalIngot; // Mixed Metal Ingot item, currently not meta sensitive - leadIngot; // Lead Ingot item, currently not meta sensitive - - - // tools/weapons (without electric tools) - treetap; // Treetap item, meta = damage value - wrench; // Wrench item, meta = damage value - cutter; // Insulation Cutter item, meta = damage value - constructionFoamSprayer; // Construction Foam Sprayer item, meta = charges (as of v1.45) - - bronzePickaxe; // Bronze Pickaxe item, meta = damage value - bronzeAxe; // Bronze Axe item, meta = damage value - bronzeSword; // Bronze Sword item, meta = damage value - bronzeShovel; // Bronze Shovel item, meta = damage value - bronzeHoe; // Bronze Hoe item, meta = damage value - - ForgeHammer; // Refine Iron Hammer item, meta = damage value - - // el. tools/devices/weapons - miningDrill; // Mining Drill item, meta = damage value for charge level - diamondDrill; // Diamond Tipped Mining Drill item, meta = damage value for charge level - chainsaw; // Chainsaw item, meta = damage value for charge level - electricWrench; // Electric Wrench item, meta = damage value for charge level - electricTreetap; // Electric Treetap item, meta = damage value for charge level - miningLaser; // Mining Laser item, meta = damage value for charge level - - ecMeter; // EC-Mater item, meta = itemdata db index (as of v1.45) - odScanner; // Ore Density Scanner item, meta = damage value for charge level - ovScanner; // Ore Value Scanner item, meta = damage value for charge level - obscurator; // Obscurator item, meta = damage value for charge level - - frequencyTransmitter; // Frequency Transmitter item, meta = itemdata db index (as of v1.45) - - nanoSaber; // Idle Nano Saber item, meta = damage value for charge level - enabledNanoSaber; // Enabled Nano Saber item, meta = damage value for charge level - - toolbox; // Open/Empty toolbox, meta = Open (0) / Closed (1) - - // armor/wearable - hazmatHelmet; // Hazmat Helmet item, meta = damage value - hazmatChestplate; // Hazmat Chestplate item, meta = damage value - hazmatLeggings; // Hazmat Leggings item, meta = damage value - hazmatBoots; // Hazmat Boots item, meta = damage value - - bronzeHelmet; // Bronze Helmet Armor item, meta = damage value - bronzeChestplate; // Bronze Chestplate Armor item, meta = damage value - bronzeLeggings; // Bronze Leggings Armor item, meta = damage value - bronzeBoots; // Bronze Boots Armor item, meta = damage value - - compositeArmor; // Composite Armor item, meta = damage value for charge level - - nanoHelmet; // Nano Helmet Armor item, meta = damage value for charge level - nanoBodyarmor; // Nano Bodyarmor item, meta = damage value for charge level - nanoLeggings; // Nano Leggings Armor item, meta = damage value for charge level - nanoBoots; // Nano Boots Armor item, meta = damage value for charge level - - quantumHelmet; // Quantum Helmet Armor item, meta = damage value for charge level - quantumBodyarmor; // Quantum Bodyarmor item, meta = damage value for charge level - quantumLeggings; // Quantum Leggings Armor item, meta = damage value for charge level - quantumBoots; // Quantum Boots Armor item, meta = damage value for charge level - - jetpack; // Jetpack item, meta = damage value for fuel level - electricJetpack; // Electric Jetpack item, meta = damage value for charge level - - batPack; // BatPack item, meta = damage value for charge level - advbatPack; // Adv.BatPack item, meta = damage value for charge level - lapPack; // LapPack item, meta = damage value for charge level - energyPack; // EnergyPack item, meta = damage value for charge level - - cfPack; // CF Pack item, meta = charges (as of v1.45) - solarHelmet; // Solar Helmet, currently not meta sensitive - staticBoots; // Static Boots, currently not meta sensitive - nightvisionGoggles; // Nightvision Goggles, meta = damage value for charge level - - // batteries - reBattery; // Empty RE Battery item, currently not meta sensitive - chargedReBattery; // RE Battery item, meta = damage value for charge level - advBattery; // Adv Batteryitem, meta = damage value for charge level - energyCrystal; // Energy Crystal item, meta = damage value for charge level - lapotronCrystal; // Lapotron Crystal item, meta = damage value for charge level - suBattery; // SU Battery item, meta = damage value for charge level - - // cables - copperCableItem; // Copper Cable item, meta sensitive - insulatedCopperCableItem; // Insulated Copper Cable item, meta sensitive - - goldCableItem; // Gold Cable item, meta sensitive - insulatedGoldCableItem; // Insulated Gold Cable item, meta sensitive - - @Deprecated - doubleInsulatedGoldCableItem; // Double Insulated Gold Cable item, meta sensitive - - ironCableItem; // Iron Cable item, meta sensitive - insulatedIronCableItem; // Insulated Iron Cable item, meta sensitive - - @Deprecated - doubleInsulatedIronCableItem; // Double Insulated Iron Cable item, meta sensitive - @Deprecated - trippleInsulatedIronCableItem; // Tripple Insulated Iron Cable item, meta sensitive - insulatedTinCableItem; - glassFiberCableItem; // Glass Fiber Cable item, meta sensitive - tinCableItem; // Tin Cable item, meta sensitive - - - detectorCableItem; // Detector Cable item, meta sensitive - splitterCableItem; // Splitter Cable item, meta sensitive - - // cells/containers (without reactor components) - - cell; // Empty Cell item, meta sensitive - lavaCell; // Lava Cell item, meta sensitive - waterCell; // Water Cell item, meta sensitive - UuMatterCell; // UUMatter Cell item, meta sensitive - CFCell; // constructionFoam Cell item, meta sensitive - - - fuelRod; // Empy Fuel Rod item, currently not meta sensitive - hydratedCoalCell; // Hydrated Coal Cell item, currently not meta sensitive - bioCell; // Bio Cell item, currently not meta sensitive - coalfuelCell; // Coalfuel Cell item, currently not meta sensitive - biofuelCell; // Biofuel Cell item, currently not meta sensitive - electrolyzedWaterCell; // Electrolyzed Water Cell item, currently not meta sensitive - airCell; // Compressed Air item, currently not meta sensitive - - fuelCan; // Empty Fuel Can item, currently not meta sensitive - filledFuelCan; // Fuel Can item, meta = fuel value (as of v1.45) - - tinCan; // Empty Tin Can item, currently not meta sensitive - filledTinCan; // Filled Tin Can item, currently not meta sensitive - - // reactor components - reactorUraniumSimple; // Uranium Cell items, meta = consumed uranium ticks - reactorUraniumDual; - reactorUraniumQuad; - - reactorCoolantSimple; - reactorCoolantTriple ; // Coolant Cell item, NBT for heat-storage, meta is 0-10000 for display - reactorCoolantSix; - - reactorPlating; // Integrated Reactor Plating item, currently not meta sensitive - reactorPlatingHeat; - reactorPlatingExplosive; - - reactorHeatSwitch; // Integrated Heat Disperser item, NBT for heat-storage, meta is 0-10000 for display - reactorHeatSwitchCore; - reactorHeatSwitchSpread; - reactorHeatSwitchDiamond; - - reactorVent; // Heat Venting component, NBT for heat-storage, meta is 0-10000 for display - reactorVentCore; - reactorVentGold; - reactorVentSpread;// Special: Does not store heat - reactorVentDiamond; - - reactorReflector; // Increase efficiency without additional ticks, NBT for heat-storage, meta is 0-10000 for display - reactorReflectorThick; // Increase efficiency without additional ticks, NBT for heat-storage, meta is 0-10000 for display - reactorCondensator; // Consumes redstone to absorb heat, NBT for storage, meta is 0-10000 for display - reactorCondensatorLap; // Consumes redstone/lapis to absorb heat, mNBT for storage, meta is 0-10000 for display - - // terraformer blueprints - terraformerBlueprint; // Empty Terraformer Blueprint item, currently not meta sensitive - cultivationTerraformerBlueprint; // Cultivation Terraformer Blueprint item, currently not meta sensitive - irrigationTerraformerBlueprint; // Irrigation Terraformer Blueprint item, currently not meta sensitive - chillingTerraformerBlueprint; // Chilling Terraformer Blueprint item, currently not meta sensitive - desertificationTerraformerBlueprint; // Desertification Terraformer Blueprint item, currently not meta sensitive - flatificatorTerraformerBlueprint; // Flatificator Terraformer Blueprint item, currently not meta sensitive - mushroomTerraformerBlueprint; // Mushroom Terraformer Blueprint item, currently not meta sensitive - - // diamond chain - coalBall; // Coal Ball item, currently not meta sensitive - compressedCoalBall; // Compressed Coal Ball item, currently not meta sensitive - coalChunk; // Coal Chunk item, currently not meta sensitive - industrialDiamond; // Industrial Diamond item, currently not meta sensitive, DEPRECATED - - // recycler chain - scrap; // Scrap item, currently not meta sensitive - scrapBox; // Scrap Box item, currently not meta sensitive - - // fuel production chain - hydratedCoalClump; // Hydrated Coal Clump item, currently not meta sensitive - plantBall; // Plant Ball item, currently not meta sensitive - compressedPlantBall; // Compressed Plant Ball item, currently not meta sensitive - - // painting - painter; // Painter item, currently not meta sensitive - - blackPainter; // Black Painter item, meta = damage value - redPainter; // Red Painter item, meta = damage value - greenPainter; // Green Painter item, meta = damage value - brownPainter; // Brown Painter item, meta = damage value - bluePainter; // Blue Painter item, meta = damage value - purplePainter; // Purple Painter item, meta = damage value - cyanPainter; // Cyan Painter item, meta = damage value - lightGreyPainter; // Light Grey Painter item, meta = damage value - darkGreyPainter; // Dark Grey Painter item, meta = damage value - pinkPainter; // Pink Painter item, meta = damage value - limePainter; // Lime Painter item, meta = damage value - yellowPainter; // Yellow Painter item, meta = damage value - cloudPainter; // Cloud Painter item, meta = damage value - magentaPainter; // Magenta Painter item, meta = damage value - orangePainter; // Orange Painter item, meta = damage value - whitePainter; // White Painter item, meta = damage value - - // explosives + related - dynamite; // Throwable Dynamite item, currently not meta sensitive - stickyDynamite; // Throwable Sticky Dynamite item, currently not meta sensitive - - remote; // Dynamite Remote item, currently not meta sensitive - - // misc intermediate recipe ingredients - electronicCircuit; // Electronic Circuit item, currently not meta sensitive - advancedCircuit; // Advanced Circuit item, currently not meta sensitive - - advancedAlloy; // Advanced Alloy item, currently not meta sensitive - - carbonFiber; // Raw Carbon Fiber item, currently not meta sensitive - carbonMesh; // Raw Carbon Mesh item, currently not meta sensitive - carbonPlate; // Carbon Plate item, currently not meta sensitive - - matter; // UUA item, currently not meta sensitive - iridiumOre; // Iridium Ore item, currently not meta sensitive - iridiumPlate; // Iridium Plate item, currently not meta sensitive - - - // Metal Plates - - platecopper; // Metal plate item, meta sensitive - platetin; // Metal plate item, meta sensitive - platebronze; // Metal plate item, meta sensitive - plategold; // Metal plate item, meta sensitive - plateiron; // Metal plate item, meta sensitive - platelead; // Metal plate item, meta sensitive - platelapi; // Metal plate item, meta sensitive - plateobsidian; // Metal plate item, meta sensitive - plateadviron; // Metal plate item, meta sensitive - - // Metal Dense Plates - denseplatecopper; // Metal dense plate item, meta sensitive - denseplatetin; // Metal dense plate item, meta sensitive - denseplatebronze; // Metal dense plate item, meta sensitive - denseplategold; // Metal dense plate item, meta sensitive - denseplateiron; // Metal dense plate item, meta sensitive - @Deprecated - denseplateadviron; // Metal dense plate item, meta sensitive - denseplatelead; // Metal dense plate item, meta sensitive - denseplatelapi; // Metal dense plate item, meta sensitive - denseplateobsidian; // Metal dense plate item, meta sensitive - - - - // upgrade modules - overclockerUpgrade; // overclocker upgrade item, meta sensitive - transformerUpgrade; // transformer upgrade item, meta sensitive - energyStorageUpgrade; // energy storage upgrade item, meta sensitive - ejectorUpgrade; // ejector upgrade item, meta sensitive - - // misc - coin; // Coin item, currently not meta sensitive - reinforcedDoor; // Reinforced Door item, currently not meta sensitive - constructionFoamPowder; // Construction Foam Powder item, currently not meta sensitive - grinPowder; // Poisonous ingrident, currently not meta sensitive - debug; // Debug item, currently not meta sensitive - boatCarbon; // Carbon Fiber Canoe item, meta sensitive - boatRubber; // Rubber Dinghy item, meta sensitive - boatRubberBroken; // Damaged Rubber Dinghy item, meta sensitive - boatElectric; // Electric Boat item, meta sensitive - - //Agriculture - cropSeed; // Crop seeds, stuff stored in NBT, don't use for crafting recipes! - cropnalyzer; // Cropnalyzer handheld device - fertilizer; // Basic IC2Item, used to provide nutrients toCropBlocks - hydratingCell; // Cell used to hydrate Crops, meta = Content, 0= Full, 9999 = Near empty - electricHoe; // Electric Hoe, Metadata indicates charge level - terraWart; // Mystic opposite of NEtherWart, cures StatusEffects, simply consumeable - weedEx; // Spraying can of WEED-EX, meta indicates usages left - - //Boozeception - mugEmpty; // Simple stone mug - coffeeBeans; // Harvested CoffeeBeans - coffeePowder; // Processed Coffee Beans, used to craft drinkable Coffee - mugCoffee; // Mug of Coffee, Meta indicates status 0 = cold, 1 = Normal, 2 = Sugar'd - hops; // Hops, harvested freshly from crop - barrel; // Carried Barrel, metadata encrypts the information about the liquid inside - blockBarrel; // Unobtainable "placed barrel", TileEntity controlling the Fermentation process - mugBooze; // Mug filled with booze, metadata encrypts the information about the liquid inside - - */ - - /** - * Get the base IC2 package name, used internally. - * - * @return IC2 package name, if unable to be determined defaults to ic2 - */ - private static String getPackage () - { - Package pkg = Items.class.getPackage(); - - if (pkg != null) - { - String packageName = pkg.getName(); - - return packageName.substring(0, packageName.length() - ".api.item".length()); - } - - return "ic2"; - } - - private static Class Ic2Items; -} diff --git a/src/main/java/mods/battlegear2/api/IAllowItem.java b/src/main/java/mods/battlegear2/api/IAllowItem.java deleted file mode 100644 index 9c629d48..00000000 --- a/src/main/java/mods/battlegear2/api/IAllowItem.java +++ /dev/null @@ -1,11 +0,0 @@ -package mods.battlegear2.api; - -import net.minecraft.item.ItemStack; - -public interface IAllowItem { - - /** - * Returns true if the mainhand {@link #ItemStack} allows the offhand {@link #ItemStack} to be placed in the partner offhand slot - */ - public boolean allowOffhand(ItemStack mainhand, ItemStack offhand); -} diff --git a/src/main/java/mods/battlegear2/api/IDyable.java b/src/main/java/mods/battlegear2/api/IDyable.java deleted file mode 100644 index 3e72f2fc..00000000 --- a/src/main/java/mods/battlegear2/api/IDyable.java +++ /dev/null @@ -1,31 +0,0 @@ -package mods.battlegear2.api; - - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -//This is a tempory fix until we get the heradry system up and running -public interface IDyable { - - /** - * Return whether the specified ItemStack has a color. - */ - public boolean hasColor(ItemStack par1ItemStack); - - - /** - * Return the color for the specified ItemStack. - */ - public int getColor(ItemStack par1ItemStack); - - public void setColor(ItemStack dyable, int rgb); - - /** - * Remove the color from the specified ItemStack. - */ - public void removeColor(ItemStack par1ItemStack); - - public int getDefaultColor(ItemStack par1ItemStack); - - -} diff --git a/src/main/java/mods/battlegear2/api/IOffhandDual.java b/src/main/java/mods/battlegear2/api/IOffhandDual.java deleted file mode 100644 index 1c184687..00000000 --- a/src/main/java/mods/battlegear2/api/IOffhandDual.java +++ /dev/null @@ -1,55 +0,0 @@ -package mods.battlegear2.api; - -import cpw.mods.fml.relauncher.Side; -import mods.battlegear2.api.weapons.OffhandAttackEvent; -import net.minecraft.item.ItemStack; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; - -public interface IOffhandDual { - /** - * Returns true if the item can be dual wielded in the offhand slot - */ - public boolean isOffhandHandDual(ItemStack off); - - /** - * Perform any function when the item is held in the offhand and the user right clicks an entity. - * This is generally used to attack an entity with the offhand item. If this is the case the event should - * be canceled to prevent any default right clicking events (Eg Villager Trading) - * - * @param event the OffhandAttackEvent that was generated - * @param mainhandItem the ItemStack currently being held in the right hand - * @param offhandItem the ItemStack currently being held in the left hand - * @return true if the off hand swing animation should be performed - */ - public boolean offhandAttackEntity(OffhandAttackEvent event, ItemStack mainhandItem, ItemStack offhandItem); - - /** - * Perform any function when the item is held in the offhand and the user right clicks "Air". - * - * @param event the PlayerInteractEvent that was generated - * @param mainhandItem the ItemStack currently being held in the right hand - * @param offhandItem the ItemStack currently being held in the left hand - * @return true if the off hand swing animation should be performed - */ - public boolean offhandClickAir(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem); - - /** - * Perform any function when the item is held in the offhand and the user right clicks a block. - * Note that this will happen prior to the activation of any activation functions of blocks - * - * @param event the PlayerInteractEvent that was generated - * @param mainhandItem the ItemStack currently being held in the right hand - * @param offhandItem the ItemStack currently being held in the left hand - * @return true if the off hand swing animation should be performed - */ - public boolean offhandClickBlock(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem); - - /** - * Perform any passive effects on each game tick when the item is held in the offhand - * - * @param effectiveSide the effective side the method was called from - * @param mainhandItem the ItemStack currently being held in the right hand - * @param offhandItem the ItemStack currently being held in the left hand - */ - public void performPassiveEffects(Side effectiveSide, ItemStack mainhandItem, ItemStack offhandItem); -} diff --git a/src/main/java/mods/battlegear2/api/ISheathed.java b/src/main/java/mods/battlegear2/api/ISheathed.java deleted file mode 100644 index 5955b87b..00000000 --- a/src/main/java/mods/battlegear2/api/ISheathed.java +++ /dev/null @@ -1,12 +0,0 @@ -package mods.battlegear2.api; - -import net.minecraft.item.ItemStack; - -public interface ISheathed { - - /** - * Returns true if the item should always be sheathed on the back, false if it should be sheathed on the hip - * @param item the {@link #ItemStack} to be sheathed - */ - public boolean sheatheOnBack(ItemStack item); -} diff --git a/src/main/java/mods/battlegear2/api/IShield.java b/src/main/java/mods/battlegear2/api/IShield.java deleted file mode 100644 index 089935c5..00000000 --- a/src/main/java/mods/battlegear2/api/IShield.java +++ /dev/null @@ -1,62 +0,0 @@ -package mods.battlegear2.api; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.DamageSource; - -public interface IShield { - - /** - * Gets the decay rate for the stamina bar when the shield is in use. - * The value should be between 0 and 1. The duration of maximum blocking can be calculated - * by 1/decayRate/20. - * - * @param shield The {@link #ItemStack} representing the shield - * @return a value between 0 & 1 representing the decay rate per tick - */ - public float getDecayRate(ItemStack shield); - - /** - * Gets the recovery rate for the stamina bar when the shield is not in use. - * The value should be between 0 and 1. - * - * @param shield The {@link #ItemStack} representing the shield - * @return a value between 0 & 1 representing the recovery rate per tick - */ - public float getRecoveryRate(ItemStack shield); - - /** - * Returns true if the current shield can and should block the given damage source - * - * @param shield The {@link #ItemStack} representing the shield - * @param source The {@link #DamageSource} representing the current damage - * @return true if the shield can block the given damage type - */ - public boolean canBlock(ItemStack shield, DamageSource source); - - /** - * Gets the extra decay rate to the stamina bar when the shield is damaged - * - * @param shield The {@link #ItemStack} representing the shield - * @param amount The amount of damage the shield has absorbed - * @return a value between 0 & 1 representing the decay rate - */ - public float getDamageDecayRate(ItemStack shield, float amount); - - /** - * Returns the block angle in degrees that the shield can block. - * This angle is taken as 0 degrees being directly in front of the player. The shield - * will block between -blockAngle to blockangle - * @param shield The {@link #ItemStack} representing the shield - * @return The maximum angle the shield should be able to block at - */ - public float getBlockAngle(ItemStack shield); - - - /** - * Returns the time a shield bash should take to be preformed. A shield bash will disallow actions - * for the number of ticks given and will knockback an oponent at time/2 - * - * @return The amount of ticks the shield bash animation will play - */ - public int getBashTimer(ItemStack shield); -} diff --git a/src/main/java/mods/battlegear2/api/PlayerEventChild.java b/src/main/java/mods/battlegear2/api/PlayerEventChild.java deleted file mode 100644 index 654952c0..00000000 --- a/src/main/java/mods/battlegear2/api/PlayerEventChild.java +++ /dev/null @@ -1,32 +0,0 @@ -package mods.battlegear2.api; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.event.Event.Result; -import net.minecraftforge.event.entity.player.PlayerEvent; - -public class PlayerEventChild extends PlayerEvent{ - - public PlayerEvent parent; - - public PlayerEventChild(PlayerEvent parent) { - super(parent.entityPlayer); - this.parent = parent; - } - - public void setCancelParentEvent(boolean cancel) { - parent.setCanceled(cancel); - } - - @Override - public void setCanceled(boolean cancel) { - super.setCanceled(cancel); - parent.setCanceled(cancel); - } - - @Override - public void setResult(Result value) { - super.setResult(value); - parent.setResult(value); - } -} diff --git a/src/main/java/mods/battlegear2/api/quiver/IArrowContainer2.java b/src/main/java/mods/battlegear2/api/quiver/IArrowContainer2.java deleted file mode 100644 index 9ad1355e..00000000 --- a/src/main/java/mods/battlegear2/api/quiver/IArrowContainer2.java +++ /dev/null @@ -1,99 +0,0 @@ -package mods.battlegear2.api.quiver; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public interface IArrowContainer2 { - - /** - * Returns the maximum amout of slots in the arrow container - * @param container {@link #ItemStack} representing this item - * @return the amount of slots - */ - public int getSlotCount(ItemStack container); - - /** - * Returns the currently selected slot in the arrow container - * @param container {@link #ItemStack} representing this item - * @return the currently selected slot - */ - public int getSelectedSlot(ItemStack container); - - /** - * Sets the currently selected slot to the given value - * @param container {@link #ItemStack} representing this item - * @param newSlot the new slot index - */ - public void setSelectedSlot(ItemStack container, int newSlot); - - /** - * Returns the itemStack in the currently selected slot - * @param container The {@link #ItemStack} representing this item - * @param slot the slot index - * @return The {@link #ItemStack} in the given slot. - */ - public ItemStack getStackInSlot(ItemStack container, int slot); - - /** - * Sets places the given item stack in the give slot - * @param container {@link #ItemStack} representing this item - * @param slot the slot index - * @param container {@link #ItemStack} representing the new stack - */ - public void setStackInSlot(ItemStack container, int slot, ItemStack stack); - - - /** - * - * @param container The {@link #ItemStack} representing this item - * @param bow The bow trying to use this container - * @param player The {@link #EntityPlayer} using the bow - * @return true if the item contains at least one arrow in the selected slot - */ - public boolean hasArrowFor(ItemStack container, ItemStack bow, EntityPlayer player, int slot); - - /** - * The arrow spawned when bow is used with this non empty container equipped - * @param container The {@link #ItemStack} representing this item - * @param charge Amount of charge in the bow, ranging from 0.2F to 2.0F - * @param player The {@link #EntityPlayer} using the bow - * @param world - * @return the arrow entity to spawn when bow is used - */ - public EntityArrow getArrowType(ItemStack container, World world, EntityPlayer player, float charge); - /** - * Action to take after an arrow has been fired - * Usually equal to removing an arrow from the container - * @param player The {@link #EntityPlayer} using the bow - * @param world - * @param container The {@link #ItemStack} representing this item - * @param bow The bow which fired - * @param arrow the arrow fired - */ - public void onArrowFired(World world, EntityPlayer player, ItemStack container, ItemStack bow, EntityArrow arrow); - /** - * Called before the arrow is fired from this container - * @param arrowEvent Used to decide bow damage, bow sound and arrow enchantment - */ - public void onPreArrowFired(QuiverArrowEvent arrowEvent); - /** - * Called when the container is put on a crafting bench with other items - * @param container The {@link #ItemStack} representing this item - * @param arrowStack The {@link #ItemStack} representing other items - * @return True to receive {@link #addArrows(ItemStack, ItemStack)} - */ - public boolean isCraftableWithArrows(ItemStack contaner, ItemStack arrowStack); - - /** - * Crafts the item with the items from {@link #isCraftableWithArrows(ItemStack, ItemStack)} - * @param container The {@link #ItemStack} representing this item - * @param arrows Another valid item on the crafting bench - * @return Number of arrows that couldn't fit in - */ - public ItemStack addArrows(ItemStack container, ItemStack newStack); - - - -} diff --git a/src/main/java/mods/battlegear2/api/quiver/QuiverArrowEvent.java b/src/main/java/mods/battlegear2/api/quiver/QuiverArrowEvent.java deleted file mode 100644 index f410261a..00000000 --- a/src/main/java/mods/battlegear2/api/quiver/QuiverArrowEvent.java +++ /dev/null @@ -1,30 +0,0 @@ -package mods.battlegear2.api.quiver; - -import mods.battlegear2.api.PlayerEventChild; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.event.entity.player.ArrowLooseEvent; -import net.minecraftforge.event.entity.player.PlayerEvent; - -public class QuiverArrowEvent extends PlayerEventChild{ - - public int bowDamage = 1; - public float bowSoundVolume = 1.0F; - public boolean addEnchantments = true; - public ArrowLooseEvent event; - - public QuiverArrowEvent(ArrowLooseEvent parent) { - super(parent); - this.event = parent; - } - - public ItemStack getBow() - { - return event.bow; - } - - public int getCharge() - { - return event.charge; - } -} diff --git a/src/main/java/mods/battlegear2/api/quiver/QuiverArrowRegistry.java b/src/main/java/mods/battlegear2/api/quiver/QuiverArrowRegistry.java deleted file mode 100644 index fcf1dcaf..00000000 --- a/src/main/java/mods/battlegear2/api/quiver/QuiverArrowRegistry.java +++ /dev/null @@ -1,62 +0,0 @@ -package mods.battlegear2.api.quiver; - -import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.Comparator; -import java.util.Map; -import java.util.TreeMap; - -public class QuiverArrowRegistry { - - private static Map> map = new TreeMap>(new StackComparator()); - - public static void addArrowToRegistry(int itemId, int itemMetadata, Class entityArrow){ - ItemStack stack = new ItemStack(itemId, 1, itemMetadata); - addArrowToRegistry(stack, entityArrow); - } - - public static void addArrowToRegistry(ItemStack stack, Class entityArrow){ - ItemStack st = stack.copy(); - st.stackSize = 1; - map.put(st, entityArrow); - } - - public static Class getArrowClass(ItemStack stack){ - return map.get(stack); - } - - static class StackComparator implements Comparator { - @Override - public int compare(ItemStack stack, ItemStack stack2) { - if(stack == stack2){ - return 0; - }else{ - - int idDiff = stack.itemID - stack2.itemID; - if(idDiff != 0){ - return idDiff; - }else{ - idDiff = stack.getItemDamage() - stack2.getItemDamage(); - if(idDiff != 0){ - return idDiff; - }else{ - int tag = 0; - if(stack.hasTagCompound()){ - tag = stack.getTagCompound().hashCode(); - } - int tag2 = 0; - if(stack2.hasTagCompound()){ - tag2 = stack2.getTagCompound().hashCode(); - } - return tag-tag2; - } - } - } - - } - } - - -} diff --git a/src/main/java/mods/battlegear2/api/weapons/IBackStabbable.java b/src/main/java/mods/battlegear2/api/weapons/IBackStabbable.java deleted file mode 100644 index 36025eca..00000000 --- a/src/main/java/mods/battlegear2/api/weapons/IBackStabbable.java +++ /dev/null @@ -1,14 +0,0 @@ -package mods.battlegear2.api.weapons; - -import net.minecraft.entity.EntityLivingBase; - -public interface IBackStabbable { - - /** - * Action to perform on back stabbing - * @param entityHit - * @param entityHitting - * @return true if it adds an hitting action - */ - public boolean onBackStab(EntityLivingBase entityHit, EntityLivingBase entityHitting); -} diff --git a/src/main/java/mods/battlegear2/api/weapons/IBattlegearWeapon.java b/src/main/java/mods/battlegear2/api/weapons/IBattlegearWeapon.java deleted file mode 100644 index f0a76bec..00000000 --- a/src/main/java/mods/battlegear2/api/weapons/IBattlegearWeapon.java +++ /dev/null @@ -1,12 +0,0 @@ -package mods.battlegear2.api.weapons; - -import cpw.mods.fml.relauncher.Side; -import mods.battlegear2.api.IAllowItem; -import mods.battlegear2.api.IOffhandDual; -import mods.battlegear2.api.ISheathed; -import net.minecraft.item.ItemStack; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; - -public interface IBattlegearWeapon extends ISheathed,IOffhandDual,IAllowItem{ - -} \ No newline at end of file diff --git a/src/main/java/mods/battlegear2/api/weapons/IExtendedReachWeapon.java b/src/main/java/mods/battlegear2/api/weapons/IExtendedReachWeapon.java deleted file mode 100644 index fce70604..00000000 --- a/src/main/java/mods/battlegear2/api/weapons/IExtendedReachWeapon.java +++ /dev/null @@ -1,12 +0,0 @@ -package mods.battlegear2.api.weapons; - -import net.minecraft.item.ItemStack; - -public interface IExtendedReachWeapon { - /** - * The distance the weapon will hit (note this will ONLY work for main hand weapons) - * @param stack - * @return - */ - public float getReachModifierInBlocks(ItemStack stack); -} diff --git a/src/main/java/mods/battlegear2/api/weapons/IHitTimeModifier.java b/src/main/java/mods/battlegear2/api/weapons/IHitTimeModifier.java deleted file mode 100644 index 38afe94e..00000000 --- a/src/main/java/mods/battlegear2/api/weapons/IHitTimeModifier.java +++ /dev/null @@ -1,15 +0,0 @@ -package mods.battlegear2.api.weapons; - -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; - -public interface IHitTimeModifier { - /** - * - * @param entityHit - * @return The amount to modify the hit shield - */ - public int getHitTime(ItemStack stack, EntityLivingBase entityHit); - -} diff --git a/src/main/java/mods/battlegear2/api/weapons/IPenetrateWeapon.java b/src/main/java/mods/battlegear2/api/weapons/IPenetrateWeapon.java deleted file mode 100644 index ae959c99..00000000 --- a/src/main/java/mods/battlegear2/api/weapons/IPenetrateWeapon.java +++ /dev/null @@ -1,13 +0,0 @@ -package mods.battlegear2.api.weapons; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; - -public interface IPenetrateWeapon { - /** - * The amount of damage bypassing armor - * @param stack The {@link net.minecraft.item.ItemStack} representative of the item dealing the hit. - * @return the amount of damage that bypasses armour - */ - public int getPenetratingPower(ItemStack stack); -} diff --git a/src/main/java/mods/battlegear2/api/weapons/IPotionEffect.java b/src/main/java/mods/battlegear2/api/weapons/IPotionEffect.java deleted file mode 100644 index a310ee17..00000000 --- a/src/main/java/mods/battlegear2/api/weapons/IPotionEffect.java +++ /dev/null @@ -1,23 +0,0 @@ -package mods.battlegear2.api.weapons; - - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.potion.PotionEffect; - -import java.util.Map; - -public interface IPotionEffect { - - - /** - * Returns a map containing the potion effects to apply to an entity hit by the weapon. Each effect - * has a float value associated with the chance of applying the effect. Note that the "dice roll" only - * occurs once so any value under this roll will be applied. - * - * @param entityHit The entity the effect will be applied to. - * @param entityHitting - * @return A Map of {@link PotionEffect} with chance value ranging from 0 to 1, to be dealt to the entityHit - */ - public Map getEffectsOnHit(EntityLivingBase entityHit, EntityLivingBase entityHitting); - -} diff --git a/src/main/java/mods/battlegear2/api/weapons/ISpecialEffect.java b/src/main/java/mods/battlegear2/api/weapons/ISpecialEffect.java deleted file mode 100644 index 9f52e9bb..00000000 --- a/src/main/java/mods/battlegear2/api/weapons/ISpecialEffect.java +++ /dev/null @@ -1,16 +0,0 @@ -package mods.battlegear2.api.weapons; - -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.PotionEffect; - -public interface ISpecialEffect { - /** - * - * @param entityHit The entity the effect will be applied to. - * @param entityHitting - * @return true if it adds an hitting action - */ - public boolean performEffects(EntityLivingBase entityHit, EntityLivingBase entityHitting); -} diff --git a/src/main/java/mods/battlegear2/api/weapons/OffhandAttackEvent.java b/src/main/java/mods/battlegear2/api/weapons/OffhandAttackEvent.java deleted file mode 100644 index 273b1d5f..00000000 --- a/src/main/java/mods/battlegear2/api/weapons/OffhandAttackEvent.java +++ /dev/null @@ -1,22 +0,0 @@ -package mods.battlegear2.api.weapons; - -import mods.battlegear2.api.PlayerEventChild; -import net.minecraft.entity.Entity; -import net.minecraftforge.event.entity.player.EntityInteractEvent; -import net.minecraftforge.event.entity.player.PlayerEvent; - -public class OffhandAttackEvent extends PlayerEventChild { - - public boolean swingOffhand = true; - public boolean shouldAttack = true; - public EntityInteractEvent event; - - public OffhandAttackEvent(EntityInteractEvent parent) { - super(parent); - this.event = parent; - } - - public Entity getTarget() { - return event.target; - } -} \ No newline at end of file diff --git a/src/main/java/mods/battlegear2/items/ItemShield.java b/src/main/java/mods/battlegear2/items/ItemShield.java deleted file mode 100644 index f040d050..00000000 --- a/src/main/java/mods/battlegear2/items/ItemShield.java +++ /dev/null @@ -1,11 +0,0 @@ -package mods.battlegear2.items; - -import net.minecraft.item.Item; - -public class ItemShield extends Item { - - public ItemShield(int id) - { - super(id); - } -} diff --git a/src/main/java/vazkii/tinkerer/client/core/handler/ClientTickHandler.java b/src/main/java/vazkii/tinkerer/client/core/handler/ClientTickHandler.java index 6777018e..2c1d19eb 100644 --- a/src/main/java/vazkii/tinkerer/client/core/handler/ClientTickHandler.java +++ b/src/main/java/vazkii/tinkerer/client/core/handler/ClientTickHandler.java @@ -14,51 +14,32 @@ */ package vazkii.tinkerer.client.core.handler; -import java.util.EnumSet; - +import cpw.mods.fml.common.gameevent.TickEvent; +import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.client.Minecraft; import thaumcraft.api.research.ResearchItem; import thaumcraft.client.gui.GuiResearchRecipe; import vazkii.tinkerer.client.core.handler.kami.ToolModeHUDHandler; import vazkii.tinkerer.client.core.helper.ClientHelper; import vazkii.tinkerer.client.gui.GuiResearchPeripheral; -import vazkii.tinkerer.common.core.handler.ConfigHandler; -import vazkii.tinkerer.common.lib.LibMisc; import vazkii.tinkerer.common.lib.LibResearch; -import cpw.mods.fml.common.ITickHandler; -import cpw.mods.fml.common.TickType; -import cpw.mods.fml.relauncher.ReflectionHelper; -public class ClientTickHandler implements ITickHandler { +public class ClientTickHandler { public static int elapsedTicks; + public void tickEnd(TickEvent event) { + if(event.phase== TickEvent.Phase.END) { + Minecraft mc = ClientHelper.minecraft(); + if (mc.currentScreen != null && mc.currentScreen instanceof GuiResearchRecipe && !(mc.currentScreen instanceof GuiResearchPeripheral)) { + ResearchItem research = ReflectionHelper.getPrivateValue(GuiResearchRecipe.class, (GuiResearchRecipe) mc.currentScreen, 9); + if (research.key.equals(LibResearch.KEY_PERIPHERALS) || research.key.equals(LibResearch.KEY_GOLEMCONNECTOR)) + mc.displayGuiScreen(new GuiResearchPeripheral(research)); + } - @Override - public void tickStart(EnumSet type, Object... tickData) { - } + ToolModeHUDHandler.clientTick(); - @Override - public void tickEnd(EnumSet type, Object... tickData) { - Minecraft mc = ClientHelper.minecraft(); - if(mc.currentScreen != null && mc.currentScreen instanceof GuiResearchRecipe && !(mc.currentScreen instanceof GuiResearchPeripheral)) { - ResearchItem research = ReflectionHelper.getPrivateValue(GuiResearchRecipe.class, (GuiResearchRecipe) mc.currentScreen, 9); - if(research.key.equals(LibResearch.KEY_PERIPHERALS) || research.key.equals(LibResearch.KEY_GOLEMCONNECTOR)) - mc.displayGuiScreen(new GuiResearchPeripheral(research)); - } - - ToolModeHUDHandler.clientTick(); - - ++elapsedTicks; - } - - @Override - public EnumSet ticks() { - return EnumSet.of(TickType.CLIENT); - } - - @Override - public String getLabel() { - return LibMisc.MOD_NAME; + ++elapsedTicks; + } } } diff --git a/src/main/java/vazkii/tinkerer/client/core/handler/GemArmorKeyHandler.java b/src/main/java/vazkii/tinkerer/client/core/handler/GemArmorKeyHandler.java index 802ada2e..7c73f5c9 100644 --- a/src/main/java/vazkii/tinkerer/client/core/handler/GemArmorKeyHandler.java +++ b/src/main/java/vazkii/tinkerer/client/core/handler/GemArmorKeyHandler.java @@ -1,80 +1,33 @@ package vazkii.tinkerer.client.core.handler; -import cpw.mods.fml.client.registry.KeyBindingRegistry; -import cpw.mods.fml.common.TickType; -import cpw.mods.fml.common.network.PacketDispatcher; +import cpw.mods.fml.client.registry.ClientRegistry; +import cpw.mods.fml.common.gameevent.InputEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.settings.KeyBinding; import org.lwjgl.input.Keyboard; -import thaumcraft.common.lib.PacketHandler; import vazkii.tinkerer.client.core.handler.kami.KamiArmorClientHandler; import vazkii.tinkerer.common.ThaumicTinkerer; -import java.util.EnumSet; - /** * Created by Katrina on 28/02/14. */ @SideOnly(Side.CLIENT) -public class GemArmorKeyHandler extends KeyBindingRegistry.KeyHandler { +public class GemArmorKeyHandler { - static KeyBinding SpecialAbility = new KeyBinding("ttmisc.toggleArmor", Keyboard.KEY_U); - /** - * Pass an array of keybindings and a repeat flag for each one - * - */ - public GemArmorKeyHandler() { - super(new KeyBinding[]{SpecialAbility}, new boolean[]{false}); + static KeyBinding SpecialAbility = new KeyBinding("ttmisc.toggleArmor", Keyboard.KEY_U,"ttmisc.keyCategory"); + public GemArmorKeyHandler() + { + ClientRegistry.registerKeyBinding(SpecialAbility); } - /** - * Called when the key is first in the down position on any tick from the {@link #ticks()} - * set. Will be called subsequently with isRepeat set to true - * - * @param types the type(s) of tick that fired when this key was first down - * @param kb - * @param tickEnd was it an end or start tick which fired the key - * @param isRepeat is it a repeat key event - * @see #keyUp(java.util.EnumSet, net.minecraft.client.settings.KeyBinding, boolean) - */ - @Override - public void keyDown(EnumSet types, KeyBinding kb, boolean tickEnd, boolean isRepeat) { - } - - /** - * Fired once when the key changes state from down to up - * - * @param types the type(s) of tick that fired when this key was first down - * @param kb - * @param tickEnd was it an end or start tick which fired the key - * @see #keyDown(java.util.EnumSet, net.minecraft.client.settings.KeyBinding, boolean, boolean) - */ - @Override - public void keyUp(EnumSet types, KeyBinding kb, boolean tickEnd) { - if(tickEnd) + public void keyUp(InputEvent.KeyInputEvent event) { + if(SpecialAbility.isPressed()) { KamiArmorClientHandler.SetStatus(!ThaumicTinkerer.proxy.armorStatus(ThaumicTinkerer.proxy.getClientPlayer())); } } - /** - * This is the list of ticks for which the key binding should trigger. The only - * valid ticks are client side ticks, obviously. - * - * @see cpw.mods.fml.common.ITickHandler#ticks() - */ - @Override - public EnumSet ticks() { - return EnumSet.of(TickType.CLIENT); - } - /** - * A profiling label for this tick handler - */ - @Override - public String getLabel() { - return "ArmorKeyHandler"; - } } diff --git a/src/main/java/vazkii/tinkerer/client/core/handler/HUDHandler.java b/src/main/java/vazkii/tinkerer/client/core/handler/HUDHandler.java index 49946ba8..db12bfd1 100644 --- a/src/main/java/vazkii/tinkerer/client/core/handler/HUDHandler.java +++ b/src/main/java/vazkii/tinkerer/client/core/handler/HUDHandler.java @@ -14,6 +14,7 @@ */ package vazkii.tinkerer.client.core.handler; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.entity.RenderItem; @@ -22,7 +23,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; -import net.minecraftforge.event.ForgeSubscribe; import thaumcraft.api.wands.IWandFocus; import thaumcraft.common.config.Config; import thaumcraft.common.items.wands.ItemWandCasting; @@ -33,7 +33,7 @@ public final class HUDHandler { RenderItem renderItem = new RenderItem(); - @ForgeSubscribe + @SubscribeEvent public void drawDislocationFocusHUD(RenderGameOverlayEvent.Post event) { if(event.type == ElementType.HOTBAR && ClientHelper.minecraft().currentScreen == null) { boolean up = !Config.dialBottom; diff --git a/src/main/java/vazkii/tinkerer/client/core/handler/kami/SoulHeartClientHandler.java b/src/main/java/vazkii/tinkerer/client/core/handler/kami/SoulHeartClientHandler.java index 8e853801..f6c0f6b0 100644 --- a/src/main/java/vazkii/tinkerer/client/core/handler/kami/SoulHeartClientHandler.java +++ b/src/main/java/vazkii/tinkerer/client/core/handler/kami/SoulHeartClientHandler.java @@ -14,12 +14,13 @@ */ package vazkii.tinkerer.client.core.handler.kami; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; -import net.minecraftforge.event.ForgeSubscribe; + import org.lwjgl.opengl.GL11; @@ -36,7 +37,7 @@ public final class SoulHeartClientHandler { public static int clientPlayerHP = 0; @SideOnly(Side.CLIENT) - @ForgeSubscribe + @SubscribeEvent public void renderHealthBar(RenderGameOverlayEvent event) { if(event.type == ElementType.FOOD && clientPlayerHP > 0) { if(event instanceof RenderGameOverlayEvent.Post) { diff --git a/src/main/java/vazkii/tinkerer/client/core/handler/kami/ToolModeHUDHandler.java b/src/main/java/vazkii/tinkerer/client/core/handler/kami/ToolModeHUDHandler.java index e35c97c0..6774edda 100644 --- a/src/main/java/vazkii/tinkerer/client/core/handler/kami/ToolModeHUDHandler.java +++ b/src/main/java/vazkii/tinkerer/client/core/handler/kami/ToolModeHUDHandler.java @@ -14,28 +14,26 @@ */ package vazkii.tinkerer.client.core.handler.kami; -import java.awt.Color; - +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.util.MathHelper; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; -import net.minecraftforge.event.ForgeSubscribe; - import org.lwjgl.opengl.GL11; - import vazkii.tinkerer.client.core.handler.ClientTickHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; + +import java.awt.*; public final class ToolModeHUDHandler { private static String currentTooltip; private static int tooltipDisplayTicks; - @ForgeSubscribe + @SubscribeEvent @SideOnly(Side.CLIENT) public void drawDislocationFocusHUD(RenderGameOverlayEvent.Post event) { if (event.type == ElementType.ALL && tooltipDisplayTicks > 0 && !MathHelper.stringNullOrLengthZero(currentTooltip)) { diff --git a/src/main/java/vazkii/tinkerer/client/gui/GuiAnimationTablet.java b/src/main/java/vazkii/tinkerer/client/gui/GuiAnimationTablet.java index 2c185c0b..26252fef 100644 --- a/src/main/java/vazkii/tinkerer/client/gui/GuiAnimationTablet.java +++ b/src/main/java/vazkii/tinkerer/client/gui/GuiAnimationTablet.java @@ -14,17 +14,12 @@ */ package vazkii.tinkerer.client.gui; -import java.util.ArrayList; -import java.util.List; - import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; - import vazkii.tinkerer.client.gui.button.GuiButtonAT; import vazkii.tinkerer.client.gui.button.GuiButtonATRadio; import vazkii.tinkerer.client.gui.button.IRadioButton; @@ -33,7 +28,9 @@ import vazkii.tinkerer.common.ThaumicTinkerer; import vazkii.tinkerer.common.block.tile.container.ContainerAnimationTablet; import vazkii.tinkerer.common.block.tile.tablet.TileAnimationTablet; import vazkii.tinkerer.common.network.packet.PacketTabletButton; -import cpw.mods.fml.common.network.PacketDispatcher; + +import java.util.ArrayList; +import java.util.List; public class GuiAnimationTablet extends GuiContainer { @@ -88,9 +85,10 @@ public class GuiAnimationTablet extends GuiContainer { String left = StatCollector.translateToLocal("ttmisc.leftClick"); String right = StatCollector.translateToLocal("ttmisc.rightClick"); String redstone = StatCollector.translateToLocal("ttmisc.redstoneControl"); - fontRenderer.drawString(left, x + 48 - fontRenderer.getStringWidth(left), y + 18, 0x999999); - fontRenderer.drawString(right, x + 128, y + 18, 0x999999); - fontRenderer.drawString(redstone, x + xSize / 2 - fontRenderer.getStringWidth(redstone) / 2, y + 50, 0x999999); + + fontRendererObj.drawString(left, x + 48 - fontRendererObj.getStringWidth(left), y + 18, 0x999999); + fontRendererObj.drawString(right, x + 128, y + 18, 0x999999); + fontRendererObj.drawString(redstone, x + xSize / 2 - fontRendererObj.getStringWidth(redstone) / 2, y + 50, 0x999999); GL11.glColor3f(1F, 1F, 1F); } } \ No newline at end of file diff --git a/src/main/java/vazkii/tinkerer/client/gui/GuiAspectAnalyzer.java b/src/main/java/vazkii/tinkerer/client/gui/GuiAspectAnalyzer.java index c27068c3..cc03c1e0 100644 --- a/src/main/java/vazkii/tinkerer/client/gui/GuiAspectAnalyzer.java +++ b/src/main/java/vazkii/tinkerer/client/gui/GuiAspectAnalyzer.java @@ -14,28 +14,26 @@ */ package vazkii.tinkerer.client.gui; -import java.util.Arrays; -import java.util.List; - import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; - import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.client.lib.UtilsFX; import thaumcraft.common.Thaumcraft; -import thaumcraft.common.lib.ThaumcraftCraftingManager; +import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager; import thaumcraft.common.lib.research.ScanManager; import vazkii.tinkerer.client.core.helper.ClientHelper; import vazkii.tinkerer.client.lib.LibResources; import vazkii.tinkerer.common.block.tile.TileAspectAnalyzer; import vazkii.tinkerer.common.block.tile.container.ContainerAspectAnalyzer; +import java.util.Arrays; +import java.util.List; + public class GuiAspectAnalyzer extends GuiContainer { private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ASPECT_ANALYZER); @@ -66,9 +64,9 @@ public class GuiAspectAnalyzer extends GuiContainer { ItemStack stack = analyzer.getStackInSlot(0); if(stack != null) { - String h = ScanManager.generateItemHash(stack.itemID, stack.getItemDamage()); + String h = ScanManager.generateItemHash(stack.getItem(), stack.getItemDamage()); - List list = Thaumcraft.proxy.getScannedObjects().get(ClientHelper.clientPlayer().username); + List list = Thaumcraft.proxy.getScannedObjects().get(ClientHelper.clientPlayer().getGameProfile().getName()); if (h != null && list != null && (list.contains("@" + h) || list.contains("#" + h))) { AspectList tags = ThaumcraftCraftingManager.getObjectTags(stack); tags = ThaumcraftCraftingManager.getBonusTags(stack, tags); diff --git a/src/main/java/vazkii/tinkerer/client/gui/GuiMobMagnet.java b/src/main/java/vazkii/tinkerer/client/gui/GuiMobMagnet.java index b9f5223b..7e053899 100644 --- a/src/main/java/vazkii/tinkerer/client/gui/GuiMobMagnet.java +++ b/src/main/java/vazkii/tinkerer/client/gui/GuiMobMagnet.java @@ -14,18 +14,13 @@ */ package vazkii.tinkerer.client.gui; -import java.util.ArrayList; -import java.util.List; - import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; - import vazkii.tinkerer.client.gui.button.GuiButtonMM; import vazkii.tinkerer.client.gui.button.GuiButtonMMRadio; import vazkii.tinkerer.client.gui.button.IRadioButton; @@ -35,7 +30,9 @@ import vazkii.tinkerer.common.block.tile.TileMobMagnet; import vazkii.tinkerer.common.block.tile.container.ContainerMobMagnet; import vazkii.tinkerer.common.item.ItemSoulMould; import vazkii.tinkerer.common.network.packet.PacketMobMagnetButton; -import cpw.mods.fml.common.network.PacketDispatcher; + +import java.util.ArrayList; +import java.util.List; public class GuiMobMagnet extends GuiContainer { @@ -100,9 +97,9 @@ public class GuiMobMagnet extends GuiContainer { else filter = StatCollector.translateToLocal("entity." + name + ".name"); } else filter = StatCollector.translateToLocal("ttmisc.all"); - fontRenderer.drawString(filter, x + xSize / 2 - fontRenderer.getStringWidth(filter) / 2 - 26, y + 16, 0x999999); - fontRenderer.drawString(adult, x + 120, y + 30, 0x999999); - fontRenderer.drawString(child, x + 120, y + 50, 0x999999); + fontRendererObj.drawString(filter, x + xSize / 2 - fontRendererObj.getStringWidth(filter) / 2 - 26, y + 16, 0x999999); + fontRendererObj.drawString(adult, x + 120, y + 30, 0x999999); + fontRendererObj.drawString(child, x + 120, y + 50, 0x999999); GL11.glColor3f(1F, 1F, 1F); } diff --git a/src/main/java/vazkii/tinkerer/client/gui/kami/GuiWarpGate.java b/src/main/java/vazkii/tinkerer/client/gui/kami/GuiWarpGate.java index 35473a86..dc3d4aed 100644 --- a/src/main/java/vazkii/tinkerer/client/gui/kami/GuiWarpGate.java +++ b/src/main/java/vazkii/tinkerer/client/gui/kami/GuiWarpGate.java @@ -19,16 +19,13 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; - import vazkii.tinkerer.client.gui.button.kami.GuiButtonWG; import vazkii.tinkerer.client.lib.LibResources; import vazkii.tinkerer.common.ThaumicTinkerer; import vazkii.tinkerer.common.block.tile.container.kami.ContainerWarpGate; import vazkii.tinkerer.common.block.tile.kami.TileWarpGate; import vazkii.tinkerer.common.network.packet.kami.PacketWarpGateButton; -import cpw.mods.fml.common.network.PacketDispatcher; public class GuiWarpGate extends GuiContainer { @@ -65,7 +62,7 @@ public class GuiWarpGate extends GuiContainer { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(gui); drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - fontRenderer.drawStringWithShadow(StatCollector.translateToLocal("ttmisc.lockedGate"), x + 20, y + 7, 0x999999); + fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("ttmisc.lockedGate"), x + 20, y + 7, 0x999999); } } diff --git a/src/main/java/vazkii/tinkerer/client/render/block/RenderMagnet.java b/src/main/java/vazkii/tinkerer/client/render/block/RenderMagnet.java index 07158163..415432fe 100644 --- a/src/main/java/vazkii/tinkerer/client/render/block/RenderMagnet.java +++ b/src/main/java/vazkii/tinkerer/client/render/block/RenderMagnet.java @@ -16,7 +16,7 @@ package vazkii.tinkerer.client.render.block; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; import org.lwjgl.opengl.GL11; @@ -34,7 +34,7 @@ public class RenderMagnet implements ISimpleBlockRenderingHandler { GL11.glPushMatrix(); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - TileEntityRenderer.instance.renderTileEntityAt(new TileMagnet(), 0.0D, 0.0D, 0.0D, 0.0F); + TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileMagnet(), 0.0D, 0.0D, 0.0D, 0.0F); GL11.glPopMatrix(); } @@ -43,10 +43,10 @@ public class RenderMagnet implements ISimpleBlockRenderingHandler { return false; } - @Override - public boolean shouldRender3DInInventory() { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } @Override public int getRenderId() { diff --git a/src/main/java/vazkii/tinkerer/client/render/block/RenderRepairer.java b/src/main/java/vazkii/tinkerer/client/render/block/RenderRepairer.java index da1c1e22..7dbd0c4d 100644 --- a/src/main/java/vazkii/tinkerer/client/render/block/RenderRepairer.java +++ b/src/main/java/vazkii/tinkerer/client/render/block/RenderRepairer.java @@ -14,16 +14,14 @@ */ package vazkii.tinkerer.client.render.block; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; - import org.lwjgl.opengl.GL11; - import vazkii.tinkerer.client.lib.LibRenderIDs; import vazkii.tinkerer.common.block.tile.TileRepairer; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; public class RenderRepairer implements ISimpleBlockRenderingHandler { @@ -31,7 +29,7 @@ public class RenderRepairer implements ISimpleBlockRenderingHandler { public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { GL11.glPushMatrix(); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - TileEntityRenderer.instance.renderTileEntityAt(new TileRepairer(), 0.0D, 0.0D, 0.0D, 0.0F); + TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileRepairer(), 0.0D, 0.0D, 0.0D, 0.0F); GL11.glPopMatrix(); } @@ -40,10 +38,10 @@ public class RenderRepairer implements ISimpleBlockRenderingHandler { return false; } - @Override - public boolean shouldRender3DInInventory() { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } @Override public int getRenderId() { diff --git a/src/main/java/vazkii/tinkerer/client/render/block/kami/RenderWarpGate.java b/src/main/java/vazkii/tinkerer/client/render/block/kami/RenderWarpGate.java index 784ea162..398dd4a7 100644 --- a/src/main/java/vazkii/tinkerer/client/render/block/kami/RenderWarpGate.java +++ b/src/main/java/vazkii/tinkerer/client/render/block/kami/RenderWarpGate.java @@ -14,26 +14,25 @@ */ package vazkii.tinkerer.client.render.block.kami; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; - import org.lwjgl.opengl.GL11; - import thaumcraft.client.renderers.block.BlockRenderer; import vazkii.tinkerer.client.lib.LibRenderIDs; import vazkii.tinkerer.common.block.kami.BlockWarpGate; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; public class RenderWarpGate extends BlockRenderer implements ISimpleBlockRenderingHandler { @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - Icon topIcon = BlockWarpGate.icons[0]; - Icon sideIcon = BlockWarpGate.icons[1]; + IIcon topIcon = BlockWarpGate.icons[0]; + IIcon sideIcon = BlockWarpGate.icons[1]; + drawFaces(renderer, block, sideIcon, topIcon, sideIcon, sideIcon, sideIcon, sideIcon, false); GL11.glColor3f(1F, 1F, 1F); @@ -65,10 +64,10 @@ public class RenderWarpGate extends BlockRenderer implements ISimpleBlockRenderi return true; } - @Override - public boolean shouldRender3DInInventory() { - return true; - } + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } @Override public int getRenderId() { diff --git a/src/main/java/vazkii/tinkerer/client/render/item/RenderMobAspect.java b/src/main/java/vazkii/tinkerer/client/render/item/RenderMobAspect.java index 675baff4..4020771c 100644 --- a/src/main/java/vazkii/tinkerer/client/render/item/RenderMobAspect.java +++ b/src/main/java/vazkii/tinkerer/client/render/item/RenderMobAspect.java @@ -4,7 +4,7 @@ import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; import vazkii.tinkerer.common.item.ItemMobAspect; @@ -46,7 +46,7 @@ public class RenderMobAspect implements IItemRenderer { } case INVENTORY: { - Icon icon = ItemMobAspect.aspectIcons[item.getItemDamage()%ItemMobAspect.aspectCount]; + IIcon icon = ItemMobAspect.aspectIcons[item.getItemDamage()%ItemMobAspect.aspectCount]; renderItem.renderIcon(0, 0, icon, 16, 16); } case EQUIPPED : { @@ -54,7 +54,7 @@ public class RenderMobAspect implements IItemRenderer { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - Icon icon = ItemMobAspect.aspectIcons[item.getItemDamage()%ItemMobAspect.aspectCount]; + IIcon icon = ItemMobAspect.aspectIcons[item.getItemDamage()%ItemMobAspect.aspectCount]; float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); diff --git a/src/main/java/vazkii/tinkerer/client/render/item/RenderMobDisplay.java b/src/main/java/vazkii/tinkerer/client/render/item/RenderMobDisplay.java index 65ec9dd4..9b726eca 100644 --- a/src/main/java/vazkii/tinkerer/client/render/item/RenderMobDisplay.java +++ b/src/main/java/vazkii/tinkerer/client/render/item/RenderMobDisplay.java @@ -1,23 +1,15 @@ package vazkii.tinkerer.client.render.item; -import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.EntityRenderer; -import net.minecraft.client.renderer.ItemRenderer; -import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityList; import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.monster.EntitySlime; import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; import vazkii.tinkerer.common.core.helper.EnumMobAspect; -import vazkii.tinkerer.common.item.ItemMobAspect; import vazkii.tinkerer.common.item.ItemMobDisplay; public class RenderMobDisplay implements IItemRenderer { diff --git a/src/main/java/vazkii/tinkerer/client/render/item/kami/RenderPlacementMirror.java b/src/main/java/vazkii/tinkerer/client/render/item/kami/RenderPlacementMirror.java index 5af3c56f..0e2f8704 100644 --- a/src/main/java/vazkii/tinkerer/client/render/item/kami/RenderPlacementMirror.java +++ b/src/main/java/vazkii/tinkerer/client/render/item/kami/RenderPlacementMirror.java @@ -5,11 +5,9 @@ import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraftforge.client.IItemRenderer; - import org.lwjgl.opengl.GL11; - import vazkii.tinkerer.common.item.ModItems; public class RenderPlacementMirror implements IItemRenderer { @@ -43,7 +41,7 @@ public class RenderPlacementMirror implements IItemRenderer { } case EQUIPPED : { for(int i = 1; i >= 0; i--) { - Icon icon = ModItems.placementMirror.getIconFromDamageForRenderPass(0, i); + IIcon icon = ModItems.placementMirror.getIconFromDamageForRenderPass(0, i); if(i == 0) { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); diff --git a/src/main/java/vazkii/tinkerer/client/render/tile/RenderTileEnchanter.java b/src/main/java/vazkii/tinkerer/client/render/tile/RenderTileEnchanter.java index da327395..3ec021ef 100644 --- a/src/main/java/vazkii/tinkerer/client/render/tile/RenderTileEnchanter.java +++ b/src/main/java/vazkii/tinkerer/client/render/tile/RenderTileEnchanter.java @@ -14,23 +14,21 @@ */ package vazkii.tinkerer.client.render.tile; -import java.awt.Color; - import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraftforge.client.IItemRenderer.ItemRenderType; - import org.lwjgl.opengl.GL11; - import thaumcraft.client.renderers.item.ItemWandRenderer; import vazkii.tinkerer.client.core.helper.ClientHelper; import vazkii.tinkerer.common.block.tile.TileEnchanter; +import java.awt.*; + public class RenderTileEnchanter extends TileEntitySpecialRenderer { ItemWandRenderer wandRenderer = new ItemWandRenderer(); @@ -55,7 +53,7 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer { int renderPass = 0; do { - Icon icon = item.getItem().getIcon(item, renderPass); + IIcon icon = item.getItem().getIcon(item, renderPass); if(icon != null) { Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass)); GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()); diff --git a/src/main/java/vazkii/tinkerer/client/render/tile/RenderTileMagnet.java b/src/main/java/vazkii/tinkerer/client/render/tile/RenderTileMagnet.java index ad498023..05ef4513 100644 --- a/src/main/java/vazkii/tinkerer/client/render/tile/RenderTileMagnet.java +++ b/src/main/java/vazkii/tinkerer/client/render/tile/RenderTileMagnet.java @@ -16,9 +16,9 @@ package vazkii.tinkerer.client.render.tile; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import thaumcraft.client.lib.UtilsFX; @@ -44,15 +44,15 @@ public class RenderTileMagnet extends TileEntitySpecialRenderer { GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glTranslatef((float)x, (float)y , (float)z); - boolean blue = tileentity.worldObj == null || (tileentity.getBlockMetadata() & 1) == 0; - boolean mob = tileentity.worldObj == null ? RenderTileMagnet.mob : (tileentity.getBlockMetadata() & 2) == 2; + boolean blue = tileentity.getWorldObj() == null || (tileentity.getBlockMetadata() & 1) == 0; + boolean mob = tileentity.getWorldObj() == null ? RenderTileMagnet.mob : (tileentity.getBlockMetadata() & 2) == 2; ClientHelper.minecraft().renderEngine.bindTexture(mob ? blue ? blueMob : redMob : blue ? RenderTileMagnet.blue : red); int redstone = 0; - if(tileentity.worldObj != null) { + if(tileentity.getWorldObj() != null) { for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) - redstone = Math.max(redstone, tileentity.worldObj.getIndirectPowerLevelTo(tileentity.xCoord + dir.offsetX, tileentity.yCoord + dir.offsetY, tileentity.zCoord + dir.offsetZ, dir.ordinal())); + redstone = Math.max(redstone, tileentity.getWorldObj().getIndirectPowerLevelTo(tileentity.xCoord + dir.offsetX, tileentity.yCoord + dir.offsetY, tileentity.zCoord + dir.offsetZ, dir.ordinal())); } else redstone = 15; GL11.glTranslatef(0.5F, 1.5F, 0.5F); @@ -61,7 +61,7 @@ public class RenderTileMagnet extends TileEntitySpecialRenderer { GL11.glRotatef(90F, 1F, 0F, 0F); GL11.glTranslatef(0F, 0F, -0.6F); - Icon icon = ((ItemHoverHarness) ConfigItems.itemHoverHarness).iconLightningRing; + IIcon icon = ((ItemHoverHarness) ConfigItems.itemHoverHarness).iconLightningRing; for(int i = 0; i < 3; i++) { for(int j = 0; j < 2; j++) { diff --git a/src/main/java/vazkii/tinkerer/common/block/kami/BlockWarpGate.java b/src/main/java/vazkii/tinkerer/common/block/kami/BlockWarpGate.java index dd784585..17b94286 100644 --- a/src/main/java/vazkii/tinkerer/common/block/kami/BlockWarpGate.java +++ b/src/main/java/vazkii/tinkerer/common/block/kami/BlockWarpGate.java @@ -15,16 +15,15 @@ package vazkii.tinkerer.common.block.kami; -import java.util.Random; - +import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.World; import vazkii.tinkerer.client.core.helper.IconHelper; import vazkii.tinkerer.client.lib.LibRenderIDs; @@ -32,12 +31,12 @@ import vazkii.tinkerer.common.ThaumicTinkerer; import vazkii.tinkerer.common.block.BlockModContainer; import vazkii.tinkerer.common.block.tile.kami.TileWarpGate; import vazkii.tinkerer.common.lib.LibGuiIDs; -import cpw.mods.fml.common.network.PacketDispatcher; -import cpw.mods.fml.common.network.Player; + +import java.util.Random; public class BlockWarpGate extends BlockModContainer { - public static Icon[] icons = new Icon[3]; + public static IIcon[] icons = new IIcon[3]; Random random; public BlockWarpGate() { @@ -53,7 +52,7 @@ public class BlockWarpGate extends BlockModContainer { if(!par1World.isRemote) { TileEntity tile = par1World.getTileEntity(par2, par3, par4); if(tile != null) { - PacketDispatcher.sendPacketToPlayer(tile.getDescriptionPacket(), (Player) par5EntityPlayer); + par1World.markBlockForUpdate(par2,par3,par4); par5EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_WARP_GATE, par1World, par2, par3, par4); } } @@ -62,7 +61,7 @@ public class BlockWarpGate extends BlockModContainer { } @Override - public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { + public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) { TileWarpGate warpGate = (TileWarpGate) par1World.getTileEntity(par2, par3, par4); if (warpGate != null) { @@ -81,7 +80,7 @@ public class BlockWarpGate extends BlockModContainer { k1 = itemstack.stackSize; itemstack.stackSize -= k1; - entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.itemID, k1, itemstack.getItemDamage())); + entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage())); float f3 = 0.05F; entityitem.motionX = (float)random.nextGaussian() * f3; entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F; @@ -94,23 +93,24 @@ public class BlockWarpGate extends BlockModContainer { } par1World.func_96440_m(par2, par3, par4, par5); + } super.breakBlock(par1World, par2, par3, par4, par5, par6); } @Override - public TileEntity createNewTileEntity(World world) { + public TileEntity createNewTileEntity(World world,int in) { return new TileWarpGate(); } @Override - public Icon getIcon(int par1, int par2) { + public IIcon getIcon(int par1, int par2) { return icons[par1 == 1 ? 0 : 1]; } @Override - public void registerIcons(IconRegister par1IconRegister) { + public void registerBlockIcons(IIconRegister par1IconRegister) { for(int i = 0; i < icons.length; i++) icons[i] = IconHelper.forBlock(par1IconRegister, this, i); } diff --git a/src/main/java/vazkii/tinkerer/common/block/tile/TileAspectAnalyzer.java b/src/main/java/vazkii/tinkerer/common/block/tile/TileAspectAnalyzer.java index ca54b528..cb413ea9 100644 --- a/src/main/java/vazkii/tinkerer/common/block/tile/TileAspectAnalyzer.java +++ b/src/main/java/vazkii/tinkerer/common/block/tile/TileAspectAnalyzer.java @@ -15,24 +15,16 @@ package vazkii.tinkerer.common.block.tile; import appeng.api.movable.IMovableTile; -import dan200.computer.api.IComputerAccess; -import dan200.computer.api.ILuaContext; -import dan200.computer.api.IPeripheral; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; -import thaumcraft.common.lib.ThaumcraftCraftingManager; +import net.minecraftforge.common.util.Constants; import vazkii.tinkerer.common.lib.LibBlockNames; -import java.util.ArrayList; -import java.util.List; - -public class TileAspectAnalyzer extends TileEntity implements IInventory, IPeripheral, IMovableTile { +public class TileAspectAnalyzer extends TileEntity implements IInventory, IMovableTile { ItemStack[] inventorySlots = new ItemStack[1]; @@ -40,10 +32,10 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory, IPerip public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); - NBTTagList var2 = par1NBTTagCompound.getTagList("Items"); + NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); inventorySlots = new ItemStack[getSizeInventory()]; for (int var3 = 0; var3 < var2.tagCount(); ++var3) { - NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); + NBTTagCompound var4 = (NBTTagCompound)var2.getCompoundTagAt(var3); byte var5 = var4.getByte("Slot"); if (var5 >= 0 && var5 < inventorySlots.length) inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4); @@ -108,15 +100,18 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory, IPerip inventorySlots[i] = itemstack; } - @Override - public String getInvName() { - return LibBlockNames.MAGNET; - } + @Override + public String getInventoryName() { + return LibBlockNames.MAGNET; + + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + - @Override - public boolean isInvNameLocalized() { - return false; - } @Override public int getInventoryStackLimit() { @@ -128,22 +123,23 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory, IPerip return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64; } - @Override - public void openChest() { - // NO-OP - } + @Override + public void openInventory() { - @Override - public void closeChest() { - // NO-OP - } + } - @Override + @Override + public void closeInventory() { + + } + + + @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { return true; } - @Override + /*@Override public String getType() { return "tt_aspectanalyzer"; } @@ -202,7 +198,7 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory, IPerip @Override public void detach(IComputerAccess computer) { // NO-OP - } + }*/ @Override public boolean prepareToMove() { return true; diff --git a/src/main/java/vazkii/tinkerer/common/block/tile/TileCamo.java b/src/main/java/vazkii/tinkerer/common/block/tile/TileCamo.java index af7a497e..0d6dc6f5 100644 --- a/src/main/java/vazkii/tinkerer/common/block/tile/TileCamo.java +++ b/src/main/java/vazkii/tinkerer/common/block/tile/TileCamo.java @@ -17,9 +17,8 @@ package vazkii.tinkerer.common.block.tile; import appeng.api.movable.IMovableTile; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet132TileEntityData; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; public class TileCamo extends TileEntity implements IMovableTile { @@ -60,17 +59,17 @@ public class TileCamo extends TileEntity implements IMovableTile { } @Override - public Packet getDescriptionPacket() { + public S35PacketUpdateTileEntity getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); writeCustomNBT(nbttagcompound); - return new Packet132TileEntityData(xCoord, yCoord, zCoord, -999, nbttagcompound); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound); } @Override - public void onDataPacket(INetworkManager manager, Packet132TileEntityData packet) { + public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) { super.onDataPacket(manager, packet); - readCustomNBT(packet.data); - worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord); + readCustomNBT(packet.func_148857_g()); + worldObj.markBlockRangeForRenderUpdate(xCoord-1,yCoord-1,zCoord-1,xCoord+1,yCoord+1,zCoord+1); } @Override diff --git a/src/main/java/vazkii/tinkerer/common/block/tile/TileEnchanter.java b/src/main/java/vazkii/tinkerer/common/block/tile/TileEnchanter.java index 1b2041de..a8ee4166 100644 --- a/src/main/java/vazkii/tinkerer/common/block/tile/TileEnchanter.java +++ b/src/main/java/vazkii/tinkerer/common/block/tile/TileEnchanter.java @@ -15,7 +15,7 @@ package vazkii.tinkerer.common.block.tile; import appeng.api.movable.IMovableTile; -import cpw.mods.fml.common.network.PacketDispatcher; +import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; @@ -23,13 +23,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagInt; import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.INetworkManager; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet132TileEntityData; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.Constants; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.common.Thaumcraft; @@ -134,7 +132,7 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab enchantments.clear(); levels.clear(); worldObj.playSoundEffect(xCoord, yCoord, zCoord, "thaumcraft:wand", 1F, 1F); - PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket()); + worldObj.markBlockForUpdate(xCoord,yCoord,zCoord); return; } @@ -175,13 +173,13 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab } } - @Override - public void onInventoryChanged() { - super.onInventoryChanged(); + @Override + public void markDirty() { + super.markDirty(); if(!worldObj.isRemote && !working) { enchantments.clear(); levels.clear(); - PacketDispatcher.sendPacketToAllInDimension(getDescriptionPacket(), worldObj.provider.dimensionId); + worldObj.markBlockForUpdate(xCoord,yCoord,zCoord); } } @@ -230,13 +228,13 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab if(y + i >= 256) return -1; - int id = worldObj.getBlockId(x, y + i, z); + Block block = worldObj.getBlock(x, y + i, z); int meta = worldObj.getBlockMetadata(x, y + i, z); - if(id == ConfigBlocks.blockCosmeticSolid.blockID && meta == 0) { + if(block == ConfigBlocks.blockCosmeticSolid && meta == 0) { ++obsidianFound; continue; } - if(id == ConfigBlocks.blockAiry.blockID && meta == 1) { + if(block == ConfigBlocks.blockAiry && meta == 1) { if(obsidianFound >= 2 && obsidianFound < 13) return y + i; return -1; @@ -277,20 +275,20 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab currentAspects.readFromNBT(par1NBTTagCompound.getCompoundTag(TAG_CURRENT_ASPECTS)); totalAspects.readFromNBT(par1NBTTagCompound.getCompoundTag(TAG_TOTAL_ASPECTS)); - NBTTagList enchants = par1NBTTagCompound.getTagList(TAG_ENCHANTS); + NBTTagList enchants = par1NBTTagCompound.getTagList(TAG_ENCHANTS, Constants.NBT.TAG_INT); enchantments.clear(); for(int i = 0; i < enchants.tagCount(); i++) - enchantments.add(((NBTTagInt) enchants.tagAt(i)).data); + enchantments.add(Integer.parseInt(enchants.getStringTagAt(i))); - NBTTagList levels = par1NBTTagCompound.getTagList(TAG_LEVELS); + NBTTagList levels = par1NBTTagCompound.getTagList(TAG_LEVELS, Constants.NBT.TAG_INT); this.levels.clear(); for(int i = 0; i < levels.tagCount(); i++) - this.levels.add(((NBTTagInt) levels.tagAt(i)).data); + this.levels.add(Integer.parseInt(levels.getStringTagAt(i))); - NBTTagList var2 = par1NBTTagCompound.getTagList("Items"); + NBTTagList var2 = par1NBTTagCompound.getTagList("Items",Constants.NBT.TAG_COMPOUND); inventorySlots = new ItemStack[getSizeInventory()]; for (int var3 = 0; var3 < var2.tagCount(); ++var3) { - NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); + NBTTagCompound var4 = (NBTTagCompound)var2.getCompoundTagAt(var3); byte var5 = var4.getByte("Slot"); if (var5 >= 0 && var5 < inventorySlots.length) inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4); @@ -300,10 +298,10 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) { NBTTagList enchants = new NBTTagList(); for(int enchant : enchantments) - enchants.appendTag(new NBTTagInt("", enchant)); + enchants.appendTag(new NBTTagInt(enchant)); NBTTagList levels = new NBTTagList(); for(int level : this.levels) - levels.appendTag(new NBTTagInt("", level)); + levels.appendTag(new NBTTagInt(level)); NBTTagCompound totalAspectsCmp = new NBTTagCompound(); totalAspects.writeToNBT(totalAspectsCmp); @@ -312,8 +310,8 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab currentAspects.writeToNBT(currentAspectsCmp); par1NBTTagCompound.setBoolean(TAG_WORKING, working); - par1NBTTagCompound.setCompoundTag(TAG_TOTAL_ASPECTS, totalAspectsCmp); - par1NBTTagCompound.setCompoundTag(TAG_CURRENT_ASPECTS, currentAspectsCmp); + par1NBTTagCompound.setTag(TAG_TOTAL_ASPECTS, totalAspectsCmp); + par1NBTTagCompound.setTag(TAG_CURRENT_ASPECTS, currentAspectsCmp); par1NBTTagCompound.setTag(TAG_ENCHANTS, enchants); par1NBTTagCompound.setTag(TAG_LEVELS, levels); @@ -371,15 +369,17 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab inventorySlots[i] = itemstack; } - @Override - public String getInvName() { - return LibBlockNames.ENCHANTER; - } + @Override + public String getInventoryName() { + return LibBlockNames.ENCHANTER; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + - @Override - public boolean isInvNameLocalized() { - return false; - } @Override public int getInventoryStackLimit() { @@ -391,15 +391,17 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64; } - @Override - public void openChest() { - // NO-OP - } + @Override + public void openInventory() { + + } + + @Override + public void closeInventory() { + + } + - @Override - public void closeChest() { - // NO-OP - } @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { diff --git a/src/main/java/vazkii/tinkerer/common/block/tile/TileFunnel.java b/src/main/java/vazkii/tinkerer/common/block/tile/TileFunnel.java index eea6dda7..88f4a2df 100644 --- a/src/main/java/vazkii/tinkerer/common/block/tile/TileFunnel.java +++ b/src/main/java/vazkii/tinkerer/common/block/tile/TileFunnel.java @@ -15,20 +15,19 @@ package vazkii.tinkerer.common.block.tile; import appeng.api.movable.IMovableTile; -import cpw.mods.fml.common.network.PacketDispatcher; import net.minecraft.block.BlockHopper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet132TileEntityData; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityHopper; import net.minecraft.util.Facing; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.Constants; +import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.aspects.IAspectContainer; @@ -72,8 +71,9 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo } @Override - public void onInventoryChanged() { - PacketDispatcher.sendPacketToAllInDimension(getDescriptionPacket(), worldObj.provider.dimensionId); + public void markDirty() { + super.markDirty(); + worldObj.markBlockForUpdate(xCoord,yCoord,zCoord); } private TileEntity getHopperFacing(int x, int y, int z, int meta) { @@ -96,10 +96,10 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo } public void readCustomNBT(NBTTagCompound par1NBTTagCompound) { - NBTTagList var2 = par1NBTTagCompound.getTagList("Items"); + NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); inventorySlots = new ItemStack[getSizeInventory()]; for (int var3 = 0; var3 < var2.tagCount(); ++var3) { - NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); + NBTTagCompound var4 = (NBTTagCompound)var2.getCompoundTagAt(var3); byte var5 = var4.getByte("Slot"); if (var5 >= 0 && var5 < inventorySlots.length) inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4); @@ -174,15 +174,17 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo inventorySlots[i] = itemstack; } - @Override - public String getInvName() { - return LibBlockNames.FUNNEL; - } + @Override + public String getInventoryName() { + return LibBlockNames.FUNNEL; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + - @Override - public boolean isInvNameLocalized() { - return false; - } @Override public int getInventoryStackLimit() { @@ -194,15 +196,16 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64; } - @Override - public void openChest() { - // NO-OP - } + @Override + public void openInventory() { + + } + + @Override + public void closeInventory() { + + } - @Override - public void closeChest() { - // NO-OP - } @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { @@ -210,16 +213,16 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo } @Override - public Packet getDescriptionPacket() { + public S35PacketUpdateTileEntity getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); writeCustomNBT(nbttagcompound); - return new Packet132TileEntityData(xCoord, yCoord, zCoord, -999, nbttagcompound); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound); } @Override - public void onDataPacket(INetworkManager manager, Packet132TileEntityData packet) { + public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) { super.onDataPacket(manager, packet); - readCustomNBT(packet.data); + readCustomNBT(packet.func_148857_g()); } @Override diff --git a/src/main/java/vazkii/tinkerer/common/block/tile/TileRepairer.java b/src/main/java/vazkii/tinkerer/common/block/tile/TileRepairer.java index 850ad2c2..c23809c6 100644 --- a/src/main/java/vazkii/tinkerer/common/block/tile/TileRepairer.java +++ b/src/main/java/vazkii/tinkerer/common/block/tile/TileRepairer.java @@ -16,17 +16,16 @@ package vazkii.tinkerer.common.block.tile; import appeng.api.movable.IMovableTile; import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.network.PacketDispatcher; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet132TileEntityData; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.Constants; +import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.api.ThaumcraftApiHelper; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; @@ -68,7 +67,7 @@ public class TileRepairer extends TileEntity implements ISidedInventory, IAspect if( dmg > 0) { int essentia = drawEssentia(); TinkersConstructCompat.fixDamage(inventorySlots[0], essentia); - onInventoryChanged(); + markDirty(); if(dmgLastTick != 0 && dmgLastTick != dmg) { ThaumicTinkerer.tcProxy.sparkle((float) (xCoord + 0.25 + Math.random() / 2F), (float) (yCoord + 1 + Math.random() / 2F), (float) (zCoord + 0.25 + Math.random() / 2F), 0); tookLastTick = true; @@ -83,7 +82,7 @@ public class TileRepairer extends TileEntity implements ISidedInventory, IAspect int essentia = drawEssentia(); int dmg = inventorySlots[0].getItemDamage(); inventorySlots[0].setItemDamage(Math.max(0, dmg - essentia)); - onInventoryChanged(); + markDirty(); if(dmgLastTick != 0 && dmgLastTick != dmg) { ThaumicTinkerer.tcProxy.sparkle((float) (xCoord + 0.25 + Math.random() / 2F), (float) (yCoord + 1 + Math.random() / 2F), (float) (zCoord + 0.25 + Math.random() / 2F), 0); @@ -110,12 +109,12 @@ public class TileRepairer extends TileEntity implements ISidedInventory, IAspect } public void readCustomNBT(NBTTagCompound par1NBTTagCompound) { - NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items"); + NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); inventorySlots = new ItemStack[1]; if(nbttaglist.tagCount()>0) { - NBTTagCompound tagList = (NBTTagCompound) nbttaglist.tagAt(0); + NBTTagCompound tagList = (NBTTagCompound) nbttaglist.getCompoundTagAt(0); inventorySlots[0] = ItemStack.loadItemStackFromNBT(tagList); } } @@ -174,15 +173,15 @@ public class TileRepairer extends TileEntity implements ISidedInventory, IAspect inventorySlots[i] = itemstack; } - @Override - public String getInvName() { - return LibBlockNames.FUNNEL; - } + @Override + public String getInventoryName() { + return LibBlockNames.FUNNEL; + } - @Override - public boolean isInvNameLocalized() { - return false; - } + @Override + public boolean hasCustomInventoryName() { + return false; + } @Override public int getInventoryStackLimit() { @@ -194,15 +193,16 @@ public class TileRepairer extends TileEntity implements ISidedInventory, IAspect return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64; } - @Override - public void openChest() { - // NO-OP - } + @Override + public void openInventory() { + + } + + @Override + public void closeInventory() { + + } - @Override - public void closeChest() { - // NO-OP - } @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { @@ -210,21 +210,22 @@ public class TileRepairer extends TileEntity implements ISidedInventory, IAspect } @Override - public Packet getDescriptionPacket() { + public S35PacketUpdateTileEntity getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); writeCustomNBT(nbttagcompound); - return new Packet132TileEntityData(xCoord, yCoord, zCoord, -999, nbttagcompound); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound); } @Override - public void onDataPacket(INetworkManager manager, Packet132TileEntityData packet) { + public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) { super.onDataPacket(manager, packet); - readCustomNBT(packet.data); + readCustomNBT(packet.func_148857_g()); } @Override - public void onInventoryChanged() { - PacketDispatcher.sendPacketToAllInDimension(getDescriptionPacket(), worldObj.provider.dimensionId); + public void markDirty() { + super.markDirty(); + worldObj.markBlockForUpdate(xCoord,yCoord,zCoord); } @Override diff --git a/src/main/java/vazkii/tinkerer/common/block/tile/kami/TileWarpGate.java b/src/main/java/vazkii/tinkerer/common/block/tile/kami/TileWarpGate.java index 7b0491c7..3a636e32 100644 --- a/src/main/java/vazkii/tinkerer/common/block/tile/kami/TileWarpGate.java +++ b/src/main/java/vazkii/tinkerer/common/block/tile/kami/TileWarpGate.java @@ -20,12 +20,13 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet132TileEntityData; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.ChunkCoordinates; +import net.minecraftforge.common.util.Constants; import vazkii.tinkerer.common.ThaumicTinkerer; import vazkii.tinkerer.common.item.ModItems; import vazkii.tinkerer.common.item.kami.ItemSkyPearl; @@ -95,9 +96,9 @@ public class TileWarpGate extends TileEntity implements IInventory { player.worldObj.playSoundAtEntity(player, "thaumcraft:wand", 1F, 0.1F); return true; } else if(!player.worldObj.isRemote) - player.addChatMessage("ttmisc.noTeleport"); + player.addChatMessage(new ChatComponentTranslation("ttmisc.noTeleport")); } else if(!player.worldObj.isRemote) - player.addChatMessage("ttmisc.noDest"); + player.addChatMessage(new ChatComponentTranslation("ttmisc.noDest")); return false; } @@ -119,10 +120,10 @@ public class TileWarpGate extends TileEntity implements IInventory { public void readCustomNBT(NBTTagCompound par1NBTTagCompound) { locked = par1NBTTagCompound.getBoolean(TAG_LOCKED); - NBTTagList var2 = par1NBTTagCompound.getTagList("Items"); + NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); inventorySlots = new ItemStack[getSizeInventory()]; for (int var3 = 0; var3 < var2.tagCount(); ++var3) { - NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); + NBTTagCompound var4 = (NBTTagCompound)var2.getCompoundTagAt(var3); byte var5 = var4.getByte("Slot"); if (var5 >= 0 && var5 < inventorySlots.length) inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4); @@ -186,15 +187,15 @@ public class TileWarpGate extends TileEntity implements IInventory { inventorySlots[i] = itemstack; } - @Override - public String getInvName() { - return LibBlockNames.WARP_GATE; - } + @Override + public String getInventoryName() { + return LibBlockNames.WARP_GATE; + } - @Override - public boolean isInvNameLocalized() { - return false; - } + @Override + public boolean hasCustomInventoryName() { + return false; + } @Override public int getInventoryStackLimit() { @@ -206,32 +207,34 @@ public class TileWarpGate extends TileEntity implements IInventory { return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64; } - @Override - public void openChest() { - // NO-OP - } + @Override + public void openInventory() { + + } + + @Override + public void closeInventory() { + + } + - @Override - public void closeChest() { - // NO-OP - } @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return itemstack.itemID == ModItems.skyPearl.itemID; + return itemstack.getItem() == ModItems.skyPearl; } @Override - public Packet getDescriptionPacket() { + public S35PacketUpdateTileEntity getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); writeCustomNBT(nbttagcompound); - return new Packet132TileEntityData(xCoord, yCoord, zCoord, -999, nbttagcompound); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound); } @Override - public void onDataPacket(INetworkManager manager, Packet132TileEntityData packet) { + public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) { super.onDataPacket(manager, packet); - readCustomNBT(packet.data); + readCustomNBT(packet.func_148857_g()); } } diff --git a/src/main/java/vazkii/tinkerer/common/block/tile/tablet/TileAnimationTablet.java b/src/main/java/vazkii/tinkerer/common/block/tile/tablet/TileAnimationTablet.java index 021b3f98..a93f8222 100644 --- a/src/main/java/vazkii/tinkerer/common/block/tile/tablet/TileAnimationTablet.java +++ b/src/main/java/vazkii/tinkerer/common/block/tile/tablet/TileAnimationTablet.java @@ -15,35 +15,28 @@ package vazkii.tinkerer.common.block.tile.tablet; import appeng.api.movable.IMovableTile; -import cpw.mods.fml.common.network.PacketDispatcher; -import dan200.computer.api.IComputerAccess; -import dan200.computer.api.ILuaContext; -import dan200.computer.api.IPeripheral; +import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.block.Block; -import net.minecraft.command.PlayerSelector; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet132TileEntityData; -import net.minecraft.network.packet.Packet3Chat; -import net.minecraft.server.MinecraftServer; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.ChatMessageComponent; +import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.FakePlayer; -import net.minecraftforge.common.ForgeDirection; -import net.minecraftforge.event.Event; +import net.minecraftforge.common.util.Constants; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; @@ -54,7 +47,7 @@ import vazkii.tinkerer.common.lib.LibBlockNames; import java.util.ArrayList; import java.util.List; -public class TileAnimationTablet extends TileEntity implements IInventory, IPeripheral, IMovableTile { +public class TileAnimationTablet extends TileEntity implements IInventory ,IMovableTile{ private static final String TAG_LEFT_CLICK = "leftClick"; private static final String TAG_REDSTONE = "redstone"; @@ -132,7 +125,7 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IPeri if((!redstone || isBreaking) && detect && swingProgress == 0) { initiateSwing(); - worldObj.addBlockEvent(xCoord, yCoord, zCoord, ModBlocks.animationTablet.blockID, 0, 0); + worldObj.addBlockEvent(xCoord, yCoord, zCoord, ModBlocks.animationTablet, 0, 0); } } @@ -145,7 +138,7 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IPeri ChunkCoordinates coords = getTargetLoc(); ItemStack stack = getStackInSlot(0); Item item = stack.getItem(); - int id = worldObj.getBlockId(coords.posX, coords.posY, coords.posZ); + Block block = worldObj.getBlock(coords.posX, coords.posY, coords.posZ); player.setCurrentItemOrArmor(0, stack); //EntityPlayer realPlayer=MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(Owner); @@ -163,19 +156,19 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IPeri player.attackTargetEntityWithCurrentItem(entity); done = true; } else if(!isBreaking){ - if(id != 0 && !Block.blocksList[id].isAirBlock(worldObj, coords.posX, coords.posY, coords.posZ) && Block.blocksList[id].getBlockHardness(worldObj, coords.posX, coords.posY, coords.posZ) >= 0) { + if(block!=Blocks.air && !block.isAir(worldObj, coords.posX, coords.posY, coords.posZ) && block.getBlockHardness(worldObj, coords.posX, coords.posY, coords.posZ) >= 0) { isBreaking = true; - startBreaking(Block.blocksList[id], worldObj.getBlockMetadata(coords.posX, coords.posY, coords.posZ)); + startBreaking(block, worldObj.getBlockMetadata(coords.posX, coords.posY, coords.posZ)); done = true; } } } else { int side = SIDES[(getBlockMetadata() & 7) - 2].getOpposite().ordinal(); - if(!(id != 0 && !Block.blocksList[id].isAirBlock(worldObj, coords.posX, coords.posY, coords.posZ))) { + if(!(block!=Blocks.air && !block.isAir(worldObj, coords.posX, coords.posY, coords.posZ))) { coords.posY -= 1; side = ForgeDirection.UP.ordinal(); - id = worldObj.getBlockId(coords.posX, coords.posY, coords.posZ); + block = worldObj.getBlock(coords.posX, coords.posY, coords.posZ); } try { @@ -186,7 +179,7 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IPeri if(!done) item.onItemUseFirst(stack, player, worldObj, coords.posX, coords.posY, coords.posZ, side, 0F, 0F, 0F); if(!done) - done = Block.blocksList[id] != null && Block.blocksList[id].onBlockActivated(worldObj, coords.posX, coords.posY, coords.posZ, player, side, 0F, 0F, 0F); + done = block != null && block.onBlockActivated(worldObj, coords.posX, coords.posY, coords.posZ, player, side, 0F, 0F, 0F); if(!done) done = item.onItemUse(stack, player, worldObj, coords.posX, coords.posY, coords.posZ, side, 0F, 0F, 0F); if(!done) { @@ -196,12 +189,13 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IPeri } catch(Throwable e) { e.printStackTrace(); - Packet3Chat packet = new Packet3Chat(new ChatMessageComponent().addText(EnumChatFormatting.RED + "Something went wrong with a Tool Dynamism Tablet! Check your FML log.")); - Packet3Chat packet1 = new Packet3Chat(new ChatMessageComponent().addText(EnumChatFormatting.RED + "" + EnumChatFormatting.ITALIC + e.getMessage())); - - PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 16, worldObj.provider.dimensionId, packet); - PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 16, worldObj.provider.dimensionId, packet1); - } + List list=worldObj.getEntitiesWithinAABB(EntityPlayer.class,AxisAlignedBB.getBoundingBox(xCoord-8,yCoord-8,zCoord-8,xCoord+8,yCoord+8,zCoord+8)); + for(Object player:list) + { + ((EntityPlayer)player).addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "Something went wrong with a Tool Dynamism Tablet! Check your FML log.")); + ((EntityPlayer)player).addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "" + EnumChatFormatting.ITALIC + e.getMessage())); + } + } } if(done) { @@ -209,16 +203,16 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IPeri if(stack == null || stack.stackSize == 0) setInventorySlotContents(0, null); - PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket()); - } - onInventoryChanged(); + worldObj.markBlockForUpdate(xCoord,yCoord,zCoord); + } + markDirty(); } // Copied from ItemInWorldManager, seems to do the trick. private void stopBreaking() { isBreaking = false; ChunkCoordinates coords = getTargetLoc(); - worldObj.destroyBlockInWorldPartially(player.entityId, coords.posX, coords.posY, coords.posZ, -1); + worldObj.destroyBlockInWorldPartially(player.getEntityId(), coords.posX, coords.posY, coords.posZ, -1); } // Copied from ItemInWorldManager, seems to do the trick. @@ -251,7 +245,7 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IPeri stopBreaking(); } else { int var7 = (int) (var5 * 10); - worldObj.destroyBlockInWorldPartially(player.entityId, coords.posX, coords.posY, coords.posZ, var7); + worldObj.destroyBlockInWorldPartially(player.getEntityId(), coords.posX, coords.posY, coords.posZ, var7); durabilityRemainingOnBlock = var7; } } @@ -265,17 +259,16 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IPeri ChunkCoordinates coords = getTargetLoc(); var1 = curblockDamage - initialDamage; - int var2 = worldObj.getBlockId(coords.posX, coords.posY, coords.posZ); + Block block= worldObj.getBlock(coords.posX, coords.posY, coords.posZ); - if (var2 == 0) + if (block== Blocks.air) stopBreaking(); else { - Block var3 = Block.blocksList[var2]; - var4 = var3.getPlayerRelativeBlockHardness(player, worldObj,coords.posX, coords.posY, coords.posZ) * var1; + var4 = block.getPlayerRelativeBlockHardness(player, worldObj,coords.posX, coords.posY, coords.posZ) * var1; var5 = (int) (var4 * 10); if (var5 != durabilityRemainingOnBlock) { - worldObj.destroyBlockInWorldPartially(player.entityId, coords.posX, coords.posY, coords.posZ, var5); + worldObj.destroyBlockInWorldPartially(player.getEntityId(), coords.posX, coords.posY, coords.posZ, var5); durabilityRemainingOnBlock = var5; } @@ -292,36 +285,35 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IPeri if (stack != null && stack.getItem().onBlockStartBreak(stack, par1, par2, par3, player)) return false; - int var4 = worldObj.getBlockId(par1, par2, par3); + Block block =worldObj.getBlock(par1, par2, par3); int var5 = worldObj.getBlockMetadata(par1, par2, par3); - worldObj.playAuxSFXAtEntity(player, 2001, par1, par2, par3, var4 + (var5 << 12)); + //worldObj.playAuxSFXAtEntity(player, 2001, par1, par2, par3, var4 + (var5 << 12)); boolean var6 = false; boolean var8 = false; - Block block = Block.blocksList[var4]; if (block != null) var8 = block.canHarvestBlock(player, var5); worldObj.loadedEntityList.size(); if (stack != null) - stack.onBlockDestroyed(worldObj, var4, par1, par2, par3, player); + stack.getItem().onBlockDestroyed(stack, worldObj, block, par1, par2, par3, player); var6 = removeBlock(par1, par2, par3); if (var6 && var8) - Block.blocksList[var4].harvestBlock(worldObj, player, par1, par2, par3, var5); + block.harvestBlock(worldObj, player, par1, par2, par3, var5); return var6; } // Copied from ItemInWorldManager, seems to do the trick. private boolean removeBlock(int par1, int par2, int par3) { - Block var4 = Block.blocksList[worldObj.getBlockId(par1, par2, par3)]; + Block var4 = worldObj.getBlock(par1, par2, par3); int var5 = worldObj.getBlockMetadata(par1, par2, par3); if (var4 != null) var4.onBlockHarvested(worldObj, par1, par2, par3, var5, player); - boolean var6 = var4 != null && var4.removeBlockByPlayer(worldObj, player, par1, par2, par3); + boolean var6 = var4 != null && var4.removedByPlayer(worldObj, player, par1, par2, par3); if (var4 != null && var6) var4.onBlockDestroyedByPlayer(worldObj, par1, par2, par3, var5); @@ -393,10 +385,10 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IPeri leftClick = par1NBTTagCompound.getBoolean(TAG_LEFT_CLICK); redstone = par1NBTTagCompound.getBoolean(TAG_REDSTONE); - NBTTagList var2 = par1NBTTagCompound.getTagList("Items"); + NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); inventorySlots = new ItemStack[getSizeInventory()]; for (int var3 = 0; var3 < var2.tagCount(); ++var3) { - NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); + NBTTagCompound var4 = (NBTTagCompound)var2.getCompoundTagAt(var3); byte var5 = var4.getByte("Slot"); if (var5 >= 0 && var5 < inventorySlots.length) inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4); @@ -439,7 +431,7 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IPeri inventorySlots[par1] = null; if(!worldObj.isRemote) - PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket()); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); return stackAt; } else { @@ -449,7 +441,7 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IPeri inventorySlots[par1] = null; if(!worldObj.isRemote) - PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket()); + worldObj.markBlockForUpdate(xCoord,yCoord,zCoord); return stackAt; } @@ -468,18 +460,18 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IPeri inventorySlots[i] = itemstack; if(!worldObj.isRemote) - PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket()); + worldObj.markBlockForUpdate(xCoord,yCoord,zCoord); } - @Override - public String getInvName() { - return LibBlockNames.ANIMATION_TABLET; - } + @Override + public String getInventoryName() { + return LibBlockNames.ANIMATION_TABLET; + } - @Override - public boolean isInvNameLocalized() { - return false; - } + @Override + public boolean hasCustomInventoryName() { + return false; + } @Override public int getInventoryStackLimit() { @@ -496,30 +488,31 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IPeri return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64; } - @Override - public void openChest() { - // NO-OP - } + @Override + public void openInventory() { + + } + + @Override + public void closeInventory() { + + } + @Override - public void closeChest() { - // NO-OP - } - - @Override - public Packet getDescriptionPacket() { + public S35PacketUpdateTileEntity getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); writeCustomNBT(nbttagcompound); - return new Packet132TileEntityData(xCoord, yCoord, zCoord, -999, nbttagcompound); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound); } @Override - public void onDataPacket(INetworkManager manager, Packet132TileEntityData packet) { + public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) { super.onDataPacket(manager, packet); - readCustomNBT(packet.data); + readCustomNBT(packet.func_148857_g()); } - @Override + /*@Override public String getType() { return "tt_animationTablet"; } @@ -527,9 +520,9 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IPeri @Override public String[] getMethodNames() { return new String[]{ "getRedstone", "setRedstone", "getLeftClick", "setLeftClick", "getRotation", "setRotation", "hasItem", "trigger" }; - } + }*/ - @Override + /*@Override public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception { switch(method) { case 0 : return new Object[]{ redstone }; @@ -569,22 +562,22 @@ public class TileAnimationTablet extends TileEntity implements IInventory, IPeri } } return null; - } + }*/ - @Override - public boolean canAttachToSide(int side) { - return true; - } + //@Override + //public boolean canAttachToSide(int side) { + // return true; + //} - @Override - public void attach(IComputerAccess computer) { - // NO-OP - } + //@Override + //public void attach(IComputerAccess computer) { + // // NO-OP + //} - @Override - public void detach(IComputerAccess computer) { - // NO-OP - } + //@Override + //public void detach(IComputerAccess computer) { + // // NO-OP + //} @Override public boolean prepareToMove() { diff --git a/src/main/java/vazkii/tinkerer/common/block/tile/transvector/TileTransvectorDislocator.java b/src/main/java/vazkii/tinkerer/common/block/tile/transvector/TileTransvectorDislocator.java index ae047389..d1efc0d1 100644 --- a/src/main/java/vazkii/tinkerer/common/block/tile/transvector/TileTransvectorDislocator.java +++ b/src/main/java/vazkii/tinkerer/common/block/tile/transvector/TileTransvectorDislocator.java @@ -17,12 +17,12 @@ package vazkii.tinkerer.common.block.tile.transvector; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; +import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChunkCoordinates; -import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.api.ThaumcraftApi; import thaumcraft.client.codechicken.core.vec.Vector3; import thaumcraft.common.config.ConfigBlocks; @@ -40,14 +40,14 @@ public class TileTransvectorDislocator extends TileTransvector { class BlockData { - int id; + Block block; int meta; NBTTagCompound tile; ChunkCoordinates coords; - public BlockData(int id, int meta, TileEntity tile, ChunkCoordinates coords) { - this.id = id; + public BlockData(Block block, int meta, TileEntity tile, ChunkCoordinates coords) { + this.block = block; this.meta = meta; if(tile != null) { @@ -60,23 +60,22 @@ public class TileTransvectorDislocator extends TileTransvector { } public BlockData(ChunkCoordinates coords) { - this(worldObj.getBlockId(coords.posX, coords.posY, coords.posZ), worldObj.getBlockMetadata(coords.posX, coords.posY, coords.posZ), worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ), coords); + this(worldObj.getBlock(coords.posX, coords.posY, coords.posZ), worldObj.getBlockMetadata(coords.posX, coords.posY, coords.posZ), worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ), coords); } public void clearTileEntityAt() { - Block block = Block.blocksList[id]; if(block != null) { TileEntity tileToSet = block.createTileEntity(worldObj, meta); - worldObj.setBlockTileEntity(coords.posX, coords.posY, coords.posZ, tileToSet); + worldObj.setTileEntity(coords.posX, coords.posY, coords.posZ, tileToSet); } } public void setTo(ChunkCoordinates coords) { - worldObj.setBlock(coords.posX, coords.posY, coords.posZ, id, meta, 1 | 2); + worldObj.setBlock(coords.posX, coords.posY, coords.posZ, block, meta, 1 | 2); TileEntity tile = this.tile == null ? null : TileEntity.createAndLoadEntity(this.tile); - worldObj.setBlockTileEntity(coords.posX, coords.posY, coords.posZ, tile); + worldObj.setTileEntity(coords.posX, coords.posY, coords.posZ, tile); if(tile != null) { tile.xCoord = coords.posX; @@ -85,8 +84,8 @@ public class TileTransvectorDislocator extends TileTransvector { tile.updateContainingBlockInfo(); } - if(Block.blocksList[id] != null) - Block.blocksList[id].onNeighborBlockChange(worldObj, coords.posX, coords.posY, coords.posZ, ModBlocks.dislocator.blockID); + if(block != null) + block.onNeighborBlockChange(worldObj, coords.posX, coords.posY, coords.posZ, ModBlocks.dislocator); worldObj.setBlockMetadataWithNotify(coords.posX, coords.posY, coords.posZ, meta, 3); @@ -147,10 +146,10 @@ public class TileTransvectorDislocator extends TileTransvector { } private boolean checkBlock(ChunkCoordinates coords) { - int id = worldObj.getBlockId(coords.posX, coords.posY, coords.posZ); + Block block = worldObj.getBlock(coords.posX, coords.posY, coords.posZ); int meta = worldObj.getBlockMetadata(coords.posX, coords.posY, coords.posZ); - return !(id == ConfigBlocks.blockAiry.blockID && meta == 0) && !ThaumcraftApi.portableHoleBlackList.contains(id) && Item.itemsList[id] != null && Block.blocksList[id] != null && Block.blocksList[id].getBlockHardness(worldObj, coords.posX, coords.posY, coords.posZ) != -1F || id == 0; + return !(block == ConfigBlocks.blockAiry && meta == 0) && !ThaumcraftApi.portableHoleBlackList.contains(block) && block != null && block.getBlockHardness(worldObj, coords.posX, coords.posY, coords.posZ) != -1F || block != Blocks.air; } private List getEntitiesAtPoint(ChunkCoordinates coords) { diff --git a/src/main/java/vazkii/tinkerer/common/block/transvector/BlockTransvectorDislocator.java b/src/main/java/vazkii/tinkerer/common/block/transvector/BlockTransvectorDislocator.java index 97863a1c..b5ac4b4e 100644 --- a/src/main/java/vazkii/tinkerer/common/block/transvector/BlockTransvectorDislocator.java +++ b/src/main/java/vazkii/tinkerer/common/block/transvector/BlockTransvectorDislocator.java @@ -14,27 +14,27 @@ */ package vazkii.tinkerer.common.block.transvector; -import java.util.Random; - +import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.World; import thaumcraft.common.config.ConfigItems; import vazkii.tinkerer.client.core.helper.IconHelper; import vazkii.tinkerer.common.block.BlockCamo; -import vazkii.tinkerer.common.block.tile.transvector.TileTransvector; +import vazkii.tinkerer.common.block.tile.TileCamo; import vazkii.tinkerer.common.block.tile.transvector.TileTransvectorDislocator; -import cpw.mods.fml.common.network.PacketDispatcher; + +import java.util.Random; public class BlockTransvectorDislocator extends BlockCamo { - Icon[] icons = new Icon[2]; + IIcon[] icons = new IIcon[2]; public BlockTransvectorDislocator() { super(Material.iron); @@ -49,11 +49,11 @@ public class BlockTransvectorDislocator extends BlockCamo { TileTransvectorDislocator dislocator = (TileTransvectorDislocator) tile; ItemStack currentStack = par5EntityPlayer.getCurrentEquippedItem(); - if(currentStack != null && currentStack.itemID == ConfigItems.itemWandCasting.itemID) { + if(currentStack != null && currentStack.getItem()== ConfigItems.itemWandCasting) { dislocator.orientation = par6; par1World.playSoundEffect(par2, par3, par4, "thaumcraft:tool", 0.6F, 1F); - PacketDispatcher.sendPacketToAllInDimension(tile.getDescriptionPacket(), par1World.provider.dimensionId); + par1World.markBlockForUpdate(par2,par3,par4); return true; } @@ -62,7 +62,7 @@ public class BlockTransvectorDislocator extends BlockCamo { } @Override - public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) { if(par1World.isRemote) return; @@ -71,7 +71,7 @@ public class BlockTransvectorDislocator extends BlockCamo { boolean on = meta != 0; if (power && !on) { - par1World.scheduleBlockUpdate(par2, par3, par4, blockID, tickRate(par1World)); + par1World.scheduleBlockUpdate(par2, par3, par4, this, tickRate(par1World)); par1World.setBlockMetadataWithNotify(par2, par3, par4, 1, 4); } else if (!power && on) par1World.setBlockMetadataWithNotify(par2, par3, par4, 0, 4); @@ -92,18 +92,18 @@ public class BlockTransvectorDislocator extends BlockCamo { } @Override - public void registerIcons(IconRegister par1IconRegister) { + public void registerBlockIcons(IIconRegister par1IconRegister) { icons[0] = IconHelper.forBlock(par1IconRegister, this, 0); icons[1] = IconHelper.forBlock(par1IconRegister, this, 1); } @Override - public Icon getIconFromSideAfterCheck(TileEntity tile, int meta, int side) { + public IIcon getIconFromSideAfterCheck(TileEntity tile, int meta, int side) { return icons[((TileTransvectorDislocator) tile).orientation == side ? 1 : 0]; } @Override - public Icon getIcon(int par1, int par2) { + public IIcon getIcon(int par1, int par2) { return icons[0]; } @@ -112,12 +112,12 @@ public class BlockTransvectorDislocator extends BlockCamo { TileEntity tile = par1World.getTileEntity(par2, par3, par4); int orientation = BlockPistonBase.determineOrientation(par1World, par2, par3, par4, par5EntityLivingBase); ((TileTransvectorDislocator) tile).orientation = orientation; - PacketDispatcher.sendPacketToAllInDimension(tile.getDescriptionPacket(), par1World.provider.dimensionId); + par1World.markBlockForUpdate(par2,par3,par4); } - @Override - public TileTransvector createNewTileEntity(World world) { - return new TileTransvectorDislocator(); - } + @Override + public TileCamo createNewTileEntity(World world, int var2) { + return new TileTransvectorDislocator(); + } } diff --git a/src/main/java/vazkii/tinkerer/common/compat/EnderStorageFunctions.java b/src/main/java/vazkii/tinkerer/common/compat/EnderStorageFunctions.java index 1668a5f4..e3936983 100644 --- a/src/main/java/vazkii/tinkerer/common/compat/EnderStorageFunctions.java +++ b/src/main/java/vazkii/tinkerer/common/compat/EnderStorageFunctions.java @@ -1,24 +1,16 @@ package vazkii.tinkerer.common.compat; -import java.util.List; - -import codechicken.enderstorage.api.EnderStorageManager; -import codechicken.enderstorage.storage.item.EnderItemStorage; -import codechicken.enderstorage.storage.item.TileEnderChest; - -import thaumcraft.common.items.wands.ItemWandCasting; -import vazkii.tinkerer.common.item.foci.ItemFocusEnderChest; -import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; +import java.util.List; + public class EnderStorageFunctions { public static ItemStack onFocusRightClick(ItemStack stack, World world, EntityPlayer p, MovingObjectPosition pos) { - ItemWandCasting wand = (ItemWandCasting) stack.getItem(); + return stack; + /*ItemWandCasting wand = (ItemWandCasting) stack.getItem(); ItemStack focus=wand.getFocusItem(stack); if(world.isRemote) return stack; @@ -66,7 +58,7 @@ public class EnderStorageFunctions { } } - return stack; + return stack;*/ } private static String getOwner(ItemStack stack) { diff --git a/src/main/java/vazkii/tinkerer/common/enchantment/EnchantmentAutoSmelt.java b/src/main/java/vazkii/tinkerer/common/enchantment/EnchantmentAutoSmelt.java index 34e0387b..7f3d7d48 100644 --- a/src/main/java/vazkii/tinkerer/common/enchantment/EnchantmentAutoSmelt.java +++ b/src/main/java/vazkii/tinkerer/common/enchantment/EnchantmentAutoSmelt.java @@ -33,7 +33,7 @@ public class EnchantmentAutoSmelt extends EnchantmentMod { @Override public boolean canApply(ItemStack par1ItemStack) { - return super.canApply(par1ItemStack) && par1ItemStack.itemID != ConfigItems.itemAxeElemental.itemID; + return super.canApply(par1ItemStack) && par1ItemStack.getItem() != ConfigItems.itemAxeElemental; } } diff --git a/src/main/java/vazkii/tinkerer/common/enchantment/ModEnchantmentHandler.java b/src/main/java/vazkii/tinkerer/common/enchantment/ModEnchantmentHandler.java index 7a5cacc3..344f1ec3 100644 --- a/src/main/java/vazkii/tinkerer/common/enchantment/ModEnchantmentHandler.java +++ b/src/main/java/vazkii/tinkerer/common/enchantment/ModEnchantmentHandler.java @@ -14,7 +14,8 @@ */ package vazkii.tinkerer.common.enchantment; -import cpw.mods.fml.relauncher.ReflectionHelper; +import cpw.mods.fml.common.eventhandler.EventPriority; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.block.material.Material; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityLivingBase; @@ -24,8 +25,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; -import net.minecraftforge.event.EventPriority; -import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingFallEvent; @@ -46,7 +45,7 @@ public class ModEnchantmentHandler { public final String NBTTunnelDirection="TTEnchantTunnelDir"; - @ForgeSubscribe + @SubscribeEvent public void onEntityDamaged(LivingHurtEvent event) { if(event.source.getEntity() instanceof EntityLivingBase) { EntityLivingBase attacker = (EntityLivingBase) event.source.getEntity(); @@ -64,7 +63,7 @@ public class ModEnchantmentHandler { ItemStack legs = player.getCurrentArmor(1); int pounce = EnchantmentHelper.getEnchantmentLevel(LibEnchantIDs.pounce, legs); if(pounce > 0){ - if(player.worldObj.getBlockId((int)Math.floor(player.posX), (int)Math.floor(player.posY)-1, (int)Math.floor(player.posZ)) == 0){ + if(player.worldObj.getBlock((int) Math.floor(player.posX), (int) Math.floor(player.posY) - 1, (int) Math.floor(player.posZ)) == net.minecraft.init.Blocks.air){ event.ammount*=1+(.25*pounce); } @@ -94,7 +93,7 @@ public class ModEnchantmentHandler { if(focusedStrikes > 0 || dispersedStrikes > 0) { int lastTarget=heldItem.stackTagCompound.getInteger(NBTLastTarget); int successiveStrikes=heldItem.stackTagCompound.getInteger(NBTSuccessiveStrike); - int entityId=event.entityLiving.entityId; + int entityId=event.entityLiving.getEntityId(); if(lastTarget!=entityId){ heldItem.stackTagCompound.setInteger(NBTSuccessiveStrike, 0); @@ -125,7 +124,7 @@ public class ModEnchantmentHandler { } } - @ForgeSubscribe(priority = EventPriority.HIGHEST) + @SubscribeEvent(priority = EventPriority.HIGHEST) public void onEntityUpdate(LivingUpdateEvent event) { final double min = -0.0784000015258789; @@ -145,15 +144,15 @@ public class ModEnchantmentHandler { return; int quickDraw = EnchantmentHelper.getEnchantmentLevel(LibEnchantIDs.idQuickDraw, heldItem); - ItemStack usingItem = ReflectionHelper.getPrivateValue(EntityPlayer.class, player, LibObfuscation.ITEM_IN_USE); - int time = ReflectionHelper.getPrivateValue(EntityPlayer.class, player, LibObfuscation.ITEM_IN_USE_COUNT); + ItemStack usingItem = player.itemInUse; + int time = player.itemInUseCount; if(quickDraw > 0 && usingItem != null && usingItem.getItem() instanceof ItemBow) if((usingItem.getItem().getMaxItemUseDuration(usingItem) - time) % (6 - quickDraw) == 0) - ReflectionHelper.setPrivateValue(EntityPlayer.class, player, time - 1, LibObfuscation.ITEM_IN_USE_COUNT); + player.itemInUseCount=time - 1; } } - @ForgeSubscribe + @SubscribeEvent public void onPlayerJump(LivingJumpEvent event) { if(event.entityLiving instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.entityLiving; @@ -164,7 +163,7 @@ public class ModEnchantmentHandler { } } - @ForgeSubscribe(priority = EventPriority.LOW) + @SubscribeEvent(priority = EventPriority.LOW) public void onFall(LivingFallEvent event){ if(event.entityLiving instanceof EntityPlayer){ ItemStack boots = ((EntityPlayer)event.entityLiving).getCurrentArmor(0); @@ -179,7 +178,7 @@ public class ModEnchantmentHandler { } } - @ForgeSubscribe + @SubscribeEvent public void onBreakBlock(BlockEvent.BreakEvent event) { ItemStack item=event.getPlayer().getCurrentEquippedItem(); int tunnel=EnchantmentHelper.getEnchantmentLevel(LibEnchantIDs.tunnel, item); @@ -190,7 +189,7 @@ public class ModEnchantmentHandler { } - @ForgeSubscribe(priority = EventPriority.HIGHEST) + @SubscribeEvent(priority = EventPriority.HIGHEST) public void onGetHarvestSpeed(PlayerEvent.BreakSpeed event) { ItemStack heldItem = event.entityPlayer.getHeldItem(); @@ -223,8 +222,8 @@ public class ModEnchantmentHandler { int desintegrate = EnchantmentHelper.getEnchantmentLevel(LibEnchantIDs.idDesintegrate, heldItem); int autoSmelt = EnchantmentHelper.getEnchantmentLevel(LibEnchantIDs.idAutoSmelt, heldItem); - boolean desintegrateApplies = desintegrate > 0 && event.block.blockHardness <= 1.5F && heldItem.getItem().getStrVsBlock(heldItem, event.block, event.metadata) != 1F; - boolean autoSmeltApplies = autoSmelt > 0 && event.block.blockMaterial == Material.wood; + boolean desintegrateApplies = desintegrate > 0 && event.block.blockHardness <= 1.5F; + boolean autoSmeltApplies = autoSmelt > 0 && event.block.getMaterial() == Material.wood; if(desintegrateApplies || autoSmeltApplies) { heldItem.damageItem(1, event.entityPlayer); diff --git a/src/main/java/vazkii/tinkerer/common/research/EnderStorageRecepie.java b/src/main/java/vazkii/tinkerer/common/research/EnderStorageRecepie.java index 05d86329..43a36696 100644 --- a/src/main/java/vazkii/tinkerer/common/research/EnderStorageRecepie.java +++ b/src/main/java/vazkii/tinkerer/common/research/EnderStorageRecepie.java @@ -1,20 +1,10 @@ package vazkii.tinkerer.common.research; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; -import thaumcraft.common.config.ConfigBlocks; -import thaumcraft.common.config.ConfigItems; -import vazkii.tinkerer.common.item.ModItems; -import vazkii.tinkerer.common.lib.LibResearch; -import codechicken.enderstorage.EnderStorage; - public class EnderStorageRecepie { public static void loadRecipes() { - ModRecipes.registerResearchItemI(LibResearch.KEY_BLOCK_TALISMAN, new ItemStack(ModItems.blockTalisman), 9, new AspectList().add(Aspect.VOID, 65).add(Aspect.DARKNESS, 32).add(Aspect.MAGIC, 50).add(Aspect.ELDRITCH, 32), new ItemStack(ConfigItems.itemFocusPortableHole), - new ItemStack(ModItems.kamiResource), new ItemStack(EnderStorage.blockEnderChest, 0), new ItemStack(Item.diamond), new ItemStack(ModItems.kamiResource), new ItemStack(ConfigItems.itemResource, 1, 11), new ItemStack(ConfigBlocks.blockJar, 1, 3)); + //ModRecipes.registerResearchItemI(LibResearch.KEY_BLOCK_TALISMAN, new ItemStack(ModItems.blockTalisman), 9, new AspectList().add(Aspect.VOID, 65).add(Aspect.DARKNESS, 32).add(Aspect.MAGIC, 50).add(Aspect.ELDRITCH, 32), new ItemStack(ConfigItems.itemFocusPortableHole), + // new ItemStack(ModItems.kamiResource), new ItemStack(EnderStorage.blockEnderChest, 0), new ItemStack(Item.diamond), new ItemStack(ModItems.kamiResource), new ItemStack(ConfigItems.itemResource, 1, 11), new ItemStack(ConfigBlocks.blockJar, 1, 3)); } } diff --git a/src/main/resources/ThaumicTinkerer_at.cfg b/src/main/resources/ThaumicTinkerer_at.cfg index 23074290..8eeacf04 100644 --- a/src/main/resources/ThaumicTinkerer_at.cfg +++ b/src/main/resources/ThaumicTinkerer_at.cfg @@ -24,4 +24,7 @@ public-f net.minecraft.init.Blocks field_150357_h #bedrock public net.minecraft.entity.monster.EntitySlime func_70799_a #setSlimeSize #NetHandlerPlayServer -public net.minecraft.network.NetHandlerPlayServer field_147365_f #floatingTickCount \ No newline at end of file +public net.minecraft.network.NetHandlerPlayServer field_147365_f #floatingTickCount + +#Block +public net.minecraft.block.Block field_149782_v #blockHardness \ No newline at end of file