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


Java BlockDirectional类代码示例

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


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

示例1: getBoundingBox

import net.minecraft.block.BlockDirectional; //导入依赖的package包/类
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
    EnumFacing side = state.getValue(BlockDirectional.FACING);
    switch (side){
        case DOWN:
        case UP: {
            return new AxisAlignedBB(2/16F, 0, 2/16F, 14/16F, 1, 14/16F);
        }
        case EAST:
        case WEST: {
            return new AxisAlignedBB(0, 2/16F, 2/16F, 1, 14/16F, 14/16F);
        }
        case NORTH:
        case SOUTH: {
            return new AxisAlignedBB(2/16F, 2/16F, 0, 14/16F, 14/16F, 1);
        }
    }
    return FULL_BLOCK_AABB;
}
 
开发者ID:canitzp,项目名称:Metalworks,代码行数:20,代码来源:BlockBattery.java

示例2: getBedOrientationInDegrees

import net.minecraft.block.BlockDirectional; //导入依赖的package包/类
/**
 * Returns the orientation of the bed in degrees.
 */
public float getBedOrientationInDegrees()
{
    if (this.playerLocation != null)
    {
        EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockDirectional.FACING);

        switch (enumfacing)
        {
            case SOUTH:
                return 90.0F;

            case NORTH:
                return 270.0F;

            case WEST:
                return 0.0F;

            case EAST:
                return 180.0F;
        }
    }

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

示例3: getQuads

