Fixed Bug with Terminal Scroll Bar and Searching.
Switched to Reactive Packet size protection.
This commit is contained in:
parent
3343329ff9
commit
c3549e483c
3 changed files with 20 additions and 6 deletions
|
@ -167,6 +167,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource
|
||||||
{
|
{
|
||||||
repo.searchString = this.searchField.getText();
|
repo.searchString = this.searchField.getText();
|
||||||
repo.updateView();
|
repo.updateView();
|
||||||
|
setScrollBar();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package appeng.container.implementations;
|
package appeng.container.implementations;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.BufferOverflowException;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
@ -136,15 +137,19 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito
|
||||||
|
|
||||||
for (IAEItemStack send : monitorCache)
|
for (IAEItemStack send : monitorCache)
|
||||||
{
|
{
|
||||||
if ( piu.getLength() > 20000 )
|
try
|
||||||
|
{
|
||||||
|
piu.appendItem( send );
|
||||||
|
}
|
||||||
|
catch (BufferOverflowException boe)
|
||||||
{
|
{
|
||||||
Packet p = piu.getPacket();
|
Packet p = piu.getPacket();
|
||||||
PacketDispatcher.sendPacketToPlayer( p, (Player) c );
|
PacketDispatcher.sendPacketToPlayer( p, (Player) c );
|
||||||
piu = new PacketMEInventoryUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
piu = new PacketMEInventoryUpdate();
|
||||||
piu.appendItem( send );
|
piu.appendItem( send );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Packet p = piu.getPacket();
|
Packet p = piu.getPacket();
|
||||||
PacketDispatcher.sendPacketToPlayer( p, (Player) c );
|
PacketDispatcher.sendPacketToPlayer( p, (Player) c );
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.BufferOverflowException;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -26,6 +27,7 @@ public class PacketMEInventoryUpdate extends AppEngPacket
|
||||||
// output...
|
// output...
|
||||||
final private ByteArrayOutputStream bytes;
|
final private ByteArrayOutputStream bytes;
|
||||||
final private DataOutputStream data;
|
final private DataOutputStream data;
|
||||||
|
int lastSize = 0;
|
||||||
boolean empty = true;
|
boolean empty = true;
|
||||||
|
|
||||||
// input.
|
// input.
|
||||||
|
@ -59,7 +61,9 @@ public class PacketMEInventoryUpdate extends AppEngPacket
|
||||||
public Packet250CustomPayload getPacket()
|
public Packet250CustomPayload getPacket()
|
||||||
{
|
{
|
||||||
isChunkDataPacket = false;
|
isChunkDataPacket = false;
|
||||||
configureWrite( bytes.toByteArray() );
|
byte[] dataOut = new byte[lastSize];
|
||||||
|
System.arraycopy( bytes.toByteArray(), 0, dataOut, 0, lastSize );
|
||||||
|
configureWrite( dataOut );
|
||||||
return super.getPacket();
|
return super.getPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,10 +75,14 @@ public class PacketMEInventoryUpdate extends AppEngPacket
|
||||||
data.writeInt( getPacketID() );
|
data.writeInt( getPacketID() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void appendItem(IAEItemStack is) throws IOException
|
public void appendItem(IAEItemStack is) throws IOException, BufferOverflowException
|
||||||
{
|
{
|
||||||
is.writeToPacket( data );
|
is.writeToPacket( data );
|
||||||
empty = false;
|
empty = false;
|
||||||
|
if ( bytes.size() > 20000 )
|
||||||
|
throw new BufferOverflowException();
|
||||||
|
else
|
||||||
|
lastSize = bytes.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLength()
|
public int getLength()
|
||||||
|
|
Loading…
Reference in a new issue