Basic reformat, hit once, hope never again
This commit is contained in:
@@ -27,8 +27,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.commons.Remapper;
|
||||
@@ -45,6 +43,8 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
import appeng.api.parts.CableRenderMode;
|
||||
import appeng.api.parts.IPartHelper;
|
||||
import appeng.api.parts.IPartItem;
|
||||
@@ -59,6 +59,7 @@ import appeng.parts.PartPlacement;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ApiPart implements IPartHelper
|
||||
{
|
||||
|
||||
@@ -69,14 +70,212 @@ public class ApiPart implements IPartHelper
|
||||
|
||||
public void initFMPSupport()
|
||||
{
|
||||
for (Class layerInterface : this.interfaces2Layer.keySet())
|
||||
for( Class layerInterface : this.interfaces2Layer.keySet() )
|
||||
{
|
||||
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.FMP ) )
|
||||
((IFMP) AppEng.instance.getIntegration( IntegrationType.FMP )).registerPassThrough( layerInterface );
|
||||
if( AppEng.instance.isIntegrationEnabled( IntegrationType.FMP ) )
|
||||
( (IFMP) AppEng.instance.getIntegration( IntegrationType.FMP ) ).registerPassThrough( layerInterface );
|
||||
}
|
||||
}
|
||||
|
||||
private Class loadClass(String Name, byte[] b)
|
||||
public Class getCombinedInstance( String base )
|
||||
{
|
||||
if( this.desc.size() == 0 )
|
||||
{
|
||||
try
|
||||
{
|
||||
return Class.forName( base );
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
}
|
||||
}
|
||||
|
||||
String description = base + ':' + Joiner.on( ";" ).skipNulls().join( this.desc.iterator() );
|
||||
|
||||
if( this.tileImplementations.get( description ) != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.tileImplementations.get( description );
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
}
|
||||
}
|
||||
|
||||
String f = base;// TileCableBus.class.getName();
|
||||
String Addendum = "";
|
||||
try
|
||||
{
|
||||
Addendum = Class.forName( base ).getSimpleName();
|
||||
}
|
||||
catch( ClassNotFoundException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
Class myCLass;
|
||||
|
||||
try
|
||||
{
|
||||
myCLass = Class.forName( f );
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
}
|
||||
|
||||
String path = f;
|
||||
|
||||
for( String name : this.desc )
|
||||
{
|
||||
try
|
||||
{
|
||||
String newPath = path + ';' + name;
|
||||
myCLass = this.getClassByDesc( Addendum, newPath, f, this.interfaces2Layer.get( Class.forName( name ) ) );
|
||||
path = newPath;
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
AELog.warning( "Error loading " + name );
|
||||
AELog.error( t );
|
||||
// throw new RuntimeException( t );
|
||||
}
|
||||
f = myCLass.getName();
|
||||
}
|
||||
|
||||
this.tileImplementations.put( description, myCLass );
|
||||
|
||||
try
|
||||
{
|
||||
return myCLass;
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
}
|
||||
}
|
||||
|
||||
public Class getClassByDesc( String Addendum, String fullPath, String root, String next )
|
||||
{
|
||||
if( this.roots.get( fullPath ) != null )
|
||||
return this.roots.get( fullPath );
|
||||
|
||||
ClassWriter cw = new ClassWriter( ClassWriter.COMPUTE_MAXS );
|
||||
ClassNode n = this.getReader( next );
|
||||
String originalName = n.name;
|
||||
|
||||
try
|
||||
{
|
||||
n.name = n.name + '_' + Addendum;
|
||||
n.superName = Class.forName( root ).getName().replace( ".", "/" );
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
AELog.error( t );
|
||||
}
|
||||
|
||||
for( MethodNode mn : n.methods )
|
||||
{
|
||||
Iterator<AbstractInsnNode> i = mn.instructions.iterator();
|
||||
while( i.hasNext() )
|
||||
{
|
||||
this.processNode( i.next(), n.superName );
|
||||
}
|
||||
}
|
||||
|
||||
DefaultPackageClassNameRemapper remapper = new DefaultPackageClassNameRemapper();
|
||||
remapper.inputOutput.put( "appeng/api/parts/LayerBase", n.superName );
|
||||
remapper.inputOutput.put( originalName, n.name );
|
||||
n.accept( new RemappingClassAdapter( cw, remapper ) );
|
||||
// n.accept( cw );
|
||||
|
||||
// n.accept( new TraceClassVisitor( new PrintWriter( System.out ) ) );
|
||||
byte[] byteArray = cw.toByteArray();
|
||||
int size = byteArray.length;
|
||||
Class clazz = this.loadClass( n.name.replace( "/", "." ), byteArray );
|
||||
|
||||
try
|
||||
{
|
||||
Object fish = clazz.newInstance();
|
||||
Class rootC = Class.forName( root );
|
||||
|
||||
boolean hasError = false;
|
||||
|
||||
if( !rootC.isInstance( fish ) )
|
||||
{
|
||||
hasError = true;
|
||||
AELog.severe( "Error, Expected layer to implement " + root + " did not." );
|
||||
}
|
||||
|
||||
if( fish instanceof LayerBase )
|
||||
{
|
||||
hasError = true;
|
||||
AELog.severe( "Error, Expected layer to NOT implement LayerBase but it DID." );
|
||||
}
|
||||
|
||||
if( !fullPath.contains( ".fmp." ) )
|
||||
{
|
||||
if( !( fish instanceof TileCableBus ) )
|
||||
{
|
||||
hasError = true;
|
||||
AELog.severe( "Error, Expected layer to implement TileCableBus did not." );
|
||||
}
|
||||
|
||||
if( !( fish instanceof TileEntity ) )
|
||||
{
|
||||
hasError = true;
|
||||
AELog.severe( "Error, Expected layer to implement TileEntity did not." );
|
||||
}
|
||||
}
|
||||
|
||||
if( !hasError )
|
||||
{
|
||||
AELog.info( "Layer: " + n.name + " loaded successfully - " + size + " bytes" );
|
||||
}
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
AELog.severe( "Layer: " + n.name + " Failed." );
|
||||
AELog.error( t );
|
||||
}
|
||||
|
||||
this.roots.put( fullPath, clazz );
|
||||
return clazz;
|
||||
}
|
||||
|
||||
public ClassNode getReader( String name )
|
||||
{
|
||||
try
|
||||
{
|
||||
ClassReader cr;
|
||||
String path = '/' + name.replace( ".", "/" ) + ".class";
|
||||
InputStream is = this.getClass().getResourceAsStream( path );
|
||||
cr = new ClassReader( is );
|
||||
ClassNode cn = new ClassNode();
|
||||
cr.accept( cn, ClassReader.EXPAND_FRAMES );
|
||||
return cn;
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
throw new RuntimeException( "Error loading " + name, t );
|
||||
}
|
||||
}
|
||||
|
||||
private void processNode( AbstractInsnNode next, String nePar )
|
||||
{
|
||||
if( next instanceof MethodInsnNode )
|
||||
{
|
||||
MethodInsnNode min = (MethodInsnNode) next;
|
||||
if( min.owner.equals( "appeng/api/parts/LayerBase" ) )
|
||||
{
|
||||
min.owner = nePar;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Class loadClass( String Name, byte[] b )
|
||||
{
|
||||
// override classDefine (as it is protected) and define the class.
|
||||
Class clazz = null;
|
||||
@@ -104,7 +303,7 @@ public class ApiPart implements IPartHelper
|
||||
defineClassMethod.setAccessible( false );
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
catch( Exception e )
|
||||
{
|
||||
AELog.error( e );
|
||||
throw new RuntimeException( "Unable to manage part API.", e );
|
||||
@@ -112,241 +311,13 @@ public class ApiPart implements IPartHelper
|
||||
return clazz;
|
||||
}
|
||||
|
||||
public ClassNode getReader(String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
ClassReader cr;
|
||||
String path = '/' + name.replace( ".", "/" ) + ".class";
|
||||
InputStream is = this.getClass().getResourceAsStream( path );
|
||||
cr = new ClassReader( is );
|
||||
ClassNode cn = new ClassNode();
|
||||
cr.accept( cn, ClassReader.EXPAND_FRAMES );
|
||||
return cn;
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
throw new RuntimeException( "Error loading " + name, t );
|
||||
}
|
||||
}
|
||||
|
||||
public Class getCombinedInstance(String base)
|
||||
{
|
||||
if ( this.desc.size() == 0 )
|
||||
{
|
||||
try
|
||||
{
|
||||
return Class.forName( base );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
}
|
||||
}
|
||||
|
||||
String description = base + ':' + Joiner.on( ";" ).skipNulls().join( this.desc.iterator() );
|
||||
|
||||
if ( this.tileImplementations.get( description ) != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.tileImplementations.get( description );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
}
|
||||
}
|
||||
|
||||
String f = base;// TileCableBus.class.getName();
|
||||
String Addendum = "";
|
||||
try
|
||||
{
|
||||
Addendum = Class.forName( base ).getSimpleName();
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
Class myCLass;
|
||||
|
||||
try
|
||||
{
|
||||
myCLass = Class.forName( f );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
}
|
||||
|
||||
String path = f;
|
||||
|
||||
for (String name : this.desc)
|
||||
{
|
||||
try
|
||||
{
|
||||
String newPath = path + ';' + name;
|
||||
myCLass = this.getClassByDesc( Addendum, newPath, f, this.interfaces2Layer.get( Class.forName( name ) ) );
|
||||
path = newPath;
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
AELog.warning( "Error loading " + name );
|
||||
AELog.error( t );
|
||||
// throw new RuntimeException( t );
|
||||
}
|
||||
f = myCLass.getName();
|
||||
}
|
||||
|
||||
this.tileImplementations.put( description, myCLass );
|
||||
|
||||
try
|
||||
{
|
||||
return myCLass;
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
}
|
||||
}
|
||||
|
||||
static class DefaultPackageClassNameRemapper extends Remapper
|
||||
{
|
||||
|
||||
public final HashMap<String, String> inputOutput = new HashMap<String, String>();
|
||||
|
||||
@Override
|
||||
public String map(String typeName)
|
||||
{
|
||||
String o = this.inputOutput.get( typeName );
|
||||
if ( o == null )
|
||||
return typeName;
|
||||
return o;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Class getClassByDesc(String Addendum, String fullPath, String root, String next)
|
||||
{
|
||||
if ( this.roots.get( fullPath ) != null )
|
||||
return this.roots.get( fullPath );
|
||||
|
||||
ClassWriter cw = new ClassWriter( ClassWriter.COMPUTE_MAXS );
|
||||
ClassNode n = this.getReader( next );
|
||||
String originalName = n.name;
|
||||
|
||||
try
|
||||
{
|
||||
n.name = n.name + '_' + Addendum;
|
||||
n.superName = Class.forName( root ).getName().replace( ".", "/" );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
AELog.error( t );
|
||||
}
|
||||
|
||||
for (MethodNode mn : n.methods)
|
||||
{
|
||||
Iterator<AbstractInsnNode> i = mn.instructions.iterator();
|
||||
while (i.hasNext())
|
||||
{
|
||||
this.processNode( i.next(), n.superName );
|
||||
}
|
||||
}
|
||||
|
||||
DefaultPackageClassNameRemapper remapper = new DefaultPackageClassNameRemapper();
|
||||
remapper.inputOutput.put( "appeng/api/parts/LayerBase", n.superName );
|
||||
remapper.inputOutput.put( originalName, n.name );
|
||||
n.accept( new RemappingClassAdapter( cw, remapper ) );
|
||||
// n.accept( cw );
|
||||
|
||||
// n.accept( new TraceClassVisitor( new PrintWriter( System.out ) ) );
|
||||
byte[] byteArray = cw.toByteArray();
|
||||
int size = byteArray.length;
|
||||
Class clazz = this.loadClass( n.name.replace( "/", "." ), byteArray );
|
||||
|
||||
try
|
||||
{
|
||||
Object fish = clazz.newInstance();
|
||||
Class rootC = Class.forName( root );
|
||||
|
||||
boolean hasError = false;
|
||||
|
||||
if ( !rootC.isInstance( fish ) )
|
||||
{
|
||||
hasError = true;
|
||||
AELog.severe( "Error, Expected layer to implement " + root + " did not." );
|
||||
}
|
||||
|
||||
if ( fish instanceof LayerBase )
|
||||
{
|
||||
hasError = true;
|
||||
AELog.severe( "Error, Expected layer to NOT implement LayerBase but it DID." );
|
||||
}
|
||||
|
||||
if ( !fullPath.contains( ".fmp." ) )
|
||||
{
|
||||
if ( !(fish instanceof TileCableBus) )
|
||||
{
|
||||
hasError = true;
|
||||
AELog.severe( "Error, Expected layer to implement TileCableBus did not." );
|
||||
}
|
||||
|
||||
if ( !(fish instanceof TileEntity) )
|
||||
{
|
||||
hasError = true;
|
||||
AELog.severe( "Error, Expected layer to implement TileEntity did not." );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !hasError )
|
||||
{
|
||||
AELog.info( "Layer: " + n.name + " loaded successfully - " + size + " bytes" );
|
||||
}
|
||||
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
AELog.severe( "Layer: " + n.name + " Failed." );
|
||||
AELog.error( t );
|
||||
}
|
||||
|
||||
this.roots.put( fullPath, clazz );
|
||||
return clazz;
|
||||
}
|
||||
|
||||
private void processNode(AbstractInsnNode next, String nePar)
|
||||
{
|
||||
if ( next instanceof MethodInsnNode )
|
||||
{
|
||||
MethodInsnNode min = (MethodInsnNode) next;
|
||||
if ( min.owner.equals( "appeng/api/parts/LayerBase" ) )
|
||||
{
|
||||
min.owner = nePar;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItemBusRenderer(IPartItem i)
|
||||
{
|
||||
if ( Platform.isClient() && i instanceof Item )
|
||||
MinecraftForgeClient.registerItemRenderer( (Item) i, BusRenderer.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBus(ItemStack is, int x, int y, int z, int side, EntityPlayer player, World w)
|
||||
{
|
||||
return PartPlacement.place( is, x, y, z, side, player, w, PartPlacement.PlaceType.PLACE_ITEM, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean registerNewLayer(String layer, String layerInterface)
|
||||
public boolean registerNewLayer( String layer, String layerInterface )
|
||||
{
|
||||
try
|
||||
{
|
||||
final Class<?> layerInterfaceClass = Class.forName( layerInterface );
|
||||
if ( this.interfaces2Layer.get( layerInterfaceClass ) == null )
|
||||
if( this.interfaces2Layer.get( layerInterfaceClass ) == null )
|
||||
{
|
||||
this.interfaces2Layer.put( layerInterfaceClass, layer );
|
||||
this.desc.add( layerInterface );
|
||||
@@ -355,17 +326,44 @@ public class ApiPart implements IPartHelper
|
||||
else
|
||||
AELog.info( "Layer " + layer + " not registered, " + layerInterface + " already has a layer." );
|
||||
}
|
||||
catch (Throwable ignored)
|
||||
catch( Throwable ignored )
|
||||
{
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItemBusRenderer( IPartItem i )
|
||||
{
|
||||
if( Platform.isClient() && i instanceof Item )
|
||||
MinecraftForgeClient.registerItemRenderer( (Item) i, BusRenderer.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBus( ItemStack is, int x, int y, int z, int side, EntityPlayer player, World w )
|
||||
{
|
||||
return PartPlacement.place( is, x, y, z, side, player, w, PartPlacement.PlaceType.PLACE_ITEM, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public CableRenderMode getCableRenderMode()
|
||||
{
|
||||
return CommonHelper.proxy.getRenderMode();
|
||||
}
|
||||
|
||||
static class DefaultPackageClassNameRemapper extends Remapper
|
||||
{
|
||||
|
||||
public final HashMap<String, String> inputOutput = new HashMap<String, String>();
|
||||
|
||||
@Override
|
||||
public String map( String typeName )
|
||||
{
|
||||
String o = this.inputOutput.get( typeName );
|
||||
if( o == null )
|
||||
return typeName;
|
||||
return o;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.api;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@@ -41,17 +42,24 @@ import appeng.util.item.AEFluidStack;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.item.ItemList;
|
||||
|
||||
|
||||
public class ApiStorage implements IStorageHelper
|
||||
{
|
||||
|
||||
@Override
|
||||
public IAEItemStack createItemStack(ItemStack is)
|
||||
public ICraftingLink loadCraftingLink( NBTTagCompound data, ICraftingRequester req )
|
||||
{
|
||||
return new CraftingLink( data, req );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack createItemStack( ItemStack is )
|
||||
{
|
||||
return AEItemStack.create( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack createFluidStack(FluidStack is)
|
||||
public IAEFluidStack createFluidStack( FluidStack is )
|
||||
{
|
||||
return AEFluidStack.create( is );
|
||||
}
|
||||
@@ -69,32 +77,26 @@ public class ApiStorage implements IStorageHelper
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack poweredExtraction(IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack request, BaseActionSource src)
|
||||
{
|
||||
return Platform.poweredExtraction( energy, cell, request, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack poweredInsert(IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack input, BaseActionSource src)
|
||||
{
|
||||
return Platform.poweredInsert( energy, cell, input, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack readItemFromPacket(ByteBuf input) throws IOException
|
||||
public IAEItemStack readItemFromPacket( ByteBuf input ) throws IOException
|
||||
{
|
||||
return AEItemStack.loadItemStackFromPacket( input );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack readFluidFromPacket(ByteBuf input) throws IOException
|
||||
public IAEFluidStack readFluidFromPacket( ByteBuf input ) throws IOException
|
||||
{
|
||||
return AEFluidStack.loadFluidStackFromPacket( input );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICraftingLink loadCraftingLink(NBTTagCompound data, ICraftingRequester req)
|
||||
public IAEItemStack poweredExtraction( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack request, BaseActionSource src )
|
||||
{
|
||||
return new CraftingLink( data, req );
|
||||
return Platform.poweredExtraction( energy, cell, request, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack poweredInsert( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack input, BaseActionSource src )
|
||||
{
|
||||
return Platform.poweredInsert( energy, cell, input, src );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,10 @@
|
||||
|
||||
package appeng.core.api;
|
||||
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
|
||||
public interface IIMCProcessor
|
||||
{
|
||||
void process( IMCMessage m );
|
||||
|
||||
@@ -38,10 +38,10 @@ public final class ApiParts implements IParts
|
||||
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 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;
|
||||
@@ -79,10 +79,10 @@ public final class ApiParts implements IParts
|
||||
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.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 ) );
|
||||
@@ -140,28 +140,28 @@ public final class ApiParts implements IParts
|
||||
public AEColoredItemDefinition lumenCableSmart()
|
||||
{
|
||||
throw new MissingDefinition( "Lumen Smart Cable has yet to be implemented." );
|
||||
// return this.lumenCableSmart;
|
||||
// return this.lumenCableSmart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition lumenCableCovered()
|
||||
{
|
||||
throw new MissingDefinition( "Lumen Covered Cable has yet to be implemented." );
|
||||
// return this.lumenCableCovered;
|
||||
// return this.lumenCableCovered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition lumenCableGlass()
|
||||
{
|
||||
throw new MissingDefinition( "Lumen Glass Cable has yet to be implemented." );
|
||||
// return this.lumenCableGlass;
|
||||
// return this.lumenCableGlass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColoredItemDefinition lumenCableDense()
|
||||
{
|
||||
throw new MissingDefinition( "Lumen Dense Cable has yet to be implemented." );
|
||||
// return this.lumenCableDense;
|
||||
// return this.lumenCableDense;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,7 +35,7 @@ public class DefinitionConstructor
|
||||
{
|
||||
final IBlockDefinition definition = this.registerBlockDefinition( feature );
|
||||
|
||||
if ( definition instanceof ITileDefinition )
|
||||
if( definition instanceof ITileDefinition )
|
||||
{
|
||||
return ( (ITileDefinition) definition );
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class DefinitionConstructor
|
||||
{
|
||||
final IItemDefinition definition = this.registerItemDefinition( feature );
|
||||
|
||||
if ( definition instanceof IBlockDefinition )
|
||||
if( definition instanceof IBlockDefinition )
|
||||
{
|
||||
return ( (IBlockDefinition) definition );
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class DefinitionConstructor
|
||||
{
|
||||
final IFeatureHandler handler = feature.handler();
|
||||
|
||||
if ( handler.isFeatureAvailable() )
|
||||
if( handler.isFeatureAvailable() )
|
||||
{
|
||||
this.handlers.addFeatureHandler( handler );
|
||||
this.features.addFeature( feature );
|
||||
@@ -74,9 +74,9 @@ public class DefinitionConstructor
|
||||
{
|
||||
final ColoredItemDefinition definition = new ColoredItemDefinition();
|
||||
|
||||
for ( Item targetItem : target.maybeItem().asSet() )
|
||||
for( Item targetItem : target.maybeItem().asSet() )
|
||||
{
|
||||
for ( AEColor color : AEColor.VALID_COLORS )
|
||||
for( AEColor color : AEColor.VALID_COLORS )
|
||||
{
|
||||
definition.add( color, new ItemStackSrc( targetItem, offset + color.ordinal() ) );
|
||||
}
|
||||
@@ -89,12 +89,12 @@ public class DefinitionConstructor
|
||||
{
|
||||
final ColoredItemDefinition definition = new ColoredItemDefinition();
|
||||
|
||||
for ( AEColor color : AEColor.values() )
|
||||
for( AEColor color : AEColor.values() )
|
||||
{
|
||||
ItemStackSrc multiPartSource = target.createPart( type, color );
|
||||
final Optional<ItemStackSrc> maybeSource = Optional.fromNullable( multiPartSource );
|
||||
|
||||
if ( maybeSource.isPresent() )
|
||||
if( maybeSource.isPresent() )
|
||||
{
|
||||
definition.add( color, multiPartSource );
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core.api.imc;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -27,6 +28,7 @@ import appeng.api.AEApi;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.api.IIMCProcessor;
|
||||
|
||||
|
||||
public class IMCBlackListSpatial implements IIMCProcessor
|
||||
{
|
||||
|
||||
@@ -35,10 +37,10 @@ public class IMCBlackListSpatial implements IIMCProcessor
|
||||
{
|
||||
|
||||
ItemStack is = m.getItemStackValue();
|
||||
if ( is != null )
|
||||
if( is != null )
|
||||
{
|
||||
Block blk = Block.getBlockFromItem( is.getItem() );
|
||||
if ( blk != null )
|
||||
if( blk != null )
|
||||
{
|
||||
AEApi.instance().registries().movable().blacklistBlock( blk );
|
||||
return;
|
||||
@@ -46,7 +48,5 @@ public class IMCBlackListSpatial implements IIMCProcessor
|
||||
}
|
||||
|
||||
AELog.info( "Bad Block blacklisted by " + m.getSender() );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,8 +49,10 @@ msg.setInteger( "turns", 8 );
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-grindable", msg );
|
||||
|
||||
*/
|
||||
|
||||
package appeng.core.api.imc;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -59,6 +61,7 @@ import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.core.api.IIMCProcessor;
|
||||
|
||||
|
||||
public class IMCGrinder implements IIMCProcessor
|
||||
{
|
||||
@Override
|
||||
@@ -73,18 +76,18 @@ public class IMCGrinder implements IIMCProcessor
|
||||
|
||||
int turns = msg.getInteger( "turns" );
|
||||
|
||||
if ( in == null )
|
||||
if( in == null )
|
||||
throw new RuntimeException( "invalid input" );
|
||||
|
||||
if ( out == null )
|
||||
if( out == null )
|
||||
throw new RuntimeException( "invalid output" );
|
||||
|
||||
if ( msg.hasKey( "optional" ) )
|
||||
if( msg.hasKey( "optional" ) )
|
||||
{
|
||||
NBTTagCompound optionalTag = (NBTTagCompound) msg.getTag( "optional" );
|
||||
ItemStack optional = ItemStack.loadItemStackFromNBT( optionalTag );
|
||||
|
||||
if ( optional == null )
|
||||
if( optional == null )
|
||||
throw new RuntimeException( "invalid optional" );
|
||||
|
||||
float chance = msg.getFloat( "chance" );
|
||||
|
||||
@@ -28,8 +28,10 @@ msg.setDouble( "weight", 32.0 );
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-mattercannon-ammo", msg );
|
||||
|
||||
*/
|
||||
|
||||
package appeng.core.api.imc;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -38,6 +40,7 @@ import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.core.api.IIMCProcessor;
|
||||
|
||||
|
||||
public class IMCMatterCannon implements IIMCProcessor
|
||||
{
|
||||
|
||||
@@ -50,7 +53,7 @@ public class IMCMatterCannon implements IIMCProcessor
|
||||
ItemStack ammo = ItemStack.loadItemStackFromNBT( item );
|
||||
double weight = msg.getDouble( "weight" );
|
||||
|
||||
if ( ammo == null )
|
||||
if( ammo == null )
|
||||
throw new RuntimeException( "invalid item" );
|
||||
|
||||
AEApi.instance().registries().matterCannon().registerAmmo( ammo, weight );
|
||||
|
||||
@@ -26,8 +26,10 @@ FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-fluid",
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-item", new ItemStack( myBlockOrItem ) );
|
||||
|
||||
*/
|
||||
|
||||
package appeng.core.api.imc;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
@@ -36,6 +38,7 @@ import appeng.api.AEApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.core.api.IIMCProcessor;
|
||||
|
||||
|
||||
public class IMCP2PAttunement implements IIMCProcessor
|
||||
{
|
||||
|
||||
@@ -46,10 +49,10 @@ public class IMCP2PAttunement implements IIMCProcessor
|
||||
|
||||
TunnelType type = TunnelType.valueOf( key );
|
||||
|
||||
if ( type != null )
|
||||
if( type != null )
|
||||
{
|
||||
ItemStack is = m.getItemStackValue();
|
||||
if ( is != null )
|
||||
if( is != null )
|
||||
AEApi.instance().registries().p2pTunnel().addNewAttunement( is, type );
|
||||
else
|
||||
throw new RuntimeException( "invalid item" );
|
||||
@@ -57,5 +60,4 @@ public class IMCP2PAttunement implements IIMCProcessor
|
||||
else
|
||||
throw new RuntimeException( "invalid type" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,14 +21,17 @@
|
||||
FMLInterModComms.sendMessage( "appliedenergistics2", "whitelist-spatial", "mymod.tileentities.MyTileEntity" );
|
||||
|
||||
*/
|
||||
|
||||
package appeng.core.api.imc;
|
||||
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.api.IIMCProcessor;
|
||||
|
||||
|
||||
public class IMCSpatial implements IIMCProcessor
|
||||
{
|
||||
|
||||
@@ -41,11 +44,9 @@ public class IMCSpatial implements IIMCProcessor
|
||||
Class classInstance = Class.forName( m.getStringValue() );
|
||||
AEApi.instance().registries().movable().whiteListTileEntity( classInstance );
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
catch( ClassNotFoundException e )
|
||||
{
|
||||
AELog.info( "Bad Class Registered: " + m.getStringValue() + " by " + m.getSender() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user