Fixed Fake Slot Dragging Behavior ( Fixed Bug: #1108 )
This commit is contained in:
@@ -4,9 +4,11 @@ import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -159,6 +161,8 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
@Override
|
||||
protected void mouseClicked(int xCoord, int yCoord, int btn)
|
||||
{
|
||||
drag_click.clear();
|
||||
|
||||
if ( btn == 1 )
|
||||
{
|
||||
for (Object o : this.buttonList)
|
||||
@@ -171,6 +175,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.mouseClicked( xCoord, yCoord, btn );
|
||||
}
|
||||
|
||||
@@ -179,6 +184,9 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
ItemStack dbl_whichItem;
|
||||
Slot bl_clicked;
|
||||
|
||||
// dragy
|
||||
Set<Slot> drag_click = new HashSet();
|
||||
|
||||
@Override
|
||||
protected void handleMouseClick(Slot slot, int slotIdx, int ctrlDown, int key)
|
||||
{
|
||||
@@ -189,6 +197,9 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
InventoryAction action = null;
|
||||
action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACESINGLE : InventoryAction.PICKUP_OR_SETDOWN;
|
||||
|
||||
if ( drag_click.size() > 1 )
|
||||
return;
|
||||
|
||||
if ( action != null )
|
||||
{
|
||||
try
|
||||
@@ -418,12 +429,17 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
|
||||
if ( slot instanceof SlotFake && itemstack != null )
|
||||
{
|
||||
if ( c == 0 )
|
||||
drag_click.add( slot );
|
||||
if ( drag_click.size() > 1 )
|
||||
{
|
||||
try
|
||||
{
|
||||
PacketInventoryAction p = new PacketInventoryAction( InventoryAction.PICKUP_OR_SETDOWN, slot.slotNumber, 0 );
|
||||
NetworkHandler.instance.sendToServer( p );
|
||||
for (Slot dr : drag_click)
|
||||
{
|
||||
PacketInventoryAction p = new PacketInventoryAction( c == 0 ? InventoryAction.PICKUP_OR_SETDOWN : InventoryAction.PLACE_SINGLE,
|
||||
dr.slotNumber, 0 );
|
||||
NetworkHandler.instance.sendToServer( p );
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user