コード例 #1
0
  protected BlockPattern getSnowmanPattern() {
    if (this.snowmanPattern == null) {
      this.snowmanPattern =
          FactoryBlockPattern.start()
              .aisle(new String[] {"^", "#", "#"})
              .where('^', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.pumpkin)))
              .where('#', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.snow)))
              .build();
    }

    return this.snowmanPattern;
  }
コード例 #2
0
  protected BlockPattern getGolemBasePattern() {
    if (this.golemBasePattern == null) {
      this.golemBasePattern =
          FactoryBlockPattern.start()
              .aisle(new String[] {"~ ~", "###", "~#~"})
              .where('#', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.iron_block)))
              .where('~', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.air)))
              .build();
    }

    return this.golemBasePattern;
  }
コード例 #3
0
  @SuppressWarnings({"rawtypes", "unchecked"})
  public static BlockStateHelper getMatcher(final BlockStateInfo blockStateInfo) {
    final BlockStateHelper matcher = BlockStateHelper.forBlock(blockStateInfo.block);
    for (final Map.Entry<IProperty, Comparable> entry : blockStateInfo.stateData.entrySet()) {
      matcher.where(
          entry.getKey(),
          new Predicate<Comparable>() {
            @Override
            public boolean apply(final Comparable input) {
              return input != null && input.equals(entry.getValue());
            }
          });
    }

    return matcher;
  }