2012-09-21 22:13:21 +02:00
|
|
|
package ee3.common.network;
|
|
|
|
|
|
|
|
import java.io.DataInputStream;
|
|
|
|
import java.io.DataOutputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import cpw.mods.fml.common.network.Player;
|
2012-10-24 04:01:41 +02:00
|
|
|
import cpw.mods.fml.common.registry.LanguageRegistry;
|
2012-09-24 21:58:15 +02:00
|
|
|
import ee3.common.EquivalentExchange3;
|
2012-11-26 21:59:26 +01:00
|
|
|
import ee3.common.item.IKeyBound;
|
2012-10-29 04:16:32 +01:00
|
|
|
import ee3.common.item.ITransmutationStone;
|
2012-09-24 21:58:15 +02:00
|
|
|
import ee3.common.lib.GuiIds;
|
|
|
|
import ee3.common.lib.ItemIds;
|
|
|
|
import ee3.common.lib.Reference;
|
2012-09-21 22:13:21 +02:00
|
|
|
|
2012-09-24 21:58:15 +02:00
|
|
|
import net.minecraft.src.EntityPlayer;
|
2012-10-22 04:39:43 +02:00
|
|
|
import net.minecraft.src.INetworkManager;
|
2012-09-24 21:58:15 +02:00
|
|
|
import net.minecraft.src.Packet250CustomPayload;
|
2012-09-21 22:13:21 +02:00
|
|
|
|
2012-10-27 23:41:02 +02:00
|
|
|
/**
|
|
|
|
* PacketKeyPressed
|
|
|
|
*
|
|
|
|
* Packet specifically for notifying the server of client key pressed events
|
|
|
|
*
|
|
|
|
* @author pahimar
|
|
|
|
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
|
|
|
|
*
|
|
|
|
*/
|
2012-09-21 22:13:21 +02:00
|
|
|
public class PacketKeyPressed extends PacketEE {
|
|
|
|
|
2012-09-24 21:58:15 +02:00
|
|
|
public String key;
|
2012-09-21 22:13:21 +02:00
|
|
|
|
|
|
|
public PacketKeyPressed() {
|
|
|
|
super(PacketTypeHandler.KEY, false);
|
|
|
|
}
|
2012-09-24 21:58:15 +02:00
|
|
|
|
|
|
|
public PacketKeyPressed(String key) {
|
|
|
|
super(PacketTypeHandler.KEY, false);
|
|
|
|
this.key = key;
|
|
|
|
}
|
2012-09-21 22:13:21 +02:00
|
|
|
|
|
|
|
public void writeData(DataOutputStream data) throws IOException {
|
2012-09-24 21:58:15 +02:00
|
|
|
data.writeUTF(key);
|
2012-09-21 22:13:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void readData(DataInputStream data) throws IOException {
|
2012-09-24 21:58:15 +02:00
|
|
|
this.key = data.readUTF();
|
2012-09-21 22:13:21 +02:00
|
|
|
}
|
|
|
|
|
2012-09-24 21:58:15 +02:00
|
|
|
public void setKey(String key) {
|
2012-09-21 22:13:21 +02:00
|
|
|
this.key = key;
|
|
|
|
}
|
|
|
|
|
2012-10-22 04:39:43 +02:00
|
|
|
public void execute(INetworkManager manager, Player player) {
|
2012-09-24 21:58:15 +02:00
|
|
|
EntityPlayer thePlayer = (EntityPlayer) player;
|
2012-11-30 16:47:18 +01:00
|
|
|
|
2012-11-26 21:59:26 +01:00
|
|
|
if ((thePlayer.getCurrentEquippedItem() != null) && (thePlayer.getCurrentEquippedItem().getItem() instanceof IKeyBound)) {
|
2012-11-30 20:03:36 +01:00
|
|
|
((IKeyBound) thePlayer.getCurrentEquippedItem().getItem()).doKeyBindingAction(thePlayer, thePlayer.getCurrentEquippedItem(), this.key);
|
2012-11-26 21:59:26 +01:00
|
|
|
}
|
2012-09-21 22:13:21 +02:00
|
|
|
}
|
|
|
|
}
|