This commit is contained in:
Electroblob77
2019-01-05 22:18:14 +00:00
parent b374f71533
commit 224ee281ef
33 changed files with 160 additions and 273 deletions
@@ -54,7 +54,8 @@ import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.RegistryBuilder;
/**
* Class responsible for defining, storing and registering all of wizardry's spells.
* Class responsible for defining, storing and registering all of wizardry's spells. Use this to access individual
* spell instances, similar to the {@code Blocks} and {@code Items} classes.
*
* @author Electroblob
* @since Wizardry 2.1
@@ -75,7 +76,8 @@ public final class Spells {
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>();
// EDIT: It's probably because of type erasure, thinking about it.
RegistryBuilder<Spell> builder = new RegistryBuilder<>();
builder.setType(Spell.class);
builder.setName(new ResourceLocation(Wizardry.MODID, "spells"));
builder.setIDRange(0, 5000); // Is there any penalty for using a larger number?
@@ -26,13 +26,6 @@ import net.minecraftforge.registries.IForgeRegistry;
@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/
@@ -17,12 +17,11 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@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:49).
// 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
// 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
@@ -1,74 +1,18 @@
package electroblob.wizardry.registry;
import java.util.List;
import com.google.common.collect.Lists;
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.EntityWitherSkeletonMinion;
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.entity.construct.*;
import electroblob.wizardry.entity.living.*;
import electroblob.wizardry.entity.projectile.*;
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.tileentity.*;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EnumCreatureType;
@@ -91,6 +35,8 @@ import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import net.minecraftforge.registries.IForgeRegistry;
import java.util.List;
/**
* Class responsible for registering all the things that don't have (or need) instances: entities, loot tables, recipes,
* etc.
@@ -101,13 +47,11 @@ import net.minecraftforge.registries.IForgeRegistry;
@Mod.EventBusSubscriber
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,
* number of 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
@@ -246,7 +190,7 @@ public final class WizardryRegistry {
/** Now only deals with the dynamic crafting recipes and the smelting recipes. */
@SubscribeEvent
public static void registerRecipes(RegistryEvent.Register<IRecipe> event){
IForgeRegistry<IRecipe> registry = event.getRegistry();
FurnaceRecipes.instance().addSmeltingRecipeForBlock(WizardryBlocks.crystal_ore, new ItemStack(WizardryItems.magic_crystal), 0.5f);
@@ -8,8 +8,7 @@ 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.
*
* @author Electroblob
* @since Wizardry 2.1