1.1.11
All checks were successful
SorceryCraft/pipeline/head This commit looks good

Update Mappings
Add Lightning Spell
This commit is contained in:
TheBrokenRail 2020-03-13 18:05:12 -04:00
parent 5a4cd89d68
commit 4bc4821543
17 changed files with 90 additions and 27 deletions

View File

@ -1,5 +1,9 @@
### Changelog ### Changelog
**1.1.11**
* Update Mappings
* Add Lightning Spell
**1.1.10** **1.1.10**
* Update to 20w11a * Update to 20w11a
* Enhance Flame Spell * Enhance Flame Spell

View File

@ -60,6 +60,7 @@ You can apply Spells to blank or existing Spells in the Casting Table. Doing so
| Teleport | 2 | Teleports target to random location. | | Teleport | 2 | Teleports target to random location. |
| Inward | 1 | Causes the Spell to target the caster. If the Spell fails instead of rebounding, it will just do nothing. This does nothing on its own. | | Inward | 1 | Causes the Spell to target the caster. If the Spell fails instead of rebounding, it will just do nothing. This does nothing on its own. |
| Cooling | 1 | Extinguish the target if they are on fire. | | Cooling | 1 | Extinguish the target if they are on fire. |
| Lightning | 1 | Strikes the target with lightning. |
## ```/spell``` Command ## ```/spell``` Command
This command requires OP permissions. This command requires OP permissions.

View File

@ -6,11 +6,11 @@ org.gradle.jvmargs = -Xmx1G
minecraft_version = 20w11a minecraft_version = 20w11a
curseforge_id = 365308 curseforge_id = 365308
simple_minecraft_version = 1.16-Snapshot simple_minecraft_version = 1.16-Snapshot
yarn_mappings = 20w11a+build.1 yarn_mappings = 20w11a+build.6
loader_version = 0.7.8+build.187 loader_version = 0.7.8+build.187
# Mod Properties # Mod Properties
mod_version = 1.1.10 mod_version = 1.1.11
maven_group = com.thebrokenrail maven_group = com.thebrokenrail
archives_base_name = sorcerycraft archives_base_name = sorcerycraft

View File

