コード例 #1
0
  @Override
  public void executeRitual(
      EntityPlayer player, ItemStack stack, final World world, final BlockPos pos) {
    if (stack.getItem() == ItemManager.itemEarthRod) {
      if (world.getBlockState(pos).getBlock() == Blocks.EMERALD_ORE) {
        if (ItemEarthRod.isRodInfused(stack)) {
          final EarthStoneOuter outer = new EarthStoneOuter();
          final EarthStoneInner inner = new EarthStoneInner();

          ParticleSystem infuseSystem = createInfuseSystem();
          final ParticleSystem finishSystem = createFinishSystem();

          if (outer.checkMatrix(world, pos, false, true)
              && inner.checkMatrix(world, pos, false, true)) {
            ParticleSystemManager.INSTANCE.addSpawnForTimeWithDelay(
                infuseSystem, 2000, world, pos, 20);
            DelayUtil.INSTANCE.postDelayed(
                2000,
                new DelayUtil.DelayedAction() {
                  @Override
                  public void execute() {
                    if (outer.checkMatrix(world, pos, true, true)
                        && inner.checkMatrix(world, pos, false, true)) {
                      outer.placeBlocks(world, pos, false, true);
                      ParticleSystemManager.INSTANCE.addSpawnForTime(finishSystem, 50, world, pos);
                    }
                  }
                });
          }
        }
      }
    }
  }
コード例 #2
0
  @Override
  public boolean canExecuteRitual(EntityPlayer player, ItemStack stack, World world, BlockPos pos) {
    if (stack.getItem() == ItemManager.itemEarthRod) {
      if (world.getBlockState(pos).getBlock() == Blocks.EMERALD_ORE) {
        if (ItemEarthRod.isRodInfused(stack)) {
          EarthStoneOuter outer = new EarthStoneOuter();
          EarthStoneInner inner = new EarthStoneInner();

          if (outer.checkMatrix(world, pos, false, true)
              && inner.checkMatrix(world, pos, false, true)) return true;
        }
      }
    }
    return false;
  }