Aether packet changes

This commit is contained in:
Kino 2017-12-09 16:10:52 -05:00
parent a610f58a17
commit 77a47df13b
8 changed files with 15 additions and 118 deletions

View file

@ -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

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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<PacketDisplayDialogue>
}
public PacketDisplayDialogue(String dialogueName, String dialogue, String... dialogueText)
{
this(dialogueName, dialogue, (ArrayList<String>) null);
ArrayList<String> array = new ArrayList<String>();
array.addAll(Arrays.asList(dialogueText));
this.dialogueText = array;
}
public PacketDisplayDialogue(String dialogueName, String dialogue, ArrayList<String> dialogueText)
{
this.dialogueName = dialogueName;

View file

@ -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<PacketGameType>
{
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)
{
}
}
}

View file

@ -52,7 +52,6 @@ public class PacketInitiateValkyrieFight extends AetherPacket<PacketInitiateValk
if (entity instanceof EntityValkyrieQueen)
{
System.out.println("rawr");
((EntityValkyrieQueen)entity).setBossReady(true);
PlayerAether.get(player).setCurrentBoss((EntityValkyrieQueen)entity);
}

View file

@ -1,55 +0,0 @@
package com.legacy.aether.networking.packets;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import com.legacy.aether.player.PlayerAether;
public class PacketSendPoison extends AetherPacket<PacketSendPoison>
{
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)
{
}
}