本文整理汇总了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