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:
@@ -1,23 +1,22 @@
|
||||
package electroblob.wizardry;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import electroblob.wizardry.command.CommandCastSpell;
|
||||
import electroblob.wizardry.command.CommandDiscoverSpell;
|
||||
import electroblob.wizardry.command.CommandSetAlly;
|
||||
import electroblob.wizardry.command.CommandViewAllies;
|
||||
import electroblob.wizardry.data.DispenserCastingData;
|
||||
import electroblob.wizardry.data.WizardData;
|
||||
import electroblob.wizardry.integration.antiqueatlas.WizardryAntiqueAtlasIntegration;
|
||||
import electroblob.wizardry.integration.baubles.WizardryBaublesIntegration;
|
||||
import electroblob.wizardry.misc.Forfeit;
|
||||
import electroblob.wizardry.packet.WizardryPacketHandler;
|
||||
import electroblob.wizardry.registry.WizardryAdvancementTriggers;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardryRegistry;
|
||||
import electroblob.wizardry.registry.WizardryTabs;
|
||||
import electroblob.wizardry.registry.*;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.CustomSoundCategory;
|
||||
import electroblob.wizardry.util.SpellProperties;
|
||||
import electroblob.wizardry.worldgen.*;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.Capability.IStorage;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
@@ -30,12 +29,13 @@ import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* <i>"Electroblob's Wizardry adds an RPG-like system of spells to Minecraft, with the aim of being as playable as
|
||||
* possible. No crazy constructs, no perk trees, no complex recipes - simply find spell books, cast spells, and master
|
||||
* the arcane! - But you knew that, right?"</i>
|
||||
* <p>
|
||||
* <p></p>
|
||||
* Main mod class for Wizardry. Contains the logger and settings instances, along with all the other stuff that's normally
|
||||
* in a main mod class.
|
||||
* @author Electroblob
|
||||
@@ -50,9 +50,9 @@ public class Wizardry {
|
||||
public static final String NAME = "Electroblob's Wizardry";
|
||||
/**
|
||||
* The version number for this version of wizardry. The following system is used for version numbers:
|
||||
* <p>
|
||||
* <p></p>
|
||||
* <center><b>[major Minecraft version].[major mod version].[minor mod version/patch]
|
||||
* <p>
|
||||
* <p></p>
|
||||
* </center></b> The major mod version is consistent across Minecraft versions, i.e. Wizardry 1.1 has the same
|
||||
* features as Wizardry 2.1, but they are for different versions of Minecraft and have separate minor versioning.
|
||||
* 1.x.x represents Minecraft 1.7.x versions, 2.x.x represents Minecraft 1.10.x versions, 3.x.x represents Minecraft
|
||||
@@ -60,56 +60,28 @@ public class Wizardry {
|
||||
*/
|
||||
public static final String VERSION = "4.2.0";
|
||||
|
||||
// IDEA: Improve the algorithm that finds a place to summon creatures to take walls into account.
|
||||
// IDEA: Replace all uses of Math.cos and Math.sin with MathHelper versions
|
||||
// IDEA: Triggering of inbuilt Forge events in relevant places?
|
||||
// IDEA: Abstract the vanilla particles behind the particle builder
|
||||
|
||||
/* Minor bugs that need fixing at some point:
|
||||
* - Player skin hat layer shows through wizard hats - Wizard armour breaks rather than just running out of mana (I
|
||||
* can't seem to replicate this bug, but I have had it happen to me before...)
|
||||
* - Shift-clicking a stack of special upgrades when in the arcane workbench causes the whole stack to be
|
||||
* transferred when it should be just one (this is a bug with vanilla as well - try putting a stack of bottles into
|
||||
* a brewing stand). I have at least made it so only one gets used now, so it has no impact on the game.
|
||||
* - When a spell is on cooldown, you can't break blocks when holding a wand. */
|
||||
|
||||
// TODO: So somehow I have managed to overlook the fact that health is actually a float. What this means is that
|
||||
// I can make the healing spells use damage multipliers - hurrah!
|
||||
|
||||
// TODO: Switch from IInventory to IItemHandler (Or don't. It's only useful for automation really.)
|
||||
// TODO: Have particles obey Minecraft's particle setting where appropriate
|
||||
// (see https://github.com/RootsTeam/Embers/blob/master/src/main/java/teamroots/embers/particle/ParticleUtil.java)
|
||||
// TODO: Go over all the worldgen code, use IWorldGenerator
|
||||
// TODO: Implement a continuous sound system using MovingSoundEntity, allowing continuous spells to have a long sound
|
||||
// loop as well as a start and end sound
|
||||
// TODO: EntityMagicArrow needs attention
|
||||
// TODO: Go over particle spawning on projectile impact and make sure hitvec is used wherever appropriate
|
||||
// TODO: Replace spell IDs in packets with ResourceLocation strings
|
||||
// TODO: Forcefield needs looking at, esp. with regards to projectiles and explosions
|
||||
// TODO: TileEntityArcaneWorkbench needs looking at, esp. regarding inventory and markDirty
|
||||
// TODO: Fireskin somehow lost its particles
|
||||
// TODO: Convert settings over to the @Config system
|
||||
// TODO: Go through listeners of LivingHurtEvent and decide whether they should change to LivingDamageEvent
|
||||
|
||||
// NOTE: Add melee upgrades to loot tables when they are added.
|
||||
// TODO: See what can be done with the illager spell sounds (and go over sounds in general)
|
||||
// TODO: Fix possession
|
||||
// TODO: Fix charge
|
||||
|
||||
/** Static instance of the {@link Settings} object for Wizardry. */
|
||||
public static final Settings settings = new Settings();
|
||||
|
||||
/** Static instance of the {@link Logger} object for Wizardry.
|
||||
* <p>
|
||||
* <p></p>
|
||||
* Logging conventions for wizardry (only these levels are used currently):
|
||||
* <p>
|
||||
* <p></p>
|
||||
* - <b>ERROR</b>: Anything that threw an exception; may or may not crash the game.<br>
|
||||
* - <b>WARN</b>: Anything that isn't supposed to happen during normal operation, but didn't throw an exception.<br>
|
||||
* - <b>INFO</b>: Anything that might happen during normal mod operation that the user needs to know about. */
|
||||
public static Logger logger;
|
||||
|
||||
// private static Pattern entityNamePattern;
|
||||
|
||||
// EventManager
|
||||
WizardryWorldGenerator generator = new WizardryWorldGenerator();
|
||||
|
||||
// The instance of wizardry that Forge uses.
|
||||
@Instance(Wizardry.MODID)
|
||||
public static Wizardry instance;
|
||||
@@ -123,40 +95,27 @@ public class Wizardry {
|
||||
|
||||
logger = event.getModLog();
|
||||
|
||||
proxy.registerResourceReloadListener();
|
||||
proxy.registerResourceReloadListeners();
|
||||
|
||||
settings.initConfig(event);
|
||||
|
||||
// Yes - by the looks of it, having an interface is completely unnecessary in this case.
|
||||
CapabilityManager.INSTANCE.register(WizardData.class, new IStorage<WizardData>(){
|
||||
// These methods are only called by Capability.writeNBT() or Capability.readNBT(), which in turn are
|
||||
// NEVER CALLED. Unless I'm missing some reflective invocation, that means this entire class serves only
|
||||
// to allow capabilities to be saved and loaded manually. What that would be useful for I don't know.
|
||||
// (If an API forces most users to write redundant code for no reason, it's not user friendly, is it?)
|
||||
// ... well, that's my rant for today!
|
||||
@Override
|
||||
public NBTBase writeNBT(Capability<WizardData> capability, WizardData instance, EnumFacing side){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(Capability<WizardData> capability, WizardData instance, EnumFacing side, NBTBase nbt){
|
||||
}
|
||||
}, WizardData::new);
|
||||
|
||||
WizardryRegistry.registerTileEntities();
|
||||
|
||||
WizardryRegistry.registerEntities();
|
||||
// The check for the generateLoot setting is now done within this method.
|
||||
WizardryRegistry.registerLoot();
|
||||
// Capabilities
|
||||
WizardData.register();
|
||||
DispenserCastingData.register();
|
||||
|
||||
// Register things that don't have registries
|
||||
WizardryBlocks.registerTileEntities();
|
||||
WizardryLoot.register();
|
||||
WizardryAdvancementTriggers.register();
|
||||
Forfeit.register();
|
||||
|
||||
// Moved to preInit, because apparently it has to be here now.
|
||||
// Client-side stuff (via proxies)
|
||||
proxy.registerRenderers();
|
||||
// It seems this also has to be here
|
||||
proxy.registerKeyBindings();
|
||||
|
||||
WizardryBaublesIntegration.init();
|
||||
WizardryAntiqueAtlasIntegration.init();
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -164,26 +123,41 @@ public class Wizardry {
|
||||
|
||||
settings.initConfigExtras();
|
||||
|
||||
// Event Handlers
|
||||
GameRegistry.registerWorldGenerator(generator, 0);
|
||||
MinecraftForge.EVENT_BUS.register(instance);
|
||||
// World generators
|
||||
// Weight is a misnomer, it's actually the priority (where lower numbers get generated first)
|
||||
// Literally nothing on typical 'weight' values here, there isn't even an upper limit
|
||||
// Examples I've managed to find:
|
||||
// - Tinker's construct slime islands use 25
|
||||
GameRegistry.registerWorldGenerator(new WorldGenCrystalOre(), 0);
|
||||
GameRegistry.registerWorldGenerator(new WorldGenCrystalFlower(), 50);
|
||||
GameRegistry.registerWorldGenerator(new WorldGenWizardTower(), 20);
|
||||
GameRegistry.registerWorldGenerator(new WorldGenObelisk(), 20);
|
||||
GameRegistry.registerWorldGenerator(new WorldGenShrine(), 20);
|
||||
|
||||
// This is for the config change and missing mappings events
|
||||
MinecraftForge.EVENT_BUS.register(instance); // Since there's already an instance we might as well use it
|
||||
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, new WizardryGuiHandler());
|
||||
WizardryPacketHandler.initPackets();
|
||||
|
||||
// Post-registry extras
|
||||
WizardryItems.populateWandMap();
|
||||
WizardryItems.populateArmourMap();
|
||||
WizardryItems.registerDispenseBehaviours();
|
||||
Spell.registry.forEach(Spell::init);
|
||||
SpellProperties.init();
|
||||
|
||||
// Client-side stuff (via proxies)
|
||||
proxy.initGuiBits();
|
||||
proxy.initParticleFactories();
|
||||
proxy.registerParticles();
|
||||
proxy.registerSoundEventListener();
|
||||
|
||||
WizardrySounds.SPELLS = CustomSoundCategory.add(Wizardry.MODID + ":spells");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event){
|
||||
// This needs to be here or it won't necessarily include all the mods' entities.
|
||||
// TODO: Re-implement this when the Forge bug is fixed.
|
||||
/* Doesn't seem to be doing anything... String entityNames = ""; for(Object name :
|
||||
* EntityList.classToStringMapping.values()){ if(name instanceof String){ entityNames = entityNames + name +
|
||||
* '|'; } } // Cuts off the last '|' entityNames = entityNames.substring(0, entityNames.length()-1);
|
||||
* entityNamePattern = Pattern.compile(entityNames); */
|
||||
proxy.initialiseLayers();
|
||||
WizardryTabs.sort();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -205,23 +179,30 @@ public class Wizardry {
|
||||
// 2.1 changed some item ids, so this fixes them for existing worlds
|
||||
// Nobody updates minecraft versions when using mods, but I may as well leave this here just in case.
|
||||
@SubscribeEvent
|
||||
public static void onMissingMappingEvent(RegistryEvent.MissingMappings<Item> event){
|
||||
public static void onMissingItemMappingEvent(RegistryEvent.MissingMappings<Item> event){
|
||||
// Just get, not getAll, since the mod id didn't change!
|
||||
for(RegistryEvent.MissingMappings.Mapping<Item> mapping : event.getAllMappings()){
|
||||
if(mapping.key.getResourceDomain().equals(Wizardry.MODID)){
|
||||
if(mapping.key.getNamespace().equals(Wizardry.MODID)){
|
||||
|
||||
Item replacement;
|
||||
|
||||
switch(mapping.key.getResourcePath()){
|
||||
switch(mapping.key.getPath()){
|
||||
|
||||
case "wand_basic": replacement = WizardryItems.magic_wand; break;
|
||||
case "wand_basic_fire": replacement = WizardryItems.basic_fire_wand; break;
|
||||
case "wand_basic_ice": replacement = WizardryItems.basic_ice_wand; break;
|
||||
case "wand_basic_lightning": replacement = WizardryItems.basic_lightning_wand; break;
|
||||
case "wand_basic_necromancy": replacement = WizardryItems.basic_necromancy_wand; break;
|
||||
case "wand_basic_earth": replacement = WizardryItems.basic_earth_wand; break;
|
||||
case "wand_basic_sorcery": replacement = WizardryItems.basic_sorcery_wand; break;
|
||||
case "wand_basic_healing": replacement = WizardryItems.basic_healing_wand; break;
|
||||
case "wand_basic_fire": replacement = WizardryItems.novice_fire_wand; break;
|
||||
case "wand_basic_ice": replacement = WizardryItems.novice_ice_wand; break;
|
||||
case "wand_basic_lightning": replacement = WizardryItems.novice_lightning_wand; break;
|
||||
case "wand_basic_necromancy": replacement = WizardryItems.novice_necromancy_wand; break;
|
||||
case "wand_basic_earth": replacement = WizardryItems.novice_earth_wand; break;
|
||||
case "wand_basic_sorcery": replacement = WizardryItems.novice_sorcery_wand; break;
|
||||
case "wand_basic_healing": replacement = WizardryItems.novice_healing_wand; break;
|
||||
case "basic_fire_wand": replacement = WizardryItems.novice_fire_wand; break;
|
||||
case "basic_ice_wand": replacement = WizardryItems.novice_ice_wand; break;
|
||||
case "basic_lightning_wand": replacement = WizardryItems.novice_lightning_wand; break;
|
||||
case "basic_necromancy_wand": replacement = WizardryItems.novice_necromancy_wand; break;
|
||||
case "basic_earth_wand": replacement = WizardryItems.novice_earth_wand; break;
|
||||
case "basic_sorcery_wand": replacement = WizardryItems.novice_sorcery_wand; break;
|
||||
case "basic_healing_wand": replacement = WizardryItems.novice_healing_wand; break;
|
||||
case "wand_apprentice": replacement = WizardryItems.apprentice_wand; break;
|
||||
case "wand_apprentice_fire": replacement = WizardryItems.apprentice_fire_wand; break;
|
||||
case "wand_apprentice_ice": replacement = WizardryItems.apprentice_ice_wand; break;
|
||||
@@ -264,4 +245,13 @@ public class Wizardry {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onMissingSpellMappingEvent(RegistryEvent.MissingMappings<Spell> event){
|
||||
for(RegistryEvent.MissingMappings.Mapping<Spell> mapping : event.getAllMappings()){
|
||||
if(mapping.key.getNamespace().equals(Wizardry.MODID)){
|
||||
if(mapping.key.getPath().equals("firestorm")) mapping.remap(Spells.fire_breath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user