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


Java Capability类代码示例

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


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

示例1: writeNBT

import net.minecraftforge.common.capabilities.Capability; //导入依赖的package包/类
@Nullable
@Override
public NBTBase writeNBT(Capability<FoodStats> capability, FoodStats instance, EnumFacing side) {
    NBTTagCompound tagCompound = new NBTTagCompound();
    tagCompound.setInteger("amount", instance.getAmount());
    tagCompound.setBoolean("wolfFood", instance.isWolfFood());
    tagCompound.setFloat("saturationModifier", instance.getSaturationModifier());
    tagCompound.setBoolean("alwaysEdible", instance.isAlwaysEdible());
    tagCompound.setInteger("maxItemUseDuration", instance.getMaxItemUseDuration());
    tagCompound.setInteger("action", instance.getAction().ordinal());
    if (instance.getPotion() != null)
        tagCompound.setTag("potion", instance.getPotion().writeCustomPotionEffectToNBT(new NBTTagCompound()));
    tagCompound.setFloat("potionEffectProbability", instance.getPotionEffectProbability());
    tagCompound.setString("unlocalizedName", instance.getUnlocalizedName());
    return tagCompound;
}
 
开发者ID:MinecraftPangu,项目名称:Pangu,代码行数:17,代码来源:CapabilityFood.java

示例2: getCapability

import net.minecraftforge.common.capabilities.Capability; //导入依赖的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: getCapability

import net.minecraftforge.common.capabilities.Capability; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing)
{
    if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
        return (T) tank;
    return super.getCapability(capability, facing);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:9,代码来源:TileFluidHandler.java

示例4: getCapability

import net.minecraftforge.common.capabilities.Capability; //导入依赖的package包/类
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing)
{
	if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
	{
		return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(itemStackHandler);
	}
	return super.getCapability(capability, facing);
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:10,代码来源:TileEntityInfernalSmelter.java

示例5: getCapability

import net.minecraftforge.common.capabilities.Capability; //导入依赖的package包/类
@Nullable
@Override
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing)
{
    return sender instanceof ICapabilityProvider
            ? ((ICapabilityProvider) sender).getCapability(capability, facing)
            : null;
}
 
开发者ID:Ivorforce,项目名称:MCOpts,代码行数:9,代码来源:DelegatingSender.java

示例6: getCapability

import net.minecraftforge.common.capabilities.Capability; //导入依赖的package包/类
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
	if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
		return (T) new MachineItemHandler(this);
	}

	return super.getCapability(capability, facing);
}
 
开发者ID:astronautlabs,项目名称:rezolve,代码行数:9,代码来源:MachineEntity.java

示例7: getCapability

import net.minecraftforge.common.capabilities.Capability; //导入依赖的package包/类
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing)
{
	if (capability  == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
		return (T) this.handler;
	return super.getCapability(capability, facing);
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:8,代码来源:TileEntityHereticCauldron.java

示例8: hasCapability

import net.minecraftforge.common.capabilities.Capability; //导入依赖的package包/类
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
	if (m_realPlayer == null) {
		return super.hasCapability(capability, facing);
	} else {
		return m_realPlayer.hasCapability(capability, facing);
	}
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:9,代码来源:EntityPlayerProxy.java

示例9: getCapability

import net.minecraftforge.common.capabilities.Capability; //导入依赖的package包/类
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
	if (CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.equals(capability)) {
		@SuppressWarnings("unchecked")
		T result = (T) Inventory;
		return result;
	}
	return super.getCapability(capability, facing);
}
 
开发者ID:PorPit,项目名称:MineCamera,代码行数:10,代码来源:EntityTripod.java

示例10: hasCapability

import net.minecraftforge.common.capabilities.Capability; //导入依赖的package包/类
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
	if (CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.equals(capability)) {
		return true;
	}
	return super.hasCapability(capability, facing);
}
 
开发者ID:PorPit,项目名称:MineCamera,代码行数:8,代码来源:TileEntityPhotoProcessor.java

示例11: hasCapability

import net.minecraftforge.common.capabilities.Capability; //导入依赖的package包/类
@Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing)
{
    for (TileEntityModule module : modules.values())
    {
        if (module.hasCapability(capability, facing))
            return true;
    }

    return super.hasCapability(capability, facing);
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:12,代码来源:TileEntitySimple.java

示例12: writeNBT

import net.minecraftforge.common.capabilities.Capability; //导入依赖的package包/类
@Override
public NBTBase writeNBT(Capability<CapabilityDivination> capability, CapabilityDivination instance, EnumFacing side) {
	NBTTagCompound tag = new NBTTagCompound();
	if (instance.getFortune() != null) {
		tag.setString("fortune", instance.getFortune().getRegistryName().toString());
		tag.setBoolean("active", instance.isActive());
		tag.setBoolean("removable", instance.isRemovable());
	}
	return tag;
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:11,代码来源:DivinationStorage.java

示例13: hasCapability

import net.minecraftforge.common.capabilities.Capability; //导入依赖的package包/类
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing)
{
	if(world.getTileEntity(pos.down()) != null)
			return world.getTileEntity(pos.down()).hasCapability(capability, facing);
	return false;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:8,代码来源:TileEntityHereticCauldronTop.java

示例14: hasCapability

import net.minecraftforge.common.capabilities.Capability; //导入依赖的package包/类
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing)
{
	if (facing == null && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
	{
		return true;
	}
	return super.hasCapability(capability, facing);
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:10,代码来源:TileEntityArcaneTransfigurationTable.java

示例15: getCapability

import net.minecraftforge.common.capabilities.Capability; //导入依赖的package包/类
@Nullable
@Override
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
    if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
        return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(fluidHandler);
    }
    return super.getCapability(capability, facing);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:9,代码来源:TileEntityThermopneumaticProcessingPlant.java


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