Search in sources :

Example 1 with CrusherRecipe

use of blusunrize.immersiveengineering.api.crafting.CrusherRecipe in project ImmersiveEngineering by BluSunrize.

the class IERecipes method initCrusherRecipes.

public static void initCrusherRecipes() {
    oreOutputSecondaries.put("Iron", new Object[] { "dustNickel", .1f });
    oreOutputSecondaries.put("Gold", new Object[] { "crystalCinnabar", .05f });
    oreOutputSecondaries.put("Copper", new Object[] { "dustGold", .1f });
    oreOutputSecondaries.put("Lead", new Object[] { "dustSilver", .1f });
    oreOutputSecondaries.put("Silver", new Object[] { "dustLead", .1f });
    oreOutputSecondaries.put("Nickel", new Object[] { "dustPlatinum", .1f });
    //		addCrusherRecipe(new ItemStack(IEContent.itemMetal,1,15), "ingotConstantan", 3600, null,0);
    //		addCrusherRecipe(new ItemStack(IEContent.itemMetal,1,16), "ingotElectrum", 3600, null,0);
    //		addCrusherRecipe(new ItemStack(IEContent.itemMetal,1,19), "ingotHOPGraphite", 3600, null,0);
    //		CrusherRecipe.addRecipe(new ItemStack(IEContent.itemMetal,1,17), "fuelCoke", 4800);
    //		CrusherRecipe.addRecipe(new ItemStack(IEContent.itemMetal,1,18), "gemQuartz", 4800);
    oreOutputModifier.put("Lapis", new ItemStack(Items.DYE, 9, 4));
    oreOutputModifier.put("Diamond", new ItemStack(Items.DIAMOND, 2));
    oreOutputModifier.put("Redstone", new ItemStack(Items.REDSTONE, 6));
    oreOutputSecondaries.put("Redstone", new Object[] { "crystalCinnabar", .25f });
    oreOutputModifier.put("Emerald", new ItemStack(Items.EMERALD, 2));
    oreOutputModifier.put("Quartz", new ItemStack(Items.QUARTZ, 3));
    oreOutputSecondaries.put("Quartz", new Object[] { "dustSulfur", .15f });
    oreOutputModifier.put("Coal", new ItemStack(Items.COAL, 4));
    oreOutputSecondaries.put("Platinum", new Object[] { "dustNickel", .1f });
    oreOutputSecondaries.put("Tungsten", new Object[] { "dustManganese", .1f });
    oreOutputSecondaries.put("Uranium", new Object[] { "dustLead", .1f });
    oreOutputSecondaries.put("Yellorium", new Object[] { "dustLead", .1f });
    oreOutputSecondaries.put("Plutonium", new Object[] { "dustUranium", .1f });
    Item item = GameRegistry.findItem("IC2", "itemOreIridium");
    oreOutputSecondaries.put("Osmium", new Object[] { item, .01f });
    oreOutputSecondaries.put("Iridium", new Object[] { "dustPlatium", .1f });
    oreOutputSecondaries.put("FzDarkIron", new Object[] { "dustIron", .1f });
    item = GameRegistry.findItem("Railcraft", "firestone.raw");
    if (item != null)
        oreOutputModifier.put("Firestone", new ItemStack(item));
    oreOutputSecondaries.put("Nikolite", new Object[] { Items.DIAMOND, .025f });
    addCrusherRecipe(new ItemStack(Blocks.GRAVEL), "cobblestone", 1600);
    addCrusherRecipe(new ItemStack(Blocks.SAND), Blocks.GRAVEL, 1600);
    addCrusherRecipe(new ItemStack(Blocks.SAND), "itemSlag", 1600);
    addCrusherRecipe(new ItemStack(Blocks.SAND), "blockGlass", 3200);
    addCrusherRecipe(new ItemStack(Items.QUARTZ, 4), "blockQuartz", 3200);
    addCrusherRecipe(new ItemStack(Items.GLOWSTONE_DUST, 4), "glowstone", 3200);
    addCrusherRecipe(new ItemStack(Items.BLAZE_POWDER, 4), "rodBlaze", 3200, "dustSulfur", .5f);
    addCrusherRecipe(new ItemStack(Items.DYE, 6, 15), Items.BONE, 3200);
    addCrusherRecipe(new ItemStack(IEContent.itemMaterial, 1, 17), "fuelCoke", 2400);
    addCrusherRecipe(new ItemStack(IEContent.itemMaterial, 9, 17), "blockFuelCoke", 4800);
    addItemToOreDictCrusherRecipe("dustCoal", 1, new ItemStack(Items.COAL), 2400);
    addItemToOreDictCrusherRecipe("dustObsidian", 4, Blocks.OBSIDIAN, 6000);
    for (int i = 0; i < 16; i++) {
        CrusherRecipe r = CrusherRecipe.addRecipe(new ItemStack(Items.STRING, 4), new ItemStack(Blocks.WOOL, 1, i), 3200);
        if (i != 0)
            r.addToSecondaryOutput(new ItemStack(Items.DYE, 1, 15 - i), .05f);
    }
}
Also used : Item(net.minecraft.item.Item) CrusherRecipe(blusunrize.immersiveengineering.api.crafting.CrusherRecipe) ItemStack(net.minecraft.item.ItemStack) ItemEngineersBlueprint(blusunrize.immersiveengineering.common.items.ItemEngineersBlueprint)

