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


Java ForgeDirection类代码示例

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


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

示例1: rotateEngine

import net.minecraftforge.common.ForgeDirection; //导入依赖的package包/类
public void rotateEngine() {

		for (int i = getOrientation().ordinal() + 1; i <= getOrientation().ordinal() + 6; ++i) {
			ForgeDirection orient = ForgeDirection.values()[i % 6];

			Position pos = new Position(xCoord, yCoord, zCoord, orient);
			pos.moveForwards(1.0F);

			TileEntity tile = worldObj.getBlockTileEntity((int) pos.x, (int) pos.y, (int) pos.z);

			if (BlockUtil.isPoweredTile(tile)) {
				setOrientation(orient);
				worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);

				break;
			}
		}
	}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:19,代码来源:Engine.java

示例2: isBlockSolidOnSide

import net.minecraftforge.common.ForgeDirection; //导入依赖的package包/类
/**
 * Override how this work, normally liquids never have a solid top surface...
 * BUT if we where called by the native fire handling mechanism then we should
 * pretend that we do... so that we can burn
 */
@Override
public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) {
  /* We inspect the stack to see if we have been called indirectly by any of the fire handling routines. If so pretend to have a solid top surface so that the fire can stay on this block.
   * Note the special circumstances that forces us to do this stack based hack, it would make most software engineers cry - but works well for our purpose (not modifying any base-classes).  
   */
  if (!canBurn) return false;
  StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
  if (stackTraceElements.length < 7) return false;
  StackTraceElement caller = stackTraceElements[6];
  if (caller.getClassName().equals(Block.fire.getClass().getName())) {
    return true;
  }

  if (stackTraceElements.length < 7) return false;
  StackTraceElement caller8 = stackTraceElements[8];
  if (caller8.getClassName().equals(Block.fire.getClass().getName())) {
    return true;
  }
  return false;

}
 
开发者ID:mbrx,项目名称:FysiksFun,代码行数:27,代码来源:BlockFFFluid.java

示例3: GuiPropolisPipe

import net.minecraftforge.common.ForgeDirection; //导入依赖的package包/类
public GuiPropolisPipe(EntityPlayer player, Pipe pipe) {
	super(Defaults.TEXTURE_PATH_GUI + "/analyzer.png", new ContainerPropolisPipe(player.inventory, pipe));

	pipeLogic = (PipeLogicPropolis) pipe.logic;
	// Request filter set update if on client
	if (!Proxies.common.isSimulating(pipe.worldObj)) {
		pipeLogic.requestFilterSet();
	}

	xSize = 175;
	ySize = 225;

	for (int i = 0; i < 6; i++) {
		slotManager.add(new TypeFilterSlot(8, 18 + i * 18, ForgeDirection.values()[i], pipeLogic));
	}

	IApiaristTracker tracker = BeeManager.breedingManager.getApiaristTracker(player.worldObj, player.username);
	for (int i = 0; i < 6; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 2; k++) {
				slotManager.add(new SpeciesFilterSlot(tracker, 44 + j * 45 + k * 18, 18 + i * 18, ForgeDirection.values()[i], j, k, pipeLogic));
			}
		}
	}
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:26,代码来源:GuiPropolisPipe.java

示例4: onNeighborBlockChange

import net.minecraftforge.common.ForgeDirection; //导入依赖的package包/类
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, int neighborID)
{
    for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
    {
        if (world.getBlockId(x + side.offsetX, y + side.offsetY, z + side.offsetZ) == this.blockID)
        {
            if (this.passBlockChange(world, new Vector3(x, y, z), new ArrayList<Vector3>()))
                return;
        } else if (world.getBlockId(x + side.offsetX, y + side.offsetY, z + side.offsetZ) == ModBlocks.factoryController.blockID)
        {
            ModBlocks.factoryController.onNeighborBlockChange(world, x + side.offsetX, y + side.offsetY, z + side.offsetZ, world.getBlockId(x, y, z));
            return;
        }
    }
}
 
开发者ID:PaleoCrafter,项目名称:R0b0ts,代码行数:17,代码来源:BlockFactory.java

示例5: renderLeft

