本文整理汇总了Java中net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY属性的典型用法代码示例。如果您正苦于以下问题:Java CapabilityItemHandler.ITEM_HANDLER_CAPABILITY属性的具体用法?Java CapabilityItemHandler.ITEM_HANDLER_CAPABILITY怎么用?Java CapabilityItemHandler.ITEM_HANDLER_CAPABILITY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraftforge.items.CapabilityItemHandler
的用法示例。
在下文中一共展示了CapabilityItemHandler.ITEM_HANDLER_CAPABILITY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCapability
@Nullable
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing)
{
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
{
return (T) getItemHandlerCapability(facing);
}
for (TileEntityModule module : modules.values())
{
if (module.hasCapability(capability, facing))
return module.getCapability(capability, facing);
}
return super.getCapability(capability, facing);
}
示例2: getCapability
@Nullable
@Override
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
if (facing == null) return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(playerMainInvHandler);
switch (facing) {
case UP:
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(playerArmorInvHandler);
case DOWN:
return super.getCapability(capability, facing);
default:
return dispenserUpgradeInserted ?
CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(playerFoodHandler) :
CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(playerMainInvHandler);
}
} else if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY && dispenserUpgradeInserted) {
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(playerExperienceHandler);
} else if (capability == CapabilityEnergy.ENERGY) {
return CapabilityEnergy.ENERGY.cast(energyRF);
}
return super.getCapability(capability, facing);
}
示例3: getCapability
@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);
}
示例4: hasCapability
@Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY
|| capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY
|| capability == CapabilityEnergy.ENERGY
|| super.hasCapability(capability, facing);
}
示例5: getCapability
@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);
}
示例6: getCapability
@Nullable
@Override
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && getPrimaryInventory() != null) {
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(getPrimaryInventory());
}
return super.getCapability(capability, facing);
}
示例7: getCapability
@SuppressWarnings("unchecked")
@Nullable
@Override
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
if (capability == CapabilityEnergy.ENERGY) return (T) energyStorage;
else if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) return (T) fluidTank;
else if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return (T) itemHandler;
else return super.getCapability(capability, facing);
}
示例8: getCapability
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
IItemHandler handler = this.getItemHandler();
if (handler != null) {
return (T) handler;
}
}
return super.getCapability(capability, facing);
}
示例9: getCapability
@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);
}
示例10: hasCapability
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing)
{
if (facing == null && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
{
return true;
}
return super.hasCapability(capability, facing);
}
示例11: hasCapability
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
return true;
}
return super.hasCapability(capability, facing);
}
示例12: hasCapability
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing)
{
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
{
return true;
}
return super.hasCapability(capability, facing);
}
示例13: hasCapability
@Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
}
示例14: hasCapability
@Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing)
{
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
}
示例15: hasCapability
@Override
public boolean hasCapability(Capability<?> cap, EnumFacing side) {
return cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(cap, side);
}