Skip to content

Commit

Permalink
Merge pull request #40 from sweetrpg/1.18
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
paulyhedral authored Dec 5, 2024
2 parents 256510b + a926f8d commit f90114c
Show file tree
Hide file tree
Showing 15 changed files with 317 additions and 135 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ out
*.ipr
*.iws
*.iml
.idea/workspace.xml
.idea/

# gradle
build
Expand All @@ -27,4 +27,4 @@ logs
# Files from Forge MDK
forge*changelog.txt
/src/generated/resources/.cache/cache
.DS_Store
.DS_Store
2 changes: 1 addition & 1 deletion .release-info/1.18/RELEASE_HASH
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3f7a5625360952bcbd99e42b635469bff7a7f01c
256510bbbd810366ee9da94fc0ddd31d450e4576
2 changes: 1 addition & 1 deletion .release-info/1.18/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.9
0.1.12
5 changes: 5 additions & 0 deletions CHANGELOG/1.18/0.1.9.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 0.1.9

- `[FIX]` Fix endless loop when calculating recipes
- `[FIX]` Fixes to recipe cost calculations
- `[FIX]` Miscellaneous optimizations
9 changes: 6 additions & 3 deletions CHANGELOG/1.18/current.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
- `[FIX]` Fix endless loop when calculating recipes
- `[FIX]` Fixes to recipe cost calculations
- `[FIX]` Miscellaneous optimizations
- `[FIX]` Made cost calculation of non-vanilla recipes slightly more expensive
- `[FIX]` Made cost calculation of non-crafting table recipes slightly more expensive
- `[FIX]` Increased recipe calculation depth to 3
- `[FIX]` Added checks for recipe and ingredient namespaces in determining intermediate/raw status
- `[FIX]` Changed text for crafting queue sections
- `[NEW]` Intermediate and raw materials that are tags are marked with an asterisk
8 changes: 4 additions & 4 deletions src/generated/resources/assets/crafttracker/lang/de_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"crafttracker.msg.shopping_list_overlay_mode.show": "Nun wird das Overlay mit der Einkaufsliste angezeigt.",
"crafttracker.screen.craft_queue.empty_message": "Die Warteschlange ist leer.",
"crafttracker.screen.craft_queue.help_message": "Die Warteschlange verwalten:",
"crafttracker.screen.craft_queue.section.fuel": "Kraftstoff",
"crafttracker.screen.craft_queue.section.intermediates": "Zwischenprodukte",
"crafttracker.screen.craft_queue.section.materials": "Materialien",
"crafttracker.screen.craft_queue.section.products": "Produkte",
"crafttracker.screen.craft_queue.section.fuel": "Und dieser Treibstoff:",
"crafttracker.screen.craft_queue.section.intermediates": "Sie m\u00FCssen zun\u00E4chst Folgendes tun:",
"crafttracker.screen.craft_queue.section.materials": "Mit diesen Materialien:",
"crafttracker.screen.craft_queue.section.products": "Um zu machen:",
"crafttracker.screen.craft_queue.title": "Herstellungswarteschlange",
"crafttracker.screen.have": "habe %d",
"crafttracker.screen.queue_mgr.button.clear": "Alle l\u00F6schen",
Expand Down
14 changes: 7 additions & 7 deletions src/generated/resources/assets/crafttracker/lang/en_gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
"crafttracker.config.client.shopping_list_width": "The width of the shopping list overlay",
"crafttracker.config.client.shopping_list_x": "The X position on the screen for the shopping list overlay",
"crafttracker.config.client.shopping_list_y": "The Y position on the screen for the shopping list overlay",
"crafttracker.msg.queue_overlay_mode.dynamic": "The craft list overlay mode is dynamic.",
"crafttracker.msg.queue_overlay_mode.hide": "The craft list overlay will now be hidden.",
"crafttracker.msg.queue_overlay_mode.show": "The craft list overlay will now be shown.",
"crafttracker.msg.queue_overlay_mode.dynamic": "The craft queue overlay mode is dynamic.",
"crafttracker.msg.queue_overlay_mode.hide": "The craft queue overlay will now be hidden.",
"crafttracker.msg.queue_overlay_mode.show": "The craft queue overlay will now be shown.",
"crafttracker.msg.shopping_list_overlay_mode.dynamic": "The shopping list overlay mode is dynamic.",
"crafttracker.msg.shopping_list_overlay_mode.hide": "The shopping list overlay will now be hidden.",
"crafttracker.msg.shopping_list_overlay_mode.show": "The shopping list overlay will now be shown.",
"crafttracker.screen.craft_queue.empty_message": "The queue is empty.",
"crafttracker.screen.craft_queue.help_message": "To manage the queue:",
"crafttracker.screen.craft_queue.section.fuel": "Fuel",
"crafttracker.screen.craft_queue.section.intermediates": "Intermediates",
"crafttracker.screen.craft_queue.section.materials": "Materials",
"crafttracker.screen.craft_queue.section.products": "Products",
"crafttracker.screen.craft_queue.section.fuel": "And this fuel:",
"crafttracker.screen.craft_queue.section.intermediates": "You first need to make:",
"crafttracker.screen.craft_queue.section.materials": "With these materials:",
"crafttracker.screen.craft_queue.section.products": "To make:",
"crafttracker.screen.craft_queue.title": "Craft Queue",
"crafttracker.screen.have": "have %d",
"crafttracker.screen.queue_mgr.button.clear": "Clear",
Expand Down
14 changes: 7 additions & 7 deletions src/generated/resources/assets/crafttracker/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
"crafttracker.config.client.shopping_list_width": "The width of the shopping list overlay",
"crafttracker.config.client.shopping_list_x": "The X position on the screen for the shopping list overlay",
"crafttracker.config.client.shopping_list_y": "The Y position on the screen for the shopping list overlay",
"crafttracker.msg.queue_overlay_mode.dynamic": "The craft list overlay mode is dynamic.",
"crafttracker.msg.queue_overlay_mode.hide": "The craft list overlay will now be hidden.",
"crafttracker.msg.queue_overlay_mode.show": "The craft list overlay will now be shown.",
"crafttracker.msg.queue_overlay_mode.dynamic": "The craft queue overlay mode is dynamic.",
"crafttracker.msg.queue_overlay_mode.hide": "The craft queue overlay will now be hidden.",
"crafttracker.msg.queue_overlay_mode.show": "The craft queue overlay will now be shown.",
"crafttracker.msg.shopping_list_overlay_mode.dynamic": "The shopping list overlay mode is dynamic.",
"crafttracker.msg.shopping_list_overlay_mode.hide": "The shopping list overlay will now be hidden.",
"crafttracker.msg.shopping_list_overlay_mode.show": "The shopping list overlay will now be shown.",
"crafttracker.screen.craft_queue.empty_message": "The queue is empty.",
"crafttracker.screen.craft_queue.help_message": "To manage the queue:",
"crafttracker.screen.craft_queue.section.fuel": "Fuel",
"crafttracker.screen.craft_queue.section.intermediates": "Intermediates",
"crafttracker.screen.craft_queue.section.materials": "Materials",
"crafttracker.screen.craft_queue.section.products": "Products",
"crafttracker.screen.craft_queue.section.fuel": "And this fuel:",
"crafttracker.screen.craft_queue.section.intermediates": "You first need to make:",
"crafttracker.screen.craft_queue.section.materials": "With these materials:",
"crafttracker.screen.craft_queue.section.products": "To make:",
"crafttracker.screen.craft_queue.title": "Craft Queue",
"crafttracker.screen.have": "have %d",
"crafttracker.screen.queue_mgr.button.clear": "Clear",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ private static void handlePopulateShoppingList() {

materials.forEach(m -> {
var haveQty = InventoryUtil.getQuantityOf(player, m.getItemId());
var needed = m.getQuantity() - haveQty;
var needed = m.getAmount() - haveQty;

if(needed > 0)
sMgr.addItem(player, m.getItemId(), needed);
});
fuel.forEach(f -> {
var haveQty = InventoryUtil.getQuantityOf(player, f.getItemId());
var needed = f.getQuantity() - haveQty;
var needed = f.getAmount() - haveQty;

if(needed > 0)
sMgr.addItem(player, f.getItemId(), needed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ public class CraftQueueOverlay {
var mgr = CraftingQueueManager.INSTANCE;
var products = mgr.getEndProducts().stream().sorted((i1, i2) -> {
var item1 = ForgeRegistries.ITEMS.getValue(i1.getProductId());
if(item1 == null) return 0;
var item2 = ForgeRegistries.ITEMS.getValue(i2.getProductId());
if(item2 == null) return 0;
return item1.getDescription().getString().compareTo(item2.getDescription().getString());
}).toList();

Expand Down Expand Up @@ -103,6 +105,9 @@ public class CraftQueueOverlay {
var p = products.get(i);

var item = ForgeRegistries.ITEMS.getValue(p.getProductId());
if(item == null) {
continue;
}
var stack = item.getDefaultInstance();
var selectedRecipe = p.getRecipes().get(p.getIndex());
var amountProduced = selectedRecipe.getResultItem().getCount() * p.getIterations();
Expand All @@ -118,7 +123,7 @@ public class CraftQueueOverlay {
}

Player player = Minecraft.getInstance().player;
var inventory = player.getInventory();
// var inventory = player.getInventory();

// SECTION: intermediates

Expand All @@ -136,18 +141,20 @@ public class CraftQueueOverlay {
// items
var sortedIntermediates = mgr.getIntermediates().stream().sorted((i1, i2) -> {
var item1 = ForgeRegistries.ITEMS.getValue(i1.getItemId());
if(item1 == null) return 0;
var item2 = ForgeRegistries.ITEMS.getValue(i2.getItemId());
if(item2 == null) return 0;
return item1.getDescription().getString().compareTo(item2.getDescription().getString());
}).toList();
for(int i = 0; i < sortedIntermediates.size(); i++) {
var inter = sortedIntermediates.get(i);

var item = ForgeRegistries.ITEMS.getValue(inter.getItemId());
var stack = item.getDefaultInstance();
stack.setCount(inter.getQuantity());
stack.setCount(inter.getAmount());

int playerHasQuantity = InventoryUtil.getQuantityOf(player, inter.getItemId());
if(playerHasQuantity >= inter.getQuantity()) {
if(playerHasQuantity >= inter.getAmount()) {
// don't need to display this intermediate, since the user doesn't need to make it
continue;
}
Expand All @@ -159,14 +166,16 @@ public class CraftQueueOverlay {
final int lambdaYpos = yPos;
if(playerHasQuantity > 0) {
var countText = I18n.get(Constants.TRANSLATION_KEY_GUI_HAVE, playerHasQuantity);
var text = String.format("%s [%s]",
var text = String.format("%s%s [%s]",
item.getDescription().getString(MAX_STRING_LENGTH - countText.length() - 3),
inter.isTag() ? "*" : "",
countText);
CraftTracker.LOGGER.trace("text: {}", text);
GuiComponent.drawString(poseStack, gui.getFont(), text, x + ITEM_NAME_X_OFFSET, lambdaYpos + 4, TEXT_COLOR);
}
else {
var text = item.getDescription().getString(MAX_STRING_LENGTH);
var text = item.getDescription().getString(MAX_STRING_LENGTH) +
(inter.isTag() ? "*" : "");
GuiComponent.drawString(poseStack, gui.getFont(), text, x + ITEM_NAME_X_OFFSET, yPos + 4, TEXT_COLOR);
}

Expand Down Expand Up @@ -199,10 +208,10 @@ public class CraftQueueOverlay {

var item = ForgeRegistries.ITEMS.getValue(m.getItemId());
var stack = item.getDefaultInstance();
stack.setCount(m.getQuantity());
stack.setCount(m.getAmount());

int playerHasQuantity = InventoryUtil.getQuantityOf(player, m.getItemId());
if(playerHasQuantity >= m.getQuantity()) {
if(playerHasQuantity >= m.getAmount()) {
// don't need to display this intermediate, since the user doesn't need to make it
continue;
}
Expand All @@ -214,14 +223,16 @@ public class CraftQueueOverlay {
final int lambdaYpos = yPos;
if(playerHasQuantity > 0) {
var countText = I18n.get(Constants.TRANSLATION_KEY_GUI_HAVE, playerHasQuantity);
var text = String.format("%s [%s]",
var text = String.format("%s%s [%s]",
item.getDescription().getString(MAX_STRING_LENGTH - countText.length() - 3),
m.isTag() ? "*" : "",
countText);
CraftTracker.LOGGER.trace("text: {}", text);
GuiComponent.drawString(poseStack, gui.getFont(), text, x + ITEM_NAME_X_OFFSET, lambdaYpos + 4, TEXT_COLOR);
}
else {
var text = item.getDescription().getString(MAX_STRING_LENGTH);
var text = item.getDescription().getString(MAX_STRING_LENGTH) +
(m.isTag() ? "*" : "");
GuiComponent.drawString(poseStack, gui.getFont(), text, x + ITEM_NAME_X_OFFSET, yPos + 4, TEXT_COLOR);
}

Expand Down Expand Up @@ -254,10 +265,10 @@ public class CraftQueueOverlay {

var item = ForgeRegistries.ITEMS.getValue(f.getItemId());
var stack = item.getDefaultInstance();
stack.setCount(f.getQuantity());
stack.setCount(f.getAmount());

int playerHasQuantity = InventoryUtil.getQuantityOf(player, f.getItemId());
if(playerHasQuantity >= f.getQuantity()) {
if(playerHasQuantity >= f.getAmount()) {
// don't need to display this intermediate, since the user doesn't need to make it
continue;
}
Expand All @@ -269,14 +280,16 @@ public class CraftQueueOverlay {
final int lambdaYpos = yPos;
if(playerHasQuantity > 0) {
var countText = I18n.get(Constants.TRANSLATION_KEY_GUI_HAVE, playerHasQuantity);
var text = String.format("%s [%s]",
var text = String.format("%s%s [%s]",
item.getDescription().getString(MAX_STRING_LENGTH - countText.length() - 3),
f.isTag() ? "*" : "",
countText);
CraftTracker.LOGGER.trace("text: {}", text);
GuiComponent.drawString(poseStack, gui.getFont(), text, x + ITEM_NAME_X_OFFSET, lambdaYpos + 4, TEXT_COLOR);
}
else {
var text = item.getDescription().getString(MAX_STRING_LENGTH);
var text = item.getDescription().getString(MAX_STRING_LENGTH) +
(f.isTag() ? "*" : "");
GuiComponent.drawString(poseStack, gui.getFont(), text, x + ITEM_NAME_X_OFFSET, yPos + 4, TEXT_COLOR);
}

Expand Down
Loading

0 comments on commit f90114c

Please sign in to comment.