本文整理匯總了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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