Beta 4 + Configs

Dependency Updated: AE2-rv3-beta-4
Added config options for many things.
This commit is contained in:
Chris committed 2016-01-10 12:55:45 -05:00
1 parent 73ef506cb8
commit ddb483d817
27 files changed
+782 -589

No files matched your search

+2
View File
@@ -4,6 +4,8 @@
Fixed bug where Terminals would not properly update during certain AE-network changes.
Fixed bug where craftable essentia was still present on the network when it should not be.
Added config option to force some thaumcraft blocks to be turned into facades.
Dependency Updated: AE2-rv3-beta-4
Added config options for many things.
01/09/2016 0.10.0.0
Fixed crafting aspect item display name.
@@ -2,21 +2,6 @@ package thaumicenergistics.api;
public interface IThEConfig
{
/**
* Controls if the Essentia Provider is allowed to be crafted.
*/
public boolean allowedToCraftEssentiaProvider();
/**
* Controls if the Infusion Provider is allowed to be crafted.
*/
public boolean allowedToCraftInfusionProvider();
/**
* Controls if Certus Quartz can be duped in the crucible.
*/
public boolean allowedToDuplicateCertusQuartz();
/**
* If true essentia gas will be blacklisted from ExtraCells.
*
@@ -30,6 +15,83 @@ public interface IThEConfig
*/
public int conversionMultiplier();
/**
* Can the Arcane Assembler be crafted.
*
* @return
*/
public boolean craftArcaneAssembler();
/**
* Can the ACT be crafted.
*
* @return
*/
public boolean craftArcaneCraftingTerminal();
/**
* Can the DPE be crafted.
*
* @return
*/
public boolean craftDistillationPatternEncoder();
/**
* Can Essentia cells be crafted.
*
* @return
*/
public boolean craftEssentiaCells();
/**
* Can the Essentia Provider be crafted.
*/
public boolean craftEssentiaProvider();
/**
* Can the EVC be crafted.
*
* @return
*/
public boolean craftEssentiaVibrationChamber();
/**
* Can the Infusion Provider be crafted.
*/
public boolean craftInfusionProvider();
/**
* Can the VRI be crafted.
*
* @return
*/
public boolean craftVisRelayInterface();
/**
* Can the WET be crafted.
*
* @return
*/
public boolean craftWirelessEssentiaTerminal();
/**
* If true the iron and thaumium gearbox's will be rendered as a standard
* block.
*/
public boolean disableGearboxModel();
/**
* Controls if Certus Quartz can be duped in the crucible.
*/
public boolean enableCertusQuartzDupe();
/**
* Is the wrench focus enabled.
*
* @return
*/
public boolean enableWrenchFocus();
/**
* When enabled, overwrites the AE2 facade setting for certain Thaumcraft blocks,
* allowing them to become facades.
@@ -37,10 +99,4 @@ public interface IThEConfig
* @return
*/
public boolean forceTCFacades();
/**
* If true the iron and thaumium gearbox's will be rendered as a standard
* block.
*/
public boolean gearboxModelDisabled();
}
@@ -12,18 +12,29 @@ class ConfigurationHandler
/**
* Names of the categories.
*/
private static final String CATEGORY_CRAFTING = "crafting", CATEGORY_CLIENT = "client", CATEGORY_INTEGRATION = "integration";
private static final String CATEGORY_CRAFTING = "crafting",
CATEGORY_CLIENT = "client",
CATEGORY_INTEGRATION = "integration";
/**
* Default values.
*/
private static final int DEFAULT_CONVERSION_EXPONENT = 7;
private static final boolean DEFAULT_ESSENTIAPROVIDER = true,
DEFAULT_INFUSIONPROVIDER = true,
DEFAULT_QUARTZ = true,
DEFAULT_GEARBOX_DISABLED = false,
DEFAULT_EXTRACELLS_BLIST = true,
DEFAULT_FORCE_TC_FACADES = true;
private static final int DFT_CONVERSION_EXPONENT = 7;
private static final boolean
DFT_CRAFT_ARCANE_ASSEMBLER = true,
DFT_CRAFT_ARCANE_CRAFTING_TERM = true,
DFT_CRAFT_DISTILLATION_PATTERN_ENCODER = true,
DFT_CRAFT_ESSENTIA_CELLS = true,
DFT_CRAFT_ESSENTIA_PROVIDER = true,
DFT_CRAFT_ESSENTIA_VIBRATION_CHAMBER = true,
DFT_CRAFT_INFUSION_PROVIDER = true,
DFT_CRAFT_VIS_RELAY_INTERFACE = true,
DFT_CRAFT_WIRELESS_ESSENTIA_TERM = true,
DFT_DISABLE_GEARBOX = false,
DFT_ENABLE_QUARTZ_DUPE = true,
DFT_ENABLE_WRENCH_FOCUS = true,
DFT_EXTRACELLS_BLIST = true,
DFT_FORCE_TC_FACADES = true;
/**
* Mod configuration
@@ -34,38 +45,23 @@ class ConfigurationHandler
* Controls the conversion ratio of essentia/fluid. <BR>
* 1 essentia unit is converted to this many mb's of fluid.
*/
private int conversionMultiplier = (int)Math.pow( 2, DEFAULT_CONVERSION_EXPONENT );
private int conversionMultiplier = (int)Math.pow( 2, DFT_CONVERSION_EXPONENT );
/**
* Controls if the Essentia Provider is allowed to be crafted.
*/
private boolean allowEssentiaProvider = DEFAULT_ESSENTIAPROVIDER;
/**
* Controls if the Infusion Provider is allowed to be crafted.
*/
private boolean allowInfusionProvider = DEFAULT_INFUSIONPROVIDER;
/**
* Controls if Certus Quartz can be duped in the crucible.
*/
private boolean allowCertusDupe = DEFAULT_QUARTZ;
/**
* Controls if the iron and thaumium gearbox's will be rendered as a
* standard block.
*/
private boolean gearboxModelDisabled = DEFAULT_GEARBOX_DISABLED;
/**
* Controls if essentia gas is blacklisted
*/
private boolean extracellsBlacklist = DEFAULT_EXTRACELLS_BLIST;
/**
* Allows specific blocks from Thaumcraft to be turned into facades.
*/
private boolean forceTCFacades = DEFAULT_FORCE_TC_FACADES;
private boolean
craft_Arcane_Assembler = DFT_CRAFT_ARCANE_ASSEMBLER,
craft_Arcane_Crafting_Term = DFT_CRAFT_ARCANE_CRAFTING_TERM,
craft_Distillation_Pattern_Encoder = DFT_CRAFT_DISTILLATION_PATTERN_ENCODER,
craft_Essentia_Cells = DFT_CRAFT_ESSENTIA_CELLS,
craft_Essentia_Provider = DFT_CRAFT_ESSENTIA_PROVIDER,
craft_Essentia_Vibration_Chamber = DFT_CRAFT_ESSENTIA_VIBRATION_CHAMBER,
craft_Infusion_Provider = DFT_CRAFT_INFUSION_PROVIDER,
craft_Vis_Relay_Interface = DFT_CRAFT_VIS_RELAY_INTERFACE,
craft_Wireless_Essentia_Term = DFT_CRAFT_WIRELESS_ESSENTIA_TERM,
disable_Gearbox = DFT_DISABLE_GEARBOX,
enable_Quartz_Dupe = DFT_ENABLE_QUARTZ_DUPE,
enable_Wrench_Focus = DFT_ENABLE_WRENCH_FOCUS,
extracells_Blist = DFT_EXTRACELLS_BLIST,
force_TC_Facades = DFT_FORCE_TC_FACADES;
private ConfigurationHandler( final Configuration config )
{
@@ -84,7 +80,6 @@ class ConfigurationHandler
{
ConfigurationHandler.INSTANCE = new ConfigurationHandler( new Configuration( configFile ) );
}
return ConfigurationHandler.INSTANCE;
}
@@ -93,12 +88,12 @@ class ConfigurationHandler
*/
private void synchronizeConfigFile()
{
// Sync the essentia fluid conversion ratio
// General =========================================================
int fluidPow = this.configSettings
.getInt(
"Essentia Fluid Ratio Exponent",
Configuration.CATEGORY_GENERAL,
ConfigurationHandler.DEFAULT_CONVERSION_EXPONENT,
ConfigurationHandler.DFT_CONVERSION_EXPONENT,
1,
11,
"Controls the conversion ratio of essentia/fluid. 1 essentia is converted to (2^this) milibuckets of fluid. "
@@ -106,29 +101,78 @@ class ConfigurationHandler
+ "Values above 11 make it impossible to use fluid transfer devices such as the ME IO Port, or anything from EC2." );
this.conversionMultiplier = (int)Math.pow( 2, Math.min( fluidPow, 11 ) );
// Sync essentia provider
this.allowEssentiaProvider = this.configSettings.getBoolean( "Allow Crafting Essentia Provider", CATEGORY_CRAFTING,
DEFAULT_ESSENTIAPROVIDER, "Controls if the Essentia Provider is allowed to be crafted." );
// Crafting ========================================================
this.craft_Arcane_Assembler = this.configSettings.getBoolean(
"Arcane Assembler",
CATEGORY_CRAFTING, DFT_CRAFT_ARCANE_ASSEMBLER,
"Controls if the Arcane Assembler can be crafted." );
// Sync essentia provider
this.allowInfusionProvider = this.configSettings.getBoolean( "Allow Crafting Infusion Provider", CATEGORY_CRAFTING,
DEFAULT_INFUSIONPROVIDER, "Controls if the Infusion Provider is allowed to be crafted." );
this.craft_Arcane_Crafting_Term = this.configSettings.getBoolean(
"Arcane Crafting Terminal",
CATEGORY_CRAFTING, DFT_CRAFT_ARCANE_CRAFTING_TERM,
"Controls if the Arcane Crafting Terminal can be crafted." );
// Sync certus dupe
this.allowCertusDupe = this.configSettings.getBoolean( "Certus Quartz Duplication", CATEGORY_CRAFTING,
DEFAULT_QUARTZ, "Controls if Certus Quartz can be duplicated in the crucible." );
this.craft_Distillation_Pattern_Encoder = this.configSettings.getBoolean(
"Distillation Pattern Encoder.",
CATEGORY_CRAFTING, DFT_CRAFT_DISTILLATION_PATTERN_ENCODER,
"Controls if the Distillation Pattern Encoder can be crafted." );
// Gearbox model
this.gearboxModelDisabled = this.configSettings.getBoolean( "Disable Gearbox Model", CATEGORY_CLIENT,
DEFAULT_GEARBOX_DISABLED, "The iron and thaumium gearboxes will be rendered as a standard block." );
this.craft_Essentia_Cells = this.configSettings.getBoolean(
"Essentia Cells",
CATEGORY_CRAFTING, DFT_CRAFT_ESSENTIA_CELLS,
"Controls if Essentia Cells and Components can be crafted." );
// Extra cells blacklist
this.extracellsBlacklist = this.configSettings.getBoolean( "ExtraCells Blacklist", CATEGORY_INTEGRATION,
DEFAULT_EXTRACELLS_BLIST, "Prevents extra cells from interacting with essentia gas" );
this.craft_Essentia_Provider = this.configSettings.getBoolean(
"Essentia Provider",
CATEGORY_CRAFTING, DFT_CRAFT_ESSENTIA_PROVIDER,
"Controls if the Essentia Provider can be crafted." );
// Thaumcraft facades
this.forceTCFacades = this.configSettings.getBoolean( "Force TC Facades", CATEGORY_CRAFTING, DEFAULT_FORCE_TC_FACADES,
"When enabled, overwrites the AE2 facade setting for certain Thaumcraft blocks, allowing them to become facades." );
this.craft_Essentia_Vibration_Chamber = this.configSettings.getBoolean(
"Essentia Vibration Chamber",
CATEGORY_CRAFTING, DFT_CRAFT_ESSENTIA_VIBRATION_CHAMBER,
"Controlls if the Essentia Vibration Chamber can be crafted." );
this.craft_Infusion_Provider = this.configSettings.getBoolean(
"Infusion Provider",
CATEGORY_CRAFTING, DFT_CRAFT_INFUSION_PROVIDER,
"Controls if the Infusion Provider can be crafted." );
this.craft_Vis_Relay_Interface = this.configSettings.getBoolean(
"Vis Relay Interface",
CATEGORY_CRAFTING, DFT_CRAFT_VIS_RELAY_INTERFACE,
"Controls if the Vis Relay Interface can be crafted." );
this.craft_Wireless_Essentia_Term = this.configSettings.getBoolean(
"Allow Crafting Wireless Essentia Terminal",
CATEGORY_CRAFTING, DFT_CRAFT_WIRELESS_ESSENTIA_TERM,
"Controls if the Wireless Essentia Terminal can be crafted." );
this.enable_Quartz_Dupe = this.configSettings.getBoolean(
"Certus Quartz Duplication",
CATEGORY_CRAFTING, DFT_ENABLE_QUARTZ_DUPE,
"Controls if Certus Quartz can be duplicated in the crucible." );
this.enable_Wrench_Focus = this.configSettings.getBoolean(
"Wrench Focus",
CATEGORY_CRAFTING, DFT_ENABLE_WRENCH_FOCUS,
"Controlls if the Wrench Focus is enabled and craftable." );
this.force_TC_Facades = this.configSettings.getBoolean(
"Force TC Facades",
CATEGORY_CRAFTING, DFT_FORCE_TC_FACADES,
"When enabled, overwrites the AE2 facade settings for some Thaumcraft blocks, allowing their facades to be crafted." );
// Client ==========================================================
this.disable_Gearbox = this.configSettings.getBoolean(
"Disable Gearbox Model",
CATEGORY_CLIENT, DFT_DISABLE_GEARBOX,
"The iron and thaumium gearboxes will be rendered as a standard block." );
// Integration =====================================================
this.extracells_Blist = this.configSettings.getBoolean(
"ExtraCells Blacklist",
CATEGORY_INTEGRATION, DFT_EXTRACELLS_BLIST,
"Prevents extra cells from interacting with essentia gas" );
// Has the config file changed?
if( this.configSettings.hasChanged() )
@@ -138,28 +182,10 @@ class ConfigurationHandler
}
}
@Override
public boolean allowedToCraftEssentiaProvider()
{
return this.allowEssentiaProvider;
}
@Override
public boolean allowedToCraftInfusionProvider()
{
return this.allowInfusionProvider;
}
@Override
public boolean allowedToDuplicateCertusQuartz()
{
return this.allowCertusDupe;
}
@Override
public boolean blacklistEssentiaFluidInExtraCells()
{
return this.extracellsBlacklist;
return this.extracells_Blist;
}
@Override
@@ -169,15 +195,81 @@ class ConfigurationHandler
}
@Override
public boolean forceTCFacades()
public boolean craftArcaneAssembler()
{
return this.forceTCFacades;
return this.craft_Arcane_Assembler;
}
@Override
public boolean gearboxModelDisabled()
public boolean craftArcaneCraftingTerminal()
{
return this.gearboxModelDisabled;
return this.craft_Arcane_Crafting_Term;
}
@Override
public boolean craftDistillationPatternEncoder()
{
return this.craft_Distillation_Pattern_Encoder;
}
@Override
public boolean craftEssentiaCells()
{
return this.craft_Essentia_Cells;
}
@Override
public boolean craftEssentiaProvider()
{
return this.craft_Essentia_Provider;
}
@Override
public boolean craftEssentiaVibrationChamber()
{
return this.craft_Essentia_Vibration_Chamber;
}
@Override
public boolean craftInfusionProvider()
{
return this.craft_Infusion_Provider;
}
@Override
public boolean craftVisRelayInterface()
{
return this.craft_Vis_Relay_Interface;
}
@Override
public boolean craftWirelessEssentiaTerminal()
{
return this.craft_Wireless_Essentia_Term;
}
@Override
public boolean disableGearboxModel()
{
return this.disable_Gearbox;
}
@Override
public boolean enableCertusQuartzDupe()
{
return this.enable_Quartz_Dupe;
}
@Override
public boolean enableWrenchFocus()
{
return this.enable_Wrench_Focus;
}
@Override
public boolean forceTCFacades()
{
return this.force_TC_Facades;
}
}
@@ -120,7 +120,7 @@ public abstract class AbstractBlockGearBoxBase
@Override
public final boolean isSideSolid( final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection side )
{
return ThEApi.instance().config().gearboxModelDisabled();
return ThEApi.instance().config().disableGearboxModel();
}
/**
@@ -158,7 +158,7 @@ public abstract class AbstractBlockGearBoxBase
@Override
public final boolean renderAsNormalBlock()
{
return ThEApi.instance().config().gearboxModelDisabled();
return ThEApi.instance().config().disableGearboxModel();
}
/**
@@ -168,7 +168,7 @@ public abstract class AbstractBlockGearBoxBase
@Override
public boolean shouldSideBeRendered( final IBlockAccess iblockaccess, final int i, final int j, final int k, final int l )
{
return ThEApi.instance().config().gearboxModelDisabled();
return ThEApi.instance().config().disableGearboxModel();
}
}
@@ -75,6 +75,23 @@ public class CommonDependantItems
public ItemStack CertusWrench;
public ItemStack VibrationChamber;
/**
* Populates the common items
*/
public CommonDependantItems()
{
// MC items
this.VanillaLapis = new ItemStack( (Item)Item.itemRegistry.getObject( "dye" ), 1, 4 );
this.RedstoneDust = new ItemStack( (Item)Item.itemRegistry.getObject( "redstone" ) );
this.RedstoneTorch = new ItemStack( net.minecraft.init.Blocks.redstone_torch );
// AE items
this.populateAEItems();
// TC items
this.populateTCItems();
}
/**
* Attempts to get the specified AE item.
* Returns a stack of size 1, or null.
@@ -189,21 +206,4 @@ public class CommonDependantItems
this.QuickSilverDrop = new ItemStack( ConfigItems.itemNugget, 1, 5 );
this.Thaumometer = new ItemStack( ConfigItems.itemThaumometer );
}
/**
* Populates the common items
*/
public void buildCommon()
{
// MC items
this.VanillaLapis = new ItemStack( (Item)Item.itemRegistry.getObject( "dye" ), 1, 4 );
this.RedstoneDust = new ItemStack( (Item)Item.itemRegistry.getObject( "redstone" ) );
this.RedstoneTorch = new ItemStack( net.minecraft.init.Blocks.redstone_torch );
// AE items
this.populateAEItems();
// TC items
this.populateTCItems();
}
}
@@ -5,6 +5,7 @@ import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
import thaumicenergistics.api.IThEConfig;
import thaumicenergistics.api.ThEApi;
import thaumicenergistics.common.registries.*;
import thaumicenergistics.common.registries.ResearchRegistry.ResearchTypes;
@@ -12,11 +13,16 @@ import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
public class FeatureACT
extends ThEDependencyFeatureBase
extends ThEThaumcraftResearchFeature
{
public FeatureACT()
{
super( ResearchTypes.ARCANE_TERMINAL.getKey() );
}
@Override
protected boolean checkConfigs()
protected boolean checkConfigs( final IThEConfig theConfig )
{
// Depends on crafting terminal
if( !AEConfig.instance.isFeatureEnabled( AEFeature.CraftingTerminal ) )
@@ -24,7 +30,7 @@ public class FeatureACT
return false;
}
return true;
return theConfig.craftArcaneCraftingTerminal();
}
@Override
@@ -33,6 +39,12 @@ public class FeatureACT
return new Object[] { cdi.CalculationProcessor, cdi.METerminal };
}
@Override
protected ThEThaumcraftResearchFeature getParentFeature()
{
return FeatureRegistry.instance().featureThaumicEnergistics;
}
@Override
protected void registerCrafting( final CommonDependantItems cdi )
{
@@ -54,8 +66,7 @@ public class FeatureACT
Object[] actRecipe = new Object[] { cdi.METerminal, cdi.ArcaneWorkTable, cdi.CalculationProcessor };
// Register
RecipeRegistry.PART_ARCANE_TERMINAL = ThaumcraftApi.addShapelessArcaneCraftingRecipe(
ResearchRegistry.ResearchTypes.ARCANE_TERMINAL.getKey(),
RecipeRegistry.PART_ARCANE_TERMINAL = ThaumcraftApi.addShapelessArcaneCraftingRecipe( this.researchKey,
ArcaneCraftingTerminal, actAspectList, actRecipe );
}
@@ -83,14 +94,7 @@ public class FeatureACT
}
@Override
public String getFirstValidParentKey( final boolean includeSelf )
public void registerPseudoParents()
{
if( includeSelf && this.isAvailable() )
{
return ResearchTypes.ARCANE_TERMINAL.getKey();
}
// Pass to parent
return FeatureRegistry.instance().featureResearchSetup.getFirstValidParentKey( true );
}
}
@@ -1,11 +1,11 @@
package thaumicenergistics.common.features;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
import thaumicenergistics.api.IThEConfig;
import thaumicenergistics.api.ThEApi;
import thaumicenergistics.common.registries.*;
import thaumicenergistics.common.registries.ResearchRegistry.PseudoResearchTypes;
@@ -16,11 +16,16 @@ import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
public class FeatureAutocrafting_Arcane
extends ThEDependencyFeatureBase
extends ThEThaumcraftResearchFeature
{
public FeatureAutocrafting_Arcane()
{
super( ResearchTypes.ARCANE_ASSEMBLER.getKey() );
}
@Override
protected boolean checkConfigs()
protected boolean checkConfigs( final IThEConfig theConfig )
{
// Depends on crafting CPU's
if( !AEConfig.instance.isFeatureEnabled( AEFeature.CraftingCPU ) )
@@ -34,7 +39,7 @@ public class FeatureAutocrafting_Arcane
return false;
}
return true;
return theConfig.craftArcaneAssembler();
}
@Override
@@ -43,6 +48,12 @@ public class FeatureAutocrafting_Arcane
return new Object[] { cdi.VibrantGlass, cdi.CalculationProcessor, cdi.LogicProcessor, cdi.MolecularAssembler };
}
@Override
protected ThEThaumcraftResearchFeature getParentFeature()
{
return FeatureRegistry.instance().featureVRI;
}
@Override
protected void registerCrafting( final CommonDependantItems cdi )
{
@@ -68,7 +79,7 @@ public class FeatureAutocrafting_Arcane
cdi.CalculationProcessor };
// Register KC
RecipeRegistry.ITEM_KNOWLEDGE_CORE = ThaumcraftApi.addArcaneCraftingRecipe( ResearchRegistry.ResearchTypes.KNOWLEDGE_INSCRIBER.getKey(),
RecipeRegistry.ITEM_KNOWLEDGE_CORE = ThaumcraftApi.addArcaneCraftingRecipe( this.researchKey,
KnowledgeCore, kCoreAspects, kCoreRecipe );
// Knowledge Inscriber
@@ -87,8 +98,7 @@ public class FeatureAutocrafting_Arcane
cdi.LogicProcessor };
// Register KI
RecipeRegistry.BLOCK_KNOWLEDGE_INSCRIBER = ThaumcraftApi.addArcaneCraftingRecipe(
ResearchRegistry.ResearchTypes.KNOWLEDGE_INSCRIBER.getKey(),
RecipeRegistry.BLOCK_KNOWLEDGE_INSCRIBER = ThaumcraftApi.addArcaneCraftingRecipe( this.researchKey,
KnowledgeInscriber, kiAspects, kiRecipe );
// Arcane Assembler
@@ -107,7 +117,7 @@ public class FeatureAutocrafting_Arcane
cdi.EntropyShard, cdi.FireShard };
// Register Assembler
RecipeRegistry.BLOCK_ARCANE_ASSEMBLER = ThaumcraftApi.addInfusionCraftingRecipe( ResearchRegistry.ResearchTypes.ARCANE_ASSEMBLER.getKey(),
RecipeRegistry.BLOCK_ARCANE_ASSEMBLER = ThaumcraftApi.addInfusionCraftingRecipe( this.researchKey,
ArcaneAssembler, 7, assemblerAspects, cdi.MolecularAssembler, assemblerRecipe );
}
@@ -171,21 +181,9 @@ public class FeatureAutocrafting_Arcane
}
@Override
public String getFirstValidParentKey( final boolean includeSelf )
public void registerPseudoParents()
{
if( includeSelf && this.isAvailable() )
{
return ResearchTypes.ARCANE_ASSEMBLER.getKey();
}
// Pass to parent
return FeatureRegistry.instance().featureVRI.getFirstValidParentKey( true );
}
@Override
public EnumSet<PseudoResearchTypes> getPseudoParentTypes()
{
return EnumSet.of( PseudoResearchTypes.SCEPTRE );
PseudoResearchTypes.SCEPTRE.registerPsudeoResearch();
}
}
@@ -5,6 +5,7 @@ import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
import thaumicenergistics.api.IThEConfig;
import thaumicenergistics.api.ThEApi;
import thaumicenergistics.common.registries.FeatureRegistry;
import thaumicenergistics.common.registries.RecipeRegistry;
@@ -14,11 +15,16 @@ import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
public class FeatureAutocrafting_Essentia
extends ThEDependencyFeatureBase
extends ThEThaumcraftResearchFeature
{
public FeatureAutocrafting_Essentia()
{
super( ResearchTypes.DISTILLATION_PATTERN_ENCODER.getKey() );
}
@Override
protected boolean checkConfigs()
protected boolean checkConfigs( final IThEConfig theConfig )
{
// Depends on crafting CPU's
if( !AEConfig.instance.isFeatureEnabled( AEFeature.CraftingCPU ) )
@@ -26,7 +32,7 @@ public class FeatureAutocrafting_Essentia
return false;
}
return true;
return theConfig.craftDistillationPatternEncoder();
}
@Override
@@ -35,6 +41,12 @@ public class FeatureAutocrafting_Essentia
return new Object[] { cdi.MEInterface, cdi.EngineeringProcessor };
}
@Override
protected ThEThaumcraftResearchFeature getParentFeature()
{
return FeatureRegistry.instance().featureEssentiaIOBuses;
}
@Override
protected void registerCrafting( final CommonDependantItems cdi )
{
@@ -52,8 +64,7 @@ public class FeatureAutocrafting_Essentia
cdi.EngineeringProcessor };
// Register
RecipeRegistry.BLOCK_DISTILLATION_PATTERN_ENCODER = ThaumcraftApi.addArcaneCraftingRecipe(
ResearchTypes.DISTILLATION_PATTERN_ENCODER.getKey(),
RecipeRegistry.BLOCK_DISTILLATION_PATTERN_ENCODER = ThaumcraftApi.addArcaneCraftingRecipe( this.researchKey,
dpeStack, dpeAspects, dpeRecipe );
}
@@ -92,15 +103,8 @@ public class FeatureAutocrafting_Essentia
}
@Override
public String getFirstValidParentKey( final boolean includeSelf )
public void registerPseudoParents()
{
if( includeSelf && this.isAvailable() )
{
return ResearchTypes.DISTILLATION_PATTERN_ENCODER.getKey();
}
// Pass to parent
return FeatureRegistry.instance().featureEssentiaIOBuses.getFirstValidParentKey( true );
}
}
@@ -1,7 +1,6 @@
package thaumicenergistics.common.features;
import java.util.ArrayList;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.oredict.ShapedOreRecipe;
@@ -13,6 +12,7 @@ import thaumcraft.api.crafting.IArcaneRecipe;
import thaumcraft.api.crafting.ShapedArcaneRecipe;
import thaumcraft.api.research.ResearchPage;
import thaumcraft.common.config.Config;
import thaumicenergistics.api.IThEConfig;
import thaumicenergistics.api.IThEItems;
import thaumicenergistics.api.ThEApi;
import thaumicenergistics.common.registries.*;
@@ -23,8 +23,13 @@ import appeng.core.features.AEFeature;
import cpw.mods.fml.common.registry.GameRegistry;
public class FeatureCells
extends ThEDependencyFeatureBase
extends ThEThaumcraftResearchFeature
{
public FeatureCells()
{
super( ResearchTypes.STORAGE.getKey() );
}
/**
* Helper function to replace a single item with a group of items in a
* recipe.
@@ -57,7 +62,7 @@ public class FeatureCells
}
@Override
protected boolean checkConfigs()
protected boolean checkConfigs( final IThEConfig theConfig )
{
// Depends on cells
if( !AEConfig.instance.isFeatureEnabled( AEFeature.StorageCells ) )
@@ -65,7 +70,7 @@ public class FeatureCells
return false;
}
return true;
return theConfig.craftEssentiaCells();
}
@Override
@@ -75,6 +80,12 @@ public class FeatureCells
cdi.CalculationProcessor, cdi.QuartzGlass, cdi.MECellWorkbench };
}
@Override
protected ThEThaumcraftResearchFeature getParentFeature()
{
return FeatureRegistry.instance().featureThaumicEnergistics;
}
@Override
protected void registerCrafting( final CommonDependantItems cdi )
{
@@ -120,7 +131,7 @@ public class FeatureCells
EssentiaStorageComponent_1k };
// Register 1K storage
RecipeRegistry.ITEM_STORAGE_COMPONENT_1K = ThaumcraftApi.addArcaneCraftingRecipe( ResearchTypes.STORAGE.getKey(),
RecipeRegistry.ITEM_STORAGE_COMPONENT_1K = ThaumcraftApi.addArcaneCraftingRecipe( this.researchKey,
EssentiaStorageComponent_1k,
aspects1KStorage, recipe1KStorage );
@@ -148,7 +159,7 @@ public class FeatureCells
EssentiaStorageComponent_4k };
// Register 4K storage
RecipeRegistry.ITEM_STORAGE_COMPONENT_4K = ThaumcraftApi.addArcaneCraftingRecipe( ResearchTypes.STORAGE.getKey(),
RecipeRegistry.ITEM_STORAGE_COMPONENT_4K = ThaumcraftApi.addArcaneCraftingRecipe( this.researchKey,
EssentiaStorageComponent_4k,
aspects4KStorage, recipe4KStorage );
@@ -173,7 +184,7 @@ public class FeatureCells
EssentiaStorageComponent_16k };
// Register 16K storage
RecipeRegistry.ITEM_STORAGE_COMPONENT_16K = ThaumcraftApi.addArcaneCraftingRecipe( ResearchTypes.STORAGE.getKey(),
RecipeRegistry.ITEM_STORAGE_COMPONENT_16K = ThaumcraftApi.addArcaneCraftingRecipe( this.researchKey,
EssentiaStorageComponent_16k,
aspects16KStorage, recipe16KStorage );
@@ -199,7 +210,7 @@ public class FeatureCells
EssentiaStorageComponent_64k };
// Register 64K storage
RecipeRegistry.ITEM_STORAGE_COMPONENT_64K = ThaumcraftApi.addArcaneCraftingRecipe( ResearchTypes.STORAGE.getKey(),
RecipeRegistry.ITEM_STORAGE_COMPONENT_64K = ThaumcraftApi.addArcaneCraftingRecipe( this.researchKey,
EssentiaStorageComponent_64k,
aspects64KStorage, recipe64KStorage );
@@ -271,26 +282,14 @@ public class FeatureCells
}
@Override
public String getFirstValidParentKey( final boolean includeSelf )
{
if( includeSelf && this.isAvailable() )
{
return ResearchTypes.STORAGE.getKey();
}
// Pass to parent
return FeatureRegistry.instance().featureResearchSetup.getFirstValidParentKey( true );
}
@Override
public EnumSet<PseudoResearchTypes> getPseudoParentTypes()
public void registerPseudoParents()
{
if( Config.wardedStone )
{
return EnumSet.of( PseudoResearchTypes.WARDED, PseudoResearchTypes.DISTILESSENTIA );
PseudoResearchTypes.WARDED.registerPsudeoResearch();
}
return EnumSet.of( PseudoResearchTypes.DISTILESSENTIA );
PseudoResearchTypes.DISTILESSENTIA.registerPsudeoResearch();
}
}
@@ -1,11 +1,11 @@
package thaumicenergistics.common.features;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
import thaumicenergistics.api.IThEConfig;
import thaumicenergistics.api.ThEApi;
import thaumicenergistics.common.items.ItemMaterial;
import thaumicenergistics.common.registries.*;
@@ -13,11 +13,16 @@ import thaumicenergistics.common.registries.ResearchRegistry.PseudoResearchTypes
import thaumicenergistics.common.registries.ResearchRegistry.ResearchTypes;
public class FeatureConversionCores
extends ThEDependencyFeatureBase
extends ThEThaumcraftResearchFeature
{
public FeatureConversionCores()
{
super( ResearchTypes.CORES.getKey() );
}
@Override
protected boolean checkConfigs()
protected boolean checkConfigs( final IThEConfig theConfig )
{
return true;
}
@@ -28,6 +33,12 @@ public class FeatureConversionCores
return new Object[] { cdi.FormationCore, cdi.AnnihilationCore };
}
@Override
protected ThEThaumcraftResearchFeature getParentFeature()
{
return FeatureRegistry.instance().featureThaumicEnergistics;
}
@Override
protected void registerCrafting( final CommonDependantItems cdi )
{
@@ -41,7 +52,7 @@ public class FeatureConversionCores
coalescenceAspects.add( Aspect.ORDER, 2 );
// Register Coalescence Core
RecipeRegistry.MATERIAL_COALESCENCE_CORE = ThaumcraftApi.addShapelessArcaneCraftingRecipe( ResearchRegistry.ResearchTypes.CORES.getKey(),
RecipeRegistry.MATERIAL_COALESCENCE_CORE = ThaumcraftApi.addShapelessArcaneCraftingRecipe( this.researchKey,
CoalescenceCore, coalescenceAspects, cdi.QuickSilverDrop, cdi.QuickSilverDrop, cdi.QuickSilverDrop, cdi.OrderShard, cdi.FormationCore );
// Set Diffusion Core aspects
@@ -50,7 +61,7 @@ public class FeatureConversionCores
diffusionAspects.add( Aspect.ENTROPY, 2 );
// Register Diffusion Core
RecipeRegistry.MATERIAL_DIFFUSION_CORE = ThaumcraftApi.addShapelessArcaneCraftingRecipe( ResearchRegistry.ResearchTypes.CORES.getKey(),
RecipeRegistry.MATERIAL_DIFFUSION_CORE = ThaumcraftApi.addShapelessArcaneCraftingRecipe( this.researchKey,
DiffusionCore, diffusionAspects, cdi.QuickSilverDrop, cdi.QuickSilverDrop, cdi.QuickSilverDrop, cdi.EntropyShard, cdi.AnnihilationCore );
}
@@ -80,21 +91,9 @@ public class FeatureConversionCores
}
@Override
public String getFirstValidParentKey( final boolean includeSelf )
public void registerPseudoParents()
{
if( includeSelf && this.isAvailable() )
{
return ResearchTypes.CORES.getKey();
}
// Pass to parent
return FeatureRegistry.instance().featureResearchSetup.getFirstValidParentKey( true );
}
@Override
public EnumSet<PseudoResearchTypes> getPseudoParentTypes()
{
return EnumSet.of( PseudoResearchTypes.DISTILESSENTIA );
PseudoResearchTypes.DISTILESSENTIA.registerPsudeoResearch();
}
}
@@ -1,12 +1,12 @@
package thaumicenergistics.common.features;
import java.util.ArrayList;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
import thaumicenergistics.api.IThEConfig;
import thaumicenergistics.api.ThEApi;
import thaumicenergistics.common.registries.*;
import thaumicenergistics.common.registries.ResearchRegistry.PseudoResearchTypes;
@@ -15,13 +15,18 @@ import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
public class FeatureEssentiaIOBuses
extends ThEDependencyFeatureBase
extends ThEThaumcraftResearchFeature
{
private boolean isImportExportEnabled = false;
public FeatureEssentiaIOBuses()
{
super( ResearchTypes.IO.getKey() );
}
@Override
protected boolean checkConfigs()
protected boolean checkConfigs( final IThEConfig theConfig )
{
this.isImportExportEnabled = ( AEConfig.instance.isFeatureEnabled( AEFeature.ImportBus ) || AEConfig.instance
.isFeatureEnabled( AEFeature.ExportBus ) );
@@ -35,6 +40,12 @@ public class FeatureEssentiaIOBuses
return null;
}
@Override
protected ThEThaumcraftResearchFeature getParentFeature()
{
return FeatureRegistry.instance().featureConversionCores;
}
@Override
protected void registerCrafting( final CommonDependantItems cdi )
{
@@ -54,7 +65,7 @@ public class FeatureEssentiaIOBuses
cdi.FilterTube, 'W', cdi.WardedGlass };
// Register the storage bus
RecipeRegistry.PART_STORAGE_BUS = ThaumcraftApi.addArcaneCraftingRecipe( ResearchRegistry.ResearchTypes.IO.getKey(), EssentiaStorageBus,
RecipeRegistry.PART_STORAGE_BUS = ThaumcraftApi.addArcaneCraftingRecipe( this.researchKey, EssentiaStorageBus,
storageAspectList, recipeStorageBus );
// Is import and export enabled?
@@ -77,11 +88,11 @@ public class FeatureEssentiaIOBuses
Object[] recipeExportBus = new Object[] { "JCJ", "IFI", 'J', cdi.WardedJar, 'C', CoalescenceCore, 'I', cdi.IronIngot, 'F', cdi.FilterTube };
// Register Import Bus
RecipeRegistry.PART_IMPORT_BUS = ThaumcraftApi.addArcaneCraftingRecipe( ResearchRegistry.ResearchTypes.IO.getKey(), EssentiaImportBus,
RecipeRegistry.PART_IMPORT_BUS = ThaumcraftApi.addArcaneCraftingRecipe( this.researchKey, EssentiaImportBus,
ioAspectList, recipeImportBus );
// Register Export Bus
RecipeRegistry.PART_EXPORT_BUS = ThaumcraftApi.addArcaneCraftingRecipe( ResearchRegistry.ResearchTypes.IO.getKey(), EssentiaExportBus,
RecipeRegistry.PART_EXPORT_BUS = ThaumcraftApi.addArcaneCraftingRecipe( this.researchKey, EssentiaExportBus,
ioAspectList, recipeExportBus );
}
}
@@ -129,20 +140,8 @@ public class FeatureEssentiaIOBuses
}
@Override
public String getFirstValidParentKey( final boolean includeSelf )
public void registerPseudoParents()
{
if( includeSelf && this.isAvailable() )
{
return ResearchTypes.IO.getKey();
}
// Pass to parent
return FeatureRegistry.instance().featureConversionCores.getFirstValidParentKey( true );
}
@Override
public EnumSet<PseudoResearchTypes> getPseudoParentTypes()
{
return EnumSet.of( PseudoResearchTypes.TUBEFILTER );
PseudoResearchTypes.TUBEFILTER.registerPsudeoResearch();
}
}
@@ -7,6 +7,7 @@ import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
import thaumicenergistics.api.IThEConfig;
import thaumicenergistics.api.IThEItems;
import thaumicenergistics.api.IThEParts;
import thaumicenergistics.api.ThEApi;
@@ -17,16 +18,22 @@ import appeng.core.features.AEFeature;
import cpw.mods.fml.common.registry.GameRegistry;
public class FeatureEssentiaMonitoring
extends ThEDependencyFeatureBase
extends ThEThaumcraftResearchFeature
{
private boolean isWirelessEnabled = false, isConversionEnabled = false;
public FeatureEssentiaMonitoring()
{
super( ResearchTypes.ESSENTIA_TERMINAL.getKey() );
}
@Override
protected boolean checkConfigs()
protected boolean checkConfigs( final IThEConfig theConfig )
{
this.isConversionEnabled = AEConfig.instance.isFeatureEnabled( AEFeature.PartConversionMonitor );
this.isWirelessEnabled = AEConfig.instance.isFeatureEnabled( AEFeature.WirelessAccessTerminal );
this.isWirelessEnabled = AEConfig.instance.isFeatureEnabled( AEFeature.WirelessAccessTerminal )
&& theConfig.craftWirelessEssentiaTerminal();
return true;
}
@@ -38,6 +45,12 @@ public class FeatureEssentiaMonitoring
return new Object[] { cdi.LogicProcessor, cdi.CalculationProcessor };
}
@Override
protected ThEThaumcraftResearchFeature getParentFeature()
{
return FeatureRegistry.instance().featureConversionCores;
}
@Override
protected void registerCrafting( final CommonDependantItems cdi )
{
@@ -58,7 +71,7 @@ public class FeatureEssentiaMonitoring
// Register Essentia Terminal
RecipeRegistry.PART_ESSENTIA_TERMINAL = ThaumcraftApi.addShapelessArcaneCraftingRecipe(
ResearchRegistry.ResearchTypes.ESSENTIA_TERMINAL.getKey(), EssentiaTerminal, etAspectList, cdi.IlluminatedPanel, DiffusionCore,
this.researchKey, EssentiaTerminal, etAspectList, cdi.IlluminatedPanel, DiffusionCore,
CoalescenceCore, cdi.LogicProcessor, cdi.VisFilter );
// Is wireless term enabled?
@@ -80,7 +93,7 @@ public class FeatureEssentiaMonitoring
// Register Essentia Level Emitter
RecipeRegistry.PART_ESSENTIA_LEVEL_EMITTER = ThaumcraftApi.addShapelessArcaneCraftingRecipe(
ResearchRegistry.ResearchTypes.ESSENTIA_TERMINAL.getKey(), EssentiaLevelEmitter, emitterAspectList, cdi.CalculationProcessor,
this.researchKey, EssentiaLevelEmitter, emitterAspectList, cdi.CalculationProcessor,
cdi.RedstoneTorch, cdi.SalisMundus );
// Register Essentia Storage Monitor
@@ -141,14 +154,7 @@ public class FeatureEssentiaMonitoring
}
@Override
public String getFirstValidParentKey( final boolean includeSelf )
public void registerPseudoParents()
{
if( includeSelf && this.isAvailable() )
{
return ResearchTypes.ESSENTIA_TERMINAL.getKey();
}
// Pass to parent
return FeatureRegistry.instance().featureConversionCores.getFirstValidParentKey( true );
}
}
@@ -5,23 +5,25 @@ import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
import thaumicenergistics.api.IThEConfig;
import thaumicenergistics.api.ThEApi;
import thaumicenergistics.common.registries.*;
import thaumicenergistics.common.registries.ResearchRegistry.ResearchTypes;
public class FeatureEssentiaProvider
extends ThEDependencyFeatureBase
extends ThEThaumcraftResearchFeature
{
public FeatureEssentiaProvider()
{
super( ResearchTypes.ESSENTIA_PROVIDER.getKey() );
}
@Override
protected boolean checkConfigs()
protected boolean checkConfigs( final IThEConfig theConfig )
{
// Depends on ThE config
if( !ThEApi.instance().config().allowedToCraftEssentiaProvider() )
{
return false;
}
return true;
return theConfig.craftEssentiaProvider();
}
@Override
@@ -30,6 +32,12 @@ public class FeatureEssentiaProvider
return new Object[] { cdi.MEInterface };
}
@Override
protected ThEThaumcraftResearchFeature getParentFeature()
{
return FeatureRegistry.instance().featureEssentiaIOBuses;
}
@Override
protected void registerCrafting( final CommonDependantItems cdi )
{
@@ -50,7 +58,7 @@ public class FeatureEssentiaProvider
DiffusionCore, cdi.WaterShard };
// Register Essentia Provider
RecipeRegistry.BLOCK_ESSENTIA_PROVIDER = ThaumcraftApi.addInfusionCraftingRecipe( ResearchRegistry.ResearchTypes.ESSENTIA_PROVIDER.getKey(),
RecipeRegistry.BLOCK_ESSENTIA_PROVIDER = ThaumcraftApi.addInfusionCraftingRecipe( this.researchKey,
EssentiaProvider, 3, essentiaProviderList, cdi.MEInterface, recipeEssentiaProvider );
}
@@ -81,15 +89,8 @@ public class FeatureEssentiaProvider
}
@Override
public String getFirstValidParentKey( final boolean includeSelf )
public void registerPseudoParents()
{
if( includeSelf && this.isAvailable() )
{
return ResearchTypes.ESSENTIA_PROVIDER.getKey();
}
// Pass to parent
return FeatureRegistry.instance().featureEssentiaIOBuses.getFirstValidParentKey( true );
}
}
@@ -5,6 +5,7 @@ import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
import thaumicenergistics.api.IThEConfig;
import thaumicenergistics.api.ThEApi;
import thaumicenergistics.common.registries.FeatureRegistry;
import thaumicenergistics.common.registries.RecipeRegistry;
@@ -14,10 +15,15 @@ import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
public class FeatureEssentiaVibrationChamber
extends ThEDependencyFeatureBase
extends ThEThaumcraftResearchFeature
{
public FeatureEssentiaVibrationChamber()
{
super( ResearchTypes.ESSENTIA_VIBRATION_CHAMBER.getKey() );
}
@Override
protected boolean checkConfigs()
protected boolean checkConfigs( final IThEConfig theConfig )
{
// Depends on power generation
if( !AEConfig.instance.isFeatureEnabled( AEFeature.PowerGen ) )
@@ -25,7 +31,7 @@ public class FeatureEssentiaVibrationChamber
return false;
}
return true;
return theConfig.craftEssentiaVibrationChamber();
}
@Override
@@ -35,6 +41,12 @@ public class FeatureEssentiaVibrationChamber
return new Object[] { cdi.WardedJar, cdi.VibrationChamber, cdi.AnnihilationCore };
}
@Override
protected ThEThaumcraftResearchFeature getParentFeature()
{
return FeatureRegistry.instance().featureConversionCores;
}
@Override
protected void registerCrafting( final CommonDependantItems cdi )
{
@@ -50,8 +62,8 @@ public class FeatureEssentiaVibrationChamber
chamberAspects.add( Aspect.ORDER, 4 );
// Register Chamber
RecipeRegistry.BLOCK_ESSENTIA_VIBRATION_CHAMBER = ThaumcraftApi.addShapelessArcaneCraftingRecipe(
ResearchTypes.ESSENTIA_VIBRATION_CHAMBER.getKey(), EssVibrationChamber, chamberAspects, cdi.VibrationChamber, DiffusionCore,
RecipeRegistry.BLOCK_ESSENTIA_VIBRATION_CHAMBER = ThaumcraftApi.addShapelessArcaneCraftingRecipe( this.researchKey,
EssVibrationChamber, chamberAspects, cdi.VibrationChamber, DiffusionCore,
cdi.WardedJar );
}
@@ -90,15 +102,8 @@ public class FeatureEssentiaVibrationChamber
}
@Override
public String getFirstValidParentKey( final boolean includeSelf )
public void registerPseudoParents()
{
if( includeSelf && this.isAvailable() )
{
return ResearchTypes.ESSENTIA_VIBRATION_CHAMBER.getKey();
}
// Pass to parent
return FeatureRegistry.instance().featureConversionCores.getFirstValidParentKey( true );
}
}
@@ -1,6 +1,5 @@
package thaumicenergistics.common.features;
import java.util.EnumSet;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
@@ -8,6 +7,7 @@ import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
import thaumicenergistics.api.IThEConfig;
import thaumicenergistics.api.ThEApi;
import thaumicenergistics.common.registries.RecipeRegistry;
import thaumicenergistics.common.registries.ResearchRegistry;
@@ -15,12 +15,30 @@ import thaumicenergistics.common.registries.ResearchRegistry.PseudoResearchTypes
import thaumicenergistics.common.registries.ResearchRegistry.ResearchTypes;
public class FeatureGearbox
extends ThEFeatureBase
extends ThEThaumcraftResearchFeature
{
public FeatureGearbox()
{
super( true );
super( ResearchTypes.IRON_GEARBOX.getKey() );
}
@Override
protected boolean checkConfigs( final IThEConfig theConfig )
{
return true;
}
@Override
protected Object[] getItemReqs( final CommonDependantItems cdi )
{
return null;
}
@Override
protected ThEThaumcraftResearchFeature getParentFeature()
{
return null;
}
@Override
@@ -51,7 +69,7 @@ public class FeatureGearbox
Object[] recipeIronGear = new Object[] { " I ", " W ", "I I", 'I', cdi.IronIngot, 'W', WoodGear };
// Register Iron Gear
RecipeRegistry.MATERIAL_IRON_GEAR = ThaumcraftApi.addArcaneCraftingRecipe( ResearchRegistry.ResearchTypes.IRON_GEARBOX.getKey(), ThEIronGear,
RecipeRegistry.MATERIAL_IRON_GEAR = ThaumcraftApi.addArcaneCraftingRecipe( this.researchKey, ThEIronGear,
ironGearAspects, recipeIronGear );
// Set Iron Gear Box aspects
@@ -62,7 +80,7 @@ public class FeatureGearbox
// Iron Gear Box recipe
Object[] recipeIronGearBox = new Object[] { "SGS", "GGG", "SGS", 'S', cdi.Cobblestone, 'G', IronGear };
RecipeRegistry.BLOCK_IRONGEARBOX = ThaumcraftApi.addArcaneCraftingRecipe( ResearchRegistry.ResearchTypes.IRON_GEARBOX.getKey(), IronGearBox,
RecipeRegistry.BLOCK_IRONGEARBOX = ThaumcraftApi.addArcaneCraftingRecipe( this.researchKey, IronGearBox,
igbAspects, recipeIronGearBox );
// Set Thaumium Gear Box aspects
@@ -123,21 +141,10 @@ public class FeatureGearbox
}
@Override
public String getFirstValidParentKey( final boolean includeSelf )
public void registerPseudoParents()
{
if( includeSelf && this.isAvailable() )
{
return ResearchTypes.IRON_GEARBOX.getKey();
}
PseudoResearchTypes.COREUSE.registerPsudeoResearch();
// No parent to pass to
return "";
}
@Override
public EnumSet<PseudoResearchTypes> getPseudoParentTypes()
{
return EnumSet.of( PseudoResearchTypes.COREUSE );
}
}
@@ -1,30 +1,30 @@
package thaumicenergistics.common.features;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
import thaumcraft.common.config.Config;
import thaumicenergistics.api.IThEConfig;
import thaumicenergistics.api.ThEApi;
import thaumicenergistics.common.registries.*;
import thaumicenergistics.common.registries.ResearchRegistry.PseudoResearchTypes;
import thaumicenergistics.common.registries.ResearchRegistry.ResearchTypes;
public class FeatureInfusionProvider
extends ThEDependencyFeatureBase
extends ThEThaumcraftResearchFeature
{
public FeatureInfusionProvider()
{
super( ResearchTypes.INFUSION_PROVIDER.getKey() );
}
@Override
protected boolean checkConfigs()
protected boolean checkConfigs( final IThEConfig theConfig )
{
// Depends on ThEConfig
if( !ThEApi.instance().config().allowedToCraftInfusionProvider() )
{
return false;
}
return true;
return theConfig.craftInfusionProvider();
}
@Override
@@ -33,6 +33,12 @@ public class FeatureInfusionProvider
return new Object[] { cdi.MEInterface };
}
@Override
protected ThEThaumcraftResearchFeature getParentFeature()
{
return FeatureRegistry.instance().featureEssentiaIOBuses;
}
@Override
protected void registerCrafting( final CommonDependantItems cdi )
{
@@ -52,7 +58,7 @@ public class FeatureInfusionProvider
cdi.SalisMundus, CoalescenceCore, cdi.AirShard };
// Create the infusion provider recipe
RecipeRegistry.BLOCK_INFUSION_PROVIDER = ThaumcraftApi.addInfusionCraftingRecipe( ResearchRegistry.ResearchTypes.INFUSION_PROVIDER.getKey(),
RecipeRegistry.BLOCK_INFUSION_PROVIDER = ThaumcraftApi.addInfusionCraftingRecipe( this.researchKey,
InfusionProvider, 4, infusionProviderList, cdi.MEInterface, infusionProviderRecipeItems );
}
@@ -89,21 +95,18 @@ public class FeatureInfusionProvider
}
@Override
public String getFirstValidParentKey( final boolean includeSelf )
public void registerPseudoParents()
{
if( includeSelf && this.isAvailable() )
PseudoResearchTypes.INFUSION.registerPsudeoResearch();
if( Config.allowMirrors )
{
return ResearchTypes.INFUSION_PROVIDER.getKey();
PseudoResearchTypes.MIRROR.registerPsudeoResearch();
}
else
{
PseudoResearchTypes.JAR.registerPsudeoResearch();
}
// Pass to parent
return FeatureRegistry.instance().featureEssentiaIOBuses.getFirstValidParentKey( true );
}
@Override
public EnumSet<PseudoResearchTypes> getPseudoParentTypes()
{
return EnumSet.of( PseudoResearchTypes.INFUSION, ( Config.allowMirrors ? PseudoResearchTypes.MIRROR : PseudoResearchTypes.JAR ) );
}
}
@@ -1,30 +1,31 @@
package thaumicenergistics.common.features;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
import thaumicenergistics.api.ThEApi;
import thaumicenergistics.common.registries.*;
import thaumicenergistics.api.IThEConfig;
import thaumicenergistics.common.registries.RecipeRegistry;
import thaumicenergistics.common.registries.ResearchRegistry;
import thaumicenergistics.common.registries.ResearchRegistry.PseudoResearchTypes;
import thaumicenergistics.common.registries.ResearchRegistry.ResearchTypes;
import appeng.api.AEApi;
public class FeatureQuartzDupe
extends ThEDependencyFeatureBase
extends ThEThaumcraftResearchFeature
{
public FeatureQuartzDupe()
{
super( ResearchTypes.CERTUS_DUPE.getKey() );
}
@Override
protected boolean checkConfigs()
protected boolean checkConfigs( final IThEConfig theConfig )
{
// Depends on ThE config
if( !ThEApi.instance().config().allowedToDuplicateCertusQuartz() )
{
return false;
}
return true;
return theConfig.enableCertusQuartzDupe();
}
@Override
@@ -33,6 +34,12 @@ public class FeatureQuartzDupe
return null;
}
@Override
protected ThEThaumcraftResearchFeature getParentFeature()
{
return null;
}
@Override
protected void registerCrafting( final CommonDependantItems cdi )
{
@@ -47,7 +54,7 @@ public class FeatureQuartzDupe
NetherQuartz2.stackSize = 2;
// Certus Quartz
if( FeatureRegistry.instance().getCommonItems().CertusQuartz != null )
if( cdi.CertusQuartz != null )
{
AspectList certusAspects = new AspectList();
certusAspects.add( Aspect.CRYSTAL, 4 );
@@ -97,20 +104,8 @@ public class FeatureQuartzDupe
}
@Override
public String getFirstValidParentKey( final boolean includeSelf )
public void registerPseudoParents()
{
if( includeSelf && this.isAvailable() )
{
return ResearchTypes.CERTUS_DUPE.getKey();
}
// No parent
return "";
}
@Override
public EnumSet<PseudoResearchTypes> getPseudoParentTypes()
{
return EnumSet.of( PseudoResearchTypes.DUPE );
PseudoResearchTypes.DUPE.registerPsudeoResearch();
}
}
@@ -1,99 +0,0 @@
package thaumicenergistics.common.features;
import java.util.ArrayList;
import net.minecraft.util.ResourceLocation;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchCategories;
import thaumcraft.api.research.ResearchItem;
import thaumcraft.api.research.ResearchPage;
import thaumicenergistics.common.ThaumicEnergistics;
import thaumicenergistics.common.registries.ResearchRegistry;
import thaumicenergistics.common.registries.ResearchRegistry.PseudoResearchTypes;
import thaumicenergistics.common.registries.ResearchRegistry.ResearchTypes;
public class FeatureResearchSetup
extends ThEFeatureBase
{
/**
* Research background image
*/
private static final ResourceLocation RESEARCH_BACKGROUND = new ResourceLocation( ThaumicEnergistics.MOD_ID,
"textures/research/Research.Background.png" );
/**
* Research tab image
*/
private static final ResourceLocation TAB_ICON = new ResourceLocation( ThaumicEnergistics.MOD_ID, "textures/research/tab.icon.png" );
/**
* Set to true when the research has been finalized.
*/
private boolean hasFinalizedResearch = false;
public FeatureResearchSetup()
{
// Inform the super we are enabled by default.
super( true );
}
@Override
protected void registerResearch()
{
// Create the research tab
ResearchCategories
.registerCategory( ResearchRegistry.TERESEARCH_TAB, FeatureResearchSetup.TAB_ICON, FeatureResearchSetup.RESEARCH_BACKGROUND );
// Create the basic research item
ResearchTypes.BASIC.researchItem = new ResearchItem( ResearchTypes.BASIC.getKey(), ResearchRegistry.TERESEARCH_TAB, new AspectList(), 0, 0,
0, FeatureResearchSetup.TAB_ICON );
ResearchTypes.BASIC.researchItem.setPages( new ResearchPage[] { new ResearchPage( ResearchTypes.BASIC.getPageName( 1 ) ) } );
ResearchTypes.BASIC.researchItem.setStub().setRound().setAutoUnlock();
ResearchTypes.BASIC.researchItem.registerResearchItem();
}
/**
* Finishes the Thaumcraft registration by inserting the pseudo-parents for
* any enabled research features.
*
* @param featureList
*/
public void finalizeRegistration( final ArrayList<ThEFeatureBase> featureList )
{
if( this.hasFinalizedResearch )
{
return;
}
// Loop over all features
for( ThEFeatureBase feature : featureList )
{
// Is the feature available?
if( feature.isAvailable() )
{
// Get parent(s)
for( PseudoResearchTypes type : feature.getPseudoParentTypes() )
{
// Register parent
type.registerPsudeoResearch();
}
}
}
// Mark that finalization has occurred.
this.hasFinalizedResearch = true;
}
@Override
public String getFirstValidParentKey( final boolean includeSelf )
{
if( includeSelf )
{
return ResearchTypes.BASIC.getKey();
}
return "";
}
}
@@ -5,7 +5,7 @@ import net.minecraft.block.Block;
import net.minecraftforge.common.config.Property;
import thaumcraft.common.config.Config;
import thaumcraft.common.config.ConfigBlocks;
import thaumicenergistics.api.ThEApi;
import thaumicenergistics.api.IThEConfig;
import appeng.core.FacadeConfig;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
@@ -59,9 +59,9 @@ public class FeatureThaumcraftFacades
}
@Override
protected boolean checkConfigs()
protected boolean checkConfigs( final IThEConfig theConfig )
{
return ThEApi.instance().config().forceTCFacades();
return theConfig.forceTCFacades();
}
@Override
@@ -71,8 +71,11 @@ public class FeatureThaumcraftFacades
}
@Override
protected void registerCrafting( final CommonDependantItems cdi )
protected void registerAdditional()
{
// Call super
super.registerAdditional();
// Amber block
this.forceEnabled( ConfigBlocks.blockCosmeticOpaque, 0 );
@@ -122,4 +125,9 @@ public class FeatureThaumcraftFacades
this.forceEnabled( ConfigBlocks.blockTaint, 2 );
}
@Override
protected void registerCrafting( final CommonDependantItems cdi )
{
}
}
@@ -0,0 +1,80 @@
package thaumicenergistics.common.features;
import net.minecraft.util.ResourceLocation;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchCategories;
import thaumcraft.api.research.ResearchItem;
import thaumcraft.api.research.ResearchPage;
import thaumicenergistics.api.IThEConfig;
import thaumicenergistics.common.ThaumicEnergistics;
import thaumicenergistics.common.registries.ResearchRegistry;
import thaumicenergistics.common.registries.ResearchRegistry.ResearchTypes;
public class FeatureThaumicEnergisticsResearch
extends ThEThaumcraftResearchFeature
{
/**
* Research background image
*/
private static final ResourceLocation RESEARCH_BACKGROUND = new ResourceLocation( ThaumicEnergistics.MOD_ID,
"textures/research/Research.Background.png" );
/**
* Research tab image
*/
private static final ResourceLocation TAB_ICON = new ResourceLocation( ThaumicEnergistics.MOD_ID, "textures/research/tab.icon.png" );
public FeatureThaumicEnergisticsResearch()
{
super( ResearchTypes.BASIC.getKey() );
}
@Override
protected boolean checkConfigs( final IThEConfig theConfig )
{
return true;
}
@Override
protected Object[] getItemReqs( final CommonDependantItems cdi )
{
return null;
}
@Override
protected ThEThaumcraftResearchFeature getParentFeature()
{
return null;
}
@Override
protected void registerCrafting( final CommonDependantItems cdi )
{
}
@Override
protected void registerResearch()
{
// Create the research tab
ResearchCategories.registerCategory(
ResearchRegistry.TERESEARCH_TAB, FeatureThaumicEnergisticsResearch.TAB_ICON,
FeatureThaumicEnergisticsResearch.RESEARCH_BACKGROUND );
// Create the basic research item
ResearchTypes.BASIC.researchItem = new ResearchItem( this.researchKey,
ResearchRegistry.TERESEARCH_TAB, new AspectList(),
0, 0, 0, FeatureThaumicEnergisticsResearch.TAB_ICON );
ResearchTypes.BASIC.researchItem.setPages( new ResearchPage[] {
new ResearchPage( ResearchTypes.BASIC.getPageName( 1 ) ) } );
ResearchTypes.BASIC.researchItem.setRound().setAutoUnlock();
ResearchTypes.BASIC.researchItem.registerResearchItem();
}
@Override
public void registerPseudoParents()
{
}
}
@@ -1,11 +1,11 @@
package thaumicenergistics.common.features;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
import thaumicenergistics.api.IThEConfig;
import thaumicenergistics.api.ThEApi;
import thaumicenergistics.common.registries.*;
import thaumicenergistics.common.registries.ResearchRegistry.PseudoResearchTypes;
@@ -14,10 +14,15 @@ import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
public class FeatureVisRelayInterface
extends ThEDependencyFeatureBase
extends ThEThaumcraftResearchFeature
{
public FeatureVisRelayInterface()
{
super( ResearchTypes.VIS_RELAY_INTERFACE.getKey() );
}
@Override
protected boolean checkConfigs()
protected boolean checkConfigs( final IThEConfig theConfig )
{
// Depends on P2P
if( !AEConfig.instance.isFeatureEnabled( AEFeature.P2PTunnel ) )
@@ -25,7 +30,7 @@ public class FeatureVisRelayInterface
return false;
}
return true;
return theConfig.craftVisRelayInterface();
}
@Override
@@ -34,6 +39,12 @@ public class FeatureVisRelayInterface
return new Object[] { cdi.MEP2P };
}
@Override
protected ThEThaumcraftResearchFeature getParentFeature()
{
return FeatureRegistry.instance().featureACT;
}
@Override
protected void registerCrafting( final CommonDependantItems cdi )
{
@@ -48,8 +59,7 @@ public class FeatureVisRelayInterface
visInterfaceAspectList.add( Aspect.FIRE, 2 );
visInterfaceAspectList.add( Aspect.ORDER, 2 );
visInterfaceAspectList.add( Aspect.WATER, 2 );
RecipeRegistry.PART_VIS_INTERFACE = ThaumcraftApi.addShapelessArcaneCraftingRecipe(
ResearchRegistry.ResearchTypes.VIS_RELAY_INTERFACE.getKey(),
RecipeRegistry.PART_VIS_INTERFACE = ThaumcraftApi.addShapelessArcaneCraftingRecipe( this.researchKey,
VisInterface, visInterfaceAspectList, cdi.BallanceShard, cdi.MEP2P );
}
@@ -80,21 +90,9 @@ public class FeatureVisRelayInterface
}
@Override
public String getFirstValidParentKey( final boolean includeSelf )
public void registerPseudoParents()
{
if( includeSelf && this.isAvailable() )
{
return ResearchTypes.VIS_RELAY_INTERFACE.getKey();
}
// Pass to parent
return FeatureRegistry.instance().featureACT.getFirstValidParentKey( true );
}
@Override
public EnumSet<PseudoResearchTypes> getPseudoParentTypes()
{
return EnumSet.of( PseudoResearchTypes.VISPOWER );
PseudoResearchTypes.VISPOWER.registerPsudeoResearch();
}
}
@@ -1,11 +1,11 @@
package thaumicenergistics.common.features;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchPage;
import thaumicenergistics.api.IThEConfig;
import thaumicenergistics.api.ThEApi;
import thaumicenergistics.common.registries.RecipeRegistry;
import thaumicenergistics.common.registries.ResearchRegistry;
@@ -15,10 +15,15 @@ import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
public class FeatureWrenchFocus
extends ThEDependencyFeatureBase
extends ThEThaumcraftResearchFeature
{
public FeatureWrenchFocus()
{
super( ResearchTypes.FOCUS_WRENCH.getKey() );
}
@Override
protected boolean checkConfigs()
protected boolean checkConfigs( final IThEConfig theConfig )
{
// Depends on quartz tools
if( !AEConfig.instance.isFeatureEnabled( AEFeature.CertusQuartzTools ) )
@@ -32,7 +37,7 @@ public class FeatureWrenchFocus
return false;
}
return true;
return theConfig.enableWrenchFocus();
}
@Override
@@ -41,6 +46,12 @@ public class FeatureWrenchFocus
return new Object[] { cdi.CertusWrench };
}
@Override
protected ThEThaumcraftResearchFeature getParentFeature()
{
return null;
}
@Override
protected void registerCrafting( final CommonDependantItems cdi )
{
@@ -51,7 +62,7 @@ public class FeatureWrenchFocus
AspectList wrenchAspects = new AspectList();
wrenchAspects.add( Aspect.AIR, 10 );
wrenchAspects.add( Aspect.FIRE, 10 );
RecipeRegistry.ITEM_WRENCH_FOCUS = ThaumcraftApi.addArcaneCraftingRecipe( ResearchRegistry.ResearchTypes.FOCUS_WRENCH.getKey(), WrenchFocus,
RecipeRegistry.ITEM_WRENCH_FOCUS = ThaumcraftApi.addArcaneCraftingRecipe( this.researchKey, WrenchFocus,
wrenchAspects, new Object[] { "ANF", "NWN", "FNA", 'A', cdi.AirShard, 'F', cdi.FireShard, 'N', cdi.NetherQuartz, 'W', cdi.CertusWrench } );
}
@@ -78,21 +89,9 @@ public class FeatureWrenchFocus
}
@Override
public String getFirstValidParentKey( final boolean includeSelf )
public void registerPseudoParents()
{
if( includeSelf && this.isAvailable() )
{
return ResearchTypes.FOCUS_WRENCH.getKey();
}
// No parent
return "";
}
@Override
public EnumSet<PseudoResearchTypes> getPseudoParentTypes()
{
return EnumSet.of( PseudoResearchTypes.FOCUSFIRE );
PseudoResearchTypes.FOCUSFIRE.registerPsudeoResearch();
}
}
@@ -1,5 +1,10 @@
package thaumicenergistics.common.features;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import thaumicenergistics.api.IThEConfig;
import thaumicenergistics.api.ThEApi;
import thaumicenergistics.common.registries.FeatureRegistry;
/**
* Defines a feature that depends on a configuration setting and/or specific
@@ -11,9 +16,14 @@ package thaumicenergistics.common.features;
public abstract class ThEDependencyFeatureBase
extends ThEFeatureBase
{
/**
* True if the requirements have been checked.
*/
private boolean hasCheckedReqs = false;
public ThEDependencyFeatureBase()
{
// Inform the super that we are not enabled by default
// Disabled by default
super( false );
}
@@ -47,24 +57,38 @@ public abstract class ThEDependencyFeatureBase
/**
* Checks if this feature can be enabled based on ThE, TC and/or AE configs.
*/
protected abstract boolean checkConfigs();
protected abstract boolean checkConfigs( @Nonnull IThEConfig theConfig );
/**
* Gets the features required items.
*
* @return
*/
@Nullable
protected abstract Object[] getItemReqs( CommonDependantItems cdi );
@Override
protected void registerAdditional()
{
}
/**
* Evaluates the dependencies of the feature and enables it if possible.
*
* @param cdi
*/
public final void evaluateDependencies( final CommonDependantItems cdi )
@Override
public boolean isAvailable()
{
// Ask for the features config settings and required items
this.setAvailable( this.checkConfigs() && this.checkItemReqs( this.getItemReqs( cdi ) ) );
if( !this.hasCheckedReqs )
{
// Ask for the features config settings and required items
this.available = this.checkConfigs( ThEApi.instance().config() )
&& this.checkItemReqs( this.getItemReqs( FeatureRegistry.instance().cdi ) );
this.hasCheckedReqs = true;
}
return super.isAvailable();
}
}
@@ -1,8 +1,5 @@
package thaumicenergistics.common.features;
import java.util.EnumSet;
import thaumicenergistics.common.registries.ResearchRegistry.PseudoResearchTypes;
/**
* Defines what a basic feature of ThE is.
*
@@ -12,16 +9,16 @@ import thaumicenergistics.common.registries.ResearchRegistry.PseudoResearchTypes
public abstract class ThEFeatureBase
{
/**
* Is the feature available.
*/
private boolean available = false;
/**
* Has the feature been called to register itself?
*/
private boolean hasRegistered = false;
/**
* Is the feature available.
*/
protected boolean available = false;
/**
* Creates the feature.
*
@@ -29,60 +26,20 @@ public abstract class ThEFeatureBase
*/
public ThEFeatureBase( final boolean initiallyAvailable )
{
this.setAvailable( initiallyAvailable );
this.available = initiallyAvailable;
}
/**
* Registers any additional features of this feature.
*/
protected abstract void registerAdditional();
/**
* Registers the features crafting recipes, if it has any.
*
* @param cdi
*/
protected void registerCrafting( final CommonDependantItems cdi )
{
}
/**
* Registers the research with Thaumcraft, if it has any.
*/
protected void registerResearch()
{
}
/**
* Set if the feature is available.
*
* @param available
*/
protected void setAvailable( final boolean available )
{
this.available = available;
}
/**
* Gets the research key of the first valid parent that can be found.
* If the feature in question is not enabled, it will pass the call to its
* parent.
*
* Only valid for Thaumcraft features.
*
* @return
*/
public String getFirstValidParentKey( final boolean includeSelf )
{
return "";
}
/**
* Gets the features pseudo-parent(s) if it has any.
*
* Only valid for Thaumcraft features.
*
* @return
*/
public EnumSet<PseudoResearchTypes> getPseudoParentTypes()
{
return EnumSet.noneOf( PseudoResearchTypes.class );
}
protected abstract void registerCrafting( final CommonDependantItems cdi );
/**
* Is the feature available?
@@ -107,8 +64,8 @@ public abstract class ThEFeatureBase
// Register crafting recipe(s)
this.registerCrafting( cdi );
// Register Thaumcraft research.
this.registerResearch();
// Register anything else
this.registerAdditional();
// Mark that this feature has been registered
this.hasRegistered = true;
@@ -0,0 +1,86 @@
package thaumicenergistics.common.features;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Defines a feature that has Thaumcraft research.
*
* @author Nividica
*
*/
public abstract class ThEThaumcraftResearchFeature
extends ThEDependencyFeatureBase
{
/**
* The research key for this research.
*/
public final String researchKey;
/**
* Creates the feature with the specified research key.
*
* @param parent
*/
public ThEThaumcraftResearchFeature( @Nonnull final String researchKey )
{
this.researchKey = researchKey;
}
/**
* Gets the parent for this feature, if there is one.
*
* @return
*/
@Nullable
protected abstract ThEThaumcraftResearchFeature getParentFeature();
@Override
protected void registerAdditional()
{
// Call super
super.registerAdditional();
// Register Thaumcraft research.
this.registerResearch();
// Register pseudo parents
this.registerPseudoParents();
}
/**
* Registers the research with Thaumcraft, if it has any.
*/
protected abstract void registerResearch();
/**
* Gets the research key of the first valid parent that can be found.
* If the feature in question is not enabled, it will pass the call to its
* parent.
*
* @param includeSelf
* @return
*/
public final String getFirstValidParentKey( final boolean includeSelf )
{
if( this.isAvailable() && includeSelf )
{
return this.researchKey;
}
else if( this.getParentFeature() != null )
{
// Pass to parent
return this.getParentFeature().getFirstValidParentKey( true );
}
else
{
// No parent
return "";
}
}
/**
* If the research item has any pseudo parents, register them here.
*/
public abstract void registerPseudoParents();
}
@@ -16,12 +16,7 @@ public class FeatureRegistry
/**
* Singleton instance of the FR
*/
private static FeatureRegistry instanceFR;
/**
* Commonly used dependency items.
*/
private final CommonDependantItems commonItems;
private static FeatureRegistry INSTANCE;
/**
* All features.
@@ -33,10 +28,15 @@ public class FeatureRegistry
*/
private boolean hasRegistered = false;
/**
* Commonly used dependency items.
*/
public final CommonDependantItems cdi;
/**
* Sets up the TC research tab.
*/
public final FeatureResearchSetup featureResearchSetup;
public final FeatureThaumicEnergisticsResearch featureThaumicEnergistics;
/**
* Autocrafting.
@@ -119,10 +119,10 @@ public class FeatureRegistry
private FeatureRegistry()
{
// Build common items
this.commonItems = new CommonDependantItems();
this.cdi = new CommonDependantItems();
// Build setup
this.featureResearchSetup = new FeatureResearchSetup();
// Build ThE primary node
this.featuresList.add( this.featureThaumicEnergistics = new FeatureThaumicEnergisticsResearch() );
// Build autocrafting
this.featuresList.add( this.featureAutoCrafting_Arcane = new FeatureAutocrafting_Arcane() );
@@ -177,22 +177,12 @@ public class FeatureRegistry
*/
public static FeatureRegistry instance()
{
if( FeatureRegistry.instanceFR == null )
if( FeatureRegistry.INSTANCE == null )
{
FeatureRegistry.instanceFR = new FeatureRegistry();
FeatureRegistry.INSTANCE = new FeatureRegistry();
}
return FeatureRegistry.instanceFR;
}
/**
* Gets items that are depended on.
*
* @return
*/
public CommonDependantItems getCommonItems()
{
return this.commonItems;
return FeatureRegistry.INSTANCE;
}
/**
@@ -207,33 +197,13 @@ public class FeatureRegistry
return;
}
// Build common items
this.commonItems.buildCommon();
// Build dependencies
for( ThEFeatureBase feature : this.featuresList )
{
// Is the feature a dependency feature?
if( feature instanceof ThEDependencyFeatureBase )
{
// Evaluate the dependencies
( (ThEDependencyFeatureBase)feature ).evaluateDependencies( this.commonItems );
}
}
// Start with the setup
this.featureResearchSetup.registerFeature( this.commonItems );
// Register each feature
for( ThEFeatureBase feature : this.featuresList )
{
// Attempt to register the feature
feature.registerFeature( this.commonItems );
feature.registerFeature( this.cdi );
}
// Finish the registration
this.featureResearchSetup.finalizeRegistration( this.featuresList );
// Mark that registration has occurred.
this.hasRegistered = true;
}
@@ -34,7 +34,7 @@ public class Renderers
RenderingRegistry.registerBlockHandler( new RenderBlockInfusionProvider() );
// Are gearbox models enabled?
if( !ThEApi.instance().config().gearboxModelDisabled() )
if( !ThEApi.instance().config().disableGearboxModel() )
{
// Register the gearbox renderer
ClientRegistry.bindTileEntitySpecialRenderer( TileGearBox.class, new RenderTileGearbox() );