Search in sources :

Example 91 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project Witchworks by Um-Mitternacht.

the class KettleCrafting method init.

public static void init() {
    //------------------------------------Processing------------------------------------//
    //Some recipes that return the non-dyed version of an Item
    KettleRegistry.addKettleProcessing(FluidRegistry.WATER, Items.LEATHER_HELMET, Items.LEATHER_HELMET, false);
    KettleRegistry.addKettleProcessing(FluidRegistry.WATER, Items.LEATHER_CHESTPLATE, Items.LEATHER_CHESTPLATE, false);
    KettleRegistry.addKettleProcessing(FluidRegistry.WATER, Items.LEATHER_LEGGINGS, Items.LEATHER_LEGGINGS, false);
    KettleRegistry.addKettleProcessing(FluidRegistry.WATER, Items.LEATHER_BOOTS, Items.LEATHER_BOOTS, false);
    //Cooking with Oil
    KettleRegistry.addKettleProcessing(Fluids.MUNDANE_OIL, Items.PORKCHOP, Items.COOKED_PORKCHOP, true);
    KettleRegistry.addKettleProcessing(Fluids.MUNDANE_OIL, Items.MUTTON, Items.COOKED_MUTTON, true);
    KettleRegistry.addKettleProcessing(Fluids.MUNDANE_OIL, Items.RABBIT, Items.COOKED_RABBIT, true);
    KettleRegistry.addKettleProcessing(Fluids.MUNDANE_OIL, Items.CHICKEN, Items.COOKED_CHICKEN, true);
    KettleRegistry.addKettleProcessing(Fluids.MUNDANE_OIL, Items.BEEF, Items.COOKED_BEEF, true);
    KettleRegistry.addKettleProcessing(Fluids.MUNDANE_OIL, Items.FISH, Items.COOKED_FISH, true);
    KettleRegistry.addKettleProcessing(Fluids.MUNDANE_OIL, Items.POTATO, Items.BAKED_POTATO, true);
    //Coking with Water
    KettleRegistry.addKettleProcessing(FluidRegistry.WATER, ModItems.EMPTY_HONEYCOMB, ModItems.WAX, true);
    KettleRegistry.addKettleProcessing(FluidRegistry.WATER, ModItems.HONEYCOMB, ModItems.HONEY, true);
    //------------------------------------Fluid Creation------------------------------------//
    KettleRegistry.addKettleFluid(ModItems.HONEY, new FluidStack(Fluids.HONEY, 1000));
    KettleRegistry.addKettleFluid(Items.POTATO, new FluidStack(Fluids.MUNDANE_OIL, 1000));
    //------------------------------------Item Rituals------------------------------------//
    //Todo: Better recipe for kelp seeds.
    KettleRegistry.registerKettleItemRitual(new ItemRitual(getStack(ModItems.SEED_KELP), 5), getStack(Items.WHEAT_SEEDS, 1), Blocks.WATERLILY);
    KettleRegistry.registerKettleItemRitual(new ItemRitual(getStack(Items.GOLDEN_APPLE, 1, 1), 8), getStack(Blocks.GOLD_BLOCK, 8), Items.APPLE);
    //Todo: Sapling recipes once we add our own (to make it easier to get them without exploring, in the event a player cannot find them),
    //Todo: Also gemstone amalgam for usage as a crafting ingredient. Also, the easter egg recipe and its achievement.
    //------------------------------------Brew Recipes------------------------------------//
    KettleRegistry.registerKettleBrewRecipe(BrewUtils.createBrew(ModItems.BREW_PHIAL_DRINK, ModBrews.SHELL_ARMOR), Items.BONE, ModItems.NEEDLE_BONE, getStack(ModBlocks.COQUINA, 3));
    KettleRegistry.registerKettleBrewRecipe(BrewUtils.createBrew(ModItems.BREW_PHIAL_DRINK, ModBrews.INNER_FIRE), getStack(Items.BLAZE_ROD, 2), Items.GOLD_NUGGET, Items.BLAZE_POWDER);
    KettleRegistry.registerKettleBrewRecipe(BrewUtils.createBrew(ModItems.BREW_PHIAL_DRINK, ModBrews.SPIDER_NIGHTMARE), getStack(Blocks.WEB, 10), getStack(Items.SPIDER_EYE, 5), Items.GHAST_TEAR, Items.FERMENTED_SPIDER_EYE);
    KettleRegistry.registerKettleBrewRecipe(BrewUtils.createBrew(ModItems.BREW_PHIAL_DRINK, ModBrews.EXTINGUISH), getStack(Items.SNOWBALL, 2), Blocks.PACKED_ICE, ModItems.MINT);
    //Todo: More brews, obviously. Just need ideas, really.
    //------------------------------------Custom Brew Creation------------------------------------//
    //Todo: Continue once more effects are added, such as new brews, and what not. Also when I get around to making the ingredients and what not.
    KettleRegistry.addItemEffect(getStack(ModItems.SALT), new PotionEffect(MobEffects.BLINDNESS, 500), false);
    KettleRegistry.addItemEffect(getStack(Items.ROTTEN_FLESH), new PotionEffect(MobEffects.HUNGER, 500), false);
    KettleRegistry.addItemEffect(getStack(Blocks.END_STONE), new PotionEffect(MobEffects.LEVITATION, 500), false);
    KettleRegistry.addItemEffect(getStack(Items.SPIDER_EYE), new PotionEffect(MobEffects.POISON, 500), false);
    KettleRegistry.addItemEffect(getStack(Items.GHAST_TEAR), new PotionEffect(MobEffects.REGENERATION, 500), false);
    KettleRegistry.addItemEffect(getStack(Items.GOLDEN_CARROT), new PotionEffect(MobEffects.NIGHT_VISION, 500), false);
    KettleRegistry.addItemEffect(getStack(Items.SUGAR), new PotionEffect(MobEffects.SPEED, 500), false);
    KettleRegistry.addItemEffect(getStack(Items.MAGMA_CREAM), new PotionEffect(MobEffects.FIRE_RESISTANCE, 500), false);
    KettleRegistry.addItemEffect(getStack(Items.BLAZE_POWDER), new PotionEffect(MobEffects.STRENGTH, 500), false);
    KettleRegistry.addItemEffect(getStack(Items.RABBIT_FOOT), new PotionEffect(MobEffects.JUMP_BOOST, 500), false);
    KettleRegistry.addItemEffect(getStack(Items.SPECKLED_MELON), new PotionEffect(MobEffects.INSTANT_HEALTH, 1), false);
    KettleRegistry.addItemEffect(getStack(Items.FISH, 1, 3), new PotionEffect(MobEffects.WATER_BREATHING, 500), false);
    KettleRegistry.addItemEffect(getStack(Blocks.RED_FLOWER, 1, 1), new PotionEffect(MobEffects.LUCK, 500), false);
    KettleRegistry.addItemEffect(getStack(ModItems.WAX), new PotionEffect(MobEffects.SLOWNESS, 500), false);
    KettleRegistry.addItemEffect(getStack(Items.POISONOUS_POTATO), new PotionEffect(MobEffects.NAUSEA, 500), false);
    KettleRegistry.addItemEffect(getStack(ModItems.BELLADONNA), new PotionEffect(MobEffects.WITHER, 500), false);
    KettleRegistry.addItemEffect(getStack(ModItems.ASPHODEL), new PotionEffect(MobEffects.UNLUCK, 500), false);
    KettleRegistry.addItemEffect(getStack(ModItems.LAVENDER), new PotionEffect(MobEffects.HASTE, 500), false);
    KettleRegistry.addItemEffect(getStack(Items.PRISMARINE_CRYSTALS), new PotionEffect(MobEffects.GLOWING, 500), false);
    KettleRegistry.addItemEffect(getStack(ModItems.KELP), new PotionEffect(MobEffects.WATER_BREATHING, 500), false);
    KettleRegistry.addItemEffect(getStack(Items.PRISMARINE_SHARD), new PotionEffect(MobEffects.MINING_FATIGUE, 500), false);
    KettleRegistry.addItemEffect(getStack(Items.SHULKER_SHELL), new PotionEffect(MobEffects.SLOWNESS, 500), false);
    KettleRegistry.addItemEffect(getStack(ModBlocks.COQUINA), BrewRegistry.getDefault(ModBrews.SHELL_ARMOR), false);
    KettleRegistry.addItemEffect(getStack(ModItems.MINT), BrewRegistry.getDefault(ModBrews.EXTINGUISH), false);
    KettleRegistry.addItemModifier(getStack(Items.QUARTZ), new BrewSimpleModifier(2400, 0), true);
    KettleRegistry.addItemModifier(getStack(Items.REDSTONE), new BrewSimpleModifier(600, 0), true);
    KettleRegistry.addItemModifier(getStack(Blocks.REDSTONE_BLOCK), new BrewSimpleModifier(1200, 0), true);
    KettleRegistry.addItemModifier(getStack(ModItems.NUUMMITE), new BrewSimpleModifier(0, 3), true);
    KettleRegistry.addItemModifier(getStack(Items.GLOWSTONE_DUST), new BrewSimpleModifier(0, 1), true);
    KettleRegistry.addItemModifier(getStack(Blocks.GLOWSTONE), new BrewSimpleModifier(0, 2), true);
}
Also used : BrewSimpleModifier(com.witchworks.api.recipe.BrewSimpleModifier) PotionEffect(net.minecraft.potion.PotionEffect) FluidStack(net.minecraftforge.fluids.FluidStack)

