use of com.mcmoddev.lib.block.InteractiveFluidBlock 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);
}
use of com.mcmoddev.lib.block.InteractiveFluidBlock in project BaseMetals by MinecraftModDevelopmentMods.
the class Materials method init.
/**
*/
public static void init(final MMDLibRegisterMaterials event) {
final List<String> rareMaterials = Arrays.asList(MaterialNames.ADAMANTINE, MaterialNames.COLDIRON, MaterialNames.PLATINUM, MaterialNames.STARSTEEL);
final List<String> materials = Arrays.asList(MaterialNames.ANTIMONY, MaterialNames.BISMUTH, MaterialNames.COPPER, MaterialNames.LEAD, MaterialNames.NICKEL, MaterialNames.SILVER, MaterialNames.TIN, MaterialNames.ZINC);
final List<String> rareAlloyMaterials = Arrays.asList(MaterialNames.AQUARIUM, MaterialNames.MITHRIL);
final List<String> alloyMaterials = Arrays.asList(MaterialNames.BRASS, MaterialNames.BRONZE, MaterialNames.CUPRONICKEL, MaterialNames.ELECTRUM, MaterialNames.INVAR, MaterialNames.PEWTER, MaterialNames.STEEL);
materials.stream().filter(Options::isMaterialEnabled).forEach(name -> createMaterial(name, MaterialType.METAL, getHardness(name), getStrength(name), getMagic(name), getColor(name)));
alloyMaterials.stream().filter(Options::isMaterialEnabled).forEach(name -> createAlloyMaterial(name, MaterialType.METAL, getHardness(name), getStrength(name), getMagic(name), getColor(name)));
rareMaterials.stream().filter(Options::isMaterialEnabled).forEach(name -> createRareMaterial(name, MaterialType.METAL, getHardness(name), getStrength(name), getMagic(name), getColor(name)));
rareAlloyMaterials.stream().filter(Options::isMaterialEnabled).forEach(name -> createRareAlloyMaterial(name, MaterialType.METAL, getHardness(name), getStrength(name), getMagic(name), getColor(name)));
if (Options.isMaterialEnabled(MaterialNames.MERCURY)) {
createMaterial(MaterialNames.MERCURY, MaterialType.METAL, 1.0d, 1.0d, 1.0d, 0xFFE2E2E2, true);
Materials.getMaterialByName(MaterialNames.MERCURY).setFluidBlockGetter(new IFluidBlockGetter() {
public BlockFluidClassic apply(String fluidName) {
return new InteractiveFluidBlock(FluidRegistry.getFluid(MaterialNames.MERCURY), false, (final World w, final EntityLivingBase e) -> {
if (w.rand.nextInt(32) == 0) {
e.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 30 * 20, 2));
}
});
}
});
}
// Mod Materials
if (hasMaterial(MaterialNames.ADAMANTINE)) {
getMaterialByName(MaterialNames.ADAMANTINE).setBlastResistance(2000f).setSpawnSize(4).setDefaultDimension(-1);
}
if (hasMaterial(MaterialNames.STARSTEEL)) {
getMaterialByName(MaterialNames.STARSTEEL).setBlastResistance(2000f).setSpawnSize(6).setDefaultDimension(1).setRegenerates(true);
}
}
Aggregations