| 52 | import static gregapi.data.CS.*; |
| 53 | |
| 54 | public class CompatIC2 extends CompatBase implements ICompatIC2 { |
| 55 | public CompatIC2() { |
| 56 | // Checking if everything is available. |
| 57 | valuable(Blocks.glowstone, 0, 1); |
| 58 | valuable(Blocks.soul_sand, 0, 1); |
| 59 | if (ic2.api.recipe.Recipes.scrapboxDrops == null) {/**/} |
| 60 | if (ic2.api.recipe.Recipes.recyclerBlacklist == null) {/**/} |
| 61 | if (ic2.api.recipe.Recipes.recyclerWhitelist == null) {/**/} |
| 62 | MinecraftForge.EVENT_BUS.register(this); |
| 63 | } |
| 64 | |
| 65 | @Override |
| 66 | public void onPostLoad(FMLPostInitializationEvent aEvent) { |
| 67 | for (Object tOre : BlocksGT.stoneToSmallOres .values()) valuable((Block)tOre, 2); |
| 68 | for (Object tOre : BlocksGT.stoneToNormalOres.values()) valuable((Block)tOre, 3); |
| 69 | for (Object tOre : BlocksGT.stoneToBrokenOres.values()) valuable((Block)tOre, 3); |
| 70 | |
| 71 | if (mToBlacklist != null) { |
| 72 | for (ItemStackContainer tStack : mToBlacklist) ic2.api.recipe.Recipes.recyclerBlacklist.add((IRecipeInput)makeInput(tStack.toStack())); |
| 73 | mToBlacklist.clear(); |
| 74 | mToBlacklist = null; |
| 75 | } |
| 76 | |
| 77 | if (MD.AA.mLoaded) Crops.instance.registerBaseSeed(ST.make(MD.AA, "itemCoffeeBeans", 1, W), Crops.instance.getCropCard("IC2", "Coffee"), 1, 1, 1, 1); |
| 78 | } |
| 79 | |
| 80 | @Override |
| 81 | public void onServerStarted(FMLServerStartedEvent aEvent) { |
| 82 | if (MD.AA.mLoaded) Ic2Items.coffeeBeans = ST.make(MD.AA, "itemCoffeeBeans", 1, 0); |
| 83 | } |
| 84 | |
| 85 | @SubscribeEvent |
| 86 | public void onRetextureEvent(RetextureEvent aEvent) { |
| 87 | TileEntity tTileEntity = WD.te(aEvent.world, aEvent.x, aEvent.y, aEvent.z, T); |
| 88 | if (tTileEntity instanceof ITileEntityCoverable) { |
| 89 | CoverData tData = ((ITileEntityCoverable)tTileEntity).getCoverData(); |
| 90 | if (tData != null && tData.mBehaviours[aEvent.side] instanceof CoverTextureCanvas) { |
| 91 | if (tData.mNBTs[aEvent.side] == null) tData.mNBTs[aEvent.side] = UT.NBT.make(); |
| 92 | tData.mNBTs[aEvent.side].setInteger(NBT_CANVAS_BLOCK, Block.getIdFromBlock(aEvent.referencedBlock)); |
| 93 | tData.mNBTs[aEvent.side].setInteger(NBT_CANVAS_META , aEvent.referencedMeta); |
| 94 | tData.mBehaviours[aEvent.side].onCoverPlaced((byte)aEvent.side, tData, null, tData.getCoverItem((byte)aEvent.side)); |
| 95 | aEvent.applied = T; |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | @Override |
| 101 | public boolean valuable(Block aBlock, int aMeta, int aValue) { |
| 102 | if (aBlock == null || aBlock == NB) return F; |
| 103 | ic2.core.IC2.addValuableOre((IRecipeInput)makeInput(ST.make(aBlock, 1, UT.Code.bind4(aMeta))), Math.max(1, aValue)); |
| 104 | return T; |
| 105 | } |
| 106 | @Override |
| 107 | public boolean valuable(Block aBlock, int aValue) { |
| 108 | if (aBlock == null || aBlock == NB) return F; |
| 109 | for (byte i = 0; i < 16; i++) valuable(aBlock, i, aValue); |
| 110 | return T; |
| 111 | } |