Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.boxtop.epicloot;
- import net.minecraft.src.EnumToolMaterial;
- import net.minecraft.src.ItemStack;
- import net.minecraft.src.NBTTagCompound;
- import net.minecraft.src.NBTTagList;
- import net.minecraft.src.NBTTagString;
- import net.minecraftforge.common.EnumHelper;
- import java.util.Random;
- public class LootGenHandler {
- private static final int MAX_USES = 300;
- private static final int MAX_DAMAGE = 6;
- private static final int TOTAL_SWORD_IMAGES = 47;
- private static Random rndgen = new Random();
- public static String GenerateName()
- {
- return (ItemNamer.GenerateFullName());
- }
- public static int GenerateDamageValue()
- {
- int dmg = rndgen.nextInt(MAX_DAMAGE);
- return dmg;
- }
- public static int GenerateMaxUses()
- {
- int durb = rndgen.nextInt(MAX_USES) + 1;
- return durb;
- }
- public static int GenUsesBasedOnDamage(int dmgVal)
- {
- return 0;
- }
- public static int getRandomSwordImgID()
- {
- int imgid = rndgen.nextInt(TOTAL_SWORD_IMAGES);
- return imgid;
- }
- //this function is not used currently
- public static ItemStack SetToolDamage(ItemStack itemstack, int dmgVal)
- {
- NBTTagCompound tag = itemstack.stackTagCompound;
- if (tag == null)
- {
- tag = new NBTTagCompound();
- itemstack.stackTagCompound = tag;
- }
- itemstack.stackTagCompound.setInteger("maxdamage", dmgVal);
- return itemstack;
- }
- //this function is not used currently
- public static int GetToolDamage(ItemStack itemstack)
- {
- NBTTagCompound tag = itemstack.stackTagCompound;
- if (tag == null)
- {
- tag = new NBTTagCompound();
- itemstack.stackTagCompound = tag;
- }
- if (itemstack.stackTagCompound.hasKey("maxdamage"))
- {
- return itemstack.stackTagCompound.getInteger("maxdamage");
- }
- else
- {
- return 0;
- }
- }
- //this function is not used currently
- public static ItemStack SetToolUses(ItemStack itemstack, int useVal)
- {
- NBTTagCompound tag = itemstack.stackTagCompound;
- if (tag == null)
- {
- tag = new NBTTagCompound();
- itemstack.stackTagCompound = tag;
- }
- itemstack.stackTagCompound.setInteger("maxuses", useVal);
- return itemstack;
- }
- //this function is not used currently
- public static int GetToolUses(ItemStack itemstack)
- {
- NBTTagCompound tag = itemstack.stackTagCompound;
- if (tag == null)
- {
- tag = new NBTTagCompound();
- itemstack.stackTagCompound = tag;
- }
- if (itemstack.stackTagCompound.hasKey("maxuses"))
- {
- return itemstack.stackTagCompound.getInteger("maxuses");
- }
- else
- {
- return 0;
- }
- }
- public static ItemStack setIconIndex(ItemStack itemstack, int iconindex)
- {
- NBTTagCompound tag = itemstack.stackTagCompound;
- if (tag == null)
- {
- tag = new NBTTagCompound();
- itemstack.stackTagCompound = tag;
- }
- itemstack.stackTagCompound.setInteger("iconindex", iconindex);
- return itemstack;
- }
- public static int getIconIndex(ItemStack itemstack)
- {
- NBTTagCompound tag = itemstack.stackTagCompound;
- if (tag == null)
- {
- tag = new NBTTagCompound();
- itemstack.stackTagCompound = tag;
- }
- if (itemstack.stackTagCompound.hasKey("iconindex"))
- {
- return itemstack.stackTagCompound.getInteger("iconindex");
- }
- else
- {
- return 0;
- }
- }
- public static EnumToolMaterial GenToolMaterialEnum(int uses, int damage)
- {
- EnumToolMaterial myMat = EnumHelper.addToolMaterial("mymat",
- 0,
- uses,
- 4.0F,
- damage,
- 0);
- return myMat;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement