Remove Meta values from Config.
Fixed a number of rendering gltiches with Smart/Covered Cables
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
package appeng.migration;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IItemMigrate
|
||||
{
|
||||
|
||||
void modifyItemStack(ItemStack is);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
package appeng.migration;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.implementations.items.IItemGroup;
|
||||
import appeng.api.implementations.items.IStorageComponent;
|
||||
import appeng.api.implementations.items.IUpgradeModule;
|
||||
import appeng.client.texture.MissingIcon;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.AEFeatureHandler;
|
||||
import appeng.core.features.ItemStackSrc;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.items.materials.ItemMultiMaterial;
|
||||
import appeng.items.materials.MaterialType;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class OldItemMaterial extends AEBaseItem implements IStorageComponent, IUpgradeModule, IItemMigrate
|
||||
{
|
||||
|
||||
HashMap<Integer, OldMaterialType> dmgToMaterial = new HashMap();
|
||||
|
||||
public static OldItemMaterial instance;
|
||||
|
||||
public OldItemMaterial() {
|
||||
super( OldItemMaterial.class );
|
||||
setfeature( EnumSet.of( AEFeature.AlphaMigration ) );
|
||||
setHasSubtypes( true );
|
||||
instance = this;
|
||||
|
||||
for (OldMaterialType omt : OldMaterialType.values())
|
||||
{
|
||||
createMaterial( omt );
|
||||
}
|
||||
}
|
||||
|
||||
class SlightlyBetterSort implements Comparator<String>
|
||||
{
|
||||
|
||||
Pattern p;
|
||||
|
||||
public SlightlyBetterSort(Pattern p) {
|
||||
this.p = p;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(String o1, String o2)
|
||||
{
|
||||
try
|
||||
{
|
||||
Matcher a = p.matcher( o1 );
|
||||
Matcher b = p.matcher( o2 );
|
||||
if ( a.find() && b.find() )
|
||||
{
|
||||
int ia = Integer.parseInt( a.group( 1 ) );
|
||||
int ib = Integer.parseInt( b.group( 1 ) );
|
||||
return Integer.compare( ia, ib );
|
||||
}
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
// ek!
|
||||
}
|
||||
return o1.compareTo( o2 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack is, EntityPlayer player, List details, boolean moar)
|
||||
{
|
||||
super.addInformation( is, player, details, moar );
|
||||
|
||||
OldMaterialType mt = getTypeByStack( is );
|
||||
if ( mt == null )
|
||||
return;
|
||||
|
||||
if ( mt == OldMaterialType.NamePress )
|
||||
{
|
||||
NBTTagCompound c = Platform.openNbtData( is );
|
||||
details.add( c.getString( "InscribeName" ) );
|
||||
}
|
||||
|
||||
Upgrades u = getType( is );
|
||||
if ( u != null )
|
||||
{
|
||||
List<String> textList = new LinkedList();
|
||||
for (Entry<ItemStack, Integer> j : u.getSupported().entrySet())
|
||||
{
|
||||
String name = null;
|
||||
|
||||
int limit = j.getValue();
|
||||
|
||||
if ( j.getKey().getItem() instanceof IItemGroup )
|
||||
{
|
||||
IItemGroup ig = (IItemGroup) j.getKey().getItem();
|
||||
String str = ig.getUnlocalizedGroupName( j.getKey() );
|
||||
if ( str != null )
|
||||
name = Platform.gui_localize( str ) + (limit > 1 ? " (" + limit + ")" : "");
|
||||
}
|
||||
|
||||
if ( name == null )
|
||||
name = j.getKey().getDisplayName() + (limit > 1 ? " (" + limit + ")" : "");
|
||||
|
||||
if ( !textList.contains( name ) )
|
||||
textList.add( name );
|
||||
}
|
||||
|
||||
Pattern p = Pattern.compile( "(\\d+)[^\\d]" );
|
||||
SlightlyBetterSort s = new SlightlyBetterSort( p );
|
||||
Collections.sort( textList, s );
|
||||
details.addAll( textList );
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStackSrc createMaterial(OldMaterialType mat)
|
||||
{
|
||||
String name = mat.name();
|
||||
|
||||
if ( mat.damageValue == -1 )
|
||||
{
|
||||
boolean enabled = true;
|
||||
for (AEFeature f : mat.getFeature())
|
||||
enabled = enabled && AEConfig.instance.isFeatureEnabled( f );
|
||||
|
||||
if ( enabled )
|
||||
{
|
||||
int newMaterialNum = AEConfig.instance.get( "materials", name, AEConfig.instance.getFreeMaterial( mat.ordinal() ) ).getInt();
|
||||
mat.damageValue = newMaterialNum;
|
||||
ItemStackSrc output = new ItemStackSrc( this, newMaterialNum );
|
||||
|
||||
dmgToMaterial.put( newMaterialNum, mat );
|
||||
|
||||
if ( mat.getOreName() != null )
|
||||
OreDictionary.registerOre( mat.getOreName(), output.stack( 1 ) );
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
else
|
||||
throw new RuntimeException( "Cannot create the same material twice..." );
|
||||
}
|
||||
|
||||
public OldMaterialType getTypeByStack(ItemStack is)
|
||||
{
|
||||
if ( dmgToMaterial.containsKey( is.getItemDamage() ) )
|
||||
return dmgToMaterial.get( is.getItemDamage() );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int dmg)
|
||||
{
|
||||
if ( dmgToMaterial.containsKey( dmg ) )
|
||||
return dmgToMaterial.get( dmg ).IIcon;
|
||||
return new MissingIcon( this );
|
||||
}
|
||||
|
||||
private String nameOf(ItemStack is)
|
||||
{
|
||||
if ( is == null )
|
||||
return "null";
|
||||
|
||||
OldMaterialType mt = getTypeByStack( is );
|
||||
if ( mt == null )
|
||||
return "null";
|
||||
|
||||
return AEFeatureHandler.getName( OldItemMaterial.class, mt.name() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack is)
|
||||
{
|
||||
return "item.appliedenergistics2." + nameOf( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister icoRegister)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomEntity(ItemStack is)
|
||||
{
|
||||
return getTypeByStack( is ).hasCustomEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity createEntity(World w, Entity location, ItemStack itemstack)
|
||||
{
|
||||
Class<? extends Entity> droppedEntity = getTypeByStack( itemstack ).getCustomEntityClass();
|
||||
Entity eqi;
|
||||
|
||||
try
|
||||
{
|
||||
eqi = droppedEntity.getConstructor( World.class, double.class, double.class, double.class, ItemStack.class ).newInstance( w, location.posX,
|
||||
location.posY, location.posZ, itemstack );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
}
|
||||
|
||||
eqi.motionX = location.motionX;
|
||||
eqi.motionY = location.motionY;
|
||||
eqi.motionZ = location.motionZ;
|
||||
|
||||
if ( location instanceof EntityItem && eqi instanceof EntityItem )
|
||||
((EntityItem) eqi).delayBeforeCanPickup = ((EntityItem) location).delayBeforeCanPickup;
|
||||
|
||||
return eqi;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytes(ItemStack is)
|
||||
{
|
||||
switch (getTypeByStack( is ))
|
||||
{
|
||||
case Cell1kPart:
|
||||
return 1024;
|
||||
case Cell4kPart:
|
||||
return 1024 * 4;
|
||||
case Cell16kPart:
|
||||
return 1024 * 16;
|
||||
case Cell64kPart:
|
||||
return 1024 * 64;
|
||||
default:
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStorageComponent(ItemStack is)
|
||||
{
|
||||
switch (getTypeByStack( is ))
|
||||
{
|
||||
case Cell1kPart:
|
||||
case Cell4kPart:
|
||||
case Cell16kPart:
|
||||
case Cell64kPart:
|
||||
return true;
|
||||
default:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Upgrades getType(ItemStack itemstack)
|
||||
{
|
||||
switch (getTypeByStack( itemstack ))
|
||||
{
|
||||
case CardCapacity:
|
||||
return Upgrades.CAPACITY;
|
||||
case CardFuzzy:
|
||||
return Upgrades.FUZZY;
|
||||
case CardRedstone:
|
||||
return Upgrades.REDSTONE;
|
||||
case CardSpeed:
|
||||
return Upgrades.SPEED;
|
||||
case CardInverter:
|
||||
return Upgrades.INVERTER;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List cList)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifyItemStack(ItemStack is)
|
||||
{
|
||||
if ( is.getItem() == this )
|
||||
{
|
||||
OldMaterialType omt = getTypeByStack( is );
|
||||
for (MaterialType mt : MaterialType.values())
|
||||
{
|
||||
if ( omt != null && mt.toString().equals( omt.toString() ) )
|
||||
{
|
||||
ItemStack newStack = ItemMultiMaterial.instance.getStackByType( mt );
|
||||
if ( newStack != null )
|
||||
{
|
||||
NBTTagCompound tmp = new NBTTagCompound();
|
||||
newStack.stackSize = is.stackSize;
|
||||
newStack.setTagCompound( is.getTagCompound() );
|
||||
|
||||
// write then read...
|
||||
newStack.writeToNBT( tmp );
|
||||
is.readFromNBT( tmp );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
package appeng.migration;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.items.IItemGroup;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.AEFeatureHandler;
|
||||
import appeng.core.features.ItemStackSrc;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.items.parts.ItemMultiPart;
|
||||
import appeng.items.parts.PartType;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class OldItemPart extends AEBaseItem implements IPartItem, IItemGroup, IItemMigrate
|
||||
{
|
||||
|
||||
class OldPartTypeIst
|
||||
{
|
||||
|
||||
OldPartType part;
|
||||
int varient;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
IIcon ico;
|
||||
|
||||
};
|
||||
|
||||
HashMap<Integer, OldPartTypeIst> dmgToPart = new HashMap();
|
||||
|
||||
public static OldItemPart instance;
|
||||
|
||||
public OldItemPart() {
|
||||
super( OldItemPart.class );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
AEApi.instance().partHelper().setItemBusRenderer( this );
|
||||
setHasSubtypes( true );
|
||||
instance = this;
|
||||
|
||||
for (OldPartType omt : OldPartType.values())
|
||||
{
|
||||
if ( omt.getVarients() == null )
|
||||
createPart( omt, null );
|
||||
else
|
||||
{
|
||||
for (Enum e : omt.getVarients())
|
||||
createPart( omt, e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStackSrc createPart(OldPartType mat, Enum varient)
|
||||
{
|
||||
try
|
||||
{
|
||||
// I think this still works?
|
||||
ItemStack is = new ItemStack( this );
|
||||
mat.getPart().getConstructor( ItemStack.class ).newInstance( is );
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return null; // part not supported..
|
||||
}
|
||||
|
||||
String name = varient == null ? mat.name() : mat.name() + "." + varient.name();
|
||||
int varID = varient == null ? 0 : varient.ordinal();
|
||||
|
||||
// verify
|
||||
for (OldPartTypeIst p : dmgToPart.values())
|
||||
{
|
||||
if ( p.part == mat && p.varient == varID )
|
||||
throw new RuntimeException( "Cannot create the same material twice..." );
|
||||
}
|
||||
|
||||
boolean enabled = true;
|
||||
for (AEFeature f : mat.getFeature())
|
||||
enabled = enabled && AEConfig.instance.isFeatureEnabled( f );
|
||||
|
||||
if ( enabled )
|
||||
{
|
||||
int newPartNum = AEConfig.instance.get( "parts", name, AEConfig.instance.getFreePart( mat.ordinal() * 32 + varID ) ).getInt();
|
||||
ItemStackSrc output = new ItemStackSrc( this, newPartNum );
|
||||
|
||||
OldPartTypeIst pti = new OldPartTypeIst();
|
||||
pti.part = mat;
|
||||
pti.varient = varID;
|
||||
|
||||
dmgToPart.put( newPartNum, pti );
|
||||
return output;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getDamageByType(OldPartType t)
|
||||
{
|
||||
for (Entry<Integer, OldPartTypeIst> pt : dmgToPart.entrySet())
|
||||
{
|
||||
if ( pt.getValue().part == t )
|
||||
return pt.getKey();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public OldPartType getTypeByStack(ItemStack is)
|
||||
{
|
||||
if ( is == null )
|
||||
return null;
|
||||
|
||||
OldPartTypeIst pt = dmgToPart.get( is.getItemDamage() );
|
||||
if ( pt != null )
|
||||
return pt.part;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSpriteNumber()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int dmg)
|
||||
{
|
||||
IIcon ico = dmgToPart.get( dmg ).ico;
|
||||
return ico;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack is)
|
||||
{
|
||||
return "item.appliedenergistics2." + getname( is );
|
||||
}
|
||||
|
||||
public String getname(ItemStack is)
|
||||
{
|
||||
return AEFeatureHandler.getName( OldItemPart.class, getTypeByStack( is ).name() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack is)
|
||||
{
|
||||
OldPartType pt = getTypeByStack( is );
|
||||
if ( pt == null )
|
||||
return "Unnamed";
|
||||
|
||||
Enum[] varients = pt.getVarients();
|
||||
|
||||
if ( varients != null )
|
||||
return super.getItemStackDisplayName( is ) + " - " + varients[dmgToPart.get( is.getItemDamage() ).varient].toString();
|
||||
|
||||
if ( pt.getExtraName() != null )
|
||||
return super.getItemStackDisplayName( is ) + " - " + pt.getExtraName().getLocal();
|
||||
|
||||
return super.getItemStackDisplayName( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack is, EntityPlayer player, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
return AEApi.instance().partHelper().placeBus( is, x, y, z, side, player, w );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPart createPartFromItemStack(ItemStack is)
|
||||
{
|
||||
try
|
||||
{
|
||||
OldPartType t = getTypeByStack( is );
|
||||
if ( t != null )
|
||||
return t.getPart().getConstructor( ItemStack.class ).newInstance( is );
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
throw new RuntimeException( "Unable to construct IBusPart from IBusItem : " + getTypeByStack( is ).getPart().getName()
|
||||
+ " ; Possibly didn't have correct constructor( ItemStack )", e );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item number, CreativeTabs tab, List cList)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public int varientOf(int itemDamage)
|
||||
{
|
||||
return dmgToPart.get( itemDamage ).varient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedGroupName(ItemStack is)
|
||||
{
|
||||
switch (getTypeByStack( is ))
|
||||
{
|
||||
case ImportBus:
|
||||
case ExportBus:
|
||||
return GuiText.IOBuses.getUnlocalized();
|
||||
default:
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifyItemStack(ItemStack is)
|
||||
{
|
||||
if ( is.getItem() == this )
|
||||
{
|
||||
OldPartTypeIst omt = dmgToPart.get( is.getItemDamage() );
|
||||
for (PartType mt : PartType.values())
|
||||
{
|
||||
if ( omt != null && omt.part != null && mt.toString().equals( omt.part.toString() ) )
|
||||
{
|
||||
ItemStack newStack = ItemMultiPart.instance.getStackFromTypeAndVarient( mt, omt.varient );
|
||||
if ( newStack != null )
|
||||
{
|
||||
NBTTagCompound tmp = new NBTTagCompound();
|
||||
newStack.stackSize = is.stackSize;
|
||||
newStack.setTagCompound( is.getTagCompound() );
|
||||
|
||||
// write then read...
|
||||
newStack.writeToNBT( tmp );
|
||||
is.readFromNBT( tmp );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package appeng.migration;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.entity.EntityChargedQuartz;
|
||||
import appeng.entity.EntityIds;
|
||||
import appeng.entity.EntitySingularity;
|
||||
import appeng.items.materials.ItemMultiMaterial;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public enum OldMaterialType
|
||||
{
|
||||
CertusQuartzCrystal(AEFeature.Core, "crystalCertusQuartz"), CertusQuartzCrystalCharged(AEFeature.Core, EntityChargedQuartz.class),
|
||||
|
||||
CertusQuartzDust(AEFeature.Core, "dustCertusQuartz"), NetherQuartzDust(AEFeature.Core, "dustNetherQuartz"), Flour(AEFeature.Flour, "dustWheat"), GoldDust(
|
||||
AEFeature.Core, "dustGold"), IronDust(AEFeature.Core, "dustIron"), IronNugget(AEFeature.Core, "nuggetIron"),
|
||||
|
||||
Silicon(AEFeature.Core, "itemSilicon"), MatterBall,
|
||||
|
||||
FluixCrystal(AEFeature.Core, "crystalFluix"), FluixDust(AEFeature.Core, "dustFluix"), FluixPearl(AEFeature.Core, "pearlFluix"),
|
||||
|
||||
PureifiedCertusQuartzCrystal, PureifiedNetherQuartzCrystal, PureifiedFluixCrystal,
|
||||
|
||||
CalcProcessorPress, EngProcessorPress, LogicProcessorPress,
|
||||
|
||||
CalcProcessorPrint, EngProcessorPrint, LogicProcessorPrint,
|
||||
|
||||
SiliconPress, SiliconPrint,
|
||||
|
||||
NamePress,
|
||||
|
||||
LogicProcessor, CalcProcessor, EngProcessor,
|
||||
|
||||
// Basic Cards
|
||||
BasicCard, CardRedstone, CardCapacity,
|
||||
|
||||
// Adv Cards
|
||||
AdvCard, CardFuzzy, CardSpeed, CardInverter,
|
||||
|
||||
Cell2SpatialPart(AEFeature.SpatialIO), Cell16SpatialPart(AEFeature.SpatialIO), Cell128SpatialPart(AEFeature.SpatialIO),
|
||||
|
||||
Cell1kPart(AEFeature.StorageCells), Cell4kPart(AEFeature.StorageCells), Cell16kPart(AEFeature.StorageCells), Cell64kPart(AEFeature.StorageCells), EmptyStorageCell(
|
||||
AEFeature.StorageCells),
|
||||
|
||||
WoodenGear(AEFeature.GrindStone, "gearWood"),
|
||||
|
||||
Wireless(AEFeature.WirelessAccessTerminal), WirelessBooster(AEFeature.WirelessAccessTerminal),
|
||||
|
||||
FormationCore, AnnihilationCore,
|
||||
|
||||
SkyDust(AEFeature.Core),
|
||||
|
||||
EnderDust(AEFeature.QuantumNetworkBridge, "dustEnder", EntitySingularity.class), Singularity(AEFeature.QuantumNetworkBridge, EntitySingularity.class), QESingularity(
|
||||
AEFeature.QuantumNetworkBridge, EntitySingularity.class);
|
||||
|
||||
private String oreName;
|
||||
private EnumSet<AEFeature> features;
|
||||
private Class<? extends Entity> droppedEntity;
|
||||
|
||||
// IIcon for the material.
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon IIcon;
|
||||
public int damageValue = -1;
|
||||
|
||||
OldMaterialType() {
|
||||
features = EnumSet.of( AEFeature.Core );
|
||||
}
|
||||
|
||||
OldMaterialType(AEFeature part) {
|
||||
features = EnumSet.of( part );
|
||||
}
|
||||
|
||||
OldMaterialType(AEFeature part, Class<? extends Entity> c) {
|
||||
features = EnumSet.of( part );
|
||||
droppedEntity = c;
|
||||
|
||||
EntityRegistry.registerModEntity( droppedEntity, droppedEntity.getSimpleName(), EntityIds.get( droppedEntity ), AppEng.instance, 16, 4, true );
|
||||
}
|
||||
|
||||
OldMaterialType(AEFeature part, String oreDictionary, Class<? extends Entity> c) {
|
||||
features = EnumSet.of( part );
|
||||
oreName = oreDictionary;
|
||||
if ( OreDictionary.getOres( oreDictionary ).size() > 0 )
|
||||
features.add( AEFeature.DuplicateItems );
|
||||
|
||||
droppedEntity = c;
|
||||
EntityRegistry.registerModEntity( droppedEntity, droppedEntity.getSimpleName(), EntityIds.get( droppedEntity ), AppEng.instance, 16, 4, true );
|
||||
}
|
||||
|
||||
OldMaterialType(AEFeature part, String oreDictionary) {
|
||||
features = EnumSet.of( part );
|
||||
oreName = oreDictionary;
|
||||
if ( OreDictionary.getOres( oreDictionary ).size() > 0 )
|
||||
features.add( AEFeature.DuplicateItems );
|
||||
}
|
||||
|
||||
public ItemStack stack(int size)
|
||||
{
|
||||
return new ItemStack( ItemMultiMaterial.instance, size, damageValue );
|
||||
}
|
||||
|
||||
public EnumSet<AEFeature> getFeature()
|
||||
{
|
||||
return features;
|
||||
}
|
||||
|
||||
public String getOreName()
|
||||
{
|
||||
return oreName;
|
||||
}
|
||||
|
||||
public boolean hasCustomEntity()
|
||||
{
|
||||
return droppedEntity != null;
|
||||
}
|
||||
|
||||
public Class<? extends Entity> getCustomEntityClass()
|
||||
{
|
||||
return droppedEntity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package appeng.migration;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.parts.automation.PartAnnihilationPlane;
|
||||
import appeng.parts.automation.PartExportBus;
|
||||
import appeng.parts.automation.PartFormationPlane;
|
||||
import appeng.parts.automation.PartImportBus;
|
||||
import appeng.parts.automation.PartLevelEmitter;
|
||||
import appeng.parts.misc.PartCableAnchor;
|
||||
import appeng.parts.misc.PartInterface;
|
||||
import appeng.parts.misc.PartInvertedToggleBus;
|
||||
import appeng.parts.misc.PartStorageBus;
|
||||
import appeng.parts.misc.PartToggleBus;
|
||||
import appeng.parts.networking.PartCableCovered;
|
||||
import appeng.parts.networking.PartCableGlass;
|
||||
import appeng.parts.networking.PartCableSmart;
|
||||
import appeng.parts.networking.PartDenseCable;
|
||||
import appeng.parts.networking.PartQuartzFiber;
|
||||
import appeng.parts.p2p.PartP2PBCPower;
|
||||
import appeng.parts.p2p.PartP2PIC2Power;
|
||||
import appeng.parts.p2p.PartP2PItems;
|
||||
import appeng.parts.p2p.PartP2PLiquids;
|
||||
import appeng.parts.p2p.PartP2PRFPower;
|
||||
import appeng.parts.p2p.PartP2PRedstone;
|
||||
import appeng.parts.p2p.PartP2PTunnelME;
|
||||
import appeng.parts.reporting.PartConversionMonitor;
|
||||
import appeng.parts.reporting.PartCraftingTerminal;
|
||||
import appeng.parts.reporting.PartDarkMonitor;
|
||||
import appeng.parts.reporting.PartMonitor;
|
||||
import appeng.parts.reporting.PartPatternTerminal;
|
||||
import appeng.parts.reporting.PartSemiDarkMonitor;
|
||||
import appeng.parts.reporting.PartStorageMonitor;
|
||||
import appeng.parts.reporting.PartTerminal;
|
||||
|
||||
public enum OldPartType
|
||||
{
|
||||
ToggleBus(AEFeature.Core, PartToggleBus.class),
|
||||
|
||||
InvertedToggleBus(AEFeature.Core, PartInvertedToggleBus.class),
|
||||
|
||||
CableSmart(AEFeature.Core, PartCableSmart.class), CableCovered(AEFeature.Core, PartCableCovered.class), CableGlass(AEFeature.Core, PartCableGlass.class),
|
||||
|
||||
CableDense(AEFeature.DenseCables, PartDenseCable.class),
|
||||
|
||||
CableAnchor(AEFeature.Core, PartCableAnchor.class),
|
||||
|
||||
QuartzFiber(AEFeature.Core, PartQuartzFiber.class),
|
||||
|
||||
Monitor(AEFeature.Core, PartMonitor.class),
|
||||
|
||||
SemiDarkMonitor(AEFeature.Core, PartSemiDarkMonitor.class),
|
||||
|
||||
DarkMonitor(AEFeature.Core, PartDarkMonitor.class),
|
||||
|
||||
StorageBus(AEFeature.StorageBus, PartStorageBus.class),
|
||||
|
||||
ImportBus(AEFeature.ImportBus, PartImportBus.class),
|
||||
|
||||
ExportBus(AEFeature.ExportBus, PartExportBus.class),
|
||||
|
||||
LevelEmitter(AEFeature.LevelEmiter, PartLevelEmitter.class),
|
||||
|
||||
AnnihilationPlane(AEFeature.AnnihilationPlane, PartAnnihilationPlane.class),
|
||||
|
||||
FormationPlane(AEFeature.FormationPlane, PartFormationPlane.class),
|
||||
|
||||
P2PTunnelME(AEFeature.P2PTunnelME, PartP2PTunnelME.class, GuiText.METunnel),
|
||||
|
||||
P2PTunnelRedstone(AEFeature.P2PTunnelRedstone, PartP2PRedstone.class, GuiText.RedstoneTunnel),
|
||||
|
||||
P2PTunnelItems(AEFeature.P2PTunnelItems, PartP2PItems.class, GuiText.ItemTunnel),
|
||||
|
||||
P2PTunnelLiquids(AEFeature.P2PTunnelLiquids, PartP2PLiquids.class, GuiText.FluidTunnel),
|
||||
|
||||
P2PTunnelMJ(AEFeature.P2PTunnelMJ, PartP2PBCPower.class, GuiText.MJTunnel),
|
||||
|
||||
P2PTunnelEU(AEFeature.P2PTunnelEU, PartP2PIC2Power.class, GuiText.EUTunnel),
|
||||
|
||||
// CraftingMonitor(AEFeature.Crafting, PartCraftingMonitor.class),
|
||||
|
||||
PatternTerminal(AEFeature.CraftingTerminal, PartPatternTerminal.class),
|
||||
|
||||
CraftingTerminal(AEFeature.CraftingTerminal, PartCraftingTerminal.class),
|
||||
|
||||
Terminal(AEFeature.Core, PartTerminal.class),
|
||||
|
||||
StorageMonitor(AEFeature.StorageMonitor, PartStorageMonitor.class),
|
||||
|
||||
ConversionMonitor(AEFeature.PartConversionMonitor, PartConversionMonitor.class),
|
||||
|
||||
Interface(AEFeature.Core, PartInterface.class),
|
||||
|
||||
P2PTunnelRF(AEFeature.P2PTunnelRF, PartP2PRFPower.class, GuiText.RFTunnel);
|
||||
|
||||
private final EnumSet<AEFeature> features;
|
||||
private final Class<? extends IPart> myPart;
|
||||
private final GuiText extraName;
|
||||
|
||||
OldPartType(AEFeature part, Class<? extends IPart> c) {
|
||||
this( part, c, null );
|
||||
}
|
||||
|
||||
OldPartType(AEFeature part, Class<? extends IPart> c, GuiText en) {
|
||||
features = EnumSet.of( part );
|
||||
myPart = c;
|
||||
extraName = en;
|
||||
}
|
||||
|
||||
public Enum[] getVarients()
|
||||
{
|
||||
return (this == CableSmart || this == CableCovered || this == CableGlass || this == CableDense) ? AEColor.values() : null;
|
||||
}
|
||||
|
||||
public EnumSet<AEFeature> getFeature()
|
||||
{
|
||||
return features;
|
||||
}
|
||||
|
||||
public Class<? extends IPart> getPart()
|
||||
{
|
||||
return myPart;
|
||||
}
|
||||
|
||||
public GuiText getExtraName()
|
||||
{
|
||||
return extraName;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user