本文整理汇总了Java中appeng.api.parts.IPart类的典型用法代码示例。如果您正苦于以下问题:Java IPart类的具体用法?Java IPart怎么用?Java IPart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPart类属于appeng.api.parts包,在下文中一共展示了IPart类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createPartFromItemStack
import appeng.api.parts.IPart; //导入依赖的package包/类
@Override
public IPart createPartFromItemStack( final ItemStack itemStack )
{
IPart newPart = null;
// Get the part
AEPartsEnum part = AEPartsEnum.getPartFromDamageValue( itemStack );
// Attempt to create a new instance of the part
try
{
newPart = part.createPartInstance( itemStack );
}
catch( Throwable e )
{
// Bad stuff, log the error.
ThELog.error( e, "Unable to create cable-part from item: %s", itemStack.getDisplayName() );
}
// Return the part
return newPart;
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:24,代码来源:ItemAEPart.java
示例2: getPart
import appeng.api.parts.IPart; //导入依赖的package包/类
/**
* Gets the AE part at the specified location.
*
* @param tileSide
* @param world
* @param x
* @param y
* @param z
* @return
*/
private static IPart getPart( final ForgeDirection tileSide, final World world, final int x, final int y, final int z )
{
// Get the host at the specified position
IPartHost partHost = (IPartHost)( world.getTileEntity( x, y, z ) );
// Ensure we got a host
if( partHost == null )
{
return null;
}
// Get the part from the host
return( partHost.getPart( tileSide ) );
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:25,代码来源:ThEGuiHandler.java
示例3: refreshCache
import appeng.api.parts.IPart; //导入依赖的package包/类
private void refreshCache()
{
// Clear the reference
this.digiVisSource.clear();
IDigiVisSource visSource = null;
try
{
// Get the world
World world = DimensionManager.getWorld( this.worldID );
// Ensure the world is not null
if( world == null )
{
return;
}
// Get the tile
TileEntity tile = world.getTileEntity( this.x, this.y, this.z );
// Ensure we got a tile
if( tile == null )
{
return;
}
// Is the source a block?
if( this.side.equals( ForgeDirection.UNKNOWN ) )
{
// Ensure the block is a source
if( !( tile instanceof IDigiVisSource ) )
{
return;
}
// Get the source
visSource = (IDigiVisSource)tile;
}
else
{
// Ensure the tile is a part host
if( !( tile instanceof IPartHost ) )
{
return;
}
// Get the part from the host
IPart part = ( (IPartHost)tile ).getPart( this.side );
// Ensure we got the part, and it is a vis source
if( !( part instanceof IDigiVisSource ) )
{
return;
}
// Cast to the source
visSource = (IDigiVisSource)part;
}
// Check the UID
if( visSource.getUID() == this.UID )
{
// Set the source
this.digiVisSource = new WeakReference<IDigiVisSource>( visSource );
}
}
catch( Exception e )
{
}
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:71,代码来源:DigiVisSourceData.java
示例4: getPartFromSidedID
import appeng.api.parts.IPart; //导入依赖的package包/类
/**
* Gets the sided part for the GUI ID.
*
* @param ID
* @param world
* @param x
* @param y
* @param z
* @return
*/
private static IPart getPartFromSidedID( final int ID, final World world, final int x, final int y, final int z )
{
ForgeDirection side = ForgeDirection.getOrientation( ID % ThEGuiHandler.ID_STEP_VALUE );
return ThEGuiHandler.getPart( side, world, x, y, z );
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:16,代码来源:ThEGuiHandler.java
示例5: getFacingPartFromPartHost
import appeng.api.parts.IPart; //导入依赖的package包/类
/**
* Gets the part that is facing the essentia storage bus.
*
* @param partHost
* @return
*/
protected IPart getFacingPartFromPartHost( final IPartHost partHost )
{
return partHost.getPart( this.partStorageBus.getSide().getOpposite() );
}
开发者ID:Nividica,项目名称:ThaumicEnergistics,代码行数:11,代码来源:HandlerEssentiaStorageBusBase.java
注:本文中的appeng.api.parts.IPart类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论