Java Code Examples for net.minecraft.init.Items#IRON_SWORD

The following examples show how to use net.minecraft.init.Items#IRON_SWORD . 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 check out the related API usage on the sidebar.
Example 1
private ItemStack getSwordForLevel(int swordLevel) {
  ////have a better chance of not getting a wooden or stone sword
  if(swordLevel < 2) {
    swordLevel += rand.nextInt(isHardDifficulty() ? 3 : 2);
    swordLevel = Math.min(swordLevel, 2);
  }
  switch (swordLevel) {
  case 0:
    return new ItemStack(Items.WOODEN_SWORD);
  case 1:
    return new ItemStack(Items.STONE_SWORD);
  case 2:
    return new ItemStack(Items.IRON_SWORD);
  case 4:
    return new ItemStack(Items.DIAMOND_SWORD);
  }
  return new ItemStack(Items.IRON_SWORD);
}
 
Example 2
private static ItemStack level1Sword() {
	ItemStack stack = new ItemStack(Items.IRON_SWORD);
	stack.setStackDisplayName("Moon Sword I");
	stack.addEnchantment(Enchantment.REGISTRY.getObjectById(17), 1);
	stack.addEnchantment(Enchantment.REGISTRY.getObjectById(18), 1);
	return stack;
}
 
Example 3
private static ItemStack level2Sword() {
	ItemStack stack = new ItemStack(Items.IRON_SWORD);
	stack.setStackDisplayName("Moon Sword II");
	stack.addEnchantment(Enchantment.REGISTRY.getObjectById(16), 1);
	stack.addEnchantment(Enchantment.REGISTRY.getObjectById(17), 2);
	stack.addEnchantment(Enchantment.REGISTRY.getObjectById(18), 2);
	return stack;
}
 
Example 4
private static ItemStack level1Sword() {
	ItemStack stack = new ItemStack(Items.IRON_SWORD);
	stack.setStackDisplayName("Svarog Sword");
	stack.addEnchantment(Enchantment.REGISTRY.getObjectById(17), 1);
	stack.addEnchantment(Enchantment.REGISTRY.getObjectById(16), 1);
	return stack;
}
 
Example 5
private static ItemStack level2Sword() {
	ItemStack stack = new ItemStack(Items.IRON_SWORD);
	stack.setStackDisplayName("Sol Sword");
	stack.addEnchantment(Enchantment.REGISTRY.getObjectById(17), 3);
	stack.addEnchantment(Enchantment.REGISTRY.getObjectById(16), 3);
	return stack;
}
 
Example 6
Source Project: Cyberware   File: EntityCyberZombie.java    License: MIT License 5 votes vote down vote up
@Override
protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty)
{
	super.setEquipmentBasedOnDifficulty(difficulty);
	
	if (CyberwareConfig.KATANA && !CyberwareConfig.NO_CLOTHES && this.getItemStackFromSlot(EntityEquipmentSlot.MAINHAND) != null && this.getItemStackFromSlot(EntityEquipmentSlot.MAINHAND).getItem() == Items.IRON_SWORD)
	{
		this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(CyberwareContent.katana));
		this.setDropChance(EntityEquipmentSlot.MAINHAND, 0F);
	}
}
 
Example 7
private static ItemStack getSwordByQuality(Quality quality){
	switch (quality) {
	case DIAMOND: return new ItemStack(Items.DIAMOND_SWORD);
	case GOLD: return new ItemStack(Items.GOLDEN_SWORD);
	case IRON: return new ItemStack(Items.IRON_SWORD);
	case STONE: return new ItemStack(Items.STONE_SWORD);
	default: return new ItemStack(Items.WOODEN_SWORD);
	}
}
 
Example 8
protected static ItemStack level1Sword() {
	ItemStack stack = new ItemStack(Items.IRON_SWORD);
	stack.addEnchantment(Enchantment.REGISTRY.getObjectById(19), 1);
	return stack;
}
 
Example 9
private static ItemStack level1Sword() {
	ItemStack stack = new ItemStack(Items.IRON_SWORD);
	stack.setStackDisplayName("Logi Sword");
	stack.addEnchantment(Enchantment.REGISTRY.getObjectById(20), 1);
	return stack;
}
 
Example 10
private static ItemStack level2Sword() {
	ItemStack stack = new ItemStack(Items.IRON_SWORD);
	stack.setStackDisplayName("Vulcan Sword");
	stack.addEnchantment(Enchantment.REGISTRY.getObjectById(20), 2);
	return stack;
}