Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -112,23 +113,27 @@ 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));
}

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));
}

Expand Down Expand Up @@ -156,6 +161,15 @@ private boolean isAmmo(ItemStack stack)
return false;
}

private void sortRecipes(List<WorkbenchRecipe> recipes) {
Collections.sort(
recipes,
(recipe1, recipe2) ->
recipe1.getItem().getDescriptionId().compareTo(
recipe2.getItem().getDescriptionId())
);
}

@Override
public void init()
{
Expand Down