Example 92 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project Engine by VoltzEngine-Project.

the class FluidRenderUtility method renderFluidTesselation.

/*public static int[] getFluidDisplayLists(FluidStack fluidStack, World world, boolean flowing)
	{
		if (fluidStack == null)
		{
			return null;
		}
		Fluid fluid = fluidStack.getFluid();
		if (fluid == null)
		{
			return null;
		}
		Map<Fluid, int[]> cache = flowing ? flowingRenderCache : stillRenderCache;
		int[] diplayLists = cache.get(fluid);
		if (diplayLists != null)
		{
			return diplayLists;
		}

		diplayLists = new int[DISPLAY_STAGES];

		if (fluid.getBlockID() > 0)
		{
			liquidBlock.baseBlock = Block.blocksList[fluid.getBlockID()];
			liquidBlock.texture = getFluidTexture(fluidStack.getFluid(), flowing);
		}
		else
		{
			liquidBlock.baseBlock = Block.waterStill;
			liquidBlock.texture = getFluidTexture(fluidStack.getFluid(), flowing);
		}

		cache.put(fluid, diplayLists);

		GL11.glDisable(GL11.GL_LIGHTING);
		GL11.glDisable(GL11.GL_BLEND);
		GL11.glDisable(GL11.GL_CULL_FACE);

		for (int s = 0; s < DISPLAY_STAGES; ++s)
		{
			diplayLists[s] = GLAllocation.generateDisplayLists(1);
			GL11.glNewList(diplayLists[s], 4864 /* GL_COMPILE *);

			liquidBlock.min.x = 0.01f;
			liquidBlock.min.y = 0;
			liquidBlock.min.z = 0.01f;

			liquidBlock.max.x = 0.99f;
			liquidBlock.max.y = (float) s / (float) DISPLAY_STAGES;
			liquidBlock.max.z = 0.99f;

			RenderBlockEntity.instance.renderBlock(liquidBlock, world, 0, 0, 0, false, true);

			GL11.glEndList();
		}

		GL11.glColor4f(1, 1, 1, 1);
		GL11.glEnable(GL11.GL_CULL_FACE);
		GL11.glEnable(GL11.GL_BLEND);
		GL11.glEnable(GL11.GL_LIGHTING);

		return diplayLists;
	}*/
