Skip to content

Commit

Permalink
Merge pull request #34 from sweetrpg/1.18
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
paulyhedral authored Dec 3, 2024
2 parents 3f7a562 + ec7e9cc commit 256510b
Show file tree
Hide file tree
Showing 22 changed files with 744 additions and 231 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

Expand Down Expand Up @@ -32,6 +28,6 @@ jobs:
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
uses: gradle/gradle-build-action@v3.5.0
with:
arguments: build test --console=verbose
2 changes: 1 addition & 1 deletion .release-info/1.18/RELEASE_HASH
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ed226a7a5730d6a9a3f1050d5c840e23298d1224
3f7a5625360952bcbd99e42b635469bff7a7f01c
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.5
0.1.9
6 changes: 6 additions & 0 deletions CHANGELOG/1.18/0.1.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# 0.1.5

- `[NEW]` When an end product's recipe intermediates have multiple variations, the "least expensive"
one is chosen
- `[NEW]` Added hotkey to clear the shopping list
- `[NEW]` Items in the queue and shopping list are now sorted by name
7 changes: 3 additions & 4 deletions CHANGELOG/1.18/current.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
- `[NEW]` When an end product's recipe intermediates have multiple variations, the "least expensive"
one is chosen
- `[NEW]` Added hotkey to clear the shopping list
- `[NEW]` Items in the queue and shopping list are now sorted by name
- `[FIX]` Fix endless loop when calculating recipes
- `[FIX]` Fixes to recipe cost calculations
- `[FIX]` Miscellaneous optimizations
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@

