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


Java ICapabilityProvider.hasCapability方法代码示例

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


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

示例1: lookFor

import net.minecraftforge.common.capabilities.ICapabilityProvider; //导入方法依赖的package包/类
@Override
public void lookFor(LazyEnergyCapProvider lecp, FluxCompat.Registry r) {
	final ICapabilityProvider icp = lecp.getObject();
	if (icp == null || icp instanceof TileEntityFluxGen || blacklist(icp)) return;
	EnumFacing f = null;
	try {
		for (int i = 0; i < U.FANCY_FACING.length; i++) {
			f = U.FANCY_FACING[i];
			if (icp.hasCapability(CapabilityEnergy.ENERGY, f)) {
				r.register(EnergyType.FORGE_ENERGY, ForgeFluxCompat::forgeFactorize);
			}
		}
	} catch (Exception e) {
		MCFluxReport.addErrMsg(new ErrMsg.BadImplementation("Forge Energy", icp.getClass(), e, f));
	}
}
 
开发者ID:Szewek,项目名称:Minecraft-Flux,代码行数:17,代码来源:ForgeFluxCompat.java

示例2: exportStackToInventory

import net.minecraftforge.common.capabilities.ICapabilityProvider; //导入方法依赖的package包/类
@Nonnull
public static ItemStack exportStackToInventory(ICapabilityProvider provider, ItemStack stack, EnumFacing side) {
    if (provider.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side)) {
        IItemHandler handler = provider.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side);
        return ItemHandlerHelper.insertItem(handler, stack, false);
    }
    return stack;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:9,代码来源:PneumaticCraftUtils.java

示例3: insert

import net.minecraftforge.common.capabilities.ICapabilityProvider; //导入方法依赖的package包/类
@Nonnull
public static ItemStack insert(ICapabilityProvider provider, ItemStack itemStack, EnumFacing side, boolean simulate) {
    if (provider.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side)) {
        IItemHandler handler = provider.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side);
        return ItemHandlerHelper.insertItem(handler, itemStack, simulate);
    }
    return ItemStack.EMPTY;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:9,代码来源:IOHelper.java

示例4: update

import net.minecraftforge.common.capabilities.ICapabilityProvider; //导入方法依赖的package包/类
@Override
public void update()
{
    if (this.getWorld().isRemote)
        return;

    for (EnumFacing dir : EnumFacing.VALUES)
    {
        EnumFacing side = dir.getOpposite();
        BlockPos pos = this.getPos().offset(dir);

        ICapabilityProvider provider = this.getWorld().getTileEntity(pos);
        if (provider == null)
            continue;

        IEnergyStorage storage = null;
        if (provider.hasCapability(CapabilityEnergy.ENERGY, side))
            storage = provider.getCapability(CapabilityEnergy.ENERGY, side);

        //TODO? Other compatible energy types?

        if (storage == null)
            continue;

        if (storage.canReceive())
            storage.receiveEnergy(POWER_PER_TICK, false);
    }
}
 
开发者ID:LexManos,项目名称:VoidUtils,代码行数:29,代码来源:TileEntityEnergyCell.java

示例5: isPowerSource

import net.minecraftforge.common.capabilities.ICapabilityProvider; //导入方法依赖的package包/类
public static boolean isPowerSource(Object object, EnumFacing facing)
{
    if (!(object instanceof ICapabilityProvider))
        return false;

    ICapabilityProvider cap = (ICapabilityProvider) object;

    Capability teslaCap = TeslaControllerBase.PRODUCER.getCapability();
    return cap.hasCapability(CapabilityEnergy.ENERGY, facing)
            || (teslaCap != null && cap.hasCapability(teslaCap, facing));
}
 
开发者ID:gigaherz,项目名称:Ender-Rift,代码行数:12,代码来源:AutomationHelper.java

示例6: isAutomatable

import net.minecraftforge.common.capabilities.ICapabilityProvider; //导入方法依赖的package包/类
public static boolean isAutomatable(Object object, EnumFacing facing)
{
    if (!(object instanceof ICapabilityProvider))
        return false;

    ICapabilityProvider cap = (ICapabilityProvider) object;

    return cap.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing);
}
 
开发者ID:gigaherz,项目名称:Ender-Rift,代码行数:10,代码来源:AutomationHelper.java

示例7: getCapability