/**
	 * Based on Open Blocks tank renderer
	 *
	 * @param tank
	 */
public static void renderFluidTesselation(IFluidTank tank, double ySouthEast, double yNorthEast, double ySouthWest, double yNorthWest) {
    FluidStack fluidStack = tank.getFluid();
    if (fluidStack != null && fluidStack.amount > 0) {
        GL11.glPushMatrix();
        GL11.glDisable(2896);
        Fluid fluid = fluidStack.getFluid();
        IIcon texture = fluid.getStillIcon();
        RenderUtility.bind(getFluidSheet(fluid));
        int color = fluid.getColor(fluidStack);
        Tessellator t = Tessellator.instance;
        double uMin = texture.getInterpolatedU(0.0);
        double uMax = texture.getInterpolatedU(16.0);
        double vMin = texture.getInterpolatedV(0.0);
        double vMax = texture.getInterpolatedV(16.0);
        double vHeight = vMax - vMin;
        float r = (color >> 16 & 0xFF) / 255.0F;
        float g = (color >> 8 & 0xFF) / 255.0F;
        float b = (color & 0xFF) / 255.0F;
        // north side
        t.startDrawingQuads();
        t.setColorOpaque_F(r, g, b);
        // bottom
        t.addVertexWithUV(0.5, -0.5, -0.5, uMax, vMin);
        // bottom
        t.addVertexWithUV(-0.5, -0.5, -0.5, uMin, vMin);
        // top
        t.addVertexWithUV(-0.5, -0.5 + yNorthWest, -0.5, uMin, vMin + (vHeight * yNorthWest));
        // north/west
        t.addVertexWithUV(0.5, -0.5 + yNorthEast, -0.5, uMax, vMin + (vHeight * yNorthEast));
        // top
        // north/east
        t.draw();
        // south side
        t.startDrawingQuads();
        t.setColorOpaque_F(r, g, b);
        // top
        t.addVertexWithUV(0.5, -0.5, 0.5, uMin, vMin);
        // south
        t.addVertexWithUV(0.5, -0.5 + ySouthEast, 0.5, uMin, vMin + (vHeight * ySouthEast));
        // east
        t.addVertexWithUV(-0.5, -0.5 + ySouthWest, 0.5, uMax, vMin + (vHeight * ySouthWest));
        // top
        // south
        // west
        t.addVertexWithUV(-0.5, -0.5, 0.5, uMax, vMin);
        t.draw();
        // east side
        t.startDrawingQuads();
        t.setColorOpaque_F(r, g, b);
        // top
        t.addVertexWithUV(0.5, -0.5, -0.5, uMin, vMin);
        // north/east
        t.addVertexWithUV(0.5, -0.5 + yNorthEast, -0.5, uMin, vMin + (vHeight * yNorthEast));
        // top
        // south/east
        t.addVertexWithUV(0.5, -0.5 + ySouthEast, 0.5, uMax, vMin + (vHeight * ySouthEast));
        t.addVertexWithUV(0.5, -0.5, 0.5, uMax, vMin);
        t.draw();
        // west side
        t.startDrawingQuads();
        t.setColorOpaque_F(r, g, b);
        t.addVertexWithUV(-0.5, -0.5, 0.5, uMin, vMin);
        // top
        // south/west
        t.addVertexWithUV(-0.5, -0.5 + ySouthWest, 0.5, uMin, vMin + (vHeight * ySouthWest));
        // top
        // north/west
        t.addVertexWithUV(-0.5, -0.5 + yNorthWest, -0.5, uMax, vMin + (vHeight * yNorthWest));
        t.addVertexWithUV(-0.5, -0.5, -0.5, uMax, vMin);
        t.draw();
        // top
        t.startDrawingQuads();
        t.setColorOpaque_F(r, g, b);
        // south
        // east
        t.addVertexWithUV(0.5, -0.5 + ySouthEast, 0.5, uMax, vMin);
        // north
        // east
        t.addVertexWithUV(0.5, -0.5 + yNorthEast, -0.5, uMin, vMin);
        // north
        // west
        t.addVertexWithUV(-0.5, -0.5 + yNorthWest, -0.5, uMin, vMax);
        // south
        // west
        t.addVertexWithUV(-0.5, -0.5 + ySouthWest, 0.5, uMax, vMax);
        t.draw();
        // bottom
        t.startDrawingQuads();
        t.setColorOpaque_F(r, g, b);
        t.addVertexWithUV(0.5, -0.5, -0.5, uMax, vMin);
        t.addVertexWithUV(0.5, -0.5, 0.5, uMin, vMin);
        t.addVertexWithUV(-0.5, -0.5, 0.5, uMin, vMax);
        t.addVertexWithUV(-0.5, -0.5, -0.5, uMax, vMax);
        t.draw();
        GL11.glEnable(2896);
        GL11.glPopMatrix();
    }
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) IIcon(net.minecraft.util.IIcon) FluidStack(net.minecraftforge.fluids.FluidStack) Fluid(net.minecraftforge.fluids.Fluid)

