Fixes #675 No disabled feature should log spam or crash anymore.
Deprecates the old usage of the AEItemDefinitions via the direct method access of * blocks() * parts() * items() * materials() and thus use the new re-direct via definitions(). All definitions are now initialized, no matter what. But SubItems, Items and Blocks are not registered, if by chance are disabled.
This commit is contained in:
@@ -193,10 +193,10 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
|
||||
this.levelByStacks[btnNum] = Math.min( this.levelByStacks[btnNum], buttonCap );
|
||||
}
|
||||
|
||||
for (Enum e : this.settings.getSettings())
|
||||
for (Settings e : this.settings.getSettings())
|
||||
{
|
||||
String Category = "Client"; // e.getClass().getSimpleName();
|
||||
Enum value = this.settings.getSetting( e );
|
||||
Enum<?> value = this.settings.getSetting( e );
|
||||
|
||||
Property p = this.get( Category, e.name(), value.name(), this.getListComment( value ) );
|
||||
|
||||
@@ -376,7 +376,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
|
||||
@Override
|
||||
public void updateSetting(IConfigManager manager, Enum setting, Enum newValue)
|
||||
{
|
||||
for (Enum e : this.settings.getSettings())
|
||||
for (Settings e : this.settings.getSettings())
|
||||
{
|
||||
if ( e == setting )
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ import appeng.util.Platform;
|
||||
public final class AELog
|
||||
{
|
||||
|
||||
public static final FMLRelaunchLog instance = FMLRelaunchLog.log;
|
||||
public static final FMLRelaunchLog INSTANCE = FMLRelaunchLog.log;
|
||||
|
||||
private AELog() {
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core;
|
||||
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.IAppEngApi;
|
||||
@@ -41,28 +42,47 @@ import appeng.util.Platform;
|
||||
|
||||
public final class Api implements IAppEngApi
|
||||
{
|
||||
|
||||
public static final Api INSTANCE = new Api();
|
||||
|
||||
private Api() {
|
||||
|
||||
}
|
||||
private final ApiPart partHelper;
|
||||
|
||||
// private MovableTileRegistry MovableRegistry = new MovableTileRegistry();
|
||||
private final RegistryContainer rc = new RegistryContainer();
|
||||
private final ApiStorage storageHelper = new ApiStorage();
|
||||
private final IRegistryContainer registryContainer;
|
||||
private final IStorageHelper storageHelper;
|
||||
private final Materials materials;
|
||||
private final Items items;
|
||||
private final Blocks blocks;
|
||||
private final Parts parts;
|
||||
private final ApiDefinitions definitions;
|
||||
|
||||
public final ApiPart partHelper = new ApiPart();
|
||||
|
||||
private final Materials materials = new Materials();
|
||||
private final Items items = new Items();
|
||||
private final Blocks blocks = new Blocks();
|
||||
private final Parts parts = new Parts();
|
||||
private Api()
|
||||
{
|
||||
this.parts = new Parts();
|
||||
this.blocks = new Blocks();
|
||||
this.items = new Items();
|
||||
this.materials = new Materials();
|
||||
this.storageHelper = new ApiStorage();
|
||||
this.registryContainer = new RegistryContainer();
|
||||
this.partHelper = new ApiPart();
|
||||
this.definitions = new ApiDefinitions( this.partHelper );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegistryContainer registries()
|
||||
{
|
||||
return this.rc;
|
||||
return this.registryContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStorageHelper storage()
|
||||
{
|
||||
return this.storageHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPartHelper partHelper()
|
||||
{
|
||||
return this.partHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,19 +110,13 @@ public final class Api implements IAppEngApi
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStorageHelper storage()
|
||||
public ApiDefinitions definitions()
|
||||
{
|
||||
return this.storageHelper;
|
||||
return this.definitions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPartHelper partHelper()
|
||||
{
|
||||
return this.partHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode createGridNode(IGridBlock blk)
|
||||
public IGridNode createGridNode( IGridBlock blk )
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
throw new RuntimeException( "Grid Features are Server Side Only." );
|
||||
@@ -110,9 +124,13 @@ public final class Api implements IAppEngApi
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridConnection createGridConnection(IGridNode a, IGridNode b) throws FailedConnection
|
||||
public IGridConnection createGridConnection( IGridNode a, IGridNode b ) throws FailedConnection
|
||||
{
|
||||
return new GridConnection( a, b, ForgeDirection.UNKNOWN );
|
||||
}
|
||||
|
||||
public ApiPart getPartHelper()
|
||||
{
|
||||
return this.partHelper;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.core;
|
||||
|
||||
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.parts.IPartHelper;
|
||||
import appeng.core.api.definitions.ApiBlocks;
|
||||
import appeng.core.api.definitions.ApiItems;
|
||||
import appeng.core.api.definitions.ApiMaterials;
|
||||
import appeng.core.api.definitions.ApiParts;
|
||||
import appeng.core.api.definitions.DefinitionConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* Internal implementation of the definitions for the API
|
||||
*/
|
||||
public final class ApiDefinitions implements IDefinitions
|
||||
{
|
||||
private final ApiBlocks blocks;
|
||||
private final ApiItems items;
|
||||
private final ApiMaterials materials;
|
||||
private final ApiParts parts;
|
||||
private final FeatureHandlerRegistry handlers;
|
||||
private final FeatureRegistry features;
|
||||
|
||||
public ApiDefinitions( IPartHelper partHelper )
|
||||
{
|
||||
this.features = new FeatureRegistry();
|
||||
this.handlers = new FeatureHandlerRegistry();
|
||||
|
||||
final DefinitionConstructor constructor = new DefinitionConstructor( this.features, this.handlers );
|
||||
|
||||
this.blocks = new ApiBlocks( constructor );
|
||||
this.items = new ApiItems( constructor );
|
||||
this.materials = new ApiMaterials( constructor );
|
||||
this.parts = new ApiParts( constructor, partHelper );
|
||||
}
|
||||
|
||||
public FeatureHandlerRegistry getFeatureHandlerRegistry()
|
||||
{
|
||||
return this.handlers;
|
||||
}
|
||||
|
||||
public FeatureRegistry getFeatureRegistry()
|
||||
{
|
||||
return this.features;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiBlocks blocks()
|
||||
{
|
||||
return this.blocks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiItems items()
|
||||
{
|
||||
return this.items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiMaterials materials()
|
||||
{
|
||||
return this.materials;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiParts parts()
|
||||
{
|
||||
return this.parts;
|
||||
}
|
||||
}
|
||||
@@ -193,7 +193,7 @@ public class AppEng
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStarting( FMLServerAboutToStartEvent evt )
|
||||
public void serverAboutToStart( FMLServerAboutToStartEvent evt )
|
||||
{
|
||||
WorldSettings.getInstance().init();
|
||||
}
|
||||
|
||||
@@ -25,15 +25,15 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
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.definitions.IBlocks;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.IItems;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
|
||||
|
||||
public final class CreativeTab extends CreativeTabs
|
||||
{
|
||||
|
||||
public static CreativeTab instance = null;
|
||||
|
||||
public CreativeTab()
|
||||
@@ -55,25 +55,21 @@ public final class CreativeTab extends CreativeTabs
|
||||
@Override
|
||||
public ItemStack getIconItemStack()
|
||||
{
|
||||
final IAppEngApi api = AEApi.instance();
|
||||
final appeng.api.definitions.Blocks blocks = api.blocks();
|
||||
final Items items = api.items();
|
||||
final Materials materials = api.materials();
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IBlocks blocks = definitions.blocks();
|
||||
final IItems items = definitions.items();
|
||||
final IMaterials materials = definitions.materials();
|
||||
|
||||
return this.findFirst( blocks.blockController, blocks.blockChest, blocks.blockCellWorkbench, blocks.blockFluix, items.itemCell1k, items.itemNetworkTool, materials.materialFluixCrystal, materials.materialCertusQuartzCrystal );
|
||||
return this.findFirst( blocks.controller(), blocks.chest(), blocks.cellWorkbench(), blocks.fluix(), items.cell1k(), items.networkTool(), materials.fluixCrystal(), materials.certusQuartzCrystal() );
|
||||
}
|
||||
|
||||
private ItemStack findFirst( AEItemDefinition... choices )
|
||||
private ItemStack findFirst( IItemDefinition... choices )
|
||||
{
|
||||
for ( AEItemDefinition a : choices )
|
||||
for ( IItemDefinition definition : choices )
|
||||
{
|
||||
if ( a != null )
|
||||
for ( ItemStack definitionStack : definition.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
ItemStack is = a.stack( 1 );
|
||||
if ( is != null )
|
||||
{
|
||||
return is;
|
||||
}
|
||||
return definitionStack;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,9 +19,12 @@
|
||||
package appeng.core;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
|
||||
@@ -43,7 +46,13 @@ public final class CreativeTabFacade extends CreativeTabs
|
||||
@Override
|
||||
public ItemStack getIconItemStack()
|
||||
{
|
||||
return ((ItemFacade) AEApi.instance().items().itemFacade.item()).getCreativeTabIcon();
|
||||
final Optional<Item> maybeFacade = AEApi.instance().definitions().items().facade().maybeItem();
|
||||
if ( maybeFacade.isPresent() )
|
||||
{
|
||||
return ((ItemFacade) maybeFacade.get()).getCreativeTabIcon();
|
||||
}
|
||||
|
||||
return new ItemStack( Blocks.planks );
|
||||
}
|
||||
|
||||
public static void init()
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.core;
|
||||
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
|
||||
|
||||
public final class FeatureHandlerRegistry
|
||||
{
|
||||
private final Set<IFeatureHandler> registry = new HashSet<IFeatureHandler>();
|
||||
|
||||
public void addFeatureHandler( IFeatureHandler feature )
|
||||
{
|
||||
this.registry.add( feature );
|
||||
}
|
||||
|
||||
public Set<IFeatureHandler> getRegisteredFeatureHandlers()
|
||||
{
|
||||
return this.registry;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.core;
|
||||
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import appeng.core.features.IAEFeature;
|
||||
|
||||
|
||||
public final class FeatureRegistry
|
||||
{
|
||||
private final Set<IAEFeature> registry = new HashSet<IAEFeature>();
|
||||
|
||||
public void addFeature( IAEFeature feature )
|
||||
{
|
||||
this.registry.add( feature );
|
||||
}
|
||||
|
||||
public Set<IAEFeature> getRegisteredFeatures()
|
||||
{
|
||||
return this.registry;
|
||||
}
|
||||
}
|
||||
@@ -19,8 +19,9 @@
|
||||
package appeng.core;
|
||||
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
@@ -37,14 +38,15 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.definitions.Blocks;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.definitions.IItems;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
import appeng.api.definitions.IParts;
|
||||
import appeng.api.definitions.Items;
|
||||
import appeng.api.definitions.Materials;
|
||||
import appeng.api.definitions.Parts;
|
||||
@@ -62,116 +64,23 @@ 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.api.util.AEColor;
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import appeng.block.crafting.BlockCraftingMonitor;
|
||||
import appeng.block.crafting.BlockCraftingStorage;
|
||||
import appeng.block.crafting.BlockCraftingUnit;
|
||||
import appeng.block.crafting.BlockMolecularAssembler;
|
||||
import appeng.block.grindstone.BlockCrank;
|
||||
import appeng.block.grindstone.BlockGrinder;
|
||||
import appeng.block.misc.BlockCellWorkbench;
|
||||
import appeng.block.misc.BlockCharger;
|
||||
import appeng.block.misc.BlockCondenser;
|
||||
import appeng.block.misc.BlockInscriber;
|
||||
import appeng.block.misc.BlockInterface;
|
||||
import appeng.block.misc.BlockLightDetector;
|
||||
import appeng.block.misc.BlockPaint;
|
||||
import appeng.block.misc.BlockQuartzGrowthAccelerator;
|
||||
import appeng.block.misc.BlockQuartzTorch;
|
||||
import appeng.block.misc.BlockSecurity;
|
||||
import appeng.block.misc.BlockSkyCompass;
|
||||
import appeng.block.misc.BlockTinyTNT;
|
||||
import appeng.block.misc.BlockVibrationChamber;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.block.networking.BlockController;
|
||||
import appeng.block.networking.BlockCreativeEnergyCell;
|
||||
import appeng.block.networking.BlockDenseEnergyCell;
|
||||
import appeng.block.networking.BlockEnergyAcceptor;
|
||||
import appeng.block.networking.BlockEnergyCell;
|
||||
import appeng.block.networking.BlockWireless;
|
||||
import appeng.block.qnb.BlockQuantumLinkChamber;
|
||||
import appeng.block.qnb.BlockQuantumRing;
|
||||
import appeng.block.solids.BlockFluix;
|
||||
import appeng.block.solids.BlockQuartz;
|
||||
import appeng.block.solids.BlockQuartzChiseled;
|
||||
import appeng.block.solids.BlockQuartzGlass;
|
||||
import appeng.block.solids.BlockQuartzLamp;
|
||||
import appeng.block.solids.BlockQuartzPillar;
|
||||
import appeng.block.solids.BlockSkyStone;
|
||||
import appeng.block.solids.OreQuartz;
|
||||
import appeng.block.solids.OreQuartzCharged;
|
||||
import appeng.block.spatial.BlockMatrixFrame;
|
||||
import appeng.block.spatial.BlockSpatialIOPort;
|
||||
import appeng.block.spatial.BlockSpatialPylon;
|
||||
import appeng.block.stair.ChiseledQuartzStairBlock;
|
||||
import appeng.block.stair.FluixStairBlock;
|
||||
import appeng.block.stair.QuartzPillarStairBlock;
|
||||
import appeng.block.stair.QuartzStairBlock;
|
||||
import appeng.block.stair.SkyStoneBlockStairBlock;
|
||||
import appeng.block.stair.SkyStoneBrickStairBlock;
|
||||
import appeng.block.stair.SkyStoneSmallBrickStairBlock;
|
||||
import appeng.block.stair.SkyStoneStairBlock;
|
||||
import appeng.block.storage.BlockChest;
|
||||
import appeng.block.storage.BlockDrive;
|
||||
import appeng.block.storage.BlockIOPort;
|
||||
import appeng.block.storage.BlockSkyChest;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.ColoredItemDefinition;
|
||||
import appeng.core.features.DamagedItemDefinition;
|
||||
import appeng.core.features.DefinitionConverter;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
import appeng.core.features.IStackSrc;
|
||||
import appeng.core.features.ItemStackSrc;
|
||||
import appeng.core.features.NullItemDefinition;
|
||||
import appeng.core.features.WrappedDamageItemDefinition;
|
||||
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.debug.BlockChunkloader;
|
||||
import appeng.debug.BlockCubeGenerator;
|
||||
import appeng.debug.BlockItemGen;
|
||||
import appeng.debug.BlockPhantomNode;
|
||||
import appeng.debug.ToolDebugCard;
|
||||
import appeng.debug.ToolEraser;
|
||||
import appeng.debug.ToolMeteoritePlacer;
|
||||
import appeng.debug.ToolReplicatorCard;
|
||||
import appeng.hooks.AETrading;
|
||||
import appeng.hooks.MeteoriteWorldGen;
|
||||
import appeng.hooks.QuartzWorldGen;
|
||||
import appeng.worldgen.MeteoriteWorldGen;
|
||||
import appeng.worldgen.QuartzWorldGen;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.items.materials.ItemMultiMaterial;
|
||||
import appeng.items.materials.MaterialType;
|
||||
import appeng.items.misc.ItemCrystalSeed;
|
||||
import appeng.items.misc.ItemEncodedPattern;
|
||||
import appeng.items.misc.ItemPaintBall;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
import appeng.items.parts.ItemMultiPart;
|
||||
import appeng.items.parts.PartType;
|
||||
import appeng.items.storage.ItemBasicStorageCell;
|
||||
import appeng.items.storage.ItemCreativeStorageCell;
|
||||
import appeng.items.storage.ItemSpatialStorageCell;
|
||||
import appeng.items.storage.ItemViewCell;
|
||||
import appeng.items.tools.ToolBiometricCard;
|
||||
import appeng.items.tools.ToolMemoryCard;
|
||||
import appeng.items.tools.ToolNetworkTool;
|
||||
import appeng.items.tools.powered.ToolChargedStaff;
|
||||
import appeng.items.tools.powered.ToolColorApplicator;
|
||||
import appeng.items.tools.powered.ToolEntropyManipulator;
|
||||
import appeng.items.tools.powered.ToolMassCannon;
|
||||
import appeng.items.tools.powered.ToolPortableCell;
|
||||
import appeng.items.tools.powered.ToolWirelessTerminal;
|
||||
import appeng.items.tools.quartz.ToolQuartzAxe;
|
||||
import appeng.items.tools.quartz.ToolQuartzCuttingKnife;
|
||||
import appeng.items.tools.quartz.ToolQuartzHoe;
|
||||
import appeng.items.tools.quartz.ToolQuartzPickaxe;
|
||||
import appeng.items.tools.quartz.ToolQuartzSpade;
|
||||
import appeng.items.tools.quartz.ToolQuartzSword;
|
||||
import appeng.items.tools.quartz.ToolQuartzWrench;
|
||||
import appeng.me.cache.CraftingGridCache;
|
||||
import appeng.me.cache.EnergyGridCache;
|
||||
import appeng.me.cache.GridStorageCache;
|
||||
@@ -207,7 +116,6 @@ import appeng.recipes.ores.OreDictionaryHandler;
|
||||
import appeng.spatial.BiomeGenStorage;
|
||||
import appeng.spatial.StorageWorldProvider;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.ClassInstantiation;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@@ -216,37 +124,22 @@ public final class Registration
|
||||
final public static Registration INSTANCE = new Registration();
|
||||
|
||||
private final RecipeHandler recipeHandler;
|
||||
private final Multimap<AEFeature, Class<? extends IAEFeature>> featuresToEntities;
|
||||
private final DefinitionConverter converter;
|
||||
public BiomeGenBase storageBiome;
|
||||
|
||||
private Registration()
|
||||
{
|
||||
this.converter = new DefinitionConverter();
|
||||
this.recipeHandler = new RecipeHandler();
|
||||
this.featuresToEntities = ArrayListMultimap.create();
|
||||
}
|
||||
|
||||
public void preInitialize( FMLPreInitializationEvent event )
|
||||
{
|
||||
this.registerSpatial( false );
|
||||
|
||||
IRecipeHandlerRegistry recipeRegistry = AEApi.instance().registries().recipes();
|
||||
recipeRegistry.addNewSubItemResolver( new AEItemResolver() );
|
||||
|
||||
recipeRegistry.addNewCraftHandler( "hccrusher", HCCrusher.class );
|
||||
recipeRegistry.addNewCraftHandler( "mekcrusher", MekCrusher.class );
|
||||
recipeRegistry.addNewCraftHandler( "mekechamber", MekEnrichment.class );
|
||||
recipeRegistry.addNewCraftHandler( "grind", Grind.class );
|
||||
recipeRegistry.addNewCraftHandler( "crusher", Crusher.class );
|
||||
recipeRegistry.addNewCraftHandler( "grindfz", GrindFZ.class );
|
||||
recipeRegistry.addNewCraftHandler( "pulverizer", Pulverizer.class );
|
||||
recipeRegistry.addNewCraftHandler( "macerator", Macerator.class );
|
||||
|
||||
recipeRegistry.addNewCraftHandler( "smelt", Smelt.class );
|
||||
recipeRegistry.addNewCraftHandler( "inscribe", Inscribe.class );
|
||||
recipeRegistry.addNewCraftHandler( "press", Press.class );
|
||||
|
||||
recipeRegistry.addNewCraftHandler( "shaped", Shaped.class );
|
||||
recipeRegistry.addNewCraftHandler( "shapeless", Shapeless.class );
|
||||
final Api api = Api.INSTANCE;
|
||||
IRecipeHandlerRegistry recipeRegistry = api.registries().recipes();
|
||||
this.registerCraftHandlers( recipeRegistry );
|
||||
|
||||
RecipeSorter.register( "AE2-Facade", FacadeRecipe.class, Category.SHAPED, "" );
|
||||
RecipeSorter.register( "AE2-Shaped", ShapedRecipe.class, Category.SHAPED, "" );
|
||||
@@ -254,219 +147,33 @@ public final class Registration
|
||||
|
||||
MinecraftForge.EVENT_BUS.register( OreDictionaryHandler.INSTANCE );
|
||||
|
||||
Items items = Api.INSTANCE.items();
|
||||
Materials materials = Api.INSTANCE.materials();
|
||||
Parts parts = Api.INSTANCE.parts();
|
||||
Blocks blocks = Api.INSTANCE.blocks();
|
||||
final ApiDefinitions definitions = api.definitions();
|
||||
|
||||
AEItemDefinition materialItem = this.addFeature( ItemMultiMaterial.class );
|
||||
final IBlocks apiBlocks = definitions.blocks();
|
||||
final IItems apiItems = definitions.items();
|
||||
final IMaterials apiMaterials = definitions.materials();
|
||||
final IParts apiParts = definitions.parts();
|
||||
|
||||
Class<?> materialClass = materials.getClass();
|
||||
for ( MaterialType mat : MaterialType.values() )
|
||||
final Items items = api.items();
|
||||
final Materials materials = api.materials();
|
||||
final Parts parts = api.parts();
|
||||
final Blocks blocks = api.blocks();
|
||||
|
||||
this.assignMaterials( materials, apiMaterials );
|
||||
this.assignParts( parts, apiParts );
|
||||
this.assignBlocks( blocks, apiBlocks );
|
||||
this.assignItems( items, apiItems );
|
||||
|
||||
// Register all detected handlers and features (items, blocks) in pre-init
|
||||
for ( IFeatureHandler handler : definitions.getFeatureHandlerRegistry().getRegisteredFeatureHandlers() )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( mat == MaterialType.InvalidType )
|
||||
( ( ItemMultiMaterial ) materialItem.item() ).createMaterial( mat );
|
||||
else
|
||||
{
|
||||
Field f = materialClass.getField( "material" + mat.name() );
|
||||
IStackSrc is = ( ( ItemMultiMaterial ) materialItem.item() ).createMaterial( mat );
|
||||
if ( is != null )
|
||||
f.set( materials, new DamagedItemDefinition( is ) );
|
||||
else
|
||||
f.set( materials, new NullItemDefinition() );
|
||||
}
|
||||
}
|
||||
catch ( Throwable err )
|
||||
{
|
||||
AELog.severe( "Error creating material: " + mat.name() );
|
||||
throw new RuntimeException( err );
|
||||
}
|
||||
handler.register();
|
||||
}
|
||||
|
||||
AEItemDefinition partItem = this.addFeature( ItemMultiPart.class );
|
||||
|
||||
Class<?> partClass = parts.getClass();
|
||||
for ( PartType type : PartType.values() )
|
||||
for ( IAEFeature feature : definitions.getFeatureRegistry().getRegisteredFeatures() )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( type == PartType.InvalidType )
|
||||
( ( ItemMultiPart ) partItem.item() ).createPart( type, null );
|
||||
else
|
||||
{
|
||||
Field f = partClass.getField( "part" + type.name() );
|
||||
Enum<AEColor>[] variants = type.getVariants();
|
||||
if ( variants == null )
|
||||
{
|
||||
ItemStackSrc is = ( ( ItemMultiPart ) partItem.item() ).createPart( type, null );
|
||||
if ( is != null )
|
||||
f.set( parts, new DamagedItemDefinition( is ) );
|
||||
else
|
||||
f.set( parts, new NullItemDefinition() );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( variants[0] instanceof AEColor )
|
||||
{
|
||||
ColoredItemDefinition def = new ColoredItemDefinition();
|
||||
|
||||
for ( Enum<AEColor> v : variants )
|
||||
{
|
||||
ItemStackSrc is = ( ( ItemMultiPart ) partItem.item() ).createPart( type, v );
|
||||
if ( is != null )
|
||||
def.add( ( AEColor ) v, is );
|
||||
}
|
||||
|
||||
f.set( parts, def );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( Throwable err )
|
||||
{
|
||||
AELog.severe( "Error creating part: " + type.name() );
|
||||
throw new RuntimeException( err );
|
||||
}
|
||||
feature.postInit();
|
||||
}
|
||||
|
||||
// very important block!
|
||||
blocks.blockMultiPart = this.addFeature( BlockCableBus.class );
|
||||
|
||||
blocks.blockCraftingUnit = this.addFeature( BlockCraftingUnit.class );
|
||||
blocks.blockCraftingAccelerator = new WrappedDamageItemDefinition( blocks.blockCraftingUnit, 1 );
|
||||
blocks.blockCraftingMonitor = this.addFeature( BlockCraftingMonitor.class );
|
||||
blocks.blockCraftingStorage1k = this.addFeature( BlockCraftingStorage.class );
|
||||
blocks.blockCraftingStorage4k = new WrappedDamageItemDefinition( blocks.blockCraftingStorage1k, 1 );
|
||||
blocks.blockCraftingStorage16k = new WrappedDamageItemDefinition( blocks.blockCraftingStorage1k, 2 );
|
||||
blocks.blockCraftingStorage64k = new WrappedDamageItemDefinition( blocks.blockCraftingStorage1k, 3 );
|
||||
blocks.blockMolecularAssembler = this.addFeature( BlockMolecularAssembler.class );
|
||||
|
||||
blocks.blockQuartzOre = this.addFeature( OreQuartz.class );
|
||||
blocks.blockQuartzOreCharged = this.addFeature( OreQuartzCharged.class );
|
||||
blocks.blockMatrixFrame = this.addFeature( BlockMatrixFrame.class );
|
||||
blocks.blockQuartz = this.addFeature( BlockQuartz.class );
|
||||
blocks.blockFluix = this.addFeature( BlockFluix.class );
|
||||
blocks.blockSkyStone = this.addFeature( BlockSkyStone.class );
|
||||
blocks.blockSkyChest = this.addFeature( BlockSkyChest.class );
|
||||
blocks.blockSkyCompass = this.addFeature( BlockSkyCompass.class );
|
||||
|
||||
blocks.blockQuartzGlass = this.addFeature( BlockQuartzGlass.class );
|
||||
blocks.blockQuartzVibrantGlass = this.addFeature( BlockQuartzLamp.class );
|
||||
blocks.blockQuartzPillar = this.addFeature( BlockQuartzPillar.class );
|
||||
blocks.blockQuartzChiseled = this.addFeature( BlockQuartzChiseled.class );
|
||||
blocks.blockQuartzTorch = this.addFeature( BlockQuartzTorch.class );
|
||||
blocks.blockLightDetector = this.addFeature( BlockLightDetector.class );
|
||||
blocks.blockCharger = this.addFeature( BlockCharger.class );
|
||||
blocks.blockQuartzGrowthAccelerator = this.addFeature( BlockQuartzGrowthAccelerator.class );
|
||||
|
||||
blocks.blockGrindStone = this.addFeature( BlockGrinder.class );
|
||||
blocks.blockCrankHandle = this.addFeature( BlockCrank.class );
|
||||
blocks.blockInscriber = this.addFeature( BlockInscriber.class );
|
||||
blocks.blockWireless = this.addFeature( BlockWireless.class );
|
||||
blocks.blockTinyTNT = this.addFeature( BlockTinyTNT.class );
|
||||
|
||||
blocks.blockQuantumRing = this.addFeature( BlockQuantumRing.class );
|
||||
blocks.blockQuantumLink = this.addFeature( BlockQuantumLinkChamber.class );
|
||||
|
||||
blocks.blockSpatialPylon = this.addFeature( BlockSpatialPylon.class );
|
||||
blocks.blockSpatialIOPort = this.addFeature( BlockSpatialIOPort.class );
|
||||
|
||||
blocks.blockController = this.addFeature( BlockController.class );
|
||||
blocks.blockDrive = this.addFeature( BlockDrive.class );
|
||||
blocks.blockChest = this.addFeature( BlockChest.class );
|
||||
blocks.blockInterface = this.addFeature( BlockInterface.class );
|
||||
blocks.blockCellWorkbench = this.addFeature( BlockCellWorkbench.class );
|
||||
blocks.blockIOPort = this.addFeature( BlockIOPort.class );
|
||||
blocks.blockCondenser = this.addFeature( BlockCondenser.class );
|
||||
blocks.blockEnergyAcceptor = this.addFeature( BlockEnergyAcceptor.class );
|
||||
blocks.blockVibrationChamber = this.addFeature( BlockVibrationChamber.class );
|
||||
|
||||
blocks.blockEnergyCell = this.addFeature( BlockEnergyCell.class );
|
||||
blocks.blockEnergyCellDense = this.addFeature( BlockDenseEnergyCell.class );
|
||||
blocks.blockEnergyCellCreative = this.addFeature( BlockCreativeEnergyCell.class );
|
||||
|
||||
blocks.blockSecurity = this.addFeature( BlockSecurity.class );
|
||||
blocks.blockPaint = this.addFeature( BlockPaint.class );
|
||||
|
||||
items.itemCellCreative = this.addFeature( ItemCreativeStorageCell.class );
|
||||
items.itemViewCell = this.addFeature( ItemViewCell.class );
|
||||
items.itemEncodedPattern = this.addFeature( ItemEncodedPattern.class );
|
||||
|
||||
items.itemCell1k = this.addFeature( ItemBasicStorageCell.class, MaterialType.Cell1kPart, 1 );
|
||||
items.itemCell4k = this.addFeature( ItemBasicStorageCell.class, MaterialType.Cell4kPart, 4 );
|
||||
items.itemCell16k = this.addFeature( ItemBasicStorageCell.class, MaterialType.Cell16kPart, 16 );
|
||||
items.itemCell64k = this.addFeature( ItemBasicStorageCell.class, MaterialType.Cell64kPart, 64 );
|
||||
|
||||
items.itemSpatialCell2 = this.addFeature( ItemSpatialStorageCell.class, MaterialType.Cell2SpatialPart, 2 );
|
||||
items.itemSpatialCell16 = this.addFeature( ItemSpatialStorageCell.class, MaterialType.Cell16SpatialPart, 16 );
|
||||
items.itemSpatialCell128 = this.addFeature( ItemSpatialStorageCell.class, MaterialType.Cell128SpatialPart, 128 );
|
||||
|
||||
items.itemCertusQuartzKnife = this.addFeature( ToolQuartzCuttingKnife.class, AEFeature.CertusQuartzTools );
|
||||
items.itemCertusQuartzWrench = this.addFeature( ToolQuartzWrench.class, AEFeature.CertusQuartzTools );
|
||||
items.itemCertusQuartzAxe = this.addFeature( ToolQuartzAxe.class, AEFeature.CertusQuartzTools );
|
||||
items.itemCertusQuartzHoe = this.addFeature( ToolQuartzHoe.class, AEFeature.CertusQuartzTools );
|
||||
items.itemCertusQuartzPick = this.addFeature( ToolQuartzPickaxe.class, AEFeature.CertusQuartzTools );
|
||||
items.itemCertusQuartzShovel = this.addFeature( ToolQuartzSpade.class, AEFeature.CertusQuartzTools );
|
||||
items.itemCertusQuartzSword = this.addFeature( ToolQuartzSword.class, AEFeature.CertusQuartzTools );
|
||||
|
||||
items.itemNetherQuartzKnife = this.addFeature( ToolQuartzCuttingKnife.class, AEFeature.NetherQuartzTools );
|
||||
items.itemNetherQuartzWrench = this.addFeature( ToolQuartzWrench.class, AEFeature.NetherQuartzTools );
|
||||
items.itemNetherQuartzAxe = this.addFeature( ToolQuartzAxe.class, AEFeature.NetherQuartzTools );
|
||||
items.itemNetherQuartzHoe = this.addFeature( ToolQuartzHoe.class, AEFeature.NetherQuartzTools );
|
||||
items.itemNetherQuartzPick = this.addFeature( ToolQuartzPickaxe.class, AEFeature.NetherQuartzTools );
|
||||
items.itemNetherQuartzShovel = this.addFeature( ToolQuartzSpade.class, AEFeature.NetherQuartzTools );
|
||||
items.itemNetherQuartzSword = this.addFeature( ToolQuartzSword.class, AEFeature.NetherQuartzTools );
|
||||
|
||||
items.itemMassCannon = this.addFeature( ToolMassCannon.class );
|
||||
items.itemMemoryCard = this.addFeature( ToolMemoryCard.class );
|
||||
items.itemChargedStaff = this.addFeature( ToolChargedStaff.class );
|
||||
items.itemEntropyManipulator = this.addFeature( ToolEntropyManipulator.class );
|
||||
items.itemColorApplicator = this.addFeature( ToolColorApplicator.class );
|
||||
|
||||
items.itemWirelessTerminal = this.addFeature( ToolWirelessTerminal.class );
|
||||
items.itemNetworkTool = this.addFeature( ToolNetworkTool.class );
|
||||
items.itemPortableCell = this.addFeature( ToolPortableCell.class );
|
||||
items.itemBiometricCard = this.addFeature( ToolBiometricCard.class );
|
||||
|
||||
items.itemFacade = this.addFeature( ItemFacade.class );
|
||||
items.itemCrystalSeed = this.addFeature( ItemCrystalSeed.class );
|
||||
|
||||
ColoredItemDefinition paintBall;
|
||||
ColoredItemDefinition lumenPaintBall;
|
||||
items.itemPaintBall = paintBall = new ColoredItemDefinition();
|
||||
items.itemLumenPaintBall = lumenPaintBall = new ColoredItemDefinition();
|
||||
AEItemDefinition pb = this.addFeature( ItemPaintBall.class );
|
||||
|
||||
for ( AEColor c : AEColor.values() )
|
||||
{
|
||||
if ( c != AEColor.Transparent )
|
||||
{
|
||||
paintBall.add( c, new ItemStackSrc( pb.item(), c.ordinal() ) );
|
||||
lumenPaintBall.add( c, new ItemStackSrc( pb.item(), 20 + c.ordinal() ) );
|
||||
}
|
||||
}
|
||||
|
||||
// stairs
|
||||
this.addFeature( SkyStoneStairBlock.class, blocks.blockSkyStone.block(), 0 );
|
||||
this.addFeature( SkyStoneBlockStairBlock.class, blocks.blockSkyStone.block(), 1 );
|
||||
this.addFeature( SkyStoneBrickStairBlock.class, blocks.blockSkyStone.block(), 2 );
|
||||
this.addFeature( SkyStoneSmallBrickStairBlock.class, blocks.blockSkyStone.block(), 3 );
|
||||
this.addFeature( FluixStairBlock.class, blocks.blockFluix.block() );
|
||||
this.addFeature( QuartzStairBlock.class, blocks.blockQuartz.block() );
|
||||
this.addFeature( ChiseledQuartzStairBlock.class, blocks.blockQuartzChiseled.block() );
|
||||
this.addFeature( QuartzPillarStairBlock.class, blocks.blockQuartzPillar.block() );
|
||||
|
||||
// unsupported developer tools
|
||||
this.addFeature( ToolEraser.class );
|
||||
this.addFeature( ToolMeteoritePlacer.class );
|
||||
this.addFeature( ToolDebugCard.class );
|
||||
this.addFeature( ToolReplicatorCard.class );
|
||||
this.addFeature( BlockItemGen.class );
|
||||
this.addFeature( BlockChunkloader.class );
|
||||
this.addFeature( BlockPhantomNode.class );
|
||||
this.addFeature( BlockCubeGenerator.class );
|
||||
}
|
||||
|
||||
private void registerSpatial( boolean force )
|
||||
@@ -508,40 +215,296 @@ public final class Registration
|
||||
}
|
||||
}
|
||||
|
||||
private AEItemDefinition addFeature( Class<? extends IAEFeature> featureClass, Object... args )
|
||||
private void registerCraftHandlers( IRecipeHandlerRegistry registry )
|
||||
{
|
||||
final ClassInstantiation<IAEFeature> instantiation = new ClassInstantiation<IAEFeature>( featureClass, args );
|
||||
final Optional<IAEFeature> instance = instantiation.get();
|
||||
registry.addNewSubItemResolver( new AEItemResolver() );
|
||||
|
||||
if ( instance.isPresent() )
|
||||
{
|
||||
final IAEFeature feature = instance.get();
|
||||
final IFeatureHandler handler = feature.handler();
|
||||
if ( handler.isFeatureAvailable() )
|
||||
{
|
||||
for ( AEFeature f : handler.getFeatures() )
|
||||
{
|
||||
this.featuresToEntities.put( f, featureClass );
|
||||
}
|
||||
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 );
|
||||
|
||||
handler.register();
|
||||
feature.postInit();
|
||||
registry.addNewCraftHandler( "smelt", Smelt.class );
|
||||
registry.addNewCraftHandler( "inscribe", Inscribe.class );
|
||||
registry.addNewCraftHandler( "press", Press.class );
|
||||
|
||||
return handler.getDefinition();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RuntimeException( "Error upon Class Instantiation with Feature: " + featureClass.getName() );
|
||||
}
|
||||
registry.addNewCraftHandler( "shaped", Shaped.class );
|
||||
registry.addNewCraftHandler( "shapeless", Shapeless.class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns materials from the new API to the old API
|
||||
*
|
||||
* Uses direct cast, since its only a temporary solution anyways
|
||||
*
|
||||
* @param target old API
|
||||
* @param source new API
|
||||
*
|
||||
* @deprecated to be removed when the public definition API is removed
|
||||
*/
|
||||
@Deprecated
|
||||
private void assignMaterials( Materials target, IMaterials source )
|
||||
{
|
||||
target.materialCell2SpatialPart = this.converter.of( source.cell2SpatialPart() );
|
||||
target.materialCell16SpatialPart = this.converter.of( source.cell16SpatialPart() );
|
||||
target.materialCell128SpatialPart = this.converter.of( source.cell128SpatialPart() );
|
||||
|
||||
target.materialSilicon = this.converter.of( source.silicon() );
|
||||
target.materialSkyDust = this.converter.of( source.skyDust() );
|
||||
|
||||
target.materialCalcProcessorPress = this.converter.of( source.calcProcessorPress() );
|
||||
target.materialEngProcessorPress = this.converter.of( source.engProcessorPress() );
|
||||
target.materialLogicProcessorPress = this.converter.of( source.logicProcessorPress() );
|
||||
|
||||
target.materialCalcProcessorPrint = this.converter.of( source.calcProcessorPrint() );
|
||||
target.materialEngProcessorPrint = this.converter.of( source.engProcessorPrint() );
|
||||
target.materialLogicProcessorPrint = this.converter.of( source.logicProcessorPrint() );
|
||||
|
||||
target.materialSiliconPress = this.converter.of( source.siliconPress() );
|
||||
target.materialSiliconPrint = this.converter.of( source.siliconPrint() );
|
||||
|
||||
target.materialNamePress = this.converter.of( source.namePress() );
|
||||
|
||||
target.materialLogicProcessor = this.converter.of( source.logicProcessor() );
|
||||
target.materialCalcProcessor = this.converter.of( source.calcProcessor() );
|
||||
target.materialEngProcessor = this.converter.of( source.engProcessor() );
|
||||
|
||||
target.materialBasicCard = this.converter.of( source.basicCard() );
|
||||
target.materialAdvCard = this.converter.of( source.advCard() );
|
||||
|
||||
target.materialPurifiedCertusQuartzCrystal = this.converter.of( source.purifiedCertusQuartzCrystal() );
|
||||
target.materialPurifiedNetherQuartzCrystal = this.converter.of( source.purifiedNetherQuartzCrystal() );
|
||||
target.materialPurifiedFluixCrystal = this.converter.of( source.purifiedFluixCrystal() );
|
||||
|
||||
target.materialCell1kPart = this.converter.of( source.cell1kPart() );
|
||||
target.materialCell4kPart = this.converter.of( source.cell4kPart() );
|
||||
target.materialCell16kPart = this.converter.of( source.cell16kPart() );
|
||||
target.materialCell64kPart = this.converter.of( source.cell64kPart() );
|
||||
target.materialEmptyStorageCell = this.converter.of( source.emptyStorageCell() );
|
||||
|
||||
target.materialCardRedstone = this.converter.of( source.cardRedstone() );
|
||||
target.materialCardSpeed = this.converter.of( source.cardSpeed() );
|
||||
target.materialCardCapacity = this.converter.of( source.cardCapacity() );
|
||||
target.materialCardFuzzy = this.converter.of( source.cardFuzzy() );
|
||||
target.materialCardInverter = this.converter.of( source.cardInverter() );
|
||||
target.materialCardCrafting = this.converter.of( source.cardCrafting() );
|
||||
|
||||
target.materialEnderDust = this.converter.of( source.enderDust() );
|
||||
target.materialFlour = this.converter.of( source.flour() );
|
||||
target.materialGoldDust = this.converter.of( source.goldDust() );
|
||||
target.materialIronDust = this.converter.of( source.ironDust() );
|
||||
target.materialFluixDust = this.converter.of( source.fluixDust() );
|
||||
target.materialCertusQuartzDust = this.converter.of( source.certusQuartzDust() );
|
||||
target.materialNetherQuartzDust = this.converter.of( source.netherQuartzDust() );
|
||||
|
||||
target.materialMatterBall = this.converter.of( source.matterBall() );
|
||||
target.materialIronNugget = this.converter.of( source.ironNugget() );
|
||||
|
||||
target.materialCertusQuartzCrystal = this.converter.of( source.certusQuartzCrystal() );
|
||||
target.materialCertusQuartzCrystalCharged = this.converter.of( source.certusQuartzCrystalCharged() );
|
||||
target.materialFluixCrystal = this.converter.of( source.fluixCrystal() );
|
||||
target.materialFluixPearl = this.converter.of( source.fluixPearl() );
|
||||
|
||||
target.materialWoodenGear = this.converter.of( source.woodenGear() );
|
||||
|
||||
target.materialWireless = this.converter.of( source.wireless() );
|
||||
target.materialWirelessBooster = this.converter.of( source.wirelessBooster() );
|
||||
|
||||
target.materialAnnihilationCore = this.converter.of( source.annihilationCore() );
|
||||
target.materialFormationCore = this.converter.of( source.formationCore() );
|
||||
|
||||
target.materialSingularity = this.converter.of( source.singularity() );
|
||||
target.materialQESingularity = this.converter.of( source.qESingularity() );
|
||||
target.materialBlankPattern = this.converter.of( source.blankPattern() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns parts from the new API to the old API
|
||||
*
|
||||
* @param target old API
|
||||
* @param source new API
|
||||
*
|
||||
* @deprecated to be removed when the public definition API is removed
|
||||
*/
|
||||
@Deprecated
|
||||
private void assignParts( Parts target, IParts source )
|
||||
{
|
||||
target.partCableSmart = source.cableSmart();
|
||||
target.partCableCovered = source.cableCovered();
|
||||
target.partCableGlass = source.cableGlass();
|
||||
target.partCableDense = source.cableDense();
|
||||
// target.partLumenCableSmart = source.lumenCableSmart();
|
||||
// target.partLumenCableCovered = source.lumenCableCovered();
|
||||
// target.partLumenCableGlass = source.lumenCableGlass();
|
||||
// target.partLumenCableDense = source.lumenCableDense();
|
||||
target.partQuartzFiber = this.converter.of( source.quartzFiber() );
|
||||
target.partToggleBus = this.converter.of( source.toggleBus() );
|
||||
target.partInvertedToggleBus = this.converter.of( source.invertedToggleBus() );
|
||||
target.partStorageBus = this.converter.of( source.storageBus() );
|
||||
target.partImportBus = this.converter.of( source.importBus() );
|
||||
target.partExportBus = this.converter.of( source.exportBus() );
|
||||
target.partInterface = this.converter.of( source.iface() );
|
||||
target.partLevelEmitter = this.converter.of( source.levelEmitter() );
|
||||
target.partAnnihilationPlane = this.converter.of( source.annihilationPlane() );
|
||||
target.partFormationPlane = this.converter.of( source.formationPlane() );
|
||||
|
||||
target.partCableAnchor = this.converter.of( source.cableAnchor() );
|
||||
target.partP2PTunnelLight = target.partCableAnchor;
|
||||
target.partP2PTunnelRF = target.partP2PTunnelLight;
|
||||
target.partP2PTunnelEU = target.partP2PTunnelRF;
|
||||
target.partP2PTunnelLiquids = target.partP2PTunnelEU;
|
||||
target.partP2PTunnelItems = target.partP2PTunnelLiquids;
|
||||
target.partP2PTunnelRedstone = target.partP2PTunnelItems;
|
||||
target.partP2PTunnelME = target.partP2PTunnelRedstone;
|
||||
target.partMonitor = this.converter.of( source.monitor() );
|
||||
target.partSemiDarkMonitor = this.converter.of( source.semiDarkMonitor() );
|
||||
target.partDarkMonitor = this.converter.of( source.darkMonitor() );
|
||||
target.partInterfaceTerminal = this.converter.of( source.interfaceTerminal() );
|
||||
target.partPatternTerminal = this.converter.of( source.patternTerminal() );
|
||||
target.partCraftingTerminal = this.converter.of( source.craftingTerminal() );
|
||||
target.partTerminal = this.converter.of( source.terminal() );
|
||||
target.partStorageMonitor = this.converter.of( source.storageMonitor() );
|
||||
target.partConversionMonitor = this.converter.of( source.conversionMonitor() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns blocks from the new API to the old API
|
||||
*
|
||||
* @param target old API
|
||||
* @param source new API
|
||||
*
|
||||
* @deprecated to be removed when the public definition API is removed
|
||||
*/
|
||||
@Deprecated
|
||||
private void assignBlocks( Blocks target, IBlocks source )
|
||||
{
|
||||
target.blockMultiPart = this.converter.of( source.multiPart() );
|
||||
|
||||
target.blockCraftingUnit = this.converter.of( source.craftingUnit() );
|
||||
target.blockCraftingAccelerator = this.converter.of( source.craftingAccelerator() );
|
||||
target.blockCraftingMonitor = this.converter.of( source.craftingMonitor() );
|
||||
target.blockCraftingStorage1k = this.converter.of( source.craftingStorage1k() );
|
||||
target.blockCraftingStorage4k = this.converter.of( source.craftingStorage4k() );
|
||||
target.blockCraftingStorage16k = this.converter.of( source.craftingStorage16k() );
|
||||
target.blockCraftingStorage64k = this.converter.of( source.craftingStorage64k() );
|
||||
target.blockMolecularAssembler = this.converter.of( source.molecularAssembler() );
|
||||
|
||||
target.blockQuartzOre = this.converter.of( source.quartzOre() );
|
||||
target.blockQuartzOreCharged = this.converter.of( source.quartzOreCharged() );
|
||||
target.blockMatrixFrame = this.converter.of( source.matrixFrame() );
|
||||
target.blockQuartz = this.converter.of( source.quartz() );
|
||||
target.blockFluix = this.converter.of( source.fluix() );
|
||||
target.blockSkyStone = this.converter.of( source.skyStone() );
|
||||
target.blockSkyChest = this.converter.of( source.skyChest() );
|
||||
target.blockSkyCompass = this.converter.of( source.skyCompass() );
|
||||
|
||||
target.blockQuartzGlass = this.converter.of( source.quartzGlass() );
|
||||
target.blockQuartzVibrantGlass = this.converter.of( source.quartzVibrantGlass() );
|
||||
target.blockQuartzPillar = this.converter.of( source.quartzPillar() );
|
||||
target.blockQuartzChiseled = this.converter.of( source.quartzChiseled() );
|
||||
target.blockQuartzTorch = this.converter.of( source.quartzTorch() );
|
||||
target.blockLightDetector = this.converter.of( source.lightDetector() );
|
||||
target.blockCharger = this.converter.of( source.charger() );
|
||||
target.blockQuartzGrowthAccelerator = this.converter.of( source.quartzGrowthAccelerator() );
|
||||
|
||||
target.blockGrindStone = this.converter.of( source.grindStone() );
|
||||
target.blockCrankHandle = this.converter.of( source.crankHandle() );
|
||||
target.blockInscriber = this.converter.of( source.inscriber() );
|
||||
target.blockWireless = this.converter.of( source.wireless() );
|
||||
target.blockTinyTNT = this.converter.of( source.tinyTNT() );
|
||||
|
||||
target.blockQuantumRing = this.converter.of( source.quantumRing() );
|
||||
target.blockQuantumLink = this.converter.of( source.quantumLink() );
|
||||
|
||||
target.blockSpatialPylon = this.converter.of( source.spatialPylon() );
|
||||
target.blockSpatialIOPort = this.converter.of( source.spatialIOPort() );
|
||||
|
||||
target.blockController = this.converter.of( source.controller() );
|
||||
target.blockDrive = this.converter.of( source.drive() );
|
||||
target.blockChest = this.converter.of( source.chest() );
|
||||
target.blockInterface = this.converter.of( source.iface() );
|
||||
target.blockCellWorkbench = this.converter.of( source.cellWorkbench() );
|
||||
target.blockIOPort = this.converter.of( source.iOPort() );
|
||||
target.blockCondenser = this.converter.of( source.condenser() );
|
||||
target.blockEnergyAcceptor = this.converter.of( source.energyAcceptor() );
|
||||
target.blockVibrationChamber = this.converter.of( source.vibrationChamber() );
|
||||
|
||||
target.blockEnergyCell = this.converter.of( source.energyCell() );
|
||||
target.blockEnergyCellDense = this.converter.of( source.energyCellDense() );
|
||||
target.blockEnergyCellCreative = this.converter.of( source.energyCellCreative() );
|
||||
|
||||
target.blockSecurity = this.converter.of( source.security() );
|
||||
target.blockPaint = this.converter.of( source.paint() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns materials from the new API to the old API
|
||||
*
|
||||
* @param target old API
|
||||
* @param source new API
|
||||
*
|
||||
* @deprecated to be removed when the public definition API is removed
|
||||
*/
|
||||
@Deprecated
|
||||
private void assignItems( Items target, IItems source )
|
||||
{
|
||||
target.itemCellCreative = this.converter.of( source.cellCreative() );
|
||||
target.itemViewCell = this.converter.of( source.viewCell() );
|
||||
target.itemEncodedPattern = this.converter.of( source.encodedPattern() );
|
||||
|
||||
target.itemCell1k = this.converter.of( source.cell1k() );
|
||||
target.itemCell4k = this.converter.of( source.cell4k() );
|
||||
target.itemCell16k = this.converter.of( source.cell16k() );
|
||||
target.itemCell64k = this.converter.of( source.cell64k() );
|
||||
|
||||
target.itemSpatialCell2 = this.converter.of( source.spatialCell2() );
|
||||
target.itemSpatialCell16 = this.converter.of( source.spatialCell16() );
|
||||
target.itemSpatialCell128 = this.converter.of( source.spatialCell128() );
|
||||
|
||||
target.itemCertusQuartzKnife = this.converter.of( source.certusQuartzKnife() );
|
||||
target.itemCertusQuartzWrench = this.converter.of( source.certusQuartzWrench() );
|
||||
target.itemCertusQuartzAxe = this.converter.of( source.certusQuartzAxe() );
|
||||
target.itemCertusQuartzHoe = this.converter.of( source.certusQuartzHoe() );
|
||||
target.itemCertusQuartzPick = this.converter.of( source.certusQuartzPick() );
|
||||
target.itemCertusQuartzShovel = this.converter.of( source.certusQuartzShovel() );
|
||||
target.itemCertusQuartzSword = this.converter.of( source.certusQuartzSword() );
|
||||
|
||||
target.itemNetherQuartzKnife = this.converter.of( source.netherQuartzKnife() );
|
||||
target.itemNetherQuartzWrench = this.converter.of( source.netherQuartzWrench() );
|
||||
target.itemNetherQuartzAxe = this.converter.of( source.netherQuartzAxe() );
|
||||
target.itemNetherQuartzHoe = this.converter.of( source.netherQuartzHoe() );
|
||||
target.itemNetherQuartzPick = this.converter.of( source.netherQuartzPick() );
|
||||
target.itemNetherQuartzShovel = this.converter.of( source.netherQuartzShovel() );
|
||||
target.itemNetherQuartzSword = this.converter.of( source.netherQuartzSword() );
|
||||
|
||||
target.itemMassCannon = this.converter.of( source.massCannon() );
|
||||
target.itemMemoryCard = this.converter.of( source.memoryCard() );
|
||||
target.itemChargedStaff = this.converter.of( source.chargedStaff() );
|
||||
target.itemEntropyManipulator = this.converter.of( source.entropyManipulator() );
|
||||
target.itemColorApplicator = this.converter.of( source.colorApplicator() );
|
||||
|
||||
target.itemWirelessTerminal = this.converter.of( source.wirelessTerminal() );
|
||||
target.itemNetworkTool = this.converter.of( source.networkTool() );
|
||||
target.itemPortableCell = this.converter.of( source.portableCell() );
|
||||
target.itemBiometricCard = this.converter.of( source.biometricCard() );
|
||||
|
||||
target.itemFacade = this.converter.of( source.facade() );
|
||||
target.itemCrystalSeed = this.converter.of( source.crystalSeed() );
|
||||
|
||||
target.itemPaintBall = source.coloredPaintBall();
|
||||
target.itemLumenPaintBall = source.coloredLumenPaintBall();
|
||||
}
|
||||
|
||||
public void initialize( FMLInitializationEvent event )
|
||||
{
|
||||
final IAppEngApi api = AEApi.instance();
|
||||
final IPartHelper partHelper = api.partHelper();
|
||||
final IRegistryContainer registries = api.registries();
|
||||
|
||||
// Perform ore camouflage!
|
||||
ItemMultiMaterial.instance.makeUnique();
|
||||
|
||||
@@ -550,19 +513,18 @@ public final class Registration
|
||||
else
|
||||
this.recipeHandler.parseRecipes( new JarLoader( "/assets/appliedenergistics2/recipes/" ), "index.recipe" );
|
||||
|
||||
IPartHelper ph = AEApi.instance().partHelper();
|
||||
ph.registerNewLayer( "appeng.parts.layers.LayerISidedInventory", "net.minecraft.inventory.ISidedInventory" );
|
||||
ph.registerNewLayer( "appeng.parts.layers.LayerIFluidHandler", "net.minecraftforge.fluids.IFluidHandler" );
|
||||
ph.registerNewLayer( "appeng.parts.layers.LayerITileStorageMonitorable", "appeng.api.implementations.tiles.ITileStorageMonitorable" );
|
||||
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 ( AppEng.instance.isIntegrationEnabled( IntegrationType.IC2 ) )
|
||||
{
|
||||
ph.registerNewLayer( "appeng.parts.layers.LayerIEnergySink", "ic2.api.energy.tile.IEnergySink" );
|
||||
ph.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" );
|
||||
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySink", "ic2.api.energy.tile.IEnergySink" );
|
||||
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" );
|
||||
}
|
||||
|
||||
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.RF ) )
|
||||
ph.registerNewLayer( "appeng.parts.layers.LayerIEnergyHandler", "cofh.api.energy.IEnergyReceiver" );
|
||||
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergyHandler", "cofh.api.energy.IEnergyReceiver" );
|
||||
|
||||
FMLCommonHandler.instance().bus().register( TickHandler.INSTANCE );
|
||||
MinecraftForge.EVENT_BUS.register( TickHandler.INSTANCE );
|
||||
@@ -571,7 +533,7 @@ public final class Registration
|
||||
MinecraftForge.EVENT_BUS.register( pp );
|
||||
FMLCommonHandler.instance().bus().register( pp );
|
||||
|
||||
IGridCacheRegistry gcr = AEApi.instance().registries().gridCache();
|
||||
IGridCacheRegistry gcr = registries.gridCache();
|
||||
gcr.registerGridCache( ITickManager.class, TickManagerCache.class );
|
||||
gcr.registerGridCache( IEnergyGrid.class, EnergyGridCache.class );
|
||||
gcr.registerGridCache( IPathingGrid.class, PathGridCache.class );
|
||||
@@ -581,12 +543,17 @@ public final class Registration
|
||||
gcr.registerGridCache( ISecurityGrid.class, SecurityCache.class );
|
||||
gcr.registerGridCache( ICraftingGrid.class, CraftingGridCache.class );
|
||||
|
||||
AEApi.instance().registries().externalStorage().addExternalStorageInterface( new AEExternalHandler() );
|
||||
registries.externalStorage().addExternalStorageInterface( new AEExternalHandler() );
|
||||
|
||||
AEApi.instance().registries().cell().addCellHandler( new BasicCellHandler() );
|
||||
AEApi.instance().registries().cell().addCellHandler( new CreativeCellHandler() );
|
||||
registries.cell().addCellHandler( new BasicCellHandler() );
|
||||
registries.cell().addCellHandler( new CreativeCellHandler() );
|
||||
|
||||
AEApi.instance().registries().matterCannon().registerAmmo( AEApi.instance().materials().materialMatterBall.stack( 1 ), 32.0 );
|
||||
for ( ItemStack ammoStack : api.definitions().materials().matterBall().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
final double weight = 32;
|
||||
|
||||
registries.matterCannon().registerAmmo( ammoStack, weight );
|
||||
}
|
||||
|
||||
this.recipeHandler.injectRecipes();
|
||||
|
||||
@@ -607,95 +574,108 @@ public final class Registration
|
||||
|
||||
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();
|
||||
final IDefinitions definitions = api.definitions();
|
||||
final IParts parts = definitions.parts();
|
||||
final IBlocks blocks = definitions.blocks();
|
||||
final IItems items = definitions.items();
|
||||
|
||||
// default settings..
|
||||
( ( P2PTunnelRegistry ) registries.p2pTunnel() ).configure();
|
||||
( (P2PTunnelRegistry) registries.p2pTunnel() ).configure();
|
||||
|
||||
// add to localization..
|
||||
PlayerMessages.values();
|
||||
GuiText.values();
|
||||
|
||||
Api.INSTANCE.partHelper.initFMPSupport();
|
||||
( ( BlockCableBus ) blocks.blockMultiPart.block() ).setupTile();
|
||||
Api.INSTANCE.getPartHelper().initFMPSupport();
|
||||
for ( Block block : blocks.multiPart().maybeBlock().asSet() )
|
||||
{
|
||||
( (BlockCableBus) block ).setupTile();
|
||||
}
|
||||
|
||||
// Interface
|
||||
Upgrades.CRAFTING.registerItem( parts.partInterface, 1 );
|
||||
Upgrades.CRAFTING.registerItem( blocks.blockInterface, 1 );
|
||||
Upgrades.CRAFTING.registerItem( parts.iface(), 1 );
|
||||
Upgrades.CRAFTING.registerItem( blocks.iface(), 1 );
|
||||
|
||||
// IO Port!
|
||||
Upgrades.SPEED.registerItem( blocks.blockIOPort, 3 );
|
||||
Upgrades.REDSTONE.registerItem( blocks.blockIOPort, 1 );
|
||||
Upgrades.SPEED.registerItem( blocks.iOPort(), 3 );
|
||||
Upgrades.REDSTONE.registerItem( blocks.iOPort(), 1 );
|
||||
|
||||
// Level Emitter!
|
||||
Upgrades.FUZZY.registerItem( parts.partLevelEmitter, 1 );
|
||||
Upgrades.CRAFTING.registerItem( parts.partLevelEmitter, 1 );
|
||||
Upgrades.FUZZY.registerItem( parts.levelEmitter(), 1 );
|
||||
Upgrades.CRAFTING.registerItem( parts.levelEmitter(), 1 );
|
||||
|
||||
// Import Bus
|
||||
Upgrades.FUZZY.registerItem( parts.partImportBus, 1 );
|
||||
Upgrades.REDSTONE.registerItem( parts.partImportBus, 1 );
|
||||
Upgrades.CAPACITY.registerItem( parts.partImportBus, 2 );
|
||||
Upgrades.SPEED.registerItem( parts.partImportBus, 4 );
|
||||
Upgrades.FUZZY.registerItem( parts.importBus(), 1 );
|
||||
Upgrades.REDSTONE.registerItem( parts.importBus(), 1 );
|
||||
Upgrades.CAPACITY.registerItem( parts.importBus(), 2 );
|
||||
Upgrades.SPEED.registerItem( parts.importBus(), 4 );
|
||||
|
||||
// Export Bus
|
||||
Upgrades.FUZZY.registerItem( parts.partExportBus, 1 );
|
||||
Upgrades.REDSTONE.registerItem( parts.partExportBus, 1 );
|
||||
Upgrades.CAPACITY.registerItem( parts.partExportBus, 2 );
|
||||
Upgrades.SPEED.registerItem( parts.partExportBus, 4 );
|
||||
Upgrades.CRAFTING.registerItem( parts.partExportBus, 1 );
|
||||
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 );
|
||||
|
||||
// Storage Cells
|
||||
Upgrades.FUZZY.registerItem( items.itemCell1k, 1 );
|
||||
Upgrades.INVERTER.registerItem( items.itemCell1k, 1 );
|
||||
Upgrades.FUZZY.registerItem( items.cell1k(), 1 );
|
||||
Upgrades.INVERTER.registerItem( items.cell1k(), 1 );
|
||||
|
||||
Upgrades.FUZZY.registerItem( items.itemCell4k, 1 );
|
||||
Upgrades.INVERTER.registerItem( items.itemCell4k, 1 );
|
||||
Upgrades.FUZZY.registerItem( items.cell4k(), 1 );
|
||||
Upgrades.INVERTER.registerItem( items.cell4k(), 1 );
|
||||
|
||||
Upgrades.FUZZY.registerItem( items.itemCell16k, 1 );
|
||||
Upgrades.INVERTER.registerItem( items.itemCell16k, 1 );
|
||||
Upgrades.FUZZY.registerItem( items.cell16k(), 1 );
|
||||
Upgrades.INVERTER.registerItem( items.cell16k(), 1 );
|
||||
|
||||
Upgrades.FUZZY.registerItem( items.itemCell64k, 1 );
|
||||
Upgrades.INVERTER.registerItem( items.itemCell64k, 1 );
|
||||
Upgrades.FUZZY.registerItem( items.cell64k(), 1 );
|
||||
Upgrades.INVERTER.registerItem( items.cell64k(), 1 );
|
||||
|
||||
Upgrades.FUZZY.registerItem( items.itemPortableCell, 1 );
|
||||
Upgrades.INVERTER.registerItem( items.itemPortableCell, 1 );
|
||||
Upgrades.FUZZY.registerItem( items.portableCell(), 1 );
|
||||
Upgrades.INVERTER.registerItem( items.portableCell(), 1 );
|
||||
|
||||
Upgrades.FUZZY.registerItem( items.itemViewCell, 1 );
|
||||
Upgrades.INVERTER.registerItem( items.itemViewCell, 1 );
|
||||
Upgrades.FUZZY.registerItem( items.viewCell(), 1 );
|
||||
Upgrades.INVERTER.registerItem( items.viewCell(), 1 );
|
||||
|
||||
// Storage Bus
|
||||
Upgrades.FUZZY.registerItem( parts.partStorageBus, 1 );
|
||||
Upgrades.INVERTER.registerItem( parts.partStorageBus, 1 );
|
||||
Upgrades.CAPACITY.registerItem( parts.partStorageBus, 5 );
|
||||
Upgrades.FUZZY.registerItem( parts.storageBus(), 1 );
|
||||
Upgrades.INVERTER.registerItem( parts.storageBus(), 1 );
|
||||
Upgrades.CAPACITY.registerItem( parts.storageBus(), 5 );
|
||||
|
||||
// Formation Plane
|
||||
Upgrades.FUZZY.registerItem( parts.partFormationPlane, 1 );
|
||||
Upgrades.INVERTER.registerItem( parts.partFormationPlane, 1 );
|
||||
Upgrades.CAPACITY.registerItem( parts.partFormationPlane, 5 );
|
||||
Upgrades.FUZZY.registerItem( parts.formationPlane(), 1 );
|
||||
Upgrades.INVERTER.registerItem( parts.formationPlane(), 1 );
|
||||
Upgrades.CAPACITY.registerItem( parts.formationPlane(), 5 );
|
||||
|
||||
// Matter Cannon
|
||||
Upgrades.FUZZY.registerItem( items.itemMassCannon, 1 );
|
||||
Upgrades.INVERTER.registerItem( items.itemMassCannon, 1 );
|
||||
Upgrades.SPEED.registerItem( items.itemMassCannon, 4 );
|
||||
Upgrades.FUZZY.registerItem( items.massCannon(), 1 );
|
||||
Upgrades.INVERTER.registerItem( items.massCannon(), 1 );
|
||||
Upgrades.SPEED.registerItem( items.massCannon(), 4 );
|
||||
|
||||
// Molecular Assembler
|
||||
Upgrades.SPEED.registerItem( blocks.blockMolecularAssembler, 5 );
|
||||
Upgrades.SPEED.registerItem( blocks.molecularAssembler(), 5 );
|
||||
|
||||
// Inscriber
|
||||
Upgrades.SPEED.registerItem( blocks.blockInscriber, 3 );
|
||||
Upgrades.SPEED.registerItem( blocks.inscriber(), 3 );
|
||||
|
||||
if ( items.itemWirelessTerminal != null )
|
||||
for ( Item wirelessTerminalItem : items.wirelessTerminal().maybeItem().asSet() )
|
||||
{
|
||||
registries.wireless().registerWirelessHandler( ( IWirelessTermHandler ) items.itemWirelessTerminal.item() );
|
||||
registries.wireless().registerWirelessHandler( (IWirelessTermHandler) wirelessTerminalItem );
|
||||
}
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.ChestLoot ) )
|
||||
{
|
||||
ChestGenHooks d = ChestGenHooks.getInfo( ChestGenHooks.MINESHAFT_CORRIDOR );
|
||||
d.addItem( new WeightedRandomChestContent( api.materials().materialCertusQuartzCrystal.stack( 1 ), 1, 4, 2 ) );
|
||||
d.addItem( new WeightedRandomChestContent( api.materials().materialCertusQuartzDust.stack( 1 ), 1, 4, 2 ) );
|
||||
|
||||
final IMaterials materials = definitions.materials();
|
||||
|
||||
for ( ItemStack crystal : materials.certusQuartzCrystal().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
d.addItem( new WeightedRandomChestContent( crystal, 1, 4, 2 ) );
|
||||
}
|
||||
for ( ItemStack dust : materials.certusQuartzDust().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
d.addItem( new WeightedRandomChestContent( dust, 1, 4, 2 ) );
|
||||
}
|
||||
}
|
||||
|
||||
// add villager trading to black smiths for a few basic materials
|
||||
|
||||
@@ -92,7 +92,7 @@ public class WorldSettings extends Configuration
|
||||
}
|
||||
|
||||
final ConfigCategory playerList = this.getCategory( "players" );
|
||||
this.mappings = new PlayerMappings( playerList, AELog.instance );
|
||||
this.mappings = new PlayerMappings( playerList, AELog.INSTANCE );
|
||||
}
|
||||
|
||||
public static WorldSettings getInstance()
|
||||
|
||||
@@ -0,0 +1,599 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.core.api.definitions;
|
||||
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.crafting.BlockCraftingMonitor;
|
||||
import appeng.block.crafting.BlockCraftingStorage;
|
||||
import appeng.block.crafting.BlockCraftingUnit;
|
||||
import appeng.block.crafting.BlockMolecularAssembler;
|
||||
import appeng.block.grindstone.BlockCrank;
|
||||
import appeng.block.grindstone.BlockGrinder;
|
||||
import appeng.block.misc.BlockCellWorkbench;
|
||||
import appeng.block.misc.BlockCharger;
|
||||
import appeng.block.misc.BlockCondenser;
|
||||
import appeng.block.misc.BlockInscriber;
|
||||
import appeng.block.misc.BlockInterface;
|
||||
import appeng.block.misc.BlockLightDetector;
|
||||
import appeng.block.misc.BlockPaint;
|
||||
import appeng.block.misc.BlockQuartzGrowthAccelerator;
|
||||
import appeng.block.misc.BlockQuartzTorch;
|
||||
import appeng.block.misc.BlockSecurity;
|
||||
import appeng.block.misc.BlockSkyCompass;
|
||||
import appeng.block.misc.BlockTinyTNT;
|
||||
import appeng.block.misc.BlockVibrationChamber;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.block.networking.BlockController;
|
||||
import appeng.block.networking.BlockCreativeEnergyCell;
|
||||
import appeng.block.networking.BlockDenseEnergyCell;
|
||||
import appeng.block.networking.BlockEnergyAcceptor;
|
||||
import appeng.block.networking.BlockEnergyCell;
|
||||
import appeng.block.networking.BlockWireless;
|
||||
import appeng.block.qnb.BlockQuantumLinkChamber;
|
||||
import appeng.block.qnb.BlockQuantumRing;
|
||||
import appeng.block.solids.BlockFluix;
|
||||
import appeng.block.solids.BlockQuartz;
|
||||
import appeng.block.solids.BlockQuartzChiseled;
|
||||
import appeng.block.solids.BlockQuartzGlass;
|
||||
import appeng.block.solids.BlockQuartzLamp;
|
||||
import appeng.block.solids.BlockQuartzPillar;
|
||||
import appeng.block.solids.BlockSkyStone;
|
||||
import appeng.block.solids.OreQuartz;
|
||||
import appeng.block.solids.OreQuartzCharged;
|
||||
import appeng.block.spatial.BlockMatrixFrame;
|
||||
import appeng.block.spatial.BlockSpatialIOPort;
|
||||
import appeng.block.spatial.BlockSpatialPylon;
|
||||
import appeng.block.stair.ChiseledQuartzStairBlock;
|
||||
import appeng.block.stair.FluixStairBlock;
|
||||
import appeng.block.stair.QuartzPillarStairBlock;
|
||||
import appeng.block.stair.QuartzStairBlock;
|
||||
import appeng.block.stair.SkyStoneBlockStairBlock;
|
||||
import appeng.block.stair.SkyStoneBrickStairBlock;
|
||||
import appeng.block.stair.SkyStoneSmallBrickStairBlock;
|
||||
import appeng.block.stair.SkyStoneStairBlock;
|
||||
import appeng.block.storage.BlockChest;
|
||||
import appeng.block.storage.BlockDrive;
|
||||
import appeng.block.storage.BlockIOPort;
|
||||
import appeng.block.storage.BlockSkyChest;
|
||||
import appeng.core.features.WrappedDamageItemDefinition;
|
||||
import appeng.debug.BlockChunkloader;
|
||||
import appeng.debug.BlockCubeGenerator;
|
||||
import appeng.debug.BlockItemGen;
|
||||
import appeng.debug.BlockPhantomNode;
|
||||
|
||||
|
||||
/**
|
||||
* Internal implementation for the API blocks
|
||||
*/
|
||||
public final class ApiBlocks implements IBlocks
|
||||
{
|
||||
private final IBlockDefinition quartzOre;
|
||||
private final IBlockDefinition quartzOreCharged;
|
||||
private final IBlockDefinition matrixFrame;
|
||||
private final IBlockDefinition quartz;
|
||||
private final IBlockDefinition quartzPillar;
|
||||
private final IBlockDefinition quartzChiseled;
|
||||
private final IBlockDefinition quartzGlass;
|
||||
private final IBlockDefinition quartzVibrantGlass;
|
||||
private final IBlockDefinition quartzTorch;
|
||||
private final IBlockDefinition fluix;
|
||||
private final IBlockDefinition skyStone;
|
||||
private final IBlockDefinition skyChest;
|
||||
private final IBlockDefinition skyCompass;
|
||||
private final ITileDefinition grindStone;
|
||||
private final ITileDefinition crankHandle;
|
||||
private final ITileDefinition inscriber;
|
||||
private final ITileDefinition wireless;
|
||||
private final ITileDefinition charger;
|
||||
private final ITileDefinition tinyTNT;
|
||||
private final ITileDefinition security;
|
||||
private final ITileDefinition quantumRing;
|
||||
private final ITileDefinition quantumLink;
|
||||
private final ITileDefinition spatialPylon;
|
||||
private final ITileDefinition spatialIOPort;
|
||||
private final ITileDefinition multiPart;
|
||||
private final ITileDefinition controller;
|
||||
private final ITileDefinition drive;
|
||||
private final ITileDefinition chest;
|
||||
private final ITileDefinition iface;
|
||||
private final ITileDefinition cellWorkbench;
|
||||
private final ITileDefinition iOPort;
|
||||
private final ITileDefinition condenser;
|
||||
private final ITileDefinition energyAcceptor;
|
||||
private final ITileDefinition vibrationChamber;
|
||||
private final ITileDefinition quartzGrowthAccelerator;
|
||||
private final ITileDefinition energyCell;
|
||||
private final ITileDefinition energyCellDense;
|
||||
private final ITileDefinition energyCellCreative;
|
||||
private final ITileDefinition craftingUnit;
|
||||
private final ITileDefinition craftingAccelerator;
|
||||
private final ITileDefinition craftingStorage1k;
|
||||
private final ITileDefinition craftingStorage4k;
|
||||
private final ITileDefinition craftingStorage16k;
|
||||
private final ITileDefinition craftingStorage64k;
|
||||
private final ITileDefinition craftingMonitor;
|
||||
private final ITileDefinition molecularAssembler;
|
||||
private final ITileDefinition lightDetector;
|
||||
private final ITileDefinition paint;
|
||||
private final IBlockDefinition skyStoneStair;
|
||||
private final IBlockDefinition skyStoneBlockStair;
|
||||
private final IBlockDefinition skyStoneBrickStair;
|
||||
private final IBlockDefinition skyStoneSmallBrickStair;
|
||||
private final IBlockDefinition fluixStair;
|
||||
private final IBlockDefinition quartzStair;
|
||||
private final IBlockDefinition chiseledQuartzStair;
|
||||
private final IBlockDefinition quartzPillarStair;
|
||||
|
||||
private final IBlockDefinition itemGen;
|
||||
private final IBlockDefinition chunkLoader;
|
||||
private final IBlockDefinition phantomNode;
|
||||
private final IBlockDefinition cubeGenerator;
|
||||
|
||||
private final Set<IOrientableBlock> orientables;
|
||||
|
||||
public ApiBlocks( DefinitionConstructor constructor )
|
||||
{
|
||||
final BlockLightDetector lightDetector = new BlockLightDetector();
|
||||
final BlockQuartzPillar quartzPillar = new BlockQuartzPillar();
|
||||
final BlockSkyStone skyStone = new BlockSkyStone();
|
||||
final BlockFluix fluixBlock = new BlockFluix();
|
||||
final BlockQuartzGrowthAccelerator cga = new BlockQuartzGrowthAccelerator();
|
||||
final BlockQuartzTorch quartzTorch = new BlockQuartzTorch();
|
||||
final BlockQuartz quartzBlock = new BlockQuartz();
|
||||
final BlockQuartzChiseled chiseldQuartz = new BlockQuartzChiseled();
|
||||
|
||||
this.orientables = ImmutableSet.<IOrientableBlock>of( lightDetector, quartzPillar, skyStone, cga, quartzTorch );
|
||||
|
||||
this.quartzOre = constructor.registerBlockDefinition( new OreQuartz() );
|
||||
this.quartzOreCharged = constructor.registerBlockDefinition( new OreQuartzCharged() );
|
||||
this.matrixFrame = constructor.registerBlockDefinition( new BlockMatrixFrame() );
|
||||
this.quartz = constructor.registerBlockDefinition( quartzBlock );
|
||||
this.quartzPillar = constructor.registerBlockDefinition( quartzPillar );
|
||||
this.quartzChiseled = constructor.registerBlockDefinition( chiseldQuartz );
|
||||
this.quartzGlass = constructor.registerBlockDefinition( new BlockQuartzGlass() );
|
||||
this.quartzVibrantGlass = constructor.registerBlockDefinition( new BlockQuartzLamp() );
|
||||
this.quartzTorch = constructor.registerBlockDefinition( quartzTorch );
|
||||
this.fluix = constructor.registerBlockDefinition( fluixBlock );
|
||||
this.skyStone = constructor.registerBlockDefinition( skyStone );
|
||||
this.skyChest = constructor.registerBlockDefinition( new BlockSkyChest() );
|
||||
this.skyCompass = constructor.registerBlockDefinition( new BlockSkyCompass() );
|
||||
this.grindStone = constructor.registerTileDefinition( new BlockGrinder() );
|
||||
this.crankHandle = constructor.registerTileDefinition( new BlockCrank() );
|
||||
this.inscriber = constructor.registerTileDefinition( new BlockInscriber() );
|
||||
this.wireless = constructor.registerTileDefinition( new BlockWireless() );
|
||||
this.charger = constructor.registerTileDefinition( new BlockCharger() );
|
||||
this.tinyTNT = constructor.registerTileDefinition( new BlockTinyTNT() );
|
||||
this.security = constructor.registerTileDefinition( new BlockSecurity() );
|
||||
this.quantumRing = constructor.registerTileDefinition( new BlockQuantumRing() );
|
||||
this.quantumLink = constructor.registerTileDefinition( new BlockQuantumLinkChamber() );
|
||||
this.spatialPylon = constructor.registerTileDefinition( new BlockSpatialPylon() );
|
||||
this.spatialIOPort = constructor.registerTileDefinition( new BlockSpatialIOPort() );
|
||||
this.multiPart = constructor.registerTileDefinition( new BlockCableBus() );
|
||||
this.controller = constructor.registerTileDefinition( new BlockController() );
|
||||
this.drive = constructor.registerTileDefinition( new BlockDrive() );
|
||||
this.chest = constructor.registerTileDefinition( new BlockChest() );
|
||||
this.iface = constructor.registerTileDefinition( new BlockInterface() );
|
||||
this.cellWorkbench = constructor.registerTileDefinition( new BlockCellWorkbench() );
|
||||
this.iOPort = constructor.registerTileDefinition( new BlockIOPort() );
|
||||
this.condenser = constructor.registerTileDefinition( new BlockCondenser() );
|
||||
this.energyAcceptor = constructor.registerTileDefinition( new BlockEnergyAcceptor() );
|
||||
this.vibrationChamber = constructor.registerTileDefinition( new BlockVibrationChamber() );
|
||||
this.quartzGrowthAccelerator = constructor.registerTileDefinition( cga );
|
||||
this.energyCell = constructor.registerTileDefinition( new BlockEnergyCell() );
|
||||
this.energyCellDense = constructor.registerTileDefinition( new BlockDenseEnergyCell() );
|
||||
this.energyCellCreative = constructor.registerTileDefinition( new BlockCreativeEnergyCell() );
|
||||
this.craftingUnit = constructor.registerTileDefinition( new BlockCraftingUnit() );
|
||||
this.craftingAccelerator = new WrappedDamageItemDefinition( this.craftingUnit, 1 );
|
||||
this.craftingStorage1k = constructor.registerTileDefinition( new BlockCraftingStorage() );
|
||||
this.craftingStorage4k = new WrappedDamageItemDefinition( this.craftingStorage1k, 1 );
|
||||
this.craftingStorage16k = new WrappedDamageItemDefinition( this.craftingStorage1k, 2 );
|
||||
this.craftingStorage64k = new WrappedDamageItemDefinition( this.craftingStorage1k, 3 );
|
||||
this.craftingMonitor = constructor.registerTileDefinition( new BlockCraftingMonitor() );
|
||||
this.molecularAssembler = constructor.registerTileDefinition( new BlockMolecularAssembler() );
|
||||
this.lightDetector = constructor.registerTileDefinition( lightDetector );
|
||||
this.paint = constructor.registerTileDefinition( new BlockPaint() );
|
||||
|
||||
this.skyStoneStair = constructor.registerBlockDefinition( new SkyStoneStairBlock( skyStone, 0 ) );
|
||||
this.skyStoneBlockStair = constructor.registerBlockDefinition( new SkyStoneBlockStairBlock( skyStone, 1 ) );
|
||||
this.skyStoneBrickStair = constructor.registerBlockDefinition( new SkyStoneBrickStairBlock( skyStone, 2 ) );
|
||||
this.skyStoneSmallBrickStair = constructor.registerBlockDefinition( new SkyStoneSmallBrickStairBlock( skyStone, 3 ) );
|
||||
|
||||
this.fluixStair = constructor.registerBlockDefinition( new FluixStairBlock( fluixBlock ) );
|
||||
|
||||
this.quartzStair = constructor.registerBlockDefinition( new QuartzStairBlock( quartzBlock ) );
|
||||
|
||||
this.chiseledQuartzStair = constructor.registerBlockDefinition( new ChiseledQuartzStairBlock( chiseldQuartz ) );
|
||||
|
||||
this.quartzPillarStair = constructor.registerBlockDefinition( new QuartzPillarStairBlock( quartzPillar ) );
|
||||
|
||||
this.itemGen = constructor.registerBlockDefinition( new BlockItemGen() );
|
||||
this.chunkLoader = constructor.registerBlockDefinition( new BlockChunkloader() );
|
||||
this.phantomNode = constructor.registerBlockDefinition( new BlockPhantomNode() );
|
||||
this.cubeGenerator = constructor.registerBlockDefinition( new BlockCubeGenerator() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition quartzOre()
|
||||
{
|
||||
return this.quartzOre;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition quartzOreCharged()
|
||||
{
|
||||
return this.quartzOreCharged;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition matrixFrame()
|
||||
{
|
||||
return this.matrixFrame;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition quartz()
|
||||
{
|
||||
return this.quartz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition quartzPillar()
|
||||
{
|
||||
return this.quartzPillar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition quartzChiseled()
|
||||
{
|
||||
return this.quartzChiseled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition quartzGlass()
|
||||
{
|
||||
return this.quartzGlass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition quartzVibrantGlass()
|
||||
{
|
||||
return this.quartzVibrantGlass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition quartzTorch()
|
||||
{
|
||||
return this.quartzTorch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition fluix()
|
||||
{
|
||||
return this.fluix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition skyStone()
|
||||
{
|
||||
return this.skyStone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition skyChest()
|
||||
{
|
||||
return this.skyChest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition skyCompass()
|
||||
{
|
||||
return this.skyCompass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition skyStoneStair()
|
||||
{
|
||||
return this.skyStoneStair;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition skyStoneBlockStair()
|
||||
{
|
||||
return this.skyStoneBlockStair;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition skyStoneBrickStair()
|
||||
{
|
||||
return this.skyStoneBrickStair;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition skyStoneSmallBrickStair()
|
||||
{
|
||||
return this.skyStoneSmallBrickStair;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition fluixStair()
|
||||
{
|
||||
return this.fluixStair;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition quartzStair()
|
||||
{
|
||||
return this.quartzStair;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition chiseledQuartzStair()
|
||||
{
|
||||
return this.chiseledQuartzStair;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition quartzPillarStair()
|
||||
{
|
||||
return this.quartzPillarStair;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition grindStone()
|
||||
{
|
||||
return this.grindStone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition crankHandle()
|
||||
{
|
||||
return this.crankHandle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition inscriber()
|
||||
{
|
||||
return this.inscriber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition wireless()
|
||||
{
|
||||
return this.wireless;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition charger()
|
||||
{
|
||||
return this.charger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition tinyTNT()
|
||||
{
|
||||
return this.tinyTNT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition security()
|
||||
{
|
||||
return this.security;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition quantumRing()
|
||||
{
|
||||
return this.quantumRing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition quantumLink()
|
||||
{
|
||||
return this.quantumLink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition spatialPylon()
|
||||
{
|
||||
return this.spatialPylon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition spatialIOPort()
|
||||
{
|
||||
return this.spatialIOPort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition multiPart()
|
||||
{
|
||||
return this.multiPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition controller()
|
||||
{
|
||||
return this.controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition drive()
|
||||
{
|
||||
return this.drive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition chest()
|
||||
{
|
||||
return this.chest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition iface()
|
||||
{
|
||||
return this.iface;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition cellWorkbench()
|
||||
{
|
||||
return this.cellWorkbench;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition iOPort()
|
||||
{
|
||||
return this.iOPort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition condenser()
|
||||
{
|
||||
return this.condenser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition energyAcceptor()
|
||||
{
|
||||
return this.energyAcceptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition vibrationChamber()
|
||||
{
|
||||
return this.vibrationChamber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition quartzGrowthAccelerator()
|
||||
{
|
||||
return this.quartzGrowthAccelerator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition energyCell()
|
||||
{
|
||||
return this.energyCell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition energyCellDense()
|
||||
{
|
||||
return this.energyCellDense;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition energyCellCreative()
|
||||
{
|
||||
return this.energyCellCreative;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition craftingUnit()
|
||||
{
|
||||
return this.craftingUnit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition craftingAccelerator()
|
||||
{
|
||||
return this.craftingAccelerator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition craftingStorage1k()
|
||||
{
|
||||
return this.craftingStorage1k;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition craftingStorage4k()
|
||||
{
|
||||
return this.craftingStorage4k;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition craftingStorage16k()
|
||||
{
|
||||
return this.craftingStorage16k;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition craftingStorage64k()
|
||||
{
|
||||
return this.craftingStorage64k;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition craftingMonitor()
|
||||
{
|
||||
return this.craftingMonitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition molecularAssembler()
|
||||
{
|
||||
return this.molecularAssembler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition lightDetector()
|
||||
{
|
||||
return this.lightDetector;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition paint()
|
||||
{
|
||||
return this.paint;
|
||||
}
|
||||
|
||||
public IBlockDefinition chunkLoader()
|
||||
{
|
||||
return this.chunkLoader;
|
||||
}
|
||||
|
||||
public IBlockDefinition itemGen()
|
||||
{
|
||||
return this.itemGen;
|
||||
}
|
||||
|
||||
public IBlockDefinition phantomNode()
|
||||
{
|
||||
return this.phantomNode;
|
||||
}
|
||||
|
||||
public IBlockDefinition cubeGenerator()
|
||||
{
|
||||
return this.cubeGenerator;
|
||||
}
|
||||
|
||||
public Set<IOrientableBlock> orientables()
|
||||
{
|
||||
return this.orientables;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,418 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.core.api.definitions;
|
||||
|
||||
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.IItems;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.debug.ToolDebugCard;
|
||||
import appeng.debug.ToolEraser;
|
||||
import appeng.debug.ToolMeteoritePlacer;
|
||||
import appeng.debug.ToolReplicatorCard;
|
||||
import appeng.items.materials.MaterialType;
|
||||
import appeng.items.misc.ItemCrystalSeed;
|
||||
import appeng.items.misc.ItemEncodedPattern;
|
||||
import appeng.items.misc.ItemPaintBall;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
import appeng.items.storage.ItemBasicStorageCell;
|
||||
import appeng.items.storage.ItemCreativeStorageCell;
|
||||
import appeng.items.storage.ItemSpatialStorageCell;
|
||||
import appeng.items.storage.ItemViewCell;
|
||||
import appeng.items.tools.ToolBiometricCard;
|
||||
import appeng.items.tools.ToolMemoryCard;
|
||||
import appeng.items.tools.ToolNetworkTool;
|
||||
import appeng.items.tools.powered.ToolChargedStaff;
|
||||
import appeng.items.tools.powered.ToolColorApplicator;
|
||||
import appeng.items.tools.powered.ToolEntropyManipulator;
|
||||
import appeng.items.tools.powered.ToolMassCannon;
|
||||
import appeng.items.tools.powered.ToolPortableCell;
|
||||
import appeng.items.tools.powered.ToolWirelessTerminal;
|
||||
import appeng.items.tools.quartz.ToolQuartzAxe;
|
||||
import appeng.items.tools.quartz.ToolQuartzCuttingKnife;
|
||||
import appeng.items.tools.quartz.ToolQuartzHoe;
|
||||
import appeng.items.tools.quartz.ToolQuartzPickaxe;
|
||||
import appeng.items.tools.quartz.ToolQuartzSpade;
|
||||
import appeng.items.tools.quartz.ToolQuartzSword;
|
||||
import appeng.items.tools.quartz.ToolQuartzWrench;
|
||||
|
||||
|
||||
/**
|
||||
* Internal implementation for the API items
|
||||
*/
|
||||
public final class ApiItems implements IItems
|
||||
{
|
||||
private final IItemDefinition certusQuartzAxe;
|
||||
private final IItemDefinition certusQuartzHoe;
|
||||
private final IItemDefinition certusQuartzShovel;
|
||||
private final IItemDefinition certusQuartzPick;
|
||||
private final IItemDefinition certusQuartzSword;
|
||||
private final IItemDefinition certusQuartzWrench;
|
||||
private final IItemDefinition certusQuartzKnife;
|
||||
|
||||
private final IItemDefinition netherQuartzAxe;
|
||||
private final IItemDefinition netherQuartzHoe;
|
||||
private final IItemDefinition netherQuartzShovel;
|
||||
private final IItemDefinition netherQuartzPick;
|
||||
private final IItemDefinition netherQuartzSword;
|
||||
private final IItemDefinition netherQuartzWrench;
|
||||
private final IItemDefinition netherQuartzKnife;
|
||||
|
||||
private final IItemDefinition entropyManipulator;
|
||||
private final IItemDefinition wirelessTerminal;
|
||||
private final IItemDefinition biometricCard;
|
||||
private final IItemDefinition chargedStaff;
|
||||
private final IItemDefinition massCannon;
|
||||
private final IItemDefinition memoryCard;
|
||||
private final IItemDefinition networkTool;
|
||||
private final IItemDefinition portableCell;
|
||||
|
||||
private final IItemDefinition cellCreative;
|
||||
private final IItemDefinition viewCell;
|
||||
|
||||
private final IItemDefinition cell1k;
|
||||
private final IItemDefinition cell4k;
|
||||
private final IItemDefinition cell16k;
|
||||
private final IItemDefinition cell64k;
|
||||
|
||||
private final IItemDefinition spatialCell2;
|
||||
private final IItemDefinition spatialCell16;
|
||||
private final IItemDefinition spatialCell128;
|
||||
|
||||
private final IItemDefinition facade;
|
||||
private final IItemDefinition crystalSeed;
|
||||
|
||||
// rv1
|
||||
private final IItemDefinition encodedPattern;
|
||||
private final IItemDefinition colorApplicator;
|
||||
|
||||
private final IItemDefinition paintBall;
|
||||
private final AEColoredItemDefinition coloredPaintBall;
|
||||
private final AEColoredItemDefinition coloredLumenPaintBall;
|
||||
|
||||
// unsupported dev tools
|
||||
private final IItemDefinition toolEraser;
|
||||
private final IItemDefinition toolMeteoritePlacer;
|
||||
private final IItemDefinition toolDebugCard;
|
||||
private final IItemDefinition toolReplicatorCard;
|
||||
|
||||
public ApiItems( DefinitionConstructor constructor )
|
||||
{
|
||||
this.certusQuartzAxe = constructor.registerItemDefinition( new ToolQuartzAxe( AEFeature.CertusQuartzTools ) );
|
||||
this.certusQuartzHoe = constructor.registerItemDefinition( new ToolQuartzHoe( AEFeature.CertusQuartzTools ) );
|
||||
this.certusQuartzShovel = constructor.registerItemDefinition( new ToolQuartzSpade( AEFeature.CertusQuartzTools ) );
|
||||
this.certusQuartzPick = constructor.registerItemDefinition( new ToolQuartzPickaxe( AEFeature.CertusQuartzTools ) );
|
||||
this.certusQuartzSword = constructor.registerItemDefinition( new ToolQuartzSword( AEFeature.CertusQuartzTools ) );
|
||||
this.certusQuartzWrench = constructor.registerItemDefinition( new ToolQuartzWrench( AEFeature.CertusQuartzTools ) );
|
||||
this.certusQuartzKnife = constructor.registerItemDefinition( new ToolQuartzCuttingKnife( AEFeature.CertusQuartzTools ) );
|
||||
|
||||
this.netherQuartzAxe = constructor.registerItemDefinition( new ToolQuartzAxe( AEFeature.NetherQuartzTools ) );
|
||||
this.netherQuartzHoe = constructor.registerItemDefinition( new ToolQuartzHoe( AEFeature.NetherQuartzTools ) );
|
||||
this.netherQuartzShovel = constructor.registerItemDefinition( new ToolQuartzSpade( AEFeature.NetherQuartzTools ) );
|
||||
this.netherQuartzPick = constructor.registerItemDefinition( new ToolQuartzPickaxe( AEFeature.NetherQuartzTools ) );
|
||||
this.netherQuartzSword = constructor.registerItemDefinition( new ToolQuartzSword( AEFeature.NetherQuartzTools ) );
|
||||
this.netherQuartzWrench = constructor.registerItemDefinition( new ToolQuartzWrench( AEFeature.NetherQuartzTools ) );
|
||||
this.netherQuartzKnife = constructor.registerItemDefinition( new ToolQuartzCuttingKnife( AEFeature.NetherQuartzTools ) );
|
||||
|
||||
this.entropyManipulator = constructor.registerItemDefinition( new ToolEntropyManipulator() );
|
||||
this.wirelessTerminal = constructor.registerItemDefinition( new ToolWirelessTerminal() );
|
||||
this.biometricCard = constructor.registerItemDefinition( new ToolBiometricCard() );
|
||||
this.chargedStaff = constructor.registerItemDefinition( new ToolChargedStaff() );
|
||||
this.massCannon = constructor.registerItemDefinition( new ToolMassCannon() );
|
||||
this.memoryCard = constructor.registerItemDefinition( new ToolMemoryCard() );
|
||||
this.networkTool = constructor.registerItemDefinition( new ToolNetworkTool() );
|
||||
this.portableCell = constructor.registerItemDefinition( new ToolPortableCell() );
|
||||
|
||||
this.cellCreative = constructor.registerItemDefinition( new ItemCreativeStorageCell() );
|
||||
this.viewCell = constructor.registerItemDefinition( new ItemViewCell() );
|
||||
|
||||
this.cell1k = constructor.registerItemDefinition( new ItemBasicStorageCell( MaterialType.Cell1kPart, 1 ) );
|
||||
this.cell4k = constructor.registerItemDefinition( new ItemBasicStorageCell( MaterialType.Cell4kPart, 4 ) );
|
||||
this.cell16k = constructor.registerItemDefinition( new ItemBasicStorageCell( MaterialType.Cell16kPart, 16 ) );
|
||||
this.cell64k = constructor.registerItemDefinition( new ItemBasicStorageCell( MaterialType.Cell64kPart, 64 ) );
|
||||
|
||||
this.spatialCell2 = constructor.registerItemDefinition( new ItemSpatialStorageCell( 2 ) );
|
||||
this.spatialCell16 = constructor.registerItemDefinition( new ItemSpatialStorageCell( 16 ) );
|
||||
this.spatialCell128 = constructor.registerItemDefinition( new ItemSpatialStorageCell( 128 ) );
|
||||
|
||||
this.facade = constructor.registerItemDefinition( new ItemFacade() );
|
||||
this.crystalSeed = constructor.registerItemDefinition( new ItemCrystalSeed() );
|
||||
|
||||
// rv1
|
||||
this.encodedPattern = constructor.registerItemDefinition( new ItemEncodedPattern() );
|
||||
this.colorApplicator = constructor.registerItemDefinition( new ToolColorApplicator() );
|
||||
|
||||
this.paintBall = constructor.registerItemDefinition( new ItemPaintBall() );
|
||||
this.coloredPaintBall = constructor.constructColoredDefinition( this.paintBall, 0 );
|
||||
this.coloredLumenPaintBall = constructor.constructColoredDefinition( this.paintBall, 20 );
|
||||
|
||||
this.toolEraser = constructor.registerItemDefinition( new ToolEraser() );
|
||||
this.toolMeteoritePlacer = constructor.registerItemDefinition( new ToolMeteoritePlacer() );
|
||||
this.toolDebugCard = constructor.registerItemDefinition( new ToolDebugCard() );
|
||||
this.toolReplicatorCard = constructor.registerItemDefinition( new ToolReplicatorCard() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition certusQuartzAxe()
|
||||
{
|
||||
return this.certusQuartzAxe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition certusQuartzHoe()
|
||||
{
|
||||
return this.certusQuartzHoe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition certusQuartzShovel()
|
||||
{
|
||||
return this.certusQuartzShovel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition certusQuartzPick()
|
||||
{
|
||||
return this.certusQuartzPick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition certusQuartzSword()
|
||||
{
|
||||
return this.certusQuartzSword;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition certusQuartzWrench()
|
||||
{
|
||||
return this.certusQuartzWrench;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition certusQuartzKnife()
|
||||
{
|
||||
return this.certusQuartzKnife;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition netherQuartzAxe()
|
||||
{
|
||||
return this.netherQuartzAxe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition netherQuartzHoe()
|
||||
{
|
||||
return this.netherQuartzHoe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition netherQuartzShovel()
|
||||
{
|
||||
return this.netherQuartzShovel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition netherQuartzPick()
|
||||
{
|
||||
return this.netherQuartzPick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition netherQuartzSword()
|
||||
{
|
||||
return this.netherQuartzSword;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition netherQuartzWrench()
|
||||
{
|
||||
return this.netherQuartzWrench;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition netherQuartzKnife()
|
||||
{
|
||||
return this.netherQuartzKnife;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition entropyManipulator()
|
||||
{
|
||||
return this.entropyManipulator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition wirelessTerminal()
|
||||
{
|
||||
return this.wirelessTerminal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition biometricCard()
|
||||
{
|
||||
return this.biometricCard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition chargedStaff()
|
||||
{
|
||||
return this.memoryCard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition massCannon()
|
||||
{
|
||||
return this.massCannon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition memoryCard()
|
||||
{
|
||||
return this.memoryCard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition networkTool()
|
||||
{
|
||||
return this.networkTool;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition portableCell()
|
||||
{
|
||||
return this.portableCell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cellCreative()
|
||||
{
|
||||
return this.cellCreative;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition viewCell()
|
||||
{
|
||||
return this.viewCell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cell1k()
|
||||
{
|
||||
return this.cell1k;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cell4k()
|
||||
{
|
||||
return this.cell4k;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cell16k()
|
||||
{
|
||||
return this.cell16k;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cell64k()
|
||||
{
|
||||
return this.cell64k;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition spatialCell2()
|
||||
{
|
||||
return this.spatialCell2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition spatialCell16()
|
||||
{
|
||||
return this.spatialCell16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition spatialCell128()
|
||||
{
|
||||
return this.spatialCell128;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition facade()
|
||||
{
|
||||
return this.facade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition crystalSeed()
|
||||
{
|
||||
return this.crystalSeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition encodedPattern()
|
||||
{
|
||||
return this.encodedPattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition colorApplicator()
|
||||
{
|
||||
return this.colorApplicator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition coloredPaintBall()
|
||||
{
|
||||
return this.coloredPaintBall;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition coloredLumenPaintBall()
|
||||
{
|
||||
return this.coloredLumenPaintBall;
|
||||
}
|
||||
|
||||
public IItemDefinition paintBall()
|
||||
{
|
||||
return this.paintBall;
|
||||
}
|
||||
|
||||
public IItemDefinition toolEraser()
|
||||
{
|
||||
return this.toolEraser;
|
||||
}
|
||||
|
||||
public IItemDefinition toolMeteoritePlacer()
|
||||
{
|
||||
return this.toolMeteoritePlacer;
|
||||
}
|
||||
|
||||
public IItemDefinition toolDebugCard()
|
||||
{
|
||||
return this.toolDebugCard;
|
||||
}
|
||||
|
||||
public IItemDefinition toolReplicatorCard()
|
||||
{
|
||||
return this.toolReplicatorCard;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,507 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.core.api.definitions;
|
||||
|
||||
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
import appeng.core.features.DamagedItemDefinition;
|
||||
import appeng.items.materials.ItemMultiMaterial;
|
||||
import appeng.items.materials.MaterialType;
|
||||
|
||||
|
||||
/**
|
||||
* Internal implementation for the API materials
|
||||
*/
|
||||
public final class ApiMaterials implements IMaterials
|
||||
{
|
||||
private final IItemDefinition cell2SpatialPart;
|
||||
private final IItemDefinition cell16SpatialPart;
|
||||
private final IItemDefinition cell128SpatialPart;
|
||||
|
||||
private final IItemDefinition silicon;
|
||||
private final IItemDefinition skyDust;
|
||||
|
||||
private final IItemDefinition calcProcessorPress;
|
||||
private final IItemDefinition engProcessorPress;
|
||||
private final IItemDefinition logicProcessorPress;
|
||||
|
||||
private final IItemDefinition calcProcessorPrint;
|
||||
private final IItemDefinition engProcessorPrint;
|
||||
private final IItemDefinition logicProcessorPrint;
|
||||
|
||||
private final IItemDefinition siliconPress;
|
||||
private final IItemDefinition siliconPrint;
|
||||
|
||||
private final IItemDefinition namePress;
|
||||
|
||||
private final IItemDefinition logicProcessor;
|
||||
private final IItemDefinition calcProcessor;
|
||||
private final IItemDefinition engProcessor;
|
||||
|
||||
private final IItemDefinition basicCard;
|
||||
private final IItemDefinition advCard;
|
||||
|
||||
private final IItemDefinition purifiedCertusQuartzCrystal;
|
||||
private final IItemDefinition purifiedNetherQuartzCrystal;
|
||||
private final IItemDefinition purifiedFluixCrystal;
|
||||
|
||||
private final IItemDefinition cell1kPart;
|
||||
private final IItemDefinition cell4kPart;
|
||||
private final IItemDefinition cell16kPart;
|
||||
private final IItemDefinition cell64kPart;
|
||||
private final IItemDefinition emptyStorageCell;
|
||||
|
||||
private final IItemDefinition cardRedstone;
|
||||
private final IItemDefinition cardSpeed;
|
||||
private final IItemDefinition cardCapacity;
|
||||
private final IItemDefinition cardFuzzy;
|
||||
private final IItemDefinition cardInverter;
|
||||
private final IItemDefinition cardCrafting;
|
||||
|
||||
private final IItemDefinition enderDust;
|
||||
private final IItemDefinition flour;
|
||||
private final IItemDefinition goldDust;
|
||||
private final IItemDefinition ironDust;
|
||||
private final IItemDefinition fluixDust;
|
||||
private final IItemDefinition certusQuartzDust;
|
||||
private final IItemDefinition netherQuartzDust;
|
||||
|
||||
private final IItemDefinition matterBall;
|
||||
private final IItemDefinition ironNugget;
|
||||
|
||||
private final IItemDefinition certusQuartzCrystal;
|
||||
private final IItemDefinition certusQuartzCrystalCharged;
|
||||
private final IItemDefinition fluixCrystal;
|
||||
private final IItemDefinition fluixPearl;
|
||||
|
||||
private final IItemDefinition woodenGear;
|
||||
|
||||
private final IItemDefinition wireless;
|
||||
private final IItemDefinition wirelessBooster;
|
||||
|
||||
private final IItemDefinition annihilationCore;
|
||||
private final IItemDefinition formationCore;
|
||||
|
||||
private final IItemDefinition singularity;
|
||||
private final IItemDefinition qESingularity;
|
||||
private final IItemDefinition blankPattern;
|
||||
|
||||
public ApiMaterials( DefinitionConstructor constructor )
|
||||
{
|
||||
final ItemMultiMaterial itemMultiMaterial = new ItemMultiMaterial();
|
||||
constructor.registerItemDefinition( itemMultiMaterial );
|
||||
|
||||
this.cell2SpatialPart = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Cell2SpatialPart ) );
|
||||
this.cell16SpatialPart = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Cell16SpatialPart ) );
|
||||
this.cell128SpatialPart = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Cell128SpatialPart ) );
|
||||
|
||||
this.silicon = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Silicon ) );
|
||||
this.skyDust = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.SkyDust ) );
|
||||
|
||||
this.calcProcessorPress = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CalcProcessorPress ) );
|
||||
this.engProcessorPress = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.EngProcessorPress ) );
|
||||
this.logicProcessorPress = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.LogicProcessorPress ) );
|
||||
|
||||
this.calcProcessorPrint = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CalcProcessorPrint ) );
|
||||
this.engProcessorPrint = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.EngProcessorPrint ) );
|
||||
this.logicProcessorPrint = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.LogicProcessorPrint ) );
|
||||
|
||||
this.siliconPress = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.SiliconPress ) );
|
||||
this.siliconPrint = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.SiliconPrint ) );
|
||||
|
||||
this.namePress = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.NamePress ) );
|
||||
|
||||
this.logicProcessor = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.LogicProcessor ) );
|
||||
this.calcProcessor = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CalcProcessor ) );
|
||||
this.engProcessor = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.EngProcessor ) );
|
||||
|
||||
this.basicCard = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.BasicCard ) );
|
||||
this.advCard = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.AdvCard ) );
|
||||
|
||||
this.purifiedCertusQuartzCrystal = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.PurifiedCertusQuartzCrystal ) );
|
||||
this.purifiedNetherQuartzCrystal = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.PurifiedNetherQuartzCrystal ) );
|
||||
this.purifiedFluixCrystal = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.PurifiedFluixCrystal ) );
|
||||
|
||||
this.cell1kPart = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Cell1kPart ) );
|
||||
this.cell4kPart = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Cell4kPart ) );
|
||||
this.cell16kPart = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Cell16kPart ) );
|
||||
this.cell64kPart = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Cell64kPart ) );
|
||||
this.emptyStorageCell = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.EmptyStorageCell ) );
|
||||
|
||||
this.cardRedstone = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CardRedstone ) );
|
||||
this.cardSpeed = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CardSpeed ) );
|
||||
this.cardCapacity = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CardCapacity ) );
|
||||
this.cardFuzzy = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CardFuzzy ) );
|
||||
this.cardInverter = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CardInverter ) );
|
||||
this.cardCrafting = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CardCrafting ) );
|
||||
|
||||
this.enderDust = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.EnderDust ) );
|
||||
this.flour = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Flour ) );
|
||||
this.goldDust = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.GoldDust ) );
|
||||
this.ironDust = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.IronDust ) );
|
||||
this.fluixDust = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.FluixDust ) );
|
||||
this.certusQuartzDust = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CertusQuartzDust ) );
|
||||
this.netherQuartzDust = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.NetherQuartzDust ) );
|
||||
|
||||
this.matterBall = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.MatterBall ) );
|
||||
this.ironNugget = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.IronNugget ) );
|
||||
|
||||
this.certusQuartzCrystal = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CertusQuartzCrystal ) );
|
||||
this.certusQuartzCrystalCharged = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.CertusQuartzCrystalCharged ) );
|
||||
this.fluixCrystal = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.FluixCrystal ) );
|
||||
this.fluixPearl = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.FluixPearl ) );
|
||||
|
||||
this.woodenGear = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.WoodenGear ) );
|
||||
|
||||
this.wireless = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Wireless ) );
|
||||
this.wirelessBooster = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.WirelessBooster ) );
|
||||
|
||||
this.annihilationCore = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.AnnihilationCore ) );
|
||||
this.formationCore = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.FormationCore ) );
|
||||
|
||||
this.singularity = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.Singularity ) );
|
||||
this.qESingularity = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.QESingularity ) );
|
||||
this.blankPattern = new DamagedItemDefinition( itemMultiMaterial.createMaterial( MaterialType.BlankPattern ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cell2SpatialPart()
|
||||
{
|
||||
return this.cell2SpatialPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cell16SpatialPart()
|
||||
{
|
||||
return this.cell16SpatialPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cell128SpatialPart()
|
||||
{
|
||||
return this.cell128SpatialPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition silicon()
|
||||
{
|
||||
return this.silicon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition skyDust()
|
||||
{
|
||||
return this.skyDust;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition calcProcessorPress()
|
||||
{
|
||||
return this.calcProcessorPress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition engProcessorPress()
|
||||
{
|
||||
return this.engProcessorPress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition logicProcessorPress()
|
||||
{
|
||||
return this.logicProcessorPress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition calcProcessorPrint()
|
||||
{
|
||||
return this.calcProcessorPrint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition engProcessorPrint()
|
||||
{
|
||||
return this.engProcessorPrint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition logicProcessorPrint()
|
||||
{
|
||||
return this.logicProcessorPrint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition siliconPress()
|
||||
{
|
||||
return this.siliconPress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition siliconPrint()
|
||||
{
|
||||
return this.siliconPrint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition namePress()
|
||||
{
|
||||
return this.namePress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition logicProcessor()
|
||||
{
|
||||
return this.logicProcessor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition calcProcessor()
|
||||
{
|
||||
return this.calcProcessor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition engProcessor()
|
||||
{
|
||||
return this.engProcessor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition basicCard()
|
||||
{
|
||||
return this.basicCard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition advCard()
|
||||
{
|
||||
return this.advCard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition purifiedCertusQuartzCrystal()
|
||||
{
|
||||
return this.purifiedCertusQuartzCrystal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition purifiedNetherQuartzCrystal()
|
||||
{
|
||||
return this.purifiedNetherQuartzCrystal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition purifiedFluixCrystal()
|
||||
{
|
||||
return this.purifiedFluixCrystal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cell1kPart()
|
||||
{
|
||||
return this.cell1kPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cell4kPart()
|
||||
{
|
||||
return this.cell4kPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cell16kPart()
|
||||
{
|
||||
return this.cell16kPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cell64kPart()
|
||||
{
|
||||
return this.cell64kPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition emptyStorageCell()
|
||||
{
|
||||
return this.emptyStorageCell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cardRedstone()
|
||||
{
|
||||
return this.cardRedstone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cardSpeed()
|
||||
{
|
||||
return this.cardSpeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cardCapacity()
|
||||
{
|
||||
return this.cardCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cardFuzzy()
|
||||
{
|
||||
return this.cardFuzzy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cardInverter()
|
||||
{
|
||||
return this.cardInverter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cardCrafting()
|
||||
{
|
||||
return this.cardCrafting;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition enderDust()
|
||||
{
|
||||
return this.enderDust;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition flour()
|
||||
{
|
||||
return this.flour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition goldDust()
|
||||
{
|
||||
return this.goldDust;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition ironDust()
|
||||
{
|
||||
return this.ironDust;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition fluixDust()
|
||||
{
|
||||
return this.fluixDust;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition certusQuartzDust()
|
||||
{
|
||||
return this.certusQuartzDust;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition netherQuartzDust()
|
||||
{
|
||||
return this.netherQuartzDust;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition matterBall()
|
||||
{
|
||||
return this.matterBall;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition ironNugget()
|
||||
{
|
||||
return this.ironNugget;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition certusQuartzCrystal()
|
||||
{
|
||||
return this.certusQuartzCrystal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition certusQuartzCrystalCharged()
|
||||
{
|
||||
return this.certusQuartzCrystalCharged;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition fluixCrystal()
|
||||
{
|
||||
return this.fluixCrystal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition fluixPearl()
|
||||
{
|
||||
return this.fluixPearl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition woodenGear()
|
||||
{
|
||||
return this.woodenGear;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition wireless()
|
||||
{
|
||||
return this.wireless;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition wirelessBooster()
|
||||
{
|
||||
return this.wirelessBooster;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition annihilationCore()
|
||||
{
|
||||
return this.annihilationCore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition formationCore()
|
||||
{
|
||||
return this.formationCore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition singularity()
|
||||
{
|
||||
return this.singularity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition qESingularity()
|
||||
{
|
||||
return this.qESingularity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition blankPattern()
|
||||
{
|
||||
return this.blankPattern;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,328 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.core.api.definitions;
|
||||
|
||||
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.IParts;
|
||||
import appeng.api.exceptions.MissingDefinition;
|
||||
import appeng.api.parts.IPartHelper;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
import appeng.core.features.DamagedItemDefinition;
|
||||
import appeng.items.parts.ItemMultiPart;
|
||||
import appeng.items.parts.PartType;
|
||||
|
||||
|
||||
/**
|
||||
* Internal implementation for the API parts
|
||||
*/
|
||||
public final class ApiParts implements IParts
|
||||
{
|
||||
private final AEColoredItemDefinition cableSmart;
|
||||
private final AEColoredItemDefinition cableCovered;
|
||||
private final AEColoredItemDefinition cableGlass;
|
||||
private final AEColoredItemDefinition cableDense;
|
||||
// private final AEColoredItemDefinition lumenCableSmart;
|
||||
// private final AEColoredItemDefinition lumenCableCovered;
|
||||
// private final AEColoredItemDefinition lumenCableGlass;
|
||||
// private final AEColoredItemDefinition lumenCableDense;
|
||||
private final IItemDefinition quartzFiber;
|
||||
private final IItemDefinition toggleBus;
|
||||
private final IItemDefinition invertedToggleBus;
|
||||
private final IItemDefinition storageBus;
|
||||
private final IItemDefinition importBus;
|
||||
private final IItemDefinition exportBus;
|
||||
private final IItemDefinition iface;
|
||||
private final IItemDefinition levelEmitter;
|
||||
private final IItemDefinition annihilationPlane;
|
||||
private final IItemDefinition formationPlane;
|
||||
private final IItemDefinition p2PTunnelME;
|
||||
private final IItemDefinition p2PTunnelRedstone;
|
||||
private final IItemDefinition p2PTunnelItems;
|
||||
private final IItemDefinition p2PTunnelLiquids;
|
||||
private final IItemDefinition p2PTunnelEU;
|
||||
private final IItemDefinition p2PTunnelRF;
|
||||
private final IItemDefinition p2PTunnelLight;
|
||||
private final IItemDefinition cableAnchor;
|
||||
private final IItemDefinition monitor;
|
||||
private final IItemDefinition semiDarkMonitor;
|
||||
private final IItemDefinition darkMonitor;
|
||||
private final IItemDefinition interfaceTerminal;
|
||||
private final IItemDefinition patternTerminal;
|
||||
private final IItemDefinition craftingTerminal;
|
||||
private final IItemDefinition terminal;
|
||||
private final IItemDefinition storageMonitor;
|
||||
private final IItemDefinition conversionMonitor;
|
||||
|
||||
public ApiParts( DefinitionConstructor constructor, IPartHelper partHelper )
|
||||
{
|
||||
final ItemMultiPart itemMultiPart = new ItemMultiPart( partHelper );
|
||||
constructor.registerItemDefinition( itemMultiPart );
|
||||
|
||||
this.cableSmart = constructor.constructColoredDefinition( itemMultiPart, PartType.CableSmart );
|
||||
this.cableCovered = constructor.constructColoredDefinition( itemMultiPart, PartType.CableCovered );
|
||||
this.cableGlass = constructor.constructColoredDefinition( itemMultiPart, PartType.CableGlass );
|
||||
this.cableDense = constructor.constructColoredDefinition( itemMultiPart, PartType.CableDense );
|
||||
// this.lumenCableSmart = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
||||
// this.lumenCableCovered = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
||||
// this.lumenCableGlass = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
||||
// this.lumenCableDense = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
|
||||
this.quartzFiber = new DamagedItemDefinition( itemMultiPart.createPart( PartType.QuartzFiber ) );
|
||||
this.toggleBus = new DamagedItemDefinition( itemMultiPart.createPart( PartType.ToggleBus ) );
|
||||
this.invertedToggleBus = new DamagedItemDefinition( itemMultiPart.createPart( PartType.InvertedToggleBus ) );
|
||||
this.storageBus = new DamagedItemDefinition( itemMultiPart.createPart( PartType.StorageBus ) );
|
||||
this.importBus = new DamagedItemDefinition( itemMultiPart.createPart( PartType.ImportBus ) );
|
||||
this.exportBus = new DamagedItemDefinition( itemMultiPart.createPart( PartType.ExportBus ) );
|
||||
this.iface = new DamagedItemDefinition( itemMultiPart.createPart( PartType.Interface ) );
|
||||
this.levelEmitter = new DamagedItemDefinition( itemMultiPart.createPart( PartType.LevelEmitter ) );
|
||||
this.annihilationPlane = new DamagedItemDefinition( itemMultiPart.createPart( PartType.AnnihilationPlane ) );
|
||||
this.formationPlane = new DamagedItemDefinition( itemMultiPart.createPart( PartType.FormationPlane ) );
|
||||
this.p2PTunnelME = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelME ) );
|
||||
this.p2PTunnelRedstone = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelRedstone ) );
|
||||
this.p2PTunnelItems = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelItems ) );
|
||||
this.p2PTunnelLiquids = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelLiquids ) );
|
||||
this.p2PTunnelEU = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelEU ) );
|
||||
this.p2PTunnelRF = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelRF ) );
|
||||
this.p2PTunnelLight = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelLight ) );
|
||||
this.cableAnchor = new DamagedItemDefinition( itemMultiPart.createPart( PartType.CableAnchor ) );
|
||||
this.monitor = new DamagedItemDefinition( itemMultiPart.createPart( PartType.Monitor ) );
|
||||
this.semiDarkMonitor = new DamagedItemDefinition( itemMultiPart.createPart( PartType.SemiDarkMonitor ) );
|
||||
this.darkMonitor = new DamagedItemDefinition( itemMultiPart.createPart( PartType.DarkMonitor ) );
|
||||
this.interfaceTerminal = new DamagedItemDefinition( itemMultiPart.createPart( PartType.InterfaceTerminal ) );
|
||||
this.patternTerminal = new DamagedItemDefinition( itemMultiPart.createPart( PartType.PatternTerminal ) );
|
||||
this.craftingTerminal = new DamagedItemDefinition( itemMultiPart.createPart( PartType.CraftingTerminal ) );
|
||||
this.terminal = new DamagedItemDefinition( itemMultiPart.createPart( PartType.Terminal ) );
|
||||
this.storageMonitor = new DamagedItemDefinition( itemMultiPart.createPart( PartType.StorageMonitor ) );
|
||||
this.conversionMonitor = new DamagedItemDefinition( itemMultiPart.createPart( PartType.ConversionMonitor ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition cableSmart()
|
||||
{
|
||||
return this.cableSmart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition cableCovered()
|
||||
{
|
||||
return this.cableCovered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition cableGlass()
|
||||
{
|
||||
return this.cableGlass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition cableDense()
|
||||
{
|
||||
return this.cableDense;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition lumenCableSmart()
|
||||
{
|
||||
throw new MissingDefinition( "Lumen Smart Cable has yet to be implemented." );
|
||||
// return this.lumenCableSmart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition lumenCableCovered()
|
||||
{
|
||||
throw new MissingDefinition( "Lumen Covered Cable has yet to be implemented." );
|
||||
// return this.lumenCableCovered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition lumenCableGlass()
|
||||
{
|
||||
throw new MissingDefinition( "Lumen Glass Cable has yet to be implemented." );
|
||||
// return this.lumenCableGlass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition lumenCableDense()
|
||||
{
|
||||
throw new MissingDefinition( "Lumen Dense Cable has yet to be implemented." );
|
||||
// return this.lumenCableDense;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition quartzFiber()
|
||||
{
|
||||
return this.quartzFiber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition toggleBus()
|
||||
{
|
||||
return this.toggleBus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition invertedToggleBus()
|
||||
{
|
||||
return this.invertedToggleBus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition storageBus()
|
||||
{
|
||||
return this.storageBus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition importBus()
|
||||
{
|
||||
return this.importBus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition exportBus()
|
||||
{
|
||||
return this.exportBus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition iface()
|
||||
{
|
||||
return this.iface;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition levelEmitter()
|
||||
{
|
||||
return this.levelEmitter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition annihilationPlane()
|
||||
{
|
||||
return this.annihilationPlane;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition formationPlane()
|
||||
{
|
||||
return this.formationPlane;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition p2PTunnelME()
|
||||
{
|
||||
return this.p2PTunnelME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition p2PTunnelRedstone()
|
||||
{
|
||||
return this.p2PTunnelRedstone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition p2PTunnelItems()
|
||||
{
|
||||
return this.p2PTunnelItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition p2PTunnelLiquids()
|
||||
{
|
||||
return this.p2PTunnelLiquids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition p2PTunnelEU()
|
||||
{
|
||||
return this.p2PTunnelEU;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition p2PTunnelRF()
|
||||
{
|
||||
return this.p2PTunnelRF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition p2PTunnelLight()
|
||||
{
|
||||
return this.p2PTunnelLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition cableAnchor()
|
||||
{
|
||||
return this.cableAnchor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition monitor()
|
||||
{
|
||||
return this.monitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition semiDarkMonitor()
|
||||
{
|
||||
return this.semiDarkMonitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition darkMonitor()
|
||||
{
|
||||
return this.darkMonitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition interfaceTerminal()
|
||||
{
|
||||
return this.interfaceTerminal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition patternTerminal()
|
||||
{
|
||||
return this.patternTerminal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition craftingTerminal()
|
||||
{
|
||||
return this.craftingTerminal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition terminal()
|
||||
{
|
||||
return this.terminal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition storageMonitor()
|
||||
{
|
||||
return this.storageMonitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition conversionMonitor()
|
||||
{
|
||||
return this.conversionMonitor;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package appeng.core.api.definitions;
|
||||
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
import appeng.core.FeatureHandlerRegistry;
|
||||
import appeng.core.FeatureRegistry;
|
||||
import appeng.core.features.ColoredItemDefinition;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
import appeng.core.features.ItemStackSrc;
|
||||
import appeng.items.parts.ItemMultiPart;
|
||||
import appeng.items.parts.PartType;
|
||||
|
||||
|
||||
public class DefinitionConstructor
|
||||
{
|
||||
private final FeatureRegistry features;
|
||||
private final FeatureHandlerRegistry handlers;
|
||||
|
||||
public DefinitionConstructor( FeatureRegistry features, FeatureHandlerRegistry handlers )
|
||||
{
|
||||
this.features = features;
|
||||
this.handlers = handlers;
|
||||
}
|
||||
|
||||
public final ITileDefinition registerTileDefinition( IAEFeature feature )
|
||||
{
|
||||
final IBlockDefinition definition = this.registerBlockDefinition( feature );
|
||||
|
||||
if ( definition instanceof ITileDefinition )
|
||||
{
|
||||
return ( (ITileDefinition) definition );
|
||||
}
|
||||
|
||||
throw new RuntimeException( "No tile definition" );
|
||||
}
|
||||
|
||||
public final IBlockDefinition registerBlockDefinition( IAEFeature feature )
|
||||
{
|
||||
final IItemDefinition definition = this.registerItemDefinition( feature );
|
||||
|
||||
if ( definition instanceof IBlockDefinition )
|
||||
{
|
||||
return ( (IBlockDefinition) definition );
|
||||
}
|
||||
|
||||
throw new RuntimeException( "No block definition" );
|
||||
}
|
||||
|
||||
public final IItemDefinition registerItemDefinition( IAEFeature feature )
|
||||
{
|
||||
final IFeatureHandler handler = feature.handler();
|
||||
|
||||
if ( handler.isFeatureAvailable() )
|
||||
{
|
||||
this.handlers.addFeatureHandler( handler );
|
||||
this.features.addFeature( feature );
|
||||
}
|
||||
|
||||
final IItemDefinition definition = handler.getDefinition();
|
||||
|
||||
return definition;
|
||||
}
|
||||
|
||||
public final AEColoredItemDefinition constructColoredDefinition( IItemDefinition target, int offset )
|
||||
{
|
||||
final ColoredItemDefinition definition = new ColoredItemDefinition();
|
||||
|
||||
for ( Item targetItem : target.maybeItem().asSet() )
|
||||
{
|
||||
for ( AEColor color : AEColor.VALID_COLORS )
|
||||
{
|
||||
definition.add( color, new ItemStackSrc( targetItem, offset + color.ordinal() ) );
|
||||
}
|
||||
}
|
||||
|
||||
return definition;
|
||||
}
|
||||
|
||||
public final AEColoredItemDefinition constructColoredDefinition( ItemMultiPart target, PartType type )
|
||||
{
|
||||
final ColoredItemDefinition definition = new ColoredItemDefinition();
|
||||
|
||||
for ( AEColor color : AEColor.values() )
|
||||
{
|
||||
ItemStackSrc multiPartSource = target.createPart( type, color );
|
||||
final Optional<ItemStackSrc> maybeSource = Optional.fromNullable( multiPartSource );
|
||||
|
||||
if ( maybeSource.isPresent() )
|
||||
{
|
||||
definition.add( color, multiPartSource );
|
||||
}
|
||||
}
|
||||
|
||||
return definition;
|
||||
}
|
||||
}
|
||||
@@ -21,11 +21,11 @@ package appeng.core.features;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.block.AEBaseItemBlock;
|
||||
import appeng.core.CommonHelper;
|
||||
@@ -33,21 +33,21 @@ import appeng.core.CreativeTab;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class AEBlockFeatureHandler implements IFeatureHandler
|
||||
public final class AEBlockFeatureHandler implements IFeatureHandler
|
||||
{
|
||||
private final EnumSet<AEFeature> features;
|
||||
private final AEBaseBlock featured;
|
||||
private final FeatureNameExtractor extractor;
|
||||
private final boolean enabled;
|
||||
private final AEBlockDefinition definition;
|
||||
private final TileDefinition definition;
|
||||
|
||||
public AEBlockFeatureHandler( EnumSet<AEFeature> features, AEBaseBlock featured, Optional<String> subName )
|
||||
{
|
||||
this.features = features;
|
||||
final ActivityState state = new FeaturedActiveChecker( features ).getActivityState();
|
||||
|
||||
this.featured = featured;
|
||||
this.extractor = new FeatureNameExtractor( featured.getClass(), subName );
|
||||
this.enabled = new FeaturedActiveChecker( features ).get();
|
||||
this.definition = new AEBlockDefinition( featured, this.enabled );
|
||||
this.enabled = state == ActivityState.Enabled;
|
||||
this.definition = new TileDefinition( featured, state );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,13 +57,7 @@ public class AEBlockFeatureHandler implements IFeatureHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<AEFeature> getFeatures()
|
||||
{
|
||||
return this.features;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEItemDefinition getDefinition()
|
||||
public ITileDefinition getDefinition()
|
||||
{
|
||||
return this.definition;
|
||||
}
|
||||
|
||||
@@ -1,266 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.block.AEBaseItemBlock;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.CreativeTab;
|
||||
import appeng.core.CreativeTabFacade;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class AEFeatureHandler implements AEItemDefinition
|
||||
{
|
||||
|
||||
private static final Pattern PATTERN_ITEM_MULTI_PART = Pattern.compile( "ItemMultiPart", Pattern.LITERAL );
|
||||
private static final Pattern PATTERN_ITEM_MULTI_MATERIAL = Pattern.compile( "ItemMultiMaterial", Pattern.LITERAL );
|
||||
private static final Pattern PATTERN_QUARTZ = Pattern.compile( "Quartz", Pattern.LITERAL );
|
||||
|
||||
private final EnumSet<AEFeature> features;
|
||||
|
||||
private final String subName;
|
||||
private final IAEFeature feature;
|
||||
|
||||
private Item ItemData;
|
||||
private Block BlockData;
|
||||
private BlockStairs stairData;
|
||||
|
||||
public AEFeatureHandler( EnumSet<AEFeature> features, IAEFeature feature, String subName )
|
||||
{
|
||||
this.features = features;
|
||||
this.feature = feature;
|
||||
this.subName = subName;
|
||||
}
|
||||
|
||||
public void register()
|
||||
{
|
||||
if ( this.isFeatureAvailable() )
|
||||
{
|
||||
if ( this.feature instanceof Item )
|
||||
{
|
||||
this.initItem( ( Item ) this.feature );
|
||||
}
|
||||
else if ( this.feature instanceof BlockStairs )
|
||||
{
|
||||
this.initStairBlock( ( BlockStairs ) this.feature );
|
||||
}
|
||||
else if ( this.feature instanceof Block )
|
||||
{
|
||||
this.initBlock( ( Block ) this.feature );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFeatureAvailable()
|
||||
{
|
||||
boolean enabled = true;
|
||||
|
||||
for ( AEFeature f : this.features )
|
||||
enabled = enabled && AEConfig.instance.isFeatureEnabled( f );
|
||||
|
||||
return enabled;
|
||||
}
|
||||
|
||||
private void initItem( Item i )
|
||||
{
|
||||
this.ItemData = i;
|
||||
|
||||
String name = getName( i.getClass(), this.subName );
|
||||
i.setTextureName( "appliedenergistics2:" + name );
|
||||
i.setUnlocalizedName( /* "item." */"appliedenergistics2." + name );
|
||||
|
||||
if ( i instanceof ItemFacade )
|
||||
i.setCreativeTab( CreativeTabFacade.instance );
|
||||
else
|
||||
i.setCreativeTab( CreativeTab.instance );
|
||||
|
||||
if ( name.equals( "ItemMaterial" ) )
|
||||
name = "ItemMultiMaterial";
|
||||
else if ( name.equals( "ItemPart" ) )
|
||||
name = "ItemMultiPart";
|
||||
|
||||
GameRegistry.registerItem( i, "item." + name );
|
||||
}
|
||||
|
||||
private void initStairBlock( BlockStairs stair )
|
||||
{
|
||||
this.stairData = stair;
|
||||
|
||||
String name = getName( stair.getClass(), this.subName );
|
||||
stair.setCreativeTab( CreativeTab.instance );
|
||||
stair.setBlockName( /* "tile." */"appliedenergistics2." + name );
|
||||
stair.setBlockTextureName( "appliedenergistics2:" + name );
|
||||
|
||||
GameRegistry.registerBlock( stair, "tile." + name );
|
||||
}
|
||||
|
||||
private void initBlock( Block b )
|
||||
{
|
||||
this.BlockData = b;
|
||||
|
||||
String name = getName( b.getClass(), this.subName );
|
||||
b.setCreativeTab( CreativeTab.instance );
|
||||
b.setBlockName( /* "tile." */"appliedenergistics2." + name );
|
||||
b.setBlockTextureName( "appliedenergistics2:" + name );
|
||||
|
||||
if ( Platform.isClient() && this.BlockData instanceof AEBaseBlock )
|
||||
{
|
||||
AEBaseBlock bb = ( AEBaseBlock ) b;
|
||||
CommonHelper.proxy.bindTileEntitySpecialRenderer( bb.getTileEntityClass(), bb );
|
||||
}
|
||||
|
||||
Class<? extends AEBaseItemBlock> itemBlock = AEBaseItemBlock.class;
|
||||
if ( b instanceof AEBaseBlock )
|
||||
itemBlock = ( ( AEBaseBlock ) b ).getItemBlockClass();
|
||||
|
||||
GameRegistry.registerBlock( b, itemBlock, "tile." + name );
|
||||
}
|
||||
|
||||
public static String getName( Class o, String subName )
|
||||
{
|
||||
String name = o.getSimpleName();
|
||||
|
||||
if ( name.startsWith( "ItemMultiPart" ) )
|
||||
name = PATTERN_ITEM_MULTI_PART.matcher( name ).replaceAll( "ItemPart" );
|
||||
else if ( name.startsWith( "ItemMultiMaterial" ) )
|
||||
name = PATTERN_ITEM_MULTI_MATERIAL.matcher( name ).replaceAll( "ItemMaterial" );
|
||||
|
||||
if ( subName != null )
|
||||
{
|
||||
// simple hack to allow me to do get nice names for these without
|
||||
// mode code outside of AEBaseItem
|
||||
if ( subName.startsWith( "P2PTunnel" ) )
|
||||
return "ItemPart.P2PTunnel";
|
||||
|
||||
if ( subName.equals( "CertusQuartzTools" ) )
|
||||
return PATTERN_QUARTZ.matcher( name ).replaceAll( "CertusQuartz" );
|
||||
if ( subName.equals( "NetherQuartzTools" ) )
|
||||
return PATTERN_QUARTZ.matcher( name ).replaceAll( "NetherQuartz" );
|
||||
|
||||
name += '.' + subName;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
public EnumSet<AEFeature> getFeatures()
|
||||
{
|
||||
return this.features.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block block()
|
||||
{
|
||||
return this.BlockData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item item()
|
||||
{
|
||||
if ( this.ItemData != null )
|
||||
{
|
||||
return this.ItemData;
|
||||
}
|
||||
else if ( this.BlockData != null )
|
||||
{
|
||||
return Item.getItemFromBlock( this.BlockData );
|
||||
}
|
||||
else if ( this.stairData != null )
|
||||
{
|
||||
return Item.getItemFromBlock( this.stairData );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> entity()
|
||||
{
|
||||
if ( this.BlockData instanceof AEBaseBlock )
|
||||
{
|
||||
AEBaseBlock bb = ( AEBaseBlock ) this.BlockData;
|
||||
return bb.getTileEntityClass();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack stack( int stackSize )
|
||||
{
|
||||
if ( this.isFeatureAvailable() )
|
||||
{
|
||||
ItemStack rv;
|
||||
|
||||
if ( this.ItemData != null )
|
||||
rv = new ItemStack( this.ItemData );
|
||||
else
|
||||
rv = new ItemStack( this.BlockData );
|
||||
|
||||
rv.stackSize = stackSize;
|
||||
return rv;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAsStack( ItemStack is )
|
||||
{
|
||||
return this.isFeatureAvailable() && Platform.isSameItemType( is, this.stack( 1 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* block at xyz in world is same if:
|
||||
*
|
||||
* - the feature is available
|
||||
* - the stored block data is not null
|
||||
* - and the stored block data is equal
|
||||
*
|
||||
* @param world world of block
|
||||
* @param x x pos of block
|
||||
* @param y y pos of block
|
||||
* @param z z pos of block
|
||||
*
|
||||
* @return true if feature is available and the blocks are equal
|
||||
*/
|
||||
@Override
|
||||
public boolean sameAsBlock( IBlockAccess world, int x, int y, int z )
|
||||
{
|
||||
return this.isFeatureAvailable() && this.BlockData != null && world.getBlock( x, y, z ) == this.BlockData;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
public enum ActivityState
|
||||
{
|
||||
Enabled, Disabled
|
||||
}
|
||||
@@ -21,62 +21,61 @@ package appeng.core.features;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import appeng.util.Platform;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
|
||||
|
||||
public class BlockDefinition implements AEItemDefinition
|
||||
public class BlockDefinition extends ItemDefinition implements IBlockDefinition
|
||||
{
|
||||
private final Block block;
|
||||
private final boolean enabled;
|
||||
|
||||
public BlockDefinition( Block block, boolean enabled )
|
||||
public BlockDefinition( Block block, ActivityState state )
|
||||
{
|
||||
super( Item.getItemFromBlock( block ), state );
|
||||
this.block = block;
|
||||
this.enabled = enabled;
|
||||
this.enabled = state == ActivityState.Enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block block()
|
||||
public Optional<Block> maybeBlock()
|
||||
{
|
||||
return this.block;
|
||||
return Optional.of( this.block );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item item()
|
||||
{
|
||||
return Item.getItemFromBlock( this.block );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> entity()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack stack( int stackSize )
|
||||
public Optional<ItemBlock> maybeItemBlock()
|
||||
{
|
||||
if ( this.enabled )
|
||||
{
|
||||
return new ItemStack( this.block );
|
||||
return Optional.of( new ItemBlock( this.block ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return Optional.absent();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAsStack( ItemStack comparableItem )
|
||||
public final Optional<ItemStack> maybeStack( int stackSize )
|
||||
{
|
||||
return this.enabled && Platform.isSameItemType( comparableItem, this.stack( 1 ) );
|
||||
if ( this.enabled )
|
||||
{
|
||||
return Optional.of( new ItemStack( this.block ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return Optional.absent();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAsBlock( IBlockAccess world, int x, int y, int z )
|
||||
public final boolean isSameAs( IBlockAccess world, int x, int y, int z )
|
||||
{
|
||||
return this.enabled && world.getBlock( x, y, z ) == this.block;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
|
||||
public class ColoredItemDefinition implements AEColoredItemDefinition
|
||||
public final class ColoredItemDefinition implements AEColoredItemDefinition
|
||||
{
|
||||
|
||||
final ItemStackSrc[] colors = new ItemStackSrc[17];
|
||||
|
||||
@@ -18,60 +18,53 @@
|
||||
|
||||
package appeng.core.features;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
public class DamagedItemDefinition implements AEItemDefinition
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
|
||||
|
||||
public final class DamagedItemDefinition implements IItemDefinition
|
||||
{
|
||||
private final IStackSrc source;
|
||||
|
||||
final IStackSrc src;
|
||||
|
||||
public DamagedItemDefinition(IStackSrc is) {
|
||||
this.src = is;
|
||||
public DamagedItemDefinition( IStackSrc source )
|
||||
{
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block block()
|
||||
public Optional<Item> maybeItem()
|
||||
{
|
||||
return null;
|
||||
final Item item = this.source.getItem();
|
||||
|
||||
return Optional.fromNullable( item );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item item()
|
||||
public Optional<ItemStack> maybeStack( int stackSize )
|
||||
{
|
||||
return this.src.getItem();
|
||||
final ItemStack stack = this.source.stack( stackSize );
|
||||
|
||||
return Optional.fromNullable( stack );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> entity()
|
||||
public boolean isSameAs( ItemStack comparableStack )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack stack(int stackSize)
|
||||
{
|
||||
return this.src.stack( stackSize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAsStack(ItemStack comparableItem)
|
||||
{
|
||||
if ( comparableItem == null )
|
||||
if ( comparableStack == null )
|
||||
return false;
|
||||
|
||||
return comparableItem.getItem() == this.src.getItem() && comparableItem.getItemDamage() == this.src.getDamage();
|
||||
return comparableStack.getItem() == this.source.getItem() && comparableStack.getItemDamage() == this.source.getDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAsBlock(IBlockAccess world, int x, int y, int z)
|
||||
public boolean isSameAs( IBlockAccess world, int x, int y, int z )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.definitions.IComparableDefinition;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public final class DefinitionConverter
|
||||
{
|
||||
public AEItemDefinition of( ITileDefinition definition )
|
||||
{
|
||||
return new AETile( definition );
|
||||
}
|
||||
|
||||
public AEItemDefinition of( IBlockDefinition definition )
|
||||
{
|
||||
return new AEBlock( definition );
|
||||
}
|
||||
|
||||
public AEItemDefinition of( IItemDefinition definition )
|
||||
{
|
||||
return new AEItem( definition );
|
||||
}
|
||||
|
||||
public AEItemDefinition of( IComparableDefinition definition )
|
||||
{
|
||||
return new AEComparable( definition );
|
||||
}
|
||||
|
||||
private static class AEComparable implements AEItemDefinition
|
||||
{
|
||||
private final IComparableDefinition definition;
|
||||
|
||||
public AEComparable( IComparableDefinition definition )
|
||||
{
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Block block()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Item item()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Class<? extends TileEntity> entity()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack stack( int stackSize )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAsStack( ItemStack comparableItem )
|
||||
{
|
||||
return this.definition.isSameAs( comparableItem );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAsBlock( IBlockAccess world, int x, int y, int z )
|
||||
{
|
||||
return this.definition.isSameAs( world, x, y, z );
|
||||
}
|
||||
}
|
||||
|
||||
private static class AEItem extends AEComparable
|
||||
{
|
||||
private final IItemDefinition definition;
|
||||
|
||||
public AEItem( IItemDefinition definition )
|
||||
{
|
||||
super( definition );
|
||||
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack stack( int stackSize )
|
||||
{
|
||||
return this.definition.maybeStack( stackSize ).orNull();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Item item()
|
||||
{
|
||||
return this.definition.maybeItem().orNull();
|
||||
}
|
||||
}
|
||||
|
||||
private static class AEBlock extends AEItem
|
||||
{
|
||||
private final IBlockDefinition definition;
|
||||
|
||||
public AEBlock( IBlockDefinition definition )
|
||||
{
|
||||
super( definition );
|
||||
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Block block()
|
||||
{
|
||||
return this.definition.maybeBlock().orNull();
|
||||
}
|
||||
}
|
||||
|
||||
private static class AETile extends AEBlock
|
||||
{
|
||||
private final ITileDefinition definition;
|
||||
|
||||
public AETile( ITileDefinition definition )
|
||||
{
|
||||
super( definition );
|
||||
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Class<? extends TileEntity> entity()
|
||||
{
|
||||
return this.definition.maybeEntity().orNull();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -19,30 +19,30 @@
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
import appeng.core.AEConfig;
|
||||
|
||||
|
||||
public class FeaturedActiveChecker
|
||||
{
|
||||
private final EnumSet<AEFeature> features;
|
||||
private final Set<AEFeature> features;
|
||||
|
||||
public FeaturedActiveChecker( EnumSet<AEFeature> features )
|
||||
public FeaturedActiveChecker( Set<AEFeature> features )
|
||||
{
|
||||
this.features = features;
|
||||
}
|
||||
|
||||
public boolean get()
|
||||
public ActivityState getActivityState()
|
||||
{
|
||||
for ( AEFeature f : this.features )
|
||||
{
|
||||
if ( !AEConfig.instance.isFeatureEnabled( f ) )
|
||||
{
|
||||
return false;
|
||||
return ActivityState.Disabled;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return ActivityState.Enabled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,18 +19,14 @@
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
|
||||
|
||||
public interface IFeatureHandler
|
||||
{
|
||||
boolean isFeatureAvailable();
|
||||
|
||||
EnumSet<AEFeature> getFeatures();
|
||||
|
||||
AEItemDefinition getDefinition();
|
||||
IItemDefinition getDefinition();
|
||||
|
||||
void register();
|
||||
}
|
||||
|
||||
@@ -19,66 +19,54 @@
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ItemDefinition implements AEItemDefinition
|
||||
public class ItemDefinition implements IItemDefinition
|
||||
{
|
||||
private final Item item;
|
||||
private final boolean enabled;
|
||||
|
||||
public ItemDefinition( Item item, boolean enabled )
|
||||
public ItemDefinition( Item item, ActivityState state )
|
||||
{
|
||||
this.item = item;
|
||||
this.enabled = enabled;
|
||||
this.enabled = state == ActivityState.Enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block block()
|
||||
public final Optional<Item> maybeItem()
|
||||
{
|
||||
return null;
|
||||
return Optional.of( this.item );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item item()
|
||||
{
|
||||
return this.item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> entity()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack stack( int stackSize )
|
||||
public Optional<ItemStack> maybeStack( int stackSize )
|
||||
{
|
||||
if ( this.enabled )
|
||||
{
|
||||
return new ItemStack( this.item );
|
||||
return Optional.of( new ItemStack( this.item ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
return Optional.absent();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAsStack( ItemStack comparableItem )
|
||||
public final boolean isSameAs( ItemStack comparableStack )
|
||||
{
|
||||
return this.enabled && Platform.isSameItemType( comparableItem, this.stack( 1 ) );
|
||||
return this.enabled && Platform.isSameItemType( comparableStack, this.maybeStack( 1 ).get() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAsBlock( IBlockAccess world, int x, int y, int z )
|
||||
public boolean isSameAs( IBlockAccess world, int x, int y, int z )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -21,21 +21,20 @@ package appeng.core.features;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.core.CreativeTab;
|
||||
import appeng.core.CreativeTabFacade;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
|
||||
|
||||
public class ItemFeatureHandler implements IFeatureHandler
|
||||
public final class ItemFeatureHandler implements IFeatureHandler
|
||||
{
|
||||
private final EnumSet<AEFeature> features;
|
||||
private final Item item;
|
||||
private final FeatureNameExtractor extractor;
|
||||
private final boolean enabled;
|
||||
@@ -43,11 +42,12 @@ public class ItemFeatureHandler implements IFeatureHandler
|
||||
|
||||
public ItemFeatureHandler( EnumSet<AEFeature> features, Item item, IAEFeature featured, Optional<String> subName )
|
||||
{
|
||||
this.features = features;
|
||||
final ActivityState state = new FeaturedActiveChecker( features ).getActivityState();
|
||||
|
||||
this.item = item;
|
||||
this.extractor = new FeatureNameExtractor( featured.getClass(), subName );
|
||||
this.enabled = new FeaturedActiveChecker( features ).get();
|
||||
this.definition = new ItemDefinition( item, this.enabled );
|
||||
this.enabled = state == ActivityState.Enabled;
|
||||
this.definition = new ItemDefinition( item, state );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,13 +57,7 @@ public class ItemFeatureHandler implements IFeatureHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<AEFeature> getFeatures()
|
||||
{
|
||||
return this.features;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEItemDefinition getDefinition()
|
||||
public IItemDefinition getDefinition()
|
||||
{
|
||||
return this.definition;
|
||||
}
|
||||
@@ -71,28 +65,31 @@ public class ItemFeatureHandler implements IFeatureHandler
|
||||
@Override
|
||||
public void register()
|
||||
{
|
||||
String name = this.extractor.get();
|
||||
this.item.setTextureName( "appliedenergistics2:" + name );
|
||||
this.item.setUnlocalizedName( /* "item." */"appliedenergistics2." + name );
|
||||
if ( this.enabled )
|
||||
{
|
||||
String name = this.extractor.get();
|
||||
this.item.setTextureName( "appliedenergistics2:" + name );
|
||||
this.item.setUnlocalizedName( /* "item." */"appliedenergistics2." + name );
|
||||
|
||||
if ( this.item instanceof ItemFacade )
|
||||
{
|
||||
this.item.setCreativeTab( CreativeTabFacade.instance );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.item.setCreativeTab( CreativeTab.instance );
|
||||
}
|
||||
if ( this.item instanceof ItemFacade )
|
||||
{
|
||||
this.item.setCreativeTab( CreativeTabFacade.instance );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.item.setCreativeTab( CreativeTab.instance );
|
||||
}
|
||||
|
||||
if ( name.equals( "ItemMaterial" ) )
|
||||
{
|
||||
name = "ItemMultiMaterial";
|
||||
}
|
||||
else if ( name.equals( "ItemPart" ) )
|
||||
{
|
||||
name = "ItemMultiPart";
|
||||
}
|
||||
if ( name.equals( "ItemMaterial" ) )
|
||||
{
|
||||
name = "ItemMultiMaterial";
|
||||
}
|
||||
else if ( name.equals( "ItemPart" ) )
|
||||
{
|
||||
name = "ItemMultiPart";
|
||||
}
|
||||
|
||||
GameRegistry.registerItem( this.item, "item." + name );
|
||||
GameRegistry.registerItem( this.item, "item." + name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,24 +18,27 @@
|
||||
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.items.materials.MaterialType;
|
||||
|
||||
|
||||
public class MaterialStackSrc implements IStackSrc
|
||||
{
|
||||
|
||||
final MaterialType src;
|
||||
|
||||
public MaterialStackSrc(MaterialType src) {
|
||||
public MaterialStackSrc( MaterialType src )
|
||||
{
|
||||
assert src != null;
|
||||
|
||||
this.src = src;
|
||||
if ( src == null )
|
||||
throw new RuntimeException( "Invalid Item Stack" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack stack(int stackSize)
|
||||
public ItemStack stack( int stackSize )
|
||||
{
|
||||
return this.src.stack( stackSize );
|
||||
}
|
||||
@@ -51,5 +54,4 @@ public class MaterialStackSrc implements IStackSrc
|
||||
{
|
||||
return this.src.damageValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import appeng.items.AEBaseItem;
|
||||
|
||||
|
||||
/**
|
||||
* This class is used to rename items to match the persistent stored items.
|
||||
*
|
||||
* This can be removed, when a new iteration of minecraft arrives or a new world is used.
|
||||
* Remember to differentiate the currently renamed items later on correctly.
|
||||
*
|
||||
* @deprecated only a temporary solution for a rename
|
||||
*/
|
||||
@Deprecated
|
||||
public final class NameResolver
|
||||
{
|
||||
private static final Pattern ITEM_MULTI_PART = Pattern.compile( "ItemMultiPart", Pattern.LITERAL );
|
||||
private static final Pattern ITEM_MULTI_MATERIAL = Pattern.compile( "ItemMultiMaterial", Pattern.LITERAL );
|
||||
private static final Pattern QUARTZ = Pattern.compile( "Quartz", Pattern.LITERAL );
|
||||
|
||||
private final Class<? extends AEBaseItem> withOriginalName;
|
||||
|
||||
public NameResolver( Class<? extends AEBaseItem> withOriginalName)
|
||||
{
|
||||
this.withOriginalName = withOriginalName;
|
||||
}
|
||||
|
||||
public String getName( String subName )
|
||||
{
|
||||
String name = this.withOriginalName.getSimpleName();
|
||||
|
||||
if ( name.startsWith( "ItemMultiPart" ) )
|
||||
name = ITEM_MULTI_PART.matcher( name ).replaceAll( "ItemPart" );
|
||||
else if ( name.startsWith( "ItemMultiMaterial" ) )
|
||||
name = ITEM_MULTI_MATERIAL.matcher( name ).replaceAll( "ItemMaterial" );
|
||||
|
||||
if ( subName != null )
|
||||
{
|
||||
// simple hack to allow me to do get nice names for these without
|
||||
// mode code outside of AEBaseItem
|
||||
if ( subName.startsWith( "P2PTunnel" ) )
|
||||
return "ItemPart.P2PTunnel";
|
||||
|
||||
if ( subName.equals( "CertusQuartzTools" ) )
|
||||
return QUARTZ.matcher( name ).replaceAll( "CertusQuartz" );
|
||||
if ( subName.equals( "NetherQuartzTools" ) )
|
||||
return QUARTZ.matcher( name ).replaceAll( "NetherQuartz" );
|
||||
|
||||
name += '.' + subName;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.core.features;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
|
||||
public class NullItemDefinition implements AEItemDefinition
|
||||
{
|
||||
|
||||
@Override
|
||||
public Block block()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item item()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> entity()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack stack(int stackSize)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAsStack(ItemStack comparableItem)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAsBlock(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,19 +21,18 @@ package appeng.core.features;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.block.BlockStairs;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.core.CreativeTab;
|
||||
|
||||
|
||||
public class StairBlockFeatureHandler implements IFeatureHandler
|
||||
{
|
||||
private final EnumSet<AEFeature> features;
|
||||
private final BlockStairs stairs;
|
||||
private final FeatureNameExtractor extractor;
|
||||
private final boolean enabled;
|
||||
@@ -41,39 +40,37 @@ public class StairBlockFeatureHandler implements IFeatureHandler
|
||||
|
||||
public StairBlockFeatureHandler( EnumSet<AEFeature> features, BlockStairs stairs, Optional<String> subName )
|
||||
{
|
||||
this.features = features;
|
||||
final ActivityState state = new FeaturedActiveChecker( features ).getActivityState();
|
||||
|
||||
this.stairs = stairs;
|
||||
this.extractor = new FeatureNameExtractor( stairs.getClass(), subName );
|
||||
this.enabled = new FeaturedActiveChecker( features ).get();
|
||||
this.definition = new BlockDefinition( stairs, this.enabled );
|
||||
this.enabled = state == ActivityState.Enabled;
|
||||
this.definition = new BlockDefinition( stairs, state );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFeatureAvailable()
|
||||
public final boolean isFeatureAvailable()
|
||||
{
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<AEFeature> getFeatures()
|
||||
{
|
||||
return this.features;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEItemDefinition getDefinition()
|
||||
public final IBlockDefinition getDefinition()
|
||||
{
|
||||
return this.definition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register()
|
||||
public final void register()
|
||||
{
|
||||
String name = this.extractor.get();
|
||||
this.stairs.setCreativeTab( CreativeTab.instance );
|
||||
this.stairs.setBlockName( "appliedenergistics2." + name );
|
||||
this.stairs.setBlockTextureName( "appliedenergistics2:" + name );
|
||||
if ( this.enabled )
|
||||
{
|
||||
String name = this.extractor.get();
|
||||
this.stairs.setCreativeTab( CreativeTab.instance );
|
||||
this.stairs.setBlockName( "appliedenergistics2." + name );
|
||||
this.stairs.setBlockTextureName( "appliedenergistics2:" + name );
|
||||
|
||||
GameRegistry.registerBlock( this.stairs, "tile." + name );
|
||||
GameRegistry.registerBlock( this.stairs, "tile." + name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-5
@@ -21,23 +21,28 @@ package appeng.core.features;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
import appeng.block.AEBaseBlock;
|
||||
|
||||
|
||||
public class AEBlockDefinition extends BlockDefinition
|
||||
public final class TileDefinition extends BlockDefinition implements ITileDefinition
|
||||
{
|
||||
private final AEBaseBlock block;
|
||||
|
||||
public AEBlockDefinition( AEBaseBlock block, boolean enabled )
|
||||
public TileDefinition( AEBaseBlock block, ActivityState state )
|
||||
{
|
||||
super( block, enabled );
|
||||
super( block, state );
|
||||
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> entity()
|
||||
public Optional<? extends Class<? extends TileEntity>> maybeEntity()
|
||||
{
|
||||
return this.block.getTileEntityClass();
|
||||
final Class<? extends TileEntity> entity = this.block.getTileEntityClass();
|
||||
|
||||
return Optional.of( entity );
|
||||
}
|
||||
}
|
||||
@@ -18,67 +18,92 @@
|
||||
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
public class WrappedDamageItemDefinition implements AEItemDefinition
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
|
||||
|
||||
public final class WrappedDamageItemDefinition implements ITileDefinition
|
||||
{
|
||||
private final ITileDefinition definition;
|
||||
private final int damage;
|
||||
|
||||
final AEItemDefinition baseItem;
|
||||
final int damage;
|
||||
|
||||
public WrappedDamageItemDefinition(AEItemDefinition def, int dmg) {
|
||||
this.baseItem = def;
|
||||
this.damage = dmg;
|
||||
public WrappedDamageItemDefinition( ITileDefinition definition, int damage )
|
||||
{
|
||||
this.definition = definition;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block block()
|
||||
public Optional<? extends Class<? extends TileEntity>> maybeEntity()
|
||||
{
|
||||
return this.baseItem.block();
|
||||
return this.definition.maybeEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item item()
|
||||
public Optional<Block> maybeBlock()
|
||||
{
|
||||
return this.baseItem.item();
|
||||
return this.definition.maybeBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> entity()
|
||||
public Optional<ItemBlock> maybeItemBlock()
|
||||
{
|
||||
return this.baseItem.entity();
|
||||
return this.definition.maybeItemBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack stack(int stackSize)
|
||||
public Optional<Item> maybeItem()
|
||||
{
|
||||
if ( this.baseItem == null )
|
||||
return null;
|
||||
|
||||
return new ItemStack( this.baseItem.block(), stackSize, this.damage );
|
||||
return this.definition.maybeItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAsStack(ItemStack comparableItem)
|
||||
public Optional<ItemStack> maybeStack( final int stackSize )
|
||||
{
|
||||
if ( comparableItem == null )
|
||||
return this.definition.maybeBlock().transform( new BlockTransformFunction( stackSize ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameAs( ItemStack comparableStack )
|
||||
{
|
||||
if ( comparableStack == null )
|
||||
return false;
|
||||
|
||||
return comparableItem.getItem() == this.baseItem.item() && comparableItem.getItemDamage() == this.damage;
|
||||
return this.definition.isSameAs( comparableStack ) && comparableStack.getItemDamage() == this.damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAsBlock(IBlockAccess world, int x, int y, int z)
|
||||
public boolean isSameAs( IBlockAccess world, int x, int y, int z )
|
||||
{
|
||||
if ( this.block() != null )
|
||||
return world.getBlock( x, y, z ) == this.block() && world.getBlockMetadata( x, y, z ) == this.damage;
|
||||
return false;
|
||||
return this.definition.isSameAs( world, x, y, z ) && world.getBlockMetadata( x, y, z ) == this.damage;
|
||||
}
|
||||
|
||||
private class BlockTransformFunction implements Function<Block, ItemStack>
|
||||
{
|
||||
private final int stackSize;
|
||||
|
||||
public BlockTransformFunction( int stackSize )
|
||||
{
|
||||
this.stackSize = stackSize;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack apply( Block input )
|
||||
{
|
||||
return new ItemStack( input, this.stackSize, WrappedDamageItemDefinition.this.damage );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,10 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.api.definitions.Parts;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.IParts;
|
||||
import appeng.api.features.IP2PTunnelRegistry;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.util.Platform;
|
||||
@@ -78,14 +81,16 @@ public class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
/**
|
||||
* attune based on lots of random item related stuff
|
||||
*/
|
||||
appeng.api.definitions.Blocks AEBlocks = AEApi.instance().blocks();
|
||||
Parts Parts = AEApi.instance().parts();
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IBlocks blocks = definitions.blocks();
|
||||
final IParts parts = definitions.parts();
|
||||
|
||||
this.addNewAttunement( blocks.iface(), TunnelType.ITEM );
|
||||
this.addNewAttunement( parts.iface(), TunnelType.ITEM );
|
||||
this.addNewAttunement( parts.storageBus(), TunnelType.ITEM );
|
||||
this.addNewAttunement( parts.importBus(), TunnelType.ITEM );
|
||||
this.addNewAttunement( parts.exportBus(), TunnelType.ITEM );
|
||||
|
||||
this.addNewAttunement( AEBlocks.blockInterface.stack( 1 ), TunnelType.ITEM );
|
||||
this.addNewAttunement( Parts.partInterface.stack( 1 ), TunnelType.ITEM );
|
||||
this.addNewAttunement( Parts.partStorageBus.stack( 1 ), TunnelType.ITEM );
|
||||
this.addNewAttunement( Parts.partImportBus.stack( 1 ), TunnelType.ITEM );
|
||||
this.addNewAttunement( Parts.partExportBus.stack( 1 ), TunnelType.ITEM );
|
||||
this.addNewAttunement( new ItemStack( Blocks.hopper ), TunnelType.ITEM );
|
||||
this.addNewAttunement( new ItemStack( Blocks.chest ), TunnelType.ITEM );
|
||||
this.addNewAttunement( new ItemStack( Blocks.trapped_chest ), TunnelType.ITEM );
|
||||
@@ -108,10 +113,18 @@ public class P2PTunnelRegistry implements IP2PTunnelRegistry
|
||||
|
||||
for (AEColor c : AEColor.values())
|
||||
{
|
||||
this.addNewAttunement( Parts.partCableGlass.stack( c, 1 ), TunnelType.ME );
|
||||
this.addNewAttunement( Parts.partCableCovered.stack( c, 1 ), TunnelType.ME );
|
||||
this.addNewAttunement( Parts.partCableSmart.stack( c, 1 ), TunnelType.ME );
|
||||
this.addNewAttunement( Parts.partCableDense.stack( c, 1 ), TunnelType.ME );
|
||||
this.addNewAttunement( parts.cableGlass().stack( c, 1 ), TunnelType.ME );
|
||||
this.addNewAttunement( parts.cableCovered().stack( c, 1 ), TunnelType.ME );
|
||||
this.addNewAttunement( parts.cableSmart().stack( c, 1 ), TunnelType.ME );
|
||||
this.addNewAttunement( parts.cableDense().stack( c, 1 ), TunnelType.ME );
|
||||
}
|
||||
}
|
||||
|
||||
private void addNewAttunement( IItemDefinition definition, TunnelType type )
|
||||
{
|
||||
for ( ItemStack definitionStack : definition.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
this.addNewAttunement( definitionStack, type );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,88 +24,87 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
|
||||
|
||||
public enum Achievements
|
||||
{
|
||||
// done
|
||||
Compass( -2, -4, AEApi.instance().definitions().blocks().skyCompass(), AchievementType.Craft ),
|
||||
|
||||
// done
|
||||
Compass( -2, -4, AEApi.instance().blocks().blockSkyCompass, AchievementType.Craft ),
|
||||
Presses( -2, -2, AEApi.instance().definitions().materials().logicProcessorPress(), AchievementType.Custom ),
|
||||
|
||||
// done
|
||||
Presses( -2, -2, AEApi.instance().materials().materialLogicProcessorPress, AchievementType.Custom ),
|
||||
SpatialIO( -4, -4, AEApi.instance().definitions().blocks().spatialIOPort(), AchievementType.Craft ),
|
||||
|
||||
// done
|
||||
SpatialIO( -4, -4, AEApi.instance().blocks().blockSpatialIOPort, AchievementType.Craft ),
|
||||
SpatialIOExplorer( -4, -2, AEApi.instance().definitions().items().spatialCell128(), AchievementType.Custom ),
|
||||
|
||||
// done
|
||||
SpatialIOExplorer( -4, -2, AEApi.instance().items().itemSpatialCell128, AchievementType.Custom ),
|
||||
StorageCell( -6, -4, AEApi.instance().definitions().items().cell64k(), AchievementType.CraftItem ),
|
||||
|
||||
// done
|
||||
StorageCell( -6, -4, AEApi.instance().items().itemCell64k, AchievementType.CraftItem ),
|
||||
IOPort( -6, -2, AEApi.instance().definitions().blocks().iOPort(), AchievementType.Craft ),
|
||||
|
||||
// done
|
||||
IOPort( -6, -2, AEApi.instance().blocks().blockIOPort, AchievementType.Craft ),
|
||||
CraftingTerminal( -8, -4, AEApi.instance().definitions().parts().craftingTerminal(), AchievementType.Craft ),
|
||||
|
||||
// done
|
||||
CraftingTerminal( -8, -4, AEApi.instance().parts().partCraftingTerminal, AchievementType.Craft ),
|
||||
PatternTerminal( -8, -2, AEApi.instance().definitions().parts().patternTerminal(), AchievementType.Craft ),
|
||||
|
||||
// done
|
||||
PatternTerminal( -8, -2, AEApi.instance().parts().partPatternTerminal, AchievementType.Craft ),
|
||||
ChargedQuartz( 0, -4, AEApi.instance().definitions().materials().certusQuartzCrystalCharged(), AchievementType.Pickup ),
|
||||
|
||||
// done
|
||||
ChargedQuartz( 0, -4, AEApi.instance().materials().materialCertusQuartzCrystalCharged, AchievementType.Pickup ),
|
||||
Fluix( 0, -2, AEApi.instance().definitions().materials().fluixCrystal(), AchievementType.Pickup ),
|
||||
|
||||
// done
|
||||
Fluix( 0, -2, AEApi.instance().materials().materialFluixCrystal, AchievementType.Pickup ),
|
||||
Charger( 0, 0, AEApi.instance().definitions().blocks().charger(), AchievementType.Craft ),
|
||||
|
||||
// done
|
||||
Charger( 0, 0, AEApi.instance().blocks().blockCharger, AchievementType.Craft ),
|
||||
CrystalGrowthAccelerator( -2, 0, AEApi.instance().definitions().blocks().quartzGrowthAccelerator(), AchievementType.Craft ),
|
||||
|
||||
// done
|
||||
CrystalGrowthAccelerator( -2, 0, AEApi.instance().blocks().blockQuartzGrowthAccelerator, AchievementType.Craft ),
|
||||
GlassCable( 2, 0, AEApi.instance().definitions().parts().cableGlass(), AchievementType.Craft ),
|
||||
|
||||
// done
|
||||
GlassCable( 2, 0, AEApi.instance().parts().partCableGlass, AchievementType.Craft ),
|
||||
Networking1( 4, -6, AEApi.instance().definitions().parts().cableCovered(), AchievementType.Custom ),
|
||||
|
||||
// done
|
||||
Networking1( 4, -6, AEApi.instance().parts().partCableCovered, AchievementType.Custom ),
|
||||
Controller( 4, -4, AEApi.instance().definitions().blocks().controller(), AchievementType.Craft ),
|
||||
|
||||
// done
|
||||
Controller( 4, -4, AEApi.instance().blocks().blockController, AchievementType.Craft ),
|
||||
Networking2( 4, 0, AEApi.instance().definitions().parts().cableSmart(), AchievementType.Custom ),
|
||||
|
||||
// done
|
||||
Networking2( 4, 0, AEApi.instance().parts().partCableSmart, AchievementType.Custom ),
|
||||
Networking3( 4, 2, AEApi.instance().definitions().parts().cableDense(), AchievementType.Custom ),
|
||||
|
||||
// done
|
||||
Networking3( 4, 2, AEApi.instance().parts().partCableDense, AchievementType.Custom ),
|
||||
P2P( 2, -2, AEApi.instance().definitions().parts().p2PTunnelME(), AchievementType.Craft ),
|
||||
|
||||
// done
|
||||
P2P( 2, -2, AEApi.instance().parts().partP2PTunnelME, AchievementType.Craft ),
|
||||
Recursive( 6, -2, AEApi.instance().definitions().blocks().iface(), AchievementType.Craft ),
|
||||
|
||||
// done
|
||||
Recursive( 6, -2, AEApi.instance().blocks().blockInterface, AchievementType.Craft ),
|
||||
CraftingCPU( 6, 0, AEApi.instance().definitions().blocks().craftingStorage64k(), AchievementType.CraftItem ),
|
||||
|
||||
// done
|
||||
CraftingCPU( 6, 0, AEApi.instance().blocks().blockCraftingStorage64k, AchievementType.CraftItem ),
|
||||
Facade( 6, 2, AEApi.instance().definitions().items().facade(), AchievementType.CraftItem ),
|
||||
|
||||
// done
|
||||
Facade( 6, 2, AEApi.instance().items().itemFacade, AchievementType.CraftItem ),
|
||||
NetworkTool( 8, 0, AEApi.instance().definitions().items().networkTool(), AchievementType.Craft ),
|
||||
|
||||
// done
|
||||
NetworkTool( 8, 0, AEApi.instance().items().itemNetworkTool, AchievementType.Craft ),
|
||||
PortableCell( 8, 2, AEApi.instance().definitions().items().portableCell(), AchievementType.Craft ),
|
||||
|
||||
// done
|
||||
PortableCell( 8, 2, AEApi.instance().items().itemPortableCell, AchievementType.Craft ),
|
||||
StorageBus( 10, 0, AEApi.instance().definitions().parts().storageBus(), AchievementType.Craft ),
|
||||
|
||||
// done
|
||||
StorageBus( 10, 0, AEApi.instance().parts().partStorageBus, AchievementType.Craft ),
|
||||
|
||||
// done
|
||||
QNB( 10, 2, AEApi.instance().blocks().blockQuantumLink, AchievementType.Craft );
|
||||
QNB( 10, 2, AEApi.instance().definitions().blocks().quantumLink(), AchievementType.Craft );
|
||||
|
||||
public final ItemStack stack;
|
||||
public final AchievementType type;
|
||||
@@ -139,9 +138,9 @@ public enum Achievements
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
Achievements( int x, int y, AEItemDefinition which, AchievementType type )
|
||||
Achievements( int x, int y, IItemDefinition which, AchievementType type )
|
||||
{
|
||||
this.stack = (which != null) ? which.stack( 1 ) : null;
|
||||
this.stack = which.maybeStack( 1 ).orNull();
|
||||
this.type = type;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
@@ -20,6 +20,7 @@ package appeng.core.sync;
|
||||
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@@ -32,9 +33,12 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.definitions.Materials;
|
||||
import appeng.api.definitions.IComparableDefinition;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
import appeng.api.exceptions.AppEngException;
|
||||
import appeng.api.features.IWirelessTermHandler;
|
||||
import appeng.api.implementations.IUpgradeableHost;
|
||||
@@ -273,12 +277,8 @@ public enum GuiBridge implements IGuiHandler
|
||||
{
|
||||
ItemStack is = ((Slot) so).getStack();
|
||||
|
||||
Materials m = AEApi.instance().materials();
|
||||
if ( m.materialLogicProcessorPress.sameAsStack( is ) || m.materialEngProcessorPress.sameAsStack( is )
|
||||
|| m.materialCalcProcessorPress.sameAsStack( is ) || m.materialSiliconPress.sameAsStack( is ) )
|
||||
{
|
||||
Achievements.Presses.addToPlayer( inventory.player );
|
||||
}
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
this.addPressAchievementToPlayer( is, materials, inventory.player );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -291,6 +291,26 @@ public enum GuiBridge implements IGuiHandler
|
||||
}
|
||||
}
|
||||
|
||||
private void addPressAchievementToPlayer( ItemStack newItem, IMaterials possibleMaterials, EntityPlayer player )
|
||||
{
|
||||
final IComparableDefinition logic = possibleMaterials.logicProcessorPress();
|
||||
final IComparableDefinition eng = possibleMaterials.engProcessorPress();
|
||||
final IComparableDefinition calc = possibleMaterials.calcProcessorPress();
|
||||
final IComparableDefinition silicon = possibleMaterials.siliconPress();
|
||||
|
||||
final List<IComparableDefinition> presses = Lists.newArrayList( logic, eng, calc, silicon );
|
||||
|
||||
for ( IComparableDefinition press : presses )
|
||||
{
|
||||
if ( press.isSameAs( newItem ) )
|
||||
{
|
||||
Achievements.Presses.addToPlayer( player );
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Object ConstructGui(InventoryPlayer inventory, ForgeDirection side, Object tE)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -25,6 +25,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IComparableDefinition;
|
||||
import appeng.api.definitions.IItems;
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
import appeng.api.implementations.items.MemoryCardMessages;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
@@ -58,21 +60,30 @@ public class PacketClick extends AppEngPacket
|
||||
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player)
|
||||
{
|
||||
ItemStack is = player.inventory.getCurrentItem();
|
||||
if ( is != null && is.getItem() instanceof ToolNetworkTool )
|
||||
final IItems items = AEApi.instance().definitions().items();
|
||||
final IComparableDefinition maybeMemoryCard = items.memoryCard();
|
||||
final IComparableDefinition maybeColorApplicator = items.colorApplicator();
|
||||
|
||||
if ( is != null )
|
||||
{
|
||||
ToolNetworkTool tnt = (ToolNetworkTool) is.getItem();
|
||||
tnt.serverSideToolLogic( is, player, player.worldObj, this.x, this.y, this.z, this.side, this.hitX, this.hitY, this.hitZ );
|
||||
}
|
||||
else if ( is != null && AEApi.instance().items().itemMemoryCard.sameAsStack( is ) )
|
||||
{
|
||||
IMemoryCard mem = (IMemoryCard) is.getItem();
|
||||
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
|
||||
is.setTagCompound( null );
|
||||
}
|
||||
else if ( is != null && AEApi.instance().items().itemColorApplicator.sameAsStack( is ) )
|
||||
{
|
||||
ToolColorApplicator mem = (ToolColorApplicator) is.getItem();
|
||||
mem.cycleColors( is, mem.getColor( is ), 1 );
|
||||
if ( is.getItem() instanceof ToolNetworkTool )
|
||||
{
|
||||
ToolNetworkTool tnt = (ToolNetworkTool) is.getItem();
|
||||
tnt.serverSideToolLogic( is, player, player.worldObj, this.x, this.y, this.z, this.side, this.hitX, this.hitY, this.hitZ );
|
||||
}
|
||||
|
||||
else if ( maybeMemoryCard.isSameAs( is ) )
|
||||
{
|
||||
IMemoryCard mem = (IMemoryCard) is.getItem();
|
||||
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
|
||||
is.setTagCompound( null );
|
||||
}
|
||||
|
||||
else if ( maybeColorApplicator.isSameAs( is ) )
|
||||
{
|
||||
ToolColorApplicator mem = (ToolColorApplicator) is.getItem();
|
||||
mem.cycleColors( is, mem.getColor( is ), 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.client.gui.implementations.GuiCraftingCPU;
|
||||
@@ -183,11 +184,11 @@ public class PacketValueConfig extends AppEngPacket
|
||||
{
|
||||
IConfigManager cm = ((IConfigurableObject) c).getConfigManager();
|
||||
|
||||
for (Enum e : cm.getSettings())
|
||||
for (Settings e : cm.getSettings())
|
||||
{
|
||||
if ( e.name().equals( this.Name ) )
|
||||
{
|
||||
Enum def = cm.getSetting( e );
|
||||
Enum<?> def = cm.getSetting( e );
|
||||
|
||||
try
|
||||
{
|
||||
@@ -228,11 +229,11 @@ public class PacketValueConfig extends AppEngPacket
|
||||
{
|
||||
IConfigManager cm = ((IConfigurableObject) c).getConfigManager();
|
||||
|
||||
for (Enum e : cm.getSettings())
|
||||
for (Settings e : cm.getSettings())
|
||||
{
|
||||
if ( e.name().equals( this.Name ) )
|
||||
{
|
||||
Enum def = cm.getSetting( e );
|
||||
Enum<?> def = cm.getSetting( e );
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user