Search in sources :

Example 56 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.

the class TConstructHelper method preInit.

@Override
public void preInit() {
    //		sendFluidForMelting("Uranium", 0x596552, 600);
    fluidUranium = new FluidColouredMetal("uranium", 0x596552, 600);
    sendFluidForMelting("Uranium", fluidUranium);
    blockMoltenUranium = new BlockIEFluid("molten_uranium", fluidUranium, net.minecraft.block.material.Material.LAVA);
    //		Fluid fluidCons = sendFluidForMelting("Constantan", 0xf7866c, 518);
    fluidConstantan = new FluidColouredMetal("constantan", 0xf7866c, 518);
    sendFluidForMelting("Constantan", fluidUranium);
    blockMoltenConstantan = new BlockIEFluid("molten_constantan", fluidConstantan, net.minecraft.block.material.Material.LAVA);
    sendAlloyForMelting(new FluidStack(fluidConstantan, 2), "copper", 1, "nickel", 1);
    //		FluidStack output = fluids.get(0);
    //		FluidStack[] input = new FluidStack[fluids.size()-1];
    //		input = fluids.subList(1, fluids.size()).toArray(input);
    //		TinkerRegistry.registerAlloy(new FluidStack(fluidCons, 2), new FluidStack[]{new FluidStack(fluidCons, 2)});
    FMLInterModComms.sendMessage("tconstruct", "blacklistMelting", new ItemStack(IEContent.itemBullet, 1, OreDictionary.WILDCARD_VALUE));
    FMLInterModComms.sendMessage("tconstruct", "blacklistMelting", new ItemStack(IEContent.itemDrillhead, 1, OreDictionary.WILDCARD_VALUE));
    boolean bows = false;
    try {
        String tConVersion = Loader.instance().getIndexedModList().get("tconstruct").getVersion();
        //TCon version format: 1.10.2-[major].[minor].[sub].[jenkins]
        String version = tConVersion.substring(7);
        //reduce to raw version numbers by removing "jenkins"
        version = version.replaceAll("[^\\d.]", "");
        bows = version.compareTo("2.5.6.441") >= 0;
    } catch (Exception e) {
    }
    treatedWood.setCraftable(true);
    treatedWood.addItem("stickTreatedWood", 1, Material.VALUE_Shard);
    treatedWood.addItem("plankTreatedWood", 1, Material.VALUE_Ingot);
    treatedWood.addTrait(TinkerTraits.ecological, MaterialTypes.HEAD);
    treatedWood.addTrait(TinkerTraits.ecological);
    TinkerRegistry.addMaterialStats(treatedWood, new HeadMaterialStats(25, 2.00f, 2.00f, HarvestLevels.STONE), new HandleMaterialStats(1.0f, 35), new ExtraMaterialStats(20));
    if (bows)
        TinkerRegistry.addMaterialStats(treatedWood, new BowMaterialStats(1f, 1.125f, 0), new ArrowShaftMaterialStats(1.2f, 0));
    TinkerIntegration.integrate(treatedWood, "plankTreatedWood").integrate();
    constantan.setCastable(true);
    constantan.addItem("nuggetConstantan", 1, Material.VALUE_Nugget);
    constantan.addItem("ingotConstantan", 1, Material.VALUE_Ingot);
    constantan.addTrait(thermalInversion);
    TinkerRegistry.addMaterialStats(constantan, new HeadMaterialStats(25, 4.70f, 4.00f, HarvestLevels.DIAMOND), new HandleMaterialStats(0.8f, 60), new ExtraMaterialStats(60));
    if (bows)
        TinkerRegistry.addMaterialStats(constantan, new BowMaterialStats(.55f, 1.5f, 5f));
    TinkerIntegration.integrate(constantan, fluidConstantan, "Constantan").toolforge().integrate();
    hemp.addItemIngot("fiberHemp");
    hemp.setRepresentativeItem(new ItemStack(IEContent.itemMaterial, 1, 4));
    TinkerRegistry.addMaterialStats(hemp, new BowStringMaterialStats(1f));
    TinkerIntegration.integrate(hemp).integrate();
    ToolboxHandler.addToolType((s) -> (s.getItem() instanceof TinkersItem));
}
Also used : TinkersItem(slimeknights.tconstruct.library.tinkering.TinkersItem) BlockIEFluid(blusunrize.immersiveengineering.common.blocks.BlockIEFluid) FluidStack(net.minecraftforge.fluids.FluidStack) ItemStack(net.minecraft.item.ItemStack)

