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


Java ForgeDirection.UP属性代码示例

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


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

示例1: tryPlantingCocoa

private boolean tryPlantingCocoa(Vect position) {
	
	Vect current = position;
	while(isWoodBlock(current) && BlockLog.limitToValidMetadata(getBlockMeta(current)) == 3) {
		
		for(ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
			if(direction == ForgeDirection.UP || direction == ForgeDirection.DOWN)
				continue;
			
			Vect candidate = new Vect(current.x + direction.offsetX, current.y, current.z + direction.offsetZ);
			if(isAirBlock(candidate))
				return housing.plantGermling(cocoa, world, candidate.x, candidate.y, candidate.z);
		}
		
		current = current.add(new Vect(0, 1, 0));
		if(current.y - position.y > 1)
			break;
	}
	
	return false;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:21,代码来源:FarmLogicCocoa.java

示例2: DirectionTo

/**
    * Will Return NULL if it's at some diagonal!
    */
public ForgeDirection DirectionTo(WorldCoord loc)
{
	int ox = x - loc.x;
	int oy = y - loc.y;
	int oz = z - loc.z;
	
	int xlen = Math.abs( ox );
	int ylen = Math.abs( oy );
	int zlen = Math.abs( oz );
	
	if ( loc.isEqual( this.copy().add( ForgeDirection.EAST, xlen ) ) )
		return ForgeDirection.EAST;
	
	if ( loc.isEqual( this.copy().add( ForgeDirection.WEST, xlen ) ) )
			return ForgeDirection.WEST; 
	
	if ( loc.isEqual( this.copy().add( ForgeDirection.NORTH, zlen ) ) )
			return ForgeDirection.NORTH;
	
	if ( loc.isEqual( this.copy().add( ForgeDirection.SOUTH, zlen ) ) )
			return ForgeDirection.SOUTH;
	
	if ( loc.isEqual( this.copy().add( ForgeDirection.UP, ylen ) ) )
			return ForgeDirection.UP;
	
	if ( loc.isEqual( this.copy().add( ForgeDirection.DOWN, ylen ) ) )
			return ForgeDirection.DOWN;
	
	return null;
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:33,代码来源:WorldCoord.java

示例3: getFireSpreadSpeed

@Override
public int getFireSpreadSpeed(World world, int x, int y, int z, int metadata, ForgeDirection face) {
	if (face == ForgeDirection.DOWN)
		return 20;
	else if (face != ForgeDirection.UP)
		return 10;
	else
		return 5;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:9,代码来源:BlockLeaves.java

示例4: extractItem

/**
 * Extracts saplings from top and bottom, wood from the sides.
 */
@Override
public ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount) {

	for (int i = 0; i < harvestStacks.length; i++) {
		if (harvestStacks[i] == null) {
			continue;
		}

		ItemStack product = null;

		// Extract only saplings from top or bottom
		if (hasWindfallById(harvestStacks[i].getItem().itemID)) {

			if (Config.harvesterSideSensitive && this.isSideSensitive && from != ForgeDirection.DOWN && from != ForgeDirection.UP) {
				continue;
			} else {
				product = getWindfall(harvestStacks[i]);
			}

		} else if (Config.harvesterSideSensitive && this.isSideSensitive && (from == ForgeDirection.DOWN || from == ForgeDirection.UP)) {
			continue;
		} else {
			product = new ItemStack(harvestStacks[i].getItem().itemID, 1, 0);
		}

		if (doRemove && product != null) {
			decrStackSize(i, 1);
		}

		// if(!hasProperSoil() && tile.worldObj.rand.nextInt(100) < 25)
		// return new ItemStack(Block.dirt);
		// else
		return new ItemStack[] { product };
	}

	return new ItemStack[0];
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:40,代码来源:Harvester.java

示例5: addItem

@Override
public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) {

	if (!this.isLinked())
		return 0;

	IInventory inventory = getOrCreateTradeInventory();
	ItemStack tradegood = inventory.getStackInSlot(TradeStation.SLOT_TRADEGOOD);

	// Special handling for paper
	if (stack.itemID == Item.paper.itemID) {

		// Handle paper as resource if its not the trade good or pumped in from above or below
		if ((tradegood != null && tradegood.itemID != Item.paper.itemID) || from == ForgeDirection.DOWN || from == ForgeDirection.UP)
			return StackUtils.addToInventory(stack, inventory, doAdd, TradeStation.SLOT_LETTERS_1, TradeStation.SLOT_LETTERS_COUNT);

	}

	// Special handling for stamps
	if (stack.getItem() instanceof IStamps) {

		// Handle stamps as resource if its not the trade good or pumped in from above or below
		if ((tradegood != null && !(tradegood.getItem() instanceof IStamps)) || from == ForgeDirection.DOWN || from == ForgeDirection.UP)
			return StackUtils.addToInventory(stack, inventory, doAdd, TradeStation.SLOT_STAMPS_1, TradeStation.SLOT_STAMPS_COUNT);

	}

	// Everything else
	if (tradegood == null)
		return 0;

	if (!tradegood.isItemEqual(stack))
		return 0;

	return StackUtils.addToInventory(stack, inventory, doAdd, TradeStation.SLOT_INPUTBUF_1, TradeStation.SLOT_BUFFER_COUNT);
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:36,代码来源:MachineTrader.java

示例6: getStartInventorySide

@Override
public int getStartInventorySide(ForgeDirection side) {
	// BOTTOM
	if (side == ForgeDirection.DOWN)
		return SLOT_DRONE;
	// TOP
	else if (side == ForgeDirection.UP)
		return SLOT_QUEEN;
	// SIDES
	else
		return SLOT_PRODUCT_1;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:12,代码来源:MachineApiary.java

示例7: getSizeInventorySide

@Override
public int getSizeInventorySide(ForgeDirection side) {
	if (side == ForgeDirection.DOWN || side == ForgeDirection.UP)
		return 1;
	else
		return SLOT_PRODUCT_COUNT;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:7,代码来源:MachineApiary.java

示例8: getStartInventorySide

@Override
public int getStartInventorySide(ForgeDirection side) {
	if (side == ForgeDirection.UP || side == ForgeDirection.DOWN)
		return SLOT_WASTE_1;
	else
		return SLOT_FUEL;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:7,代码来源:EngineCopper.java

示例9: getSizeInventorySide

@Override
public int getSizeInventorySide(ForgeDirection side) {
	if (side == ForgeDirection.UP || side == ForgeDirection.DOWN)
		return SLOT_WASTE_COUNT;
	else
		return 1;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:7,代码来源:EngineCopper.java

示例10: getStartInventorySide

@Override
public int getStartInventorySide(ForgeDirection side) {
	// BOTTOM
	if (side == ForgeDirection.DOWN)
		return outputSlot1;
	// TOP
	else if (side == ForgeDirection.UP)
		return canSlot;
	// SIDES
	else
		return inputSlot1;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:12,代码来源:MachineAnalyzer.java

示例11: getSizeInventorySide

@Override
public int getSizeInventorySide(ForgeDirection side) {
	if (side == ForgeDirection.UP)
		return 1;
	else if (side == ForgeDirection.DOWN)
		return 4;
	else
		return 6;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:9,代码来源:MachineAnalyzer.java

示例12: addItem

@Override
public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) {
	if (from == ForgeDirection.UP && RecipeManager.findMatchingSmelting(stack) != null)
		return inventory.addStack(stack, SLOT_METAL, 1, false, doAdd);
	return inventory.addStack(stack, SLOT_INVENTORY_1, SLOT_INVENTORY_COUNT, false, doAdd);
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:6,代码来源:MachineFabricator.java

示例13: extractItem

@Override
public ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount) {
	ItemStack product = null;

	for (int i = SLOT_PRODUCT_1; i < SLOT_PRODUCT_1 + SLOT_PRODUCT_COUNT; i++) {
		if (inventory.getStackInSlot(i) == null) {
			continue;
		}

		// Princesses can only be extracted from top.
		if (inventory.getStackInSlot(i).itemID == ForestryItem.beePrincessGE.itemID) {
			if (PluginForestryApiculture.apiarySideSensitive && from != ForgeDirection.UP) {
				continue;
			}

			product = inventory.getStackInSlot(i).copy();
			if (doRemove) {
				inventory.getStackInSlot(i).stackSize = 0;
				inventory.setInventorySlotContents(i, null);
			}
			break;

			// Drones can only be extracted from the bottom.
		} else if (inventory.getStackInSlot(i).itemID == ForestryItem.beeDroneGE.itemID) {
			if (PluginForestryApiculture.apiarySideSensitive && from != ForgeDirection.DOWN) {
				continue;
			}

			product = StackUtils.createSplitStack(inventory.getStackInSlot(i), 1);
			product.stackSize = 1;
			if (doRemove) {
				inventory.getStackInSlot(i).stackSize--;
				if (inventory.getStackInSlot(i).stackSize <= 0) {
					inventory.setInventorySlotContents(i, null);
				}
			}
			break;

			// Everything else to be extracted from the sides
		} else {
			if (PluginForestryApiculture.apiarySideSensitive && (from == ForgeDirection.UP || from == ForgeDirection.DOWN)) {
				continue;
			}

			product = StackUtils.createSplitStack(inventory.getStackInSlot(i), 1);
			if (doRemove) {
				inventory.getStackInSlot(i).stackSize--;
				if (inventory.getStackInSlot(i).stackSize <= 0) {
					inventory.setInventorySlotContents(i, null);
				}
			}
			break;
		}
	}

	return new ItemStack[] { product };
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:57,代码来源:MachineApiary.java


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