From 62fb91ff5656fc6b567694990f033c26b814bf9f Mon Sep 17 00:00:00 2001 From: Mrbysco Date: Sun, 25 Jun 2023 21:22:37 +0200 Subject: [PATCH] Add more info about Statues to JEI [build] [publish] --- changelog.md | 2 +- gradle.properties | 2 +- .../c622617f6fabf890a00b9275cd5f643584a8a2c8 | 4 +- .../resources/assets/statues/lang/en_us.json | 11 +++++ .../blocks/decorative/AzzaroStatueBlock.java | 5 ++ .../blocks/decorative/BumboStatueBlock.java | 5 ++ .../charity/EagleRayStatueBlock.java | 5 ++ .../charity/SlabFishStatueBlock.java | 5 ++ .../charity/TropiBeeStatueBlock.java | 5 ++ .../statues/compat/jei/JEIPlugin.java | 47 +++++++++++++++++++ .../client/StatueLanguageProvider.java | 12 +++++ .../statues/items/StatueBlockItem.java | 4 ++ .../block/pillager_sitting_banner_statue.json | 2 +- 13 files changed, 104 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 8ec62714..169a4e33 100644 --- a/changelog.md +++ b/changelog.md @@ -1 +1 @@ -* Initial update to 1.20 \ No newline at end of file +* Add more info to JEI about Statue Upgrading \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 566c3ffa..bc3fc88f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ curseforge_id=253172 modrinth_id=hsCeX7k7 # Version -version=0.3.6 +version=0.3.6.1 # Dependencies jei_version=15.0.0.12 diff --git a/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 b/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 index e62f209a..af19c184 100644 --- a/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 +++ b/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 @@ -1,2 +1,2 @@ -// 1.20.1 2023-06-15T20:40:21.1770633 Languages: en_us -18a72ff3d2361d8ce19fdac1eb093ebf71c537e0 assets/statues/lang/en_us.json +// 1.20.1 2023-06-25T21:17:47.6031549 Languages: en_us +ef16b0f7b08bc64e3e771534bc4f9478d1b3f1ea assets/statues/lang/en_us.json diff --git a/src/generated/resources/assets/statues/lang/en_us.json b/src/generated/resources/assets/statues/lang/en_us.json index 6588d404..fb203c42 100644 --- a/src/generated/resources/assets/statues/lang/en_us.json +++ b/src/generated/resources/assets/statues/lang/en_us.json @@ -162,6 +162,17 @@ "statues.cup.info": "I can't believe its edible.", "statues.gui.jei.category.loot": "Statue Loot", "statues.gui.jei.category.upgrade": "Statue Upgrade", + "statues.gui.jei.statue.info": "%s can be obtained as a %s drop chance from killing %s", + "statues.gui.jei.statue_core.info": "%s can be obtained by killing %s", + "statues.gui.jei.statue_core.info2": "The %s just like the vanilla one can be found in dark areas but be careful!", + "statues.gui.jei.statue_table.info": "The Statue Upgrading System allows players to upgrade and level up their mob statues. This entry will provide an overview of how the system works and what upgrades are available.", + "statues.gui.jei.statue_table.info2": "To start upgrading a statue, players first need to obtain a statue of the desired mob.", + "statues.gui.jei.statue_table.info3": "Once the player has obtained a Statue and a Statue Core, they need to craft a §c§lS.T.A.T.U.E§r (\"Statue Table for Applying Tiered Upgrade Enhancements\") and insert the Statue Core and desired statue. After pressing the \"Chisel\" button, the statue will be upgraded to a state in which it can level up.", + "statues.gui.jei.statue_table.info4": "After upgrading the statue, players can level it up by killing 10 more of the corresponding mob while the statue is in their inventory. Every 10 mobs will unlock an upgrade slot up to a max of 16.", + "statues.gui.jei.statue_table.info5": "There are several different upgrades available for the statues:", + "statues.gui.jei.statue_table.info6": "§lGlowing§r - Allows the statue to emit light\n§lUnglowing§r - Removes previously applied glowing\n§lSpawner§r - Allows the statue to spawn it's mob every so often\n§lDespawner§r - Disallows it's mob from spawning in the nearby area", + "statues.gui.jei.statue_table.info7": "§lMob Killer§r - Kills the mob if it gets nearby (1 = Regular drops, 2 = Player drops, 3 = Player drops + XP)\n§lLooting§r - Allows the statue to generate loot\n§lAutomation§r - Allows exporting of loot\n§lSpeed§r - Speeds up the interaction/spawning timer", + "statues.gui.jei.statue_table.info8": "§lInteraction§r - Allows special interactions\n§lSound§r - Allows the statue to make sound when right-clicked or powered", "statues.info.kills": "Kills:", "statues.info.level": "Level:", "statues.info.upgrade_slots": "Upgrade Slots:", diff --git a/src/main/java/com/shynieke/statues/blocks/decorative/AzzaroStatueBlock.java b/src/main/java/com/shynieke/statues/blocks/decorative/AzzaroStatueBlock.java index 7396f06b..12f18e1b 100644 --- a/src/main/java/com/shynieke/statues/blocks/decorative/AzzaroStatueBlock.java +++ b/src/main/java/com/shynieke/statues/blocks/decorative/AzzaroStatueBlock.java @@ -25,6 +25,11 @@ public AzzaroStatueBlock(Properties properties) { super(properties.sound(SoundType.STONE)); } + @Override + public boolean isHiddenStatue() { + return true; + } + @Override public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return SHAPE; diff --git a/src/main/java/com/shynieke/statues/blocks/decorative/BumboStatueBlock.java b/src/main/java/com/shynieke/statues/blocks/decorative/BumboStatueBlock.java index fa44f314..7d02e12b 100644 --- a/src/main/java/com/shynieke/statues/blocks/decorative/BumboStatueBlock.java +++ b/src/main/java/com/shynieke/statues/blocks/decorative/BumboStatueBlock.java @@ -25,6 +25,11 @@ public BumboStatueBlock(Properties properties) { super(properties.sound(SoundType.STONE)); } + @Override + public boolean isHiddenStatue() { + return true; + } + @Override public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return SHAPE; diff --git a/src/main/java/com/shynieke/statues/blocks/decorative/charity/EagleRayStatueBlock.java b/src/main/java/com/shynieke/statues/blocks/decorative/charity/EagleRayStatueBlock.java index aeda1c51..d7519600 100644 --- a/src/main/java/com/shynieke/statues/blocks/decorative/charity/EagleRayStatueBlock.java +++ b/src/main/java/com/shynieke/statues/blocks/decorative/charity/EagleRayStatueBlock.java @@ -18,6 +18,11 @@ public EagleRayStatueBlock(Properties properties) { super(properties.sound(SoundType.STONE)); } + @Override + public boolean isHiddenStatue() { + return true; + } + @Override public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return SHAPE; diff --git a/src/main/java/com/shynieke/statues/blocks/decorative/charity/SlabFishStatueBlock.java b/src/main/java/com/shynieke/statues/blocks/decorative/charity/SlabFishStatueBlock.java index 4722ff5c..83d3863f 100644 --- a/src/main/java/com/shynieke/statues/blocks/decorative/charity/SlabFishStatueBlock.java +++ b/src/main/java/com/shynieke/statues/blocks/decorative/charity/SlabFishStatueBlock.java @@ -18,6 +18,11 @@ public SlabFishStatueBlock(Properties properties) { super(properties.sound(SoundType.STONE)); } + @Override + public boolean isHiddenStatue() { + return true; + } + @Override public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return SHAPE; diff --git a/src/main/java/com/shynieke/statues/blocks/decorative/charity/TropiBeeStatueBlock.java b/src/main/java/com/shynieke/statues/blocks/decorative/charity/TropiBeeStatueBlock.java index 4f0f5143..c8c3729a 100644 --- a/src/main/java/com/shynieke/statues/blocks/decorative/charity/TropiBeeStatueBlock.java +++ b/src/main/java/com/shynieke/statues/blocks/decorative/charity/TropiBeeStatueBlock.java @@ -18,6 +18,11 @@ public TropiBeeStatueBlock(Properties properties) { super(properties.sound(SoundType.STONE)); } + @Override + public boolean isHiddenStatue() { + return true; + } + @Override public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return SHAPE; diff --git a/src/main/java/com/shynieke/statues/compat/jei/JEIPlugin.java b/src/main/java/com/shynieke/statues/compat/jei/JEIPlugin.java index 43f821df..07f681fd 100644 --- a/src/main/java/com/shynieke/statues/compat/jei/JEIPlugin.java +++ b/src/main/java/com/shynieke/statues/compat/jei/JEIPlugin.java @@ -1,14 +1,19 @@ package com.shynieke.statues.compat.jei; import com.shynieke.statues.Reference; +import com.shynieke.statues.Statues; +import com.shynieke.statues.blocks.AbstractStatueBase; import com.shynieke.statues.compat.jei.category.LootCategory; import com.shynieke.statues.compat.jei.category.UpgradeCategory; +import com.shynieke.statues.config.StatuesConfig; +import com.shynieke.statues.items.StatueBlockItem; import com.shynieke.statues.recipe.LootRecipe; import com.shynieke.statues.recipe.StatuesRecipes; import com.shynieke.statues.recipe.UpgradeRecipe; import com.shynieke.statues.registry.StatueRegistry; import mezz.jei.api.IModPlugin; import mezz.jei.api.JeiPlugin; +import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.helpers.IJeiHelpers; import mezz.jei.api.recipe.RecipeType; @@ -16,12 +21,16 @@ import mezz.jei.api.registration.IRecipeCatalystRegistration; import mezz.jei.api.registration.IRecipeCategoryRegistration; import mezz.jei.api.registration.IRecipeRegistration; +import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; +import net.minecraftforge.registries.ForgeRegistries; import javax.annotation.Nullable; +import java.util.List; import java.util.Objects; @JeiPlugin @@ -67,5 +76,43 @@ public void registerRecipes(IRecipeRegistration registration) { ClientLevel clientLevel = Objects.requireNonNull(Minecraft.getInstance().level); registration.addRecipes(LOOT_TYPE, clientLevel.getRecipeManager().getAllRecipesFor(StatuesRecipes.LOOT_RECIPE.get())); registration.addRecipes(UPGRADE_TYPE, clientLevel.getRecipeManager().getAllRecipesFor(StatuesRecipes.UPGRADE_RECIPE.get())); + + List statues = StatueRegistry.ITEMS.getEntries().stream() + .filter(registryObject -> registryObject.get() instanceof StatueBlockItem statueBlock && + statueBlock.getBlock() instanceof AbstractStatueBase statueBase && !statueBase.isHiddenStatue()) + .map(registryObject -> (StatueBlockItem) registryObject.get()).toList(); + double chance = StatuesConfig.COMMON.statueDropChance.get(); + for (StatueBlockItem statue : statues) { + if (statue.getEntity() == null) { + Statues.LOGGER.error("Tried adding info to statue but statue {} has no entity linked", ForgeRegistries.ITEMS.getKey(statue)); + } else { + registration.addItemStackInfo(statue.getDefaultInstance(), + Component.translatable("statues.gui.jei.statue.info", + Component.translatable(statue.getDescriptionId()).withStyle(ChatFormatting.YELLOW).withStyle(ChatFormatting.BOLD), + Component.literal((int) (chance * 100) + "%").withStyle(ChatFormatting.DARK_GREEN).withStyle(ChatFormatting.BOLD), + Component.translatable(statue.getEntity().getDescriptionId()).withStyle(ChatFormatting.RED).withStyle(ChatFormatting.BOLD) + ) + ); + } + } + registration.addItemStackInfo(StatueRegistry.STATUE_CORE.get().getDefaultInstance(), + Component.translatable("statues.gui.jei.statue_core.info", + Component.translatable(StatueRegistry.STATUE_CORE.get().getDescriptionId()).withStyle(ChatFormatting.YELLOW).withStyle(ChatFormatting.BOLD), + Component.translatable(StatueRegistry.STATUE_BAT.get().getDescriptionId()).withStyle(ChatFormatting.RED).withStyle(ChatFormatting.BOLD) + ), + Component.translatable("statues.gui.jei.statue_core.info2", + Component.translatable(StatueRegistry.STATUE_BAT.get().getDescriptionId()).withStyle(ChatFormatting.RED).withStyle(ChatFormatting.BOLD) + ) + ); + registration.addItemStackInfo(StatueRegistry.STATUE_TABLE.get().asItem().getDefaultInstance(), + Component.translatable("statues.gui.jei.statue_table.info"), + Component.translatable("statues.gui.jei.statue_table.info2"), + Component.translatable("statues.gui.jei.statue_table.info3"), + Component.translatable("statues.gui.jei.statue_table.info4"), + Component.translatable("statues.gui.jei.statue_table.info5"), + Component.translatable("statues.gui.jei.statue_table.info6"), + Component.translatable("statues.gui.jei.statue_table.info7"), + Component.translatable("statues.gui.jei.statue_table.info8") + ); } } diff --git a/src/main/java/com/shynieke/statues/datagen/client/StatueLanguageProvider.java b/src/main/java/com/shynieke/statues/datagen/client/StatueLanguageProvider.java index 0a360523..10fb34b9 100644 --- a/src/main/java/com/shynieke/statues/datagen/client/StatueLanguageProvider.java +++ b/src/main/java/com/shynieke/statues/datagen/client/StatueLanguageProvider.java @@ -209,6 +209,18 @@ protected void addTranslations() { add("statues.gui.jei.category.loot", "Statue Loot"); add("statues.gui.jei.category.upgrade", "Statue Upgrade"); + add("statues.gui.jei.statue.info", "%s can be obtained as a %s drop chance from killing %s"); + add("statues.gui.jei.statue_core.info", "%s can be obtained by killing %s"); + add("statues.gui.jei.statue_core.info2", "The %s just like the vanilla one can be found in dark areas but be careful!"); + add("statues.gui.jei.statue_table.info", "The Statue Upgrading System allows players to upgrade and level up their mob statues. This entry will provide an overview of how the system works and what upgrades are available."); + add("statues.gui.jei.statue_table.info2", "To start upgrading a statue, players first need to obtain a statue of the desired mob."); + add("statues.gui.jei.statue_table.info3", "Once the player has obtained a Statue and a Statue Core, they need to craft a §c§lS.T.A.T.U.E§r (\"Statue Table for Applying Tiered Upgrade Enhancements\") and insert the Statue Core and desired statue. After pressing the \"Chisel\" button, the statue will be upgraded to a state in which it can level up."); + add("statues.gui.jei.statue_table.info4", "After upgrading the statue, players can level it up by killing 10 more of the corresponding mob while the statue is in their inventory. Every 10 mobs will unlock an upgrade slot up to a max of 16."); + add("statues.gui.jei.statue_table.info5", "There are several different upgrades available for the statues:"); + add("statues.gui.jei.statue_table.info6", "§lGlowing§r - Allows the statue to emit light\n§lUnglowing§r - Removes previously applied glowing\n§lSpawner§r - Allows the statue to spawn it's mob every so often\n§lDespawner§r - Disallows it's mob from spawning in the nearby area"); + add("statues.gui.jei.statue_table.info7", "§lMob Killer§r - Kills the mob if it gets nearby (1 = Regular drops, 2 = Player drops, 3 = Player drops + XP)\n§lLooting§r - Allows the statue to generate loot\n§lAutomation§r - Allows exporting of loot\n§lSpeed§r - Speeds up the interaction/spawning timer"); + add("statues.gui.jei.statue_table.info8", "§lInteraction§r - Allows special interactions\n§lSound§r - Allows the statue to make sound when right-clicked or powered"); + add("statues.info.level", "Level:"); add("statues.info.kills", "Kills:"); diff --git a/src/main/java/com/shynieke/statues/items/StatueBlockItem.java b/src/main/java/com/shynieke/statues/items/StatueBlockItem.java index 6231317c..70ed225b 100644 --- a/src/main/java/com/shynieke/statues/items/StatueBlockItem.java +++ b/src/main/java/com/shynieke/statues/items/StatueBlockItem.java @@ -40,6 +40,10 @@ public boolean isBaby() { return this.getBlock() instanceof AbstractStatueBase statueBase ? statueBase.isBaby() : false; } + public boolean isHiddenStatue() { + return this.getBlock() instanceof AbstractStatueBase statueBase ? statueBase.isHiddenStatue() : false; + } + public EntityType getEntity() { return this.getBlock() instanceof AbstractStatueBase statueBase ? statueBase.getEntity() : null; } diff --git a/src/main/resources/assets/statues/models/block/pillager_sitting_banner_statue.json b/src/main/resources/assets/statues/models/block/pillager_sitting_banner_statue.json index 9bf8683b..700a0885 100644 --- a/src/main/resources/assets/statues/models/block/pillager_sitting_banner_statue.json +++ b/src/main/resources/assets/statues/models/block/pillager_sitting_banner_statue.json @@ -2,7 +2,7 @@ "credit": "Made with Blockbench", "textures": { "0": "statues:block/pillager", - "1": "statues:block/omnious banner", + "1": "statues:block/omnious_banner", "particle": "statues:block/pillager" }, "elements": [