Skip to content

Commit

Permalink
sync with sakura-ryoko/itemscroller 1.21.3-0.25.2
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed Dec 22, 2024
1 parent dc79a40 commit e9c6035
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
## Change
- sync with `sakura-ryoko/itemscroller` 1.21.3-0.25.2-sakura.3
- sync with `sakura-ryoko/itemscroller` 1.21.3-0.25.2
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int
private void renderRecipeItems(RecipePattern recipe, int recipeCountPerPage, HandledScreen<?> gui, DrawContext drawContext)
{
ItemStack[] items = recipe.getRecipeItems();
final int recipeDimensions = (int) Math.ceil(Math.sqrt(recipe.getRecipeLength()));
final int recipeDimensions = (int) Math.ceil(Math.sqrt(Math.min(recipe.getRecipeLength(), 9)));
int x = -3 * 17 + 2;
int y = 3 * this.entryHeight;

Expand All @@ -250,7 +250,7 @@ private void renderRecipeItems(RecipePattern recipe, int recipeCountPerPage, Han

private ItemStack getHoveredRecipeIngredient(int mouseX, int mouseY, RecipePattern recipe, int recipeCountPerPage, HandledScreen<?> gui)
{
final int recipeDimensions = (int) Math.ceil(Math.sqrt(recipe.getRecipeLength()));
final int recipeDimensions = (int) Math.ceil(Math.sqrt(Math.min(recipe.getRecipeLength(), 9)));
int scaledStackDimensions = (int) (16 * this.scale);
int scaledGridEntry = (int) (17 * this.scale);
int x = this.recipeListX - (int) ((3 * 17 - 2) * this.scale);
Expand Down
30 changes: 19 additions & 11 deletions src/main/java/fi/dy/masa/itemscroller/recipes/RecipeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,24 @@ public static boolean compareStacksAndIngredients(List<ItemStack> left, List<Ing
while (lStack.isEmpty())
{
lPos++;
lStack = left.get(lPos);
//System.out.printf("compare() [%d] left [%s] (Advance Left), right [%d]\n", lPos, lStack.toString(), i);

if (lPos < 9)
{
lStack = left.get(lPos);
//System.out.printf(" compare() [%d] left [%s] (Advance Left), right [%d]\n", lPos, lStack.toString(), i);
}
else
{
break;
}
}

List<RegistryEntry<Item>> rItems = ri.getMatchingItems();
boolean match = false;

for (RegistryEntry<Item> rItem : rItems)
{
//System.out.printf("compare() [%d] left [%s] / [%d] right [%s]\n", lPos, lStack, i, rItem.getIdAsString());
//System.out.printf(" compare() [%d] left [%s] / [%d] right [%s]\n", lPos, lStack, i, rItem.getIdAsString());

if (ri.test(lStack))
{
Expand Down Expand Up @@ -104,35 +112,35 @@ private static void dumpStacks(List<ItemStack> stacks, String side)
{
int i = 0;

//System.out.printf("DUMP [%s] -->\n", side);
System.out.printf("DUMP [%s] -->\n", side);
for (ItemStack stack : stacks)
{
//System.out.printf("%s[%d] // [%s]\n", side, i, stack.toString());
System.out.printf("%s[%d] // [%s]\n", side, i, stack.toString());
i++;
}
//System.out.printf("DUMP END [%s]\n", side);
System.out.printf("DUMP END [%s]\n", side);
}

private static void dumpIngs(List<Ingredient> ings, String side)
{
int i = 0;

//System.out.printf("DUMP [%s] -->\n", side);
System.out.printf("DUMP [%s] -->\n", side);
for (Ingredient ing : ings)
{
List<RegistryEntry<Item>> items = ing.getMatchingItems();

//System.out.printf("%s[%d] //", side, i);
System.out.printf("%s[%d] //", side, i);

for (RegistryEntry<Item> item : items)
{
//System.out.printf(" [%s]", item.getIdAsString());
System.out.printf(" [%s]", item.getIdAsString());
}

//System.out.print("// []\n");
System.out.print("// []\n");
i++;
}

//System.out.printf("DUMP END [%s]\n", side);
System.out.printf("DUMP END [%s]\n", side);
}
}

0 comments on commit e9c6035

Please sign in to comment.