add config option to disable showing all facades in creative
This commit is contained in:
parent
6ed71b4f16
commit
9c55d79861
2 changed files with 43 additions and 8 deletions
|
@ -197,6 +197,7 @@ public class BuildCraftTransport extends BuildCraftMod {
|
|||
public static boolean facadeTreatBlacklistAsWhitelist;
|
||||
public static boolean additionalWaterproofingRecipe;
|
||||
public static boolean facadeForceNonLaserRecipe;
|
||||
public static boolean showAllFacadesCreative;
|
||||
|
||||
public static BlockGenericPipe genericPipeBlock;
|
||||
public static BlockFilteredBuffer filteredBufferBlock;
|
||||
|
@ -291,7 +292,6 @@ public class BuildCraftTransport extends BuildCraftMod {
|
|||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent evt) {
|
||||
new BCCreativeTab("pipes");
|
||||
new BCCreativeTab("facades");
|
||||
if (Loader.isModLoaded("BuildCraft|Silicon")) {
|
||||
new BCCreativeTab("gates");
|
||||
}
|
||||
|
@ -303,6 +303,7 @@ public class BuildCraftTransport extends BuildCraftMod {
|
|||
BuildCraftCore.mainConfigManager.register("general.pipes.baseFluidRate", DefaultProps.PIPES_FLUIDS_BASE_FLOW_RATE, "What should the base flow rate of a fluid pipe be?", ConfigManager.RestartRequirement.GAME)
|
||||
.setMinValue(1).setMaxValue(40);
|
||||
BuildCraftCore.mainConfigManager.register("debug.printFacadeList", false, "Print a list of all registered facades.", ConfigManager.RestartRequirement.GAME);
|
||||
BuildCraftCore.mainConfigManager.register("general.pipes.facadeShowAllInCreative", true, "Should all BC facades be shown in Creative/NEI, or just a few carefully chosen ones?", ConfigManager.RestartRequirement.GAME);
|
||||
BuildCraftCore.mainConfigManager.register("general.pipes.slimeballWaterproofRecipe", false, "Should I enable an alternate Waterproof recipe, based on slimeballs?", ConfigManager.RestartRequirement.GAME);
|
||||
BuildCraftCore.mainConfigManager.register("power.gateCostMultiplier", 1.0D, "What should be the multiplier of all gate power costs?", ConfigManager.RestartRequirement.GAME);
|
||||
BuildCraftCore.mainConfigManager.register("general.pipes.facadeBlacklist", new String[]{
|
||||
|
@ -324,6 +325,10 @@ public class BuildCraftTransport extends BuildCraftMod {
|
|||
|
||||
reloadConfig(ConfigManager.RestartRequirement.GAME);
|
||||
|
||||
if (showAllFacadesCreative) {
|
||||
new BCCreativeTab("facades");
|
||||
}
|
||||
|
||||
filteredBufferBlock = new BlockFilteredBuffer();
|
||||
CoreProxy.proxy.registerBlock(filteredBufferBlock.setBlockName("filteredBufferBlock"));
|
||||
|
||||
|
@ -486,7 +491,9 @@ public class BuildCraftTransport extends BuildCraftMod {
|
|||
PipeEventBus.registerGlobalHandler(new LensFilterHandler());
|
||||
|
||||
BCCreativeTab.get("pipes").setIcon(new ItemStack(BuildCraftTransport.pipeItemsDiamond, 1));
|
||||
if (showAllFacadesCreative) {
|
||||
BCCreativeTab.get("facades").setIcon(facadeItem.getFacadeForBlock(Blocks.brick_block, 0));
|
||||
}
|
||||
if (Loader.isModLoaded("BuildCraft|Silicon")) {
|
||||
BCCreativeTab.get("gates").setIcon(ItemGate.makeGateItem(GateMaterial.DIAMOND, GateLogic.AND));
|
||||
}
|
||||
|
@ -572,6 +579,7 @@ public class BuildCraftTransport extends BuildCraftMod {
|
|||
debugPrintFacadeList = BuildCraftCore.mainConfigManager.get("debug.printFacadeList").getBoolean();
|
||||
pipeFluidsBaseFlowRate = BuildCraftCore.mainConfigManager.get("general.pipes.baseFluidRate").getInt();
|
||||
facadeForceNonLaserRecipe = BuildCraftCore.mainConfigManager.get("general.pipes.facadeNoLaserRecipe").getBoolean();
|
||||
showAllFacadesCreative = BuildCraftCore.mainConfigManager.get("general.pipes.facadeShowAllInCreative").getBoolean();
|
||||
|
||||
reloadConfig(ConfigManager.RestartRequirement.WORLD);
|
||||
} else if (restartType == ConfigManager.RestartRequirement.WORLD) {
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -33,6 +34,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.core.JavaTools;
|
||||
import buildcraft.api.facades.FacadeType;
|
||||
|
@ -48,6 +50,8 @@ import buildcraft.core.lib.items.ItemBuildCraft;
|
|||
import buildcraft.core.lib.utils.StringUtils;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
|
||||
import scala.collection.mutable.Builder$class;
|
||||
|
||||
public class ItemFacade extends ItemBuildCraft implements IFacadeItem, IPipePluggableItem {
|
||||
public static class FacadeState {
|
||||
public final Block block;
|
||||
|
@ -146,8 +150,13 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem, IPipePlug
|
|||
private static final Block NULL_BLOCK = null;
|
||||
private static final ItemStack NO_MATCH = new ItemStack(NULL_BLOCK, 0, 0);
|
||||
|
||||
private static final Block[] PREVIEW_FACADES = new Block[]{
|
||||
Blocks.planks, Blocks.stonebrick, Blocks.glass
|
||||
};
|
||||
private static int RANDOM_FACADE_ID = -1;
|
||||
|
||||
public ItemFacade() {
|
||||
super(BCCreativeTab.get("facades"));
|
||||
super(BuildCraftTransport.showAllFacadesCreative ? BCCreativeTab.get("facades") : BCCreativeTab.get("main"));
|
||||
|
||||
setHasSubtypes(true);
|
||||
setMaxDamage(0);
|
||||
|
@ -216,12 +225,30 @@ public class ItemFacade extends ItemBuildCraft implements IFacadeItem, IPipePlug
|
|||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
if (BuildCraftTransport.showAllFacadesCreative) {
|
||||
for (ItemStack stack : allFacades) {
|
||||
itemList.add(stack);
|
||||
}
|
||||
for (ItemStack stack : allHollowFacades) {
|
||||
itemList.add(stack);
|
||||
}
|
||||
} else {
|
||||
List<ItemStack> hollowFacades = new ArrayList<ItemStack>();
|
||||
for (Block b : PREVIEW_FACADES) {
|
||||
if (isBlockValidForFacade(b) && !isBlockBlacklisted(b)) {
|
||||
ItemStack facade = getFacadeForBlock(b, 0);
|
||||
itemList.add(facade);
|
||||
FacadeState state = getFacadeStates(facade)[0];
|
||||
hollowFacades.add(getFacade(new FacadeState(state.block, state.metadata, state.wire, true)));
|
||||
}
|
||||
}
|
||||
if (RANDOM_FACADE_ID < 0) {
|
||||
RANDOM_FACADE_ID = BuildCraftCore.random.nextInt(allFacades.size());
|
||||
}
|
||||
itemList.add(allFacades.get(RANDOM_FACADE_ID));
|
||||
itemList.addAll(hollowFacades);
|
||||
itemList.add(allHollowFacades.get(RANDOM_FACADE_ID));
|
||||
}
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
|
|
Loading…
Reference in a new issue