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


Java EnumFacing.HORIZONTALS属性代码示例

本文整理汇总了Java中net.minecraft.util.EnumFacing.HORIZONTALS属性的典型用法代码示例。如果您正苦于以下问题:Java EnumFacing.HORIZONTALS属性的具体用法?Java EnumFacing.HORIZONTALS怎么用?Java EnumFacing.HORIZONTALS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.minecraft.util.EnumFacing的用法示例。


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

示例1: getPlatformDirection

public EnumFacing[] getPlatformDirection() {
    for (EnumFacing dir : EnumFacing.HORIZONTALS) {
        if (getWorld().getTileEntity(getPos().offset(dir)) instanceof TileEntityAssemblyPlatform)
            return new EnumFacing[]{dir, null};
    }
    if (canMoveToDiagonalNeighbours()) {
        for (EnumFacing secDir : new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST}) {
            for (EnumFacing primDir : new EnumFacing[]{EnumFacing.NORTH, EnumFacing.SOUTH}) {
                if (getWorld().getTileEntity(getPos().offset(primDir).offset(secDir)) instanceof TileEntityAssemblyPlatform) {
                    return new EnumFacing[]{primDir, secDir};
                }
            }
        }
    }
    return null;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:16,代码来源:TileEntityAssemblyRobot.java

示例2: getTankProperties

@Override
public IFluidTankProperties[] getTankProperties() {
    if(properties == null) { //Fingers crossed
        ArrayList<IFluidTankProperties> importedProperties = new ArrayList<>();

        if (tile != null)
            for (EnumFacing facing : EnumFacing.HORIZONTALS) {
                if (tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, facing)) {
                    IFluidHandler capability = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, facing);
                    IFluidTankProperties[] faceProperties = capability.getTankProperties();
                    importedProperties.addAll(Arrays.asList(faceProperties));
                }
            }

        properties = importedProperties.toArray(new IFluidTankProperties[importedProperties.size()]);
    }

    return properties;
}
 
开发者ID:DaedalusGame,项目名称:Soot,代码行数:19,代码来源:CapabilityMixerOutput.java

示例3: drain

@Nullable
@Override
public FluidStack drain(int maxDrain, boolean doDrain) {
    FluidStack drained = null;

    if(tile != null)
        for (EnumFacing facing : EnumFacing.HORIZONTALS) {
            if(tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY,facing))
            {
                IFluidHandler capability = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY,facing);
                drained = capability.drain(maxDrain,doDrain);
                if(drained != null)
                    break;
            }
        }

    return drained;
}
 
开发者ID:DaedalusGame,项目名称:Soot,代码行数:18,代码来源:CapabilityMixerOutput.java

示例4: generate

@Override
public boolean generate(World worldIn, Random rand, BlockPos position) {
	if(size.equals(BlockPos.ORIGIN) && rand.nextFloat() < this.chance)
	{
		worldIn.setBlockState(position, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.HORIZONTALS[rand.nextInt(4)]), 3);
		((TileEntityChest)worldIn.getTileEntity(position)).setLootTable(lootTable, rand.nextLong());
		return false;
	}
	for(int x = 0; x < size.getX(); x++)
		for(int z = 0; z < size.getZ(); z++)
			if(rand.nextFloat() < this.chance)
			{
				BlockPos blockpos = new BlockPos(position.add(x, 0, z));
				boolean flag = false;
				for(EnumFacing facing : EnumFacing.HORIZONTALS)
					if(worldIn.getBlockState(blockpos.offset(facing)).getBlock() == Blocks.CHEST)
						flag = true;
				if(flag || !worldIn.isAirBlock(blockpos))
					continue;
				if(setBlock)
					worldIn.setBlockState(blockpos, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.HORIZONTALS[rand.nextInt(4)]), 3);
				((TileEntityChest)worldIn.getTileEntity(blockpos)).setLootTable(lootTable, rand.nextLong());
			}
	return false;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:25,代码来源:ChestGenerator.java

示例5: trySpread

