Fixed Bug: #0260 - Hotbar Keys + Inscriber
This commit is contained in:
@@ -20,6 +20,7 @@ import appeng.core.sync.packets.PacketMultiPart;
|
||||
import appeng.core.sync.packets.PacketNewStorageDimension;
|
||||
import appeng.core.sync.packets.PacketPartPlacement;
|
||||
import appeng.core.sync.packets.PacketProgressBar;
|
||||
import appeng.core.sync.packets.PacketSwapSlots;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.core.sync.packets.PacketTransitionEffect;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
@@ -61,7 +62,9 @@ public class AppEngPacketHandlerBase
|
||||
|
||||
PACKET_NEW_STORAGE_DIMENSION(PacketNewStorageDimension.class),
|
||||
|
||||
PACKET_SWITCH_GUIS(PacketSwitchGuis.class);
|
||||
PACKET_SWITCH_GUIS(PacketSwitchGuis.class),
|
||||
|
||||
PACKET_SWAP_SLOTS(PacketSwapSlots.class);
|
||||
|
||||
final public Class pc;
|
||||
final public Constructor con;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package appeng.core.sync.packets;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
|
||||
public class PacketSwapSlots extends AppEngPacket
|
||||
{
|
||||
|
||||
int slotA, slotB;
|
||||
|
||||
// automatic.
|
||||
public PacketSwapSlots(ByteBuf stream) throws IOException {
|
||||
slotA = stream.readInt();
|
||||
slotB = stream.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player)
|
||||
{
|
||||
if ( player != null && player.openContainer instanceof AEBaseContainer )
|
||||
{
|
||||
((AEBaseContainer) player.openContainer).swapSlotContents( slotA, slotB );
|
||||
}
|
||||
}
|
||||
|
||||
// api
|
||||
public PacketSwapSlots(int slotA, int slotB) throws IOException {
|
||||
|
||||
ByteBuf data = Unpooled.buffer();
|
||||
|
||||
data.writeInt( getPacketID() );
|
||||
data.writeInt( this.slotA = slotA );
|
||||
data.writeInt( this.slotB = slotB );
|
||||
|
||||
configureWrite( data );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user