當前位置: 首頁>>代碼示例>>Java>>正文


Java IOxygenReceiver類代碼示例

本文整理匯總了Java中micdoodle8.mods.galacticraft.api.transmission.tile.IOxygenReceiver的典型用法代碼示例。如果您正苦於以下問題:Java IOxygenReceiver類的具體用法?Java IOxygenReceiver怎麽用?Java IOxygenReceiver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IOxygenReceiver類屬於micdoodle8.mods.galacticraft.api.transmission.tile包,在下文中一共展示了IOxygenReceiver類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: renderTileEntityAt

import micdoodle8.mods.galacticraft.api.transmission.tile.IOxygenReceiver; //導入依賴的package包/類
@Override
public void renderTileEntityAt(
        TileEntity te,
        double x,
        double y,
        double z,
        float partialTicks) {
    if(te instanceof TileEntityHydroponics) {
        TileEntityHydroponics tile = (TileEntityHydroponics)te;

        GL11.glPushMatrix();
        GL11.glTranslatef((float) x, (float) y, (float) z);

        final TileEntity[] connections = OxygenUtil.getAdjacentOxygenConnections(tile);

        // meh
        for(int i = 0; i<connections.length;i++) {
            TileEntity cur = connections[i];
            ForgeDirection direction = ForgeDirection.values()[i];

            if(cur instanceof IOxygenReceiver) {
                if(((IOxygenReceiver)cur).getOxygenRequest(direction.getOpposite()) <= 0) {
                    connections[i] = null;
                }
            }
        }


        boolean hasNorth = connections[ForgeDirection.NORTH.ordinal()] != null;
        boolean hasSouth = connections[ForgeDirection.SOUTH.ordinal()] != null;
        boolean hasWest  = connections[ForgeDirection.WEST.ordinal()] != null;
        boolean hasEast  = connections[ForgeDirection.EAST.ordinal()] != null;



        final Tessellator tess = Tessellator.instance;
        model.render(tess, tile.getPlantGrowthStatus(), hasNorth, hasSouth, hasWest, hasEast);

        GL11.glPopMatrix();
    }

}
 
開發者ID:katzenpapst,項目名稱:amunra,代碼行數:43,代碼來源:RenderHydroponics.java

示例2: getRequest

import micdoodle8.mods.galacticraft.api.transmission.tile.IOxygenReceiver; //導入依賴的package包/類
/**
 * @return How much oxygen this network needs.
 */
@Override
public float getRequest(TileEntity... ignoreTiles)
{
	List<Float> requests = new ArrayList<Float>();

	for (TileEntity tileEntity : new HashSet<TileEntity>(this.oxygenTiles.keySet()))
	{
		if (Arrays.asList(ignoreTiles).contains(tileEntity))
		{
			continue;
		}

		if (tileEntity instanceof IOxygenReceiver)
		{
			if (!tileEntity.isInvalid())
			{
				if (tileEntity.worldObj.getBlockTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord) == tileEntity)
				{
					for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
					{
						Vector3 tileVec = new Vector3(tileEntity);
						TileEntity tile = tileVec.modifyPositionFromSide(direction).getTileEntity(tileEntity.worldObj);

						if (((IOxygenReceiver) tileEntity).canConnect(direction, NetworkType.OXYGEN) && this.getTransmitters().contains(tile))
						{
							requests.add(((IOxygenReceiver) tileEntity).getOxygenRequest(direction));
							continue;
						}
					}
				}
			}
		}
	}

	float total = 0.0F;

	for (Float f : requests)
	{
		total += f;
	}

	return total / requests.size();
}
 
開發者ID:4Space,項目名稱:4-Space-Legacy,代碼行數:47,代碼來源:OxygenNetwork.java


注:本文中的micdoodle8.mods.galacticraft.api.transmission.tile.IOxygenReceiver類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。