private void trySpread(World world, BlockPos pos) {
	
	for (EnumFacing face : EnumFacing.HORIZONTALS) {
		BlockPos looppos = pos.offset(face);
		if (world.getLightFor(EnumSkyBlock.BLOCK, looppos) > 5) continue;
		if (world.isAirBlock(looppos) && (world.getBlockState(looppos.down()).getBlock() == Blocks.DIRT || world.getBlockState(looppos.down()).getBlock() == Blocks.FARMLAND)) {
			if (world.rand.nextInt(2) == 0) {
				if (world.getBlockState(looppos.down()).getBlock() == Blocks.DIRT)
					world.setBlockState(looppos.down(), Blocks.FARMLAND.getDefaultState(), 3);
				else
					world.setBlockState(looppos, UCBlocks.cropDevilsnare.getDefaultState(), 3);
				break;
			}
		}
	}
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:16,代码来源:DevilSnare.java

示例6: setSurroundingElevators

public static void setSurroundingElevators(World world, BlockPos pos, int floor) {
    for (EnumFacing dir : EnumFacing.HORIZONTALS) {
        TileEntityElevatorBase elevator = getElevatorBase(world, pos.offset(dir).offset(EnumFacing.DOWN, 2));
        if (elevator != null) {
            elevator.goToFloor(floor);
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:8,代码来源:BlockElevatorCaller.java

示例7: getMachines

private void getMachines(List<IAssemblyMachine> machineList, BlockPos pos) {
    for (EnumFacing dir : EnumFacing.HORIZONTALS) {
        TileEntity te = getWorld().getTileEntity(pos.offset(dir));
        if (te instanceof IAssemblyMachine && !machineList.contains(te)) {
            machineList.add((IAssemblyMachine) te);
            getMachines(machineList, te.getPos());
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:9,代码来源:TileEntityAssemblyController.java

示例8: get

public static VanillaDoubleChestItemHandler get(TileEntityChest chest)
{
    World world = chest.getWorld();
    BlockPos pos = chest.getPos();
    if (world == null || pos == null || !world.isBlockLoaded(pos))
        return null; // Still loading

    Block blockType = chest.getBlockType();

    EnumFacing[] horizontals = EnumFacing.HORIZONTALS;
    for (int i = horizontals.length - 1; i >= 0; i--)   // Use reverse order so we can return early
    {
        EnumFacing enumfacing = horizontals[i];
        BlockPos blockpos = pos.offset(enumfacing);
        Block block = world.getBlockState(blockpos).getBlock();

        if (block == blockType)
        {
            TileEntity otherTE = world.getTileEntity(blockpos);

            if (otherTE instanceof TileEntityChest)
            {
                TileEntityChest otherChest = (TileEntityChest) otherTE;
                return new VanillaDoubleChestItemHandler(chest, otherChest,
                        enumfacing != net.minecraft.util.EnumFacing.WEST && enumfacing != net.minecraft.util.EnumFacing.NORTH);

            }
        }
    }
    return NO_ADJACENT_CHESTS_INSTANCE; //All alone
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:31,代码来源:VanillaDoubleChestItemHandler.java

示例9: generateJuniperTree

public static void generateJuniperTree(World world, BlockPos pos, Random r) {
	int h = generateTrunk(2, 4, ModBlocks.log_juniper.getDefaultState(), world, pos, r);
	EnumFacing branchOffset = EnumFacing.HORIZONTALS[r.nextInt(4)];
	BlockPos branching = pos.up(h).offset(branchOffset);
	IBlockState log = ModBlocks.log_juniper.getDefaultState().withProperty(BlockModLog.LOG_AXIS, EnumAxis.NONE);
	ArrayList<BlockPos> logs = new ArrayList<BlockPos>();
	if (isAirBlock(world, branching)) {
		world.setBlockState(branching, log, 3);
		logs.add(branching);
	}
	BlockPos other = branching.offset(branchOffset.getOpposite(), 2);
	if (isAirBlock(world, other)) {
		world.setBlockState(other, log, 3);
		logs.add(other);
	}
	for (int i = 0; i < h / 2; i++) {
		BlockPos current = branching.up().offset(branchOffset, i + 1);
		if (isAirBlock(world, current)) {
			logs.add(current);
			world.setBlockState(current, log, 3);
		}
	}

	IBlockState leaves = ModBlocks.leaves_juniper.getDefaultState();
	for (BlockPos p : logs) {
		for (EnumFacing f : EnumFacing.VALUES) {
			BlockPos lpos1 = p.offset(f);
			if (isAirBlock(world, lpos1))
				world.setBlockState(lpos1, leaves, 3);
			for (EnumFacing f2 : EnumFacing.VALUES)
				if (f2 != EnumFacing.DOWN) {
					BlockPos lpos = p.offset(f).offset(f2);
					if (isAirBlock(world, lpos) && r.nextDouble() < 0.8D)
						world.setBlockState(lpos, leaves, 3);
				}
		}
	}

}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:39,代码来源:BlockModSapling.java

示例10: getStateFromMeta

@Override
public IBlockState getStateFromMeta(int meta) {
	for(EnumFacing facing : EnumFacing.HORIZONTALS)
		if(facing.getHorizontalIndex() == meta)
			return this.getDefaultState().withProperty(FACING, facing);
	return this.getDefaultState();
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:7,代码来源:BloodPlacer.java

示例11: addCollisionBoxToList

@Override
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox,
		List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) {
	if(CAULDRON_POSITIONS.contains(pos))
		if(worldIn.getBlockState(pos.down()).getBlock() != this)
			addCollisionBoxToList(pos, entityBox, collidingBoxes, new AxisAlignedBB(0, 0, 0, 1, 0.5, 1));
		else
		{
			ArrayList<EnumFacing> openDirections = new ArrayList<>();
			for(EnumFacing face : EnumFacing.HORIZONTALS)
				if(worldIn.getBlockState(pos.offset(face)).getBlock() != this)
					openDirections.add(face);
			if(openDirections.isEmpty())
				addCollisionBoxToList(pos, entityBox, collidingBoxes, NULL_AABB);
			else
			{
				if(openDirections.contains(EnumFacing.NORTH))
					addCollisionBoxToList(pos, entityBox, collidingBoxes, new AxisAlignedBB(0, 0, 0, 1, 1, 0.5));
				if(openDirections.contains(EnumFacing.EAST))
					addCollisionBoxToList(pos, entityBox, collidingBoxes, new AxisAlignedBB(1, 0, 0, 0.5, 1, 1));
				if(openDirections.contains(EnumFacing.SOUTH))
					addCollisionBoxToList(pos, entityBox, collidingBoxes, new AxisAlignedBB(0, 0, 1, 1, 1, 0.5));
				if(openDirections.contains(EnumFacing.WEST))
					addCollisionBoxToList(pos, entityBox, collidingBoxes, new AxisAlignedBB(0, 0, 0, 0.5, 1, 1));
			}
		}
	else
		addCollisionBoxToList(pos, entityBox, collidingBoxes, FULL_BLOCK_AABB);		
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:29,代码来源:CauldronBlock.java

示例12: tick

@Override
public void tick() {
	boolean flag = handler.getStackInSlot(0).getItem() == Item.getItemFromBlock(Blocks.AIR);
	if(flag)
		timer = 0;
	if(flag != hasItem)
	{
		hasItem = flag;
		dirty();
	}
	if(isActive && workingRecipe != null && !flag)
		if(checkForCompleation(true))
		{
			BlockPos pos = workingRecipe.getPositionOfRitual();
			for(EnumFacing facing : EnumFacing.HORIZONTALS)
				if(!((TileEntityHarshenDimensionalPedestal)world.getTileEntity(pos.offset(facing))).getItem().isEmpty())
					HarshenNetwork.sendToPlayersInWorld(world, new MessagePacketSpawnItemParticles(
									((TileEntityHarshenDimensionalPedestal)world.getTileEntity(pos.offset(facing))).getItem(),
									new Vec3d(pos.offset(facing)).addVector(0.5, 0.85, 0.5),
									HarshenUtils.speedToPos(new Vec3d(pos.offset(facing)).addVector(0.5, 0.85, 0.5),
									new Vec3d(pos).addVector(0.5, 1, 0.5), 15D), 1f, false, 20, workingRecipe.getTag()));
			
			HarshenNetwork.sendToPlayersInWorld(world, new MessagePacketSpawnItemParticles(workingRecipe.getOutput(),
					new Vec3d(pos).addVector(0.5, 1, 0.5), new Vec3d((randPos() - 0.5D) / 30D, (new Random().nextBoolean() ? -1 : 1 ) / 50D, (randPos() - 0.5D) / 30D), 1.5f, false,
					(int) ((activeTimer / 20f) * (activeTimer / 20f)), workingRecipe.getTag()));
		}
		else
			deactivateAll();
	if(isActiveNonController)
		activeNonControllerTimer++;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:31,代码来源:TileEntityHarshenDimensionalPedestal.java

示例13: deactivateAll

private void deactivateAll() 
{
	isActive = false;
	for(EnumFacing facing : EnumFacing.HORIZONTALS)
		((TileEntityHarshenDimensionalPedestal)world.getTileEntity(workingRecipe.getPositionOfRitual().offset(facing))).deactivate();	
	workingRecipe = null;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:7,代码来源:TileEntityHarshenDimensionalPedestal.java

示例14: ignitePottery

public void ignitePottery(World world, BlockPos pos){
	if(world.getBlockState(pos).getBlock()==BlocksRegistry.potteryKiln&&
			((EnumKilnTypes)world.getBlockState(pos).getValue(BlockPotteryKiln.TYPE))==EnumKilnTypes.WOOD){
		world.setBlockState(pos, BlocksRegistry.potteryKiln.getDefaultState().withProperty(BlockPotteryKiln.TYPE, EnumKilnTypes.ACTIVE));
		((TilePotteryKiln)world.getTileEntity(pos)).setActive(true);
		for(EnumFacing facing:EnumFacing.HORIZONTALS){
			ignitePottery(world, pos.offset(facing));
		}
	}
}
 
开发者ID:EnderiumSmith,项目名称:CharcoalPit,代码行数:10,代码来源:PileIgnitr.java

示例15: canAdvance

@Override
public boolean canAdvance(World world, BlockPos pos, IBlockState state) {

	int lilypads = 0;
	for (EnumFacing facing : EnumFacing.HORIZONTALS) {
		Block lilypad = world.getBlockState(pos.offset(facing)).getBlock();
		if (lilypad != null && (lilypad == Blocks.WATERLILY || lilypad == UCBlocks.lavalily))
			lilypads++;
	}
	return lilypads >= 4;
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:11,代码来源:GrowthSteps.java


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