本文整理匯總了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));
}
}
}
}
}
示例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);
}
示例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));
}
示例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();
}
}
示例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;
}