Example 57 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.

the class TConstructHelper method sendAlloyForMelting.

public static void sendAlloyForMelting(FluidStack output, Object... input) {
    assert (input.length % 2 == 0);
    FluidStack[] inputStacks = new FluidStack[input.length / 2];
    for (int i = 0; i < inputStacks.length; i++) if (input[i * 2] instanceof String && input[i * 2 + 1] instanceof Integer) {
        Fluid f = FluidRegistry.getFluid((String) input[i * 2]);
        if (f != null)
            inputStacks[i] = new FluidStack(f, (Integer) input[i * 2 + 1]);
    }
    NBTTagList tagList = new NBTTagList();
    tagList.appendTag(output.writeToNBT(new NBTTagCompound()));
    for (FluidStack stack : inputStacks) if (stack != null)
        tagList.appendTag(stack.writeToNBT(new NBTTagCompound()));
    NBTTagCompound message = new NBTTagCompound();
    message.setTag("alloy", tagList);
    //		FMLInterModComms.sendMessage("tconstruct", "alloy", message);
    //	For some reason IMC on this is broken? So direct interaction is required. Oh well.
    TinkerRegistry.registerAlloy(output, inputStacks);
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) FluidStack(net.minecraftforge.fluids.FluidStack) Fluid(net.minecraftforge.fluids.Fluid) BlockIEFluid(blusunrize.immersiveengineering.common.blocks.BlockIEFluid) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 58 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.

the class HarvestcraftHelper method init.

@Override
public void init() {
    //Pams Harvest Craft uses fluids with OreDict entries, so this is my workaround >_>
    final List listWater = OreDictionary.getOres("listAllwater");
    AssemblerHandler.registerSpecialQueryConverters(o -> {
        if (!(o instanceof List))
            return null;
        if (listWater == o)
            return new RecipeQuery(new FluidStack(FluidRegistry.WATER, 1000), 1000);
        return null;
    });
    final Fluid milk = FluidRegistry.getFluid("milk");
    if (milk != null) {
        final List listMilk = OreDictionary.getOres("listAllmilk");
        AssemblerHandler.registerSpecialQueryConverters(o -> {
            if (!(o instanceof List))
                return null;
            if (listMilk == o)
                return new RecipeQuery(new FluidStack(milk, 1000), 1000);
            return null;
        });
    }
}
Also used : RecipeQuery(blusunrize.immersiveengineering.api.tool.AssemblerHandler.RecipeQuery) FluidStack(net.minecraftforge.fluids.FluidStack) Fluid(net.minecraftforge.fluids.Fluid) List(java.util.List)

Example 59 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.

the class TConstructHelper method init.

