/* * 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 . */ package appeng.items.materials; import java.util.EnumSet; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.registry.EntityRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import appeng.core.AppEng; import appeng.core.features.AEFeature; import appeng.core.features.MaterialStackSrc; import appeng.entity.EntityChargedQuartz; import appeng.entity.EntityIds; import appeng.entity.EntitySingularity; public enum MaterialType { InvalidType( -1, AEFeature.Core ), CertusQuartzCrystal( 0, AEFeature.Core, "crystalCertusQuartz" ), CertusQuartzCrystalCharged( 1, AEFeature.Core, EntityChargedQuartz.class ), CertusQuartzDust( 2, AEFeature.Core, "dustCertusQuartz" ), NetherQuartzDust( 3, AEFeature.Core, "dustNetherQuartz" ), Flour( 4, AEFeature.Flour, "dustWheat" ), GoldDust( 51, AEFeature.Core, "dustGold" ), IronDust( 49, AEFeature.Core, "dustIron" ), IronNugget( 50, AEFeature.Core, "nuggetIron" ), Silicon( 5, AEFeature.Core, "itemSilicon" ), MatterBall( 6 ), FluixCrystal( 7, AEFeature.Core, "crystalFluix" ), FluixDust( 8, AEFeature.Core, "dustFluix" ), FluixPearl( 9, AEFeature.Core, "pearlFluix" ), PurifiedCertusQuartzCrystal( 10 ), PurifiedNetherQuartzCrystal( 11 ), PurifiedFluixCrystal( 12 ), CalcProcessorPress( 13 ), EngProcessorPress( 14 ), LogicProcessorPress( 15 ), CalcProcessorPrint( 16 ), EngProcessorPrint( 17 ), LogicProcessorPrint( 18 ), SiliconPress( 19 ), SiliconPrint( 20 ), NamePress( 21 ), LogicProcessor( 22 ), CalcProcessor( 23 ), EngProcessor( 24 ), // Basic Cards BasicCard( 25 ), CardRedstone( 26 ), CardCapacity( 27 ), // Adv Cards AdvCard( 28 ), CardFuzzy( 29 ), CardSpeed( 30 ), CardInverter( 31 ), Cell2SpatialPart( 32, AEFeature.SpatialIO ), Cell16SpatialPart( 33, AEFeature.SpatialIO ), Cell128SpatialPart( 34, AEFeature.SpatialIO ), Cell1kPart( 35, AEFeature.StorageCells ), Cell4kPart( 36, AEFeature.StorageCells ), Cell16kPart( 37, AEFeature.StorageCells ), Cell64kPart( 38, AEFeature.StorageCells ), EmptyStorageCell( 39, AEFeature.StorageCells ), WoodenGear( 40, AEFeature.GrindStone, "gearWood" ), Wireless( 41, AEFeature.WirelessAccessTerminal ), WirelessBooster( 42, AEFeature.WirelessAccessTerminal ), FormationCore( 43 ), AnnihilationCore( 44 ), SkyDust( 45, AEFeature.Core ), EnderDust( 46, AEFeature.QuantumNetworkBridge, "dustEnder,dustEnderPearl", EntitySingularity.class ), Singularity( 47, AEFeature.QuantumNetworkBridge, EntitySingularity.class ), QESingularity( 48, AEFeature.QuantumNetworkBridge, EntitySingularity.class ), BlankPattern( 52 ), CardCrafting( 53 ); private final EnumSet features; // TextureAtlasSprite for the material. @SideOnly( Side.CLIENT ) public TextureAtlasSprite IIcon; public Item itemInstance; public int damageValue; // stack! public MaterialStackSrc stackSrc; private String oreName; private Class droppedEntity; private boolean isRegistered = false; MaterialType( final int metaValue ) { this.damageValue = metaValue; this.features = EnumSet.of( AEFeature.Core ); } MaterialType( final int metaValue, final AEFeature part ) { this.damageValue = metaValue; this.features = EnumSet.of( part ); } MaterialType( final int metaValue, final AEFeature part, final Class c ) { this.features = EnumSet.of( part ); this.damageValue = metaValue; this.droppedEntity = c; EntityRegistry.registerModEntity( this.droppedEntity, this.droppedEntity.getSimpleName(), EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4, true ); } MaterialType( final int metaValue, final AEFeature part, final String oreDictionary, final Class c ) { this.features = EnumSet.of( part ); this.damageValue = metaValue; this.oreName = oreDictionary; this.droppedEntity = c; EntityRegistry.registerModEntity( this.droppedEntity, this.droppedEntity.getSimpleName(), EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4, true ); } MaterialType( final int metaValue, final AEFeature part, final String oreDictionary ) { this.features = EnumSet.of( part ); this.damageValue = metaValue; this.oreName = oreDictionary; } public ItemStack stack( final int size ) { return new ItemStack( this.itemInstance, size, this.damageValue ); } public EnumSet getFeature() { return this.features; } public String getOreName() { return this.oreName; } public boolean hasCustomEntity() { return this.droppedEntity != null; } public Class getCustomEntityClass() { return this.droppedEntity; } public boolean isRegistered() { return this.isRegistered; } public void markReady() { this.isRegistered = true; } }