That's one heck of a commit you've got there...

I may have got a bit behind with version control. A lot behind, in fact. Maybe I'll go back and split this sometime - then again, I probably won't. But hey, at least it's here!
This commit is contained in:
Electroblob77
2019-08-18 00:04:18 +01:00
parent 2680d02304
commit f37812be3e
1564 changed files with 47652 additions and 12984 deletions
@@ -1,13 +1,17 @@
package electroblob.wizardry.registry;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.enchantment.EnchantmentMagicProtection;
import electroblob.wizardry.enchantment.EnchantmentMagicSword;
import electroblob.wizardry.enchantment.EnchantmentTimed;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.enchantment.Enchantment;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import javax.annotation.Nonnull;
/**
* Class responsible for defining, storing and registering all of wizardry's enchantments.
*
@@ -17,6 +21,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@Mod.EventBusSubscriber
public final class WizardryEnchantments {
private WizardryEnchantments(){} // No instances!
// 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!
@@ -26,17 +32,31 @@ public final class WizardryEnchantments {
// 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 = null;
public static final Enchantment magic_bow = null;
public static final Enchantment flaming_weapon = null;
public static final Enchantment freezing_weapon = null;
@Nonnull
@SuppressWarnings("ConstantConditions")
private static <T> T placeholder(){ return null; }
public static final Enchantment magic_sword = placeholder();
public static final Enchantment magic_bow = placeholder();
public static final Enchantment flaming_weapon = placeholder();
public static final Enchantment freezing_weapon = placeholder();
public static final Enchantment magic_protection = placeholder();
public static final Enchantment frost_protection = placeholder();
public static final Enchantment shock_protection = placeholder();
@SubscribeEvent
public static void register(RegistryEvent.Register<Enchantment> event){
event.getRegistry().register(new EnchantmentMagicSword().setRegistryName(Wizardry.MODID, "magic_sword"));
event.getRegistry().register(new EnchantmentTimed().setRegistryName(Wizardry.MODID, "magic_bow"));
event.getRegistry().register(new EnchantmentTimed().setRegistryName(Wizardry.MODID, "flaming_weapon"));
event.getRegistry().register(new EnchantmentTimed().setRegistryName(Wizardry.MODID, "freezing_weapon"));
event.getRegistry().register(new EnchantmentMagicProtection(Enchantment.Rarity.UNCOMMON, EnchantmentMagicProtection.Type.MAGIC, WizardryUtilities.ARMOUR_SLOTS).setRegistryName(Wizardry.MODID, "magic_protection"));
event.getRegistry().register(new EnchantmentMagicProtection(Enchantment.Rarity.RARE, EnchantmentMagicProtection.Type.FROST, WizardryUtilities.ARMOUR_SLOTS).setRegistryName(Wizardry.MODID, "frost_protection"));
event.getRegistry().register(new EnchantmentMagicProtection(Enchantment.Rarity.RARE, EnchantmentMagicProtection.Type.SHOCK, WizardryUtilities.ARMOUR_SLOTS).setRegistryName(Wizardry.MODID, "shock_protection"));
}
}