Added config option to hide covers in the creative mode tabs and JEI. Fixes #1886
This commit is contained in:
@@ -115,6 +115,10 @@ public class RSConfig {
|
||||
public int readerWriterChannelEnergyCapacity;
|
||||
//endregion
|
||||
|
||||
//region Covers
|
||||
public boolean hideCovers;
|
||||
//endregion
|
||||
|
||||
//region Categories
|
||||
private static final String ENERGY = "energy";
|
||||
private static final String CONTROLLER = "controller";
|
||||
@@ -126,6 +130,7 @@ public class RSConfig {
|
||||
private static final String WIRELESS_CRAFTING_MONITOR = "wirelessCraftingMonitor";
|
||||
private static final String UPGRADES = "upgrades";
|
||||
private static final String READER_WRITER = "readerWriter";
|
||||
private static final String COVERS = "covers";
|
||||
//endregion
|
||||
|
||||
public RSConfig(@Nullable RSConfig originalClientVersion, File configFile) {
|
||||
@@ -257,6 +262,10 @@ public class RSConfig {
|
||||
readerWriterChannelEnergyCapacity = config.getInt("channelEnergyCapacity", READER_WRITER, 16000, 0, Integer.MAX_VALUE, "The energy capacity of energy channels");
|
||||
//endregion
|
||||
|
||||
//region Covers
|
||||
hideCovers = config.getBoolean("hideCovers", COVERS, false, "Whether to hide covers in the creative mode tabs and JEI");
|
||||
//endregion
|
||||
|
||||
if (config.hasChanged()) {
|
||||
config.save();
|
||||
}
|
||||
@@ -276,6 +285,7 @@ public class RSConfig {
|
||||
list.add(new ConfigElement(config.getCategory(WIRELESS_CRAFTING_MONITOR)));
|
||||
list.add(new ConfigElement(config.getCategory(PORTABLE_GRID)));
|
||||
list.add(new ConfigElement(config.getCategory(READER_WRITER)));
|
||||
list.add(new ConfigElement(config.getCategory(COVERS)));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.raoulvdberge.refinedstorage.integration.jei;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.RSItems;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.cover.CoverManager;
|
||||
import com.raoulvdberge.refinedstorage.item.ItemCover;
|
||||
import mezz.jei.api.recipe.*;
|
||||
@@ -16,7 +18,7 @@ public class RecipeRegistryPluginCover implements IRecipeRegistryPlugin {
|
||||
ItemStack stack = (ItemStack) focus.getValue();
|
||||
|
||||
if (focus.getMode() == IFocus.Mode.INPUT) {
|
||||
if (CoverManager.isValidCover(stack)) {
|
||||
if ((!RS.INSTANCE.config.hideCovers && CoverManager.isValidCover(stack)) || API.instance().getComparer().isEqualNoQuantity(stack, ItemCover.HIDDEN_COVER_ALTERNATIVE)) {
|
||||
return Collections.singletonList(VanillaRecipeCategoryUid.CRAFTING);
|
||||
}
|
||||
} else if (focus.getMode() == IFocus.Mode.OUTPUT) {
|
||||
@@ -35,7 +37,7 @@ public class RecipeRegistryPluginCover implements IRecipeRegistryPlugin {
|
||||
ItemStack stack = (ItemStack) focus.getValue();
|
||||
|
||||
if (focus.getMode() == IFocus.Mode.INPUT) {
|
||||
if (CoverManager.isValidCover(stack)) {
|
||||
if ((!RS.INSTANCE.config.hideCovers && CoverManager.isValidCover(stack)) || API.instance().getComparer().isEqualNoQuantity(stack, ItemCover.HIDDEN_COVER_ALTERNATIVE)) {
|
||||
ItemStack cover = new ItemStack(RSItems.COVER);
|
||||
|
||||
ItemCover.setItem(cover, stack);
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.raoulvdberge.refinedstorage.integration.jei;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.RSItems;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.cover.CoverManager;
|
||||
import com.raoulvdberge.refinedstorage.item.ItemCover;
|
||||
import com.raoulvdberge.refinedstorage.item.ItemHollowCover;
|
||||
import mezz.jei.api.recipe.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -16,8 +19,12 @@ public class RecipeRegistryPluginHollowCover implements IRecipeRegistryPlugin {
|
||||
ItemStack stack = (ItemStack) focus.getValue();
|
||||
|
||||
if (focus.getMode() == IFocus.Mode.INPUT) {
|
||||
if (stack.getItem() == RSItems.COVER && CoverManager.isValidCover(ItemCover.getItem(stack))) {
|
||||
return Collections.singletonList(VanillaRecipeCategoryUid.CRAFTING);
|
||||
if (stack.getItem() == RSItems.COVER) {
|
||||
ItemStack covered = ItemCover.getItem(stack);
|
||||
|
||||
if ((!RS.INSTANCE.config.hideCovers && CoverManager.isValidCover(covered)) || API.instance().getComparer().isEqualNoQuantity(covered, ItemHollowCover.HIDDEN_COVER_ALTERNATIVE)) {
|
||||
return Collections.singletonList(VanillaRecipeCategoryUid.CRAFTING);
|
||||
}
|
||||
}
|
||||
} else if (focus.getMode() == IFocus.Mode.OUTPUT) {
|
||||
if (stack.getItem() == RSItems.HOLLOW_COVER) {
|
||||
@@ -35,12 +42,16 @@ public class RecipeRegistryPluginHollowCover implements IRecipeRegistryPlugin {
|
||||
ItemStack stack = (ItemStack) focus.getValue();
|
||||
|
||||
if (focus.getMode() == IFocus.Mode.INPUT) {
|
||||
if (stack.getItem() == RSItems.COVER && CoverManager.isValidCover(ItemCover.getItem(stack))) {
|
||||
ItemStack hollowCover = new ItemStack(RSItems.HOLLOW_COVER);
|
||||
if (stack.getItem() == RSItems.COVER) {
|
||||
ItemStack covered = ItemCover.getItem(stack);
|
||||
|
||||
ItemCover.setItem(hollowCover, ItemCover.getItem(stack));
|
||||
if ((!RS.INSTANCE.config.hideCovers && CoverManager.isValidCover(covered)) || API.instance().getComparer().isEqualNoQuantity(covered, ItemHollowCover.HIDDEN_COVER_ALTERNATIVE)) {
|
||||
ItemStack hollowCover = new ItemStack(RSItems.HOLLOW_COVER);
|
||||
|
||||
return Collections.singletonList((T) new RecipeWrapperHollowCover(stack, hollowCover));
|
||||
ItemCover.setItem(hollowCover, ItemCover.getItem(stack));
|
||||
|
||||
return Collections.singletonList((T) new RecipeWrapperHollowCover(stack, hollowCover));
|
||||
}
|
||||
}
|
||||
} else if (focus.getMode() == IFocus.Mode.OUTPUT) {
|
||||
if (stack.getItem() == RSItems.HOLLOW_COVER) {
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -39,6 +40,8 @@ import java.util.List;
|
||||
public class ItemCover extends ItemBase {
|
||||
private static final String NBT_ITEM = "Item";
|
||||
|
||||
public static final ItemStack HIDDEN_COVER_ALTERNATIVE = new ItemStack(Blocks.STONEBRICK);
|
||||
|
||||
public ItemCover(IItemInfo info) {
|
||||
super(info);
|
||||
|
||||
@@ -91,6 +94,16 @@ public class ItemCover extends ItemBase {
|
||||
return;
|
||||
}
|
||||
|
||||
if (RS.INSTANCE.config.hideCovers) {
|
||||
ItemStack stack = new ItemStack(this);
|
||||
|
||||
setItem(stack, HIDDEN_COVER_ALTERNATIVE);
|
||||
|
||||
items.add(stack);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for (Block block : Block.REGISTRY) {
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user