Search in sources :

Example 1 with IFluidBlockGetter

use of com.mcmoddev.lib.material.IFluidBlockGetter 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);
    }
}
Also used : BlockFluidClassic(net.minecraftforge.fluids.BlockFluidClassic) PotionEffect(net.minecraft.potion.PotionEffect) InteractiveFluidBlock(com.mcmoddev.lib.block.InteractiveFluidBlock) EntityLivingBase(net.minecraft.entity.EntityLivingBase) IFluidBlockGetter(com.mcmoddev.lib.material.IFluidBlockGetter) World(net.minecraft.world.World)

Aggregations

InteractiveFluidBlock (com.mcmoddev.lib.block.InteractiveFluidBlock)1 IFluidBlockGetter (com.mcmoddev.lib.material.IFluidBlockGetter)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 PotionEffect (net.minecraft.potion.PotionEffect)1 World (net.minecraft.world.World)1 BlockFluidClassic (net.minecraftforge.fluids.BlockFluidClassic)1