本文整理汇总了Java中net.minecraftforge.items.wrapper.SidedInvWrapper类的典型用法代码示例。如果您正苦于以下问题:Java SidedInvWrapper类的具体用法?Java SidedInvWrapper怎么用?Java SidedInvWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SidedInvWrapper类属于net.minecraftforge.items.wrapper包,在下文中一共展示了SidedInvWrapper类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getItemHandler
import net.minecraftforge.items.wrapper.SidedInvWrapper; //导入依赖的package包/类
public static IItemHandler getItemHandler(World world, BlockPos pos, EnumFacing side, boolean includeEntities) {
TileEntity te = world.getTileEntity(pos);
if (te instanceof IDrawer) {
return new DrawerWrapper((IDrawer) te);
} else if (te instanceof IDrawerGroup) {
return new DrawerGroupWrapper((IDrawerGroup) te);
} else if (te == null || !te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side)) {
IInventory inv = includeEntities ? TileEntityHopper.getInventoryAtPosition(world, pos.getX(), pos.getY(), pos.getZ()) : (te instanceof IInventory ? (IInventory) te : null);
if (inv != null) {
if (inv instanceof ISidedInventory) {
return new SidedInvWrapper((ISidedInventory) inv, side);
} else {
return new InvWrapper(inv);
}
} else
return null;
} else {
return te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side);
}
}
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:21,代码来源:TomsModUtils.java
示例2: getCapability
import net.minecraftforge.items.wrapper.SidedInvWrapper; //导入依赖的package包/类
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
if (!getStack().isEmpty() && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && facing == EnumFacing.DOWN) {
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(new SidedInvWrapper(this, facing));
}
return super.getCapability(capability, facing);
}
开发者ID:p455w0rd,项目名称:DankNull,代码行数:8,代码来源:TileDankNullDock.java
示例3: getItemHandlerCap
import net.minecraftforge.items.wrapper.SidedInvWrapper; //导入依赖的package包/类
@Deprecated
public static IItemHandler getItemHandlerCap(TileEntity tileEntity, EnumFacing face) {
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, face)) {
return tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, face);
} else if (tileEntity instanceof ISidedInventory && face != null) {
return new SidedInvWrapper(((ISidedInventory) tileEntity), face);
} else if (tileEntity instanceof IInventory) {
return new InvWrapper(((IInventory) tileEntity));
}
return new EmptyHandler();
}
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:12,代码来源:InventoryUtils.java
示例4: getItemHandler_Raw
import net.minecraftforge.items.wrapper.SidedInvWrapper; //导入依赖的package包/类
/**
* Grabs the IItemHandler capability for the tile,
* Will wrap if the cap doesnt exist, If you care about only interacting with the cap,
* Then use {@link #hasItemHandler_Raw} to check if the tile only has the cap before calling.
*
* @param tile The tile.
* @param face The face.
* @return The handler, wrapped if the tile uses legacy interfaces and no cap.
*/
public static IItemHandler getItemHandler_Raw(TileEntity tile, EnumFacing face) {
if (hasItemHandler(tile, face)) {
if (hasItemHandler_Raw(tile, face)) {
return tile.getCapability(ITEM_HANDLER, face);
} else {
if (tile instanceof ISidedInventory && face != null) {
return new SidedInvWrapper((ISidedInventory) tile, face);
} else {
return new InvWrapper((IInventory) tile);
}
}
}
return null;
}
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:24,代码来源:InventoryUtils.java
示例5: makeInvWrapper
import net.minecraftforge.items.wrapper.SidedInvWrapper; //导入依赖的package包/类
/** Create six inventory wrappers for each inventory */
public static SidedInvWrapper[] makeInvWrapper(ISidedInventory inv) {
SidedInvWrapper[] wrapper = new SidedInvWrapper[6];
for(int i = 0; i < 6; i++) {
wrapper[i] = new SidedInvWrapper(inv, EnumFacing.getFront(i));
}
return wrapper;
}
开发者ID:sblectric,项目名称:LightningCraft,代码行数:9,代码来源:LCMisc.java
示例6: getCapability
import net.minecraftforge.items.wrapper.SidedInvWrapper; //导入依赖的package包/类
@Override
@Nonnull
public <T> T getCapability(@Nonnull Capability<T> capability, @Nonnull EnumFacing facing) {
if (capability == CapabilityEnergy.ENERGY)
return CapabilityEnergy.ENERGY.cast(this);
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
return (T) new SidedInvWrapper(this, facing);
return super.getCapability(capability, facing);
}
开发者ID:Vanhal,项目名称:ProgressiveAutomation,代码行数:10,代码来源:BaseTileEntity.java
示例7: tryGetHandler
import net.minecraftforge.items.wrapper.SidedInvWrapper; //导入依赖的package包/类
public static IItemHandler tryGetHandler(TileEntity te, EnumFacing side) {
if (te == null) return null;
if (te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side))
return te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side);
if (te instanceof ISidedInventory)
return new SidedInvWrapper((ISidedInventory)te, side);
if (te instanceof IInventory)
return new InvWrapper((IInventory)te);
return null;
}
开发者ID:OpenMods,项目名称:OpenModsLib,代码行数:15,代码来源:InventoryUtils.java
示例8: getInventoryWrapper
import net.minecraftforge.items.wrapper.SidedInvWrapper; //导入依赖的package包/类
protected SidedInvWrapper getInventoryWrapper(EnumFacing side)
{
if (!this.inventoryWrapperCache.containsKey(side))
this.inventoryWrapperCache.put(side, new SidedInvWrapper(this, side));
return this.inventoryWrapperCache.get(side);
}
开发者ID:OPMCorp,项目名称:Qbar,代码行数:7,代码来源:TileCraftingMachineBase.java
注:本文中的net.minecraftforge.items.wrapper.SidedInvWrapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论