本文整理汇总了Java中net.minecraft.block.material.Material.lava方法的典型用法代码示例。如果您正苦于以下问题:Java Material.lava方法的具体用法?Java Material.lava怎么用?Java Material.lava使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.material.Material
的用法示例。
在下文中一共展示了Material.lava方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tryFlowInto
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
private void tryFlowInto(World worldIn, BlockPos pos, IBlockState state, int level)
{
if (this.canFlowInto(worldIn, pos, state))
{
if (state.getBlock() != Blocks.air)
{
if (this.blockMaterial == Material.lava)
{
this.triggerMixEffects(worldIn, pos);
}
else
{
state.getBlock().dropBlockAsItem(worldIn, pos, state, 0);
}
}
worldIn.setBlockState(pos, this.getDefaultState().withProperty(LEVEL, Integer.valueOf(level)), 3);
}
}
示例2: BlockStaticLiquid
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
protected BlockStaticLiquid(Material materialIn)
{
super(materialIn);
this.setTickRandomly(false);
if (materialIn == Material.lava)
{
this.setTickRandomly(true);
}
}
示例3: tryFlowInto
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
private void tryFlowInto(World worldIn, BlockPos pos, IBlockState state, int level) {
if (this.canFlowInto(worldIn, pos, state)) {
if (state.getBlock() != Blocks.air) {
if (this.blockMaterial == Material.lava) {
this.triggerMixEffects(worldIn, pos);
} else {
state.getBlock().dropBlockAsItem(worldIn, pos, state, 0);
}
}
worldIn.setBlockState(pos, this.getDefaultState().withProperty(LEVEL, Integer.valueOf(level)), 3);
}
}
示例4: getStaticBlock
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public static BlockStaticLiquid getStaticBlock(Material materialIn) {
if (materialIn == Material.water) {
return Blocks.water;
} else if (materialIn == Material.lava) {
return Blocks.lava;
} else {
throw new IllegalArgumentException("Invalid material");
}
}
示例5: checkForMixing
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public boolean checkForMixing(World worldIn, BlockPos pos, IBlockState state)
{
if (this.blockMaterial == Material.lava)
{
boolean flag = false;
for (EnumFacing enumfacing : EnumFacing.values())
{
if (enumfacing != EnumFacing.DOWN && worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getMaterial() == Material.water)
{
flag = true;
break;
}
}
if (flag)
{
Integer integer = (Integer)state.getValue(LEVEL);
if (integer.intValue() == 0)
{
worldIn.setBlockState(pos, Blocks.obsidian.getDefaultState());
this.triggerMixEffects(worldIn, pos);
return true;
}
if (integer.intValue() <= 4)
{
worldIn.setBlockState(pos, Blocks.cobblestone.getDefaultState());
this.triggerMixEffects(worldIn, pos);
return true;
}
}
}
return false;
}
示例6: getFlowingBlock
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public static BlockDynamicLiquid getFlowingBlock(Material materialIn)
{
if (materialIn == Material.water)
{
return Blocks.flowing_water;
}
else if (materialIn == Material.lava)
{
return Blocks.flowing_lava;
}
else
{
throw new IllegalArgumentException("Invalid material");
}
}
示例7: updateTick
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
if (this.blockMaterial == Material.lava)
{
if (worldIn.getGameRules().getBoolean("doFireTick"))
{
int i = rand.nextInt(3);
if (i > 0)
{
BlockPos blockpos = pos;
for (int j = 0; j < i; ++j)
{
blockpos = blockpos.add(rand.nextInt(3) - 1, 1, rand.nextInt(3) - 1);
Block block = worldIn.getBlockState(blockpos).getBlock();
if (block.blockMaterial == Material.air)
{
if (this.isSurroundingBlockFlammable(worldIn, blockpos))
{
worldIn.setBlockState(blockpos, Blocks.fire.getDefaultState());
return;
}
}
else if (block.blockMaterial.blocksMovement())
{
return;
}
}
}
else
{
for (int k = 0; k < 3; ++k)
{
BlockPos blockpos1 = pos.add(rand.nextInt(3) - 1, 0, rand.nextInt(3) - 1);
if (worldIn.isAirBlock(blockpos1.up()) && this.getCanBlockBurn(worldIn, blockpos1))
{
worldIn.setBlockState(blockpos1.up(), Blocks.fire.getDefaultState());
}
}
}
}
}
}
示例8: canFlowInto
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
private boolean canFlowInto(World worldIn, BlockPos pos, IBlockState state)
{
Material material = state.getBlock().getMaterial();
return material != this.blockMaterial && material != Material.lava && !this.isBlocked(worldIn, pos, state);
}
示例9: addRainParticles
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
private void addRainParticles()
{
float f = this.mc.theWorld.getRainStrength(1.0F);
if (!Config.isRainFancy())
{
f /= 2.0F;
}
if (f != 0.0F && Config.isRainSplash())
{
this.random.setSeed((long)this.rendererUpdateCount * 312987231L);
Entity entity = this.mc.getRenderViewEntity();
WorldClient worldclient = this.mc.theWorld;
BlockPos blockpos = new BlockPos(entity);
byte b0 = 10;
double d0 = 0.0D;
double d1 = 0.0D;
double d2 = 0.0D;
int i = 0;
int j = (int)(100.0F * f * f);
if (this.mc.gameSettings.particleSetting == 1)
{
j >>= 1;
}
else if (this.mc.gameSettings.particleSetting == 2)
{
j = 0;
}
for (int k = 0; k < j; ++k)
{
BlockPos blockpos1 = worldclient.getPrecipitationHeight(blockpos.add(this.random.nextInt(b0) - this.random.nextInt(b0), 0, this.random.nextInt(b0) - this.random.nextInt(b0)));
BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(blockpos1);
BlockPos blockpos2 = blockpos1.down();
Block block = worldclient.getBlockState(blockpos2).getBlock();
if (blockpos1.getY() <= blockpos.getY() + b0 && blockpos1.getY() >= blockpos.getY() - b0 && biomegenbase.canSpawnLightningBolt() && biomegenbase.getFloatTemperature(blockpos1) >= 0.15F)
{
double d3 = this.random.nextDouble();
double d4 = this.random.nextDouble();
if (block.getMaterial() == Material.lava)
{
this.mc.theWorld.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)blockpos1.getX() + d3, (double)((float)blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(), (double)blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
}
else if (block.getMaterial() != Material.air)
{
block.setBlockBoundsBasedOnState(worldclient, blockpos2);
++i;
if (this.random.nextInt(i) == 0)
{
d0 = (double)blockpos2.getX() + d3;
d1 = (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY() - 1.0D;
d2 = (double)blockpos2.getZ() + d4;
}
this.mc.theWorld.spawnParticle(EnumParticleTypes.WATER_DROP, (double)blockpos2.getX() + d3, (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY(), (double)blockpos2.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
}
}
}
if (i > 0 && this.random.nextInt(3) < this.rainSoundCounter++)
{
this.rainSoundCounter = 0;
if (d1 > (double)(blockpos.getY() + 1) && worldclient.getPrecipitationHeight(blockpos).getY() > MathHelper.floor_float((float)blockpos.getY()))
{
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false);
}
else
{
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false);
}
}
}
}
示例10: onUpdate
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
if (this.getEntityItem() == null)
{
this.setDead();
}
else
{
super.onUpdate();
if (this.delayBeforeCanPickup > 0 && this.delayBeforeCanPickup != 32767)
{
--this.delayBeforeCanPickup;
}
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.motionY -= 0.03999999910593033D;
this.noClip = this.pushOutOfBlocks(this.posX, (this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY) / 2.0D, this.posZ);
this.moveEntity(this.motionX, this.motionY, this.motionZ);
boolean flag = (int)this.prevPosX != (int)this.posX || (int)this.prevPosY != (int)this.posY || (int)this.prevPosZ != (int)this.posZ;
if (flag || this.ticksExisted % 25 == 0)
{
if (this.worldObj.getBlockState(new BlockPos(this)).getBlock().getMaterial() == Material.lava)
{
this.motionY = 0.20000000298023224D;
this.motionX = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
this.motionZ = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
this.playSound("random.fizz", 0.4F, 2.0F + this.rand.nextFloat() * 0.4F);
}
if (!this.worldObj.isRemote)
{
this.searchForOtherItemsNearby();
}
}
float f = 0.98F;
if (this.onGround)
{
f = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.getEntityBoundingBox().minY) - 1, MathHelper.floor_double(this.posZ))).getBlock().slipperiness * 0.98F;
}
this.motionX *= (double)f;
this.motionY *= 0.9800000190734863D;
this.motionZ *= (double)f;
if (this.onGround)
{
this.motionY *= -0.5D;
}
if (this.age != -32768)
{
++this.age;
}
this.handleWaterMovement();
if (!this.worldObj.isRemote && this.age >= 6000)
{
this.setDead();
}
}
}
示例11: tickRate
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
/**
* How many world ticks before ticking
*/
public int tickRate(World worldIn)
{
return this.blockMaterial == Material.water ? 5 : (this.blockMaterial == Material.lava ? (worldIn.provider.getHasNoSky() ? 10 : 30) : 0);
}
示例12: addRainParticles
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
private void addRainParticles() {
float f = this.mc.theWorld.getRainStrength(1.0F);
if (!Config.isRainFancy()) {
f /= 2.0F;
}
if (f != 0.0F && Config.isRainSplash()) {
this.random.setSeed((long) this.rendererUpdateCount * 312987231L);
Entity entity = this.mc.getRenderViewEntity();
WorldClient worldclient = this.mc.theWorld;
BlockPos blockpos = new BlockPos(entity);
byte b0 = 10;
double d0 = 0.0D;
double d1 = 0.0D;
double d2 = 0.0D;
int i = 0;
int j = (int) (100.0F * f * f);
if (this.mc.gameSettings.particleSetting == 1) {
j >>= 1;
} else if (this.mc.gameSettings.particleSetting == 2) {
j = 0;
}
for (int k = 0; k < j; ++k) {
BlockPos blockpos1 = worldclient
.getPrecipitationHeight(blockpos.add(this.random.nextInt(b0) - this.random.nextInt(b0), 0,
this.random.nextInt(b0) - this.random.nextInt(b0)));
BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(blockpos1);
BlockPos blockpos2 = blockpos1.down();
Block block = worldclient.getBlockState(blockpos2).getBlock();
if (blockpos1.getY() <= blockpos.getY() + b0 && blockpos1.getY() >= blockpos.getY() - b0
&& biomegenbase.canSpawnLightningBolt()
&& biomegenbase.getFloatTemperature(blockpos1) >= 0.15F) {
double d3 = this.random.nextDouble();
double d4 = this.random.nextDouble();
if (block.getMaterial() == Material.lava) {
this.mc.theWorld.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double) blockpos1.getX() + d3,
(double) ((float) blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(),
(double) blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
} else if (block.getMaterial() != Material.air) {
block.setBlockBoundsBasedOnState(worldclient, blockpos2);
++i;
if (this.random.nextInt(i) == 0) {
d0 = (double) blockpos2.getX() + d3;
d1 = (double) ((float) blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY() - 1.0D;
d2 = (double) blockpos2.getZ() + d4;
}
this.mc.theWorld.spawnParticle(EnumParticleTypes.WATER_DROP, (double) blockpos2.getX() + d3,
(double) ((float) blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY(),
(double) blockpos2.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
}
}
}
if (i > 0 && this.random.nextInt(3) < this.rainSoundCounter++) {
this.rainSoundCounter = 0;
if (d1 > (double) (blockpos.getY() + 1) && worldclient.getPrecipitationHeight(blockpos)
.getY() > MathHelper.floor_float((float) blockpos.getY())) {
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false);
} else {
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false);
}
}
}
}
示例13: 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]);
}
}
}
}
示例14: onItemRightClick
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
{
boolean flag = this.isFull == Blocks.air;
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(worldIn, playerIn, flag);
if (movingobjectposition == null)
{
return itemStackIn;
}
else
{
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
BlockPos blockpos = movingobjectposition.getBlockPos();
if (!worldIn.isBlockModifiable(playerIn, blockpos))
{
return itemStackIn;
}
if (flag)
{
if (!playerIn.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, itemStackIn))
{
return itemStackIn;
}
IBlockState iblockstate = worldIn.getBlockState(blockpos);
Material material = iblockstate.getBlock().getMaterial();
if (material == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0)
{
worldIn.setBlockToAir(blockpos);
playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
return this.fillBucket(itemStackIn, playerIn, Items.water_bucket);
}
if (material == Material.lava && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0)
{
worldIn.setBlockToAir(blockpos);
playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
return this.fillBucket(itemStackIn, playerIn, Items.lava_bucket);
}
}
else
{
if (this.isFull == Blocks.air)
{
return new ItemStack(Items.bucket);
}
BlockPos blockpos1 = blockpos.offset(movingobjectposition.sideHit);
if (!playerIn.canPlayerEdit(blockpos1, movingobjectposition.sideHit, itemStackIn))
{
return itemStackIn;
}
if (this.tryPlaceContainedLiquid(worldIn, blockpos1) && !playerIn.capabilities.isCreativeMode)
{
playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
return new ItemStack(Items.bucket);
}
}
}
return itemStackIn;
}
}
示例15: tickRate
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
/**
* How many world ticks before ticking
*/
public int tickRate(World worldIn) {
return this.blockMaterial == Material.water ? 5
: (this.blockMaterial == Material.lava ? (worldIn.provider.getHasNoSky() ? 10 : 30) : 0);
}