@ -1,8 +1,8 @@
package com.thebrokenrail.sorcerycraft; package com.thebrokenrail.sorcerycraft;
import com.thebrokenrail.sorcerycraft.block.CastingTableBlock; import com.thebrokenrail.sorcerycraft.block.CastingTableBlock;
import com.thebrokenrail.sorcerycraft.block.CastingTableScreenHandler; import com.thebrokenrail.sorcerycraft.gui.CastingTableScreenHandler;
import com.thebrokenrail.sorcerycraft.client.block.CastingTableScreen; import com.thebrokenrail.sorcerycraft.client.gui.CastingTableScreen;
import com.thebrokenrail.sorcerycraft.client.entity.SpellEntityRenderer; import com.thebrokenrail.sorcerycraft.client.entity.SpellEntityRenderer;
import com.thebrokenrail.sorcerycraft.command.SpellCommand; import com.thebrokenrail.sorcerycraft.command.SpellCommand;
import com.thebrokenrail.sorcerycraft.entity.SpellEntity; import com.thebrokenrail.sorcerycraft.entity.SpellEntity;
@ -108,7 +108,7 @@ public class SorceryCraft implements ModInitializer, ClientModInitializer {
ContainerProviderRegistry.INSTANCE.registerFactory(new Identifier(NAMESPACE, "casting_table"), (syncId, identifier, player, buf) -> { ContainerProviderRegistry.INSTANCE.registerFactory(new Identifier(NAMESPACE, "casting_table"), (syncId, identifier, player, buf) -> {
final World world = player.world; final World world = player.world;
final BlockPos pos = buf.readBlockPos(); final BlockPos pos = buf.readBlockPos();
return Objects.requireNonNull(world.getBlockState(pos).createContainerFactory(player.world, pos)).createMenu(syncId, player.inventory, player); return Objects.requireNonNull(world.getBlockState(pos).createScreenHandlerFactory(player.world, pos)).createMenu(syncId, player.inventory, player);
}); });
CommandRegistry.INSTANCE.register(false, SpellCommand::register); CommandRegistry.INSTANCE.register(false, SpellCommand::register);

View File

@ -1,14 +1,15 @@
package com.thebrokenrail.sorcerycraft.block; package com.thebrokenrail.sorcerycraft.block;
import com.thebrokenrail.sorcerycraft.SorceryCraft; import com.thebrokenrail.sorcerycraft.SorceryCraft;
import com.thebrokenrail.sorcerycraft.gui.CastingTableScreenHandler;
import net.fabricmc.fabric.api.block.FabricBlockSettings; import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.fabricmc.fabric.api.container.ContainerProviderRegistry; import net.fabricmc.fabric.api.container.ContainerProviderRegistry;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.screen.BlockContext; import net.minecraft.screen.NamedScreenHandlerFactory;
import net.minecraft.screen.NameableScreenHandlerFactory; import net.minecraft.screen.ScreenHandlerContext;
import net.minecraft.screen.SimpleNamedScreenHandlerFactory; import net.minecraft.screen.SimpleNamedScreenHandlerFactory;
import net.minecraft.text.TranslatableText; import net.minecraft.text.TranslatableText;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
@ -34,7 +35,7 @@ public class CastingTableBlock extends Block {
} }
@Override @Override
public NameableScreenHandlerFactory createScreenHandlerFactory(BlockState state, World world, BlockPos pos) { public NamedScreenHandlerFactory createScreenHandlerFactory(BlockState state, World world, BlockPos pos) {
return new SimpleNamedScreenHandlerFactory((i, playerInventory, playerEntity) -> new CastingTableScreenHandler(i, playerInventory, BlockContext.create(world, pos)), new TranslatableText("container." + SorceryCraft.NAMESPACE + ".casting_table")); return new SimpleNamedScreenHandlerFactory((i, playerInventory, playerEntity) -> new CastingTableScreenHandler(i, playerInventory, ScreenHandlerContext.create(world, pos)), new TranslatableText("container." + SorceryCraft.NAMESPACE + ".casting_table"));
} }
} }

View File

