當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。