From 98ca2fbd1698e6974dc07ad695dea0f5fd6995e5 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Wed, 30 Dec 2015 11:34:04 -0500 Subject: [PATCH] Implemented the Ritual Diviner and added its recipe. Added unlocalized name to rituals. Removed a few unnecessary imports. --- .../api/registry/RitualRegistry.java | 21 +- .../bloodmagic/api/ritual/Ritual.java | 5 +- .../api/util/helper/RitualHelper.java | 6 +- .../bloodmagic/item/ItemRitualDiviner.java | 424 ++++++++++++++++++ .../item/sigil/ItemSigilDivination.java | 16 +- .../bloodmagic/registry/ModItems.java | 5 + .../bloodmagic/registry/ModPotions.java | 11 +- .../bloodmagic/registry/ModRecipes.java | 122 ++--- .../bloodmagic/ritual/RitualTest.java | 3 +- .../bloodmagic/ritual/RitualWater.java | 3 +- .../assets/bloodmagic/lang/en_US.lang | 18 + .../models/item/ItemRitualDiviner0.json | 7 + 12 files changed, 553 insertions(+), 88 deletions(-) create mode 100644 src/main/java/WayofTime/bloodmagic/item/ItemRitualDiviner.java create mode 100644 src/main/resources/assets/bloodmagic/models/item/ItemRitualDiviner0.json diff --git a/src/main/java/WayofTime/bloodmagic/api/registry/RitualRegistry.java b/src/main/java/WayofTime/bloodmagic/api/registry/RitualRegistry.java index 599f5e88..47fcb7fb 100644 --- a/src/main/java/WayofTime/bloodmagic/api/registry/RitualRegistry.java +++ b/src/main/java/WayofTime/bloodmagic/api/registry/RitualRegistry.java @@ -1,18 +1,21 @@ package WayofTime.bloodmagic.api.registry; -import WayofTime.bloodmagic.api.BloodMagicAPI; -import WayofTime.bloodmagic.api.ritual.Ritual; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; - import java.util.ArrayList; import java.util.HashMap; import java.util.Map; +import WayofTime.bloodmagic.api.BloodMagicAPI; +import WayofTime.bloodmagic.api.ritual.Ritual; + +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; + public class RitualRegistry { public static final Map enabledRituals = new HashMap(); private static final BiMap registry = HashBiMap.create(); + // Ordered list for actions that depend on the order that the rituals were registered in + private static final ArrayList orderedIdList = new ArrayList(); /** * The safe way to register a new Ritual. @@ -24,8 +27,10 @@ public class RitualRegistry { if (ritual != null) { if (registry.containsKey(id)) BloodMagicAPI.getLogger().error("Duplicate ritual id: %s", id); - else + else { registry.put(id, ritual); + orderedIdList.add(id); + } } } @@ -65,6 +70,10 @@ public class RitualRegistry { public static ArrayList getIds() { return new ArrayList(registry.keySet()); } + + public static ArrayList getOrderedIds() { + return orderedIdList; + } public static ArrayList getRituals() { return new ArrayList(registry.values()); diff --git a/src/main/java/WayofTime/bloodmagic/api/ritual/Ritual.java b/src/main/java/WayofTime/bloodmagic/api/ritual/Ritual.java index 249fbddb..0e03cbe4 100644 --- a/src/main/java/WayofTime/bloodmagic/api/ritual/Ritual.java +++ b/src/main/java/WayofTime/bloodmagic/api/ritual/Ritual.java @@ -26,14 +26,15 @@ public abstract class Ritual { private final int crystalLevel; private final int activationCost; private final RitualRenderer renderer; + private final String unlocalizedName; /** * @param name - The name of the ritual * @param crystalLevel - Required Activation Crystal tier * @param activationCost - Base LP cost for activating the ritual */ - public Ritual(String name, int crystalLevel, int activationCost) { - this(name, crystalLevel, activationCost, null); + public Ritual(String name, int crystalLevel, int activationCost, String unlocalizedName) { + this(name, crystalLevel, activationCost, null, unlocalizedName); } /** diff --git a/src/main/java/WayofTime/bloodmagic/api/util/helper/RitualHelper.java b/src/main/java/WayofTime/bloodmagic/api/util/helper/RitualHelper.java index ebd2521f..6712a4bd 100644 --- a/src/main/java/WayofTime/bloodmagic/api/util/helper/RitualHelper.java +++ b/src/main/java/WayofTime/bloodmagic/api/util/helper/RitualHelper.java @@ -14,10 +14,10 @@ import net.minecraftforge.common.config.Configuration; import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.api.registry.ImperfectRitualRegistry; import WayofTime.bloodmagic.api.registry.RitualRegistry; +import WayofTime.bloodmagic.api.ritual.IRitualStone; import WayofTime.bloodmagic.api.ritual.Ritual; import WayofTime.bloodmagic.api.ritual.RitualComponent; import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual; -import WayofTime.bloodmagic.block.BlockRitualStone; public class RitualHelper { @@ -84,8 +84,8 @@ public class RitualHelper { BlockPos newPos = pos.add(component.getOffset(direction)); IBlockState worldState = world.getBlockState(newPos); Block block = worldState.getBlock(); - if (block instanceof BlockRitualStone) { - if(!((BlockRitualStone)block).isRuneType(world, newPos, component.getRuneType())) { + if (block instanceof IRitualStone) { + if(!((IRitualStone)block).isRuneType(world, newPos, component.getRuneType())) { return false; } }else { diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemRitualDiviner.java b/src/main/java/WayofTime/bloodmagic/item/ItemRitualDiviner.java new file mode 100644 index 00000000..703b6e4b --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/item/ItemRitualDiviner.java @@ -0,0 +1,424 @@ +package WayofTime.bloodmagic.item; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import org.lwjgl.input.Keyboard; + +import WayofTime.bloodmagic.BloodMagic; +import WayofTime.bloodmagic.api.Constants; +import WayofTime.bloodmagic.api.registry.RitualRegistry; +import WayofTime.bloodmagic.api.ritual.EnumRuneType; +import WayofTime.bloodmagic.api.ritual.IRitualStone; +import WayofTime.bloodmagic.api.ritual.Ritual; +import WayofTime.bloodmagic.api.ritual.RitualComponent; +import WayofTime.bloodmagic.registry.ModBlocks; +import WayofTime.bloodmagic.tile.TileMasterRitualStone; +import WayofTime.bloodmagic.util.ChatUtil; +import WayofTime.bloodmagic.util.helper.TextHelper; + +public class ItemRitualDiviner extends Item { + + public static final String tooltipBase = "tooltip.BloodMagic.diviner."; + + public ItemRitualDiviner() { + setUnlocalizedName(Constants.Mod.MODID + ".ritualDiviner"); + setCreativeTab(BloodMagic.tabBloodMagic); + setHasSubtypes(true); + setMaxStackSize(1); + } + + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { + if (addRuneToRitual(stack, world, pos, player)) { + //TODO: Have the diviner automagically build the ritual + } + + return false; + } + + /** + * Adds a single rune to the ritual. + * + * @param world + * - + * @param pos + * - Block Position of the MRS. + * @return - True if a rune was successfully added + */ + public boolean addRuneToRitual(ItemStack stack, World world, BlockPos pos, EntityPlayer player) { + TileEntity tile = world.getTileEntity(pos); + + if (tile instanceof TileMasterRitualStone) { + Ritual ritual = RitualRegistry.getRitualForId(this.getCurrentRitual(stack)); + if (ritual != null) { + EnumFacing direction = getDirection(stack); + for (RitualComponent component : ritual.getComponents()) { + if (!canPlaceRitualStone(component.getRuneType(), stack)) { + return false; + } + BlockPos offset = component.getOffset(direction); + BlockPos newPos = pos.add(offset); + IBlockState state = world.getBlockState(newPos); + Block block = state.getBlock(); + if (block instanceof IRitualStone) { // TODO: Check tile + // entity as well. + if (((IRitualStone) block).isRuneType(world, newPos, component.getRuneType())) { + continue; + } else { + // Replace existing ritual stone + int meta = component.getRuneType().ordinal(); + IBlockState newState = ModBlocks.ritualStone.getStateFromMeta(meta); + world.setBlockState(newPos, newState); + return true; + } + } else if (block.isAir(world, newPos)) { + if (!consumeStone(stack, world, player)) { + return false; + } + int meta = component.getRuneType().ordinal(); + IBlockState newState = ModBlocks.ritualStone.getStateFromMeta(meta); + world.setBlockState(newPos, newState); + return true; + } else { + return false; // TODO: Possibly replace the block with a + // ritual stone + } + } + } + } + + return false; + } + + // TODO: Make this work for any IRitualStone + public boolean consumeStone(ItemStack stack, World world, EntityPlayer player) { + ItemStack[] inventory = player.inventory.mainInventory; + for (int i = 0; i < inventory.length; i++) { + ItemStack newStack = inventory[i]; + if (newStack == null) { + continue; + } + Item item = newStack.getItem(); + if (item instanceof ItemBlock) { + Block block = ((ItemBlock) item).getBlock(); + if (block == ModBlocks.ritualStone) { + newStack.stackSize--; + if (newStack.stackSize <= 0) { + inventory[i] = null; + } + + return true; + } + } + } + + return false; + } + + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) { + Ritual ritual = RitualRegistry.getRitualForId(this.getCurrentRitual(stack)); + if (ritual != null) { + tooltip.add(TextHelper.localize("tooltip.BloodMagic.diviner.currentRitual") + TextHelper.localize(ritual.getUnlocalizedName())); + + boolean sneaking = Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT); + + if (sneaking) { + tooltip.add(TextHelper.localize(tooltipBase + "currentDirection", getDirection(stack))); + tooltip.add(""); + ArrayList componentList = ritual.getComponents(); + + int blankRunes = 0; + int airRunes = 0; + int waterRunes = 0; + int fireRunes = 0; + int earthRunes = 0; + int duskRunes = 0; + int dawnRunes = 0; + int totalRunes = 0; + + for (RitualComponent component : componentList) { + totalRunes++; + switch (component.getRuneType()) { + case BLANK: + blankRunes++; + break; + case AIR: + airRunes++; + break; + case EARTH: + earthRunes++; + break; + case FIRE: + fireRunes++; + break; + case WATER: + waterRunes++; + break; + case DUSK: + duskRunes++; + break; + case DAWN: + dawnRunes++; + break; + } + } + + if (blankRunes > 0) { + tooltip.add(TextHelper.localize(tooltipBase + "blankRune", blankRunes)); + } + if (waterRunes > 0) { + tooltip.add(TextHelper.localize(tooltipBase + "waterRune", waterRunes)); + } + if (airRunes > 0) { + tooltip.add(TextHelper.localize(tooltipBase + "airRune", airRunes)); + } + if (fireRunes > 0) { + tooltip.add(TextHelper.localize(tooltipBase + "fireRune", fireRunes)); + } + if (earthRunes > 0) { + tooltip.add(TextHelper.localize(tooltipBase + "earthRune", earthRunes)); + } + if (duskRunes > 0) { + tooltip.add(TextHelper.localize(tooltipBase + "duskRune", duskRunes)); + } + if (dawnRunes > 0) { + tooltip.add(TextHelper.localize(tooltipBase + "dawnRune", dawnRunes)); + } + + tooltip.add(""); + tooltip.add(TextHelper.localize(tooltipBase + "totalRune", totalRunes)); + } else { + tooltip.add(""); + tooltip.add(TextHelper.localize(tooltipBase + "extraInfo")); + } + } + } + + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + + if (player.isSneaking() && !world.isRemote) { + cycleRitual(stack, player); + } + + return stack; + } + + @Override + public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) { + if (entityLiving instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) entityLiving; + + if (!player.isSwingInProgress) { + if (player.isSneaking()) { + cycleRitualBackwards(stack, player); + } else { + cycleDirection(stack, player); + } + } + } + + return false; + } + + public void cycleDirection(ItemStack stack, EntityPlayer player) { + EnumFacing direction = getDirection(stack); + EnumFacing newDirection; + switch (direction) { + case NORTH: + newDirection = EnumFacing.EAST; + break; + case EAST: + newDirection = EnumFacing.SOUTH; + break; + case SOUTH: + newDirection = EnumFacing.WEST; + break; + case WEST: + newDirection = EnumFacing.NORTH; + break; + default: + newDirection = EnumFacing.NORTH; + } + + setDirection(stack, newDirection); + notifyDirectionChange(newDirection, player); + } + + public void notifyDirectionChange(EnumFacing direction, EntityPlayer player) { + ChatUtil.sendNoSpam(player, TextHelper.localize(tooltipBase + "currentDirection", direction.getName())); + } + + public void setDirection(ItemStack stack, EnumFacing direction) { + if (!stack.hasTagCompound()) { + stack.setTagCompound(new NBTTagCompound()); + } + + NBTTagCompound tag = stack.getTagCompound(); + + tag.setInteger(Constants.NBT.DIRECTION, direction.getIndex()); + } + + public EnumFacing getDirection(ItemStack stack) { + if (!stack.hasTagCompound()) { + stack.setTagCompound(new NBTTagCompound()); + return EnumFacing.NORTH; + } + + NBTTagCompound tag = stack.getTagCompound(); + + return EnumFacing.VALUES[tag.getInteger(Constants.NBT.DIRECTION)]; + } + + /** + * Cycles the selected ritual to the next available ritual that is enabled. + * + * @param stack + * - The ItemStack of the ritual diviner + * @param player + * - The player using the ritual diviner + */ + public void cycleRitual(ItemStack stack, EntityPlayer player) { + String key = getCurrentRitual(stack); + List idList = RitualRegistry.getOrderedIds(); + String firstId = ""; + boolean foundId = false; + boolean foundFirst = false; + + for (String str : idList) { + Ritual ritual = RitualRegistry.getRitualForId(str); + + if (!RitualRegistry.ritualEnabled(ritual) || !canDivinerPerformRitual(stack, ritual)) { + continue; + } + + if (!foundFirst) { + firstId = str; + foundFirst = true; + } + + if (foundId) { + setCurrentRitual(stack, str); + notifyRitualChange(str, player); + return; + } else { + if (str.equals(key)) { + foundId = true; + continue; + } + } + } + + if (foundFirst) { + setCurrentRitual(stack, firstId); + notifyRitualChange(firstId, player); + } + } + + /** + * Does the same as cycleRitual but instead cycles backwards. + * + * @param stack + * @param player + */ + public void cycleRitualBackwards(ItemStack stack, EntityPlayer player) { + String key = getCurrentRitual(stack); + List idList = RitualRegistry.getOrderedIds(); + String firstId = ""; + boolean foundId = false; + boolean foundFirst = false; + + for (int i = idList.size() - 1; i >= 0; i--) { + String str = idList.get(i); + Ritual ritual = RitualRegistry.getRitualForId(str); + + if (!RitualRegistry.ritualEnabled(ritual) || !canDivinerPerformRitual(stack, ritual)) { + continue; + } + + if (!foundFirst) { + firstId = str; + foundFirst = true; + } + + if (foundId) { + setCurrentRitual(stack, str); + notifyRitualChange(str, player); + return; + } else { + if (str.equals(key)) { + foundId = true; + continue; + } + } + } + + if (foundFirst) { + setCurrentRitual(stack, firstId); + notifyRitualChange(firstId, player); + } + } + + public boolean canDivinerPerformRitual(ItemStack stack, Ritual ritual) { + return true; + } + + public void notifyRitualChange(String key, EntityPlayer player) { + Ritual ritual = RitualRegistry.getRitualForId(key); + if (ritual != null) { + ChatUtil.sendNoSpam(player, TextHelper.localize(tooltipBase + "currentRitual") + TextHelper.localize(ritual.getUnlocalizedName())); + } + } + + public void setCurrentRitual(ItemStack stack, String key) { + if (!stack.hasTagCompound()) { + stack.setTagCompound(new NBTTagCompound()); + } + + NBTTagCompound tag = stack.getTagCompound(); + + tag.setString(Constants.NBT.CURRENT_RITUAL, key); + } + + public String getCurrentRitual(ItemStack stack) { + if (!stack.hasTagCompound()) { + stack.setTagCompound(new NBTTagCompound()); + } + + NBTTagCompound tag = stack.getTagCompound(); + return tag.getString(Constants.NBT.CURRENT_RITUAL); + } + + public boolean canPlaceRitualStone(EnumRuneType rune, ItemStack stack) { + int meta = stack.getItemDamage(); + switch (rune) { + case BLANK: + case AIR: + case EARTH: + case FIRE: + case WATER: + return true; + case DUSK: + return meta >= 1; + case DAWN: + return meta >= 2; + } + + return false; + } +} diff --git a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilDivination.java b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilDivination.java index 41f1bc83..95f4d339 100644 --- a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilDivination.java +++ b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilDivination.java @@ -1,20 +1,18 @@ package WayofTime.bloodmagic.item.sigil; -import WayofTime.bloodmagic.api.altar.IBloodAltar; -import WayofTime.bloodmagic.api.iface.IAltarReader; -import WayofTime.bloodmagic.api.iface.ISigil; -import WayofTime.bloodmagic.api.util.helper.BindableHelper; -import WayofTime.bloodmagic.api.util.helper.NetworkHelper; -import WayofTime.bloodmagic.api.util.helper.PlayerHelper; -import WayofTime.bloodmagic.tile.TileAltar; -import WayofTime.bloodmagic.util.ChatUtil; -import WayofTime.bloodmagic.util.helper.TextHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentText; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; +import WayofTime.bloodmagic.api.altar.IBloodAltar; +import WayofTime.bloodmagic.api.iface.IAltarReader; +import WayofTime.bloodmagic.api.util.helper.BindableHelper; +import WayofTime.bloodmagic.api.util.helper.NetworkHelper; +import WayofTime.bloodmagic.api.util.helper.PlayerHelper; +import WayofTime.bloodmagic.util.ChatUtil; +import WayofTime.bloodmagic.util.helper.TextHelper; public class ItemSigilDivination extends ItemSigilBase implements IAltarReader { diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModItems.java b/src/main/java/WayofTime/bloodmagic/registry/ModItems.java index d885673f..49405af6 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModItems.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModItems.java @@ -35,6 +35,7 @@ public class ModItems { public static Item packSelfSacrifice; public static Item packSacrifice; public static Item daggerOfSacrifice; + public static Item ritualDiviner; public static Item boundSword; public static Item boundPickaxe; @@ -98,6 +99,8 @@ public class ModItems { packSelfSacrifice = registerItem(new ItemPackSelfSacrifice()); daggerOfSacrifice = registerItem(new ItemDaggerOfSacrifice()); + ritualDiviner = registerItem(new ItemRitualDiviner()); + boundSword = registerItem(new ItemBoundSword()); boundPickaxe = registerItem(new ItemBoundPickaxe()); boundAxe = registerItem(new ItemBoundAxe()); @@ -168,6 +171,8 @@ public class ModItems { renderHelper.itemRender(packSacrifice); renderHelper.itemRender(packSelfSacrifice); renderHelper.itemRender(daggerOfSacrifice); + + renderHelper.itemRender(ritualDiviner, 0); renderHelper.itemRender(boundSword, 0); renderHelper.itemRender(boundSword, 1); diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModPotions.java b/src/main/java/WayofTime/bloodmagic/registry/ModPotions.java index fed56c9d..99366836 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModPotions.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModPotions.java @@ -1,14 +1,13 @@ package WayofTime.bloodmagic.registry; -import WayofTime.bloodmagic.api.Constants; -import WayofTime.bloodmagic.potion.PotionBloodMagic; -import WayofTime.bloodmagic.potion.PotionEventHandlers; -import net.minecraft.potion.Potion; -import net.minecraft.util.ResourceLocation; - import java.lang.reflect.Field; import java.lang.reflect.Modifier; +import net.minecraft.potion.Potion; +import net.minecraft.util.ResourceLocation; +import WayofTime.bloodmagic.potion.PotionBloodMagic; +import WayofTime.bloodmagic.potion.PotionEventHandlers; + public class ModPotions { public static Potion drowning; diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java index bdafe660..fa818112 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java @@ -24,73 +24,75 @@ import net.minecraftforge.oredict.RecipeSorter; public class ModRecipes { - public static void init() { - RecipeSorter.register(Constants.Mod.DOMAIN + "shapedorb", ShapedBloodOrbRecipe.class, RecipeSorter.Category.SHAPED, "before:minecraft:shapeless"); - RecipeSorter.register(Constants.Mod.DOMAIN + ":shapelessorb", ShapelessBloodOrbRecipe.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); + public static void init() { + RecipeSorter.register(Constants.Mod.DOMAIN + "shapedorb", ShapedBloodOrbRecipe.class, RecipeSorter.Category.SHAPED, "before:minecraft:shapeless"); + RecipeSorter.register(Constants.Mod.DOMAIN + ":shapelessorb", ShapelessBloodOrbRecipe.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); - addCraftingRecipes(); - addAltarRecipes(); - addAlchemyArrayRecipes(); - } + addCraftingRecipes(); + addAltarRecipes(); + addAlchemyArrayRecipes(); + } - public static void addCraftingRecipes() { - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), "xox", "oSo", "xox", 'S', OrbRegistry.getOrbStack(ModItems.orbMagician), 'o', new ItemStack(Items.redstone), 'x', new ItemStack(Items.glowstone_dust))); - //Added for testing - GameRegistry.addRecipe(new ShapelessBloodOrbRecipe(new ItemStack(Items.gold_ingot), new ItemStack(ModItems.slate, 1, 1), OrbRegistry.getOrbStack(ModItems.orbApprentice))); - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(Items.diamond), " ", " s ", " o ", 's', new ItemStack(ModItems.slate), 'o', OrbRegistry.getOrbStack(ModItems.orbWeak))); - } - - public static void addAltarRecipes() { - // ONE - AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(OrbRegistry.getOrbStack(ModItems.orbWeak), OrbRegistry.getOrbStack(ModItems.orbWeak), EnumAltarTier.ONE, 5000, 2, 1, true)); - AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.diamond), OrbRegistry.getOrbStack(ModItems.orbWeak), EnumAltarTier.ONE, 2000, 2, 1, false)); - AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.stone), new ItemStack(ModItems.slate), EnumAltarTier.ONE, 1000, 5, 5, false)); + public static void addCraftingRecipes() { + GameRegistry.addRecipe(new ShapedBloodOrbRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), "xox", "oSo", "xox", 'S', OrbRegistry.getOrbStack(ModItems.orbMagician), 'o', new ItemStack(Items.redstone), 'x', new ItemStack(Items.glowstone_dust))); + // Added for testing + GameRegistry.addRecipe(new ShapelessBloodOrbRecipe(new ItemStack(Items.gold_ingot), new ItemStack(ModItems.slate, 1, 1), OrbRegistry.getOrbStack(ModItems.orbApprentice))); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(Items.diamond), " ", " s ", " o ", 's', new ItemStack(ModItems.slate), 'o', OrbRegistry.getOrbStack(ModItems.orbWeak))); - // TWO - AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.emerald), OrbRegistry.getOrbStack(ModItems.orbApprentice), EnumAltarTier.TWO, 5000, 2, 1, false)); - AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.slate), new ItemStack(ModItems.slate, 1, 1), EnumAltarTier.TWO, 2000, 5, 5, false)); + GameRegistry.addRecipe(new ItemStack(ModItems.ritualDiviner), "dfd", "ase", "dwd", 'f', EnumRuneType.FIRE.getScribeStack(), 'a', EnumRuneType.AIR.getScribeStack(), 'w', EnumRuneType.WATER.getScribeStack(), 'e', EnumRuneType.EARTH.getScribeStack(), 'd', new ItemStack(Items.diamond), 's', new ItemStack(Items.stick)); + } - // THREE - AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.gold_block), OrbRegistry.getOrbStack(ModItems.orbMagician), EnumAltarTier.THREE, 25000, 2, 1, false)); - AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.slate, 1, 1), new ItemStack(ModItems.slate, 1, 2), EnumAltarTier.THREE, 5000, 15, 10, false)); - AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.obsidian), EnumRuneType.EARTH.getScribeStack(), EnumAltarTier.THREE, 1000, 5, 5, false)); - AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.lapis_block), EnumRuneType.WATER.getScribeStack(), EnumAltarTier.THREE, 1000, 5, 5, false)); - AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.magma_cream), EnumRuneType.FIRE.getScribeStack(), EnumAltarTier.THREE, 1000, 5, 5, false)); - AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.ghast_tear), EnumRuneType.AIR.getScribeStack(), EnumAltarTier.THREE, 1000, 5, 5, false)); + public static void addAltarRecipes() { + // ONE + AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(OrbRegistry.getOrbStack(ModItems.orbWeak), OrbRegistry.getOrbStack(ModItems.orbWeak), EnumAltarTier.ONE, 5000, 2, 1, true)); + AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.diamond), OrbRegistry.getOrbStack(ModItems.orbWeak), EnumAltarTier.ONE, 2000, 2, 1, false)); + AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.stone), new ItemStack(ModItems.slate), EnumAltarTier.ONE, 1000, 5, 5, false)); - // FOUR - AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.slate, 1, 2), new ItemStack(ModItems.slate, 1, 3), EnumAltarTier.FOUR, 15000, 20, 20, false)); - AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.coal_block), EnumRuneType.DUSK.getScribeStack(), EnumAltarTier.FOUR, 2000, 20, 10, false)); + // TWO + AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.emerald), OrbRegistry.getOrbStack(ModItems.orbApprentice), EnumAltarTier.TWO, 5000, 2, 1, false)); + AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.slate), new ItemStack(ModItems.slate, 1, 1), EnumAltarTier.TWO, 2000, 5, 5, false)); - // FIVE - AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.slate, 1, 3), new ItemStack(ModItems.slate, 1, 4), EnumAltarTier.FIVE, 30000, 40, 100, false)); + // THREE + AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.gold_block), OrbRegistry.getOrbStack(ModItems.orbMagician), EnumAltarTier.THREE, 25000, 2, 1, false)); + AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.slate, 1, 1), new ItemStack(ModItems.slate, 1, 2), EnumAltarTier.THREE, 5000, 15, 10, false)); + AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.obsidian), EnumRuneType.EARTH.getScribeStack(), EnumAltarTier.THREE, 1000, 5, 5, false)); + AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.lapis_block), EnumRuneType.WATER.getScribeStack(), EnumAltarTier.THREE, 1000, 5, 5, false)); + AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.magma_cream), EnumRuneType.FIRE.getScribeStack(), EnumAltarTier.THREE, 1000, 5, 5, false)); + AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Items.ghast_tear), EnumRuneType.AIR.getScribeStack(), EnumAltarTier.THREE, 1000, 5, 5, false)); - // SIX - AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModBlocks.crystal), OrbRegistry.getOrbStack(ModItems.orbTranscendent), EnumAltarTier.SIX, 200000, 100, 200, false)); - AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.glowstone), EnumRuneType.DAWN.getScribeStack(), EnumAltarTier.SIX, 200000, 100, 200, false)); - } - - public static void addAlchemyArrayRecipes() { - AlchemyArrayRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), new ItemStack(Items.diamond_sword), new AlchemyArrayEffectBinding(new ItemStack(ModItems.boundSword)), new BindingAlchemyCircleRenderer()); - AlchemyArrayRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), new ItemStack(Items.diamond_axe), new AlchemyArrayEffectBinding(new ItemStack(ModItems.boundAxe))); - AlchemyArrayRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), new ItemStack(Items.diamond_pickaxe), new AlchemyArrayEffectBinding(new ItemStack(ModItems.boundPickaxe))); - AlchemyArrayRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), new ItemStack(Items.diamond_shovel), new AlchemyArrayEffectBinding(new ItemStack(ModItems.boundShovel))); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_WATER), new ItemStack(ModItems.slate), new ItemStack(ModItems.sigilWater), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WaterSigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_LAVA), new ItemStack(ModItems.slate), new ItemStack(ModItems.sigilLava), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/LavaSigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_AIR), new ItemStack(ModItems.slate, 1, 1), new ItemStack(ModItems.sigilAir), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/AirSigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_FASTMINER), new ItemStack(ModItems.slate, 1, 1), new ItemStack(ModItems.sigilFastMiner), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/FastMinerSigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_VOID), new ItemStack(ModItems.slate, 1, 1), new ItemStack(ModItems.sigilVoid), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/VoidSigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_GROWTH), new ItemStack(ModItems.slate, 1, 1), new ItemStack(ModItems.sigilGreenGrove), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/GrowthSigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_AFFINITY), new ItemStack(ModItems.slate, 1, 2), new ItemStack(ModItems.sigilElementalAffinity), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/ElementalAffinitySigil.png")); - AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_SIGHT), new ItemStack(ModItems.slate, 1, 1), new ItemStack(ModItems.sigilSeer), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SightSigil.png")); - } + // FOUR + AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.slate, 1, 2), new ItemStack(ModItems.slate, 1, 3), EnumAltarTier.FOUR, 15000, 20, 20, false)); + AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.coal_block), EnumRuneType.DUSK.getScribeStack(), EnumAltarTier.FOUR, 2000, 20, 10, false)); - public static void addCompressionHandlers() { - StorageBlockCraftingManager.getInstance().addStorageBlockRecipes(); - CompressionRegistry.registerHandler(new BaseCompressionHandler(new ItemStack(Items.glowstone_dust, 4, 0), new ItemStack(Blocks.glowstone), 64)); - CompressionRegistry.registerHandler(new BaseCompressionHandler(new ItemStack(Items.snowball, 4, 0), new ItemStack(Blocks.snow), 8)); - CompressionRegistry.registerHandler(new AdvancedCompressionHandler()); + // FIVE + AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModItems.slate, 1, 3), new ItemStack(ModItems.slate, 1, 4), EnumAltarTier.FIVE, 30000, 40, 100, false)); - CompressionRegistry.registerItemThreshold(new ItemStack(Blocks.cobblestone), 64); - } + // SIX + AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(ModBlocks.crystal), OrbRegistry.getOrbStack(ModItems.orbTranscendent), EnumAltarTier.SIX, 200000, 100, 200, false)); + AltarRecipeRegistry.registerRecipe(new AltarRecipeRegistry.AltarRecipe(new ItemStack(Blocks.glowstone), EnumRuneType.DAWN.getScribeStack(), EnumAltarTier.SIX, 200000, 100, 200, false)); + } + + public static void addAlchemyArrayRecipes() { + AlchemyArrayRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), new ItemStack(Items.diamond_sword), new AlchemyArrayEffectBinding(new ItemStack(ModItems.boundSword)), new BindingAlchemyCircleRenderer()); + AlchemyArrayRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), new ItemStack(Items.diamond_axe), new AlchemyArrayEffectBinding(new ItemStack(ModItems.boundAxe))); + AlchemyArrayRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), new ItemStack(Items.diamond_pickaxe), new AlchemyArrayEffectBinding(new ItemStack(ModItems.boundPickaxe))); + AlchemyArrayRecipeRegistry.registerRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BINDING), new ItemStack(Items.diamond_shovel), new AlchemyArrayEffectBinding(new ItemStack(ModItems.boundShovel))); + AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_WATER), new ItemStack(ModItems.slate), new ItemStack(ModItems.sigilWater), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WaterSigil.png")); + AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_LAVA), new ItemStack(ModItems.slate), new ItemStack(ModItems.sigilLava), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/LavaSigil.png")); + AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_AIR), new ItemStack(ModItems.slate, 1, 1), new ItemStack(ModItems.sigilAir), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/AirSigil.png")); + AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_FASTMINER), new ItemStack(ModItems.slate, 1, 1), new ItemStack(ModItems.sigilFastMiner), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/FastMinerSigil.png")); + AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_VOID), new ItemStack(ModItems.slate, 1, 1), new ItemStack(ModItems.sigilVoid), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/VoidSigil.png")); + AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_GROWTH), new ItemStack(ModItems.slate, 1, 1), new ItemStack(ModItems.sigilGreenGrove), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/GrowthSigil.png")); + AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_AFFINITY), new ItemStack(ModItems.slate, 1, 2), new ItemStack(ModItems.sigilElementalAffinity), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/ElementalAffinitySigil.png")); + AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_SIGHT), new ItemStack(ModItems.slate, 1, 1), new ItemStack(ModItems.sigilSeer), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SightSigil.png")); + } + + public static void addCompressionHandlers() { + StorageBlockCraftingManager.getInstance().addStorageBlockRecipes(); + CompressionRegistry.registerHandler(new BaseCompressionHandler(new ItemStack(Items.glowstone_dust, 4, 0), new ItemStack(Blocks.glowstone), 64)); + CompressionRegistry.registerHandler(new BaseCompressionHandler(new ItemStack(Items.snowball, 4, 0), new ItemStack(Blocks.snow), 8)); + CompressionRegistry.registerHandler(new AdvancedCompressionHandler()); + + CompressionRegistry.registerItemThreshold(new ItemStack(Blocks.cobblestone), 64); + } } diff --git a/src/main/java/WayofTime/bloodmagic/ritual/RitualTest.java b/src/main/java/WayofTime/bloodmagic/ritual/RitualTest.java index 78ac7a40..57ba250e 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/RitualTest.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/RitualTest.java @@ -1,5 +1,6 @@ package WayofTime.bloodmagic.ritual; +import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.ritual.*; import WayofTime.bloodmagic.api.util.helper.PlayerHelper; import net.minecraft.entity.player.EntityPlayer; @@ -11,7 +12,7 @@ import java.util.ArrayList; public class RitualTest extends Ritual { public RitualTest() { - super("ritualTest", 0, 1000); + super("ritualTest", 0, 1000, "ritual." + Constants.Mod.MODID + ".testRitual"); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/ritual/RitualWater.java b/src/main/java/WayofTime/bloodmagic/ritual/RitualWater.java index 55e7efff..03e5e877 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/RitualWater.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/RitualWater.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.world.World; +import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.network.SoulNetwork; import WayofTime.bloodmagic.api.ritual.EnumRuneType; import WayofTime.bloodmagic.api.ritual.IMasterRitualStone; @@ -15,7 +16,7 @@ import WayofTime.bloodmagic.api.util.helper.NetworkHelper; public class RitualWater extends Ritual { public RitualWater() { - super("ritualWater", 0, 1000); + super("ritualWater", 0, 1000, "ritual." + Constants.Mod.MODID + ".waterRitual"); } @Override diff --git a/src/main/resources/assets/bloodmagic/lang/en_US.lang b/src/main/resources/assets/bloodmagic/lang/en_US.lang index 8ddf6bab..da028005 100644 --- a/src/main/resources/assets/bloodmagic/lang/en_US.lang +++ b/src/main/resources/assets/bloodmagic/lang/en_US.lang @@ -98,6 +98,8 @@ item.BloodMagic.sigil.enderSeverance.name=Sigil of Ender Severance item.BloodMagic.altarMaker.name=Altar Maker +item.BloodMagic.ritualDiviner.name=Ritual Diviner + # Blocks tile.BloodMagic.fluid.lifeEssence.name=Life Essence @@ -182,6 +184,22 @@ tooltip.BloodMagic.activationCrystal.weak=Activates low-level rituals tooltip.BloodMagic.activationCrystal.awakened=Activates more powerful rituals tooltip.BloodMagic.activationCrystal.creative=Creative Only - Activates any ritual +tooltip.BloodMagic.diviner.currentRitual=Current Ritual: +tooltip.BloodMagic.diviner.blankRune=Blank Runes: %d +tooltip.BloodMagic.diviner.waterRune=Water Runes: %d +tooltip.BloodMagic.diviner.airRune=Air Runes: %d +tooltip.BloodMagic.diviner.fireRune=Fire Runes: %d +tooltip.BloodMagic.diviner.earthRune=Earth Runes: %d +tooltip.BloodMagic.diviner.duskRune=Dusk Runes: %d +tooltip.BloodMagic.diviner.dawnRune=Dawn Runes: %d +tooltip.BloodMagic.diviner.totalRune=Total Runes: %d +tooltip.BloodMagic.diviner.extraInfo=Press shift for extra info +tooltip.BloodMagic.diviner.currentDirection=Current Direction: %s + +# Ritual +ritual.BloodMagic.testRitual=Test Ritual +ritual.BloodMagic.waterRitual=Ritual of the Full Spring + # Chat chat.BloodMagic.altarMaker.setTier=Set Tier to: %d chat.BloodMagic.altarMaker.building=Building a Tier %d Altar diff --git a/src/main/resources/assets/bloodmagic/models/item/ItemRitualDiviner0.json b/src/main/resources/assets/bloodmagic/models/item/ItemRitualDiviner0.json new file mode 100644 index 00000000..a1564a6f --- /dev/null +++ b/src/main/resources/assets/bloodmagic/models/item/ItemRitualDiviner0.json @@ -0,0 +1,7 @@ +{ + "parent":"bloodmagic:item/ItemModelBase", + "textures": { + "layer0":"bloodmagic:items/RitualDiviner" + } +} +