当前位置: 首页>>代码示例>>Java>>正文


Java Blocks.anvil方法代码示例

本文整理汇总了Java中net.minecraft.init.Blocks.anvil方法的典型用法代码示例。如果您正苦于以下问题:Java Blocks.anvil方法的具体用法?Java Blocks.anvil怎么用?Java Blocks.anvil使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.init.Blocks的用法示例。


在下文中一共展示了Blocks.anvil方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fall

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public void fall(float distance, float damageMultiplier)
{
    Block block = this.fallTile.getBlock();

    if (this.hurtEntities)
    {
        int i = MathHelper.ceiling_float_int(distance - 1.0F);

        if (i > 0)
        {
            List<Entity> list = Lists.newArrayList(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox()));
            boolean flag = block == Blocks.anvil;
            DamageSource damagesource = flag ? DamageSource.anvil : DamageSource.fallingBlock;

            for (Entity entity : list)
            {
                entity.attackEntityFrom(damagesource, (float)Math.min(MathHelper.floor_float((float)i * this.fallHurtAmount), this.fallHurtMax));
            }

            if (flag && (double)this.rand.nextFloat() < 0.05000000074505806D + (double)i * 0.05D)
            {
                int j = ((Integer)this.fallTile.getValue(BlockAnvil.DAMAGE)).intValue();
                ++j;

                if (j > 2)
                {
                    this.canSetAsBlock = true;
                }
                else
                {
                    this.fallTile = this.fallTile.withProperty(BlockAnvil.DAMAGE, Integer.valueOf(j));
                }
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:37,代码来源:EntityFallingBlock.java

示例2: onPlayerInteract

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public static void onPlayerInteract(PlayerInteractEvent event) {
	if (!EtFuturum.enableAnvil)
		return;

	World world = event.world;
	int x = event.x;
	int y = event.y;
	int z = event.z;

	if (world == null || world.isRemote)
		return;
	if (world.getBlock(x, y, z) == Blocks.anvil)
		world.setBlock(x, y, z, ModBlocks.anvil, world.getBlockMetadata(x, y, z), 3);
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:15,代码来源:NewAnvil.java

示例3: canBlockBePlaced

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public boolean canBlockBePlaced(Block blockIn, BlockPos pos, boolean p_175716_3_, EnumFacing side, Entity entityIn, ItemStack itemStackIn)
{
    Block block = this.getBlockState(pos).getBlock();
    AxisAlignedBB axisalignedbb = p_175716_3_ ? null : blockIn.getCollisionBoundingBox(this, pos, blockIn.getDefaultState());
    return axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, entityIn) ? false : (block.getMaterial() == Material.circuits && blockIn == Blocks.anvil ? true : block.getMaterial().isReplaceable() && blockIn.canReplace(this, pos, side, itemStackIn));
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:7,代码来源:World.java

示例4: readEntityFromNBT

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
protected void readEntityFromNBT(NBTTagCompound tagCompund)
{
    int i = tagCompund.getByte("Data") & 255;

    if (tagCompund.hasKey("Block", 8))
    {
        this.fallTile = Block.getBlockFromName(tagCompund.getString("Block")).getStateFromMeta(i);
    }
    else if (tagCompund.hasKey("TileID", 99))
    {
        this.fallTile = Block.getBlockById(tagCompund.getInteger("TileID")).getStateFromMeta(i);
    }
    else
    {
        this.fallTile = Block.getBlockById(tagCompund.getByte("Tile") & 255).getStateFromMeta(i);
    }

    this.fallTime = tagCompund.getByte("Time") & 255;
    Block block = this.fallTile.getBlock();

    if (tagCompund.hasKey("HurtEntities", 99))
    {
        this.hurtEntities = tagCompund.getBoolean("HurtEntities");
        this.fallHurtAmount = tagCompund.getFloat("FallHurtAmount");
        this.fallHurtMax = tagCompund.getInteger("FallHurtMax");
    }
    else if (block == Blocks.anvil)
    {
        this.hurtEntities = true;
    }

    if (tagCompund.hasKey("DropItem", 99))
    {
        this.shouldDropItem = tagCompund.getBoolean("DropItem");
    }

    if (tagCompund.hasKey("TileEntityData", 10))
    {
        this.tileEntityData = tagCompund.getCompoundTag("TileEntityData");
    }

    if (block == null || block.getMaterial() == Material.air)
    {
        this.fallTile = Blocks.sand.getDefaultState();
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:50,代码来源:EntityFallingBlock.java

示例5: canInteractWith

import net.minecraft.init.Blocks; //导入方法依赖的package包/类
public boolean canInteractWith(EntityPlayer playerIn)
{
    return this.theWorld.getBlockState(this.selfPosition).getBlock() != Blocks.anvil ? false : playerIn.getDistanceSq((double)this.selfPosition.getX() + 0.5D, (double)this.selfPosition.getY() + 0.5D, (double)this.selfPosition.getZ() + 0.5D) <= 64.0D;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:ContainerRepair.java


注:本文中的net.minecraft.init.Blocks.anvil方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。