Package org.spout.vanilla.component.entity.misc

Examples of org.spout.vanilla.component.entity.misc.DeathDrops


    }
  }

  protected void onDestroy() {
    // Spawn drops (if applicable)
    DeathDrops deathDropsComp = getOwner().get(DeathDrops.class);
    if (deathDropsComp == null) {
      return;
    }
    List<ItemStack> drops = deathDropsComp.getDrops();
    Point entityPosition = getOwner().getPhysics().getPosition();
    for (ItemStack stack : drops) {
      if (stack != null) {
        Item.dropNaturally(entityPosition, stack);
      }
View Full Code Here


  public void onAttached() {
    super.onAttached();
    Float nextEgg = (float) (GenericMath.getRandom().nextInt(MINIMUM_EGG_BREEDING_TIME) + MINIMUM_EGG_BREEDING_TIME);
    getOwner().getData().put(VanillaData.TIME_TILL_EGG, nextEgg);
    setEntityProtocol(new CreatureProtocol(CreatureType.CHICKEN));
    DeathDrops dropComponent = getOwner().add(DeathDrops.class);
    dropComponent.addDrop(new ItemStack(VanillaMaterials.FEATHER, getRandom().nextInt(2)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.RAW_CHICKEN, 1));
    dropComponent.addXpDrop((short) (getRandom().nextInt(3) + 1));

    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(4);
    }
    NearbyMaterialHolderSensor materialHolderSensor = new NearbyMaterialHolderSensor(getAI(), VanillaMaterials.SEEDS);
View Full Code Here

public class MooshroomCow extends Living implements Passive {
  @Override
  public void onAttached() {
    super.onAttached();
    setEntityProtocol(new CreatureProtocol(CreatureType.MUSHROOM_COW));
    DeathDrops dropComponent = getOwner().add(DeathDrops.class);
    Random random = getRandom();
    dropComponent.addDrop(new ItemStack(VanillaMaterials.RAW_BEEF, random.nextInt(2) + 1));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.LEATHER, random.nextInt(2)));
    dropComponent.addXpDrop((short) (getRandom().nextInt(3) + 1));
    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(10);
    }
  }
View Full Code Here

public class IronGolem extends Living implements Utility {
  @Override
  public void onAttached() {
    super.onAttached();
    setEntityProtocol(new CreatureProtocol(CreatureType.IRON_GOLEM)); //Index 16 (byte): Unknown, example: 1
    DeathDrops dropComponent = getOwner().add(DeathDrops.class);
    Random random = getRandom();
    dropComponent.addDrop(new ItemStack(VanillaMaterials.IRON_INGOT, random.nextInt(2) + 3));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.ROSE, random.nextInt(2)));
    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(100);
    }

    // Add metadata for whether the Entity was created by a player (opposite of naturally spawned)
View Full Code Here

  @Override
  public void onAttached() {
    super.onAttached();
    setEntityProtocol(new CreatureProtocol(CreatureType.SHEEP));
    DeathDrops dropComponent = getOwner().add(DeathDrops.class);
    dropComponent.addDrop(new ItemStack(VanillaMaterials.WOOL, 1));
    dropComponent.addXpDrop((short) (getRandom().nextInt(3) + 1));

    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(10);
    }
    NearbyMaterialHolderSensor materialHolderSensor = new NearbyMaterialHolderSensor(getAI(), VanillaMaterials.WHEAT);
View Full Code Here

public class Cow extends Animal implements Passive {
  @Override
  public void onAttached() {
    super.onAttached();
    setEntityProtocol(new CreatureProtocol(CreatureType.COW));
    DeathDrops dropComponent = getOwner().add(DeathDrops.class);
    Random random = getRandom();
    dropComponent.addDrop(new ItemStack(VanillaMaterials.RAW_BEEF, random.nextInt(2) + 1));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.LEATHER, random.nextInt(2)));
    dropComponent.addXpDrop((short) (getRandom().nextInt(3) + 1));
    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(10);
    }
    NearbyMaterialHolderSensor materialHolderSensor = new NearbyMaterialHolderSensor(getAI(), VanillaMaterials.WHEAT);
    materialHolderSensor.setSensorRadius(16);
View Full Code Here

public class Pig extends Animal {
  @Override
  public void onAttached() {
    super.onAttached();
    setEntityProtocol(new CreatureProtocol(CreatureType.PIG));
    DeathDrops dropComponent = getOwner().add(DeathDrops.class);
    dropComponent.addDrop(new ItemStack(VanillaMaterials.RAW_PORKCHOP, getRandom().nextInt(2) + 1));
    dropComponent.addXpDrop((short) (getRandom().nextInt(3) + 1));

    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(10);
    }
    NearbyMaterialHolderSensor materialHolderSensor = new NearbyMaterialHolderSensor(getAI(), VanillaMaterials.CARROT);
View Full Code Here

  @Override
  public void onAttached() {
    super.onAttached();
    setEntityProtocol(new CreatureProtocol(CreatureType.SQUID));
    Random random = getRandom();
    DeathDrops dropComponent = getOwner().add(DeathDrops.class);
    dropComponent.addDrop(new ItemStack(Dye.INK_SAC, random.nextInt(2) + 1));
    dropComponent.addXpDrop((short) (getRandom().nextInt(3) + 1));
    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(10);
    }
  }
View Full Code Here

public class Spider extends Living implements Hostile, Aggressive {
  @Override
  public void onAttached() {
    super.onAttached();
    setEntityProtocol(new CreatureProtocol(CreatureType.SPIDER));
    DeathDrops dropComponent = getOwner().add(DeathDrops.class);
    Random random = getRandom();
    dropComponent.addDrop(new ItemStack(VanillaMaterials.STRING, random.nextInt(2)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.SPIDER_EYE, random.nextInt(1)));
    dropComponent.addXpDrop((short) 5);
    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(16);
    }
    Damage damage = getOwner().add(Damage.class);
    damage.getDamageLevel(Difficulty.EASY).setAmount(2);
View Full Code Here

    PhysicsComponent physics = getOwner().getPhysics();
    physics.activate(2f, new BoxShape(1f, 2f, 1f), false, true);
    physics.setFriction(10f);
    physics.setRestitution(0f);

    DeathDrops dropComponent = getOwner().add(DeathDrops.class);
    dropComponent.addDrop(new ItemStack(VanillaMaterials.ARROW, random.nextInt(2)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.BONE, random.nextInt(2)));
    dropComponent.addXpDrop((short) 5);

    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(20);
    }
    //TODO: There are 2 kinds of damage for Skeles : Sword & Bow, along with different AI when either is equipped
View Full Code Here

TOP

Related Classes of org.spout.vanilla.component.entity.misc.DeathDrops

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.