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


Java Blocks类代码示例

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


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

示例1: setIgloo

import net.minecraft.init.Blocks; //导入依赖的package包/类
private void setIgloo()
{
    this.floor = Blocks.snow.getDefaultState();
    this.exterior = Blocks.snow.getDefaultState();
    this.wall = Blocks.packed_ice.getDefaultState();
    this.light = Blocks.torch.getDefaultState();
    this.goal = Blocks.redstone_block.getDefaultState();
    this.moat = Blocks.water.getDefaultState();
    this.moatContainer = Blocks.glowstone.getDefaultState();
    this.doorUpper = Blocks.spruce_door.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER);
    this.doorLower = Blocks.spruce_door.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER);
    this.stairs = Blocks.spruce_stairs.getDefaultState();
    this.stairsPlatform = Blocks.packed_ice.getDefaultState();
    this.ladder = Blocks.ladder.getDefaultState();
    this.puzzleDoorUpper = Blocks.iron_door.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER);
    this.puzzleDoorLower = Blocks.iron_door.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER);
    this.trigger = Blocks.lever.getDefaultState();
    this.platform = Blocks.snow.getDefaultState();
    this.hint = Blocks.redstone_ore.getDefaultState();
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:21,代码来源:ClassroomDecoratorImplementation.java

示例2: drawStandardRoads

import net.minecraft.init.Blocks; //导入依赖的package包/类
private void drawStandardRoads(World world, int chunkX, int groundY, int chunkZ, int chunkSize) {

		// Draw roads

		for (int x = 0, maxX = chunkSize; x < maxX; ++x) {
			for (int z = 0, maxZ = chunkSize; z < maxZ; ++z) {
				int edgeX = (x > chunkSize / 2) ? chunkSize - 1 - x : x;
				int edgeZ = (z > chunkSize / 2) ? chunkSize - 1 - z : z;
						
				if (edgeX < 2 || edgeZ < 2) {
					world.setBlockState(new BlockPos(chunkX * 16 + x, groundY, chunkZ * 16 + z), 
							Blocks.STONE.getStateFromMeta(4), 2);
				}
			}
		}
	}
 
开发者ID:astronautlabs,项目名称:rezolve,代码行数:17,代码来源:CityGenerator.java

示例3: onItemUse

import net.minecraft.init.Blocks; //导入依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (iblockstate.getBlock() == Blocks.jukebox && !((Boolean)iblockstate.getValue(BlockJukebox.HAS_RECORD)).booleanValue())
    {
        if (worldIn.isRemote)
        {
            return true;
        }
        else
        {
            ((BlockJukebox)Blocks.jukebox).insertRecord(worldIn, pos, iblockstate, stack);
            worldIn.playAuxSFXAtEntity((EntityPlayer)null, 1005, pos, Item.getIdFromItem(this));
            --stack.stackSize;
            playerIn.triggerAchievement(StatList.field_181740_X);
            return true;
        }
    }
    else
    {
        return false;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:28,代码来源:ItemRecord.java

示例4: initRecipes

import net.minecraft.init.Blocks; //导入依赖的package包/类
public static void initRecipes(){
	recipes.add(new PotteryKilnRecipe(new ItemStack(Items.CLAY_BALL), new ItemStack(Items.BRICK)));
	recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.CLAY), new ItemStack(Blocks.HARDENED_CLAY)));
	recipes.add(new PotteryKilnRecipe(new ItemStack(ItemsRegistry.clay_Pot), new ItemStack(Items.FLOWER_POT)));
	
	recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 0), new ItemStack(Blocks.WHITE_GLAZED_TERRACOTTA)));
	recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 1), new ItemStack(Blocks.ORANGE_GLAZED_TERRACOTTA)));
	recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 2), new ItemStack(Blocks.MAGENTA_GLAZED_TERRACOTTA)));
	recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 3), new ItemStack(Blocks.LIGHT_BLUE_GLAZED_TERRACOTTA)));
	recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 4), new ItemStack(Blocks.YELLOW_GLAZED_TERRACOTTA)));
	recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 5), new ItemStack(Blocks.LIME_GLAZED_TERRACOTTA)));
	recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 6), new ItemStack(Blocks.PINK_GLAZED_TERRACOTTA)));
	recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 7), new ItemStack(Blocks.GRAY_GLAZED_TERRACOTTA)));
	recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 8), new ItemStack(Blocks.SILVER_GLAZED_TERRACOTTA)));
	recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 9), new ItemStack(Blocks.CYAN_GLAZED_TERRACOTTA)));
	recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 10), new ItemStack(Blocks.PURPLE_GLAZED_TERRACOTTA)));
	recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 11), new ItemStack(Blocks.BLUE_GLAZED_TERRACOTTA)));
	recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 12), new ItemStack(Blocks.BROWN_GLAZED_TERRACOTTA)));
	recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 13), new ItemStack(Blocks.GREEN_GLAZED_TERRACOTTA)));
	recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 14), new ItemStack(Blocks.RED_GLAZED_TERRACOTTA)));
	recipes.add(new PotteryKilnRecipe(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, 15), new ItemStack(Blocks.BLACK_GLAZED_TERRACOTTA)));
}
 