import net.minecraftforge.common.capabilities.ICapabilityProvider; //导入方法依赖的package包/类
@Nullable
public static <T> T getCapability(@Nullable ICapabilityProvider provider, Capability<T> capability, @Nullable EnumFacing facing) 
{
	return provider != null && provider.hasCapability(capability, facing) ? provider.getCapability(capability, facing) : null;
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:6,代码来源:CapabilityUtils.java

示例8: getCapability

import net.minecraftforge.common.capabilities.ICapabilityProvider; //导入方法依赖的package包/类
@Nullable
public static <T> T getCapability(@Nullable ICapabilityProvider provider, Capability<T> capability, @Nullable EnumFacing facing) {
	return provider != null && provider.hasCapability(capability, facing) ? provider.getCapability(capability, facing) : null;
}
 
开发者ID:bookerthegeek,项目名称:Mob-Option-Redux,代码行数:5,代码来源:CapabilityProvider.java

示例9: hasFluidHandler

import net.minecraftforge.common.capabilities.ICapabilityProvider; //导入方法依赖的package包/类
public static boolean hasFluidHandler(ICapabilityProvider capProvider, EnumFacing side)
{
	return capProvider.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side);
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:5,代码来源:CapUtils.java

示例10: hasItemHandler

import net.minecraftforge.common.capabilities.ICapabilityProvider; //导入方法依赖的package包/类
public static boolean hasItemHandler(ICapabilityProvider capProvider, EnumFacing side)
{
	return capProvider.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side);
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:5,代码来源:CapUtils.java

示例11: getFluidHandlerCapability

import net.minecraftforge.common.capabilities.ICapabilityProvider; //导入方法依赖的package包/类
public static IFluidHandler getFluidHandlerCapability(@Nullable ICapabilityProvider provider, EnumFacing side) {
    if (provider != null && provider.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side)) {
      return provider.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side);
    }
    return getLegacyHandler(provider, side);
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:7,代码来源:FluidUtil.java

示例12: isTeslaHolder

import net.minecraftforge.common.capabilities.ICapabilityProvider; //导入方法依赖的package包/类
/**
 * Checks if a capability provider is a Tesla holder.
 * 
 * @param provider The provider to check. ItemStack/TileEntity/Entity and so on.
 * @param side The side to check.
 * @return Whether or not the provider is a Tesla holder.
 */
public static boolean isTeslaHolder (ICapabilityProvider provider, EnumFacing side) {
    
    return provider.hasCapability(TeslaCapabilities.CAPABILITY_HOLDER, side);
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:12,代码来源:TeslaUtils.java

示例13: isTeslaConsumer

import net.minecraftforge.common.capabilities.ICapabilityProvider; //导入方法依赖的package包/类
/**
 * Checks if a capability provider is a Tesla consumer.
 * 
 * @param provider The provider to check. ItemStack/TileEntity/Entity and so on.
 * @param side The side to check.
 * @return Whether or not the provider is a Tesla consumer.
 */
public static boolean isTeslaConsumer (ICapabilityProvider provider, EnumFacing side) {
    
    return provider.hasCapability(TeslaCapabilities.CAPABILITY_CONSUMER, side);
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:12,代码来源:TeslaUtils.java

示例14: isTeslaProducer

import net.minecraftforge.common.capabilities.ICapabilityProvider; //导入方法依赖的package包/类
/**
 * Checks if a capability provider is a Tesla producer.
 * 
 * @param provider The provider to check. ItemStack/TileEntity/Entity and so on.
 * @param side The side to check.
 * @return Whether or not the provider is a Tesla producer.
 */
public static boolean isTeslaProducer (ICapabilityProvider provider, EnumFacing side) {
    
    return provider.hasCapability(TeslaCapabilities.CAPABILITY_PRODUCER, side);
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:12,代码来源:TeslaUtils.java

示例15: getCapability

import net.minecraftforge.common.capabilities.ICapabilityProvider; //导入方法依赖的package包/类
/**
 * Get a capability handler from an {@link ICapabilityProvider} if it exists.
 *
 * @param provider   The provider
 * @param capability The capability
 * @param facing     The facing
 * @param <T>        The handler type
 * @return The handler, if any.
 */
@Nullable
public static <T> T getCapability(@Nullable ICapabilityProvider provider, Capability<T> capability, @Nullable EnumFacing facing) {
	return provider != null && provider.hasCapability(capability, facing) ? provider.getCapability(capability, facing) : null;
}
 
开发者ID:stuebz88,项目名称:modName,代码行数:14,代码来源:CapabilityUtils.java


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