import net.minecraft.block.BlockDirectional; //导入依赖的package包/类
@Override
protected List<BakedQuad> getQuads(IBlockState state) {
	EnumFacing face = state.getValue(BlockDirectional.FACING);
	List<BakedQuad> quads = new ArrayList<>();
	switch(MinecraftForgeClient.getRenderLayer()) {
		case SOLID:
			//Base
			addCube(quads, face, base, base, base, false);
			break;
		case CUTOUT_MIPPED:
			//Overlay
			addCube(quads, face, overlay[0], overlay[1], overlay[2], true);
			break;
	}
	return quads;
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:17,代码来源:BakedGravityHopper.java

示例4: getBedDirection

import net.minecraft.block.BlockDirectional; //导入依赖的package包/类
@Override
public int getBedDirection(IBlockAccess world, int x, int y, int z)
{
    TileEntity tileEntity = world.getTileEntity(x, y, z);
    if (tileEntity instanceof TileEntityMulti)
    {
        BlockVec3 mainBlockPosition = ((TileEntityMulti) tileEntity).mainBlockPosition;

     if (mainBlockPosition != null)
     {
         return mainBlockPosition.getBlock(world).getBedDirection(world, mainBlockPosition.x, mainBlockPosition.y, mainBlockPosition.z);
     }
    }

    return BlockDirectional.getDirection(world.getBlockMetadata(x, y, z));
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:17,代码来源:BlockMulti.java

示例5: func_72226_b

import net.minecraft.block.BlockDirectional; //导入依赖的package包/类
public static ChunkCoordinates func_72226_b(World p_72226_0_, int p_72226_1_, int p_72226_2_, int p_72226_3_, int p_72226_4_) {
   int var5 = p_72226_0_.func_72805_g(p_72226_1_, p_72226_2_, p_72226_3_);
   int var6 = BlockDirectional.func_72217_d(var5);

   for(int var7 = 0; var7 <= 1; ++var7) {
      int var8 = p_72226_1_ - field_72230_a[var6][0] * var7 - 1;
      int var9 = p_72226_3_ - field_72230_a[var6][1] * var7 - 1;
      int var10 = var8 + 2;
      int var11 = var9 + 2;

      for(int var12 = var8; var12 <= var10; ++var12) {
         for(int var13 = var9; var13 <= var11; ++var13) {
            if(p_72226_0_.func_72797_t(var12, p_72226_2_ - 1, var13) && !p_72226_0_.func_72803_f(var12, p_72226_2_, var13).func_76218_k() && !p_72226_0_.func_72803_f(var12, p_72226_2_ + 1, var13).func_76218_k()) {
               if(p_72226_4_ <= 0) {
                  return new ChunkCoordinates(var12, p_72226_2_, var13);
               }

               --p_72226_4_;
            }
         }
      }
   }

   return null;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:26,代码来源:BlockBed.java

示例6: setDefaultMetadata

import net.minecraft.block.BlockDirectional; //导入依赖的package包/类
/**
 * Will restore cover to default state before returning {@link ItemStack}.
 * <p>
 * Corrects log rotation, among other things.
 *
 * @param  rand a {@link Random} reference
 * @param  itemStack the {@link ItemStack}
 * @return the cover {@link ItemStack} in it's default state
 */
private ItemStack setDefaultMetadata(ItemStack itemStack)
{
    Block block = BlockProperties.toBlock(itemStack);

    // Correct rotation metadata before dropping block
    if (BlockProperties.blockRotates(itemStack) || block instanceof BlockDirectional)
    {
        int dmgDrop = block.damageDropped(itemStack.getItemDamage());
        Item itemDrop = block.getItemDropped(itemStack.getItemDamage(), getWorldObj().rand, /* Fortune */ 0);

        /* Check if block drops itself, and, if so, correct the damage value to the block's default. */

        if (itemDrop != null && itemDrop.equals(itemStack.getItem()) && dmgDrop != itemStack.getItemDamage()) {
            itemStack.setItemDamage(dmgDrop);
        }
    }

    return itemStack;
}
 
开发者ID:Mineshopper,项目名称:carpentersblocks,代码行数:29,代码来源:TEBase.java

示例7: BlockBattery

import net.minecraft.block.BlockDirectional; //导入依赖的package包/类
public BlockBattery(Type batteryType) {
    super(Material.IRON, "battery_" + batteryType.name);
    this.batteryType = batteryType;
    this.setEnergeticItem(batteryType.maxEnergy, batteryType.maxTransfer, batteryType.maxTransfer);
    this.setHarvestLevel("pickaxe", 2);
    this.setHardness(4.5F);
    this.setDefaultState(this.blockState.getBaseState().withProperty(BlockDirectional.FACING, EnumFacing.NORTH).withProperty(STATE, 0));
}
 
开发者ID:canitzp,项目名称:Metalworks,代码行数:9,代码来源:BlockBattery.java

示例8: getQuads

import net.minecraft.block.BlockDirectional; //导入依赖的package包/类
@Override
protected List<BakedQuad> getQuads(IBlockState state) {
	List<BakedQuad> quads = new ArrayList<>();
	EnumFacing facing = state.getValue(BlockDirectional.FACING);
	switch(MinecraftForgeClient.getRenderLayer()) {
		case SOLID:
			//Base
			QuadBuilder base_quads = QuadBuilder.withFormat(format)
					.setFrom(3, 3, 3)
					.setTo(13, 4, 13)
					.addAll(0F, 9F, 7F, 7F, base)
					.addFace(UP, 0F, 9F, 7F, 16F, base_)
					.addFace(DOWN, 0F, 9F, 7F, 16F, base)
					.rotate(facing, DOWN);
			quads.addAll(base_quads.bake());
			break;
		case CUTOUT_MIPPED:
			//Overlay
			QuadBuilder overlay_quads = QuadBuilder.withFormat(format)
					.setFrom(3, 3, 3)
					.setTo(13, 4, 13)
					.addAll(0F, 9F, 15F, 16F, overlay_front)
					.addFace(DOWN, 0F, 9F, 7F, 16F, overlay_front)
					.addFace(UP, 0F, 9F, 7F, 16F, overlay_back)
					.setHasBrightness(true)
					.rotate(facing, DOWN);
			quads.addAll(overlay_quads.bake());
			break;
	}
	return quads;
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:32,代码来源:BakedQimranut.java

示例9: getQuads

import net.minecraft.block.BlockDirectional; //导入依赖的package包/类
@Override
protected List<BakedQuad> getQuads(IBlockState state) {
	List<BakedQuad> quads = new ArrayList<>();
	EnumFacing facing = state.getValue(BlockDirectional.FACING);
	switch(MinecraftForgeClient.getRenderLayer()) {
		case SOLID:
			QuadBuilder base_quads = QuadBuilder.withFormat(format)
					.setFrom(2, 0, 2)
					.setTo(14, 1, 14)
					.addAll(2F, 14F, 2F, 2F, base)
					.addFace(UP, 2F, 14F, 3F, 14F, base)
					.addFace(DOWN, 2F, 14F, 2F, 14F, base)
					.rotate(facing, DOWN);
			quads.addAll(base_quads.bake());
			break;
		case CUTOUT_MIPPED:
			boolean on = state.getValue(State.ACTIVE);
			//Overlay
			QuadBuilder overlay_quads = QuadBuilder.withFormat(format)
					.setFrom(2, 0, 2)
					.setTo(14, 1, 14)
					.addAll(2F, 14F, 2F, 2F, on ? top_on : top_off)
					.addFace(UP, 2F, 14F, 2F, 14F, on ? top_on : top_off)
					.addFace(DOWN, 2F, 14F, 2F, 14F, on ? bottom_on : bottom_off)
					.setHasBrightness(true)
					.rotate(facing, DOWN);
			quads.addAll(overlay_quads.bake());
			break;
	}
	return quads;
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:32,代码来源:BakedBlinker.java

示例10: onBlockActivated

import net.minecraft.block.BlockDirectional; //导入依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
	boolean success = state.getValue(BlockDirectional.FACING).getOpposite() == facing && player.getHeldItem(hand).isEmpty();
	if(!world.isRemote && success) {
		getTile(TileMechanicalTranslocator.class, world, pos).ifPresent(tile -> tile.setTransferable(!tile.isTransferable()));
	}
	return success;
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:9,代码来源:BlockMechanicalTranslocator.java

示例11: getMetaFromState

import net.minecraft.block.BlockDirectional; //导入依赖的package包/类
@Override
public int getMetaFromState(IBlockState state) {
	int i = state.getValue(BlockDirectional.FACING).ordinal();
	if(state.getValue(State.ACTIVE)) {
		i |= 8;
	}
	return i;
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:9,代码来源:BlockMechanicalTranslocator.java

示例12: BlockBlinker

import net.minecraft.block.BlockDirectional; //导入依赖的package包/类
public BlockBlinker()  {
	super(LibNames.BLINKER, FixedMaterial.BREAK);
	setDefaultState(getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.UP).withProperty(State.ACTIVE, false));
	setHarvestLevel(Tool.PICK, ToolLevel.STONE);
	setHardness(2F);
	setLightLevel(0.2F);
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:8,代码来源:BlockBlinker.java

示例13: BlockQimranut

import net.minecraft.block.BlockDirectional; //导入依赖的package包/类
public BlockQimranut() {
	super(LibNames.QIMRANUT, FixedMaterial.BREAK);
	setDefaultState(getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.UP));
	setHarvestLevel(Tool.PICK, ToolLevel.STONE);
	setHardness(2F);
	setLightLevel(0.2F);
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:8,代码来源:BlockQimranut.java

示例14: getPlacementState

import net.minecraft.block.BlockDirectional; //导入依赖的package包/类
@Override
public IBlockState getPlacementState(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
	EnumFacing facing = EnumFacing.getDirectionFromEntityLiving(pos, placer);
	/*EnumFacing facing = EnumFacing.UP;
	Vec2f rot = placer.getPitchYaw();
	
	if (rot.x > 45) {
		facing = EnumFacing.DOWN;
	} else if (rot.x > -45) {
		facing = placer.getAdjustedHorizontalFacing();
	}*/
	
	return state.withProperty(BlockDirectional.FACING, facing);
}
 
开发者ID:elytra,项目名称:Thermionics,代码行数:15,代码来源:BlockStateBehavior.java

示例15: getFacing

import net.minecraft.block.BlockDirectional; //导入依赖的package包/类
public EnumFacing getFacing() {
	try {
		return this.world.getBlockState(this.pos).getValue(BlockDirectional.FACING);
	} catch (Throwable t) {
		return EnumFacing.NORTH;
	}
}
 
开发者ID:elytra,项目名称:Thermionics,代码行数:8,代码来源:TileEntityMachine.java


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