2014-11-14 12:02:52 +01:00
|
|
|
/*
|
|
|
|
* This file is part of Applied Energistics 2.
|
2015-05-16 20:48:32 +02:00
|
|
|
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
2014-11-14 12:02:52 +01:00
|
|
|
*
|
|
|
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
|
|
|
*/
|
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
package appeng.core;
|
|
|
|
|
2014-11-18 16:47:30 +01:00
|
|
|
|
2015-08-20 19:15:52 +02:00
|
|
|
import java.io.File;
|
2016-06-21 11:03:10 +02:00
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.Set;
|
2015-08-20 19:15:52 +02:00
|
|
|
import javax.annotation.Nonnull;
|
|
|
|
|
|
|
|
import com.google.common.base.Preconditions;
|
|
|
|
|
2016-06-19 14:43:27 +02:00
|
|
|
import net.minecraft.world.DimensionType;
|
|
|
|
import net.minecraft.world.biome.Biome;
|
2014-09-24 02:26:27 +02:00
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
2015-06-16 02:44:59 +02:00
|
|
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
|
|
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
|
|
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
|
|
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
|
|
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
2014-09-24 02:26:27 +02:00
|
|
|
import net.minecraftforge.oredict.RecipeSorter;
|
|
|
|
import net.minecraftforge.oredict.RecipeSorter.Category;
|
2015-06-17 23:30:23 +02:00
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
import appeng.api.config.Upgrades;
|
2015-01-03 02:53:14 +01:00
|
|
|
import appeng.api.definitions.IBlocks;
|
|
|
|
import appeng.api.definitions.IItems;
|
|
|
|
import appeng.api.definitions.IParts;
|
2014-09-24 02:26:27 +02:00
|
|
|
import appeng.api.features.IRecipeHandlerRegistry;
|
2014-12-29 12:48:22 +01:00
|
|
|
import appeng.api.features.IRegistryContainer;
|
2014-09-24 02:26:27 +02:00
|
|
|
import appeng.api.features.IWirelessTermHandler;
|
|
|
|
import appeng.api.features.IWorldGen.WorldGenType;
|
|
|
|
import appeng.api.movable.IMovableRegistry;
|
|
|
|
import appeng.api.networking.IGridCacheRegistry;
|
|
|
|
import appeng.api.networking.crafting.ICraftingGrid;
|
|
|
|
import appeng.api.networking.energy.IEnergyGrid;
|
|
|
|
import appeng.api.networking.pathing.IPathingGrid;
|
|
|
|
import appeng.api.networking.security.ISecurityGrid;
|
|
|
|
import appeng.api.networking.spatial.ISpatialCache;
|
|
|
|
import appeng.api.networking.storage.IStorageGrid;
|
|
|
|
import appeng.api.networking.ticking.ITickManager;
|
|
|
|
import appeng.api.parts.IPartHelper;
|
|
|
|
import appeng.core.features.AEFeature;
|
|
|
|
import appeng.core.features.registries.P2PTunnelRegistry;
|
|
|
|
import appeng.core.features.registries.entries.BasicCellHandler;
|
|
|
|
import appeng.core.features.registries.entries.CreativeCellHandler;
|
|
|
|
import appeng.core.localization.GuiText;
|
|
|
|
import appeng.core.localization.PlayerMessages;
|
|
|
|
import appeng.core.stats.PlayerStatsRegistration;
|
|
|
|
import appeng.hooks.TickHandler;
|
2016-08-19 12:38:21 +02:00
|
|
|
import appeng.items.materials.ItemMultiItem;
|
2016-08-28 12:10:40 +02:00
|
|
|
import appeng.items.parts.ItemFacade;
|
2016-06-21 11:03:10 +02:00
|
|
|
import appeng.loot.ChestLoot;
|
2014-09-24 02:26:27 +02:00
|
|
|
import appeng.me.cache.CraftingGridCache;
|
|
|
|
import appeng.me.cache.EnergyGridCache;
|
|
|
|
import appeng.me.cache.GridStorageCache;
|
|
|
|
import appeng.me.cache.P2PCache;
|
|
|
|
import appeng.me.cache.PathGridCache;
|
|
|
|
import appeng.me.cache.SecurityCache;
|
|
|
|
import appeng.me.cache.SpatialPylonCache;
|
|
|
|
import appeng.me.cache.TickManagerCache;
|
|
|
|
import appeng.me.storage.AEExternalHandler;
|
|
|
|
import appeng.parts.PartPlacement;
|
|
|
|
import appeng.recipes.AEItemResolver;
|
2015-08-20 19:15:52 +02:00
|
|
|
import appeng.recipes.CustomRecipeConfig;
|
2014-09-24 02:26:27 +02:00
|
|
|
import appeng.recipes.RecipeHandler;
|
|
|
|
import appeng.recipes.game.DisassembleRecipe;
|
|
|
|
import appeng.recipes.game.FacadeRecipe;
|
|
|
|
import appeng.recipes.game.ShapedRecipe;
|
|
|
|
import appeng.recipes.game.ShapelessRecipe;
|
|
|
|
import appeng.recipes.handlers.Crusher;
|
|
|
|
import appeng.recipes.handlers.Grind;
|
|
|
|
import appeng.recipes.handlers.GrindFZ;
|
|
|
|
import appeng.recipes.handlers.HCCrusher;
|
|
|
|
import appeng.recipes.handlers.Inscribe;
|
|
|
|
import appeng.recipes.handlers.Macerator;
|
|
|
|
import appeng.recipes.handlers.MekCrusher;
|
|
|
|
import appeng.recipes.handlers.MekEnrichment;
|
|
|
|
import appeng.recipes.handlers.Press;
|
|
|
|
import appeng.recipes.handlers.Pulverizer;
|
|
|
|
import appeng.recipes.handlers.Shaped;
|
|
|
|
import appeng.recipes.handlers.Shapeless;
|
|
|
|
import appeng.recipes.handlers.Smelt;
|
|
|
|
import appeng.recipes.ores.OreDictionaryHandler;
|
|
|
|
import appeng.spatial.BiomeGenStorage;
|
|
|
|
import appeng.spatial.StorageWorldProvider;
|
|
|
|
import appeng.tile.AEBaseTile;
|
|
|
|
import appeng.util.Platform;
|
2015-04-03 08:54:31 +02:00
|
|
|
import appeng.worldgen.MeteoriteWorldGen;
|
|
|
|
import appeng.worldgen.QuartzWorldGen;
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
|
2014-12-29 12:48:22 +01:00
|
|
|
public final class Registration
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2014-11-27 18:18:15 +01:00
|
|
|
private final RecipeHandler recipeHandler;
|
2016-06-19 14:43:27 +02:00
|
|
|
private DimensionType storageDimensionType;
|
|
|
|
private Biome storageBiome;
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-08-20 19:15:52 +02:00
|
|
|
Registration()
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2014-12-29 15:13:47 +01:00
|
|
|
this.recipeHandler = new RecipeHandler();
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
2016-06-19 14:43:27 +02:00
|
|
|
public Biome getStorageBiome()
|
2015-08-20 19:15:52 +02:00
|
|
|
{
|
|
|
|
return this.storageBiome;
|
|
|
|
}
|
|
|
|
|
2016-06-19 14:43:27 +02:00
|
|
|
public DimensionType getStorageDimensionType()
|
|
|
|
{
|
|
|
|
return storageDimensionType;
|
|
|
|
}
|
|
|
|
|
2015-10-08 15:42:42 +02:00
|
|
|
void preInitialize( final FMLPreInitializationEvent event )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2014-12-29 15:13:47 +01:00
|
|
|
this.registerSpatial( false );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-01-03 02:53:14 +01:00
|
|
|
final Api api = Api.INSTANCE;
|
2015-09-30 14:24:40 +02:00
|
|
|
final IRecipeHandlerRegistry recipeRegistry = api.registries().recipes();
|
2015-01-03 02:53:14 +01:00
|
|
|
this.registerCraftHandlers( recipeRegistry );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
RecipeSorter.register( "AE2-Facade", FacadeRecipe.class, Category.SHAPED, "" );
|
|
|
|
RecipeSorter.register( "AE2-Shaped", ShapedRecipe.class, Category.SHAPED, "" );
|
|
|
|
RecipeSorter.register( "AE2-Shapeless", ShapelessRecipe.class, Category.SHAPELESS, "" );
|
|
|
|
|
2015-01-01 22:13:10 +01:00
|
|
|
MinecraftForge.EVENT_BUS.register( OreDictionaryHandler.INSTANCE );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2016-08-22 14:25:10 +02:00
|
|
|
ApiDefinitions definitions = api.definitions();
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-01-03 02:53:14 +01:00
|
|
|
// Register all detected handlers and features (items, blocks) in pre-init
|
2016-08-22 14:25:10 +02:00
|
|
|
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.preInitialize( event.getSide() ) );
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
2015-09-30 14:24:40 +02:00
|
|
|
private void registerSpatial( final boolean force )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
if( !AEConfig.instance.isFeatureEnabled( AEFeature.SpatialIO ) )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2014-11-18 16:47:30 +01:00
|
|
|
return;
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-09-30 14:24:40 +02:00
|
|
|
final AEConfig config = AEConfig.instance;
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
if( this.storageBiome == null )
|
2014-11-18 16:47:30 +01:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
if( force && config.storageBiomeID == -1 )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2016-06-19 14:43:27 +02:00
|
|
|
config.storageBiomeID = Platform.findEmpty( Biome.REGISTRY, 0, 256 );
|
2015-04-03 08:54:31 +02:00
|
|
|
if( config.storageBiomeID == -1 )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2015-03-23 10:14:35 +01:00
|
|
|
throw new IllegalStateException( "Biome Array is full, please free up some Biome ID's or disable spatial." );
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2016-06-19 14:43:27 +02:00
|
|
|
this.storageBiome = new BiomeGenStorage();
|
2014-11-18 16:47:30 +01:00
|
|
|
config.save();
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
if( !force && config.storageBiomeID != -1 )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2016-06-19 14:43:27 +02:00
|
|
|
this.storageBiome = new BiomeGenStorage();
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2014-11-18 16:47:30 +01:00
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
if( config.storageProviderID != -1 )
|
2014-11-18 16:47:30 +01:00
|
|
|
{
|
2016-06-19 14:43:27 +02:00
|
|
|
storageDimensionType = DimensionType.register( "Storage Cell", "_cell", config.storageProviderID, StorageWorldProvider.class, false );
|
2014-11-18 16:47:30 +01:00
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
if( config.storageProviderID == -1 && force )
|
2014-11-18 16:47:30 +01:00
|
|
|
{
|
2016-06-21 11:03:10 +02:00
|
|
|
final Set<Integer> ids = new HashSet<>();
|
|
|
|
for( DimensionType type : DimensionType.values() )
|
|
|
|
{
|
|
|
|
ids.add( type.getId() );
|
|
|
|
}
|
|
|
|
|
2014-11-18 16:47:30 +01:00
|
|
|
config.storageProviderID = -11;
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2016-06-21 11:03:10 +02:00
|
|
|
while( ids.contains( config.storageProviderID ) )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2014-11-18 16:47:30 +01:00
|
|
|
config.storageProviderID--;
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2016-06-21 11:03:10 +02:00
|
|
|
|
2016-06-19 14:43:27 +02:00
|
|
|
storageDimensionType = DimensionType.register( "Storage Cell", "_cell", config.storageProviderID, StorageWorldProvider.class, false );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2014-11-18 16:47:30 +01:00
|
|
|
config.save();
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-30 14:24:40 +02:00
|
|
|
private void registerCraftHandlers( final IRecipeHandlerRegistry registry )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-01-03 02:53:14 +01:00
|
|
|
registry.addNewSubItemResolver( new AEItemResolver() );
|
|
|
|
|
|
|
|
registry.addNewCraftHandler( "hccrusher", HCCrusher.class );
|
|
|
|
registry.addNewCraftHandler( "mekcrusher", MekCrusher.class );
|
|
|
|
registry.addNewCraftHandler( "mekechamber", MekEnrichment.class );
|
|
|
|
registry.addNewCraftHandler( "grind", Grind.class );
|
|
|
|
registry.addNewCraftHandler( "crusher", Crusher.class );
|
|
|
|
registry.addNewCraftHandler( "grindfz", GrindFZ.class );
|
|
|
|
registry.addNewCraftHandler( "pulverizer", Pulverizer.class );
|
|
|
|
registry.addNewCraftHandler( "macerator", Macerator.class );
|
|
|
|
|
|
|
|
registry.addNewCraftHandler( "smelt", Smelt.class );
|
|
|
|
registry.addNewCraftHandler( "inscribe", Inscribe.class );
|
|
|
|
registry.addNewCraftHandler( "press", Press.class );
|
|
|
|
|
|
|
|
registry.addNewCraftHandler( "shaped", Shaped.class );
|
|
|
|
registry.addNewCraftHandler( "shapeless", Shapeless.class );
|
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-08-20 19:15:52 +02:00
|
|
|
public void initialize( @Nonnull final FMLInitializationEvent event, @Nonnull final File recipeDirectory, @Nonnull final CustomRecipeConfig customRecipeConfig )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-08-20 19:15:52 +02:00
|
|
|
Preconditions.checkNotNull( event );
|
|
|
|
Preconditions.checkNotNull( recipeDirectory );
|
|
|
|
Preconditions.checkArgument( !recipeDirectory.isFile() );
|
|
|
|
Preconditions.checkNotNull( customRecipeConfig );
|
|
|
|
|
2016-08-22 14:25:10 +02:00
|
|
|
final Api api = Api.INSTANCE;
|
2015-01-03 02:53:14 +01:00
|
|
|
final IPartHelper partHelper = api.partHelper();
|
|
|
|
final IRegistryContainer registries = api.registries();
|
|
|
|
|
2016-08-22 14:25:10 +02:00
|
|
|
ApiDefinitions definitions = api.definitions();
|
|
|
|
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.initialize( event.getSide() ) );
|
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
// Perform ore camouflage!
|
2016-08-19 12:38:21 +02:00
|
|
|
ItemMultiItem.instance.makeUnique();
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-08-20 19:15:52 +02:00
|
|
|
final Runnable recipeLoader = new RecipeLoader( recipeDirectory, customRecipeConfig, this.recipeHandler );
|
2015-05-13 22:02:54 +02:00
|
|
|
recipeLoader.run();
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-06-26 22:50:09 +02:00
|
|
|
// TODO readd layers
|
2015-08-20 19:15:52 +02:00
|
|
|
// partHelper.registerNewLayer( "appeng.parts.layers.LayerISidedInventory",
|
|
|
|
// "net.minecraft.inventory.ISidedInventory" );
|
|
|
|
// partHelper.registerNewLayer( "appeng.parts.layers.LayerIFluidHandler",
|
|
|
|
// "net.minecraftforge.fluids.IFluidHandler" );
|
|
|
|
// partHelper.registerNewLayer( "appeng.parts.layers.LayerITileStorageMonitorable",
|
|
|
|
// "appeng.api.implementations.tiles.ITileStorageMonitorable" );
|
|
|
|
|
|
|
|
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.IC2 ) )
|
|
|
|
// {
|
|
|
|
// partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySink", "ic2.api.energy.tile.IEnergySink" );
|
|
|
|
// partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" );
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.RF ) )
|
|
|
|
// {
|
|
|
|
// partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergyHandler", "cofh.api.energy.IEnergyReceiver" );
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.OpenComputers ) )
|
|
|
|
// {
|
|
|
|
// partHelper.registerNewLayer( "appeng.parts.layers.LayerSidedEnvironment",
|
|
|
|
// "li.cil.oc.api.network.SidedEnvironment" );
|
|
|
|
// }
|
2015-05-07 23:03:32 +02:00
|
|
|
|
2015-01-01 22:13:10 +01:00
|
|
|
FMLCommonHandler.instance().bus().register( TickHandler.INSTANCE );
|
|
|
|
MinecraftForge.EVENT_BUS.register( TickHandler.INSTANCE );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2016-06-21 11:03:10 +02:00
|
|
|
|
|
|
|
MinecraftForge.EVENT_BUS.register( new PartPlacement() );
|
|
|
|
|
|
|
|
if( AEConfig.instance.isFeatureEnabled( AEFeature.ChestLoot ) )
|
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.register( new ChestLoot() );
|
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-09-30 14:24:40 +02:00
|
|
|
final IGridCacheRegistry gcr = registries.gridCache();
|
2014-09-24 02:26:27 +02:00
|
|
|
gcr.registerGridCache( ITickManager.class, TickManagerCache.class );
|
|
|
|
gcr.registerGridCache( IEnergyGrid.class, EnergyGridCache.class );
|
|
|
|
gcr.registerGridCache( IPathingGrid.class, PathGridCache.class );
|
|
|
|
gcr.registerGridCache( IStorageGrid.class, GridStorageCache.class );
|
|
|
|
gcr.registerGridCache( P2PCache.class, P2PCache.class );
|
|
|
|
gcr.registerGridCache( ISpatialCache.class, SpatialPylonCache.class );
|
|
|
|
gcr.registerGridCache( ISecurityGrid.class, SecurityCache.class );
|
|
|
|
gcr.registerGridCache( ICraftingGrid.class, CraftingGridCache.class );
|
|
|
|
|
2015-01-03 02:53:14 +01:00
|
|
|
registries.externalStorage().addExternalStorageInterface( new AEExternalHandler() );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-01-03 02:53:14 +01:00
|
|
|
registries.cell().addCellHandler( new BasicCellHandler() );
|
|
|
|
registries.cell().addCellHandler( new CreativeCellHandler() );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2016-08-24 19:06:10 +02:00
|
|
|
api.definitions().materials().matterBall().maybeStack( 1 ).ifPresent( ammoStack ->
|
2015-01-03 02:53:14 +01:00
|
|
|
{
|
|
|
|
final double weight = 32;
|
|
|
|
|
|
|
|
registries.matterCannon().registerAmmo( ammoStack, weight );
|
2016-08-24 19:06:10 +02:00
|
|
|
} );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2014-12-29 15:13:47 +01:00
|
|
|
this.recipeHandler.injectRecipes();
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2014-12-19 12:28:41 +01:00
|
|
|
final PlayerStatsRegistration registration = new PlayerStatsRegistration( FMLCommonHandler.instance().bus(), AEConfig.instance );
|
|
|
|
registration.registerAchievementHandlers();
|
|
|
|
registration.registerAchievements();
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-08-20 19:15:52 +02:00
|
|
|
if( AEConfig.instance.isFeatureEnabled( AEFeature.EnableDisassemblyCrafting ) )
|
2015-04-26 23:20:08 +02:00
|
|
|
{
|
|
|
|
GameRegistry.addRecipe( new DisassembleRecipe() );
|
|
|
|
RecipeSorter.register( "appliedenergistics2:disassemble", DisassembleRecipe.class, Category.SHAPELESS, "after:minecraft:shapeless" );
|
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-08-20 19:15:52 +02:00
|
|
|
if( AEConfig.instance.isFeatureEnabled( AEFeature.EnableFacadeCrafting ) )
|
2015-04-26 23:20:08 +02:00
|
|
|
{
|
2016-08-28 12:10:40 +02:00
|
|
|
definitions.items().facade().maybeItem().ifPresent( facadeItem -> {
|
|
|
|
GameRegistry.addRecipe( new FacadeRecipe( (ItemFacade) facadeItem ) );
|
|
|
|
RecipeSorter.register( "appliedenergistics2:facade", FacadeRecipe.class, Category.SHAPED, "after:minecraft:shaped" );
|
|
|
|
} );
|
2015-04-26 23:20:08 +02:00
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
2015-10-08 15:42:42 +02:00
|
|
|
void postInit( final FMLPostInitializationEvent event )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2014-12-29 15:13:47 +01:00
|
|
|
this.registerSpatial( true );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2016-08-22 14:25:10 +02:00
|
|
|
final Api api = Api.INSTANCE;
|
2014-12-29 12:48:22 +01:00
|
|
|
final IRegistryContainer registries = api.registries();
|
2016-08-22 14:25:10 +02:00
|
|
|
ApiDefinitions definitions = api.definitions();
|
2015-01-03 02:53:14 +01:00
|
|
|
final IParts parts = definitions.parts();
|
|
|
|
final IBlocks blocks = definitions.blocks();
|
|
|
|
final IItems items = definitions.items();
|
2014-12-29 12:48:22 +01:00
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
// default settings..
|
2015-01-03 02:53:14 +01:00
|
|
|
( (P2PTunnelRegistry) registries.p2pTunnel() ).configure();
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2014-09-28 11:47:17 +02:00
|
|
|
// add to localization..
|
2014-09-24 02:26:27 +02:00
|
|
|
PlayerMessages.values();
|
|
|
|
GuiText.values();
|
|
|
|
|
2015-04-20 21:12:03 +02:00
|
|
|
Api.INSTANCE.partHelper().initFMPSupport();
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2016-08-22 14:25:10 +02:00
|
|
|
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.postInitialize( event.getSide() ) );
|
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
// Interface
|
2015-01-03 02:53:14 +01:00
|
|
|
Upgrades.CRAFTING.registerItem( parts.iface(), 1 );
|
|
|
|
Upgrades.CRAFTING.registerItem( blocks.iface(), 1 );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
// IO Port!
|
2015-01-03 02:53:14 +01:00
|
|
|
Upgrades.SPEED.registerItem( blocks.iOPort(), 3 );
|
|
|
|
Upgrades.REDSTONE.registerItem( blocks.iOPort(), 1 );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
// Level Emitter!
|
2015-01-03 02:53:14 +01:00
|
|
|
Upgrades.FUZZY.registerItem( parts.levelEmitter(), 1 );
|
|
|
|
Upgrades.CRAFTING.registerItem( parts.levelEmitter(), 1 );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
// Import Bus
|
2015-01-03 02:53:14 +01:00
|
|
|
Upgrades.FUZZY.registerItem( parts.importBus(), 1 );
|
|
|
|
Upgrades.REDSTONE.registerItem( parts.importBus(), 1 );
|
|
|
|
Upgrades.CAPACITY.registerItem( parts.importBus(), 2 );
|
|
|
|
Upgrades.SPEED.registerItem( parts.importBus(), 4 );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
// Export Bus
|
2015-01-03 02:53:14 +01:00
|
|
|
Upgrades.FUZZY.registerItem( parts.exportBus(), 1 );
|
|
|
|
Upgrades.REDSTONE.registerItem( parts.exportBus(), 1 );
|
|
|
|
Upgrades.CAPACITY.registerItem( parts.exportBus(), 2 );
|
|
|
|
Upgrades.SPEED.registerItem( parts.exportBus(), 4 );
|
|
|
|
Upgrades.CRAFTING.registerItem( parts.exportBus(), 1 );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
// Storage Cells
|
2015-01-03 02:53:14 +01:00
|
|
|
Upgrades.FUZZY.registerItem( items.cell1k(), 1 );
|
|
|
|
Upgrades.INVERTER.registerItem( items.cell1k(), 1 );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-01-03 02:53:14 +01:00
|
|
|
Upgrades.FUZZY.registerItem( items.cell4k(), 1 );
|
|
|
|
Upgrades.INVERTER.registerItem( items.cell4k(), 1 );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-01-03 02:53:14 +01:00
|
|
|
Upgrades.FUZZY.registerItem( items.cell16k(), 1 );
|
|
|
|
Upgrades.INVERTER.registerItem( items.cell16k(), 1 );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-01-03 02:53:14 +01:00
|
|
|
Upgrades.FUZZY.registerItem( items.cell64k(), 1 );
|
|
|
|
Upgrades.INVERTER.registerItem( items.cell64k(), 1 );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-01-03 02:53:14 +01:00
|
|
|
Upgrades.FUZZY.registerItem( items.portableCell(), 1 );
|
|
|
|
Upgrades.INVERTER.registerItem( items.portableCell(), 1 );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-01-03 02:53:14 +01:00
|
|
|
Upgrades.FUZZY.registerItem( items.viewCell(), 1 );
|
|
|
|
Upgrades.INVERTER.registerItem( items.viewCell(), 1 );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
// Storage Bus
|
2015-01-03 02:53:14 +01:00
|
|
|
Upgrades.FUZZY.registerItem( parts.storageBus(), 1 );
|
|
|
|
Upgrades.INVERTER.registerItem( parts.storageBus(), 1 );
|
|
|
|
Upgrades.CAPACITY.registerItem( parts.storageBus(), 5 );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
// Formation Plane
|
2015-01-03 02:53:14 +01:00
|
|
|
Upgrades.FUZZY.registerItem( parts.formationPlane(), 1 );
|
|
|
|
Upgrades.INVERTER.registerItem( parts.formationPlane(), 1 );
|
|
|
|
Upgrades.CAPACITY.registerItem( parts.formationPlane(), 5 );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
// Matter Cannon
|
2015-01-03 02:53:14 +01:00
|
|
|
Upgrades.FUZZY.registerItem( items.massCannon(), 1 );
|
|
|
|
Upgrades.INVERTER.registerItem( items.massCannon(), 1 );
|
|
|
|
Upgrades.SPEED.registerItem( items.massCannon(), 4 );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
// Molecular Assembler
|
2015-01-03 02:53:14 +01:00
|
|
|
Upgrades.SPEED.registerItem( blocks.molecularAssembler(), 5 );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2014-09-25 22:30:19 +02:00
|
|
|
// Inscriber
|
2015-01-03 02:53:14 +01:00
|
|
|
Upgrades.SPEED.registerItem( blocks.inscriber(), 3 );
|
2014-09-25 22:30:19 +02:00
|
|
|
|
2016-08-24 19:06:10 +02:00
|
|
|
items.wirelessTerminal().maybeItem().ifPresent( terminal ->
|
2014-12-29 12:48:22 +01:00
|
|
|
{
|
2016-08-24 19:06:10 +02:00
|
|
|
registries.wireless().registerWirelessHandler( (IWirelessTermHandler) terminal );
|
|
|
|
} );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
// add villager trading to black smiths for a few basic materials
|
2015-04-03 08:54:31 +02:00
|
|
|
if( AEConfig.instance.isFeatureEnabled( AEFeature.VillagerTrading ) )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2015-06-16 02:44:59 +02:00
|
|
|
// TODO: VILLAGER TRADING
|
|
|
|
// VillagerRegistry.instance().getRegisteredVillagers()..registerVillageTradeHandler( 3, new AETrading() );
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
if( AEConfig.instance.isFeatureEnabled( AEFeature.CertusQuartzWorldGen ) )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2014-09-24 02:26:27 +02:00
|
|
|
GameRegistry.registerWorldGenerator( new QuartzWorldGen(), 0 );
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
if( AEConfig.instance.isFeatureEnabled( AEFeature.MeteoriteWorldGen ) )
|
2014-10-19 02:32:51 +02:00
|
|
|
{
|
2014-09-24 02:26:27 +02:00
|
|
|
GameRegistry.registerWorldGenerator( new MeteoriteWorldGen(), 0 );
|
2014-10-19 02:32:51 +02:00
|
|
|
}
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-09-30 14:24:40 +02:00
|
|
|
final IMovableRegistry mr = registries.movable();
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2016-08-22 14:25:10 +02:00
|
|
|
/*
|
2014-09-24 02:26:27 +02:00
|
|
|
* You can't move bed rock.
|
|
|
|
*/
|
2016-06-19 14:43:27 +02:00
|
|
|
mr.blacklistBlock( net.minecraft.init.Blocks.BEDROCK );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* White List Vanilla...
|
|
|
|
*/
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityBeacon.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityBrewingStand.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityChest.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityCommandBlock.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityComparator.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityDaylightDetector.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityDispenser.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityDropper.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEnchantmentTable.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEnderChest.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEndPortal.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntitySkull.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityFurnace.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityMobSpawner.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntitySign.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityPiston.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityFlowerPot.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityNote.class );
|
|
|
|
mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityHopper.class );
|
|
|
|
|
2016-08-22 14:25:10 +02:00
|
|
|
/*
|
2014-09-24 02:26:27 +02:00
|
|
|
* Whitelist AE2
|
|
|
|
*/
|
|
|
|
mr.whiteListTileEntity( AEBaseTile.class );
|
|
|
|
|
2016-08-22 14:25:10 +02:00
|
|
|
/*
|
2014-09-24 02:26:27 +02:00
|
|
|
* world gen
|
|
|
|
*/
|
2015-09-30 14:24:40 +02:00
|
|
|
for( final WorldGenType type : WorldGenType.values() )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2014-12-29 12:48:22 +01:00
|
|
|
registries.worldgen().disableWorldGenForProviderID( type, StorageWorldProvider.class );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2014-11-18 16:47:30 +01:00
|
|
|
// nether
|
2014-12-29 12:48:22 +01:00
|
|
|
registries.worldgen().disableWorldGenForDimension( type, -1 );
|
2014-10-19 05:29:02 +02:00
|
|
|
|
2014-11-18 16:47:30 +01:00
|
|
|
// end
|
2014-12-29 12:48:22 +01:00
|
|
|
registries.worldgen().disableWorldGenForDimension( type, 1 );
|
2014-10-19 05:29:02 +02:00
|
|
|
}
|
|
|
|
|
2014-11-18 16:47:30 +01:00
|
|
|
// whitelist from config
|
2015-09-30 14:24:40 +02:00
|
|
|
for( final int dimension : AEConfig.instance.meteoriteDimensionWhitelist )
|
2014-10-19 05:29:02 +02:00
|
|
|
{
|
2014-12-29 12:48:22 +01:00
|
|
|
registries.worldgen().enableWorldGenForDimension( WorldGenType.Meteorites, dimension );
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
2016-08-22 14:25:10 +02:00
|
|
|
/*
|
2014-09-24 02:26:27 +02:00
|
|
|
* initial recipe bake, if ore dictionary changes after this it re-bakes.
|
|
|
|
*/
|
2015-01-01 22:13:10 +01:00
|
|
|
OreDictionaryHandler.INSTANCE.bakeRecipes();
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
}
|