本文整理汇总了Java中net.minecraft.block.material.Material.blocksMovement方法的典型用法代码示例。如果您正苦于以下问题:Java Material.blocksMovement方法的具体用法?Java Material.blocksMovement怎么用?Java Material.blocksMovement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.material.Material
的用法示例。
在下文中一共展示了Material.blocksMovement方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTopSolidOrLiquidBlock
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
/**
* Finds the highest block on the x and z coordinate that is solid or liquid, and returns its y coord.
*/
public BlockPos getTopSolidOrLiquidBlock(BlockPos pos)
{
Chunk chunk = this.getChunkFromBlockCoords(pos);
BlockPos blockpos;
BlockPos blockpos1;
for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1)
{
blockpos1 = blockpos.down();
Material material = chunk.getBlock(blockpos1).getMaterial();
if (material.blocksMovement() && material != Material.leaves)
{
break;
}
}
return blockpos;
}
示例2: canGoThrough
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
private boolean canGoThrough(BlockPos pos)
{
// check if loaded
if(!WMinecraft.getWorld().isBlockLoaded(pos, false))
return false;
// check if solid
Material material = WBlock.getMaterial(pos);
Block block = WBlock.getBlock(pos);
if(material.blocksMovement() && !(block instanceof BlockSign))
return false;
// check if trapped
if(block instanceof BlockTripWire
|| block instanceof BlockPressurePlate)
return false;
// check if safe
if(!invulnerable
&& (material == Material.LAVA || material == Material.FIRE))
return false;
return true;
}
示例3: getTopSolidOrLiquidBlock
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
/**
* Finds the highest block on the x and z coordinate that is solid or liquid, and returns its y coord.
*/
public BlockPos getTopSolidOrLiquidBlock(BlockPos pos)
{
Chunk chunk = this.getChunkFromBlockCoords(pos);
BlockPos blockpos;
BlockPos blockpos1;
for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1)
{
blockpos1 = blockpos.down();
Material material = chunk.getBlockState(blockpos1).getMaterial();
if (material.blocksMovement() && material != Material.LEAVES)
{
break;
}
}
return blockpos;
}
示例4: 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());
}
}
}
示例5: canBeSolid
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
protected boolean canBeSolid(BlockPos pos)
{
Material material = WBlock.getMaterial(pos);
Block block = WBlock.getBlock(pos);
return material.blocksMovement() && !(block instanceof BlockSign)
|| block instanceof BlockLadder || jesus
&& (material == Material.WATER || material == Material.LAVA);
}
示例6: harvestBlock
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack)
{
player.addStat(StatList.getBlockStats(this));
player.addExhaustion(0.005F);
if (this.canSilkHarvest() && EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, stack) > 0)
{
spawnAsEntity(worldIn, pos, this.getSilkTouchDrop(state));
}
else
{
if (worldIn.provider.doesWaterVaporize())
{
worldIn.setBlockToAir(pos);
return;
}
int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, stack);
this.dropBlockAsItem(worldIn, pos, state, i);
Material material = worldIn.getBlockState(pos.down()).getMaterial();
if (material.blocksMovement() || material.isLiquid())
{
worldIn.setBlockState(pos, Blocks.FLOWING_WATER.getDefaultState());
}
}
}
示例7: canDisplace
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
/**
* Returns true if the block at (pos) is displaceable. Does not displace the block.
*/
public boolean canDisplace(IBlockAccess world, BlockPos pos)
{
if (world.isAirBlock(pos)) return true;
IBlockState state = world.getBlockState(pos);
if (state.getBlock() == this)
{
return false;
}
if (displacements.containsKey(state.getBlock()))
{
return displacements.get(state.getBlock());
}
Material material = state.getMaterial();
if (material.blocksMovement() || material == Material.PORTAL)
{
return false;
}
int density = getDensity(world, pos);
if (density == Integer.MAX_VALUE)
{
return true;
}
if (this.density > density)
{
return true;
}
else
{
return false;
}
}
示例8: canFlowInto
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
protected boolean canFlowInto(IBlockAccess world, BlockPos pos)
{
if (world.isAirBlock(pos)) return true;
IBlockState state = world.getBlockState(pos);
if (state.getBlock() == this)
{
return true;
}
if (displacements.containsKey(state.getBlock()))
{
return displacements.get(state.getBlock());
}
Material material = state.getMaterial();
if (material.blocksMovement() ||
material == Material.WATER ||
material == Material.LAVA ||
material == Material.PORTAL)
{
return false;
}
int density = getDensity(world, pos);
if (density == Integer.MAX_VALUE)
{
return true;
}
if (this.density > density)
{
return true;
}
else
{
return false;
}
}
示例9: 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());
}
}
}
示例10: 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]);
}
}
}
}
示例11: 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]);
}
}
}
}
示例12: 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]);
}
}
}
}
示例13: randomDisplayTick
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
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]);
}
}
}
}
示例14: displaceIfPossible
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
/**
* Attempt to displace the block at (pos), return true if it was displaced.
*/
public boolean displaceIfPossible(World world, BlockPos pos)
{
if (world.isAirBlock(pos))
{
return true;
}
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();
if (block == this)
{
return false;
}
if (displacements.containsKey(block))
{
if (displacements.get(block))
{
if (state.getBlock() != Blocks.SNOW_LAYER) //Forge: Vanilla has a 'bug' where snowballs don't drop like every other block. So special case because ewww...
block.dropBlockAsItem(world, pos, state, 0);
return true;
}
return false;
}
Material material = state.getMaterial();
if (material.blocksMovement() || material == Material.PORTAL)
{
return false;
}
int density = getDensity(world, pos);
if (density == Integer.MAX_VALUE)
{
block.dropBlockAsItem(world, pos, state, 0);
return true;
}
if (this.density > density)
{
return true;
}
else
{
return false;
}
}