@Override
public void init() {
    if (ApiUtils.isExistingOreName("ingotAluBrass"))
        IERecipes.addOreDictAlloyingRecipe("ingotAluBrass", 4, "Copper", 100, 512, "dustAluminum", "dustAluminum", "dustAluminum");
    IERecipes.addOreDictAlloyingRecipe("ingotManyullyn", 1, "Cobalt", 200, 512, "ingotArdite");
    IERecipes.addOreDictAlloyingRecipe("ingotManyullyn", 1, "Ardite", 200, 512, "ingotCobalt");
    //		ChemthrowerHandler.registerEffect("glue", new ChemthrowerEffect_Potion(null,0, IEPotions.sticky,100,1));
    ChemthrowerHandler.registerEffect("blueslime", new ChemthrowerEffect_Potion(null, 0, IEPotions.sticky, 100, 1));
    ChemthrowerHandler.registerEffect("purpleslime", new ChemthrowerEffect_Potion(null, 0, IEPotions.sticky, 100, 2));
    //		RailgunHandler.registerProjectileProperties(new ComparableItemStack("rodIron"), 7, 1.25).setColourMap(new int[][]{{0xd8d8d8,0xd8d8d8,0xd8d8d8,0xa8a8a8,0x686868,0x686868}});
    //		RailgunHandler.registerProjectileProperties(new ComparableItemStack("rodSteel"), 9, 1.25).setColourMap(new int[][]{{0xb4b4b4,0xb4b4b4,0xb4b4b4,0x7a7a7a,0x555555,0x555555}});
    //		RailgunHandler.registerProjectileProperties(new ComparableItemStack("ironRod"), 7, 1.25).setColourMap(new int[][]{{0xd8d8d8,0xd8d8d8,0xd8d8d8,0xa8a8a8,0x686868,0x686868}});
    //		RailgunHandler.registerProjectileProperties(new ComparableItemStack("steelRod"), 9, 1.25).setColourMap(new int[][]{{0xb4b4b4,0xb4b4b4,0xb4b4b4,0x7a7a7a,0x555555,0x555555}});
    Fluid fluidClay = FluidRegistry.getFluid("clay");
    if (fluidClay != null)
        MixerRecipe.addRecipe(new FluidStack(IEContent.fluidConcrete, 500), new FluidStack(fluidClay, 500), new Object[] { "sand", "sand", "gravel" }, 3200);
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) Fluid(net.minecraftforge.fluids.Fluid) BlockIEFluid(blusunrize.immersiveengineering.common.blocks.BlockIEFluid) ChemthrowerEffect_Potion(blusunrize.immersiveengineering.api.tool.ChemthrowerHandler.ChemthrowerEffect_Potion)

Example 60 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project Trains-In-Motion-1.7.10 by EternalBlueFlame.

the class GenericRailTransport method fill.

/**checks if the fluid can be put into the tank, and if doFill is true, will actually attempt to add the fluid to the tank.
     * @return the amount of fluid that was or could be put into the tank.*/
@Override
public int fill(@Nullable ForgeDirection from, FluidStack resource, boolean doFill) {
    //if the tank has no capacity, or the filter prevents this fluid, or the fluid in the tank already isn't the same.
    if (resource == null || !canFill(null, resource.getFluid())) {
        return 0;
    }
    int amountToFill;
    //if the tank is null, figure out how much fluid to add based on tank capacity.
    if (fluidTank == null) {
        amountToFill = getTankCapacity() < resource.amount ? getTankCapacity() : resource.amount;
        if (doFill) {
            fluidTank = new FluidStack(resource.getFluid(), amountToFill);
            updateWatchers = true;
        }
    //if the tank isn't null, we also have to check the amount already in the tank
    } else {
        amountToFill = getTankCapacity() - getTankAmount() < resource.amount ? getTankCapacity() - getTankAmount() : resource.amount;
        if (doFill) {
            fluidTank.amount += amountToFill;
            updateWatchers = true;
        }
    }
    return amountToFill;
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) RailUtility.rotatePoint(ebf.tim.utility.RailUtility.rotatePoint)

Aggregations

FluidStack (net.minecraftforge.fluids.FluidStack)188 ItemStack (net.minecraft.item.ItemStack)63 TileEntity (net.minecraft.tileentity.TileEntity)30 Fluid (net.minecraftforge.fluids.Fluid)28 IFluidHandler (net.minecraftforge.fluids.IFluidHandler)25 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)19 ArrayList (java.util.ArrayList)18 IFluidHandler (net.minecraftforge.fluids.capability.IFluidHandler)16 Block (net.minecraft.block.Block)12 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)12 FluidTankInfo (net.minecraftforge.fluids.FluidTankInfo)10 Item (net.minecraft.item.Item)9 BlockPos (net.minecraft.util.math.BlockPos)9 HashMap (java.util.HashMap)6 FluidIdentifier (logisticspipes.utils.FluidIdentifier)6 StandardTank (mods.railcraft.common.fluids.tanks.StandardTank)6 EntityPlayer (net.minecraft.entity.player.EntityPlayer)6 PipeFluidTransportLogistics (logisticspipes.transport.PipeFluidTransportLogistics)5 IBlockState (net.minecraft.block.state.IBlockState)5 EnumFacing (net.minecraft.util.EnumFacing)5