That's one heck of a commit you've got there...
I may have got a bit behind with version control. A lot behind, in fact. Maybe I'll go back and split this sometime - then again, I probably won't. But hey, at least it's here!
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
package electroblob.wizardry.packet;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.data.WizardData;
|
||||
import electroblob.wizardry.packet.PacketCastContinuousSpell.Message;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
|
||||
/**
|
||||
* <b>[Server -> Client]</b> This packet is sent when the /cast command is used with a continuous spell, in order to
|
||||
* sync the relevant variables in {@link electroblob.wizardry.WizardData WizardData}.
|
||||
* sync the relevant variables in {@link WizardData WizardData}.
|
||||
*/
|
||||
public class PacketCastContinuousSpell implements IMessageHandler<Message, IMessage> {
|
||||
|
||||
@@ -21,12 +24,7 @@ public class PacketCastContinuousSpell implements IMessageHandler<Message, IMess
|
||||
if(ctx.side.isClient()){
|
||||
// Using a fully qualified name is a good course of action here; we don't really want to clutter the proxy
|
||||
// methods any more than necessary.
|
||||
net.minecraft.client.Minecraft.getMinecraft().addScheduledTask(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
Wizardry.proxy.handleCastContinuousSpellPacket(message);
|
||||
}
|
||||
});
|
||||
net.minecraft.client.Minecraft.getMinecraft().addScheduledTask(() -> Wizardry.proxy.handleCastContinuousSpellPacket(message));
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -34,24 +32,23 @@ public class PacketCastContinuousSpell implements IMessageHandler<Message, IMess
|
||||
|
||||
public static class Message implements IMessage {
|
||||
|
||||
// Note that range and blast multipliers are the only two that affect particle spawning, so they are the
|
||||
// only two that need to be sent.
|
||||
|
||||
/** EntityID of the caster */
|
||||
public int casterID;
|
||||
/** ID of the spell being cast */
|
||||
public int spellID;
|
||||
/** SpellModifiers for the spell */
|
||||
public SpellModifiers modifiers;
|
||||
/** Number of ticks to cast the spell for, or -1 for non-continuous spells */
|
||||
public int duration;
|
||||
|
||||
// This constructor is required otherwise you'll get errors (used somewhere in fml through reflection)
|
||||
public Message(){
|
||||
}
|
||||
public Message(){}
|
||||
|
||||
public Message(int casterID, int spellID, SpellModifiers modifiers){
|
||||
this.casterID = casterID;
|
||||
this.spellID = spellID;
|
||||
public Message(EntityPlayer caster, Spell spell, SpellModifiers modifiers, int duration){
|
||||
this.casterID = caster.getEntityId();
|
||||
this.spellID = spell.networkID();
|
||||
this.modifiers = modifiers;
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,6 +58,7 @@ public class PacketCastContinuousSpell implements IMessageHandler<Message, IMess
|
||||
this.spellID = buf.readInt();
|
||||
this.modifiers = new SpellModifiers();
|
||||
modifiers.read(buf);
|
||||
this.duration = buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,6 +66,7 @@ public class PacketCastContinuousSpell implements IMessageHandler<Message, IMess
|
||||
buf.writeInt(casterID);
|
||||
buf.writeInt(spellID);
|
||||
this.modifiers.write(buf);
|
||||
buf.writeInt(duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user