import net.minecraftforge.common.ForgeDirection; //导入依赖的package包/类
public boolean renderLeft()
{
	if(worldObj == null)
	{
		return true;
	}
	ForgeDirection left = getLeftSide();
	
	TileEntity en = worldObj.getBlockTileEntity(xCoord + left.offsetX, yCoord + left.offsetY, zCoord + left.offsetZ);
	
	if(en != null && en instanceof TileEntityRoast)
	{
		if(((TileEntityRoast)en).direction == direction)
		{
			return false;
		}
	}
	
	return true;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:21,代码来源:TileEntityRoast.java

示例6: fill

import net.minecraftforge.common.ForgeDirection; //导入依赖的package包/类
@Override
public int fill(ForgeDirection from, LiquidStack resource, boolean doFill) {

	// We only accept what is already in the tank or valid ingredients
	if (resourceTank.quantity > 0 && resourceTank.liquidId != resource.itemID)
		return 0;
	else if (resource.itemID != ForestryItem.liquidHoney.itemID)
		return 0;

	int used = resourceTank.fill(resource, doFill);

	if (doFill && used > 0) {
		sendNetworkUpdate();
	}

	return used;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:18,代码来源:MachineAnalyzer.java

示例7: getFront

import net.minecraftforge.common.ForgeDirection; //导入依赖的package包/类
/**
 *  Gets the direction the face is at(Opposite to the placer)
 */
public ForgeDirection getFront()
{
	if(direction == 0)//SOUTH PLACE
	{
		return ForgeDirection.NORTH;
	}
	if(direction == 1)//WEST PLACE
	{
		return ForgeDirection.EAST;
	}
	if(direction == 2)//NORTH PLACE
	{
		return ForgeDirection.SOUTH;
	}
	if(direction == 3)//EAST PLACE
	{
		return ForgeDirection.WEST;
	}
	return ForgeDirection.UNKNOWN;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:24,代码来源:TileEntityFurnaceMF.java

示例8: harvest

import net.minecraftforge.common.ForgeDirection; //导入依赖的package包/类
@Override
public Collection<ICrop> harvest(int x, int y, int z, ForgeDirection direction, int extent) {
	
	world = housing.getWorld();

	Stack<ICrop> crops = new Stack<ICrop>();
	for(int i = 0; i < extent; i++) {
		Vect position = translateWithOffset(x, y + 1, z, direction, i);
		for(IFarmable seed : germlings) {
			ICrop crop = seed.getCropAt(world, position.x, position.y, position.z);
			if(crop != null)
				crops.push(crop);
		}			
	}
	return crops;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:17,代码来源:FarmLogicPoale.java

示例9: registerIcons

import net.minecraftforge.common.ForgeDirection; //导入依赖的package包/类
@Override
public void registerIcons(IconRegister registry) {
	Icons.top = registry.registerIcon("examplemod:top");
	Icons.bottom = registry.registerIcon("examplemod:bottom");
	Icons.front = registry.registerIcon("examplemod:front");
	Icons.back = registry.registerIcon("examplemod:back");
	Icons.left = registry.registerIcon("examplemod:left");
	Icons.right = registry.registerIcon("examplemod:right");

	setTexture(ForgeDirection.EAST, Icons.left);
	setTexture(ForgeDirection.WEST, Icons.right);
	setTexture(ForgeDirection.SOUTH, Icons.front);
	setTexture(ForgeDirection.NORTH, Icons.back);
	setTexture(ForgeDirection.UP, Icons.top);
	setTexture(ForgeDirection.DOWN, Icons.bottom);
	setDefaultTexture(Icons.front);
}
 
开发者ID:OpenMods,项目名称:ExampleMod,代码行数:18,代码来源:BlockWith24Rotations.java

示例10: getAdjacentInventories

import net.minecraftforge.common.ForgeDirection; //导入依赖的package包/类
/**
 * Searches for inventories adjacent to block, excludes IPowerReceptor
 * 
 * @return
 */
public static IInventory[] getAdjacentInventories(World world, Vect blockPos, ForgeDirection from) {
	ArrayList<IInventory> inventories = new ArrayList<IInventory>();

	for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
		if(from != ForgeDirection.UNKNOWN && from != dir.getOpposite())
			continue;

		TileEntity entity = world.getBlockTileEntity(blockPos.x + dir.offsetX, blockPos.y + dir.offsetY, blockPos.z + dir.offsetZ);
		if (entity != null)
			if (entity instanceof IInventory)
				if (!(entity instanceof IPowerReceptor)) {
					inventories.add((IInventory) entity);
				}
	}

	return inventories.toArray(new IInventory[inventories.size()]);
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:23,代码来源:BlockUtil.java

示例11: readFromNBT

import net.minecraftforge.common.ForgeDirection; //导入依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound tagCompound)
{
    super.readFromNBT(tagCompound);
    orientation = ForgeDirection.getOrientation(tagCompound.getInteger("Orientation"));
    validMultiblock = tagCompound.getBoolean("ValidMultiblock");
    progressing = tagCompound.getBoolean("IsProgressing");
    progress = tagCompound.getInteger("Progress");
    NBTTagList tagList = tagCompound.getTagList("Items");
    inventory = new ItemStack[this.getSizeInventory()];
    for (int i = 0; i < tagList.tagCount(); ++i)
    {
        NBTTagCompound compound = (NBTTagCompound) tagList.tagAt(i);
        byte slotIndex = compound.getByte("Slot");
        if (slotIndex >= 0 && slotIndex < inventory.length)
        {
            inventory[slotIndex] = ItemStack.loadItemStackFromNBT(compound);
        }
    }
    if (tagCompound.hasKey("EnergyPosition"))
    {
        int[] coords = tagCompound.getIntArray("EnergyPosition");
        energyPos = new Vector3(coords[0], coords[1], coords[2]);
    }
}
 
开发者ID:PaleoCrafter,项目名称:R0b0ts,代码行数:26,代码来源:TileFactoryController.java

示例12: dumpToPipe

import net.minecraftforge.common.ForgeDirection; //导入依赖的package包/类
private void dumpToPipe(ForgeDirection[] pipes) {

		for (int i = SLOT_WASTE_1; i < SLOT_WASTE_1 + SLOT_WASTE_COUNT; i++) {
			if (inventory.getStackInSlot(i) == null) {
				continue;
			}
			if (inventory.getStackInSlot(i).stackSize <= 0) {
				continue;
			}

			ForgeDirection[] filtered;
			filtered = BlockUtil.filterPipeDirections(pipes, new ForgeDirection[] { getOrientation() });

			while (inventory.getStackInSlot(i).stackSize > 0 && filtered.length > 0) {
				BlockUtil.putFromStackIntoPipe(this, filtered, inventory.getStackInSlot(i));
			}

			if (inventory.getStackInSlot(i).stackSize <= 0) {
				inventory.setInventorySlotContents(i, null);
			}
		}
	}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:23,代码来源:EngineCopper.java

示例13: matchType

import net.minecraftforge.common.ForgeDirection; //导入依赖的package包/类
public boolean matchType(ForgeDirection orientation, EnumFilterType type, IBee bee) {
	EnumFilterType filter = typeFilter[orientation.ordinal()];
	if (filter == EnumFilterType.BEE)
		return type != EnumFilterType.ITEM && type != EnumFilterType.CLOSED && type != EnumFilterType.CLOSED;

	// Special bee filtering
	if (bee != null) {
		if (filter == EnumFilterType.PURE_BREED)
			return bee.isPureBred(EnumBeeChromosome.SPECIES);
		if (filter == EnumFilterType.NOCTURNAL)
			return bee.getGenome().getNocturnal();
		if (filter == EnumFilterType.PURE_NOCTURNAL)
			return bee.getGenome().getNocturnal() && bee.isPureBred(EnumBeeChromosome.NOCTURNAL);
		if (filter == EnumFilterType.FLYER)
			return bee.getGenome().getTolerantFlyer();
		if (filter == EnumFilterType.PURE_FLYER)
			return bee.getGenome().getTolerantFlyer() && bee.isPureBred(EnumBeeChromosome.TOLERANT_FLYER);
		if (filter == EnumFilterType.CAVE)
			return bee.getGenome().getCaveDwelling();
		if (filter == EnumFilterType.PURE_CAVE)
			return bee.getGenome().getCaveDwelling() && bee.isPureBred(EnumBeeChromosome.CAVE_DWELLING);
	}

	// Compare the remaining
	return filter == type;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:27,代码来源:PipeLogicPropolis.java

示例14: getStartInventorySide

import net.minecraftforge.common.ForgeDirection; //导入依赖的package包/类
@Override
public int getStartInventorySide(ForgeDirection side) {
	switch(side) {
	case UP:
		return TileFarmPlain.SLOT_GERMLINGS_1;
	case DOWN:
		return TileFarmPlain.SLOT_PRODUCTION_1;
	case NORTH:
	case SOUTH:
		return TileFarmPlain.SLOT_RESOURCES_1;
	case WEST:
	case EAST:
		return TileFarmPlain.SLOT_FERTILIZER;
	default:
		return 0;
	}
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:18,代码来源:TileHatch.java

示例15: extractItem

import net.minecraftforge.common.ForgeDirection; //导入依赖的package包/类
@Override
public ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount) {

	ItemStack product = null;

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

		product = getStackInSlot(i).copy();
		if (doRemove) {
			getStackInSlot(i).stackSize = 0;
			setInventorySlotContents(i, null);
		}
		break;
	}
	return new ItemStack[] { product };
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:20,代码来源:MachineAnalyzer.java


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