Created
September 17, 2015 00:53
-
-
Save TheXFactor117/9a52c8a49cbe71463123 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EventItemCrafted | |
{ | |
@SubscribeEvent | |
public void onItemCrafted(ItemCraftedEvent event) | |
{ | |
ItemStack stack = event.crafting; | |
NBTTagCompound nbt = stack.getTagCompound(); | |
if (stack.getItem() instanceof ItemSword) | |
{ | |
if (nbt == null) | |
{ | |
nbt = new NBTTagCompound(); | |
stack.setTagCompound(nbt); | |
boolean developmentEnvironment = (Boolean)Launch.blackboard.get("fml.deobfuscatedEnvironment"); | |
if (developmentEnvironment || ConfigHandler.enableDevFeatures) | |
{ | |
RandomCollection<String> rarities = new RandomCollection<String>(); | |
rarities.add(0.65D, "basic"); | |
rarities.add(0.17D, "uncommon"); | |
rarities.add(0.11D, "rare"); | |
rarities.add(0.05D, "legendary"); | |
rarities.add(0.02D, "ancient"); | |
String rarity = rarities.next(); | |
LogHelper.info(rarity); | |
if (rarity == "basic") nbt.setInteger("RARITY", 1); | |
if (rarity == "uncommon") nbt.setInteger("RARITY", 2); | |
if (rarity == "rare") nbt.setInteger("RARITY", 3); | |
if (rarity == "legendary") nbt.setInteger("RARITY", 4); | |
if (rarity == "ancient") nbt.setInteger("RARITY", 5); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment