本文整理汇总了Java中net.minecraft.tileentity.TileEntityComparator.getOutputSignal方法的典型用法代码示例。如果您正苦于以下问题:Java TileEntityComparator.getOutputSignal方法的具体用法?Java TileEntityComparator.getOutputSignal怎么用?Java TileEntityComparator.getOutputSignal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.tileentity.TileEntityComparator
的用法示例。
在下文中一共展示了TileEntityComparator.getOutputSignal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onStateChange
import net.minecraft.tileentity.TileEntityComparator; //导入方法依赖的package包/类
private void onStateChange(World worldIn, BlockPos pos, IBlockState state)
{
int i = this.calculateOutput(worldIn, pos, state);
TileEntity tileentity = worldIn.getTileEntity(pos);
int j = 0;
if (tileentity instanceof TileEntityComparator)
{
TileEntityComparator tileentitycomparator = (TileEntityComparator)tileentity;
j = tileentitycomparator.getOutputSignal();
tileentitycomparator.setOutputSignal(i);
}
if (j != i || state.getValue(MODE) == BlockRedstoneComparator.Mode.COMPARE)
{
boolean flag1 = this.shouldBePowered(worldIn, pos, state);
boolean flag = this.isPowered(state);
if (flag && !flag1)
{
worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(false)), 2);
}
else if (!flag && flag1)
{
worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(true)), 2);
}
this.notifyNeighbors(worldIn, pos, state);
}
}
示例2: getOutputSignal
import net.minecraft.tileentity.TileEntityComparator; //导入方法依赖的package包/类
@ScriptCallable(returnTypes = ReturnType.NUMBER, description = "Get the strength of the output signal")
public int getOutputSignal(TileEntityComparator comparator) {
return comparator.getOutputSignal();
}