當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。