Fixed Bug: #0260 - Hotbar Keys + Inscriber

This commit is contained in:
AlgorithmX2
2014-03-29 18:36:37 -05:00
parent 740e9e27bf
commit 794177b8d2
6 changed files with 175 additions and 12 deletions
+43
View File
@@ -46,8 +46,10 @@ import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketInventoryAction;
import appeng.core.sync.packets.PacketSwapSlots;
import appeng.helpers.InventoryAction;
import appeng.util.Platform;
import cpw.mods.fml.relauncher.ReflectionHelper;
public abstract class AEBaseGui extends GuiContainer
{
@@ -271,6 +273,47 @@ public abstract class AEBaseGui extends GuiContainer
super.handleMouseClick( slot, slotIdx, ctrlDown, key );
}
@Override
protected boolean checkHotbarKeys(int p_146983_1_)
{
Slot theSlot = ReflectionHelper.getPrivateValue( GuiContainer.class, this, "theSlot" );
if ( this.mc.thePlayer.inventory.getItemStack() == null && theSlot != null )
{
for (int j = 0; j < 9; ++j)
{
if ( p_146983_1_ == this.mc.gameSettings.keyBindsHotbar[j].getKeyCode() )
{
if ( theSlot.getSlotStackLimit() == 64 )
{
this.handleMouseClick( theSlot, theSlot.slotNumber, j, 2 );
return true;
}
else
{
try
{
for (Slot s : (List<Slot>) inventorySlots.inventorySlots)
{
if ( s.getSlotIndex() == j && s.inventory == ((AEBaseContainer) inventorySlots).getPlayerInv() )
{
NetworkHandler.instance.sendToServer( new PacketSwapSlots( s.slotNumber, theSlot.slotNumber ) );
return true;
}
}
}
catch (IOException e)
{
AELog.error( e );
}
}
}
}
}
return false;
}
@Override
public void drawScreen(int mouse_x, int mouse_y, float btn)
{