コード例 #1
0
ファイル: Ocelot.java プロジェクト: Orcem/Vanilla
  @Override
  public void onAttached() {
    super.onAttached();
    getOwner()
        .getNetwork()
        .setEntityProtocol(VanillaPlugin.VANILLA_PROTOCOL_ID, new OcelotEntityProtocol());

    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(10);
    }
    getOwner().add(DeathDrops.class).addXpDrop((short) (getRandom().nextInt(3) + 1));
  }
コード例 #2
0
ファイル: Slime.java プロジェクト: Orcem/Vanilla
  @Override
  public void onAttached() {
    super.onAttached();
    getOwner()
        .getNetwork()
        .setEntityProtocol(VanillaPlugin.VANILLA_PROTOCOL_ID, new SlimeEntityProtocol());
    if (getAttachedCount() == 1) {
      int spawnHealth = 1;
      if (getSize() == 2) {
        spawnHealth = 4;
      } else if (getSize() == 4) {
        spawnHealth = 16;
      }
      getOwner().add(Health.class).setSpawnHealth(spawnHealth);
    }

    // TODO: Damage depends of the size. Not the difficulty.
  }