Jump to content

[1.7] register two equal fluids


MrRiegel

Recommended Posts

hey,

I want to add oil and it should be compatible with buildcraft oil.

Could I play with 2 oils at the same time?

And if not, how can I activate buildcraft oil if buildcraft is installed?

 

ModFluids

public class ModFluids {

public static final Fluid oil = new Fluid("oil").setDensity(800)
		.setViscosity(10000);

public static void init() {
	registerFluid(ModFluids.oil, "oil");

}

private static void registerFluid(Fluid fluid, String fluidName) {

	if (!FluidRegistry.isFluidRegistered(fluidName)) {
		FluidRegistry.registerFluid(fluid);
	}
	fluid = FluidRegistry.getFluid(fluidName);
}
}

 

ModBlocks

public class ModBlocks {

public static final Block oilBlock = new OilBlock(ModFluids.oil, Material.water);

public static void init() {
	GameRegistry.registerBlock(oilBlock, "oilBlock");

}

}

 

Moditems

public class ModItems {

public static final Item oilBucket = new OilBucket(ModBlocks.oilBlock);

public static void init() {
	GameRegistry.registerItem(oilBucket, "oilBucket");
	FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("oil", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(oilBucket), new ItemStack(Items.bucket));
	BucketHandler.INSTANCE.buckets.put(ModBlocks.oilBlock, ModItems.oilBucket);
}

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.