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


Java BlockIce类代码示例

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


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

示例1: seedMap

import net.minecraft.block.BlockIce; //导入依赖的package包/类
private void seedMap() {
	// Iterate through the blockmap looking for known pattern types.
	// Though they probably should all be registered with Forge
	// dictionary it's not a requirement.
	final Iterator<Block> itr = Block.REGISTRY.iterator();
	while (itr.hasNext()) {
		final Block block = itr.next();
		final String blockName = MCHelper.nameOf(block);
		if (block instanceof BlockCrops) {
			final BlockCrops crop = (BlockCrops) block;
			if (crop.getMaxAge() == 3) {
				this.registerBlocks("#beets", blockName);
			} else if (blockName.equals("minecraft:wheat")) {
				this.registerBlocks("#wheat", blockName);
			} else if (crop.getMaxAge() == 7) {
				this.registerBlocks("#crop", blockName);
			}
		} else if (block instanceof BlockSapling) {
			this.registerBlocks("#sapling", blockName);
		} else if (block instanceof BlockReed) {
			this.registerBlocks("#reed", blockName);
		} else if (block instanceof BlockFence) {
			this.registerBlocks("#fence", blockName);
		} else if (block instanceof BlockFlower || block instanceof BlockMushroom) {
			this.registerBlocks("NOT_EMITTER", blockName);
		} else if (block instanceof BlockLog || block instanceof BlockPlanks) {
			this.registerBlocks("wood", blockName);
		} else if (block instanceof BlockDoor) {
			this.registerBlocks("bluntwood", blockName);
		} else if (block instanceof BlockLeaves) {
			this.registerBlocks("leaves", blockName);
		} else if (block instanceof BlockOre) {
			this.registerBlocks("ore", blockName);
		} else if (block instanceof BlockIce) {
			this.registerBlocks("ice", blockName);
		}
	}
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:39,代码来源:FootstepsRegistry.java

示例2: onItemUse

import net.minecraft.block.BlockIce; //导入依赖的package包/类
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing face, float hitX, float hitY, float hitZ) {
	if (player.isSneaking()) {
		IBlockState state = world.getBlockState(pos);
		Block block = state.getBlock();
		int meta = block.getMetaFromState(state);
		if (block instanceof BlockSecretStone) {
			block = ((BlockSecretStone.EnumType) state.getValue(BlockSecretStone.VARIANT)).getDroppedBlock();
			meta = state.getBlock().getMetaFromState(state);
		} else if (block instanceof BlockDungeonStone) {
			TileEntity te = world.getTileEntity(pos);
			if (te instanceof TileEntityDungeonStone) {
				IBlockState render = ((TileEntityDungeonStone) te).getRenderState();
				if (render == null) {
					render = ((BlockDungeonStone) block).getDefaultRenderState(stack.getItemDamage() > 7);
				}
				if (render != null) {
					block = render.getBlock();
					meta = block.getMetaFromState(render);
				}
			}
		}
		if ((block.isOpaqueCube() || block instanceof BlockIce) && Item.getItemFromBlock(block) != null) {
			if (world.isRemote) { // Send block's render color to server so held block can render correctly
				PacketDispatcher.sendToServer(new HeldBlockColorPacket(block.colorMultiplier(world, pos)));
			} else {
				if (!stack.hasTagCompound()) {
					stack.setTagCompound(new NBTTagCompound());
				}
				stack.getTagCompound().setInteger("renderBlock", Block.getIdFromBlock(block));
				stack.getTagCompound().setInteger("metadata", meta);
			}
		}
		return false;
	} else {
		return super.onItemUse(stack, player, world, pos, face, hitX, hitY, hitZ);
	}
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:39,代码来源:ItemDungeonBlock.java

示例3: genPatch

import net.minecraft.block.BlockIce; //导入依赖的package包/类
private boolean genPatch(Random random, int chunkX, int chunkZ, World world)
{
    //Coords of "top left" blocks in chunk
    int chunkBlockX = chunkX * 16;
    int chunkBlockZ = chunkZ * 16;
    //The y coordinate where patch generation will be attempted
    int patchY;
    //Coords of "top left" blocks in an adjacent chunk
    int nextChunkBlockX = chunkBlockX + 16;
    int nextChunkBlockZ = chunkBlockZ + 16;

    //Check 16 candidate blocks in the chunk to see if they are ice blocks
    for(int candX = chunkBlockX; candX < nextChunkBlockX; candX += 8)
    {
        for(int candZ = chunkBlockZ; candZ < nextChunkBlockZ; candZ += 8)
        {
            patchY = world.getTopSolidOrLiquidBlock(candX, candZ) - 1;
            Block candidate = world.getBlock(candX, patchY, candZ);
            if(candidate instanceof BlockIce || FragileGlassBase.iceBlocks.contains(Item.getItemFromBlock(candidate)))
            {
                int patchRadius = (int) (((2 * random.nextGaussian()) + FragileGlassBase.avePatchSize) / 2);
                for (int rad = patchRadius; rad > 0; rad--)
                {
                    for (double d = 0; d < 360; d += 10)
                    {
                        double r = Math.toRadians(d);
                        int nextX = (int) (candX + (rad * Math.cos(r)));
                        int nextZ = (int) (candZ + (rad * Math.sin(r)));
                        Block nextBlock = world.getBlock(nextX, patchY, nextZ);
                        if (nextBlock instanceof BlockIce || FragileGlassBase.iceBlocks.contains(Item.getItemFromBlock(nextBlock)))
                        {
                            //Adds a little randomness to the outside of patches, to avoid perfect circles all the time
                            if (rad > patchRadius - 2)
                            {
                                if (random.nextBoolean())
                                {
                                    world.setBlock(nextX, patchY, nextZ, FragileGlassBase.thinIce);
                                }
                            } else {
                                world.setBlock(nextX, patchY, nextZ, FragileGlassBase.thinIce);
                            }
                        }
                    }
                }
                world.setBlock(candX, patchY, candZ, FragileGlassBase.thinIce);
                //For testing
                //System.out.println("Generated patch at ("+candX+", "+patchY+", "+candZ+").");
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:fredtargaryen,项目名称:Fragile-Glass-1.7.10,代码行数:54,代码来源:PatchGen.java


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