Java Code Examples for net.minecraft.init.Items#golden_horse_armor()

The following examples show how to use net.minecraft.init.Items#golden_horse_armor() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
@Override
public IEntityLivingData onInitialSpawn(DifficultyInstance di, IEntityLivingData data) {  

  setHorseArmorStack(ItemStack.EMPTY);        
  setHorseSaddled(true);    
  setGrowingAge(0);
  getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(Config.fallenMountHealth);
  getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.2);
  getAttributeMap().getAttributeInstanceByName("horse.jumpStrength").setBaseValue(0.5);
  setHealth(getMaxHealth());
  
  float chanceOfArmor = world.getDifficulty() == EnumDifficulty.HARD ? Config.fallenMountChanceArmoredHard
      : Config.fallenMountChanceArmored;
  if(rand.nextFloat() <= chanceOfArmor) {

    //Value between 0 and 1 (normal) - 1.5 based on how long a chunk has been occupied and the moon phase
    
    //float occupiedDiffcultyMultiplier = worldObj.func_147462_b(posX, posY, posZ);
    
    float occupiedDiffcultyMultiplier = di.getClampedAdditionalDifficulty();
    //TODO: Do I need this normalised still?
    occupiedDiffcultyMultiplier /= 1.5f; // normalize
    float chanceImprovedArmor = world.getDifficulty() == EnumDifficulty.HARD ? Config.fallenMountChanceArmorUpgradeHard
        : Config.fallenMountChanceArmorUpgrade;
    chanceImprovedArmor *= (1 + occupiedDiffcultyMultiplier); //If we have the max occupied factor, double the chance of improved armor

    int armorLevel = 0;
    for (int i = 0; i < 2; i++) {
      if(rand.nextFloat() <= chanceImprovedArmor) {
        armorLevel++;
      }
    }
    Item armorItem = Items.IRON_HORSE_ARMOR;
    switch (armorLevel) {
    case 1:
      armorItem = Items.GOLDEN_HORSE_ARMOR;
      break;
    case 2:
      armorItem = Items.DIAMOND_HORSE_ARMOR;
      break;
    }
    armor = new ItemStack(armorItem);
    setHorseArmorStack(armor);
  } else {
    armor = ItemStack.EMPTY;
    setHorseArmorStack(armor);
  }
  return data;
}
 
Example 2
@Override
public ItemStack getLootItem(Random rand, int level){

	if(level > 0 && rand.nextInt(200) == 0){
		if(level > 2 && rand.nextInt(10) == 0) return new ItemStack(Items.DIAMOND_HORSE_ARMOR, 1, 0);
		if(level > 1 && rand.nextInt(5) == 0) return new ItemStack(Items.GOLDEN_HORSE_ARMOR, 1, 0);
		if(rand.nextInt(3) == 0) return new ItemStack(Items.IRON_HORSE_ARMOR, 1, 0);
		return new ItemStack(Items.SADDLE);
	}

	if(rand.nextInt(100) == 0) return PotionMixture.getRandom(rand);
	
	if(level > 1 && rand.nextInt(100) == 0) return new ItemStack(Items.GHAST_TEAR);

	if(level < 3 && rand.nextInt(80) == 0) return new ItemStack(Items.BOOK);
	
	if(rand.nextInt(80) == 0) return Shield.get(rand);
	
	if(level > 1 && rand.nextInt(60) == 0) return TippedArrow.get(rand, 4 + rand.nextInt(level) * 2);
	
	if(level > 1 && rand.nextInt(50) == 0){			
		switch(rand.nextInt(6)){
		case 0: return new ItemStack(Items.GUNPOWDER, 1 + rand.nextInt(3));
		case 1: return new ItemStack(Items.BLAZE_POWDER, 1 + rand.nextInt(3));
		case 2: return new ItemStack(Items.GOLD_NUGGET, 1 + rand.nextInt(3));
		case 3: return new ItemStack(Items.REDSTONE, 1 + rand.nextInt(3));
		case 4: return new ItemStack(Items.GLOWSTONE_DUST, 1 + rand.nextInt(8));
		case 5: return new ItemStack(Items.DYE, 1 + rand.nextInt(3));
		}
	}

	if(rand.nextInt(60) == 0) return PotionMixture.getPotion(rand, PotionMixture.LAUDANUM);
	
	if(rand.nextInt(30) == 0) return new ItemStack(Blocks.TORCH, 6 + rand.nextInt(20));

	if(level > 0 && rand.nextInt(8) == 0){
		switch(rand.nextInt(8)){
		case 0: return new ItemStack(Items.SLIME_BALL);
		case 1: return new ItemStack(Items.SNOWBALL);
		case 2: return new ItemStack(Items.MUSHROOM_STEW);
		case 3: return new ItemStack(Items.CLAY_BALL);
		case 4: return new ItemStack(Items.FLINT);
		case 5: return new ItemStack(Items.FEATHER);
		case 6: return new ItemStack(Items.GLASS_BOTTLE);
		case 7: return new ItemStack(Items.LEATHER);
		}
	}

	switch(rand.nextInt(7)){
	case 0: return new ItemStack(Items.BONE);
	case 1: return new ItemStack(Items.ROTTEN_FLESH);
	case 2: return new ItemStack(Items.SPIDER_EYE);
	case 3: return new ItemStack(Items.PAPER);
	case 4: return new ItemStack(Items.STRING);
	case 5: return new ItemStack(Items.STICK);
	default: return new ItemStack(Items.STICK);
	}
}