Example 2 with CrusherRecipe

use of blusunrize.immersiveengineering.api.crafting.CrusherRecipe in project ImmersiveEngineering by BluSunrize.

the class TileEntityCrusher method onEntityCollision.

@Override
public void onEntityCollision(World world, Entity entity) {
    boolean bpos = pos == 16 || pos == 17 || pos == 18 || pos == 21 || pos == 22 || pos == 23 || pos == 26 || pos == 27 || pos == 28;
    if (bpos && !world.isRemote && entity != null && !entity.isDead && !isRSDisabled()) {
        TileEntityCrusher master = master();
        if (master == null)
            return;
        Vec3d center = new Vec3d(master.getPos()).addVector(.5, .75, .5);
        AxisAlignedBB crusherInternal = new AxisAlignedBB(center.xCoord - 1.0625, center.yCoord, center.zCoord - 1.0625, center.xCoord + 1.0625, center.yCoord + 1.25, center.zCoord + 1.0625);
        if (!entity.getEntityBoundingBox().intersectsWith(crusherInternal))
            return;
        if (entity instanceof EntityItem && ((EntityItem) entity).getEntityItem() != null) {
            ItemStack stack = ((EntityItem) entity).getEntityItem();
            if (stack == null)
                return;
            CrusherRecipe recipe = master.findRecipeForInsertion(stack);
            if (recipe == null)
                return;
            ItemStack displayStack = null;
            for (IngredientStack ingr : recipe.getItemInputs()) if (ingr.matchesItemStack(stack)) {
                displayStack = Utils.copyStackWithAmount(stack, ingr.inputSize);
                break;
            }
            MultiblockProcess<CrusherRecipe> process = new MultiblockProcessInWorld<CrusherRecipe>(recipe, .5f, displayStack);
            if (master.addProcessToQueue(process, true, true)) {
                master.addProcessToQueue(process, false, true);
                stack.stackSize -= displayStack.stackSize;
                if (stack.stackSize <= 0)
                    entity.setDead();
            }
        } else if (entity instanceof EntityLivingBase && (!(entity instanceof EntityPlayer) || !((EntityPlayer) entity).capabilities.disableDamage)) {
            int consumed = master.energyStorage.extractEnergy(80, true);
            if (consumed > 0) {
                master.energyStorage.extractEnergy(consumed, false);
                EventHandler.crusherMap.put(entity.getUniqueID(), master);
                entity.attackEntityFrom(IEDamageSources.crusher, consumed / 20f);
            }
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EntityLivingBase(net.minecraft.entity.EntityLivingBase) CrusherRecipe(blusunrize.immersiveengineering.api.crafting.CrusherRecipe) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) IngredientStack(blusunrize.immersiveengineering.api.crafting.IngredientStack) Vec3d(net.minecraft.util.math.Vec3d) EntityItem(net.minecraft.entity.item.EntityItem)

Example 3 with CrusherRecipe

use of blusunrize.immersiveengineering.api.crafting.CrusherRecipe in project ImmersiveEngineering by BluSunrize.

the class Crusher method addRecipe.

@ZenMethod
public static void addRecipe(IItemStack output, IIngredient input, int energy, @Optional IItemStack secondaryOutput, @Optional double secondaryChance) {
    Object oInput = CraftTweakerHelper.toObject(input);
    if (oInput == null) {
        MineTweakerAPI.getLogger().logError("Did not add crusher recipe for " + output.getDisplayName() + ", input was null");
        return;
    }
    CrusherRecipe r = new CrusherRecipe(CraftTweakerHelper.toStack(output), oInput, energy);
    if (r.input == null) {
        MineTweakerAPI.getLogger().logError("Did not add crusher recipe for " + output.getDisplayName() + ", converted input was null");
        return;
    }
    if (secondaryOutput != null)
        r.addToSecondaryOutput(CraftTweakerHelper.toStack(secondaryOutput), (float) secondaryChance);
    MineTweakerAPI.apply(new Add(r));
}
Also used : CrusherRecipe(blusunrize.immersiveengineering.api.crafting.CrusherRecipe) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Example 4 with CrusherRecipe

use of blusunrize.immersiveengineering.api.crafting.CrusherRecipe in project ImmersiveEngineering by BluSunrize.

the class DenseOresHelper method postInit.

@Override
public void postInit() {
    HashMap map = null;
    Field f_baseOreDictionary = null;
    try {
        Class c_DenseOresRegistry = Class.forName("com.rwtema.denseores.DenseOresRegistry");
        Class c_DenseOre = Class.forName("com.rwtema.denseores.DenseOre");
        f_baseOreDictionary = c_DenseOre.getField("baseOreDictionaryEntry");
        map = (HashMap) c_DenseOresRegistry.getField("ores").get(null);
    } catch (Exception e) {
    }
    if (map != null && f_baseOreDictionary != null) {
        ArrayList<CrusherRecipe> crushRecipes = new ArrayList<CrusherRecipe>();
        ArrayList<ArcFurnaceRecipe> arcRecipes = new ArrayList<ArcFurnaceRecipe>();
        for (Object o : map.values()) {
            try {
                String baseOre = (String) f_baseOreDictionary.get(o);
                String denseOre = "dense" + baseOre;
                boolean c = false;
                for (CrusherRecipe recipe : CrusherRecipe.recipeList) if (recipe.oreInputString != null && recipe.oreInputString.equals(baseOre)) {
                    ItemStack out = Utils.copyStackWithAmount(recipe.output, recipe.output.stackSize * 4);
                    CrusherRecipe r = new CrusherRecipe(out, denseOre, (int) (recipe.getTotalProcessEnergy() / CrusherRecipe.energyModifier) * 2);
                    if (recipe.secondaryOutput != null) {
                        Object[] newSec = new Object[recipe.secondaryOutput.length * 2];
                        for (int i = 0; i < recipe.secondaryOutput.length; i++) {
                            newSec[i * 2] = Utils.copyStackWithAmount(recipe.secondaryOutput[i], recipe.secondaryOutput[i].stackSize * 2);
                            newSec[i * 2 + 1] = recipe.secondaryChance[i] * 2;
                        }
                        r.addToSecondaryOutput(newSec);
                    }
                    crushRecipes.add(r);
                    c = true;
                }
                boolean a = false;
                for (ArcFurnaceRecipe recipe : ArcFurnaceRecipe.recipeList) if (recipe.oreInputString != null && recipe.oreInputString.equals(baseOre)) {
                    ItemStack out = Utils.copyStackWithAmount(recipe.output, recipe.output.stackSize * 4);
                    int time = (int) (recipe.getTotalProcessTime() / ArcFurnaceRecipe.timeModifier);
                    int perTick = (int) (recipe.getTotalProcessEnergy() / recipe.getTotalProcessTime() / ArcFurnaceRecipe.energyModifier);
                    ArcFurnaceRecipe r = new ArcFurnaceRecipe(out, denseOre, recipe.slag, time, perTick);
                    arcRecipes.add(r);
                    a = true;
                }
                IELogger.info("Supporting DenseOre: " + denseOre + "(" + baseOre + "), Crushing:" + (c ? "[X]" : "[ ]") + ", Arc Smelting:" + (a ? "[X]" : "[ ]"));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        CrusherRecipe.recipeList.addAll(crushRecipes);
        ArcFurnaceRecipe.recipeList.addAll(arcRecipes);
    }
}
Also used : HashMap(java.util.HashMap) ArcFurnaceRecipe(blusunrize.immersiveengineering.api.crafting.ArcFurnaceRecipe) ArrayList(java.util.ArrayList) CrusherRecipe(blusunrize.immersiveengineering.api.crafting.CrusherRecipe) Field(java.lang.reflect.Field) ItemStack(net.minecraft.item.ItemStack)

Aggregations

CrusherRecipe (blusunrize.immersiveengineering.api.crafting.CrusherRecipe)4 ItemStack (net.minecraft.item.ItemStack)3 ArcFurnaceRecipe (blusunrize.immersiveengineering.api.crafting.ArcFurnaceRecipe)1 IngredientStack (blusunrize.immersiveengineering.api.crafting.IngredientStack)1 ItemEngineersBlueprint (blusunrize.immersiveengineering.common.items.ItemEngineersBlueprint)1 Field (java.lang.reflect.Field)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 EntityItem (net.minecraft.entity.item.EntityItem)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 Item (net.minecraft.item.Item)1 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 Vec3d (net.minecraft.util.math.Vec3d)1 ZenMethod (stanhebben.zenscript.annotations.ZenMethod)1