Skip to content

Commit

Permalink
v0.1.1
Browse files Browse the repository at this point in the history
 * Improve descriptions of groups and recipes that contain / output one entity
 * Fix for Bootstrap text-truncate not working
  • Loading branch information
D-Cysteine committed Jan 5, 2023
1 parent 6c8b190 commit a073458
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 25 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ idea {
}

group = "com.github.dcysteine.nesql.server"
version = "0.1.0"
version = "0.1.1"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ public static Icon buildIcon(FluidGroup fluidGroup) {
Icon icon;
if (!fluidGroup.getFluidStacks().isEmpty()) {
int size = fluidGroup.getFluidStacks().size();
icon = DisplayFluidStack.buildIcon(fluidGroup.getFluidStacks().first()).toBuilder()
.setDescription(String.format("Fluid Group (%d fluid stacks)", size))
String description = String.format("Fluid Group (%d fluid stacks)", size);
Icon innerIcon = DisplayFluidStack.buildIcon(fluidGroup.getFluidStacks().first());
if (size == 1) {
description = String.format("Fluid Group (%s)", innerIcon.getDescription());
}

icon = innerIcon.toBuilder()
.setDescription(description)
.setUrl(url)
.build();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,29 @@ public static Icon buildIcon(ItemGroup itemGroup, ItemRepository itemRepository)
String url = UrlBuilder.buildItemGroupUrl(itemGroup);
Icon icon;
if (!itemStacks.isEmpty()) {
icon = DisplayItemStack.buildIcon(itemStacks.first()).toBuilder()
.setDescription(String.format("Item Group (%d item stacks)", size))
String description = String.format("Item Group (%d item stacks)", size);
Icon innerIcon = DisplayItemStack.buildIcon(itemStacks.first());
if (size == 1) {
description = String.format("Item Group (%s)", innerIcon.getDescription());
}

icon = innerIcon.toBuilder()
.setDescription(description)
.setUrl(url)
.build();
} else if (!wildcardItemStacks.isEmpty()) {
icon = DisplayWildcardItemStack.buildIcon(wildcardItemStacks.first(), itemRepository)
.toBuilder()
.setDescription(
String.format(
"Wildcard Item Group (%d keys, %d item stacks)",
wildcardItemStacks.size(), size))
String description =
String.format(
"Wildcard Item Group (%d keys, %d item stacks)",
wildcardItemStacks.size(), size);
Icon innerIcon =
DisplayWildcardItemStack.buildIcon(wildcardItemStacks.first(), itemRepository);
if (wildcardItemStacks.size() == 1) {
description = String.format("Wildcard Item Group (%s)", innerIcon.getDescription());
}

icon = innerIcon.toBuilder()
.setDescription(description)
.setUrl(url)
.build();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,26 +72,35 @@ public static Icon buildIcon(Recipe recipe) {
String description = displayRecipeType.getDescription();
String url = UrlBuilder.buildRecipeUrl(recipe);
Icon icon;
if (numItemOutputs > 0 && numFluidOutputs > 0) {
description += String.format(" (%d items, %d fluids)", numItemOutputs, numFluidOutputs);
if (numItemOutputs > 0) {
Icon innerIcon =
DisplayItemStackWithProbability.buildIcon(recipe.getItemOutputs().get(0));
if (numItemOutputs == 1) {
description += String.format(" (%s)", innerIcon.getDescription());
} else if (numFluidOutputs > 0) {
description +=
String.format(" (%d items, %d fluids)", numItemOutputs, numFluidOutputs);
} else {
description += String.format(" (%d items)", numItemOutputs);
}

icon = DisplayItemStackWithProbability.buildIcon(recipe.getItemOutputs().get(0))
.toBuilder()
icon = innerIcon.toBuilder()
.setDescription(description)
.setUrl(url)
.build();
} else if (numItemOutputs > 0) {
description += String.format(" (%d items)", numItemOutputs);

Icon itemIcon =
DisplayItemStackWithProbability.buildIcon(recipe.getItemOutputs().get(0));
icon = itemIcon.toBuilder().setDescription(description).setUrl(url).build();
} else if (numFluidOutputs > 0) {
description += String.format(" (%d fluids)", numFluidOutputs);

Icon fluidIcon =
Icon innerIcon =
DisplayFluidStackWithProbability.buildIcon(recipe.getFluidOutputs().get(0));
icon = fluidIcon.toBuilder().setDescription(description).setUrl(url).build();
if (numFluidOutputs == 1) {
description += String.format(" (%s)", innerIcon.getDescription());
} else {
description += String.format(" (%d fluids)", numFluidOutputs);
}

icon = innerIcon.toBuilder()
.setDescription(description)
.setUrl(url)
.build();
} else {
icon = Icon.builder()
.setDescription(description + " (empty)")
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/static/css/main.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/* Fix for Bootstrap text-truncate in table cells. */
table {
table-layout: fixed;
}

/* An icon is a rendered item or fluid. */
img.icon {
width: 64px;
Expand Down

0 comments on commit a073458

Please sign in to comment.