Fixed Fake Slot Dragging Behavior ( Fixed Bug: #1108 )
This commit is contained in:
parent
d9060b7ca5
commit
68cc7fd5f7
3 changed files with 31 additions and 5 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -676,7 +676,7 @@ public abstract class AEBaseContainer extends Container
|
|||
else
|
||||
addSlotToContainer( new SlotPlayerHotBar( inventoryPlayer, i, 8 + i * 18 + offset_x, 58 + offset_y ) );
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int j = 0; j < 9; j++)
|
||||
|
@ -731,6 +731,16 @@ public abstract class AEBaseContainer extends Container
|
|||
else
|
||||
s.putStack( hand.copy() );
|
||||
|
||||
break;
|
||||
case PLACE_SINGLE:
|
||||
|
||||
if ( hand != null )
|
||||
{
|
||||
ItemStack is = hand.copy();
|
||||
is.stackSize = 1;
|
||||
s.putStack( is );
|
||||
}
|
||||
|
||||
break;
|
||||
case SPLIT_OR_PLACESINGLE:
|
||||
|
||||
|
|
|
@ -9,5 +9,5 @@ public enum InventoryAction
|
|||
CRAFT_STACK, CRAFT_ITEM, CRAFT_SHIFT,
|
||||
|
||||
// extra...
|
||||
MOVE_REGION, PICKUP_SINGLE, UPDATE_HAND, ROLLUP, ROLLDOWN, AUTOCRAFT
|
||||
MOVE_REGION, PICKUP_SINGLE, UPDATE_HAND, ROLLUP, ROLLDOWN, AUTOCRAFT, PLACE_SINGLE
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue