本文整理汇总了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();
}
示例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);
}
}
}
}
示例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;
}
}
示例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)));
}
示例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;
}
示例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")
);
}
示例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;
}
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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);
}
}
示例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--;
}
}
示例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;
}
示例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());
}
}
}