Search in sources :

Example 21 with Material

use of net.minecraft.block.material.Material in project ConvenientAdditions by Necr0.

the class ItemAdventurersPickaxe method isEffective.

public boolean isEffective(IBlockState state) {
    Material m = state.getMaterial();
    String tool = state.getBlock().getHarvestTool(state);
    return m == Material.IRON || m == Material.ANVIL || m == Material.ROCK || (tool != null && tool.equals("pickaxe"));
}
Also used : Material(net.minecraft.block.material.Material)

Example 22 with Material

use of net.minecraft.block.material.Material in project VoodooCraft by Mod-DevCafeTeam.

the class HexHandler method fluidWalking.

@SubscribeEvent
public static void fluidWalking(TickEvent.PlayerTickEvent event) {
    EntityPlayer player = event.player;
    World world = player.getEntityWorld();
    ItemStack stack = getDollWithHex(player, "water_walking");
    if (world.isRemote)
        return;
    if (stack != null) {
        BlockPos position = player.getPosition();
        Material mat = world.getBlockState(position).getMaterial();
        if (mat == Material.WATER) {
            float newY = position.getY() + 10.0F;
            player.setPosition(position.getX(), newY, position.getZ());
            VoodooCraft.log.info("Walking on water!");
        }
    }
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) BlockPos(net.minecraft.util.math.BlockPos) Material(net.minecraft.block.material.Material) World(net.minecraft.world.World) ItemStack(net.minecraft.item.ItemStack) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 23 with Material

use of net.minecraft.block.material.Material in project SecurityCraft by Geforce132.

the class ItemModifiedBucket method tryPlaceContainedLiquid.

/**
     * Attempts to place the liquid contained inside the bucket.
     */
public boolean tryPlaceContainedLiquid(World par1World, int par2, int par3, int par4) {
    if (this.isFull == Blocks.air) {
        return false;
    } else {
        Material material = par1World.getBlock(par2, par3, par4).getMaterial();
        boolean flag = !material.isSolid();
        if (!par1World.isAirBlock(par2, par3, par4) && !flag) {
            return false;
        } else {
            if (par1World.provider.isHellWorld && this.isFull == Blocks.flowing_water) {
                par1World.playSoundEffect(par2 + 0.5F, par3 + 0.5F, par4 + 0.5F, "random.fizz", 0.5F, 2.6F + (par1World.rand.nextFloat() - par1World.rand.nextFloat()) * 0.8F);
                for (int l = 0; l < 8; ++l) {
                    par1World.spawnParticle("largesmoke", par2 + Math.random(), par3 + Math.random(), par4 + Math.random(), 0.0D, 0.0D, 0.0D);
                }
            } else {
                if (!par1World.isRemote && flag && !material.isLiquid()) {
                    par1World.func_147480_a(par2, par3, par4, true);
                }
                par1World.setBlock(par2, par3, par4, this.isFull, 0, 3);
            }
            return true;
        }
    }
}
Also used : Material(net.minecraft.block.material.Material)

Example 24 with Material

use of net.minecraft.block.material.Material in project SecurityCraft by Geforce132.

the class ItemModifiedBucket method tryPlaceContainedLiquid.

/**
     * Attempts to place the liquid contained inside the bucket.
     */
public boolean tryPlaceContainedLiquid(World par1World, int par2, int par3, int par4) {
    if (this.isFull == Blocks.air) {
        return false;
    } else {
        Material material = par1World.getBlock(par2, par3, par4).getMaterial();
        boolean flag = !material.isSolid();
        if (!par1World.isAirBlock(par2, par3, par4) && !flag) {
            return false;
        } else {
            if (par1World.provider.isHellWorld && this.isFull == Blocks.flowing_water) {
                par1World.playSoundEffect((double) ((float) par2 + 0.5F), (double) ((float) par3 + 0.5F), (double) ((float) par4 + 0.5F), "random.fizz", 0.5F, 2.6F + (par1World.rand.nextFloat() - par1World.rand.nextFloat()) * 0.8F);
                for (int l = 0; l < 8; ++l) {
                    par1World.spawnParticle("largesmoke", (double) par2 + Math.random(), (double) par3 + Math.random(), (double) par4 + Math.random(), 0.0D, 0.0D, 0.0D);
                }
            } else {
                if (!par1World.isRemote && flag && !material.isLiquid()) {
                    par1World.func_147480_a(par2, par3, par4, true);
                }
                par1World.setBlock(par2, par3, par4, this.isFull, 0, 3);
            }
            return true;
        }
    }
}
Also used : Material(net.minecraft.block.material.Material)

Example 25 with Material

use of net.minecraft.block.material.Material in project SecurityCraft by Geforce132.

the class ItemModifiedBucket method tryPlaceContainedLiquid.

public boolean tryPlaceContainedLiquid(World worldIn, BlockPos pos) {
    if (this.containedBlock == Blocks.AIR) {
        return false;
    } else {
        Material material = worldIn.getBlockState(pos).getBlock().getMaterial(worldIn.getBlockState(pos));
        boolean flag = !material.isSolid();
        if (!worldIn.isAirBlock(pos) && !flag) {
            return false;
        } else {
            if (worldIn.provider.doesWaterVaporize() && this.containedBlock == Blocks.FLOWING_WATER) {
                int i = pos.getX();
                int j = pos.getY();
                int k = pos.getZ();
                for (EntityPlayer player : worldIn.playerEntities) {
                    worldIn.playSound(player, new BlockPos(i + 0.5F, j + 0.5F, k + 0.5F), SoundEvent.REGISTRY.getObject(new ResourceLocation("random.fizz")), SoundCategory.BLOCKS, 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);
                }
                for (int l = 0; l < 8; ++l) {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, i + Math.random(), j + Math.random(), k + Math.random(), 0.0D, 0.0D, 0.0D, new int[0]);
                }
            } else {
                if (!worldIn.isRemote && flag && !material.isLiquid()) {
                    worldIn.destroyBlock(pos, true);
                }
                worldIn.setBlockState(pos, this.containedBlock.getDefaultState(), 3);
            }
            return true;
        }
    }
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Material(net.minecraft.block.material.Material) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

Material (net.minecraft.block.material.Material)31 IBlockState (net.minecraft.block.state.IBlockState)11 Block (net.minecraft.block.Block)9 BlockPos (net.minecraft.util.math.BlockPos)9 BlockLiquid (net.minecraft.block.BlockLiquid)6 ItemStack (net.minecraft.item.ItemStack)6 World (net.minecraft.world.World)3 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 MovingObjectPosition (net.minecraft.util.MovingObjectPosition)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 DirectionalBlockPos (blusunrize.immersiveengineering.api.DirectionalBlockPos)1 IPos3D (com.builtbroken.jlib.data.vector.IPos3D)1 Location (com.builtbroken.mc.imp.transform.vector.Location)1 Pos (com.builtbroken.mc.imp.transform.vector.Pos)1 PlacementData (com.builtbroken.mc.lib.world.edit.PlacementData)1 FMLControlledNamespacedRegistry (cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry)1 EntityFlyingBlock (icbm.classic.content.entity.EntityFlyingBlock)1 ThreadLargeExplosion (icbm.classic.content.explosive.thread.ThreadLargeExplosion)1 IThreadCallBack (icbm.classic.content.explosive.thread.ThreadLargeExplosion.IThreadCallBack)1 MaterialNegativeSpace (ivorius.reccomplex.block.materials.MaterialNegativeSpace)1