* [JEI](https://www.curseforge.com/minecraft/mc-mods/jei) — version 9.7.2.281 or higher

## Contributing
## Where To Get It

Download it from [CurseForge](https://www.curseforge.com/minecraft/mc-mods/craft-tracker) or [Modrinth](https://modrinth.com/mod/craft-tracker).
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ dependencies {
implementation fg.deobf("curse.maven:create-${create_project_id}:${create_file_id}")
implementation fg.deobf("curse.maven:ars-nouveau-${ars_project_id}:${ars_file_id}")
implementation fg.deobf("curse.maven:curios-${curios_project_id}:${curios_file_id}")
implementation fg.deobf("curse.maven:celestial-exploration-${cexp_project_id}:${cexp_file_id}")
implementation fg.deobf("curse.maven:azurelib-${azure_project_id}:${azure_file_id}")

testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${jupiter_version}")
testImplementation("org.junit.jupiter:junit-jupiter-api:${jupiter_version}")
Expand Down
7 changes: 5 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ curios_file_id=4985315
# Create
create_project_id=328085
create_file_id=5797603

# The One Probe
top_file_id=3671753

# Patchouli
ptch_version=1.18.2-71.1
ptch_file_id=3729975
# Celestial Exploration
cexp_project_id=577208
cexp_file_id=5738281
azure_project_id=817423
azure_file_id=5782731
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,16 @@ private static void handleToggleShoppingList() {
}

private static void handleAddToQueue() {
CraftTracker.LOGGER.debug("#handleToggleCraftList");
CraftTracker.LOGGER.debug("#handleAddToQueue");

CTPlugin.jeiRuntime.getIngredientListOverlay().getIngredientUnderMouse()
.ifPresent(ingredient -> {
CraftTracker.LOGGER.debug("AddToQueuePacket#handle: type {}", ingredient.getType());
CraftTracker.LOGGER.debug("AddToQueuePacket#handle: ingredient {}", ingredient.getIngredient());
CraftTracker.LOGGER.debug("#handleAddToQueue: type {}", ingredient.getType());
CraftTracker.LOGGER.debug("#handleAddToQueue: ingredient {}", ingredient.getIngredient());

if(ingredient.getIngredient() instanceof ItemStack itemStack) {
ResourceLocation res = itemStack.getItem().getRegistryName();
CraftTracker.LOGGER.debug("AddToQueuePacket#handle: res {}", res);
CraftTracker.LOGGER.debug("#handleAddToQueue: res {}", res);

var player = Minecraft.getInstance().player;
CraftingQueueManager.INSTANCE.addProduct(player, res, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public class CraftQueueOverlay {

var mgr = CraftingQueueManager.INSTANCE;
var products = mgr.getEndProducts().stream().sorted((i1, i2) -> {
var item1 = ForgeRegistries.ITEMS.getValue(i1.getItemId());
var item2 = ForgeRegistries.ITEMS.getValue(i2.getItemId());
var item1 = ForgeRegistries.ITEMS.getValue(i1.getProductId());
var item2 = ForgeRegistries.ITEMS.getValue(i2.getProductId());
return item1.getDescription().getString().compareTo(item2.getDescription().getString());
}).toList();

Expand Down Expand Up @@ -102,14 +102,15 @@ public class CraftQueueOverlay {
for(int i = 0; i < products.size(); i++) {
var p = products.get(i);

var item = ForgeRegistries.ITEMS.getValue(p.getItemId());
var item = ForgeRegistries.ITEMS.getValue(p.getProductId());
var stack = item.getDefaultInstance();
// TODO: count overlay on icon is amount produced by recipe
// stack.setCount(stack.getCount());
var selectedRecipe = p.getRecipes().get(p.getIndex());
var amountProduced = selectedRecipe.getResultItem().getCount() * p.getIterations();
stack.setCount(amountProduced);
var drawable = CTPlugin.jeiRuntime.getJeiHelpers().getGuiHelper()
.createDrawableIngredient(VanillaTypes.ITEM_STACK, stack);
drawable.draw(poseStack, x + SECTION_X_OFFSET, yPos);
var text = String.format("%s (x%d)", item.getDescription().getString(MAX_STRING_LENGTH), p.getQuantity());
var text = String.format("%s (x%d)", item.getDescription().getString(MAX_STRING_LENGTH), p.getIterations());
GuiComponent.drawString(poseStack, gui.getFont(), text, x + ITEM_NAME_X_OFFSET, yPos + 4, TEXT_COLOR);

yPos += LINE_HEIGHT + 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.sweetrpg.crafttracker.common.lib.CTRuntime;
import com.sweetrpg.crafttracker.common.lib.Constants;
import com.sweetrpg.crafttracker.common.manager.CraftingQueueManager;
import com.sweetrpg.crafttracker.common.model.CraftingQueueProduct;
import mezz.jei.api.constants.VanillaTypes;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiComponent;
Expand Down Expand Up @@ -39,7 +40,7 @@ public class QueueManagementScreen extends Screen {
public static final int ITEM_X_QTY_OFFSET = ITEM_X_UP_BUTTON_OFFSET - (ITEM_X_QTY_WIDTH / 2);
public static final int ITEM_X_DOWN_BUTTON_OFFSET = ITEM_X_QTY_OFFSET - (int) (BUTTON_SIZE * 2) - 2;

private List<CraftingQueueManager.ProductItem> productItems;
private List<CraftingQueueProduct> productItems;
private CTRuntime.OverlayState queueState;
private CTRuntime.OverlayState shoppingState;

Expand Down Expand Up @@ -91,7 +92,7 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTic
var pItem = this.productItems.get(i);
final var itemIndex = i;

var item = ForgeRegistries.ITEMS.getValue(pItem.getItemId());
var item = ForgeRegistries.ITEMS.getValue(pItem.getProductId());
var itemStack = item.getDefaultInstance();
var y = topY + TITLE_HEIGHT + (i * (ITEM_HEIGHT + 4));

Expand All @@ -114,25 +115,25 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTic
// quantity and adjustment buttons
{
Button button = new Button(topX + width + ITEM_X_DOWN_BUTTON_OFFSET, y + 2, BUTTON_SIZE, BUTTON_SIZE - 2, new TextComponent("-"), btn -> {
CraftingQueueManager.INSTANCE.adjustProduct(player, pItem.getItemId(), -1);
CraftingQueueManager.INSTANCE.adjustProduct(player, pItem.getProductId(), -1);
QueueManagementScreen.this.productItems = CraftingQueueManager.INSTANCE.getEndProducts();
}) /*{
@Override
public void renderToolTip(PoseStack pPoseStack, int pMouseX, int pMouseY) {
QueueManagementScreen.this.renderTooltip(poseStack, new TranslatableComponent(Constants.TRANSLATION_KEY_GUI_QUEUEMGR_DEC_BUTTON_TOOLTIP), mouseX, mouseY);
}
}*/;
button.active = pItem.getQuantity() > 1;
button.active = pItem.getIterations() > 1;
this.addRenderableWidget(button);
}
{
var text = String.format("%d", pItem.getQuantity());
var text = String.format("%d", pItem.getIterations());
// this.font.draw(poseStack, text, topX + width + ITEM_X_QTY_OFFSET, y + 6, ITEM_COLOR);
GuiComponent.drawCenteredString(poseStack, this.font, text, topX + width + ITEM_X_QTY_OFFSET, y + 6, ITEM_COLOR);
}
{
Button button = new Button(topX + width + ITEM_X_UP_BUTTON_OFFSET, y + 2, BUTTON_SIZE, BUTTON_SIZE - 2, new TextComponent("+"), btn -> {
CraftingQueueManager.INSTANCE.adjustProduct(player, pItem.getItemId(), 1);
CraftingQueueManager.INSTANCE.adjustProduct(player, pItem.getProductId(), 1);
QueueManagementScreen.this.productItems = CraftingQueueManager.INSTANCE.getEndProducts();
}) /*{
@Override
Expand All @@ -149,7 +150,7 @@ public void renderToolTip(PoseStack pPoseStack, int pMouseX, int pMouseY) {
// delete button
{
Button button = new Button(topX + width + ITEM_X_DELETE_BUTTON_OFFSET, y + 2, BUTTON_SIZE, BUTTON_SIZE - 2, new TextComponent("x"), btn -> {
CraftingQueueManager.INSTANCE.removeProduct(player, pItem.getItemId());
CraftingQueueManager.INSTANCE.removeProduct(player, pItem.getProductId());
QueueManagementScreen.this.productItems = CraftingQueueManager.INSTANCE.getEndProducts();
this.renderables.clear();
}) /*{
Expand Down
Loading

0 comments on commit 256510b

Please sign in to comment.