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


Java TeslaCapabilities.CAPABILITY_CONSUMER属性代码示例

本文整理汇总了Java中net.darkhax.tesla.capability.TeslaCapabilities.CAPABILITY_CONSUMER属性的典型用法代码示例。如果您正苦于以下问题:Java TeslaCapabilities.CAPABILITY_CONSUMER属性的具体用法?Java TeslaCapabilities.CAPABILITY_CONSUMER怎么用?Java TeslaCapabilities.CAPABILITY_CONSUMER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.darkhax.tesla.capability.TeslaCapabilities的用法示例。


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

示例1: getCapability

@Override
@SuppressWarnings("unchecked")
public <T> T getCapability(Capability<T> capability, EnumFacing side)
{
    if (RFUtilities.TESLA_LOADED && capability == TeslaCapabilities.CAPABILITY_CONSUMER && side == getBlockState().getValue(BlockDiode.ORIENTATION).rotateYCCW())
    {
        return (T)teslaHandler;
    }
    else if (RFUtilities.TESLA_LOADED && capability == TeslaCapabilities.CAPABILITY_PRODUCER && side == getBlockState().getValue(BlockDiode.ORIENTATION).rotateY())
    {
        return (T)teslaHandler;
    }
    else if (capability == CapabilityEnergy.ENERGY && side == getBlockState().getValue(BlockDiode.ORIENTATION).rotateYCCW())
    {
        return (T)energyHandler;
    }
    return super.getCapability(capability, side);
}
 
开发者ID:XFactHD,项目名称:RFUtilities,代码行数:18,代码来源:TileEntityDiode.java

示例2: hasCapability

@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing)
{
    boolean grantAccess = false;
    if (facing == getBlockState().getValue(BlockCapacitor.ORIENTATION).rotateY())
    {
        //we are the receiver
        grantAccess = capability == CapabilityEnergy.ENERGY || (RFUtilities.TESLA_LOADED && capability == TeslaCapabilities.CAPABILITY_CONSUMER);
    }
    else if (facing == getBlockState().getValue(BlockCapacitor.ORIENTATION).rotateYCCW())
    {
        //we are the provider
        grantAccess = capability == CapabilityEnergy.ENERGY || (RFUtilities.TESLA_LOADED && capability == TeslaCapabilities.CAPABILITY_CONSUMER);
    }
    return grantAccess || super.hasCapability(capability, facing);
}
 
开发者ID:XFactHD,项目名称:RFUtilities,代码行数:16,代码来源:TileEntityCapacitor.java

示例3: getCapability

@Override
@SuppressWarnings("unchecked")
public <T> T getCapability (Capability<T> capability, EnumFacing facing) {
    
    if (capability == TeslaCapabilities.CAPABILITY_CONSUMER || capability == TeslaCapabilities.CAPABILITY_PRODUCER || capability == TeslaCapabilities.CAPABILITY_HOLDER)
        return (T) this.container;
        
    return null;
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:9,代码来源:BaseTeslaContainerProvider.java

示例4: getCapability

@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
    
    if(capability == TeslaCapabilities.CAPABILITY_CONSUMER)
        return (T) this.container;
    else if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
        return (T) this.itemStackHandler;
    }
    
    return super.getCapability(capability, facing);
}
 
开发者ID:jaredlll08,项目名称:Machines-and-Stuff,代码行数:11,代码来源:TileEntityMachineBase.java

示例5: hasCapability

@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
    if(capability == TeslaCapabilities.CAPABILITY_CONSUMER)
        return true;
    else if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
        return true;
    }
    return super.hasCapability(capability, facing);
}
 
开发者ID:jaredlll08,项目名称:Machines-and-Stuff,代码行数:9,代码来源:TileEntityMachineBase.java

示例6: getCapability

@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
    if(capability == TeslaCapabilities.CAPABILITY_PRODUCER && getInfoForFace(facing).getIoInfo() == AccumulatorInfo.AccumulatorIOInfo.OUTPUT) {
        return (T) this.container;
    }
    if(capability == TeslaCapabilities.CAPABILITY_CONSUMER && getInfoForFace(facing).getIoInfo() == AccumulatorInfo.AccumulatorIOInfo.INPUT) {
        return (T) this.container;
    }
    if(capability == TeslaCapabilities.CAPABILITY_HOLDER && getInfoForFace(facing).getIoInfo() != AccumulatorInfo.AccumulatorIOInfo.DISABLED)
        return (T) this.container;
    return super.getCapability(capability, facing);
}
 
开发者ID:jaredlll08,项目名称:Machines-and-Stuff,代码行数:12,代码来源:TileEntityAccumulator.java

示例7: hasCapability

@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
    if(capability == TeslaCapabilities.CAPABILITY_PRODUCER && getInfoForFace(facing).getIoInfo() == AccumulatorInfo.AccumulatorIOInfo.OUTPUT) {
        return true;
    }
    if(capability == TeslaCapabilities.CAPABILITY_CONSUMER && getInfoForFace(facing).getIoInfo() == AccumulatorInfo.AccumulatorIOInfo.INPUT) {
        return true;
    }
    if(capability == TeslaCapabilities.CAPABILITY_HOLDER && getInfoForFace(facing).getIoInfo() != AccumulatorInfo.AccumulatorIOInfo.DISABLED)
        return true;
    return super.hasCapability(capability, facing);
}
 
开发者ID:jaredlll08,项目名称:Machines-and-Stuff,代码行数:12,代码来源:TileEntityAccumulator.java