@ -1,15 +1,15 @@
package com.thebrokenrail.sorcerycraft.client.block; package com.thebrokenrail.sorcerycraft.client.gui;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.thebrokenrail.sorcerycraft.SorceryCraft; import com.thebrokenrail.sorcerycraft.SorceryCraft;
import com.thebrokenrail.sorcerycraft.block.CastingTableScreenHandler; import com.thebrokenrail.sorcerycraft.gui.CastingTableScreenHandler;
import com.thebrokenrail.sorcerycraft.packet.SelectSpellC2SPacket; import com.thebrokenrail.sorcerycraft.packet.SelectSpellC2SPacket;
import com.thebrokenrail.sorcerycraft.spell.api.Spell; import com.thebrokenrail.sorcerycraft.spell.api.Spell;
import com.thebrokenrail.sorcerycraft.spell.util.SpellTag; import com.thebrokenrail.sorcerycraft.spell.util.SpellTag;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -19,7 +19,7 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class CastingTableScreen extends ScreenWithHandler<CastingTableScreenHandler> { public class CastingTableScreen extends HandledScreen<CastingTableScreenHandler> {
private static final Identifier TEXTURE = new Identifier("textures/gui/container/villager2.png"); private static final Identifier TEXTURE = new Identifier("textures/gui/container/villager2.png");
private int selectedIndex; private int selectedIndex;
private int indexStartOffset; private int indexStartOffset;

View File

@ -1,4 +1,4 @@
package com.thebrokenrail.sorcerycraft.block; package com.thebrokenrail.sorcerycraft.gui;
import com.thebrokenrail.sorcerycraft.SorceryCraft; import com.thebrokenrail.sorcerycraft.SorceryCraft;
import com.thebrokenrail.sorcerycraft.spell.api.Spell; import com.thebrokenrail.sorcerycraft.spell.api.Spell;
@ -11,8 +11,8 @@ import net.minecraft.inventory.BasicInventory;
import net.minecraft.inventory.CraftingResultInventory; import net.minecraft.inventory.CraftingResultInventory;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.screen.BlockContext;
import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.ScreenHandlerContext;
import net.minecraft.screen.ScreenHandlerType; import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.Slot;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@ -28,10 +28,10 @@ public class CastingTableScreenHandler extends ScreenHandler {
private final Inventory inventory; private final Inventory inventory;
private final Inventory result; private final Inventory result;
private final Spell[] spells; private final Spell[] spells;
private final BlockContext context; private final ScreenHandlerContext context;
private int index = 0; private int index = 0;
public CastingTableScreenHandler(int syncId, PlayerInventory playerInventory, BlockContext blockContext) { public CastingTableScreenHandler(int syncId, PlayerInventory playerInventory, ScreenHandlerContext blockContext) {
super(ScreenHandlerType.STONECUTTER, syncId); super(ScreenHandlerType.STONECUTTER, syncId);
inventory = new BasicInventory(2) { inventory = new BasicInventory(2) {

View File

@ -1,7 +1,7 @@
package com.thebrokenrail.sorcerycraft.packet; package com.thebrokenrail.sorcerycraft.packet;
import com.thebrokenrail.sorcerycraft.SorceryCraft; import com.thebrokenrail.sorcerycraft.SorceryCraft;
import com.thebrokenrail.sorcerycraft.block.CastingTableScreenHandler; import com.thebrokenrail.sorcerycraft.gui.CastingTableScreenHandler;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import net.fabricmc.fabric.api.network.PacketContext; import net.fabricmc.fabric.api.network.PacketContext;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;

View File

@ -35,7 +35,7 @@ public class CoolingSpell extends Spell {
@Override @Override
public int getXPCost() { public int getXPCost() {
return 13; return 10;
} }
@Override @Override

View File

@ -25,10 +25,10 @@ public class DamageSpell extends Spell {
public int getXPCost() { public int getXPCost() {
switch (getLevel()) { switch (getLevel()) {
case 0: { case 0: {
return 5; return 4;
} }
case 1: { case 1: {
return 10; return 8;
} }
} }
return -1; return -1;

View File

@ -22,7 +22,7 @@ public class DissolveSpell extends Spell {
@Override @Override
public int getXPCost() { public int getXPCost() {
return 12; return 8;
} }
@Override @Override

View File

@ -49,7 +49,7 @@ public class FlameSpell extends Spell {
return 8; return 8;
} }
case 1: { case 1: {
return 16; return 12;
} }
} }
return -1; return -1;

View File

@ -25,10 +25,10 @@ public class HealSpell extends Spell {
public int getXPCost() { public int getXPCost() {
switch (getLevel()) { switch (getLevel()) {
case 0: { case 0: {
return 5; return 4;
} }
case 1: { case 1: {
return 10; return 8;
} }
} }
return -1; return -1;

View File

@ -29,7 +29,7 @@ public class LevitateSpell extends Spell {
return 12; return 12;
} }
case 1: { case 1: {
return 21; return 24;
} }
} }
return -1; return -1;

View File

@ -0,0 +1,53 @@
package com.thebrokenrail.sorcerycraft.spell;
import com.thebrokenrail.sorcerycraft.spell.api.Spell;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LightningEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.Identifier;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
public class LightningSpell extends Spell {
public LightningSpell(Identifier id, int level) {
super(id, level);
}
@Override
public void execute(World world, Entity source, Entity attacker, Entity target) {
strike(world, target.getPos(), attacker);
}
@Override
public void execute(World world, Entity source, Entity attacker, BlockHitResult hitResult) {
strike(world, hitResult.getPos(), attacker);
}
private void strike(World world, Vec3d pos, Entity attacker) {
ServerWorld serverWorld = (ServerWorld) world;
LightningEntity lightningEntity = new LightningEntity(world, pos.getX(), pos.getY(), pos.getZ(), false);
if (attacker instanceof ServerPlayerEntity) {
lightningEntity.setChanneller((ServerPlayerEntity) attacker);
}
serverWorld.addLightning(lightningEntity);
}
@Override
public int getXPCost() {
return 18;
}
@Override
public ItemStack getItemCost() {
return new ItemStack(Items.END_ROD);
}
@Override
public int getMaxLevel() {
return 1;
}
}

View File

@ -8,6 +8,7 @@ import com.thebrokenrail.sorcerycraft.spell.FlameSpell;
import com.thebrokenrail.sorcerycraft.spell.HealSpell; import com.thebrokenrail.sorcerycraft.spell.HealSpell;
import com.thebrokenrail.sorcerycraft.spell.InwardSpell; import com.thebrokenrail.sorcerycraft.spell.InwardSpell;
import com.thebrokenrail.sorcerycraft.spell.LevitateSpell; import com.thebrokenrail.sorcerycraft.spell.LevitateSpell;
import com.thebrokenrail.sorcerycraft.spell.LightningSpell;
import com.thebrokenrail.sorcerycraft.spell.SteadfastSpell; import com.thebrokenrail.sorcerycraft.spell.SteadfastSpell;
import com.thebrokenrail.sorcerycraft.spell.TeleportSpell; import com.thebrokenrail.sorcerycraft.spell.TeleportSpell;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@ -23,6 +24,7 @@ public class Spells {
public static final Identifier TELEPORT_SPELL; public static final Identifier TELEPORT_SPELL;
public static final Identifier INWARD_SPELL; public static final Identifier INWARD_SPELL;
public static final Identifier COOLING_SPELL; public static final Identifier COOLING_SPELL;
public static final Identifier LIGHTNING_SPELL;
static { static {
HEAL_SPELL = SpellRegistry.register(new Identifier(SorceryCraft.NAMESPACE, "heal_spell"), HealSpell.class); HEAL_SPELL = SpellRegistry.register(new Identifier(SorceryCraft.NAMESPACE, "heal_spell"), HealSpell.class);
@ -34,5 +36,6 @@ public class Spells {
TELEPORT_SPELL = SpellRegistry.register(new Identifier(SorceryCraft.NAMESPACE, "teleport_spell"), TeleportSpell.class); TELEPORT_SPELL = SpellRegistry.register(new Identifier(SorceryCraft.NAMESPACE, "teleport_spell"), TeleportSpell.class);
INWARD_SPELL = SpellRegistry.register(new Identifier(SorceryCraft.NAMESPACE, "inward_spell"), InwardSpell.class); INWARD_SPELL = SpellRegistry.register(new Identifier(SorceryCraft.NAMESPACE, "inward_spell"), InwardSpell.class);
COOLING_SPELL = SpellRegistry.register(new Identifier(SorceryCraft.NAMESPACE, "cooling_spell"), CoolingSpell.class); COOLING_SPELL = SpellRegistry.register(new Identifier(SorceryCraft.NAMESPACE, "cooling_spell"), CoolingSpell.class);
LIGHTNING_SPELL = SpellRegistry.register(new Identifier(SorceryCraft.NAMESPACE, "lightning_spell"), LightningSpell.class);
} }
} }

View File

@ -22,5 +22,6 @@
"spell.sorcerycraft.levitate_spell": "Levitate", "spell.sorcerycraft.levitate_spell": "Levitate",
"spell.sorcerycraft.teleport_spell": "Teleport", "spell.sorcerycraft.teleport_spell": "Teleport",
"spell.sorcerycraft.inward_spell": "Inward", "spell.sorcerycraft.inward_spell": "Inward",
"spell.sorcerycraft.cooling_spell": "Cooling" "spell.sorcerycraft.cooling_spell": "Cooling",
"spell.sorcerycraft.lightning_spell": "Lightning"
} }