diff --git a/src/main/java/elucent/rootsclassic/block/altar/AltarBlockEntity.java b/src/main/java/elucent/rootsclassic/block/altar/AltarBlockEntity.java index 9af5767c..e4c5c2ab 100644 --- a/src/main/java/elucent/rootsclassic/block/altar/AltarBlockEntity.java +++ b/src/main/java/elucent/rootsclassic/block/altar/AltarBlockEntity.java @@ -1,19 +1,21 @@ package elucent.rootsclassic.block.altar; +import com.google.common.collect.Lists; import elucent.rootsclassic.block.brazier.BrazierBlockEntity; import elucent.rootsclassic.blockentity.BEBase; import elucent.rootsclassic.client.particles.MagicAltarParticleData; import elucent.rootsclassic.client.particles.MagicLineParticleData; +import elucent.rootsclassic.recipe.RitualRecipe; import elucent.rootsclassic.registry.RootsRegistry; -import elucent.rootsclassic.ritual.RitualBase; -import elucent.rootsclassic.ritual.RitualBaseRegistry; +import elucent.rootsclassic.ritual.RitualEffect; +import elucent.rootsclassic.ritual.RitualPillars; import elucent.rootsclassic.ritual.RitualRegistry; import elucent.rootsclassic.util.InventoryUtil; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.NbtUtils; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.item.ItemEntity; @@ -23,22 +25,31 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemStackHandler; import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.awt.Color; import java.util.ArrayList; +import java.util.Collections; +import java.util.List; public class AltarBlockEntity extends BEBase { private static final int RECIPE_PROGRESS_TIME = 200; - private ArrayList incenses = new ArrayList<>(); + private List incenses = Collections.emptyList(); private int ticker = 0; private int progress = 0; - private ResourceLocation ritualName = null; - private RitualBase ritualCurrent = null; - // private ItemStack resultItem = ItemStack.EMPTY; TODO: Unused + + @Nullable + private RitualRecipe ritualCurrent = null; + private int clientRitualLevel; + private Color clientRitualColor; + private Color clientRitualSecondaryColor; + public final ItemStackHandler inventory = new ItemStackHandler(3) { @Override @@ -64,13 +75,24 @@ public void load(CompoundTag tag) { if (tag.contains("incenses")) { ListTag list = tag.getList("incenses", CompoundTag.TAG_COMPOUND); for (int i = 0; i < list.size(); i++) { - getIncenses().add(ItemStack.of(list.getCompound(i))); + incenses.add(ItemStack.of(list.getCompound(i))); } } + + /* if (tag.contains("ritualName")) { setRitualNameFromString(tag.getString("ritualName")); - setRitualCurrent(RitualBaseRegistry.RITUALS.get().getValue(getRitualName())); + setRitualCurrent(RitualRegistry.byName(getRitualName(), level.getRecipeManager())); + } + */ + + if (level != null && level.isClientSide() && tag.contains("ritual", 10)) { + var ritualTag = tag.getCompound("ritual"); + clientRitualLevel = ritualTag.getInt("level"); + clientRitualColor = new Color(ritualTag.getInt("color")); + clientRitualSecondaryColor = new Color(ritualTag.getInt("secondaryColor")); } + if (tag.contains("progress")) { setProgress(tag.getInt("progress")); } @@ -80,19 +102,31 @@ public void load(CompoundTag tag) { public void saveAdditional(CompoundTag tag) { super.saveAdditional(tag); tag.put("InventoryHandler", inventory.serializeNBT()); - if (getIncenses().size() > 0) { + if (incenses.size() > 0) { ListTag list = new ListTag(); - for (int i = 0; i < getIncenses().size(); i++) { + for (int i = 0; i < incenses.size(); i++) { // ; - // if (getIncenses().get(i) != null) { - list.add(getIncenses().get(i).save(new CompoundTag())); + // if (incenses.get(i) != null) { + list.add(incenses.get(i).save(new CompoundTag())); // } } tag.put("incenses", list); } + + /* if (getRitualName() != null) { tag.putString("ritualName", getRitualName().toString()); } + */ + + if (level != null && !level.isClientSide() && ritualCurrent != null) { + var ritualTag = new CompoundTag(); + ritualTag.putInt("level", ritualCurrent.level); + ritualTag.putInt("color", ritualCurrent.color.getRGB()); + ritualTag.putInt("secondaryColor", ritualCurrent.secondaryColor.getRGB()); + tag.put("ritual", ritualTag); + } + tag.putInt("progress", getProgress()); } @@ -128,24 +162,28 @@ public InteractionResult activate(Level levelAccessor, BlockPos pos, BlockState } } else if (player.isShiftKeyDown() && heldItem.isEmpty() && this.getProgress() == 0) { // Try to start a new ritual - setRitualName(null); - setRitualCurrent(null); - RitualBase ritual = RitualRegistry.findMatchingByIngredients(this); - if (ritual == null) { + + setRitual(null); + + var optionalRitual = RitualRegistry.findMatchingByIngredients(this); + if (optionalRitual.isEmpty()) { player.displayClientMessage(Component.translatable("rootsclassic.error.noritual.ingredients"), true); return InteractionResult.FAIL; } - if (!ritual.verifyPositionBlocks(levelAccessor, pos)) { + + var ritual = optionalRitual.get(); + + if (!RitualPillars.verifyPositionBlocks(ritual, levelAccessor, pos)) { player.displayClientMessage(Component.translatable("rootsclassic.error.noritual.stones"), true); return InteractionResult.FAIL; } //does it match everything else? if (ritual.incenseMatches(level, pos)) { - setRitualCurrent(ritual); - setRitualName(RitualBaseRegistry.RITUALS.get().getKey(ritual)); + setRitual(ritual); + setIncenses(RitualRegistry.getIncenses(levelAccessor, pos)); setProgress(RECIPE_PROGRESS_TIME); - for (BrazierBlockEntity brazier : ritual.getRecipeBraziers(levelAccessor, pos)) { + for (BrazierBlockEntity brazier : RitualPillars.getRecipeBraziers(levelAccessor, pos)) { brazier.setBurning(true); brazier.setHeldItem(ItemStack.EMPTY); } @@ -189,7 +227,7 @@ public static void serverTick(Level level, BlockPos pos, BlockState state, Altar if (tile.getTicker() > 360) { tile.setTicker(0); } - if (tile.getProgress() > 0 && tile.getRitualCurrent() != null) { + if (tile.getProgress() > 0 && tile.ritualCurrent != null) { tile.setProgress(tile.getProgress() - 1); // if (tile.getProgress() % 40 == 0) { // setIncenses(RitualManager.getIncenses(getWorld(), getPos())); @@ -204,10 +242,10 @@ public static void serverTick(Level level, BlockPos pos, BlockState state, Altar // setRitualName(null); // } // } - if (tile.getProgress() == 0 && tile.getRitualCurrent() != null) { - tile.getRitualCurrent().doEffect(level, pos, InventoryUtil.createIInventory(tile.inventory), tile.getIncenses()); - tile.setRitualName(null); - tile.setRitualCurrent(null); + if (tile.getProgress() == 0 && tile.ritualCurrent != null) { + tile.ritualCurrent.doEffect(level, pos, InventoryUtil.createIInventory(tile.inventory), tile.incenses); + + tile.setRitual(null); tile.emptyAltar(); tile.setChanged(); level.sendBlockUpdated(pos, state, state, 3); @@ -216,54 +254,61 @@ public static void serverTick(Level level, BlockPos pos, BlockState state, Altar } public static void clientTick(Level level, BlockPos pos, BlockState state, AltarBlockEntity tile) { - if (tile.getProgress() > 0 && tile.getRitualCurrent() != null) { + if (tile.getProgress() > 0 && tile.ritualCurrent != null) { tile.setProgress(tile.getProgress() - 1); - if (tile.getRitualCurrent().getPositionsRelative().size() > 0) { - BlockPos particlePos = tile.getRitualCurrent().getPositionsRelative().get(level.random.nextInt(tile.getRitualCurrent().getPositionsRelative().size())).above() - .offset(pos.getX(), pos.getY(), pos.getZ()); + var pillars = RitualPillars.getRitualPillars(tile.clientRitualLevel); + var pillarPositions = pillars.keySet().stream().toList(); + var color = tile.clientRitualColor; + var secondaryColor = tile.clientRitualSecondaryColor; + + if(color == null || secondaryColor == null) return; + + if (!pillars.isEmpty()) { + BlockPos particlePos = pillarPositions.get(level.random.nextInt(pillars.size())).above().offset(pos); if (level.random.nextInt(6) == 0) { - level.addParticle(MagicLineParticleData.createData(tile.getRitualCurrent().getColor().x, tile.getRitualCurrent().getColor().y, tile.getRitualCurrent().getColor().z), + level.addParticle(MagicLineParticleData.createData(color.getRed(), color.getGreen(), color.getBlue()), particlePos.getX() + 0.5, particlePos.getY() + 0.125, particlePos.getZ() + 0.5, particlePos.getX() + 0.5, particlePos.getY() + 0.875, particlePos.getZ() + 0.5); } else { - level.addParticle(MagicLineParticleData.createData(tile.getRitualCurrent().getSecondaryColor().x, tile.getRitualCurrent().getSecondaryColor().y, tile.getRitualCurrent().getSecondaryColor().z), + level.addParticle(MagicLineParticleData.createData(secondaryColor.getRed(), secondaryColor.getGreen(), secondaryColor.getBlue()), particlePos.getX() + 0.5, particlePos.getY() + 0.125, particlePos.getZ() + 0.5, particlePos.getX() + 0.5, particlePos.getY() + 0.875, particlePos.getZ() + 0.5); } } + if (level.random.nextInt(4) == 0) { - level.addParticle(MagicAltarParticleData.createData(tile.getRitualCurrent().getColor().x, tile.getRitualCurrent().getColor().y, tile.getRitualCurrent().getColor().z), + level.addParticle(MagicAltarParticleData.createData(color.getRed(), color.getGreen(), color.getBlue()), pos.getX() + 0.5, pos.getY() + 0.875, pos.getZ() + 0.5, 0.125 * Math.sin(Math.toRadians(360.0 * (tile.getProgress() % 100) / 100.0)), 0, 0.125 * Math.cos(Math.toRadians(360.0 * (tile.getProgress() % 100) / 100.0))); } else { - level.addParticle(MagicAltarParticleData.createData(tile.getRitualCurrent().getSecondaryColor().x, tile.getRitualCurrent().getSecondaryColor().y, tile.getRitualCurrent().getSecondaryColor().z), + level.addParticle(MagicAltarParticleData.createData(secondaryColor.getRed(), secondaryColor.getGreen(), secondaryColor.getBlue()), pos.getX() + 0.5, pos.getY() + 0.875, pos.getZ() + 0.5, 0.125 * Math.sin(Math.toRadians(360.0 * (tile.getProgress() % 100) / 100.0)), 0, 0.125 * Math.cos(Math.toRadians(360.0 * (tile.getProgress() % 100) / 100.0))); } if (level.random.nextInt(4) == 0) { - level.addParticle(MagicAltarParticleData.createData(tile.getRitualCurrent().getColor().x, tile.getRitualCurrent().getColor().y, tile.getRitualCurrent().getColor().z), + level.addParticle(MagicAltarParticleData.createData(color.getRed(), color.getGreen(), color.getBlue()), pos.getX() + 0.5, pos.getY() + 0.875, pos.getZ() + 0.5, .125 * Math.sin(Math.toRadians(90.0 + 360.0 * (tile.getProgress() % 100) / 100.0)), 0, 0.125 * Math.cos(Math.toRadians(90.0 + 360.0 * (tile.getProgress() % 100) / 100.0))); } else { - level.addParticle(MagicAltarParticleData.createData(tile.getRitualCurrent().getSecondaryColor().x, tile.getRitualCurrent().getSecondaryColor().y, tile.getRitualCurrent().getSecondaryColor().z), + level.addParticle(MagicAltarParticleData.createData(secondaryColor.getRed(), secondaryColor.getGreen(), secondaryColor.getBlue()), pos.getX() + 0.5, pos.getY() + 0.875, pos.getZ() + 0.5, .125 * Math.sin(Math.toRadians(90.0 + 360.0 * (tile.getProgress() % 100) / 100.0)), 0, 0.125 * Math.cos(Math.toRadians(90.0 + 360.0 * (tile.getProgress() % 100) / 100.0))); } if (level.random.nextInt(4) == 0) { - level.addParticle(MagicAltarParticleData.createData(tile.getRitualCurrent().getColor().x, tile.getRitualCurrent().getColor().y, tile.getRitualCurrent().getColor().z), + level.addParticle(MagicAltarParticleData.createData(color.getRed(), color.getGreen(), color.getBlue()), pos.getX() + 0.5, pos.getY() + 0.875, pos.getZ() + 0.5, .125 * Math.sin(Math.toRadians(180.0 + 360.0 * (tile.getProgress() % 100) / 100.0)), 0, 0.125 * Math.cos(Math.toRadians(180.0 + 360.0 * (tile.getProgress() % 100) / 100.0))); } else { - level.addParticle(MagicAltarParticleData.createData(tile.getRitualCurrent().getSecondaryColor().x, tile.getRitualCurrent().getSecondaryColor().y, tile.getRitualCurrent().getSecondaryColor().z), + level.addParticle(MagicAltarParticleData.createData(secondaryColor.getRed(), secondaryColor.getGreen(), secondaryColor.getBlue()), pos.getX() + 0.5, pos.getY() + 0.875, pos.getZ() + 0.5, .125 * Math.sin(Math.toRadians(180.0 + 360.0 * (tile.getProgress() % 100) / 100.0)), 0, 0.125 * Math.cos(Math.toRadians(180.0 + 360.0 * (tile.getProgress() % 100) / 100.0))); } if (level.random.nextInt(4) == 0) { - level.addParticle(MagicAltarParticleData.createData(tile.getRitualCurrent().getColor().x, tile.getRitualCurrent().getColor().y, tile.getRitualCurrent().getColor().z), + level.addParticle(MagicAltarParticleData.createData(color.getRed(), color.getGreen(), color.getBlue()), pos.getX() + 0.5, pos.getY() + 0.875, pos.getZ() + 0.5, .125 * Math.sin(Math.toRadians(270.0 + 360.0 * (tile.getProgress() % 100) / 100.0)), 0, 0.125 * Math.cos(Math.toRadians(270.0 + 360.0 * (tile.getProgress() % 100) / 100.0))); } else { - level.addParticle(MagicAltarParticleData.createData(tile.getRitualCurrent().getSecondaryColor().x, tile.getRitualCurrent().getSecondaryColor().y, tile.getRitualCurrent().getSecondaryColor().z), + level.addParticle(MagicAltarParticleData.createData(secondaryColor.getRed(), secondaryColor.getGreen(), secondaryColor.getBlue()), pos.getX() + 0.5, pos.getY() + 0.875, pos.getZ() + 0.5, .125 * Math.sin(Math.toRadians(270.0 + 360.0 * (tile.getProgress() % 100) / 100.0)), 0, 0.125 * Math.cos(Math.toRadians(270.0 + 360.0 * (tile.getProgress() % 100) / 100.0))); } @@ -271,17 +316,13 @@ public static void clientTick(Level level, BlockPos pos, BlockState state, Altar } // private void emptyNearbyBraziers() { - // for (TileEntityBrazier brazier : getRitualCurrent().getRecipeBraziers(world, pos)) { + // for (TileEntityBrazier brazier : ritualCurrent.getRecipeBraziers(world, pos)) { // brazier.setHeldItem(ItemStack.EMPTY); // brazier.setBurning(false); // } // } - public ArrayList getIncenses() { - return incenses; - } - - public void setIncenses(ArrayList incenses) { + public void setIncenses(List incenses) { this.incenses = incenses; } @@ -301,24 +342,9 @@ public void setProgress(int progress) { this.progress = progress; } - public ResourceLocation getRitualName() { - return ritualName; - } - - public void setRitualNameFromString(String ritualName) { - this.ritualName = ResourceLocation.tryParse(ritualName); - } - - public void setRitualName(ResourceLocation ritualName) { - this.ritualName = ritualName; - } - - public RitualBase getRitualCurrent() { - return ritualCurrent; - } - - public void setRitualCurrent(RitualBase ritualCurrent) { + public void setRitual(RitualRecipe ritualCurrent) { this.ritualCurrent = ritualCurrent; + setChanged(); } public void emptyAltar() { diff --git a/src/main/java/elucent/rootsclassic/client/screen/TabletPageScreen.java b/src/main/java/elucent/rootsclassic/client/screen/TabletPageScreen.java index 780e8c80..3bdc5142 100644 --- a/src/main/java/elucent/rootsclassic/client/screen/TabletPageScreen.java +++ b/src/main/java/elucent/rootsclassic/client/screen/TabletPageScreen.java @@ -9,8 +9,10 @@ import elucent.rootsclassic.research.ResearchBase; import elucent.rootsclassic.research.ResearchGroup; import elucent.rootsclassic.research.ResearchPage; +import elucent.rootsclassic.ritual.RitualPillars; import elucent.rootsclassic.util.RootsUtil; import net.minecraft.ChatFormatting; +import net.minecraft.Util; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.resources.language.I18n; @@ -93,7 +95,7 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { && mouseY >= (height / 2.0f) - 138 && mouseY < (height / 2.0f) - 40) { if (researchInfo.get(currentPage).recipe == EnumPageType.TYPE_MORTAR) { //Roots.lang("rootsclassic.recipe.chat") + - player.sendSystemMessage(Component.translatable(researchInfo.get(currentPage).mortarRecipe.toString())); + player.sendSystemMessage(Component.literal(researchInfo.get(currentPage).mortarRecipe.toString())); } else if (researchInfo.get(currentPage).recipe == EnumPageType.TYPE_ALTAR) { player.sendSystemMessage(Component.translatable(researchInfo.get(currentPage).altarRecipe.toString())); } @@ -169,31 +171,37 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTic case TYPE_ALTAR -> { RenderSystem.setShaderTexture(0, Const.tabletAltar); this.blit(poseStack, basePosX, basePosY, 0, 0, 192, 256); - for (int i = 0; i < page.altarRecipe.getBlocks().size(); i++) { + + RitualPillars.getRitualPillars(page.altarRecipe.level).forEach((pos, block) -> { + RenderSystem.setShaderTexture(0, Const.tabletAltar); int u = 192; int v = 240; int xShift = 0; int yShift = 0; this.blit(poseStack, basePosX + 93, basePosY + 153, 192, 32, 16, 16); - if (page.altarRecipe.getBlocks().get(i).equals(RootsRegistry.MUNDANE_STANDING_STONE.get())) { + if (block.equals(RootsRegistry.MUNDANE_STANDING_STONE.get())) { v = 48; - xShift = 8 * (int) page.altarRecipe.getPositionsRelative().get(i).getX(); - yShift = 8 * (int) page.altarRecipe.getPositionsRelative().get(i).getZ(); + xShift = 8 * pos.getX(); + yShift = 8 * pos.getZ(); } - if (page.altarRecipe.getBlocks().get(i).equals(RootsRegistry.ATTUNED_STANDING_STONE.get())) { + if (block.equals(RootsRegistry.ATTUNED_STANDING_STONE.get())) { v = 64; - xShift = 8 * (int) page.altarRecipe.getPositionsRelative().get(i).getX(); - yShift = 8 * (int) page.altarRecipe.getPositionsRelative().get(i).getZ(); + xShift = 8 * pos.getX(); + yShift = 8 * pos.getZ(); } this.blit(poseStack, basePosX + 93 + xShift, basePosY + 153 + yShift, u, v, 16, 16); - } + }); + for (int i = 0; i < page.altarRecipe.getIngredients().size(); i++) { - slots.add(new ScreenSlotInstance(page.altarRecipe.getIngredients().get(i), (int) basePosX + 64 + 24 * i, (int) basePosY + 56)); + var stack = page.altarRecipe.getIngredients().get(i).getItems()[0]; + slots.add(new ScreenSlotInstance(stack, (int) basePosX + 64 + 24 * i, (int) basePosY + 56)); } for (int i = 0; i < page.altarRecipe.getIncenses().size(); i++) { - slots.add(new ScreenSlotInstance(page.altarRecipe.getIncenses().get(i), (int) basePosX + 76 + 16 * i, (int) basePosY + 88)); + var stack = page.altarRecipe.getIncenses().get(i).getItems()[0]; + slots.add(new ScreenSlotInstance(stack, (int) basePosX + 76 + 16 * i, (int) basePosY + 88)); } + title = makeTitle(); textLines.add(new ScreenTextInstance(title, basePosX + 96 - (this.font.width(title) / 2.0f), basePosY + 12, RootsUtil.intColor(255, 255, 255))); } diff --git a/src/main/java/elucent/rootsclassic/client/screen/TabletScreen.java b/src/main/java/elucent/rootsclassic/client/screen/TabletScreen.java index 73b177bb..2d708a98 100644 --- a/src/main/java/elucent/rootsclassic/client/screen/TabletScreen.java +++ b/src/main/java/elucent/rootsclassic/client/screen/TabletScreen.java @@ -161,4 +161,4 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTic } poseStack.popPose(); } -} +} \ No newline at end of file diff --git a/src/main/java/elucent/rootsclassic/compat/RitualZen.java b/src/main/java/elucent/rootsclassic/compat/RitualZen.java index 7f6168ec..bc591a64 100644 --- a/src/main/java/elucent/rootsclassic/compat/RitualZen.java +++ b/src/main/java/elucent/rootsclassic/compat/RitualZen.java @@ -3,7 +3,7 @@ import com.blamejared.crafttweaker.api.CraftTweakerAPI; import com.blamejared.crafttweaker.api.annotation.ZenRegister; import com.blamejared.crafttweaker.api.item.IItemStack; -import elucent.rootsclassic.ritual.RitualBase; +import elucent.rootsclassic.ritual.RitualEffect; import elucent.rootsclassic.ritual.RitualBaseRegistry; import elucent.rootsclassic.ritual.rituals.RitualCrafting; import net.minecraft.resources.ResourceLocation; @@ -22,6 +22,7 @@ public class RitualZen { public RitualZen() { } + /* @Method public static void addCraftingRitual(String uniqueName, IItemStack output, int level, double r, double g, double b, IItemStack[] incenses, IItemStack[] ingredients) { @@ -62,6 +63,7 @@ public static void setLevel(ResourceLocation name, int level) { *

* Starting with rootsclassic (Example: "rootsclassic:staff_crafting") */ + /* @Method public static void setRitualIngredients(ResourceLocation name, IItemStack[] items) { RitualBase found = findRitualByName(name); @@ -102,4 +104,5 @@ private static ItemStack[] convertToStacks(IItemStack[] stacks) { return output; } } + */ } diff --git a/src/main/java/elucent/rootsclassic/compat/jei/JEIPlugin.java b/src/main/java/elucent/rootsclassic/compat/jei/JEIPlugin.java index d6a8a06c..fd88ac38 100644 --- a/src/main/java/elucent/rootsclassic/compat/jei/JEIPlugin.java +++ b/src/main/java/elucent/rootsclassic/compat/jei/JEIPlugin.java @@ -81,14 +81,7 @@ public void registerRecipes(IRecipeRegistration registration) { ClientLevel world = Objects.requireNonNull(Minecraft.getInstance().level); registration.addRecipes(MORTAR_TYPE, world.getRecipeManager().getAllRecipesFor(RootsRecipes.COMPONENT_RECIPE_TYPE.get())); - registration.addRecipes(RITUAL_TYPE, getRituals()); - } - - public List getRituals() { - List entries = new LinkedList<>(); - - RitualRegistry.RITUALS.getEntries().forEach(ritual -> entries.add(new RitualWrapper(ritual.get()))); - - return entries; + var ritualRecipes = world.getRecipeManager().getAllRecipesFor(RootsRecipes.RITUAL_RECIPE_TYPE.get()); + registration.addRecipes(RITUAL_TYPE, ritualRecipes.stream().map(RitualWrapper::new).toList()); } } diff --git a/src/main/java/elucent/rootsclassic/compat/jei/category/RitualCategory.java b/src/main/java/elucent/rootsclassic/compat/jei/category/RitualCategory.java index 0dec5782..bc7d94c6 100644 --- a/src/main/java/elucent/rootsclassic/compat/jei/category/RitualCategory.java +++ b/src/main/java/elucent/rootsclassic/compat/jei/category/RitualCategory.java @@ -15,10 +15,13 @@ import mezz.jei.api.recipe.RecipeIngredientRole; import mezz.jei.api.recipe.RecipeType; import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.block.Block; import java.util.List; @@ -38,7 +41,7 @@ public class RitualCategory implements IRecipeCategory { private final Component localizedName; public RitualCategory(IGuiHelper guiHelper) { - this.background = guiHelper.drawableBuilder(backgroundLocation, 0, 0, 94, 100).addPadding(0, 0, 0, 0).build(); + this.background = guiHelper.drawableBuilder(backgroundLocation, 0, 0, 94, 110).addPadding(0, 0, 0, 0).build(); this.icon = guiHelper.createDrawableIngredient(VanillaTypes.ITEM_STACK, new ItemStack(RootsRegistry.ALTAR.get())); @@ -75,12 +78,12 @@ public Component getTitle() { @Override public void setRecipe(IRecipeLayoutBuilder builder, RitualWrapper recipe, IFocusGroup focuses) { for (int i = 0; i < recipe.getIngredients().size(); i++) { - ItemStack stack = recipe.getIngredients().get(i); - builder.addSlot(RecipeIngredientRole.INPUT, 15 + (i * 24), 3).addItemStack(stack); + Ingredient ingredient = recipe.getIngredients().get(i); + builder.addSlot(RecipeIngredientRole.INPUT, 15 + (i * 24), 3).addIngredients(ingredient); } for (int i = 0; i < recipe.getIncenses().size(); i++) { - ItemStack stack = recipe.getIncenses().get(i); - builder.addSlot(RecipeIngredientRole.CATALYST, 28 + (i * 16), 27).addItemStack(stack); + Ingredient ingredient = recipe.getIncenses().get(i); + builder.addSlot(RecipeIngredientRole.CATALYST, 28 + (i * 16), 27).addIngredients(ingredient); } if (!recipe.getResult().isEmpty()) { @@ -94,6 +97,7 @@ public void draw(RitualWrapper recipe, IRecipeSlotsView recipeSlotsView, PoseSta ingredientBackground.draw(stack, 12, 0); incenseBackground.draw(stack, 0, 24); resultBackground.draw(stack, 64, 64); + stack.pushPose(); stack.scale(0.5F, 0.5F, 1); @@ -101,23 +105,28 @@ public void draw(RitualWrapper recipe, IRecipeSlotsView recipeSlotsView, PoseSta int basePosX = 63; int basePosY = 135; - final List blocks = recipe.getBlocks(); - final List relativePosition = recipe.getPositionsRelative(); - for (int i = 0; i < blocks.size(); i++) { - int xShift = 0; - int yShift = 0; + + recipe.getPillars().forEach((pos, block) -> { + var xShift = 8 * pos.getX(); + var yShift = 8 * pos.getZ(); stone.draw(stack, basePosX, basePosY); - if (blocks.get(i).equals(RootsRegistry.MUNDANE_STANDING_STONE.get())) { - xShift = 8 * (int) relativePosition.get(i).getX(); - yShift = 8 * (int) relativePosition.get(i).getZ(); + if (block.equals(RootsRegistry.MUNDANE_STANDING_STONE.get())) { + xShift = 8 * pos.getX(); + yShift = 8 * pos.getZ(); mundaneStone.draw(stack, basePosX + xShift, basePosY + yShift); } - if (blocks.get(i).equals(RootsRegistry.ATTUNED_STANDING_STONE.get())) { - xShift = 8 * (int) relativePosition.get(i).getX(); - yShift = 8 * (int) relativePosition.get(i).getZ(); + if (block.equals(RootsRegistry.ATTUNED_STANDING_STONE.get())) { + xShift = 8 * pos.getX(); + yShift = 8 * pos.getZ(); attunedStone.draw(stack, basePosX + xShift, basePosY + yShift); } - } + }); + stack.popPose(); + + Minecraft minecraft = Minecraft.getInstance(); + Font font = minecraft.font; + var infoText = recipe.getInfoText(); + font.draw(stack, infoText, (94 - font.width(infoText)) / 2F, 100, 0x8b8b8b); } } diff --git a/src/main/java/elucent/rootsclassic/compat/jei/wrapper/RitualWrapper.java b/src/main/java/elucent/rootsclassic/compat/jei/wrapper/RitualWrapper.java index f0f8fd34..cb2aba6a 100644 --- a/src/main/java/elucent/rootsclassic/compat/jei/wrapper/RitualWrapper.java +++ b/src/main/java/elucent/rootsclassic/compat/jei/wrapper/RitualWrapper.java @@ -1,42 +1,42 @@ package elucent.rootsclassic.compat.jei.wrapper; -import elucent.rootsclassic.ritual.RitualBase; -import elucent.rootsclassic.ritual.rituals.RitualCrafting; +import elucent.rootsclassic.recipe.RitualRecipe; +import elucent.rootsclassic.ritual.RitualPillars; import mezz.jei.api.recipe.category.extensions.IRecipeCategoryExtension; import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.block.Block; -import java.util.ArrayList; import java.util.List; +import java.util.Map; public class RitualWrapper implements IRecipeCategoryExtension { - private final RitualBase ritual; + private final RitualRecipe ritual; - public ArrayList getBlocks() { - return ritual.getBlocks(); + public Map getPillars() { + return RitualPillars.getRitualPillars(ritual.level); } - public ArrayList getPositionsRelative() { - return ritual.getPositionsRelative(); - } - - public List getIngredients() { + public List getIngredients() { return ritual.getIngredients(); } - public List getIncenses() { + public List getIncenses() { return ritual.getIncenses(); } public ItemStack getResult() { - if (ritual instanceof RitualCrafting ritualCrafting) { - return ritualCrafting.result; - } - return ItemStack.EMPTY; + return ritual.getResultItem(); + } + + public MutableComponent getInfoText() { + return ritual.getInfoText(); } - public RitualWrapper(RitualBase ritual) { + public RitualWrapper(RitualRecipe ritual) { this.ritual = ritual; } } diff --git a/src/main/java/elucent/rootsclassic/recipe/RitualRecipe.java b/src/main/java/elucent/rootsclassic/recipe/RitualRecipe.java new file mode 100644 index 00000000..a812ce90 --- /dev/null +++ b/src/main/java/elucent/rootsclassic/recipe/RitualRecipe.java @@ -0,0 +1,197 @@ +package elucent.rootsclassic.recipe; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import elucent.rootsclassic.Const; +import elucent.rootsclassic.block.brazier.BrazierBlockEntity; +import elucent.rootsclassic.registry.RootsRecipes; +import elucent.rootsclassic.ritual.RitualBaseRegistry; +import elucent.rootsclassic.ritual.RitualEffect; +import elucent.rootsclassic.ritual.RitualPillars; +import elucent.rootsclassic.util.RootsUtil; +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.GsonHelper; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; + +import javax.annotation.Nullable; +import java.awt.Color; +import java.util.ArrayList; +import java.util.List; + +public class RitualRecipe implements Recipe { + private final ResourceLocation id; + + private final NonNullList materials; + private final NonNullList incenses; + + public final int level; + + public final Color color; + public final Color secondaryColor; + + public final RitualEffect effect; + public final C effectConfig; + + public RitualRecipe(ResourceLocation id, RitualEffect effect, C effectConfig, NonNullList materials, NonNullList incenses, int level, Color color, Color secondaryColor) { + this.id = id; + this.materials = materials; + this.incenses = incenses; + this.level = level; + this.effect = effect; + this.effectConfig = effectConfig; + this.color = color; + this.secondaryColor = secondaryColor; + } + + @Override + public ResourceLocation getId() { + return id; + } + + @Override + public RecipeSerializer getSerializer() { + return RootsRecipes.RITUAL_SERIALIZER.get(); + } + + @Override + public ItemStack assemble(Container inventory) { + return getResultItem(); + } + + @Override + public ItemStack getResultItem() { + return effect.getResult(effectConfig).copy(); + } + + @Override + public NonNullList getIngredients() { + return materials; + } + + @Override + public RecipeType getType() { + return RootsRecipes.RITUAL_RECIPE_TYPE.get(); + } + + public Component getLocalizedName() { + return Component.translatable(Const.MODID + ".ritual." + this.getId()); + } + + @Override + public boolean canCraftInDimensions(int p_43999_, int p_44000_) { + return false; + } + + @Override + public boolean matches(Container inventory, Level worldIn) { + return false; + } + + public List getIncenses() { + return incenses; + } + + public MutableComponent getInfoText() { + return effect.getInfoText(effectConfig); + } + + public static class SerializeRitualRecipe implements RecipeSerializer> { + + public RitualRecipe fromJson(ResourceLocation recipeId, JsonObject json) { + var ingredients = readIngredients(GsonHelper.getAsJsonArray(json, "ingredients")); + var incenses = readIngredients(GsonHelper.getAsJsonArray(json, "incenses")); + if (ingredients.isEmpty() && incenses.isEmpty()) { + throw new JsonParseException("No ingredients for ritual recipe"); + } else { + var level = GsonHelper.getAsInt(json, "level"); + if (level < 0 || level > 2) throw new IllegalArgumentException("Level must be 0, 1 or 2"); + + var effectId = new ResourceLocation(GsonHelper.getAsString(json, "effect")); + var effect = RitualBaseRegistry.RITUALS.get().getValue(effectId); + var effectConfig = effect.fromJSON(json); + + var color = Color.decode(GsonHelper.getAsString(json, "color")); + var secondaryColor = json.has("secondaryColor") ? Color.decode(GsonHelper.getAsString(json, "secondaryColor")) : color; + + return new RitualRecipe(recipeId, effect, effectConfig, ingredients, incenses, level, color, secondaryColor); + } + } + + private static NonNullList readIngredients(JsonArray ingredientArray) { + NonNullList list = NonNullList.create(); + for (int i = 0; i < ingredientArray.size(); ++i) { + var stack = Ingredient.fromJson(ingredientArray.get(i).getAsJsonObject()); + if (!stack.isEmpty()) { + list.add(stack); + } + } + return list; + } + + public RitualRecipe fromNetwork(ResourceLocation recipeId, FriendlyByteBuf buffer) { + var level = buffer.readVarInt(); + + var color = new Color(buffer.readVarInt()); + var secondaryColor = new Color(buffer.readVarInt()); + + var size = buffer.readVarInt(); + var ingredients = NonNullList.withSize(size, Ingredient.EMPTY); + ingredients.replaceAll(ignored -> Ingredient.fromNetwork(buffer)); + + size = buffer.readVarInt(); + var incenses = NonNullList.withSize(size, Ingredient.EMPTY); + incenses.replaceAll(ignored -> Ingredient.fromNetwork(buffer)); + + var effectId = buffer.readResourceLocation(); + var effect = RitualBaseRegistry.RITUALS.get().getValue(effectId); + var effectConfig = effect.fromNetwork(buffer); + + return new RitualRecipe(recipeId, effect, effectConfig, ingredients, incenses, level, color, secondaryColor); + } + + public void toNetwork(FriendlyByteBuf buffer, RitualRecipe recipe) { + buffer.writeVarInt(recipe.level); + + buffer.writeVarInt(recipe.color.getRGB()); + buffer.writeVarInt(recipe.secondaryColor.getRGB()); + + buffer.writeCollection((List) recipe.materials, (buf, it) -> it.toNetwork(buf)); + buffer.writeCollection((List) recipe.incenses, (buf, it) -> it.toNetwork(buf)); + + buffer.writeResourceLocation(RitualBaseRegistry.RITUALS.get().getKey(recipe.effect)); + recipe.effect.toNetwork(recipe.effectConfig, buffer); + } + } + + public boolean incenseMatches(Level levelAccessor, BlockPos pos) { + ArrayList incenseFromNearby = new ArrayList<>(); + List braziers = RitualPillars.getRecipeBraziers(levelAccessor, pos); + for (BrazierBlockEntity brazier : braziers) { + if (!brazier.getHeldItem().isEmpty()) { + // Roots.logger.info("found brazier item " + brazier.getHeldItem()); + incenseFromNearby.add(brazier.getHeldItem()); + } + } + return RootsUtil.matchesIngredients(incenseFromNearby, incenses); + } + + + public void doEffect(Level levelAccessor, BlockPos pos, Container inventory, List incenses) { + effect.doEffect(levelAccessor, pos, inventory, incenses, effectConfig); + } + +} diff --git a/src/main/java/elucent/rootsclassic/registry/RootsRecipes.java b/src/main/java/elucent/rootsclassic/registry/RootsRecipes.java index 439b74c9..8922310f 100644 --- a/src/main/java/elucent/rootsclassic/registry/RootsRecipes.java +++ b/src/main/java/elucent/rootsclassic/registry/RootsRecipes.java @@ -3,6 +3,8 @@ import elucent.rootsclassic.Const; import elucent.rootsclassic.recipe.ComponentRecipe; import elucent.rootsclassic.recipe.ComponentRecipe.SerializeComponentRecipe; +import elucent.rootsclassic.recipe.RitualRecipe; +import elucent.rootsclassic.recipe.RitualRecipe.SerializeRitualRecipe; import net.minecraft.core.Registry; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeType; @@ -18,4 +20,8 @@ public class RootsRecipes { public static final RegistryObject> COMPONENT_RECIPE_TYPE = RECIPE_TYPES.register("component", () -> new RecipeType<>() { }); public static final RegistryObject COMPONENT_SERIALIZER = RECIPE_SERIALIZERS.register("component", SerializeComponentRecipe::new); + + public static final RegistryObject>> RITUAL_RECIPE_TYPE = RECIPE_TYPES.register("ritual", () -> new RecipeType<>() { + }); + public static final RegistryObject RITUAL_SERIALIZER = RECIPE_SERIALIZERS.register("ritual", SerializeRitualRecipe::new); } diff --git a/src/main/java/elucent/rootsclassic/research/ResearchBase.java b/src/main/java/elucent/rootsclassic/research/ResearchBase.java index 5a508b57..7cb79fa4 100644 --- a/src/main/java/elucent/rootsclassic/research/ResearchBase.java +++ b/src/main/java/elucent/rootsclassic/research/ResearchBase.java @@ -1,8 +1,12 @@ package elucent.rootsclassic.research; +import elucent.rootsclassic.Roots; +import elucent.rootsclassic.recipe.RitualRecipe; import net.minecraft.world.item.ItemStack; +import org.checkerframework.checker.nullness.qual.NonNull; import java.util.ArrayList; +import java.util.Optional; public class ResearchBase { public double posX = 0; @@ -22,6 +26,15 @@ public ResearchBase addPage(ResearchPage page) { return this; } + public ResearchBase addPageOf(@NonNull Optional> optionalRitual) { + optionalRitual.ifPresentOrElse(ritual -> { + info.add(new ResearchPage().addAltarRecipe(ritual)); + }, () -> { + Roots.LOGGER.warn("Missing altar recipe for page {}", name); + }); + return this; + } + public String getName() { return name; } @@ -37,4 +50,4 @@ public ResearchBase getReq() { public ArrayList getInfo() { return info; } -} +} \ No newline at end of file diff --git a/src/main/java/elucent/rootsclassic/research/ResearchGroup.java b/src/main/java/elucent/rootsclassic/research/ResearchGroup.java index 90b4f19c..75b7bdec 100644 --- a/src/main/java/elucent/rootsclassic/research/ResearchGroup.java +++ b/src/main/java/elucent/rootsclassic/research/ResearchGroup.java @@ -13,7 +13,7 @@ public ResearchGroup(String name, String properName) { } public ResearchGroup addResearch(ResearchBase research) { - researches.add(research); + if(!research.getInfo().isEmpty()) researches.add(research); return this; } @@ -24,4 +24,4 @@ public String getName() { public String getProperName() { return properName; } -} +} \ No newline at end of file diff --git a/src/main/java/elucent/rootsclassic/research/ResearchManager.java b/src/main/java/elucent/rootsclassic/research/ResearchManager.java index 41e97d83..0e51452c 100644 --- a/src/main/java/elucent/rootsclassic/research/ResearchManager.java +++ b/src/main/java/elucent/rootsclassic/research/ResearchManager.java @@ -3,7 +3,7 @@ import elucent.rootsclassic.Const; import elucent.rootsclassic.component.ComponentRegistry; import elucent.rootsclassic.registry.RootsRegistry; -import elucent.rootsclassic.ritual.RitualBase; +import elucent.rootsclassic.ritual.RitualEffect; import elucent.rootsclassic.ritual.RitualBaseRegistry; import elucent.rootsclassic.ritual.RitualRegistry; import net.minecraft.resources.ResourceLocation; @@ -26,7 +26,6 @@ public static void onRecipesUpdated(RecipesUpdatedEvent event) { public static void reload(RecipeManager recipeManager) { globalResearches.clear(); - IForgeRegistry ritualRegistry = RitualBaseRegistry.RITUALS.get(); //create first page of tablet book globalResearches.add(new ResearchGroup("nature", "Natural Arts") .addResearch(new ResearchBase("bark_harvesting", new ItemStack(RootsRegistry.BARK_KNIFE.get())) @@ -147,176 +146,151 @@ public static void reload(RecipeManager recipeManager) { .addPage(new ResearchPage() .addMortarRecipe(ComponentRegistry.getSpellFromName(recipeManager, new ResourceLocation(Const.MODID, "midnight_bloom")))))); //third page of tablet book - globalResearches.add(new ResearchGroup("ritual", "Rituals") + + var rituals = new ResearchGroup("ritual", "Rituals") .addResearch(new ResearchBase("ritual", new ItemStack(RootsRegistry.ALTAR.get())) .addPage(new ResearchPage() .addDisplayItem(new ItemStack(RootsRegistry.ALTAR.get()))) .addPage(new ResearchPage() .addDisplayItem(new ItemStack(RootsRegistry.BRAZIER.get()))) - .addPage(new ResearchPage())) - .addResearch(new ResearchBase("living_tools", new ItemStack(RootsRegistry.LIVING_SWORD.get())) - .addPage(new ResearchPage()) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.LIVING_PICKAXE_CRAFTING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.LIVING_AXE_CRAFTING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.LIVING_SHOVEL_CRAFTING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.LIVING_SWORD_CRAFTING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.LIVING_HOE_CRAFTING.get()))) - .addResearch(new ResearchBase("grow", new ItemStack(Items.BONE_MEAL, 1)) - .addPage(new ResearchPage()) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.GROW.get()))) - .addResearch(new ResearchBase("standing_stones", new ItemStack(RootsRegistry.MUNDANE_STANDING_STONE.get())) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.MUNDANE_STANDING_STONE.get())))) - .addResearch(new ResearchBase("animal_summoning", new ItemStack(Items.PORKCHOP)) - .addPage(new ResearchPage()) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.PIG_SUMMONING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.COW_SUMMONING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.SHEEP_SUMMONING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.CHICKEN_SUMMONING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.RABBIT_SUMMONING.get()))) - .addResearch(new ResearchBase("crystal_staff", new ItemStack(RootsRegistry.CRYSTAL_STAFF.get())) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.CRYSTAL_STAFF.get()))) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.STAFF_CRAFTING.get())) - .addPage(new ResearchPage()) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.IMBUER.get())) - .addPage(new ResearchPage())) - .addResearch(new ResearchBase("rain_rituals", new ItemStack(Items.WATER_BUCKET)) - .addPage(new ResearchPage()) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.CAUSE_RAIN.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.BANISH_RAIN.get()))) - .addResearch(new ResearchBase("flare", new ItemStack(Items.BLAZE_POWDER)) - .addPage(new ResearchPage()) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.FLARE.get()))) - .addResearch(new ResearchBase("standing_stones2", new ItemStack(RootsRegistry.ATTUNED_STANDING_STONE.get())) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.ATTUNED_STANDING_STONE.get())))) - .addResearch(new ResearchBase("monster_summoning", new ItemStack(Items.ROTTEN_FLESH)) - .addPage(new ResearchPage()) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.ZOMBIE_SUMMONING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.SKELETON_SUMMONING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.SPIDER_SUMMONING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.CREEPER_SUMMONING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.CAVE_SPIDER_SUMMONING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.SLIME_SUMMONING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.ENDERMAN_SUMMONING.get()))) - .addResearch(new ResearchBase("sylvan_armor", new ItemStack(RootsRegistry.SYLVAN_HOOD.get())) - .addPage(new ResearchPage()) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.SYLVAN_HOOD_CRAFTING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.SYLVAN_CHEST_CRAFTING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.SYLVAN_LEGS_CRAFTING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.SYLVAN_BOOTS_CRAFTING.get()))) - .addResearch(new ResearchBase("wildwood_armor", new ItemStack(RootsRegistry.WILDWOOD_MASK.get())) - .addPage(new ResearchPage()) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.WILDWOOD_HEAD_CRAFTING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.WILDWOOD_CHEST_CRAFTING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.WILDWOOD_LEGS_CRAFTING.get())) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.WILDWOOD_BOOTS_CRAFTING.get()))) - .addResearch(new ResearchBase("powered_stones", new ItemStack(RootsRegistry.ACCELERATOR_STANDING_STONE.get())) - .addPage(new ResearchPage()) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.ACCELERATOR_STONE_CRAFTING.get())) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.ACCELERATOR_STANDING_STONE.get()))) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.ENTANGLER_STONE_CRAFTING.get())) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.ENTANGLER_STANDING_STONE.get()))) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.GROWER_STONE_CRAFTING.get())) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.GROWTH_POWDER.get()))) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.HEALER_STONE_CRAFTING.get())) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.HEALER_STANDING_STONE.get()))) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.IGNITER_STONE_CRAFTING.get())) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.IGNITER_STANDING_STONE.get()))) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.REPULSOR_STONE_CRAFTING.get())) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.REPULSOR_STANDING_STONE.get()))) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.VACUUM_STONE_CRAFTING.get())) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.VACUUM_STANDING_STONE.get()))) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.STANDING_STONE.get())) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.AESTHETIC_STANDING_STONE.get())))) - .addResearch(new ResearchBase("mass_breeding", new ItemStack(Items.GOLDEN_CARROT)) - .addPage(new ResearchPage()) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.MASS_BREEDING.get()))) - .addResearch(new ResearchBase("life_drain", new ItemStack(Items.NETHER_WART)) - .addPage(new ResearchPage()) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.LIFE_DRAIN.get()))) - .addResearch(new ResearchBase("sacrifice", new ItemStack(Items.IRON_SWORD)) - .addPage(new ResearchPage()) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.SACRIFICE.get()))) - .addResearch(new ResearchBase("runic_focus", new ItemStack(RootsRegistry.RUNIC_FOCUS.get())) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.RUNIC_FOCUS.get(), 1))) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.RUNIC_FOCUS_CRAFTING.get())) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.CHARGED_RUNIC_FOCUS.get(), 1))) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.RUNIC_FOCUS_CHARGING.get()))) - .addResearch(new ResearchBase("engraved_blade", new ItemStack(RootsRegistry.ENGRAVED_BLADE.get())) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.ENGRAVED_BLADE.get()))) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.ENGRAVED_CRAFTING.get())) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.ACACIA_BARK.get()))) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.SPRUCE_BARK.get()))) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.BIRCH_BARK.get()))) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.JUNGLE_BARK.get()))) - .addPage(new ResearchPage() - .addDisplayItem(new ItemStack(RootsRegistry.DARK_OAK_BARK.get())))) - .addResearch(new ResearchBase("time_shift", new ItemStack(Items.CLOCK)) - .addPage(new ResearchPage()) - .addPage(new ResearchPage() - .addAltarRecipe(RitualRegistry.TIME_SHIFT.get())))); + .addPage(new ResearchPage())); + + rituals.addResearch(new ResearchBase("living_tools", new ItemStack(RootsRegistry.LIVING_SWORD.get())) + .addPage(new ResearchPage()) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/living_pickaxe"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/living_axe"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/living_shovel"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/living_sword"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/living_hoe")))); + + rituals.addResearch(new ResearchBase("grow", new ItemStack(Items.BONE_MEAL, 1)) + .addPage(new ResearchPage()) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/grow")))); + + rituals.addResearch(new ResearchBase("standing_stones", new ItemStack(RootsRegistry.MUNDANE_STANDING_STONE.get())) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.MUNDANE_STANDING_STONE.get())))); + + rituals.addResearch(new ResearchBase("animal_summoning", new ItemStack(Items.PORKCHOP)) + .addPage(new ResearchPage()) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/summoning/pig"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/summoning/cow"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/summoning/sheep"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/summoning/chicken"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/summoning/rabbit")))); + + rituals.addResearch(new ResearchBase("crystal_staff", new ItemStack(RootsRegistry.CRYSTAL_STAFF.get())) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.CRYSTAL_STAFF.get()))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/crystal_staff"))) + .addPage(new ResearchPage()) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/imbuer"))) + .addPage(new ResearchPage())); + + rituals.addResearch(new ResearchBase("rain_rituals", new ItemStack(Items.WATER_BUCKET)) + .addPage(new ResearchPage()) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/cause_rain"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/banish_rain")))); + + rituals.addResearch(new ResearchBase("flare", new ItemStack(Items.BLAZE_POWDER)) + .addPage(new ResearchPage()) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/flare")))); + + rituals.addResearch(new ResearchBase("standing_stones2", new ItemStack(RootsRegistry.ATTUNED_STANDING_STONE.get())) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.ATTUNED_STANDING_STONE.get())))); + + rituals.addResearch(new ResearchBase("monster_summoning", new ItemStack(Items.ROTTEN_FLESH)) + .addPage(new ResearchPage()) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/summoning/zombie"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/summoning/skeleton"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/summoning/spider"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/summoning/creeper"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/summoning/cave_spider"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/summoning/slime"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/summoning/enderman")))); + + rituals.addResearch(new ResearchBase("sylvan_armor", new ItemStack(RootsRegistry.SYLVAN_HOOD.get())) + .addPage(new ResearchPage()) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/sylvan_hood"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/sylvan_robe"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/sylvan_tunic"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/sylvan_boots")))); + + rituals.addResearch(new ResearchBase("wildwood_armor", new ItemStack(RootsRegistry.WILDWOOD_MASK.get())) + .addPage(new ResearchPage()) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/wildwood_mask"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/wildwood_plate"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/wildwood_leggings"))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/wildwood_boots")))); + + rituals.addResearch(new ResearchBase("powered_stones", new ItemStack(RootsRegistry.ACCELERATOR_STANDING_STONE.get())) + .addPage(new ResearchPage()) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/accelerator_standing_stone"))) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.ACCELERATOR_STANDING_STONE.get()))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/entangler_standing_stone"))) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.ENTANGLER_STANDING_STONE.get()))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/grower_standing_stone"))) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.GROWTH_POWDER.get()))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/healer_standing_stone"))) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.HEALER_STANDING_STONE.get()))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/igniter_standing_stone"))) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.IGNITER_STANDING_STONE.get()))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/repulsor_standing_stone"))) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.REPULSOR_STANDING_STONE.get()))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/vacuum_standing_stone"))) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.VACUUM_STANDING_STONE.get()))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/aesthetic_standing_stone"))) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.AESTHETIC_STANDING_STONE.get())))); + + rituals.addResearch(new ResearchBase("mass_breeding", new ItemStack(Items.GOLDEN_CARROT)) + .addPage(new ResearchPage()) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/mass_breeding")))); + + rituals.addResearch(new ResearchBase("life_drain", new ItemStack(Items.NETHER_WART)) + .addPage(new ResearchPage()) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/life_drain")))); + + rituals.addResearch(new ResearchBase("sacrifice", new ItemStack(Items.IRON_SWORD)) + .addPage(new ResearchPage()) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/sacrifice")))); + + rituals.addResearch(new ResearchBase("runic_focus", new ItemStack(RootsRegistry.RUNIC_FOCUS.get())) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.RUNIC_FOCUS.get(), 1))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/runic_focus"))) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.CHARGED_RUNIC_FOCUS.get(), 1))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/crafting/charged_runic_focus")))); + + rituals.addResearch(new ResearchBase("engraved_blade", new ItemStack(RootsRegistry.ENGRAVED_BLADE.get())) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.ENGRAVED_BLADE.get()))) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/engraved_blade"))) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.ACACIA_BARK.get()))) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.SPRUCE_BARK.get()))) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.BIRCH_BARK.get()))) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.JUNGLE_BARK.get()))) + .addPage(new ResearchPage() + .addDisplayItem(new ItemStack(RootsRegistry.DARK_OAK_BARK.get())))); + + rituals.addResearch(new ResearchBase("time_shift", new ItemStack(Items.CLOCK)) + .addPage(new ResearchPage()) + .addPageOf(RitualRegistry.recipeByName(recipeManager, new ResourceLocation(Const.MODID, "ritual/time_shift")))); + + globalResearches.add(rituals); } public static ResearchBase getResearch(String groupName, String researchName) { @@ -340,4 +314,4 @@ public static ResearchGroup getResearchGroup(String groupName) { } return null; } -} +} \ No newline at end of file diff --git a/src/main/java/elucent/rootsclassic/research/ResearchPage.java b/src/main/java/elucent/rootsclassic/research/ResearchPage.java index 4a3734b1..ffd80cea 100644 --- a/src/main/java/elucent/rootsclassic/research/ResearchPage.java +++ b/src/main/java/elucent/rootsclassic/research/ResearchPage.java @@ -1,7 +1,8 @@ package elucent.rootsclassic.research; import elucent.rootsclassic.recipe.ComponentRecipe; -import elucent.rootsclassic.ritual.RitualBase; +import elucent.rootsclassic.recipe.RitualRecipe; +import elucent.rootsclassic.ritual.RitualEffect; import net.minecraft.client.Minecraft; import net.minecraft.world.item.ItemStack; @@ -10,7 +11,7 @@ public class ResearchPage { public ArrayList craftingRecipe = new ArrayList<>(); public ComponentRecipe mortarRecipe = null; - public RitualBase altarRecipe = null; + public RitualRecipe altarRecipe = null; public ArrayList smeltingRecipe = new ArrayList<>(); public EnumPageType recipe = EnumPageType.TYPE_NULL; public ItemStack displayItem = null; @@ -67,9 +68,9 @@ public ResearchPage addMortarRecipe(ComponentRecipe component) { return this; } - public ResearchPage addAltarRecipe(RitualBase ritual) { + public ResearchPage addAltarRecipe(RitualRecipe ritual) { recipe = EnumPageType.TYPE_ALTAR; altarRecipe = ritual; return this; } -} +} \ No newline at end of file diff --git a/src/main/java/elucent/rootsclassic/ritual/RitualBase.java b/src/main/java/elucent/rootsclassic/ritual/RitualBase.java deleted file mode 100644 index 1da27512..00000000 --- a/src/main/java/elucent/rootsclassic/ritual/RitualBase.java +++ /dev/null @@ -1,206 +0,0 @@ -package elucent.rootsclassic.ritual; - -import elucent.rootsclassic.Roots; -import elucent.rootsclassic.block.brazier.BrazierBlockEntity; -import elucent.rootsclassic.registry.RootsRegistry; -import elucent.rootsclassic.util.RootsUtil; -import net.minecraft.core.BlockPos; -import net.minecraft.world.Container; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.phys.Vec3; - -import java.util.ArrayList; -import java.util.List; - -public abstract class RitualBase { - - private static final int RADIUS = 4; - private ArrayList blocks = new ArrayList<>(); - private ArrayList positionsRelative = new ArrayList<>(); - private List incenses = new ArrayList<>(); - private List ingredients = new ArrayList<>(); - private Vec3 color = new Vec3(255, 255, 255); - private Vec3 secondaryColor = new Vec3(255, 255, 255); - private int level; - - public RitualBase(int level, double r, double g, double b) { - setPrimaryColor(r, g, b); - setSecondaryColor(r, g, b); - setLevel(level); - } - - public void setLevel(int level) { - if (level < 0 || level > 2) { - throw new IllegalArgumentException("Level must be 0, 1 or 2"); - } - this.blocks.clear(); - this.positionsRelative.clear(); - this.level = level; - //level 0 has no stones - if (level >= 1) { - //the first circle of tier 1 stones - this.addRitualPillar(RootsRegistry.MUNDANE_STANDING_STONE.get(), -3, 0, -3); - this.addRitualPillar(RootsRegistry.MUNDANE_STANDING_STONE.get(), -3, 0, 3); - this.addRitualPillar(RootsRegistry.MUNDANE_STANDING_STONE.get(), 3, 0, -3); - this.addRitualPillar(RootsRegistry.MUNDANE_STANDING_STONE.get(), 3, 0, 3); - this.addRitualPillar(RootsRegistry.MUNDANE_STANDING_STONE.get(), 3, 0, 0); - this.addRitualPillar(RootsRegistry.MUNDANE_STANDING_STONE.get(), -3, 0, 0); - this.addRitualPillar(RootsRegistry.MUNDANE_STANDING_STONE.get(), 0, 0, 3); - this.addRitualPillar(RootsRegistry.MUNDANE_STANDING_STONE.get(), 0, 0, -3); - } - if (level == 2) { - //the outer tier 2 stones - this.addRitualPillar(RootsRegistry.ATTUNED_STANDING_STONE.get(), 5, 1, 0); - this.addRitualPillar(RootsRegistry.ATTUNED_STANDING_STONE.get(), -5, 1, 0); - this.addRitualPillar(RootsRegistry.ATTUNED_STANDING_STONE.get(), 0, 1, 5); - this.addRitualPillar(RootsRegistry.ATTUNED_STANDING_STONE.get(), 0, 1, -5); - } - } - - public RitualBase addRitualPillar(Block b, int x, int y, int z) { - getBlocks().add(b); - getPositionsRelative().add(new BlockPos(x, y, z)); - return this; - } - - public RitualBase addIngredient(ItemStack i) { - getIngredients().add(i); - return this; - } - - public RitualBase addIncense(ItemStack i) { - getIncenses().add(i); - return this; - } - - public boolean doIngredientsMatch(RitualBase ritual) { - return RootsUtil.itemListsMatch(this.getIngredients(), ritual.getIngredients()); - } - - public abstract void doEffect(Level levelAccessor, BlockPos pos, Container inventory, List incenses); - - public boolean verifyPositionBlocks(Level levelAccessor, BlockPos pos) { - if (!getPositionsRelative().isEmpty() && getPositionsRelative().size() == getBlocks().size()) { - for (int i = 0; i < getPositionsRelative().size(); i++) { - BlockPos loopPos = getPositionsRelative().get(i); - Block loopBlock = getBlocks().get(i); - BlockPos loopPosOffset = pos.offset(loopPos.getX(), loopPos.getY(), loopPos.getZ()); - if (levelAccessor.getBlockState(loopPosOffset).getBlock() != loopBlock) { - Roots.LOGGER.info(this.level + " level recipe has Missing block " + loopBlock + " at position " + loopPosOffset); - return false; - } - } - } - return true; - } - - public List getRecipeBraziers(Level levelAccessor, BlockPos pos) { - List links = new ArrayList<>(); - BlockEntity tileHere; - for (int i = -1 * RADIUS; i <= RADIUS; i++) { - for (int j = -1 * RADIUS; j <= RADIUS; j++) { - if (levelAccessor.getBlockState(pos.offset(i, 0, j)).getBlock() == RootsRegistry.BRAZIER.get()) { - tileHere = levelAccessor.getBlockEntity(pos.offset(i, 0, j)); - if (tileHere instanceof BrazierBlockEntity) { - links.add((BrazierBlockEntity) tileHere); - } - } - } - } - return links; - } - - public boolean incenseMatches(Level levelAccessor, BlockPos pos) { - ArrayList incenseFromNearby = new ArrayList<>(); - List braziers = getRecipeBraziers(levelAccessor, pos); - for (BrazierBlockEntity brazier : braziers) { - if (!brazier.getHeldItem().isEmpty()) { - // Roots.logger.info("found brazier item " + brazier.getHeldItem()); - incenseFromNearby.add(brazier.getHeldItem()); - } - } - return RootsUtil.itemListsMatch(getIncenses(), incenseFromNearby); - } - - @Override - public String toString() { - StringBuilder s = new StringBuilder("[A] "); - for (ItemStack mat : this.getIngredients()) { - s.append(mat.getHoverName().getString()).append("; "); - } - s.append("[I] "); - for (ItemStack mat : this.getIncenses()) { - s.append(mat.getHoverName().getString()).append("; "); - } - return s.toString(); - } - - public List getIngredients() { - return ingredients; - } - - public void setIngredients(List ingredients) - throws IllegalArgumentException { - if (ingredients.size() == 0 || ingredients.size() > 3) { - throw new IllegalArgumentException("Invalid ritual ingredients, must be in range [1,3]"); - } - this.ingredients = ingredients; - } - - public List getIncenses() { - return incenses; - } - - public void setIncenses(List incenses) - throws IllegalArgumentException { - if (incenses.size() == 0 || incenses.size() > 4) { - throw new IllegalArgumentException("Invalid ritual incense, must be in range [1,4]"); - } - this.incenses = incenses; - } - - public ArrayList getPositionsRelative() { - return positionsRelative; - } - - public void setPositionsRelative(ArrayList positionsRelative) { - this.positionsRelative = positionsRelative; - } - - public ArrayList getBlocks() { - return blocks; - } - - public void setBlocks(ArrayList blocks) { - this.blocks = blocks; - } - - public Vec3 getColor() { - return color; - } - - public void setPrimaryColor(double r, double g, double b) { - this.color = buildColor(r, g, b); - } - - public Vec3 getSecondaryColor() { - return secondaryColor; - } - - public RitualBase setSecondaryColor(double r, double g, double b) { - this.secondaryColor = buildColor(r, g, b); - return this; - } - - private Vec3 buildColor(double r, double g, double b) throws IllegalArgumentException { - if (r < 0 || r > 255 || - g < 0 || g > 255 || - b < 0 || b > 255) { - throw new IllegalArgumentException("Invalid color value use [0, 255]"); - } - return new Vec3(r, g, b); - } -} diff --git a/src/main/java/elucent/rootsclassic/ritual/RitualBaseRegistry.java b/src/main/java/elucent/rootsclassic/ritual/RitualBaseRegistry.java index f589fc57..246a9edb 100644 --- a/src/main/java/elucent/rootsclassic/ritual/RitualBaseRegistry.java +++ b/src/main/java/elucent/rootsclassic/ritual/RitualBaseRegistry.java @@ -14,11 +14,11 @@ public class RitualBaseRegistry { public static final ResourceLocation registryLocation = new ResourceLocation(Const.MODID, "ritual"); - public static Supplier> RITUALS; + public static Supplier>> RITUALS; @SubscribeEvent public static void onNewRegistry(NewRegistryEvent event) { - RegistryBuilder registryBuilder = new RegistryBuilder<>(); + RegistryBuilder> registryBuilder = new RegistryBuilder<>(); registryBuilder.setName(registryLocation); registryBuilder.allowModification(); registryBuilder.missing(null); diff --git a/src/main/java/elucent/rootsclassic/ritual/RitualEffect.java b/src/main/java/elucent/rootsclassic/ritual/RitualEffect.java new file mode 100644 index 00000000..f2ee096d --- /dev/null +++ b/src/main/java/elucent/rootsclassic/ritual/RitualEffect.java @@ -0,0 +1,34 @@ +package elucent.rootsclassic.ritual; + +import com.google.gson.JsonObject; +import net.minecraft.core.BlockPos; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; + +import java.util.List; + +public abstract class RitualEffect { + + public abstract void doEffect(Level levelAccessor, BlockPos pos, Container inventory, List incenses, C config); + + public ItemStack getResult(C config) { + return ItemStack.EMPTY; + } + + public MutableComponent getInfoText(C config) { + var id = RitualBaseRegistry.RITUALS.get().getKey(this); + if (id == null) return Component.empty(); + return Component.translatable(id.getNamespace() + ".jei.tooltip." + id.getPath()); + } + + abstract public C fromJSON(JsonObject object); + + abstract public void toNetwork(C config, FriendlyByteBuf buffer); + + abstract public C fromNetwork(FriendlyByteBuf buffer); + +} diff --git a/src/main/java/elucent/rootsclassic/ritual/RitualPillars.java b/src/main/java/elucent/rootsclassic/ritual/RitualPillars.java new file mode 100644 index 00000000..1ef48b2c --- /dev/null +++ b/src/main/java/elucent/rootsclassic/ritual/RitualPillars.java @@ -0,0 +1,81 @@ +package elucent.rootsclassic.ritual; + +import com.google.common.collect.ImmutableMap; +import elucent.rootsclassic.Roots; +import elucent.rootsclassic.block.brazier.BrazierBlockEntity; +import elucent.rootsclassic.recipe.RitualRecipe; +import elucent.rootsclassic.registry.RootsRegistry; +import io.netty.util.collection.IntObjectHashMap; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class RitualPillars { + + private static final int INCENSE_RADIUS = 4; + + private static final IntObjectHashMap> CACHE = new IntObjectHashMap<>(); + + public static Map getRitualPillars(int level) { + return CACHE.computeIfAbsent(level, $ -> { + var builder = new ImmutableMap.Builder(); + if (level >= 1) { + //the first circle of tier 1 stones + builder.put(new BlockPos(-3, 0, -3), RootsRegistry.MUNDANE_STANDING_STONE.get()); + builder.put(new BlockPos(-3, 0, 3), RootsRegistry.MUNDANE_STANDING_STONE.get()); + builder.put(new BlockPos(3, 0, -3), RootsRegistry.MUNDANE_STANDING_STONE.get()); + builder.put(new BlockPos(3, 0, 3), RootsRegistry.MUNDANE_STANDING_STONE.get()); + builder.put(new BlockPos(3, 0, 0), RootsRegistry.MUNDANE_STANDING_STONE.get()); + builder.put(new BlockPos(-3, 0, 0), RootsRegistry.MUNDANE_STANDING_STONE.get()); + builder.put(new BlockPos(0, 0, 3), RootsRegistry.MUNDANE_STANDING_STONE.get()); + builder.put(new BlockPos(0, 0, -3), RootsRegistry.MUNDANE_STANDING_STONE.get()); + } + if (level == 2) { + //the outer tier 2 stones + builder.put(new BlockPos(5, 1, 0), RootsRegistry.ATTUNED_STANDING_STONE.get()); + builder.put(new BlockPos(-5, 1, 0), RootsRegistry.ATTUNED_STANDING_STONE.get()); + builder.put(new BlockPos(0, 1, 5), RootsRegistry.ATTUNED_STANDING_STONE.get()); + builder.put(new BlockPos(0, 1, -5), RootsRegistry.ATTUNED_STANDING_STONE.get()); + } + + return builder.build(); + }); + } + + public static boolean verifyPositionBlocks(RitualRecipe recipe, Level levelAccessor, BlockPos pos) { + var pillars = getRitualPillars(recipe.level); + return pillars.entrySet().stream().allMatch(entry -> { + var loopPos = entry.getKey(); + var loopBlock = entry.getValue(); + BlockPos loopPosOffset = pos.offset(loopPos.getX(), loopPos.getY(), loopPos.getZ()); + if (levelAccessor.getBlockState(loopPosOffset).getBlock() != loopBlock) { + Roots.LOGGER.info(recipe.level + " level recipe has Missing block " + loopBlock + " at position " + loopPosOffset); + return false; + } else { + return true; + } + }); + } + + public static List getRecipeBraziers(Level levelAccessor, BlockPos pos) { + List links = new ArrayList<>(); + BlockEntity tileHere; + for (int i = -1 * INCENSE_RADIUS; i <= INCENSE_RADIUS; i++) { + for (int j = -1 * INCENSE_RADIUS; j <= INCENSE_RADIUS; j++) { + if (levelAccessor.getBlockState(pos.offset(i, 0, j)).getBlock() == RootsRegistry.BRAZIER.get()) { + tileHere = levelAccessor.getBlockEntity(pos.offset(i, 0, j)); + if (tileHere instanceof BrazierBlockEntity brazier) { + links.add(brazier); + } + } + } + } + return links; + } + +} diff --git a/src/main/java/elucent/rootsclassic/ritual/RitualRegistry.java b/src/main/java/elucent/rootsclassic/ritual/RitualRegistry.java index 6a4f6925..e97a24bf 100644 --- a/src/main/java/elucent/rootsclassic/ritual/RitualRegistry.java +++ b/src/main/java/elucent/rootsclassic/ritual/RitualRegistry.java @@ -3,11 +3,13 @@ import elucent.rootsclassic.Const; import elucent.rootsclassic.block.altar.AltarBlockEntity; import elucent.rootsclassic.block.brazier.BrazierBlockEntity; +import elucent.rootsclassic.recipe.RitualRecipe; +import elucent.rootsclassic.registry.RootsRecipes; import elucent.rootsclassic.registry.RootsRegistry; import elucent.rootsclassic.ritual.rituals.RitualBanishRain; import elucent.rootsclassic.ritual.rituals.RitualCauseRain; import elucent.rootsclassic.ritual.rituals.RitualCrafting; -import elucent.rootsclassic.ritual.rituals.RitualEngravedSword; +import elucent.rootsclassic.ritual.rituals.RitualEngravedCrafting; import elucent.rootsclassic.ritual.rituals.RitualFlare; import elucent.rootsclassic.ritual.rituals.RitualGrow; import elucent.rootsclassic.ritual.rituals.RitualImbuer; @@ -18,479 +20,60 @@ import elucent.rootsclassic.ritual.rituals.RitualTimeShift; import elucent.rootsclassic.util.RootsUtil; import net.minecraft.core.BlockPos; -import net.minecraft.world.entity.EntityType; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Blocks; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.RegistryObject; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import java.util.Optional; public class RitualRegistry { - public static final DeferredRegister RITUALS = DeferredRegister.create(RitualBaseRegistry.registryLocation, Const.MODID); + public static final DeferredRegister RITUALS = DeferredRegister.create(RitualBaseRegistry.registryLocation, Const.MODID); - public static final RegistryObject STAFF_CRAFTING = RITUALS.register("staff_crafting", () -> - new RitualCrafting(1, 205, 86, 0) - .setResult(new ItemStack(RootsRegistry.CRYSTAL_STAFF.get(), 1)) - .addIncense(new ItemStack(Blocks.COAL_BLOCK, 1)) - .addIncense(new ItemStack(RootsRegistry.ACACIA_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.VERDANT_SPRIG.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.BIRCH_BARK.get(), 1)) - .addIngredient(new ItemStack(Blocks.DIAMOND_BLOCK, 1)) - .addIngredient(new ItemStack(Items.STICK, 1)) - .addIngredient(new ItemStack(Items.BLAZE_POWDER, 1))); + public static final RegistryObject CRAFTING = RITUALS.register("crafting", RitualCrafting::new); - public static final RegistryObject SYLVAN_HOOD_CRAFTING = RITUALS.register("sylvan_hood_crafting", () -> - new RitualCrafting(2, 62, 138, 62) - .setResult(new ItemStack(RootsRegistry.SYLVAN_HOOD.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.BIRCH_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.BIRCH_BARK.get(), 1)) - .addIncense(new ItemStack(Items.GOLDEN_APPLE, 1)) - .addIncense(new ItemStack(Blocks.POPPY, 1)) - .addIngredient(new ItemStack(Items.DIAMOND, 1)) - .addIngredient(new ItemStack(Items.LEATHER_HELMET, 1)) - .addIngredient(new ItemStack(Blocks.VINE, 1))); + public static final RegistryObject CAUSE_RAIN = RITUALS.register("cause_rain", RitualCauseRain::new); - public static final RegistryObject SYLVAN_CHEST_CRAFTING = RITUALS.register("sylvan_chest_crafting", () -> - new RitualCrafting(2, 62, 138, 62) - .setResult(new ItemStack(RootsRegistry.SYLVAN_ROBE.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.BIRCH_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.BIRCH_BARK.get(), 1)) - .addIncense(new ItemStack(Items.GOLDEN_APPLE, 1)) - .addIncense(new ItemStack(Blocks.POPPY, 1)) - .addIngredient(new ItemStack(Items.DIAMOND, 1)) - .addIngredient(new ItemStack(Items.LEATHER_CHESTPLATE, 1)) - .addIngredient(new ItemStack(Blocks.VINE, 1))); + public static final RegistryObject BANISH_RAIN = RITUALS.register("banish_rain", RitualBanishRain::new); - public static final RegistryObject SYLVAN_LEGS_CRAFTING = RITUALS.register("sylvan_legs_crafting", () -> - new RitualCrafting(2, 62, 138, 62) - .setResult(new ItemStack(RootsRegistry.SYLVAN_TUNIC.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.BIRCH_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.BIRCH_BARK.get(), 1)) - .addIncense(new ItemStack(Items.GOLDEN_APPLE, 1)) - .addIncense(new ItemStack(Blocks.POPPY, 1)) - .addIngredient(new ItemStack(Items.DIAMOND, 1)) - .addIngredient(new ItemStack(Items.LEATHER_LEGGINGS, 1)) - .addIngredient(new ItemStack(Blocks.VINE, 1))); + public static final RegistryObject MASS_BREEDING = RITUALS.register("mass_breeding", RitualMassBreed::new); - public static final RegistryObject SYLVAN_BOOTS_CRAFTING = RITUALS.register("sylvan_boots_crafting", () -> - new RitualCrafting(2, 62, 138, 62) - .setResult(new ItemStack(RootsRegistry.SYLVAN_BOOTS.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.BIRCH_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.BIRCH_BARK.get(), 1)) - .addIncense(new ItemStack(Items.GOLDEN_APPLE, 1)) - .addIncense(new ItemStack(Blocks.POPPY, 1)) - .addIngredient(new ItemStack(Items.DIAMOND, 1)) - .addIngredient(new ItemStack(Items.LEATHER_BOOTS, 1)) - .addIngredient(new ItemStack(Blocks.VINE, 1))); + public static final RegistryObject LIFE_DRAIN = RITUALS.register("life_drain", RitualLifeDrain::new); - public static final RegistryObject WILDWOOD_HEAD_CRAFTING = RITUALS.register("wildwood_head_crafting", () -> - new RitualCrafting(2, 145, 115, 65) - .setResult(new ItemStack(RootsRegistry.WILDWOOD_MASK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIncense(new ItemStack(Items.WHEAT, 1)) - .addIncense(new ItemStack(Blocks.OAK_SAPLING, 1)) - .addIngredient(new ItemStack(Items.DIAMOND, 1)) - .addIngredient(new ItemStack(Items.IRON_HELMET, 1)) - .addIngredient(new ItemStack(Blocks.OAK_PLANKS, 1))); + public static final RegistryObject IMBUER = RITUALS.register("imbuer", RitualImbuer::new); - public static final RegistryObject WILDWOOD_CHEST_CRAFTING = RITUALS.register("wildwood_chest_crafting", () -> - new RitualCrafting(2, 145, 115, 65) - .setResult(new ItemStack(RootsRegistry.WILDWOOD_PLATE.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIncense(new ItemStack(Items.WHEAT, 1)) - .addIncense(new ItemStack(Blocks.OAK_SAPLING, 1)) - .addIngredient(new ItemStack(Items.DIAMOND, 1)) - .addIngredient(new ItemStack(Items.IRON_CHESTPLATE, 1)) - .addIngredient(new ItemStack(Blocks.OAK_PLANKS, 1))); + public static final RegistryObject SUMMONING = RITUALS.register("summoning", RitualSummoning::new); - public static final RegistryObject WILDWOOD_LEGS_CRAFTING = RITUALS.register("wildwood_legs_crafting", () -> - new RitualCrafting(2, 145, 115, 65) - .setResult(new ItemStack(RootsRegistry.WILDWOOD_LEGGINGS.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIncense(new ItemStack(Items.WHEAT, 1)) - .addIncense(new ItemStack(Blocks.OAK_SAPLING, 1)) - .addIngredient(new ItemStack(Items.DIAMOND, 1)) - .addIngredient(new ItemStack(Items.IRON_LEGGINGS, 1)) - .addIngredient(new ItemStack(Blocks.OAK_PLANKS, 1))); + public static final RegistryObject SACRIFICE = RITUALS.register("sacrifice", RitualSacrifice::new); - public static final RegistryObject WILDWOOD_BOOTS_CRAFTING = RITUALS.register("wildwood_boots_crafting", () -> - new RitualCrafting(2, 145, 115, 65) - .setResult(new ItemStack(RootsRegistry.WILDWOOD_BOOTS.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIncense(new ItemStack(Items.WHEAT, 1)) - .addIncense(new ItemStack(Blocks.OAK_SAPLING, 1)) - .addIngredient(new ItemStack(Items.DIAMOND, 1)) - .addIngredient(new ItemStack(Items.IRON_BOOTS, 1)) - .addIngredient(new ItemStack(Blocks.OAK_PLANKS, 1))); + public static final RegistryObject FLARE = RITUALS.register("flare", RitualFlare::new); - public static final RegistryObject ACCELERATOR_STONE_CRAFTING = RITUALS.register("accelerator_stone_crafting", () -> - new RitualCrafting(2, 0, 105, 73) - .setResult(new ItemStack(RootsRegistry.ACCELERATOR_STANDING_STONE.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.VERDANT_SPRIG.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.INFERNAL_BULB.get(), 1)) - .addIncense(new ItemStack(Items.WHEAT, 1)) - .addIncense(new ItemStack(RootsRegistry.JUNGLE_BARK.get(), 1)) - .addIngredient(new ItemStack(RootsRegistry.ATTUNED_STANDING_STONE.get(), 1)) - .addIngredient(new ItemStack(Items.GLOWSTONE_DUST, 1)) - .addIngredient(new ItemStack(Blocks.STONE_BRICKS, 1))); + public static final RegistryObject GROW = RITUALS.register("grow", RitualGrow::new); - public static final RegistryObject STANDING_STONE = RITUALS.register("standing_stone", () -> - new RitualCrafting(2, 0, 105, 73) - .setResult(new ItemStack(RootsRegistry.AESTHETIC_STANDING_STONE.get(), 1)) - .addIngredient(new ItemStack(RootsRegistry.ATTUNED_STANDING_STONE.get(), 1)) - .addIngredient(new ItemStack(Items.GLOWSTONE_DUST, 1)) - .addIngredient(new ItemStack(Blocks.MOSSY_STONE_BRICKS, 1))); + public static final RegistryObject ENGRAVED_CRAFTING = RITUALS.register("engraved_crafting", RitualEngravedCrafting::new); - public static final RegistryObject ENTANGLER_STONE_CRAFTING = RITUALS.register("entangler_stone_crafting", () -> - new RitualCrafting(2, 0, 105, 73) - .setResult(new ItemStack(RootsRegistry.ENTANGLER_STANDING_STONE.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.VERDANT_SPRIG.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.INFERNAL_BULB.get(), 1)) - .addIncense(new ItemStack(Items.WHEAT, 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIngredient(new ItemStack(RootsRegistry.ATTUNED_STANDING_STONE.get(), 1)) - .addIngredient(new ItemStack(Items.GLOWSTONE_DUST, 1)) - .addIngredient(new ItemStack(Blocks.CRACKED_STONE_BRICKS, 1))); + public static final RegistryObject TIME_SHIFT = RITUALS.register("time_shift", RitualTimeShift::new); - public static final RegistryObject GROWER_STONE_CRAFTING = RITUALS.register("grower_stone_crafting", () -> - new RitualCrafting(2, 0, 105, 73) - .setResult(new ItemStack(RootsRegistry.GROWER_STANDING_STONE.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.VERDANT_SPRIG.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.INFERNAL_BULB.get(), 1)) - .addIncense(new ItemStack(Items.WHEAT, 1)) - .addIncense(new ItemStack(RootsRegistry.BIRCH_BARK.get(), 1)) - .addIngredient(new ItemStack(RootsRegistry.ATTUNED_STANDING_STONE.get(), 1)) - .addIngredient(new ItemStack(Items.GLOWSTONE_DUST, 1)) - .addIngredient(new ItemStack(Blocks.STONE, 1))); - public static final RegistryObject HEALER_STONE_CRAFTING = RITUALS.register("healer_stone_crafting", () -> - new RitualCrafting(2, 0, 105, 73) - .setResult(new ItemStack(RootsRegistry.HEALER_STANDING_STONE.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.VERDANT_SPRIG.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.INFERNAL_BULB.get(), 1)) - .addIncense(new ItemStack(Items.WHEAT, 1)) - .addIncense(new ItemStack(Items.GHAST_TEAR, 1)) - .addIngredient(new ItemStack(RootsRegistry.ATTUNED_STANDING_STONE.get())) - .addIngredient(new ItemStack(Items.REDSTONE)) - .addIngredient(new ItemStack(Blocks.CHISELED_STONE_BRICKS, 1))); - - public static final RegistryObject IGNITER_STONE_CRAFTING = RITUALS.register("igniter_stone_crafting", () -> - new RitualCrafting(2, 0, 105, 73) - .setResult(new ItemStack(RootsRegistry.IGNITER_STANDING_STONE.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.VERDANT_SPRIG.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.INFERNAL_BULB.get(), 1)) - .addIncense(new ItemStack(Items.WHEAT, 1)) - .addIncense(new ItemStack(RootsRegistry.ACACIA_BARK.get(), 1)) - .addIngredient(new ItemStack(RootsRegistry.ATTUNED_STANDING_STONE.get(), 1)) - .addIngredient(new ItemStack(Items.REDSTONE, 1)) - .addIngredient(new ItemStack(Blocks.CRACKED_STONE_BRICKS, 1))); - public static final RegistryObject REPULSOR_STONE_CRAFTING = RITUALS.register("repulsor_stone_crafting", () -> - new RitualCrafting(2, 0, 105, 73) - .setResult(new ItemStack(RootsRegistry.REPULSOR_STANDING_STONE.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.VERDANT_SPRIG.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.INFERNAL_BULB.get(), 1)) - .addIncense(new ItemStack(Items.WHEAT, 1)) - .addIncense(new ItemStack(RootsRegistry.SPRUCE_BARK.get(), 1)) - .addIngredient(new ItemStack(RootsRegistry.ATTUNED_STANDING_STONE.get(), 1)) - .addIngredient(new ItemStack(Items.GLOWSTONE_DUST, 1)) - .addIngredient(new ItemStack(Blocks.CHISELED_STONE_BRICKS, 1))); - //just to move 403 wtf - - public static final RegistryObject VACUUM_STONE_CRAFTING = RITUALS.register("vacuum_stone_crafting", () -> - new RitualCrafting(2, 0, 105, 73) - .setResult(new ItemStack(RootsRegistry.VACUUM_STANDING_STONE.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.VERDANT_SPRIG.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.INFERNAL_BULB.get(), 1)) - .addIncense(new ItemStack(Items.WHEAT, 1)) - .addIncense(new ItemStack(RootsRegistry.DARK_OAK_BARK.get(), 1)) - .addIngredient(new ItemStack(RootsRegistry.ATTUNED_STANDING_STONE.get(), 1)) - .addIngredient(new ItemStack(Items.GLOWSTONE_DUST, 1)) - .addIngredient(new ItemStack(Blocks.NETHER_BRICKS))); - - public static final RegistryObject RUNIC_FOCUS_CRAFTING = RITUALS.register("runic_focus_crafting", () -> - new RitualCrafting(2, 109, 242, 109) - .setResult(new ItemStack(RootsRegistry.RUNIC_FOCUS.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.SPRUCE_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.ACACIA_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.JUNGLE_BARK.get(), 1)) - .addIngredient(new ItemStack(RootsRegistry.VERDANT_SPRIG.get(), 1)) - .addIngredient(new ItemStack(Items.DIAMOND, 1)) - .addIngredient(new ItemStack(Blocks.STONE, 1))); - - public static final RegistryObject RUNIC_FOCUS_CHARGING = RITUALS.register("runic_focus_charging", () -> - new RitualCrafting(0, 109, 242, 109) - .setResult(new ItemStack(RootsRegistry.CHARGED_RUNIC_FOCUS.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.INFERNAL_BULB.get(), 1)) - .addIncense(new ItemStack(Items.WHEAT, 1)) - .addIngredient(new ItemStack(RootsRegistry.RUNIC_FOCUS.get(), 1)) - .addIngredient(new ItemStack(Items.REDSTONE, 1)) - .addIngredient(new ItemStack(Items.GLOWSTONE_DUST, 1))); - - public static final RegistryObject LIVING_PICKAXE_CRAFTING = RITUALS.register("living_pickaxe_crafting", () -> - new RitualCrafting(0, 146, 214, 43) - .setResult(new ItemStack(RootsRegistry.LIVING_PICKAXE.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIngredient(new ItemStack(Items.WOODEN_PICKAXE, 1)) - .addIngredient(new ItemStack(RootsRegistry.VERDANT_SPRIG.get(), 1)) - .addIngredient(new ItemStack(Items.GOLD_NUGGET))); - - public static final RegistryObject LIVING_AXE_CRAFTING = RITUALS.register("living_axe_crafting", () -> - new RitualCrafting(0, 146, 214, 43) - .setResult(new ItemStack(RootsRegistry.LIVING_AXE.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIngredient(new ItemStack(Items.WOODEN_AXE, 1)) - .addIngredient(new ItemStack(RootsRegistry.VERDANT_SPRIG.get(), 1)) - .addIngredient(new ItemStack(Items.GOLD_NUGGET, 1))); - - public static final RegistryObject LIVING_SWORD_CRAFTING = RITUALS.register("living_sword_crafting", () -> - new RitualCrafting(0, 146, 214, 43) - .setResult(new ItemStack(RootsRegistry.LIVING_SWORD.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIngredient(new ItemStack(Items.WOODEN_SWORD, 1)) - .addIngredient(new ItemStack(RootsRegistry.VERDANT_SPRIG.get(), 1)) - .addIngredient(new ItemStack(Items.GOLD_NUGGET, 1))); - - public static final RegistryObject LIVING_HOE_CRAFTING = RITUALS.register("living_hoe_crafting", () -> - new RitualCrafting(0, 146, 214, 43) - .setResult(new ItemStack(RootsRegistry.LIVING_HOE.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIngredient(new ItemStack(Items.WOODEN_HOE, 1)) - .addIngredient(new ItemStack(RootsRegistry.VERDANT_SPRIG.get(), 1)) - .addIngredient(new ItemStack(Items.GOLD_NUGGET, 1))); - - public static final RegistryObject LIVING_SHOVEL_CRAFTING = RITUALS.register("living_shovel_crafting", () -> - new RitualCrafting(0, 146, 214, 43) - .setResult(new ItemStack(RootsRegistry.LIVING_SHOVEL.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.OAK_BARK.get(), 1)) - .addIngredient(new ItemStack(Items.WOODEN_SHOVEL, 1)) - .addIngredient(new ItemStack(RootsRegistry.VERDANT_SPRIG.get(), 1)) - .addIngredient(new ItemStack(Items.GOLD_NUGGET, 1))); - - public static final RegistryObject CAUSE_RAIN = RITUALS.register("cause_rain", () -> - new RitualCauseRain(1, 23, 0, 138) - .addIncense(new ItemStack(Blocks.VINE, 1)) - .addIncense(new ItemStack(RootsRegistry.OLD_ROOT.get(), 1)) - .addIngredient(new ItemStack(Blocks.LILY_PAD, 1))); - - public static final RegistryObject BANISH_RAIN = RITUALS.register("banish_rain", () -> - new RitualBanishRain(1, 204, 159, 35) - .addIncense(new ItemStack(Blocks.VINE, 1)) - .addIncense(new ItemStack(RootsRegistry.OLD_ROOT.get(), 1)) - .addIngredient(new ItemStack(Items.WHEAT, 1))); - - public static final RegistryObject MASS_BREEDING = RITUALS.register("mass_breeding", () -> - new RitualMassBreed(2, 148, 61, 81) - .addIncense(new ItemStack(Items.CARROT, 1)) - .addIncense(new ItemStack(Items.WHEAT, 1)) - .addIncense(new ItemStack(Items.WHEAT_SEEDS, 1)) - .addIncense(new ItemStack(Items.COD, 1)) - .addIngredient(new ItemStack(Items.GLOWSTONE_DUST, 1)) - .addIngredient(new ItemStack(Items.BONE))); - - public static final RegistryObject LIFE_DRAIN = RITUALS.register("life_drain", () -> - new RitualLifeDrain(2, 139, 22, 40) - .addIncense(new ItemStack(Items.WOODEN_SWORD, 1)) - .addIncense(new ItemStack(Items.WOODEN_AXE, 1)) - .addIncense(new ItemStack(RootsRegistry.DARK_OAK_BARK.get(), 1)) - .addIncense(new ItemStack(RootsRegistry.BIRCH_BARK.get(), 1)) - .addIngredient(new ItemStack(Items.BLAZE_POWDER, 1)) - .addIngredient(new ItemStack(Items.BONE, 1))); - - public static final RegistryObject IMBUER = RITUALS.register("imbuer", () -> - new RitualImbuer() - .addIngredient(new ItemStack(RootsRegistry.CRYSTAL_STAFF.get(), 1)) - .addIngredient(new ItemStack(RootsRegistry.VERDANT_SPRIG.get(), 1))); - - public static final RegistryObject COW_SUMMONING = RITUALS.register("cow_summoning", () -> - new RitualSummoning(1, 199, 105, 193) - .setEntityType(EntityType.COW) - .addIncense(new ItemStack(Items.WHEAT_SEEDS, 1)) - .addIncense(new ItemStack(Items.NETHER_WART, 1)) - .addIngredient(new ItemStack(Items.BEEF, 1)) - .addIngredient(new ItemStack(Items.LEATHER, 1)) - .addIngredient(new ItemStack(Items.BONE, 1))); - - public static final RegistryObject PIG_SUMMONING = RITUALS.register("pig_summoning", () -> - new RitualSummoning(1, 199, 105, 193) - .setEntityType(EntityType.PIG) - .addIncense(new ItemStack(Items.WHEAT_SEEDS, 1)) - .addIncense(new ItemStack(Items.NETHER_WART, 1)) - .addIngredient(new ItemStack(Items.PORKCHOP, 1)) - .addIngredient(new ItemStack(Items.PORKCHOP, 1)) - .addIngredient(new ItemStack(Items.BONE, 1))); - - public static final RegistryObject SHEEP_SUMMONING = RITUALS.register("sheep_summoning", () -> - new RitualSummoning(1, 199, 105, 193) - .setEntityType(EntityType.SHEEP) - .addIncense(new ItemStack(Items.WHEAT_SEEDS, 1)) - .addIncense(new ItemStack(Items.NETHER_WART, 1)) - .addIngredient(new ItemStack(Items.MUTTON, 1)) - .addIngredient(new ItemStack(Blocks.WHITE_WOOL, 1)) - .addIngredient(new ItemStack(Items.BONE, 1))); - - public static final RegistryObject CHICKEN_SUMMONING = RITUALS.register("chicken_summoning", () -> - new RitualSummoning(1, 199, 105, 193) - .setEntityType(EntityType.CHICKEN) - .addIncense(new ItemStack(Items.WHEAT_SEEDS, 1)) - .addIncense(new ItemStack(Items.NETHER_WART, 1)) - .addIngredient(new ItemStack(Items.CHICKEN, 1)) - .addIngredient(new ItemStack(Items.FEATHER, 1)) - .addIngredient(new ItemStack(Items.BONE, 1))); - - public static final RegistryObject RABBIT_SUMMONING = RITUALS.register("rabbit_summoning", () -> - new RitualSummoning(1, 199, 105, 193) - .setEntityType(EntityType.RABBIT) - .addIncense(new ItemStack(Items.WHEAT_SEEDS, 1)) - .addIncense(new ItemStack(Items.NETHER_WART, 1)) - .addIngredient(new ItemStack(Items.RABBIT, 1)) - .addIngredient(new ItemStack(Items.RABBIT_HIDE, 1)) - .addIngredient(new ItemStack(Items.BONE, 1))); - - public static final RegistryObject ZOMBIE_SUMMONING = RITUALS.register("zombie_summoning", () -> - new RitualSummoning(2, 58, 2, 84) - .setEntityType(EntityType.ZOMBIE) - .addIncense(new ItemStack(Items.COAL, 1)) - .addIncense(new ItemStack(Items.NETHER_WART, 1)) - .addIngredient(new ItemStack(Items.ROTTEN_FLESH, 1)) - .addIngredient(new ItemStack(Items.ROTTEN_FLESH, 1)) - .addIngredient(new ItemStack(Items.BONE, 1))); - - public static final RegistryObject SKELETON_SUMMONING = RITUALS.register("skeleton_summoning", () -> - new RitualSummoning(2, 58, 2, 84) - .setEntityType(EntityType.SKELETON) - .addIncense(new ItemStack(Items.COAL, 1)) - .addIncense(new ItemStack(Items.NETHER_WART, 1)) - .addIngredient(new ItemStack(Items.ARROW, 1)) - .addIngredient(new ItemStack(Items.BONE, 1)) - .addIngredient(new ItemStack(Items.BONE, 1))); - - public static final RegistryObject SPIDER_SUMMONING = RITUALS.register("spider_summoning", () -> - new RitualSummoning(2, 58, 2, 84) - .setEntityType(EntityType.SPIDER) - .addIncense(new ItemStack(Items.COAL, 1)) - .addIncense(new ItemStack(Items.NETHER_WART, 1)) - .addIngredient(new ItemStack(Items.STRING, 1)) - .addIngredient(new ItemStack(Items.SPIDER_EYE, 1)) - .addIngredient(new ItemStack(Items.BONE, 1))); - - public static final RegistryObject CAVE_SPIDER_SUMMONING = RITUALS.register("cave_spider_summoning", () -> - new RitualSummoning(2, 58, 2, 84) - .setEntityType(EntityType.CAVE_SPIDER) - .addIncense(new ItemStack(Items.COAL, 1)) - .addIncense(new ItemStack(Items.NETHER_WART, 1)) - .addIngredient(new ItemStack(Items.STRING, 1)) - .addIngredient(new ItemStack(Items.FERMENTED_SPIDER_EYE, 1)) - .addIngredient(new ItemStack(Items.BONE, 1))); - - public static final RegistryObject SLIME_SUMMONING = RITUALS.register("slime_summoning", () -> - new RitualSummoning(2, 58, 2, 84) - .setEntityType(EntityType.SLIME) - .addIncense(new ItemStack(Items.COAL, 1)) - .addIncense(new ItemStack(Items.NETHER_WART, 1)) - .addIngredient(new ItemStack(Items.SLIME_BALL, 1)) - .addIngredient(new ItemStack(Items.SLIME_BALL, 1)) - .addIngredient(new ItemStack(Items.SLIME_BALL, 1))); - - public static final RegistryObject CREEPER_SUMMONING = RITUALS.register("creeper_summoning", () -> - new RitualSummoning(2, 58, 2, 84) - .setEntityType(EntityType.CREEPER) - .addIncense(new ItemStack(Items.COAL, 1)) - .addIncense(new ItemStack(Items.NETHER_WART, 1)) - .addIngredient(new ItemStack(Items.GUNPOWDER, 1)) - .addIngredient(new ItemStack(Items.GUNPOWDER, 1)) - .addIngredient(new ItemStack(Items.BONE, 1))); - - public static final RegistryObject ENDERMAN_SUMMONING = RITUALS.register("enderman_summoning", () -> - new RitualSummoning(2, 58, 2, 84) - .setEntityType(EntityType.ENDERMAN) - .addIncense(new ItemStack(Items.COAL, 1)) - .addIncense(new ItemStack(Items.NETHER_WART, 1)) - .addIngredient(new ItemStack(Items.ENDER_PEARL, 1)) - .addIngredient(new ItemStack(Items.ENDER_PEARL, 1)) - .addIngredient(new ItemStack(Items.BONE, 1))); - - public static final RegistryObject SACRIFICE = RITUALS.register("sacrifice", () -> - new RitualSacrifice(2, 94, 9, 56) - .addIncense(new ItemStack(Items.BLAZE_POWDER, 1)) - .addIncense(new ItemStack(RootsRegistry.DARK_OAK_BARK.get(), 1)) - .addIngredient(new ItemStack(Items.FLINT, 1)) - .addIngredient(new ItemStack(Items.IRON_SWORD, 1)) - .addIngredient(new ItemStack(Items.BONE, 1))); - - public static final RegistryObject FLARE = RITUALS.register("flare", () -> - new RitualFlare(1, 255, 91, 25) - .addIncense(new ItemStack(Items.GUNPOWDER, 1)) - .addIncense(new ItemStack(RootsRegistry.INFERNAL_BULB.get(), 1)) - .addIngredient(new ItemStack(Items.FLINT, 1)) - .addIngredient(new ItemStack(Items.COAL, 1)) - .addIngredient(new ItemStack(Items.CHARCOAL, 1))); - - public static final RegistryObject GROW = RITUALS.register("grow", () -> - new RitualGrow(0, 82, 212, 47) - .addIncense(new ItemStack(Items.WHEAT, 1)) - .addIncense(new ItemStack(Items.BEETROOT, 1)) - .addIncense(new ItemStack(Items.POTATO, 1)) - .addIncense(new ItemStack(Items.CARROT, 1)) - .addIngredient(new ItemStack(Items.REDSTONE, 1)) - .addIngredient(new ItemStack(Items.BONE_MEAL, 1)) - .addIngredient(new ItemStack(RootsRegistry.VERDANT_SPRIG.get(), 1))); - - public static final RegistryObject ENGRAVED_CRAFTING = RITUALS.register("engraved_crafting", () -> - new RitualEngravedSword(2, 104, 106, 107) - .setResult(new ItemStack(RootsRegistry.ENGRAVED_BLADE.get())) - .addIncense(new ItemStack(Items.GOLDEN_APPLE)) - .addIncense(new ItemStack(Items.GOLDEN_CARROT, 1)) - .addIngredient(new ItemStack(Items.STONE_SWORD)) - .addIngredient(new ItemStack(RootsRegistry.RUNIC_FOCUS.get())) - .addIngredient(new ItemStack(Items.GLOWSTONE_DUST))); - - public static final RegistryObject TIME_SHIFT = RITUALS.register("time_shift", () -> - new RitualTimeShift(1, 240, 245, 88) - .addIngredient(new ItemStack(Items.CLOCK)) - .addIngredient(new ItemStack(Items.IRON_INGOT)) - .addIncense(new ItemStack(Items.CLOCK)) - .setSecondaryColor(252, 162, 35)); - - - public static RitualBase findMatchingByIngredients(AltarBlockEntity altar) { - for (RitualBase ritual : RitualBaseRegistry.RITUALS.get().getValues()) { - // if (ritual.getName().equals("healer_stone_crafting")) { - // Roots.logger.info("healer stone?"); - // for (ItemStack s : ritual.getIngredients()) { - // Roots.logger.info(s.getDisplayName()); - // } - // Roots.logger.info("==== "); - // for (ItemStack s : altar.getInventory()) { - // Roots.logger.info(s.getDisplayName()); - // } - // Roots.logger.info("----"); - // } - List altarInv = new ArrayList<>(); - for (int i = 0; i < altar.inventory.getSlots(); i++) { - altarInv.add(altar.inventory.getStackInSlot(i)); - } - if (RootsUtil.itemListsMatchWithSize(ritual.getIngredients(), altarInv)) { - return ritual; - } + public static Optional> findMatchingByIngredients(AltarBlockEntity altar) { + List altarInv = new ArrayList<>(); + for (int i = 0; i < altar.inventory.getSlots(); i++) { + var stack = altar.inventory.getStackInSlot(i); + if (!stack.isEmpty()) altarInv.add(stack); } - return null; + + return altar.getLevel().getRecipeManager().getAllRecipesFor(RootsRecipes.RITUAL_RECIPE_TYPE.get()).stream() + .filter(it -> RootsUtil.matchesIngredients(altarInv, it.getIngredients())) + .findFirst(); } - public static ArrayList getIncenses(Level level, BlockPos pos) { + public static List getIncenses(Level level, BlockPos pos) { ArrayList test = new ArrayList<>(); for (int i = -4; i < 5; i++) { for (int j = -4; j < 5; j++) { @@ -505,4 +88,11 @@ public static ArrayList getIncenses(Level level, BlockPos pos) { } return test; } + + @Nullable + public static Optional> recipeByName(RecipeManager recipeManager, ResourceLocation id) { + return recipeManager.getAllRecipesFor(RootsRecipes.RITUAL_RECIPE_TYPE.get()).stream() + .filter(it -> it.getId().equals(id)) + .findFirst(); + } } diff --git a/src/main/java/elucent/rootsclassic/ritual/SimpleRitualEffect.java b/src/main/java/elucent/rootsclassic/ritual/SimpleRitualEffect.java new file mode 100644 index 00000000..cdd239b9 --- /dev/null +++ b/src/main/java/elucent/rootsclassic/ritual/SimpleRitualEffect.java @@ -0,0 +1,35 @@ +package elucent.rootsclassic.ritual; + +import com.google.gson.JsonObject; +import net.minecraft.core.BlockPos; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; + +import java.util.List; + +public abstract class SimpleRitualEffect extends RitualEffect { + + @Override + public final Void fromJSON(JsonObject object) { + return null; + } + + @Override + public final void toNetwork(Void config, FriendlyByteBuf buffer) { + } + + @Override + public final Void fromNetwork(FriendlyByteBuf buffer) { + return null; + } + + @Override + public final void doEffect(Level levelAccessor, BlockPos pos, Container inventory, List incenses, Void config) { + doEffect(levelAccessor, pos, inventory, incenses); + } + + public abstract void doEffect(Level levelAccessor, BlockPos pos, Container inventory, List incenses); + +} diff --git a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualBanishRain.java b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualBanishRain.java index df573394..c2f638c5 100644 --- a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualBanishRain.java +++ b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualBanishRain.java @@ -1,6 +1,7 @@ package elucent.rootsclassic.ritual.rituals; -import elucent.rootsclassic.ritual.RitualBase; +import elucent.rootsclassic.ritual.RitualEffect; +import elucent.rootsclassic.ritual.SimpleRitualEffect; import net.minecraft.core.BlockPos; import net.minecraft.world.Container; import net.minecraft.world.item.ItemStack; @@ -8,11 +9,8 @@ import java.util.List; -public class RitualBanishRain extends RitualBase { +public class RitualBanishRain extends SimpleRitualEffect { - public RitualBanishRain(int level, double r, double g, double b) { - super(level, r, g, b); - } // @Override // public boolean incenseMatches(Level level, BlockPos pos) { // if (super.incenseMatches(world, pos)) { diff --git a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualCauseRain.java b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualCauseRain.java index 10fa0471..0af5f05a 100644 --- a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualCauseRain.java +++ b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualCauseRain.java @@ -1,6 +1,7 @@ package elucent.rootsclassic.ritual.rituals; -import elucent.rootsclassic.ritual.RitualBase; +import elucent.rootsclassic.ritual.RitualEffect; +import elucent.rootsclassic.ritual.SimpleRitualEffect; import net.minecraft.core.BlockPos; import net.minecraft.world.Container; import net.minecraft.world.item.ItemStack; @@ -8,11 +9,8 @@ import java.util.List; -public class RitualCauseRain extends RitualBase { +public class RitualCauseRain extends SimpleRitualEffect { - public RitualCauseRain(int level, double r, double g, double b) { - super(level, r, g, b); - } // @Override // public boolean incenseMatches(World world, BlockPos pos) { // if (super.incenseMatches(world, pos)) { diff --git a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualCrafting.java b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualCrafting.java index 504e8ea1..89a24e90 100644 --- a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualCrafting.java +++ b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualCrafting.java @@ -1,31 +1,24 @@ package elucent.rootsclassic.ritual.rituals; -import elucent.rootsclassic.ritual.RitualBase; +import com.google.gson.JsonObject; +import elucent.rootsclassic.ritual.RitualEffect; import net.minecraft.core.BlockPos; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.util.GsonHelper; import net.minecraft.world.Container; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.ShapedRecipe; import net.minecraft.world.level.Level; import java.util.List; -public class RitualCrafting extends RitualBase { - - public ItemStack result = ItemStack.EMPTY; - - public RitualCrafting(int level, double r, double g, double b) { - super(level, r, g, b); - } - - public RitualCrafting setResult(ItemStack stack) { - this.result = stack; - return this; - } +public class RitualCrafting extends RitualEffect { @Override - public void doEffect(Level levelAccessor, BlockPos pos, Container inventory, List incenses) { + public void doEffect(Level levelAccessor, BlockPos pos, Container inventory, List incenses, RitualCraftingConfig config) { // if (Util.itemListsMatchWithSize(inventory, this.ingredients)) { - ItemStack toSpawn = result.copy(); + ItemStack toSpawn = config.result.copy(); if (!levelAccessor.isClientSide) { ItemEntity item = new ItemEntity(levelAccessor, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, toSpawn); levelAccessor.addFreshEntity(item); @@ -34,4 +27,29 @@ public void doEffect(Level levelAccessor, BlockPos pos, Container inventory, Lis levelAccessor.getBlockEntity(pos).setChanged(); //} } + + @Override + public RitualCraftingConfig fromJSON(JsonObject object) { + var result = ShapedRecipe.itemStackFromJson(GsonHelper.getAsJsonObject(object, "result")); + return new RitualCraftingConfig(result); + } + + @Override + public ItemStack getResult(RitualCraftingConfig config) { + return config.result; + } + + @Override + public void toNetwork(RitualCraftingConfig config, FriendlyByteBuf buffer) { + buffer.writeItem(config.result); + } + + @Override + public RitualCraftingConfig fromNetwork(FriendlyByteBuf buffer) { + return new RitualCraftingConfig(buffer.readItem()); + } + + public record RitualCraftingConfig(ItemStack result) { + } + } diff --git a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualEngravedCrafting.java b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualEngravedCrafting.java new file mode 100644 index 00000000..0e24f65c --- /dev/null +++ b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualEngravedCrafting.java @@ -0,0 +1,71 @@ +package elucent.rootsclassic.ritual.rituals; + +import elucent.rootsclassic.registry.RootsRegistry; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.Container; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; + +import java.util.ArrayList; +import java.util.List; + +public class RitualEngravedCrafting extends RitualCrafting { + + @Override + public void doEffect(Level levelAccessor, BlockPos pos, Container inventory, List incenses, RitualCraftingConfig config) { + List items = new ArrayList<>(); + for (ItemStack i : incenses) { + items.add(i.getItem()); + } + + ItemStack toSpawn = config.result().copy(); + if (!levelAccessor.isClientSide) { + int mods = 0; + ItemEntity item = new ItemEntity(levelAccessor, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, toSpawn); + ItemStack stack = item.getItem(); + CompoundTag tag = stack.getTag() != null ? stack.getTag() : new CompoundTag(); + for (Item i : items) { + if (i == (RootsRegistry.ACACIA_BARK.get()) && mods < 4) { + addMod(tag, "spikes"); + mods++; + } + if (i == RootsRegistry.SPRUCE_BARK.get() && mods < 4) { + addMod(tag, "forceful"); + mods++; + } + if (i == RootsRegistry.BIRCH_BARK.get() && mods < 4) { + addMod(tag, "holy"); + mods++; + } + if (i == RootsRegistry.JUNGLE_BARK.get() && mods < 4) { + addMod(tag, "aquatic"); + mods++; + } + if (i == RootsRegistry.DARK_OAK_BARK.get() && mods < 4) { + addMod(tag, "shadowstep"); + mods++; + } + } + stack.setTag(tag); + levelAccessor.addFreshEntity(item); + } + inventory.clearContent(); + BlockEntity tile = levelAccessor.getBlockEntity(pos); + if (tile != null) { + tile.setChanged(); + } + + } + + public void addMod(CompoundTag tag, String name) { + if (tag.contains(name)) { + tag.putInt(name, tag.getInt(name) + 1); + } else { + tag.putInt(name, 1); + } + } +} diff --git a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualEngravedSword.java b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualEngravedSword.java deleted file mode 100644 index a2d02ae0..00000000 --- a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualEngravedSword.java +++ /dev/null @@ -1,84 +0,0 @@ -package elucent.rootsclassic.ritual.rituals; - -import elucent.rootsclassic.registry.RootsRegistry; -import elucent.rootsclassic.ritual.RitualBase; -import elucent.rootsclassic.util.RootsUtil; -import net.minecraft.core.BlockPos; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.Container; -import net.minecraft.world.entity.item.ItemEntity; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.entity.BlockEntity; - -import java.util.ArrayList; -import java.util.List; - -public class RitualEngravedSword extends RitualBase { - - public ItemStack result = null; - - public RitualBase setResult(ItemStack stack) { - this.result = stack; - return this; - } - - public RitualEngravedSword(int level, double r, double g, double b) { - super(level, r, g, b); - } - - @Override - public void doEffect(Level levelAccessor, BlockPos pos, Container inventory, List incenses) { - List items = new ArrayList<>(); - for (ItemStack i : incenses) { - items.add(i.getItem()); - } - if (RootsUtil.itemListMatchInventoryWithSize(inventory, this.getIngredients())) { - ItemStack toSpawn = result.copy(); - if (!levelAccessor.isClientSide) { - int mods = 0; - ItemEntity item = new ItemEntity(levelAccessor, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, toSpawn); - ItemStack stack = item.getItem(); - CompoundTag tag = stack.getTag() != null ? stack.getTag() : new CompoundTag(); - for (Item i : items) { - if (i == (RootsRegistry.ACACIA_BARK.get()) && mods < 4) { - addMod(tag, "spikes"); - mods++; - } - if (i == RootsRegistry.SPRUCE_BARK.get() && mods < 4) { - addMod(tag, "forceful"); - mods++; - } - if (i == RootsRegistry.BIRCH_BARK.get() && mods < 4) { - addMod(tag, "holy"); - mods++; - } - if (i == RootsRegistry.JUNGLE_BARK.get() && mods < 4) { - addMod(tag, "aquatic"); - mods++; - } - if (i == RootsRegistry.DARK_OAK_BARK.get() && mods < 4) { - addMod(tag, "shadowstep"); - mods++; - } - } - stack.setTag(tag); - levelAccessor.addFreshEntity(item); - } - inventory.clearContent(); - BlockEntity tile = levelAccessor.getBlockEntity(pos); - if (tile != null) { - tile.setChanged(); - } - } - } - - public void addMod(CompoundTag tag, String name) { - if (tag.contains(name)) { - tag.putInt(name, tag.getInt(name) + 1); - } else { - tag.putInt(name, 1); - } - } -} diff --git a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualFlare.java b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualFlare.java index 26d96be8..772ada0d 100644 --- a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualFlare.java +++ b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualFlare.java @@ -1,6 +1,7 @@ package elucent.rootsclassic.ritual.rituals; -import elucent.rootsclassic.ritual.RitualBase; +import elucent.rootsclassic.ritual.RitualEffect; +import elucent.rootsclassic.ritual.SimpleRitualEffect; import net.minecraft.core.BlockPos; import net.minecraft.world.Container; import net.minecraft.world.entity.LivingEntity; @@ -12,11 +13,7 @@ import java.util.List; -public class RitualFlare extends RitualBase { - - public RitualFlare(int level, double r, double g, double b) { - super(level, r, g, b); - } +public class RitualFlare extends SimpleRitualEffect { @Override public void doEffect(Level levelAccessor, BlockPos pos, Container inventory, List incenses) { diff --git a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualGrow.java b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualGrow.java index 27924c4e..0aa9552f 100644 --- a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualGrow.java +++ b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualGrow.java @@ -1,6 +1,7 @@ package elucent.rootsclassic.ritual.rituals; -import elucent.rootsclassic.ritual.RitualBase; +import elucent.rootsclassic.ritual.RitualEffect; +import elucent.rootsclassic.ritual.SimpleRitualEffect; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.Container; @@ -10,11 +11,7 @@ import java.util.List; -public class RitualGrow extends RitualBase { - - public RitualGrow(int level, double r, double g, double b) { - super(level, r, g, b); - } +public class RitualGrow extends SimpleRitualEffect { @Override public void doEffect(Level levelAccessor, BlockPos pos, Container inventory, List incenses) { diff --git a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualImbuer.java b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualImbuer.java index ddd6a655..84ff912e 100644 --- a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualImbuer.java +++ b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualImbuer.java @@ -3,7 +3,8 @@ import elucent.rootsclassic.Const; import elucent.rootsclassic.item.CrystalStaffItem; import elucent.rootsclassic.registry.RootsRegistry; -import elucent.rootsclassic.ritual.RitualBase; +import elucent.rootsclassic.ritual.RitualEffect; +import elucent.rootsclassic.ritual.SimpleRitualEffect; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.Container; @@ -13,11 +14,7 @@ import java.util.List; -public class RitualImbuer extends RitualBase { - - public RitualImbuer() { - super(1, 255, 255, 255); - } +public class RitualImbuer extends SimpleRitualEffect { @Override public void doEffect(Level levelAccessor, BlockPos pos, Container inventory, List incenses) { diff --git a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualLifeDrain.java b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualLifeDrain.java index 0d1ce2c5..811eef11 100644 --- a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualLifeDrain.java +++ b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualLifeDrain.java @@ -1,6 +1,7 @@ package elucent.rootsclassic.ritual.rituals; -import elucent.rootsclassic.ritual.RitualBase; +import elucent.rootsclassic.ritual.RitualEffect; +import elucent.rootsclassic.ritual.SimpleRitualEffect; import net.minecraft.core.BlockPos; import net.minecraft.world.Container; import net.minecraft.world.damagesource.DamageSource; @@ -12,11 +13,7 @@ import java.util.List; -public class RitualLifeDrain extends RitualBase { - - public RitualLifeDrain(int level, double r, double g, double b) { - super(level, r, g, b); - } +public class RitualLifeDrain extends SimpleRitualEffect { @Override public void doEffect(Level levelAccessor, BlockPos pos, Container inventory, List incenses) { diff --git a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualMassBreed.java b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualMassBreed.java index 23bdb09b..790c6691 100644 --- a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualMassBreed.java +++ b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualMassBreed.java @@ -1,6 +1,7 @@ package elucent.rootsclassic.ritual.rituals; -import elucent.rootsclassic.ritual.RitualBase; +import elucent.rootsclassic.ritual.RitualEffect; +import elucent.rootsclassic.ritual.SimpleRitualEffect; import net.minecraft.core.BlockPos; import net.minecraft.world.Container; import net.minecraft.world.entity.animal.Animal; @@ -10,11 +11,7 @@ import java.util.List; -public class RitualMassBreed extends RitualBase { - - public RitualMassBreed(int level, double r, double g, double b) { - super(level, r, g, b); - } +public class RitualMassBreed extends SimpleRitualEffect { @Override public void doEffect(Level levelAccessor, BlockPos pos, Container inventory, List incenses) { diff --git a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualSacrifice.java b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualSacrifice.java index 2b138646..bacbd529 100644 --- a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualSacrifice.java +++ b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualSacrifice.java @@ -1,6 +1,7 @@ package elucent.rootsclassic.ritual.rituals; -import elucent.rootsclassic.ritual.RitualBase; +import elucent.rootsclassic.ritual.RitualEffect; +import elucent.rootsclassic.ritual.SimpleRitualEffect; import net.minecraft.core.BlockPos; import net.minecraft.world.Container; import net.minecraft.world.entity.LivingEntity; @@ -15,12 +16,11 @@ import java.util.ArrayList; import java.util.List; -public class RitualSacrifice extends RitualBase { +public class RitualSacrifice extends SimpleRitualEffect { - public ArrayList potentialDrops = new ArrayList<>(); + private ArrayList potentialDrops = new ArrayList<>(); - public RitualSacrifice(int level, double r, double g, double b) { - super(level, r, g, b); + public RitualSacrifice() { potentialDrops.add(new ItemStack(Items.WHEAT_SEEDS, 1)); potentialDrops.add(new ItemStack(Items.WHEAT_SEEDS, 1)); potentialDrops.add(new ItemStack(Items.PUMPKIN_SEEDS, 1)); diff --git a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualSummoning.java b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualSummoning.java index 445bfafa..c655fe5b 100644 --- a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualSummoning.java +++ b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualSummoning.java @@ -1,48 +1,86 @@ package elucent.rootsclassic.ritual.rituals; -import elucent.rootsclassic.ritual.RitualBase; -import elucent.rootsclassic.util.RootsUtil; +import com.google.gson.JsonObject; +import elucent.rootsclassic.Const; +import elucent.rootsclassic.ritual.RitualEffect; import net.minecraft.core.BlockPos; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.core.Registry; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.Style; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.GsonHelper; import net.minecraft.world.Container; -import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.MobSpawnType; -import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraftforge.common.ForgeSpawnEggItem; import java.util.List; -public class RitualSummoning extends RitualBase { +public class RitualSummoning extends RitualEffect { + + @Override + public void doEffect(Level levelAccessor, BlockPos pos, Container inventory, List incenses, RitualSummoningConfig config) { + if (!levelAccessor.isClientSide) { + Entity toSpawn = config.entityType.create(levelAccessor); - public EntityType entityType = null; + if (toSpawn instanceof Mob) { + Mob mob = (Mob) toSpawn; + mob.finalizeSpawn((ServerLevel) levelAccessor, levelAccessor.getCurrentDifficultyAt(pos), MobSpawnType.MOB_SUMMONED, null, null); + } - public RitualSummoning setEntityType(EntityType entity) { - this.entityType = entity; - return this; + toSpawn.setPos(pos.getX() + 0.5, pos.getY() + 2.0, pos.getZ() + 0.5); + inventory.clearContent(); + levelAccessor.addFreshEntity(toSpawn); + BlockEntity tile = levelAccessor.getBlockEntity(pos); + if (tile != null) { + tile.setChanged(); + } + } } - public RitualSummoning(int level, double r, double g, double b) { - super(level, r, g, b); + @Override + public MutableComponent getInfoText(RitualSummoningConfig config) { + var egg = ForgeSpawnEggItem.fromEntityType(config.entityType); + if (egg == null) return Component.empty(); + return Component.translatable(Const.MODID + ".jei.tooltip.summoning", config.entityType.getDescription()); } @Override - public void doEffect(Level levelAccessor, BlockPos pos, Container inventory, List incenses) { - if (RootsUtil.itemListMatchInventoryWithSize(inventory, this.getIngredients()) && !levelAccessor.isClientSide) { - Mob toSpawn = entityType.create(levelAccessor); - if (toSpawn != null) { - toSpawn.finalizeSpawn((ServerLevel) levelAccessor, levelAccessor.getCurrentDifficultyAt(pos), MobSpawnType.MOB_SUMMONED, (SpawnGroupData) null, (CompoundTag) null); - toSpawn.setPos(pos.getX() + 0.5, pos.getY() + 2.0, pos.getZ() + 0.5); - inventory.clearContent(); - levelAccessor.addFreshEntity(toSpawn); - BlockEntity tile = levelAccessor.getBlockEntity(pos); - if (tile != null) { - tile.setChanged(); - } - } - } + public ItemStack getResult(RitualSummoningConfig config) { + var egg = ForgeSpawnEggItem.fromEntityType(config.entityType); + if (egg == null) return super.getResult(config); + var display = getInfoText(config); + return new ItemStack(egg).setHoverName(display.withStyle(Style.EMPTY.withItalic(false))); + } + + @Override + public RitualSummoningConfig fromJSON(JsonObject object) { + var id = GsonHelper.getAsString(object, "entity"); + var type = Registry.ENTITY_TYPE.get(new ResourceLocation(id)); + return new RitualSummoningConfig(type); + } + + @Override + public void toNetwork(RitualSummoningConfig config, FriendlyByteBuf buffer) { + buffer.writeResourceLocation(Registry.ENTITY_TYPE.getKey(config.entityType)); } + + @Override + public RitualSummoningConfig fromNetwork(FriendlyByteBuf buffer) { + var id = buffer.readResourceLocation(); + var type = Registry.ENTITY_TYPE.get(id); + return new RitualSummoningConfig(type); + } + + public record RitualSummoningConfig(EntityType entityType) { + } + } diff --git a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualTimeShift.java b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualTimeShift.java index dc7452b6..93947c4d 100644 --- a/src/main/java/elucent/rootsclassic/ritual/rituals/RitualTimeShift.java +++ b/src/main/java/elucent/rootsclassic/ritual/rituals/RitualTimeShift.java @@ -1,6 +1,7 @@ package elucent.rootsclassic.ritual.rituals; -import elucent.rootsclassic.ritual.RitualBase; +import elucent.rootsclassic.ritual.RitualEffect; +import elucent.rootsclassic.ritual.SimpleRitualEffect; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.Container; @@ -12,11 +13,7 @@ import java.util.ArrayList; import java.util.List; -public class RitualTimeShift extends RitualBase { - - public RitualTimeShift(int level, double r, double g, double b) { - super(level, r, g, b); - } +public class RitualTimeShift extends SimpleRitualEffect { @Override public void doEffect(Level levelAccessor, BlockPos pos, Container inventory, List incenses) { diff --git a/src/main/java/elucent/rootsclassic/util/RootsUtil.java b/src/main/java/elucent/rootsclassic/util/RootsUtil.java index 131776dd..8517047c 100644 --- a/src/main/java/elucent/rootsclassic/util/RootsUtil.java +++ b/src/main/java/elucent/rootsclassic/util/RootsUtil.java @@ -293,4 +293,15 @@ public static void randomlyRepair(RandomSource rnd, ItemStack stack) { stack.setDamageValue(stack.getDamageValue() - 1); } } + + public static boolean matchesIngredients(List inv, List ingredients) { + if (inv.size() != ingredients.size()) return false; + + var available = new ArrayList<>(inv); + return ingredients.stream().allMatch(ingredient -> { + var match = available.stream().filter(ingredient).findFirst(); + match.ifPresent(available::remove); + return match.isPresent(); + }); + } } diff --git a/src/main/resources/assets/rootsclassic/lang/en_us.json b/src/main/resources/assets/rootsclassic/lang/en_us.json index ea0e25fb..7d2f2a50 100644 --- a/src/main/resources/assets/rootsclassic/lang/en_us.json +++ b/src/main/resources/assets/rootsclassic/lang/en_us.json @@ -524,5 +524,17 @@ "death.attack.rootsclassic.fire": "%1$s burned to death", "death.attack.rootsclassic.fire.player": "%1$s burned to death because of %2$s", "death.attack.rootsclassic.wither": "%1$s withered away", - "death.attack.rootsclassic.wither.player": "%1$s ithered away because of %2$s" + "death.attack.rootsclassic.wither.player": "%1$s ithered away because of %2$s", + + "rootsclassic.jei.tooltip.crafting": "", + "rootsclassic.jei.tooltip.engraved_crafting": "", + "rootsclassic.jei.tooltip.imbuer": "Imbuer", + "rootsclassic.jei.tooltip.life_drain": "Life Drain", + "rootsclassic.jei.tooltip.cause_rain": "Cause Rain", + "rootsclassic.jei.tooltip.banish_rain": "Banish Rain", + "rootsclassic.jei.tooltip.sacrifice": "Sacrifice", + "rootsclassic.jei.tooltip.mass_breeding": "Mass Breeding", + "rootsclassic.jei.tooltip.flare": "Flare", + "rootsclassic.jei.tooltip.time_shift": "Shift Time", + "rootsclassic.jei.tooltip.summoning": "Summons %s" } \ No newline at end of file diff --git a/src/main/resources/assets/rootsclassic/textures/gui/jei/compat.png b/src/main/resources/assets/rootsclassic/textures/gui/jei/compat.png index 3a60f350..b7885152 100644 Binary files a/src/main/resources/assets/rootsclassic/textures/gui/jei/compat.png and b/src/main/resources/assets/rootsclassic/textures/gui/jei/compat.png differ diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/banish_rain.json b/src/main/resources/data/rootsclassic/recipes/ritual/banish_rain.json new file mode 100644 index 00000000..8506c2f4 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/banish_rain.json @@ -0,0 +1,19 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:banish_rain", + "level": 1, + "color": "#cc9f23", + "ingredients": [ + { + "item": "minecraft:wheat" + } + ], + "incenses": [ + { + "item": "minecraft:vine" + }, + { + "item": "rootsclassic:old_root" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/cause_rain.json b/src/main/resources/data/rootsclassic/recipes/ritual/cause_rain.json new file mode 100644 index 00000000..6f7cfbd0 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/cause_rain.json @@ -0,0 +1,19 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:cause_rain", + "level": 1, + "color": "#17008a", + "ingredients": [ + { + "item": "minecraft:lily_pad" + } + ], + "incenses": [ + { + "item": "minecraft:vine" + }, + { + "item": "rootsclassic:old_root" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/accelerator_standing_stone.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/accelerator_standing_stone.json new file mode 100644 index 00000000..97b94bd2 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/accelerator_standing_stone.json @@ -0,0 +1,34 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#006949", + "ingredients": [ + { + "item": "rootsclassic:attuned_standing_stone" + }, + { + "item": "minecraft:glowstone_dust" + }, + { + "item": "minecraft:stone_bricks" + } + ], + "incenses": [ + { + "item": "rootsclassic:verdant_sprig" + }, + { + "item": "rootsclassic:infernal_bulb" + }, + { + "item": "minecraft:wheat" + }, + { + "item": "rootsclassic:jungle_bark" + } + ], + "result": { + "item": "rootsclassic:accelerator_standing_stone" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/aesthetic_standing_stone.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/aesthetic_standing_stone.json new file mode 100644 index 00000000..6a502727 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/aesthetic_standing_stone.json @@ -0,0 +1,21 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#006949", + "ingredients": [ + { + "item": "rootsclassic:attuned_standing_stone" + }, + { + "item": "minecraft:glowstone_dust" + }, + { + "item": "minecraft:mossy_stone_bricks" + } + ], + "incenses": [], + "result": { + "item": "rootsclassic:aesthetic_standing_stone" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/charged_runic_focus.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/charged_runic_focus.json new file mode 100644 index 00000000..712fa6ac --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/charged_runic_focus.json @@ -0,0 +1,28 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 0, + "color": "#00f26d", + "ingredients": [ + { + "item": "rootsclassic:runic_focus" + }, + { + "item": "minecraft:redstone" + }, + { + "item": "minecraft:glowstone_dust" + } + ], + "incenses": [ + { + "item": "rootsclassic:infernal_bulb" + }, + { + "item": "minecraft:wheat" + } + ], + "result": { + "item": "rootsclassic:charged_runic_focus" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/crystal_staff.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/crystal_staff.json new file mode 100644 index 00000000..ffd38adb --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/crystal_staff.json @@ -0,0 +1,34 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#cd5600", + "ingredients": [ + { + "item": "minecraft:diamond_block" + }, + { + "item": "minecraft:stick" + }, + { + "item": "minecraft:blaze_powder" + } + ], + "incenses": [ + { + "item": "minecraft:coal_block" + }, + { + "item": "rootsclassic:acacia_bark" + }, + { + "item": "rootsclassic:verdant_sprig" + }, + { + "item": "rootsclassic:birch_bark" + } + ], + "result": { + "item": "rootsclassic:crystal_staff" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/entangler_standing_stone.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/entangler_standing_stone.json new file mode 100644 index 00000000..28a1ba19 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/entangler_standing_stone.json @@ -0,0 +1,34 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#006949", + "ingredients": [ + { + "item": "rootsclassic:attuned_standing_stone" + }, + { + "item": "minecraft:glowstone_dust" + }, + { + "item": "minecraft:cracked_stone_bricks" + } + ], + "incenses": [ + { + "item": "rootsclassic:verdant_sprig" + }, + { + "item": "rootsclassic:infernal_bulb" + }, + { + "item": "minecraft:wheat" + }, + { + "item": "rootsclassic:oak_bark" + } + ], + "result": { + "item": "rootsclassic:entangler_standing_stone" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/grower_standing_stone.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/grower_standing_stone.json new file mode 100644 index 00000000..8d71ee7b --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/grower_standing_stone.json @@ -0,0 +1,34 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#006949", + "ingredients": [ + { + "item": "rootsclassic:attuned_standing_stone" + }, + { + "item": "minecraft:glowstone_dust" + }, + { + "item": "minecraft:stone" + } + ], + "incenses": [ + { + "item": "rootsclassic:verdant_sprig" + }, + { + "item": "rootsclassic:infernal_bulb" + }, + { + "item": "minecraft:wheat" + }, + { + "item": "rootsclassic:birch_bark" + } + ], + "result": { + "item": "rootsclassic:grower_standing_stone" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/healer_standing_stone.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/healer_standing_stone.json new file mode 100644 index 00000000..457148f1 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/healer_standing_stone.json @@ -0,0 +1,34 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#006949", + "ingredients": [ + { + "item": "rootsclassic:attuned_standing_stone" + }, + { + "item": "minecraft:redstone" + }, + { + "item": "minecraft:chiseled_stone_bricks" + } + ], + "incenses": [ + { + "item": "rootsclassic:verdant_sprig" + }, + { + "item": "rootsclassic:infernal_bulb" + }, + { + "item": "minecraft:wheat" + }, + { + "item": "minecraft:ghast_tear" + } + ], + "result": { + "item": "rootsclassic:healer_standing_stone" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/igniter_standing_stone.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/igniter_standing_stone.json new file mode 100644 index 00000000..6a6e84a1 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/igniter_standing_stone.json @@ -0,0 +1,34 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#006949", + "ingredients": [ + { + "item": "rootsclassic:attuned_standing_stone" + }, + { + "item": "minecraft:redstone" + }, + { + "item": "minecraft:cracked_stone_bricks" + } + ], + "incenses": [ + { + "item": "rootsclassic:verdant_sprig" + }, + { + "item": "rootsclassic:infernal_bulb" + }, + { + "item": "minecraft:wheat" + }, + { + "item": "rootsclassic:acacia_bark" + } + ], + "result": { + "item": "rootsclassic:igniter_standing_stone" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/living_axe.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/living_axe.json new file mode 100644 index 00000000..be0e4627 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/living_axe.json @@ -0,0 +1,28 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 0, + "color": "#92d62b", + "ingredients": [ + { + "item": "minecraft:wooden_axe" + }, + { + "item": "rootsclassic:verdant_sprig" + }, + { + "item": "minecraft:gold_nugget" + } + ], + "incenses": [ + { + "item": "rootsclassic:oak_bark" + }, + { + "item": "rootsclassic:oak_bark" + } + ], + "result": { + "item": "rootsclassic:living_axe" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/living_hoe.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/living_hoe.json new file mode 100644 index 00000000..2ee7881c --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/living_hoe.json @@ -0,0 +1,28 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 0, + "color": "#92d62b", + "ingredients": [ + { + "item": "minecraft:wooden_hoe" + }, + { + "item": "rootsclassic:verdant_sprig" + }, + { + "item": "minecraft:gold_nugget" + } + ], + "incenses": [ + { + "item": "rootsclassic:oak_bark" + }, + { + "item": "rootsclassic:oak_bark" + } + ], + "result": { + "item": "rootsclassic:living_hoe" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/living_pickaxe.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/living_pickaxe.json new file mode 100644 index 00000000..d9f5813b --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/living_pickaxe.json @@ -0,0 +1,28 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 0, + "color": "#92d62b", + "ingredients": [ + { + "item": "minecraft:wooden_pickaxe" + }, + { + "item": "rootsclassic:verdant_sprig" + }, + { + "item": "minecraft:gold_nugget" + } + ], + "incenses": [ + { + "item": "rootsclassic:oak_bark" + }, + { + "item": "rootsclassic:oak_bark" + } + ], + "result": { + "item": "rootsclassic:living_pickaxe" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/living_shovel.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/living_shovel.json new file mode 100644 index 00000000..72f8895b --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/living_shovel.json @@ -0,0 +1,28 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 0, + "color": "#92d62b", + "ingredients": [ + { + "item": "minecraft:wooden_shovel" + }, + { + "item": "rootsclassic:verdant_sprig" + }, + { + "item": "minecraft:gold_nugget" + } + ], + "incenses": [ + { + "item": "rootsclassic:oak_bark" + }, + { + "item": "rootsclassic:oak_bark" + } + ], + "result": { + "item": "rootsclassic:living_shovel" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/living_sword.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/living_sword.json new file mode 100644 index 00000000..d98ea8b1 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/living_sword.json @@ -0,0 +1,28 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 0, + "color": "#92d62b", + "ingredients": [ + { + "item": "minecraft:wooden_sword" + }, + { + "item": "rootsclassic:verdant_sprig" + }, + { + "item": "minecraft:gold_nugget" + } + ], + "incenses": [ + { + "item": "rootsclassic:oak_bark" + }, + { + "item": "rootsclassic:oak_bark" + } + ], + "result": { + "item": "rootsclassic:living_sword" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/repulsor_standing_stone.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/repulsor_standing_stone.json new file mode 100644 index 00000000..763bf10d --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/repulsor_standing_stone.json @@ -0,0 +1,34 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#006949", + "ingredients": [ + { + "item": "rootsclassic:attuned_standing_stone" + }, + { + "item": "minecraft:glowstone_dust" + }, + { + "item": "minecraft:chiseled_stone_bricks" + } + ], + "incenses": [ + { + "item": "rootsclassic:verdant_sprig" + }, + { + "item": "rootsclassic:infernal_bulb" + }, + { + "item": "minecraft:wheat" + }, + { + "item": "rootsclassic:spruce_bark" + } + ], + "result": { + "item": "rootsclassic:repulsor_standing_stone" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/runic_focus.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/runic_focus.json new file mode 100644 index 00000000..75f8462a --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/runic_focus.json @@ -0,0 +1,34 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#00f26d", + "ingredients": [ + { + "item": "rootsclassic:verdant_sprig" + }, + { + "item": "minecraft:diamond" + }, + { + "item": "minecraft:stone" + } + ], + "incenses": [ + { + "item": "rootsclassic:oak_bark" + }, + { + "item": "rootsclassic:spruce_bark" + }, + { + "item": "rootsclassic:acacia_bark" + }, + { + "item": "rootsclassic:jungle_bark" + } + ], + "result": { + "item": "rootsclassic:runic_focus" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/sylvan_boots.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/sylvan_boots.json new file mode 100644 index 00000000..41ae85db --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/sylvan_boots.json @@ -0,0 +1,34 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#3e8a3e", + "ingredients": [ + { + "item": "minecraft:diamond" + }, + { + "item": "minecraft:leather_boots" + }, + { + "item": "minecraft:vine" + } + ], + "incenses": [ + { + "item": "rootsclassic:birch_bark" + }, + { + "item": "rootsclassic:birch_bark" + }, + { + "item": "minecraft:golden_apple" + }, + { + "item": "minecraft:poppy" + } + ], + "result": { + "item": "rootsclassic:sylvan_boots" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/sylvan_hood.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/sylvan_hood.json new file mode 100644 index 00000000..a9dbd58a --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/sylvan_hood.json @@ -0,0 +1,34 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#3e8a3e", + "ingredients": [ + { + "item": "minecraft:diamond" + }, + { + "item": "minecraft:leather_helmet" + }, + { + "item": "minecraft:vine" + } + ], + "incenses": [ + { + "item": "rootsclassic:birch_bark" + }, + { + "item": "rootsclassic:birch_bark" + }, + { + "item": "minecraft:golden_apple" + }, + { + "item": "minecraft:poppy" + } + ], + "result": { + "item": "rootsclassic:sylvan_hood" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/sylvan_robe.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/sylvan_robe.json new file mode 100644 index 00000000..e142cd08 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/sylvan_robe.json @@ -0,0 +1,34 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#3e8a3e", + "ingredients": [ + { + "item": "minecraft:diamond" + }, + { + "item": "minecraft:leather_chestplate" + }, + { + "item": "minecraft:vine" + } + ], + "incenses": [ + { + "item": "rootsclassic:birch_bark" + }, + { + "item": "rootsclassic:birch_bark" + }, + { + "item": "minecraft:golden_apple" + }, + { + "item": "minecraft:poppy" + } + ], + "result": { + "item": "rootsclassic:sylvan_robe" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/sylvan_tunic.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/sylvan_tunic.json new file mode 100644 index 00000000..c6c7678a --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/sylvan_tunic.json @@ -0,0 +1,34 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#3e8a3e", + "ingredients": [ + { + "item": "minecraft:diamond" + }, + { + "item": "minecraft:leather_leggings" + }, + { + "item": "minecraft:vine" + } + ], + "incenses": [ + { + "item": "rootsclassic:birch_bark" + }, + { + "item": "rootsclassic:birch_bark" + }, + { + "item": "minecraft:golden_apple" + }, + { + "item": "minecraft:poppy" + } + ], + "result": { + "item": "rootsclassic:sylvan_tunic" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/vacuum_standing_stone.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/vacuum_standing_stone.json new file mode 100644 index 00000000..e01ac459 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/vacuum_standing_stone.json @@ -0,0 +1,34 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#006949", + "ingredients": [ + { + "item": "rootsclassic:attuned_standing_stone" + }, + { + "item": "minecraft:glowstone_dust" + }, + { + "item": "minecraft:nether_bricks" + } + ], + "incenses": [ + { + "item": "rootsclassic:verdant_sprig" + }, + { + "item": "rootsclassic:infernal_bulb" + }, + { + "item": "minecraft:wheat" + }, + { + "item": "rootsclassic:dark_oak_bark" + } + ], + "result": { + "item": "rootsclassic:vacuum_standing_stone" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/wildwood_boots.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/wildwood_boots.json new file mode 100644 index 00000000..e0a4b116 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/wildwood_boots.json @@ -0,0 +1,34 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#917341", + "ingredients": [ + { + "item": "minecraft:diamond" + }, + { + "item": "minecraft:iron_boots" + }, + { + "item": "minecraft:oak_planks" + } + ], + "incenses": [ + { + "item": "rootsclassic:oak_bark" + }, + { + "item": "rootsclassic:oak_bark" + }, + { + "item": "minecraft:wheat" + }, + { + "item": "minecraft:oak_sapling" + } + ], + "result": { + "item": "rootsclassic:wildwood_boots" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/wildwood_leggings.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/wildwood_leggings.json new file mode 100644 index 00000000..86d5d1b0 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/wildwood_leggings.json @@ -0,0 +1,34 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#917341", + "ingredients": [ + { + "item": "minecraft:diamond" + }, + { + "item": "minecraft:iron_leggings" + }, + { + "item": "minecraft:oak_planks" + } + ], + "incenses": [ + { + "item": "rootsclassic:oak_bark" + }, + { + "item": "rootsclassic:oak_bark" + }, + { + "item": "minecraft:wheat" + }, + { + "item": "minecraft:oak_sapling" + } + ], + "result": { + "item": "rootsclassic:wildwood_leggings" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/wildwood_mask.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/wildwood_mask.json new file mode 100644 index 00000000..c4d12538 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/wildwood_mask.json @@ -0,0 +1,34 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#917341", + "ingredients": [ + { + "item": "minecraft:diamond" + }, + { + "item": "minecraft:iron_helmet" + }, + { + "item": "minecraft:oak_planks" + } + ], + "incenses": [ + { + "item": "rootsclassic:oak_bark" + }, + { + "item": "rootsclassic:oak_bark" + }, + { + "item": "minecraft:wheat" + }, + { + "item": "minecraft:oak_sapling" + } + ], + "result": { + "item": "rootsclassic:wildwood_mask" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/crafting/wildwood_plate.json b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/wildwood_plate.json new file mode 100644 index 00000000..4ed3b608 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/crafting/wildwood_plate.json @@ -0,0 +1,34 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:crafting", + "level": 2, + "color": "#917341", + "ingredients": [ + { + "item": "minecraft:diamond" + }, + { + "item": "minecraft:iron_chestplate" + }, + { + "item": "minecraft:oak_planks" + } + ], + "incenses": [ + { + "item": "rootsclassic:oak_bark" + }, + { + "item": "rootsclassic:oak_bark" + }, + { + "item": "minecraft:wheat" + }, + { + "item": "minecraft:oak_sapling" + } + ], + "result": { + "item": "rootsclassic:wildwood_plate" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/engraved_blade.json b/src/main/resources/data/rootsclassic/recipes/ritual/engraved_blade.json new file mode 100644 index 00000000..dcea8a34 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/engraved_blade.json @@ -0,0 +1,28 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:engraved_crafting", + "level": 2, + "color": "#686a6b", + "ingredients": [ + { + "item": "minecraft:stone_sword" + }, + { + "item": "rootsclassic:runic_focus" + }, + { + "item": "minecraft:glowstone_dust" + } + ], + "incenses": [ + { + "item": "minecraft:golden_carrot" + }, + { + "item": "minecraft:golden_apple" + } + ], + "result": { + "item": "rootsclassic:engraved_blade" + } +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/flare.json b/src/main/resources/data/rootsclassic/recipes/ritual/flare.json new file mode 100644 index 00000000..606c6703 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/flare.json @@ -0,0 +1,25 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:flare", + "level": 1, + "color": "#ff5b19", + "ingredients": [ + { + "item": "minecraft:flint" + }, + { + "item": "minecraft:coal" + }, + { + "item": "minecraft:charcoal" + } + ], + "incenses": [ + { + "item": "minecraft:gunpowder" + }, + { + "item": "rootsclassic:infernal_bulb" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/grow.json b/src/main/resources/data/rootsclassic/recipes/ritual/grow.json new file mode 100644 index 00000000..4c5905cd --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/grow.json @@ -0,0 +1,31 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:grow", + "level": 0, + "color": "#52d42f", + "ingredients": [ + { + "item": "minecraft:redstone" + }, + { + "item": "minecraft:bone_meal" + }, + { + "item": "rootsclassic:verdant_sprig" + } + ], + "incenses": [ + { + "item": "minecraft:wheat" + }, + { + "item": "minecraft:beetroot" + }, + { + "item": "minecraft:potato" + }, + { + "item": "minecraft:carrot" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/imbuer.json b/src/main/resources/data/rootsclassic/recipes/ritual/imbuer.json new file mode 100644 index 00000000..62060c94 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/imbuer.json @@ -0,0 +1,15 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:imbuer", + "level": 1, + "color": "#ffffff", + "ingredients": [ + { + "item": "rootsclassic:crystal_staff" + }, + { + "item": "rootsclassic:verdant_sprig" + } + ], + "incenses": [] +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/life_drain.json b/src/main/resources/data/rootsclassic/recipes/ritual/life_drain.json new file mode 100644 index 00000000..8cfb9e60 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/life_drain.json @@ -0,0 +1,28 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:life_drain", + "level": 0, + "color": "#8b1628", + "ingredients": [ + { + "item": "minecraft:blaze_powder" + }, + { + "item": "minecraft:bone" + } + ], + "incenses": [ + { + "item": "minecraft:wooden_sword" + }, + { + "item": "minecraft:wooden_axe" + }, + { + "item": "rootsclassic:dark_oak_bark" + }, + { + "item": "rootsclassic:birch_bark" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/mass_breeding.json b/src/main/resources/data/rootsclassic/recipes/ritual/mass_breeding.json new file mode 100644 index 00000000..3d316969 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/mass_breeding.json @@ -0,0 +1,28 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:mass_breeding", + "level": 2, + "color": "#943d51", + "ingredients": [ + { + "item": "minecraft:glowstone_dust" + }, + { + "item": "minecraft:bone" + } + ], + "incenses": [ + { + "item": "minecraft:carrot" + }, + { + "item": "minecraft:wheat" + }, + { + "item": "minecraft:wheat_seeds" + }, + { + "item": "minecraft:cod" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/sacrifice.json b/src/main/resources/data/rootsclassic/recipes/ritual/sacrifice.json new file mode 100644 index 00000000..42407f3a --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/sacrifice.json @@ -0,0 +1,25 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:sacrifice", + "level": 2, + "color": "#5e0938", + "ingredients": [ + { + "item": "minecraft:flint" + }, + { + "item": "minecraft:iron_sword" + }, + { + "item": "minecraft:bone" + } + ], + "incenses": [ + { + "item": "minecraft:blaze_powder" + }, + { + "item": "rootsclassic:dark_oak_bark" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/summoning/cave_spider.json b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/cave_spider.json new file mode 100644 index 00000000..9b2fcafc --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/cave_spider.json @@ -0,0 +1,26 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:summoning", + "level": 2, + "color": "#3a0254", + "ingredients": [ + { + "item": "minecraft:string" + }, + { + "item": "minecraft:fermented_spider_eye" + }, + { + "item": "minecraft:bone" + } + ], + "incenses": [ + { + "item": "minecraft:coal" + }, + { + "item": "minecraft:nether_wart" + } + ], + "entity": "minecraft:cave_spider" +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/summoning/chicken.json b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/chicken.json new file mode 100644 index 00000000..e13b16b5 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/chicken.json @@ -0,0 +1,26 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:summoning", + "level": 1, + "color": "#c769c1", + "ingredients": [ + { + "item": "minecraft:chicken" + }, + { + "item": "minecraft:feather" + }, + { + "item": "minecraft:bone" + } + ], + "incenses": [ + { + "item": "minecraft:wheat_seeds" + }, + { + "item": "minecraft:nether_wart" + } + ], + "entity": "minecraft:chicken" +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/summoning/cow.json b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/cow.json new file mode 100644 index 00000000..7906a404 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/cow.json @@ -0,0 +1,26 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:summoning", + "level": 1, + "color": "#c769c1", + "ingredients": [ + { + "item": "minecraft:beef" + }, + { + "item": "minecraft:leather" + }, + { + "item": "minecraft:bone" + } + ], + "incenses": [ + { + "item": "minecraft:wheat_seeds" + }, + { + "item": "minecraft:nether_wart" + } + ], + "entity": "minecraft:cow" +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/summoning/creeper.json b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/creeper.json new file mode 100644 index 00000000..541f0812 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/creeper.json @@ -0,0 +1,26 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:summoning", + "level": 2, + "color": "#3a0254", + "ingredients": [ + { + "item": "minecraft:gunpowder" + }, + { + "item": "minecraft:gunpowder" + }, + { + "item": "minecraft:bone" + } + ], + "incenses": [ + { + "item": "minecraft:coal" + }, + { + "item": "minecraft:nether_wart" + } + ], + "entity": "minecraft:creeper" +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/summoning/enderman.json b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/enderman.json new file mode 100644 index 00000000..2e9afa9a --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/enderman.json @@ -0,0 +1,26 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:summoning", + "level": 2, + "color": "#3a0254", + "ingredients": [ + { + "item": "minecraft:ender_pearl" + }, + { + "item": "minecraft:ender_pearl" + }, + { + "item": "minecraft:bone" + } + ], + "incenses": [ + { + "item": "minecraft:coal" + }, + { + "item": "minecraft:nether_wart" + } + ], + "entity": "minecraft:enderman" +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/summoning/pig.json b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/pig.json new file mode 100644 index 00000000..d9ecc54c --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/pig.json @@ -0,0 +1,26 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:summoning", + "level": 1, + "color": "#c769c1", + "ingredients": [ + { + "item": "minecraft:porkchop" + }, + { + "item": "minecraft:porkchop" + }, + { + "item": "minecraft:bone" + } + ], + "incenses": [ + { + "item": "minecraft:wheat_seeds" + }, + { + "item": "minecraft:nether_wart" + } + ], + "entity": "minecraft:pig" +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/summoning/rabbit.json b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/rabbit.json new file mode 100644 index 00000000..9152358a --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/rabbit.json @@ -0,0 +1,26 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:summoning", + "level": 1, + "color": "#c769c1", + "ingredients": [ + { + "item": "minecraft:rabbit" + }, + { + "item": "minecraft:rabbit_hide" + }, + { + "item": "minecraft:bone" + } + ], + "incenses": [ + { + "item": "minecraft:wheat_seeds" + }, + { + "item": "minecraft:nether_wart" + } + ], + "entity": "minecraft:rabbit" +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/summoning/sheep.json b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/sheep.json new file mode 100644 index 00000000..ce4d9407 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/sheep.json @@ -0,0 +1,26 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:summoning", + "level": 1, + "color": "#c769c1", + "ingredients": [ + { + "item": "minecraft:mutton" + }, + { + "tag": "minecraft:wool" + }, + { + "item": "minecraft:bone" + } + ], + "incenses": [ + { + "item": "minecraft:wheat_seeds" + }, + { + "item": "minecraft:nether_wart" + } + ], + "entity": "minecraft:sheep" +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/summoning/skeleton.json b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/skeleton.json new file mode 100644 index 00000000..a9ed7f67 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/skeleton.json @@ -0,0 +1,26 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:summoning", + "level": 2, + "color": "#3a0254", + "ingredients": [ + { + "item": "minecraft:arrow" + }, + { + "item": "minecraft:bone" + }, + { + "item": "minecraft:bone" + } + ], + "incenses": [ + { + "item": "minecraft:coal" + }, + { + "item": "minecraft:nether_wart" + } + ], + "entity": "minecraft:skeleton" +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/summoning/slime.json b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/slime.json new file mode 100644 index 00000000..33148999 --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/slime.json @@ -0,0 +1,26 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:summoning", + "level": 2, + "color": "#3a0254", + "ingredients": [ + { + "item": "minecraft:slime_ball" + }, + { + "item": "minecraft:slime_ball" + }, + { + "item": "minecraft:slime_ball" + } + ], + "incenses": [ + { + "item": "minecraft:coal" + }, + { + "item": "minecraft:nether_wart" + } + ], + "entity": "minecraft:slime" +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/summoning/spider.json b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/spider.json new file mode 100644 index 00000000..ddd5cf7c --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/spider.json @@ -0,0 +1,26 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:summoning", + "level": 2, + "color": "#3a0254", + "ingredients": [ + { + "item": "minecraft:string" + }, + { + "item": "minecraft:spider_eye" + }, + { + "item": "minecraft:bone" + } + ], + "incenses": [ + { + "item": "minecraft:coal" + }, + { + "item": "minecraft:nether_wart" + } + ], + "entity": "minecraft:spider" +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/summoning/zombie.json b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/zombie.json new file mode 100644 index 00000000..721f89bd --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/summoning/zombie.json @@ -0,0 +1,26 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:summoning", + "level": 2, + "color": "#3a0254", + "ingredients": [ + { + "item": "minecraft:rotten_flesh" + }, + { + "item": "minecraft:rotten_flesh" + }, + { + "item": "minecraft:bone" + } + ], + "incenses": [ + { + "item": "minecraft:coal" + }, + { + "item": "minecraft:nether_wart" + } + ], + "entity": "minecraft:zombie" +} \ No newline at end of file diff --git a/src/main/resources/data/rootsclassic/recipes/ritual/time_shift.json b/src/main/resources/data/rootsclassic/recipes/ritual/time_shift.json new file mode 100644 index 00000000..3557177d --- /dev/null +++ b/src/main/resources/data/rootsclassic/recipes/ritual/time_shift.json @@ -0,0 +1,20 @@ +{ + "type": "rootsclassic:ritual", + "effect": "rootsclassic:time_shift", + "level": 1, + "color": "#f0f563", + "secondaryColor": "#fca223", + "ingredients": [ + { + "item": "minecraft:clock" + }, + { + "item": "minecraft:iron_ingot" + } + ], + "incenses": [ + { + "item": "minecraft:clock" + } + ] +} \ No newline at end of file