示例8: hasCapability

@Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
    if (capability == TeslaCapabilities.CAPABILITY_CONSUMER && connection.canConnectEnergy(facing)) {
        return true;
    }
    if (capability == TeslaCapabilities.CAPABILITY_PRODUCER && connection.canConnectEnergy(facing)) {
        return true;
    }
    if (capability == TeslaCapabilities.CAPABILITY_HOLDER && connection.canConnectEnergy(facing)) {
        return true;
    }
    return false;
}
 
开发者ID:modmuss50,项目名称:Tesla-Flux,代码行数:13,代码来源:TeslaCapabilityProvider.java

示例9: getCapability

@Override
@SuppressWarnings("unchecked")
public <T> T getCapability (Capability<T> capability, EnumFacing facing) {

    if (capability == TeslaCapabilities.CAPABILITY_CONSUMER) {
        return (T) new InfiniteTeslaConsumer();
    }

    return super.getCapability(capability, facing);
}
 
开发者ID:Darkhax-Minecraft,项目名称:Tesla,代码行数:10,代码来源:TileEntityBlackhole.java

示例10: getCapability

@Override
@SuppressWarnings("unchecked")
public <T> T getCapability (Capability<T> capability, EnumFacing facing) {

    // This method is where other things will try to access your TileEntity's Tesla
    // capability. In the case of the analyzer, is a consumer, producer and holder so we
    // can allow requests that are looking for any of those things. This example also does
    // not care about which side is being accessed, however if you wanted to restrict which
    // side can be used, for example only allow power input through the back, that could be
    // done here.
    if (capability == TeslaCapabilities.CAPABILITY_CONSUMER || capability == TeslaCapabilities.CAPABILITY_PRODUCER || capability == TeslaCapabilities.CAPABILITY_HOLDER)
        return (T) this.container;

    return super.getCapability(capability, facing);
}
 
开发者ID:CyberdyneCC,项目名称:BigReactors,代码行数:15,代码来源:TileEntityTesla.java

示例11: hasCapability

@Override
public boolean hasCapability (Capability<?> capability, EnumFacing facing) {
   
    if (capability == TeslaCapabilities.CAPABILITY_CONSUMER || capability == TeslaCapabilities.CAPABILITY_HOLDER)
        return true;
        
    return super.hasCapability(capability, facing);
}
 
开发者ID:AshIndigo,项目名称:Alloycraft,代码行数:8,代码来源:ForgeTeslaTileEntity.java

示例12: hasCapability

@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing)
{
    if (capability == CapabilityEnergy.ENERGY || (RFUtilities.TESLA_LOADED && (capability == TeslaCapabilities.CAPABILITY_PRODUCER || capability == TeslaCapabilities.CAPABILITY_CONSUMER)))
    {
        return canConnectEnergy(facing);
    }
    return super.hasCapability(capability, facing);
}
 
开发者ID:XFactHD,项目名称:RFUtilities,代码行数:9,代码来源:TileEntityRFMeter.java

示例13: getCapability

@Override
@SuppressWarnings("unchecked")
public <T> T getCapability(Capability<T> capability, EnumFacing facing)
{
    if (capability == CapabilityEnergy.ENERGY && canConnectEnergy(facing))
    {
        return (T)energyHandler.setSendingSide(facing.getOpposite());
    }
    else if (RFUtilities.TESLA_LOADED && (capability == TeslaCapabilities.CAPABILITY_PRODUCER || capability == TeslaCapabilities.CAPABILITY_CONSUMER))
    {
        return (T)teslaHandler.setSendingSide(facing.getOpposite());
    }
    return super.getCapability(capability, facing);
}
 
开发者ID:XFactHD,项目名称:RFUtilities,代码行数:14,代码来源:TileEntityRFMeter.java

示例14: hasCapability

@Override
public boolean hasCapability (Capability<?> capability, EnumFacing facing)
{
    if (capability == TeslaCapabilities.CAPABILITY_HOLDER || capability == TeslaCapabilities.CAPABILITY_CONSUMER)
    {
        return true;
    }
    return super.hasCapability(capability, facing);
}
 
开发者ID:CyberdyneCC,项目名称:HazardousResearch,代码行数:9,代码来源:TileEntityMachine.java

示例15: getCapability

@Override
@SuppressWarnings("unchecked")
public <T> T getCapability(Capability<T> capability, EnumFacing facing)
{
    if (facing == getBlockState().getValue(BlockCapacitor.ORIENTATION).rotateY())
    {
        //we are the receiver
        if (capability == CapabilityEnergy.ENERGY)
        {
            return (T)storage.setReceiver(true);
        }
        else if (RFUtilities.TESLA_LOADED && capability == TeslaCapabilities.CAPABILITY_CONSUMER)
        {
            return (T)teslaContainer;
        }
    }
    else if (facing == getBlockState().getValue(BlockCapacitor.ORIENTATION).rotateYCCW())
    {
        //we are the provider
        if (capability == CapabilityEnergy.ENERGY)
        {
            return (T)storage.setReceiver(false);
        }
        else if (RFUtilities.TESLA_LOADED && capability == TeslaCapabilities.CAPABILITY_PRODUCER)
        {
            return (T)teslaContainer;
        }
    }
    return super.getCapability(capability, facing);
}
 
开发者ID:XFactHD,项目名称:RFUtilities,代码行数:30,代码来源:TileEntityCapacitor.java


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