本文整理汇总了Java中net.minecraft.block.material.Material.isLiquid方法的典型用法代码示例。如果您正苦于以下问题:Java Material.isLiquid方法的具体用法?Java Material.isLiquid怎么用?Java Material.isLiquid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.material.Material
的用法示例。
在下文中一共展示了Material.isLiquid方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isSafe
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public boolean isSafe(World worldIn)
{
BlockPos blockpos = new BlockPos(this.x, 256.0D, this.z);
while (blockpos.getY() > 0)
{
blockpos = blockpos.down();
Material material = worldIn.getBlockState(blockpos).getMaterial();
if (material != Material.AIR)
{
return !material.isLiquid() && material != Material.FIRE;
}
}
return false;
}
示例2: func_111098_b
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public boolean func_111098_b(World worldIn)
{
BlockPos blockpos = new BlockPos(this.field_111101_a, 256.0D, this.field_111100_b);
while (blockpos.getY() > 0)
{
blockpos = blockpos.down();
Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial();
if (material != Material.air)
{
return !material.isLiquid() && material != Material.fire;
}
}
return false;
}
示例3: harvestBlock
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
player.addExhaustion(0.025F);
if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player))
{
ItemStack itemstack = this.createStackedBlock(state);
if (itemstack != null)
{
spawnAsEntity(worldIn, pos, itemstack);
}
}
else
{
if (worldIn.provider.doesWaterVaporize())
{
worldIn.setBlockToAir(pos);
return;
}
int i = EnchantmentHelper.getFortuneModifier(player);
this.dropBlockAsItem(worldIn, pos, state, i);
Material material = worldIn.getBlockState(pos.down()).getBlock().getMaterial();
if (material.blocksMovement() || material.isLiquid())
{
worldIn.setBlockState(pos, Blocks.flowing_water.getDefaultState());
}
}
}
示例4: harvestBlock
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, @Nullable ItemStack stack)
{
player.addStat(StatList.getBlockStats(this));
player.addExhaustion(0.025F);
if (this.canSilkHarvest(worldIn, pos, state, player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, stack) > 0)
{
java.util.List<ItemStack> items = new java.util.ArrayList<ItemStack>();
ItemStack itemstack = this.createStackedBlock(state);
if (itemstack != null)
{
items.add(itemstack);
}
net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, 0, 1.0f, true, player);
for (ItemStack is : items)
spawnAsEntity(worldIn, pos, is);
}
else
{
if (worldIn.provider.doesWaterVaporize())
{
worldIn.setBlockToAir(pos);
return;
}
int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, stack);
harvesters.set(player);
this.dropBlockAsItem(worldIn, pos, state, i);
harvesters.set(null);
Material material = worldIn.getBlockState(pos.down()).getMaterial();
if (material.blocksMovement() || material.isLiquid())
{
worldIn.setBlockState(pos, Blocks.FLOWING_WATER.getDefaultState());
}
}
}
示例5: tryPlaceContainedLiquid
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public boolean tryPlaceContainedLiquid(World worldIn, BlockPos pos)
{
if (this.isFull == Blocks.air)
{
return false;
}
else
{
Material material = worldIn.getBlockState(pos).getBlock().getMaterial();
boolean flag = !material.isSolid();
if (!worldIn.isAirBlock(pos) && !flag)
{
return false;
}
else
{
if (worldIn.provider.doesWaterVaporize() && this.isFull == Blocks.flowing_water)
{
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
worldIn.playSoundEffect((double)((float)i + 0.5F), (double)((float)j + 0.5F), (double)((float)k + 0.5F), "random.fizz", 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);
for (int l = 0; l < 8; ++l)
{
worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double)i + Math.random(), (double)j + Math.random(), (double)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.isFull.getDefaultState(), 3);
}
return true;
}
}
}
示例6: randomDisplayTick
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
double d0 = (double)pos.getX();
double d1 = (double)pos.getY();
double d2 = (double)pos.getZ();
if (this.blockMaterial == Material.water)
{
int i = ((Integer)state.getValue(LEVEL)).intValue();
if (i > 0 && i < 8)
{
if (rand.nextInt(64) == 0)
{
worldIn.playSound(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, "liquid.water", rand.nextFloat() * 0.25F + 0.75F, rand.nextFloat() * 1.0F + 0.5F, false);
}
}
else if (rand.nextInt(10) == 0)
{
worldIn.spawnParticle(EnumParticleTypes.SUSPENDED, d0 + (double)rand.nextFloat(), d1 + (double)rand.nextFloat(), d2 + (double)rand.nextFloat(), 0.0D, 0.0D, 0.0D, new int[0]);
}
}
if (this.blockMaterial == Material.lava && worldIn.getBlockState(pos.up()).getBlock().getMaterial() == Material.air && !worldIn.getBlockState(pos.up()).getBlock().isOpaqueCube())
{
if (rand.nextInt(100) == 0)
{
double d8 = d0 + (double)rand.nextFloat();
double d4 = d1 + this.maxY;
double d6 = d2 + (double)rand.nextFloat();
worldIn.spawnParticle(EnumParticleTypes.LAVA, d8, d4, d6, 0.0D, 0.0D, 0.0D, new int[0]);
worldIn.playSound(d8, d4, d6, "liquid.lavapop", 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false);
}
if (rand.nextInt(200) == 0)
{
worldIn.playSound(d0, d1, d2, "liquid.lava", 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false);
}
}
if (rand.nextInt(10) == 0 && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()))
{
Material material = worldIn.getBlockState(pos.down(2)).getBlock().getMaterial();
if (!material.blocksMovement() && !material.isLiquid())
{
double d3 = d0 + (double)rand.nextFloat();
double d5 = d1 - 1.05D;
double d7 = d2 + (double)rand.nextFloat();
if (this.blockMaterial == Material.water)
{
worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d3, d5, d7, 0.0D, 0.0D, 0.0D, new int[0]);
}
else
{
worldIn.spawnParticle(EnumParticleTypes.DRIP_LAVA, d3, d5, d7, 0.0D, 0.0D, 0.0D, new int[0]);
}
}
}
}
示例7: onUpdate
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.motionY -= (double)this.particleGravity;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if (this.particleMaxAge-- <= 0)
{
this.setDead();
}
if (this.onGround)
{
if (Math.random() < 0.5D)
{
this.setDead();
}
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
BlockPos blockpos = new BlockPos(this);
IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
Block block = iblockstate.getBlock();
block.setBlockBoundsBasedOnState(this.worldObj, blockpos);
Material material = iblockstate.getBlock().getMaterial();
if (material.isLiquid() || material.isSolid())
{
double d0 = 0.0D;
if (iblockstate.getBlock() instanceof BlockLiquid)
{
d0 = (double)(1.0F - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()));
}
else
{
d0 = block.getBlockBoundsMaxY();
}
double d1 = (double)MathHelper.floor_double(this.posY) + d0;
if (this.posY < d1)
{
this.setDead();
}
}
}
示例8: randomDisplayTick
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
double d0 = (double)pos.getX();
double d1 = (double)pos.getY();
double d2 = (double)pos.getZ();
if (this.blockMaterial == Material.WATER)
{
int i = ((Integer)stateIn.getValue(LEVEL)).intValue();
if (i > 0 && i < 8)
{
if (rand.nextInt(64) == 0)
{
worldIn.playSound(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, SoundEvents.BLOCK_WATER_AMBIENT, SoundCategory.BLOCKS, rand.nextFloat() * 0.25F + 0.75F, rand.nextFloat() + 0.5F, false);
}
}
else if (rand.nextInt(10) == 0)
{
worldIn.spawnParticle(EnumParticleTypes.SUSPENDED, d0 + (double)rand.nextFloat(), d1 + (double)rand.nextFloat(), d2 + (double)rand.nextFloat(), 0.0D, 0.0D, 0.0D, new int[0]);
}
}
if (this.blockMaterial == Material.LAVA && worldIn.getBlockState(pos.up()).getMaterial() == Material.AIR && !worldIn.getBlockState(pos.up()).isOpaqueCube())
{
if (rand.nextInt(100) == 0)
{
double d8 = d0 + (double)rand.nextFloat();
double d4 = d1 + stateIn.getBoundingBox(worldIn, pos).maxY;
double d6 = d2 + (double)rand.nextFloat();
worldIn.spawnParticle(EnumParticleTypes.LAVA, d8, d4, d6, 0.0D, 0.0D, 0.0D, new int[0]);
worldIn.playSound(d8, d4, d6, SoundEvents.BLOCK_LAVA_POP, SoundCategory.BLOCKS, 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false);
}
if (rand.nextInt(200) == 0)
{
worldIn.playSound(d0, d1, d2, SoundEvents.BLOCK_LAVA_AMBIENT, SoundCategory.BLOCKS, 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false);
}
}
if (rand.nextInt(10) == 0 && worldIn.getBlockState(pos.down()).isFullyOpaque())
{
Material material = worldIn.getBlockState(pos.down(2)).getMaterial();
if (!material.blocksMovement() && !material.isLiquid())
{
double d3 = d0 + (double)rand.nextFloat();
double d5 = d1 - 1.05D;
double d7 = d2 + (double)rand.nextFloat();
if (this.blockMaterial == Material.WATER)
{
worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d3, d5, d7, 0.0D, 0.0D, 0.0D, new int[0]);
}
else
{
worldIn.spawnParticle(EnumParticleTypes.DRIP_LAVA, d3, d5, d7, 0.0D, 0.0D, 0.0D, new int[0]);
}
}
}
}
示例9: tryPlaceFluid
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
/**
* Tries to place a fluid in the world in block form.
* Makes a fluid emptying sound when successful.
* Checks if water-like fluids should vaporize like in the nether.
*
* Modeled after {@link net.minecraft.item.ItemBucket#tryPlaceContainedLiquid(EntityPlayer, World, BlockPos)}
*
* @param player Player who places the fluid. May be null for blocks like dispensers.
* @param worldIn World to place the fluid in
* @param fluidStack The fluidStack to place.
* @param pos The position in the world to place the fluid block
* @return true if successful
*/
public static boolean tryPlaceFluid(@Nullable EntityPlayer player, World worldIn, FluidStack fluidStack, BlockPos pos)
{
if (worldIn == null || fluidStack == null || pos == null)
{
return false;
}
Fluid fluid = fluidStack.getFluid();
if (fluid == null || !fluid.canBePlacedInWorld())
{
return false;
}
// check that we can place the fluid at the destination
IBlockState destBlockState = worldIn.getBlockState(pos);
Material destMaterial = destBlockState.getMaterial();
boolean isDestNonSolid = !destMaterial.isSolid();
boolean isDestReplaceable = destBlockState.getBlock().isReplaceable(worldIn, pos);
if (!worldIn.isAirBlock(pos) && !isDestNonSolid && !isDestReplaceable)
{
return false; // Non-air, solid, unreplacable block. We can't put fluid here.
}
if (worldIn.provider.doesWaterVaporize() && fluid.doesVaporize(fluidStack))
{
fluid.vaporize(player, worldIn, pos, fluidStack);
}
else
{
if (!worldIn.isRemote && (isDestNonSolid || isDestReplaceable) && !destMaterial.isLiquid())
{
worldIn.destroyBlock(pos, true);
}
SoundEvent soundevent = fluid.getEmptySound(fluidStack);
worldIn.playSound(player, pos, soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F);
IBlockState fluidBlockState = fluid.getBlock().getDefaultState();
worldIn.setBlockState(pos, fluidBlockState, 11);
}
return true;
}
示例10: onUpdate
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.motionY -= (double)this.particleGravity;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if (this.particleMaxAge-- <= 0)
{
this.setExpired();
}
if (this.isCollided)
{
if (Math.random() < 0.5D)
{
this.setExpired();
}
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
Material material = iblockstate.getMaterial();
if (material.isLiquid() || material.isSolid())
{
double d0;
if (iblockstate.getBlock() instanceof BlockLiquid)
{
d0 = (double)(1.0F - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()));
}
else
{
d0 = iblockstate.getBoundingBox(this.worldObj, blockpos).maxY;
}
double d1 = (double)MathHelper.floor_double(this.posY) + d0;
if (this.posY < d1)
{
this.setExpired();
}
}
}
示例11: tryPlaceContainedLiquid
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public boolean tryPlaceContainedLiquid(@Nullable EntityPlayer player, World worldIn, BlockPos posIn)
{
if (this.containedBlock == Blocks.AIR)
{
return false;
}
else
{
IBlockState iblockstate = worldIn.getBlockState(posIn);
Material material = iblockstate.getMaterial();
boolean flag = !material.isSolid();
boolean flag1 = iblockstate.getBlock().isReplaceable(worldIn, posIn);
if (!worldIn.isAirBlock(posIn) && !flag && !flag1)
{
return false;
}
else
{
if (worldIn.provider.doesWaterVaporize() && this.containedBlock == Blocks.FLOWING_WATER)
{
int l = posIn.getX();
int i = posIn.getY();
int j = posIn.getZ();
worldIn.playSound(player, posIn, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);
for (int k = 0; k < 8; ++k)
{
worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double)l + Math.random(), (double)i + Math.random(), (double)j + Math.random(), 0.0D, 0.0D, 0.0D, new int[0]);
}
}
else
{
if (!worldIn.isRemote && (flag || flag1) && !material.isLiquid())
{
worldIn.destroyBlock(posIn, true);
}
SoundEvent soundevent = this.containedBlock == Blocks.FLOWING_LAVA ? SoundEvents.ITEM_BUCKET_EMPTY_LAVA : SoundEvents.ITEM_BUCKET_EMPTY;
worldIn.playSound(player, posIn, soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F);
worldIn.setBlockState(posIn, this.containedBlock.getDefaultState(), 11);
}
return true;
}
}
}
示例12: onUpdate
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.materialType == Material.WATER)
{
this.particleRed = 0.2F;
this.particleGreen = 0.3F;
this.particleBlue = 1.0F;
}
else
{
this.particleRed = 1.0F;
this.particleGreen = 16.0F / (float)(40 - this.bobTimer + 16);
this.particleBlue = 4.0F / (float)(40 - this.bobTimer + 8);
}
this.motionY -= (double)this.particleGravity;
if (this.bobTimer-- > 0)
{
this.motionX *= 0.02D;
this.motionY *= 0.02D;
this.motionZ *= 0.02D;
this.setParticleTextureIndex(113);
}
else
{
this.setParticleTextureIndex(112);
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if (this.particleMaxAge-- <= 0)
{
this.setExpired();
}
if (this.isCollided)
{
if (this.materialType == Material.WATER)
{
this.setExpired();
this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
}
else
{
this.setParticleTextureIndex(114);
}
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
Material material = iblockstate.getMaterial();
if (material.isLiquid() || material.isSolid())
{
double d0 = 0.0D;
if (iblockstate.getBlock() instanceof BlockLiquid)
{
d0 = (double)BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue());
}
double d1 = (double)(MathHelper.floor_double(this.posY) + 1) - d0;
if (this.posY < d1)
{
this.setExpired();
}
}
}