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