本文整理汇总了Java中net.darkhax.tesla.capability.TeslaCapabilities.CAPABILITY_HOLDER属性的典型用法代码示例。如果您正苦于以下问题:Java TeslaCapabilities.CAPABILITY_HOLDER属性的具体用法?Java TeslaCapabilities.CAPABILITY_HOLDER怎么用?Java TeslaCapabilities.CAPABILITY_HOLDER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.darkhax.tesla.capability.TeslaCapabilities
的用法示例。
在下文中一共展示了TeslaCapabilities.CAPABILITY_HOLDER属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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_PRODUCER || capability == TeslaCapabilities.CAPABILITY_HOLDER)
return (T) this.container;
if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(itemHandler);
return super.getCapability(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_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);
}
示例5: 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);
}
示例6: 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;
}
示例7: getCapability
@Override
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
container.setDir(facing);
if (capability == TeslaCapabilities.CAPABILITY_CONSUMER && connection.canConnectEnergy(facing)) {
return (T) container;
}
if (capability == TeslaCapabilities.CAPABILITY_PRODUCER && connection.canConnectEnergy(facing)) {
return (T) container;
}
if (capability == TeslaCapabilities.CAPABILITY_HOLDER && connection.canConnectEnergy(facing)) {
return (T) container;
}
return null;
}
示例8: 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);
}
示例9: hasCapability
@Override
public boolean hasCapability (Capability<?> capability, EnumFacing facing) {
// This method replaces the instanceof checks that would be used in an interface based
// system. It can be used by other things to see if the TileEntity uses a capability or
// not. This example is a Consumer, Producer and Holder, so we return true for all
// three. This can also be used to restrict access on certain sides, for example if you
// only accept power input from the bottom of the block, you would only return true for
// Consumer if the facing parameter was down.
if (capability == TeslaCapabilities.CAPABILITY_CONSUMER || capability == TeslaCapabilities.CAPABILITY_PRODUCER || capability == TeslaCapabilities.CAPABILITY_HOLDER)
return true;
return super.hasCapability(capability, facing);
}
示例10: 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;
}
示例11: hasCapability
@Override
public boolean hasCapability (Capability<?> capability, EnumFacing facing) {
// This method replaces the instanceof checks that would be used in an interface based
// system. It can be used by other things to see if the TileEntity uses a capability or
// not. This example is a Consumer, Producer and Holder, so we return true for all
// three. This can also be used to restrict access on certain sides, for example if you
// only accept power input from the bottom of the block, you would only return true for
// Consumer if the facing parameter was down.
if (capability == TeslaCapabilities.CAPABILITY_CONSUMER || capability == TeslaCapabilities.CAPABILITY_PRODUCER || capability == TeslaCapabilities.CAPABILITY_HOLDER) {
return true;
}
return super.hasCapability(capability, facing);
}
示例12: getCapability
@Override
@SuppressWarnings("unchecked")
public <T> T getCapability (Capability<T> capability, EnumFacing facing)
{
if (capability == TeslaCapabilities.CAPABILITY_HOLDER || capability == TeslaCapabilities.CAPABILITY_CONSUMER)
{
return (T) this.container;
}
return super.getCapability(capability, facing);
}
示例13: 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);
}
示例14: hasCapability
@Override
public boolean hasCapability (Capability<?> capability, EnumFacing facing) {
// This method replaces the instanceof checks that would be used in an interface based
// system. It can be used by other things to see if the TileEntity uses a capability or
// not. This example is a Consumer, Producer and Holder, so we return true for all
// three. This can also be used to restrict access on certain sides, for example if you
// only accept power input from the bottom of the block, you would only return true for
// Consumer if the facing parameter was down.
if (capability == TeslaCapabilities.CAPABILITY_PRODUCER || capability == TeslaCapabilities.CAPABILITY_HOLDER)
return true;
if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
return true;
return super.hasCapability(capability, facing);
}
示例15: hasCapability
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing)
{
return (capability == TeslaCapabilities.CAPABILITY_CONSUMER ||
capability == TeslaCapabilities.CAPABILITY_HOLDER ||
capability == CapabilityEnergy.ENERGY);
}