This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
SorceryCraft/README.md

152 lines
4.2 KiB
Markdown
Raw Normal View History

2020-03-01 18:19:59 +00:00
# SorceryCraft
Cast Spells in Minecraft!
This mod supports the Minecraft 1.16 snapshots.
2020-03-02 23:06:47 +00:00
## What are Spells?
2020-03-01 18:56:28 +00:00
Spells are found throughout the world in chests. When you pick up a Spell you will learn it, one you learn a Spell you can apply it to a blank or existing Spell in the Casting Table. You can cast Spells by right-clicking. There is also a 30% chance the spell will rebound and hit you instead, unless the "Steadfast" Spell is applied.
2020-03-01 18:19:59 +00:00
2020-03-02 23:06:47 +00:00
## What's a Casting Table?
2020-03-01 18:19:59 +00:00
You can apply Spells to blank or existing Spells in the Casting Table. Doing so will require a certain amount of levels, and sometimes may require an item.
## Crafting
#### Blank Spell
2020-03-02 23:23:12 +00:00
<table>
<tr>
<td></td>
<td>Lapis Lazuli</td>
<td></td>
</tr>
<tr>
<td>Lapis Lazuli</td>
<td>Paper</td>
<td>Lapis Lazuli</td>
</tr>
<tr>
<td></td>
<td>Lapis Lazuli</td>
<td></td>
</tr>
</table>
2020-03-01 18:19:59 +00:00
2020-03-04 01:22:40 +00:00
#### Casting Table
2020-03-02 23:23:12 +00:00
<table>
<tr>
<td>Lapis Lazuli</td>
<td>Cobblestone</td>
<td>Lapis Lazuli</td>
</tr>
<tr>
<td>Cobblestone</td>
<td>Diamond</td>
<td>Cobblestone</td>
</tr>
<tr>
<td>Lapis Lazuli</td>
<td>Cobblestone</td>
<td>Lapis Lazuli</td>
</tr>
</table>
2020-03-02 23:06:47 +00:00
## Spells
| Spell | Max Level | Description |
| --- | --- | --- |
| Flame | 2 | Sets target on fire. |
| Damage | 2 | Damages target. |
| Heal | 2 | Heals target. |
| Dissolve | 1 | Removes target's status effects. |
| Levitate | 2 | Gives target the Levitation effect. |
| Steadfast | 1 | Prevents Spell from rebounding. |
| Teleport | 2 | Teleports target to random location. |
2020-03-04 01:22:40 +00:00
| Inward | 1 | Causes the Spell to target the player. If the Spell fails instead of rebounding, it will just do nothing. |
| Cooling | 1 | Extinguish the target if they are on fire. |
2020-03-04 01:22:40 +00:00
## ```/spell``` Command
This command requires OP permissions.
#### ```/spell clear <player>```
This command clears all known spells from the given player.
#### ```/spell list <player>```
This lists all the spells the given player knows.
#### ```/spell learn <player> <spell-id> <level>```
This teaches the specified spell to the specified player.
#### ```/spell add <player> <spell-id> <level>```
This adds the specified spell to the item in the player's main hand.
#### ```/spell remove <player> <spell-id>```
2020-03-08 15:10:50 +00:00
This removes the specified spell from the item in the player's main hand.
## API
1. Add Dependency to Gradle
```gradle
repositories {
2020-03-08 15:34:47 +00:00
maven { url 'https://jitpack.io' }
2020-03-08 15:10:50 +00:00
}
dependencies {
2020-03-08 15:34:47 +00:00
modImplementation 'com.thebrokenrail:sorcerycraft:VERSION'
2020-03-08 15:10:50 +00:00
}
```
2. Add Dependency to ```fabric.mod.json```
```json
{
2020-03-08 15:34:47 +00:00
"depends": {
"sorcerycraft": "VERSION"
}
2020-03-08 15:10:50 +00:00
}
```
3. Create a class extending ```com.thebrokenrail.sorcerycraft.spell.registry.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
2020-03-08 15:34:47 +00:00
// Return ItemStack.EMPTY if an item is not required
2020-03-08 15:10:50 +00:00
}
@Override
public int getMaxLevel() {
// Return ExampleSpell's maximum level
}
}
```
4. Register the Spell in your ModInitializer
```java
public class ExampleMod implements ModInitializer {
@Override
public void onInitialize() {
SpellRegistry.registerSpell(new Identifier("modid", "example_spell"), ExampleSpell.class);
}
}
```
2020-03-08 15:15:34 +00:00
5. Add Spell Translation
```json
{
2020-03-08 15:34:47 +00:00
"spell.modid.example_spell": "Example"
2020-03-08 15:15:34 +00:00
}
```
2020-03-08 15:10:50 +00:00
#### Useful Methods
- ```Spell.getLevel()```
- ```Spell.getID()```