diff --git a/.idea/modules.xml b/.idea/modules.xml
index d9ebdec..8f29342 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -2,8 +2,8 @@
-
-
+
+
-
\ No newline at end of file
+
diff --git a/.idea/runConfigurations/client.xml b/.idea/runConfigurations/client.xml
index 8eb3e45..8c695c1 100644
--- a/.idea/runConfigurations/client.xml
+++ b/.idea/runConfigurations/client.xml
@@ -2,10 +2,10 @@
-
+
-
+
diff --git a/.idea/runConfigurations/data.xml b/.idea/runConfigurations/data.xml
index e578301..f5dc441 100644
--- a/.idea/runConfigurations/data.xml
+++ b/.idea/runConfigurations/data.xml
@@ -2,10 +2,10 @@
-
-
+
+
-
+
diff --git a/.idea/runConfigurations/server.xml b/.idea/runConfigurations/server.xml
index a8459dc..5e804ec 100644
--- a/.idea/runConfigurations/server.xml
+++ b/.idea/runConfigurations/server.xml
@@ -2,10 +2,10 @@
-
+
-
+
diff --git a/.release-info/1.19/RELEASE_HASH b/.release-info/1.19/RELEASE_HASH
index e69de29..2c7b318 100644
--- a/.release-info/1.19/RELEASE_HASH
+++ b/.release-info/1.19/RELEASE_HASH
@@ -0,0 +1 @@
+299dce87e20b11ea54d9a23528f7bc59399f2a21
diff --git a/.release-info/1.19/VERSION b/.release-info/1.19/VERSION
index 1866a36..f2722b1 100644
--- a/.release-info/1.19/VERSION
+++ b/.release-info/1.19/VERSION
@@ -1 +1 @@
-0.2.9
+0.2.12
diff --git a/CHANGELOG/1.19/0.2.9.md b/CHANGELOG/1.19/0.2.9.md
new file mode 100644
index 0000000..a41d2da
--- /dev/null
+++ b/CHANGELOG/1.19/0.2.9.md
@@ -0,0 +1,3 @@
+# 0.2.9
+
+- `[NEW]` Release for 1.19!
diff --git a/CHANGELOG/1.19/current.md b/CHANGELOG/1.19/current.md
index 2efb7c3..ff86226 100644
--- a/CHANGELOG/1.19/current.md
+++ b/CHANGELOG/1.19/current.md
@@ -1 +1 @@
-- `[NEW]` Release for 1.19!
+- `[CHG]` Release to catch up with 1.18 changes
diff --git a/README.md b/README.md
index ee625cf..29f00d3 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@
## Requirements
-* [JEI](https://www.curseforge.com/minecraft/mc-mods/jei) — version 11.8.1.1034 or higher
+* [JEI](https://www.curseforge.com/minecraft/mc-mods/jei)
## Where To Get It
diff --git a/src/main/java/com/sweetrpg/crafttracker/CraftTracker.java b/src/main/java/com/sweetrpg/crafttracker/CraftTracker.java
index b430e15..cc29e75 100644
--- a/src/main/java/com/sweetrpg/crafttracker/CraftTracker.java
+++ b/src/main/java/com/sweetrpg/crafttracker/CraftTracker.java
@@ -7,13 +7,13 @@
import com.sweetrpg.crafttracker.common.config.ConfigHandler;
import com.sweetrpg.crafttracker.common.event.EventHandler;
import com.sweetrpg.crafttracker.common.lib.Constants;
-import com.sweetrpg.crafttracker.common.registry.*;
import com.sweetrpg.crafttracker.data.CTAdvancementProvider;
import com.sweetrpg.crafttracker.data.CTLangProvider;
import net.minecraft.data.DataGenerator;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.data.event.GatherDataEvent;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.event.server.ServerStartingEvent;
import net.minecraftforge.eventbus.api.IEventBus;
@@ -22,7 +22,6 @@
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
-import net.minecraftforge.data.event.GatherDataEvent;
import net.minecraftforge.network.NetworkRegistry;
import net.minecraftforge.network.simple.SimpleChannel;
import org.apache.logging.log4j.LogManager;
@@ -50,15 +49,6 @@ public CraftTracker() {
modEventBus.addListener(CommonSetup::init);
modEventBus.addListener(this::interModProcess);
- // Registries
- ModBlocks.BLOCKS.register(modEventBus);
- ModBlockEntityTypes.TILE_ENTITIES.register(modEventBus);
- ModItems.ITEMS.register(modEventBus);
-// ModSerializers.SERIALIZERS.register(modEventBus);
- ModRecipeSerializers.RECIPE_SERIALIZERS.register(modEventBus);
-
- modEventBus.addListener(ModRegistries::newRegistry);
-
IEventBus forgeEventBus = MinecraftForge.EVENT_BUS;
forgeEventBus.addListener(this::serverStarting);
forgeEventBus.addListener(this::registerCommands);
diff --git a/src/main/java/com/sweetrpg/crafttracker/client/overlay/CraftQueueOverlay.java b/src/main/java/com/sweetrpg/crafttracker/client/overlay/CraftQueueOverlay.java
index 07bc013..912abef 100644
--- a/src/main/java/com/sweetrpg/crafttracker/client/overlay/CraftQueueOverlay.java
+++ b/src/main/java/com/sweetrpg/crafttracker/client/overlay/CraftQueueOverlay.java
@@ -62,17 +62,17 @@ public void onRenderGuiOverlay(RenderGuiOverlayEvent event) {
return;
case DYNAMIC:
- if(ConfigHandler.CLIENT.CRAFT_QUEUE_OVERLAY_HIDE_EMPTY.get() &&
+ if(ConfigHandler.CLIENT.craftQueueOverlayHideEmpty.get() &&
products.isEmpty()) {
return;
}
break;
}
- var x = ConfigHandler.CLIENT.CRAFT_QUEUE_OVERLAY_X.get();
- var y = ConfigHandler.CLIENT.CRAFT_QUEUE_OVERLAY_Y.get();
- var olWidth = Math.min((ConfigHandler.CLIENT.CRAFT_QUEUE_OVERLAY_X.get() + ConfigHandler.CLIENT.CRAFT_QUEUE_OVERLAY_WIDTH.get()), width - 10);
- var olHeight = Math.min((ConfigHandler.CLIENT.CRAFT_QUEUE_OVERLAY_Y.get() + ConfigHandler.CLIENT.CRAFT_QUEUE_OVERLAY_HEIGHT.get()), height - 10);
+ var x = ConfigHandler.CLIENT.craftQueueOverlayX.get();
+ var y = ConfigHandler.CLIENT.craftQueueOverlayY.get();
+ var olWidth = Math.min((ConfigHandler.CLIENT.craftQueueOverlayX.get() + ConfigHandler.CLIENT.craftQueueOverlayWidth.get()), width - 10);
+ var olHeight = Math.min((ConfigHandler.CLIENT.craftQueueOverlayY.get() + ConfigHandler.CLIENT.craftQueueOverlayHeight.get()), height - 10);
var backgroundColor = 0x015f5f5f; // TODO: get from config
var borderColor = 0x061f1f1f; // TODO: get from config
diff --git a/src/main/java/com/sweetrpg/crafttracker/client/overlay/ShoppingListOverlay.java b/src/main/java/com/sweetrpg/crafttracker/client/overlay/ShoppingListOverlay.java
index 4e83a22..c0cbb25 100644
--- a/src/main/java/com/sweetrpg/crafttracker/client/overlay/ShoppingListOverlay.java
+++ b/src/main/java/com/sweetrpg/crafttracker/client/overlay/ShoppingListOverlay.java
@@ -15,7 +15,6 @@
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.client.event.RenderGuiOverlayEvent;
import net.minecraftforge.client.gui.overlay.ForgeGui;
-import net.minecraftforge.client.gui.overlay.IGuiOverlay;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.registries.ForgeRegistries;
@@ -56,23 +55,23 @@ public void onRenderGuiOverlay(RenderGuiOverlayEvent event) {
return;
case DYNAMIC:
- if(ConfigHandler.CLIENT.SHOPPING_LIST_OVERLAY_HIDE_EMPTY.get() &&
+ if(ConfigHandler.CLIENT.shoppingListOverlayHideEmpty.get() &&
items.isEmpty()) {
return;
}
break;
}
- var x = ConfigHandler.CLIENT.SHOPPING_LIST_OVERLAY_X.get();
+ var x = ConfigHandler.CLIENT.shoppingListOverlayX.get();
if(x < 0) {
- x = width - (ConfigHandler.CLIENT.SHOPPING_LIST_OVERLAY_WIDTH.get() + Math.abs(x));
+ x = width - (ConfigHandler.CLIENT.shoppingListOverlayWidth.get() + Math.abs(x));
}
- var y = ConfigHandler.CLIENT.SHOPPING_LIST_OVERLAY_Y.get();
+ var y = ConfigHandler.CLIENT.shoppingListOverlayY.get();
if(x < 0) {
- y = width - (ConfigHandler.CLIENT.SHOPPING_LIST_OVERLAY_HEIGHT.get() + Math.abs(y));
+ y = width - (ConfigHandler.CLIENT.shoppingListOverlayHeight.get() + Math.abs(y));
}
- var olWidth = Math.min((x + ConfigHandler.CLIENT.SHOPPING_LIST_OVERLAY_WIDTH.get()), width - 10);
- var olHeight = Math.min((y + ConfigHandler.CLIENT.SHOPPING_LIST_OVERLAY_HEIGHT.get()), height - 10);
+ var olWidth = Math.min((x + ConfigHandler.CLIENT.shoppingListOverlayWidth.get()), width - 10);
+ var olHeight = Math.min((y + ConfigHandler.CLIENT.shoppingListOverlayHeight.get()), height - 10);
var backgroundColor = 0x5f5f5f5f; // TODO: get from config?
var borderColor = 0x1f1f1f1f; // TODO: get from config?
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/config/ConfigHandler.java b/src/main/java/com/sweetrpg/crafttracker/common/config/ConfigHandler.java
index 938e0a0..f121571 100644
--- a/src/main/java/com/sweetrpg/crafttracker/common/config/ConfigHandler.java
+++ b/src/main/java/com/sweetrpg/crafttracker/common/config/ConfigHandler.java
@@ -2,60 +2,94 @@
import com.sweetrpg.crafttracker.CraftTracker;
import com.sweetrpg.crafttracker.common.lib.Constants;
+import com.sweetrpg.crafttracker.common.lib.Costs;
+import com.sweetrpg.crafttracker.common.lib.Multipliers;
+import com.sweetrpg.crafttracker.common.manager.CraftingQueueManager;
+import net.minecraft.client.Minecraft;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.config.ModConfig;
+import net.minecraftforge.fml.event.config.ModConfigEvent;
import org.apache.commons.lang3.tuple.Pair;
+import java.util.HashMap;
+import java.util.Map;
+
public class ConfigHandler {
public static ClientConfig CLIENT;
+ public static CommonConfig COMMON;
public static ServerConfig SERVER;
- private static ForgeConfigSpec CONFIG_SERVER_SPEC;
- private static ForgeConfigSpec CONFIG_CLIENT_SPEC;
public static void init(IEventBus modEventBus) {
- Pair commonPair = new ForgeConfigSpec.Builder().configure(ServerConfig::new);
- CONFIG_SERVER_SPEC = commonPair.getRight();
- SERVER = commonPair.getLeft();
Pair clientPair = new ForgeConfigSpec.Builder().configure(ClientConfig::new);
- CONFIG_CLIENT_SPEC = clientPair.getRight();
+ ForgeConfigSpec configClientSpec = clientPair.getRight();
CLIENT = clientPair.getLeft();
+ Pair commonPair = new ForgeConfigSpec.Builder().configure(CommonConfig::new);
+ ForgeConfigSpec configCommonSpec = commonPair.getRight();
+ COMMON = commonPair.getLeft();
+ Pair serverPair = new ForgeConfigSpec.Builder().configure(ServerConfig::new);
+ ForgeConfigSpec configServerSpec = serverPair.getRight();
+ SERVER = serverPair.getLeft();
+
CraftTracker.LOGGER.debug("register configs");
+ ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, configClientSpec);
+ ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, configCommonSpec);
+ ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, configServerSpec);
+
+ modEventBus.addListener(ConfigHandler::configEventHandler);
+ }
+
+ public static void configEventHandler(ModConfigEvent event) {
+ CraftTracker.LOGGER.debug("#configEventHandler: {}", event);
- ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, CONFIG_SERVER_SPEC);
- ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, CONFIG_CLIENT_SPEC);
+ if(event instanceof ModConfigEvent.Reloading &&
+ ((event.getConfig().getType() == ModConfig.Type.CLIENT) ||
+ (event.getConfig().getType() == ModConfig.Type.COMMON)) &&
+ Minecraft.getInstance().level != null) {
+ CraftTracker.LOGGER.debug("config is reloading");
+
+ CraftingQueueManager.INSTANCE.computeAll();
+ }
}
public static class ClientConfig {
- public ForgeConfigSpec.BooleanValue CRAFT_QUEUE_OVERLAY_HIDE_EMPTY;
- public ForgeConfigSpec.IntValue CRAFT_QUEUE_OVERLAY_X;
- public ForgeConfigSpec.IntValue CRAFT_QUEUE_OVERLAY_Y;
- public ForgeConfigSpec.IntValue CRAFT_QUEUE_OVERLAY_WIDTH;
- public ForgeConfigSpec.IntValue CRAFT_QUEUE_OVERLAY_HEIGHT;
- public ForgeConfigSpec.BooleanValue SHOPPING_LIST_OVERLAY_HIDE_EMPTY;
- public ForgeConfigSpec.IntValue SHOPPING_LIST_OVERLAY_X;
- public ForgeConfigSpec.IntValue SHOPPING_LIST_OVERLAY_Y;
- public ForgeConfigSpec.IntValue SHOPPING_LIST_OVERLAY_WIDTH;
- public ForgeConfigSpec.IntValue SHOPPING_LIST_OVERLAY_HEIGHT;
+ // General
+ public ForgeConfigSpec.IntValue calculationDepth;
+
+ // Craft Queue
+ public ForgeConfigSpec.BooleanValue craftQueueOverlayHideEmpty;
+ public ForgeConfigSpec.IntValue craftQueueOverlayX;
+ public ForgeConfigSpec.IntValue craftQueueOverlayY;
+ public ForgeConfigSpec.IntValue craftQueueOverlayWidth;
+ public ForgeConfigSpec.IntValue craftQueueOverlayHeight;
+
+ // Shopping List
+ public ForgeConfigSpec.BooleanValue shoppingListOverlayHideEmpty;
+ public ForgeConfigSpec.IntValue shoppingListOverlayX;
+ public ForgeConfigSpec.IntValue shoppingListOverlayY;
+ public ForgeConfigSpec.IntValue shoppingListOverlayWidth;
+ public ForgeConfigSpec.IntValue shoppingListOverlayHeight;
public ClientConfig(ForgeConfigSpec.Builder builder) {
{
builder.push("General");
+ calculationDepth = builder.comment("Determines how far down the tree the queue calculation will go before it stops").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_CALC_DEPTH).defineInRange("calculation_depth", 3, 1, 5);
+
builder.pop();
}
{
builder.push("CraftQueue");
- CRAFT_QUEUE_OVERLAY_HIDE_EMPTY = builder.comment("Sets whether the craft queue overlay should be displayed only when it has items in it.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_CRAFT_QUEUE_HIDE_EMPTY).define("craft_queue_hide_empty", true);
- CRAFT_QUEUE_OVERLAY_X = builder.comment("Sets the X screen location for the craft queue overlay.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_CRAFT_QUEUE_X).defineInRange("craft_queue_x", 10, -1000, 10000);
- CRAFT_QUEUE_OVERLAY_Y = builder.comment("Sets the Y screen location for the craft queue overlay.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_CRAFT_QUEUE_Y).defineInRange("craft_queue_y", 60, -1000, 10000);
- CRAFT_QUEUE_OVERLAY_WIDTH = builder.comment("Sets the width of the craft queue overlay.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_CRAFT_QUEUE_WIDTH).defineInRange("craft_queue_width", 300, 100, 10000);
- CRAFT_QUEUE_OVERLAY_HEIGHT = builder.comment("Sets the height of the craft queue overlay.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_CRAFT_QUEUE_HEIGHT).defineInRange("craft_queue_height", 500, 100, 10000);
+ craftQueueOverlayHideEmpty = builder.comment("Sets whether the craft queue overlay should be displayed only when it has items in it.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_CRAFT_QUEUE_HIDE_EMPTY).define("craft_queue_hide_empty", true);
+ craftQueueOverlayX = builder.comment("Sets the X screen location for the craft queue overlay.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_CRAFT_QUEUE_X).defineInRange("craft_queue_x", 10, -1000, 10000);
+ craftQueueOverlayY = builder.comment("Sets the Y screen location for the craft queue overlay.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_CRAFT_QUEUE_Y).defineInRange("craft_queue_y", 60, -1000, 10000);
+ craftQueueOverlayWidth = builder.comment("Sets the width of the craft queue overlay.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_CRAFT_QUEUE_WIDTH).defineInRange("craft_queue_width", 300, 100, 10000);
+ craftQueueOverlayHeight = builder.comment("Sets the height of the craft queue overlay.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_CRAFT_QUEUE_HEIGHT).defineInRange("craft_queue_height", 500, 100, 10000);
builder.pop();
}
@@ -63,11 +97,61 @@ public ClientConfig(ForgeConfigSpec.Builder builder) {
{
builder.push("ShoppingList");
- SHOPPING_LIST_OVERLAY_HIDE_EMPTY = builder.comment("Sets whether the 'shopping list' overlay should be displayed only when it has items in it.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_SHOPPING_LIST_HIDE_EMPTY).define("shopping_list_hide_empty", true);
- SHOPPING_LIST_OVERLAY_X = builder.comment("Sets the X screen location for the 'shopping list' overlay.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_SHOPPING_LIST_X).defineInRange("shopping_list_x", -10, -1000, 10000);
- SHOPPING_LIST_OVERLAY_Y = builder.comment("Sets the Y screen location for the 'shopping list' overlay.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_SHOPPING_LIST_Y).defineInRange("shopping_list_y", 60, -1000, 10000);
- SHOPPING_LIST_OVERLAY_WIDTH = builder.comment("Sets the width of the 'shopping list' overlay.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_SHOPPING_LIST_WIDTH).defineInRange("shopping_list_width", 300, 100, 10000);
- SHOPPING_LIST_OVERLAY_HEIGHT = builder.comment("Sets the height of the 'shopping list' overlay.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_SHOPPING_LIST_HEIGHT).defineInRange("shopping_list_height", 500, 100, 10000);
+ shoppingListOverlayHideEmpty = builder.comment("Sets whether the 'shopping list' overlay should be displayed only when it has items in it.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_SHOPPING_LIST_HIDE_EMPTY).define("shopping_list_hide_empty", true);
+ shoppingListOverlayX = builder.comment("Sets the X screen location for the 'shopping list' overlay.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_SHOPPING_LIST_X).defineInRange("shopping_list_x", -10, -1000, 10000);
+ shoppingListOverlayY = builder.comment("Sets the Y screen location for the 'shopping list' overlay.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_SHOPPING_LIST_Y).defineInRange("shopping_list_y", 60, -1000, 10000);
+ shoppingListOverlayWidth = builder.comment("Sets the width of the 'shopping list' overlay.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_SHOPPING_LIST_WIDTH).defineInRange("shopping_list_width", 300, 100, 10000);
+ shoppingListOverlayHeight = builder.comment("Sets the height of the 'shopping list' overlay.").translation(Constants.TRANSLATION_KEY_CONFIG_CLIENT_SHOPPING_LIST_HEIGHT).defineInRange("shopping_list_height", 500, 100, 10000);
+
+ builder.pop();
+ }
+ }
+ }
+
+ public static class CommonConfig {
+
+ public Map tagEntries = new HashMap<>();
+ public Map overrideEntries = new HashMap<>();
+ public Map namespaceEntries = new HashMap<>();
+ public Map recipeTypeEntries = new HashMap<>();
+
+ public CommonConfig(ForgeConfigSpec.Builder builder) {
+ {
+ builder.push("Costs By Tag");
+
+ Costs.tags.forEach((k, v) -> {
+ tagEntries.put(k, builder.comment("A tag and corresponding cost").defineInRange(k, v, 1, 10000));
+ });
+
+ builder.pop();
+ }
+
+ {
+ builder.push("Cost Overrides");
+
+ Costs.itemOverrides.forEach((k, v) -> {
+ overrideEntries.put(k, builder.comment("An item and corresponding cost override").defineInRange(k, v, 1, 10000));
+ });
+
+ builder.pop();
+ }
+
+ {
+ builder.push("Namespace Multipliers");
+
+ Multipliers.namespaces.forEach((k, v) -> {
+ namespaceEntries.put(k, builder.comment("A namespace and the multiplier associated with it").defineInRange(k, v, 0.1f, 100f));
+ });
+
+ builder.pop();
+ }
+
+ {
+ builder.push("Recipe Type Multipliers");
+
+ Multipliers.recipeTypes.forEach((k, v) -> {
+ recipeTypeEntries.put(k, builder.comment("A recipe type and the multiplier associated with it").defineInRange(k, v, 0.1f, 100f));
+ });
builder.pop();
}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/event/EventHandler.java b/src/main/java/com/sweetrpg/crafttracker/common/event/EventHandler.java
index 7be35c1..b019b62 100644
--- a/src/main/java/com/sweetrpg/crafttracker/common/event/EventHandler.java
+++ b/src/main/java/com/sweetrpg/crafttracker/common/event/EventHandler.java
@@ -12,7 +12,6 @@
import net.minecraftforge.event.entity.player.PlayerEvent.ItemCraftedEvent;
import net.minecraftforge.event.entity.player.PlayerEvent.ItemPickupEvent;
import net.minecraftforge.event.entity.player.PlayerEvent.ItemSmeltedEvent;
-import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedInEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.common.Mod;
@@ -23,18 +22,6 @@
@Mod.EventBusSubscriber(modid = Constants.MOD_ID)
public class EventHandler {
-// @SubscribeEvent
-// public void onEntitySpawn(final EntityJoinWorldEvent event) {
-// CraftTracker.LOGGER.trace("EventHandler#onEntitySpawn: {}", event);
-//
-// }
-
- @SubscribeEvent
- public void playerLoggedIn(final PlayerLoggedInEvent event) {
- CraftTracker.LOGGER.debug("EventHandler#playerLoggedIn: {}", event);
-
- }
-
@SubscribeEvent
public void onItemCrafted(final ItemCraftedEvent event) {
CraftTracker.LOGGER.debug("EventHandler#onItemCrafted: {}", event);
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/lib/Constants.java b/src/main/java/com/sweetrpg/crafttracker/common/lib/Constants.java
index 841589b..c7e5a0b 100644
--- a/src/main/java/com/sweetrpg/crafttracker/common/lib/Constants.java
+++ b/src/main/java/com/sweetrpg/crafttracker/common/lib/Constants.java
@@ -56,6 +56,8 @@ public class Constants {
public static final String TRANSLATION_KEY_GUI_MSG_SLIST_OVERLAY_MODE_SHOW = "crafttracker.msg.shopping_list_overlay_mode.show";
public static final String TRANSLATION_KEY_GUI_MSG_SLIST_OVERLAY_MODE_DYNAMIC = "crafttracker.msg.shopping_list_overlay_mode.dynamic";
+ // Config
+ public static final String TRANSLATION_KEY_CONFIG_CLIENT_CALC_DEPTH = "crafttracker.config.client.calculation_depth";
public static final String TRANSLATION_KEY_CONFIG_CLIENT_CRAFT_QUEUE_X = "crafttracker.config.client.craft_queue_x";
public static final String TRANSLATION_KEY_CONFIG_CLIENT_CRAFT_QUEUE_Y = "crafttracker.config.client.craft_queue_y";
public static final String TRANSLATION_KEY_CONFIG_CLIENT_CRAFT_QUEUE_WIDTH = "crafttracker.config.client.craft_queue_width";
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/lib/Costs.java b/src/main/java/com/sweetrpg/crafttracker/common/lib/Costs.java
new file mode 100644
index 0000000..7c3316f
--- /dev/null
+++ b/src/main/java/com/sweetrpg/crafttracker/common/lib/Costs.java
@@ -0,0 +1,1085 @@
+package com.sweetrpg.crafttracker.common.lib;
+
+import java.util.Map;
+
+import static java.util.Map.entry;
+
+public class Costs {
+
+ public static final Map tags = Map.ofEntries(
+ entry("c:animal_foods", 10),
+ entry("c:armors", 10),
+ entry("c:barrels/wooden", 10),
+ entry("c:barrels", 10),
+ entry("c:bookshelves", 10),
+ entry("c:bricks/nether", 10),
+ entry("c:bricks/normal", 10),
+ entry("c:bricks", 10),
+ entry("c:buckets/empty", 10),
+ entry("c:buckets/entity_water", 10),
+ entry("c:buckets/lava", 10),
+ entry("c:buckets/milk", 10),
+ entry("c:buckets/powder_snow", 10),
+ entry("c:buckets/water", 10),
+ entry("c:buckets", 10),
+ entry("c:budding_blocks", 10),
+ entry("c:buds", 10),
+ entry("c:chains", 10),
+ entry("c:chests/wooden", 10),
+ entry("c:chests", 10),
+ entry("c:clusters", 10),
+ entry("c:cobblestones", 10),
+ entry("c:concrete_powders", 10),
+ entry("c:concretes", 10),
+ entry("c:crops/beetroot", 10),
+ entry("c:crops/cactus", 10),
+ entry("c:crops/carrot", 10),
+ entry("c:crops/cocoa_bean", 10),
+ entry("c:crops/melon", 10),
+ entry("c:crops/nether_wart", 10),
+ entry("c:crops/potato", 10),
+ entry("c:crops/pumpkin", 10),
+ entry("c:crops/sugar_cane", 10),
+ entry("c:crops/wheat", 10),
+ entry("c:crops", 10),
+ entry("c:dusts/glowstone", 10),
+ entry("c:dusts/redstone", 10),
+ entry("c:dusts", 10),
+ entry("c:dyed/black", 10),
+ entry("c:dyed/blue", 10),
+ entry("c:dyed/brown", 10),
+ entry("c:dyed/cyan", 10),
+ entry("c:dyed/gray", 10),
+ entry("c:dyed/green", 10),
+ entry("c:dyed/light_blue", 10),
+ entry("c:dyed/light_gray", 10),
+ entry("c:dyed/lime", 10),
+ entry("c:dyed/magenta", 10),
+ entry("c:dyed/orange", 10),
+ entry("c:dyed/pink", 10),
+ entry("c:dyed/purple", 10),
+ entry("c:dyed/red", 10),
+ entry("c:dyed/white", 10),
+ entry("c:dyed/yellow", 10),
+ entry("c:dyed", 10),
+ entry("c:dyes/black", 10),
+ entry("c:dyes/blue", 10),
+ entry("c:dyes/brown", 10),
+ entry("c:dyes/cyan", 10),
+ entry("c:dyes/gray", 10),
+ entry("c:dyes/green", 10),
+ entry("c:dyes/light_blue", 10),
+ entry("c:dyes/light_gray", 10),
+ entry("c:dyes/lime", 10),
+ entry("c:dyes/magenta", 10),
+ entry("c:dyes/orange", 10),
+ entry("c:dyes/pink", 10),
+ entry("c:dyes/purple", 10),
+ entry("c:dyes/red", 10),
+ entry("c:dyes/white", 10),
+ entry("c:dyes/yellow", 10),
+ entry("c:dyes", 10),
+ entry("c:enchantables", 10),
+ entry("c:ender_pearls", 10),
+ entry("c:fertilizers", 10),
+ entry("c:foods/berry", 10),
+ entry("c:foods/bread", 10),
+ entry("c:foods/candy", 10),
+ entry("c:foods/cooked_fish", 10),
+ entry("c:foods/cooked_meat", 10),
+ entry("c:foods/cookie", 10),
+ entry("c:foods/edible_when_placed", 10),
+ entry("c:foods/food_poisoning", 10),
+ entry("c:foods/fruit", 10),
+ entry("c:foods/golden", 10),
+ entry("c:foods/raw_fish", 10),
+ entry("c:foods/raw_meat", 10),
+ entry("c:foods/soup", 10),
+ entry("c:foods/vegetable", 10),
+ entry("c:foods", 10),
+ entry("c:gems/amethyst", 10),
+ entry("c:gems/diamond", 10),
+ entry("c:gems/emerald", 10),
+ entry("c:gems/lapis", 10),
+ entry("c:gems/prismarine", 10),
+ entry("c:gems/quartz", 10),
+ entry("c:gems", 10),
+ entry("c:glass_blocks/cheap", 10),
+ entry("c:glass_blocks/colorless", 10),
+ entry("c:glass_blocks/tinted", 10),
+ entry("c:glass_blocks", 10),
+ entry("c:glass_panes/colorless", 10),
+ entry("c:glass_panes", 10),
+ entry("c:glazed_terracottas", 10),
+ entry("c:hidden_from_recipe_viewers", 10),
+ entry("c:ingots/copper", 10),
+ entry("c:ingots/gold", 10),
+ entry("c:ingots/iron", 10),
+ entry("c:ingots/netherite", 10),
+ entry("c:ingots", 10),
+ entry("c:leathers", 10),
+ entry("c:music_discs", 10),
+ entry("c:nuggets/gold", 10),
+ entry("c:nuggets/iron", 10),
+ entry("c:nuggets", 10),
+ entry("c:obsidians/crying", 10),
+ entry("c:obsidians/normal", 10),
+ entry("c:obsidians", 10),
+ entry("c:ores/netherite_scrap", 10),
+ entry("c:ores/quartz", 10),
+ entry("c:ores", 10),
+ entry("c:player_workstations/crafting_tables", 10),
+ entry("c:player_workstations/furnaces", 10),
+ entry("c:raw_materials/copper", 10),
+ entry("c:raw_materials/gold", 10),
+ entry("c:raw_materials/iron", 10),
+ entry("c:raw_materials", 10),
+ entry("c:relocation_not_supported", 10),
+ entry("c:rods/blaze", 10),
+ entry("c:rods/breeze", 10),
+ entry("c:rods/wooden", 10),
+ entry("c:rods", 10),
+ entry("c:ropes", 10),
+ entry("c:sandstone/blocks", 10),
+ entry("c:sandstone/red_blocks", 10),
+ entry("c:sandstone/red_slabs", 10),
+ entry("c:sandstone/red_stairs", 10),
+ entry("c:sandstone/slabs", 10),
+ entry("c:sandstone/stairs", 10),
+ entry("c:sandstone/uncolored_blocks", 10),
+ entry("c:sandstone/uncolored_slabs", 10),
+ entry("c:sandstone/uncolored_stairs", 10),
+ entry("c:shulker_boxes", 10),
+ entry("c:skulls", 10),
+ entry("c:slime_balls", 10),
+ entry("c:stones", 10),
+ entry("c:storage_blocks/bone_meal", 10),
+ entry("c:storage_blocks/coal", 10),
+ entry("c:storage_blocks/copper", 10),
+ entry("c:storage_blocks/diamond", 10),
+ entry("c:storage_blocks/dried_kelp", 10),
+ entry("c:storage_blocks/emerald", 10),
+ entry("c:storage_blocks/gold", 10),
+ entry("c:storage_blocks/iron", 10),
+ entry("c:storage_blocks/lapis", 10),
+ entry("c:storage_blocks/netherite", 10),
+ entry("c:storage_blocks/raw_copper", 10),
+ entry("c:storage_blocks/raw_gold", 10),
+ entry("c:storage_blocks/raw_iron", 10),
+ entry("c:storage_blocks/redstone", 10),
+ entry("c:storage_blocks/slime", 10),
+ entry("c:storage_blocks/wheat", 10),
+ entry("c:storage_blocks", 10),
+ entry("c:strings", 10),
+ entry("c:tools/bow", 10),
+ entry("c:tools/brush", 10),
+ entry("c:tools/crossbow", 10),
+ entry("c:tools/fishing_rod", 10),
+ entry("c:tools/igniter", 10),
+ entry("c:tools/mace", 10),
+ entry("c:tools/melee_weapon", 10),
+ entry("c:tools/mining_tool", 10),
+ entry("c:tools/ranged_weapon", 10),
+ entry("c:tools/shear", 10),
+ entry("c:tools/shield", 10),
+ entry("c:tools/spear", 10),
+ entry("c:tools", 10),
+ entry("c:villager_job_sites", 10),
+ entry("forge:anvil", 10),
+ entry("forge:arrows", 10),
+ entry("forge:banners", 10),
+ entry("forge:barrels_wooden", 10),
+ entry("forge:barrels", 10),
+ entry("forge:beds", 10),
+ entry("forge:boats", 20),
+ entry("forge:bones", 5),
+ entry("forge:bookshelves", 50),
+ entry("forge:buttons", 10),
+ entry("forge:candles", 10),
+ entry("forge:carpets", 10),
+ entry("forge:chests/ender", 475),
+ entry("forge:chests/trapped", 10),
+ entry("forge:chests/wooden", 10),
+ entry("forge:chests", 10),
+ entry("forge:coal_ores", 20),
+ entry("forge:coals", 20),
+ entry("forge:cobblestone/deepslate", 7),
+ entry("forge:cobblestone/infested", 10),
+ entry("forge:cobblestone/mossy", 10),
+ entry("forge:cobblestone/normal", 5),
+ entry("forge:cobblestone", 5),
+ entry("forge:copper_ores", 50),
+ entry("forge:crimson_stems", 10),
+ entry("forge:crops", 10),
+ entry("forge:diamond_ores", 500),
+ entry("forge:dirt", 1),
+ entry("forge:doors", 10),
+ entry("forge:dusts/glowstone", 137),
+ entry("forge:dusts/prismarine", 250),
+ entry("forge:dusts/redstone", 137),
+ entry("forge:dusts", 120),
+ entry("forge:dyes/black", 15),
+ entry("forge:dyes/blue", 10),
+ entry("forge:dyes/brown", 10),
+ entry("forge:dyes/cyan", 10),
+ entry("forge:dyes/gray", 10),
+ entry("forge:dyes/green", 15),
+ entry("forge:dyes/light_blue", 10),
+ entry("forge:dyes/light_gray", 10),
+ entry("forge:dyes/lime", 10),
+ entry("forge:dyes/magenta", 10),
+ entry("forge:dyes/orange", 10),
+ entry("forge:dyes/pink", 10),
+ entry("forge:dyes/purple", 10),
+ entry("forge:dyes/red", 10),
+ entry("forge:dyes/white", 10),
+ entry("forge:dyes/yellow", 10),
+ entry("forge:dyes", 10),
+ entry("forge:eggs", 10),
+ entry("forge:emerald_ores", 400),
+ entry("forge:enchanting_fuels", 100),
+ entry("forge:end_stones", 150),
+ entry("forge:ender_pearls", 150),
+ entry("forge:enderman_place_on_blacklist", 10),
+ entry("forge:feathers", 10),
+ entry("forge:fence_gates/wooden", 10),
+ entry("forge:fence_gates", 10),
+ entry("forge:fences/nether_brick", 10),
+ entry("forge:fences/wooden", 10),
+ entry("forge:fences", 10),
+ entry("forge:fishes", 10),
+ entry("forge:flowers", 5),
+ entry("forge:foods/pie", 10),
+ entry("forge:gems/amethyst", 150),
+ entry("forge:gems/diamond", 500),
+ entry("forge:gems/emerald", 400),
+ entry("forge:gems/lapis", 250),
+ entry("forge:gems/prismarine", 250),
+ entry("forge:gems/quartz", 300),
+ entry("forge:gems", 150),
+ entry("forge:glass_panes", 20),
+ entry("forge:glass_silica", 20),
+ entry("forge:glass_tinted", 20),
+ entry("forge:glass", 10),
+ entry("forge:gold_ores", 250),
+ entry("forge:gravel", 2),
+ entry("forge:gunpowder", 50),
+ entry("forge:heads", 100),
+ entry("forge:ingots/brick", 16),
+ entry("forge:ingots/copper", 55),
+ entry("forge:ingots/gold", 310),
+ entry("forge:ingots/iron", 110),
+ entry("forge:ingots/nether_brick", 20),
+ entry("forge:ingots/netherite", 750),
+ entry("forge:ingots", 15),
+ entry("forge:iron_ores", 110),
+ entry("forge:lapis_ores", 250),
+ entry("forge:leather", 50),
+ entry("forge:leaves", 2),
+ entry("forge:lectern_books", 100),
+ entry("forge:logs_that_burn", 10),
+ entry("forge:logs", 10),
+ entry("forge:mushrooms", 2),
+ entry("forge:music_discs", 10),
+ entry("forge:nether_stars", 900),
+ entry("forge:netherrack", 5),
+ entry("forge:non_flammable_wood", 10),
+ entry("forge:nuggets/gold", 33),
+ entry("forge:nuggets/iron", 11),
+ entry("forge:nuggets", 2),
+ entry("forge:obsidian", 400),
+ entry("forge:ore_bearing_ground/deepslate", 10),
+ entry("forge:ore_bearing_ground/netherrack", 10),
+ entry("forge:ore_bearing_ground/stone", 10),
+ entry("forge:ore_rates/dense", 10),
+ entry("forge:ore_rates/singular", 10),
+ entry("forge:ore_rates/sparse", 10),
+ entry("forge:ores_in_ground/deepslate", 10),
+ entry("forge:ores_in_ground/netherrack", 10),
+ entry("forge:ores_in_ground/stone", 10),
+ entry("forge:ores/coal", 25),
+ entry("forge:ores/copper", 50),
+ entry("forge:ores/diamond", 500),
+ entry("forge:ores/emerald", 400),
+ entry("forge:ores/gold", 300),
+ entry("forge:ores/iron", 100),
+ entry("forge:ores/lapis", 250),
+ entry("forge:ores/netherite_scrap", 750),
+ entry("forge:ores/quartz", 300),
+ entry("forge:ores/redstone", 200),
+ entry("forge:ores", 10),
+ entry("forge:planks", 10),
+ entry("forge:rails", 10),
+ entry("forge:raw_materials/copper", 50),
+ entry("forge:raw_materials/gold", 300),
+ entry("forge:raw_materials/iron", 100),
+ entry("forge:raw_materials", 10),
+ entry("forge:redstone_ores", 200),
+ entry("forge:rods/blaze", 450),
+ entry("forge:rods/wooden", 10),
+ entry("forge:rods", 50),
+ entry("forge:sand/colorless", 10),
+ entry("forge:sand/red", 10),
+ entry("forge:sand", 10),
+ entry("forge:sandstone", 15),
+ entry("forge:saplings", 2),
+ entry("forge:seeds/beetroot", 10),
+ entry("forge:seeds/melon", 10),
+ entry("forge:seeds/pumpkin", 10),
+ entry("forge:seeds/wheat", 10),
+ entry("forge:seeds", 2),
+ entry("forge:shears", 10),
+ entry("forge:signs", 10),
+ entry("forge:slimeballs", 40),
+ entry("forge:small_flowers", 10),
+ entry("forge:soul_fire_base_blocks", 100),
+ entry("forge:stained_glass_panes", 10),
+ entry("forge:stained_glass", 10),
+ entry("forge:stone_bricks", 5),
+ entry("forge:stone", 5),
+ entry("forge:string", 15),
+ entry("forge:tall_flowers", 5),
+ entry("forge:terracotta", 100),
+ entry("forge:warped_stems", 250),
+ entry("forge:wooden_buttons", 10),
+ entry("forge:wooden_doors", 60),
+ entry("forge:wooden_fences", 10),
+ entry("forge:wooden_pressure_plates", 20),
+ entry("forge:wooden_slabs", 30),
+ entry("forge:wooden_stairs", 60),
+ entry("forge:wooden_trapdoors", 60),
+ entry("forge:wool", 10),
+ entry("minecraft:acacia_fence_gate", 10),
+ entry("minecraft:acacia_fence", 10),
+ entry("minecraft:allium", 10),
+ entry("minecraft:amethyst_cluster", 10),
+ entry("minecraft:amethyst_shard", 10),
+ entry("minecraft:ancient_debris", 10),
+ entry("minecraft:andesite", 10),
+ entry("minecraft:anvil", 10),
+ entry("minecraft:apple", 10),
+ entry("minecraft:arrows", 10),
+ entry("minecraft:axolotl_bucket", 10),
+ entry("minecraft:azure_bluet", 10),
+ entry("minecraft:baked_potato", 10),
+ entry("minecraft:bamboo_fence_gate", 10),
+ entry("minecraft:bamboo_fence", 10),
+ entry("minecraft:bamboo", 10),
+ entry("minecraft:banners", 10),
+ entry("minecraft:barrel", 10),
+ entry("minecraft:barrels_wooden", 10),
+ entry("minecraft:barrels", 10),
+ entry("minecraft:beds", 10),
+ entry("minecraft:beef", 10),
+ entry("minecraft:beetroot_seeds", 10),
+ entry("minecraft:beetroot_soup", 10),
+ entry("minecraft:beetroot", 10),
+ entry("minecraft:birch_fence_gate", 10),
+ entry("minecraft:birch_fence", 10),
+ entry("minecraft:black_banner", 10),
+ entry("minecraft:black_bed", 10),
+ entry("minecraft:black_candle", 10),
+ entry("minecraft:black_carpet", 10),
+ entry("minecraft:black_concrete_powder", 10),
+ entry("minecraft:black_concrete", 10),
+ entry("minecraft:black_dye", 10),
+ entry("minecraft:black_glazed_terracotta", 10),
+ entry("minecraft:black_shulker_box", 10),
+ entry("minecraft:black_stained_glass_pane", 10),
+ entry("minecraft:black_stained_glass", 10),
+ entry("minecraft:black_terracotta", 10),
+ entry("minecraft:black_wall_banner", 10),
+ entry("minecraft:black_wool", 10),
+ entry("minecraft:blackstone", 6),
+ entry("minecraft:blast_furnace", 10),
+ entry("minecraft:blaze_rod", 10),
+ entry("minecraft:blue_banner", 10),
+ entry("minecraft:blue_bed", 10),
+ entry("minecraft:blue_candle", 10),
+ entry("minecraft:blue_carpet", 10),
+ entry("minecraft:blue_concrete_powder", 10),
+ entry("minecraft:blue_concrete", 10),
+ entry("minecraft:blue_dye", 10),
+ entry("minecraft:blue_glazed_terracotta", 10),
+ entry("minecraft:blue_orchid", 10),
+ entry("minecraft:blue_shulker_box", 10),
+ entry("minecraft:blue_stained_glass_pane", 10),
+ entry("minecraft:blue_stained_glass", 10),
+ entry("minecraft:blue_terracotta", 10),
+ entry("minecraft:blue_wall_banner", 10),
+ entry("minecraft:blue_wool", 10),
+ entry("minecraft:boats", 20),
+ entry("minecraft:bone_block", 10),
+ entry("minecraft:bone_meal", 10),
+ entry("minecraft:bone", 10),
+ entry("minecraft:bones", 5),
+ entry("minecraft:bookshelf", 10),
+ entry("minecraft:bookshelves", 50),
+ entry("minecraft:bow", 10),
+ entry("minecraft:bread", 10),
+ entry("minecraft:breeze_rod", 10),
+ entry("minecraft:brewing_stand", 10),
+ entry("minecraft:brick", 10),
+ entry("minecraft:brown_banner", 10),
+ entry("minecraft:brown_bed", 10),
+ entry("minecraft:brown_candle", 10),
+ entry("minecraft:brown_carpet", 10),
+ entry("minecraft:brown_concrete_powder", 10),
+ entry("minecraft:brown_concrete", 10),
+ entry("minecraft:brown_dye", 10),
+ entry("minecraft:brown_glazed_terracotta", 10),
+ entry("minecraft:brown_mushroom", 10),
+ entry("minecraft:brown_shulker_box", 10),
+ entry("minecraft:brown_stained_glass_pane", 10),
+ entry("minecraft:brown_stained_glass", 10),
+ entry("minecraft:brown_terracotta", 10),
+ entry("minecraft:brown_wall_banner", 10),
+ entry("minecraft:brown_wool", 10),
+ entry("minecraft:brush", 10),
+ entry("minecraft:bucket", 10),
+ entry("minecraft:budding_amethyst", 10),
+ entry("minecraft:buttons", 10),
+ entry("minecraft:cactus", 10),
+ entry("minecraft:cake", 10),
+ entry("minecraft:candles", 10),
+ entry("minecraft:carpets", 10),
+ entry("minecraft:carrot_on_a_stick", 10),
+ entry("minecraft:carrot", 10),
+ entry("minecraft:cartography_table", 10),
+ entry("minecraft:carved_pumpkin", 10),
+ entry("minecraft:cauldron", 10),
+ entry("minecraft:chain", 10),
+ entry("minecraft:chainmail_boots", 10),
+ entry("minecraft:chainmail_chestplate", 10),
+ entry("minecraft:chainmail_helmet", 10),
+ entry("minecraft:chainmail_leggings", 10),
+ entry("minecraft:cherry_fence_gate", 10),
+ entry("minecraft:cherry_fence", 10),
+ entry("minecraft:cherry_leaves", 10),
+ entry("minecraft:chest", 10),
+ entry("minecraft:chests_ender", 475),
+ entry("minecraft:chests_trapped", 10),
+ entry("minecraft:chests_wooden", 10),
+ entry("minecraft:chests", 10),
+ entry("minecraft:chicken", 10),
+ entry("minecraft:chiseled_red_sandstone", 10),
+ entry("minecraft:chiseled_sandstone", 10),
+ entry("minecraft:chorus_flower", 10),
+ entry("minecraft:chorus_fruit", 10),
+ entry("minecraft:coal_block", 10),
+ entry("minecraft:coal_ore", 20),
+ entry("minecraft:coal_ores", 20),
+ entry("minecraft:coals", 20),
+ entry("minecraft:cobbled_deepslate", 10),
+ entry("minecraft:cobblestone_deepslate", 7),
+ entry("minecraft:cobblestone_mossy", 10),
+ entry("minecraft:cobblestone_normal", 5),
+ entry("minecraft:cobblestone", 5),
+ entry("minecraft:cocoa_beans", 10),
+ entry("minecraft:cod_bucket", 10),
+ entry("minecraft:cod", 10),
+ entry("minecraft:compass", 10),
+ entry("minecraft:composter", 10),
+ entry("minecraft:cooked_beef", 10),
+ entry("minecraft:cooked_chicken", 10),
+ entry("minecraft:cooked_cod", 10),
+ entry("minecraft:cooked_mutton", 10),
+ entry("minecraft:cooked_porkchop", 10),
+ entry("minecraft:cooked_rabbit", 10),
+ entry("minecraft:cooked_salmon", 10),
+ entry("minecraft:cookie", 10),
+ entry("minecraft:copper_block", 10),
+ entry("minecraft:copper_ingot", 10),
+ entry("minecraft:copper_ore", 10),
+ entry("minecraft:copper_ores", 50),
+ entry("minecraft:cornflower", 10),
+ entry("minecraft:crafting_table", 10),
+ entry("minecraft:creeper_head", 10),
+ entry("minecraft:creeper_wall_head", 10),
+ entry("minecraft:crimson_fence_gate", 10),
+ entry("minecraft:crimson_fence", 10),
+ entry("minecraft:crimson_fungus", 10),
+ entry("minecraft:crimson_stems", 10),
+ entry("minecraft:crops", 10),
+ entry("minecraft:crossbow", 10),
+ entry("minecraft:crying_obsidian", 10),
+ entry("minecraft:cut_red_sandstone_slab", 10),
+ entry("minecraft:cut_red_sandstone", 10),
+ entry("minecraft:cut_sandstone_slab", 10),
+ entry("minecraft:cut_sandstone", 10),
+ entry("minecraft:cyan_banner", 10),
+ entry("minecraft:cyan_bed", 10),
+ entry("minecraft:cyan_candle", 10),
+ entry("minecraft:cyan_carpet", 10),
+ entry("minecraft:cyan_concrete_powder", 10),
+ entry("minecraft:cyan_concrete", 10),
+ entry("minecraft:cyan_dye", 10),
+ entry("minecraft:cyan_glazed_terracotta", 10),
+ entry("minecraft:cyan_shulker_box", 10),
+ entry("minecraft:cyan_stained_glass_pane", 10),
+ entry("minecraft:cyan_stained_glass", 10),
+ entry("minecraft:cyan_terracotta", 10),
+ entry("minecraft:cyan_wall_banner", 10),
+ entry("minecraft:cyan_wool", 10),
+ entry("minecraft:dandelion", 10),
+ entry("minecraft:dark_oak_fence_gate", 10),
+ entry("minecraft:dark_oak_fence", 10),
+ entry("minecraft:deepslate_coal_ore", 10),
+ entry("minecraft:deepslate_copper_ore", 10),
+ entry("minecraft:deepslate_diamond_ore", 10),
+ entry("minecraft:deepslate_emerald_ore", 10),
+ entry("minecraft:deepslate_gold_ore", 10),
+ entry("minecraft:deepslate_iron_ore", 10),
+ entry("minecraft:deepslate_lapis_ore", 10),
+ entry("minecraft:deepslate_redstone_ore", 10),
+ entry("minecraft:deepslate", 10),
+ entry("minecraft:diamond_axe", 10),
+ entry("minecraft:diamond_block", 10),
+ entry("minecraft:diamond_boots", 10),
+ entry("minecraft:diamond_chestplate", 10),
+ entry("minecraft:diamond_helmet", 10),
+ entry("minecraft:diamond_hoe", 10),
+ entry("minecraft:diamond_leggings", 10),
+ entry("minecraft:diamond_ore", 10),
+ entry("minecraft:diamond_ores", 500),
+ entry("minecraft:diamond_pickaxe", 10),
+ entry("minecraft:diamond_shovel", 10),
+ entry("minecraft:diamond_sword", 10),
+ entry("minecraft:diamond", 10),
+ entry("minecraft:diorite", 10),
+ entry("minecraft:dirt", 1),
+ entry("minecraft:doors", 10),
+ entry("minecraft:dragon_head", 10),
+ entry("minecraft:dragon_wall_head", 10),
+ entry("minecraft:dried_kelp_block", 10),
+ entry("minecraft:dried_kelp", 10),
+ entry("minecraft:dusts_glowstone", 137),
+ entry("minecraft:dusts_prismarine", 250),
+ entry("minecraft:dusts_redstone", 137),
+ entry("minecraft:dusts", 120),
+ entry("minecraft:dyes_black", 15),
+ entry("minecraft:dyes_blue", 10),
+ entry("minecraft:dyes_brown", 10),
+ entry("minecraft:dyes_cyan", 10),
+ entry("minecraft:dyes_gray", 10),
+ entry("minecraft:dyes_green", 15),
+ entry("minecraft:dyes_light_blue", 10),
+ entry("minecraft:dyes_light_gray", 10),
+ entry("minecraft:dyes_lime", 10),
+ entry("minecraft:dyes_magenta", 10),
+ entry("minecraft:dyes_orange", 10),
+ entry("minecraft:dyes_pink", 10),
+ entry("minecraft:dyes_purple", 10),
+ entry("minecraft:dyes_red", 10),
+ entry("minecraft:dyes_white", 10),
+ entry("minecraft:dyes_yellow", 10),
+ entry("minecraft:dyes", 10),
+ entry("minecraft:egg", 10),
+ entry("minecraft:eggs", 10),
+ entry("minecraft:elytra", 10),
+ entry("minecraft:emerald_block", 10),
+ entry("minecraft:emerald_ore", 10),
+ entry("minecraft:emerald_ores", 400),
+ entry("minecraft:emerald", 10),
+ entry("minecraft:enchanted_golden_apple", 10),
+ entry("minecraft:enchanting_fuels", 100),
+ entry("minecraft:end_stone", 10),
+ entry("minecraft:end_stones", 150),
+ entry("minecraft:ender_chest", 10),
+ entry("minecraft:ender_pearl", 10),
+ entry("minecraft:ender_pearls", 150),
+ entry("minecraft:feather", 10),
+ entry("minecraft:feathers", 10),
+ entry("minecraft:fence_gates_wooden", 10),
+ entry("minecraft:fence_gates", 10),
+ entry("minecraft:fences_nether_brick", 10),
+ entry("minecraft:fences_wooden", 10),
+ entry("minecraft:fences", 10),
+ entry("minecraft:fishes", 10),
+ entry("minecraft:fishing_rod", 10),
+ entry("minecraft:fletching_table", 10),
+ entry("minecraft:flint_and_steel", 10),
+ entry("minecraft:flowering_azalea_leaves", 10),
+ entry("minecraft:flowering_azalea", 10),
+ entry("minecraft:flowers", 5),
+ entry("minecraft:furnace", 10),
+ entry("minecraft:gems_amethyst", 150),
+ entry("minecraft:gems_diamond", 500),
+ entry("minecraft:gems_emerald", 400),
+ entry("minecraft:gems_lapis", 250),
+ entry("minecraft:gems_prismarine", 250),
+ entry("minecraft:gems_quartz", 300),
+ entry("minecraft:gems", 150),
+ entry("minecraft:glass_pane", 20),
+ entry("minecraft:glass_panes", 20),
+ entry("minecraft:glass_silica", 20),
+ entry("minecraft:glass_tinted", 20),
+ entry("minecraft:glass", 10),
+ entry("minecraft:glow_berries", 10),
+ entry("minecraft:glowstone_dust", 10),
+ entry("minecraft:gold_block", 10),
+ entry("minecraft:gold_ingot", 10),
+ entry("minecraft:gold_nugget", 10),
+ entry("minecraft:gold_ore", 250),
+ entry("minecraft:gold_ores", 250),
+ entry("minecraft:golden_apple", 275),
+ entry("minecraft:golden_axe", 275),
+ entry("minecraft:golden_boots", 300),
+ entry("minecraft:golden_carrot", 250),
+ entry("minecraft:golden_chestplate", 300),
+ entry("minecraft:golden_helmet", 300),
+ entry("minecraft:golden_hoe", 300),
+ entry("minecraft:golden_leggings", 300),
+ entry("minecraft:golden_pickaxe", 275),
+ entry("minecraft:golden_shovel", 275),
+ entry("minecraft:golden_sword", 300),
+ entry("minecraft:granite", 10),
+ entry("minecraft:gravel", 2),
+ entry("minecraft:gray_banner", 10),
+ entry("minecraft:gray_bed", 10),
+ entry("minecraft:gray_candle", 10),
+ entry("minecraft:gray_carpet", 10),
+ entry("minecraft:gray_concrete_powder", 10),
+ entry("minecraft:gray_concrete", 10),
+ entry("minecraft:gray_dye", 10),
+ entry("minecraft:gray_glazed_terracotta", 10),
+ entry("minecraft:gray_shulker_box", 10),
+ entry("minecraft:gray_stained_glass_pane", 10),
+ entry("minecraft:gray_stained_glass", 10),
+ entry("minecraft:gray_terracotta", 10),
+ entry("minecraft:gray_wall_banner", 10),
+ entry("minecraft:gray_wool", 10),
+ entry("minecraft:green_banner", 10),
+ entry("minecraft:green_bed", 10),
+ entry("minecraft:green_candle", 10),
+ entry("minecraft:green_carpet", 10),
+ entry("minecraft:green_concrete_powder", 10),
+ entry("minecraft:green_concrete", 10),
+ entry("minecraft:green_dye", 10),
+ entry("minecraft:green_glazed_terracotta", 10),
+ entry("minecraft:green_shulker_box", 10),
+ entry("minecraft:green_stained_glass_pane", 10),
+ entry("minecraft:green_stained_glass", 10),
+ entry("minecraft:green_terracotta", 10),
+ entry("minecraft:green_wall_banner", 10),
+ entry("minecraft:green_wool", 10),
+ entry("minecraft:grindstone", 10),
+ entry("minecraft:gunpowder", 50),
+ entry("minecraft:hay_block", 10),
+ entry("minecraft:heads", 100),
+ entry("minecraft:honey_bottle", 10),
+ entry("minecraft:infested_cobblestone", 10),
+ entry("minecraft:ingots_brick", 16),
+ entry("minecraft:ingots_copper", 55),
+ entry("minecraft:ingots_gold", 310),
+ entry("minecraft:ingots_iron", 110),
+ entry("minecraft:ingots_nether_brick", 20),
+ entry("minecraft:ingots_netherite", 750),
+ entry("minecraft:ingots", 15),
+ entry("minecraft:iron_axe", 150),
+ entry("minecraft:iron_block", 150),
+ entry("minecraft:iron_boots", 150),
+ entry("minecraft:iron_chestplate", 150),
+ entry("minecraft:iron_helmet", 150),
+ entry("minecraft:iron_hoe", 150),
+ entry("minecraft:iron_ingot", 150),
+ entry("minecraft:iron_leggings", 150),
+ entry("minecraft:iron_nugget", 150),
+ entry("minecraft:iron_ore", 110),
+ entry("minecraft:iron_ores", 110),
+ entry("minecraft:iron_pickaxe", 150),
+ entry("minecraft:iron_shovel", 150),
+ entry("minecraft:iron_sword", 150),
+ entry("minecraft:jungle_fence_gate", 10),
+ entry("minecraft:jungle_fence", 10),
+ entry("minecraft:lapis_block", 400),
+ entry("minecraft:lapis_lazuli", 125),
+ entry("minecraft:lapis_ore", 250),
+ entry("minecraft:lapis_ores", 250),
+ entry("minecraft:large_amethyst_bud", 10),
+ entry("minecraft:lava_bucket", 10),
+ entry("minecraft:lava_cauldron", 10),
+ entry("minecraft:leather_boots", 10),
+ entry("minecraft:leather_chestplate", 10),
+ entry("minecraft:leather_helmet", 60),
+ entry("minecraft:leather_leggings", 60),
+ entry("minecraft:leather", 50),
+ entry("minecraft:leaves", 2),
+ entry("minecraft:lectern_books", 100),
+ entry("minecraft:lectern", 10),
+ entry("minecraft:light_blue_banner", 10),
+ entry("minecraft:light_blue_bed", 10),
+ entry("minecraft:light_blue_candle", 10),
+ entry("minecraft:light_blue_carpet", 10),
+ entry("minecraft:light_blue_concrete_powder", 10),
+ entry("minecraft:light_blue_concrete", 10),
+ entry("minecraft:light_blue_dye", 10),
+ entry("minecraft:light_blue_glazed_terracotta", 10),
+ entry("minecraft:light_blue_shulker_box", 10),
+ entry("minecraft:light_blue_stained_glass_pane", 10),
+ entry("minecraft:light_blue_stained_glass", 10),
+ entry("minecraft:light_blue_terracotta", 10),
+ entry("minecraft:light_blue_wall_banner", 10),
+ entry("minecraft:light_blue_wool", 10),
+ entry("minecraft:light_gray_banner", 10),
+ entry("minecraft:light_gray_bed", 10),
+ entry("minecraft:light_gray_candle", 10),
+ entry("minecraft:light_gray_carpet", 10),
+ entry("minecraft:light_gray_concrete_powder", 10),
+ entry("minecraft:light_gray_concrete", 10),
+ entry("minecraft:light_gray_dye", 10),
+ entry("minecraft:light_gray_glazed_terracotta", 10),
+ entry("minecraft:light_gray_shulker_box", 10),
+ entry("minecraft:light_gray_stained_glass_pane", 10),
+ entry("minecraft:light_gray_stained_glass", 10),
+ entry("minecraft:light_gray_terracotta", 10),
+ entry("minecraft:light_gray_wall_banner", 10),
+ entry("minecraft:light_gray_wool", 10),
+ entry("minecraft:lilac", 10),
+ entry("minecraft:lily_of_the_valley", 10),
+ entry("minecraft:lime_banner", 10),
+ entry("minecraft:lime_bed", 10),
+ entry("minecraft:lime_candle", 10),
+ entry("minecraft:lime_carpet", 10),
+ entry("minecraft:lime_concrete_powder", 10),
+ entry("minecraft:lime_concrete", 10),
+ entry("minecraft:lime_dye", 10),
+ entry("minecraft:lime_glazed_terracotta", 10),
+ entry("minecraft:lime_shulker_box", 10),
+ entry("minecraft:lime_stained_glass_pane", 10),
+ entry("minecraft:lime_stained_glass", 10),
+ entry("minecraft:lime_terracotta", 10),
+ entry("minecraft:lime_wall_banner", 10),
+ entry("minecraft:lime_wool", 10),
+ entry("minecraft:logs_that_burn", 10),
+ entry("minecraft:logs", 10),
+ entry("minecraft:loom", 10),
+ entry("minecraft:mace", 10),
+ entry("minecraft:magenta_banner", 10),
+ entry("minecraft:magenta_bed", 10),
+ entry("minecraft:magenta_candle", 10),
+ entry("minecraft:magenta_carpet", 10),
+ entry("minecraft:magenta_concrete_powder", 10),
+ entry("minecraft:magenta_concrete", 10),
+ entry("minecraft:magenta_dye", 10),
+ entry("minecraft:magenta_glazed_terracotta", 10),
+ entry("minecraft:magenta_shulker_box", 10),
+ entry("minecraft:magenta_stained_glass_pane", 10),
+ entry("minecraft:magenta_stained_glass", 10),
+ entry("minecraft:magenta_terracotta", 10),
+ entry("minecraft:magenta_wall_banner", 10),
+ entry("minecraft:magenta_wool", 10),
+ entry("minecraft:mangrove_fence_gate", 10),
+ entry("minecraft:mangrove_fence", 10),
+ entry("minecraft:mangrove_propagule", 10),
+ entry("minecraft:medium_amethyst_bud", 10),
+ entry("minecraft:melon_seeds", 10),
+ entry("minecraft:melon_slice", 10),
+ entry("minecraft:melon", 10),
+ entry("minecraft:milk_bucket", 10),
+ entry("minecraft:mossy_cobblestone", 10),
+ entry("minecraft:mushroom_stew", 10),
+ entry("minecraft:mushrooms", 2),
+ entry("minecraft:music_disc_11", 10),
+ entry("minecraft:music_disc_13", 10),
+ entry("minecraft:music_disc_5", 10),
+ entry("minecraft:music_disc_blocks", 10),
+ entry("minecraft:music_disc_cat", 10),
+ entry("minecraft:music_disc_chirp", 10),
+ entry("minecraft:music_disc_creator_music_box", 10),
+ entry("minecraft:music_disc_creator", 10),
+ entry("minecraft:music_disc_far", 10),
+ entry("minecraft:music_disc_mall", 10),
+ entry("minecraft:music_disc_mellohi", 10),
+ entry("minecraft:music_disc_otherside", 10),
+ entry("minecraft:music_disc_pigstep", 10),
+ entry("minecraft:music_disc_precipice", 10),
+ entry("minecraft:music_disc_relic", 10),
+ entry("minecraft:music_disc_stal", 10),
+ entry("minecraft:music_disc_strad", 10),
+ entry("minecraft:music_disc_wait", 10),
+ entry("minecraft:music_disc_ward", 10),
+ entry("minecraft:music_discs", 10),
+ entry("minecraft:mutton", 10),
+ entry("minecraft:nether_brick_fence", 10),
+ entry("minecraft:nether_brick", 10),
+ entry("minecraft:nether_gold_ore", 10),
+ entry("minecraft:nether_quartz_ore", 10),
+ entry("minecraft:nether_star", 900),
+ entry("minecraft:nether_stars", 900),
+ entry("minecraft:nether_wart", 10),
+ entry("minecraft:netherite_axe", 1000),
+ entry("minecraft:netherite_block", 1000),
+ entry("minecraft:netherite_boots", 1000),
+ entry("minecraft:netherite_chestplate", 1000),
+ entry("minecraft:netherite_helmet", 1000),
+ entry("minecraft:netherite_hoe", 1000),
+ entry("minecraft:netherite_ingot", 1000),
+ entry("minecraft:netherite_leggings", 1000),
+ entry("minecraft:netherite_pickaxe", 1000),
+ entry("minecraft:netherite_shovel", 1000),
+ entry("minecraft:netherite_sword", 1000),
+ entry("minecraft:netherrack", 5),
+ entry("minecraft:non_flammable_wood", 10),
+ entry("minecraft:nuggets_gold", 33),
+ entry("minecraft:nuggets_iron", 11),
+ entry("minecraft:nuggets", 2),
+ entry("minecraft:oak_fence_gate", 10),
+ entry("minecraft:oak_fence", 10),
+ entry("minecraft:obsidian", 400),
+ entry("minecraft:ominous_bottle", 10),
+ entry("minecraft:orange_banner", 10),
+ entry("minecraft:orange_bed", 10),
+ entry("minecraft:orange_candle", 10),
+ entry("minecraft:orange_carpet", 10),
+ entry("minecraft:orange_concrete_powder", 10),
+ entry("minecraft:orange_concrete", 10),
+ entry("minecraft:orange_dye", 10),
+ entry("minecraft:orange_glazed_terracotta", 10),
+ entry("minecraft:orange_shulker_box", 10),
+ entry("minecraft:orange_stained_glass_pane", 10),
+ entry("minecraft:orange_stained_glass", 10),
+ entry("minecraft:orange_terracotta", 10),
+ entry("minecraft:orange_tulip", 10),
+ entry("minecraft:orange_wall_banner", 10),
+ entry("minecraft:orange_wool", 10),
+ entry("minecraft:ore_bearing_ground_deepslate", 10),
+ entry("minecraft:ore_bearing_ground_netherrack", 10),
+ entry("minecraft:ore_bearing_ground_stone", 10),
+ entry("minecraft:ores_coal", 25),
+ entry("minecraft:ores_copper", 50),
+ entry("minecraft:ores_diamond", 500),
+ entry("minecraft:ores_emerald", 400),
+ entry("minecraft:ores_gold", 300),
+ entry("minecraft:ores_in_ground_deepslate", 10),
+ entry("minecraft:ores_in_ground_netherrack", 10),
+ entry("minecraft:ores_in_ground_stone", 10),
+ entry("minecraft:ores_iron", 100),
+ entry("minecraft:ores_lapis", 250),
+ entry("minecraft:ores_netherite_scrap", 750),
+ entry("minecraft:ores_quartz", 300),
+ entry("minecraft:ores_redstone", 200),
+ entry("minecraft:ores", 10),
+ entry("minecraft:oxeye_daisy", 10),
+ entry("minecraft:peony", 10),
+ entry("minecraft:piglin_head", 10),
+ entry("minecraft:piglin_wall_head", 10),
+ entry("minecraft:pink_banner", 10),
+ entry("minecraft:pink_bed", 10),
+ entry("minecraft:pink_candle", 10),
+ entry("minecraft:pink_carpet", 10),
+ entry("minecraft:pink_concrete_powder", 10),
+ entry("minecraft:pink_concrete", 10),
+ entry("minecraft:pink_dye", 10),
+ entry("minecraft:pink_glazed_terracotta", 10),
+ entry("minecraft:pink_petals", 10),
+ entry("minecraft:pink_shulker_box", 10),
+ entry("minecraft:pink_stained_glass_pane", 10),
+ entry("minecraft:pink_stained_glass", 10),
+ entry("minecraft:pink_terracotta", 10),
+ entry("minecraft:pink_tulip", 10),
+ entry("minecraft:pink_wall_banner", 10),
+ entry("minecraft:pink_wool", 10),
+ entry("minecraft:pitcher_plant", 10),
+ entry("minecraft:pitcher_pod", 10),
+ entry("minecraft:planks", 10),
+ entry("minecraft:player_head", 10),
+ entry("minecraft:player_wall_head", 10),
+ entry("minecraft:poisonous_potato", 10),
+ entry("minecraft:poppy", 10),
+ entry("minecraft:porkchop", 10),
+ entry("minecraft:potato", 10),
+ entry("minecraft:powder_snow_bucket", 10),
+ entry("minecraft:powder_snow_cauldron", 10),
+ entry("minecraft:prismarine_crystals", 10),
+ entry("minecraft:pufferfish_bucket", 10),
+ entry("minecraft:pufferfish", 10),
+ entry("minecraft:pumpkin_pie", 10),
+ entry("minecraft:pumpkin_seeds", 10),
+ entry("minecraft:pumpkin", 10),
+ entry("minecraft:purple_banner", 10),
+ entry("minecraft:purple_bed", 10),
+ entry("minecraft:purple_candle", 10),
+ entry("minecraft:purple_carpet", 10),
+ entry("minecraft:purple_concrete_powder", 10),
+ entry("minecraft:purple_concrete", 10),
+ entry("minecraft:purple_dye", 10),
+ entry("minecraft:purple_glazed_terracotta", 10),
+ entry("minecraft:purple_shulker_box", 10),
+ entry("minecraft:purple_stained_glass_pane", 10),
+ entry("minecraft:purple_stained_glass", 10),
+ entry("minecraft:purple_terracotta", 10),
+ entry("minecraft:purple_wall_banner", 10),
+ entry("minecraft:purple_wool", 10),
+ entry("minecraft:quartz", 10),
+ entry("minecraft:rabbit_stew", 10),
+ entry("minecraft:rabbit", 10),
+ entry("minecraft:rails", 10),
+ entry("minecraft:raw_copper_block", 10),
+ entry("minecraft:raw_copper", 10),
+ entry("minecraft:raw_gold_block", 300),
+ entry("minecraft:raw_gold", 300),
+ entry("minecraft:raw_iron_block", 100),
+ entry("minecraft:raw_iron", 100),
+ entry("minecraft:raw_materials_copper", 50),
+ entry("minecraft:raw_materials_gold", 300),
+ entry("minecraft:raw_materials_iron", 100),
+ entry("minecraft:raw_materials", 10),
+ entry("minecraft:red_banner", 10),
+ entry("minecraft:red_bed", 10),
+ entry("minecraft:red_candle", 10),
+ entry("minecraft:red_carpet", 10),
+ entry("minecraft:red_concrete_powder", 10),
+ entry("minecraft:red_concrete", 10),
+ entry("minecraft:red_dye", 10),
+ entry("minecraft:red_glazed_terracotta", 10),
+ entry("minecraft:red_mushroom", 10),
+ entry("minecraft:red_sand", 10),
+ entry("minecraft:red_sandstone_slab", 10),
+ entry("minecraft:red_sandstone_stairs", 10),
+ entry("minecraft:red_sandstone", 10),
+ entry("minecraft:red_shulker_box", 10),
+ entry("minecraft:red_stained_glass_pane", 10),
+ entry("minecraft:red_stained_glass", 10),
+ entry("minecraft:red_terracotta", 10),
+ entry("minecraft:red_tulip", 10),
+ entry("minecraft:red_wall_banner", 10),
+ entry("minecraft:red_wool", 10),
+ entry("minecraft:redstone_block", 600),
+ entry("minecraft:redstone_ore", 200),
+ entry("minecraft:redstone_ores", 200),
+ entry("minecraft:redstone", 200),
+ entry("minecraft:rods_blaze", 450),
+ entry("minecraft:rods_wooden", 50),
+ entry("minecraft:rods", 50),
+ entry("minecraft:rose_bush", 10),
+ entry("minecraft:rotten_flesh", 10),
+ entry("minecraft:salmon_bucket", 10),
+ entry("minecraft:salmon", 10),
+ entry("minecraft:sand_colorless", 10),
+ entry("minecraft:sand_red", 10),
+ entry("minecraft:sand", 10),
+ entry("minecraft:sandstone_slab", 10),
+ entry("minecraft:sandstone_stairs", 10),
+ entry("minecraft:sandstone", 15),
+ entry("minecraft:saplings", 2),
+ entry("minecraft:seagrass", 10),
+ entry("minecraft:seeds", 2),
+ entry("minecraft:shears", 10),
+ entry("minecraft:shield", 10),
+ entry("minecraft:shulker_box", 10),
+ entry("minecraft:signs", 10),
+ entry("minecraft:skeleton_skull", 10),
+ entry("minecraft:skeleton_wall_skull", 10),
+ entry("minecraft:slime_ball", 40),
+ entry("minecraft:slime_block", 100),
+ entry("minecraft:slimeballs", 40),
+ entry("minecraft:small_amethyst_bud", 10),
+ entry("minecraft:small_flowers", 10),
+ entry("minecraft:smithing_table", 10),
+ entry("minecraft:smoker", 10),
+ entry("minecraft:smooth_red_sandstone_slab", 10),
+ entry("minecraft:smooth_red_sandstone_stairs", 10),
+ entry("minecraft:smooth_red_sandstone", 10),
+ entry("minecraft:smooth_sandstone_slab", 10),
+ entry("minecraft:smooth_sandstone_stairs", 10),
+ entry("minecraft:smooth_sandstone", 10),
+ entry("minecraft:soul_fire_base_blocks", 100),
+ entry("minecraft:spider_eye", 10),
+ entry("minecraft:spore_blossom", 10),
+ entry("minecraft:spruce_fence_gate", 10),
+ entry("minecraft:spruce_fence", 10),
+ entry("minecraft:stained_glass_panes", 10),
+ entry("minecraft:stained_glass", 10),
+ entry("minecraft:stick", 10),
+ entry("minecraft:stone_axe", 10),
+ entry("minecraft:stone_bricks", 5),
+ entry("minecraft:stone_crafting_materials", 5),
+ entry("minecraft:stone_hoe", 10),
+ entry("minecraft:stone_pickaxe", 10),
+ entry("minecraft:stone_shovel", 10),
+ entry("minecraft:stone_sword", 10),
+ entry("minecraft:stone_tool_materials", 5),
+ entry("minecraft:stone", 5),
+ entry("minecraft:stonecutter", 10),
+ entry("minecraft:string", 15),
+ entry("minecraft:sugar_cane", 10),
+ entry("minecraft:sugar", 10),
+ entry("minecraft:sunflower", 10),
+ entry("minecraft:suspicious_stew", 10),
+ entry("minecraft:sweet_berries", 10),
+ entry("minecraft:tadpole_bucket", 10),
+ entry("minecraft:tall_flowers", 5),
+ entry("minecraft:terracotta", 100),
+ entry("minecraft:tinted_glass", 10),
+ entry("minecraft:torchflower_seeds", 10),
+ entry("minecraft:torchflower", 10),
+ entry("minecraft:trapped_chest", 10),
+ entry("minecraft:trident", 10),
+ entry("minecraft:tropical_fish_bucket", 10),
+ entry("minecraft:tropical_fish", 10),
+ entry("minecraft:tuff", 10),
+ entry("minecraft:turtle_helmet", 10),
+ entry("minecraft:warped_fence_gate", 10),
+ entry("minecraft:warped_fence", 10),
+ entry("minecraft:warped_fungus_on_a_stick", 10),
+ entry("minecraft:warped_fungus", 10),
+ entry("minecraft:warped_stems", 250),
+ entry("minecraft:water_bucket", 10),
+ entry("minecraft:water_cauldron", 10),
+ entry("minecraft:wheat_seeds", 10),
+ entry("minecraft:wheat", 10),
+ entry("minecraft:white_banner", 10),
+ entry("minecraft:white_bed", 10),
+ entry("minecraft:white_candle", 10),
+ entry("minecraft:white_carpet", 10),
+ entry("minecraft:white_concrete_powder", 10),
+ entry("minecraft:white_concrete", 10),
+ entry("minecraft:white_dye", 10),
+ entry("minecraft:white_glazed_terracotta", 10),
+ entry("minecraft:white_shulker_box", 10),
+ entry("minecraft:white_stained_glass_pane", 10),
+ entry("minecraft:white_stained_glass", 10),
+ entry("minecraft:white_terracotta", 10),
+ entry("minecraft:white_tulip", 10),
+ entry("minecraft:white_wall_banner", 10),
+ entry("minecraft:white_wool", 10),
+ entry("minecraft:wither_rose", 10),
+ entry("minecraft:wither_skeleton_skull", 10),
+ entry("minecraft:wither_skeleton_wall_skull", 10),
+ entry("minecraft:wooden_axe", 10),
+ entry("minecraft:wooden_buttons", 10),
+ entry("minecraft:wooden_doors", 60),
+ entry("minecraft:wooden_fences", 10),
+ entry("minecraft:wooden_hoe", 10),
+ entry("minecraft:wooden_pickaxe", 10),
+ entry("minecraft:wooden_pressure_plates", 20),
+ entry("minecraft:wooden_shovel", 10),
+ entry("minecraft:wooden_slabs", 30),
+ entry("minecraft:wooden_stairs", 60),
+ entry("minecraft:wooden_sword", 10),
+ entry("minecraft:wooden_trapdoors", 60),
+ entry("minecraft:wool", 10),
+ entry("minecraft:yellow_banner", 10),
+ entry("minecraft:yellow_bed", 10),
+ entry("minecraft:yellow_candle", 10),
+ entry("minecraft:yellow_carpet", 10),
+ entry("minecraft:yellow_concrete_powder", 10),
+ entry("minecraft:yellow_concrete", 10),
+ entry("minecraft:yellow_dye", 10),
+ entry("minecraft:yellow_glazed_terracotta", 10),
+ entry("minecraft:yellow_shulker_box", 10),
+ entry("minecraft:yellow_stained_glass_pane", 10),
+ entry("minecraft:yellow_stained_glass", 10),
+ entry("minecraft:yellow_terracotta", 10),
+ entry("minecraft:yellow_wall_banner", 10),
+ entry("minecraft:yellow_wool", 10),
+ entry("minecraft:zombie_head", 10),
+ entry("minecraft:zombie_wall_head", 10)
+ );
+
+ public static final Map itemOverrides = Map.ofEntries(
+ entry("create:precision_mechanism", 250),
+ entry("minecraft:trapped_chest", 11)
+ );
+}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/lib/Multipliers.java b/src/main/java/com/sweetrpg/crafttracker/common/lib/Multipliers.java
new file mode 100644
index 0000000..0009f24
--- /dev/null
+++ b/src/main/java/com/sweetrpg/crafttracker/common/lib/Multipliers.java
@@ -0,0 +1,20 @@
+package com.sweetrpg.crafttracker.common.lib;
+
+import java.util.Map;
+
+import static java.util.Map.entry;
+
+public class Multipliers {
+
+ public static final Map namespaces = Map.ofEntries(
+ entry("minecraft", 1f),
+ entry("create", 1.5f)
+ );
+
+ public static final Map recipeTypes = Map.ofEntries(
+ entry("minecraft:crafting", 1f),
+ entry("minecraft:smelting", 1.1f),
+ entry("minecraft:blasting", 1.2f),
+ entry("create:crushing", 1.1f)
+ );
+}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/manager/CraftingQueueManager.java b/src/main/java/com/sweetrpg/crafttracker/common/manager/CraftingQueueManager.java
index 17da45b..1ce3730 100644
--- a/src/main/java/com/sweetrpg/crafttracker/common/manager/CraftingQueueManager.java
+++ b/src/main/java/com/sweetrpg/crafttracker/common/manager/CraftingQueueManager.java
@@ -1,6 +1,7 @@
package com.sweetrpg.crafttracker.common.manager;
import com.sweetrpg.crafttracker.CraftTracker;
+import com.sweetrpg.crafttracker.common.config.ConfigHandler;
import com.sweetrpg.crafttracker.common.model.CraftingQueueItem;
import com.sweetrpg.crafttracker.common.model.CraftingQueueProduct;
import com.sweetrpg.crafttracker.common.storage.CraftingQueueStorage;
@@ -24,10 +25,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.nio.file.FileAlreadyExistsException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.StandardOpenOption;
+import java.nio.file.*;
import java.text.MessageFormat;
import java.util.*;
@@ -41,8 +39,6 @@ public class CraftingQueueManager {
public static CraftingQueueManager INSTANCE = new CraftingQueueManager();
- private static final int MAX_PROCESSING_LEVEL = 3;
-
private Map endProducts = new HashMap<>();
private Map intermediateProducts = new HashMap<>();
private Map rawMaterials = new HashMap<>();
@@ -66,13 +62,15 @@ public void load(Player player) {
CraftTracker.LOGGER.debug("file: {}", file);
try {
- try (InputStream in = Files.newInputStream(file, StandardOpenOption.READ)) {
- var data = NbtIo.readCompressed(in);
- var products = CraftingQueueStorage.load(data);
- products.forEach((k, v) -> v.setRecipes(RecipeUtil.getRecipesFor(k)));
- this.endProducts = products;
- this.computeAll();
- }
+ InputStream in = Files.newInputStream(file, StandardOpenOption.READ);
+ var data = NbtIo.readCompressed(in);
+ var products = CraftingQueueStorage.load(data);
+ products.forEach((k, v) -> v.setRecipes(RecipeUtil.getRecipesFor(k)));
+ this.endProducts = products;
+ this.computeAll();
+ }
+ catch (NoSuchFileException e) {
+ // ignore
}
catch (IOException e) {
CraftTracker.LOGGER.error("An error occurred while loading crafting queue [" + file + "]", e);
@@ -164,8 +162,8 @@ public List getFuel() {
*
* This will trigger a recalculation of the entire queue.
*
- * @param player The player whose queue is being adjusted
- * @param itemId The item to add to the queue
+ * @param player The player whose queue is being adjusted
+ * @param itemId The item to add to the queue
* @param quantity The amount to add
*/
public void addProduct(Player player, ResourceLocation itemId, int quantity) {
@@ -195,8 +193,8 @@ public void addProduct(Player player, ResourceLocation itemId, int quantity) {
* A convenience method to adjust the quantity of a product.
* This will call the appropriate add* or remove* method.
*
- * @param player The player whose queue is being adjusted
- * @param itemId The item to adjust
+ * @param player The player whose queue is being adjusted
+ * @param itemId The item to adjust
* @param quantity The amount to adjust; positive values will increase the amount, negative values will reduce it.
*/
public void adjustProduct(Player player, ResourceLocation itemId, int quantity) {
@@ -227,8 +225,8 @@ public void removeProduct(Player player, ResourceLocation itemId) {
/**
* Removes a single end product, or a quantity of it, from the queue.
*
- * @param player The player whose queue is being adjusted
- * @param itemId The item to remove from the queue
+ * @param player The player whose queue is being adjusted
+ * @param itemId The item to remove from the queue
* @param quantity The amount of the item to remove. If this value is the greater than or equal to the amount
* currently in the queue, the item is removed entirely.
*/
@@ -280,10 +278,6 @@ public void removeAll() {
public void computeAll() {
CraftTracker.LOGGER.debug("CraftingQueueManager#computeAll");
-// this.intermediateProducts.clear();
-// this.rawMaterials.clear();
-// this.fuel.clear();
-
ProcessingContext ctx = new ProcessingContext();
this.endProducts.forEach((k, v) -> {
@@ -300,7 +294,7 @@ public void computeAll() {
/**
* Starts the computation of an end product's intermediates and materials.
*
- * @param ctx The context to use for processing the queue
+ * @param ctx The context to use for processing the queue
* @param product The product to process
*/
void computeProduct(ProcessingContext ctx, CraftingQueueProduct product) {
@@ -363,10 +357,10 @@ void coalesceProducts(ProcessingContext ctx) {
* If the recipe's namespace or the result item's namespace differ from the ingredients, the function will exit
* early with a `null` return value in order to prevent strange suggestions of intermediates and raw materials.
*
- * @param recipe The recipe to compute
+ * @param recipe The recipe to compute
* @param iterations The desired number of times the recipe is to be crafted by the player
- * @param depth The current depth of processing the queue. This is metadata about the processing context used to
- * prevent potential loops in looking up required items.
+ * @param depth The current depth of processing the queue. This is metadata about the processing context used to
+ * prevent potential loops in looking up required items.
* @return A computed recipe, or `null` if certain criteria are not met or thresholds are crossed.
*/
ComputedRecipe computeRecipe(Recipe> recipe, int iterations, int depth) {
@@ -452,7 +446,7 @@ ComputedRecipe computeRecipe(Recipe> recipe, int iterations, int depth) {
var subRecipes = RecipeUtil.getRecipesFor(id);
CraftTracker.LOGGER.debug("subRecipes: {}", subRecipes.stream().map(DebugUtil::printRecipe).toList());
- if(subRecipes.isEmpty() || depth >= MAX_PROCESSING_LEVEL) {
+ if(subRecipes.isEmpty() || depth >= ConfigHandler.CLIENT.calculationDepth.get()) {
CraftTracker.LOGGER.debug("subRecipes is empty; ingredient {} is a raw material", ingredientId);
// no recipes for this ingredient, so it's a raw material
computedRecipe.rawMaterials.compute(id,
@@ -529,15 +523,7 @@ class ProcessingContext {
@Override
public String toString() {
- return MessageFormat.format("""
- ProcessingContext[
- intermediateProducts={0}
- rawMaterials={1}
- fuel={2}
- handledItems={3}
- computedRecipes={4}
- ]
- """,
+ return MessageFormat.format("ProcessingContext[ intermediateProducts={0}, rawMaterials={1}, fuel={2}, handledItems={3}, computedRecipes={4} ]",
intermediateProducts, rawMaterials, fuel, handledItems, computedRecipes);
}
}
@@ -581,13 +567,7 @@ public ComputedRecipeItem tag(boolean tag) {
@Override
public String toString() {
- return MessageFormat.format("""
- ComputedRecipeItem[
- itemId={0}
- amount={1}
- tag={2}
- ]
- """,
+ return MessageFormat.format("ComputedRecipeItem[ itemId={0}, amount={1}, tag={2} ]",
itemId, amount, tag);
}
}
@@ -604,6 +584,7 @@ class ComputedRecipe {
/**
* Constructs the object with the ID of the recipe it represents.
+ *
* @param recipeId The recipe ID
*/
ComputedRecipe(ResourceLocation recipeId) {
@@ -612,28 +593,14 @@ class ComputedRecipe {
@Override
public String toString() {
- return MessageFormat.format("""
- ComputedRecipe[
- recipeId={0}
- intermediateProducts={1}
- rawMaterials={2}
- fuel={3}
- ]
- """,
+ return MessageFormat.format("ComputedRecipe[ recipeId={0}, intermediateProducts={1}, rawMaterials={2}, fuel={3} ]",
recipeId, intermediateProducts, rawMaterials, fuel);
}
}
@Override
public String toString() {
- return MessageFormat.format("""
- CraftingQueueManager[
- endProducts={0}
- intermediateProducts={1}
- rawMaterials={2}
- fuel={3}
- ]
- """,
+ return MessageFormat.format(" CraftingQueueManager[ endProducts={0}, intermediateProducts={1}, rawMaterials={2}, fuel={3} ]",
endProducts, intermediateProducts, rawMaterials, fuel);
}
}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/manager/ShoppingListManager.java b/src/main/java/com/sweetrpg/crafttracker/common/manager/ShoppingListManager.java
index 76b1e0f..aff0b82 100644
--- a/src/main/java/com/sweetrpg/crafttracker/common/manager/ShoppingListManager.java
+++ b/src/main/java/com/sweetrpg/crafttracker/common/manager/ShoppingListManager.java
@@ -15,6 +15,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
+import java.text.MessageFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -197,5 +198,11 @@ public int getQuantity() {
public void setQuantity(int quantity) {
this.quantity = quantity;
}
+
+ @Override
+ public String toString() {
+ return MessageFormat.format("ListItem[ itemId={0}, quantity={1} ]",
+ itemId, quantity);
+ }
}
}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/model/CraftingQueueItem.java b/src/main/java/com/sweetrpg/crafttracker/common/model/CraftingQueueItem.java
index 67271f3..4e76b6e 100644
--- a/src/main/java/com/sweetrpg/crafttracker/common/model/CraftingQueueItem.java
+++ b/src/main/java/com/sweetrpg/crafttracker/common/model/CraftingQueueItem.java
@@ -2,6 +2,8 @@
import net.minecraft.resources.ResourceLocation;
+import java.text.MessageFormat;
+
/**
* A value object for holding intermediate, material, and fuel information from the crafting queue.
*/
@@ -71,4 +73,10 @@ public boolean isTag() {
public void setTag(boolean tag) {
this.tag = tag;
}
+
+ @Override
+ public String toString() {
+ return MessageFormat.format("CraftingQueueItem[ itemId={0}, amount={1}, tag={2} ]",
+ itemId, amount, tag);
+ }
}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/model/CraftingQueueProduct.java b/src/main/java/com/sweetrpg/crafttracker/common/model/CraftingQueueProduct.java
index a47c434..468d009 100644
--- a/src/main/java/com/sweetrpg/crafttracker/common/model/CraftingQueueProduct.java
+++ b/src/main/java/com/sweetrpg/crafttracker/common/model/CraftingQueueProduct.java
@@ -64,14 +64,7 @@ public void setIndex(int index) {
@Override
public String toString() {
- return MessageFormat.format("""
- CraftingQueueProduct[
- itemId={0}
- recipes={1}
- iterations={2}
- index={3}
- ]
- """,
+ return MessageFormat.format("CraftingQueueProduct[ itemId={0}, recipes={1}, iterations={2}, index={3} ]",
productId, recipes, iterations, index);
}
}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModBlockEntityTypes.java b/src/main/java/com/sweetrpg/crafttracker/common/registry/ModBlockEntityTypes.java
deleted file mode 100644
index 6592fb3..0000000
--- a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModBlockEntityTypes.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.sweetrpg.crafttracker.common.registry;
-
-import com.sweetrpg.crafttracker.common.lib.Constants;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.entity.BlockEntity;
-import net.minecraft.world.level.block.entity.BlockEntityType;
-import net.minecraftforge.registries.DeferredRegister;
-import net.minecraftforge.registries.ForgeRegistries;
-import net.minecraftforge.registries.RegistryObject;
-
-import java.util.function.Supplier;
-
-public class ModBlockEntityTypes {
-
- public static final DeferredRegister> TILE_ENTITIES = DeferredRegister.create(ForgeRegistries.Keys.BLOCK_ENTITY_TYPES, Constants.MOD_ID);
-
- private static RegistryObject> register(final String name, final BlockEntityType.BlockEntitySupplier sup, Supplier extends Block> validBlock) {
- return register(name, () -> BlockEntityType.Builder.of(sup, validBlock.get()).build(null));
- }
-
- private static > RegistryObject register(final String name, final Supplier sup) {
- return TILE_ENTITIES.register(name, sup);
- }
-
-}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModBlocks.java b/src/main/java/com/sweetrpg/crafttracker/common/registry/ModBlocks.java
deleted file mode 100644
index a2bd65e..0000000
--- a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModBlocks.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.sweetrpg.crafttracker.common.registry;
-
-import com.sweetrpg.crafttracker.common.lib.Constants;
-import net.minecraft.world.item.BlockItem;
-import net.minecraft.world.item.Item;
-import net.minecraft.world.level.block.Block;
-import net.minecraftforge.registries.DeferredRegister;
-import net.minecraftforge.registries.ForgeRegistries;
-import net.minecraftforge.registries.RegistryObject;
-
-import javax.annotation.Nullable;
-import java.util.function.Function;
-import java.util.function.Supplier;
-
-public class ModBlocks {
-
- public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.Keys.BLOCKS, Constants.MOD_ID);
- public static final DeferredRegister- ITEMS = ModItems.ITEMS;
-
- private static Item.Properties createInitialProp() {
- return new Item.Properties().tab(ModItemGroups.GENERAL);
- }
-
- private static BlockItem makeItemBlock(Block block) {
- return makeItemBlock(block, null);
- }
-
- private static BlockItem makeItemBlock(Block block, @Nullable Function extraPropFunc) {
- Item.Properties prop = createInitialProp();
- return new BlockItem(block, extraPropFunc != null ? extraPropFunc.apply(prop) : prop);
- }
-
- private static RegistryObject registerWithItem(final String name, final Supplier blockSupplier, @Nullable Function extraPropFunc) {
- return register(name, blockSupplier, (b) -> makeItemBlock(b.get(), extraPropFunc));
- }
-
- private static RegistryObject registerWithItem(final String name, final Supplier blockSupplier) {
- return register(name, blockSupplier, (b) -> makeItemBlock(b.get()));
- }
-
- private static RegistryObject register(final String name, final Supplier blockSupplier, final Function, Item> itemFunction) {
- RegistryObject blockObj = register(name, blockSupplier);
- ITEMS.register(name, () -> itemFunction.apply(blockObj));
- return blockObj;
- }
-
- private static RegistryObject register(final String name, final Supplier blockSupplier) {
- return BLOCKS.register(name, blockSupplier);
- }
-
-}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModItemGroups.java b/src/main/java/com/sweetrpg/crafttracker/common/registry/ModItemGroups.java
deleted file mode 100644
index 5a8c6a9..0000000
--- a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModItemGroups.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.sweetrpg.crafttracker.common.registry;
-
-import net.minecraft.world.item.CreativeModeTab;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.item.Items;
-
-import java.util.function.Supplier;
-
-public class ModItemGroups {
-
- public static final CreativeModeTab GENERAL = new CustomItemGroup("CraftTracker", () -> new ItemStack(Items.CRAFTING_TABLE));
-
- public static class CustomItemGroup extends CreativeModeTab {
-
- private Supplier icon;
-
- public CustomItemGroup(String label, Supplier iconIn) {
- super(label);
- this.icon = iconIn;
- }
-
- @Override
- public ItemStack makeIcon() {
- return this.icon.get();
- }
- }
-}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModItems.java b/src/main/java/com/sweetrpg/crafttracker/common/registry/ModItems.java
deleted file mode 100644
index e5d2968..0000000
--- a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModItems.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.sweetrpg.crafttracker.common.registry;
-
-import com.sweetrpg.crafttracker.common.lib.Constants;
-import net.minecraft.world.item.Item;
-import net.minecraftforge.registries.DeferredRegister;
-import net.minecraftforge.registries.ForgeRegistries;
-import net.minecraftforge.registries.RegistryObject;
-
-import javax.annotation.Nullable;
-import java.util.function.Function;
-import java.util.function.Supplier;
-
-public class ModItems {
-
- public static final DeferredRegister
- ITEMS = DeferredRegister.create(ForgeRegistries.Keys.ITEMS, Constants.MOD_ID);
-
- private static Item.Properties createInitialProp() {
- return new Item.Properties().tab(ModItemGroups.GENERAL);
- }
-
- private static RegistryObject registerWith(final String name, Function itemConstructor, int maxStackSize) {
- return register(name, () -> itemConstructor.apply(createInitialProp().stacksTo(maxStackSize)));
- }
-
- private static RegistryObject register(final String name, Function itemConstructor) {
- return register(name, () -> itemConstructor.apply(createInitialProp()));
- }
-
- private static RegistryObject
- register(final String name) {
- return registerWith(name, null);
- }
-
- private static RegistryObject
- registerWith(final String name, @Nullable Function extraPropFunc) {
- Item.Properties prop = createInitialProp();
- return register(name, () -> new Item(extraPropFunc != null ? extraPropFunc.apply(prop) : prop));
- }
-
- private static RegistryObject register(final String name, final Supplier sup) {
- return ITEMS.register(name, sup);
- }
-
-}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModRecipeSerializers.java b/src/main/java/com/sweetrpg/crafttracker/common/registry/ModRecipeSerializers.java
deleted file mode 100644
index b0f4a08..0000000
--- a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModRecipeSerializers.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.sweetrpg.crafttracker.common.registry;
-
-import com.sweetrpg.crafttracker.common.lib.Constants;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.world.item.crafting.Recipe;
-import net.minecraft.world.item.crafting.RecipeSerializer;
-import net.minecraft.world.item.crafting.SimpleRecipeSerializer;
-import net.minecraftforge.registries.DeferredRegister;
-import net.minecraftforge.registries.ForgeRegistries;
-import net.minecraftforge.registries.RegistryObject;
-
-import java.util.function.Function;
-import java.util.function.Supplier;
-
-public class ModRecipeSerializers {
-
- public static final DeferredRegister> RECIPE_SERIALIZERS = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, Constants.MOD_ID);
-
- private static , T extends RecipeSerializer> RegistryObject> register(final String name, Function factory) {
- return register(name, () -> new SimpleRecipeSerializer<>(factory));
- }
-
- private static > RegistryObject register(final String name, final Supplier sup) {
- return RECIPE_SERIALIZERS.register(name, sup);
- }
-}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModRegistries.java b/src/main/java/com/sweetrpg/crafttracker/common/registry/ModRegistries.java
deleted file mode 100644
index 551c5df..0000000
--- a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModRegistries.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.sweetrpg.crafttracker.common.registry;
-
-import net.minecraft.resources.ResourceLocation;
-import net.minecraftforge.registries.NewRegistryEvent;
-import net.minecraftforge.registries.RegistryBuilder;
-
-public class ModRegistries {
-
- protected class Keys {
- }
-
- public static void newRegistry(NewRegistryEvent event) {
- }
-
- private static RegistryBuilder makeRegistry(final ResourceLocation rl, Class type) {
- return new RegistryBuilder().setName(rl);
- }
-
-}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModSounds.java b/src/main/java/com/sweetrpg/crafttracker/common/registry/ModSounds.java
deleted file mode 100644
index 9605da8..0000000
--- a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModSounds.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.sweetrpg.crafttracker.common.registry;
-
-import com.sweetrpg.crafttracker.common.lib.Constants;
-import com.sweetrpg.crafttracker.common.util.Util;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.sounds.SoundEvent;
-import net.minecraftforge.registries.DeferredRegister;
-import net.minecraftforge.registries.ForgeRegistries;
-import net.minecraftforge.registries.RegistryObject;
-
-import java.util.function.Function;
-import java.util.function.Supplier;
-
-public class ModSounds {
-
- public static final DeferredRegister SOUNDS = DeferredRegister.create(ForgeRegistries.Keys.SOUND_EVENTS, Constants.MOD_ID);
-
- private static RegistryObject register(final String name) {
- return register(name, SoundEvent::new);
- }
-
- private static RegistryObject register(final String name, final Function factory) {
- return register(name, () -> factory.apply(Util.getResource(name)));
- }
-
- private static RegistryObject register(final String name, final Supplier sup) {
- return SOUNDS.register(name, sup);
- }
-}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModTags.java b/src/main/java/com/sweetrpg/crafttracker/common/registry/ModTags.java
deleted file mode 100644
index 377c46b..0000000
--- a/src/main/java/com/sweetrpg/crafttracker/common/registry/ModTags.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.sweetrpg.crafttracker.common.registry;
-
-import com.sweetrpg.crafttracker.common.util.Util;
-import net.minecraft.tags.BlockTags;
-import net.minecraft.tags.ItemTags;
-import net.minecraft.tags.TagKey;
-import net.minecraft.world.item.Item;
-import net.minecraft.world.level.block.Block;
-
-public class ModTags {
-
- private static TagKey
- modItemTag(String name) {
- return ItemTags.create(Util.getResource(name));
- }
-
- private static TagKey modBlockTag(String name) {
- return BlockTags.create(Util.getResource(name));
- }
-
-// private static TagKey> tag(String path) {
-// return EntityTypeTags.bind(Util.getResourcePath(path));
-// }
-}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/util/AdvancementUtil.java b/src/main/java/com/sweetrpg/crafttracker/common/util/AdvancementUtil.java
index f6f44b9..220a32a 100644
--- a/src/main/java/com/sweetrpg/crafttracker/common/util/AdvancementUtil.java
+++ b/src/main/java/com/sweetrpg/crafttracker/common/util/AdvancementUtil.java
@@ -16,6 +16,6 @@ public static void trigger(ModAdvancements.Key advancement, ServerPlayer player)
if(ModTriggers.ENTRIES.get(ct.getCriterion().getPath()) instanceof SimpleTrigger trigger) {
trigger.trigger(player);
}
-
}
+
}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/util/Cache.java b/src/main/java/com/sweetrpg/crafttracker/common/util/Cache.java
deleted file mode 100644
index f2bdc98..0000000
--- a/src/main/java/com/sweetrpg/crafttracker/common/util/Cache.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.sweetrpg.crafttracker.common.util;
-
-import java.util.Optional;
-import java.util.function.Predicate;
-import java.util.function.Supplier;
-
-public class Cache implements Supplier {
-
- private final Supplier getter;
- private Optional value;
-
- private Cache(Supplier getterIn) {
- this.getter = getterIn;
- }
-
- @Override
- public T get() {
- if (this.value == null) {
- this.value = Optional.ofNullable(this.getter.get());
- }
-
- return this.value.orElse(null);
- }
-
- public boolean test(Predicate pred) {
- return pred.test(this.get());
- }
-
- public void markForRefresh() {
- this.value = null;
- }
-
- public static Cache make(Supplier getterIn) {
- return new Cache<>(getterIn);
- }
-
-}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/util/DebugUtil.java b/src/main/java/com/sweetrpg/crafttracker/common/util/DebugUtil.java
index cb239e8..dcff676 100644
--- a/src/main/java/com/sweetrpg/crafttracker/common/util/DebugUtil.java
+++ b/src/main/java/com/sweetrpg/crafttracker/common/util/DebugUtil.java
@@ -23,26 +23,24 @@ public class DebugUtil {
public static String printIngredient(Ingredient ingredient) {
StringBuilder builder = new StringBuilder();
- builder.append("Ingredient{\n");
+ builder.append("Ingredient{ ");
- builder.append("\titems=[\n");
+ builder.append("items=[ ");
Arrays.stream(ingredient.getItems())
.forEach(i -> {
- builder.append("\t\tregistryName=");
+ builder.append("registryName=");
builder.append(ForgeRegistries.ITEMS.getKey(i.getItem()));
- builder.append("\n");
- builder.append("\t\ttags=[");
+ builder.append(", tags=[");
builder.append(String.join(",", i.getTags().map(TagKey::toString).toList()));
- builder.append("]\n");
+ builder.append("]");
- builder.append("\t\tcount=");
+ builder.append(", count=");
builder.append(i.getCount());
- builder.append("\n");
});
- builder.append("\t]\n");
+ builder.append(" ]");
- builder.append("}");
+ builder.append(" }");
return builder.toString();
}
@@ -56,21 +54,19 @@ public static String printIngredient(Ingredient ingredient) {
public static String printItemStack(ItemStack itemStack) {
StringBuilder builder = new StringBuilder();
- builder.append("ItemStack{\n");
+ builder.append("ItemStack{ ");
- builder.append("\tregistryName=");
+ builder.append("registryName=");
builder.append(ForgeRegistries.ITEMS.getKey(itemStack.getItem()));
- builder.append("\n");
- builder.append("\tcount=");
+ builder.append(", count=");
builder.append(itemStack.getCount());
- builder.append("\n");
- builder.append("\ttags=[");
+ builder.append(", tags=[");
builder.append(String.join(",", itemStack.getTags().map(TagKey::toString).toList()));
- builder.append("]\n");
+ builder.append("]");
- builder.append("}");
+ builder.append(" }");
return builder.toString();
}
@@ -84,12 +80,12 @@ public static String printItemStack(ItemStack itemStack) {
public static String printItem(Item item) {
StringBuilder builder = new StringBuilder();
- builder.append("Item{");
+ builder.append("Item{ ");
builder.append("registryName=");
builder.append(ForgeRegistries.ITEMS.getKey(item));
- builder.append("}");
+ builder.append(" }");
return builder.toString();
}
@@ -103,23 +99,21 @@ public static String printItem(Item item) {
public static String printRecipe(Recipe> recipe) {
StringBuilder builder = new StringBuilder();
- builder.append("Recipe{\n");
+ builder.append("Recipe{ ");
- builder.append("\tid=");
+ builder.append("id=");
builder.append(recipe.getId());
- builder.append("\n");
- builder.append("\tresultItem=");
+ builder.append(", resultItem=");
builder.append(DebugUtil.printItemStack(recipe.getResultItem()));
- builder.append("\n");
- builder.append("\tingredients=[\n\t\t");
- builder.append(String.join(",\n\t\t", recipe.getIngredients().stream()
+ builder.append(", ingredients=[ ");
+ builder.append(String.join(",", recipe.getIngredients().stream()
.map(DebugUtil::printIngredient)
.toList()));
- builder.append("\t]\n");
+ builder.append(" ]");
- builder.append("}");
+ builder.append(" }");
return builder.toString();
}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/util/RecipeUtil.java b/src/main/java/com/sweetrpg/crafttracker/common/util/RecipeUtil.java
index e8f09a5..aa27301 100644
--- a/src/main/java/com/sweetrpg/crafttracker/common/util/RecipeUtil.java
+++ b/src/main/java/com/sweetrpg/crafttracker/common/util/RecipeUtil.java
@@ -1,22 +1,22 @@
package com.sweetrpg.crafttracker.common.util;
import com.sweetrpg.crafttracker.CraftTracker;
-import com.sweetrpg.crafttracker.common.lib.Constants;
+import com.sweetrpg.crafttracker.common.util.calc.ItemCostCalculator;
+import com.sweetrpg.crafttracker.common.util.calc.RecipeCostCalculator;
import net.minecraft.client.Minecraft;
import net.minecraft.core.NonNullList;
import net.minecraft.resources.ResourceLocation;
-import net.minecraft.tags.TagKey;
import net.minecraft.util.Tuple;
-import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.item.crafting.CraftingRecipe;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraftforge.registries.ForgeRegistries;
import org.apache.commons.lang3.ObjectUtils;
-import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
import java.util.stream.Collectors;
/**
@@ -24,46 +24,6 @@
*/
public class RecipeUtil {
- public static final float NON_VANILLA_COST_MULTIPLIER = 1.2f;
- public static final float NON_CRAFTING_COST_MULTIPLIER = 1.25f;
-
- private static Map ingredientCostsByTag = new HashMap<>();
- private static Map ingredientCostOverrides = new HashMap<>();
-
- static {
- var mgr = Minecraft.getInstance().getResourceManager();
-
- var ingCostsResource = new ResourceLocation(Constants.MOD_ID, "ingredient-costs.properties");
- try {
- var costs = mgr.getResource(ingCostsResource);
- var props = new Properties();
- props.load(costs.get().open());
- props.entrySet().forEach(entry -> {
- var key = new ResourceLocation((String) entry.getKey());
- var value = Integer.parseInt((String) entry.getValue());
- ingredientCostsByTag.put(key, value);
- });
- }
- catch (IOException e) {
- CraftTracker.LOGGER.error("I/O exception when trying to load ingredient costs file", e);
- }
-
- var ingOverridesResource = new ResourceLocation(Constants.MOD_ID, "ingredient-overrides.properties");
- try {
- var costs = mgr.getResource(ingOverridesResource);
- var props = new Properties();
- props.load(costs.get().open());
- props.entrySet().forEach(entry -> {
- var key = new ResourceLocation((String) entry.getKey());
- var value = Integer.parseInt((String) entry.getValue());
- ingredientCostOverrides.put(key, value);
- });
- }
- catch (IOException e) {
- CraftTracker.LOGGER.error("I/O exception when trying to load ingredient overrides file", e);
- }
- }
-
/**
* Looks up recipes that will output the specified item
*
@@ -122,145 +82,6 @@ public static boolean areIngredientsSameNamespace(String namespace, NonNullList<
return ing.size() == 1;
}
- /**
- * Calculates the "cost" of a recipe.
- *
- * Computes the cost of a recipe from:
- * - the sum of its ingredients' costs
- * - whether the recipe is "vanilla"
- * - whether the recipe is "simple" (crafted vs. smelted, etc.)
- *
- * @param recipe The recipe to calculate
- * @return A integer value of the recipe's cost
- */
- public static int calculateRecipeCost(Recipe> recipe) {
- CraftTracker.LOGGER.debug("RecipeUtil#calculateRecipeCost: {}", DebugUtil.printRecipe(recipe));
-
- int cost = recipe.getIngredients().stream()
- .map(RecipeUtil::calculateIngredientCost)
- .reduce(0, Integer::sum);
-
- // if the item's namespace is not 'minecraft:', increase the cost
- if(!recipe.getId().getNamespace().equals("minecraft")) {
- CraftTracker.LOGGER.debug("RecipeUtil#calculateRecipeCost: increasing cost ({}) of non-vanilla recipe {} by {}",
- cost, DebugUtil.printRecipe(recipe), NON_VANILLA_COST_MULTIPLIER);
- cost = (int) (cost * NON_VANILLA_COST_MULTIPLIER);
- }
-
- if(!(recipe instanceof CraftingRecipe)) {
- CraftTracker.LOGGER.debug("RecipeUtil#calculateRecipeCost: increasing cost ({}) of non-crafting table recipe {} by {}",
- cost, DebugUtil.printRecipe(recipe), NON_CRAFTING_COST_MULTIPLIER);
- cost = (int) (cost * NON_VANILLA_COST_MULTIPLIER);
- }
-
- return cost;
- }
-
- /**
- * Calculates the cost of an ingredient
- *
- * Computes the cost of an ingredient by looking at the constituent items (i.e., if the ingredient is a tag, looking
- * at the cost of items that match the tag).
- * An item's cost can be set in the override list.
- * The ultimate cost of an ingredient will be the highest cost of the items matching its tag.
- *
- * @param ingredient The ingredient to calculate
- * @return An integer value of the ingredient's cost
- */
- public static int calculateIngredientCost(Ingredient ingredient) {
- CraftTracker.LOGGER.debug("RecipeUtil#getIngredientCost: {}", DebugUtil.printIngredient(ingredient));
-
- for(ItemStack stack : ingredient.getItems()) {
- // is the item in the override list?
- var itemId = ForgeRegistries.ITEMS.getKey(stack.getItem());
- var count = stack.getCount();
-
- if(ingredientCostOverrides.containsKey(itemId)) {
- CraftTracker.LOGGER.debug("found item {} in override list", itemId);
- return ingredientCostOverrides.get(itemId) * count;
- }
-
- // it's not, so check its tags
- int highestCost = 0;
- for(TagKey
- tag : stack.getTags().toList()) {
- var tagId = tag.location();
- if(ingredientCostsByTag.containsKey(tagId)) {
- CraftTracker.LOGGER.debug("found item {} in tag list", tagId);
- int cost = ingredientCostsByTag.get(tagId) * count;
-
- // if the item's namespace is not 'minecraft:', increase the cost
- if(!ObjectUtils.defaultIfNull(ForgeRegistries.ITEMS.getKey(stack.getItem()).getNamespace(), "").equals("minecraft") &&
- !ObjectUtils.defaultIfNull(tagId.getNamespace(), "").equals("minecraft")) {
- CraftTracker.LOGGER.debug("RecipeUtil#calculateRecipeCost: increasing cost ({}) of non-vanilla item {} by {}",
- cost, tagId, NON_VANILLA_COST_MULTIPLIER);
- cost = (int) (cost * NON_VANILLA_COST_MULTIPLIER);
- }
-
- if(cost > highestCost) {
- highestCost = cost;
- }
- }
- }
- if(highestCost > 0) {
- return highestCost;
- }
- }
-
- CraftTracker.LOGGER.debug("#calculateIngredientCost: fell through to default cost");
- return 1;
- }
-
- /**
- * Calculates the cost of an item stack
- *
- * The logic here is the same as for {@link #calculateIngredientCost(Ingredient)}, except that it applies to an
- * {@link ItemStack}. See that method's documentation for details, with the caveat that this method will fall
- * back on an item's rarity if all other calculations are insufficient.
- *
- * @param stack The stack to calculate
- * @return An integer value of the item stack's cost
- */
- public static int calculateItemCost(ItemStack stack) {
- CraftTracker.LOGGER.debug("#calculateItemCost: {}", DebugUtil.printItemStack(stack));
-
- var itemId = ForgeRegistries.ITEMS.getKey(stack.getItem());
- var count = stack.getCount();
-
- if(ingredientCostOverrides.containsKey(itemId)) {
- CraftTracker.LOGGER.debug("found item {} in override list", itemId);
- return ingredientCostOverrides.get(itemId) * count;
- }
-
- // it's not, so check its tags
- int highestCost = 0;
- for(TagKey
- tag : stack.getTags().toList()) {
- var tagId = tag.location();
- if(ingredientCostsByTag.containsKey(tagId)) {
- CraftTracker.LOGGER.debug("found item {} in tag list", tagId);
- int cost = ingredientCostsByTag.get(tagId) * count;
-
- // if the item's namespace is not 'minecraft:', increase the cost
- if(!ObjectUtils.defaultIfNull(ForgeRegistries.ITEMS.getKey(stack.getItem()).getNamespace(), "").equals("minecraft") &&
- !ObjectUtils.defaultIfNull(tagId.getNamespace(), "").equals("minecraft")) {
- CraftTracker.LOGGER.debug("RecipeUtil#calculateItemCost: increasing cost ({}) of non-vanilla item {} by {}",
- cost, tagId, NON_VANILLA_COST_MULTIPLIER);
- cost = (int) (cost * NON_VANILLA_COST_MULTIPLIER);
- }
-
- if(cost > highestCost) {
- highestCost = (int) cost;
- }
- }
- }
- if(highestCost > 0) {
- return highestCost;
- }
-
- CraftTracker.LOGGER.debug("#calculateIngredientCost: fell through to rarity");
- var rarity = stack.getItem().getRarity(stack);
- return Math.max(rarity.ordinal() * count, count);
- }
-
/**
* Given a list of recipes, return the one that is least expensive.
*
@@ -277,12 +98,15 @@ public static Recipe> chooseLeastExpensiveOf(List extends Recipe>> recipes
List, Integer>> recipeCosts = new ArrayList<>();
for(Recipe> recipe : recipes) {
- var cost = RecipeUtil.calculateRecipeCost(recipe);
+ CraftTracker.LOGGER.debug("recipe: {}", DebugUtil.printRecipe(recipe));
+ var cost = new RecipeCostCalculator(recipe).calculate();
+ CraftTracker.LOGGER.debug("cost: {}", cost);
var tuple = new Tuple<>(recipe, cost);
recipeCosts.add(tuple);
}
+ CraftTracker.LOGGER.debug("sorting recipes");
recipeCosts.sort((rc1, rc2) -> {
var result = rc1.getB().compareTo(rc2.getB());
if(result == 0) {
@@ -291,7 +115,9 @@ public static Recipe> chooseLeastExpensiveOf(List extends Recipe>> recipes
return result;
});
- return recipeCosts.get(0).getA();
+ var itemToReturn = recipeCosts.get(0).getA();
+ CraftTracker.LOGGER.debug("returning top item from sorted recipes: {}", DebugUtil.printRecipe(itemToReturn));
+ return itemToReturn;
}
/**
@@ -304,18 +130,30 @@ public static ItemStack chooseLeastExpensiveOf(ItemStack[] stacks) {
CraftTracker.LOGGER.debug("RecipeUtil#chooseLeastExpensiveOf: {}", Arrays.stream(stacks).map(DebugUtil::printItemStack).toList());
if(stacks.length == 1) {
+ CraftTracker.LOGGER.debug("only 1 item in the stack; returning that");
return stacks[0];
}
List> itemCosts = new ArrayList<>();
for(ItemStack stack : stacks) {
- var cost = RecipeUtil.calculateItemCost(stack);
+ CraftTracker.LOGGER.debug("stack: {}", DebugUtil.printItemStack(stack));
+ var cost = new ItemCostCalculator(stack).calculate();
+ CraftTracker.LOGGER.debug("cost: {}", cost);
var tuple = new Tuple<>(stack, cost);
itemCosts.add(tuple);
}
+ CraftTracker.LOGGER.debug("Considering the costs of {} items:", itemCosts.size());
+ itemCosts.forEach(t -> {
+ var s = t.getA();
+ var c = t.getB();
+
+ CraftTracker.LOGGER.debug("item: {}, cost: {}", ForgeRegistries.ITEMS.getKey(s.getItem()), c);
+ });
+
+ CraftTracker.LOGGER.debug("sorting items");
itemCosts.sort((rc1, rc2) -> {
var result = rc1.getB().compareTo(rc2.getB());
if(result == 0) {
@@ -325,7 +163,9 @@ public static ItemStack chooseLeastExpensiveOf(ItemStack[] stacks) {
return result;
});
- return itemCosts.get(0).getA();
+ var itemToReturn = itemCosts.get(0).getA();
+ CraftTracker.LOGGER.debug("returning top item from sorted items: {}", DebugUtil.printItemStack(itemToReturn));
+ return itemToReturn;
}
}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/util/TextUtils.java b/src/main/java/com/sweetrpg/crafttracker/common/util/TextUtils.java
deleted file mode 100644
index 7b8987e..0000000
--- a/src/main/java/com/sweetrpg/crafttracker/common/util/TextUtils.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.sweetrpg.crafttracker.common.util;
-
-import com.sweetrpg.crafttracker.common.lib.Constants;
-import net.minecraft.ChatFormatting;
-import net.minecraft.network.chat.Component;
-import net.minecraft.network.chat.MutableComponent;
-
-public class TextUtils {
- private static final MutableComponent NO_EFFECTS = (Component.translatable("effect.none")).withStyle(ChatFormatting.GRAY);
-
- /**
- * Syntactic sugar for custom translation keys. Always prefixed with the mod's ID in lang files (e.g. crafttracker.your.key.here).
- */
- public static MutableComponent getTranslation(String type, String key, Object... args) {
- return Component.translatable(type + "." + Constants.MOD_ID + "." + key, args);
- }
-
-}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/util/Util.java b/src/main/java/com/sweetrpg/crafttracker/common/util/Util.java
index 09baeae..55fbb13 100644
--- a/src/main/java/com/sweetrpg/crafttracker/common/util/Util.java
+++ b/src/main/java/com/sweetrpg/crafttracker/common/util/Util.java
@@ -1,24 +1,14 @@
package com.sweetrpg.crafttracker.common.util;
-import com.google.common.collect.Lists;
import com.sweetrpg.crafttracker.common.lib.Constants;
-import io.netty.buffer.Unpooled;
import net.minecraft.client.Minecraft;
-import net.minecraft.core.Holder;
-import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
-import net.minecraft.world.item.DyeColor;
import net.minecraftforge.fml.loading.FMLPaths;
-import net.minecraftforge.registries.RegistryObject;
import java.io.File;
import java.nio.file.Path;
import java.text.DecimalFormat;
-import java.util.*;
-import java.util.function.Consumer;
-import java.util.function.Predicate;
-import java.util.function.Supplier;
-import java.util.stream.Collectors;
+import java.util.Locale;
/**
* Miscellaneous utilities.
@@ -62,78 +52,6 @@ public static Path getStoragePath() {
return STORAGE_DIR.resolve(addressPath).normalize();
}
- public static String format1DP(double value) {
- return Util.dfShort.format(value);
- }
-
- public static String format2DP(double value) {
- return Util.dfShortDouble.format(value);
- }
-
- public static boolean isPointInRegion(int x, int y, int width, int height, double mouseX, double mouseY) {
- return mouseX >= x - 1 && mouseX < x + width + 1 && mouseY >= y - 1 && mouseY < y + height + 1;
- }
-
- public static float[] rgbIntToFloatArray(int rgbInt) {
- int r = (rgbInt >> 16) & 255;
- int g = (rgbInt >> 8) & 255;
- int b = (rgbInt >> 0) & 255;
-
- return new float[]{r / 255F, g / 255F, b / 255F};
- }
-
- public static int[] rgbIntToIntArray(int rgbInt) {
- int r = (rgbInt >> 16) & 255;
- int g = (rgbInt >> 8) & 255;
- int b = (rgbInt >> 0) & 255;
-
- return new int[]{r, g, b};
- }
-
- public static int colorDye(int startColor, DyeColor dye) {
- return colorDye(startColor, Lists.newArrayList(dye));
- }
-
- public static int colorDye(int startColor, Collection dyes) {
- List colors = dyes.stream()
- .mapToInt(DyeColor::getTextColor)
- .mapToObj(Util::rgbIntToIntArray)
- .collect(Collectors.toList());
-
- if(startColor != -1) {
- colors.add(0, rgbIntToIntArray(startColor));
- }
-
- return colorDye(colors);
- }
-
- public static int colorDye(Collection colors) {
- int[] temp = new int[3];
- int maxCompSum = 0;
-
- for(int[] color : colors) {
- maxCompSum += Math.max(color[0], Math.max(color[1], color[2]));
- temp[0] += color[0];
- temp[1] += color[1];
- temp[2] += color[2];
- }
-
- int redAve = temp[0] / colors.size();
- int greenAve = temp[1] / colors.size();
- int blueAve = temp[2] / colors.size();
-
- float maxAve = (float) maxCompSum / (float) colors.size();
- float max = Math.max(redAve, Math.max(greenAve, blueAve));
-
- redAve = (int) (redAve * maxAve / max);
- greenAve = (int) (greenAve * maxAve / max);
- blueAve = (int) (blueAve * maxAve / max);
-
- int finalColor = (redAve << 8) + greenAve;
- finalColor = (finalColor << 8) + blueAve;
- return finalColor;
- }
-
/**
* @param name The path of the resource
*/
@@ -166,88 +84,4 @@ public static String getResourcePath(String modId, String name) {
return getResource(modId, name).toString();
}
- public static FriendlyByteBuf createBuf() {
- return new FriendlyByteBuf(Unpooled.buffer());
- }
-
- // From net.minecraft.util.Util
- public static T make(Supplier supplier) {
- return supplier.get();
- }
-
- // From net.minecraft.util.Util
- public static T make(T object, Consumer consumer) {
- consumer.accept(object);
- return object;
- }
-
- // From net.minecraft.util.Util but for RegistryObject
- public static RegistryObject acceptOrElse(RegistryObject opt, Consumer consumer, Runnable orElse) {
- if(opt.isPresent()) {
- consumer.accept(opt.get());
- }
- else {
- orElse.run();
- }
-
- return opt;
- }
-
- public static Optional acceptOrElse(Optional opt, Consumer consumer, Runnable orElse) {
- if(opt.isPresent()) {
- consumer.accept(opt.get());
- }
- else {
- orElse.run();
- }
-
- return opt;
- }
-
- public static boolean allMatch(Iterable input, Predicate matcher) {
- Objects.requireNonNull(matcher);
- for(T e : input) {
- if(!matcher.test(e)) {
- return false;
- }
- }
- return true;
- }
-
- public static boolean anyMatch(Iterable input, Predicate matcher) {
- Objects.requireNonNull(matcher);
- for(T e : input) {
- if(matcher.test(e)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Takes various registry related objects and returns the
- * registry id of the object it is representing
- */
- public static ResourceLocation getRegistryId(Object obj) {
- if(obj instanceof ResourceLocation) {
- return (ResourceLocation) obj;
- }
-
- if(obj instanceof String) {
- // Returns null when namespace or path contain invalid
- // characters
- return ResourceLocation.tryParse((String) obj);
- }
-
- if(obj instanceof Holder.Reference) {
- return ((Holder.Reference) obj).key().location();
- }
-
- if(obj instanceof RegistryObject) {
- return ((RegistryObject) obj).getId();
- }
-
- return null;
- }
-
}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/util/calc/ICostCalculator.java b/src/main/java/com/sweetrpg/crafttracker/common/util/calc/ICostCalculator.java
new file mode 100644
index 0000000..7b03ce9
--- /dev/null
+++ b/src/main/java/com/sweetrpg/crafttracker/common/util/calc/ICostCalculator.java
@@ -0,0 +1,7 @@
+package com.sweetrpg.crafttracker.common.util.calc;
+
+public interface ICostCalculator {
+
+ int calculate();
+
+}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/util/calc/IngredientCostCalculator.java b/src/main/java/com/sweetrpg/crafttracker/common/util/calc/IngredientCostCalculator.java
new file mode 100644
index 0000000..16c4907
--- /dev/null
+++ b/src/main/java/com/sweetrpg/crafttracker/common/util/calc/IngredientCostCalculator.java
@@ -0,0 +1,97 @@
+package com.sweetrpg.crafttracker.common.util.calc;
+
+import com.sweetrpg.crafttracker.CraftTracker;
+import com.sweetrpg.crafttracker.common.config.ConfigHandler;
+import com.sweetrpg.crafttracker.common.util.DebugUtil;
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.tags.TagKey;
+import net.minecraft.world.item.Item;
+import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.item.crafting.Ingredient;
+import net.minecraftforge.registries.ForgeRegistries;
+import org.apache.commons.lang3.ObjectUtils;
+
+/**
+ * Calculates the cost of an ingredient
+ *
+ * Computes the cost of an ingredient by looking at the constituent items (i.e., if the ingredient is a tag, looking
+ * at the cost of items that match the tag).
+ * An item's cost can be set in the override list.
+ * The ultimate cost of an ingredient will be the highest cost of the items matching its tag.
+ */
+public class IngredientCostCalculator implements ICostCalculator {
+
+ private final Ingredient ingredient;
+
+ /**
+ * Default constructor.
+ *
+ * @param ingredient The ingredient to calculate
+ */
+ public IngredientCostCalculator(Ingredient ingredient) {
+ this.ingredient = ingredient;
+ }
+
+ /**
+ * Perform the calculation.
+ *
+ * @return An integer value of the ingredient's cost
+ */
+ @Override
+ public int calculate() {
+ CraftTracker.LOGGER.debug("#getIngredientCost: {}", DebugUtil.printIngredient(ingredient));
+
+ for(ItemStack stack : ingredient.getItems()) {
+ CraftTracker.LOGGER.debug("stack: {}", DebugUtil.printItemStack(stack));
+
+ // is the item in the override list?
+ var itemId = ForgeRegistries.ITEMS.getKey(stack.getItem());
+ var count = stack.getCount();
+
+ if(ConfigHandler.COMMON.overrideEntries.containsKey(itemId)) {
+ CraftTracker.LOGGER.debug("found item {} in override list", itemId);
+ return ConfigHandler.COMMON.overrideEntries.get(itemId).get() * count;
+ }
+
+ // it's not, so check its tags
+ int highestCost = 0;
+ for(TagKey
- tag : stack.getTags().toList()) {
+ var tagId = tag.location();
+ CraftTracker.LOGGER.debug("looking at tagId: {}", tagId);
+
+ if(ConfigHandler.COMMON.tagEntries.containsKey(tagId)) {
+ CraftTracker.LOGGER.debug("found tag {} in tag list", tagId);
+
+ int cost = ConfigHandler.COMMON.tagEntries.get(tagId).get() * count;
+ CraftTracker.LOGGER.debug("cost of tag {} is {}", tagId, cost);
+
+ // adjust the cost by the namespace's multiplier
+ var tagNamespace = ObjectUtils.defaultIfNull(ForgeRegistries.ITEMS.getKey(stack.getItem()), new ResourceLocation("", "")).getNamespace();
+ CraftTracker.LOGGER.debug("tagNamespace: {}", tagNamespace);
+ var multiplier = ConfigHandler.COMMON.namespaceEntries.get(tagNamespace);
+ CraftTracker.LOGGER.debug("multiplier: {}", multiplier);
+
+ if(multiplier != null) {
+ var newCost = (int) (cost * multiplier.get());
+ CraftTracker.LOGGER.debug("#calculate: increasing cost of tag {} in namespace {} by {}: from {} to {}",
+ tagId, tagNamespace, multiplier.get(),
+ cost, newCost);
+ cost = newCost;
+ }
+
+ if(cost > highestCost) {
+ CraftTracker.LOGGER.trace("replacing highestCost with new value: was {}, is {}", highestCost, cost);
+ highestCost = cost;
+ }
+ }
+ }
+ if(highestCost > 0) {
+ CraftTracker.LOGGER.debug("returning highest cost: {}", highestCost);
+ return highestCost;
+ }
+ }
+
+ CraftTracker.LOGGER.debug("#calculateIngredientCost: fell through to default cost");
+ return 1;
+ }
+}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/util/calc/ItemCostCalculator.java b/src/main/java/com/sweetrpg/crafttracker/common/util/calc/ItemCostCalculator.java
new file mode 100644
index 0000000..6de2c63
--- /dev/null
+++ b/src/main/java/com/sweetrpg/crafttracker/common/util/calc/ItemCostCalculator.java
@@ -0,0 +1,90 @@
+package com.sweetrpg.crafttracker.common.util.calc;
+
+import com.sweetrpg.crafttracker.CraftTracker;
+import com.sweetrpg.crafttracker.common.config.ConfigHandler;
+import com.sweetrpg.crafttracker.common.util.DebugUtil;
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.tags.TagKey;
+import net.minecraft.world.item.Item;
+import net.minecraft.world.item.ItemStack;
+import net.minecraftforge.registries.ForgeRegistries;
+import org.apache.commons.lang3.ObjectUtils;
+
+/**
+ * Calculates the cost of an item stack
+ *
+ * The logic here is the same as for {@link IngredientCostCalculator}, except that it applies to an
+ * {@link ItemStack}. See that method's documentation for details, with the caveat that this method will fall
+ * back on an item's rarity if all other calculations are insufficient.
+ */
+public class ItemCostCalculator implements ICostCalculator {
+
+ private final ItemStack stack;
+
+ /**
+ * Default constructor.
+ *
+ * @param stack The stack to calculate
+ */
+ public ItemCostCalculator(ItemStack stack) {
+ this.stack = stack;
+ }
+
+ /**
+ * Perform the calculation.
+ *
+ * @return An integer value of the item stack's cost
+ */
+ @Override
+ public int calculate() {
+ CraftTracker.LOGGER.debug("#calculateItemCost: {}", DebugUtil.printItemStack(stack));
+
+ var itemId = ForgeRegistries.ITEMS.getKey(stack.getItem());
+ var count = stack.getCount();
+
+ if(ConfigHandler.COMMON.overrideEntries.containsKey(itemId)) {
+ CraftTracker.LOGGER.debug("found item {} in override list", itemId);
+ return ConfigHandler.COMMON.overrideEntries.get(itemId).get() * count;
+ }
+
+ // it's not, so check its tags
+ int highestCost = 0;
+ for(TagKey
- tag : stack.getTags().toList()) {
+ var tagId = tag.location();
+ CraftTracker.LOGGER.debug("looking at tagId: {}", tagId);
+
+ if(ConfigHandler.COMMON.tagEntries.containsKey(tagId)) {
+ CraftTracker.LOGGER.debug("found item {} in tag list", tagId);
+
+ int cost = ConfigHandler.COMMON.tagEntries.get(tagId).get() * count;
+ CraftTracker.LOGGER.debug("cost of tag {} is {}", tagId, cost);
+
+ var tagNamespace = ObjectUtils.defaultIfNull(ForgeRegistries.ITEMS.getKey(stack.getItem()), new ResourceLocation("", "")).getNamespace();
+ CraftTracker.LOGGER.debug("tagNamespace: {}", tagNamespace);
+ var multiplier = ConfigHandler.COMMON.namespaceEntries.get(tagNamespace);
+ CraftTracker.LOGGER.debug("multiplier: {}", multiplier);
+
+ if(multiplier != null) {
+ var newCost = (int) (cost * multiplier.get());
+ CraftTracker.LOGGER.debug("#calculate: increasing cost of tag {} in namespace {} by {}: from {} to {}",
+ tagId, tagNamespace, multiplier.get(),
+ cost, newCost);
+ cost = newCost;
+ }
+
+ if(cost > highestCost) {
+ CraftTracker.LOGGER.trace("replacing highestCost with new value: was {}, is {}", highestCost, cost);
+ highestCost = (int) cost;
+ }
+ }
+ }
+ if(highestCost > 0) {
+ CraftTracker.LOGGER.debug("returning highest cost: {}", highestCost);
+ return highestCost;
+ }
+
+ CraftTracker.LOGGER.debug("#calculate: fell through to rarity");
+ var rarity = stack.getItem().getRarity(stack);
+ return Math.max(rarity.ordinal() * count, count);
+ }
+}
diff --git a/src/main/java/com/sweetrpg/crafttracker/common/util/calc/RecipeCostCalculator.java b/src/main/java/com/sweetrpg/crafttracker/common/util/calc/RecipeCostCalculator.java
new file mode 100644
index 0000000..bd87629
--- /dev/null
+++ b/src/main/java/com/sweetrpg/crafttracker/common/util/calc/RecipeCostCalculator.java
@@ -0,0 +1,75 @@
+package com.sweetrpg.crafttracker.common.util.calc;
+
+import com.sweetrpg.crafttracker.CraftTracker;
+import com.sweetrpg.crafttracker.common.config.ConfigHandler;
+import com.sweetrpg.crafttracker.common.util.DebugUtil;
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.world.item.crafting.Recipe;
+import org.apache.commons.lang3.ObjectUtils;
+
+/**
+ * Calculates the "cost" of a recipe.
+ *
+ * Computes the cost of a recipe from:
+ * - the sum of its ingredients' costs
+ * - whether the recipe is "vanilla"
+ * - whether the recipe is "simple" (crafted vs. smelted, etc.)
+ */
+public class RecipeCostCalculator implements ICostCalculator {
+
+ private final Recipe> recipe;
+
+ /**
+ * Default constructor.
+ *
+ * @param recipe The recipe to calculate
+ */
+ public RecipeCostCalculator(Recipe> recipe) {
+ this.recipe = recipe;
+ }
+
+ /**
+ * Perform the calculation.
+ *
+ * @return An integer value of the recipe's cost
+ */
+ @Override
+ public int calculate() {
+ CraftTracker.LOGGER.debug("#calculate: {}", DebugUtil.printRecipe(recipe));
+
+ int cost = recipe.getIngredients().stream()
+ .map(IngredientCostCalculator::new)
+ .map(IngredientCostCalculator::calculate)
+ .reduce(0, Integer::sum);
+ CraftTracker.LOGGER.debug("summed cost of items: {}", cost);
+
+ // adjust the cost by the namespace's multiplier
+ var recipeNamespace = ObjectUtils.defaultIfNull(recipe.getId(), new ResourceLocation("", "")).getNamespace();
+ CraftTracker.LOGGER.debug("recipeNamespace: {}", recipeNamespace);
+ var multiplier = ConfigHandler.COMMON.namespaceEntries.get(recipeNamespace);
+ CraftTracker.LOGGER.debug("multiplier: {}", multiplier);
+
+ if(multiplier != null) {
+ var newCost = (int) (cost * multiplier.get());
+ CraftTracker.LOGGER.debug("#calculate: increasing cost of recipe {} in namespace {} by {}: from {} to {}",
+ recipe.getId(), recipeNamespace, multiplier.get(),
+ cost, newCost);
+ cost = newCost;
+ }
+
+ var recipeType = recipe.getType();
+ CraftTracker.LOGGER.debug("recipe type: {}", recipeType);
+
+ var typeMultiplier = ConfigHandler.COMMON.recipeTypeEntries.get(recipeType.toString());
+ if(typeMultiplier != null) {
+ var newCost = (int) (cost * typeMultiplier.get());
+ CraftTracker.LOGGER.debug("#calculate: increasing cost of recipe type {} by {}: from {} to {}",
+ recipeType, typeMultiplier.get(),
+ cost, newCost);
+ cost = newCost;
+ }
+
+ CraftTracker.LOGGER.debug("returning cost: {}", cost);
+ return cost;
+ }
+}
diff --git a/src/main/java/com/sweetrpg/crafttracker/data/CTBlockTagsProvider.java b/src/main/java/com/sweetrpg/crafttracker/data/CTBlockTagsProvider.java
deleted file mode 100644
index 10616be..0000000
--- a/src/main/java/com/sweetrpg/crafttracker/data/CTBlockTagsProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.sweetrpg.crafttracker.data;
-
-import com.sweetrpg.crafttracker.common.lib.Constants;
-import net.minecraft.data.DataGenerator;
-import net.minecraft.data.tags.BlockTagsProvider;
-import net.minecraftforge.common.data.ExistingFileHelper;
-
-public class CTBlockTagsProvider extends BlockTagsProvider {
-
- public CTBlockTagsProvider(DataGenerator generatorIn, ExistingFileHelper existingFileHelper) {
- super(generatorIn, Constants.MOD_ID, existingFileHelper);
- }
-
- @Override
- public String getName() {
- return "CraftTracker Block Tags";
- }
-
- @Override
- protected void addTags() {
- this.registerModTags();
- this.registerMinecraftTags();
- this.registerForgeTags();
-
- this.registerBlockMineables();
- }
-
- protected void registerBlockMineables() {
-
- }
-
- protected void registerMinecraftTags() {
- }
-
- protected void registerForgeTags() {
-
- }
-
- protected void registerModTags() {
- }
-
-}
diff --git a/src/main/java/com/sweetrpg/crafttracker/data/CTBlockstateProvider.java b/src/main/java/com/sweetrpg/crafttracker/data/CTBlockstateProvider.java
deleted file mode 100644
index 6e3739c..0000000
--- a/src/main/java/com/sweetrpg/crafttracker/data/CTBlockstateProvider.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package com.sweetrpg.crafttracker.data;
-
-import com.sweetrpg.crafttracker.common.lib.Constants;
-import net.minecraft.core.Direction;
-import net.minecraft.data.DataGenerator;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.properties.IntegerProperty;
-import net.minecraft.world.level.block.state.properties.Property;
-import net.minecraft.world.phys.AABB;
-import net.minecraftforge.client.model.generators.*;
-import net.minecraftforge.common.data.ExistingFileHelper;
-import net.minecraftforge.registries.ForgeRegistries;
-
-import javax.annotation.Nullable;
-import java.util.List;
-import java.util.function.BiConsumer;
-import java.util.function.BiFunction;
-import java.util.function.Supplier;
-
-public class CTBlockstateProvider extends BlockStateProvider {
-
- // Applies texture to all faces and for the input face culls that direction
- private static final BiFunction.ElementBuilder.FaceBuilder>> cullFaceFactory = (texture, input) -> (d, b) -> b.texture(texture).cullface(d == input ? d : null);
-
- public CTBlockstateProvider(DataGenerator gen, ExistingFileHelper exFileHelper) {
- super(gen, Constants.MOD_ID, exFileHelper);
- }
-
- public ExistingFileHelper getExistingHelper() {
- return this.models().existingFileHelper;
- }
-
- @Override
- public String getName() {
- return "CraftTracker Blockstates/Block Models";
- }
-
- @Override
- protected void registerStatesAndModels() {
- }
-
- private String blockName(Block block) {
- return ForgeRegistries.BLOCKS.getKey(block).getPath();
- }
-
- public ResourceLocation resourceBlock(String path) {
- return new ResourceLocation(Constants.MOD_ID, "block/" + path);
- }
-
- protected void createFromShape(Supplier extends Block> blockIn, AABB bb) {
- BlockModelBuilder model = this.models()
- .getBuilder(name(blockIn))
- .parent(this.models().getExistingFile(mcLoc(ModelProvider.BLOCK_FOLDER + "/block")))
- .texture("particle", extend(blockTexture(blockIn), "_bottom"))
- .texture("bottom", extend(blockTexture(blockIn), "_bottom"))
- .texture("top", extend(blockTexture(blockIn), "_top"))
- .texture("side", extend(blockTexture(blockIn), "_side"));
-
- model.element()
- .from((float) bb.minX, (float) bb.minY, (float) bb.minZ)
- .to((float) bb.maxX, (float) bb.maxY, (float) bb.maxZ)
- .allFaces((d, f) -> f.cullface(d == Direction.DOWN ? d : null).texture(d.getAxis().isHorizontal() ? "#side" : d == Direction.DOWN ? "#bottom" : "#top"));
-
- this.simpleBlock(blockIn.get(), model);
- }
-
- public void stageBlock(Block block, IntegerProperty ageProperty, Property>... ignored) {
- getVariantBuilder(block).forAllStatesExcept(state -> {
- int ageSuffix = state.getValue(ageProperty);
- String stageName = blockName(block) + "_stage" + ageSuffix;
- return ConfiguredModel.builder().modelFile(models().cross(stageName, resourceBlock(stageName))).build();
- }, ignored);
- }
-
- public void customStageBlock(Block block, @Nullable ResourceLocation parent, String textureKey, IntegerProperty ageProperty, List suffixes, Property>... ignored) {
- getVariantBuilder(block).forAllStatesExcept(state -> {
- int ageSuffix = state.getValue(ageProperty);
- String stageName = blockName(block) + "_stage";
- stageName += suffixes.isEmpty() ? ageSuffix : suffixes.get(Math.min(suffixes.size(), ageSuffix));
- if(parent == null) {
- return ConfiguredModel.builder().modelFile(models().cross(stageName, resourceBlock(stageName))).build();
- }
- return ConfiguredModel.builder().modelFile(models().singleTexture(stageName, parent, textureKey, resourceBlock(stageName))).build();
- }, ignored);
- }
-
- private String name(Supplier extends Block> block) {
- return ForgeRegistries.BLOCKS.getKey(block.get()).getPath();
- }
-
- private ResourceLocation blockTexture(Supplier extends Block> block) {
- ResourceLocation base = ForgeRegistries.BLOCKS.getKey(block.get());
- return prextend(base, ModelProvider.BLOCK_FOLDER + "/");
- }
-
- public ModelFile cross(Supplier extends Block> block) {
- return this.models().cross(name(block), blockTexture(block));
- }
-
- protected void makeSimple(Supplier extends Block> blockIn) {
- this.simpleBlock(blockIn.get());
- }
-
- private ResourceLocation prextend(ResourceLocation rl, String prefix) {
- return new ResourceLocation(rl.getNamespace(), prefix + rl.getPath());
- }
-
- private ResourceLocation extend(ResourceLocation rl, String suffix) {
- return new ResourceLocation(rl.getNamespace(), rl.getPath() + suffix);
- }
-}
diff --git a/src/main/java/com/sweetrpg/crafttracker/data/CTItemTagsProvider.java b/src/main/java/com/sweetrpg/crafttracker/data/CTItemTagsProvider.java
deleted file mode 100644
index 32a3a8c..0000000
--- a/src/main/java/com/sweetrpg/crafttracker/data/CTItemTagsProvider.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.sweetrpg.crafttracker.data;
-
-import com.sweetrpg.crafttracker.common.lib.Constants;
-import net.minecraft.data.DataGenerator;
-import net.minecraft.data.tags.BlockTagsProvider;
-import net.minecraft.data.tags.ItemTagsProvider;
-import net.minecraft.tags.TagKey;
-import net.minecraft.world.item.Item;
-import net.minecraft.world.level.ItemLike;
-import net.minecraftforge.common.data.ExistingFileHelper;
-
-import java.util.Arrays;
-import java.util.function.Supplier;
-
-public class CTItemTagsProvider extends ItemTagsProvider {
-
- public CTItemTagsProvider(DataGenerator generatorIn, BlockTagsProvider blockTagProvider, ExistingFileHelper existingFileHelper) {
- super(generatorIn, blockTagProvider, Constants.MOD_ID, existingFileHelper);
- }
-
- @Override
- public String getName() {
- return "CraftTracker Item Tags";
- }
-
- @Override
- public void addTags() {
-
- }
-
- @SafeVarargs
- private final void createTag(TagKey
- tag, Supplier extends ItemLike>... items) {
- tag(tag).add(Arrays.stream(items).map(Supplier::get).map(ItemLike::asItem).toArray(Item[]::new));
- }
-
- @SafeVarargs
- private final void appendToTag(TagKey
- tag, TagKey
- ... toAppend) {
- tag(tag).addTags(toAppend);
- }
-}
diff --git a/src/main/java/com/sweetrpg/crafttracker/data/CTLootTableProvider.java b/src/main/java/com/sweetrpg/crafttracker/data/CTLootTableProvider.java
deleted file mode 100644
index fb0e08a..0000000
--- a/src/main/java/com/sweetrpg/crafttracker/data/CTLootTableProvider.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.sweetrpg.crafttracker.data;
-
-import com.google.common.collect.ImmutableList;
-import com.mojang.datafixers.util.Pair;
-import com.sweetrpg.crafttracker.common.registry.ModBlocks;
-import net.minecraft.data.DataGenerator;
-import net.minecraft.data.loot.BlockLoot;
-import net.minecraft.data.loot.EntityLoot;
-import net.minecraft.data.loot.LootTableProvider;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.world.entity.EntityType;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.storage.loot.LootTable;
-import net.minecraft.world.level.storage.loot.ValidationContext;
-import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet;
-import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
-
-import java.util.List;
-import java.util.Map;
-import java.util.function.BiConsumer;
-import java.util.function.Consumer;
-import java.util.function.Supplier;
-import java.util.stream.Collectors;
-
-public class CTLootTableProvider extends LootTableProvider {
-
- public CTLootTableProvider(DataGenerator dataGeneratorIn) {
- super(dataGeneratorIn);
- }
-
- @Override
- public String getName() {
- return "CraftTracker Loot Tables";
- }
-
- @Override
- protected List>>, LootContextParamSet>> getTables() {
- return ImmutableList.of(Pair.of(Blocks::new, LootContextParamSets.BLOCK), Pair.of(Entities::new, LootContextParamSets.ENTITY));
- }
-
- @Override
- protected void validate(Map map, ValidationContext validationTracker) {
- }
-
- private static class Blocks extends BlockLoot {
-
- @Override
- protected void addTables() {
- }
-
-
- private void dropsSelf(Supplier extends Block> block) {
- dropSelf(block.get());
- }
-
- @Override
- protected Iterable getKnownBlocks() {
- return ModBlocks.BLOCKS.getEntries().stream().map(Supplier::get).collect(Collectors.toList());
- }
- }
-
- private static class Entities extends EntityLoot {
-
- @Override
- protected void addTables() {
-
- }
-
- protected void registerNoLoot(Supplier extends EntityType>> type) {
- this.add(type.get(), LootTable.lootTable());
- }
-
- @Override
- protected Iterable> getKnownEntities() {
- return List.of();
- }
- }
-}
diff --git a/src/main/java/com/sweetrpg/crafttracker/data/CTRecipeProvider.java b/src/main/java/com/sweetrpg/crafttracker/data/CTRecipeProvider.java
deleted file mode 100644
index 80f13cb..0000000
--- a/src/main/java/com/sweetrpg/crafttracker/data/CTRecipeProvider.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.sweetrpg.crafttracker.data;
-
-import com.google.gson.JsonObject;
-import com.sweetrpg.crafttracker.CraftTracker;
-import net.minecraft.data.DataGenerator;
-import net.minecraft.data.HashCache;
-import net.minecraft.data.recipes.FinishedRecipe;
-import net.minecraft.data.recipes.RecipeProvider;
-
-import java.nio.file.Path;
-import java.util.function.Consumer;
-
-public class CTRecipeProvider extends RecipeProvider {
-
- public CTRecipeProvider(DataGenerator generatorIn) {
- super(generatorIn);
- }
-
- @Override
- public String getName() {
- return "CraftTracker Recipes";
- }
-
- @Override
- protected void buildCraftingRecipes(Consumer consumer) {
- CraftTracker.LOGGER.debug("Build crafting recipes: {}", consumer);
-
- // shopping list
- }
-
-}
diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml
index 60f6b6b..bf49380 100644
--- a/src/main/resources/META-INF/mods.toml
+++ b/src/main/resources/META-INF/mods.toml
@@ -40,14 +40,14 @@ displayName = "Craft Tracker"
[[dependencies.crafttracker]]
modId="configured"
mandatory=false
- versionRange="[1.5.4,)"
+ versionRange="[2.1.1,)"
ordering="NONE"
side="BOTH"
[[dependencies.crafttracker]]
modId="patchouli"
mandatory=false
- versionRange="[1.18.2-71.1,)"
+ versionRange="[1.19.2-77,)"
ordering="NONE"
side="BOTH"
diff --git a/src/main/resources/assets/crafttracker/ingredient-costs.properties b/src/main/resources/assets/crafttracker/ingredient-costs.properties
deleted file mode 100644
index 5a15c5d..0000000
--- a/src/main/resources/assets/crafttracker/ingredient-costs.properties
+++ /dev/null
@@ -1,308 +0,0 @@
-minecraft\:anvil=10
-minecraft\:arrows=10
-minecraft\:banners=10
-minecraft\:barrels=10
-minecraft\:barrels_wooden=10
-minecraft\:beds=10
-minecraft\:boats=20
-minecraft\:bones=5
-minecraft\:bookshelves=50
-minecraft\:buttons=10
-minecraft\:candles=10
-minecraft\:carpets=10
-minecraft\:chests=10
-minecraft\:chests_ender=475
-minecraft\:chests_trapped=10
-minecraft\:chests_wooden=10
-minecraft\:coal_ores=20
-minecraft\:coals=20
-minecraft\:cobblestone=5
-minecraft\:cobblestone_deepslate=7
-minecraft\:cobblestone_mossy=10
-minecraft\:cobblestone_normal=5
-minecraft\:copper_ores=50
-minecraft\:crimson_stems=10
-minecraft\:crops=10
-minecraft\:diamond_ores=500
-minecraft\:dirt=1
-minecraft\:doors=10
-minecraft\:dusts=120
-minecraft\:dusts_glowstone=137
-minecraft\:dusts_prismarine=250
-minecraft\:dusts_redstone=137
-minecraft\:dyes=10
-minecraft\:dyes_black=15
-minecraft\:dyes_blue=10
-minecraft\:dyes_brown=10
-minecraft\:dyes_cyan=10
-minecraft\:dyes_gray=10
-minecraft\:dyes_green=15
-minecraft\:dyes_light_blue=10
-minecraft\:dyes_light_gray=10
-minecraft\:dyes_lime=10
-minecraft\:dyes_magenta=10
-minecraft\:dyes_orange=10
-minecraft\:dyes_pink=10
-minecraft\:dyes_purple=10
-minecraft\:dyes_red=10
-minecraft\:dyes_white=10
-minecraft\:dyes_yellow=10
-minecraft\:eggs=10
-minecraft\:emerald_ores=400
-minecraft\:enchanting_fuels=100
-minecraft\:end_stones=150
-minecraft\:ender_pearls=150
-minecraft\:feathers=10
-minecraft\:fence_gates=10
-minecraft\:fence_gates_wooden=10
-minecraft\:fences=10
-minecraft\:fences_nether_brick=10
-minecraft\:fences_wooden=10
-minecraft\:fishes=10
-minecraft\:flowers=5
-minecraft\:gems=150
-minecraft\:gems_amethyst=150
-minecraft\:gems_diamond=500
-minecraft\:gems_emerald=400
-minecraft\:gems_lapis=250
-minecraft\:gems_prismarine=250
-minecraft\:gems_quartz=300
-minecraft\:glass=10
-minecraft\:glass_panes=20
-minecraft\:glass_silica=20
-minecraft\:glass_tinted=20
-minecraft\:gold_ores=250
-minecraft\:gravel=2
-minecraft\:gunpowder=50
-minecraft\:heads=100
-minecraft\:ingots=15
-minecraft\:ingots_brick=16
-minecraft\:ingots_copper=55
-minecraft\:ingots_gold=310
-minecraft\:ingots_iron=110
-minecraft\:ingots_nether_brick=20
-minecraft\:ingots_netherite=750
-minecraft\:iron_ores=110
-minecraft\:lapis_ores=250
-minecraft\:leather=50
-minecraft\:leaves=2
-minecraft\:lectern_books=100
-minecraft\:logs=10
-minecraft\:logs_that_burn=10
-minecraft\:mushrooms=2
-minecraft\:music_discs=10
-minecraft\:nether_stars=900
-minecraft\:netherrack=5
-minecraft\:non_flammable_wood=10
-minecraft\:nuggets=2
-minecraft\:nuggets_gold=33
-minecraft\:nuggets_iron=11
-minecraft\:obsidian=400
-minecraft\:ore_bearing_ground_deepslate=10
-minecraft\:ore_bearing_ground_netherrack=10
-minecraft\:ore_bearing_ground_stone=10
-minecraft\:ores=10
-minecraft\:ores_coal=25
-minecraft\:ores_copper=50
-minecraft\:ores_diamond=500
-minecraft\:ores_emerald=400
-minecraft\:ores_gold=300
-minecraft\:ores_in_ground_deepslate=10
-minecraft\:ores_in_ground_netherrack=10
-minecraft\:ores_in_ground_stone=10
-minecraft\:ores_iron=100
-minecraft\:ores_lapis=250
-minecraft\:ores_netherite_scrap=750
-minecraft\:ores_quartz=300
-minecraft\:ores_redstone=200
-minecraft\:planks=10
-minecraft\:rails=10
-minecraft\:raw_materials=10
-minecraft\:raw_materials_copper=50
-minecraft\:raw_materials_gold=300
-minecraft\:raw_materials_iron=100
-minecraft\:redstone_ores=200
-minecraft\:rods=50
-minecraft\:rods_blaze=450
-minecraft\:rods_wooden=10
-minecraft\:sand=10
-minecraft\:sand_colorless=10
-minecraft\:sand_red=10
-minecraft\:sandstone=15
-minecraft\:saplings=2
-minecraft\:seeds=2
-minecraft\:shears=10
-minecraft\:signs=10
-minecraft\:slimeballs=40
-minecraft\:small_flowers=10
-minecraft\:soul_fire_base_blocks=100
-minecraft\:stained_glass=10
-minecraft\:stained_glass_panes=10
-minecraft\:stone=5
-minecraft\:stone_bricks=5
-minecraft\:string=15
-minecraft\:tall_flowers=5
-minecraft\:terracotta=100
-minecraft\:warped_stems=250
-minecraft\:wooden_buttons=10
-minecraft\:wooden_doors=60
-minecraft\:wooden_fences=10
-minecraft\:wooden_pressure_plates=20
-minecraft\:wooden_slabs=30
-minecraft\:wooden_stairs=60
-minecraft\:wooden_trapdoors=60
-minecraft\:wool=10
-forge\:anvil=10
-forge\:arrows=10
-forge\:banners=10
-forge\:barrels=10
-forge\:barrels_wooden=10
-forge\:beds=10
-forge\:boats=20
-forge\:bones=5
-forge\:bookshelves=50
-forge\:buttons=10
-forge\:candles=10
-forge\:carpets=10
-forge\:chests=10
-forge\:chests/ender=475
-forge\:chests/trapped=10
-forge\:chests/wooden=10
-forge\:coal_ores=20
-forge\:coals=20
-forge\:cobblestone=5
-forge\:cobblestone_deepslate=7
-forge\:cobblestone_mossy=10
-forge\:cobblestone_normal=5
-forge\:copper_ores=50
-forge\:crimson_stems=10
-forge\:crops=10
-forge\:diamond_ores=500
-forge\:dirt=1
-forge\:doors=10
-forge\:dusts=120
-forge\:dusts_glowstone=137
-forge\:dusts_prismarine=250
-forge\:dusts_redstone=137
-forge\:dyes=10
-forge\:dyes_black=15
-forge\:dyes_blue=10
-forge\:dyes_brown=10
-forge\:dyes_cyan=10
-forge\:dyes_gray=10
-forge\:dyes_green=15
-forge\:dyes_light_blue=10
-forge\:dyes_light_gray=10
-forge\:dyes_lime=10
-forge\:dyes_magenta=10
-forge\:dyes_orange=10
-forge\:dyes_pink=10
-forge\:dyes_purple=10
-forge\:dyes_red=10
-forge\:dyes_white=10
-forge\:dyes_yellow=10
-forge\:eggs=10
-forge\:emerald_ores=400
-forge\:enchanting_fuels=100
-forge\:end_stones=150
-forge\:ender_pearls=150
-forge\:feathers=10
-forge\:fence_gates=10
-forge\:fence_gates_wooden=10
-forge\:fences=10
-forge\:fences_nether_brick=10
-forge\:fences_wooden=10
-forge\:fishes=10
-forge\:flowers=5
-forge\:gems=150
-forge\:gems_amethyst=150
-forge\:gems_diamond=500
-forge\:gems_emerald=400
-forge\:gems_lapis=250
-forge\:gems_prismarine=250
-forge\:gems_quartz=300
-forge\:glass=10
-forge\:glass_panes=20
-forge\:glass_silica=20
-forge\:glass_tinted=20
-forge\:gold_ores=250
-forge\:gravel=2
-forge\:gunpowder=50
-forge\:heads=100
-forge\:ingots=15
-forge\:ingots_brick=16
-forge\:ingots_copper=55
-forge\:ingots_gold=310
-forge\:ingots_iron=110
-forge\:ingots_nether_brick=20
-forge\:ingots_netherite=750
-forge\:iron_ores=110
-forge\:lapis_ores=250
-forge\:leather=50
-forge\:leaves=2
-forge\:lectern_books=100
-forge\:logs=10
-forge\:logs_that_burn=10
-forge\:mushrooms=2
-forge\:music_discs=10
-forge\:nether_stars=900
-forge\:netherrack=5
-forge\:non_flammable_wood=10
-forge\:nuggets=2
-forge\:nuggets_gold=33
-forge\:nuggets_iron=11
-forge\:obsidian=400
-forge\:ore_bearing_ground_deepslate=10
-forge\:ore_bearing_ground_netherrack=10
-forge\:ore_bearing_ground_stone=10
-forge\:ores=10
-forge\:ores_coal=25
-forge\:ores_copper=50
-forge\:ores_diamond=500
-forge\:ores_emerald=400
-forge\:ores_gold=300
-forge\:ores_in_ground_deepslate=10
-forge\:ores_in_ground_netherrack=10
-forge\:ores_in_ground_stone=10
-forge\:ores_iron=100
-forge\:ores_lapis=250
-forge\:ores_netherite_scrap=750
-forge\:ores_quartz=300
-forge\:ores_redstone=200
-forge\:planks=10
-forge\:rails=10
-forge\:raw_materials=10
-forge\:raw_materials_copper=50
-forge\:raw_materials_gold=300
-forge\:raw_materials_iron=100
-forge\:redstone_ores=200
-forge\:rods=50
-forge\:rods_blaze=450
-forge\:rods_wooden=10
-forge\:sand=10
-forge\:sand_colorless=10
-forge\:sand_red=10
-forge\:sandstone=15
-forge\:saplings=2
-forge\:seeds=2
-forge\:shears=10
-forge\:signs=10
-forge\:slimeballs=40
-forge\:small_flowers=10
-forge\:soul_fire_base_blocks=100
-forge\:stained_glass=10
-forge\:stained_glass_panes=10
-forge\:stone=5
-forge\:stone_bricks=5
-forge\:string=15
-forge\:tall_flowers=5
-forge\:terracotta=100
-forge\:warped_stems=250
-forge\:wooden_buttons=10
-forge\:wooden_doors=60
-forge\:wooden_fences=10
-forge\:wooden_pressure_plates=20
-forge\:wooden_slabs=30
-forge\:wooden_stairs=60
-forge\:wooden_trapdoors=60
-forge\:wool=10
diff --git a/src/main/resources/assets/crafttracker/ingredient-overrides.properties b/src/main/resources/assets/crafttracker/ingredient-overrides.properties
deleted file mode 100644
index a620283..0000000
--- a/src/main/resources/assets/crafttracker/ingredient-overrides.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-create\:precision_mechanism=250
-minecraft\:trapped_chest=11
diff --git a/src/main/resources/assets/crafttracker/sounds.json b/src/main/resources/assets/crafttracker/sounds.json
deleted file mode 100644
index 2c63c08..0000000
--- a/src/main/resources/assets/crafttracker/sounds.json
+++ /dev/null
@@ -1,2 +0,0 @@
-{
-}
diff --git a/src/test/java/com/sweetrpg/crafttracker/test/CacheTest.java b/src/test/java/com/sweetrpg/crafttracker/test/CacheTest.java
deleted file mode 100644
index ce5d3bc..0000000
--- a/src/test/java/com/sweetrpg/crafttracker/test/CacheTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.sweetrpg.crafttracker.test;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import org.junit.jupiter.api.Test;
-
-import com.sweetrpg.crafttracker.common.util.Cache;
-
-public class CacheTest {
-
- @Test
- public void test() {
- Cache cache = Cache.make(() -> new String("string"));
- String first = cache.get();
- String second = cache.get();
-
- cache.markForRefresh();
- String third = cache.get();
-
- assertSame(first, second);
- assertNotSame(second, third);
-
- assertTrue(cache.test((v) -> v.length() == 6));
- }
-}
diff --git a/src/test/java/com/sweetrpg/crafttracker/test/crafttracker/common/util/UtilTest.java b/src/test/java/com/sweetrpg/crafttracker/test/crafttracker/common/util/UtilTest.java
deleted file mode 100644
index c22ea41..0000000
--- a/src/test/java/com/sweetrpg/crafttracker/test/crafttracker/common/util/UtilTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.sweetrpg.crafttracker.test.crafttracker.common.util;
-
-import org.junit.jupiter.api.Test;
-
-public class UtilTest {
-
- @Test
- public void testGetRegistryId() {
-// ResourceLocation dirtRL = new ResourceLocation("minecraft:dirt");
-// assertEquals(dirtRL, getRegistryId("minecraft:dirt"));
-// assertEquals(dirtRL, getRegistryId(dirtRL));
-// assertEquals(dirtRL, getRegistryId(RegistryObject.of(dirtRL, Block.class, "dummy_mod")));
-//
-// assertEquals(dirtRL, getRegistryId(new IRegistryDelegate() {
-// @Override public ResourceLocation name() { return dirtRL; }
-// // Methods should never be called
-// @Override public Class type() { return Block.class; }
-// @Override public Block get() { return null; }
-// }));
-//
-// assertEquals(dirtRL, getRegistryId(new IForgeRegistryEntry() {
-// @Override public ResourceLocation getRegistryName() { return dirtRL; }
-// // Methods should never be called
-// @Override public Class getRegistryType() { return Block.class; }
-// @Override public Block setRegistryName(ResourceLocation name) { return null; }
-// }));
-//
-// assertNull(getRegistryId("name:space:invalid")); // invalid rl's should return null
-// assertNull(getRegistryId(Integer.valueOf(0))); // other object types too
- }
-}