diff --git a/src/main/java/com/mrcrayfish/guns/client/screen/WorkbenchScreen.java b/src/main/java/com/mrcrayfish/guns/client/screen/WorkbenchScreen.java index e5034e3bd..2c3728a68 100644 --- a/src/main/java/com/mrcrayfish/guns/client/screen/WorkbenchScreen.java +++ b/src/main/java/com/mrcrayfish/guns/client/screen/WorkbenchScreen.java @@ -44,6 +44,7 @@ import java.awt.*; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -112,6 +113,7 @@ else if(this.isAmmo(output)) if(!weapons.isEmpty()) { + this.sortRecipes(weapons); ItemStack icon = new ItemStack(ModItems.ASSAULT_RIFLE.get()); icon.getOrCreateTag().putInt("AmmoCount", ModItems.ASSAULT_RIFLE.get().getGun().getGeneral().getMaxAmmo()); this.tabs.add(new Tab(icon, "weapons", weapons)); @@ -119,16 +121,19 @@ else if(this.isAmmo(output)) if(!attachments.isEmpty()) { + this.sortRecipes(attachments); this.tabs.add(new Tab(new ItemStack(ModItems.LONG_SCOPE.get()), "attachments", attachments)); } if(!ammo.isEmpty()) { + this.sortRecipes(ammo); this.tabs.add(new Tab(new ItemStack(ModItems.SHELL.get()), "ammo", ammo)); } if(!misc.isEmpty()) { + this.sortRecipes(misc); this.tabs.add(new Tab(new ItemStack(Items.BARRIER), "misc", misc)); } @@ -156,6 +161,15 @@ private boolean isAmmo(ItemStack stack) return false; } + private void sortRecipes(List recipes) { + Collections.sort( + recipes, + (recipe1, recipe2) -> + recipe1.getItem().getDescriptionId().compareTo( + recipe2.getItem().getDescriptionId()) + ); + } + @Override public void init() {