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"));
}
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!");
}
}
}
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;
}
}
}
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;
}
}
}
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;
}
}
}
Aggregations