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


Java Block类代码示例

本文整理汇总了Java中net.minecraft.block.Block的典型用法代码示例。如果您正苦于以下问题:Java Block类的具体用法?Java Block怎么用?Java Block使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: canPlantStay

import net.minecraft.block.Block; //导入依赖的package包/类
public static boolean canPlantStay(World world, int x, int y, int z) {
	Block block = world.getBlock(x, y - 1, z);
	if (block != ModBlocks.chorus_plant && block != Blocks.end_stone) {
		if (block.isAir(world, x, y - 1, z)) {
			int adjecentCount = 0;
			for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
				Block adjecentBlock = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
				if (adjecentBlock == ModBlocks.chorus_plant)
					adjecentCount++;
				else if (!adjecentBlock.isAir(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ))
					return false;
			}
			return adjecentCount == 1;
		} else
			return false;
	} else
		return true;
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:19,代码来源:ChorusFlower.java

示例2: getItemBurnTimeElectrical

import net.minecraft.block.Block; //导入依赖的package包/类
public static int getItemBurnTimeElectrical(ItemStack itemStack) {
	if(itemStack == null) {
		return 0;
	} else {
		Item item = itemStack.getItem();

		if(item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) {

			@SuppressWarnings("unused")
			Block block = Block.getBlockFromItem(item);

		}
		if(item == TechnicalItem.Battery1)
			return 2560;

		return 0;
	}
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:19,代码来源:TileEntityMachine.java

示例3: isOnLadder

import net.minecraft.block.Block; //导入依赖的package包/类
/**
 * returns true if this entity is by a ladder, false otherwise
 */
public boolean isOnLadder()
{
    int i = MathHelper.floor_double(this.posX);
    int j = MathHelper.floor_double(this.getEntityBoundingBox().minY);
    int k = MathHelper.floor_double(this.posZ);

    if (this instanceof EntityPlayer && ((EntityPlayer)this).isSpectator())
    {
        return false;
    }
    else
    {
        BlockPos blockpos = new BlockPos(i, j, k);
        IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
        Block block = iblockstate.getBlock();
        return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(iblockstate, worldObj, new BlockPos(i, j, k), this);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:EntityLivingBase.java

示例4: pushEntity

import net.minecraft.block.Block; //导入依赖的package包/类
public static void pushEntity(IBlockState blockState, BlockPos blockPos, IBlockAccess blockAccess, VertexBuffer wrr)
{
    Block block = blockState.getBlock();
    int i;
    int j;

    if (blockState instanceof BlockStateBase)
    {
        BlockStateBase blockstatebase = (BlockStateBase)blockState;
        i = blockstatebase.getBlockId();
        j = blockstatebase.getMetadata();
    }
    else
    {
        i = Block.getIdFromBlock(block);
        j = block.getMetaFromState(blockState);
    }

    i = BlockAliases.getMappedBlockId(i, j);
    int i1 = block.getRenderType(blockState).ordinal();
    int k = ((i1 & 65535) << 16) + (i & 65535);
    int l = j & 65535;
    wrr.sVertexBuilder.pushEntity(((long)l << 32) + (long)k);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:SVertexBuilder.java

示例5: onItemUse

import net.minecraft.block.Block; //导入依赖的package包/类
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
	
	if (stack.getItemDamage() == EnumItems.TIMEMEAL.ordinal() && player.canPlayerEdit(pos, facing, stack)) {
		Block crops = world.getBlockState(pos).getBlock();
		if (crops != null && crops instanceof BlockCrops) {
			if (crops != UCBlocks.cropMerlinia)
				world.setBlockState(pos, ((BlockCrops)crops).withAge(0), 2);
			else if (crops == UCBlocks.cropMerlinia)
				((Merlinia)crops).merliniaGrowth(world, pos, world.rand.nextInt(1) + 1);
			else if (crops instanceof BlockNetherWart)
				((BlockNetherWart)crops).updateTick(world, pos, world.getBlockState(pos), world.rand);
			if (!player.capabilities.isCreativeMode && !player.worldObj.isRemote)
				stack.stackSize--;
			UCPacketHandler.sendToNearbyPlayers(world, pos, new PacketUCEffect(EnumParticleTypes.VILLAGER_HAPPY, pos.getX() - 0.5D, pos.getY(), pos.getZ() - 0.5D, 6));
			return EnumActionResult.SUCCESS;
		}
	}
	return super.onItemUse(stack, player, world, pos, hand, facing, hitX, hitY, hitZ);
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:20,代码来源:ItemGeneric.java

示例6: mergeStatBases

import net.minecraft.block.Block; //导入依赖的package包/类
/**
 * Merge {@link StatBase} object references for similar blocks
 */
private static void mergeStatBases(StatBase[] statBaseIn, Block p_151180_1_, Block p_151180_2_)
{
    int i = Block.getIdFromBlock(p_151180_1_);
    int j = Block.getIdFromBlock(p_151180_2_);

    if (statBaseIn[i] != null && statBaseIn[j] == null)
    {
        statBaseIn[j] = statBaseIn[i];
    }
    else
    {
        allStats.remove(statBaseIn[i]);
        objectMineStats.remove(statBaseIn[i]);
        generalStats.remove(statBaseIn[i]);
        statBaseIn[i] = statBaseIn[j];
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:21,代码来源:StatList.java

示例7: readEntityFromNBT

import net.minecraft.block.Block; //导入依赖的package包/类
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    super.readEntityFromNBT(tagCompund);
    IBlockState iblockstate;

    if (tagCompund.hasKey("carried", 8))
    {
        iblockstate = Block.getBlockFromName(tagCompund.getString("carried")).getStateFromMeta(tagCompund.getShort("carriedData") & 65535);
    }
    else
    {
        iblockstate = Block.getBlockById(tagCompund.getShort("carried")).getStateFromMeta(tagCompund.getShort("carriedData") & 65535);
    }

    this.setHeldBlockState(iblockstate);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:20,代码来源:EntityEnderman.java

示例8: shouldSideBeRendered

import net.minecraft.block.Block; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
	Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
	if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_])) {
		return true;
	}

	if (block == this) {
		return false;
	}
	return true;
}
 
开发者ID:viddeno,项目名称:Technical,代码行数:14,代码来源:BlockBaryteOre.java

示例9: create

import net.minecraft.block.Block; //导入依赖的package包/类
@SuppressWarnings("unchecked")
static <T extends Block> StateMetaMapper<T> create(Collection<IProperty<?>> properties)
{
    if (properties.size() == 0)
        return new EmptyStateMetaMapper<>();
    else if (properties.size() == 1)
        return new SimpleStateMetaMapper(properties.iterator().next());
    else
        return new BitStateMetaMapper<>(properties);
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:11,代码来源:StateMetaMapper.java

示例10: set

import net.minecraft.block.Block; //导入依赖的package包/类
public void set(int x, int y, int z, IBlockState state)
{
    if (state instanceof net.minecraftforge.common.property.IExtendedBlockState)
        state = ((net.minecraftforge.common.property.IExtendedBlockState) state).getClean();
    IBlockState iblockstate = this.get(x, y, z);
    Block block = iblockstate.getBlock();
    Block block1 = state.getBlock();

    if (block != Blocks.AIR)
    {
        --this.blockRefCount;

        if (block.getTickRandomly())
        {
            --this.tickRefCount;
        }
    }

    if (block1 != Blocks.AIR)
    {
        ++this.blockRefCount;

        if (block1.getTickRandomly())
        {
            ++this.tickRefCount;
        }
    }

    this.data.set(x, y, z, state);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:31,代码来源:ExtendedBlockStorage.java

示例11: onBlockDestroyed

import net.minecraft.block.Block; //导入依赖的package包/类
/**
 * Called when a Block is destroyed using this Item. Return true to trigger the "Use Item" statistic.
 */
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn)
{
    if ((double)blockIn.getBlockHardness(worldIn, pos) != 0.0D)
    {
        stack.damageItem(2, playerIn);
    }

    return true;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:13,代码来源:ItemSword.java

示例12: notifyNeighborsRespectDebug

import net.minecraft.block.Block; //导入依赖的package包/类
public void notifyNeighborsRespectDebug(BlockPos pos, Block blockType, boolean p_175722_3_)
{
    if (this.worldInfo.getTerrainType() != WorldType.DEBUG_WORLD)
    {
        this.notifyNeighborsOfStateChange(pos, blockType, p_175722_3_);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:8,代码来源:World.java

示例13: ItemTool

import net.minecraft.block.Block; //导入依赖的package包/类
protected ItemTool(float attackDamageIn, float attackSpeedIn, Item.ToolMaterial materialIn, Set<Block> effectiveBlocksIn)
{
    this.efficiencyOnProperMaterial = 4.0F;
    this.toolMaterial = materialIn;
    this.effectiveBlocks = effectiveBlocksIn;
    this.maxStackSize = 1;
    this.setMaxDamage(materialIn.getMaxUses());
    this.efficiencyOnProperMaterial = materialIn.getEfficiencyOnProperMaterial();
    this.damageVsEntity = attackDamageIn + materialIn.getDamageVsEntity();
    this.attackSpeed = attackSpeedIn;
    this.setCreativeTab(CreativeTabs.TOOLS);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:ItemTool.java

示例14: writeBlockState

import net.minecraft.block.Block; //导入依赖的package包/类
/**
 * Writes the given blockstate to the given tag.
 *  
 * @param tag The tag to write to
 * @param state The blockstate to be written
 */
public static NBTTagCompound writeBlockState(NBTTagCompound tag, IBlockState state)
{
    tag.setString("Name", ((ResourceLocation)Block.REGISTRY.getNameForObject(state.getBlock())).toString());

    if (!state.getProperties().isEmpty())
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();

        for (Entry < IProperty<?>, Comparable<? >> entry : state.getProperties().entrySet())
        {
            IProperty<?> iproperty = (IProperty)entry.getKey();
            nbttagcompound.setString(iproperty.getName(), getName(iproperty, (Comparable)entry.getValue()));
        }

        tag.setTag("Properties", nbttagcompound);
    }

    return tag;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:26,代码来源:NBTUtil.java

示例15: getBlockType

import net.minecraft.block.Block; //导入依赖的package包/类
/**
 * Gets the block type at the location of this entity (client-only).
 */
public Block getBlockType()
{
    if (this.blockType == null && this.worldObj != null)
    {
        this.blockType = this.worldObj.getBlockState(this.pos).getBlock();
    }

    return this.blockType;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:13,代码来源:TileEntity.java


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