From 815fd3d7a7e492d353e13f688210656391acc813 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Mon, 9 Mar 2020 20:49:40 -0400 Subject: [PATCH] Restructure README --- API.md | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ CHANGELOG.md | 2 +- README.md | 69 +++---------------------------------------------- 3 files changed, 76 insertions(+), 67 deletions(-) create mode 100644 API.md diff --git a/API.md b/API.md new file mode 100644 index 0000000..1513daa --- /dev/null +++ b/API.md @@ -0,0 +1,72 @@ +# API + +## Getting Started +1. Add Dependency to Gradle + ```gradle + repositories { + maven { url 'https://jitpack.io' } + } + dependencies { + modImplementation 'com.thebrokenrail:sorcerycraft:VERSION' + } + ``` +2. Add Dependency to ```fabric.mod.json``` + ```json + { + "depends": { + "sorcerycraft": "1.1.x" + } + } + ``` +3. Create a class extending ```com.thebrokenrail.sorcerycraft.spell.api.Spell``` + ```java + public class ExampleSpell extends Spell { + public ExampleSpell(Identifier id, int level) { + super(id, level); + } + + @Override + public void execute(Entity target, Entity source, Entity attacker) { + // Called when ExampleSpell hits an entity + // Not required to override + } + + @Override + public void execute(World world, BlockHitResult hitResult) { + // Called when ExampleSpell hits a block + // Not required to override + } + + @Override + public int getXPCost() { + // Return the amount of levels required to make ExampleSpell in a Casting Table + } + + @Override + public ItemStack getItemCost() { + // Return the item(s) required to make ExampleSpell in a Casting Table + // Return ItemStack.EMPTY if an item is not required + } + + @Override + public int getMaxLevel() { + // Return ExampleSpell's maximum level + } + } + ``` +4. Register the Spell in your ModInitializer + ```java + public class ExampleMod implements ModInitializer { + public static final Identifier EXAMPLE_SPELL = SpellRegistry.register(new Identifier("modid", "example_spell"), ExampleSpell.class); + } + ``` +5. Add Spell Translation + ```json + { + "spell.modid.example_spell": "Example" + } + ``` + +## Useful Methods +- ```Spell.getLevel()``` +- ```Spell.getID()``` \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3920c65..29e627b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -72,5 +72,5 @@ **1.0.1** * Add Teleport Spell -**1.0.0** +**1.0** * Initial Release \ No newline at end of file diff --git a/README.md b/README.md index f492dc5..8adbce0 100644 --- a/README.md +++ b/README.md @@ -80,70 +80,7 @@ This adds the specified spell to the item in the player's main hand. This removes the specified spell from the item in the player's main hand. ## API -1. Add Dependency to Gradle - ```gradle - repositories { - maven { url 'https://jitpack.io' } - } - dependencies { - modImplementation 'com.thebrokenrail:sorcerycraft:VERSION' - } - ``` -2. Add Dependency to ```fabric.mod.json``` - ```json - { - "depends": { - "sorcerycraft": "1.1.x" - } - } - ``` -3. Create a class extending ```com.thebrokenrail.sorcerycraft.spell.api.Spell``` - ```java - public class ExampleSpell extends Spell { - public ExampleSpell(Identifier id, int level) { - super(id, level); - } - - @Override - public void execute(Entity target, Entity source, Entity attacker) { - // Called when ExampleSpell hits an entity - } - - @Override - public void execute(World world, BlockHitResult hitResult) { - // Called when ExampleSpell hits a block - } - - @Override - public int getXPCost() { - // Return the amount of levels required to make ExampleSpell in a Casting Table - } - - @Override - public ItemStack getItemCost() { - // Return the item(s) required to make ExampleSpell in a Casting Table - // Return ItemStack.EMPTY if an item is not required - } - - @Override - public int getMaxLevel() { - // Return ExampleSpell's maximum level - } - } - ``` -4. Register the Spell in your ModInitializer - ```java - public class ExampleMod implements ModInitializer { - public static final Identifier EXAMPLE_SPELL = SpellRegistry.register(new Identifier("modid", "example_spell"), ExampleSpell.class); - } - ``` -5. Add Spell Translation - ```json - { - "spell.modid.example_spell": "Example" - } - ``` +[View API](API.md) -#### Useful Methods -- ```Spell.getLevel()``` -- ```Spell.getID()``` \ No newline at end of file +## Changelog +[View Changelog](CHANGELOG.md) \ No newline at end of file