From 77a47df13bb4ce4a605d3a241cdffe8914faefb0 Mon Sep 17 00:00:00 2001 From: Kino Date: Sat, 9 Dec 2017 16:10:52 -0500 Subject: [PATCH] Aether packet changes --- .../dialogue/server/GuiServerDialogue.java | 2 +- .../{dialogue => }/DialogueClickedEvent.java | 2 +- .../networking/AetherNetworkingManager.java | 6 -- .../packets/PacketDialogueClicked.java | 2 +- .../packets/PacketDisplayDialogue.java | 12 ++++ .../networking/packets/PacketGameType.java | 53 ------------------ .../packets/PacketInitiateValkyrieFight.java | 1 - .../networking/packets/PacketSendPoison.java | 55 ------------------- 8 files changed, 15 insertions(+), 118 deletions(-) rename src/main/java/com/legacy/aether/events/{dialogue => }/DialogueClickedEvent.java (93%) delete mode 100644 src/main/java/com/legacy/aether/networking/packets/PacketGameType.java delete mode 100644 src/main/java/com/legacy/aether/networking/packets/PacketSendPoison.java diff --git a/src/main/java/com/legacy/aether/client/gui/dialogue/server/GuiServerDialogue.java b/src/main/java/com/legacy/aether/client/gui/dialogue/server/GuiServerDialogue.java index 4367f05..0609671 100644 --- a/src/main/java/com/legacy/aether/client/gui/dialogue/server/GuiServerDialogue.java +++ b/src/main/java/com/legacy/aether/client/gui/dialogue/server/GuiServerDialogue.java @@ -26,7 +26,7 @@ public class GuiServerDialogue extends GuiDialogue dialogueOptions.add(new DialogueOption(dialogueForOption)); } - this.addDialogueOptions((DialogueOption[]) dialogueOptions.toArray()); + this.addDialogueOptions(dialogueOptions.toArray(new DialogueOption[] {})); } @Override diff --git a/src/main/java/com/legacy/aether/events/dialogue/DialogueClickedEvent.java b/src/main/java/com/legacy/aether/events/DialogueClickedEvent.java similarity index 93% rename from src/main/java/com/legacy/aether/events/dialogue/DialogueClickedEvent.java rename to src/main/java/com/legacy/aether/events/DialogueClickedEvent.java index 02889db..1c2a95c 100644 --- a/src/main/java/com/legacy/aether/events/dialogue/DialogueClickedEvent.java +++ b/src/main/java/com/legacy/aether/events/DialogueClickedEvent.java @@ -1,4 +1,4 @@ -package com.legacy.aether.events.dialogue; +package com.legacy.aether.events; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.fml.common.eventhandler.Event; diff --git a/src/main/java/com/legacy/aether/networking/AetherNetworkingManager.java b/src/main/java/com/legacy/aether/networking/AetherNetworkingManager.java index b33060b..ae09f17 100644 --- a/src/main/java/com/legacy/aether/networking/AetherNetworkingManager.java +++ b/src/main/java/com/legacy/aether/networking/AetherNetworkingManager.java @@ -12,11 +12,9 @@ import com.legacy.aether.networking.packets.PacketAccessory; import com.legacy.aether.networking.packets.PacketAchievement; import com.legacy.aether.networking.packets.PacketDialogueClicked; import com.legacy.aether.networking.packets.PacketDisplayDialogue; -import com.legacy.aether.networking.packets.PacketGameType; import com.legacy.aether.networking.packets.PacketInitiateValkyrieFight; import com.legacy.aether.networking.packets.PacketOpenContainer; import com.legacy.aether.networking.packets.PacketPerkChanged; -import com.legacy.aether.networking.packets.PacketSendPoison; public class AetherNetworkingManager { @@ -33,10 +31,6 @@ public class AetherNetworkingManager INSTANCE.registerMessage(PacketAccessory.class, PacketAccessory.class, discriminant++, Side.CLIENT); - INSTANCE.registerMessage(PacketSendPoison.class, PacketSendPoison.class, discriminant++, Side.CLIENT); - - INSTANCE.registerMessage(PacketGameType.class, PacketGameType.class, discriminant++, Side.SERVER); - INSTANCE.registerMessage(PacketInitiateValkyrieFight.class, PacketInitiateValkyrieFight.class, discriminant++, Side.SERVER); INSTANCE.registerMessage(PacketDisplayDialogue.class, PacketDisplayDialogue.class, discriminant++, Side.CLIENT); diff --git a/src/main/java/com/legacy/aether/networking/packets/PacketDialogueClicked.java b/src/main/java/com/legacy/aether/networking/packets/PacketDialogueClicked.java index e73f083..b7f8b42 100644 --- a/src/main/java/com/legacy/aether/networking/packets/PacketDialogueClicked.java +++ b/src/main/java/com/legacy/aether/networking/packets/PacketDialogueClicked.java @@ -1,6 +1,6 @@ package com.legacy.aether.networking.packets; -import com.legacy.aether.events.dialogue.DialogueClickedEvent; +import com.legacy.aether.events.DialogueClickedEvent; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/com/legacy/aether/networking/packets/PacketDisplayDialogue.java b/src/main/java/com/legacy/aether/networking/packets/PacketDisplayDialogue.java index 92e813c..387603d 100644 --- a/src/main/java/com/legacy/aether/networking/packets/PacketDisplayDialogue.java +++ b/src/main/java/com/legacy/aether/networking/packets/PacketDisplayDialogue.java @@ -1,6 +1,7 @@ package com.legacy.aether.networking.packets; import java.util.ArrayList; +import java.util.Arrays; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; @@ -19,6 +20,17 @@ public class PacketDisplayDialogue extends AetherPacket } + public PacketDisplayDialogue(String dialogueName, String dialogue, String... dialogueText) + { + this(dialogueName, dialogue, (ArrayList) null); + + ArrayList array = new ArrayList(); + + array.addAll(Arrays.asList(dialogueText)); + + this.dialogueText = array; + } + public PacketDisplayDialogue(String dialogueName, String dialogue, ArrayList dialogueText) { this.dialogueName = dialogueName; diff --git a/src/main/java/com/legacy/aether/networking/packets/PacketGameType.java b/src/main/java/com/legacy/aether/networking/packets/PacketGameType.java deleted file mode 100644 index c509ded..0000000 --- a/src/main/java/com/legacy/aether/networking/packets/PacketGameType.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.legacy.aether.networking.packets; - -import io.netty.buffer.ByteBuf; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.GameType; - -public class PacketGameType extends AetherPacket -{ - - public GameType gameType; - - public PacketGameType() - { - - } - - public PacketGameType(GameType gameType) - { - this.gameType = gameType; - } - - @Override - public void fromBytes(ByteBuf buf) - { - this.gameType = GameType.getByID(buf.readInt()); - } - - @Override - public void toBytes(ByteBuf buf) - { - buf.writeInt(this.gameType.getID()); - } - - @Override - public void handleClient(PacketGameType message, EntityPlayer player) - { - - } - - @Override - public void handleServer(PacketGameType message, EntityPlayer player) - { - try - { - player.setGameType(message.gameType); - } - catch(Exception e) - { - - } - } - -} diff --git a/src/main/java/com/legacy/aether/networking/packets/PacketInitiateValkyrieFight.java b/src/main/java/com/legacy/aether/networking/packets/PacketInitiateValkyrieFight.java index 0f7413a..29f5b70 100644 --- a/src/main/java/com/legacy/aether/networking/packets/PacketInitiateValkyrieFight.java +++ b/src/main/java/com/legacy/aether/networking/packets/PacketInitiateValkyrieFight.java @@ -52,7 +52,6 @@ public class PacketInitiateValkyrieFight extends AetherPacket -{ - - private int entityID; - - public PacketSendPoison() - { - - } - - public PacketSendPoison(EntityPlayer thePlayer) - { - this.entityID = thePlayer.getEntityId(); - } - - @Override - public void fromBytes(ByteBuf buf) - { - this.entityID = buf.readInt(); - } - - @Override - public void toBytes(ByteBuf buf) - { - buf.writeInt(this.entityID); - } - - @Override - public void handleClient(PacketSendPoison message, EntityPlayer player) - { - if (player != null && player.worldObj != null) - { - EntityPlayer parent = (EntityPlayer) player.worldObj.getEntityByID(message.entityID); - - if (parent != null) - { - PlayerAether.get(parent).afflictPoison(); - } - } - } - - @Override - public void handleServer(PacketSendPoison message, EntityPlayer player) - { - - } - -} \ No newline at end of file