Initial 1.11.2 update

This commit is contained in:
Electroblob
2018-02-07 21:15:50 +00:00
parent 67f6be0671
commit 3df5597dcc
368 changed files with 17234 additions and 15082 deletions
@@ -12,6 +12,7 @@ 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
*/
@@ -20,7 +21,7 @@ import net.minecraftforge.fml.common.registry.RegistryBuilder;
// 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,
// and secondly,
// and secondly,
@ObjectHolder(Wizardry.MODID)
@Mod.EventBusSubscriber
public final class Spells {
@@ -28,16 +29,16 @@ 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;
@@ -53,7 +54,7 @@ public final class Spells {
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;
@@ -160,7 +161,7 @@ public final class 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;
@@ -171,7 +172,7 @@ public final class Spells {
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;
@@ -190,12 +191,12 @@ public final class Spells {
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());
@@ -210,7 +211,7 @@ public final class Spells {
registry.register(new Light());
registry.register(new Telekinesis());
registry.register(new Heal());
registry.register(new Fireball());
registry.register(new FlameRay());
registry.register(new Firebomb());
@@ -317,7 +318,7 @@ public final class 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());
@@ -328,7 +329,7 @@ public final class Spells {
registry.register(new ImbueWeapon());
registry.register(new InvigoratingPresence());
registry.register(new Oakflesh());
registry.register(new GreaterFireball());
registry.register(new FlamingWeapon());
registry.register(new IceLance());
@@ -8,40 +8,66 @@ 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 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);
}
@@ -19,63 +19,73 @@ 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,
// 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 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 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 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);
public static final Block vanishing_cobweb = new BlockVanishingCobweb(Material.WEB).setLightOpacity(1)
.setHardness(4.0F);
static {
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}.
* {@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");
@@ -10,25 +10,30 @@ 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).
// 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_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");
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){
@@ -37,5 +42,5 @@ public final class WizardryEnchantments {
event.getRegistry().register(flaming_weapon);
event.getRegistry().register(freezing_weapon);
}
}
@@ -6,6 +6,8 @@ import java.util.Map;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import com.google.common.collect.ImmutableMap;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.constants.Element;
import electroblob.wizardry.constants.Tier;
@@ -45,6 +47,7 @@ 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
*/
@@ -131,8 +134,10 @@ public final class WizardryItems {
// 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);
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
@@ -182,6 +187,10 @@ public final class WizardryItems {
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 Map<EntityEquipmentSlot, Item> SPECTRAL_ARMOUR_MAP = ImmutableMap.of(
EntityEquipmentSlot.HEAD, spectral_helmet, EntityEquipmentSlot.CHEST, spectral_chestplate,
EntityEquipmentSlot.LEGS, spectral_leggings, EntityEquipmentSlot.FEET, spectral_boots);
public static final Item smoke_bomb = new ItemSmokeBomb();
public static final Item identification_scroll = new ItemIdentificationScroll();
@@ -189,8 +198,8 @@ public final class WizardryItems {
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 {
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);
@@ -223,7 +232,7 @@ public final class WizardryItems {
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);
@@ -262,10 +271,11 @@ public final class WizardryItems {
* 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}.
* {@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);
@@ -17,6 +17,7 @@ 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
*/
@@ -25,48 +26,52 @@ 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. */
* 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);
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
}.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
}.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));
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
}.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
}.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);
@@ -79,10 +84,11 @@ public final class WizardryPotions {
* 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}.
* {@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);
@@ -90,12 +96,12 @@ public final class WizardryPotions {
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");
@@ -83,47 +83,43 @@ 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.
* 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
/* 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.
* 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.
*/
* 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());
@@ -136,185 +132,250 @@ public final class WizardryRegistry {
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"));
// 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");
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()]));
ResourceLocation wizardID = new ResourceLocation(Wizardry.MODID, "wizard");
ResourceLocation evilWizardID = new ResourceLocation(Wizardry.MODID, "evil_wizard");
int id = 0; // Incrementable index for the mod specific entity id.
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "zombie_minion"),
EntityZombieMinion.class, "zombie_minion", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "magic_missile"),
EntityMagicMissile.class, "magic_missile", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
// TODO: This should be a particle
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "arc"), EntityArc.class, "arc", id++,
wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "skeleton_minion"),
EntitySkeletonMinion.class, "skeleton_minion", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "spark_bomb"), EntitySparkBomb.class,
"spark_bomb", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "spirit_wolf"), EntitySpiritWolf.class,
"spirit_wolf", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "ice_shard"), EntityIceShard.class,
"ice_shard", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "blaze_minion"), EntityBlazeMinion.class,
"blaze_minion", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "ice_wraith"), EntityIceWraith.class,
"ice_wraith", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "lightning_wraith"),
EntityLightningWraith.class, "lightning_wraith", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "black_hole"), EntityBlackHole.class,
"black_hole", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "shield"), EntityShield.class, "shield",
id++, wizardry, 128, 1, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "meteor"), EntityMeteor.class, "meteor",
id++, wizardry, 128, 5, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "blizzard"), EntityBlizzard.class,
"blizzard", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(wizardID, EntityWizard.class, "wizard", id++, wizardry, 128,
LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "bubble"), EntityBubble.class, "bubble",
id++, wizardry, 128, 3, false);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "tornado"), EntityTornado.class,
"tornado", id++, wizardry, 128, 1, false);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "lightning_hammer"), EntityHammer.class,
"lightning_hammer", id++, wizardry, 128, 1, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "firebomb"), EntityFirebomb.class,
"firebomb", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "force_orb"), EntityForceOrb.class,
"force_orb", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "arrow_rain"), EntityArrowRain.class,
"arrow_rain", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "spark"), EntitySpark.class, "spark",
id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "shadow_wraith"),
EntityShadowWraith.class, "shadow_wraith", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "darkness_orb"), EntityDarknessOrb.class,
"darkness_orb", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "spider_minion"),
EntitySpiderMinion.class, "spider_minion", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "healing_aura"), EntityHealAura.class,
"healing_aura", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "fire_sigil"), EntityFireSigil.class,
"fire_sigil", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "frost_sigil"), EntityFrostSigil.class,
"frost_sigil", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "lightning_sigil"),
EntityLightningSigil.class, "lightning_sigil", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "lightning_arrow"),
EntityLightningArrow.class, "lightning_arrow", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "firebolt"), EntityFirebolt.class,
"firebolt", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "poison_bomb"), EntityPoisonBomb.class,
"poison_bomb", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "ice_charge"), EntityIceCharge.class,
"ice_charge", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "force_arrow"), EntityForceArrow.class,
"force_arrow", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "dart"), EntityDart.class, "dart", id++,
wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "magic_slime"), EntityMagicSlime.class,
"magic_slime", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "forcefield"), EntityForcefield.class,
"forcefield", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "ring_of_fire"), EntityFireRing.class,
"ring_of_fire", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "lightning_disc"),
EntityLightningDisc.class, "lightning_disc", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "thunderbolt"), EntityThunderbolt.class,
"thunderbolt", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "ice_giant"), EntityIceGiant.class,
"ice_giant", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "spirit_horse"), EntitySpiritHorse.class,
"spirit_horse", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "phoenix"), EntityPhoenix.class,
"phoenix", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "silverfish_minion"),
EntitySilverfishMinion.class, "silverfish_minion", id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "decay"), EntityDecay.class, "decay",
id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "storm_elemental"),
EntityStormElemental.class, "storm_elemental", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "earthquake"), EntityEarthquake.class,
"earthquake", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "ice_lance"), EntityIceLance.class,
"ice_lance", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "hailstorm"), EntityHailstorm.class,
"hailstorm", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "smoke_bomb"), EntitySmokeBomb.class,
"smoke_bomb", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(evilWizardID, EntityEvilWizard.class, "evil_wizard", id++, wizardry, 128,
LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "decoy"), EntityDecoy.class, "decoy",
id++, wizardry, 128, LIVING_UPDATE_INTERVAL, true);
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "ice_spike"), EntityIceSpike.class,
"ice_spike", id++, wizardry, 128, 1, true);
// TODO: This should be a particle.
EntityRegistry.registerModEntity(new ResourceLocation(Wizardry.MODID, "lightning_pulse"),
EntityLightningPulse.class, "lightning_pulse", id++, wizardry, 128, PROJECTILE_UPDATE_INTERVAL, false);
EntityRegistry.registerEgg(wizardID, 0x19295e, 0xee9312);
EntityRegistry.registerEgg(evilWizardID, 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);
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.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);
}
}
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);
}
}
}
}
@@ -8,8 +8,9 @@ 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...
* 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
*/
@@ -36,13 +37,13 @@ public final class WizardrySounds {
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);
@@ -14,11 +14,13 @@ import electroblob.wizardry.spell.Spell;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
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
*/
@@ -32,13 +34,13 @@ public final class WizardryTabs {
@Override
@SideOnly(Side.CLIENT)
public Item getTabIconItem() {
return WizardryItems.wizard_handbook;
public ItemStack getTabIconItem(){
return new ItemStack(WizardryItems.wizard_handbook);
}
@Override
@SideOnly(Side.CLIENT)
public void displayAllRelevantItems(List<ItemStack> items) {
public void displayAllRelevantItems(NonNullList<ItemStack> items){
super.displayAllRelevantItems(items);
Collections.sort(items, itemSorter);
}
@@ -47,25 +49,25 @@ public final class WizardryTabs {
@Override
@SideOnly(Side.CLIENT)
public Item getTabIconItem() {
return WizardryItems.spell_book;
public ItemStack getTabIconItem(){
return new ItemStack(WizardryItems.spell_book);
}
@Override
@SideOnly(Side.CLIENT)
public void displayAllRelevantItems(List<ItemStack> items) {
public void displayAllRelevantItems(NonNullList<ItemStack> items){
super.displayAllRelevantItems(items);
Collections.sort(items, spellItemSorter);
}
@Override
public boolean hasSearchBar() {
public boolean hasSearchBar(){
return true;
}
@Override
@SideOnly(Side.CLIENT)
public String getBackgroundImageName() {
public String getBackgroundImageName(){
return "item_search.png";
}
};
@@ -74,85 +76,44 @@ public final class WizardryTabs {
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>() {
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) {
public Item apply(ItemStack input){
return input.getItem();
}
});
spellItemSorter = new Comparator<ItemStack>(){
@Override
public int compare(ItemStack stack1, ItemStack stack2) {
public int compare(ItemStack stack1, ItemStack stack2){
if((stack1.getItem() instanceof ItemSpellBook && stack2.getItem() instanceof ItemSpellBook)
|| (stack1.getItem() instanceof ItemScroll && stack2.getItem() instanceof ItemScroll)){