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.DecimalFormat;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@@ -159,6 +161,8 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
@Override
|
@Override
|
||||||
protected void mouseClicked(int xCoord, int yCoord, int btn)
|
protected void mouseClicked(int xCoord, int yCoord, int btn)
|
||||||
{
|
{
|
||||||
|
drag_click.clear();
|
||||||
|
|
||||||
if ( btn == 1 )
|
if ( btn == 1 )
|
||||||
{
|
{
|
||||||
for (Object o : this.buttonList)
|
for (Object o : this.buttonList)
|
||||||
@@ -171,6 +175,7 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.mouseClicked( xCoord, yCoord, btn );
|
super.mouseClicked( xCoord, yCoord, btn );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,6 +184,9 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
ItemStack dbl_whichItem;
|
ItemStack dbl_whichItem;
|
||||||
Slot bl_clicked;
|
Slot bl_clicked;
|
||||||
|
|
||||||
|
// dragy
|
||||||
|
Set<Slot> drag_click = new HashSet();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleMouseClick(Slot slot, int slotIdx, int ctrlDown, int key)
|
protected void handleMouseClick(Slot slot, int slotIdx, int ctrlDown, int key)
|
||||||
{
|
{
|
||||||
@@ -189,6 +197,9 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
InventoryAction action = null;
|
InventoryAction action = null;
|
||||||
action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACESINGLE : InventoryAction.PICKUP_OR_SETDOWN;
|
action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACESINGLE : InventoryAction.PICKUP_OR_SETDOWN;
|
||||||
|
|
||||||
|
if ( drag_click.size() > 1 )
|
||||||
|
return;
|
||||||
|
|
||||||
if ( action != null )
|
if ( action != null )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -418,12 +429,17 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
|
|
||||||
if ( slot instanceof SlotFake && itemstack != null )
|
if ( slot instanceof SlotFake && itemstack != null )
|
||||||
{
|
{
|
||||||
if ( c == 0 )
|
drag_click.add( slot );
|
||||||
|
if ( drag_click.size() > 1 )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PacketInventoryAction p = new PacketInventoryAction( InventoryAction.PICKUP_OR_SETDOWN, slot.slotNumber, 0 );
|
for (Slot dr : drag_click)
|
||||||
NetworkHandler.instance.sendToServer( p );
|
{
|
||||||
|
PacketInventoryAction p = new PacketInventoryAction( c == 0 ? InventoryAction.PICKUP_OR_SETDOWN : InventoryAction.PLACE_SINGLE,
|
||||||
|
dr.slotNumber, 0 );
|
||||||
|
NetworkHandler.instance.sendToServer( p );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -676,7 +676,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
else
|
else
|
||||||
addSlotToContainer( new SlotPlayerHotBar( inventoryPlayer, i, 8 + i * 18 + offset_x, 58 + offset_y ) );
|
addSlotToContainer( new SlotPlayerHotBar( inventoryPlayer, i, 8 + i * 18 + offset_x, 58 + offset_y ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 9; j++)
|
for (int j = 0; j < 9; j++)
|
||||||
@@ -731,6 +731,16 @@ public abstract class AEBaseContainer extends Container
|
|||||||
else
|
else
|
||||||
s.putStack( hand.copy() );
|
s.putStack( hand.copy() );
|
||||||
|
|
||||||
|
break;
|
||||||
|
case PLACE_SINGLE:
|
||||||
|
|
||||||
|
if ( hand != null )
|
||||||
|
{
|
||||||
|
ItemStack is = hand.copy();
|
||||||
|
is.stackSize = 1;
|
||||||
|
s.putStack( is );
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SPLIT_OR_PLACESINGLE:
|
case SPLIT_OR_PLACESINGLE:
|
||||||
|
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ public enum InventoryAction
|
|||||||
CRAFT_STACK, CRAFT_ITEM, CRAFT_SHIFT,
|
CRAFT_STACK, CRAFT_ITEM, CRAFT_SHIFT,
|
||||||
|
|
||||||
// extra...
|
// extra...
|
||||||
MOVE_REGION, PICKUP_SINGLE, UPDATE_HAND, ROLLUP, ROLLDOWN, AUTOCRAFT
|
MOVE_REGION, PICKUP_SINGLE, UPDATE_HAND, ROLLUP, ROLLDOWN, AUTOCRAFT, PLACE_SINGLE
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user