Initial commit

This commit is contained in:
Electroblob
2018-01-19 20:33:04 +00:00
commit da6b007a3a
945 changed files with 60616 additions and 0 deletions
@@ -0,0 +1,351 @@
package electroblob.wizardry.registry;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.spell.*;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
import net.minecraftforge.fml.common.registry.IForgeRegistry;
import net.minecraftforge.fml.common.registry.RegistryBuilder;
/**
* Class responsible for defining, storing and registering all of wizardry's spells.
* @author Electroblob
* @since Wizardry 2.1
*/
// In case anyone was wondering, the reason @ObjectHolder is useful within one mod is that it allows you to initialise
// stuff during the registry events (or whenever), whilst still having a final field (which is important, not only
// because it makes the text go bold, but also because it stops anyone fiddling with your fields). "Why would I want to
// initialise things within the registry events?", I hear you ask - well, for one, custom registries don't like it if
// you haven't created the registry before you start calling constructors of classes extending IForgeRegistryEntry.Impl.
@ObjectHolder(Wizardry.MODID)
@Mod.EventBusSubscriber
public final class Spells {
// This is here because this class is already an event handler.
@SubscribeEvent
public static void createRegistry(RegistryEvent.NewRegistry event){
// Beats me why we need both of these. Surely the type parameter means it already knows?
RegistryBuilder<Spell> builder = new RegistryBuilder<Spell>();
builder.setType(Spell.class);
builder.setName(new ResourceLocation(Wizardry.MODID, "spells"));
builder.setIDRange(0, 5000); // Is there any penalty for using a larger number?
Spell.registry = builder.create();
}
// Wizardry 1.0 spells
public static final Spell none = null;
public static final Spell magic_missile = null;
public static final Spell ignite = null;
public static final Spell freeze = null;
public static final Spell snowball = null;
public static final Spell arc = null;
public static final Spell thunderbolt = null;
public static final Spell summon_zombie = null;
public static final Spell snare = null;
public static final Spell dart = null;
public static final Spell light = null;
public static final Spell telekinesis = null;
public static final Spell heal = null;
public static final Spell fireball = null;
public static final Spell flame_ray = null;
public static final Spell firebomb = null;
public static final Spell fire_sigil = null;
public static final Spell firebolt = null;
public static final Spell frost_ray = null;
public static final Spell summon_snow_golem = null;
public static final Spell ice_shard = null;
public static final Spell ice_statue = null;
public static final Spell frost_sigil = null;
public static final Spell lightning_ray = null;
public static final Spell spark_bomb = null;
public static final Spell homing_spark = null;
public static final Spell lightning_sigil = null;
public static final Spell lightning_arrow = null;
public static final Spell life_drain = null;
public static final Spell summon_skeleton = null;
public static final Spell metamorphosis = null;
public static final Spell wither = null;
public static final Spell poison = null;
public static final Spell growth_aura = null;
public static final Spell bubble = null;
public static final Spell whirlwind = null;
public static final Spell poison_bomb = null;
public static final Spell summon_spirit_wolf = null;
public static final Spell blink = null;
public static final Spell agility = null;
public static final Spell conjure_sword = null;
public static final Spell conjure_pickaxe = null;
public static final Spell conjure_bow = null;
public static final Spell force_arrow = null;
public static final Spell shield = null;
public static final Spell replenish_hunger = null;
public static final Spell cure_effects = null;
public static final Spell heal_ally = null;
public static final Spell summon_blaze = null;
public static final Spell ring_of_fire = null;
public static final Spell detonate = null;
public static final Spell fire_resistance = null;
public static final Spell fireskin = null;
public static final Spell flaming_axe = null;
public static final Spell blizzard = null;
public static final Spell summon_ice_wraith = null;
public static final Spell ice_shroud = null;
public static final Spell ice_charge = null;
public static final Spell frost_axe = null;
public static final Spell invoke_weather = null;
public static final Spell chain_lightning = null;
public static final Spell lightning_bolt = null;
public static final Spell summon_lightning_wraith = null;
public static final Spell static_aura = null;
public static final Spell lightning_disc = null;
public static final Spell mind_control = null;
public static final Spell summon_wither_skeleton = null;
public static final Spell entrapment = null;
public static final Spell wither_skull = null;
public static final Spell darkness_orb = null;
public static final Spell shadow_ward = null;
public static final Spell decay = null;
public static final Spell water_breathing = null;
public static final Spell tornado = null;
public static final Spell glide = null;
public static final Spell summon_spirit_horse = null;
public static final Spell spider_swarm = null;
public static final Spell slime = null;
public static final Spell petrify = null;
public static final Spell invisibility = null;
public static final Spell levitation = null;
public static final Spell force_orb = null;
public static final Spell transportation = null;
public static final Spell spectral_pathway = null;
public static final Spell phase_step = null;
public static final Spell vanishing_box = null;
public static final Spell greater_heal = null;
public static final Spell healing_aura = null;
public static final Spell forcefield = null;
public static final Spell ironflesh = null;
public static final Spell transience = null;
public static final Spell meteor = null;
public static final Spell firestorm = null;
public static final Spell summon_phoenix = null;
public static final Spell ice_age = null;
public static final Spell wall_of_frost = null;
public static final Spell summon_ice_giant = null;
public static final Spell thunderstorm = null;
public static final Spell lightning_hammer = null;
public static final Spell plague_of_darkness = null;
public static final Spell summon_skeleton_legion = null;
public static final Spell summon_shadow_wraith = null;
public static final Spell forests_curse = null;
public static final Spell flight = null;
public static final Spell silverfish_swarm = null;
public static final Spell black_hole = null;
public static final Spell shockwave = null;
public static final Spell summon_iron_golem = null;
public static final Spell arrow_rain = null;
public static final Spell diamondflesh = null;
public static final Spell font_of_vitality = null;
// Wizardry 1.1 spells
public static final Spell smoke_bomb = null;
public static final Spell mind_trick = null;
public static final Spell leap = null;
public static final Spell pocket_furnace = null;
public static final Spell intimidate = null;
public static final Spell banish = null;
public static final Spell sixth_sense = null;
public static final Spell darkvision = null;
public static final Spell clairvoyance = null;
public static final Spell pocket_workbench = null;
public static final Spell imbue_weapon = null;
public static final Spell invigorating_presence = null;
public static final Spell oakflesh = null;
public static final Spell greater_fireball = null;
public static final Spell flaming_weapon = null;
public static final Spell ice_lance = null;
public static final Spell freezing_weapon = null;
public static final Spell ice_spikes = null;
public static final Spell lightning_pulse = null;
public static final Spell curse_of_soulbinding = null;
public static final Spell cobwebs = null;
public static final Spell decoy = null;
public static final Spell arcane_jammer = null;
public static final Spell conjure_armour = null;
public static final Spell group_heal = null;
public static final Spell hailstorm = null;
public static final Spell lightning_web = null;
public static final Spell summon_storm_elemental = null;
public static final Spell earthquake = null;
public static final Spell font_of_mana = null;
@SubscribeEvent
public static void register(RegistryEvent.Register<Spell> event){
IForgeRegistry<Spell> registry = event.getRegistry();
// event.getRegistry should always equal Spell.registry.
registry.register(new None());
registry.register(new MagicMissile());
registry.register(new Ignite());
registry.register(new Freeze());
registry.register(new Snowball());
registry.register(new Arc());
registry.register(new Thunderbolt());
registry.register(new SummonZombie());
registry.register(new Snare());
registry.register(new Dart());
registry.register(new Light());
registry.register(new Telekinesis());
registry.register(new Heal());
registry.register(new Fireball());
registry.register(new FlameRay());
registry.register(new Firebomb());
registry.register(new FireSigil());
registry.register(new Firebolt());
registry.register(new FrostRay());
registry.register(new SummonSnowGolem());
registry.register(new IceShard());
registry.register(new IceStatue());
registry.register(new FrostSigil());
registry.register(new LightningRay());
registry.register(new SparkBomb());
registry.register(new HomingSpark());
registry.register(new LightningSigil());
registry.register(new LightningArrow());
registry.register(new LifeDrain());
registry.register(new SummonSkeleton());
registry.register(new Metamorphosis());
registry.register(new Wither());
registry.register(new Poison());
registry.register(new GrowthAura());
registry.register(new Bubble());
registry.register(new Whirlwind());
registry.register(new PoisonBomb());
registry.register(new SummonSpiritWolf());
registry.register(new Blink());
registry.register(new Agility());
registry.register(new ConjureSword());
registry.register(new ConjurePickaxe());
registry.register(new ConjureBow());
registry.register(new ForceArrow());
registry.register(new Shield());
registry.register(new ReplenishHunger());
registry.register(new CureEffects());
registry.register(new HealAlly());
registry.register(new SummonBlaze());
registry.register(new RingOfFire());
registry.register(new Detonate());
registry.register(new FireResistance());
registry.register(new Fireskin());
registry.register(new FlamingAxe());
registry.register(new Blizzard());
registry.register(new SummonIceWraith());
registry.register(new IceShroud());
registry.register(new IceCharge());
registry.register(new FrostAxe());
registry.register(new InvokeWeather());
registry.register(new ChainLightning());
registry.register(new LightningBolt());
registry.register(new SummonLightningWraith());
registry.register(new StaticAura());
registry.register(new LightningDisc());
registry.register(new MindControl());
registry.register(new SummonWitherSkeleton());
registry.register(new Entrapment());
registry.register(new WitherSkull());
registry.register(new DarknessOrb());
registry.register(new ShadowWard());
registry.register(new Decay());
registry.register(new WaterBreathing());
registry.register(new Tornado());
registry.register(new Glide());
registry.register(new SummonSpiritHorse());
registry.register(new SpiderSwarm());
registry.register(new Slime());
registry.register(new Petrify());
registry.register(new Invisibility());
registry.register(new Levitation());
registry.register(new ForceOrb());
registry.register(new Transportation());
registry.register(new SpectralPathway());
registry.register(new PhaseStep());
registry.register(new VanishingBox());
registry.register(new GreaterHeal());
registry.register(new HealingAura());
registry.register(new Forcefield());
registry.register(new Ironflesh());
registry.register(new Transience());
registry.register(new Meteor());
registry.register(new Firestorm());
registry.register(new SummonPhoenix());
registry.register(new IceAge());
registry.register(new WallOfFrost());
registry.register(new SummonIceGiant());
registry.register(new Thunderstorm());
registry.register(new LightningHammer());
registry.register(new PlagueOfDarkness());
registry.register(new SummonSkeletonLegion());
registry.register(new SummonShadowWraith());
registry.register(new ForestsCurse());
registry.register(new Flight());
registry.register(new SilverfishSwarm());
registry.register(new BlackHole());
registry.register(new Shockwave());
registry.register(new SummonIronGolem());
registry.register(new ArrowRain());
registry.register(new Diamondflesh());
registry.register(new FontOfVitality());
// Wizardry 1.1 spells
registry.register(new SmokeBomb());
registry.register(new MindTrick());
registry.register(new Leap());
registry.register(new PocketFurnace());
registry.register(new Intimidate());
registry.register(new Banish());
registry.register(new SixthSense());
registry.register(new Darkvision());
registry.register(new Clairvoyance());
registry.register(new PocketWorkbench());
registry.register(new ImbueWeapon());
registry.register(new InvigoratingPresence());
registry.register(new Oakflesh());
registry.register(new GreaterFireball());
registry.register(new FlamingWeapon());
registry.register(new IceLance());
registry.register(new FreezingWeapon());
registry.register(new IceSpikes());
registry.register(new LightningPulse());
registry.register(new CurseOfSoulbinding());
registry.register(new Cobwebs());
registry.register(new Decoy());
registry.register(new ArcaneJammer());
registry.register(new ConjureArmour());
registry.register(new GroupHeal());
registry.register(new Hailstorm());
registry.register(new LightningWeb());
registry.register(new SummonStormElemental());
registry.register(new Earthquake());
registry.register(new FontOfMana());
}
}
@@ -0,0 +1,47 @@
package electroblob.wizardry.registry;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.stats.Achievement;
import net.minecraftforge.common.AchievementPage;
/**
* Class responsible for defining, storing and registering all of wizardry's achievements (achievements don't have a
* registry, but it make sense to do them the same way as everything else).
* @author Electroblob
* @since Wizardry 2.1
*/
public final class WizardryAchievements {
public static final Achievement crystal = new Achievement("crystal", "crystal", -1, -1, WizardryItems.magic_crystal, null).registerStat();
public static final Achievement arcane_initiate = new Achievement("arcane_initiate", "arcane_initiate", 2, -1, WizardryItems.magic_wand, crystal).registerStat();
public static final Achievement apprentice = new Achievement("apprentice", "apprentice", 2, 3, WizardryItems.apprentice_wand, arcane_initiate).registerStat();
public static final Achievement master = new Achievement("master", "master", 3, 6, WizardryItems.master_wand, apprentice).registerStat();
public static final Achievement all_spells = new Achievement("all_spells", "all_spells", 5, 7, WizardryItems.wizard_handbook, master).registerStat().setSpecial();
public static final Achievement wizard_trade = new Achievement("wizard_trade", "wizard_trade", 2, -5, Items.EMERALD, arcane_initiate).registerStat();
public static final Achievement buy_master_spell = new Achievement("buy_master_spell", "buy_master_spell", 5, -5, WizardryItems.spell_book, wizard_trade).registerStat().setSpecial();
public static final Achievement freeze_blaze = new Achievement("freeze_blaze", "freeze_blaze", -1, 3, Blocks.ICE, apprentice).registerStat();
public static final Achievement charge_creeper = new Achievement("charge_creeper", "charge_creeper", -1, 1, Items.GUNPOWDER, arcane_initiate).registerStat();
public static final Achievement frankenstein = new Achievement("frankenstein", "frankenstein", -3, 1, WizardryItems.advanced_lightning_wand, charge_creeper).registerStat().setSpecial();
public static final Achievement special_upgrade = new Achievement("special_upgrade", "special_upgrade", 4, 1, WizardryItems.condenser_upgrade, arcane_initiate).registerStat();
public static final Achievement craft_flask = new Achievement("craft_flask", "craft_flask", 4, -2, WizardryItems.mana_flask, arcane_initiate).registerStat();
public static final Achievement elemental = new Achievement("elemental", "elemental", 6, -1, WizardryItems.basic_fire_wand, arcane_initiate).registerStat();
public static final Achievement armour_set = new Achievement("armour_set", "armour_set", 0, -4, WizardryItems.wizard_hat, arcane_initiate).registerStat();
public static final Achievement legendary = new Achievement("legendary", "legendary", -2, -5, WizardryItems.armour_upgrade, armour_set).registerStat().setSpecial();
public static final Achievement self_destruct = new Achievement("self_destruct", "self_destruct", 1, 0, Blocks.PUMPKIN, arcane_initiate).registerStat();
public static final Achievement pig_tornado = new Achievement("pig_tornado", "pig_tornado", 6, 3, Items.SADDLE, apprentice).registerStat().setSpecial();
public static final Achievement jam_wizard = new Achievement("jam_wizard", "jam_wizard", 4, 4, Blocks.WEB, apprentice).registerStat();
public static final Achievement slime_skeleton = new Achievement("slime_skeleton", "slime_skeleton", 1, 5, Items.SLIME_BALL, apprentice).registerStat();
public static final Achievement anger_wizard = new Achievement("anger_wizard", "anger_wizard", 1, -7, Items.IRON_SWORD, wizard_trade).registerStat();
public static final Achievement defeat_evil_wizard = new Achievement("defeat_evil_wizard", "defeat_evil_wizard", 4, -7, WizardryItems.wizard_boots_necromancy, wizard_trade).registerStat();
public static final Achievement max_out_wand = new Achievement("max_out_wand", "max_out_wand", 7, 1, WizardryItems.arcane_tome, special_upgrade).registerStat().setSpecial();
public static final Achievement element_master = new Achievement("element_master", "element_master", 7, -3, WizardryItems.master_ice_wand, elemental).registerStat().setSpecial();
public static final Achievement identify_spell = new Achievement("identify_spell", "identify_spell", -2, -3, WizardryItems.identification_scroll, arcane_initiate).registerStat();
private static final Achievement[] ACHIEVEMENTS_LIST = {crystal, arcane_initiate, apprentice, master, all_spells, wizard_trade, buy_master_spell, freeze_blaze, charge_creeper,
frankenstein, special_upgrade, craft_flask, elemental, armour_set, legendary, self_destruct, pig_tornado, jam_wizard, slime_skeleton, anger_wizard, defeat_evil_wizard,
max_out_wand, element_master, identify_spell};
public static final AchievementPage WIZARDRY_ACHIEVEMENT_PAGE = new AchievementPage("Wizardry", ACHIEVEMENTS_LIST);
}
@@ -0,0 +1,92 @@
package electroblob.wizardry.registry;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.block.BlockArcaneWorkbench;
import electroblob.wizardry.block.BlockCrystalFlower;
import electroblob.wizardry.block.BlockCrystalOre;
import electroblob.wizardry.block.BlockMagicLight;
import electroblob.wizardry.block.BlockSnare;
import electroblob.wizardry.block.BlockSpectral;
import electroblob.wizardry.block.BlockStatue;
import electroblob.wizardry.block.BlockTransportationStone;
import electroblob.wizardry.block.BlockVanishingCobweb;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.IForgeRegistry;
/**
* Class responsible for defining, storing and registering all of wizardry's blocks.
* @author Electroblob
* @since Wizardry 2.1
*/
@Mod.EventBusSubscriber
public final class WizardryBlocks {
// I get registry events, they make sense - even I doubted myself with when to do various things in the load process,
// so I can see why the folks at Forge wanted to save us having to think about it.
// What I do not understand is why you would use @ObjectHolder for your own blocks and items. What's the point in
// making your code longer and more complicated, when you can just define the blocks as constants and register them
// later?
// Found a very nice way of registering things using arrays, which might make @ObjectHolder actually useful.
// http://www.minecraftforge.net/forum/topic/49497-1112-is-using-registryevent-this-way-ok/
// Anything set to use the material 'air' will not render, even with a TESR!
// setSoundType should be public, but in this particular version it isn't... which is a bit of a pain.
public static final Block arcane_workbench = new BlockArcaneWorkbench().setHardness(1.0F).setCreativeTab(WizardryTabs.WIZARDRY);
public static final Block crystal_ore = new BlockCrystalOre(Material.ROCK).setHardness(3.0F).setCreativeTab(WizardryTabs.WIZARDRY);
public static final Block petrified_stone = new BlockStatue(Material.ROCK).setHardness(1.5F).setResistance(10.0F);
public static final Block ice_statue = new BlockStatue(Material.ICE).setHardness(0.5F).setLightOpacity(3);
public static final Block magic_light = new BlockMagicLight(Material.CIRCUITS);
public static final Block crystal_flower = new BlockCrystalFlower(Material.PLANTS).setHardness(0.0F).setCreativeTab(WizardryTabs.WIZARDRY);
public static final Block snare = new BlockSnare(Material.PLANTS).setHardness(0.0F);
public static final Block transportation_stone = new BlockTransportationStone(Material.ROCK).setHardness(0.0F).setLightLevel(0.5f).setLightOpacity(0).setCreativeTab(WizardryTabs.WIZARDRY);
public static final Block spectral_block = new BlockSpectral(Material.GLASS).setLightLevel(0.7f).setLightOpacity(0).setBlockUnbreakable().setResistance(6000000.0F);
public static final Block crystal_block = new Block(Material.IRON).setHardness(5.0F).setResistance(10.0F).setCreativeTab(WizardryTabs.WIZARDRY);
public static final Block meteor = new Block(Material.ROCK).setLightLevel(1);
public static final Block vanishing_cobweb = new BlockVanishingCobweb(Material.WEB).setLightOpacity(1).setHardness(4.0F);
static {
// This is here because Block#setHarvestLevel isn't chainable.
crystal_block.setHarvestLevel("pickaxe", 2);
}
/**
* Sets both the registry and unlocalised names of the given block, then registers it with the given registry. Use
* this instead of {@link Block#setRegistryName(String)} and {@link Block#setUnlocalizedName(String)} during
* construction, for convenience and consistency.
* @param registry The registry to register the given block to.
* @param item The block to register.
* @param name The name of the block, without the mod ID or the .name stuff. The registry name will be
* {@code wizardry:[name]}. The unlocalised name will be {@code tile.wizardry:[name].name}.
*/
public static void registerBlock(IForgeRegistry<Block> registry, Block block, String name){
block.setRegistryName(Wizardry.MODID, name);
block.setUnlocalizedName(block.getRegistryName().toString());
registry.register(block);
}
@SubscribeEvent
public static void register(RegistryEvent.Register<Block> event){
IForgeRegistry<Block> registry = event.getRegistry();
registerBlock(registry, arcane_workbench, "arcane_workbench");
registerBlock(registry, crystal_ore, "crystal_ore");
registerBlock(registry, petrified_stone, "petrified_stone");
registerBlock(registry, ice_statue, "ice_statue");
registerBlock(registry, magic_light, "magic_light");
registerBlock(registry, crystal_flower, "crystal_flower");
registerBlock(registry, snare, "snare");
registerBlock(registry, transportation_stone, "transportation_stone");
registerBlock(registry, spectral_block, "spectral_block");
registerBlock(registry, crystal_block, "crystal_block");
registerBlock(registry, meteor, "meteor");
registerBlock(registry, vanishing_cobweb, "vanishing_cobweb");
}
}
@@ -0,0 +1,41 @@
package electroblob.wizardry.registry;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.enchantment.EnchantmentMagicSword;
import electroblob.wizardry.enchantment.EnchantmentTimed;
import net.minecraft.enchantment.Enchantment;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
/**
* Class responsible for defining, storing and registering all of wizardry's enchantments.
* @author Electroblob
* @since Wizardry 2.1
*/
@Mod.EventBusSubscriber
public final class WizardryEnchantments {
// At the moment these enchantments generate on books in dungeon chests due to a bad bit of code (EnchantRandomly:50).
// No idea how to fix this because I have no way of hooking into that code... removing the enchantments from the
// registry works, but breaks everything else!
// TODO: For the time being, a dynamic solution will have to do, i.e. intercept the book when it is generated and
// reassign its enchantment.
// All of these have custom classes, so the unlocalised name (referred to simply as 'name' for enchantments) is
// dealt with inside those classes.
public static final Enchantment magic_sword = new EnchantmentMagicSword().setRegistryName(Wizardry.MODID, "magic_sword");
public static final Enchantment magic_bow = new EnchantmentTimed().setRegistryName(Wizardry.MODID, "magic_bow");
public static final Enchantment flaming_weapon = new EnchantmentTimed().setRegistryName(Wizardry.MODID, "flaming_weapon");
public static final Enchantment freezing_weapon = new EnchantmentTimed().setRegistryName(Wizardry.MODID, "freezing_weapon");
@SubscribeEvent
public static void register(RegistryEvent.Register<Enchantment> event){
event.getRegistry().register(magic_sword);
event.getRegistry().register(magic_bow);
event.getRegistry().register(flaming_weapon);
event.getRegistry().register(freezing_weapon);
}
}
@@ -0,0 +1,419 @@
package electroblob.wizardry.registry;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.constants.Element;
import electroblob.wizardry.constants.Tier;
import electroblob.wizardry.item.ItemArcaneTome;
import electroblob.wizardry.item.ItemArmourUpgrade;
import electroblob.wizardry.item.ItemFirebomb;
import electroblob.wizardry.item.ItemFlamingAxe;
import electroblob.wizardry.item.ItemFrostAxe;
import electroblob.wizardry.item.ItemIdentificationScroll;
import electroblob.wizardry.item.ItemPoisonBomb;
import electroblob.wizardry.item.ItemScroll;
import electroblob.wizardry.item.ItemSmokeBomb;
import electroblob.wizardry.item.ItemSpectralArmour;
import electroblob.wizardry.item.ItemSpectralBow;
import electroblob.wizardry.item.ItemSpectralPickaxe;
import electroblob.wizardry.item.ItemSpectralSword;
import electroblob.wizardry.item.ItemSpellBook;
import electroblob.wizardry.item.ItemWand;
import electroblob.wizardry.item.ItemWizardArmour;
import electroblob.wizardry.item.ItemWizardHandbook;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.IForgeRegistry;
/**
* Class responsible for defining, storing and registering all of wizardry's items. Also registers the ItemBlocks for
* wizardry's blocks.
* @author Electroblob
* @since Wizardry 2.1
*/
@Mod.EventBusSubscriber
public final class WizardryItems {
public static final Item magic_crystal = new Item().setCreativeTab(WizardryTabs.WIZARDRY);
public static final Item magic_wand = new ItemWand(Tier.BASIC, null);
public static final Item apprentice_wand = new ItemWand(Tier.APPRENTICE, null);
public static final Item advanced_wand = new ItemWand(Tier.ADVANCED, null);
public static final Item master_wand = new ItemWand(Tier.MASTER, null);
public static final Item arcane_tome = new ItemArcaneTome();
public static final Item wizard_handbook = new ItemWizardHandbook();
public static final Item spell_book = new ItemSpellBook();
public static final Item basic_fire_wand = new ItemWand(Tier.BASIC, Element.FIRE);
public static final Item basic_ice_wand = new ItemWand(Tier.BASIC, Element.ICE);
public static final Item basic_lightning_wand = new ItemWand(Tier.BASIC, Element.LIGHTNING);
public static final Item basic_necromancy_wand = new ItemWand(Tier.BASIC, Element.NECROMANCY);
public static final Item basic_earth_wand = new ItemWand(Tier.BASIC, Element.EARTH);
public static final Item basic_sorcery_wand = new ItemWand(Tier.BASIC, Element.SORCERY);
public static final Item basic_healing_wand = new ItemWand(Tier.BASIC, Element.HEALING);
public static final Item apprentice_fire_wand = new ItemWand(Tier.APPRENTICE, Element.FIRE);
public static final Item apprentice_ice_wand = new ItemWand(Tier.APPRENTICE, Element.ICE);
public static final Item apprentice_lightning_wand = new ItemWand(Tier.APPRENTICE, Element.LIGHTNING);
public static final Item apprentice_necromancy_wand = new ItemWand(Tier.APPRENTICE, Element.NECROMANCY);
public static final Item apprentice_earth_wand = new ItemWand(Tier.APPRENTICE, Element.EARTH);
public static final Item apprentice_sorcery_wand = new ItemWand(Tier.APPRENTICE, Element.SORCERY);
public static final Item apprentice_healing_wand = new ItemWand(Tier.APPRENTICE, Element.HEALING);
public static final Item advanced_fire_wand = new ItemWand(Tier.ADVANCED, Element.FIRE);
public static final Item advanced_ice_wand = new ItemWand(Tier.ADVANCED, Element.ICE);
public static final Item advanced_lightning_wand = new ItemWand(Tier.ADVANCED, Element.LIGHTNING);
public static final Item advanced_necromancy_wand = new ItemWand(Tier.ADVANCED, Element.NECROMANCY);
public static final Item advanced_earth_wand = new ItemWand(Tier.ADVANCED, Element.EARTH);
public static final Item advanced_sorcery_wand = new ItemWand(Tier.ADVANCED, Element.SORCERY);
public static final Item advanced_healing_wand = new ItemWand(Tier.ADVANCED, Element.HEALING);
public static final Item master_fire_wand = new ItemWand(Tier.MASTER, Element.FIRE);
public static final Item master_ice_wand = new ItemWand(Tier.MASTER, Element.ICE);
public static final Item master_lightning_wand = new ItemWand(Tier.MASTER, Element.LIGHTNING);
public static final Item master_necromancy_wand = new ItemWand(Tier.MASTER, Element.NECROMANCY);
public static final Item master_earth_wand = new ItemWand(Tier.MASTER, Element.EARTH);
public static final Item master_sorcery_wand = new ItemWand(Tier.MASTER, Element.SORCERY);
public static final Item master_healing_wand = new ItemWand(Tier.MASTER, Element.HEALING);
public static final Item spectral_sword = new ItemSpectralSword(ToolMaterial.IRON);
public static final Item spectral_pickaxe = new ItemSpectralPickaxe(ToolMaterial.IRON);
public static final Item spectral_bow = new ItemSpectralBow();
public static final Item mana_flask = new Item(){
@Override
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer entityplayer){
entityplayer.addStat(WizardryAchievements.craft_flask);
}
}.setCreativeTab(WizardryTabs.WIZARDRY);
public static final Item storage_upgrade = new Item().setCreativeTab(WizardryTabs.WIZARDRY);
public static final Item siphon_upgrade = new Item().setCreativeTab(WizardryTabs.WIZARDRY);
public static final Item condenser_upgrade = new Item().setCreativeTab(WizardryTabs.WIZARDRY);
public static final Item range_upgrade = new Item().setCreativeTab(WizardryTabs.WIZARDRY);
public static final Item duration_upgrade = new Item().setCreativeTab(WizardryTabs.WIZARDRY);
public static final Item cooldown_upgrade = new Item().setCreativeTab(WizardryTabs.WIZARDRY);
public static final Item blast_upgrade = new Item().setCreativeTab(WizardryTabs.WIZARDRY);
public static final Item attunement_upgrade = new Item().setCreativeTab(WizardryTabs.WIZARDRY);
public static final Item magic_silk = new Item().setCreativeTab(WizardryTabs.WIZARDRY);
public static final Item.ToolMaterial MAGICAL = EnumHelper.addToolMaterial("MAGICAL", 3, 1000, 8.0f, 4.0f, 0);
public static final Item flaming_axe = new ItemFlamingAxe(MAGICAL);
public static final Item frost_axe = new ItemFrostAxe(MAGICAL);
public static final Item firebomb = new ItemFirebomb();
public static final Item poison_bomb = new ItemPoisonBomb();
public static final Item blank_scroll = new Item().setCreativeTab(WizardryTabs.WIZARDRY);
public static final Item scroll = new ItemScroll().setCreativeTab(WizardryTabs.SPELLS);
// The only way to get these is in dungeon chests (They are legendary, after all. Wizards don't just have them.
// Also if they were sold you could buy four from the same wizard - and that's no fun at all!)
public static final Item armour_upgrade = new ItemArmourUpgrade();
public static final ArmorMaterial SILK = EnumHelper.addArmorMaterial("SILK", "wizardry/textures/armour/wizard_armour",
15, new int[]{2, 5, 4, 2}, 0, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, 0.0F);
// Saw a post somewhere that said you have to put these in the init methods rather than defining them as constants.
// I *think* that's because the post was for a newer Minecraft version, where custom armour has its own renderer or
// something, meaning it would be done a lot like the entity rendering registry in ClientProxy. This is all working
// fine it seems, so I'm not going to fiddle with it, but it might be useful to know if I update versions again.
public static final Item wizard_hat = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.HEAD, null);
public static final Item wizard_robe = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.CHEST, null);
public static final Item wizard_leggings = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.LEGS, null);
public static final Item wizard_boots = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.FEET, null);
public static final Item wizard_hat_fire = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.HEAD, Element.FIRE);
public static final Item wizard_robe_fire = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.CHEST, Element.FIRE);
public static final Item wizard_leggings_fire = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.LEGS, Element.FIRE);
public static final Item wizard_boots_fire = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.FEET, Element.FIRE);
public static final Item wizard_hat_ice = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.HEAD, Element.ICE);
public static final Item wizard_robe_ice = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.CHEST, Element.ICE);
public static final Item wizard_leggings_ice = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.LEGS, Element.ICE);
public static final Item wizard_boots_ice = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.FEET, Element.ICE);
public static final Item wizard_hat_lightning = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.HEAD, Element.LIGHTNING);
public static final Item wizard_robe_lightning = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.CHEST, Element.LIGHTNING);
public static final Item wizard_leggings_lightning = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.LEGS, Element.LIGHTNING);
public static final Item wizard_boots_lightning = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.FEET, Element.LIGHTNING);
public static final Item wizard_hat_necromancy = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.HEAD, Element.NECROMANCY);
public static final Item wizard_robe_necromancy = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.CHEST, Element.NECROMANCY);
public static final Item wizard_leggings_necromancy = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.LEGS, Element.NECROMANCY);
public static final Item wizard_boots_necromancy = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.FEET, Element.NECROMANCY);
public static final Item wizard_hat_earth = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.HEAD, Element.EARTH);
public static final Item wizard_robe_earth = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.CHEST, Element.EARTH);
public static final Item wizard_leggings_earth = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.LEGS, Element.EARTH);
public static final Item wizard_boots_earth = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.FEET, Element.EARTH);
public static final Item wizard_hat_sorcery = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.HEAD, Element.SORCERY);
public static final Item wizard_robe_sorcery = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.CHEST, Element.SORCERY);
public static final Item wizard_leggings_sorcery = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.LEGS, Element.SORCERY);
public static final Item wizard_boots_sorcery = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.FEET, Element.SORCERY);
public static final Item wizard_hat_healing = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.HEAD, Element.HEALING);
public static final Item wizard_robe_healing = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.CHEST, Element.HEALING);
public static final Item wizard_leggings_healing = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.LEGS, Element.HEALING);
public static final Item wizard_boots_healing = new ItemWizardArmour(SILK, 1, EntityEquipmentSlot.FEET, Element.HEALING);
public static final Item spectral_helmet = new ItemSpectralArmour(ArmorMaterial.IRON, 1, EntityEquipmentSlot.HEAD);
public static final Item spectral_chestplate = new ItemSpectralArmour(ArmorMaterial.IRON, 1, EntityEquipmentSlot.CHEST);
public static final Item spectral_leggings = new ItemSpectralArmour(ArmorMaterial.IRON, 1, EntityEquipmentSlot.LEGS);
public static final Item spectral_boots = new ItemSpectralArmour(ArmorMaterial.IRON, 1, EntityEquipmentSlot.FEET);
public static final Item smoke_bomb = new ItemSmokeBomb();
public static final Item identification_scroll = new ItemIdentificationScroll();
public static final Map<Pair<Tier, Element>, Item> WAND_MAP = new HashMap<>();
public static final Map<Pair<EntityEquipmentSlot, Element>, Item> ARMOUR_MAP = new HashMap<>();
static {
WAND_MAP.put(ImmutablePair.of(Tier.BASIC, Element.MAGIC), magic_wand);
WAND_MAP.put(ImmutablePair.of(Tier.BASIC, Element.FIRE), basic_fire_wand);
WAND_MAP.put(ImmutablePair.of(Tier.BASIC, Element.ICE), basic_ice_wand);
WAND_MAP.put(ImmutablePair.of(Tier.BASIC, Element.LIGHTNING), basic_lightning_wand);
WAND_MAP.put(ImmutablePair.of(Tier.BASIC, Element.NECROMANCY), basic_necromancy_wand);
WAND_MAP.put(ImmutablePair.of(Tier.BASIC, Element.EARTH), basic_earth_wand);
WAND_MAP.put(ImmutablePair.of(Tier.BASIC, Element.SORCERY), basic_sorcery_wand);
WAND_MAP.put(ImmutablePair.of(Tier.BASIC, Element.HEALING), basic_healing_wand);
WAND_MAP.put(ImmutablePair.of(Tier.APPRENTICE, Element.MAGIC), apprentice_wand);
WAND_MAP.put(ImmutablePair.of(Tier.APPRENTICE, Element.FIRE), apprentice_fire_wand);
WAND_MAP.put(ImmutablePair.of(Tier.APPRENTICE, Element.ICE), apprentice_ice_wand);
WAND_MAP.put(ImmutablePair.of(Tier.APPRENTICE, Element.LIGHTNING), apprentice_lightning_wand);
WAND_MAP.put(ImmutablePair.of(Tier.APPRENTICE, Element.NECROMANCY), apprentice_necromancy_wand);
WAND_MAP.put(ImmutablePair.of(Tier.APPRENTICE, Element.EARTH), apprentice_earth_wand);
WAND_MAP.put(ImmutablePair.of(Tier.APPRENTICE, Element.SORCERY), apprentice_sorcery_wand);
WAND_MAP.put(ImmutablePair.of(Tier.APPRENTICE, Element.HEALING), apprentice_healing_wand);
WAND_MAP.put(ImmutablePair.of(Tier.ADVANCED, Element.MAGIC), advanced_wand);
WAND_MAP.put(ImmutablePair.of(Tier.ADVANCED, Element.FIRE), advanced_fire_wand);
WAND_MAP.put(ImmutablePair.of(Tier.ADVANCED, Element.ICE), advanced_ice_wand);
WAND_MAP.put(ImmutablePair.of(Tier.ADVANCED, Element.LIGHTNING), advanced_lightning_wand);
WAND_MAP.put(ImmutablePair.of(Tier.ADVANCED, Element.NECROMANCY), advanced_necromancy_wand);
WAND_MAP.put(ImmutablePair.of(Tier.ADVANCED, Element.EARTH), advanced_earth_wand);
WAND_MAP.put(ImmutablePair.of(Tier.ADVANCED, Element.SORCERY), advanced_sorcery_wand);
WAND_MAP.put(ImmutablePair.of(Tier.ADVANCED, Element.HEALING), advanced_healing_wand);
WAND_MAP.put(ImmutablePair.of(Tier.MASTER, Element.MAGIC), master_wand);
WAND_MAP.put(ImmutablePair.of(Tier.MASTER, Element.FIRE), master_fire_wand);
WAND_MAP.put(ImmutablePair.of(Tier.MASTER, Element.ICE), master_ice_wand);
WAND_MAP.put(ImmutablePair.of(Tier.MASTER, Element.LIGHTNING), master_lightning_wand);
WAND_MAP.put(ImmutablePair.of(Tier.MASTER, Element.NECROMANCY), master_necromancy_wand);
WAND_MAP.put(ImmutablePair.of(Tier.MASTER, Element.EARTH), master_earth_wand);
WAND_MAP.put(ImmutablePair.of(Tier.MASTER, Element.SORCERY), master_sorcery_wand);
WAND_MAP.put(ImmutablePair.of(Tier.MASTER, Element.HEALING), master_healing_wand);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.HEAD, Element.MAGIC), wizard_hat);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.HEAD, Element.FIRE), wizard_hat_fire);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.HEAD, Element.ICE), wizard_hat_ice);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.HEAD, Element.LIGHTNING), wizard_hat_lightning);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.HEAD, Element.NECROMANCY), wizard_hat_necromancy);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.HEAD, Element.EARTH), wizard_hat_earth);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.HEAD, Element.SORCERY), wizard_hat_sorcery);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.HEAD, Element.HEALING), wizard_hat_healing);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.CHEST, Element.MAGIC), wizard_robe);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.CHEST, Element.FIRE), wizard_robe_fire);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.CHEST, Element.ICE), wizard_robe_ice);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.CHEST, Element.LIGHTNING), wizard_robe_lightning);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.CHEST, Element.NECROMANCY), wizard_robe_necromancy);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.CHEST, Element.EARTH), wizard_robe_earth);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.CHEST, Element.SORCERY), wizard_robe_sorcery);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.CHEST, Element.HEALING), wizard_robe_healing);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.LEGS, Element.MAGIC), wizard_leggings);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.LEGS, Element.FIRE), wizard_leggings_fire);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.LEGS, Element.ICE), wizard_leggings_ice);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.LEGS, Element.LIGHTNING), wizard_leggings_lightning);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.LEGS, Element.NECROMANCY), wizard_leggings_necromancy);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.LEGS, Element.EARTH), wizard_leggings_earth);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.LEGS, Element.SORCERY), wizard_leggings_sorcery);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.LEGS, Element.HEALING), wizard_leggings_healing);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.FEET, Element.MAGIC), wizard_boots);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.FEET, Element.FIRE), wizard_boots_fire);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.FEET, Element.ICE), wizard_boots_ice);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.FEET, Element.LIGHTNING), wizard_boots_lightning);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.FEET, Element.NECROMANCY), wizard_boots_necromancy);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.FEET, Element.EARTH), wizard_boots_earth);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.FEET, Element.SORCERY), wizard_boots_sorcery);
ARMOUR_MAP.put(ImmutablePair.of(EntityEquipmentSlot.FEET, Element.HEALING), wizard_boots_healing);
}
/**
* Sets both the registry and unlocalised names of the given item, then registers it with the given registry. Use
* this instead of {@link Item#setRegistryName(String)} and {@link Item#setUnlocalizedName(String)} during
* construction, for convenience and consistency.
* @param registry The registry to register the given item to.
* @param item The item to register.
* @param name The name of the item, without the mod ID or the .name stuff. The registry name will be
* {@code wizardry:[name]}. The unlocalised name will be {@code item.wizardry:[name].name}.
*/
public static void registerItem(IForgeRegistry<Item> registry, Item item, String name){
item.setRegistryName(Wizardry.MODID, name);
item.setUnlocalizedName(item.getRegistryName().toString());
registry.register(item);
}
/** Registers an ItemBlock afor the given block, with the same registry name as that block. */
private static void registerItemBlock(IForgeRegistry<Item> registry, Block block){
// We don't need to keep a reference to the ItemBlock, so this can all be done in one line.
registry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
}
@SubscribeEvent
public static void register(RegistryEvent.Register<Item> event){
IForgeRegistry<Item> registry = event.getRegistry();
// ItemBlocks
// Not all blocks need an ItemBlock
registerItemBlock(registry, WizardryBlocks.arcane_workbench);
registerItemBlock(registry, WizardryBlocks.crystal_ore);
registerItemBlock(registry, WizardryBlocks.crystal_flower);
registerItemBlock(registry, WizardryBlocks.transportation_stone);
registerItemBlock(registry, WizardryBlocks.crystal_block);
// Items
registerItem(registry, magic_crystal, "magic_crystal");
registerItem(registry, magic_wand, "magic_wand");
registerItem(registry, apprentice_wand, "apprentice_wand");
registerItem(registry, advanced_wand, "advanced_wand");
registerItem(registry, master_wand, "master_wand");
registerItem(registry, spell_book, "spell_book");
registerItem(registry, arcane_tome, "arcane_tome");
registerItem(registry, wizard_handbook, "wizard_handbook");
registerItem(registry, basic_fire_wand, "basic_fire_wand");
registerItem(registry, basic_ice_wand, "basic_ice_wand");
registerItem(registry, basic_lightning_wand, "basic_lightning_wand");
registerItem(registry, basic_necromancy_wand, "basic_necromancy_wand");
registerItem(registry, basic_earth_wand, "basic_earth_wand");
registerItem(registry, basic_sorcery_wand, "basic_sorcery_wand");
registerItem(registry, basic_healing_wand, "basic_healing_wand");
registerItem(registry, apprentice_fire_wand, "apprentice_fire_wand");
registerItem(registry, apprentice_ice_wand, "apprentice_ice_wand");
registerItem(registry, apprentice_lightning_wand, "apprentice_lightning_wand");
registerItem(registry, apprentice_necromancy_wand, "apprentice_necromancy_wand");
registerItem(registry, apprentice_earth_wand, "apprentice_earth_wand");
registerItem(registry, apprentice_sorcery_wand, "apprentice_sorcery_wand");
registerItem(registry, apprentice_healing_wand, "apprentice_healing_wand");
registerItem(registry, advanced_fire_wand, "advanced_fire_wand");
registerItem(registry, advanced_ice_wand, "advanced_ice_wand");
registerItem(registry, advanced_lightning_wand, "advanced_lightning_wand");
registerItem(registry, advanced_necromancy_wand, "advanced_necromancy_wand");
registerItem(registry, advanced_earth_wand, "advanced_earth_wand");
registerItem(registry, advanced_sorcery_wand, "advanced_sorcery_wand");
registerItem(registry, advanced_healing_wand, "advanced_healing_wand");
registerItem(registry, master_fire_wand, "master_fire_wand");
registerItem(registry, master_ice_wand, "master_ice_wand");
registerItem(registry, master_lightning_wand, "master_lightning_wand");
registerItem(registry, master_necromancy_wand, "master_necromancy_wand");
registerItem(registry, master_earth_wand, "master_earth_wand");
registerItem(registry, master_sorcery_wand, "master_sorcery_wand");
registerItem(registry, master_healing_wand, "master_healing_wand");
registerItem(registry, spectral_sword, "spectral_sword");
registerItem(registry, spectral_pickaxe, "spectral_pickaxe");
registerItem(registry, spectral_bow, "spectral_bow");
registerItem(registry, mana_flask, "mana_flask");
registerItem(registry, storage_upgrade, "storage_upgrade");
registerItem(registry, siphon_upgrade, "siphon_upgrade");
registerItem(registry, condenser_upgrade, "condenser_upgrade");
registerItem(registry, range_upgrade, "range_upgrade");
registerItem(registry, duration_upgrade, "duration_upgrade");
registerItem(registry, cooldown_upgrade, "cooldown_upgrade");
registerItem(registry, blast_upgrade, "blast_upgrade");
registerItem(registry, attunement_upgrade, "attunement_upgrade");
registerItem(registry, flaming_axe, "flaming_axe");
registerItem(registry, frost_axe, "frost_axe");
registerItem(registry, firebomb, "firebomb");
registerItem(registry, poison_bomb, "poison_bomb");
registerItem(registry, blank_scroll, "blank_scroll");
registerItem(registry, scroll, "scroll");
registerItem(registry, armour_upgrade, "armour_upgrade");
registerItem(registry, magic_silk, "magic_silk");
registerItem(registry, wizard_hat, "wizard_hat");
registerItem(registry, wizard_robe, "wizard_robe");
registerItem(registry, wizard_leggings, "wizard_leggings");
registerItem(registry, wizard_boots, "wizard_boots");
registerItem(registry, wizard_hat_fire, "wizard_hat_fire");
registerItem(registry, wizard_robe_fire, "wizard_robe_fire");
registerItem(registry, wizard_leggings_fire, "wizard_leggings_fire");
registerItem(registry, wizard_boots_fire, "wizard_boots_fire");
registerItem(registry, wizard_hat_ice, "wizard_hat_ice");
registerItem(registry, wizard_robe_ice, "wizard_robe_ice");
registerItem(registry, wizard_leggings_ice, "wizard_leggings_ice");
registerItem(registry, wizard_boots_ice, "wizard_boots_ice");
registerItem(registry, wizard_hat_lightning, "wizard_hat_lightning");
registerItem(registry, wizard_robe_lightning, "wizard_robe_lightning");
registerItem(registry, wizard_leggings_lightning, "wizard_leggings_lightning");
registerItem(registry, wizard_boots_lightning, "wizard_boots_lightning");
registerItem(registry, wizard_hat_necromancy, "wizard_hat_necromancy");
registerItem(registry, wizard_robe_necromancy, "wizard_robe_necromancy");
registerItem(registry, wizard_leggings_necromancy, "wizard_leggings_necromancy");
registerItem(registry, wizard_boots_necromancy, "wizard_boots_necromancy");
registerItem(registry, wizard_hat_earth, "wizard_hat_earth");
registerItem(registry, wizard_robe_earth, "wizard_robe_earth");
registerItem(registry, wizard_leggings_earth, "wizard_leggings_earth");
registerItem(registry, wizard_boots_earth, "wizard_boots_earth");
registerItem(registry, wizard_hat_sorcery, "wizard_hat_sorcery");
registerItem(registry, wizard_robe_sorcery, "wizard_robe_sorcery");
registerItem(registry, wizard_leggings_sorcery, "wizard_leggings_sorcery");
registerItem(registry, wizard_boots_sorcery, "wizard_boots_sorcery");
registerItem(registry, wizard_hat_healing, "wizard_hat_healing");
registerItem(registry, wizard_robe_healing, "wizard_robe_healing");
registerItem(registry, wizard_leggings_healing, "wizard_leggings_healing");
registerItem(registry, wizard_boots_healing, "wizard_boots_healing");
registerItem(registry, spectral_helmet, "spectral_helmet");
registerItem(registry, spectral_chestplate, "spectral_chestplate");
registerItem(registry, spectral_leggings, "spectral_leggings");
registerItem(registry, spectral_boots, "spectral_boots");
registerItem(registry, smoke_bomb, "smoke_bomb");
registerItem(registry, identification_scroll, "identification_scroll");
}
}
@@ -0,0 +1,113 @@
package electroblob.wizardry.registry;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.potion.PotionDecay;
import electroblob.wizardry.potion.PotionFrost;
import electroblob.wizardry.potion.PotionMagicEffect;
import electroblob.wizardry.potion.PotionMagicEffectParticles;
import electroblob.wizardry.util.WizardryParticleType;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.World;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.IForgeRegistry;
/**
* Class responsible for defining, storing and registering all of wizardry's potion effects.
* @author Electroblob
* @since Wizardry 2.1
*/
@Mod.EventBusSubscriber
public final class WizardryPotions {
/* Interestingly, setting the colour to black stops the particles from rendering. This is great, however, the black
* colour then 'mixes' with other potions that are applied. Whilst this is a bit annoying, for the amount it is
* likely to get noticed it is certainly preferable to always making showParticles false, because now I can give
* the user the option (via commands) of having one of my potion effects without particles, and more importantly
* the potion effect HUD still gets displayed. TODO: Backport to 1.7.10, assuming it also works in that version.
* This means also changing whenever the potion effect is added such that it is NOT ambient. */
public static final Potion frost = new PotionFrost(true, 0); // Colour was 0x38ddec (was arbitrary anyway)
public static final Potion transience = new PotionMagicEffectParticles(false, 0, 0){
@Override
public void spawnCustomParticle(World world, double x, double y, double z){
Wizardry.proxy.spawnParticle(WizardryParticleType.DUST, world, x, y, z, 0, 0, 0, (int)(16.0D / (Math.random() * 0.8D + 0.2D)), 0.8f, 0.8f, 1.0f);
}
}.setBeneficial(); //0xffe89b
public static final Potion fireskin = new PotionMagicEffectParticles(false, 0, 1){
@Override
public void spawnCustomParticle(World world, double x, double y, double z){
world.spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0, 0, 0);
}
@Override
public void performEffect(EntityLivingBase entitylivingbase, int strength){
entitylivingbase.extinguish(); // Stops melee mobs that are on fire from setting the player on fire,
// without allowing the player to actually stand in fire or swim in lava without taking damage.
};
}.setBeneficial(); //0xff2f02
public static final Potion ice_shroud = new PotionMagicEffectParticles(false, 0, 2){
@Override
public void spawnCustomParticle(World world, double x, double y, double z){
float brightness = 0.5f + (world.rand.nextFloat()/2);
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, x, y, z, 0, 0, 0, 48 + world.rand.nextInt(12), brightness, brightness + 0.1f, 1.0f, true, 0);
Wizardry.proxy.spawnParticle(WizardryParticleType.SNOW, world, x, y, z, 0, -0.02, 0, 40 + world.rand.nextInt(10));
}
}.setBeneficial(); //0x52f1ff
public static final Potion static_aura = new PotionMagicEffectParticles(false, 0, 3){
@Override
public void spawnCustomParticle(World world, double x, double y, double z){
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world, x, y, z, 0, 0, 0, 3);
}
}.setBeneficial(); //0x0070ff
public static final Potion decay = new PotionDecay(true, 0x3c006c);
public static final Potion sixth_sense = new PotionMagicEffect(false, 0xc6ff01, 4).setBeneficial();
public static final Potion arcane_jammer = new PotionMagicEffect(false, 0xcf4aa2, 5);
public static final Potion mind_trick = new PotionMagicEffect(true, 0x601683, 6);
public static final Potion mind_control = new PotionMagicEffect(true, 0x320b44, 7);
public static final Potion font_of_mana = new PotionMagicEffect(false, 0xffe5bb, 8).setBeneficial();
public static final Potion fear = new PotionMagicEffect(true, 0xbd0100, 9);
/**
* Sets both the registry and unlocalised names of the given potion, then registers it with the given registry. Use
* this instead of {@link potion#setRegistryName(String)} and {@link potion#setUnlocalizedName(String)} during
* construction, for convenience and consistency.
* @param registry The registry to register the given potion to.
* @param potion The potion to register.
* @param name The name of the potion, without the mod ID or the .name stuff. The registry name will be
* {@code wizardry:[name]}. The unlocalised name will be {@code potion.wizardry:[name].name}.
*/
public static void registerPotion(IForgeRegistry<Potion> registry, Potion potion, String name){
potion.setRegistryName(Wizardry.MODID, name);
// For some reason, Potion#getName() doesn't prepend "potion." itself, so it has to be done here.
potion.setPotionName("potion." + potion.getRegistryName().toString());
registry.register(potion);
}
@SubscribeEvent
public static void register(RegistryEvent.Register<Potion> event){
IForgeRegistry<Potion> registry = event.getRegistry();
registerPotion(registry, frost, "frost");
registerPotion(registry, transience, "transience");
registerPotion(registry, fireskin, "fireskin");
registerPotion(registry, ice_shroud, "ice_shroud");
registerPotion(registry, static_aura, "static_aura");
registerPotion(registry, decay, "decay");
registerPotion(registry, sixth_sense, "sixth_sense");
registerPotion(registry, arcane_jammer, "arcane_jammer");
registerPotion(registry, mind_trick, "mind_trick");
registerPotion(registry, mind_control, "mind_control");
registerPotion(registry, font_of_mana, "font_of_mana");
registerPotion(registry, fear, "fear");
}
}
@@ -0,0 +1,320 @@
package electroblob.wizardry.registry;
import java.util.ArrayList;
import java.util.List;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.constants.Element;
import electroblob.wizardry.constants.Tier;
import electroblob.wizardry.entity.EntityArc;
import electroblob.wizardry.entity.EntityMeteor;
import electroblob.wizardry.entity.EntityShield;
import electroblob.wizardry.entity.construct.EntityArrowRain;
import electroblob.wizardry.entity.construct.EntityBlackHole;
import electroblob.wizardry.entity.construct.EntityBlizzard;
import electroblob.wizardry.entity.construct.EntityBubble;
import electroblob.wizardry.entity.construct.EntityDecay;
import electroblob.wizardry.entity.construct.EntityEarthquake;
import electroblob.wizardry.entity.construct.EntityFireRing;
import electroblob.wizardry.entity.construct.EntityFireSigil;
import electroblob.wizardry.entity.construct.EntityForcefield;
import electroblob.wizardry.entity.construct.EntityFrostSigil;
import electroblob.wizardry.entity.construct.EntityHailstorm;
import electroblob.wizardry.entity.construct.EntityHammer;
import electroblob.wizardry.entity.construct.EntityHealAura;
import electroblob.wizardry.entity.construct.EntityIceSpike;
import electroblob.wizardry.entity.construct.EntityLightningPulse;
import electroblob.wizardry.entity.construct.EntityLightningSigil;
import electroblob.wizardry.entity.construct.EntityTornado;
import electroblob.wizardry.entity.living.EntityBlazeMinion;
import electroblob.wizardry.entity.living.EntityDecoy;
import electroblob.wizardry.entity.living.EntityEvilWizard;
import electroblob.wizardry.entity.living.EntityIceGiant;
import electroblob.wizardry.entity.living.EntityIceWraith;
import electroblob.wizardry.entity.living.EntityLightningWraith;
import electroblob.wizardry.entity.living.EntityMagicSlime;
import electroblob.wizardry.entity.living.EntityPhoenix;
import electroblob.wizardry.entity.living.EntityShadowWraith;
import electroblob.wizardry.entity.living.EntitySilverfishMinion;
import electroblob.wizardry.entity.living.EntitySkeletonMinion;
import electroblob.wizardry.entity.living.EntitySpiderMinion;
import electroblob.wizardry.entity.living.EntitySpiritHorse;
import electroblob.wizardry.entity.living.EntitySpiritWolf;
import electroblob.wizardry.entity.living.EntityStormElemental;
import electroblob.wizardry.entity.living.EntityWizard;
import electroblob.wizardry.entity.living.EntityZombieMinion;
import electroblob.wizardry.entity.projectile.EntityDarknessOrb;
import electroblob.wizardry.entity.projectile.EntityDart;
import electroblob.wizardry.entity.projectile.EntityFirebolt;
import electroblob.wizardry.entity.projectile.EntityFirebomb;
import electroblob.wizardry.entity.projectile.EntityForceArrow;
import electroblob.wizardry.entity.projectile.EntityForceOrb;
import electroblob.wizardry.entity.projectile.EntityIceCharge;
import electroblob.wizardry.entity.projectile.EntityIceLance;
import electroblob.wizardry.entity.projectile.EntityIceShard;
import electroblob.wizardry.entity.projectile.EntityLightningArrow;
import electroblob.wizardry.entity.projectile.EntityLightningDisc;
import electroblob.wizardry.entity.projectile.EntityMagicMissile;
import electroblob.wizardry.entity.projectile.EntityPoisonBomb;
import electroblob.wizardry.entity.projectile.EntitySmokeBomb;
import electroblob.wizardry.entity.projectile.EntitySpark;
import electroblob.wizardry.entity.projectile.EntitySparkBomb;
import electroblob.wizardry.entity.projectile.EntityThunderbolt;
import electroblob.wizardry.loot.RandomSpell;
import electroblob.wizardry.loot.WizardSpell;
import electroblob.wizardry.tileentity.TileEntityArcaneWorkbench;
import electroblob.wizardry.tileentity.TileEntityMagicLight;
import electroblob.wizardry.tileentity.TileEntityPlayerSave;
import electroblob.wizardry.tileentity.TileEntityStatue;
import electroblob.wizardry.tileentity.TileEntityTimer;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Biomes;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.storage.loot.LootTableList;
import net.minecraft.world.storage.loot.functions.LootFunctionManager;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
/**
* Class responsible for registering all the things that don't have (or need) instances: entities, loot tables,
* recipes, etc.
* @author Electroblob
* @since Wizardry 1.0
*/
public final class WizardryRegistry {
// NOTE: In 1.12, recipes have a registry (they can still stay here though since we don't keep references to them)
/** Called from the preInit method in the main mod class to register the custom dungeon loot. */
public static void registerLoot(){
/* Loot tables work as follows:
* Minecraft goes through each pool in turn. For each pool, it does a certain number or rolls, which can either
* be set to always be one number or a random number from a range. Each roll, it generates one stack of a single
* random entry in that pool, weighted according to the weights of the entries. Functions allow properties of
* that stack (stack size, damage, nbt) to be set, and even allow it to be replaced dynamically with a
* completely different item (though there's very little point in doing that as it could be achieved just as
* easily with more entries, which makes me think it would be bad practice).
* You can also use conditions to control whether an entry or pool is used at all, which is mostly for mob drops
* under specific conditions, but one of them is simply a random chance, meaning you could use it to make a pool
* that only gets rolled sometimes.
* All in all, this can get rather confusing, because stackable items can have 5 stages of randomness applied
* to them at once: a random chance for the pool, a random number of rolls for the pool, the weighted random
* chance of choosing that particular entry, a random chance for that entry, and a random stack size, and that's
* before you take functions into account.
*
* ...oh, and entries can be entire loot tables in themselves, allowing for potentially infinite levels of
* randomness. Yeah.
*
* Translating to the new system:
* ChestGenHooks.SOME_NAME -> loot table json file
* ??? -> loot pool (I don't think it was split up like this before)
* ChestGenHooks.addItem() -> entry in a loot pool
* Stack sizes in WeightedRandomChestContent -> set_count function for entries
* Weight in WeightedRandomChestContent -> weight of entries
* Custom WeightedRandomChestContent implementations -> custom loot functions, but only for complex/dynamic
* stuff - things that serve to allow the chance for a category of items (like armour) to be specified but still
* have a random chance for which exact item you get should be done with nested loot tables.
*/
// Always registers the loot tables, but only injects the additions into vanilla if the appropriate option is
// enabled in the config (see WizardryEventHandler).
LootFunctionManager.registerFunction(new RandomSpell.Serializer());
LootFunctionManager.registerFunction(new WizardSpell.Serializer());
LootTableList.register(new ResourceLocation(Wizardry.MODID, "chests/wizard_tower"));
LootTableList.register(new ResourceLocation(Wizardry.MODID, "chests/dungeon_additions"));
LootTableList.register(new ResourceLocation(Wizardry.MODID, "subsets/novice_wands"));
LootTableList.register(new ResourceLocation(Wizardry.MODID, "subsets/wizard_armour"));
LootTableList.register(new ResourceLocation(Wizardry.MODID, "subsets/arcane_tomes"));
LootTableList.register(new ResourceLocation(Wizardry.MODID, "subsets/wand_upgrades"));
LootTableList.register(new ResourceLocation(Wizardry.MODID, "entities/evil_wizard"));
// TODO: At the moment this is not used anywhere because I can't find a way to add it to all mobs.
//LootTableList.register(new ResourceLocation(Wizardry.MODID, "entities/mob_additions"));
}
/** Called from the preInit method in the main mod class to register all the tile entities. */
public static void registerTileEntities(){
GameRegistry.registerTileEntity(TileEntityArcaneWorkbench.class, Wizardry.MODID + "ArcaneWorkbenchTileEntity");
GameRegistry.registerTileEntity(TileEntityStatue.class, Wizardry.MODID + "PetrifiedStoneTileEntity");
GameRegistry.registerTileEntity(TileEntityMagicLight.class, Wizardry.MODID + "MagicLightTileEntity");
GameRegistry.registerTileEntity(TileEntityTimer.class, Wizardry.MODID + "TimerTileEntity");
GameRegistry.registerTileEntity(TileEntityPlayerSave.class, Wizardry.MODID + "TileEntityPlayerSave");
}
/** Not actually the frequency at all; smaller numbers are more frequent. Vanilla uses 3 I think. */
private static final int LIVING_UPDATE_INTERVAL = 3;
/** Not actually the frequency at all; smaller numbers are more frequent. */
private static final int PROJECTILE_UPDATE_INTERVAL = 10;
/** Called from the preInit method in the main mod class to register all the entities. */
public static void registerEntities(Wizardry wizardry){
int id = 0; // Incrementable index for the mod specific entity id.
EntityRegistry.registerModEntity(EntityZombieMinion.class, "zombie_minion", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityMagicMissile.class, "magic_missile", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
// TODO: This should be a particle
EntityRegistry.registerModEntity(EntityArc.class, "arc", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(EntitySkeletonMinion.class, "skeleton_minion", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntitySparkBomb.class, "spark_bomb", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntitySpiritWolf.class, "spirit_wolf", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityIceShard.class, "ice_shard", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityBlazeMinion.class, "blaze_minion", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityIceWraith.class, "ice_wraith", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityLightningWraith.class, "lightning_wraith", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityBlackHole.class, "black_hole", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(EntityShield.class, "shield", id++, wizardry, 128, 1, true);
EntityRegistry.registerModEntity(EntityMeteor.class, "meteor", id++, wizardry, 128, 5, true);
EntityRegistry.registerModEntity(EntityBlizzard.class, "blizzard", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(EntityWizard.class, "wizard", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityBubble.class, "bubble", id++, wizardry, 128, 3, false);
EntityRegistry.registerModEntity(EntityTornado.class, "tornado", id++, wizardry, 128, 1, false);
EntityRegistry.registerModEntity(EntityHammer.class, "lightning_hammer", id++, wizardry, 128, 1, true);
EntityRegistry.registerModEntity(EntityFirebomb.class, "firebomb", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityForceOrb.class, "force_orb", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityArrowRain.class, "arrow_rain", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(EntitySpark.class, "spark", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityShadowWraith.class, "shadow_wraith", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityDarknessOrb.class, "darkness_orb", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntitySpiderMinion.class, "spider_minion", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityHealAura.class, "healing_aura", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(EntityFireSigil.class, "fire_sigil", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(EntityFrostSigil.class, "frost_sigil", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(EntityLightningSigil.class, "lightning_sigil", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(EntityLightningArrow.class, "lightning_arrow", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityFirebolt.class, "firebolt", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityPoisonBomb.class, "poison_bomb", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityIceCharge.class, "ice_charge", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityForceArrow.class, "force_arrow", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityDart.class, "dart", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityMagicSlime.class, "magic_slime", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityForcefield.class, "forcefield", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(EntityFireRing.class, "ring_of_fire", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(EntityLightningDisc.class, "lightning_disc", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityThunderbolt.class, "thunderbolt", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityIceGiant.class, "ice_giant", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntitySpiritHorse.class, "spirit_horse", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityPhoenix.class, "phoenix", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntitySilverfishMinion.class, "silverfish_minion", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityDecay.class, "decay", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(EntityStormElemental.class, "storm_elemental", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityEarthquake.class, "earthquake", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(EntityIceLance.class, "ice_lance", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityHailstorm.class, "hailstorm", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(EntitySmokeBomb.class, "smoke_bomb", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityEvilWizard.class, "evil_wizard", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityDecoy.class, "decoy", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(EntityIceSpike.class, "ice_spike", id++, wizardry, 128, 1, true);
// TODO: This should be a particle.
EntityRegistry.registerModEntity(EntityLightningPulse.class, "lightning_pulse", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerEgg(EntityWizard.class, 0x19295e, 0xee9312);
EntityRegistry.registerEgg(EntityEvilWizard.class, 0x290404, 0xee9312);
// TODO: May need fixing
List<Biome> biomes = new ArrayList<Biome>();
for(Biome biome : Biome.EXPLORATION_BIOMES_LIST){
if(biome != null){
biomes.add(biome);
}
}
biomes.remove(Biomes.MUSHROOM_ISLAND);
biomes.remove(Biomes.MUSHROOM_ISLAND_SHORE);
// For reference: 5, 1, 1 are the parameters for the witch in vanilla.
EntityRegistry.addSpawn(EntityEvilWizard.class, 3, 1, 1, EnumCreatureType.MONSTER, biomes.toArray(new Biome[biomes.size()]));
}
/** Called from the init method in the main mod class to register all the recipes. */
public static void registerRecipes(){
ItemStack magicCrystalStack = new ItemStack(WizardryItems.magic_crystal);
ItemStack magicWandStack = new ItemStack(WizardryItems.magic_wand, 1, Tier.BASIC.maxCharge);
ItemStack goldNuggetStack = new ItemStack(Items.GOLD_NUGGET);
ItemStack stickStack = new ItemStack(Items.STICK);
ItemStack bookStack = new ItemStack(Items.BOOK);
ItemStack stringStack = new ItemStack(Items.STRING);
ItemStack spellBookStack = new ItemStack(WizardryItems.spell_book, 1, Spells.magic_missile.id());
ItemStack arcaneWorkbenchStack = new ItemStack(WizardryBlocks.arcane_workbench);
ItemStack stoneStack = new ItemStack(Blocks.STONE);
ItemStack lapisBlockStack = new ItemStack(Blocks.LAPIS_BLOCK);
ItemStack purpleCarpetStack = new ItemStack(Blocks.CARPET, 1, 10);
ItemStack wizardHandbookStack = new ItemStack(WizardryItems.wizard_handbook);
ItemStack crystalFlowerStack = new ItemStack(WizardryBlocks.crystal_flower);
ItemStack magicCrystalStack1 = new ItemStack(WizardryItems.magic_crystal, 2);
ItemStack magicCrystalStack2 = new ItemStack(WizardryItems.magic_crystal, 9);
ItemStack crystalBlockStack = new ItemStack(WizardryBlocks.crystal_block);
ItemStack manaFlaskStack = new ItemStack(WizardryItems.mana_flask);
ItemStack bottleStack = new ItemStack(Items.GLASS_BOTTLE);
ItemStack gunpowderStack = new ItemStack(Items.GUNPOWDER);
ItemStack blazePowderStack = new ItemStack(Items.BLAZE_POWDER);
ItemStack spiderEyeStack = new ItemStack(Items.SPIDER_EYE);
// Coal or charcoal is equally fine, hence the wildcard value
ItemStack coalStack = new ItemStack(Items.COAL, 1, OreDictionary.WILDCARD_VALUE);
ItemStack firebombStack = new ItemStack(WizardryItems.firebomb, 3);
ItemStack poisonBombStack = new ItemStack(WizardryItems.poison_bomb, 3);
ItemStack smokeBombStack = new ItemStack(WizardryItems.smoke_bomb, 3);
ItemStack transportationStoneStack = new ItemStack(WizardryBlocks.transportation_stone, 2);
ItemStack silkStack = new ItemStack(WizardryItems.magic_silk);
ItemStack silkStack1 = new ItemStack(WizardryItems.magic_silk, 2);
ItemStack hatStack = new ItemStack(WizardryItems.wizard_hat);
ItemStack robeStack = new ItemStack(WizardryItems.wizard_robe);
ItemStack leggingsStack = new ItemStack(WizardryItems.wizard_leggings);
ItemStack bootsStack = new ItemStack(WizardryItems.wizard_boots);
ItemStack scrollStack = new ItemStack(WizardryItems.blank_scroll);
ItemStack paperStack = new ItemStack(Items.PAPER);
GameRegistry.addRecipe(magicWandStack, " x", " y ", "z ", 'x', magicCrystalStack, 'y', stickStack, 'z', goldNuggetStack);
GameRegistry.addRecipe(spellBookStack, " x ", "xyx", " x ", 'x', magicCrystalStack, 'y', bookStack);
GameRegistry.addRecipe(arcaneWorkbenchStack, "vwv", "xyx", "zzz", 'v', goldNuggetStack, 'w', purpleCarpetStack, 'x', magicCrystalStack, 'y', lapisBlockStack, 'z', stoneStack);
GameRegistry.addRecipe(manaFlaskStack, "yyy", "yxy", "yyy", 'x', bottleStack, 'y', magicCrystalStack);
GameRegistry.addRecipe(transportationStoneStack, " x ", "xyx", " x ", 'x', stoneStack, 'y', magicCrystalStack);
GameRegistry.addRecipe(hatStack, "yyy", "y y", 'y', silkStack);
GameRegistry.addRecipe(robeStack, "y y", "yyy", "yyy", 'y', silkStack);
GameRegistry.addRecipe(leggingsStack, "yyy", "y y", "y y", 'y', silkStack);
GameRegistry.addRecipe(bootsStack, "y y", "y y", 'y', silkStack);
GameRegistry.addRecipe(silkStack1, " x ", "xyx", " x ", 'x', stringStack, 'y', magicCrystalStack);
GameRegistry.addRecipe(crystalBlockStack, "zzz", "zzz", "zzz", 'z', magicCrystalStack);
GameRegistry.addShapelessRecipe(wizardHandbookStack, bookStack, magicCrystalStack);
GameRegistry.addShapelessRecipe(magicCrystalStack1, crystalFlowerStack);
GameRegistry.addShapelessRecipe(magicCrystalStack2, crystalBlockStack);
if(Wizardry.settings.firebombIsCraftable) GameRegistry.addShapelessRecipe(firebombStack, bottleStack, gunpowderStack, blazePowderStack, blazePowderStack);
if(Wizardry.settings.poisonBombIsCraftable) GameRegistry.addShapelessRecipe(poisonBombStack, bottleStack, gunpowderStack, spiderEyeStack, spiderEyeStack);
if(Wizardry.settings.smokeBombIsCraftable) GameRegistry.addShapelessRecipe(smokeBombStack, bottleStack, gunpowderStack, coalStack, coalStack);
if(Wizardry.settings.useAlternateScrollRecipe){
GameRegistry.addShapelessRecipe(scrollStack, paperStack, stringStack, magicCrystalStack);
}else{
GameRegistry.addShapelessRecipe(scrollStack, paperStack, stringStack);
}
// Mana flask recipes
ItemStack miscWandStack;
for(Element element : Element.values()){
for(Tier tier : Tier.values()){
miscWandStack = new ItemStack(WizardryUtilities.getWand(tier, element), 1, OreDictionary.WILDCARD_VALUE);
GameRegistry.addShapelessRecipe(miscWandStack, miscWandStack, manaFlaskStack);
}
}
ItemStack miscArmourStack;
for(Element element : Element.values()){
for(EntityEquipmentSlot slot : WizardryUtilities.ARMOUR_SLOTS){
miscArmourStack = new ItemStack(WizardryUtilities.getArmour(element, slot), 1, OreDictionary.WILDCARD_VALUE);
GameRegistry.addShapelessRecipe(miscArmourStack, miscArmourStack, manaFlaskStack);
}
}
}
}
@@ -0,0 +1,68 @@
package electroblob.wizardry.registry;
import electroblob.wizardry.Wizardry;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
/**
* Class responsible for defining, storing and registering all of wizardry's sound events. For some reason, these
* worked in the beta versions despite not being registered...
* @author Electroblob
* @since Wizardry 2.1
*/
@Mod.EventBusSubscriber
public final class WizardrySounds {
// Anything with LOOP in its name is intended to be played in a continuous loop.
public static final SoundEvent SPELL_SPARK = createSound("arc");
public static final SoundEvent SPELL_CONJURATION = createSound("aura");
public static final SoundEvent SPELL_SHOCKWAVE = createSound("boom");
public static final SoundEvent SPELL_LOOP_CRACKLE = createSound("crackle");
public static final SoundEvent SPELL_SUMMONING = createSound("darkaura");
public static final SoundEvent SPELL_DEFLECTION = createSound("effect");
public static final SoundEvent SPELL_LIGHTNING = createSound("electricitya");
public static final SoundEvent SPELL_LOOP_LIGHTNING = createSound("electricityb");
public static final SoundEvent SPELL_LOOP_FIRE = createSound("flameray");
public static final SoundEvent SPELL_FREEZE = createSound("freeze");
public static final SoundEvent SPELL_LOOP_ICE = createSound("frostray");
public static final SoundEvent SPELL_HEAL = createSound("heal");
public static final SoundEvent SPELL_ICE = createSound("ice");
public static final SoundEvent SPELL_CONJURATION_LARGE = createSound("largeaura");
public static final SoundEvent SPELL_MAGIC = createSound("magic");
public static final SoundEvent SPELL_LOOP_SPARKLE = createSound("sparkle");
public static final SoundEvent SPELL_LOOP_WIND = createSound("wind");
public static final SoundEvent SPELL_EARTHQUAKE = createSound("rumble");
public static final SoundEvent SPELL_FORCE = createSound("force");
/** Trick borrowed from the Twilight Forest, makes things neater. */
public static SoundEvent createSound(String name){
// All the setRegistryName methods delegate to this one, it doesn't matter which you use.
return new SoundEvent(new ResourceLocation(Wizardry.MODID, name)).setRegistryName(name);
}
@SubscribeEvent
public static void register(RegistryEvent.Register<SoundEvent> event){
event.getRegistry().register(SPELL_SPARK);
event.getRegistry().register(SPELL_CONJURATION);
event.getRegistry().register(SPELL_SHOCKWAVE);
event.getRegistry().register(SPELL_LOOP_CRACKLE);
event.getRegistry().register(SPELL_SUMMONING);
event.getRegistry().register(SPELL_DEFLECTION);
event.getRegistry().register(SPELL_LIGHTNING);
event.getRegistry().register(SPELL_LOOP_LIGHTNING);
event.getRegistry().register(SPELL_LOOP_FIRE);
event.getRegistry().register(SPELL_FREEZE);
event.getRegistry().register(SPELL_LOOP_ICE);
event.getRegistry().register(SPELL_HEAL);
event.getRegistry().register(SPELL_ICE);
event.getRegistry().register(SPELL_CONJURATION_LARGE);
event.getRegistry().register(SPELL_MAGIC);
event.getRegistry().register(SPELL_LOOP_SPARKLE);
event.getRegistry().register(SPELL_LOOP_WIND);
event.getRegistry().register(SPELL_EARTHQUAKE);
event.getRegistry().register(SPELL_FORCE);
}
}
@@ -0,0 +1,175 @@
package electroblob.wizardry.registry;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import com.google.common.base.Function;
import com.google.common.collect.Ordering;
import electroblob.wizardry.item.ItemScroll;
import electroblob.wizardry.item.ItemSpellBook;
import electroblob.wizardry.spell.Spell;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* Class responsible for defining and storing all of wizardry's creative tabs. Also handles sorting of the items.
* @author Electroblob
* @since Wizardry 2.1
*/
public final class WizardryTabs {
private static Comparator<ItemStack> itemSorter;
private static Comparator<ItemStack> spellItemSorter;
// Creative Tabs
public static final CreativeTabs WIZARDRY = new CreativeTabs("wizardry"){
@Override
@SideOnly(Side.CLIENT)
public Item getTabIconItem() {
return WizardryItems.wizard_handbook;
}
@Override
@SideOnly(Side.CLIENT)
public void displayAllRelevantItems(List<ItemStack> items) {
super.displayAllRelevantItems(items);
Collections.sort(items, itemSorter);
}
};
public static final CreativeTabs SPELLS = new CreativeTabs("wizardryspells"){
@Override
@SideOnly(Side.CLIENT)
public Item getTabIconItem() {
return WizardryItems.spell_book;
}
@Override
@SideOnly(Side.CLIENT)
public void displayAllRelevantItems(List<ItemStack> items) {
super.displayAllRelevantItems(items);
Collections.sort(items, spellItemSorter);
}
@Override
public boolean hasSearchBar() {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public String getBackgroundImageName() {
return "item_search.png";
}
};
/** Initialises the item sorters for the creative tabs. */
public static void sort(){
List<Item> orderedItemList = Arrays.asList(
Item.getItemFromBlock(WizardryBlocks.arcane_workbench),
Item.getItemFromBlock(WizardryBlocks.crystal_ore),
Item.getItemFromBlock(WizardryBlocks.crystal_block),
Item.getItemFromBlock(WizardryBlocks.crystal_flower),
Item.getItemFromBlock(WizardryBlocks.transportation_stone),
WizardryItems.magic_crystal,
WizardryItems.magic_wand,
WizardryItems.apprentice_wand,
WizardryItems.advanced_wand,
WizardryItems.master_wand,
WizardryItems.arcane_tome,
WizardryItems.wizard_handbook,
WizardryItems.basic_fire_wand,
WizardryItems.basic_ice_wand,
WizardryItems.basic_lightning_wand,
WizardryItems.basic_necromancy_wand,
WizardryItems.basic_earth_wand,
WizardryItems.basic_sorcery_wand,
WizardryItems.basic_healing_wand,
WizardryItems.smoke_bomb,
WizardryItems.firebomb,
WizardryItems.poison_bomb,
WizardryItems.blank_scroll,
WizardryItems.identification_scroll,
WizardryItems.mana_flask,
WizardryItems.storage_upgrade,
WizardryItems.siphon_upgrade,
WizardryItems.condenser_upgrade,
WizardryItems.range_upgrade,
WizardryItems.duration_upgrade,
WizardryItems.cooldown_upgrade,
WizardryItems.blast_upgrade,
WizardryItems.attunement_upgrade,
WizardryItems.magic_silk,
WizardryItems.armour_upgrade,
WizardryItems.wizard_hat,
WizardryItems.wizard_robe,
WizardryItems.wizard_leggings,
WizardryItems.wizard_boots,
WizardryItems.wizard_hat_fire,
WizardryItems.wizard_robe_fire,
WizardryItems.wizard_leggings_fire,
WizardryItems.wizard_boots_fire,
WizardryItems.wizard_hat_ice,
WizardryItems.wizard_robe_ice,
WizardryItems.wizard_leggings_ice,
WizardryItems.wizard_boots_ice,
WizardryItems.wizard_hat_lightning,
WizardryItems.wizard_robe_lightning,
WizardryItems.wizard_leggings_lightning,
WizardryItems.wizard_boots_lightning,
WizardryItems.wizard_hat_necromancy,
WizardryItems.wizard_robe_necromancy,
WizardryItems.wizard_leggings_necromancy,
WizardryItems.wizard_boots_necromancy,
WizardryItems.wizard_hat_earth,
WizardryItems.wizard_robe_earth,
WizardryItems.wizard_leggings_earth,
WizardryItems.wizard_boots_earth,
WizardryItems.wizard_hat_sorcery,
WizardryItems.wizard_robe_sorcery,
WizardryItems.wizard_leggings_sorcery,
WizardryItems.wizard_boots_sorcery,
WizardryItems.wizard_hat_healing,
WizardryItems.wizard_robe_healing,
WizardryItems.wizard_leggings_healing,
WizardryItems.wizard_boots_healing);
itemSorter = Ordering.explicit(orderedItemList).onResultOf(new Function<ItemStack, Item>() {
@Override
public Item apply(ItemStack input) {
return input.getItem();
}
});
spellItemSorter = new Comparator<ItemStack>(){
@Override
public int compare(ItemStack stack1, ItemStack stack2) {
if((stack1.getItem() instanceof ItemSpellBook && stack2.getItem() instanceof ItemSpellBook)
|| (stack1.getItem() instanceof ItemScroll && stack2.getItem() instanceof ItemScroll)){
Spell spell1 = Spell.get(stack1.getItemDamage());
Spell spell2 = Spell.get(stack2.getItemDamage());
return spell1.compareTo(spell2);
}else if(stack1.getItem() instanceof ItemScroll){
return 1;
}else if(stack2.getItem() instanceof ItemScroll){
return -1;
}
return 0;
}
};
}
}