diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2018-05-24 15:52:43 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2018-05-24 15:52:43 -0400 |
| commit | a11c98c6cad501e081837ec8fa2e323edaeb1ca3 (patch) | |
| tree | ab97a3e81bfa3eec2ff530ec55ff4a69e48f49e3 /TF2 Crates/src | |
Initial commitmaster
Diffstat (limited to 'TF2 Crates/src')
97 files changed, 4683 insertions, 0 deletions
diff --git a/TF2 Crates/src/main/java/baubles/api/BaubleType.java b/TF2 Crates/src/main/java/baubles/api/BaubleType.java new file mode 100755 index 0000000..861f306 --- /dev/null +++ b/TF2 Crates/src/main/java/baubles/api/BaubleType.java @@ -0,0 +1,5 @@ +package baubles.api;
+
+public enum BaubleType {
+ RING, AMULET, BELT
+}
diff --git a/TF2 Crates/src/main/java/baubles/api/BaublesApi.java b/TF2 Crates/src/main/java/baubles/api/BaublesApi.java new file mode 100755 index 0000000..9824262 --- /dev/null +++ b/TF2 Crates/src/main/java/baubles/api/BaublesApi.java @@ -0,0 +1,38 @@ +package baubles.api;
+
+import java.lang.reflect.Method;
+
+import cpw.mods.fml.common.FMLLog;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+
+/**
+ * @author Azanor
+ */
+public class BaublesApi {
+ static Method getBaubles;
+
+ /**
+ * Retrieves the baubles inventory for the supplied player
+ */
+ public static IInventory getBaubles(EntityPlayer player) {
+ IInventory ot = null;
+
+ try {
+ if (getBaubles == null) {
+ Class<?> fake =
+ Class.forName("baubles.common.lib.PlayerHandler");
+ getBaubles = fake.getMethod("getPlayerBaubles",
+ EntityPlayer.class);
+ }
+
+ ot = (IInventory) getBaubles.invoke(null, player);
+ } catch (Exception ex) {
+ FMLLog.warning(
+ "[Baubles API] Could not invoke baubles.common.lib.PlayerHandler method getPlayerBaubles");
+ }
+
+ return ot;
+ }
+
+}
diff --git a/TF2 Crates/src/main/java/baubles/api/IBauble.java b/TF2 Crates/src/main/java/baubles/api/IBauble.java new file mode 100755 index 0000000..bbf1d19 --- /dev/null +++ b/TF2 Crates/src/main/java/baubles/api/IBauble.java @@ -0,0 +1,48 @@ +package baubles.api;
+
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.item.ItemStack;
+
+/**
+ *
+ * This interface should be extended by items that can be worn in bauble
+ * slots
+ *
+ * @author Azanor
+ */
+
+public interface IBauble {
+
+ /**
+ * This method return the type of bauble this is. Type is used to
+ * determine the slots it can go into.
+ */
+ public BaubleType getBaubleType(ItemStack itemstack);
+
+ /**
+ * This method is called once per tick if the bauble is being worn by a
+ * player
+ */
+ public void onWornTick(ItemStack itemstack, EntityLivingBase player);
+
+ /**
+ * This method is called when the bauble is equipped by a player
+ */
+ public void onEquipped(ItemStack itemstack, EntityLivingBase player);
+
+ /**
+ * This method is called when the bauble is unequipped by a player
+ */
+ public void onUnequipped(ItemStack itemstack, EntityLivingBase player);
+
+ /**
+ * can this bauble be placed in a bauble slot
+ */
+ public boolean canEquip(ItemStack itemstack, EntityLivingBase player);
+
+ /**
+ * Can this bauble be removed from a bauble slot
+ */
+ public boolean canUnequip(ItemStack itemstack,
+ EntityLivingBase player);
+}
diff --git a/TF2 Crates/src/main/java/baubles/api/package-info.java b/TF2 Crates/src/main/java/baubles/api/package-info.java new file mode 100755 index 0000000..3530abc --- /dev/null +++ b/TF2 Crates/src/main/java/baubles/api/package-info.java @@ -0,0 +1,4 @@ +@API(owner = "Baubles", apiVersion = "1.0.1.10", provides = "Baubles|API")
+package baubles.api;
+
+import cpw.mods.fml.common.API;
diff --git a/TF2 Crates/src/main/java/tf2crates/ClientProxyTC.java b/TF2 Crates/src/main/java/tf2crates/ClientProxyTC.java new file mode 100755 index 0000000..09478a3 --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/ClientProxyTC.java @@ -0,0 +1,19 @@ +package tf2crates;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import net.minecraftforge.common.MinecraftForge;
+import tf2crates.handler.EventHandler;
+import tf2crates.handler.TooltipHandler;
+import tlhpoeCore.TLHPoE;
+
+public class ClientProxyTC extends ServerProxyTC {
+ @Override
+ public void initClient() {
+ TLHPoE.registerUpdateDetector(ReferenceTC.ID, ReferenceTC.NAME,
+ ReferenceTC.VERSION, "0B6mhkrh-GwwwWFFnNFlqWklCVFE");
+
+ MinecraftForge.EVENT_BUS.register(new TooltipHandler());
+
+ FMLCommonHandler.instance().bus().register(new EventHandler());
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/ReferenceTC.java b/TF2 Crates/src/main/java/tf2crates/ReferenceTC.java new file mode 100755 index 0000000..a73a7c3 --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/ReferenceTC.java @@ -0,0 +1,9 @@ +package tf2crates;
+
+public class ReferenceTC {
+ public static final String ID = "tf2crates";
+ public static final String NAME = "TF2 Crates";
+ public static final String VERSION = "1.5";
+
+ public static String CURRENT_SPECIAL_CRATE = null;
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/ServerProxyTC.java b/TF2 Crates/src/main/java/tf2crates/ServerProxyTC.java new file mode 100755 index 0000000..326f7e7 --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/ServerProxyTC.java @@ -0,0 +1,556 @@ +package tf2crates;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import baubles.api.IBauble;
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry;
+import cpw.mods.fml.common.registry.GameData;
+import cpw.mods.fml.common.registry.GameRegistry;
+import net.minecraft.block.BlockFence;
+import net.minecraft.block.BlockStairs;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.Item.ToolMaterial;
+import net.minecraft.item.ItemArmor;
+import net.minecraft.item.ItemArmor.ArmorMaterial;
+import net.minecraft.item.ItemAxe;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemBow;
+import net.minecraft.item.ItemFood;
+import net.minecraft.item.ItemHoe;
+import net.minecraft.item.ItemPickaxe;
+import net.minecraft.item.ItemSlab;
+import net.minecraft.item.ItemSpade;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemSword;
+import net.minecraft.item.ItemTool;
+import net.minecraft.potion.Potion;
+import net.minecraft.util.WeightedRandomChestContent;
+import net.minecraftforge.common.ChestGenHooks;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.common.config.Configuration;
+import net.minecraftforge.common.config.Property;
+import net.minecraftforge.common.util.EnumHelper;
+import net.minecraftforge.oredict.OreDictionary;
+import tf2crates.crate.Crates;
+import tf2crates.crate.RandomLoot;
+import tf2crates.crate.RandomRandomLoot;
+import tf2crates.handler.AnvilHandler;
+import tf2crates.handler.AttackHandler;
+import tf2crates.handler.DeathHandler;
+import tf2crates.handler.TickHandler;
+import tf2crates.item.ItemCrate;
+import tf2crates.item.ItemKey;
+import tf2crates.item.ItemKnife;
+import tf2crates.item.ItemModAxe;
+import tf2crates.item.ItemModPickaxe;
+import tf2crates.item.ItemModShovel;
+import tf2crates.item.ItemNoiseMaker;
+import tf2crates.item.ItemPaint;
+import tf2crates.item.ItemSandvich;
+import tf2crates.item.ItemScrap;
+import tf2crates.item.ItemUnusualEffect;
+
+public class ServerProxyTC {
+ public static boolean unbreakableSuperWeapons;
+ public static int keyRarity;
+ public static boolean sandvichEnabled;
+ public static boolean difficultKeyRecipe;
+ public static int numRandomCrates;
+
+ public static ToolMaterial MOD_WEAPON;
+
+ public static Item unusualEffect;
+ public static Item strangifier;
+
+ public static Item paint;
+ public static Item crate;
+ public static Item key;
+ public static Item scrap;
+
+ public static Item equalizer;
+ public static Item escapePlan;
+
+ public static Item marketGardener;
+
+ public static Item axtinguisher;
+ public static Item sharpenedVolcanoFragment;
+ public static Item powerJack;
+
+ public static Item conniversKunai;
+
+ public static Item sandvich;
+
+ public static Item noiseMakerBirthday;
+ public static Item noiseMakerSpooky;
+ public static Item noiseMakerFestive;
+
+ public void initServer() {
+ initConfig();
+
+ MOD_WEAPON = EnumHelper.addToolMaterial("MOD_WEAPON", 2,
+ unbreakableSuperWeapons ? -1 : 1561, 2F, 5F, 22);
+
+ strangifier = new Item().setUnlocalizedName("strangifier")
+ .setTextureName(ReferenceTC.ID + ":strangifier")
+ .setMaxStackSize(1).setCreativeTab(tab);
+ unusualEffect = new ItemUnusualEffect().setCreativeTab(tab);
+
+ GameRegistry.registerItem(unusualEffect, "unusualEffect");
+ GameRegistry.registerItem(strangifier, "strangifier");
+
+ paint = new ItemPaint().setCreativeTab(tab);
+ crate = new ItemCrate().setCreativeTab(tab);
+ key = new ItemKey().setCreativeTab(tab);
+ scrap = new ItemScrap().setCreativeTab(tab);
+
+ GameRegistry.registerItem(paint, "paint");
+ GameRegistry.registerItem(crate, "crate");
+ GameRegistry.registerItem(key, "key");
+ GameRegistry.registerItem(scrap, "scrap");
+
+ equalizer = new ItemModPickaxe("equalizer").setCreativeTab(tab);
+ escapePlan = new ItemModPickaxe("escapePlan").setCreativeTab(tab);
+ marketGardener = new ItemModShovel("marketGardener", 5)
+ .setCreativeTab(tab);
+ axtinguisher = new ItemModAxe("axtinguisher", 6)
+ .setCreativeTab(tab);
+ sharpenedVolcanoFragment = new ItemModAxe(
+ "sharpenedVolcanoFragment", 4).setCreativeTab(tab);
+ powerJack = new ItemModAxe("powerJack").setCreativeTab(tab);
+ conniversKunai = new ItemKnife("conniversKunai", 3)
+ .setCreativeTab(tab);
+
+ GameRegistry.registerItem(equalizer, "equalizer");
+ GameRegistry.registerItem(escapePlan, "escapePlan");
+ GameRegistry.registerItem(marketGardener, "marketGardener");
+ GameRegistry.registerItem(axtinguisher, "axtinguisher");
+ GameRegistry.registerItem(sharpenedVolcanoFragment,
+ "sharpenedVolcanoFragment");
+ GameRegistry.registerItem(powerJack, "powerJack");
+ GameRegistry.registerItem(conniversKunai, "conniversKunai");
+
+ if (sandvichEnabled) {
+ sandvich = new ItemSandvich().setCreativeTab(tab);
+ GameRegistry.registerItem(sandvich, "sandvich");
+ }
+
+ noiseMakerBirthday = new ItemNoiseMaker("noiseMakerBirthday",
+ ReferenceTC.ID + ":tf2crates.birthday")
+ .setCreativeTab(tab);
+ noiseMakerSpooky = new ItemNoiseMaker("noiseMakerSpooky",
+ "mob.blaze.breath", "mob.creeper.say", "mob.endermen.idle",
+ "mob.endermen.stare", "mob.endermen.scream",
+ "mob.ghast.charge", "mob.ghast.death", "mob.ghast.moan",
+ "mob.silverfish.say", "mob.skeleton.say",
+ "mob.skeleton.step", "mob.spider.say", "mob.zombie.say")
+ .setCreativeTab(tab);
+ noiseMakerFestive = new ItemNoiseMaker("noiseMakerFestive",
+ ReferenceTC.ID + ":tf2crates.hohohohoho",
+ ReferenceTC.ID + ":tf2crates.sleighbells")
+ .setCreativeTab(tab);
+
+ GameRegistry.registerItem(noiseMakerBirthday,
+ "noiseMakerBirthday");
+ GameRegistry.registerItem(noiseMakerSpooky, "noiseMakerSpooky");
+ GameRegistry.registerItem(noiseMakerFestive, "noiseMakerFestive");
+
+ MinecraftForge.EVENT_BUS.register(new AnvilHandler());
+ MinecraftForge.EVENT_BUS.register(new DeathHandler());
+ MinecraftForge.EVENT_BUS.register(new AttackHandler());
+
+ FMLCommonHandler.instance().bus().register(new TickHandler());
+
+ GameRegistry.addShapelessRecipe(new ItemStack(scrap, 3, 0),
+ new ItemStack(Items.iron_ingot, 1),
+ new ItemStack(Items.iron_ingot, 1),
+ new ItemStack(Items.gold_ingot, 1));
+ GameRegistry.addShapelessRecipe(new ItemStack(scrap, 1, 1),
+ new ItemStack(scrap, 1, 0), new ItemStack(scrap, 1, 0),
+ new ItemStack(scrap, 1, 0));
+ GameRegistry.addShapelessRecipe(new ItemStack(scrap, 1, 2),
+ new ItemStack(scrap, 1, 1), new ItemStack(scrap, 1, 1),
+ new ItemStack(scrap, 1, 1));
+
+ if (difficultKeyRecipe) {
+ GameRegistry.addShapelessRecipe(new ItemStack(key, 1),
+ new ItemStack(scrap, 1, 2), new ItemStack(scrap, 1, 2),
+ new ItemStack(scrap, 1, 2),
+ new ItemStack(scrap, 1, 2));
+ } else {
+ GameRegistry.addShapelessRecipe(new ItemStack(key, 1),
+ new ItemStack(scrap, 1, 2), new ItemStack(scrap, 1, 2),
+ new ItemStack(scrap, 1, 2));
+ }
+
+ GameRegistry.addShapelessRecipe(new ItemStack(strangifier, 1),
+ new ItemStack(scrap, 1, 1), new ItemStack(scrap, 1, 0),
+ new ItemStack(scrap, 1, 0));
+
+ GameRegistry.addSmelting(new ItemStack(scrap, 1, 2),
+ new ItemStack(scrap, 3, 1), 0);
+ GameRegistry.addSmelting(new ItemStack(scrap, 1, 1),
+ new ItemStack(scrap, 3, 0), 0);
+
+ OreDictionary.registerOre("dye",
+ new ItemStack(paint, 1, OreDictionary.WILDCARD_VALUE));
+
+ String[] dyes = { "Black", "Red", "Green", "Brown", "Blue",
+ "Purple", "Cyan", "LightGray", "Gray", "Pink", "Lime",
+ "Yellow", "LightBlue", "Magenta", "Orange", "White" };
+
+ for (int i = 0; i < 16; i++) {
+ OreDictionary.registerOre("dye" + dyes[i],
+ new ItemStack(paint, 1, i));
+ }
+ }
+
+ public void postInitServer() {
+ FMLControlledNamespacedRegistry<
+ Item> items = GameData.getItemRegistry();
+
+ int i;
+
+ for (Iterator<Item> iterator = items.iterator();
+ iterator.hasNext();) {
+ Item item = iterator.next();
+
+ if (item != null) {
+ if (item instanceof ItemTool) {
+ ItemTool tool = (ItemTool) item;
+
+ addToolToCategory(item, tool.func_150913_i());
+
+ if (tool instanceof ItemPickaxe) {
+ RandomLoot.PICKAXES.add(tool);
+ } else if (tool instanceof ItemSpade) {
+ RandomLoot.SHOVELS.add(tool);
+ } else if (tool instanceof ItemAxe) {
+ RandomLoot.AXES.add(tool);
+ }
+ } else if (item instanceof ItemSword) {
+ RandomLoot.SWORDS.add(item);
+
+ try {
+ addToolToCategory(item, ToolMaterial.valueOf(
+ ((ItemSword) item).getToolMaterialName()));
+ } catch (IllegalArgumentException iaex) {
+ // Do nothing. DragonAPI compatibility
+ }
+ } else if (item instanceof ItemBow) {
+ RandomLoot.BOWS.add(item);
+ } else if (item instanceof ItemHoe) {
+
+ RandomLoot.HOES.add(item);
+
+ try {
+ addToolToCategory(item, ToolMaterial.valueOf(
+ ((ItemHoe) item).getToolMaterialName()));
+ } catch (IllegalArgumentException iaex) {
+ // Do nothing. DragonAPI compatibility
+ }
+ } else if (item instanceof ItemArmor) {
+ ItemArmor armor = (ItemArmor) item;
+
+ addArmorToCategory(item, armor.getArmorMaterial());
+
+ switch (armor.armorType) {
+ case 0:
+ RandomLoot.HELMETS.add(armor);
+ break;
+ case 1:
+ RandomLoot.CHESTPLATES.add(armor);
+ break;
+ case 2:
+ RandomLoot.LEGGINGS.add(armor);
+ break;
+ case 3:
+ RandomLoot.BOOTS.add(armor);
+ break;
+ }
+ } else if (item instanceof ItemFood) {
+ RandomLoot.FOOD.add(item);
+ } else if (item instanceof ItemSlab) {
+ RandomLoot.SLABS.add(new ItemStack(item, 1));
+ } else if (item instanceof ItemBlock
+ && ((ItemBlock) item).field_150939_a instanceof BlockStairs) {
+ RandomLoot.STAIRS.add(new ItemStack(item, 1));
+ } else if (item instanceof ItemBlock
+ && ((ItemBlock) item).field_150939_a instanceof BlockFence) {
+ RandomLoot.FENCES.add(new ItemStack(item, 1));
+ } else if (item instanceof IBauble) {
+ IBauble bauble = (IBauble) item;
+
+ try {
+ switch (bauble
+ .getBaubleType(new ItemStack(item, 1))) {
+
+ case AMULET:
+ RandomLoot.AMULETS.add(item);
+ break;
+ case BELT:
+ RandomLoot.BELTS.add(item);
+ break;
+ case RING:
+ RandomLoot.RINGS.add(item);
+ break;
+ default:
+ break;
+
+ }
+ } catch (NullPointerException npex) {
+ // Do nothing, a bauble failed to load properly
+ }
+ }
+ }
+ }
+
+ for (i = 0; i < Potion.potionTypes.length; i++) {
+ RandomLoot.POTIONS
+ .add(new ItemStack(Items.potionitem, 1, 8193 + i));
+ RandomLoot.POTIONS
+ .add(new ItemStack(Items.potionitem, 1, 8225 + i));
+ RandomLoot.POTIONS
+ .add(new ItemStack(Items.potionitem, 1, 8257 + i));
+
+ RandomLoot.SPLASH_POTIONS
+ .add(new ItemStack(Items.potionitem, 1, 16385 + i));
+ RandomLoot.SPLASH_POTIONS
+ .add(new ItemStack(Items.potionitem, 1, 16417 + i));
+ RandomLoot.SPLASH_POTIONS
+ .add(new ItemStack(Items.potionitem, 1, 16449 + i));
+ }
+
+ for (String oreName : OreDictionary.getOreNames()) {
+ try {
+ if (oreName.startsWith("dust")) {
+ if (!oreName.startsWith("dustSmall")
+ && !oreName.startsWith("dustTiny")) {
+ RandomLoot.DUSTS.add(
+ OreDictionary.getOres(oreName).get(0));
+ } else {
+
+ }
+ } else if (oreName.startsWith("arrow")) {
+ RandomLoot.ARROWS
+ .add(OreDictionary.getOres(oreName).get(0));
+ } else if (oreName.startsWith("block")) {
+ RandomLoot.BLOCKS
+ .add(OreDictionary.getOres(oreName).get(0));
+ } else if (oreName.startsWith("crate")) {
+ RandomLoot.CRATES
+ .add(OreDictionary.getOres(oreName).get(0));
+ } else if (oreName.startsWith("crop")) {
+ RandomLoot.CROPS
+ .add(OreDictionary.getOres(oreName).get(0));
+ } else if (oreName.startsWith("gem")) {
+ RandomLoot.GEMS
+ .add(OreDictionary.getOres(oreName).get(0));
+ } else if (oreName.startsWith("ingot")) {
+ RandomLoot.INGOTS
+ .add(OreDictionary.getOres(oreName).get(0));
+ } else if (oreName.startsWith("ore")) {
+ RandomLoot.ORES
+ .add(OreDictionary.getOres(oreName).get(0));
+ } else if (oreName.startsWith("seed")) {
+ RandomLoot.SEEDS
+ .add(OreDictionary.getOres(oreName).get(0));
+ } else if (oreName.startsWith("stone")) {
+ RandomLoot.STONES
+ .addAll(OreDictionary.getOres(oreName));
+ } else if (oreName.startsWith("toolHead")) {
+ RandomLoot.TOOL_HEADS
+ .add(OreDictionary.getOres(oreName).get(0));
+ }
+ } catch (IndexOutOfBoundsException ioobex) {
+ // Do nothing. Handle someone giving us a oredict entry
+ // without anything actually in it
+ }
+ }
+
+ RandomLoot.GLASS.addAll(OreDictionary.getOres("blockGlass"));
+ RandomLoot.GLASS.addAll(OreDictionary.getOres("paneGlass"));
+
+ RandomLoot.WOOL.addAll(OreDictionary.getOres("blockCloth"));
+
+ RandomLoot.DYES.addAll(OreDictionary.getOres("dye"));
+
+ RandomLoot.LOGS.addAll(OreDictionary.getOres("logWood"));
+
+ RandomLoot.PLANKS.addAll(OreDictionary.getOres("plankWood"));
+
+ RandomLoot.RECORDS.addAll(OreDictionary.getOres("record"));
+
+ RandomLoot.SAPLINGS.addAll(OreDictionary.getOres("treeSapling"));
+
+ RandomRandomLoot.init();
+
+ Crates.init();
+
+ WeightedRandomChestContent keyWRCC = new WeightedRandomChestContent(
+ new ItemStack(key, 1), 1, 1, keyRarity);
+
+ ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, keyWRCC);
+
+ ChestGenHooks.addItem(ChestGenHooks.BONUS_CHEST, keyWRCC);
+
+ ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, keyWRCC);
+
+ ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, keyWRCC);
+
+ ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, keyWRCC);
+
+ ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, keyWRCC);
+
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, keyWRCC);
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, keyWRCC);
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, keyWRCC);
+ }
+
+ public void initClient() {
+ }
+
+ public static CreativeTabs tab = new CreativeTabs("tf2Crates") {
+ @Override
+ public Item getTabIconItem() {
+ return crate;
+ }
+ };
+
+ private static void addToolToCategory(Item item,
+ ToolMaterial material) {
+ ArrayList<Item> list = RandomLoot.MATERIAL_TOOLS.get(material);
+
+ if (list == null) {
+ list = new ArrayList<Item>();
+ }
+
+ list.add(item);
+
+ RandomLoot.MATERIAL_TOOLS.remove(material);
+ RandomLoot.MATERIAL_TOOLS.put(material, list);
+ }
+
+ private static void addArmorToCategory(Item armor,
+ ArmorMaterial material) {
+ ArrayList<Item> list = RandomLoot.MATERIAL_ARMOR.get(material);
+
+ if (list == null) {
+ list = new ArrayList<Item>();
+ }
+
+ list.add(armor);
+
+ RandomLoot.MATERIAL_ARMOR.remove(material);
+ RandomLoot.MATERIAL_ARMOR.put(material, list);
+ }
+
+ private static void initConfig() {
+ Configuration config = new Configuration(
+ new File("./config/TF2 Crates.cfg"), true);
+
+ config.load();
+
+ Property prop = config.get("Chances",
+ "Chance of Crate from Mob Death", new int[] { 5, 100 });
+
+ prop.comment = "default: 5 out of 100 (5% chance)";
+
+ DeathHandler.crateChance = prop.getIntList();
+
+ prop = config.get("Chances", "Chance of Key from Mob Death",
+ new int[] { 2, 100 });
+
+ prop.comment = "default: 2 out of 100 (2% chance)";
+
+ DeathHandler.keyChance = prop.getIntList();
+
+ prop = config.get("Chances", "Chance of Unusual Effect",
+ new int[] { 2, 100 });
+
+ prop.comment = "default: 2 out of 100 (2% chance)";
+
+ ItemCrate.unusualChance = prop.getIntList();
+
+ prop = config.get("Chances", "Chance of Rare Weapon",
+ new int[] { 5, 100 });
+
+ prop.comment = "default: 5 out of 100 (5% chance)";
+
+ ItemCrate.weaponChance = prop.getIntList();
+
+ prop = config.get("Chances", "Key Rarity", 25);
+
+ prop.comment = "default: 25 | The rarity of keys generated inside of chests. The lower the rarer.";
+
+ keyRarity = prop.getInt();
+
+ prop = config.get("Recipe Tweaks", "Keys are Hard to Make", false);
+
+ prop.comment = "default: false | If false, keys cost 3 refined. If true, keys cost 4 refined.";
+
+ difficultKeyRecipe = prop.getBoolean();
+
+ prop = config.get("Weapons",
+ "Market Gardener Minimum Fall Distance", 0.75D);
+
+ prop.comment = "default: 0.75 | This is to prevent players from just jumping to get the crit :)";
+
+ AttackHandler.marketGardenerMinimumFall = prop.getDouble();
+
+ prop = config.get("Unusual Effect Stuff", "Repair Hat", true);
+
+ prop.comment = "default: true | If true, the helmet is repaired when combined with an unusual effect.";
+
+ AnvilHandler.repairHat = prop.getBoolean();
+
+ prop = config.get("Unusual Effect Stuff", "Make Hat Unbreakable",
+ true);
+
+ prop.comment = "default: false | If true, the helmet is made unbreakable when combined with an unusual effect.";
+
+ AnvilHandler.makeUnbreakable = prop.getBoolean();
+
+ prop = config.get("Weapons", "Unbreakable Rare Weapons", true);
+
+ prop.comment = "default: true | If true, all weapons added by this mod are unbrekable.";
+
+ unbreakableSuperWeapons = prop.getBoolean();
+
+ prop = config.get("Anvil Recipes", "Strangifier Cost", 15);
+
+ prop.comment = "default: 15 | The cost of adding a strangifier to an item.";
+
+ AnvilHandler.strangeCost = prop.getInt();
+
+ prop = config.get("Anvil Recipes", "Unusual Cost", 30);
+
+ prop.comment = "default: 30 | The cost of adding an unusual effect to a helmet.";
+
+ AnvilHandler.unusualCost = prop.getInt();
+
+ prop = config.get("Weapons", "Backstab Difficulty", 0.95D);
+
+ prop.comment = "default: 0.95D | The lower, the more difficult it is to get a backstab. 1 is very easy, and 0 is impossible.";
+
+ ItemKnife.backstabDifficulty = prop.getDouble();
+
+ prop = config.get("Weapons", "Enable Sandvich", true);
+
+ prop.comment = "default: true | If true, enables the sandvich.";
+
+ sandvichEnabled = prop.getBoolean();
+
+ prop = config.get("Chances", "Random Crates", 64);
+
+ prop.comment = "Number of series of crates with randomly determined loot to create";
+
+ numRandomCrates = prop.getInt();
+
+ config.save();
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/TF2Crates.java b/TF2 Crates/src/main/java/tf2crates/TF2Crates.java new file mode 100755 index 0000000..4670a31 --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/TF2Crates.java @@ -0,0 +1,34 @@ +package tf2crates;
+
+import static tf2crates.ReferenceTC.ID;
+import static tf2crates.ReferenceTC.NAME;
+import static tf2crates.ReferenceTC.VERSION;
+
+import cpw.mods.fml.common.Mod;
+import cpw.mods.fml.common.Mod.EventHandler;
+import cpw.mods.fml.common.Mod.Instance;
+import cpw.mods.fml.common.SidedProxy;
+import cpw.mods.fml.common.event.FMLPostInitializationEvent;
+import cpw.mods.fml.common.event.FMLPreInitializationEvent;
+
+@Mod(modid = ID, name = NAME, version = VERSION,
+ dependencies = "required-after:tlhpoeCore")
+public class TF2Crates { // TODO: Release
+ @Instance(ID)
+ public static TF2Crates instance;
+
+ @SidedProxy(clientSide = ID + ".ClientProxyTC",
+ serverSide = ID + ".ServerProxyTC")
+ public static ServerProxyTC proxy;
+
+ @EventHandler
+ public void preInit(FMLPreInitializationEvent event) {
+ proxy.initServer();
+ proxy.initClient();
+ }
+
+ @EventHandler
+ public void postInit(FMLPostInitializationEvent event) {
+ proxy.postInitServer();
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/crate/Crates.java b/TF2 Crates/src/main/java/tf2crates/crate/Crates.java new file mode 100755 index 0000000..542b88a --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/crate/Crates.java @@ -0,0 +1,313 @@ +package tf2crates.crate;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.Item.ToolMaterial;
+import net.minecraft.item.ItemArmor.ArmorMaterial;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.StatCollector;
+import tf2crates.ServerProxyTC;
+import tlhpoeCore.ReferenceT;
+import tlhpoeCore.util.MathUtil;
+
+public class Crates {
+ public static final Map<Integer,
+ Object[]> CRATE_LOOT = new HashMap<
+ Integer, Object[]>();
+ public static final Map<String,
+ Integer> SPECIAL_CRATES = new HashMap<
+ String, Integer>();
+ public static final Map<Integer,
+ String> SCRATES_REVERSE = new HashMap<
+ Integer, String>();
+
+ public static void init() {
+ addNormalCrates();
+
+ addSpecialCrates();
+
+ List<Integer> IDs = new ArrayList<Integer>();
+ List<String> names = new ArrayList<String>();
+
+ IDs.addAll(SPECIAL_CRATES.values());
+ names.addAll(SPECIAL_CRATES.keySet());
+
+ for (int i = 0; i < SPECIAL_CRATES.size(); i++) {
+ SCRATES_REVERSE.put(IDs.get(i), names.get(i));
+ }
+
+ if (ReferenceT.DEOBFUSCATED) {
+ for (int i = 1; i < getNumberOfSeries() + 1; i++) {
+ Object[] lootItems = getLootForCrate(i);
+
+ if (SPECIAL_CRATES.containsValue(i)) {
+ System.out.println("* '''"
+ + StatCollector.translateToLocal("crate."
+ + SCRATES_REVERSE.get(i) + ".name")
+ + "''' <br />");
+ } else {
+ System.out.println(
+ "* '''Crate Series #" + i + "''' <br />");
+ }
+
+ for (int j = 0; j < lootItems.length; j++) {
+ Object loot = lootItems[j];
+ String name = null;
+
+ if (loot instanceof ItemStack) {
+ name = ((ItemStack) loot).getDisplayName();
+ } else if (loot instanceof RandomLoot) {
+ name = ((RandomLoot) loot).getDisplayName();
+ }
+
+ System.out.println("** " + name + " <br />");
+ }
+
+ System.out
+ .println("** or an Exceedingly Rare Special Item!"
+ + " <br /> <br />");
+ System.out.println(" ");
+ }
+ }
+ }
+
+ private static void addSpecialCrates() {
+ addSpecialCrateLoot("spookyCrate",
+ new ItemStack(ServerProxyTC.noiseMakerSpooky, 1),
+ new RandomLoot.SpecificItem(Items.emerald, 8, 16),
+ new RandomLoot.SpecificItem(Items.diamond, 8, 16),
+ new RandomLoot.SpecificItem(Items.gold_ingot, 16, 32),
+ new RandomLoot.SpecificItem(Items.iron_ingot, 32, 64),
+ new RandomLoot.SpecificItem(Items.cookie, 48, 64));
+
+ addSpecialCrateLoot("festiveCrate",
+ new ItemStack(ServerProxyTC.noiseMakerFestive, 1),
+ new RandomLoot.SpecificItem(Items.emerald, 8, 16),
+ new RandomLoot.SpecificItem(Items.diamond, 8, 16),
+ new RandomLoot.SpecificItem(Items.gold_ingot, 16, 32),
+ new RandomLoot.SpecificItem(Items.iron_ingot, 32, 64),
+ new RandomLoot.SpecificItem(Items.experience_bottle, 48,
+ 64));
+
+ addSpecialCrateLoot("birthdayCrate",
+ new ItemStack(ServerProxyTC.noiseMakerBirthday, 1),
+ new RandomLoot.SpecificItem(Items.emerald, 8, 16),
+ new RandomLoot.SpecificItem(Items.diamond, 8, 16),
+ new RandomLoot.SpecificItem(Items.gold_ingot, 16, 32),
+ new RandomLoot.SpecificItem(Items.iron_ingot, 32, 64),
+ new RandomLoot.SpecificItem(Items.cake, 16, 64));
+ }
+
+ private static void addNormalCrates() {
+ addCrateLoot(new ItemStack(Items.name_tag, 1),
+ new ItemStack(ServerProxyTC.paint, 1, 0),
+ new ItemStack(ServerProxyTC.paint, 1, 15),
+ new RandomLoot.Pickaxe(true));
+
+ addCrateLoot(new RandomLoot.Pickaxe(true),
+ new RandomLoot.Sword(true), new RandomLoot.EnchantedBook(),
+ new RandomLoot.Food());
+
+ addCrateLoot(new RandomLoot.Food(), new RandomLoot.Potion(),
+ new RandomLoot.Chestplate(false),
+ new RandomLoot.Boot(false));
+
+ addCrateLoot(new ItemStack(Items.nether_wart, 32),
+ new RandomLoot.SpecificItem(Items.blaze_rod, 16, 32),
+ new RandomLoot.SpecificItem(Items.ghast_tear, 8, 16),
+ new RandomLoot.SpecificItem(
+ Item.getItemFromBlock(Blocks.enchanting_table), 2,
+ 4),
+ new RandomLoot.SpecificItem(
+ Item.getItemFromBlock(Blocks.beacon), 2, 4));
+
+ addCrateLoot(new ItemStack(Items.name_tag, 1),
+ new ItemStack(ServerProxyTC.paint, 1, 7),
+ new ItemStack(ServerProxyTC.paint, 1, 8),
+ new RandomLoot.Hoe(true));
+
+ addCrateLoot(new RandomLoot.Food(), new RandomLoot.Potion(),
+ new RandomLoot.Axe(false), new RandomLoot.Sword(false));
+
+ addCrateLoot(new ItemStack(Items.name_tag, 1),
+ new ItemStack(ServerProxyTC.paint, 1, 1),
+ new ItemStack(ServerProxyTC.paint, 1, 14),
+ new RandomLoot.Shovel(true));
+
+ addCrateLoot(new RandomLoot.Shovel(true), new RandomLoot.Axe(true),
+ new RandomLoot.EnchantedBook(), new RandomLoot.Food());
+
+ addCrateLoot(new RandomLoot.Pickaxe(false),
+ new RandomLoot.Shovel(false), new RandomLoot.Axe(false),
+ new RandomLoot.Sword(false), new RandomLoot.Hoe(false));
+
+ addCrateLoot(new ItemStack(Items.name_tag, 1),
+ new ItemStack(ServerProxyTC.paint, 1, 5),
+ new ItemStack(ServerProxyTC.paint, 1, 10),
+ new RandomLoot.Shovel(true));
+
+ addCrateLoot(new ItemStack(ServerProxyTC.paint, 1, 12),
+ new RandomLoot.CertainMaterialArmor(ArmorMaterial.DIAMOND,
+ true),
+ new RandomLoot.CertainMaterialTool(ToolMaterial.EMERALD,
+ true));
+
+ addCrateLoot(new RandomLoot.Helmet(true),
+ new RandomLoot.Legging(true),
+ new RandomLoot.EnchantedBook(), new RandomLoot.Food());
+
+ addCrateLoot(
+ new RandomLoot.SpecificItem(Items.carrot_on_a_stick, 1, 4),
+ new RandomLoot.SpecificItem(Items.bone, 32, 64),
+ new RandomLoot.Food(),
+ new RandomLoot.SpecificItem(Items.nether_star, 1, 4),
+ new RandomLoot.Pickaxe(true));
+
+ addCrateLoot(new ItemStack(Items.name_tag, 1),
+ new ItemStack(ServerProxyTC.paint, 1, 2),
+ new ItemStack(ServerProxyTC.paint, 1, 13),
+ new RandomLoot.Sword(true));
+
+ addCrateLoot(new RandomLoot.Food(), new RandomLoot.SplashPotion(),
+ new RandomLoot.Shovel(false),
+ new RandomLoot.Pickaxe(false));
+
+ addCrateLoot(new ItemStack(Items.name_tag, 1),
+ new ItemStack(ServerProxyTC.paint, 1, 3),
+ new ItemStack(ServerProxyTC.paint, 1, 12),
+ new RandomLoot.Axe(true));
+
+ addCrateLoot(new RandomLoot.Helmet(false),
+ new RandomLoot.Legging(false), new RandomLoot.Boot(false),
+ new RandomLoot.Axe(false), new RandomLoot.Hoe(false));
+
+ addCrateLoot(new ItemStack(ServerProxyTC.paint, 1, 11),
+ new RandomLoot.CertainMaterialArmor(ArmorMaterial.GOLD,
+ true),
+ new RandomLoot.CertainMaterialTool(ToolMaterial.GOLD,
+ true));
+
+ addCrateLoot(new RandomLoot.Chestplate(true),
+ new RandomLoot.Boot(true), new RandomLoot.Shovel(true),
+ new RandomLoot.Axe(true));
+
+ addCrateLoot(new RandomLoot.Hoe(true), new RandomLoot.Axe(true),
+ new RandomLoot.EnchantedBook(), new RandomLoot.Food());
+
+ addCrateLoot(new ItemStack(Items.name_tag, 1),
+ new ItemStack(ServerProxyTC.paint, 1, 6),
+ new ItemStack(ServerProxyTC.paint, 1, 9),
+ new RandomLoot.Pickaxe(true));
+
+ addCrateLoot(new RandomLoot.Chestplate(false),
+ new RandomLoot.Pickaxe(false), new RandomLoot.Sword(true),
+ new RandomLoot.Food(), new RandomLoot.Boot(true));
+
+ addCrateLoot(new RandomLoot.Food(), new RandomLoot.SplashPotion(),
+ new RandomLoot.Helmet(true), new RandomLoot.Legging(true),
+ new RandomLoot.Chestplate(false));
+
+ addCrateLoot(new RandomLoot.Chestplate(true),
+ new RandomLoot.Boot(true), new RandomLoot.EnchantedBook(),
+ new RandomLoot.Food());
+
+ addCrateLoot(new ItemStack(Items.name_tag, 1),
+ new ItemStack(ServerProxyTC.paint, 1, 4),
+ new ItemStack(ServerProxyTC.paint, 1, 11),
+ new RandomLoot.Sword(true));
+
+ addCrateLoot(new RandomLoot.Helmet(false),
+ new RandomLoot.Chestplate(false),
+ new RandomLoot.Legging(false), new RandomLoot.Boot(false));
+
+ addCrateLoot(new RandomLoot.Paint(), new RandomLoot.Potion(),
+ new RandomLoot.SplashPotion(), new RandomLoot.Food());
+
+ addCrateLoot(new ItemStack(ServerProxyTC.paint, 1, 7),
+ new RandomLoot.CertainMaterialArmor(ArmorMaterial.IRON,
+ true),
+ new RandomLoot.CertainMaterialTool(ToolMaterial.IRON,
+ true));
+
+ addCrateLoot(new RandomLoot.Helmet(true),
+ new RandomLoot.Legging(true), new RandomLoot.Pickaxe(true),
+ new RandomLoot.Sword(true));
+
+ addCrateLoot(new RandomLoot.EnchantedBook(), new RandomLoot.Food(),
+ new RandomLoot.Paint(), new RandomLoot.FishingRod());
+
+ addCrateLoot(new RandomLoot.Bow(true), new RandomLoot.Arrow(),
+ new RandomLoot.FishingRod(),
+ new RandomLoot.SplashPotion());
+
+ addCrateLoot(new RandomLoot.SpecificItem(Items.dye, 16, 32, 15),
+ new RandomLoot.Hoe(true), new RandomLoot.Seed(),
+ new RandomLoot.Saplings());
+
+ addCrateLoot(new RandomLoot.Amulet(), new RandomLoot.Belt(),
+ new RandomLoot.Ring());
+
+ // Add in random random crates - per MC load
+ for (int i = 0; i < ServerProxyTC.numRandomCrates; i++) {
+ int numInCrate = MathUtil.getRandomIntegerBetween(0, 2) + 3;
+
+ List<RandomLoot> crateContents = new ArrayList<RandomLoot>(numInCrate);
+
+ for (int j = 0; j < numInCrate; j++) {
+ RandomLoot possibleLoot = RandomRandomLoot.getRandomLoot();
+
+ while (crateContents.contains(possibleLoot)) {
+ possibleLoot = RandomRandomLoot.getRandomLoot();
+ }
+
+ crateContents.add(possibleLoot);
+ }
+
+ CRATE_LOOT.put(CRATE_LOOT.size() + 1, crateContents.toArray());
+ }
+ }
+
+ private static void addCrateLoot(Object... lootItems) {
+ CRATE_LOOT.put(CRATE_LOOT.size() + 1, lootItems);
+ }
+
+ public static Object[] getLootForCrate(int series) {
+ return CRATE_LOOT.get(series);
+ }
+
+ public static int getNumberOfSeries() {
+ return CRATE_LOOT.size();
+ }
+
+ private static void addSpecialCrateLoot(String name,
+ Object... lootItems) {
+ addCrateLoot(lootItems);
+ SPECIAL_CRATES.put(name, CRATE_LOOT.size());
+ }
+
+ public static Object[] getLootForSpecialCreate(String crateName) {
+ return CRATE_LOOT.get(SPECIAL_CRATES.get(crateName));
+ }
+
+ public static String getNameFromSeries(int series) {
+ return SCRATES_REVERSE.get(series);
+ }
+
+ public static boolean isSeriesSpecial(int series) {
+ return SPECIAL_CRATES.containsValue(series);
+ }
+
+ public static int getNumberOfSpecialCrates() {
+ return SPECIAL_CRATES.size();
+ }
+
+ public static int getSeriesFromName(String name) {
+ return SPECIAL_CRATES.get(name);
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/crate/RandomLoot.java b/TF2 Crates/src/main/java/tf2crates/crate/RandomLoot.java new file mode 100755 index 0000000..ee7ef5a --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/crate/RandomLoot.java @@ -0,0 +1,1065 @@ +package tf2crates.crate;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.enchantment.EnchantmentData;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.Item.ToolMaterial;
+import net.minecraft.item.ItemArmor.ArmorMaterial;
+import net.minecraft.item.ItemStack;
+import tf2crates.ServerProxyTC;
+import tf2crates.item.ItemPaint;
+import tlhpoeCore.util.MathUtil;
+
+public abstract class RandomLoot {
+ private static int nextID = 0;
+ private int ID;
+
+ private List<Item> possibleLoot;
+ protected boolean enchanted;
+ public int min = 1, max = 1;
+
+ protected RandomLoot(List<Item> possibleLoot, boolean enchanted) {
+ this.possibleLoot = possibleLoot;
+ this.enchanted = enchanted;
+
+ ID = nextID++;
+ }
+
+ public ItemStack getLoot() {
+ ItemStack loot = new ItemStack(
+ possibleLoot.get(MathUtil.nextInt(possibleLoot.size())),
+ MathUtil.getRandomIntegerBetween(min, max));
+
+ if (enchanted) {
+ EnchantmentHelper.addRandomEnchantment(MathUtil.getRandom(),
+ loot, MathUtil.getRandomIntegerBetween(25, 30));
+ }
+
+ return loot;
+ }
+
+ public abstract String getDisplayName();
+
+ public int getID() {
+ return ID;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ID;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj == null) {
+ return false;
+ }
+
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ RandomLoot other = (RandomLoot) obj;
+
+ if (ID != other.ID) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static class SpecificItem extends RandomLoot {
+ private ItemStack itemStack;
+ private Item item;
+ private int meta = -1;
+
+ public SpecificItem(Item item, int min, int max) {
+ super(null, false);
+
+ this.itemStack = new ItemStack(item, 1);
+ this.item = item;
+ this.min = min;
+ this.max = max;
+ }
+
+ public SpecificItem(Item item, int min, int max, int meta) {
+ this(item, min, max);
+
+ this.meta = meta;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return min != max ? (min + " to " + max + " "
+ + itemStack.getDisplayName() + (min > 1 ? "s" : ""))
+ : ((min > 1 ? (min + " ") : "A ")
+ + itemStack.getDisplayName()
+ + (min > 1 ? "s" : ""));
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ return new ItemStack(item,
+ MathUtil.getRandomIntegerBetween(min, max), meta);
+ }
+ }
+
+ public static class Pickaxe extends RandomLoot {
+ public Pickaxe(boolean enchanted) {
+ super(PICKAXES, enchanted);
+ }
+
+ @Override
+ public String getDisplayName() {
+ return enchanted ? "An Enchanted Random Pickaxe"
+ : "A Random Pickaxe";
+ }
+ }
+
+ public static class Shovel extends RandomLoot {
+ public Shovel(boolean enchanted) {
+ super(SHOVELS, enchanted);
+ }
+
+ @Override
+ public String getDisplayName() {
+ return enchanted ? "An Enchanted Random Shovel"
+ : "A Random Shovel";
+ }
+ }
+
+ public static class Axe extends RandomLoot {
+ public Axe(boolean enchanted) {
+ super(AXES, enchanted);
+ }
+
+ @Override
+ public String getDisplayName() {
+ return enchanted ? "An Enchanted Random Axe" : "A Random Axe";
+ }
+ }
+
+ public static class Hoe extends RandomLoot {
+ public Hoe(boolean enchanted) {
+ super(HOES, enchanted);
+ }
+
+ @Override
+ public String getDisplayName() {
+ return enchanted ? "An Enchanted Random Hoe" : "A Random Hoe";
+ }
+ }
+
+ public static class ToolHead extends RandomLoot {
+ public ToolHead() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack head = TOOL_HEADS
+ .get(MathUtil.getRandomIntegerBetween(0,
+ RandomLoot.TOOL_HEADS.size()))
+ .copy();
+
+ return head;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "A Random Tool Head";
+ }
+
+ }
+
+ public static class Sword extends RandomLoot {
+ public Sword(boolean enchanted) {
+ super(SWORDS, enchanted);
+ }
+
+ @Override
+ public String getDisplayName() {
+ return enchanted ? "An Enchanted Random Sword"
+ : "A Random Sword";
+ }
+ }
+
+ public static class Bow extends RandomLoot {
+ public Bow(boolean enchanted) {
+ super(BOWS, enchanted);
+
+ this.min = 1;
+ this.max = 1;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return enchanted ? "An Enchanted Random Bow" : "A Random Bow";
+ }
+ }
+
+ public static class Seed extends RandomLoot {
+ public Seed() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack seedType = SEEDS
+ .get(MathUtil.getRandomIntegerBetween(0, SEEDS.size()))
+ .copy();
+
+ seedType.stackSize = MathUtil.getRandomIntegerBetween(16, 32);
+
+ return seedType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "16 to 32 Seeds of a Random Type";
+ }
+ }
+
+ public static class Saplings extends RandomLoot {
+ public Saplings() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack saplingType = SAPLINGS.get(
+ MathUtil.getRandomIntegerBetween(0, SAPLINGS.size()))
+ .copy();
+
+ saplingType.stackSize = MathUtil.getRandomIntegerBetween(16,
+ 32);
+
+ return saplingType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "16 to 32 Saplings of a Random Type";
+ }
+ }
+
+ public static class Arrow extends RandomLoot {
+ public Arrow() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack arrowType = ARROWS.get(
+ MathUtil.getRandomIntegerBetween(0, ARROWS.size()))
+ .copy();
+
+ arrowType.stackSize = MathUtil.getRandomIntegerBetween(16, 32);
+
+ return arrowType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "16 to 32 Arrows of a Random Type";
+ }
+ }
+
+ public static class Helmet extends RandomLoot {
+ public Helmet(boolean enchanted) {
+ super(HELMETS, enchanted);
+ }
+
+ @Override
+ public String getDisplayName() {
+ return enchanted ? "An Enchanted Random Helmet"
+ : "A Random Helmet";
+ }
+ }
+
+ public static class Chestplate extends RandomLoot {
+ public Chestplate(boolean enchanted) {
+ super(CHESTPLATES, enchanted);
+ }
+
+ @Override
+ public String getDisplayName() {
+ return enchanted ? "An Enchanted Random Chestplate"
+ : "A Random Chestplate";
+ }
+ }
+
+ public static class Legging extends RandomLoot {
+ public Legging(boolean enchanted) {
+ super(LEGGINGS, enchanted);
+ }
+
+ @Override
+ public String getDisplayName() {
+ return enchanted ? "Enchanted Random Leggings"
+ : "Random Leggings";
+ }
+ }
+
+ public static class Boot extends RandomLoot {
+ public Boot(boolean enchanted) {
+ super(BOOTS, enchanted);
+ }
+
+ @Override
+ public String getDisplayName() {
+ return enchanted ? "Enchanted Random Boots" : "Random Boots";
+ }
+ }
+
+ public static class Food extends RandomLoot {
+ public Food() {
+ super(FOOD, false);
+
+ this.min = 16;
+ this.max = 64;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "16 to 64 of a Random Food Item";
+ }
+ }
+
+ public static class Potion extends RandomLoot {
+ public Potion() {
+ super(null, false);
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "4 to 16 of a Random Potion";
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack loot = POTIONS.get(MathUtil.nextInt(POTIONS.size()))
+ .copy();
+
+ loot.stackSize = MathUtil.getRandomIntegerBetween(4, 16);
+
+ return loot;
+ }
+ }
+
+ public static class SplashPotion extends RandomLoot {
+ public SplashPotion() {
+ super(null, false);
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "4 to 16 of a Random Splash Potion";
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack loot = SPLASH_POTIONS
+ .get(MathUtil.nextInt(SPLASH_POTIONS.size())).copy();
+
+ loot.stackSize = MathUtil.getRandomIntegerBetween(4, 16);
+
+ return loot;
+ }
+ }
+
+ public static class CertainMaterialTool extends RandomLoot {
+ private ToolMaterial material;
+
+ public CertainMaterialTool(ToolMaterial material,
+ boolean enchanted) {
+ super(MATERIAL_TOOLS.get(material), enchanted);
+
+ this.material = material;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return enchanted
+ ? "Enchanted Random " + material.name() + " Tool"
+ : "Random " + material.name() + " Tool";
+ }
+ }
+
+ public static class CertainMaterialArmor extends RandomLoot {
+ private ArmorMaterial material;
+
+ public CertainMaterialArmor(ArmorMaterial material,
+ boolean enchanted) {
+ super(MATERIAL_ARMOR.get(material), enchanted);
+
+ this.material = material;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return enchanted
+ ? "Enchanted Random " + material.name() + " Armor"
+ : "Random " + material.name() + " Armor";
+ }
+ }
+
+ public static class Paint extends RandomLoot {
+ public Paint() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ int dmg = MathUtil.nextInt(ItemPaint.TYPES.length);
+
+ if (MathUtil.getChance(1, 50)) {
+ dmg = 11;
+ }
+
+ return new ItemStack(ServerProxyTC.paint, 1, dmg);
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "A Random Paint";
+ }
+ }
+
+ public static class EnchantedBook extends RandomLoot {
+ public EnchantedBook() {
+ super(null, true);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack loot = new ItemStack(Items.enchanted_book,
+ MathUtil.getRandomIntegerBetween(2, 8));
+ Enchantment enchantment = Enchantment.enchantmentsBookList[MathUtil
+ .nextInt(Enchantment.enchantmentsBookList.length)];
+
+ Items.enchanted_book.addEnchantment(loot,
+ new EnchantmentData(enchantment,
+ MathUtil.getRandomIntegerBetween(
+ enchantment.getMinLevel(),
+ enchantment.getMaxLevel())));
+
+ return loot;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "2 to 8 Random Enchanted Books";
+ }
+ }
+
+ public static class FishingRod extends RandomLoot {
+ public FishingRod() {
+ super(null, true);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack loot = new ItemStack(Items.fishing_rod, 1);
+
+ EnchantmentHelper.addRandomEnchantment(MathUtil.getRandom(),
+ loot, 30);
+
+ return loot;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "A Randomly Enchanted Fishing Rod";
+ }
+ }
+
+ public static class Slab extends RandomLoot {
+ public Slab() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack slabType = SLABS
+ .get(MathUtil.getRandomIntegerBetween(0, SLABS.size()))
+ .copy();
+
+ slabType.stackSize = MathUtil.getRandomIntegerBetween(16, 64);
+
+ return slabType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "16 to 64 Slabs of a Random Type";
+ }
+ }
+
+ public static class Stair extends RandomLoot {
+ public Stair() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack stairType = STAIRS.get(
+ MathUtil.getRandomIntegerBetween(0, STAIRS.size()))
+ .copy();
+
+ stairType.stackSize = MathUtil.getRandomIntegerBetween(16, 64);
+
+ return stairType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "16 to 64 Stairs of a Random Type";
+ }
+ }
+
+ public static class Fence extends RandomLoot {
+ public Fence() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack fenceType = FENCES.get(
+ MathUtil.getRandomIntegerBetween(0, FENCES.size()))
+ .copy();
+
+ fenceType.stackSize = MathUtil.getRandomIntegerBetween(16, 64);
+
+ return fenceType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "16 to 64 Fences of a Random Type";
+ }
+ }
+
+ public static class Planks extends RandomLoot {
+ public Planks() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack plankType = PLANKS.get(
+ MathUtil.getRandomIntegerBetween(0, PLANKS.size()))
+ .copy();
+
+ plankType.stackSize = MathUtil.getRandomIntegerBetween(16, 64);
+
+ return plankType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "16 to 64 Planks of a Random Type";
+ }
+ }
+
+ public static class Logs extends RandomLoot {
+ public Logs() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack logType = LOGS
+ .get(MathUtil.getRandomIntegerBetween(0, LOGS.size()))
+ .copy();
+
+ logType.stackSize = MathUtil.getRandomIntegerBetween(16, 32);
+
+ return logType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "16 to 32 Logs of a Random Type";
+ }
+ }
+
+ public static class Crop extends RandomLoot {
+ public Crop() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack cropType = CROPS
+ .get(MathUtil.getRandomIntegerBetween(0, CROPS.size()))
+ .copy();
+
+ cropType.stackSize = MathUtil.getRandomIntegerBetween(16, 32);
+
+ return cropType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "8 to 16 Crops of a Random Type";
+ }
+ }
+
+ public static class Dye extends RandomLoot {
+ public Dye() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack dyeType = DYES
+ .get(MathUtil.getRandomIntegerBetween(0, DYES.size()))
+ .copy();
+
+ dyeType.stackSize = MathUtil.getRandomIntegerBetween(16, 32);
+
+ return dyeType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "16 to 32 Logs of a Random Type";
+ }
+ }
+
+ public static class Record extends RandomLoot {
+ public Record() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack dyeType = RECORDS.get(
+ MathUtil.getRandomIntegerBetween(0, RECORDS.size()))
+ .copy();
+
+ dyeType.stackSize = 1;
+
+ return dyeType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "A Random Record";
+ }
+ }
+
+ public static class Glass extends RandomLoot {
+ public Glass() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack glassType = GLASS.get(MathUtil
+ .getRandomIntegerBetween(0, RandomLoot.GLASS.size()))
+ .copy();
+
+ glassType.stackSize = MathUtil.getRandomIntegerBetween(32, 64);
+
+ return glassType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "32 to 64 Glass of a Random Type";
+ }
+ }
+
+ public static class Wool extends RandomLoot {
+ public Wool() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack woolType = WOOL.get(MathUtil
+ .getRandomIntegerBetween(0, RandomLoot.WOOL.size()))
+ .copy();
+
+ woolType.stackSize = MathUtil.getRandomIntegerBetween(8, 32);
+
+ return woolType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "8 to 32 Wool of a Random Type";
+ }
+ }
+
+ public static class Stone extends RandomLoot {
+ public Stone() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack stoneType = STONES.get(MathUtil
+ .getRandomIntegerBetween(0, RandomLoot.STONES.size()))
+ .copy();
+
+ stoneType.stackSize = MathUtil.getRandomIntegerBetween(16, 48);
+
+ return stoneType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "16 to 48 Stone of a Random Type";
+ }
+ }
+
+ public static class Dust extends RandomLoot {
+ public Dust() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack dustType = RandomLoot.DUSTS.get(MathUtil
+ .getRandomIntegerBetween(0, RandomLoot.DUSTS.size()))
+ .copy();
+
+ dustType.stackSize = MathUtil.getRandomIntegerBetween(8, 16);
+
+ return dustType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "8 to 16 Dust of a Random Type";
+ }
+ }
+
+ public static class Block extends RandomLoot {
+ public Block() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack blockType = RandomLoot.DUSTS.get(MathUtil
+ .getRandomIntegerBetween(0, RandomLoot.DUSTS.size()))
+ .copy();
+
+ blockType.stackSize = MathUtil.getRandomIntegerBetween(4, 8);
+
+ return blockType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "4 to 8 Random Blocks";
+ }
+ }
+
+ public static class Crate extends RandomLoot {
+ public Crate() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack crateType = RandomLoot.CRATES.get(MathUtil
+ .getRandomIntegerBetween(0, RandomLoot.CRATES.size()))
+ .copy();
+
+ crateType.stackSize = MathUtil.getRandomIntegerBetween(4, 8);
+
+ return crateType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "4 to 8 Storage Crates of a Random Type";
+ }
+ }
+
+ public static class Gem extends RandomLoot {
+ public Gem() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack gemType = RandomLoot.GEMS.get(MathUtil
+ .getRandomIntegerBetween(0, RandomLoot.GEMS.size()))
+ .copy();
+
+ gemType.stackSize = MathUtil.getRandomIntegerBetween(8, 16);
+
+ return gemType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "8 to 16 Gems of a Random Type";
+ }
+ }
+
+ public static class Ingot extends RandomLoot {
+ public Ingot() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack ingotType = RandomLoot.INGOTS.get(MathUtil
+ .getRandomIntegerBetween(0, RandomLoot.INGOTS.size()))
+ .copy();
+
+ ingotType.stackSize = MathUtil.getRandomIntegerBetween(16, 32);
+
+ return ingotType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "16 to 32 Ingots of a Random Type";
+ }
+ }
+
+ public static class Ore extends RandomLoot {
+ public Ore() {
+ super(null, false);
+ }
+
+ @Override
+ public ItemStack getLoot() {
+ ItemStack oreType = RandomLoot.ORES.get(MathUtil
+ .getRandomIntegerBetween(0, RandomLoot.ORES.size()))
+ .copy();
+
+ oreType.stackSize = MathUtil.getRandomIntegerBetween(16, 32);
+
+ return oreType;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "16 to 32 Ores of a Random Type";
+ }
+ }
+
+ public static class Belt extends RandomLoot {
+ public Belt() {
+ super(RandomLoot.BELTS, false);
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "A Random Belt";
+ }
+
+ }
+
+ public static class Amulet extends RandomLoot {
+ public Amulet() {
+ super(RandomLoot.AMULETS, false);
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "A Random Amulet";
+ }
+
+ }
+
+ public static class Ring extends RandomLoot {
+ public Ring() {
+ super(RandomLoot.RINGS, false);
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "A Random Ring";
+ }
+ }
+
+ /*
+ * Tool Loot
+ */
+ public static final List<
+ Item> PICKAXES = new ArrayList<
+ Item>();
+ public static final List<
+ Item> SHOVELS = new ArrayList<
+ Item>();
+ public static final List<
+ Item> AXES = new ArrayList<
+ Item>();
+ public static final List<
+ Item> HOES = new ArrayList<
+ Item>();
+ public static final List<
+ ItemStack> TOOL_HEADS = new ArrayList<
+ ItemStack>();
+
+ /*
+ * Weapon Loot
+ */
+ public static final List<
+ Item> SWORDS = new ArrayList<
+ Item>();
+ public static final List<
+ Item> BOWS = new ArrayList<
+ Item>();
+ public static final List<
+ ItemStack> ARROWS = new ArrayList<
+ ItemStack>();
+
+ /*
+ * Tool Material Loot
+ */
+ public static final Map<ToolMaterial,
+ ArrayList<
+ Item>> MATERIAL_TOOLS = new HashMap<
+ ToolMaterial, ArrayList<Item>>();
+
+ /*
+ * Armor Loot
+ */
+ public static final List<
+ Item> HELMETS = new ArrayList<
+ Item>();
+ public static final List<
+ Item> CHESTPLATES = new ArrayList<
+ Item>();
+ public static final List<
+ Item> LEGGINGS = new ArrayList<
+ Item>();
+ public static final List<
+ Item> BOOTS = new ArrayList<
+ Item>();
+
+ /*
+ * Armor Material Loot
+ */
+ public static final Map<ArmorMaterial,
+ ArrayList<
+ Item>> MATERIAL_ARMOR = new HashMap<
+ ArmorMaterial, ArrayList<Item>>();
+
+ /*
+ * Food Loot
+ */
+ public static final List<
+ Item> FOOD = new ArrayList<
+ Item>();
+ public static final List<
+ ItemStack> CROPS = new ArrayList<
+ ItemStack>();
+ public static final List<
+ ItemStack> SEEDS = new ArrayList<
+ ItemStack>();
+
+ /*
+ * Potion Loot
+ */
+ public static final List<
+ ItemStack> POTIONS = new ArrayList<
+ ItemStack>();
+ public static final List<
+ ItemStack> SPLASH_POTIONS = new ArrayList<
+ ItemStack>();
+
+ /*
+ * Resource Loot
+ */
+ public static final List<
+ ItemStack> DUSTS = new ArrayList<
+ ItemStack>();
+ public static final List<
+ ItemStack> BLOCKS = new ArrayList<
+ ItemStack>();
+ public static final List<
+ ItemStack> CRATES = new ArrayList<
+ ItemStack>();
+ public static final List<
+ ItemStack> GEMS = new ArrayList<
+ ItemStack>();
+ public static final List<
+ ItemStack> INGOTS = new ArrayList<
+ ItemStack>();
+ public static final List<
+ ItemStack> ORES = new ArrayList<
+ ItemStack>();
+
+ /*
+ * Decorative Loot
+ */
+ public static final List<
+ ItemStack> GLASS = new ArrayList<
+ ItemStack>();
+ public static final List<
+ ItemStack> WOOL = new ArrayList<
+ ItemStack>();
+ public static final List<
+ ItemStack> DYES = new ArrayList<
+ ItemStack>();
+ public static final List<
+ ItemStack> FENCES = new ArrayList<
+ ItemStack>();
+ public static final List<
+ ItemStack> LOGS = new ArrayList<
+ ItemStack>();
+ public static final List<
+ ItemStack> PLANKS = new ArrayList<
+ ItemStack>();
+ public static final List<
+ ItemStack> RECORDS = new ArrayList<
+ ItemStack>();
+ public static final List<
+ ItemStack> SLABS = new ArrayList<
+ ItemStack>();
+ public static final List<
+ ItemStack> STAIRS = new ArrayList<
+ ItemStack>();
+ public static final List<
+ ItemStack> STONES = new ArrayList<
+ ItemStack>();
+ public static final List<
+ ItemStack> SAPLINGS = new ArrayList<
+ ItemStack>();
+
+ /*
+ * List of weapons
+ */
+ public static final List<
+ Item> WEAPONS = new ArrayList<
+ Item>();
+
+ /*
+ * List of baubles
+ */
+ public static final List<
+ Item> BELTS = new ArrayList<
+ Item>();
+ public static final List<
+ Item> AMULETS = new ArrayList<
+ Item>();
+ public static final List<
+ Item> RINGS = new ArrayList<
+ Item>();
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/crate/RandomRandomLoot.java b/TF2 Crates/src/main/java/tf2crates/crate/RandomRandomLoot.java new file mode 100755 index 0000000..f8f184d --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/crate/RandomRandomLoot.java @@ -0,0 +1,158 @@ +package tf2crates.crate; + +import java.util.ArrayList; +import java.util.List; + +import tconstruct.library.crafting.ToolBuilder; +import tconstruct.library.crafting.ToolRecipe; +import tlhpoeCore.util.MathUtil; + +/** + * Get random instances of random loot :) + * + * @author ben + * + */ +public class RandomRandomLoot { + private static List<RandomLoot> loot; + + public static void init() { + loot = new ArrayList<RandomLoot>(); + + // Tool loot + addToolLoot(); + + // Weapon loot + addWeaponLoot(); + + // Armor loot + addArmorLoot(); + + // Potion loot + addPotionLoot(); + + // Plant loot + addPlantLoot(); + addPlantLoot(); + + // Dye loot + addDyeLoot(); + addDyeLoot(); + + // Decorative loot + addDecorativeLoot(); + addDecorativeLoot(); + + // Valuble loot + addValubleLoot(); + + // Bauble loot + addBaubleLoot(); + + // Misc Loot + addMiscLoot(); + addMiscLoot(); + + addTinkersLoot(); + } + + private static void addTinkersLoot() { + List<ToolRecipe> combos = ToolBuilder.instance.combos; + for (ToolRecipe toolRecipe : combos) { + boolean isLegendary; + + if (MathUtil.nextDouble() > .8) { + isLegendary = true; + } else { + isLegendary = false; + } + + loot.add(new RandomTinkersTool(isLegendary, toolRecipe)); + } + } + + private static void addToolLoot() { + loot.add(new RandomLoot.Pickaxe(false)); + loot.add(new RandomLoot.Pickaxe(true)); + loot.add(new RandomLoot.Shovel(false)); + loot.add(new RandomLoot.Shovel(true)); + loot.add(new RandomLoot.Axe(false)); + loot.add(new RandomLoot.Axe(true)); + loot.add(new RandomLoot.Hoe(false)); + loot.add(new RandomLoot.Hoe(true)); + + loot.add(new RandomLoot.ToolHead()); + } + + private static void addWeaponLoot() { + loot.add(new RandomLoot.Sword(false)); + loot.add(new RandomLoot.Sword(true)); + loot.add(new RandomLoot.Bow(false)); + loot.add(new RandomLoot.Bow(true)); + loot.add(new RandomLoot.Arrow()); + } + + private static void addArmorLoot() { + loot.add(new RandomLoot.Helmet(false)); + loot.add(new RandomLoot.Helmet(true)); + loot.add(new RandomLoot.Chestplate(false)); + loot.add(new RandomLoot.Chestplate(true)); + loot.add(new RandomLoot.Legging(false)); + loot.add(new RandomLoot.Legging(true)); + loot.add(new RandomLoot.Boot(false)); + loot.add(new RandomLoot.Boot(true)); + } + + private static void addPotionLoot() { + loot.add(new RandomLoot.Potion()); + loot.add(new RandomLoot.SplashPotion()); + } + + private static void addPlantLoot() { + loot.add(new RandomLoot.Food()); + loot.add(new RandomLoot.Seed()); + loot.add(new RandomLoot.Crop()); + loot.add(new RandomLoot.Saplings()); + loot.add(new RandomLoot.Logs()); + loot.add(new RandomLoot.Planks()); + } + + private static void addDyeLoot() { + loot.add(new RandomLoot.Paint()); + loot.add(new RandomLoot.Dye()); + } + + private static void addDecorativeLoot() { + loot.add(new RandomLoot.Slab()); + loot.add(new RandomLoot.Stair()); + loot.add(new RandomLoot.Fence()); + loot.add(new RandomLoot.Glass()); + loot.add(new RandomLoot.Stone()); + } + + private static void addValubleLoot() { + loot.add(new RandomLoot.Dust()); + loot.add(new RandomLoot.Block()); + loot.add(new RandomLoot.Crate()); + loot.add(new RandomLoot.Gem()); + loot.add(new RandomLoot.Ingot()); + loot.add(new RandomLoot.Ore()); + } + + private static void addBaubleLoot() { + loot.add(new RandomLoot.Amulet()); + loot.add(new RandomLoot.Belt()); + loot.add(new RandomLoot.Ring()); + } + + private static void addMiscLoot() { + loot.add(new RandomLoot.EnchantedBook()); + loot.add(new RandomLoot.FishingRod()); + loot.add(new RandomLoot.Record()); + } + + public static RandomLoot getRandomLoot() { + return loot + .get(MathUtil.getRandomIntegerBetween(0, loot.size() - 1)); + } +} diff --git a/TF2 Crates/src/main/java/tf2crates/crate/RandomTinkersTool.java b/TF2 Crates/src/main/java/tf2crates/crate/RandomTinkersTool.java new file mode 100755 index 0000000..c79ea86 --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/crate/RandomTinkersTool.java @@ -0,0 +1,143 @@ +package tf2crates.crate; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import tconstruct.library.TConstructRegistry; +import tconstruct.library.crafting.ModifyBuilder; +import tconstruct.library.crafting.ToolBuilder; +import tconstruct.library.crafting.ToolRecipe; +import tconstruct.library.modifier.ItemModifier; +import tconstruct.library.tools.ToolCore; +import tconstruct.library.tools.ToolMaterial; +import tconstruct.library.util.IToolPart; +import tlhpoeCore.util.MathUtil; + +public class RandomTinkersTool extends RandomLoot { + private boolean isLegendary; + + private ToolRecipe toolType; + + private ArrayList<Integer> materialIDs; + + public RandomTinkersTool(boolean isLegendary, ToolRecipe toolType) { + super(null, isLegendary); + + this.isLegendary = isLegendary; + this.toolType = toolType; + } + + @Override + public String getDisplayName() { + return "A Random " + (isLegendary ? " Legendary" : "") + + " Tinker's " + toolType.getType().getLocalizedToolName(); + } + + @Override + public ItemStack getLoot() { + if (materialIDs == null) { + prepareMaterials(); + } + + // determine type + ToolRecipe recipe = toolType; + ToolCore type = recipe.getType(); + + ItemStack tool = null; + int tries = 0; + // try to build the tool + do { + tries++; + // get components + ItemStack[] parts = new ItemStack[] { null, null, null, null }; + + Item[] items = new Item[4]; + items[0] = type.getHeadItem(); + items[1] = type.getHandleItem(); + items[2] = type.getAccessoryItem(); + items[3] = type.getExtraItem(); + + for (int i = 0; i < 4; i++) { + if (items[i] == null) { + continue; + } + + do { + // get a material + Integer matId = materialIDs + .get(MathUtil.nextInt(materialIDs.size())); + + parts[i] = new ItemStack(items[i], 1, matId); + } while (((IToolPart) items[i]) + .getMaterialID(parts[i]) == -1); + } + // build the tool + tool = ToolBuilder.instance.buildTool(parts[0], parts[1], + parts[2], parts[3], ""); + } while (tool == null && tries < 200); + + if (tool == null) { + ItemStack oops = new ItemStack(Items.stick); + + oops.setStackDisplayName("Crate Malfunction"); + + return oops; + } + + int modCount = MathUtil.nextInt(3); + + for (int i = modCount; i > 0; i--) { + doModifyWeapon(tool); + } + + if (isLegendary) { + EnchantmentHelper.addRandomEnchantment(MathUtil.getRandom(), + tool, MathUtil.getRandomIntegerBetween(25, 30)); + } + + return tool; + } + + private void doModifyWeapon(ItemStack tool) { + List<ItemModifier> modifiers = ModifyBuilder.instance.itemModifiers; + + ItemModifier mod = modifiers + .get(MathUtil.nextInt(modifiers.size())); + + ItemStack[] stacks = stackFromModifier(mod); + + if (!mod.matches(stacks, tool)) { + return; + } + + mod.addMatchingEffect(tool); + + mod.modify(stacks, tool); + } + + private static ItemStack[] stackFromModifier(ItemModifier modifier) { + ItemStack[] stack = new ItemStack[modifier.stacks.size()]; + int i = 0; + for (Object s : modifier.stacks) + stack[i++] = (ItemStack) s; + + return stack; + } + + private void prepareMaterials() { + materialIDs = new ArrayList<Integer>(); // converted to list for + // indexed access for + // random + + for (Map.Entry<Integer, + ToolMaterial> entry : TConstructRegistry.toolMaterials + .entrySet()) { + materialIDs.add(entry.getKey()); + } + } +} diff --git a/TF2 Crates/src/main/java/tf2crates/entity/EntityDamageSourceBackstab.java b/TF2 Crates/src/main/java/tf2crates/entity/EntityDamageSourceBackstab.java new file mode 100755 index 0000000..bfbc58d --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/entity/EntityDamageSourceBackstab.java @@ -0,0 +1,17 @@ +package tf2crates.entity;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.util.EntityDamageSource;
+
+public class EntityDamageSourceBackstab extends EntityDamageSource {
+ private EntityDamageSourceBackstab(Entity attacker) {
+ super("backstab", attacker);
+
+ this.setDamageBypassesArmor();
+ }
+
+ public static EntityDamageSourceBackstab
+ causeBackstabDamage(Entity attacker) {
+ return new EntityDamageSourceBackstab(attacker);
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/handler/AnvilHandler.java b/TF2 Crates/src/main/java/tf2crates/handler/AnvilHandler.java new file mode 100755 index 0000000..f846696 --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/handler/AnvilHandler.java @@ -0,0 +1,118 @@ +package tf2crates.handler;
+
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import net.minecraft.item.ItemArmor;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemTool;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.event.AnvilUpdateEvent;
+import tf2crates.ServerProxyTC;
+import tf2crates.crate.RandomLoot;
+import tf2crates.item.ItemUnusualEffect;
+
+public class AnvilHandler {
+ public static boolean repairHat, makeUnbreakable;
+
+ public static int strangeCost, unusualCost, descriptionCost;
+
+ @SubscribeEvent
+ public void anvilUpdate(AnvilUpdateEvent event) {
+ ItemStack left = event.left;
+ ItemStack right = event.right;
+
+ if (left != null && right != null) {
+ String leftN = left.getItem().getUnlocalizedName();
+
+ if (left.getItem() instanceof ItemTool
+ || leftN.contains("sword") || leftN.contains("Sword")
+ || leftN.contains("hoe") || leftN.contains("Hoe")) {
+ if (left.getItemDamage() > 0) {
+ if (right.stackSize == 1
+ && right.getItem() == ServerProxyTC.scrap) {
+ ItemStack res = left.copy();
+
+ double amt = 0.1111D;
+ int dmg = right.getItemDamage();
+
+ if (dmg == 1) {
+ amt = 0.3333D;
+ } else if (dmg == 2) {
+ amt = 1D;
+ }
+
+ res.setItemDamage((int) (res.getItemDamage()
+ - (res.getMaxDamage() * amt)));
+
+ event.output = res;
+ event.cost = 2;
+
+ return;
+ }
+ }
+ }
+
+ NBTTagCompound lNbt = left.getTagCompound();
+
+ if (lNbt == null) {
+ left.setTagCompound(lNbt = new NBTTagCompound());
+ }
+
+ if (RandomLoot.WEAPONS.contains(left.getItem())
+ && !lNbt.getBoolean("Golden")) {
+ if (right.getItem() == ServerProxyTC.paint
+ && right.getItemDamage() == 11) {
+ ItemStack res = left.copy();
+
+ res.getTagCompound().setBoolean("Golden", true);
+ res.setItemDamage(0);
+
+ res.setStackDisplayName(EnumChatFormatting.YELLOW
+ + "Strange Minecraftium "
+ + res.getDisplayName());
+
+ event.output = res;
+ event.cost = 1;
+ }
+ }
+
+ if (!lNbt.hasKey("UnusualEffect")) {
+ if (left.getItem() instanceof ItemArmor) {
+ ItemArmor armor = (ItemArmor) left.getItem();
+
+ if (armor.armorType == 0) {
+ if (right.getItem() instanceof ItemUnusualEffect) {
+ ItemStack result = left.copy();
+
+ result.getTagCompound().setInteger(
+ "UnusualEffect",
+ right.getItemDamage());
+
+ if (makeUnbreakable) {
+ result.getTagCompound()
+ .setBoolean("Unbreakable", true);
+ } else if (repairHat) {
+ result.setItemDamage(0);
+ }
+
+ event.output = result;
+ event.cost = unusualCost;
+ }
+
+ }
+ }
+ }
+
+ if (!lNbt.hasKey("Strange") && left.stackSize == 1) {
+ if (right.getItem() == ServerProxyTC.strangifier) {
+ ItemStack result = left.copy();
+
+ result.getTagCompound().setInteger("Strange", 0);
+
+ event.output = result;
+ event.cost = strangeCost;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/handler/AttackHandler.java b/TF2 Crates/src/main/java/tf2crates/handler/AttackHandler.java new file mode 100755 index 0000000..0d6e2ff --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/handler/AttackHandler.java @@ -0,0 +1,76 @@ +package tf2crates.handler;
+
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.event.entity.living.LivingHurtEvent;
+import tf2crates.ReferenceTC;
+import tf2crates.ServerProxyTC;
+import tlhpoeCore.network.MessagePlaySound;
+
+public class AttackHandler {
+ public static double marketGardenerMinimumFall;
+
+ @SubscribeEvent
+ public void attackHandler(LivingHurtEvent event) {
+ Entity attackerE = event.source.getEntity();
+
+ if (attackerE != null && attackerE instanceof EntityLivingBase) {
+ EntityLivingBase attacker = (EntityLivingBase) attackerE;
+ ItemStack heldItem = attacker.getHeldItem();
+
+ if (heldItem != null && heldItem.getItem() != null) {
+ Item item = heldItem.getItem();
+ boolean playSound = false;
+
+ if (item == ServerProxyTC.equalizer) {
+ float per =
+ attacker.getHealth() / attacker.getMaxHealth();
+
+ if (per <= 0.25F) {
+ event.ammount += 8;
+ } else if (per <= 0.5F) {
+ event.ammount += 4;
+ } else if (per <= 0.75F) {
+ event.ammount += 2;
+ }
+ } else if (item == ServerProxyTC.marketGardener) {
+ if (attacker.fallDistance >= marketGardenerMinimumFall) {
+ event.ammount += 15;
+
+ playSound = true;
+ }
+ } else if (item == ServerProxyTC.axtinguisher) {
+ if (event.entityLiving.isBurning()) {
+ event.ammount += 8;
+
+ playSound = true;
+ }
+ } else if (item == ServerProxyTC.sharpenedVolcanoFragment) {
+ event.entityLiving.setFire(10);
+ }
+
+ if (playSound && attacker instanceof EntityPlayerMP) {
+ new MessagePlaySound(
+ ReferenceTC.ID + ":tf2crates.crit")
+ .sendTo((EntityPlayerMP) attacker);
+ }
+ }
+ }
+
+ ItemStack heldItem = event.entityLiving.getHeldItem();
+
+ if (heldItem != null && heldItem.getItem() != null) {
+ Item item = heldItem.getItem();
+
+ if (item == ServerProxyTC.powerJack) {
+ event.ammount *= 1.5;
+ } else if (item == ServerProxyTC.conniversKunai) {
+ event.ammount *= 2;
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/handler/DeathHandler.java b/TF2 Crates/src/main/java/tf2crates/handler/DeathHandler.java new file mode 100755 index 0000000..b680e40 --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/handler/DeathHandler.java @@ -0,0 +1,88 @@ +package tf2crates.handler;
+
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.monster.EntityMob;
+import net.minecraft.entity.projectile.EntityArrow;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.event.entity.living.LivingDropsEvent;
+import tf2crates.ReferenceTC;
+import tf2crates.ServerProxyTC;
+import tf2crates.crate.Crates;
+import tlhpoeCore.util.MathUtil;
+
+public class DeathHandler {
+ public static int[] crateChance;
+ public static int[] keyChance;
+
+ @SubscribeEvent
+ public void mobDeath(LivingDropsEvent event) {
+ EntityLivingBase entity = event.entityLiving;
+
+ if (entity instanceof EntityMob) {
+ if (MathUtil.getChance(crateChance[0], crateChance[1])) {
+ String special = ReferenceTC.CURRENT_SPECIAL_CRATE;
+
+ if (special != null && MathUtil.getChance(1, 5)) {
+ event.drops.add(new EntityItem(entity.worldObj,
+ entity.posX, entity.posY + 1, entity.posZ,
+ new ItemStack(ServerProxyTC.crate, 1,
+ Crates.getSeriesFromName(special))));
+ } else {
+ event.drops.add(new EntityItem(entity.worldObj,
+ entity.posX, entity.posY + 1, entity.posZ,
+ new ItemStack(ServerProxyTC.crate, 1, MathUtil
+ .nextInt(Crates.getNumberOfSeries()
+ - Crates.getNumberOfSpecialCrates()))));
+ }
+ }
+
+ if (MathUtil.getChance(keyChance[0], keyChance[1])) {
+ event.drops.add(new EntityItem(entity.worldObj,
+ entity.posX, entity.posY + 1, entity.posZ,
+ new ItemStack(ServerProxyTC.key, 1)));
+ }
+
+ Entity attacker = event.source.getSourceOfDamage();
+
+ if (attacker != null) {
+ EntityLivingBase attackerL = null;
+
+ if (attacker instanceof EntityLivingBase) {
+ attackerL = (EntityLivingBase) attacker;
+ } else if (attacker instanceof EntityArrow) {
+ EntityArrow arrow = (EntityArrow) attacker;
+
+ if (arrow.shootingEntity != null
+ && arrow.shootingEntity instanceof EntityLivingBase) {
+ attackerL =
+ (EntityLivingBase) arrow.shootingEntity;
+ }
+ }
+
+ if (attackerL != null) {
+ ItemStack held = attackerL.getHeldItem();
+
+ if (held != null) {
+ NBTTagCompound nbt = held.getTagCompound();
+
+ if (nbt != null && (nbt.hasKey("Strange")
+ || nbt.hasKey("Golden"))) {
+ nbt.setInteger("Strange",
+ nbt.getInteger("Strange") + 1);
+ }
+
+ if (held.getItem() != null && held
+ .getItem() == ServerProxyTC.powerJack) {
+ attackerL.heal(
+ attackerL.getMaxHealth() * 0.25F);
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/handler/EventHandler.java b/TF2 Crates/src/main/java/tf2crates/handler/EventHandler.java new file mode 100755 index 0000000..212c13f --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/handler/EventHandler.java @@ -0,0 +1,284 @@ +package tf2crates.handler;
+
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import cpw.mods.fml.common.gameevent.TickEvent;
+import cpw.mods.fml.common.gameevent.TickEvent.Phase;
+import net.minecraft.client.Minecraft;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import tlhpoeCore.util.MCUtil;
+import tlhpoeCore.util.MathUtil;
+
+public class EventHandler {
+ @SubscribeEvent
+ public void playerTick(TickEvent.PlayerTickEvent event) {
+ EntityPlayer player = event.player;
+
+ if (event.phase == Phase.START) {
+ Minecraft mc = MCUtil.getMC();
+ if (player != mc.thePlayer || (player == mc.thePlayer
+ && mc.gameSettings.thirdPersonView != 0)) {
+ ItemStack helmet = player.getEquipmentInSlot(4);
+
+ if (helmet != null) {
+ NBTTagCompound nbt = helmet.getTagCompound();
+ if (nbt != null && nbt.hasKey("UnusualEffect")) {
+ int unusualEffect =
+ nbt.getInteger("UnusualEffect");
+
+ switch (unusualEffect) {
+ case (0):
+ if (MathUtil.getChance(1, 5)) {
+ player.worldObj.spawnParticle("flame",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(16), rDouble(16),
+ rDouble(16));
+ }
+
+ break;
+
+ case (1):
+ if (MathUtil.getChance(1, 5)) {
+ player.worldObj.spawnParticle(
+ "explode",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(8), rDouble(16),
+ rDouble(8));
+ }
+
+ break;
+
+ case (2):
+ if (MathUtil.getChance(1, 5)) {
+ player.worldObj.spawnParticle(
+ "fireworksSpark",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(8), rDouble(16),
+ rDouble(8));
+ }
+
+ break;
+ case (3):
+
+ if (MathUtil.getChance(1, 2)) {
+ player.worldObj.spawnParticle(
+ "depthsuspend",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(8), rDouble(16),
+ rDouble(8));
+ player.worldObj.spawnParticle(
+ "depthsuspend",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(8), rDouble(16),
+ rDouble(8));
+ }
+
+ break;
+
+ case (4):
+ if (MathUtil.getChance(1, 4)) {
+ player.worldObj.spawnParticle("crit",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(8), rDouble(16),
+ rDouble(8));
+ player.worldObj.spawnParticle("crit",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(8), rDouble(16),
+ rDouble(8));
+ }
+
+ break;
+
+ case (5):
+ if (MathUtil.getChance(1, 4)) {
+ player.worldObj.spawnParticle(
+ "magicCrit",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(8), rDouble(16),
+ rDouble(8));
+ player.worldObj.spawnParticle(
+ "magicCrit",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(8), rDouble(16),
+ rDouble(8));
+ }
+
+ break;
+
+ case (6):
+ if (MathUtil.getChance(1, 5)) {
+ player.worldObj.spawnParticle("note",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(8), rDouble(16),
+ rDouble(8));
+ }
+
+ break;
+
+ case (7):
+ if (MathUtil.getChance(1, 2)) {
+ player.worldObj.spawnParticle("portal",
+ player.posX + rDouble(4),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(4),
+ rDouble(16), rDouble(16),
+ rDouble(16));
+ player.worldObj.spawnParticle("portal",
+ player.posX + rDouble(4),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(4),
+ rDouble(16), rDouble(16),
+ rDouble(16));
+ }
+
+ break;
+
+ case (8):
+ if (MathUtil.getChance(1, 5)) {
+ player.worldObj.spawnParticle(
+ "enchantmenttable",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(2), rDouble(2),
+ rDouble(2));
+ player.worldObj.spawnParticle(
+ "enchantmenttable",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(2), rDouble(2),
+ rDouble(2));
+ }
+
+ break;
+
+ case (9):
+ if (MathUtil.getChance(1, 5)) {
+ player.worldObj.spawnParticle("lava",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(8), 0, rDouble(8));
+ }
+
+ break;
+
+ case (10):
+ if (MathUtil.getChance(1, 5)) {
+ player.worldObj.spawnParticle(
+ "largesmoke",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(8), rDouble(16),
+ rDouble(8));
+ player.worldObj.spawnParticle(
+ "reddust",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(8), rDouble(16),
+ rDouble(8));
+ }
+
+ break;
+
+ case (11):
+ if (MathUtil.getChance(1, 5)) {
+ player.worldObj.spawnParticle("slime",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(8), rDouble(16),
+ rDouble(8));
+ player.worldObj.spawnParticle("slime",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(8), rDouble(16),
+ rDouble(8));
+ }
+
+ break;
+
+ case (12):
+ if (MathUtil.getChance(1, 5)) {
+ player.worldObj.spawnParticle("heart",
+ player.posX + rDouble(1.25),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1.25),
+ rDouble(8), rDouble(16),
+ rDouble(8));
+ }
+
+ break;
+
+ case (13):
+ if (MathUtil.getChance(1, 5)) {
+ player.worldObj.spawnParticle(
+ MathUtil.getChance(1, 10)
+ ? "angryVillager"
+ : "happyVillager",
+ player.posX + rDouble(1),
+ player.posY + 0.5D
+ + rDouble(4),
+ player.posZ + rDouble(1),
+ rDouble(2), rDouble(16),
+ rDouble(2));
+ }
+
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private static double rDouble(double randomness) {
+ return (MathUtil.nextDouble() / randomness)
+ - (MathUtil.nextDouble() / randomness);
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/handler/TickHandler.java b/TF2 Crates/src/main/java/tf2crates/handler/TickHandler.java new file mode 100755 index 0000000..08af067 --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/handler/TickHandler.java @@ -0,0 +1,40 @@ +package tf2crates.handler;
+
+import java.util.Calendar;
+
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import cpw.mods.fml.common.gameevent.TickEvent;
+import tf2crates.ReferenceTC;
+
+public class TickHandler {
+ private short counter = 0;
+
+ @SubscribeEvent
+ public void playerTick(TickEvent.WorldTickEvent event) {
+ if (event.phase == TickEvent.Phase.START) {
+ if (counter >= 36000) {
+ counter = 0;
+
+ Calendar date = Calendar.getInstance();
+
+ int month = date.get(Calendar.MONTH);
+ int day = date.getMaximum(Calendar.DAY_OF_MONTH);
+
+ if ((month == Calendar.OCTOBER && day >= 29)
+ || (month == Calendar.NOVEMBER && day < 12)) {
+ ReferenceTC.CURRENT_SPECIAL_CRATE = "spookyCrate";
+ } else if (month == Calendar.DECEMBER
+ && (day >= 20 && day <= 31)) {
+ ReferenceTC.CURRENT_SPECIAL_CRATE = "festiveCrate";
+ } else if (month == Calendar.AUGUST
+ && (day >= 24 && day <= 31)) {
+ ReferenceTC.CURRENT_SPECIAL_CRATE = "birthdayCrate";
+ } else {
+ ReferenceTC.CURRENT_SPECIAL_CRATE = null;
+ }
+ } else {
+ counter++;
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/handler/TooltipHandler.java b/TF2 Crates/src/main/java/tf2crates/handler/TooltipHandler.java new file mode 100755 index 0000000..630463a --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/handler/TooltipHandler.java @@ -0,0 +1,40 @@ +package tf2crates.handler;
+
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+import net.minecraftforge.event.entity.player.ItemTooltipEvent;
+import tf2crates.item.ItemUnusualEffect;
+
+public class TooltipHandler {
+ @SubscribeEvent
+ public void toolTip(ItemTooltipEvent event) {
+ if (event.itemStack != null) {
+ NBTTagCompound nbt = event.itemStack.getTagCompound();
+
+ if (nbt != null) {
+ if (nbt.hasKey("UnusualEffect")) {
+ event.toolTip.add("Unusual Effect: "
+ + EnumChatFormatting.LIGHT_PURPLE
+ + StatCollector
+ .translateToLocal("unusualEffect."
+ + ItemUnusualEffect.TYPES[nbt
+ .getInteger(
+ "UnusualEffect")]
+ + ".name"));
+ }
+
+ if (nbt.hasKey("Strange") || nbt.hasKey("Golden")) {
+ event.toolTip.add("# of Mobs Killed: "
+ + EnumChatFormatting.YELLOW
+ + nbt.getInteger("Strange"));
+ }
+
+ if (nbt.hasKey("Description")) {
+ event.toolTip.add(nbt.getString("Description"));
+ }
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/item/ItemCrate.java b/TF2 Crates/src/main/java/tf2crates/item/ItemCrate.java new file mode 100755 index 0000000..90be581 --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/item/ItemCrate.java @@ -0,0 +1,196 @@ +package tf2crates.item;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+import tf2crates.ReferenceTC;
+import tf2crates.ServerProxyTC;
+import tf2crates.crate.Crates;
+import tf2crates.crate.RandomLoot;
+import tlhpoeCore.network.MessagePlaySound;
+import tlhpoeCore.util.MathUtil;
+
+public class ItemCrate extends Item {
+ public static IIcon[] sCrateTextures;
+ public static int[] unusualChance;
+ public static int[] weaponChance;
+
+ public ItemCrate() {
+ super();
+
+ this.setUnlocalizedName("crate");
+ this.setTextureName(ReferenceTC.ID + ":crate");
+ this.setMaxStackSize(1);
+
+ this.hasSubtypes = true;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register) {
+ super.registerIcons(register);
+
+ sCrateTextures = new IIcon[Crates.getNumberOfSeries() + 1];
+
+ for (int i = 0; i < sCrateTextures.length; i++) {
+ if (Crates.isSeriesSpecial(i)) {
+ sCrateTextures[i] = register.registerIcon(ReferenceTC.ID
+ + ":" + Crates.getNameFromSeries(i));
+ }
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconIndex(ItemStack itemStack) {
+ int series = 1 + itemStack.getItemDamage();
+
+ if (Crates.isSeriesSpecial(series)) {
+ return sCrateTextures[series];
+ }
+
+ return super.getIconIndex(itemStack);
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack itemStack, int pass) {
+ int series = 1 + itemStack.getItemDamage();
+
+ if (Crates.isSeriesSpecial(series)) {
+ return sCrateTextures[series];
+ }
+
+ return super.getIcon(itemStack, pass);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item item, CreativeTabs tabs, List list) {
+ for (int i = 0; i < Crates.getNumberOfSeries(); i++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack itemStack, EntityPlayer player,
+ List info, boolean f) {
+ int series = itemStack.getItemDamage() + 1;
+
+ info.add(Crates.isSeriesSpecial(series)
+ ? (EnumChatFormatting.GREEN
+ + (StatCollector.translateToLocal(
+ "crate." + Crates.getNameFromSeries(series)
+ + ".name")))
+ : EnumChatFormatting.YELLOW + "Crate Series #" + series);
+
+ Object[] lootItems = Crates.getLootForCrate(series);
+
+ for (int i = 0; i < lootItems.length; i++) {
+ Object loot = lootItems[i];
+ String name = null;
+
+ if (loot instanceof ItemStack) {
+ name = ((ItemStack) loot).getDisplayName();
+ } else if (loot instanceof RandomLoot) {
+ name = ((RandomLoot) loot).getDisplayName();
+ }
+
+ info.add(EnumChatFormatting.GRAY + name);
+ }
+
+ info.add(EnumChatFormatting.AQUA
+ + "or an Exceedingly Rare Special Item!");
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack itemStack, World world,
+ EntityPlayer player) {
+ if (!world.isRemote) {
+ if (player.capabilities.isCreativeMode || player.inventory
+ .consumeInventoryItem(ServerProxyTC.key)) {
+ int series = itemStack.getItemDamage() + 1;
+ Object[] lootItems = Crates.getLootForCrate(series);
+
+ ItemStack stackLoot = null;
+
+ if (MathUtil.getChance(unusualChance[0],
+ unusualChance[1])) {
+ stackLoot = new ItemStack(ServerProxyTC.unusualEffect,
+ 1, MathUtil.nextInt(
+ ItemUnusualEffect.TYPES.length));
+ } else if (MathUtil.getChance(weaponChance[0],
+ weaponChance[1])) {
+ stackLoot = new ItemStack(
+ RandomLoot.WEAPONS.get(MathUtil
+ .nextInt(RandomLoot.WEAPONS.size())),
+ 1);
+ } else {
+ Object loot =
+ lootItems[MathUtil.nextInt(lootItems.length)];
+
+ if (loot instanceof ItemStack) {
+ stackLoot = (ItemStack) loot;
+ } else if (loot instanceof RandomLoot) {
+ stackLoot = ((RandomLoot) loot).getLoot();
+ }
+ }
+
+ boolean full = true;
+
+ for (int i = 0; i < player.inventory.getSizeInventory();
+ i++) {
+ if (player.inventory.getStackInSlot(i) == null) {
+ full = false;
+ }
+ }
+
+ if (!full) {
+ player.inventory
+ .addItemStackToInventory(stackLoot.copy());
+ } else {
+ player.entityDropItem(stackLoot.copy(), 1F);
+ }
+
+ MinecraftServer.getServer().getConfigurationManager()
+ .sendChatMsg(new ChatComponentText(player
+ .getDisplayName()
+ + " just uncrated "
+ + (stackLoot.stackSize > 1
+ ? (EnumChatFormatting.AQUA + ""
+ + stackLoot.stackSize
+ + " ")
+ : "a ")
+ + EnumChatFormatting.YELLOW
+ + stackLoot.getDisplayName()
+ + (stackLoot.stackSize > 1 ? "s" : "")
+ + EnumChatFormatting.WHITE + "!!!"));
+
+ new MessagePlaySound(ReferenceTC.ID + ":tf2crates.uncrate")
+ .sendTo((EntityPlayerMP) player);
+
+ itemStack.stackSize--;
+ } else {
+ player.addChatMessage(new ChatComponentText("You need a "
+ + EnumChatFormatting.YELLOW
+ + "Steve Co. Supply Crate Key"
+ + EnumChatFormatting.WHITE + " to open this!"));
+ }
+ }
+
+ return itemStack;
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/item/ItemKey.java b/TF2 Crates/src/main/java/tf2crates/item/ItemKey.java new file mode 100755 index 0000000..242f1a2 --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/item/ItemKey.java @@ -0,0 +1,35 @@ +package tf2crates.item;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import tf2crates.ReferenceTC;
+
+public class ItemKey extends Item {
+ public ItemKey() {
+ super();
+
+ this.setUnlocalizedName("key");
+ this.setTextureName(ReferenceTC.ID + ":key");
+ this.setMaxStackSize(1);
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack itemStack) {
+ return EnumRarity.rare;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack itemStack, EntityPlayer player,
+ List info, boolean f) {
+ info.add(EnumChatFormatting.YELLOW
+ + "Used to open locked supply crates.");
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/item/ItemKnife.java b/TF2 Crates/src/main/java/tf2crates/item/ItemKnife.java new file mode 100755 index 0000000..46412ee --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/item/ItemKnife.java @@ -0,0 +1,106 @@ +package tf2crates.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemSword;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.IIcon;
+import tf2crates.ReferenceTC;
+import tf2crates.ServerProxyTC;
+import tf2crates.crate.RandomLoot;
+import tf2crates.entity.EntityDamageSourceBackstab;
+import tlhpoeCore.network.MessagePlaySound;
+import tlhpoeCore.util.MiscUtil;
+
+public class ItemKnife extends ItemSword {
+ public static double backstabDifficulty = 0.75D;
+
+ public IIcon goldTexture;
+
+ public ItemKnife(String name) {
+ super(ServerProxyTC.MOD_WEAPON);
+
+ this.setUnlocalizedName(name);
+ this.setTextureName(ReferenceTC.ID + ":weapon/" + name);
+
+ RandomLoot.WEAPONS.add(this);
+ }
+
+ public ItemKnife(String name, float dmg) {
+ this(name);
+
+ MiscUtil.replaceField("field_150934_a", ItemSword.class, dmg,
+ this);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register) {
+ super.registerIcons(register);
+
+ this.goldTexture =
+ register.registerIcon(ReferenceTC.ID + ":weapon/gold/"
+ + this.getUnlocalizedName().substring(5));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconIndex(ItemStack itemStack) {
+ NBTTagCompound nbt = itemStack.getTagCompound();
+
+ if (nbt != null && nbt.getBoolean("Golden")) {
+ return this.goldTexture;
+ }
+
+ return super.getIconIndex(itemStack);
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack itemStack, int pass) {
+ NBTTagCompound nbt = itemStack.getTagCompound();
+
+ if (nbt != null && nbt.getBoolean("Golden")) {
+ return this.goldTexture;
+ }
+
+ return super.getIcon(itemStack, pass);
+ }
+
+ @Override
+ public boolean hitEntity(ItemStack itemStack, EntityLivingBase prey,
+ EntityLivingBase attacker) {
+ itemStack.damageItem(1, attacker);
+
+ float pYaw = prey.rotationYawHead % 360F;
+
+ pYaw = pYaw < 0 ? 360 + pYaw : prey.rotationYawHead;
+
+ float aYaw = attacker.rotationYawHead < 0
+ ? 360 + attacker.rotationYawHead
+ : attacker.rotationYawHead;
+
+ float newRot = pYaw - aYaw;
+
+ if (newRot < (90 * backstabDifficulty)
+ && newRot > (-90 * backstabDifficulty)) {
+ if (!attacker.worldObj.isRemote) {
+ new MessagePlaySound(ReferenceTC.ID + ":tf2crates.crit")
+ .sendTo((EntityPlayerMP) attacker);
+ }
+
+ if (itemStack.getItem() == ServerProxyTC.conniversKunai) {
+ attacker.heal(prey.getMaxHealth());
+ }
+
+ prey.attackEntityFrom(EntityDamageSourceBackstab
+ .causeBackstabDamage(attacker),
+ prey.getMaxHealth() * 600);
+ }
+
+ return false;
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/item/ItemModAxe.java b/TF2 Crates/src/main/java/tf2crates/item/ItemModAxe.java new file mode 100755 index 0000000..78dea2c --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/item/ItemModAxe.java @@ -0,0 +1,88 @@ +package tf2crates.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.item.ItemAxe;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemTool;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+import tf2crates.ReferenceTC;
+import tf2crates.ServerProxyTC;
+import tf2crates.crate.RandomLoot;
+import tlhpoeCore.util.MiscUtil;
+
+public class ItemModAxe extends ItemAxe {
+ public IIcon goldTexture;
+
+ public ItemModAxe(String name) {
+ super(ServerProxyTC.MOD_WEAPON);
+
+ this.setUnlocalizedName(name);
+ this.setTextureName(ReferenceTC.ID + ":weapon/" + name);
+
+ RandomLoot.WEAPONS.add(this);
+ }
+
+ public ItemModAxe(String name, float dmg) {
+ this(name);
+
+ MiscUtil.replaceField("damageVsEntity", ItemTool.class, dmg, this);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register) {
+ super.registerIcons(register);
+
+ this.goldTexture =
+ register.registerIcon(ReferenceTC.ID + ":weapon/gold/"
+ + this.getUnlocalizedName().substring(5));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconIndex(ItemStack itemStack) {
+ NBTTagCompound nbt = itemStack.getTagCompound();
+
+ if (nbt != null && nbt.getBoolean("Golden")) {
+ return this.goldTexture;
+ }
+
+ return super.getIconIndex(itemStack);
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack itemStack, int pass) {
+ NBTTagCompound nbt = itemStack.getTagCompound();
+
+ if (nbt != null && nbt.getBoolean("Golden")) {
+ return this.goldTexture;
+ }
+
+ return super.getIcon(itemStack, pass);
+ }
+
+ @Override
+ public void onUpdate(ItemStack itemStack, World world, Entity entity,
+ int f, boolean f2) {
+ if (this == ServerProxyTC.powerJack) {
+ if (entity instanceof EntityLivingBase) {
+ EntityLivingBase living = (EntityLivingBase) entity;
+ ItemStack heldItem = living.getHeldItem();
+
+ if (heldItem != null && heldItem.getItem() != null
+ && heldItem.getItem() == ServerProxyTC.powerJack) {
+ living.addPotionEffect(new PotionEffect(
+ Potion.moveSpeed.id, 2, 0, true));
+ }
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/item/ItemModPickaxe.java b/TF2 Crates/src/main/java/tf2crates/item/ItemModPickaxe.java new file mode 100755 index 0000000..ddcd915 --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/item/ItemModPickaxe.java @@ -0,0 +1,100 @@ +package tf2crates.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.item.ItemPickaxe;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+import tf2crates.ReferenceTC;
+import tf2crates.ServerProxyTC;
+import tf2crates.crate.RandomLoot;
+
+public class ItemModPickaxe extends ItemPickaxe {
+ public IIcon goldTexture;
+
+ public ItemModPickaxe(String name) {
+ super(ServerProxyTC.MOD_WEAPON);
+
+ this.setUnlocalizedName(name);
+ this.setTextureName(ReferenceTC.ID + ":weapon/" + name);
+
+ RandomLoot.WEAPONS.add(this);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register) {
+ super.registerIcons(register);
+
+ this.goldTexture =
+ register.registerIcon(ReferenceTC.ID + ":weapon/gold/"
+ + this.getUnlocalizedName().substring(5));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconIndex(ItemStack itemStack) {
+ NBTTagCompound nbt = itemStack.getTagCompound();
+
+ if (nbt != null && nbt.getBoolean("Golden")) {
+ return this.goldTexture;
+ }
+
+ return super.getIconIndex(itemStack);
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack itemStack, int pass) {
+ NBTTagCompound nbt = itemStack.getTagCompound();
+
+ if (nbt != null && nbt.getBoolean("Golden")) {
+ return this.goldTexture;
+ }
+
+ return super.getIcon(itemStack, pass);
+ }
+
+ @Override
+ public void onUpdate(ItemStack itemStack, World world, Entity entity,
+ int f, boolean f2) {
+ if (this == ServerProxyTC.escapePlan) {
+ if (entity instanceof EntityLivingBase) {
+ EntityLivingBase living = (EntityLivingBase) entity;
+ ItemStack heldItem = living.getHeldItem();
+
+ if (heldItem != null && heldItem.getItem() != null
+ && heldItem
+ .getItem() == ServerProxyTC.escapePlan) {
+ float per = living.getHealth() / living.getMaxHealth();
+ int amplifier = -1;
+
+ if (per <= 0.25F) {
+ amplifier = 2;
+ } else if (per <= 0.5F) {
+ amplifier = 1;
+ } else if (per <= 0.75F) {
+ amplifier = 0;
+ }
+
+ if (amplifier != -1) {
+ living.addPotionEffect(new PotionEffect(
+ Potion.moveSpeed.id, 2, amplifier, true));
+ }
+
+ if (amplifier > 0) {
+ living.addPotionEffect(
+ new PotionEffect(Potion.digSpeed.id, 2,
+ amplifier - 1, true));
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/item/ItemModShovel.java b/TF2 Crates/src/main/java/tf2crates/item/ItemModShovel.java new file mode 100755 index 0000000..e43b713 --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/item/ItemModShovel.java @@ -0,0 +1,66 @@ +package tf2crates.item;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.ItemSpade;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemTool;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.IIcon;
+import tf2crates.ReferenceTC;
+import tf2crates.ServerProxyTC;
+import tf2crates.crate.RandomLoot;
+import tlhpoeCore.util.MiscUtil;
+
+public class ItemModShovel extends ItemSpade {
+ public IIcon goldTexture;
+
+ public ItemModShovel(String name) {
+ super(ServerProxyTC.MOD_WEAPON);
+
+ this.setUnlocalizedName(name);
+ this.setTextureName(ReferenceTC.ID + ":weapon/" + name);
+
+ RandomLoot.WEAPONS.add(this);
+ }
+
+ public ItemModShovel(String name, float dmg) {
+ this(name);
+
+ MiscUtil.replaceField("damageVsEntity", ItemTool.class, dmg, this);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register) {
+ super.registerIcons(register);
+
+ this.goldTexture =
+ register.registerIcon(ReferenceTC.ID + ":weapon/gold/"
+ + this.getUnlocalizedName().substring(5));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconIndex(ItemStack itemStack) {
+ NBTTagCompound nbt = itemStack.getTagCompound();
+
+ if (nbt != null && nbt.getBoolean("Golden")) {
+ return this.goldTexture;
+ }
+
+ return super.getIconIndex(itemStack);
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack itemStack, int pass) {
+ NBTTagCompound nbt = itemStack.getTagCompound();
+
+ if (nbt != null && nbt.getBoolean("Golden")) {
+ return this.goldTexture;
+ }
+
+ return super.getIcon(itemStack, pass);
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/item/ItemNoiseMaker.java b/TF2 Crates/src/main/java/tf2crates/item/ItemNoiseMaker.java new file mode 100755 index 0000000..807e9ab --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/item/ItemNoiseMaker.java @@ -0,0 +1,50 @@ +package tf2crates.item;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumAction;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import tf2crates.ReferenceTC;
+import tlhpoeCore.util.MathUtil;
+
+public class ItemNoiseMaker extends Item {
+ public String[] noises;
+
+ public ItemNoiseMaker(String name, String... noises) {
+ super();
+
+ this.setUnlocalizedName(name);
+ this.setTextureName(ReferenceTC.ID + ":" + name);
+ this.setMaxStackSize(1);
+
+ this.noises = noises;
+ }
+
+ @Override
+ public void onPlayerStoppedUsing(ItemStack itemStack, World world,
+ EntityPlayer player, int time) {
+ if (this.getMaxItemUseDuration(itemStack) - time > 10) {
+ player.playSound(noises[MathUtil.nextInt(noises.length)],
+ 0.25F + ((float) (MathUtil.nextDouble() / 8)), 1F);
+ }
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack itemStack, World world,
+ EntityPlayer player) {
+ player.setItemInUse(itemStack,
+ this.getMaxItemUseDuration(itemStack));
+ return itemStack;
+ }
+
+ @Override
+ public int getMaxItemUseDuration(ItemStack itemStack) {
+ return Integer.MAX_VALUE;
+ }
+
+ @Override
+ public EnumAction getItemUseAction(ItemStack itemStack) {
+ return EnumAction.block;
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/item/ItemPaint.java b/TF2 Crates/src/main/java/tf2crates/item/ItemPaint.java new file mode 100755 index 0000000..f1d4f51 --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/item/ItemPaint.java @@ -0,0 +1,124 @@ +package tf2crates.item;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+import tf2crates.ReferenceTC;
+
+public class ItemPaint extends Item { // make paint able to change the
+ // color of wool blocks
+ public static final String[] TYPES = { "black", "red", "green",
+ "brown", "blue", "purple", "cyan", "silver", "gray", "pink",
+ "lime", "yellow", "lightBlue", "magenta", "orange", "white" };
+ public IIcon[] textures;
+
+ public ItemPaint() {
+ super();
+
+ this.setUnlocalizedName("paint");
+ this.setMaxStackSize(1);
+
+ this.hasSubtypes = true;
+
+ this.setContainerItem(this);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister iconRegister) {
+ textures = new IIcon[TYPES.length];
+
+ for (int i = 0; i < TYPES.length; i++) {
+ textures[i] = iconRegister
+ .registerIcon(ReferenceTC.ID + ":paint/" + TYPES[i]);
+ }
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack itemStack) {
+ return StatCollector.translateToLocal(
+ "paint." + TYPES[itemStack.getItemDamage()] + ".name");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item item, CreativeTabs tabs, List list) {
+ for (int i = 0; i < TYPES.length; i++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack itemStack) {
+ return EnumRarity.rare;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int dmg) {
+ return textures[dmg];
+ }
+
+ @Override
+ public boolean
+ doesContainerItemLeaveCraftingGrid(ItemStack itemStack) {
+ return false;
+ }
+
+ @Override
+ public boolean hasContainerItem(ItemStack stack) {
+ return true;
+ }
+
+ @Override
+ public ItemStack getContainerItem(ItemStack itemStack) {
+ return itemStack;
+ }
+
+ @Override
+ public boolean onItemUse(ItemStack itemStack, EntityPlayer player,
+ World world, int x, int y, int z, int meta, float p_77648_8_,
+ float p_77648_9_, float p_77648_10_) {
+ Block block = world.getBlock(x, y, z);
+
+ if (block == Blocks.wool || block == Blocks.carpet
+ || block == Blocks.glass || block == Blocks.stained_glass
+ || block == Blocks.glass_pane
+ || block == Blocks.stained_glass_pane
+ || block == Blocks.hardened_clay
+ || block == Blocks.stained_hardened_clay) {
+ if (!world.isRemote) {
+ if (block == Blocks.glass) {
+ block = Blocks.stained_glass;
+ }
+
+ if (block == Blocks.glass_pane) {
+ block = Blocks.stained_glass_pane;
+ }
+
+ if (block == Blocks.hardened_clay) {
+ block = Blocks.stained_hardened_clay;
+ }
+
+ world.setBlock(x, y, z, block,
+ 15 - itemStack.getItemDamage(), 2);
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/item/ItemSandvich.java b/TF2 Crates/src/main/java/tf2crates/item/ItemSandvich.java new file mode 100755 index 0000000..0a58246 --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/item/ItemSandvich.java @@ -0,0 +1,78 @@ +package tf2crates.item;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemFood;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.world.World;
+import tf2crates.ReferenceTC;
+import tf2crates.crate.RandomLoot;
+
+public class ItemSandvich extends ItemFood {
+ public ItemSandvich() {
+ super(20, 0.32F, true);
+
+ this.setUnlocalizedName("sandvich");
+ this.setTextureName(ReferenceTC.ID + ":sandvich");
+ this.setMaxStackSize(1);
+ this.setMaxDamage(6001);
+ this.setAlwaysEdible();
+
+ RandomLoot.WEAPONS.add(this);
+ }
+
+ @Override
+ protected void onFoodEaten(ItemStack itemStack, World world,
+ EntityPlayer player) {
+ if (!world.isRemote) {
+ player.addPotionEffect(
+ new PotionEffect(Potion.regeneration.id, 600, 2));
+ player.addPotionEffect(
+ new PotionEffect(Potion.digSpeed.id, 600, 2));
+ player.addPotionEffect(
+ new PotionEffect(Potion.moveSpeed.id, 600, 1));
+
+ player.heal(player.getMaxHealth());
+
+ itemStack.setItemDamage(6000);
+ }
+ }
+
+ @Override
+ public ItemStack onEaten(ItemStack itemStack, World world,
+ EntityPlayer player) {
+ player.getFoodStats().func_151686_a(this, itemStack);
+
+ world.playSoundAtEntity(player, "random.burp", 0.5F,
+ world.rand.nextFloat() * 0.1F + 0.9F);
+
+ this.onFoodEaten(itemStack, world, player);
+
+ return itemStack;
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack itemStack, World world,
+ EntityPlayer player) {
+ if (itemStack.getItemDamage() == 0) {
+ player.setItemInUse(itemStack,
+ this.getMaxItemUseDuration(itemStack));
+ }
+
+ return itemStack;
+ }
+
+ @Override
+ public void onUpdate(ItemStack itemStack, World world, Entity entity,
+ int f, boolean f2) {
+ if (!world.isRemote) {
+ int dmg = itemStack.getItemDamage();
+
+ if (dmg > 0) {
+ itemStack.setItemDamage(dmg - 1);
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/item/ItemScrap.java b/TF2 Crates/src/main/java/tf2crates/item/ItemScrap.java new file mode 100755 index 0000000..900851d --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/item/ItemScrap.java @@ -0,0 +1,66 @@ +package tf2crates.item;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.StatCollector;
+import tf2crates.ReferenceTC;
+
+public class ItemScrap extends Item {
+ public static final String[] TYPES =
+ { "scrap", "reclaimed", "refined" };
+ public static final EnumRarity[] RARITIES =
+ { EnumRarity.uncommon, EnumRarity.rare, EnumRarity.epic };
+ public IIcon[] textures;
+
+ public ItemScrap() {
+ super();
+
+ this.setUnlocalizedName("scrap");
+
+ this.hasSubtypes = true;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister iconRegister) {
+ textures = new IIcon[TYPES.length];
+
+ for (int i = 0; i < TYPES.length; i++) {
+ textures[i] = iconRegister
+ .registerIcon(ReferenceTC.ID + ":" + TYPES[i]);
+ }
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack itemStack) {
+ return StatCollector.translateToLocal(
+ "item." + TYPES[itemStack.getItemDamage()] + ".name");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item item, CreativeTabs tabs, List list) {
+ for (int i = 0; i < TYPES.length; i++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int dmg) {
+ return textures[dmg];
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack itemStack) {
+ return RARITIES[itemStack.getItemDamage()];
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tf2crates/item/ItemUnusualEffect.java b/TF2 Crates/src/main/java/tf2crates/item/ItemUnusualEffect.java new file mode 100755 index 0000000..03ac2b0 --- /dev/null +++ b/TF2 Crates/src/main/java/tf2crates/item/ItemUnusualEffect.java @@ -0,0 +1,61 @@ +package tf2crates.item;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+import tf2crates.ReferenceTC;
+
+public class ItemUnusualEffect extends Item {
+ public static final String[] TYPES = { "burningFlames", "poof",
+ "whiteSparkles", "flies", "critical", "magicalCrit", "musical",
+ "end", "enchanted", "volcano", "smoking", "slime", "loving",
+ "villager" };
+
+ public ItemUnusualEffect() {
+ super();
+
+ this.setUnlocalizedName("unusualEffect");
+ this.setTextureName(ReferenceTC.ID + ":unusualEffect");
+ this.setMaxStackSize(1);
+ this.setFull3D();
+
+ this.hasSubtypes = true;
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack itemStack) {
+ return StatCollector
+ .translateToLocal("unusualEffect."
+ + TYPES[itemStack.getItemDamage()] + ".name")
+ + " Unusual Effect";
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item item, CreativeTabs tabs, List list) {
+ for (int i = 0; i < TYPES.length; i++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack itemStack) {
+ return EnumRarity.epic;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack itemStack, EntityPlayer player,
+ List info, boolean f) {
+ info.add(EnumChatFormatting.YELLOW
+ + "Combine this with the helmet of your choice!");
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tlhpoeCore/BasicMessageT.java b/TF2 Crates/src/main/java/tlhpoeCore/BasicMessageT.java new file mode 100755 index 0000000..a2fb5df --- /dev/null +++ b/TF2 Crates/src/main/java/tlhpoeCore/BasicMessageT.java @@ -0,0 +1,25 @@ +package tlhpoeCore;
+
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import io.netty.buffer.ByteBuf;
+import net.minecraft.entity.player.EntityPlayerMP;
+
+public abstract class BasicMessageT implements IMessage {
+ @Override
+ public abstract void fromBytes(ByteBuf buf);
+
+ @Override
+ public abstract void toBytes(ByteBuf buf);
+
+ public void sendToAll() {
+ TLHPoE.networkChannel.sendToAll(this);
+ }
+
+ public void sendTo(EntityPlayerMP player) {
+ TLHPoE.networkChannel.sendTo(this, player);
+ }
+
+ public void sendToServer() {
+ TLHPoE.networkChannel.sendToServer(this);
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tlhpoeCore/ClientProxyT.java b/TF2 Crates/src/main/java/tlhpoeCore/ClientProxyT.java new file mode 100755 index 0000000..5b9c07d --- /dev/null +++ b/TF2 Crates/src/main/java/tlhpoeCore/ClientProxyT.java @@ -0,0 +1,50 @@ +package tlhpoeCore;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import cpw.mods.fml.common.network.FMLNetworkEvent.ClientConnectedToServerEvent;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.ChatComponentText;
+import tlhpoeCore.util.MCUtil;
+
+public class ClientProxyT extends ServerProxyT {
+ @Override
+ public void doClient() {
+ FMLCommonHandler.instance().bus().register(this);
+
+ TLHPoE.registerUpdateDetector(ReferenceT.ID, ReferenceT.NAME,
+ ReferenceT.VERSION, "0B6mhkrh-GwwwTFkyWWh5b3BiYU0");
+ }
+
+ @SubscribeEvent
+ public void connect(ClientConnectedToServerEvent event) {
+ if (!Loader.isModLoaded("VersionChecker")) {
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ boolean done = false;
+
+ while (!done) {
+ EntityPlayer player = MCUtil.getMC().thePlayer;
+
+ if (player != null) {
+ done = true;
+
+ player.addChatMessage(new ChatComponentText(
+ "If you want to be notified of the latest update from any of TLHPoE's mods, install the VersionChecker mod!"));
+ } else {
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Thread.currentThread().interrupt();
+ }
+ }).start();
+ }
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tlhpoeCore/ReferenceT.java b/TF2 Crates/src/main/java/tlhpoeCore/ReferenceT.java new file mode 100755 index 0000000..302afc4 --- /dev/null +++ b/TF2 Crates/src/main/java/tlhpoeCore/ReferenceT.java @@ -0,0 +1,12 @@ +package tlhpoeCore;
+
+public class ReferenceT {
+ public static final String ID = "tlhpoeCore";
+ public static final String NAME = "TLHPoE Core";
+ public static final String VERSION = "1.9";
+
+ public static boolean DEOBFUSCATED = false;
+
+ public static final int DEFAULT_WIDTH = 854;
+ public static final int DEFAULT_HEIGHT = 480;
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tlhpoeCore/ScaledResolutionT.java b/TF2 Crates/src/main/java/tlhpoeCore/ScaledResolutionT.java new file mode 100755 index 0000000..deba078 --- /dev/null +++ b/TF2 Crates/src/main/java/tlhpoeCore/ScaledResolutionT.java @@ -0,0 +1,18 @@ +package tlhpoeCore;
+
+import net.minecraft.client.gui.ScaledResolution;
+import tlhpoeCore.util.MCUtil;
+
+public class ScaledResolutionT extends ScaledResolution {
+ public ScaledResolutionT(int width, int height) {
+ super(MCUtil.getMC(), width, height);
+ }
+
+ public double getScaledX(double x) {
+ return (x / ReferenceT.DEFAULT_WIDTH) * getScaledWidth_double();
+ }
+
+ public double getScaledY(double y) {
+ return (y / ReferenceT.DEFAULT_HEIGHT) * getScaledHeight_double();
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tlhpoeCore/ServerProxyT.java b/TF2 Crates/src/main/java/tlhpoeCore/ServerProxyT.java new file mode 100755 index 0000000..230d0de --- /dev/null +++ b/TF2 Crates/src/main/java/tlhpoeCore/ServerProxyT.java @@ -0,0 +1,15 @@ +package tlhpoeCore;
+
+import cpw.mods.fml.relauncher.Side;
+import tlhpoeCore.network.MessagePlaySound;
+
+public class ServerProxyT {
+ public void doServer() {
+ TLHPoE.networkChannel.registerMessage(
+ MessagePlaySound.Handler.class, MessagePlaySound.class,
+ TLHPoE.getNextMessageID(), Side.CLIENT);
+ }
+
+ public void doClient() {
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tlhpoeCore/TLHPoE.java b/TF2 Crates/src/main/java/tlhpoeCore/TLHPoE.java new file mode 100755 index 0000000..1147cb9 --- /dev/null +++ b/TF2 Crates/src/main/java/tlhpoeCore/TLHPoE.java @@ -0,0 +1,81 @@ +package tlhpoeCore;
+
+import static tlhpoeCore.ReferenceT.ID;
+import static tlhpoeCore.ReferenceT.NAME;
+import static tlhpoeCore.ReferenceT.VERSION;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+import cpw.mods.fml.common.Mod;
+import cpw.mods.fml.common.Mod.EventHandler;
+import cpw.mods.fml.common.Mod.Instance;
+import cpw.mods.fml.common.SidedProxy;
+import cpw.mods.fml.common.event.FMLInterModComms;
+import cpw.mods.fml.common.event.FMLPreInitializationEvent;
+import cpw.mods.fml.common.network.NetworkRegistry;
+import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
+import net.minecraft.launchwrapper.Launch;
+import net.minecraft.nbt.NBTTagCompound;
+import tlhpoeCore.util.MiscUtil;
+
+@Mod(modid = ID, name = NAME, version = VERSION)
+public class TLHPoE {
+ @Instance(ID)
+ public static TLHPoE instance;
+ @SidedProxy(clientSide = ID + ".ClientProxyT",
+ serverSide = ID + ".ServerProxyT")
+ public static ServerProxyT proxy;
+
+ public static SimpleNetworkWrapper networkChannel;
+
+ private static int nextMessageID = 0;
+
+ @EventHandler
+ public void preInit(FMLPreInitializationEvent e) {
+ ReferenceT.DEOBFUSCATED = (Boolean) Launch.blackboard
+ .get("fml.deobfuscatedEnvironment");
+
+ networkChannel =
+ NetworkRegistry.INSTANCE.newSimpleChannel("TLHPoE");
+
+ proxy.doServer();
+ proxy.doClient();
+ }
+
+ public static void registerUpdateDetector(String modid, String name,
+ String modVersion, String driveID) {
+ String newVersion = null;
+
+ try {
+ newVersion = MiscUtil
+ .getURLText("https://docs.google.com/uc?authuser=0&id="
+ + driveID + "&export=download");
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ return;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return;
+ }
+
+ if (modVersion.equals(newVersion)) {
+ return;
+ }
+
+ NBTTagCompound nbt = new NBTTagCompound();
+
+ nbt.setString("modDisplayName", name);
+ nbt.setString("oldVersion", modVersion);
+ nbt.setString("newVersion", newVersion);
+ nbt.setString("updateUrl", "http://adfoc.us/23774349240713");
+ nbt.setBoolean("isDirectLink", false);
+
+ FMLInterModComms.sendRuntimeMessage(modid, "VersionChecker",
+ "addUpdate", nbt);
+ }
+
+ public static int getNextMessageID() {
+ return nextMessageID++;
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tlhpoeCore/network/MessagePlaySound.java b/TF2 Crates/src/main/java/tlhpoeCore/network/MessagePlaySound.java new file mode 100755 index 0000000..0e646fb --- /dev/null +++ b/TF2 Crates/src/main/java/tlhpoeCore/network/MessagePlaySound.java @@ -0,0 +1,43 @@ +package tlhpoeCore.network;
+
+import cpw.mods.fml.common.network.ByteBufUtils;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import io.netty.buffer.ByteBuf;
+import tlhpoeCore.BasicMessageT;
+import tlhpoeCore.util.MCUtil;
+
+public class MessagePlaySound extends BasicMessageT {
+ public String soundName;
+
+ public MessagePlaySound() {
+ this("");
+ }
+
+ public MessagePlaySound(String soundName) {
+ this.soundName = soundName;
+ }
+
+ @Override
+ public void toBytes(ByteBuf buf) {
+ ByteBufUtils.writeUTF8String(buf, soundName);
+ }
+
+ @Override
+ public void fromBytes(ByteBuf buf) {
+ soundName = ByteBufUtils.readUTF8String(buf);
+ }
+
+ public static class Handler
+ implements IMessageHandler<MessagePlaySound, IMessage> {
+ @Override
+ public IMessage onMessage(MessagePlaySound message,
+ MessageContext ctx) {
+ MCUtil.getMC().thePlayer.playSound(message.soundName, 0.25F,
+ 1F);
+
+ return null;
+ }
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tlhpoeCore/util/MCUtil.java b/TF2 Crates/src/main/java/tlhpoeCore/util/MCUtil.java new file mode 100755 index 0000000..01c3b2d --- /dev/null +++ b/TF2 Crates/src/main/java/tlhpoeCore/util/MCUtil.java @@ -0,0 +1,82 @@ +package tlhpoeCore.util;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.ResourceLocation;
+import tlhpoeCore.ReferenceT;
+
+public class MCUtil {
+ public static Minecraft getMC() {
+ return Minecraft.getMinecraft();
+ }
+
+ public static Item getRandomItemOrBlock() {
+ Item i = null;
+
+ int length = Item.itemRegistry.getKeys().toArray().length;
+
+ Object select =
+ Item.itemRegistry.getObjectById(MathUtil.nextInt(length));
+
+ if (select != null && select instanceof Item) {
+ i = (Item) select;
+ } else {
+ return getRandomItemOrBlock();
+ }
+
+ return i;
+ }
+
+ public static Item getRandomItem() {
+ Item i = null;
+
+ int length = Item.itemRegistry.getKeys().toArray().length;
+
+ Object select =
+ Item.itemRegistry.getObjectById(MathUtil.nextInt(length));
+
+ if (select != null && select instanceof Item
+ && !(select instanceof ItemBlock)) {
+ i = (Item) select;
+ } else {
+ return getRandomItem();
+ }
+
+ return i;
+ }
+
+ public static Item getRandomBlock() {
+ Item i = null;
+
+ int length = Item.itemRegistry.getKeys().toArray().length;
+
+ Object select =
+ Item.itemRegistry.getObjectById(MathUtil.nextInt(length));
+
+ if (select != null && select instanceof ItemBlock) {
+ i = (Item) select;
+ } else {
+ return getRandomBlock();
+ }
+
+ return i;
+ }
+
+ public static NBTTagCompound
+ getPlayerNBTCompound(EntityPlayer player) {
+ NBTTagCompound nbt = player.getEntityData();
+
+ if (nbt.getCompoundTag(ReferenceT.NAME) == null) {
+ nbt.setTag(ReferenceT.NAME, new NBTTagCompound());
+ }
+
+ return nbt.getCompoundTag(ReferenceT.NAME);
+ }
+
+ public static ResourceLocation newResource(String url) {
+ return new ResourceLocation(url);
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tlhpoeCore/util/MathUtil.java b/TF2 Crates/src/main/java/tlhpoeCore/util/MathUtil.java new file mode 100755 index 0000000..d99a147 --- /dev/null +++ b/TF2 Crates/src/main/java/tlhpoeCore/util/MathUtil.java @@ -0,0 +1,35 @@ +package tlhpoeCore.util;
+
+import java.util.Random;
+
+public class MathUtil {
+ private static final Random RANDOM = new Random();
+
+ public static int nextInt(int n) {
+ return RANDOM.nextInt(n);
+ }
+
+ public static double nextDouble() {
+ return RANDOM.nextDouble();
+ }
+
+ public static int getRandomIntegerBetween(Random r, int min, int max) {
+ return r.nextInt(max - min + 1) + min;
+ }
+
+ public static int getRandomIntegerBetween(int min, int max) {
+ return nextInt(max - min + 1) + min;
+ }
+
+ public static boolean getChance(Random r, int chance, int range) {
+ return chance >= range ? true : r.nextInt(range - 1) <= chance - 1;
+ }
+
+ public static boolean getChance(int chance, int range) {
+ return chance >= range ? true : nextInt(range - 1) <= chance - 1;
+ }
+
+ public static Random getRandom() {
+ return RANDOM;
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tlhpoeCore/util/MiscUtil.java b/TF2 Crates/src/main/java/tlhpoeCore/util/MiscUtil.java new file mode 100755 index 0000000..f34c996 --- /dev/null +++ b/TF2 Crates/src/main/java/tlhpoeCore/util/MiscUtil.java @@ -0,0 +1,94 @@ +package tlhpoeCore.util;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public class MiscUtil {
+ public static Field getField(String fieldName, Class<?> clazz) {
+ Field field = null;
+
+ try {
+ field = clazz.getDeclaredField(fieldName);
+ } catch (NoSuchFieldException e) {
+ e.printStackTrace();
+ } catch (SecurityException e) {
+ e.printStackTrace();
+ }
+
+ return field;
+ }
+
+ public static Object getFieldValue(String fieldName, Class<?> clazz,
+ Object instance) {
+ Field field = getField(fieldName, clazz);
+ makePublic(field);
+
+ try {
+ return field.get(instance);
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ public static void replaceField(String fieldName, Class<?> clazz,
+ Object newValue, Object instance) {
+ Field field = getField(fieldName, clazz);
+
+ if (field != null) {
+ makePublic(field);
+
+ try {
+ field.set(instance, newValue);
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static void makePublic(Field field) {
+ field.setAccessible(true);
+
+ Field modField = null;
+
+ try {
+ modField = Field.class.getDeclaredField("modifiers");
+ } catch (NoSuchFieldException e) {
+ e.printStackTrace();
+ } catch (SecurityException e) {
+ e.printStackTrace();
+ }
+
+ modField.setAccessible(true);
+
+ try {
+ modField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static String getURLText(String url)
+ throws MalformedURLException, IOException {
+ BufferedReader versionFile = new BufferedReader(
+ new InputStreamReader(new URL(url).openStream()));
+
+ String s = versionFile.readLine();
+
+ versionFile.close();
+
+ return s;
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tlhpoeCore/util/RenderUtil.java b/TF2 Crates/src/main/java/tlhpoeCore/util/RenderUtil.java new file mode 100755 index 0000000..824acf9 --- /dev/null +++ b/TF2 Crates/src/main/java/tlhpoeCore/util/RenderUtil.java @@ -0,0 +1,43 @@ +package tlhpoeCore.util;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.Tessellator;
+
+public class RenderUtil {
+ public static void drawString(String msg, int x, int y, int color) {
+ MCUtil.getMC().fontRenderer.drawString(msg, x, y, color);
+ }
+
+ public static void drawOutlinedString(String msg, int x, int y,
+ int color, int outlineColor) {
+ Minecraft mc = MCUtil.getMC();
+
+ mc.fontRenderer.drawString(msg, x - 1, y, outlineColor);
+ mc.fontRenderer.drawString(msg, x + 1, y, outlineColor);
+ mc.fontRenderer.drawString(msg, x, y - 1, outlineColor);
+ mc.fontRenderer.drawString(msg, x, y + 1, outlineColor);
+
+ drawString(msg, x, y, color);
+ }
+
+ public static void drawTexturedQuad(int x, int y, int width,
+ int height, int u, int v, int uSize, int vSize, int texSizeX,
+ int texSizeY, float zLevel) {
+ float uFact = 1f / texSizeX;
+ float vFact = 1f / texSizeY;
+
+ int uEnd = u + uSize;
+ int vEnd = v + vSize;
+
+ Tessellator t = Tessellator.instance;
+
+ t.startDrawingQuads();
+ t.addVertexWithUV(x, y + height, zLevel, u * uFact, vEnd * vFact);
+ t.addVertexWithUV(x + width, y + height, zLevel, uEnd * uFact,
+ vEnd * vFact);
+ t.addVertexWithUV(x + width, y, zLevel, uEnd * uFact, v * vFact);
+ t.addVertexWithUV(x, y, zLevel, u * uFact, v * vFact);
+
+ t.draw();
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/java/tlhpoeCore/util/WorldUtil.java b/TF2 Crates/src/main/java/tlhpoeCore/util/WorldUtil.java new file mode 100755 index 0000000..1aa46ab --- /dev/null +++ b/TF2 Crates/src/main/java/tlhpoeCore/util/WorldUtil.java @@ -0,0 +1,62 @@ +package tlhpoeCore.util;
+
+import net.minecraft.block.Block;
+import net.minecraft.world.World;
+
+public class WorldUtil {
+ public static int getTopBlock(World world, int x, int z) {
+ for (int y = 0; y < 256; y++) {
+ if (world.canBlockSeeTheSky(x, y, z)) {
+ return y;
+ }
+ }
+
+ return -1;
+ }
+
+ public static int getTopBlockOfType(World world, int x, int z,
+ Block block) {
+ for (int y = 0; y < 256; y++) {
+ if (world.getBlock(x, 256 - y, z) == block) {
+ return 256 - y;
+ }
+ }
+
+ return -1;
+ }
+
+ public static void fillCircle(World world, double x, double y,
+ double z, int radius, Block block) {
+ world.setBlock((int) x, (int) y, (int) z, block);
+
+ world.setBlock((int) x + 1, (int) y, (int) z, block);
+ world.setBlock((int) x - 1, (int) y, (int) z, block);
+
+ world.setBlock((int) x, (int) y, (int) z + 1, block);
+ world.setBlock((int) x, (int) y, (int) z - 1, block);
+
+ x += 0.5;
+ y += 0.5;
+ z += 0.5;
+
+ while (radius != 0) {
+ for (int i = 0; i < 360; i++) {
+ world.setBlock((int) (x + radius * Math.cos(i)), (int) y,
+ (int) (z + radius * Math.sin(i)), block);
+ }
+
+ radius--;
+ }
+ }
+
+ public static void fillRect(World world, Block filler, int x, int y,
+ int z, int width, int length, int height) {
+ for (int i = 0; i < width; i++) {
+ for (int j = 0; j < length; j++) {
+ for (int k = 0; k < height; k++) {
+ world.setBlock(x + i, y + k, z + j, filler);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/lang/en_US.lang b/TF2 Crates/src/main/resources/assets/tf2crates/lang/en_US.lang new file mode 100755 index 0000000..52db75c --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/lang/en_US.lang @@ -0,0 +1,66 @@ +itemGroup.tf2Crates=TF2 Crates
+
+item.crate.name=Steve Co. Supply Crate
+item.key.name=Steve Co. Supply Crate Key
+item.strangifier.name=Strangifier
+
+crate.spookyCrate.name=Steve Co. Spooky Crate
+crate.festiveCrate.name=Steve Co. Festive Crate
+crate.birthdayCrate.name=Steve Co. Birthday Crate
+
+item.equalizer.name=Equalminer
+item.escapePlan.name=Escape Pick
+
+item.marketGardener.name=Emerald Gardener
+
+item.axtinguisher.name=Axtinguisher
+item.sharpenedVolcanoFragment.name=Sharpened Obsidian Fragment
+
+item.powerJack.name=Coaljack
+
+item.conniversKunai.name=Crafter's Kunai
+
+item.sandvich.name=Sandvich
+
+item.noiseMakerBirthday.name=Birthday Noise Maker
+item.noiseMakerSpooky.name=Spooky Noise Maker
+item.noiseMakerFestive.name=Festive Noise Maker
+
+unusualEffect.burningFlames.name=Burning Flames
+unusualEffect.poof.name=Poof
+unusualEffect.whiteSparkles.name=White Sparkles
+unusualEffect.flies.name=Flies
+unusualEffect.critical.name=Critical
+unusualEffect.magicalCrit.name=Magical Crit
+unusualEffect.musical.name=Musical
+unusualEffect.end.name=The End
+unusualEffect.enchanted.name=Enchanted
+unusualEffect.volcano.name=Volcanic
+unusualEffect.smoking.name=Smoking
+unusualEffect.slime.name=Slimey
+unusualEffect.loving.name=Love is in the Air
+unusualEffect.villager.name=Villager
+
+paint.black.name=A Distinctive Lack of Hue
+paint.red.name=A Shade of an Erythrocyte
+paint.green.name=Indubitably Green
+paint.brown.name=Radigan Conagher Brown
+paint.blue.name=Captivating Cobalt
+paint.purple.name=A Deep Commitment to Purple
+paint.cyan.name=Steve Co. Cyan
+paint.silver.name=Silverware Silver
+paint.gray.name=Aged Moustache Grey
+paint.pink.name=Pink as the Nether
+paint.lime.name=The Bitter Taste of Defeat and Lime
+paint.yellow.name=Minecraftium Gold
+paint.lightBlue.name=A Color Similar to the Sky
+paint.magenta.name=Color No. 321-52-88
+paint.orange.name=Sunset Orange
+paint.white.name=An Extraodinary Abundance of Tinge
+
+item.scrap.name=Scrap Metal
+item.reclaimed.name=Reclaimed Metal
+item.refined.name=Refined Metal
+
+death.attack.backstab=%1$s got backstabbed
+death.attack.backstab.player=%1$s got backstabbed by %2$s
\ No newline at end of file diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/sounds.json b/TF2 Crates/src/main/resources/assets/tf2crates/sounds.json new file mode 100755 index 0000000..d1fc927 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/sounds.json @@ -0,0 +1,32 @@ +{
+ "tf2crates.uncrate": {
+ "category": "player",
+ "sounds": [
+ "tf2crates/uncrate"
+ ]
+ },
+ "tf2crates.crit": {
+ "category": "player",
+ "sounds": [
+ "tf2crates/crit"
+ ]
+ },
+ "tf2crates.birthday": {
+ "category": "player",
+ "sounds": [
+ "tf2crates/birthday"
+ ]
+ },
+ "tf2crates.hohohohoho": {
+ "category": "player",
+ "sounds": [
+ "tf2crates/hohohohoho"
+ ]
+ },
+ "tf2crates.sleighbells": {
+ "category": "player",
+ "sounds": [
+ "tf2crates/sleighbells"
+ ]
+ }
+}
\ No newline at end of file diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/sounds/tf2crates/birthday.ogg b/TF2 Crates/src/main/resources/assets/tf2crates/sounds/tf2crates/birthday.ogg Binary files differnew file mode 100755 index 0000000..bc5b102 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/sounds/tf2crates/birthday.ogg diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/sounds/tf2crates/crit.ogg b/TF2 Crates/src/main/resources/assets/tf2crates/sounds/tf2crates/crit.ogg Binary files differnew file mode 100755 index 0000000..a1eeeb2 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/sounds/tf2crates/crit.ogg diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/sounds/tf2crates/hohohohoho.ogg b/TF2 Crates/src/main/resources/assets/tf2crates/sounds/tf2crates/hohohohoho.ogg Binary files differnew file mode 100755 index 0000000..0d86039 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/sounds/tf2crates/hohohohoho.ogg diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/sounds/tf2crates/sleighbells.ogg b/TF2 Crates/src/main/resources/assets/tf2crates/sounds/tf2crates/sleighbells.ogg Binary files differnew file mode 100755 index 0000000..967a0af --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/sounds/tf2crates/sleighbells.ogg diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/sounds/tf2crates/uncrate.ogg b/TF2 Crates/src/main/resources/assets/tf2crates/sounds/tf2crates/uncrate.ogg Binary files differnew file mode 100755 index 0000000..892b2ec --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/sounds/tf2crates/uncrate.ogg diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/birthdayCrate.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/birthdayCrate.png Binary files differnew file mode 100755 index 0000000..d876ab6 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/birthdayCrate.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/crate.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/crate.png Binary files differnew file mode 100755 index 0000000..a44e4fd --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/crate.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/festiveCrate.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/festiveCrate.png Binary files differnew file mode 100755 index 0000000..6b726bb --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/festiveCrate.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/jarate.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/jarate.png Binary files differnew file mode 100755 index 0000000..455ce98 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/jarate.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/key.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/key.png Binary files differnew file mode 100755 index 0000000..017911a --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/key.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/minersHelmet.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/minersHelmet.png Binary files differnew file mode 100755 index 0000000..2b7619f --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/minersHelmet.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/noiseMakerBirthday.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/noiseMakerBirthday.png Binary files differnew file mode 100755 index 0000000..9a9ba27 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/noiseMakerBirthday.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/noiseMakerFestive.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/noiseMakerFestive.png Binary files differnew file mode 100755 index 0000000..ab301ec --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/noiseMakerFestive.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/noiseMakerSpooky.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/noiseMakerSpooky.png Binary files differnew file mode 100755 index 0000000..d237477 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/noiseMakerSpooky.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/black.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/black.png Binary files differnew file mode 100755 index 0000000..425dccf --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/black.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/blue.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/blue.png Binary files differnew file mode 100755 index 0000000..f506ef4 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/blue.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/brown.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/brown.png Binary files differnew file mode 100755 index 0000000..59dda9b --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/brown.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/cyan.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/cyan.png Binary files differnew file mode 100755 index 0000000..17744d8 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/cyan.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/empty.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/empty.png Binary files differnew file mode 100755 index 0000000..ca91061 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/empty.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/gray.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/gray.png Binary files differnew file mode 100755 index 0000000..a2cf622 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/gray.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/green.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/green.png Binary files differnew file mode 100755 index 0000000..b0f3d46 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/green.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/lightBlue.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/lightBlue.png Binary files differnew file mode 100755 index 0000000..f75b9d0 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/lightBlue.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/lime.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/lime.png Binary files differnew file mode 100755 index 0000000..5096084 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/lime.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/magenta.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/magenta.png Binary files differnew file mode 100755 index 0000000..ccbf0cb --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/magenta.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/orange.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/orange.png Binary files differnew file mode 100755 index 0000000..b003210 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/orange.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/overlay.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/overlay.png Binary files differnew file mode 100755 index 0000000..83915a8 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/overlay.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/pink.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/pink.png Binary files differnew file mode 100755 index 0000000..839b86d --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/pink.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/purple.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/purple.png Binary files differnew file mode 100755 index 0000000..11775f6 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/purple.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/red.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/red.png Binary files differnew file mode 100755 index 0000000..72c4d9c --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/red.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/silver.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/silver.png Binary files differnew file mode 100755 index 0000000..3f7212c --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/silver.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/white.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/white.png Binary files differnew file mode 100755 index 0000000..139c24d --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/white.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/yellow.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/yellow.png Binary files differnew file mode 100755 index 0000000..1f86b41 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/paint/yellow.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/reclaimed.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/reclaimed.png Binary files differnew file mode 100755 index 0000000..0c4ca33 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/reclaimed.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/refined.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/refined.png Binary files differnew file mode 100755 index 0000000..6aa0132 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/refined.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/sandvich.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/sandvich.png Binary files differnew file mode 100755 index 0000000..fda380b --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/sandvich.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/scrap.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/scrap.png Binary files differnew file mode 100755 index 0000000..9ebde3b --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/scrap.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/spookyCrate.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/spookyCrate.png Binary files differnew file mode 100755 index 0000000..e20f608 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/spookyCrate.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/strangifier.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/strangifier.png Binary files differnew file mode 100755 index 0000000..9478054 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/strangifier.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/unusualEffect.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/unusualEffect.png Binary files differnew file mode 100755 index 0000000..5ff3aa6 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/unusualEffect.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/axtinguisher.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/axtinguisher.png Binary files differnew file mode 100755 index 0000000..074a887 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/axtinguisher.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/conniversKunai.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/conniversKunai.png Binary files differnew file mode 100755 index 0000000..8aa14a6 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/conniversKunai.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/equalizer.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/equalizer.png Binary files differnew file mode 100755 index 0000000..d02172a --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/equalizer.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/escapePlan.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/escapePlan.png Binary files differnew file mode 100755 index 0000000..9f458a3 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/escapePlan.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/axtinguisher.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/axtinguisher.png Binary files differnew file mode 100755 index 0000000..258f068 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/axtinguisher.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/conniversKunai.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/conniversKunai.png Binary files differnew file mode 100755 index 0000000..9679941 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/conniversKunai.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/equalizer.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/equalizer.png Binary files differnew file mode 100755 index 0000000..3bce821 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/equalizer.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/escapePlan.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/escapePlan.png Binary files differnew file mode 100755 index 0000000..1bb40fa --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/escapePlan.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/marketGardener.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/marketGardener.png Binary files differnew file mode 100755 index 0000000..bd5d4ed --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/marketGardener.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/powerJack.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/powerJack.png Binary files differnew file mode 100755 index 0000000..e743313 --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/powerJack.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/sharpenedVolcanoFragment.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/sharpenedVolcanoFragment.png Binary files differnew file mode 100755 index 0000000..9ec68df --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/gold/sharpenedVolcanoFragment.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/marketGardener.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/marketGardener.png Binary files differnew file mode 100755 index 0000000..317d56f --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/marketGardener.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/powerJack.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/powerJack.png Binary files differnew file mode 100755 index 0000000..0b46a3f --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/powerJack.png diff --git a/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/sharpenedVolcanoFragment.png b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/sharpenedVolcanoFragment.png Binary files differnew file mode 100755 index 0000000..6a996fa --- /dev/null +++ b/TF2 Crates/src/main/resources/assets/tf2crates/textures/items/weapon/sharpenedVolcanoFragment.png |
