Merge pull request #652 from thatsIch/b-644-NPE-on-disabled-features
Fixes #644 Several missing null checks when disabling huge chunks of the mod via config
This commit is contained in:
commit
2b34ba5840
7 changed files with 144 additions and 98 deletions
|
@ -23,10 +23,14 @@
|
||||||
|
|
||||||
package appeng.api.config;
|
package appeng.api.config;
|
||||||
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import appeng.api.util.AEItemDefinition;
|
||||||
|
|
||||||
|
|
||||||
public enum Upgrades
|
public enum Upgrades
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -42,8 +46,9 @@ public enum Upgrades
|
||||||
public final int myTier;
|
public final int myTier;
|
||||||
public final HashMap<ItemStack, Integer> supportedMax = new HashMap<ItemStack, Integer>();
|
public final HashMap<ItemStack, Integer> supportedMax = new HashMap<ItemStack, Integer>();
|
||||||
|
|
||||||
private Upgrades(int tier) {
|
private Upgrades( int tier )
|
||||||
myTier = tier;
|
{
|
||||||
|
this.myTier = tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,12 +56,26 @@ public enum Upgrades
|
||||||
*/
|
*/
|
||||||
public HashMap<ItemStack, Integer> getSupported()
|
public HashMap<ItemStack, Integer> getSupported()
|
||||||
{
|
{
|
||||||
return supportedMax;
|
return this.supportedMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerItem(ItemStack myItem, int maxSupported)
|
|
||||||
|
|
||||||
|
public void registerItem( AEItemDefinition myItem, int maxSupported )
|
||||||
{
|
{
|
||||||
if ( myItem != null )
|
if ( myItem != null )
|
||||||
supportedMax.put( myItem, maxSupported );
|
{
|
||||||
|
final ItemStack stack = myItem.stack( 1 );
|
||||||
|
|
||||||
|
this.registerItem( stack, maxSupported );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerItem( ItemStack stack, int maxSupported )
|
||||||
|
{
|
||||||
|
if ( stack != null )
|
||||||
|
{
|
||||||
|
this.supportedMax.put( stack, maxSupported );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,4 +74,5 @@ public class Parts
|
||||||
public AEItemDefinition partStorageMonitor;
|
public AEItemDefinition partStorageMonitor;
|
||||||
public AEItemDefinition partConversionMonitor;
|
public AEItemDefinition partConversionMonitor;
|
||||||
|
|
||||||
|
// entweder optional oder null pattern, wahrscheinlich besser mit optional für API
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class AppEng
|
||||||
if ( Platform.isClient() )
|
if ( Platform.isClient() )
|
||||||
CommonHelper.proxy.init();
|
CommonHelper.proxy.init();
|
||||||
|
|
||||||
Registration.instance.PreInit( event );
|
Registration.INSTANCE.preInitialize( event );
|
||||||
|
|
||||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.VersionChecker ) )
|
if ( AEConfig.instance.isFeatureEnabled( AEFeature.VersionChecker ) )
|
||||||
{
|
{
|
||||||
|
@ -143,7 +143,7 @@ public class AppEng
|
||||||
Stopwatch star = Stopwatch.createStarted();
|
Stopwatch star = Stopwatch.createStarted();
|
||||||
AELog.info( "Init" );
|
AELog.info( "Init" );
|
||||||
|
|
||||||
Registration.instance.Init( event );
|
Registration.INSTANCE.initialize( event );
|
||||||
IntegrationRegistry.INSTANCE.init();
|
IntegrationRegistry.INSTANCE.init();
|
||||||
|
|
||||||
AELog.info( "Init ( end " + star.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
|
AELog.info( "Init ( end " + star.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
|
||||||
|
@ -155,7 +155,7 @@ public class AppEng
|
||||||
Stopwatch star = Stopwatch.createStarted();
|
Stopwatch star = Stopwatch.createStarted();
|
||||||
AELog.info( "PostInit" );
|
AELog.info( "PostInit" );
|
||||||
|
|
||||||
Registration.instance.PostInit( event );
|
Registration.INSTANCE.postInit( event );
|
||||||
IntegrationRegistry.INSTANCE.postInit();
|
IntegrationRegistry.INSTANCE.postInit();
|
||||||
FMLCommonHandler.instance().registerCrashCallable( new CrashEnhancement( CrashInfo.INTEGRATION ) );
|
FMLCommonHandler.instance().registerCrashCallable( new CrashEnhancement( CrashInfo.INTEGRATION ) );
|
||||||
|
|
||||||
|
|
|
@ -18,22 +18,34 @@
|
||||||
|
|
||||||
package appeng.core;
|
package appeng.core;
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.IAppEngApi;
|
||||||
|
import appeng.api.definitions.Items;
|
||||||
|
import appeng.api.definitions.Materials;
|
||||||
import appeng.api.util.AEItemDefinition;
|
import appeng.api.util.AEItemDefinition;
|
||||||
|
|
||||||
|
|
||||||
public final class CreativeTab extends CreativeTabs
|
public final class CreativeTab extends CreativeTabs
|
||||||
{
|
{
|
||||||
|
|
||||||
public static CreativeTab instance = null;
|
public static CreativeTab instance = null;
|
||||||
|
|
||||||
public CreativeTab() {
|
public CreativeTab()
|
||||||
|
{
|
||||||
super( "appliedenergistics2" );
|
super( "appliedenergistics2" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void init()
|
||||||
|
{
|
||||||
|
instance = new CreativeTab();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getTabIconItem()
|
public Item getTabIconItem()
|
||||||
{
|
{
|
||||||
|
@ -43,26 +55,28 @@ public final class CreativeTab extends CreativeTabs
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getIconItemStack()
|
public ItemStack getIconItemStack()
|
||||||
{
|
{
|
||||||
return this.findFirst( AEApi.instance().blocks().blockController, AEApi.instance().blocks().blockChest, AEApi.instance().blocks().blockCellWorkbench, AEApi
|
final IAppEngApi api = AEApi.instance();
|
||||||
.instance().blocks().blockFluix, AEApi.instance().items().itemCell1k, AEApi.instance().items().itemNetworkTool,
|
final appeng.api.definitions.Blocks blocks = api.blocks();
|
||||||
AEApi.instance().materials().materialFluixCrystal, AEApi.instance().materials().materialCertusQuartzCrystal );
|
final Items items = api.items();
|
||||||
|
final Materials materials = api.materials();
|
||||||
|
|
||||||
|
return this.findFirst( blocks.blockController, blocks.blockChest, blocks.blockCellWorkbench, blocks.blockFluix, items.itemCell1k, items.itemNetworkTool, materials.materialFluixCrystal, materials.materialCertusQuartzCrystal );
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack findFirst( AEItemDefinition... choices )
|
private ItemStack findFirst( AEItemDefinition... choices )
|
||||||
{
|
{
|
||||||
for ( AEItemDefinition a : choices )
|
for ( AEItemDefinition a : choices )
|
||||||
|
{
|
||||||
|
if ( a != null )
|
||||||
{
|
{
|
||||||
ItemStack is = a.stack( 1 );
|
ItemStack is = a.stack( 1 );
|
||||||
if ( is != null )
|
if ( is != null )
|
||||||
|
{
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new ItemStack( Blocks.chest );
|
return new ItemStack( Blocks.chest );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init()
|
|
||||||
{
|
|
||||||
instance = new CreativeTab();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -42,12 +42,14 @@ import com.google.common.collect.ArrayListMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.IAppEngApi;
|
||||||
import appeng.api.config.Upgrades;
|
import appeng.api.config.Upgrades;
|
||||||
import appeng.api.definitions.Blocks;
|
import appeng.api.definitions.Blocks;
|
||||||
import appeng.api.definitions.Items;
|
import appeng.api.definitions.Items;
|
||||||
import appeng.api.definitions.Materials;
|
import appeng.api.definitions.Materials;
|
||||||
import appeng.api.definitions.Parts;
|
import appeng.api.definitions.Parts;
|
||||||
import appeng.api.features.IRecipeHandlerRegistry;
|
import appeng.api.features.IRecipeHandlerRegistry;
|
||||||
|
import appeng.api.features.IRegistryContainer;
|
||||||
import appeng.api.features.IWirelessTermHandler;
|
import appeng.api.features.IWirelessTermHandler;
|
||||||
import appeng.api.features.IWorldGen.WorldGenType;
|
import appeng.api.features.IWorldGen.WorldGenType;
|
||||||
import appeng.api.movable.IMovableRegistry;
|
import appeng.api.movable.IMovableRegistry;
|
||||||
|
@ -209,9 +211,9 @@ import appeng.util.ClassInstantiation;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class Registration
|
public final class Registration
|
||||||
{
|
{
|
||||||
final public static Registration instance = new Registration();
|
final public static Registration INSTANCE = new Registration();
|
||||||
|
|
||||||
private final RecipeHandler recipeHandler;
|
private final RecipeHandler recipeHandler;
|
||||||
private final Multimap<AEFeature, Class<? extends IAEFeature>> featuresToEntities;
|
private final Multimap<AEFeature, Class<? extends IAEFeature>> featuresToEntities;
|
||||||
|
@ -223,7 +225,7 @@ public class Registration
|
||||||
this.featuresToEntities = ArrayListMultimap.create();
|
this.featuresToEntities = ArrayListMultimap.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PreInit( FMLPreInitializationEvent event )
|
public void preInitialize( FMLPreInitializationEvent event )
|
||||||
{
|
{
|
||||||
this.registerSpatial( false );
|
this.registerSpatial( false );
|
||||||
|
|
||||||
|
@ -431,7 +433,8 @@ public class Registration
|
||||||
items.itemFacade = this.addFeature( ItemFacade.class );
|
items.itemFacade = this.addFeature( ItemFacade.class );
|
||||||
items.itemCrystalSeed = this.addFeature( ItemCrystalSeed.class );
|
items.itemCrystalSeed = this.addFeature( ItemCrystalSeed.class );
|
||||||
|
|
||||||
ColoredItemDefinition paintBall, lumenPaintBall;
|
ColoredItemDefinition paintBall;
|
||||||
|
ColoredItemDefinition lumenPaintBall;
|
||||||
items.itemPaintBall = paintBall = new ColoredItemDefinition();
|
items.itemPaintBall = paintBall = new ColoredItemDefinition();
|
||||||
items.itemLumenPaintBall = lumenPaintBall = new ColoredItemDefinition();
|
items.itemLumenPaintBall = lumenPaintBall = new ColoredItemDefinition();
|
||||||
AEItemDefinition pb = this.addFeature( ItemPaintBall.class );
|
AEItemDefinition pb = this.addFeature( ItemPaintBall.class );
|
||||||
|
@ -537,7 +540,7 @@ public class Registration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Init( FMLInitializationEvent event )
|
public void initialize( FMLInitializationEvent event )
|
||||||
{
|
{
|
||||||
// Perform ore camouflage!
|
// Perform ore camouflage!
|
||||||
ItemMultiMaterial.instance.makeUnique();
|
ItemMultiMaterial.instance.makeUnique();
|
||||||
|
@ -607,92 +610,101 @@ public class Registration
|
||||||
CraftingManager.getInstance().getRecipeList().add( new FacadeRecipe() );
|
CraftingManager.getInstance().getRecipeList().add( new FacadeRecipe() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInit( FMLPostInitializationEvent event )
|
public void postInit( FMLPostInitializationEvent event )
|
||||||
{
|
{
|
||||||
this.registerSpatial( true );
|
this.registerSpatial( true );
|
||||||
|
|
||||||
|
final IAppEngApi api = AEApi.instance();
|
||||||
|
final IRegistryContainer registries = api.registries();
|
||||||
|
final Parts parts = api.parts();
|
||||||
|
final Blocks blocks = api.blocks();
|
||||||
|
final Items items = api.items();
|
||||||
|
|
||||||
// default settings..
|
// default settings..
|
||||||
( ( P2PTunnelRegistry ) AEApi.instance().registries().p2pTunnel() ).configure();
|
( ( P2PTunnelRegistry ) registries.p2pTunnel() ).configure();
|
||||||
|
|
||||||
// add to localization..
|
// add to localization..
|
||||||
PlayerMessages.values();
|
PlayerMessages.values();
|
||||||
GuiText.values();
|
GuiText.values();
|
||||||
|
|
||||||
Api.instance.partHelper.initFMPSupport();
|
Api.instance.partHelper.initFMPSupport();
|
||||||
( ( BlockCableBus ) AEApi.instance().blocks().blockMultiPart.block() ).setupTile();
|
( ( BlockCableBus ) blocks.blockMultiPart.block() ).setupTile();
|
||||||
|
|
||||||
// Interface
|
// Interface
|
||||||
Upgrades.CRAFTING.registerItem( AEApi.instance().parts().partInterface.stack( 1 ), 1 );
|
Upgrades.CRAFTING.registerItem( parts.partInterface, 1 );
|
||||||
Upgrades.CRAFTING.registerItem( AEApi.instance().blocks().blockInterface.stack( 1 ), 1 );
|
Upgrades.CRAFTING.registerItem( blocks.blockInterface, 1 );
|
||||||
|
|
||||||
// IO Port!
|
// IO Port!
|
||||||
Upgrades.SPEED.registerItem( AEApi.instance().blocks().blockIOPort.stack( 1 ), 3 );
|
Upgrades.SPEED.registerItem( blocks.blockIOPort, 3 );
|
||||||
Upgrades.REDSTONE.registerItem( AEApi.instance().blocks().blockIOPort.stack( 1 ), 1 );
|
Upgrades.REDSTONE.registerItem( blocks.blockIOPort, 1 );
|
||||||
|
|
||||||
// Level Emitter!
|
// Level Emitter!
|
||||||
Upgrades.FUZZY.registerItem( AEApi.instance().parts().partLevelEmitter.stack( 1 ), 1 );
|
Upgrades.FUZZY.registerItem( parts.partLevelEmitter, 1 );
|
||||||
Upgrades.CRAFTING.registerItem( AEApi.instance().parts().partLevelEmitter.stack( 1 ), 1 );
|
Upgrades.CRAFTING.registerItem( parts.partLevelEmitter, 1 );
|
||||||
|
|
||||||
// Import Bus
|
// Import Bus
|
||||||
Upgrades.FUZZY.registerItem( AEApi.instance().parts().partImportBus.stack( 1 ), 1 );
|
Upgrades.FUZZY.registerItem( parts.partImportBus, 1 );
|
||||||
Upgrades.REDSTONE.registerItem( AEApi.instance().parts().partImportBus.stack( 1 ), 1 );
|
Upgrades.REDSTONE.registerItem( parts.partImportBus, 1 );
|
||||||
Upgrades.CAPACITY.registerItem( AEApi.instance().parts().partImportBus.stack( 1 ), 2 );
|
Upgrades.CAPACITY.registerItem( parts.partImportBus, 2 );
|
||||||
Upgrades.SPEED.registerItem( AEApi.instance().parts().partImportBus.stack( 1 ), 4 );
|
Upgrades.SPEED.registerItem( parts.partImportBus, 4 );
|
||||||
|
|
||||||
// Export Bus
|
// Export Bus
|
||||||
Upgrades.FUZZY.registerItem( AEApi.instance().parts().partExportBus.stack( 1 ), 1 );
|
Upgrades.FUZZY.registerItem( parts.partExportBus, 1 );
|
||||||
Upgrades.REDSTONE.registerItem( AEApi.instance().parts().partExportBus.stack( 1 ), 1 );
|
Upgrades.REDSTONE.registerItem( parts.partExportBus, 1 );
|
||||||
Upgrades.CAPACITY.registerItem( AEApi.instance().parts().partExportBus.stack( 1 ), 2 );
|
Upgrades.CAPACITY.registerItem( parts.partExportBus, 2 );
|
||||||
Upgrades.SPEED.registerItem( AEApi.instance().parts().partExportBus.stack( 1 ), 4 );
|
Upgrades.SPEED.registerItem( parts.partExportBus, 4 );
|
||||||
Upgrades.CRAFTING.registerItem( AEApi.instance().parts().partExportBus.stack( 1 ), 1 );
|
Upgrades.CRAFTING.registerItem( parts.partExportBus, 1 );
|
||||||
|
|
||||||
// Storage Cells
|
// Storage Cells
|
||||||
Upgrades.FUZZY.registerItem( AEApi.instance().items().itemCell1k.stack( 1 ), 1 );
|
Upgrades.FUZZY.registerItem( items.itemCell1k, 1 );
|
||||||
Upgrades.INVERTER.registerItem( AEApi.instance().items().itemCell1k.stack( 1 ), 1 );
|
Upgrades.INVERTER.registerItem( items.itemCell1k, 1 );
|
||||||
|
|
||||||
Upgrades.FUZZY.registerItem( AEApi.instance().items().itemCell4k.stack( 1 ), 1 );
|
Upgrades.FUZZY.registerItem( items.itemCell4k, 1 );
|
||||||
Upgrades.INVERTER.registerItem( AEApi.instance().items().itemCell4k.stack( 1 ), 1 );
|
Upgrades.INVERTER.registerItem( items.itemCell4k, 1 );
|
||||||
|
|
||||||
Upgrades.FUZZY.registerItem( AEApi.instance().items().itemCell16k.stack( 1 ), 1 );
|
Upgrades.FUZZY.registerItem( items.itemCell16k, 1 );
|
||||||
Upgrades.INVERTER.registerItem( AEApi.instance().items().itemCell16k.stack( 1 ), 1 );
|
Upgrades.INVERTER.registerItem( items.itemCell16k, 1 );
|
||||||
|
|
||||||
Upgrades.FUZZY.registerItem( AEApi.instance().items().itemCell64k.stack( 1 ), 1 );
|
Upgrades.FUZZY.registerItem( items.itemCell64k, 1 );
|
||||||
Upgrades.INVERTER.registerItem( AEApi.instance().items().itemCell64k.stack( 1 ), 1 );
|
Upgrades.INVERTER.registerItem( items.itemCell64k, 1 );
|
||||||
|
|
||||||
Upgrades.FUZZY.registerItem( AEApi.instance().items().itemPortableCell.stack( 1 ), 1 );
|
Upgrades.FUZZY.registerItem( items.itemPortableCell, 1 );
|
||||||
Upgrades.INVERTER.registerItem( AEApi.instance().items().itemPortableCell.stack( 1 ), 1 );
|
Upgrades.INVERTER.registerItem( items.itemPortableCell, 1 );
|
||||||
|
|
||||||
Upgrades.FUZZY.registerItem( AEApi.instance().items().itemViewCell.stack( 1 ), 1 );
|
Upgrades.FUZZY.registerItem( items.itemViewCell, 1 );
|
||||||
Upgrades.INVERTER.registerItem( AEApi.instance().items().itemViewCell.stack( 1 ), 1 );
|
Upgrades.INVERTER.registerItem( items.itemViewCell, 1 );
|
||||||
|
|
||||||
// Storage Bus
|
// Storage Bus
|
||||||
Upgrades.FUZZY.registerItem( AEApi.instance().parts().partStorageBus.stack( 1 ), 1 );
|
Upgrades.FUZZY.registerItem( parts.partStorageBus, 1 );
|
||||||
Upgrades.INVERTER.registerItem( AEApi.instance().parts().partStorageBus.stack( 1 ), 1 );
|
Upgrades.INVERTER.registerItem( parts.partStorageBus, 1 );
|
||||||
Upgrades.CAPACITY.registerItem( AEApi.instance().parts().partStorageBus.stack( 1 ), 5 );
|
Upgrades.CAPACITY.registerItem( parts.partStorageBus, 5 );
|
||||||
|
|
||||||
// Formation Plane
|
// Formation Plane
|
||||||
Upgrades.FUZZY.registerItem( AEApi.instance().parts().partFormationPlane.stack( 1 ), 1 );
|
Upgrades.FUZZY.registerItem( parts.partFormationPlane, 1 );
|
||||||
Upgrades.INVERTER.registerItem( AEApi.instance().parts().partFormationPlane.stack( 1 ), 1 );
|
Upgrades.INVERTER.registerItem( parts.partFormationPlane, 1 );
|
||||||
Upgrades.CAPACITY.registerItem( AEApi.instance().parts().partFormationPlane.stack( 1 ), 5 );
|
Upgrades.CAPACITY.registerItem( parts.partFormationPlane, 5 );
|
||||||
|
|
||||||
// Matter Cannon
|
// Matter Cannon
|
||||||
Upgrades.FUZZY.registerItem( AEApi.instance().items().itemMassCannon.stack( 1 ), 1 );
|
Upgrades.FUZZY.registerItem( items.itemMassCannon, 1 );
|
||||||
Upgrades.INVERTER.registerItem( AEApi.instance().items().itemMassCannon.stack( 1 ), 1 );
|
Upgrades.INVERTER.registerItem( items.itemMassCannon, 1 );
|
||||||
Upgrades.SPEED.registerItem( AEApi.instance().items().itemMassCannon.stack( 1 ), 4 );
|
Upgrades.SPEED.registerItem( items.itemMassCannon, 4 );
|
||||||
|
|
||||||
// Molecular Assembler
|
// Molecular Assembler
|
||||||
Upgrades.SPEED.registerItem( AEApi.instance().blocks().blockMolecularAssembler.stack( 1 ), 5 );
|
Upgrades.SPEED.registerItem( blocks.blockMolecularAssembler, 5 );
|
||||||
|
|
||||||
// Inscriber
|
// Inscriber
|
||||||
Upgrades.SPEED.registerItem( AEApi.instance().blocks().blockInscriber.stack( 1 ), 3 );
|
Upgrades.SPEED.registerItem( blocks.blockInscriber, 3 );
|
||||||
|
|
||||||
AEApi.instance().registries().wireless().registerWirelessHandler( ( IWirelessTermHandler ) AEApi.instance().items().itemWirelessTerminal.item() );
|
if ( items.itemWirelessTerminal != null )
|
||||||
|
{
|
||||||
|
registries.wireless().registerWirelessHandler( ( IWirelessTermHandler ) items.itemWirelessTerminal.item() );
|
||||||
|
}
|
||||||
|
|
||||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.ChestLoot ) )
|
if ( AEConfig.instance.isFeatureEnabled( AEFeature.ChestLoot ) )
|
||||||
{
|
{
|
||||||
ChestGenHooks d = ChestGenHooks.getInfo( ChestGenHooks.MINESHAFT_CORRIDOR );
|
ChestGenHooks d = ChestGenHooks.getInfo( ChestGenHooks.MINESHAFT_CORRIDOR );
|
||||||
d.addItem( new WeightedRandomChestContent( AEApi.instance().materials().materialCertusQuartzCrystal.stack( 1 ), 1, 4, 2 ) );
|
d.addItem( new WeightedRandomChestContent( api.materials().materialCertusQuartzCrystal.stack( 1 ), 1, 4, 2 ) );
|
||||||
d.addItem( new WeightedRandomChestContent( AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ), 1, 4, 2 ) );
|
d.addItem( new WeightedRandomChestContent( api.materials().materialCertusQuartzDust.stack( 1 ), 1, 4, 2 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// add villager trading to black smiths for a few basic materials
|
// add villager trading to black smiths for a few basic materials
|
||||||
|
@ -707,7 +719,7 @@ public class Registration
|
||||||
GameRegistry.registerWorldGenerator( new MeteoriteWorldGen(), 0 );
|
GameRegistry.registerWorldGenerator( new MeteoriteWorldGen(), 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
IMovableRegistry mr = AEApi.instance().registries().movable();
|
IMovableRegistry mr = registries.movable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* You can't move bed rock.
|
* You can't move bed rock.
|
||||||
|
@ -747,19 +759,19 @@ public class Registration
|
||||||
*/
|
*/
|
||||||
for ( WorldGenType type : WorldGenType.values() )
|
for ( WorldGenType type : WorldGenType.values() )
|
||||||
{
|
{
|
||||||
AEApi.instance().registries().worldgen().disableWorldGenForProviderID( type, StorageWorldProvider.class );
|
registries.worldgen().disableWorldGenForProviderID( type, StorageWorldProvider.class );
|
||||||
|
|
||||||
// nether
|
// nether
|
||||||
AEApi.instance().registries().worldgen().disableWorldGenForDimension( type, -1 );
|
registries.worldgen().disableWorldGenForDimension( type, -1 );
|
||||||
|
|
||||||
// end
|
// end
|
||||||
AEApi.instance().registries().worldgen().disableWorldGenForDimension( type, 1 );
|
registries.worldgen().disableWorldGenForDimension( type, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// whitelist from config
|
// whitelist from config
|
||||||
for ( int dimension : AEConfig.instance.meteoriteDimensionWhitelist )
|
for ( int dimension : AEConfig.instance.meteoriteDimensionWhitelist )
|
||||||
{
|
{
|
||||||
AEApi.instance().registries().worldgen().enableWorldGenForDimension( WorldGenType.Meteorites, dimension );
|
registries.worldgen().enableWorldGenForDimension( WorldGenType.Meteorites, dimension );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class StorageWorldProvider extends WorldProvider
|
||||||
@Override
|
@Override
|
||||||
protected void registerWorldChunkManager()
|
protected void registerWorldChunkManager()
|
||||||
{
|
{
|
||||||
super.worldChunkMgr = new WorldChunkManagerHell( Registration.instance.storageBiome, 0.0F );
|
super.worldChunkMgr = new WorldChunkManagerHell( Registration.INSTANCE.storageBiome, 0.0F );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -48,12 +48,12 @@ import appeng.util.Platform;
|
||||||
public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||||
{
|
{
|
||||||
|
|
||||||
final private static ItemStack ring = AEApi.instance().blocks().blockQuantumRing.stack( 1 );
|
final private static ItemStack RING_STACK = ( AEApi.instance().blocks().blockQuantumRing != null ) ? AEApi.instance().blocks().blockQuantumRing.stack( 1 ) : null;
|
||||||
|
|
||||||
final int sidesRing[] = new int[] {};
|
final int[] sidesRing = new int[] { };
|
||||||
final int sidesLink[] = new int[] { 0 };
|
final int[] sidesLink = new int[] { 0 };
|
||||||
|
|
||||||
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 1 );
|
final AppEngInternalInventory internalInventory = new AppEngInternalInventory( this, 1 );
|
||||||
|
|
||||||
public final byte corner = 16;
|
public final byte corner = 16;
|
||||||
final byte hasSingularity = 32;
|
final byte hasSingularity = 32;
|
||||||
|
@ -68,7 +68,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||||
private boolean updateStatus = false;
|
private boolean updateStatus = false;
|
||||||
|
|
||||||
@TileEvent(TileEventType.TICK)
|
@TileEvent(TileEventType.TICK)
|
||||||
public void Tick_TileQuantumBridge()
|
public void onTickEvent()
|
||||||
{
|
{
|
||||||
if ( this.updateStatus )
|
if ( this.updateStatus )
|
||||||
{
|
{
|
||||||
|
@ -80,21 +80,21 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||||
public void writeToStream_TileQuantumBridge(ByteBuf data)
|
public void onNetworkWriteEvent( ByteBuf data )
|
||||||
{
|
{
|
||||||
int out = this.constructed;
|
int out = this.constructed;
|
||||||
|
|
||||||
if ( this.getStackInSlot( 0 ) != null && this.constructed != -1 )
|
if ( this.getStackInSlot( 0 ) != null && this.constructed != -1 )
|
||||||
out = out | this.hasSingularity;
|
out |= this.hasSingularity;
|
||||||
|
|
||||||
if ( this.gridProxy.isActive() && this.constructed != -1 )
|
if ( this.gridProxy.isActive() && this.constructed != -1 )
|
||||||
out = out | this.powered;
|
out |= this.powered;
|
||||||
|
|
||||||
data.writeByte( (byte) out );
|
data.writeByte( (byte) out );
|
||||||
}
|
}
|
||||||
|
|
||||||
@TileEvent(TileEventType.NETWORK_READ)
|
@TileEvent(TileEventType.NETWORK_READ)
|
||||||
public boolean readFromStream_TileQuantumBridge(ByteBuf data)
|
public boolean onNetworkReadEvent( ByteBuf data )
|
||||||
{
|
{
|
||||||
int oldValue = this.constructed;
|
int oldValue = this.constructed;
|
||||||
this.constructed = data.readByte();
|
this.constructed = data.readByte();
|
||||||
|
@ -106,17 +106,17 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||||
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||||
this.gridProxy.setFlags( GridFlags.DENSE_CAPACITY );
|
this.gridProxy.setFlags( GridFlags.DENSE_CAPACITY );
|
||||||
this.gridProxy.setIdlePowerUsage( 22 );
|
this.gridProxy.setIdlePowerUsage( 22 );
|
||||||
this.inv.setMaxStackSize( 1 );
|
this.internalInventory.setMaxStackSize( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IInventory getInternalInventory()
|
public IInventory getInternalInventory()
|
||||||
{
|
{
|
||||||
return this.inv;
|
return this.internalInventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@MENetworkEventSubscribe
|
@MENetworkEventSubscribe
|
||||||
public void PowerSwitch(MENetworkPowerStatusChange c)
|
public void onPowerStatusChange( MENetworkPowerStatusChange c )
|
||||||
{
|
{
|
||||||
this.updateStatus = true;
|
this.updateStatus = true;
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||||
{
|
{
|
||||||
super.onReady();
|
super.onReady();
|
||||||
if ( this.worldObj.getBlock( this.xCoord, this.yCoord, this.zCoord ) == AEApi.instance().blocks().blockQuantumRing.block() )
|
if ( this.worldObj.getBlock( this.xCoord, this.yCoord, this.zCoord ) == AEApi.instance().blocks().blockQuantumRing.block() )
|
||||||
this.gridProxy.setVisualRepresentation( ring );
|
this.gridProxy.setVisualRepresentation( RING_STACK );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -210,7 +210,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||||
|
|
||||||
public long getQEFrequency()
|
public long getQEFrequency()
|
||||||
{
|
{
|
||||||
ItemStack is = this.inv.getStackInSlot( 0 );
|
ItemStack is = this.internalInventory.getStackInSlot( 0 );
|
||||||
if ( is != null )
|
if ( is != null )
|
||||||
{
|
{
|
||||||
NBTTagCompound c = is.getTagCompound();
|
NBTTagCompound c = is.getTagCompound();
|
||||||
|
|
Loading…
Reference in a new issue