Example 93 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project Engine by VoltzEngine-Project.

the class MRLoaderFluidStack method newRecipe.

protected MRFluidStack newRecipe(Fluid fluid, int ingots, ItemStack input) {
    MRFluidStack recipe = new MRFluidStack(type, new FluidStack(fluid, ingots * Engine.INGOT_VOLUME));
    recipe.addInputOption(input);
    return recipe;
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack)

Example 94 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project CodeChickenLib by Chicken-Bones.

the class MCDataIO method readFluidStack.

public static FluidStack readFluidStack(MCDataInput in) {
    FluidStack fluid = null;
    short fluidID = in.readShort();
    if (fluidID >= 0)
        fluid = new FluidStack(FluidRegistry.getFluid(fluidID), in.readVarInt(), in.readNBTTagCompound());
    return fluid;
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack)

Example 95 with FluidStack

use of net.minecraftforge.fluids.FluidStack in project Overloaded by CJ-MC-Mods.

the class LongFluidStorage method drain.

/**
     * Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler.
     *
     * @param resource FluidStack representing the Fluid and maximum amount of fluid to be drained.
     * @param doDrain  If false, drain will only be simulated.
     * @return FluidStack representing the Fluid and amount that was (or would have been, if
     * simulated) drained.
     */
@Nullable
@Override
public FluidStack drain(@Nonnull FluidStack resource, boolean doDrain) {
    LongFluidStack result = take(new LongFluidStack(resource, resource.amount), doDrain);
    if (result.amount == 0L) {
        return null;
    }
    FluidStack toReturn = resource.copy();
    toReturn.amount = (int) result.amount;
    return toReturn;
}
Also used : LongFluidStack(com.cjm721.overloaded.storage.LongFluidStack) LongFluidStack(com.cjm721.overloaded.storage.LongFluidStack) FluidStack(net.minecraftforge.fluids.FluidStack) Nullable(javax.annotation.Nullable)

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