Remove deprecated item definition

This commit is contained in:
thatsIch 2015-06-17 23:30:23 +02:00
parent 6d510d3912
commit 0cd25428e6
5 changed files with 9 additions and 564 deletions

View File

@ -24,11 +24,7 @@
package appeng.api;
import appeng.api.definitions.Blocks;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.Items;
import appeng.api.definitions.Materials;
import appeng.api.definitions.Parts;
import appeng.api.exceptions.FailedConnection;
import appeng.api.features.IRegistryContainer;
import appeng.api.networking.IGridBlock;
@ -40,7 +36,6 @@ import appeng.api.storage.IStorageHelper;
public interface IAppEngApi
{
/**
* @return Registry Container for the numerous registries in AE2.
*/
@ -56,38 +51,6 @@ public interface IAppEngApi
*/
IPartHelper partHelper();
/**
* @return an accessible list of all of AE's Items
*
* @deprecated use {@link appeng.api.definitions.IDefinitions#items()}
*/
@Deprecated
Items items();
/**
* @return an accessible list of all of AE's materials; materials are items
*
* @deprecated use {@link appeng.api.definitions.IDefinitions#materials()}
*/
@Deprecated
Materials materials();
/**
* @return an accessible list of all of AE's blocks
*
* @deprecated use {@link appeng.api.definitions.IDefinitions#blocks()}
*/
@Deprecated
Blocks blocks();
/**
* @return an accessible list of all of AE's parts, parts are items
*
* @deprecated use {@link appeng.api.definitions.IDefinitions#parts()}
*/
@Deprecated
Parts parts();
/**
* @return an accessible list of all AE definitions
*/

View File

@ -27,12 +27,12 @@ package appeng.api.config;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.item.ItemStack;
import appeng.api.definitions.IItemDefinition;
import appeng.api.util.AEItemDefinition;
import com.google.common.base.Optional;
import net.minecraft.item.ItemStack;
import appeng.api.definitions.IItemDefinition;
public enum Upgrades
{
@ -46,17 +46,8 @@ public enum Upgrades
*/
FUZZY( 1 ), SPEED( 1 ), INVERTER( 1 );
/**
* @deprecated use {@link Upgrades#getTier()}
*/
@Deprecated
public final int tier;
/**
* @deprecated use {@link Upgrades#getSupported()}
*/
@Deprecated
private final Map<ItemStack, Integer> supportedMax = new HashMap<ItemStack, Integer>();
private final int tier;
private final Map<ItemStack, Integer> supportedMax = new HashMap<>();
Upgrades( int tier )
{
@ -74,7 +65,7 @@ public enum Upgrades
/**
* Registers a specific amount of this upgrade into a specific machine
*
* @param item machine in which this upgrade can be installed
* @param item machine in which this upgrade can be installed
* @param maxSupported amount how many upgrades can be installed
*/
public void registerItem( IItemDefinition item, int maxSupported )
@ -89,7 +80,7 @@ public enum Upgrades
/**
* Registers a specific amount of this upgrade into a specific machine
*
* @param stack machine in which this upgrade can be installed
* @param stack machine in which this upgrade can be installed
* @param maxSupported amount how many upgrades can be installed
*/
public void registerItem( ItemStack stack, int maxSupported )
@ -100,28 +91,6 @@ public enum Upgrades
}
}
/**
* Registers a specific amount of this upgrade into a specific machine
*
* @param item machine in which this upgrade can be installed
* @param maxSupported amount how many upgrades can be installed
*
* @deprecated use {@link Upgrades#registerItem(IItemDefinition, int)}
*/
@Deprecated
public void registerItem( AEItemDefinition item, int maxSupported )
{
if( item != null )
{
final ItemStack stack = item.stack( 1 );
if( stack != null )
{
this.registerItem( stack, maxSupported );
}
}
}
public int getTier()
{
return this.tier;

View File

@ -20,10 +20,6 @@ package appeng.core;
import appeng.api.IAppEngApi;
import appeng.api.definitions.Blocks;
import appeng.api.definitions.Items;
import appeng.api.definitions.Materials;
import appeng.api.definitions.Parts;
import appeng.api.exceptions.FailedConnection;
import appeng.api.features.IRegistryContainer;
import appeng.api.networking.IGridBlock;
@ -48,18 +44,10 @@ public final class Api implements IAppEngApi
// private MovableTileRegistry MovableRegistry = new MovableTileRegistry();
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;
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();
@ -84,30 +72,6 @@ public final class Api implements IAppEngApi
return this.partHelper;
}
@Override
public Items items()
{
return this.items;
}
@Override
public Materials materials()
{
return this.materials;
}
@Override
public Blocks blocks()
{
return this.blocks;
}
@Override
public Parts parts()
{
return this.parts;
}
@Override
public ApiDefinitions definitions()
{

View File

@ -34,18 +34,15 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.RecipeSorter.Category;
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;
import appeng.api.features.IRecipeHandlerRegistry;
import appeng.api.features.IRegistryContainer;
import appeng.api.features.IWirelessTermHandler;
@ -62,7 +59,6 @@ import appeng.api.networking.ticking.ITickManager;
import appeng.api.parts.IPartHelper;
import appeng.block.networking.BlockCableBus;
import appeng.core.features.AEFeature;
import appeng.core.features.DefinitionConverter;
import appeng.core.features.IAEFeature;
import appeng.core.features.IFeatureHandler;
import appeng.core.features.registries.P2PTunnelRegistry;
@ -118,12 +114,10 @@ public final class Registration
public static final Registration INSTANCE = new Registration();
private final RecipeHandler recipeHandler;
private final DefinitionConverter converter;
public BiomeGenBase storageBiome;
private Registration()
{
this.converter = new DefinitionConverter();
this.recipeHandler = new RecipeHandler();
}
@ -143,21 +137,6 @@ public final class Registration
final ApiDefinitions definitions = api.definitions();
final IBlocks apiBlocks = definitions.blocks();
final IItems apiItems = definitions.items();
final IMaterials apiMaterials = definitions.materials();
final IParts apiParts = definitions.parts();
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() )
{
@ -238,269 +217,6 @@ public final class Registration
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();

View File

@ -1,167 +0,0 @@
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.util.BlockPos;
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, BlockPos pos )
{
return false;
}
}
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();
}
@Override
public boolean sameAsBlock( IBlockAccess world, BlockPos pos )
{
return this.definition.isSameAs( world, pos );
}
}
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();
}
}
}