From 85827362feb683e8259ea3099702522bb6e94b79 Mon Sep 17 00:00:00 2001 From: aidancbrady Date: Sat, 27 May 2017 15:24:46 -0700 Subject: [PATCH] Update IC2 API --- src/api/java/ic2/api/crops/Crops.class | Bin 1187 -> 1187 bytes src/api/java/ic2/api/energy/IEnergyNet.class | Bin 582 -> 1172 bytes src/api/java/ic2/api/energy/IEnergyNet.java | 14 + .../api/energy/IEnergyNetEventReceiver.class | Bin 0 -> 216 bytes .../api/energy/IEnergyNetEventReceiver.java | 20 ++ .../energy/prefab/BasicEnergyTe$Sink.class | Bin 0 -> 702 bytes .../energy/prefab/BasicEnergyTe$Source.class | Bin 0 -> 712 bytes .../ic2/api/energy/prefab/BasicEnergyTe.class | Bin 0 -> 1711 bytes .../ic2/api/energy/prefab/BasicEnergyTe.java | 104 ++++++ .../api/energy/prefab/BasicEnergyTile.class | Bin 0 -> 5890 bytes .../api/energy/prefab/BasicEnergyTile.java | 309 ++++++++++++++++++ .../ic2/api/energy/prefab/BasicSink.class | Bin 0 -> 3876 bytes .../java/ic2/api/energy/prefab/BasicSink.java | 155 +++++++++ .../api/energy/prefab/BasicSinkSource.class | Bin 0 -> 4800 bytes .../api/energy/prefab/BasicSinkSource.java | 116 +++++++ .../ic2/api/energy/prefab/BasicSource.class | Bin 0 -> 4391 bytes .../ic2/api/energy/prefab/BasicSource.java | 167 ++++++++++ src/api/java/ic2/api/info/ITeBlock.java | 123 +++---- src/api/java/ic2/api/info/Info.class | Bin 1267 -> 1325 bytes src/api/java/ic2/api/info/Info.java | 3 +- src/api/java/ic2/api/item/IC2Items.class | Bin 1693 -> 1727 bytes src/api/java/ic2/api/item/IC2Items.java | 4 +- .../ic2/api/item/IElectricItemManager.java | 2 +- .../java/ic2/api/item/IItemHudProvider.class | Bin 407 -> 373 bytes .../java/ic2/api/item/IItemHudProvider.java | 2 +- .../java/ic2/api/network/NetworkHelper.class | Bin 2922 -> 2956 bytes .../java/ic2/api/network/NetworkHelper.java | 4 +- src/api/java/ic2/api/reactor/IReactor.class | Bin 960 -> 737 bytes src/api/java/ic2/api/reactor/IReactor.java | 24 -- .../recipe/IBasicMachineRecipeManager.class | Bin 0 -> 679 bytes .../recipe/IBasicMachineRecipeManager.java | 13 + .../ICannerBottleRecipeManager$Input.class | Bin 968 -> 947 bytes .../ICannerBottleRecipeManager$RawInput.class | Bin 0 -> 636 bytes .../recipe/ICannerBottleRecipeManager.class | Bin 634 -> 1009 bytes .../recipe/ICannerBottleRecipeManager.java | 50 +-- .../ICannerEnrichRecipeManager$Input.class | Bin 1151 -> 1114 bytes .../ICannerEnrichRecipeManager$RawInput.class | Bin 0 -> 685 bytes .../recipe/ICannerEnrichRecipeManager.class | Bin 668 -> 939 bytes .../recipe/ICannerEnrichRecipeManager.java | 44 +-- ...tingRecipeManager$AttributeContainer.class | Bin 0 -> 565 bytes .../api/recipe/ICraftingRecipeManager.class | Bin 244 -> 358 bytes .../api/recipe/ICraftingRecipeManager.java | 29 +- ...tyFluidContainerRecipeManager$Output.class | Bin 0 -> 918 bytes .../IEmptyFluidContainerRecipeManager.class | Bin 0 -> 908 bytes .../IEmptyFluidContainerRecipeManager.java | 25 ++ ...illFluidContainerRecipeManager$Input.class | Bin 0 -> 701 bytes .../IFillFluidContainerRecipeManager.class | Bin 0 -> 931 bytes .../IFillFluidContainerRecipeManager.java | 24 ++ ...RecipeManager$RecipeIoContainerFluid.class | Bin 687 -> 0 bytes .../ic2/api/recipe/IFluidRecipeManager.class | Bin 654 -> 0 bytes .../ic2/api/recipe/IFluidRecipeManager.java | 60 ---- ...chineRecipeManager$RecipeIoContainer.class | Bin 670 -> 0 bytes .../api/recipe/IMachineRecipeManager.class | Bin 634 -> 688 bytes .../ic2/api/recipe/IMachineRecipeManager.java | 34 +- .../ic2/api/recipe/IScrapboxManager.class | Bin 395 -> 444 bytes .../java/ic2/api/recipe/IScrapboxManager.java | 2 +- .../java/ic2/api/recipe/MachineRecipe.class | Bin 0 -> 1792 bytes .../java/ic2/api/recipe/MachineRecipe.java | 35 ++ .../ic2/api/recipe/MachineRecipeResult.class | Bin 0 -> 1336 bytes .../ic2/api/recipe/MachineRecipeResult.java | 23 ++ .../recipe/RecipeInputFluidContainer.class | Bin 3400 -> 0 bytes .../api/recipe/RecipeInputFluidContainer.java | 68 ---- .../ic2/api/recipe/RecipeInputItemStack.class | Bin 2418 -> 0 bytes .../ic2/api/recipe/RecipeInputItemStack.java | 51 --- .../ic2/api/recipe/RecipeInputOreDict.class | Bin 3722 -> 0 bytes .../ic2/api/recipe/RecipeInputOreDict.java | 110 ------- .../java/ic2/api/recipe/RecipeOutput.class | Bin 2599 -> 2683 bytes src/api/java/ic2/api/recipe/RecipeOutput.java | 1 + .../ic2/api/recipe/RecipeOutputFluid.class | Bin 2632 -> 0 bytes .../ic2/api/recipe/RecipeOutputFluid.java | 57 ---- src/api/java/ic2/api/recipe/RecipeUtil.class | Bin 1695 -> 0 bytes src/api/java/ic2/api/recipe/RecipeUtil.java | 34 -- src/api/java/ic2/api/recipe/Recipes.class | Bin 1495 -> 1903 bytes src/api/java/ic2/api/recipe/Recipes.java | 45 +-- src/api/java/ic2/api/tile/RotorRegistry.class | Bin 1701 -> 1756 bytes src/api/java/ic2/api/tile/RotorRegistry.java | 4 +- .../api/upgrade/IAugmentationUpgrade.class | Bin 0 -> 269 bytes .../ic2/api/upgrade/IAugmentationUpgrade.java | 20 ++ .../api/upgrade/IEnergyStorageUpgrade.class | Bin 0 -> 384 bytes .../api/upgrade/IEnergyStorageUpgrade.java | 30 ++ .../api/upgrade/IFluidConsumingUpgrade.class | Bin 0 -> 177 bytes .../api/upgrade/IFluidConsumingUpgrade.java | 10 + .../api/upgrade/IFluidProducingUpgrade.class | Bin 0 -> 177 bytes .../api/upgrade/IFluidProducingUpgrade.java | 10 + .../java/ic2/api/upgrade/IFullUpgrade.class | Bin 0 -> 526 bytes .../java/ic2/api/upgrade/IFullUpgrade.java | 12 + .../api/upgrade/IItemConsumingUpgrade.class | Bin 0 -> 175 bytes .../api/upgrade/IItemConsumingUpgrade.java | 10 + .../api/upgrade/IItemProducingUpgrade.class | Bin 0 -> 175 bytes .../api/upgrade/IItemProducingUpgrade.java | 10 + .../ic2/api/upgrade/IProcessingUpgrade.class | Bin 0 -> 441 bytes .../ic2/api/upgrade/IProcessingUpgrade.java | 50 +++ .../upgrade/IRedstoneSensitiveUpgrade.class | Bin 0 -> 383 bytes .../upgrade/IRedstoneSensitiveUpgrade.java | 31 ++ .../ic2/api/upgrade/ITransformerUpgrade.class | Bin 0 -> 264 bytes .../ic2/api/upgrade/ITransformerUpgrade.java | 20 ++ .../ic2/api/upgrade/IUpgradableBlock.class | Bin 0 -> 314 bytes .../ic2/api/upgrade/IUpgradableBlock.java | 29 ++ .../java/ic2/api/upgrade/IUpgradeItem.class | Bin 0 -> 713 bytes .../java/ic2/api/upgrade/IUpgradeItem.java | 44 +++ .../ic2/api/upgrade/UpgradableProperty.class | Bin 0 -> 1472 bytes .../ic2/api/upgrade/UpgradableProperty.java | 45 +++ .../ic2/api/upgrade/UpgradeRegistry.class | Bin 0 -> 1308 bytes .../java/ic2/api/upgrade/UpgradeRegistry.java | 38 +++ .../api/util/FluidContainerOutputMode.class | Bin 0 -> 1381 bytes .../api/util/FluidContainerOutputMode.java | 18 + .../common/integration/MekanismHooks.java | 32 +- .../common/integration/OreDictManager.java | 3 +- 108 files changed, 1570 insertions(+), 598 deletions(-) create mode 100644 src/api/java/ic2/api/energy/IEnergyNetEventReceiver.class create mode 100644 src/api/java/ic2/api/energy/IEnergyNetEventReceiver.java create mode 100644 src/api/java/ic2/api/energy/prefab/BasicEnergyTe$Sink.class create mode 100644 src/api/java/ic2/api/energy/prefab/BasicEnergyTe$Source.class create mode 100644 src/api/java/ic2/api/energy/prefab/BasicEnergyTe.class create mode 100644 src/api/java/ic2/api/energy/prefab/BasicEnergyTe.java create mode 100644 src/api/java/ic2/api/energy/prefab/BasicEnergyTile.class create mode 100644 src/api/java/ic2/api/energy/prefab/BasicEnergyTile.java create mode 100644 src/api/java/ic2/api/energy/prefab/BasicSink.class create mode 100644 src/api/java/ic2/api/energy/prefab/BasicSink.java create mode 100644 src/api/java/ic2/api/energy/prefab/BasicSinkSource.class create mode 100644 src/api/java/ic2/api/energy/prefab/BasicSinkSource.java create mode 100644 src/api/java/ic2/api/energy/prefab/BasicSource.class create mode 100644 src/api/java/ic2/api/energy/prefab/BasicSource.java create mode 100644 src/api/java/ic2/api/recipe/IBasicMachineRecipeManager.class create mode 100644 src/api/java/ic2/api/recipe/IBasicMachineRecipeManager.java create mode 100644 src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$RawInput.class create mode 100644 src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$RawInput.class create mode 100644 src/api/java/ic2/api/recipe/ICraftingRecipeManager$AttributeContainer.class create mode 100644 src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager$Output.class create mode 100644 src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager.class create mode 100644 src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager.java create mode 100644 src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager$Input.class create mode 100644 src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager.class create mode 100644 src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager.java delete mode 100644 src/api/java/ic2/api/recipe/IFluidRecipeManager$RecipeIoContainerFluid.class delete mode 100644 src/api/java/ic2/api/recipe/IFluidRecipeManager.class delete mode 100644 src/api/java/ic2/api/recipe/IFluidRecipeManager.java delete mode 100644 src/api/java/ic2/api/recipe/IMachineRecipeManager$RecipeIoContainer.class create mode 100644 src/api/java/ic2/api/recipe/MachineRecipe.class create mode 100644 src/api/java/ic2/api/recipe/MachineRecipe.java create mode 100644 src/api/java/ic2/api/recipe/MachineRecipeResult.class create mode 100644 src/api/java/ic2/api/recipe/MachineRecipeResult.java delete mode 100644 src/api/java/ic2/api/recipe/RecipeInputFluidContainer.class delete mode 100644 src/api/java/ic2/api/recipe/RecipeInputFluidContainer.java delete mode 100644 src/api/java/ic2/api/recipe/RecipeInputItemStack.class delete mode 100644 src/api/java/ic2/api/recipe/RecipeInputItemStack.java delete mode 100644 src/api/java/ic2/api/recipe/RecipeInputOreDict.class delete mode 100644 src/api/java/ic2/api/recipe/RecipeInputOreDict.java delete mode 100644 src/api/java/ic2/api/recipe/RecipeOutputFluid.class delete mode 100644 src/api/java/ic2/api/recipe/RecipeOutputFluid.java delete mode 100644 src/api/java/ic2/api/recipe/RecipeUtil.class delete mode 100644 src/api/java/ic2/api/recipe/RecipeUtil.java create mode 100644 src/api/java/ic2/api/upgrade/IAugmentationUpgrade.class create mode 100644 src/api/java/ic2/api/upgrade/IAugmentationUpgrade.java create mode 100644 src/api/java/ic2/api/upgrade/IEnergyStorageUpgrade.class create mode 100644 src/api/java/ic2/api/upgrade/IEnergyStorageUpgrade.java create mode 100644 src/api/java/ic2/api/upgrade/IFluidConsumingUpgrade.class create mode 100644 src/api/java/ic2/api/upgrade/IFluidConsumingUpgrade.java create mode 100644 src/api/java/ic2/api/upgrade/IFluidProducingUpgrade.class create mode 100644 src/api/java/ic2/api/upgrade/IFluidProducingUpgrade.java create mode 100644 src/api/java/ic2/api/upgrade/IFullUpgrade.class create mode 100644 src/api/java/ic2/api/upgrade/IFullUpgrade.java create mode 100644 src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.class create mode 100644 src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.java create mode 100644 src/api/java/ic2/api/upgrade/IItemProducingUpgrade.class create mode 100644 src/api/java/ic2/api/upgrade/IItemProducingUpgrade.java create mode 100644 src/api/java/ic2/api/upgrade/IProcessingUpgrade.class create mode 100644 src/api/java/ic2/api/upgrade/IProcessingUpgrade.java create mode 100644 src/api/java/ic2/api/upgrade/IRedstoneSensitiveUpgrade.class create mode 100644 src/api/java/ic2/api/upgrade/IRedstoneSensitiveUpgrade.java create mode 100644 src/api/java/ic2/api/upgrade/ITransformerUpgrade.class create mode 100644 src/api/java/ic2/api/upgrade/ITransformerUpgrade.java create mode 100644 src/api/java/ic2/api/upgrade/IUpgradableBlock.class create mode 100644 src/api/java/ic2/api/upgrade/IUpgradableBlock.java create mode 100644 src/api/java/ic2/api/upgrade/IUpgradeItem.class create mode 100644 src/api/java/ic2/api/upgrade/IUpgradeItem.java create mode 100644 src/api/java/ic2/api/upgrade/UpgradableProperty.class create mode 100644 src/api/java/ic2/api/upgrade/UpgradableProperty.java create mode 100644 src/api/java/ic2/api/upgrade/UpgradeRegistry.class create mode 100644 src/api/java/ic2/api/upgrade/UpgradeRegistry.java create mode 100644 src/api/java/ic2/api/util/FluidContainerOutputMode.class create mode 100644 src/api/java/ic2/api/util/FluidContainerOutputMode.java diff --git a/src/api/java/ic2/api/crops/Crops.class b/src/api/java/ic2/api/crops/Crops.class index 8e10c62682a2346bf83e96772814609dabb415fb..a97ba790f2e6d689ffd1d2714fc7f843a4522eaf 100644 GIT binary patch delta 10 RcmZ3?xtMdqLKY?lNdOas0?7aX delta 10 RcmZ3?xtMdqLKY?mNdOcC0|@{C diff --git a/src/api/java/ic2/api/energy/IEnergyNet.class b/src/api/java/ic2/api/energy/IEnergyNet.class index 1880b7d3ecd099481294f73f2eb5c60b6d2943df..7c4869363e4dde01a2fabe6938164c5ebbdd3ad8 100644 GIT binary patch literal 1172 zcmb7EO>fgc5S=X{X+uL>pp-(PAaSsT#7aHZ&;v>$S&B-)7D$}fI8(E!?X9-!RQ+ol z_yPPV#O$Vui%CSe_<46`-kUG`=dbTS0N?;#v|zsl&l$8*G_lN(!B=lkpy9bJFwx?~ z@C&80G5>6zLCsVenekkhZ~R@RlGC9&5Bz~l4!Agz91GOxB_|i;Vb2|`LcpL+Vo^Do z>9xdoJbUx%$~F`WBh4kZ9zFLO_@5Z8MKUdfDK#bh;Z1y4%WHAq;XhM5^5WR>?|E}y zS)3>y4pbtH7*YCGzE6@BTiv6wENj7Br>!wpQ=HZRvJzbuXvJ5ldu|#Gj&2Z9Yt8j( zGH4PPO^reC|CtsHpTRm29;-1%Mi`=fdlTB)!py^IQ##`^KkMSCOhXz2gGqfwu9s7* zbU}WDiI@s56(4F@n8;`pd9d)(|H5F?HRl3#U#mQps2Mc8(C^MH_QD#5iae~P>xT@s zHKy|1pzcj+b3bB&a%#=5{%XY4CvlAC4_CKeJ7uwiryZ$MC)lUYfx$+_@!D3#V7J!G z%7K!0#b=^O`TNlX6VqhCV1@nz0G$SdThIU?ynTgDXpw!DtShia_f2Te&v)p&4jt!z m7d9Mj!j{8(aNpqr*mn33b{sx}U5Ah1iNigM#Q4-HJo^ntVqO{m delta 104 zcmbQjd5lHi)W2Q(7#J9g7)00^gxDE`CkoU|-plxAvKq6= void addTile(T tile); + void addTile(T tile); + + void removeTile(IEnergyTile tile); + World getWorld(IEnergyTile tile); BlockPos getPos(IEnergyTile tile); @@ -58,6 +67,8 @@ public interface IEnergyNet { */ NodeStats getNodeStats(IEnergyTile tile); + boolean dumpDebugInfo(World world, BlockPos pos, PrintStream console, PrintStream chat); + /** * Determine the typical power used by the specific tier, e.g. 128 eu/t for tier 2. * @@ -73,4 +84,7 @@ public interface IEnergyNet { * @return tier */ int getTierFromPower(double power); + + void registerEventReceiver(IEnergyNetEventReceiver receiver); + void unregisterEventReceiver(IEnergyNetEventReceiver receiver); } diff --git a/src/api/java/ic2/api/energy/IEnergyNetEventReceiver.class b/src/api/java/ic2/api/energy/IEnergyNetEventReceiver.class new file mode 100644 index 0000000000000000000000000000000000000000..c39d5b09a78989c1836c6e3b00efea7d90b07247 GIT binary patch literal 216 zcmZ{eF$%&!6h!C8#Kcq{z*0mT7t&f;L=Z$FihbOC!iKmjAuf0|3lHF-#En=9R`X}( z@tNoA{s5354iSYI5CWr@ML`%(H%cZVzbL_)oAM@FRkK*9A9HZ`Vs<1%MrV9BmI?9R zTpP(NR}n^EaLa9KS+^NWR+gK2mD`*!`T6~aCJZ}X)VVIj?o_dC`vijLHUpkd=)nh^ L2A#U5-{lD3MwK~T literal 0 HcmV?d00001 diff --git a/src/api/java/ic2/api/energy/IEnergyNetEventReceiver.java b/src/api/java/ic2/api/energy/IEnergyNetEventReceiver.java new file mode 100644 index 000000000..420eb10ff --- /dev/null +++ b/src/api/java/ic2/api/energy/IEnergyNetEventReceiver.java @@ -0,0 +1,20 @@ +package ic2.api.energy; + +import ic2.api.energy.tile.IEnergyTile; + +/** + * Interface for handlers being invoked after energy net changes. + * + *

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

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

WARNING: The events may (and will) be invoked from arbitrary threads. It's up to the + * implementation of IEnergyNetEventReceiver to properly synchronize them. + */ +public interface IEnergyNetEventReceiver { + void onAdd(IEnergyTile tile); + void onRemove(IEnergyTile tile); +} diff --git a/src/api/java/ic2/api/energy/prefab/BasicEnergyTe$Sink.class b/src/api/java/ic2/api/energy/prefab/BasicEnergyTe$Sink.class new file mode 100644 index 0000000000000000000000000000000000000000..566fb3c532bd4d14cce52dfb9e794ac40591a7bd GIT binary patch literal 702 zcma)4%T5A85Ug1c1lRXlP&Ar|dvFsI^?>1kk4QqiKuGj9tb>l?LYBeAFYtRj7!ytW z06)rDyLjP3xXg6dbk|fretti{0UTf}jRcmHSV_aeY6@dmOCpm*Rv>YreQk;YWBGD< zuPzWjZQm+^>5BH%Rqv^xf|_i!h|E>mo@~`+phN#3jGKGiWl~l9j{G(lHIN% z>QuCM;L47672&%Vw-czQY`7)a)!umo)znUyS`ZlbWJh}1ya6seoKFSzkdSQM=6IimNHn*!NN)wDXeCY&!8ZXu4-SKLxEJeR@=E0 zNFH}@l)zM7`|4uw&{9EDwmM{H>s?QFE@hy@ct|GAo$k}6(H#UHMRv{iRdC#q{k|f< zTi4#cD|^~iq;H?xUZC2tZlx8C?@6xX(Lp5Y7jzD<}V4cthe9$rth#a$F}PO$A9*F^2<;lPkveU}K6A g9Wad@KziBl~4$&Y79#yywiBU%!9+1Tc@K6g12wF$_J0JGd*&dAah3d(ylw zO%56sY1s<{vezhPk95S+eT3@H#H(F~guIv259vw?Z?U+hTx% zQ{~=B(X!2rPP1&fhA21a87(>$(by8MCGF5T=xtkV1=A7Y%jjeMjJ?(&Cm#i{OuZ|l zjMPmpNa`^ETs9X05L6(Z%>{WocF_@41u4tk6%DH@JZ718?80`(-g#>`{LNw46xDUt zX>P0<%rjfGO;2yKHWgRYJl!sPI(H0FFF4JX)3K{dvWPMI6-=Cbn9;wumS-A{&tH$i zk3!vCHWnjRWaS9YW0_3bv%EcB_RN~UWYtqaQ?Ap;X6WrKbMCX)6&l8HUc)HPs94l6 zA&p5nOvzyyH#OvtS1@^Ut1`f3f1Up+N?&-bB&gQ>$pL5 zKkhpQzH+k{SBQiQbdD3tcj73q&p1n!LwREN5$g&~F);9gS-tF`4;>RLJ%Lz0d`R64 zsTy-149M{=IYaHhD^}|@Yx$;!t{tOGPe5l!h4dqu6J2tkd5fCg^-%w(nJpSpKQLdJ zaV9@|09A^f-N#Uu9jJbfI6fkcPd~DEP&jT1&W1jIE!1f25=iAoJYAzv&b1FafwThey implement the necessary forwards to make BasicSink/BasicSource work, provided the sub + * classes always call those forwards when overriding them. + * + *

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

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


+ * public class MyMachine extends BasicEnergyTe.Sink implements ITickable {
+ *     public MyMachine() {
+ *         super(10000, 2);
+ *     }
+ *
+ *     {@literal @}Override
+ *     public void readFromNBT(NBTTagCompound nbt) {
+ *         super.readFromNbt(nbt); // important: keep super call
+ *
+ *         this.progess = nbt.getInteger("progress");
+ *     }
+ *
+ *     {@literal @}Override
+ *     public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
+ *         nbt = super.writeToNBT(nbt); // important: keep super call
+ *
+ *         nbt.setInteger("progress", progress);
+ *
+ *         return nbt;
+ *     }
+ *
+ *     {@literal @}Override
+ *     public void update() {
+ *         if (hasWork() && getEnergyBuffer().useEnergy(50) && ++progress >= 100) {
+ *             progress = 0;
+ *             doWork();
+ *         }
+ *     }
+ *
+ *     private int progress;
+ * }
+ * 
+ */ +public class BasicEnergyTe extends TileEntity { + public static class Sink extends BasicEnergyTe { + public Sink(int capacity, int tier) { + energyBuffer = new BasicSink(this, capacity, tier); + } + } + + public static class Source extends BasicEnergyTe { + public Source(int capacity, int tier) { + energyBuffer = new BasicSource(this, capacity, tier); + } + } + + protected BasicEnergyTe() { } + + public T getEnergyBuffer() { + return energyBuffer; + } + + // forwards >> + + @Override + public void onLoad() { + energyBuffer.onLoad(); + } + + @Override + public void invalidate() { + super.invalidate(); + + energyBuffer.invalidate(); + } + + @Override + public void onChunkUnload() { + energyBuffer.onChunkUnload(); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + energyBuffer.readFromNBT(nbt); + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { + return energyBuffer.writeToNBT(super.writeToNBT(nbt)); + } + + // << forwards + + protected T energyBuffer; +} diff --git a/src/api/java/ic2/api/energy/prefab/BasicEnergyTile.class b/src/api/java/ic2/api/energy/prefab/BasicEnergyTile.class new file mode 100644 index 0000000000000000000000000000000000000000..66d017eef03750fc4f1113571987d62b043a6f7d GIT binary patch literal 5890 zcma)AXLKA_8NH(&X;!O|WXp256uD}(D?E-J1&o6oTb3OqlHx?N6B$xQyQB5QTf}N5 z+X*F<5FnI<7RxCRAPFU;T9O@;Mu{QR5Xw&uhr@pk91e#Ahj70)TV_{l>>qmb=Iwjm zckfr<=#Brr_%eX4_(KSn$q?3HCWuq=d`KicY~T@j zxm$)uW%#OW{8~L8!`Ef@4H>=}!sB?N0Z-yvGJIRszGL9K4G7~t8J;rmy%3^!T83u~ zJR8JwA#BDy2A((Yf`QW-79}$=JLhK72eO%IH|}ILv<%!~Puo_~PA9DE$L?@qxg8p6 zk7csSxQ5jOX(wl;+_V$R+T%G(En7FqkK7fQ$V_TjSFvX*=O(R`ojYRfp|+z3GLzgI zjM)=*%*~z9pzYOQI%y}HI5C{dWF4w$u;XzjK9cF9Hf}hqq3$X-?dEoB=n7Yer*y|j z=P1e=;j~XpckJytq(Se^#2pRI1H?Ntl^S!hBlcL5D=h=0ojhb`U3t$h>bWB>;dc(W zv8|Rp;aVOhYa;86+hf)qd(w>&5MhcQa;TfIv(&6%<0V1T&=xMrcGKe-t6yN`1cHZm zgfuH84ktQxkDJM~el*V$ixw zdLU!dK_NFiZ6{stx5iAm_sCTG=)rVS{n(Io?D)QHCN;EYgvP1FmmbSm{AI*W^kz~M znW=PqhsX}(?8L(0sj``VrCysLj%D4PGm=qi_Fama3UgEy-jHx|y~W@pZ-!^Xq<>8h zE2A}YqZbc_ux;kH@|8L}MS=_w*}O07I3>yTjB#%>2~nbCLCj7coMZ?~ka?>N{raiW zQeEtbolVdmYb)u}5-F>ngL37LE*`9%6t8M%ub^GAl^WviWI^z{iwNGUBq!aJn=>$P z;0&!pZmI;ZTu6|2Rp|2vq_>+jz?G__VZ(ymRbrHuk?dF5qD}=Tish=2%7?~sjHV$w zMZ>gGV5xu&=dx}(!CV!L!*2TMh$}UYUhUT)M~5?0*_h+4hP;=3%x=o5$oI`6)Wj}a zE5i*Yu0W58cZ0IqOZtYUlF0)ZH=T2`eaBxIshYB8R;k&L2OH6DEF)*O~Z^ib)ga@e>nQ3G0sXPOvbSO#BpYnD`lf zZekn>1HUlwOZ>{jow&=y2XL2xUz>OnzhMxWaPgLj6n<-BT5v8e;H)T=CUTh4u)bV* zj7fOOWM2+N&po{1+mp%a+-#f<&=C$v%uC1Q$)j>^5f+>&U#VM@BPr1WM9v^ zF)0{>cG^xzRxI_mn0)3)We&QNH#(_|w1LG%F{*!Y(9q;g_Q$sFp0?ej*Ik)itUlo~ zK;s#fEsN$&WzyDQ;r_5sR#|`g4)qO<+_vZ7u!f%U;^CbePbCXyRkR^Jvg6d+@S&5mcEaE*Cweb?bsY2YuLR08YItMbhB~xJVdocsE`?b=S)0|9wO&10{nV4?n$K0-xeHfA z!*0Iy^G)Z|h(yEl(4OP8275S$_ypEb!Fu#^)`0*=1AEcOr_AJT)VxiB zx`9ChLk6y=XBr9p0B*<==;c$+n~~FKI7R2q!4xBTxIEYHLIa~f^qbz^ynfLTfY!i8 zwswxYxiCqHBCy*N*hztnr_po@ZD-ItgXPa-(K#$0rM+6_u;iwQK8uEu!c}xP7%f3u z!_UfoET=;^kxCRpJ^{uRT$ht2Dg&IZDepe8H|xZ+^4q+gM$R-0XR&n(otxQlEU&itQd@Rx2&AQ zs#&Zq5o%ILQ(G$?Q4zex~9BO2RUg33WwCbt)$$E^e<1 zWOXHwnW{kS>Og!>@qj!|AWvKX$QUc20ErcWT#?V1kXS_QpQuFhv=2?F7_o6Ud9&Qf ztPw|U$tT+kYMY+vEQ)*ZQ8X4`u8E9NMQ4n$)G2zrME87qh6#Qa8*q-L=p`TiEk#3a zVI&KFNqrqP=5o$?0nXzX$_G@lu;_g7AsG6T&;w5u)p%Y$?-T7Wv?bBCsA;@ftaPL( zdz>~EjvbNCIdsgBkylvAHSm5AA;Vh{Rf)^R}0(}b6>&LRxr<{d>*R~ zw-^H3^%Z*4$w$O+3SDD(g?{p3)P=X}LTQEWBjkgxliQ{sw(E-A3SB~of~wGKr`>?R z67=7&7Jp~k`Uey6pUj?r(YF6qRJ~SqtVs1(o+{xZqo}TBK@`%uBE17aA-yEf{I*<7 zR7aZ#u*n;Ezk!K>_BK_PmTL>kTD!6mKRZ1usjG<8nnkon{dso0d6sxirO^4ho)$!d z7E(~XuD2);)z|g-y;enNs3bI0DYThF7ymz@HS&#^7y1VA$kl3;@B*(PJi{>K>{WyZ zBGI$x(jeCf<1kJ&CQ}#^?;%y^T?BoC7Z$+%|`Is7<`0Y#wc~=CS3KQs3Ro1_5m; zLfSI4Xv?vN!L&(RiEY{{eh{xlueJu)X>AzN+HteiQ4H1=X4f(HX^nnb#F=-`8}*rr zS=+UtUf0<)PLPW(pU8QB-F%8CYE*^rnvALtns?*#>|T=>rptHrMNdY3#x0!G@Ildn G5B(1g5%(|v literal 0 HcmV?d00001 diff --git a/src/api/java/ic2/api/energy/prefab/BasicEnergyTile.java b/src/api/java/ic2/api/energy/prefab/BasicEnergyTile.java new file mode 100644 index 000000000..fc913bafe --- /dev/null +++ b/src/api/java/ic2/api/energy/prefab/BasicEnergyTile.java @@ -0,0 +1,309 @@ +package ic2.api.energy.prefab; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +import net.minecraftforge.common.MinecraftForge; + +import ic2.api.energy.event.EnergyTileLoadEvent; +import ic2.api.energy.event.EnergyTileUnloadEvent; +import ic2.api.energy.tile.IEnergyTile; +import ic2.api.info.ILocatable; +import ic2.api.info.Info; +import ic2.api.item.ElectricItem; + +/** + * Common functionality for BasicSink and BasicSource. + */ +abstract class BasicEnergyTile implements ILocatable, IEnergyTile { + // ********************************** + // *** Methods for use by the mod *** + // ********************************** + + /** + * Constructor for a new BasicSink delegate. + * + * @param parent TileEntity represented by this energy sink. + * @param capacity Maximum amount of eu to store. + * @param tier IC2 tier, 1 = LV, 2 = MV, ... + */ + protected BasicEnergyTile(TileEntity parent, double capacity) { + this((Object) parent, capacity); + } + + protected BasicEnergyTile(ILocatable parent, double capacity) { + this((Object) parent, capacity); + } + + private BasicEnergyTile(Object locationProvider, double capacity) { + this.locationProvider = locationProvider; + this.capacity = capacity; + } + + protected BasicEnergyTile(World world, BlockPos pos, double capacity) { + if (world == null) throw new NullPointerException("null world"); + if (pos == null) throw new NullPointerException("null pos"); + + this.locationProvider = null; + this.world = world; + this.pos = pos; + this.capacity = capacity; + } + + // in-world te forwards >> + + /** + * Forward for the base TileEntity's update(), used for creating the energy net link. + * Either update or onLoad have to be used. + */ + public void update() { + if (!addedToEnet) onLoad(); + } + + /** + * Notification that the base TileEntity is loaded, used for creating the energy net link. + * Either update or onLoad have to be used. + */ + public void onLoad() { + if (!addedToEnet + && !getWorldObj().isRemote + && Info.isIc2Available()) { + MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); + + addedToEnet = true; + } + } + + /** + * Forward for the base TileEntity's invalidate(), used for destroying the energy net link. + * Both invalidate and onChunkUnload have to be used. + */ + public void invalidate() { + onChunkUnload(); + } + + /** + * Forward for the base TileEntity's onChunkUnload(), used for destroying the energy net link. + * Both invalidate and onChunkUnload have to be used. + */ + public void onChunkUnload() { + if (addedToEnet + && !getWorldObj().isRemote + && Info.isIc2Available()) { + MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); + + addedToEnet = false; + } + } + + /** + * Forward for the base TileEntity's readFromNBT(), used for loading the state. + * + * @param tag Compound tag as supplied by TileEntity.readFromNBT() + */ + public void readFromNBT(NBTTagCompound tag) { + NBTTagCompound data = tag.getCompoundTag(getNbtTagName()); + energyStored = data.getDouble("energy"); + } + + /** + * Forward for the base TileEntity's writeToNBT(), used for saving the state. + * + * @param tag Compound tag as supplied by TileEntity.writeToNBT() + */ + public NBTTagCompound writeToNBT(NBTTagCompound tag) { + NBTTagCompound data = new NBTTagCompound(); + + data.setDouble("energy", energyStored); + tag.setTag(getNbtTagName(), data); + + return tag; + } + + // << in-world te forwards + // methods for using this adapter >> + + /** + * Get the maximum amount of energy this sink can hold in its buffer. + * + * @return Capacity in EU. + */ + public double getCapacity() { + return capacity; + } + + /** + * Set the maximum amount of energy this sink can hold in its buffer. + * + * @param capacity1 Capacity in EU. + */ + public void setCapacity(double capacity) { + this.capacity = capacity; + } + + /** + * Determine the energy stored in this buffer. + * + * @return amount in EU, may be above capacity + */ + public double getEnergyStored() { + return energyStored; + } + + /** + * Set the stored energy to the specified amount. + * + * This is intended for server -> client synchronization, e.g. to display the stored energy in + * a GUI through getEnergyStored(). + * + * @param amount + */ + public void setEnergyStored(double amount) { + energyStored = amount; + } + + /** + * Determine the free capacity in this buffer. + * + * @return amount in EU + */ + public double getFreeCapacity() { + return capacity - energyStored; + } + + /** + * Add some energy to the output buffer. + * + * @param amount maximum amount of energy to add + * @return amount added/used, NOT remaining + */ + public double addEnergy(double amount) { + if (getWorldObj().isRemote) return 0; + if (amount > capacity - energyStored) amount = capacity - energyStored; + + energyStored += amount; + + return amount; + } + + /** + * Determine if the specified amount of energy is available. + * + * @param amount in EU + * @return true if the amount is available + */ + public boolean canUseEnergy(double amount) { + return energyStored >= amount; + } + + /** + * Use the specified amount of energy, if available. + * + * @param amount amount to use + * @return true if the amount was available + */ + public boolean useEnergy(double amount) { + if (!canUseEnergy(amount) || getWorldObj().isRemote) return false; + + energyStored -= amount; + + return true; + } + + /** + * Charge the supplied ItemStack from this energy buffer. + * + * @param stack ItemStack to charge (null is ignored) + * @return true if energy was transferred + */ + public boolean charge(ItemStack stack) { + if (stack == null || !Info.isIc2Available() || getWorldObj().isRemote) return false; + + double amount = ElectricItem.manager.charge(stack, energyStored, Math.max(getSinkTier(), getSourceTier()), false, false); + + energyStored -= amount; + + return amount > 0; + } + + /** + * Discharge the supplied ItemStack into this energy buffer. + * + * @param stack ItemStack to discharge (null is ignored) + * @param limit Transfer limit, values <= 0 will use the battery's limit + * @return true if energy was transferred + */ + public boolean discharge(ItemStack stack, double limit) { + if (stack == null || !Info.isIc2Available() || getWorldObj().isRemote) return false; + + double amount = capacity - energyStored; + if (amount <= 0) return false; + + if (limit > 0 && limit < amount) amount = limit; + + amount = ElectricItem.manager.discharge(stack, amount, Math.max(getSinkTier(), getSourceTier()), limit > 0, true, false); + + energyStored += amount; + + return amount > 0; + } + + // << methods for using this adapter + + // ****************************** + // *** Methods for use by ic2 *** + // ****************************** + + // ILocatable >> + + @Override + public World getWorldObj() { + if (world == null) initLocation(); + + return world; + } + + @Override + public BlockPos getPosition() { + if (pos == null) initLocation(); + + return pos; + } + + private void initLocation() { + if (locationProvider instanceof ILocatable) { + ILocatable provider = (ILocatable) locationProvider; + world = provider.getWorldObj(); + pos = provider.getPosition(); + } else if (locationProvider instanceof TileEntity) { + TileEntity provider = (TileEntity) locationProvider; + world = provider.getWorld(); + pos = provider.getPos(); + } else { + throw new IllegalStateException("no/incompatible location provider"); + } + } + + // << ILocatable + + protected abstract String getNbtTagName(); + + protected int getSinkTier() { + return 0; + } + + protected int getSourceTier() { + return 0; + } + + private final Object locationProvider; + protected World world; + protected BlockPos pos; + + protected double capacity; + protected double energyStored; + protected boolean addedToEnet; +} diff --git a/src/api/java/ic2/api/energy/prefab/BasicSink.class b/src/api/java/ic2/api/energy/prefab/BasicSink.class new file mode 100644 index 0000000000000000000000000000000000000000..32434a7ee5803e4fab5d48a4063c2b62da8d87a5 GIT binary patch literal 3876 zcma)8TXz#x6#k~og@$Pg2q>1jMUoU5sHkWVp-rpNP|${}qMl5q>9omAoJ1g_dYY7Nrxfip*v^J+28*5?d;Qk|NHwN05kX@gZM4$*vZUK;lmBwW*Q6ewi{sdJ`fy5|)Xauv&PwU%iax+9id%{7~bVY#Nep;c))FPFtq zIe(1|%-MBA!9<0$7rU*R;Z#MfNjtkLwl132gk$ozznO4X%#MO16;q$lMBCI1%WxVS zTH7&}MNOL(9aCR2t+gV#(-sbqDmXTjHww1tqAhfClENt|IG77aOl#TJ%IuHJzWAQ+ zd+fP_*=P#x*iN&qU1wR0_|v8IXf5HcXtPaQU%O&=e1fC|DVU4^`fVu~ZQGQQqY<4L zqYAcn441Q0l{HJ`WC3;xT{qfpXI^GaZYkooDeRVp!RJYe_okPpYZ6~GvMt-@a&1+?fk!}Fn}O2T(N~1S zo*s?HY`R8EE0b7qg}zoSae-2s+DD$C&B|ll4qaZpaCC2T60hpQx*G0|iF!~7)}WkD zPyh>#Vax@$Yl7O)GqdE{j#2lF(JWxqtq0t(A&_$)er4`B6j9Y)oUO`^-I`3R=4y08 zHJP(pZK`6u7|nN#3KhvQM4hWI%^r(pB?iM&Y}~fyR=U>ORjX+W3W)lGb~C26E}CXt zxKxgmZB^u1s@wK^jM~w z9lobNFVD>cNEP!~Q1K?-Qc=d+D&9dw#U(7NxXj`T-c|7)iYk^+RdJP9*LZcES2u7| z#Vx$A;se}P@ga+kSbU7zbQzy8acRyD(D16t!~aoB{iB6%mV$gV>#P#;vg&F2mKB`C>%Ns6epc1OO|p>FA0m|vZFo`s zhzx#`cDy!G0}oZ4C%@PW6>s=$qT+&VC%PJ#^;tOQti^7QM1%ji&&8x~I)OQqd@wfv zgGYC5`#lofFMZHa54z(b4=EoS^7b$m1>fic`@96E;T8kV3?8c_GO%AP@e8YY}x;W+f(;T)&uJ8*pSUia|yAaGbNdiG<$&kP5qe-~oF`-TJ4 RzZo&$XNLe2OvuSo`yUZh!uIt's designed to be attached to a tile entity as a delegate. Functionally BasicSink acts as a + * one-time configurable input energy buffer, thus providing a common use case for machines. + * + *

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

The constraints set by BasicSink like the strict tank-like energy buffering should provide a + * more easy to use and stable interface than using IEnergySink directly while aiming for + * optimal performance. + * + *

Using BasicSink involves the following steps:

    + *
  • create a BasicSink instance in your TileEntity, typically in a field + *
  • forward onLoad (or update), invalidate, onChunkUnload, readFromNBT and writeToNBT to the BasicSink + * instance. + *
  • call useEnergy whenever appropriate. canUseEnergy determines if enough energy is available + * without consuming the energy. + *
  • optionally use getEnergyStored to display the output buffer charge level + *
  • optionally use setEnergyStored to sync the stored energy to the client (e.g. in the Container)
+ * + *

Example implementation code: + *


+ * public class SomeTileEntity extends TileEntity {
+ *     // new basic energy sink, 1000 EU buffer, tier 1 (32 EU/t, LV)
+ *     private BasicSink ic2EnergySink = new BasicSink(this, 1000, 1);
+ *
+ *     {@literal @}Override
+ *     public void onLoad() {
+ *         ic2EnergySink.onLoad(); // notify the energy sink
+ *         ...
+ *     }
+ *
+ *     {@literal @}Override
+ *     public void invalidate() {
+ *         ic2EnergySink.invalidate(); // notify the energy sink
+ *         ...
+ *         super.invalidate(); // this is important for mc!
+ *     }
+ *
+ *     {@literal @}Override
+ *     public void onChunkUnload() {
+ *         ic2EnergySink.onChunkUnload(); // notify the energy sink
+ *         ...
+ *     }
+ *
+ *     {@literal @}Override
+ *     public void readFromNBT(NBTTagCompound tag) {
+ *         super.readFromNBT(tag);
+ *
+ *         ic2EnergySink.readFromNBT(tag);
+ *         ...
+ *     }
+ *
+ *     {@literal @}Override
+ *     public void writeToNBT(NBTTagCompound tag) {
+ *         super.writeToNBT(tag);
+ *
+ *         ic2EnergySink.writeToNBT(tag);
+ *         ...
+ *     }
+ *
+ *     {@literal @}Override
+ *     public void update() {
+ *         if (ic2EnergySink.useEnergy(5)) { // use 5 eu from the sink's buffer this tick
+ *             ... // do something with the energy
+ *         }
+ *         ...
+ *     }
+ *
+ *     ...
+ * }
+ * 
+ */ +public class BasicSink extends BasicEnergyTile implements IEnergySink { + /** + * Constructor for a new BasicSink delegate. + * + * @param parent TileEntity represented by this energy sink. + * @param capacity Maximum amount of eu to store. + * @param tier IC2 tier, 1 = LV, 2 = MV, ... + */ + public BasicSink(TileEntity parent, double capacity, int tier) { + super(parent, capacity); + + this.tier = tier; + } + + public BasicSink(ILocatable parent, double capacity, int tier) { + super(parent, capacity); + + this.tier = tier; + } + + public BasicSink(World world, BlockPos pos, double capacity, int tier) { + super(world, pos, capacity); + + this.tier = tier; + } + + /** + * Set the IC2 energy tier for this sink. + * + * @param tier IC2 Tier. + */ + public void setSinkTier(int tier) { + this.tier = tier; + } + + // energy net interface >> + + @Override + public boolean acceptsEnergyFrom(IEnergyEmitter emitter, EnumFacing direction) { + return true; + } + + @Override + public double getDemandedEnergy() { + return Math.max(0, capacity - energyStored); + } + + @Override + public double injectEnergy(EnumFacing directionFrom, double amount, double voltage) { + energyStored += amount; + + return 0; + } + + @Override + public int getSinkTier() { + return tier; + } + + // << energy net interface + + @Override + protected String getNbtTagName() { + return "IC2BasicSink"; + } + + protected int tier; +} diff --git a/src/api/java/ic2/api/energy/prefab/BasicSinkSource.class b/src/api/java/ic2/api/energy/prefab/BasicSinkSource.class new file mode 100644 index 0000000000000000000000000000000000000000..ca5b5762556d8486fd5603424a10f9a92a18cf93 GIT binary patch literal 4800 zcmbtW`F9&v75>Ir#+JrO>c&Z2lhjL$Wx4INA#npPp|KTHf#amuNz+1su{4$^mS)6g z6gNQG_kE{8+4s_OSW_2%;2eJCZ{h&oeWT5jsZkF<=xXM@cklh~z2ALv|M~B~{T;v= zyqv)_f+0+yDdN@;cJW*mxA8%F{ZNMD!y=xSa~~1$QQ7#Ih>vIR34Bt-rv~w9+53!$ z&x-h*h|i1of`~7Q_>zb(i};F&uZmE1>0ugQ6Y+Hs-w^Rl5#JK=Z5`jy@m(D+==h$7 z!G`1RY&f>BK`Uy=G`yx?vcrXJ_;S_TRoev(>Bk(`2`*@u&#k(4VAdShF8S70Ukf?i1*Hq+8j8z>k>iD6CY{L#Dfnk-Cxv)lo zBEhii^>83n537Gq#SRK~&2r0j`I4#!9p~oA3Bz%3+NGeqcsd%n0&>Z1)>fEux3X9$ zh}Lk~@u}r_?uzf#nDIFHJzA`?Rr8usW&M^{4Xg_3lO?EbAcR8(AK}`Stu5Q{;>?tN zYqyOrnJWk-hefp~PI+J33^uIFnpLCeqq(`&o7OGMtXgixTn~JK9(rVf909K3G!N}> zgP5#`N~-c#Hg9S;d6&}uat@W9MrqsfCBUg@GM&J#nMDdk+r`4%GfYhT^yL3IEr*Ai z4K}Cr6Wfxh;F3|Y+-u#{A*A|(K112?)|NIjtVD6Un}Nw47Gv3~)mioOVl>e)N0?~ew#vdMWp<_?vqA;WUEXfG zJJ;N*XE74;h^raLy=7IMvK6onY0q6%d+BC9T*-vwS>atrvPABrhlDu>=J6u~Z^W#D z9AFd%x_*_T>`3$hHBlhGwVHR6N;T@!5@}Lu{Lp4nA?=mrR*T+V~@wTPNovmSP zzkW}{X_(l*cXtPCn2Rzg767}EygAVZVTWI>Fw`}h7uTTUHUi5nF)ibr&qwQ6DmkAvh}~r6<%s+kpS4z@Y*UP(H}FKXX6L|8x2I+#a<2 zXz~sQ@}sFcNaX*7OzxjWN}S+fJi>o@I)gV6f;_Pa30j^6a8f-91Q%3^7CI$Zz+-r;ieQ0zZ&M{$P{l|H8dVG_ z+JfRwS`}kdig6BURgA}VTx^H4gymK^7idVTna+=sNy3l;#gL3zeU!nTS8$Gnr#f)b zD6r<7jd7`C>v^(4_%KZ-j;kybg@!qDa4?@E0mVlmpCdiHR6M4r_Bb+FA_)sPNrO{Z zQBEgFSDNcMoo+eJV2me(hC;bCw1445f>7R$Ct6{hmsRc^Iz;Yg`7Wtm}0qO&T@*$Tsq5@C~3mXw*02-!}QSrwZ^un`+kA{tSp2TePoB(C9l3(bT4 zmvkgX4*wyN47W!$5h6HpQNHvo)ov#Da3rcc(xcq+OJz<7G0OM!r_9NsrThrXAk^2@ zy*v_)x!1Se0nVAErT#E!8Fu0P9_~FzJKfRdFw@aasQRVzvwJw&pEjqUIPKB?v^hS- zX&>u0N65V1xVy+XceS)lMjcXr562Hu?iP&mTAb?>UB({dnuA`9>#_b^a~h3veP4gB zInc(q9`DaJXVZ@B9;&?IAf9#;&Y?C=`(%H>ISqG!w{NOFoH|IkTP{w~G0OM%r_AX) WMtPz?Wlrre%9DL4Q_WX5PvgJj<$bvT literal 0 HcmV?d00001 diff --git a/src/api/java/ic2/api/energy/prefab/BasicSinkSource.java b/src/api/java/ic2/api/energy/prefab/BasicSinkSource.java new file mode 100644 index 000000000..f9f936f6c --- /dev/null +++ b/src/api/java/ic2/api/energy/prefab/BasicSinkSource.java @@ -0,0 +1,116 @@ +package ic2.api.energy.prefab; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +import ic2.api.energy.EnergyNet; +import ic2.api.energy.tile.IEnergySink; +import ic2.api.energy.tile.IEnergySource; +import ic2.api.info.ILocatable; + +/** + * Combination of BasicSink and BasicSource, see their respective documentation for details. + * + *

A subclass still has to implement acceptsEnergyFrom and emitsEnergyTo. + */ +public abstract class BasicSinkSource extends BasicEnergyTile implements IEnergySink, IEnergySource { + public BasicSinkSource(TileEntity parent, double capacity, int sinkTier, int sourceTier) { + super(parent, capacity); + + this.sinkTier = sinkTier; + this.sourceTier = sourceTier; + this.sourcePower = EnergyNet.instance.getPowerFromTier(sourceTier); + + if (getCapacity() < sourcePower) setCapacity(sourcePower); + } + + public BasicSinkSource(ILocatable parent, double capacity, int sinkTier, int sourceTier) { + super(parent, capacity); + + this.sinkTier = sinkTier; + this.sourceTier = sourceTier; + this.sourcePower = EnergyNet.instance.getPowerFromTier(sourceTier); + + if (getCapacity() < sourcePower) setCapacity(sourcePower); + } + + public BasicSinkSource(World world, BlockPos pos, double capacity, int sinkTier, int sourceTier) { + super(world, pos, capacity); + + this.sinkTier = sinkTier; + this.sourceTier = sourceTier; + this.sourcePower = EnergyNet.instance.getPowerFromTier(sourceTier); + + if (getCapacity() < sourcePower) setCapacity(sourcePower); + } + + /** + * Set the IC2 energy tier for this sink. + * + * @param tier IC2 Tier. + */ + public void setSinkTier(int tier) { + this.sinkTier = tier; + } + + /** + * Set the IC2 energy tier for this source. + * + * @param tier IC2 Tier. + */ + public void setSourceTier(int tier) { + double power = EnergyNet.instance.getPowerFromTier(tier); + + if (getCapacity() < power) setCapacity(power); + + this.sourceTier = tier; + this.sourcePower = power; + } + + // energy net interface >> + + @Override + public double getDemandedEnergy() { + return Math.max(0, capacity - energyStored); + } + + @Override + public double injectEnergy(EnumFacing directionFrom, double amount, double voltage) { + energyStored += amount; + + return 0; + } + + @Override + public int getSinkTier() { + return sinkTier; + } + + @Override + public double getOfferedEnergy() { + return Math.min(energyStored, sourcePower); + } + + @Override + public void drawEnergy(double amount) { + energyStored -= amount; + } + + @Override + public int getSourceTier() { + return sourceTier; + } + + // << energy net interface + + @Override + protected String getNbtTagName() { + return "IC2BasicSinkSource"; + } + + protected int sinkTier; + protected int sourceTier; + protected double sourcePower; +} diff --git a/src/api/java/ic2/api/energy/prefab/BasicSource.class b/src/api/java/ic2/api/energy/prefab/BasicSource.class new file mode 100644 index 0000000000000000000000000000000000000000..aa23817177762383bd48e39eacee79a5966dca8b GIT binary patch literal 4391 zcmbVOX?xt{6+IfyVvpq{q}d#k;KZ1W6+li%Q^1fmwqr0jPN6?@B8+lpLw3PJOo2O^au1e^=W(VD|u!t3p3@*mGtVK`<{F6d6$3v=O6zBa2#J0 zF^H8O+=5CEs_=T@qb8q^7ij`9b#V#BG~~zCB3AK4H?GOZlVbiL=8s~Y67#f}KZ&_6 z=FeiD5%a7V6^(HR@tm0F#k?TqMKLdldAWdB3V5}E*ED29*9kOe(;9L$e^tFtYRKQ` zdTw}1gHf9CoY1Vgo?{2rVrYhL#c{mQ4X>H=d_ALH$0nyoE;87JUv@NXpP~0`qq^V( z^VULzBRgk&+p1i&0$0A{!ECtf)-?>xxb|_=s=21)Il-<%eXq40~d>HpsU z1-zkQJXx7lKd6+=OJc_oBpa-nS+&AtbG+i)E9d=sJV#D}Gz=sF?Xfg;)qED}aKa}g zXaR2)@D?+!J7HA1dDY%*N%g1Csk&kPj4JcIui=4K3F6vIcg^X@AOHO!hanT8!a>R~R zDUDF6#d2V+t`B8PlcK}CRrMPpmOi4|>p%#FE~B#x;k>mpYgMVvU8RwkE7n!ZtXSTX zITr?!m4;rru~TkD@m4x*TnQ=lk3dQS=N7JLIIsz{v9YW{-CnkWC9*i2)RP-JRdbp~ z$#-m0>YQKqKJ)|L;@s1ybA8I1;?iVgIHcQ_ccC@fW0jlb6c5&OJF}h&9A~1re6~|e zQJ6WZ!6`>R8%KKS(?Uq)T3^N0fT_&;v*Ys`rjoq9h0x?5He} z*9L{ywlCc&s?l*9-qvv#Lj}B}<6XR0!23Erz=t|+#juXwV@k*G@Sr$;B<5ospJ2Fv zPj!5T&oykDo;cnXRmUvO={S!^bo>%?I_7af$3oX>{Uk&{m z@oj5H!{Ek$n-`&mk)#+>32;HN_50RIIMLw~r8?_y^XPWHdT4nzlO9O!Y4H|GKW-HL zi5RV)(Y|$F&Q+0WYcu9TJJ8yE69tHvola)aR)*9qIdQ&7c6yZ6`nuiL+U3sjFrxf< zuJhn8O>*hu5HBBtV26=GR`kpZOjab!=K#lV!x7pNzrNsjj!)A#T3UlP_fnG0OLwp#7H)*#eFgaJ)+#h3j3ZT)TfPSC?E@$hAVQ9;fra zm+Og6x&E}t^<>QTOO_>1{-egx+eg;WW9-hY7dH3*6gEHsA^Ol@-&R?`CluKes_3K5 z!j9r+xLc7O#XY!J6?T-~!)y{cCw#b=gZ~r0+U2&ID;u#k@`udC0Lyr zE{cx7Mekn|ao<*P^~f)d%gYrWjAKl&@WQCqc$7hoEZsm+iV#sNs=9x`#6DDE_NedP zCcR!vvm?Br;~_j82Q<|;xXQjpCYj}@ZESLJm@H;+HU{4jgS&R>e`~Uc3iOvYXjcT? zaavBJP4ljyFA2WX29D^TyUBF6%sM*T7cbR=ar9O99{98JIW36!3x0z`R+efDd*6Cd^ek H&z1iHDPv2h literal 0 HcmV?d00001 diff --git a/src/api/java/ic2/api/energy/prefab/BasicSource.java b/src/api/java/ic2/api/energy/prefab/BasicSource.java new file mode 100644 index 000000000..41ca69209 --- /dev/null +++ b/src/api/java/ic2/api/energy/prefab/BasicSource.java @@ -0,0 +1,167 @@ +package ic2.api.energy.prefab; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +import ic2.api.energy.EnergyNet; +import ic2.api.energy.tile.IEnergyAcceptor; +import ic2.api.energy.tile.IEnergySource; +import ic2.api.info.ILocatable; + +/** + * BasicSource is a simple delegate to add an ic2 energy source. + * + *

It's designed to be attached to a tile entity as a delegate. Functionally BasicSource acts as a + * one-time configurable output energy buffer, thus providing a common use case for generators. + * + *

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

The constraints set by BasicSource like the strict tank-like energy buffering should provide a + * more easy to use and stable interface than using IEnergySource directly while aiming for + * optimal performance. + * + *

Using BasicSource involves the following steps:

    + *
  • create a BasicSource instance in your TileEntity, typically in a field + *
  • forward onLoad (or update), invalidate, onChunkUnload, readFromNBT ans writeToNBT to the BasicSource + * instance. + *
  • call addEnergy whenever appropriate, using getFreeCapacity may determine if e.g. the generator + * should run + *
  • optionally use getEnergyStored to display the output buffer charge level + *
  • optionally use setEnergyStored to sync the stored energy to the client (e.g. in the Container)
+ * + *

Example implementation code: + *


+ * public class SomeTileEntity extends TileEntity {
+ *     // new basic energy source, 1000 EU buffer, tier 1 (32 EU/t, LV)
+ *     private BasicSource ic2EnergySource = new BasicSource(this, 1000, 1);
+ *
+ *     {@literal @}Override
+ *     public void onLoad() {
+ *         ic2EnergySource.onLoad(); // notify the energy source
+ *         ...
+ *     }
+ *
+ *     {@literal @}Override
+ *     public void invalidate() {
+ *         ic2EnergySource.invalidate(); // notify the energy source
+ *         ...
+ *         super.invalidate(); // this is important for mc!
+ *     }
+ *
+ *     {@literal @}Override
+ *     public void onChunkUnload() {
+ *         ic2EnergySource.onChunkUnload(); // notify the energy source
+ *         ...
+ *     }
+ *
+ *     {@literal @}Override
+ *     public void readFromNBT(NBTTagCompound tag) {
+ *         super.readFromNBT(tag);
+ *
+ *         ic2EnergySource.readFromNBT(tag);
+ *         ...
+ *     }
+ *
+ *     {@literal @}Override
+ *     public void writeToNBT(NBTTagCompound tag) {
+ *         super.writeToNBT(tag);
+ *
+ *         ic2EnergySource.writeToNBT(tag);
+ *         ...
+ *     }
+ *
+ *     {@literal @}Override
+ *     public void update() {
+ *         ic2EnergySource.addEnergy(5); // add 5 eu to the source's buffer this tick
+ *         ...
+ *     }
+ *
+ *     ...
+ * }
+ * 
+ */ +public class BasicSource extends BasicEnergyTile implements IEnergySource { + /** + * Constructor for a new BasicSource delegate. + * + * @param parent1 Base TileEntity represented by this energy source. + * @param capacity1 Maximum amount of eu to store. + * @param tier1 IC2 tier, 1 = LV, 2 = MV, ... + */ + public BasicSource(TileEntity parent, double capacity, int tier) { + super(parent, capacity); + + this.tier = tier; + this.power = EnergyNet.instance.getPowerFromTier(tier); + + if (getCapacity() < power) setCapacity(power); + } + + public BasicSource(ILocatable parent, double capacity, int tier) { + super(parent, capacity); + + this.tier = tier; + this.power = EnergyNet.instance.getPowerFromTier(tier); + + if (getCapacity() < power) setCapacity(power); + } + + public BasicSource(World world, BlockPos pos, double capacity, int tier) { + super(world, pos, capacity); + + this.tier = tier; + this.power = EnergyNet.instance.getPowerFromTier(tier); + + if (getCapacity() < power) setCapacity(power); + } + + /** + * Set the IC2 energy tier for this source. + * + * @param tier1 IC2 Tier. + */ + public void setSourceTier(int tier) { + double power = EnergyNet.instance.getPowerFromTier(tier); + + if (getCapacity() < power) setCapacity(power); + + this.tier = tier; + this.power = power; + } + + // energy net interface >> + + @Override + public boolean emitsEnergyTo(IEnergyAcceptor receiver, EnumFacing direction) { + return true; + } + + @Override + public double getOfferedEnergy() { + return Math.min(energyStored, power); + } + + @Override + public void drawEnergy(double amount) { + energyStored -= amount; + } + + @Override + public int getSourceTier() { + return tier; + } + + // << energy net interface + + @Override + protected String getNbtTagName() { + return "IC2BasicSource"; + } + + protected int tier; + protected double power; +} diff --git a/src/api/java/ic2/api/info/ITeBlock.java b/src/api/java/ic2/api/info/ITeBlock.java index fe44aa734..7fc6665a4 100644 --- a/src/api/java/ic2/api/info/ITeBlock.java +++ b/src/api/java/ic2/api/info/ITeBlock.java @@ -1,8 +1,7 @@ package ic2.api.info; -import java.util.Set; - import net.minecraft.block.material.Material; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; @@ -19,25 +18,14 @@ import ic2.api.tile.IWrenchable; * by being able to extend it means all those methods you can now extend and be confident they will be called correctly. *

*

- * The more observant might have noticed there was an event that allowed you to do basically the same thing called TeBlockBakeEvent. - * Whilst that event used to add your own class onto TeBlock (that wasn't ideal as you could end up using the same ID as another addon which would cause a crash), - * this allows you to completely implement your own version of TeBlock, then let IC2 take it and build the necessary structures around it. - * Both mean you no longer have to use EnumHelper and lots of reflection to mess about with TeBlock, - * just to be left with either a crash from doing it too late/wrong, or lots of code bound to IC2 (such as language keys and blockstate jsons being in IC2's assets). - *

- *

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

* You can pick whether each of your tile entity items show up in creative, and the order in which they do.
- * You can choose whether you use an enum or class for your implementation. - * We use (and I personally recommend) using an enum, as the values should never change, but in the end the choice is yours.
* There is a proper separation between each registered ITeBlock by resource location, rather than everything being inserted into a single enum. * You also receive your own instance of BlockTileEntity and ItemBlockTileEntity rather than having to use IC2's own one.
* All the language keys and blockstate file are in your own assets (which you can, and in fact have to, pick). + * You can have custom item models with non-standard model locations. *
- * It is a vast improvement over TeBlockBakeEvent, which is probably important as it's gone now ;) - *

- *
* The event allows you to properly register your own version of TeBlock in a way that will be as fully supported as is physically possible. * It's not in the actual API itself as it's heavily dependent on internal classes, so you have this instead. * This is also probably the most documented thing in the entire IC2 API. I'm too kind really. ;) @@ -49,44 +37,42 @@ import ic2.api.tile.IWrenchable; *import net.minecraftforge.common.MinecraftForge; *import net.minecraftforge.fml.common.Mod; *import net.minecraftforge.fml.common.Mod.EventHandler; - *import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; + *import net.minecraftforge.fml.common.event.FMLConstructionEvent; *import net.minecraftforge.fml.common.event.FMLInitializationEvent; - * - *{@literal @}Mod(modId="ExampleIC2Addon") - *public class ExampleIC2Addon { - * public ExampleIC2Addon() { - * //You have to register before IC2 reaches Pre-Initialization, which unless you specifically load before it is unlikely you'll achieve. - * //Especially if you're an addon, you'll want to be loading after IC2 not before! - * //But, your mod's constructor will definitely be called before then. The issue is it's called more than once. - * //If you try registering the same tile entity ID twice it will crash (more on that later), so you'll have to use a singleton instance. - * //An enum works well for this, but anything will work as long as it's registered to the event bus once, and only once. - * MinecraftForge.EVENT_BUS.register(TileEntityRegisterer.INSTANCE); - * } - * - * {@literal @}EventHandler - * public void preInit(FMLPreInitializationEvent event) { - * MyTeBlock.registerTileEntities(); - * } - * - * {@literal @}EventHandler - * public void preInit(FMLInitializationEvent event) { - * MyTeBlock.buildDummies(); - * } - *} + *import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; * *import ic2.api.event.TeBlockFinalCallEvent; *import ic2.core.block.TeBlockRegistry; - *import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; * - *public enum TileEntityRegisterer { - * INSTANCE; + *{@literal @}Mod(modId="ExampleIC2Addon") + *public class ExampleIC2Addon { + * {@literal @}EventHandler + * public void start(FMLConstructionEvent event) { + * MinecraftForge.EVENT_BUS.register(this); + * } * * {@literal @}SubscribeEvent * public void register(TeBlockFinalCallEvent event) { * TeBlockRegistry.addAll(MyTeBlock.class, MyTeBlock.IDENTITY); + * + * MinecraftForge.EVENT_BUS.unregister(this); + * } + * + * {@literal @}EventHandler + * public void init(FMLInitializationEvent event) { + * MyTeBlock.buildDummies(); * } *} * + * + *import net.minecraft.block.material.Material; + *import net.minecraft.creativetab.CreativeTabs; + *import net.minecraft.item.EnumRarity; + *import net.minecraft.item.ItemStack; + *import net.minecraft.tileentity.TileEntity; + *import net.minecraft.util.EnumFacing; + *import net.minecraft.util.ResourceLocation; + * *import ic2.core.block.BlockTileEntity; *import ic2.core.block.ITeBlock; *import ic2.core.block.TileEntityBlock; @@ -95,21 +81,14 @@ import ic2.api.tile.IWrenchable; *import ic2.core.ref.TeBlock.HarvestTool; *import ic2.core.ref.TeBlock.ITePlaceHandler; *import ic2.core.util.Util; - *import net.minecraft.block.material.Material; - *import net.minecraft.creativetab.CreativeTabs; - *import net.minecraft.item.EnumRarity; - *import net.minecraft.item.ItemStack; - *import net.minecraft.tileentity.TileEntity; - *import net.minecraft.util.EnumFacing; - *import net.minecraft.util.ResourceLocation; * *public enum MyTeBlock implements ITeBlock { - * my_machine_name(MyMachineTileEntity.class, 0, false, Util.noFacings, false, HarvestTool.Pickaxe, DefaultDrop.Machine, 5, 10, EnumRarity.UNCOMMON, Material.IRON); + * my_machine_name(MyMachineTileEntity.class, 0, false, Util.noFacings, false, HarvestTool.Pickaxe, DefaultDrop.Machine, 5, 10, EnumRarity.UNCOMMON, Material.IRON, false); * * private MyTeBlock(Class teClass, int ID, * boolean hasActive, Set{@literal <}EnumFacing{@literal >} possibleFacings, boolean canBeWrenched, * HarvestTool tool, DefaultDrop drop, - * float hardness, float explosionResistance, EnumRarity rarity, Material material) { + * float hardness, float explosionResistance, EnumRarity rarity, Material material, boolean isTransparent) { * this.teClass = teClass; * this.ID = ID; * this.hasActive = hasActive; @@ -121,6 +100,9 @@ import ic2.api.tile.IWrenchable; * this.explosionResistance = explosionResistance; * this.rarity = rarity; * this.material = material; + * this.isTransparent = isTransparent; + * + * TileEntity.addMapping(block.teClass, IDENTITY.getResourceDomain() + ':' + block.getName()); * } * * {@literal @}Override @@ -194,12 +176,8 @@ import ic2.api.tile.IWrenchable; * } * * {@literal @}Override - * public void addSubBlocks(List{@literal <}ItemStack{@literal >} list, BlockTileEntity block, ItemBlockTileEntity item, CreativeTabs tab) { - * for (MyTeBlock block : values()) { - * if (type.hasItem()) { - * list.add(block.getItemStack(type)); - * } - * } + * public boolean isTransparent() { + * return isTransparent; * } * * {@literal @}Override @@ -212,15 +190,9 @@ import ic2.api.tile.IWrenchable; * return placeHandler; * } * - * public static void registerTileEntities() { - * for (MyTeBlock block : values()) { - * if (block.teClass != null) TileEntity.addMapping(block.teClass, IDENTITY.getResourceDomain() + ':' + block.getName()); - * } - * } - * * public static void buildDummies() { * for (MyTeBlock block : values()) { - * //System.out.printf("Registering %s (with teClass %s)%n", block.getName(), block.teClass); + * //System.out.printf("Building %s (with teClass %s)%n", block.getName(), block.teClass); * if (block.teClass != null) { * try { * block.dummyTe = block.teClass.newInstance(); @@ -247,6 +219,7 @@ import ic2.api.tile.IWrenchable; * private final float explosionResistance; * private final EnumRarity rarity; * private final Material material; + * private final boolean isTransparent; * private TileEntityBlock dummyTe; * private ITePlaceHandler placeHandler; * @@ -275,7 +248,7 @@ import ic2.api.tile.IWrenchable; *
  • itemMeta: The ID of the new instance. This is utterly critical, as it's the thing used to detect which ITeBlock an item is. * That's very important as the tile entity class is worked out by the ID when a block's being placed in ItemBlockTileEntity. * Changing this will cause everyone's items to change and there is no stopping that if you do. - * The ID you pick should start at 0, and go up to Short.MAX_VALUE. + * The ID you pick should start at 0, and go up to {@link Short#MAX_VALUE}. * Use -1 if the tile entity doesn't have an item form (or is placed using an item other than ItemBlockTileEntity).
  • *
  • identifier: The resource location associated with the ITeBlock. * The language keys, translations and internal mappings all use this, so it's best to store it as a static final variable and use that. @@ -291,16 +264,13 @@ import ic2.api.tile.IWrenchable; *
  • hardness: The hardness the block should have with the tile entity, IC2 normally uses 5.
  • *
  • explosionResistance: The explosionResistance the block should have with the tile entity, IC2 normally uses 10.
  • *
  • rarity: The EnumRarity that the item will have for the tile entity.
  • - *
  • material: The {@link Material} that the block representing the tile entity should have. Maximum of 16 different ones per ITeBlock registration.
  • + *
  • material: The {@link Material} that the block representing the tile entity should have. Maximum of 8 different ones per ITeBlock registration.
  • + *
  • isTransparent: Whether the block should be rendered with {@link BlockRenderLayer#CUTOUT} or {@link BlockRenderLayer#SOLID} + * (which controls whether transparency can be in the texture).
  • *
  • placeHandler: Custom placement logic, used for things like Reactor Chambers within IC2 itself. * Returning null for this uses the default logic (placing like a normal block).
  • *
  • dummyTe: An instance of the tile entity never registered to the world (don't try doing that) used for getting additional information about the Tile Entity. * Mostly an internal thing, only exposed in case your Tile Entity uses a special constructor.
  • - * - *
  • addSubBlocks: Called by BlockTileEntity to add all the ITeBlocks you want to the creative menu. - * {@link BlockTileEntity#getItemStack(ITeBlock)} will be a useful method to get the item stack, a block instance is passed for that reason. - * This is only called once on a random ITeBlock for the resource location, because they are internally stored in a {@link Set} so has no order. - * Will probably be changed to a static method if/when the move is made to only Java 8 support. * * IMPORTANT THINGS TO NOTE *
    @@ -309,15 +279,17 @@ import ic2.api.tile.IWrenchable; * For ItemBlockTileEntity, use {@link BlockTileEntity#getItem()}. *
    Using a custom item model for your ITeBlock
    *
    Implement ITeBlockSpecialItem along with ITeBlock, then the item model will be what's provided rather than the block model.
    + *
    The default implementation for adding ITeBlocks to creative
    + *
    The default logic adds all registered ITeBlocks that return true for {@link ic2.core.ref.TeBlock#hasItem()}.
    *
    * More will be added to this list if questions keep re-occurring, or are about a suitably important topic. *

    *
    *

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

    @@ -327,16 +299,17 @@ import ic2.api.tile.IWrenchable; * @see {@link ic2.core.ref.TeBlock} for how all the IC2 implements {@link ITeBlock}. * @see {@link ic2.core.ref.TeBlock.HarvestTool} for the currently available tools (you'll need this for adding new tile entities). * @see {@link ic2.core.ref.TeBlock.DefaultDrop} for the currently available drops (you'll need this for adding new tile entities too). + * @see {@link ic2.core.block.ITeBlock.ITeBlockCreativeRegisterer} for customising what blocks are added to creative past the default implementation * @see {@link ic2.core.ref.TeBlock.ITePlaceHandler} for making your own block placement handler (example in {@link ic2.core.item.ItemHandlers#reactorChamberPlace}). * @see {@link ic2.core.util.Util} for the useful facings you might want for supportedFacings. * @see {@link ic2.core.block.TileEntityBlock} for the base tile entity. * @see {@link ic2.core.block.BlockTileEntity} for the base block (you'll never need to construct this yourself). - * @see {@link ic2.core.item.block.ItemBlockTileEntity} for the base item (you'll never need to construct this yourself either). + * @see {@link ic2.core.item.block.ItemBlockTileEntity} for the base item (you shouldn't need to construct this yourself either). * @see {@link ITeBlockSpecialItem} for the interface used to have a custom item location. * * - * @since IC2 2.6.114 - * @version 1.2 + * @since IC2 2.7.14 + * @version 2.0 * * @author Chocohead */ diff --git a/src/api/java/ic2/api/info/Info.class b/src/api/java/ic2/api/info/Info.class index 54987885d9302262cfdd487de0f9ac8e25eaaacc..9682d4754144ddaf8aace5bbc16d6b0d8be7606b 100644 GIT binary patch delta 448 zcmX|+%PvDv7=^!cT0PFO71fq1Exo#zx~of75eYHy0Mdvw6%i2;uOWQ^FTj8%1_p)( z9zo(MOhx?rXbkpR>%V0EYk%1fPVxQckZw(uGC?H`nncFP8Vz0=BdC3jXiujUS~E^Fu2ddT=#j?%A)&}XrvSSG3H zq1U3ISYcJM#=1pOu|Y|(Nm;SQwt=U1oNuJeJL9lTl0hpr?f6C6bkON?7Xg>Mn;dL% zh_Kt2JHn1WF6_ZTvIq{;{oZgXCOw~2+A%JuT;0MTLvAlYQtyhsz;tILPnd5wg3oyF zpQxXB<2TwSOp9Qj1nehBOf2GLN&MRe36UZ#I~jQvX8Si0L;jTg%i|7o5=k3y8hDKc W=A%@GnCTywf@wLDkmvNHNFe2eMCtv{d(C2`@xr3-(+m0#i3 z7+lCJyRYiqcW*v}@a_Bg1!&MSjIt77s2f&UOR;X)VAH`?z&1Nh?Ydq=v!~g= z?tDa{dT-{Lwd9!5G%W{I6#hj|-W*zvIJTS+YECU@v@C5pmM-UmEALiax=hdnSkj^b z#u$%zg2|XOL(UF)ifQqU%M%*S4tihC=%j~Dmq zk9e;b!6*E?Omved_uZ5nNx_0_RU|9F%W`Tg{!Puw9t%>#l3b0K{vxkPvHZJ^n58%X Tl4^kWAco?9zp7MK@jPljHs&JJ diff --git a/src/api/java/ic2/api/info/Info.java b/src/api/java/ic2/api/info/Info.java index 8d3884216..619e04e53 100644 --- a/src/api/java/ic2/api/info/Info.java +++ b/src/api/java/ic2/api/info/Info.java @@ -25,7 +25,7 @@ public class Info { public static boolean isIc2Available() { if (ic2Available != null) return ic2Available; - boolean loaded = Loader.isModLoaded("IC2"); + boolean loaded = Loader.isModLoaded(MOD_ID); if (Loader.instance().hasReachedState(LoaderState.CONSTRUCTING)) { ic2Available = loaded; @@ -34,5 +34,6 @@ public class Info { return loaded; } + public static String MOD_ID = "ic2"; private static Boolean ic2Available = null; } \ No newline at end of file diff --git a/src/api/java/ic2/api/item/IC2Items.class b/src/api/java/ic2/api/item/IC2Items.class index a68e242fd1ff3a409f9937c36780c1f5428e15a5..95a0eb820192576d419a25e076d946714ae38f72 100644 GIT binary patch delta 332 zcmW-c%PvD<6otQYIOp#<{X5Vg+R`*4sOlvZsu$O`=)JVXL_{Q#CW41BHIOs*5Ht~y zU}j+A8N7voh`%P^+G}NJXYD)Bo5%k6eSQU!9NyZ&l*JM$H_N1LGGqlg!HSKWn2XiE zuJy6r$A*o~rXVjU+#h{vTG5H>;l!3?o1kQZpkPNbOi5CvBB)Aggak!Nora((*=5hU z)+^o?ZApucWS@p)l!M-v?$ZK8-P2_J-Y0v+PlG38_mOlBP?Rz@e4!egX#x z9J;u)B}bCZl8h8*jP;E*%*UK7 zVkU|UB1M7A>9^&H>0-(kqNwZkAX6qy1&2W2*|7-qm)%%tlVO!L1Pf;VEh#L+;WPFV z>8Sk9Y+kq0&0d5wRUTuunNTw&MUyN1r&(v-C~4j=v0-j48V)GB~ CT`6P$ diff --git a/src/api/java/ic2/api/item/IC2Items.java b/src/api/java/ic2/api/item/IC2Items.java index b0c113981..cee186861 100644 --- a/src/api/java/ic2/api/item/IC2Items.java +++ b/src/api/java/ic2/api/item/IC2Items.java @@ -5,6 +5,8 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; +import ic2.api.info.Info; + /** * Provides access to IC2 blocks and items. @@ -75,7 +77,7 @@ public final class IC2Items { public static void setInstance(IItemAPI api) { ModContainer mc = Loader.instance().activeModContainer(); - if (mc == null || !"IC2".equals(mc.getModId())) { + if (mc == null || !Info.MOD_ID.equals(mc.getModId())) { throw new IllegalAccessError("invoked from "+mc); } diff --git a/src/api/java/ic2/api/item/IElectricItemManager.java b/src/api/java/ic2/api/item/IElectricItemManager.java index 74964a24d..3c890d88f 100644 --- a/src/api/java/ic2/api/item/IElectricItemManager.java +++ b/src/api/java/ic2/api/item/IElectricItemManager.java @@ -94,7 +94,7 @@ public interface IElectricItemManager { * * @param stack electric item's stack * @param amount amount of energy to discharge in EU - * @param entity entity holding the item + * @param entity entity holding the item, may be null * @return true if the operation succeeded */ boolean use(ItemStack stack, double amount, EntityLivingBase entity); diff --git a/src/api/java/ic2/api/item/IItemHudProvider.class b/src/api/java/ic2/api/item/IItemHudProvider.class index df596fec3246e15da71b36a02d69c8b8967333bf..98e3cc0562bbcb402127a08e3014454ae0d2ef8d 100644 GIT binary patch delta 79 zcmbQv{FO=g)W2Q(7#J9g82H&4c-R?u*%|mIiv60b%V?<&6lP#zVPs%qU}sn1ziK03~(^mH+?% delta 112 zcmey$G@V)O)W2Q(7#J9g7zEiFc-a~F*ctfQ83ZN@|B{x%Q*ab=CbE|VBW$* zpCBSwxKC#aZBg}I==a1Vi!4c&S&_8SE{H3?QQNvIStB8-z$+=oD@gv4Dakr%!G>fL zpCBsPVq35y*=6rBWBBYTvWM-INki zS;x3BiibSzkHI3X*qv6{B2%UKKro(h;Wz&2;-Gp>y ThjvZuc`5~Ap-(;9u+#es3!q27 delta 336 zcmXAkOD{uF6otRr_U827o~X8=Z9GDRsK=y6grrr^h-k#fqqN?wXVrihn2|8h93vwH zbCHM`7?2o9Bz}j9KOo|W+1hJ=YiI4_;Agr0_Vf4zMAkwP4MgS-j-b zhc#gCXm(e#qvnBDhpJ#FtrG-AJe;a`yRqyD2TuK6(*q^ivpxeHzN wl3K2)=b8vNRBN{8KS7L;o^+PDR)*&5=q8~rc4^nb@l9CJBlN0Q8xHz@0T+=yFaQ7m diff --git a/src/api/java/ic2/api/network/NetworkHelper.java b/src/api/java/ic2/api/network/NetworkHelper.java index 84d52cf3d..9e7bcfea1 100644 --- a/src/api/java/ic2/api/network/NetworkHelper.java +++ b/src/api/java/ic2/api/network/NetworkHelper.java @@ -9,6 +9,8 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.relauncher.Side; +import ic2.api.info.Info; + /** * Provides methods to initiate events and synchronize tile entity fields in SMP. * @@ -158,7 +160,7 @@ public final class NetworkHelper { */ public static void setInstance(INetworkManager server, INetworkManager client) { ModContainer mc = Loader.instance().activeModContainer(); - if (mc == null || !"IC2".equals(mc.getModId())) { + if (mc == null || !Info.MOD_ID.equals(mc.getModId())) { throw new IllegalAccessError(); } serverInstance = server; diff --git a/src/api/java/ic2/api/reactor/IReactor.class b/src/api/java/ic2/api/reactor/IReactor.class index 3b27ee12fd623f2b0261a9924e6b49317da6af1d..7878499fb08cb51c36a261b3b6474a84cbe6a2a5 100644 GIT binary patch delta 188 zcmXZRIS#@=5Jb^G$fnsB517sDTTaC7I0Hu^b%2O{3txf+31Lc;^sB0VSsDA{n?HdI zXX9WTjnmy delta 373 zcmZ{fyG{Z@6o&uZ0OJkBfNqT96_xciiIs_!m%;)QL!tG!4mhwoW0pZH<1-j)AHvqc zSo;>f2yr+T6vpD5FDL(hZr|BYR{9#ee*ieZKEn>fF2mkS>F{~FC2d2B$eQ%pr17nX zN-eBwX?dcwj8f6G{BbC7l8-!0oXPuCM#4&Go^SNDRf)V(U3C-7W37!9RvF#(FjsGj z2f<^ZTYS{xCgevu!%O3w)junHR>eFK_Ku&#Ch9oX+xfsdEoVGrkOdrbVDK^Kegei_ z - * Should be the same world as {@link #getCoreTe()} returns if it's not null. - * @deprecated See {@link #getWorldObj()} - * - * @return The reactor's world object - */ - @Deprecated //TODO: remove for 1.11 - public World getReactorWorld(); //getWorld has obfuscation issues (https://github.com/md-5/SpecialSource/issues/12) - - /** - * Return the reactor's current position in the world ({@link #getReactorWorld()}. - *
    - * Should be the same position as {@link #getCoreTe()} returns if it's not null. - * @deprecated See {@link #getPosition()} - * - * @return The reactor's current position - */ - @Deprecated //TODO: remove for 1.11 - public BlockPos getReactorPos(); //As would getPos - /** * Get the reactor's heat. * diff --git a/src/api/java/ic2/api/recipe/IBasicMachineRecipeManager.class b/src/api/java/ic2/api/recipe/IBasicMachineRecipeManager.class new file mode 100644 index 0000000000000000000000000000000000000000..31608e7837e59c63e8de16e36462565555561c9b GIT binary patch literal 679 zcmaJM&f~e@h#FG~faB&l^B_x6&X#$b}@qnl4cCCx;wrRKC{T~0ogCF2W z8He_OR^%`<$?UwD_g?n%>-_@&x^QN}i3KeSP8rnE^JY@0STb, ItemStack> { + boolean addRecipe(IRecipeInput input, NBTTagCompound metadata, boolean replace, ItemStack... outputs); + + @Deprecated + RecipeOutput getOutputFor(ItemStack input, boolean adjustInput); +} diff --git a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$Input.class b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$Input.class index 89a9b2f1762623f20cbde6a1300d09e51e40fe4e..4b88cdf180f9cda4b199e19c418d1d7485fc2817 100644 GIT binary patch delta 184 zcmW-ZO%B0e5Qd+xRnt;GO;!CXZ6y{W5s8&>F^7=v9yWFs*5U%L;RIsX%*>nTnfD=A zDW0F(9oSITsL~Jc82rYt&WN!v6|!^ju{(3=&q4%0B)}KuAu+j77}n?a+OC{eBd0>4 zxTML#MsAv@kJ0|t?+Himn2z1M2eY&%H{A-!pJ&PwoXOE>NHsY0h;-Lf^O(>k F_yT8B6XE~> delta 240 zcmYj~O-jR15P-k;()1-UwAHk>u^OK>_76&_J6H7py@ZH`K&T+SNXSJ5cP_e?UchU3 zg5snLkzr=OVdi5#%$G^`htC~w&nTcy-^b;$Dpw~YTpMl-gCadd!Sm~8`;={7-WCdX zo#pwWwCX*+4Ka8jKAs^B>2PNlD(1z{yzJ@khY>Z#vYyajDhU=xYE$A&dPNZ)>PT%N tE!^R}96QU^?4M!(3@b+WXjs}pnx5D$I(bww#4>0uIF%mAnJX___`ig>8AbpA diff --git a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$RawInput.class b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$RawInput.class new file mode 100644 index 0000000000000000000000000000000000000000..f7edd9fed0e942e8f1ab53fcb98d50e15d495e9b GIT binary patch literal 636 zcmb7BT}uK%6g{)9u4`L<^!-5}(1TjEwE0#PBm{yLXb3%y+h}9!uB>DIt{x=lp&!tX zitboFCdI(HbMD-G&YhX}kJmQ<9yT&aV!?)qMGZ?9RxGSC*nSi$E<+JBY}P}e+&&RM z<{jlqCHiiSpsBe3aLizKWDqc%<@~((?e?;hBnPxPKeQ_bR^VaV@2R;7C9oSfNkb>nP4a>qhgZF=1hMZP& z10HtW>vm80be%*|KT7G(YS^K_OwtD%$m@w{m)Ap4WVCE#2xo}hQbmGdw)_HC-W$Ux z?~jpqrj!APus}ktevy|EXY9pQ}MgkKXHrZ(-gI0lcC^KXx zN?!E)ZRx0yWVoudlvCqkq_`iMxE)K8Z+*U~rQt)RrQ?em!pVelKY>X?&IUCAJHs@ju-llY$}(A*_++O!5BS5_0MG( zN}t<`$uR6E!>6HPs3qNgABKVdJtzX2Wnf6rNz*TwUZAz207Um9*^6Wamgr>3XE{<< gP@1MthE?)QVGZliy+JXcw-gpAHba>$x^u|C14U9b*8l(j delta 220 zcmey!{)@%()W2Q(7#J9g7=+mw1lSn_*%^cw8CX5@3Q9{D8F)PN@=}YOa}tY-Q;QiH zI1^J+f>M(+3sM;wq9=MqGHHfQc4I7b;7U&|frtYY32JEiWF?j*>X(*e=IHw-7FYu{ z24|+{C6<&H0W~I~%iH)&_G8wccua8e3P#?^^-M*ReVNVefo@`8W?^JtV_;`s0MZ-` joM4)Zftvy7FrX|G11}Ksfm!?vtU#IzD8mfIEDW3gX`(Mt diff --git a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java index 415b3c38c..6471e475e 100644 --- a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java +++ b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java @@ -1,51 +1,57 @@ package ic2.api.recipe; -import java.util.Map; - import net.minecraft.item.ItemStack; -public interface ICannerBottleRecipeManager { +import ic2.api.recipe.ICannerBottleRecipeManager.Input; +import ic2.api.recipe.ICannerBottleRecipeManager.RawInput; + +public interface ICannerBottleRecipeManager extends IMachineRecipeManager { /** * Adds a recipe to the machine. - * + * * @param container Container to be filled * @param fill Item to fill into the container * @param output Filled container + * @return */ - public void addRecipe(IRecipeInput container, IRecipeInput fill, ItemStack output); + boolean addRecipe(IRecipeInput container, IRecipeInput fill, ItemStack output, boolean replace); + + @Deprecated + void addRecipe(IRecipeInput container, IRecipeInput fill, ItemStack output); /** * Gets the recipe output for the given input. - * + * * @param container Container to be filled * @param fill Item to fill into the container * @param adjustInput modify the input according to the recipe's requirements * @param acceptTest allow either container or fill to be null to see if either of them is part of a recipe * @return Recipe output, or null if none */ - public RecipeOutput getOutputFor(ItemStack container, ItemStack fill, boolean adjustInput, boolean acceptTest); - - /** - * Gets a list of recipes. - * - * You're a mad evil scientist if you ever modify this. - * - * @return List of recipes - */ - public Map getRecipes(); - + @Deprecated + RecipeOutput getOutputFor(ItemStack container, ItemStack fill, boolean adjustInput, boolean acceptTest); public static class Input { - public Input(IRecipeInput container1, IRecipeInput fill1) { - this.container = container1; - this.fill = fill1; + public Input(IRecipeInput container, IRecipeInput fill) { + this.container = container; + this.fill = fill; } - public boolean matches(ItemStack container1, ItemStack fill1) { - return this.container.matches(container1) && this.fill.matches(fill1); + public boolean matches(ItemStack container, ItemStack fill) { + return this.container.matches(container) && this.fill.matches(fill); } public final IRecipeInput container; public final IRecipeInput fill; } + + public static class RawInput { + public RawInput(ItemStack container, ItemStack fill) { + this.container = container; + this.fill = fill; + } + + public final ItemStack container; + public final ItemStack fill; + } } diff --git a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$Input.class b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$Input.class index b9899a9f2f2cd2fa43e6867ec4f2077bfc4d1695..8a00f0bcc12eb81cd8503f06e7a681ea339ba95e 100644 GIT binary patch delta 258 zcmYk0IS#@=3`O4r$Rr_R-Jls(6s3BCvFTI5{Qy8L6tDmQ delta 287 zcmYj~JyOC@6otQ+IC*(VCL##k+Irp4q8ax_>oCP##g`9Jtv6{wGT+v(xNshO`-MVeJNMH&{!JL%|#g#=|X_ U#!Aw$B!?3!G6N~|gjB}-11b+3Qvd(} diff --git a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$RawInput.class b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$RawInput.class new file mode 100644 index 0000000000000000000000000000000000000000..6d01f5efdee0dfe4e7a83e186704c2519041f567 GIT binary patch literal 685 zcmb7C%T59@6g?e49*zRO-;cx?L}L}*Y1|MsB&Z1(5|?EtP#g*=1AdnaW8%UO@S}{k zs0&O?becKsy*>AwJMFx^zq|s-VKspWX5$EB&cb{Yi%~2wMCyKD)fl#mS_ZtWwDgRq z2lb9=NIu-_@e4~S2g18QVTg%ZO$BNo8P-N?xC&&O7YM$&W2Z{1;EdriGfMqUew6i7 zaHql$&Ub2Loh(wP*Zp=?np;uzDKk~|zX27cs=6SYgQh-8#QK literal 0 HcmV?d00001 diff --git a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.class b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.class index f32226dce7b182acd4577a1bbc0581cbdb4fff86..73118021fa03e1a9bc097d59c0d5b28f8d424ed6 100644 GIT binary patch delta 398 zcma)&y-xx`5XIk|9LoWI;0KDeg`wGmmPR8D3B&{wV_}TTxxpppa=F{XSolYfYi+G8 z?JVqU{G*JME5yRWV)FLo&2MIRpZpim{rq}+2hc%FU|V2Epee9RsEpKo-^Q6E)ce-z z*3O)AW@b}Db1+qNB_m}g za>;ZT&kw!e%uK9uS)vIazuHd6QyseQz=R#CVk3EviM8wxRd{Qx9u;<|teWT~zod)B zbtAX5|8w*FmD0n5|Ima^ensut^39UHjLHOp$F;&= { /** * Adds a recipe to the machine. - * + * * @param input Fluid input * @param additive Item to enrich the fluid with * @param output Output fluid */ + @Deprecated public void addRecipe(FluidStack input, IRecipeInput additive, FluidStack output); /** * Gets the recipe output for the given input. - * + * * @param input Fluid input * @param additive Item to enrich the fluid with * @param adjustInput modify the input according to the recipe's requirements * @param acceptTest allow input or additive to be null to see if either of them is part of a recipe * @return Recipe output, or null if none, output fluid in nbt */ + @Deprecated public RecipeOutput getOutputFor(FluidStack input, ItemStack additive, boolean adjustInput, boolean acceptTest); - /** - * Gets a list of recipes. - * - * You're a mad evil scientist if you ever modify this. - * - * @return List of recipes - */ - public Map getRecipes(); - - public static class Input { - public Input(FluidStack fluid1, IRecipeInput additive1) { - this.fluid = fluid1; - this.additive = additive1; + public Input(FluidStack fluid, IRecipeInput additive) { + this.fluid = fluid; + this.additive = additive; } - public boolean matches(FluidStack fluid1, ItemStack additive1) { - return (this.fluid == null || this.fluid.isFluidEqual(fluid1)) && - this.additive.matches(additive1); + public boolean matches(FluidStack fluid, ItemStack additive) { + return this.fluid.isFluidEqual(fluid) && this.additive.matches(additive); } public final FluidStack fluid; public final IRecipeInput additive; } + + public static class RawInput { + public RawInput(FluidStack fluid, ItemStack additive) { + this.fluid = fluid; + this.additive = additive; + } + + public final FluidStack fluid; + public final ItemStack additive; + } } diff --git a/src/api/java/ic2/api/recipe/ICraftingRecipeManager$AttributeContainer.class b/src/api/java/ic2/api/recipe/ICraftingRecipeManager$AttributeContainer.class new file mode 100644 index 0000000000000000000000000000000000000000..26f2e3b87ce2d04958dafdf14e3cb5147cd9d027 GIT binary patch literal 565 zcmbVJ%SyvQ6g`us#?)vZzHJu@3T*@fU5Sby0ijS8R0?)CNym0dIw^VhUoMK^!VmDH z#5>iUE<^_Iz2`p8J-AMrF5)N|66VcX+V=_MkRQ{i>|gg<7a;&zU&xZ*>R?Ej=XWhmXn zc@m0Csg=}!pFA4#C+@(;j)MhQ4i;fqs52b@cQHdnb9xb1L+>USi!fs-H1#(f{D~8L zbc7;Z#z0kTqNu86k*8CT)DqbxLJ!nYAYXQ0z})%_hTE8-@JuNK4%r$J0Zp9T?)W2Q(7#J9g82H#3xY-$a*co^k8H5~5N{TX*N=s6m^Ycm)GxJi57#Vmx z^MJH-PGWI!YVkyYeawsu789qbda7V5W@BVvWMBds%fP_I(#XKZz|Oz`q&Yw|P@EG? Saxt(1X)d5jW*}x^-~<2$EFL5P delta 63 zcmaFH^o3F2)W2Q(7#J9g7`WIOIM^9DCz|h5V`F4sWMBe{GB7Z)G%_$VurM$HX;u&o LlwkvjGq3{yosS4> diff --git a/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java b/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java index 756eaf634..7ff754571 100644 --- a/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java +++ b/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java @@ -4,23 +4,42 @@ import net.minecraft.item.ItemStack; /** * Recipe manager interface for crafting recipes. - * + * * @author Richard */ public interface ICraftingRecipeManager { /** * Adds a shaped crafting recipe. - * + * * @param output Recipe output * @param input Recipe input format */ public void addRecipe(ItemStack output, Object... input); - + /** * Adds a shapeless crafting recipe. - * + * * @param output Recipe output * @param input Recipe input */ public void addShapelessRecipe(ItemStack output, Object... input); -} + + /** + * Attribute container to pass additional information to AdvRecipe and AdvShapelessRecipe + * + * @author Chocohead + */ + public static class AttributeContainer { + public final boolean hidden; + public final boolean consuming; + + /** + * @param hidden Whether the recipe is hidden from JEI by default + * @param consuming Whether containers should be consumed or returned empty + */ + public AttributeContainer(boolean hidden, boolean consuming) { + this.hidden = hidden; + this.consuming = consuming; + } + } +} \ No newline at end of file diff --git a/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager$Output.class b/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager$Output.class new file mode 100644 index 0000000000000000000000000000000000000000..24704809b4d31f65d96e7d9c4cb0d9b76e67d413 GIT binary patch literal 918 zcmbVKU279T6g`uV#*M3~wZ?C4K}wC{NFNkQsSm+IV6|YRuVu2G#A!FP%Vt*S&+?%N zKKKLtQR121_Ms4Hm4%sm&%O7YJ9qEzKR)rg+&3p57lA$#vcZ17Vt z8|(aw8Ye_nqBK^?zRHdF&%lQJYUb46D_mAMfpBO!pFyJLb4~nRWa2HUG9z;xn@r2$ zhgs%M%H9X()BIe9J}RrGI)7F%aR}XudMDYr=E34OUOLyS&!9a@i#*o5#=m>x(w<-W zT?i54X^17XLbP$cg*Ab<|M_}><#N3eWv6m)e8lY%sBik;^ZH*YvCbWCa7@Vue{Da%-#-AL38x+$d2sAO-GdW^a^ITR8iZO$Dbg*;lY|n4 z5|3j!LwG&!Dl%*;6a|`(4HJf@tmC?&;lZ=Ny*iF`NNg;v7$vMdAN;NenvBPSStDeY zYemX%x1r9od(nvehl^FAra;8RdOUb?MT0aNP-3O=5h_CwDsHSMgs=Z}wwvyRzi=kG z3fXTB*93xq~~m)~F@T<6Pni7jrZjDS#ZZO{EE hEFyTY@1lx}3Q%>~Y<2*(G;;`LH&$Im(X|p(egM%JEr { + MachineRecipeResult apply(ItemStack input, Fluid requiredFluid, FluidContainerOutputMode outputMode, boolean acceptTest); + + public static class Output { + public Output(Collection container, FluidStack fluid) { + this.container = container; + this.fluid = fluid; + } + + public final Collection container; + public final FluidStack fluid; + } +} diff --git a/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager$Input.class b/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager$Input.class new file mode 100644 index 0000000000000000000000000000000000000000..9f813eba2cd4e250ef856e410ba4727a9fd86d08 GIT binary patch literal 701 zcmbVK%Sr<=6g`=?*4EM5`hKFIqE!qC;zDs#PzqH+MR1u;(;A)5lVyM2L7)9;yvz*>J`GmKhVCcdsbvLRo9fddnm_)y?@y&v+OyWjg0 z;l`Cfx)L_DK%vGmPkZgUjxJT*r=?U2J>_4i$XNZ;n2v8umxWh@PA?X4s{uQ$_^R90 zH1E}nwfqgol&JUxdBL(+p?k)!$&-x9VQG z$YajM0J1Iyk;`IUVE1471x78Q^i|N3XZ2g{v9;8?osRq?A(r_VGJGKpincVKincoL zf-8?9N|)L-BU0Q8p<|CZ))+166G&vZiERhHpr7RL&!U)Fr14|z;6lk+wAxR^W WlTGAsjZt$jP9&I;cZ_K=<=z2H`m+@P literal 0 HcmV?d00001 diff --git a/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager.class b/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager.class new file mode 100644 index 0000000000000000000000000000000000000000..42ddd10a7ac9bf619938d326c36e0246e18bacd3 GIT binary patch literal 931 zcmd5*%}N6?5T2=R*R55n&rm@x1`3|G^in7+Y$>$h!CTD6nwn;p-9+#Kd?vwz58y+I z<8Enf6|^Tk%)3YAJ04wTjd?Nr=PjOB{F#>LB!8$Oj;y8sN9Zq6#r*6l~mQp{lz z%i!v4X}G{2a&b$bCFWS>PTK&%pQx$f)@2g0`X6%YMl*iTndWB7E)x|8rCe0oPqdc8 zs>F07BQ2X#JtE^bmMJUeETnB>xws2@E1I@rw?~vbeac{TJ)?kM(bmXZH0bX$Z%h)G z2}y$_5l(&@sPhk^5!jY, Input> { + MachineRecipeResult, Input> apply(Input input, FluidContainerOutputMode outputMode, boolean acceptTest); + + public static class Input { + public Input(ItemStack container, FluidStack fluid) { + this.container = container; + this.fluid = fluid; + } + + public final ItemStack container; + public final FluidStack fluid; + } +} diff --git a/src/api/java/ic2/api/recipe/IFluidRecipeManager$RecipeIoContainerFluid.class b/src/api/java/ic2/api/recipe/IFluidRecipeManager$RecipeIoContainerFluid.class deleted file mode 100644 index d2fad775369819f90bf0d99d454d6cb9012e18dc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 687 zcma)4O;5r=5Pe&~3RVlKh#w?MJRlmI5I5jsHq12Xk&Eg|z z`NEbXVYTj}y`|E1h6OJSB49ZVoZ>oBy6J?nuh5s$mBAImbtMk}!5dHh<~ryyBpY5| zFqm!WiretHC;SKAb10H;dp38v+?UFq1(U&(95WPV`n`td2AnGWNF0OFa>;2pd^{F} ztH(98BHXn4hP!+q{Qdb{^r4x1FZ6BEluAxbI^~oo+8M13mdG09JrW{8yIFk$ zs~%3ERgWe}yi!QRGTA&40ViZnsr(EpIHwobotD8QgnG=V4U0~ykw$BkJPm8q8q|_T Jj3Tl~e*;5ntSSHi diff --git a/src/api/java/ic2/api/recipe/IFluidRecipeManager.class b/src/api/java/ic2/api/recipe/IFluidRecipeManager.class deleted file mode 100644 index a6f3a2d4e76457b2b66848a0c0a43f63a8acaf72..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 654 zcmah{Jx{|h5Iwi0A)!F|s+bW&x?rgr3SuBqq)3HIq*IyP#Eo21CvqHi{uTp2fFFgp zBt@v9h{0dyckjJB`{VQN9RNmfX27ulCkC7n7(DV&WZX~PRB9$9S6)(xh(OPmcyJSz z=R7B1vM8#d1eW$#gd@r_K~k3@shnTnlKrcREo_Ljwmw_v1GbXoItP@bkh{`EB7_^J(Dcv>T=ziMu(l- z(uc^u^$4`>vR*4l3l(xtB&d46h3~5LO5mdT1izID^ndD_%$GdW1g`(j`@?aU0D%_% sAb?Ki6}n*HhQKbE)oQ^W-uLjf1^XC3fWvCvujV7z!PP=U8%GDsFSQ-RwEzGB diff --git a/src/api/java/ic2/api/recipe/IFluidRecipeManager.java b/src/api/java/ic2/api/recipe/IFluidRecipeManager.java deleted file mode 100644 index 7cc662429..000000000 --- a/src/api/java/ic2/api/recipe/IFluidRecipeManager.java +++ /dev/null @@ -1,60 +0,0 @@ -package ic2.api.recipe; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import net.minecraftforge.fluids.FluidStack; - - -/** - * Recipe manager interface for machines that will probably never be added. - * - * @author estebes, Player - */ -public interface IFluidRecipeManager { - /** - * Adds a recipe to the machine. - * - * @param input Fluid input - * @param output Output fluid - */ - public boolean addRecipe(IRecipeInput input, NBTTagCompound metadata, boolean replace, FluidStack... output); - - /** - * Gets the recipe output for the given input. - * - * @param input Fluid input - * @param adjustInput modify the input according to the recipe's requirements - * @return Recipe output, or null if none, output fluid in nbt - */ - public RecipeOutputFluid getOutputFor(ItemStack input, boolean adjustInput); - - /** - * Get all registered recipes (optional operation). - * - * The method is only available if {@link #isIterable()} is true. - * You're a mad evil scientist if you ever modify this. - * - * @return Iterable of all recipes registered to the manager. - * @throws UnsupportedOperationException if {@link #isIterable()} is false. - */ - public Iterable getRecipes(); - - /** - * Determine whether the recipes can be iterated. - * - * @return true if {@link #getRecipes()} is implemented, false otherwise. - */ - public boolean isIterable(); - - - public static class RecipeIoContainerFluid { - public RecipeIoContainerFluid(IRecipeInput input, RecipeOutputFluid output) { - this.input = input; - this.output = output; - } - - public final IRecipeInput input; - public final RecipeOutputFluid output; - } -} diff --git a/src/api/java/ic2/api/recipe/IMachineRecipeManager$RecipeIoContainer.class b/src/api/java/ic2/api/recipe/IMachineRecipeManager$RecipeIoContainer.class deleted file mode 100644 index 0d21f7ada7da7ed302520a22dd3cdb47e7409824..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 670 zcma)4O;5r=5Pe%dDp)PxH%g)j2Sj5N4#o(0Au(wJlBgl^xYP|SsVyn3|H}h0@!${e zM;T`e7m*mc>CEoToA;(W{rdj+1W-dMixhS;NMcu+Jsk%+iVP{~jiZpE)Rs=o;$vwA z!jWTP+4r%xRl3fQ_M>n)aE9x~X$5RZPlh)P&C0)&i^*R!r#*&b%YPOOW?OpVE_&&U z;F0%TiWJ(u!`&Vaq&m-o$#5tq4EcH2e#`elPL%p3%x;ovcBpCqg91o7H!)>e&=p^?ZuN z8-+A%kS!1qa80&OLn1i$bj9z1&}F<}!f21`iP#H0pnvh>7lC~I9(woTcZ_}4u61N>3O zfeJxv497S7-prdf`}y_$0RSyHtH4PGP8n2jJQmVdv1IUQ^(Od=JVYIEcQlc{v2!X~ z8a`E8`UyT8u1AJH-FY4c_t7+tQa!eZjUhE2s6eAh6KdSFJmJ`$aP8i9;u6Mj_{N}} z<7n9EDZj-rRy})###oB zkqM4MNvzx4htAc%16QNE*(5bvc4V+)&2tkS;oPiE{JDd0bBcMy?q4l!G>Fo~mk%nW zYg{Z~xr*{I#55Ht z0~43a62-u?$I|a}j3rNsM(%D1RGevNtc2!kV(}Av(p-6(-`&pV7!0Fz9A#?hEFLQu zsl}SR6lNOz7pJ!%{XpnxripMAk)474cgvzz^;B9aDI5kC@s&?B&4t|?ukaOlh$_g1 z6ZAqsD03zQg*rUKV-HH)&u z7b6*x&I_aiti?(HIWV2`pzh&r7HnBPJmyM+J% diff --git a/src/api/java/ic2/api/recipe/IMachineRecipeManager.java b/src/api/java/ic2/api/recipe/IMachineRecipeManager.java index efa62cc88..7126ad6b5 100644 --- a/src/api/java/ic2/api/recipe/IMachineRecipeManager.java +++ b/src/api/java/ic2/api/recipe/IMachineRecipeManager.java @@ -1,6 +1,5 @@ package ic2.api.recipe; -import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; /** @@ -8,7 +7,7 @@ import net.minecraft.nbt.NBTTagCompound; * * @author Player, RichardG */ -public interface IMachineRecipeManager { +public interface IMachineRecipeManager { /** * Adds a recipe to the machine. * @@ -19,21 +18,23 @@ public interface IMachineRecipeManager { * @note Replace is only as reliable as IRecipeInput.getInputs(). * * @param input Recipe input + * @param output Recipe outputs, zero or more depending on the machine. * @param metadata Meta data for additional recipe properties, may be null. * @param replace Replace conflicting existing recipes, not recommended, may be ignored. - * @param outputs Recipe outputs, zero or more depending on the machine. * @return true on success, false otherwise, e.g. on conflicts. */ - public boolean addRecipe(IRecipeInput input, NBTTagCompound metadata, boolean replace, ItemStack... outputs); + boolean addRecipe(RI input, RO output, NBTTagCompound metadata, boolean replace); /** - * Gets the recipe output for the given input. + * Gets the recipe result for the given input. * - * @param input Recipe input - * @param adjustInput modify the input according to the recipe's requirements - * @return Recipe output, or null if none + * @param input Recipe input (not modified) + * @param acceptTest If true the manager will accept partially missing ingredients or + * ingredients with insufficient quantities. This is primarily used to check whether a + * slot/tank/etc can accept the input while trying to supply a machine with resources. + * @return Recipe result, or null if none */ - public RecipeOutput getOutputFor(ItemStack input, boolean adjustInput); + MachineRecipeResult apply(I input, boolean acceptTest); /** * Get all registered recipes (optional operation). @@ -44,23 +45,12 @@ public interface IMachineRecipeManager { * @return Iterable of all recipes registered to the manager. * @throws UnsupportedOperationException if {@link #isIterable()} is false. */ - public Iterable getRecipes(); + Iterable> getRecipes(); /** * Determine whether the recipes can be iterated. * * @return true if {@link #getRecipes()} is implemented, false otherwise. */ - public boolean isIterable(); - - - public static class RecipeIoContainer { - public RecipeIoContainer(IRecipeInput input, RecipeOutput output) { - this.input = input; - this.output = output; - } - - public final IRecipeInput input; - public final RecipeOutput output; - } + boolean isIterable(); } diff --git a/src/api/java/ic2/api/recipe/IScrapboxManager.class b/src/api/java/ic2/api/recipe/IScrapboxManager.class index 2aa3304f11f9c2eb446b97ea926513a2b6658ce7..80cf6ffd49f150693e85f9fd4082c16b8a1961f9 100644 GIT binary patch delta 129 zcmeBX-oq?>>ff$?3=9lL41(+oeC!PT>6nHuLJYuAh^Q}H_N|95?{_`G#%zqnbgsLUBnZJX VXcUwP&W2QJWdE(-Ks687zT?M89=g9VJ`0jMl`z;V;od zLZXR3z#nCNPH){{TjtD?yL;|^&U2pga{KG|_n$q)R@L2=D1K_!9nPE&@tbnltRJ+R?Uv`%*fnoEw!0_Mnl>0~@FaT% z`h!*tp{I&qKK7awt5Y^B4VP7KCJOJAZ2bC0HHlnMVPT^d1=En%J|(!dTh-yFkp93wXyv$Lf|_5Zy~_*})2; zxmwomS{%qy&^SKh)=l8-2;Dn0xq~Yp7^8J89M~yi3=r z1@e{hJ`dMXe!uW~FpoWrug9SdTEuW}Q$9b8t~4yfU{s0J)0Wq%T5oNC;%-gRCO?)0 zrD%?qmkCm7B0-b9Ow%1ah*2Xb%D|4VB$^wAlxVvDRpKFPJSyAT$WrePCX_v+C42$m z_&~^r4aFo;0#=BUupz!{Pr*hWxQpN{MR$Qo!)lWPU!s_vTbHg$`ii|wGgwt1h@$w# zD1+Uiz|lRr4+|baJl=7n5Y65~J?Ns6h$v7~KnZ;heHC+oiqH60fJy7u6w-57Bc*8D-_TJ-Kj+4)X` RTv3%QJjG6@9MB { + public MachineRecipe(I input, O output) { + this(input, output, null); + } + + public MachineRecipe(I input, O output, NBTTagCompound meta) { + this.input = input; + this.output = output; + this.meta = meta; + } + + public I getInput() { + return input; + } + + public O getOutput() { + return output; + } + + public NBTTagCompound getMetaData() { + return meta; + } + + public MachineRecipeResult getResult(AI adjustedInput) { + return new MachineRecipeResult(this, adjustedInput); + } + + private final I input; + private final O output; + private final NBTTagCompound meta; +} diff --git a/src/api/java/ic2/api/recipe/MachineRecipeResult.class b/src/api/java/ic2/api/recipe/MachineRecipeResult.class new file mode 100644 index 0000000000000000000000000000000000000000..09bb88f049cc55ed8e47926924b298af35024d7d GIT binary patch literal 1336 zcma)5+iuf96r9b)xsXdSr4%S7lmdxcHKM$cC{hJNiWG?CMtyf2D|Hl-D6x@v;+H_8 zAo0Kl@KK1_tTDOC<-zMc<2iHY>{niN0d4Bo z?!*z;Z@Knq)tb0fg;d{K_N6;=%=!14K<3=-k1Wrhl3b1?*E?pj)-l_)2GjCZZ{W{7 zr`H@!d{01c4Xh7Vb!d(H)pmE_*d9soPLr!vcSo+*5O@)-Ut5=`TnHpyjeGP~Y|-^Q z|9#h)cC7A@h~668*6_lbx-t&Hgm>xA1P&uRF`bz|lm>T}B|c96$~^y%{O~;3r96_8 z==MT-qs9c;S*GuJY7PRWawW1P^^I#N3k8&R+xO1gGOoTk7QeVi?iGs$mq zc4pmdzFbc>+Z(`5#KwBAK=yp>Pi^OoE2p@-bRpGbPNdr$3NUg=A)Uhw { + public MachineRecipeResult(MachineRecipe recipe, I adjustedInput) { + this.recipe = recipe; + this.adjustedInput = adjustedInput; + } + + public MachineRecipe getRecipe() { + return recipe; + } + + public RO getOutput() { + return recipe.getOutput(); + } + + public I getAdjustedInput() { + return adjustedInput; + } + + private final MachineRecipe recipe; + private final I adjustedInput; +} diff --git a/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.class b/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.class deleted file mode 100644 index 01caff1710489c7d7b3c667ed22af238f43dfe70..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3400 zcmb_fTXR!Y6#jOT^d#XxA<#nUg*&84OKPpC6bq$LiMB;sS_D)$O-|bbxp{Je7VnDp z`+a=W8Rf+Xoq^O}@mnV;ZCYw@#)s^^&)#dV^{sEO{hgCv|NikB zfDU}2VK|75I1pVZ@J|^iN4+`;qslP-m7Bb_Z|90e8U!yYSRIo%3d!xgu- zj4F70vq@8-rk^1O3+XY_K4OfeI1}p6CXCdmVO#QCn)Eu8R$d{}ZzVcnM$U@aX2Qyu zu_3pMXL1F{Mb(?lI0il1gtx6Skhmbx(uR|mH0gfRf*mo-G1IX)n_8Tq_0 zb+8h+TL&>@PB4HywRN#qM)lYx30b)qPF;BwOyy=Pp?!hvo^m7$$?WcOi~Cs(&$-D3 zhOLQ=;S_9ETE`+DDmqi}JK15!wlWh6Yi9SSjLbx=ILn-Z!`XtJF#9a2=H?|Ubf+8v ztq+(v7PH})ymj?MyiZoz9JTTmi@zt6$vTE(WizC_u9&zRYi5iWbMg1+_!OT>^Eriyil(}C^kYCFe5cyMf}D$axO8b77VM7CJ6MX|((Ji) z?_N=b-U?=Sa%&V;%&{#*EA*WxzXXf5;!YgPbqtFjw*Oa@JPOK-n`mFwX5pvIq^KT| zRZ`SSz-L9Su?*9KTTXEmd2=H+@KP>e%LM(iI2E=mG+fM@TrO@XN|&k_fIWWYXEB zHST^J6pMdzDdODA>^5(=Y9p63Gt8{*Huy^RizSBV-xwxmb81k;Us9khez|SrPhm5v zuu8<0pLVN6U)fi4eh0#ATlmxi4{d-zB)ZD;`(;%9z=tYC*aqE&wfxjuhbW)xiiT)K z8=ttvbxa`>9WS{%MjH>;Y9g26i9|2K8)>`*-<;DByj)(-wt)^Bu>wu5^Nq!Ax186M zoYR$yyNUr~XfK7i&M@LO&m&U>C98%k|~(-M|(N_XX=c`-C;Vci74y#MmqLK0zZWiU%Mk zC5sYGFB+6$D0E>Dtz`2bj9$%t@+$OWm$AHm1}g?yuXTHNd278*U!$|N*4we$SMR%s zno{oHp!x#pqB6BIGL2O;2wlPIDjYrURTpml77eWt!lqF>gSxVH(!KV3#`4Z%sgnh= z3(d^2ohkKl94EE}{{RSXIoD>g_W&!+Cn!r9_;CvRY0aC-S;?+AbC4rpYa_fj5rR)c zpN0oD98%=s2AVX)|3c_b`g({~Rd|^8e2cObE=D*boJFr<9l59vt)E7NkUEXVP*ZU% xd2tkKW;2ZqlFod(d*{&|ErIp&aK-8{9$^nW%AXw05c_@n$={l8{`c97z&}D= amount;*/ - return false; - } - - @Override - public int getAmount() { - return amount; - } - - @Override - public List getInputs() { - List ret = new ArrayList(); - - /*for (FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (data.fluid.getFluid() != fluid) continue; - - ret.add(RecipeUtil.setImmutableSize(data.filledContainer, getAmount())); - }*/ - - ret.add(RecipeUtil.setImmutableSize(IC2Items.getItem("fluid_cell", fluid.getName()), getAmount())); - - return Collections.unmodifiableList(ret); - } - - @Override - public String toString() { - return "RInputFluidContainer<"+amount+"x"+fluid.getName()+">"; - } - - public final Fluid fluid; - public final int amount; -} diff --git a/src/api/java/ic2/api/recipe/RecipeInputItemStack.class b/src/api/java/ic2/api/recipe/RecipeInputItemStack.class deleted file mode 100644 index adccec38f86ed3f054b40f8808ace63b57ef6b08..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2418 zcma)7TUQ%Z6#j+;hJ>L&&2?xuj*y37a!~W6BFwuu9>)Qpj)|(R$$;*(UpN+SFUt?u^HGZkafGjr5p(7 z=B$ApQTJLdHH`v=IpwNg-oWwf)8FOR3?!GmiZn1#B>3f4eM9=IVxz{BOwn^hZB6(} z%kg0{xS^T`P8OAO))ozA`_fSjXFWMc~|! zH1^CWu2H+$+Srl~2}o6Cuo#n($mU3gJ_$V|RwkP(Zi!pMZUw4l7gaMLd8x9hx*}-# zjQZ?j3Ug2AaGn6YfmaTEZX3R8uhri>~VhB2b>oNJgVLLNj}BW-WY*;})in)5~WTKF1dZroxy*-9oJ< ztD?5(S6g-I1{c0|WJ5z5I8tzLiJGcR>gt+o>dKmIHl(wuWJQC0X+dDa!ZEyHVNzRh zaK=D(UukZ7epT9@FDuFk>=j?0=T3Ox-?mVJG_h%+iW>$d_Py&UX$!C5j0J@)6E`i? zP&eUP@X#m1wylG(if7C9q_N=VLrFEp^ zVWBOLtfG*yvigP@X5q20Odisb`MXGQ`w0t_`XZ_C4hG|2L*G955hwSAI~b;3 ze{|5li$mYTO#X~y;uiu&?q}#Y==15=Ot*dbrqVH3&R(Zqr#k25az z)8?*y@20i1#*gx#GX`c$V_K0yjL9z*UZs}KzM#39L51D6=42A;l;;q@JiWJb3!7Q)j@!f)enW}HXcc)rub a={6J7v55rU3XQytcen$y{MQlA0sjGyc1zy? diff --git a/src/api/java/ic2/api/recipe/RecipeInputItemStack.java b/src/api/java/ic2/api/recipe/RecipeInputItemStack.java deleted file mode 100644 index 459e6adf9..000000000 --- a/src/api/java/ic2/api/recipe/RecipeInputItemStack.java +++ /dev/null @@ -1,51 +0,0 @@ -package ic2.api.recipe; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.oredict.OreDictionary; - -/** - * @deprecated Use {@link Recipes#inputFactory} instead. - */ -@Deprecated -public class RecipeInputItemStack implements IRecipeInput { - public RecipeInputItemStack(ItemStack input) { - this(input, input.getCount()); - } - - public RecipeInputItemStack(ItemStack input, int amount) { - if (input.getItem() == null) throw new IllegalArgumentException("Invalid item stack specfied"); - - this.input = input.copy(); // Never forget to copy. - this.amount = amount; - } - - @Override - public boolean matches(ItemStack subject) { - return subject.getItem() == input.getItem() && // Item matching - (subject.getMetadata() == input.getMetadata() || input.getMetadata() == OreDictionary.WILDCARD_VALUE) && //meta matching - (input.getMetadata() == OreDictionary.WILDCARD_VALUE || RecipeUtil.matchesNBT(subject.getTagCompound(), input.getTagCompound())); //nbt matching. - } - - @Override - public int getAmount() { - return amount; - } - - @Override - public List getInputs() { - return Collections.unmodifiableList(Arrays.asList(RecipeUtil.setImmutableSize(input, getAmount()))); - } - - @Override - public String toString() { - return "RInputItemStack<"+RecipeUtil.setImmutableSize(input, amount)+">"; - } - - public final ItemStack input; - public final int amount; -} diff --git a/src/api/java/ic2/api/recipe/RecipeInputOreDict.class b/src/api/java/ic2/api/recipe/RecipeInputOreDict.class deleted file mode 100644 index 70503957939fdf454883af8811f1a081b8a6b5e4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3722 zcma)9`*Rc575>&*X(f4iSbl(FL&2fMmf|S5EhV-w5Ce^gY^V)RNguGti@YGMl+}tt zQkt~sBW?Pi?HaeP&t z&x`M`C9w%#PjLB$fo~dk!N9jPL>;$U_cf&Q7pzNGu4K8z+_djGZgE&c%qmyvE^oDQ z4SL!3Ee-7}1jk+9F4`U?^@?ZLG;9to>%LRU<(-<(o5ZwJbS=N`*%}^Rb3KxGZ9i9b zT)W^|=lz`H+vVIimucTBTpS*i5Jnu=@kcdu_N{OnM%X_?&tsKYn%o z&XstQ%2x_jX~yy#c@GbDf6if?_vf9$V9u&KInORQRXaDO9^-<=anC;N6eRSnySN+| zpZ#~cSP|YbE+T7`Ex#});Oy+Xce?#gQkpml02Wq3CPMy#rW z+rYOK)5->3H1HjAp=kSuLP|yY`bjD|QK&PHRA2uZelXQ&O{k!uW6r9ba%*+Rmueny zNm0Qx;@M1P@B^Cv2eaaSC7=3ZR{>f>&5YaI)u z_l8jJuvNB-xFjjs!Xni-5VV$HH` zR?Yb^3(2yx3HDf}RN@E=T4{6LEmvlp^J>Zm73&ShbMrHFm%$RVs#V*i!-2aD^H6@p zI0#A0Fnb8kiuMg=Nb`D?x#jrpA-`*V_s#e@T8>PdIC=U^eth~Qzd!jxrJO5PD#enW zXHd03B^IPxvdPO-71(a;oszB8^3vht+-$;@l77V_ZMZ zlLLrQ0x&XJeG%GUl+Y)*Ce?8YF|=bZ-@5`ad=mTkMg`@L?Mq{igvO3Bj0o@InQV`? zh?ce1x~R29S=$lFHLS%$Yt&WYw$KaESwtk0y$L)vNSuOl00f>>U{T zJoLzDb^-Arooixm^ugOmY8Z;8W4F<&ai&hn&eZS^Y#1`qhKR<~@pllLU;59sm(VIl ziFqW&;sQ4AO{Dd7{B?A6MmrPN(b}14dv@tnMD;i3m;M}ig8}G}q71_1x|50a^7rEX z{PDL7+sS|tGGL4;JtXkkA_3Gi9!9Uw;%)EmJ;9Aa6R zVgsD3c$8=SI@87&xzj>l7jYOz2+mg6I7%xz{hq<6XeElrsBJdn_fUSEC;O1NgUtqx z9n_YHtzqDC19`q{1}6A73A~40>S&_%sCEZiwEseTm)e?qkAeay=4!MSB~noVqD27_ z<24wtBqy#Z5QeYe)0m1mxcdK;V4`kUCC zSwP!$#P$92Qm}vbyo_k}##>08rh#@1i|CjPObtFhvi50MP+_V7-M zxEt~Ju`wvxb?bZOEnkJliC*S34V8KJC_A~gh1b0ZbzWQzS-H(p__;z#zsEDAPk0)!;=c6fFOks z5J`(oF0|$^F0K;m^L)w}>}6oRZ*ze0af6F~i~pO*{uR4klc9DKz1e2%QbZhV0uu%D z+r|zQmAhb4_J-~{SYg3hYqUvlB3Mf(3AC7Z&`vBHAVwIs5dE|4Tlx2S{t4l~0Q?W9 C$4rm_ diff --git a/src/api/java/ic2/api/recipe/RecipeInputOreDict.java b/src/api/java/ic2/api/recipe/RecipeInputOreDict.java deleted file mode 100644 index b2e26ee1e..000000000 --- a/src/api/java/ic2/api/recipe/RecipeInputOreDict.java +++ /dev/null @@ -1,110 +0,0 @@ -package ic2.api.recipe; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import net.minecraftforge.oredict.OreDictionary; - -/** - * @deprecated Use {@link Recipes#inputFactory} instead. - */ -@Deprecated -public class RecipeInputOreDict implements IRecipeInput { - public RecipeInputOreDict(String input) { - this(input, 1); - } - - public RecipeInputOreDict(String input, int amount) { - this(input, amount, null); - } - - public RecipeInputOreDict(String input, int amount, Integer meta) { - this.input = input; - this.amount = amount; - this.meta = meta; - } - - @Override - public boolean matches(ItemStack subject) { - List inputs = getOres(); - boolean useOreStackMeta = (meta == null); - Item subjectItem = subject.getItem(); - int subjectMeta = subject.getItemDamage(); - - for (ItemStack oreStack : inputs) { - Item oreItem = oreStack.getItem(); - if (oreItem == null) continue; // ignore invalid - - int metaRequired = useOreStackMeta ? oreStack.getItemDamage() : meta; - - if (subjectItem == oreItem && - (subjectMeta == metaRequired || metaRequired == OreDictionary.WILDCARD_VALUE)) { - return true; - } - } - - return false; - } - - @Override - public int getAmount() { - return amount; - } - - @Override - public List getInputs() { - List ores = getOres(); - - // check if we have to filter the list first - boolean hasUnsuitableEntries = false; - - for (ItemStack stack : ores) { - if (stack.getItem() == null || stack.getCount() != getAmount()) { - hasUnsuitableEntries = true; - break; - } - } - - if (!hasUnsuitableEntries) return ores; - - List ret = new ArrayList(ores.size()); - - for (ItemStack stack : ores) { - if (stack.getItem() != null) { // ignore invalid - ret.add(RecipeUtil.setImmutableSize(stack, getAmount())); - } - } - - return Collections.unmodifiableList(ret); - } - - @Override - public String toString() { - if (meta == null) { - return "RInputOreDict<"+amount+"x"+input+">"; - } else { - return "RInputOreDict<"+amount+"x"+input+"@"+meta+">"; - } - } - - private List getOres() { - if (ores != null) return ores; - - // cache the ore list by making use of the fact that forge always uses the same list, - // unless it's EMPTY_LIST, which should never happen. - List ret = OreDictionary.getOres(input); - - if (ret != OreDictionary.EMPTY_LIST) ores = ret; - - return ret; - } - - public final String input; - public final int amount; - public final Integer meta; - private List ores; -} diff --git a/src/api/java/ic2/api/recipe/RecipeOutput.class b/src/api/java/ic2/api/recipe/RecipeOutput.class index a2a19b3b1e48f991a41b45bf1420cb23daf47b72..0c83c13a14f4c169fc17c9d2e1e95bd0be28c7ea 100644 GIT binary patch delta 468 zcmYL`&r4KM6vsdJ&FG!EbEAwYFlQ<=vp|p$Y9j>wu(GkN$!Dhh@TpIII`hVyH&#=P zv=V|AaU+oafYvcP7wu~owDTWm8@LF9@IG9$_)t@w3l|6e_Y7%HGpsp9j~${Zn?H$j z?G;T()$}EMPppT+g6lh=j|A1B{S#VN^1v2r@32P-N5QW76$YE=>EF@iFVtImJ8+(qZxW>Qtx! z$&zGQkTBJv=JqxEl62~YSTT2LLqSam&6*;LtwpnH>OAG?YnpX7%&MofFvX@F*VGc% zY_Tm_(d@9R*<)W2Hs4Ozt2yA%e0XA!BaSskoCrjvtp-gaO_Ed18M`kz-jtISu$ODX zWDq5jGJ@t-UVC%!6EYFsS9LCuJnP7(*}6K3kf4AW3hl-y7dGmR&3sQO55#z+!o>Zb QqRIqR!Y^pC4|iz&1MKHMrvLx| diff --git a/src/api/java/ic2/api/recipe/RecipeOutput.java b/src/api/java/ic2/api/recipe/RecipeOutput.java index 80ad5fb5c..0f2fe1cba 100644 --- a/src/api/java/ic2/api/recipe/RecipeOutput.java +++ b/src/api/java/ic2/api/recipe/RecipeOutput.java @@ -7,6 +7,7 @@ import java.util.List; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +@Deprecated public final class RecipeOutput { public RecipeOutput(NBTTagCompound metadata1, List items1) { assert !items1.contains(null); diff --git a/src/api/java/ic2/api/recipe/RecipeOutputFluid.class b/src/api/java/ic2/api/recipe/RecipeOutputFluid.class deleted file mode 100644 index ef597f4dd7b051f60e1d38b0fe8bcd4035dfa22a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2632 zcmb7G-E$LF96dMLX4CCLOZqKf0SlyQVU;hD)=FEbR6^0VpnxdbWZP~@cf;-mff$7Od`!wF1kj83X}U(WeJ!xW}vG}DArI4vI^s`yAl3(lxG zt09H)B+kkA$MSJLiBFRFRE8Hcn3z?O6Hwh!P%H($KudPfylfh!z%CeB+Ybf>8mH}f z#|%oIC2;Vm;i0T!1;&!?SUJy}3+7yJ-ZJJ2B|GmM}f(4t*Y|GlYJ%(Ad4bRHi zMa!59UnfK6!o3o7M}2{-#Y&NNArU9cVpx>wsmQC~lIQ>b9@b2{+-r6X_0QGQ_#zc$ zxt(jAOO>okC9^={+S8E+1=E=~PR=e`xnQtQ%IHgPj0o&l+wzr+QGvJ}Ft4pf+lj#P z%)s@i0S7rH=D7^r*+r>p=;_+^1%{rJyk=rm%+b(+I~{noGfyPxzM3_nUTOKET%l~$ zcv`ZjO}iy8XN}v^Y#q-SXt%_vqZea3w&6AUL&rS!33OFAFj6@bM?KH=bZo&^9h_=xA3SJ{;?eR|=xzj}90>Mr>Qr8RLCMEf{%&pL z4_zD^q+ucODqAu1uuT^OEnU*}>}%i{UCgl^Y<|i0FnXMKsnBo$xEZBxLd$&X-(T5CMEFMA-VI;xD z(9c*W5IMGqAY&L{oPv15W?aQC6}wd!?2ESXI=&$2H<%$oXIWo@)-wGAzaV)JjS^QZ z#HH~KbfOVmHCVJ&EZQm-jZ5v}Y#|S6R9O_*R+)dR{|{)(_`3fgv=f=1q25Q6z(6JV z4xh6#@h3EPB_5$iwjN<2YMHVn!xiYun2yrd2~0-$j1DQg?qj_m$9ub#a@5DJW`T!j zIn*FK%W+K&U2@&@zYWRzg;I1b`15_|!JIK)Wd*q4kmA+@(w zsl0_DyiMYym>nF8GKW_)hnXp5?L^{l7!-BmKWJ0&4*&MY{$iq#msG?&|I?C60OQ>N^>WpIY(2?q5yn^oUIX6-~5$5d+Hx+p*U51#%D8|b5rNZ*FA*HS0 fm77qN+fd>^Ay&0cRA_yOxdAc#utazyT<7S2vq5|I diff --git a/src/api/java/ic2/api/recipe/RecipeOutputFluid.java b/src/api/java/ic2/api/recipe/RecipeOutputFluid.java deleted file mode 100644 index 750492245..000000000 --- a/src/api/java/ic2/api/recipe/RecipeOutputFluid.java +++ /dev/null @@ -1,57 +0,0 @@ -package ic2.api.recipe; - -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import net.minecraft.nbt.NBTTagCompound; - -import net.minecraftforge.fluids.FluidStack; - -/** - * @author estebes - */ -public class RecipeOutputFluid { - public RecipeOutputFluid(NBTTagCompound metadata, List outputs) { - assert !outputs.contains(null); - - this.metadata = metadata; - this.outputs = outputs; - } - - public RecipeOutputFluid(NBTTagCompound metadata, FluidStack... outputs) { - this(metadata, Arrays.asList(outputs)); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof RecipeOutputFluid) { - RecipeOutputFluid ro = (RecipeOutputFluid) obj; - - if (outputs.size() == ro.outputs.size() && - (metadata == null && ro.metadata == null || metadata != null && ro.metadata != null && metadata.equals(ro.metadata))) { - Iterator itA = outputs.iterator(); - Iterator itB = ro.outputs.iterator(); - - while (itA.hasNext() && itB.hasNext()) { - FluidStack stackA = itA.next(); - FluidStack stackB = itB.next(); - - if (stackA.isFluidStackIdentical(stackB)) return false; - } - - return true; - } - } - - return false; - } - - @Override - public String toString() { - return "ROutput<"+outputs+","+metadata+">"; - } - - public final List outputs; - public final NBTTagCompound metadata; -} diff --git a/src/api/java/ic2/api/recipe/RecipeUtil.class b/src/api/java/ic2/api/recipe/RecipeUtil.class deleted file mode 100644 index eaf0c311cb3c8e7963f14f17c3e716ab538593a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1695 zcmah}U31%15IxtDtXPqo)Fc7pHiYtJ%WXtUfs&M_O`yfZaiLBF1j3A>ToSdmY-E|C z{FCs~$G+qNX247thT)0M@Q+~lI#+h5b!w<*ymz&C_w3mZ>9@as{29O*d}?75^BK5! z*`hdY(e{cGXUFj>UK_{jIH$xLCKi-=QHk>w-oyo^Eh+7yiAyGy1=8n(Fo-V*XvNZo zfWFe&kpdIdAe6Okb6ZC1-gbkQT(#wUjSVjf)bqfo$9q9Xpim9`Gp^ST+(`OCTe{bh z<9Zx476m3dGOje6-B<Yx-!00GP zf!W77>YXH`s0d^e@HMYJU~e_O*x!?#+VZ- z_b^G0v`@gq3Kzh{TTE1Mbt7M14%8$k9!zImC9`o9ITLT&xQydAuHYRL6&vqj)kYO- zCTcdW;yuFIcwZT>q0Xru=4oRc*KKUz1E#d`AwIIPiH~i3f-Qmke{RSS)YYUPY(s+H z84Da`jt7;{#9?NK3<6{1Iw){v$o+odY5`Oh`6UtcFgd2~dnSw0 z?;8Em%uOx=Zt>AQI$Z8U{ZpY#LD~Y-qe5AiLF~#-QYAkdWBp9ZFfu@WS>)$kufe_y zISja#HZg|@e#g{LOgJS{4C zi{2@oQ_got6>cNz^q{Reh3}DazM)-9uyW9oxG`ABVw|auB)BvESUima?}>tAI8NkQ z>Ka6jsh%P4B$d! l)-QV&)`WJEc?U#+M8N|fdLARGQbwE%g9NcegI4;#`Olm^|5@!t-><>++24~>067$r=z*I+ zK7o(>>8$~0LsfmDTY+Twx&LLlmM{BK^M>-J7l=*Gm6i=&BH7Tw+j8%7TW}eihVWz{ z^mh20r5~?~9pzPoSEIPk(o;=Y5x%I(z&$)aV606Geae@Wm*b+Tcwjns>8i8jH(S~* ze-mxN>%y<{lCR~zSMOf2;2zZ?d#sa^ji&xythdzHwQXMu+8|)ab%m{Wx82^9VQ5p; z>;F%h>zY)&*_ASZwvdVa)nm}kg@g=i++jgEK5;UJ0_{W}M7B*4&1=Lk6mN%Wa| zzvY1CpydP0hn9~lhb&W;!imc%?%V|6}{sm?X zUt-qq6JC28O+%kEGCL(`*69W78Io>Czhn9FfvF6mFAUX z=B9>a7H1~qq&nv1<(DLuWaj4;Gct(zWF?j*>gOcprRyW~STizk<|Zbm7A2PC7j5=r zoX5C1fw_-yauaJcvo3?)BsSA}DF#jk76w+J?VJp34D1X{3>-iC@ln~g`u~Dc6HcmS<1^+n~sx1g4dtv~?mjXQmB=v!!`aqfyNV95fXJFh2WH2!p07;N{7#L(2 W41pvML;*0!jTyKZfE*LBGE)FI@-o2y diff --git a/src/api/java/ic2/api/recipe/Recipes.java b/src/api/java/ic2/api/recipe/Recipes.java index 214148129..c6cc0d753 100644 --- a/src/api/java/ic2/api/recipe/Recipes.java +++ b/src/api/java/ic2/api/recipe/Recipes.java @@ -1,5 +1,7 @@ package ic2.api.recipe; +import net.minecraft.item.ItemStack; + /** * General recipe registry. * @@ -34,33 +36,33 @@ public class Recipes { /** * Recipe manager for furnace recipes. * - *

    No recipe meta. - * - * @deprecated currently unused/not implemented, uses the vanilla furnace recipe list + *

    Recipe meta: + *

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

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

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

    No recipe meta. */ - public static IMachineRecipeManager compressor; + public static IBasicMachineRecipeManager compressor; /** * Recipe manager for thermal centrifuge recipes. @@ -70,7 +72,7 @@ public class Recipes { *

  • int minHeat: minimum heat level required * */ - public static IMachineRecipeManager centrifuge; + public static IBasicMachineRecipeManager centrifuge; /** * Recipe manager for blast cutter recipes. @@ -80,7 +82,7 @@ public class Recipes { *
  • int hardness: minimum blade hardness (3=iron, 6=steel, 9=diamond) * */ - public static IMachineRecipeManager blockcutter; + public static IBasicMachineRecipeManager blockcutter; /** * Recipe manager for blast furnace recipes. @@ -91,7 +93,7 @@ public class Recipes { *
  • int duration: process duration (in ticks) * */ - public static IMachineRecipeManager blastfurnace; + public static IBasicMachineRecipeManager blastfurnace; /** * Recipe manager for recycler recipes. @@ -101,28 +103,28 @@ public class Recipes { * @note the implementation is currently immutable, any non-blacklisted item will be accepted, * chance checking is up to the caller. */ - public static IMachineRecipeManager recycler; + public static IBasicMachineRecipeManager recycler; /** * Recipe manager for metal former extrusion mode recipes. * *

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

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

    No recipe meta. */ - public static IMachineRecipeManager metalformerRolling; + public static IBasicMachineRecipeManager metalformerRolling; /** * Recipe manager for ore washing plant recipes. @@ -132,7 +134,7 @@ public class Recipes { *

  • int amount: input fluid amount per cycle (in mB) * */ - public static IMachineRecipeManager oreWashing; + public static IBasicMachineRecipeManager oreWashing; public static ICannerBottleRecipeManager cannerBottle; public static ICannerEnrichRecipeManager cannerEnrich; public static IElectrolyzerRecipeManager electrolyzer; @@ -141,10 +143,7 @@ public class Recipes { /** * Recipe manager for uu mass fabricator (matter gen) recipes. * - *

    Recipe meta: - *

      - *
    • int amplification: amount of eu to be amplified per item (fixed +5x) - *
    + *

    No recipe meta. * *

    Reference values: *

      @@ -152,7 +151,8 @@ public class Recipes { *
    • 45000: Scrapbox *
    */ - public static IMachineRecipeManager matterAmplifier; + public static IMachineRecipeManager matterAmplifier; + /** * Reference scrap box chance values: * @@ -184,4 +184,7 @@ public class Recipes { * Opposite of {@link #liquidCooldownManager}. This is for Liquids that can be heated up again. */ public static ILiquidHeatExchangerManager liquidHeatupManager; + + public static IEmptyFluidContainerRecipeManager emptyFluidContainer; + public static IFillFluidContainerRecipeManager fillFluidContainer; } diff --git a/src/api/java/ic2/api/tile/RotorRegistry.class b/src/api/java/ic2/api/tile/RotorRegistry.class index 329ff28ad21e0ac1e2d8ca771400b643e0ec7558..45357043aabf14614d4690e75a53699676ef5751 100644 GIT binary patch delta 282 zcmXAjy-LGS0ENGsCcP$2EGbeogVevObf~R=^Y?c3RLMicr4nuR5A=xby#BguU2eUS<6sk-C=`G z$<`3t4mLZIUCEwg|1qi3VGF^9xIB;pulpMOWIFf`e$FwCKmlL|Gm#Ukmf z{=y69GgiCwPHuqm)1_Jg$s_?&%;?NhWK@g!f1O!!nxtNf%poXfvN68(r<-);7Zr3a AnE(I) delta 242 zcmXAjyG{Z@07cKt?lQ2x)r`O$hz(Lxs{a4&2-n98nSTMs>v$ct0i!$5P*kO-4CF>RcZ5k9TDXQ$+ PPgo0^D!(b4r&RO{&c!6! diff --git a/src/api/java/ic2/api/tile/RotorRegistry.java b/src/api/java/ic2/api/tile/RotorRegistry.java index dd652f2cc..132f0f9f5 100644 --- a/src/api/java/ic2/api/tile/RotorRegistry.java +++ b/src/api/java/ic2/api/tile/RotorRegistry.java @@ -8,6 +8,8 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.relauncher.SideOnly; +import ic2.api.info.Info; + /** * Helper class for registering {@link IRotorProvider}s to provide the default windmill renderer */ @@ -28,7 +30,7 @@ public class RotorRegistry { */ public static void setInstance(IRotorRegistry i) { ModContainer mc = Loader.instance().activeModContainer(); - if (mc == null || !"IC2".equals(mc.getModId())) { + if (mc == null || !Info.MOD_ID.equals(mc.getModId())) { throw new IllegalAccessError("Only IC2 can set the instance"); } else { INSTANCE = i; diff --git a/src/api/java/ic2/api/upgrade/IAugmentationUpgrade.class b/src/api/java/ic2/api/upgrade/IAugmentationUpgrade.class new file mode 100644 index 0000000000000000000000000000000000000000..98e28e1f5a68d7f04793b1f3e9f3f34408225f4c GIT binary patch literal 269 zcmZvXy$ZrW5QJy_i$8_7f~AEv9@tu`AOr*p@c}mH8cvgogo_Vn;RE{mE_gZKb*$H8Gu_#5&+LvM@KdJF5 zYm=u|DBI_&g|}0~wKq-eB0q}BAHEh|2DuJZVoY+vxK-a3zH5T|I(UiyVsS$l7F83i z-1?AGkMmz{-;v~U#V<@a-;4YgnQ+q5P2kd*`{hck63+Hcf27-o^a+Gcs)O|1PM6R{ P4@k3*EFpx$7RTTdjRXoYKq`=ls0l(%j6v z^w5IzqQsO`y{yEtL`DX+%w!||#DYxyQi!lVcGZjw0wDGJIf;4c`u<5-smUdb3^Evc ep=NuQq~@|QGB7eQ0WmYsc?>|B1xPY6umS*#05MXoYKscfTH}A(&Ws% z^w5IzqQsO`y{yEtL`DX+%w!||#DYxyQi!lVcGZjw0wDGJIf;4c`u<5-smUdb3^Evc ep=NuQq~@|QGB7eQ0WmYsc?>|B1xPY6umS*uq%lwc literal 0 HcmV?d00001 diff --git a/src/api/java/ic2/api/upgrade/IFluidProducingUpgrade.java b/src/api/java/ic2/api/upgrade/IFluidProducingUpgrade.java new file mode 100644 index 000000000..f310a90f5 --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IFluidProducingUpgrade.java @@ -0,0 +1,10 @@ +package ic2.api.upgrade; + +/** + * An interface to mark an item as an {@link UpgradableProperty#FluidProducing} type upgrade + * + * @author Player, Chocohead + */ +public interface IFluidProducingUpgrade extends IUpgradeItem { + +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/IFullUpgrade.class b/src/api/java/ic2/api/upgrade/IFullUpgrade.class new file mode 100644 index 0000000000000000000000000000000000000000..2e3ed4f982f58e785e8bff8d9457249d89606431 GIT binary patch literal 526 zcmajc+e!m55C-5sRXbWwt!Ke2PvDIUeFG5-y;59#fVew`l-;D{Q1I2f@Bw@%amAtw z5xfZ``SQ;UdH;BQ12DuPVS}(q=o1EnEy6Zohpe5|!m|G_(F%UHBwT6r9}P6PjTY2Ib%7 literal 0 HcmV?d00001 diff --git a/src/api/java/ic2/api/upgrade/IFullUpgrade.java b/src/api/java/ic2/api/upgrade/IFullUpgrade.java new file mode 100644 index 000000000..207786220 --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IFullUpgrade.java @@ -0,0 +1,12 @@ +package ic2.api.upgrade; + +/** + * An interface to mark an item supporting all {@link UpgradableProperty} type upgrades + * + * @author Player, Chocohead + */ +public interface IFullUpgrade extends IAugmentationUpgrade, IEnergyStorageUpgrade, IFluidConsumingUpgrade, + IFluidProducingUpgrade, IItemConsumingUpgrade, IItemProducingUpgrade, IProcessingUpgrade, + IRedstoneSensitiveUpgrade, ITransformerUpgrade { + +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.class b/src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.class new file mode 100644 index 0000000000000000000000000000000000000000..b571d1daba1730040ac0f75d65cf3ce709741960 GIT binary patch literal 175 zcmX^0Z`VEs1_mPrPId-1b_RBK1`b9BuHgLAqU2P!%$!t41}RU^lGI%1{Ji4Q+|0c6 z(1P@$#FSLMti-ZJMh4Z)WF!5=f=vBVh_F6Z#f%IBAm#cwiFxVz{z+M>$t8>oG8kH+ bMuV(lV`N}tU;<)hpyL>TGz*YqVqgUT4g4^a literal 0 HcmV?d00001 diff --git a/src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.java b/src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.java new file mode 100644 index 000000000..0a7216bc9 --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.java @@ -0,0 +1,10 @@ +package ic2.api.upgrade; + +/** + * An interface to mark an item as an {@link UpgradableProperty#ItemConsuming} type upgrade + * + * @author Player, Chocohead + */ +public interface IItemConsumingUpgrade extends IUpgradeItem { + +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/IItemProducingUpgrade.class b/src/api/java/ic2/api/upgrade/IItemProducingUpgrade.class new file mode 100644 index 0000000000000000000000000000000000000000..e28bf01b6af49488eef15f6db8f8e464dcb2c20b GIT binary patch literal 175 zcmX^0Z`VEs1_mPrPId-1b_RBK1`b9BuHgLAqU2P!%$!t41}RU^lGNOQqWqN7$t8>oG8kH+ bMuV(lV`N}tU;<)hpyL>TGz*YqVqgUT2dFTF literal 0 HcmV?d00001 diff --git a/src/api/java/ic2/api/upgrade/IItemProducingUpgrade.java b/src/api/java/ic2/api/upgrade/IItemProducingUpgrade.java new file mode 100644 index 000000000..85a3b9929 --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IItemProducingUpgrade.java @@ -0,0 +1,10 @@ +package ic2.api.upgrade; + +/** + * An interface to mark an item as an {@link UpgradableProperty#ItemProducing} type upgrade + * + * @author Player, Chocohead + */ +public interface IItemProducingUpgrade extends IUpgradeItem { + +} diff --git a/src/api/java/ic2/api/upgrade/IProcessingUpgrade.class b/src/api/java/ic2/api/upgrade/IProcessingUpgrade.class new file mode 100644 index 0000000000000000000000000000000000000000..38402e8903dda4341d98f9631b96596ee5474c21 GIT binary patch literal 441 zcmb_ZO-lnY5PehEuGUXbP{ETYy%^}#o3_G2MWOlw(sT@|+3b>LMgN)ye}F$q%+?ha z_Ua*%nc>Zwc{5+%AD;k**h{gUVkgBe;Xrd3zXdNJe4%)`d^9-|Zq6r;gUF3z<>hk_ zCU7pYXr@7`m#c|ULm^8es#1G7XOTUv967UmZHtJw$Oy-gyG46f*8tu%EW`Fqj1Te)-gi(a+2xG!sQKqsHZkC)jzI3cz)q2A0Vd2=TLLA%LY`hZB zh0>uV-q`o2h1jVwm8iDLYLl|kZ^y-~bAHata1pNvw;B6C!t;L%>sS*;N!iwxUnFP3 zz5acYuxrH2j=$aTLjRHP@)!~by-*h+++Ls1 Q#{dX(h$tY0%MQoY7yqwy5&!@I literal 0 HcmV?d00001 diff --git a/src/api/java/ic2/api/upgrade/IRedstoneSensitiveUpgrade.java b/src/api/java/ic2/api/upgrade/IRedstoneSensitiveUpgrade.java new file mode 100644 index 000000000..7c06a5afe --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IRedstoneSensitiveUpgrade.java @@ -0,0 +1,31 @@ +package ic2.api.upgrade; + +import net.minecraft.item.ItemStack; + +/** + * An interface to mark an item as an {@link UpgradableProperty#RedstoneSensitive} type upgrade + * + * @author Player, Chocohead + */ +public interface IRedstoneSensitiveUpgrade extends IUpgradeItem { + /** + * Whether the upgrade modifies the given {@link IUpgradableBlock}'s redstone input + * + * @param stack The upgrade stack + * @param parent The block being modified + * + * @return Whether the redstone input should be changed (and thus {@link #getRedstoneInput(ItemStack, IUpgradableBlock, int)} be called) + */ + boolean modifiesRedstoneInput(ItemStack stack, IUpgradableBlock parent); + + /** + * Change the redstone input given the {@link IUpgradableBlock}'s initial input value + * + * @param stack The upgrade stack + * @param parent The block receiving the redstone signal + * @param externalInput The initial redstone signal + * + * @return The new redstone signal + */ + int getRedstoneInput(ItemStack stack, IUpgradableBlock parent, int externalInput); +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/ITransformerUpgrade.class b/src/api/java/ic2/api/upgrade/ITransformerUpgrade.class new file mode 100644 index 0000000000000000000000000000000000000000..2d52de1f97cde12d3e46b83f708c85e94ad8baab GIT binary patch literal 264 zcmZXPy$%6E6ot?AxBd#HLZ_iIiB?BQHjyas0N1!S!~Vz^;@K1)z(a{ybX%O0Q+)U2 z+}Hc@1TaP`Ks`VsK$Fmp#Le%{^2UfI%m&L;oJve8+Va6E<0Mg`x3yz^nk}X*%SI%zLZYf@n0v&mia5;QbI3{@%l}# z9Y6cJVIM5-2*fg4c0H#nqn_3qF2jI8=*bs=ej-OB0i+&b(AE^k O;t$2`VI*qYs*@kAD^fZD literal 0 HcmV?d00001 diff --git a/src/api/java/ic2/api/upgrade/IUpgradableBlock.java b/src/api/java/ic2/api/upgrade/IUpgradableBlock.java new file mode 100644 index 000000000..766761873 --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IUpgradableBlock.java @@ -0,0 +1,29 @@ +package ic2.api.upgrade; + +import java.util.Set; + +/** + * An interface to mark a block as supporting {@link IUpgradeItem}s + * + * @author Player + */ +public interface IUpgradableBlock { + /** + * @return The energy the block current has + */ + double getEnergy(); + + /** + * Attempt to use the given amount of energy + * + * @param amount The amount of energy to be used + * + * @return Whether the energy was successfully used + */ + boolean useEnergy(double amount); + + /** + * @return The set of {@link UpgradableProperty}s that the block supports + */ + Set getUpgradableProperties(); +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/IUpgradeItem.class b/src/api/java/ic2/api/upgrade/IUpgradeItem.class new file mode 100644 index 0000000000000000000000000000000000000000..6432181d32e088353200c874ce5231e2079a2dcf GIT binary patch literal 713 zcmcIi!Ab)$5Pj3ut*x!ryB}aLMta@i!D6AXps?z}TbjltZJLy9R`93%01tkEA0=iN zQITp9@si05GxKKNyyut4CjbNVn%He(kI+?lS}4z_T8^zF93Lh|dbU(X3de6fQ(i9F zBs{6-Vi6~Ee#cqim1e2*asP(UN>ygKFPtP?|EheLC^2AsrC71b9G^*cRoQZy3ujl- z`TO{!0*S1-RANCGZ9@3ka`MshRNJsZIdjLF03c+ZpP3oK{JH5TUPe}HDZH{K?ynCM z9{vY#`1A1sm1_suSVm~4ws1m@l@3?lf8$h^x;QEoK{)t^_bP|bt8}Be$=LaH9_Wb( jgjx_IP;U_GXas*Ncr`@9Z( literal 0 HcmV?d00001 diff --git a/src/api/java/ic2/api/upgrade/IUpgradeItem.java b/src/api/java/ic2/api/upgrade/IUpgradeItem.java new file mode 100644 index 000000000..09e16a30b --- /dev/null +++ b/src/api/java/ic2/api/upgrade/IUpgradeItem.java @@ -0,0 +1,44 @@ +package ic2.api.upgrade; + +import java.util.Collection; +import java.util.Set; + +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +/** + * An interface to mark an item as an upgrade for {@link IUpgradableBlock}s + * + * @author Player, Chocohead + */ +public interface IUpgradeItem { + /** + * Checks if the upgrade is valid for the given {@link UpgradableProperty} types + * + * @param stack The upgrade stack being checked + * @param types The list of types being tested + * + * @return Whether the upgrade is valid + */ + boolean isSuitableFor(ItemStack stack, Set types); + + /** + * Called every time the given {@link IUpgradableBlock} ticks + * + * @param stack The upgrade stack being ticked + * @param parent The parent block being ticked + * + * @return Whether to call {@link TileEntity#markDirty()} due to a stack changing + */ + boolean onTick(ItemStack stack, IUpgradableBlock parent); + + /** + * Called when the given {@link IUpgradableBlock} finishes processing + * + * @param stack The upgrade stack + * @param parent The parent finishing processing + * @param output The list of output products from the process, read only! + * @return final output + */ + Collection onProcessEnd(ItemStack stack, IUpgradableBlock parent, Collection output); +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/UpgradableProperty.class b/src/api/java/ic2/api/upgrade/UpgradableProperty.class new file mode 100644 index 0000000000000000000000000000000000000000..7f514987861f5cf7c04df7bea38590545f715420 GIT binary patch literal 1472 zcma)6YflqF6g|@}-R-i4Qr<6lLkmg;0ns8-u_)Srae<`KFH5`BCGD2%gUG+ql8C`* z`0Nkzqw&tPkrGVoHo2$g&Y3%B?#%Ab-s;|v!7#@S1$Q{66^w9vreKugrh+k!&lQYw%qW=PxTRo{;|m!t8PqpUC2zW}WfvJH zvsQjFX`EO||D@;`1v9xX&^Roaq&qPk?<~d8n)Zuj)Ao3pq2sMtaJ`Cc>Za{lo^?vO z);-6t-J^Rof5L#IZ`H(iFAc%sQE(q^SVZrih#ZSMHxL(|!-?N}DIc8?fVLyO`8HhwP^k%^8YiD|w@IU^o^pTCXhGMwyn3-LA?ITC;4+TW9F`$D-Sb0|v?a zV9^f4x>d9d&v&R&FwO^*wS1{Qd8MIr#`eo=&A45sLs#{R@8r!bi=TP#?RzoL8=+x} z-`Hsl+jzw={{QQwVGge~+{c23K@4da=HU(xBRq`qFvi0;4--60Vu+#by77D;3@!N* zT|$Pgc%osCyNAbS-Xs6Zja}O;8LpdZko`Ton^jXA3-qQ8&}*q~^mBgzAz2hiE(MZN zf#g*n*%e5R1(Iojj%-a*nVdsw7COAXQvm)N@fv zbrVpomw=M}`Z*Zid9Bg2Q0c#h2%>c8U35Hsw9g@==^F0PwR=y;bxcR_kvb5lcVh() JX-)vEe*ll{Kp6l4 literal 0 HcmV?d00001 diff --git a/src/api/java/ic2/api/upgrade/UpgradableProperty.java b/src/api/java/ic2/api/upgrade/UpgradableProperty.java new file mode 100644 index 000000000..17c575cf6 --- /dev/null +++ b/src/api/java/ic2/api/upgrade/UpgradableProperty.java @@ -0,0 +1,45 @@ +package ic2.api.upgrade; + +/** + * The possible properties an {@link IUpgradableBlock} can support + * + * @author Player + */ +public enum UpgradableProperty { + /** + * A block that processes something, taking upgrade process time + energy demand into account + */ + Processing, + /** + * A simple count based upgrade property, e.g. extra range + */ + Augmentable, + /** + * A block that is sensitive to redstone state/changes + */ + RedstoneSensitive, + /** + * A block that can have it's tier changed + */ + Transformer, + /** + * A block that can have the amount of energy it stores changed + */ + EnergyStorage, + /** + * A block that consumes items + */ + ItemConsuming, + /** + * A block that produces items + */ + ItemProducing, + /** + * A block that consumes fluids + */ + FluidConsuming, + /** + * A block that produces fluids + */ + FluidProducing, +} \ No newline at end of file diff --git a/src/api/java/ic2/api/upgrade/UpgradeRegistry.class b/src/api/java/ic2/api/upgrade/UpgradeRegistry.class new file mode 100644 index 0000000000000000000000000000000000000000..9059b9d15d16a72b7c0b5ad7f59feda4213d3e83 GIT binary patch literal 1308 zcma)5TTc@~6#k|yY`bj{q2L9C<)&@bE~4V4m4pyYNUA0lG3e8<9hSxIwwdl4`78bk zFNvrm8ejcU#xuKX+BAyp!_3aPe&;*q{P_9hD}WW;(~-xbjwM{wa7jZkjgpQO${FNv zIg2Z}s-pr^!?F$?iyE$JSYb#99b59I=rWAf5BMu?2EOB(b*JlB88QvW_P8HN!LU4_ zuGKx^n=Qu^mgIZB>G+~$Zqm{4x%INTM()Ek$8-EOhGem{&5+t?H!0AmI{7>bTDwAS z@m-fBWA(Ph-EA%%^^S!pf8QZgb9KjBF?q)^W2ENO2=NnP6G(YTdD1fc7m{JEcrvWg z$!dn7u7b}n^Do1ESm#6DiScG_;m6Pj_GGaX@#S*QR7@0oA3i9}1WrUoJKTJ5H@7mjvM!%&IyhWpl2RO7iB6l0DSIZwOJ za9&YM_b9y*I89qlD}-@63nVe=W^@mgkHFrACKGfHhr$s|(tj>8z!{vSR|e-OWaRt; z$xvsMKO*rR$v4O!BegR&bcEq=@1d1HBb~sr@>}vtLd6}S8x*NPQD!jJ7vG@QH0dsc zwyZ#jW-v>L70TH#4WLobPspfv#37v#&iS}F18FM!cWDdctiJ3q^qnJQKR{Cj_B$@o KYo25YEc^n2I7om1 literal 0 HcmV?d00001 diff --git a/src/api/java/ic2/api/upgrade/UpgradeRegistry.java b/src/api/java/ic2/api/upgrade/UpgradeRegistry.java new file mode 100644 index 000000000..8f6bed650 --- /dev/null +++ b/src/api/java/ic2/api/upgrade/UpgradeRegistry.java @@ -0,0 +1,38 @@ +package ic2.api.upgrade; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import net.minecraft.item.ItemStack; + +/** + * The registry that contains all known {@link IUpgradeItem}s + * + * @author Player + */ +public class UpgradeRegistry { + /** + * Register an upgrade itemstack to the registry + * + * @param stack The upgrade to register + * + * @return The stack that has been registered + */ + public static ItemStack register(ItemStack stack) { + if (!(stack.getItem() instanceof IUpgradeItem)) throw new IllegalArgumentException("The stack must represent an IUpgradeItem."); + + upgrades.add(stack); + + return stack; + } + + /** + * @return An unmodifiable list of registered upgrades + */ + public static Iterable getUpgrades() { + return Collections.unmodifiableCollection(upgrades); + } + + private static final List upgrades = new ArrayList(); +} diff --git a/src/api/java/ic2/api/util/FluidContainerOutputMode.class b/src/api/java/ic2/api/util/FluidContainerOutputMode.class new file mode 100644 index 0000000000000000000000000000000000000000..43c42ccb66f4c1705e0f1f0281ce96f954c9508a GIT binary patch literal 1381 zcma)5T~8BH5Iwj1)h=sk3lu>RKS0`|R1g$wRS1DdQiY`0SbSQ_f=jkrvfU-&%^&20 z78Rq>@a&H=&b{40iJEjbxwCWU%$YfJ@BaGz?I(a)EXN?@zK$8pY8ck=Kt~dDe3|Ew zhf$<-vX8j45Jf+?i%|@4`#6d;w*?JFhU9Af&_7-a9A~Ss5%`CJ&oEiCYqNRt(9Q?G z?c~>-z}{VHxV~w-me&ToXzW@AhMr~j_#!W{?ru6}&D!*=JA*ZP^N#86=gYolyZeP~*KMUrjhg9HOwZ=LA-U|Db*hp2o0vf@+OF+CWf=TN-SzEk zg+cb;+9Whqw)b7r4?LohGa{0-o9(0Mn5dM=(oCbpniCS!29Ydw6km0Nda+AMPw9m9 zawG6+)|$;HHTu7+FwMtiV2IzvVFOP#nEsP3`)&uxYSjDCfgx!W9PuC`PBJ*=TKK1v)L?kz|K$iGAre!JM%)=dbYAO zL;p;Y{yueSi1!DOr51&yE`_B=36bJTfW$B#2>A+PxP}qX0Li;WmOpw6>> entry : Recipes.macerator.getRecipes()) { - if(!entry.input.getInputs().isEmpty()) + if(!entry.getInput().getInputs().isEmpty()) { - List names = MekanismUtils.getOreDictName(entry.input.getInputs().get(0)); + List names = MekanismUtils.getOreDictName(entry.getInput().getInputs().get(0)); for(String name : names) { @@ -88,7 +88,7 @@ public final class MekanismHooks if(name.startsWith("ingot")) { - RecipeHandler.addCrusherRecipe(entry.input.getInputs().get(0), entry.output.items.get(0)); + RecipeHandler.addCrusherRecipe(entry.getInput().getInputs().get(0), entry.getOutput().iterator().next()); did = true; } @@ -101,28 +101,22 @@ public final class MekanismHooks } try { - Recipes.macerator.addRecipe(new RecipeInputOreDict("oreOsmium"), null, false, new ItemStack(MekanismItems.Dust, 2, Resource.OSMIUM.ordinal())); + Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("oreOsmium"), null, false, new ItemStack(MekanismItems.Dust, 2, Resource.OSMIUM.ordinal())); } catch(Exception e) {} try { - Recipes.macerator.addRecipe(new RecipeInputOreDict("ingotOsmium"), null, false, new ItemStack(MekanismItems.Dust, 1, Resource.OSMIUM.ordinal())); - Recipes.macerator.addRecipe(new RecipeInputOreDict("ingotRefinedObsidian"), null, false, new ItemStack(MekanismItems.OtherDust, 1, 5)); - Recipes.macerator.addRecipe(new RecipeInputOreDict("ingotRefinedGlowstone"), null, false, new ItemStack(Items.GLOWSTONE_DUST)); - Recipes.macerator.addRecipe(new RecipeInputOreDict("ingotSteel"), null, false, new ItemStack(MekanismItems.OtherDust, 1, 1)); + Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("ingotOsmium"), null, false, new ItemStack(MekanismItems.Dust, 1, Resource.OSMIUM.ordinal())); + Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("ingotRefinedObsidian"), null, false, new ItemStack(MekanismItems.OtherDust, 1, 5)); + Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("ingotRefinedGlowstone"), null, false, new ItemStack(Items.GLOWSTONE_DUST)); + Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("ingotSteel"), null, false, new ItemStack(MekanismItems.OtherDust, 1, 1)); } catch(Exception e) {} try { for(Resource resource : Resource.values()) { - Recipes.macerator.addRecipe(new RecipeInputOreDict("clump" + resource.getName()), null, false, new ItemStack(MekanismItems.DirtyDust, 1, resource.ordinal())); + Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("clump" + resource.getName()), null, false, new ItemStack(MekanismItems.DirtyDust, 1, resource.ordinal())); } } catch(Exception e) {} - - NBTTagCompound tag = new NBTTagCompound(); - - tag.setInteger("amplification", 50000); - - Recipes.matterAmplifier.addRecipe(new RecipeInputItemStack(new ItemStack(MekanismItems.EnrichedAlloy), 1), tag, false); } @Method(modid = "ComputerCraft") diff --git a/src/main/java/mekanism/common/integration/OreDictManager.java b/src/main/java/mekanism/common/integration/OreDictManager.java index 690f5cde4..37ecf74de 100644 --- a/src/main/java/mekanism/common/integration/OreDictManager.java +++ b/src/main/java/mekanism/common/integration/OreDictManager.java @@ -1,6 +1,5 @@ package mekanism.common.integration; -import ic2.api.recipe.RecipeInputOreDict; import ic2.api.recipe.Recipes; import java.util.ArrayList; @@ -328,7 +327,7 @@ public final class OreDictManager public static void addIC2BronzeRecipe() { try { - Recipes.macerator.addRecipe(new RecipeInputOreDict("ingotBronze"), null, false, StackUtils.size(OreDictionary.getOres("dustBronze").get(0), 1)); + Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("ingotBronze"), null, false, StackUtils.size(OreDictionary.getOres("dustBronze").get(0), 1)); } catch(Exception e) {} }