Added config to hide all the covers from JEI

This commit is contained in:
Buuz135
2021-09-11 20:19:40 +02:00
parent a6884690d4
commit b187baeb76
2 changed files with 30 additions and 11 deletions

View File

@@ -8,11 +8,12 @@ public class ClientConfig {
private final Grid grid; private final Grid grid;
private final CrafterManager crafterManager; private final CrafterManager crafterManager;
private final Cover cover;
public ClientConfig() { public ClientConfig() {
grid = new Grid(); grid = new Grid();
crafterManager = new CrafterManager(); crafterManager = new CrafterManager();
cover = new Cover();
spec = builder.build(); spec = builder.build();
} }
@@ -28,6 +29,10 @@ public class ClientConfig {
return crafterManager; return crafterManager;
} }
public Cover getCover() {
return cover;
}
public class Grid { public class Grid {
private final ForgeConfigSpec.IntValue maxRowsStretch; private final ForgeConfigSpec.IntValue maxRowsStretch;
private final ForgeConfigSpec.BooleanValue detailedTooltip; private final ForgeConfigSpec.BooleanValue detailedTooltip;
@@ -83,4 +88,19 @@ public class ClientConfig {
return maxRowsStretch.get(); return maxRowsStretch.get();
} }
} }
public class Cover{
private final ForgeConfigSpec.BooleanValue showAllCoversInJEI;
public Cover() {
builder.push("cover");
showAllCoversInJEI = builder.comment("When true all the possible covers will be added to JEI (Game restart required)").define("showAllCoversInJEI", true);
builder.pop();
}
public boolean showAllRecipesInJEI() {
return showAllCoversInJEI.get();
}
}
} }

View File

@@ -73,17 +73,16 @@ public class CoverItem extends Item {
@Override @Override
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) { public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
//if (RS.INSTANCE.config.hideCovers) {
// ItemStack stack = new ItemStack(this);
//setItem(stack, HIDDEN_COVER_ALTERNATIVE);
//items.add(stack);
//return;
//}
if (this.isInGroup(group)) { if (this.isInGroup(group)) {
if (!RS.CLIENT_CONFIG.getCover().showAllRecipesInJEI()) {
ItemStack stack = new ItemStack(this);
setItem(stack, HIDDEN_COVER_ALTERNATIVE);
items.add(stack);
return;
}
for (Block block : ForgeRegistries.BLOCKS.getValues()) { for (Block block : ForgeRegistries.BLOCKS.getValues()) {
Item item = Item.getItemFromBlock(block); Item item = Item.getItemFromBlock(block);