开发者ID:EnderiumSmith,项目名称:CharcoalPit,代码行数:23,代码来源:PotteryKilnRecipe.java

示例5: shouldMoveTo

import net.minecraft.init.Blocks; //导入依赖的package包/类
/**
 * Return true to set given position as destination
 */
protected boolean shouldMoveTo(World worldIn, BlockPos pos)
{
    Block block = worldIn.getBlockState(pos).getBlock();

    if (block == Blocks.FARMLAND)
    {
        pos = pos.up();
        IBlockState iblockstate = worldIn.getBlockState(pos);
        block = iblockstate.getBlock();

        if (block instanceof BlockCrops && ((BlockCrops)block).isMaxAge(iblockstate) && this.wantsToReapStuff && (this.currentTask == 0 || this.currentTask < 0))
        {
            this.currentTask = 0;
            return true;
        }

        if (iblockstate.getMaterial() == Material.AIR && this.hasFarmItem && (this.currentTask == 1 || this.currentTask < 0))
        {
            this.currentTask = 1;
            return true;
        }
    }

    return false;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:29,代码来源:EntityAIHarvestFarmland.java

示例6: onItemRegister

import net.minecraft.init.Blocks; //导入依赖的package包/类
@SubscribeEvent
public static void onItemRegister(RegistryEvent.Register<Item> event) {
    IForgeRegistry<Item> registry = event.getRegistry();
    registry.registerAll(
            new Mooncake().setRegistryName("mooncakecraft:mooncake"),
            new MooncakeMold().setRegistryName("mooncakecraft:mooncakemold"),
            new MooncakeFilling().setRegistryName("mooncakecraft:mooncake_filling"),
            new Item().setCreativeTab(MooncakeConstants.TAB_MOONCAKE_CRAFT).setHasSubtypes(false).setUnlocalizedName("mooncakecraft.wheat_flour").setRegistryName("mooncakecraft:wheat_flour"),
            new MoonCakeRaw().setRegistryName("mooncakecraft:mooncakeraw"),
            new MoonCakeUnshaped().setRegistryName("mooncakecraft:mooncakeunshaped"),
            new Item().setCreativeTab(MooncakeConstants.TAB_MOONCAKE_CRAFT).setHasSubtypes(false).setUnlocalizedName("mooncakecraft.lotus_seeds").setRegistryName("mooncakecraft:lotus_seeds"),
            new Item().setCreativeTab(MooncakeConstants.TAB_MOONCAKE_CRAFT).setHasSubtypes(false).setUnlocalizedName("mooncakecraft.jujube").setRegistryName("mooncakecraft:jujube"),
            new ItemSeeds(MooncakeConstants.PEANUT_PLANT, Blocks.FARMLAND).setCreativeTab(MooncakeConstants.TAB_MOONCAKE_CRAFT).setUnlocalizedName("mooncakecraft.peanut_seeds").setRegistryName("mooncakecraft:peanut_seeds"),
            new ItemSeeds(MooncakeConstants.SESAME_PLANT, Blocks.FARMLAND).setCreativeTab(MooncakeConstants.TAB_MOONCAKE_CRAFT).setUnlocalizedName("mooncakecraft.sesame_seeds").setRegistryName("mooncakecraft:sesame_seeds"),
            new Item().setRegistryName("mooncakecraft:icon")
    );
}
 
开发者ID:TeamCovertDragon,项目名称:MooncakeCraft,代码行数:18,代码来源:MooncakeRegistries.java

示例7: extinguishFire

import net.minecraft.init.Blocks; //导入依赖的package包/类
/**
 * Attempts to extinguish a fire
 */
public boolean extinguishFire(EntityPlayer player, BlockPos pos, EnumFacing side)
{
    pos = pos.offset(side);

    if (this.getBlockState(pos).getBlock() == Blocks.fire)
    {
        this.playAuxSFXAtEntity(player, 1004, pos, 0);
        this.setBlockToAir(pos);
        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:World.java

示例8: generate

import net.minecraft.init.Blocks; //导入依赖的package包/类
@Override
public boolean generate(World worldIn, Random rand, BlockPos position)
{
	for (int i = 0; i < 16; ++i)
	{
		BlockPos offset = position.add(rand.nextInt(6) - rand.nextInt(6), 6, rand.nextInt(6) - rand.nextInt(6));
		while (!worldIn.isSideSolid(offset.down(), EnumFacing.UP, false) && offset.getY() > 0)
		{
			offset = offset.down();
		}
		
		if (worldIn.isAirBlock(offset) && !worldIn.getBlockState(offset.down()).getBlock().isAssociatedBlock(Blocks.SAND))
		{
			EnumRockClass erc = GenerationHelper.getStoneTypeAt(worldIn, offset);
			worldIn.setBlockState(offset, ExPBlocks.pebble.getDefaultState().withProperty(ExPBlockProperties.ROCK_CLASS, erc), 2);
		}
	}
	
	return true;
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:21,代码来源:PebbleGenerator.java

示例9: canConnectTo

import net.minecraft.init.Blocks; //导入依赖的package包/类
protected static boolean canConnectTo(IBlockState blockState, EnumFacing side)
{
    Block block = blockState.getBlock();

    if (block == Blocks.redstone_wire)
    {
        return true;
    }
    else if (Blocks.unpowered_repeater.isAssociated(block))
    {
        EnumFacing enumfacing = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING);
        return enumfacing == side || enumfacing.getOpposite() == side;
    }
    else
    {
        return block.canProvidePower() && side != null;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:BlockRedstoneWire.java

示例10: getItemBurnTimeBurning

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

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

			Block block = Block.getBlockFromItem(item);

			if(block == Blocks.coal_block)
				return 3200;
		}

		if(item == Items.coal)
			return 320;

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

示例11: func_174845_l

import net.minecraft.init.Blocks; //导入依赖的package包/类
public EntityDiggingFX func_174845_l()
{
    this.field_181019_az = new BlockPos(this.posX, this.posY, this.posZ);
    Block block = this.field_174847_a.getBlock();

    if (block == Blocks.grass)
    {
        return this;
    }
    else
    {
        int i = block.getRenderColor(this.field_174847_a);
        this.particleRed *= (float)(i >> 16 & 255) / 255.0F;
        this.particleGreen *= (float)(i >> 8 & 255) / 255.0F;
        this.particleBlue *= (float)(i & 255) / 255.0F;
        return this;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:19,代码来源:EntityDiggingFX.java

示例12: destroyBlock

import net.minecraft.init.Blocks; //导入依赖的package包/类
/**
 * Sets a block to air, but also plays the sound and particles and can spawn drops
 */
public boolean destroyBlock(BlockPos pos, boolean dropBlock)
{
    IBlockState iblockstate = this.getBlockState(pos);
    Block block = iblockstate.getBlock();

    if (block.getMaterial() == Material.air)
    {
        return false;
    }
    else
    {
        this.playAuxSFX(2001, pos, Block.getStateId(iblockstate));

        if (dropBlock)
        {
            block.dropBlockAsItem(this, pos, iblockstate, 0);
        }

        return this.setBlockState(pos, Blocks.air.getDefaultState(), 3);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:25,代码来源:World.java

示例13: update

import net.minecraft.init.Blocks; //导入依赖的package包/类
@Override
public void update() {
    /*
     * Most of the Electrostatic Compressor's logic can be found in TickHandlerPneumaticCraft#handleElectrostaticGeneration().
     */
    if (getWorld().getTotalWorldTime() % 40 == 0) {
        for (ironBarsBeneath = 0; ironBarsBeneath < 128; ironBarsBeneath++) {
            if (getWorld().getBlockState(getPos().offset(EnumFacing.DOWN, ironBarsBeneath + 1)).getBlock() != Blocks.IRON_BARS) {
                break;
            }
        }
    }
    super.update();
    if (!getWorld().isRemote) {
        if (lastRedstoneState != shouldEmitRedstone()) {
            lastRedstoneState = !lastRedstoneState;
            updateNeighbours();
        }
        struckByLightningCooldown--;
    }

}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:23,代码来源:TileEntityElectrostaticCompressor.java

示例14: getBlock0

import net.minecraft.init.Blocks; //导入依赖的package包/类
/**
 * Returns the block corresponding to the given coordinates inside a chunk.
 */
private Block getBlock0(int x, int y, int z)
{
    Block block = Blocks.air;

    if (y >= 0 && y >> 4 < this.storageArrays.length)
    {
        ExtendedBlockStorage extendedblockstorage = this.storageArrays[y >> 4];

        if (extendedblockstorage != null)
        {
            try
            {
                block = extendedblockstorage.getBlockByExtId(x, y & 15, z);
            }
            catch (Throwable throwable)
            {
                CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting block");
                throw new ReportedException(crashreport);
            }
        }
    }

    return block;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:28,代码来源:Chunk.java

示例15: onNeighborBlockChange

import net.minecraft.init.Blocks; //导入依赖的package包/类
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    EnumFacing.Axis enumfacing$axis = (EnumFacing.Axis)state.getValue(AXIS);

    if (enumfacing$axis == EnumFacing.Axis.X)
    {
        BlockPortal.Size blockportal$size = new BlockPortal.Size(worldIn, pos, EnumFacing.Axis.X);

        if (!blockportal$size.func_150860_b() || blockportal$size.field_150864_e < blockportal$size.field_150868_h * blockportal$size.field_150862_g)
        {
            worldIn.setBlockState(pos, Blocks.air.getDefaultState());
        }
    }
    else if (enumfacing$axis == EnumFacing.Axis.Z)
    {
        BlockPortal.Size blockportal$size1 = new BlockPortal.Size(worldIn, pos, EnumFacing.Axis.Z);

        if (!blockportal$size1.func_150860_b() || blockportal$size1.field_150864_e < blockportal$size1.field_150868_h * blockportal$size1.field_150862_g)
        {
            worldIn.setBlockState(pos, Blocks.air.getDefaultState());
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:27,代码来源:BlockPortal.java


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