Conflicts:
	container/AEBaseContainer.java
	core/sync/AppEngPacketHandlerBase.java
This commit is contained in:
AlgorithmX2
2014-05-13 19:25:07 -05:00
57 changed files with 1270 additions and 152 deletions
+2 -2
View File
@@ -80,8 +80,7 @@ public class AppEng
IMCHandlers.put( "add-p2p-attunement-" + type.name().replace( '_', '-' ).toLowerCase(), new IMCP2PAttunement() );
}
for (CrashInfo ci : CrashInfo.values())
FMLCommonHandler.instance().registerCrashCallable( new CrashEnhancement( ci ) );
FMLCommonHandler.instance().registerCrashCallable( new CrashEnhancement( CrashInfo.MOD_VERSION ) );
}
public boolean isIntegrationEnabled(String Name)
@@ -157,6 +156,7 @@ public class AppEng
Registration.instance.PostInit( event );
IntegrationRegistry.instance.postinit();
FMLCommonHandler.instance().registerCrashCallable( new CrashEnhancement( CrashInfo.INTEGRATION ) );
CommonHelper.proxy.postinit();
AEConfig.instance.save();
+7 -1
View File
@@ -486,16 +486,22 @@ public class Registration
ph.registerNewLayer( "appeng.api.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" );
}
if ( AppEng.instance.isIntegrationEnabled( "MJ" ) )
if ( AppEng.instance.isIntegrationEnabled( "MJ5" ) )
{
ph.registerNewLayer( "appeng.api.parts.layers.LayerIPowerEmitter", "buildcraft.api.power.IPowerEmitter" );
ph.registerNewLayer( "appeng.api.parts.layers.LayerIPowerReceptor", "buildcraft.api.power.IPowerReceptor" );
}
if ( AppEng.instance.isIntegrationEnabled( "MJ6" ) )
{
ph.registerNewLayer( "appeng.api.parts.layers.LayerIBatteryProvider", "buildcraft.api.mj.IBatteryProvider" );
}
if ( AppEng.instance.isIntegrationEnabled( "RF" ) )
ph.registerNewLayer( "appeng.api.parts.layers.LayerIEnergyHandler", "cofh.api.energy.IEnergyHandler" );
FMLCommonHandler.instance().bus().register( TickHandler.instance );
MinecraftForge.EVENT_BUS.register( TickHandler.instance );
MinecraftForge.EVENT_BUS.register( new PartPlacement() );
IGridCacheRegistry gcr = AEApi.instance().registries().gridCache();
+15 -8
View File
@@ -9,8 +9,21 @@ public class CrashEnhancement implements ICrashCallable
final CrashInfo Output;
final String ModVersion = AEConfig.CHANNEL + " " + AEConfig.VERSION + " for Forge " + // WHAT?
net.minecraftforge.common.ForgeVersion.majorVersion + "." // majorVersion
+ net.minecraftforge.common.ForgeVersion.minorVersion + "." // minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion + "." // revisionVersion
+ net.minecraftforge.common.ForgeVersion.buildVersion;
final String IntegrationInfo;
public CrashEnhancement(CrashInfo ci) {
Output = ci;
if ( IntegrationRegistry.instance != null )
IntegrationInfo = IntegrationRegistry.instance.getStatus();
else
IntegrationInfo = "N/A";
}
@Override
@@ -19,15 +32,9 @@ public class CrashEnhancement implements ICrashCallable
switch (Output)
{
case MOD_VERSION:
return AEConfig.CHANNEL + " " + AEConfig.VERSION + " for Forge "
+ net.minecraftforge.common.ForgeVersion.majorVersion + "." // majorVersion
+ net.minecraftforge.common.ForgeVersion.minorVersion + "." // minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion + "." // revisionVersion
+ net.minecraftforge.common.ForgeVersion.buildVersion;
return ModVersion;
case INTEGRATION:
if ( IntegrationRegistry.instance == null )
return "N/A";
return IntegrationRegistry.instance.getStatus();
return IntegrationInfo;
}
return "UNKNOWN_VALUE";
+2 -2
View File
@@ -36,8 +36,8 @@ public abstract class AppEngPacket
public FMLProxyPacket getProxy()
{
if ( p.array().length > 30000 ) // 2k walking room :)
throw new IllegalArgumentException( "Sorry AE2 made a huge packet by accident!" );
if ( p.array().length > 2 * 1024 * 1024 ) // 2k walking room :)
throw new IllegalArgumentException( "Sorry AE2 made a " + p.array().length + " byte packet by accident!" );
return new FMLProxyPacket( p, NetworkHandler.instance.getChannel() );
}
+4 -1
View File
@@ -20,6 +20,7 @@ import appeng.core.sync.packets.PacketMultiPart;
import appeng.core.sync.packets.PacketNEIRecipe;
import appeng.core.sync.packets.PacketNewStorageDimension;
import appeng.core.sync.packets.PacketPartPlacement;
import appeng.core.sync.packets.PacketPartialItem;
import appeng.core.sync.packets.PacketPatternSlot;
import appeng.core.sync.packets.PacketProgressBar;
import appeng.core.sync.packets.PacketSwapSlots;
@@ -70,7 +71,9 @@ public class AppEngPacketHandlerBase
PACKET_PATTERN_SLOT(PacketPatternSlot.class),
PACKET_RECIPE_NEI(PacketNEIRecipe.class);
PACKET_RECIPE_NEI(PacketNEIRecipe.class),
PACKET_PARTIAL_ITEM(PacketPartialItem.class);
final public Class pc;
final public Constructor con;
+6 -1
View File
@@ -13,6 +13,7 @@ import appeng.container.AEBaseContainer;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import appeng.helpers.InventoryAction;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
public class PacketInventoryAction extends AppEngPacket
@@ -40,7 +41,7 @@ public class PacketInventoryAction extends AppEngPacket
if ( sender.openContainer instanceof AEBaseContainer )
{
AEBaseContainer aebc = (AEBaseContainer) sender.openContainer;
aebc.doAction( sender, action, slot, slotItem );
aebc.doAction( sender, action, slot );
}
}
@@ -58,6 +59,10 @@ public class PacketInventoryAction extends AppEngPacket
// api
public PacketInventoryAction(InventoryAction action, int slot, IAEItemStack slotItem) throws IOException {
if ( Platform.isClient() && slotItem != null )
throw new RuntimeException( "invalid packet, client cannot post inv actions with stacks." );
this.action = action;
this.slot = slot;
this.slotItem = slotItem;
@@ -136,7 +136,7 @@ public class PacketMEInventoryUpdate extends AppEngPacket
is.writeToPacket( tmp );
compressFrame.flush();
if ( writtenBytes + tmp.readableBytes() > 30000 )
if ( writtenBytes + tmp.readableBytes() > 2 * 1024 * 1024 ) // 2mb!
throw new BufferOverflowException();
else
{
+63
View File
@@ -0,0 +1,63 @@
package appeng.core.sync.packets;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
import appeng.container.AEBaseContainer;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
public class PacketPartialItem extends AppEngPacket
{
short pageNum;
byte[] data;
// automatic.
public PacketPartialItem(ByteBuf stream) throws IOException {
pageNum = stream.readShort();
stream.readBytes( data = new byte[stream.readableBytes()] );
}
@Override
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player)
{
if ( player.openContainer instanceof AEBaseContainer )
{
((AEBaseContainer) player.openContainer).postPartial( this );
}
}
// api
public PacketPartialItem(int page, int maxPages, byte[] buf) throws IOException {
ByteBuf data = Unpooled.buffer();
pageNum = (short) (page | (maxPages << 8));
this.data = buf;
data.writeInt( getPacketID() );
data.writeShort( pageNum );
data.writeBytes( buf );
configureWrite( data );
}
public int getPageCount()
{
return pageNum >> 8;
}
public int getSize()
{
return data.length;
}
public int write(byte[] buffer, int cursor)
{
System.arraycopy( data, 0, buffer, cursor, data.length );
return cursor + data.length;
}
}