本文整理汇总了Java中net.minecraft.block.material.Material.water方法的典型用法代码示例。如果您正苦于以下问题:Java Material.water方法的具体用法?Java Material.water怎么用?Java Material.water使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.material.Material
的用法示例。
在下文中一共展示了Material.water方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generatePillar
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
private static void generatePillar(World world, int x, int y, int z, Block block, int meta) {
for (int i = 1; i <= 5; i++)
generatePillarSection(world, x, y - i, z, block, meta);
y -= 5;
for (; y >= 0; y--) {
generatePillarSection(world, x, y, z, block, meta);
for (int i = 0; i < 4; i++)
for (int k = 0; k < 4; k++)
if (world.getBlock(x + i, y, z).getMaterial() != Material.water && y > 3) {
generatePillarSection(world, x, y - 1, z, block, meta);
generatePillarSection(world, x, y - 2, z, block, meta);
return;
}
}
}
示例2: 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;
}
示例3: canPlaceBlockAt
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
Block block = worldIn.getBlockState(pos.down()).getBlock();
if (block == this)
{
return true;
}
else if (block != Blocks.grass && block != Blocks.dirt && block != Blocks.sand)
{
return false;
}
else
{
for (Object enumfacing0 : EnumFacing.Plane.HORIZONTAL)
{
EnumFacing enumfacing = (EnumFacing) enumfacing0;
if (worldIn.getBlockState(pos.offset(enumfacing).down()).getBlock().getMaterial() == Material.water)
{
return true;
}
}
return false;
}
}
示例4: updateFallState
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos)
{
if (onGroundIn)
{
if (this.fallDistance > 3.0F)
{
this.fall(this.fallDistance, 1.0F);
if (!this.worldObj.isRemote && !this.isDead)
{
this.setDead();
if (this.worldObj.getGameRules().getBoolean("doEntityDrops"))
{
for (int i = 0; i < 3; ++i)
{
this.dropItemWithOffset(Item.getItemFromBlock(Blocks.planks), 1, 0.0F);
}
for (int j = 0; j < 2; ++j)
{
this.dropItemWithOffset(Items.stick, 1, 0.0F);
}
}
}
this.fallDistance = 0.0F;
}
}
else if (this.worldObj.getBlockState((new BlockPos(this)).down()).getBlock().getMaterial() != Material.water && y < 0.0D)
{
this.fallDistance = (float)((double)this.fallDistance - y);
}
}
示例5: 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");
}
}
示例6: hasWater
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
private boolean hasWater(World worldIn, BlockPos pos)
{
for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(pos.add(-4, 0, -4), pos.add(4, 1, 4)))
{
if (worldIn.getBlockState(blockpos$mutableblockpos).getBlock().getMaterial() == Material.water)
{
return true;
}
}
return false;
}
示例7: canBlockStay
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
if (pos.getY() >= 0 && pos.getY() < 256)
{
IBlockState iblockstate = worldIn.getBlockState(pos.down());
return iblockstate.getBlock().getMaterial() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0;
}
else
{
return false;
}
}
示例8: generate
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public boolean generate(World worldIn, Random rand, BlockPos position)
{
if (worldIn.getBlockState(position).getBlock().getMaterial() != Material.water)
{
return false;
}
else
{
int i = rand.nextInt(this.radius - 2) + 2;
int j = 2;
for (int k = position.getX() - i; k <= position.getX() + i; ++k)
{
for (int l = position.getZ() - i; l <= position.getZ() + i; ++l)
{
int i1 = k - position.getX();
int j1 = l - position.getZ();
if (i1 * i1 + j1 * j1 <= i * i)
{
for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1)
{
BlockPos blockpos = new BlockPos(k, k1, l);
Block block = worldIn.getBlockState(blockpos).getBlock();
if (block == Blocks.dirt || block == Blocks.grass)
{
worldIn.setBlockState(blockpos, this.block.getDefaultState(), 2);
}
}
}
}
}
return true;
}
}
示例9: generate
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public boolean generate(World worldIn, Random rand, BlockPos position)
{
if (worldIn.getBlockState(position).getBlock().getMaterial() != Material.water)
{
return false;
}
else
{
int i = rand.nextInt(this.numberOfBlocks - 2) + 2;
int j = 1;
for (int k = position.getX() - i; k <= position.getX() + i; ++k)
{
for (int l = position.getZ() - i; l <= position.getZ() + i; ++l)
{
int i1 = k - position.getX();
int j1 = l - position.getZ();
if (i1 * i1 + j1 * j1 <= i * i)
{
for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1)
{
BlockPos blockpos = new BlockPos(k, k1, l);
Block block = worldIn.getBlockState(blockpos).getBlock();
if (block == Blocks.dirt || block == Blocks.clay)
{
worldIn.setBlockState(blockpos, this.field_150546_a.getDefaultState(), 2);
}
}
}
}
}
return true;
}
}
示例10: getFluidColor
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
public static int getFluidColor(Block p_getFluidColor_0_, IBlockAccess p_getFluidColor_1_, BlockPos p_getFluidColor_2_)
{
return p_getFluidColor_0_.getMaterial() != Material.water ? p_getFluidColor_0_.colorMultiplier(p_getFluidColor_1_, p_getFluidColor_2_) : (waterColors != null ? (Config.isSmoothBiomes() ? getSmoothColor(waterColors, p_getFluidColor_1_, (double)p_getFluidColor_2_.getX(), (double)p_getFluidColor_2_.getY(), (double)p_getFluidColor_2_.getZ(), 3, 1) : getCustomColor(waterColors, p_getFluidColor_1_, p_getFluidColor_2_)) : (!Config.isSwampColors() ? 16777215 : p_getFluidColor_0_.colorMultiplier(p_getFluidColor_1_, p_getFluidColor_2_)));
}
示例11: 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)
{
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(worldIn, playerIn, true);
if (movingobjectposition == null)
{
return itemStackIn;
}
else
{
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
BlockPos blockpos = movingobjectposition.getBlockPos();
if (!worldIn.isBlockModifiable(playerIn, blockpos))
{
return itemStackIn;
}
if (!playerIn.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, itemStackIn))
{
return itemStackIn;
}
if (worldIn.getBlockState(blockpos).getBlock().getMaterial() == Material.water)
{
--itemStackIn.stackSize;
playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
if (itemStackIn.stackSize <= 0)
{
return new ItemStack(Items.potionitem);
}
if (!playerIn.inventory.addItemStackToInventory(new ItemStack(Items.potionitem)))
{
playerIn.dropPlayerItemWithRandomChoice(new ItemStack(Items.potionitem, 1, 0), false);
}
}
}
return itemStackIn;
}
}
示例12: onImpact
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
@Override
public void onImpact(MovingObjectPosition target)
{
if (target.entityHit != null) // We hit a living thing!
{
// Damage
target.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.shootingEntity), (float)this.damage);
target.entityHit.hurtResistantTime = 0; // No immunity frames
this.targetsHit += 1; // Punched through one more entity
// Bonus
EntityLightningBolt bolt = new EntityLightningBolt(this.worldObj, target.entityHit.posX, target.entityHit.posY, target.entityHit.posZ);
this.worldObj.addWeatherEffect(bolt);
}
else
{
// Let's blast through terrain on hit
int x = target.blockX;
int y = target.blockY;
int z = target.blockZ;
Block toBeBroken = this.worldObj.getBlock(x, y, z);
int meta = this.worldObj.getBlockMetadata(x, y, z);
boolean breakThis = true;
if (toBeBroken.getHarvestLevel(meta) > 1)
{
breakThis = false;
this.targetsHit += 1; // Thicker materials
}
if (toBeBroken.getHarvestLevel(meta) > 2)
{
breakThis = false;
this.targetsHit += 2; // Even thicker materials
}
if (toBeBroken.getHarvestLevel(meta) > 3)
{
breakThis = false;
this.targetsHit += 3; // Super thick material
}
if (toBeBroken.getMaterial() == Material.water) { breakThis = false; }
if (toBeBroken == Blocks.water) { breakThis = false; }
if (toBeBroken == Blocks.flowing_water) { breakThis = false; }
if (toBeBroken == Blocks.obsidian)
{
breakThis = false;
this.targetsHit += 2; // Thicker materials
}
if (toBeBroken == Blocks.iron_block)
{
breakThis = false;
this.targetsHit += 2; // Thicker materials
}
if (breakThis) // Sorted out all blocks we don't want to break. Checking the rest now
{
// Glass breaking
Helper.tryBlockBreak(this.worldObj, this, target, 3); // Very Strong
}
this.targetsHit += 1; // Punched through one more block, no matter if we managed to break it
}
// SFX
NetHelper.sendParticleMessageToAllPlayers(this.worldObj, this.getEntityId(), (byte) 10, (byte) 2);
this.worldObj.playSoundAtEntity(this, "ambient.weather.thunder", 0.7F, 0.5F);
if (this.targetsHit > this.targetsHitMax) { this.setDead(); } // Went through the maximum, so ending now
}
示例13: getFOVModifier
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
/**
* Changes the field of view of the player depending on if they are underwater
* or not
*/
private float getFOVModifier(float partialTicks, boolean p_78481_2_) {
if (this.debugView) {
return 90.0F;
} else {
Entity entity = this.mc.getRenderViewEntity();
float f = 70.0F;
if (p_78481_2_) {
f = this.mc.gameSettings.fovSetting;
f = f * (this.fovModifierHandPrev + (this.fovModifierHand - this.fovModifierHandPrev) * partialTicks);
}
boolean flag = false;
if (this.mc.currentScreen == null) {
GameSettings gamesettings = this.mc.gameSettings;
flag = GameSettings.isKeyDown(this.mc.gameSettings.ofKeyBindZoom);
}
if (flag) {
if (!Config.zoomMode) {
Config.zoomMode = true;
this.mc.gameSettings.smoothCamera = true;
}
if (Config.zoomMode) {
f /= 4.0F;
}
} else if (Config.zoomMode) {
Config.zoomMode = false;
this.mc.gameSettings.smoothCamera = false;
this.mouseFilterXAxis = new MouseFilter();
this.mouseFilterYAxis = new MouseFilter();
this.mc.renderGlobal.displayListEntitiesDirty = true;
}
if (entity instanceof EntityLivingBase && ((EntityLivingBase) entity).getHealth() <= 0.0F) {
float f1 = (float) ((EntityLivingBase) entity).deathTime + partialTicks;
f /= (1.0F - 500.0F / (f1 + 500.0F)) * 2.0F + 1.0F;
}
Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks);
if (block.getMaterial() == Material.water) {
f = f * 60.0F / 70.0F;
}
return f;
}
}
示例14: isSafeToStandAt
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
/**
* Returns true when an entity could stand at a position, including solid blocks under the entire entity.
*/
private boolean isSafeToStandAt(int x, int y, int z, int sizeX, int sizeY, int sizeZ, Vec3 vec31, double p_179683_8_, double p_179683_10_)
{
int i = x - sizeX / 2;
int j = z - sizeZ / 2;
if (!this.isPositionClear(i, y, j, sizeX, sizeY, sizeZ, vec31, p_179683_8_, p_179683_10_))
{
return false;
}
else
{
for (int k = i; k < i + sizeX; ++k)
{
for (int l = j; l < j + sizeZ; ++l)
{
double d0 = (double)k + 0.5D - vec31.xCoord;
double d1 = (double)l + 0.5D - vec31.zCoord;
if (d0 * p_179683_8_ + d1 * p_179683_10_ >= 0.0D)
{
Block block = this.worldObj.getBlockState(new BlockPos(k, y - 1, l)).getBlock();
Material material = block.getMaterial();
if (material == Material.air)
{
return false;
}
if (material == Material.water && !this.theEntity.isInWater())
{
return false;
}
if (material == Material.lava)
{
return false;
}
}
}
}
return true;
}
}
示例15: isWater
import net.minecraft.block.material.Material; //导入方法依赖的package包/类
private boolean isWater(BlockPos pos)
{
return this.getBlockState(pos).getBlock().getMaterial() == Material.water;
}