Skip to content

Commit

Permalink
Add more info about Statues to JEI [build] [publish]
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrbysco committed Jun 25, 2023
1 parent f2889e3 commit 62fb91f
Show file tree
Hide file tree
Showing 13 changed files with 104 additions and 5 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* Initial update to 1.20
* Add more info to JEI about Statue Upgrading
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions src/generated/resources/assets/statues/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
47 changes: 47 additions & 0 deletions src/main/java/com/shynieke/statues/compat/jei/JEIPlugin.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
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;
import mezz.jei.api.recipe.category.IRecipeCategory;
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
Expand Down Expand Up @@ -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<StatueBlockItem> 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")
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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:");
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/shynieke/statues/items/StatueBlockItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down

0 comments on commit 62fb91f

Please sign in to comment.