use of net.minecraftforge.fluids.BlockFluidClassic in project BaseMetals by MinecraftModDevelopmentMods.
the class Fluids method addFluidBlock.
@Nullable
protected static BlockFluidClassic addFluidBlock(@Nonnull final MMDMaterial material) {
if (material.getFluidBlock() != null) {
return material.getFluidBlock();
}
BlockFluidClassic block;
String name = material.getName();
if (name == null) {
return null;
}
if (!name.equals(MaterialNames.MERCURY)) {
block = new BlockFluidClassic(material.getFluid(), Material.LAVA);
} else {
block = new InteractiveFluidBlock(getFluidByName(name), false, (World w, EntityLivingBase e) -> {
if (w.rand.nextInt(32) == 0) {
e.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 30 * 20, 2));
}
});
}
// fullName
block.setRegistryName(name);
block.setUnlocalizedName(block.getRegistryName().getResourceDomain() + "." + name);
material.addNewBlock("fluid", block);
block.setCreativeTab(CreativeTabs.MISC);
final ItemBlock itemBlock = new ItemBlock(block);
// fullName
itemBlock.setRegistryName(name);
itemBlock.setUnlocalizedName(block.getRegistryName().getResourceDomain() + "." + name);
material.addNewItem("fluidItemBlock", itemBlock);
material.setFluidBlock(block);
return fluidBlockRegistry.put(name, block);
}
Aggregations