Initial 1.11.2 update

This commit is contained in:
Electroblob
2018-02-07 21:15:50 +00:00
parent 67f6be0671
commit 3df5597dcc
368 changed files with 17234 additions and 15082 deletions
@@ -8,8 +8,10 @@ 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}. */
/**
* <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}.
*/
public class PacketCastContinuousSpell implements IMessageHandler<Message, IMessage> {
@Override
@@ -21,7 +23,7 @@ public class PacketCastContinuousSpell implements IMessageHandler<Message, IMess
// methods any more than necessary.
net.minecraft.client.Minecraft.getMinecraft().addScheduledTask(new Runnable(){
@Override
public void run() {
public void run(){
Wizardry.proxy.handleCastContinuousSpellPacket(message);
}
});
@@ -31,7 +33,7 @@ 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.
@@ -43,7 +45,8 @@ public class PacketCastContinuousSpell implements IMessageHandler<Message, IMess
public SpellModifiers modifiers;
// 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;
@@ -10,16 +10,18 @@ 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 a spell is cast by a player and returns true, and is sent to other
/**
* <b>[Server -> Client]</b> This packet is sent when a spell is cast by a player and returns true, and is sent to other
* clients so they can spawn the particles themselves. What sending this packet effectively does is make the
* {@link Item#onItemRightClick} method client-consistent just for the item that sends it. Interestingly,
* {@link Item#onUsingTick} is client-consistent already, so continuous spells don't need to send packets from there
* (this is probably something to do with eating particles or usage actions). */
* (this is probably something to do with eating particles or usage actions).
*/
public class PacketCastSpell implements IMessageHandler<Message, IMessage> {
@Override
public IMessage onMessage(Message message, MessageContext ctx){
// Just to make sure that the side is correct
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
@@ -44,13 +46,14 @@ public class PacketCastSpell implements IMessageHandler<Message, IMessage> {
/** SpellModifiers for the spell */
public SpellModifiers modifiers;
/** The hand that is holding the itemstack used to cast the spell. Defaults to MAIN_HAND. */
public EnumHand hand;
public EnumHand hand;
// This constructor is required otherwise you'll get errors (used somewhere in fml through reflection)
public Message(){}
public Message(){
}
public Message(int casterID, EnumHand hand, int spellID, SpellModifiers modifiers){
this.casterID = casterID;
this.spellID = spellID;
this.modifiers = modifiers;
@@ -59,7 +62,7 @@ public class PacketCastSpell implements IMessageHandler<Message, IMessage> {
@Override
public void fromBytes(ByteBuf buf){
// The order is important
this.casterID = buf.readInt();
this.spellID = buf.readInt();
@@ -70,7 +73,7 @@ public class PacketCastSpell implements IMessageHandler<Message, IMessage> {
@Override
public void toBytes(ByteBuf buf){
buf.writeInt(casterID);
buf.writeInt(spellID);
this.modifiers.write(buf);
@@ -12,13 +12,14 @@ 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 a player casts the clairvoyance spell to allow pathing to chunks
* outside the render distance. */
/**
* <b>[Server -> Client]</b> This packet is sent when a player casts the clairvoyance spell to allow pathing to chunks
* outside the render distance.
*/
public class PacketClairvoyance implements IMessageHandler<Message, IMessage> {
@Override
public IMessage onMessage(Message message, MessageContext ctx)
{
public IMessage onMessage(Message message, MessageContext ctx){
// Just to make sure that the side is correct
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
@@ -38,40 +39,41 @@ public class PacketClairvoyance implements IMessageHandler<Message, IMessage> {
public Path path;
public float durationMultiplier;
// This constructor is required otherwise you'll get errors (used somewhere in fml through reflection)
public Message() {}
public Message(){
}
public Message(Path path, float durationMultiplier){
this.path = path;
this.durationMultiplier = durationMultiplier;
}
@Override
public void fromBytes(ByteBuf buf){
// The order is important
this.durationMultiplier = buf.readFloat();
List<PathPoint> points = new ArrayList<PathPoint>();
while(buf.isReadable()){
points.add(new PathPoint(buf.readInt(), buf.readInt(), buf.readInt()));
}
this.path = new Path(points.toArray(new PathPoint[0]));
}
@Override
public void toBytes(ByteBuf buf){
buf.writeFloat(durationMultiplier);
for(int i=0; i<path.getCurrentPathLength(); i++){
for(int i = 0; i < path.getCurrentPathLength(); i++){
PathPoint point = path.getPathPointFromIndex(i);
buf.writeInt(point.xCoord);
buf.writeInt(point.yCoord);
buf.writeInt(point.zCoord);
@@ -24,7 +24,7 @@ public class PacketControlInput implements IMessageHandler<Message, IMessage> {
player.getServerWorld().addScheduledTask(new Runnable(){
public void run() {
public void run(){
ItemStack wand = player.getHeldItemMainhand();
@@ -62,17 +62,14 @@ public class PacketControlInput implements IMessageHandler<Message, IMessage> {
break;
}
}
}
);
});
}
return null;
}
public static enum ControlType {
APPLY_BUTTON,
NEXT_SPELL_KEY,
PREVIOUS_SPELL_KEY;
APPLY_BUTTON, NEXT_SPELL_KEY, PREVIOUS_SPELL_KEY;
}
public static class Message implements IMessage {
@@ -80,7 +77,8 @@ public class PacketControlInput implements IMessageHandler<Message, IMessage> {
private ControlType controlType;
// This constructor is required otherwise you'll get errors (used somewhere in fml through reflection)
public Message() {}
public Message(){
}
public Message(ControlType type){
this.controlType = type;
@@ -11,13 +11,14 @@ 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 each time a player joins a world to synchronise the client-side spell
* glyph names with the server-side ones. */
/**
* <b>[Server -> Client]</b> This packet is sent each time a player joins a world to synchronise the client-side spell
* glyph names with the server-side ones.
*/
public class PacketGlyphData implements IMessageHandler<Message, IMessage> {
@Override
public IMessage onMessage(Message message, MessageContext ctx)
{
public IMessage onMessage(Message message, MessageContext ctx){
// Just to make sure that the side is correct
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
@@ -41,10 +42,10 @@ public class PacketGlyphData implements IMessageHandler<Message, IMessage> {
public List<String> descriptions;
// This constructor is required otherwise you'll get errors (used somewhere in fml through reflection)
public Message() {}
public Message(){
}
public Message(List<String> names, List<String> descriptions)
{
public Message(List<String> names, List<String> descriptions){
this.names = names;
this.descriptions = descriptions;
}
@@ -61,7 +62,7 @@ public class PacketGlyphData implements IMessageHandler<Message, IMessage> {
@Override
public void toBytes(ByteBuf buf){
for(int i=0; i<names.size(); i++){
for(int i = 0; i < names.size(); i++){
ByteBufUtils.writeUTF8String(buf, names.get(i) == null ? "error" : names.get(i));
ByteBufUtils.writeUTF8String(buf, descriptions.get(i) == null ? "error" : descriptions.get(i));
}
@@ -10,14 +10,16 @@ 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 an {@link ISpellCaster} casts a spell which returns true, and is
/**
* <b>[Server -> Client]</b> This packet is sent when an {@link ISpellCaster} casts a spell which returns true, and is
* sent to clients so they can spawn the particles. Unlike the player packets, this is for both continuous <b>and</b>
* non-continuous spells. */
* non-continuous spells.
*/
public class PacketNPCCastSpell implements IMessageHandler<Message, IMessage> {
@Override
public IMessage onMessage(Message message, MessageContext ctx){
// Just to make sure that the side is correct
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
@@ -47,7 +49,8 @@ public class PacketNPCCastSpell implements IMessageHandler<Message, IMessage> {
public EnumHand hand;
// This constructor is required otherwise you'll get errors (used somewhere in fml through reflection)
public Message(){}
public Message(){
}
public Message(int casterID, int targetID, EnumHand hand, int spellID, SpellModifiers modifiers){
this.casterID = casterID;
@@ -11,14 +11,15 @@ 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 to synchronise any fields that need synchronising in
/**
* <b>[Server -> Client]</b> This packet is sent to synchronise any fields that need synchronising in
* {@link electroblob.wizardry.WizardData WizardData}. This packet is not sent often enough and is too small to warrant
* having separate packets for each field that needs synchronising. */
* having separate packets for each field that needs synchronising.
*/
public class PacketPlayerSync implements IMessageHandler<Message, IMessage> {
@Override
public IMessage onMessage(Message message, MessageContext ctx)
{
public IMessage onMessage(Message message, MessageContext ctx){
// Just to make sure that the side is correct
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
@@ -40,7 +41,8 @@ public class PacketPlayerSync implements IMessageHandler<Message, IMessage> {
public int selectedMinionID;
// This constructor is required otherwise you'll get errors (used somewhere in fml through reflection)
public Message() {}
public Message(){
}
public Message(Set<Spell> spellsDiscovered2, int selectedMinionID){
this.spellsDiscovered = spellsDiscovered2;
@@ -8,8 +8,11 @@ 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 to synchronise the config settings with clients on player login.
* @see Settings */
/**
* <b>[Server -> Client]</b> This packet is sent to synchronise the config settings with clients on player login.
*
* @see Settings
*/
public class PacketSyncSettings implements IMessageHandler<Message, IMessage> {
@Override
@@ -29,18 +32,18 @@ public class PacketSyncSettings implements IMessageHandler<Message, IMessage> {
return null;
}
private static void copySettings(Message message){
Wizardry.settings.firebombIsCraftable = message.settings.firebombIsCraftable;
Wizardry.settings.poisonBombIsCraftable = message.settings.poisonBombIsCraftable;
Wizardry.settings.smokeBombIsCraftable = message.settings.smokeBombIsCraftable;
Wizardry.settings.useAlternateScrollRecipe = message.settings.useAlternateScrollRecipe;
Wizardry.settings.discoveryMode = message.settings.discoveryMode;
// Wizardry.settings.maxSpellCommandMultiplier = message.settings.maxSpellCommandMultiplier;
// Wizardry.settings.castCommandName = message.settings.castCommandName;
// Wizardry.settings.discoverspellCommandName = message.settings.discoverspellCommandName;
// Wizardry.settings.allyCommandName = message.settings.allyCommandName;
// Wizardry.settings.alliesCommandName = message.settings.alliesCommandName;
// Wizardry.settings.maxSpellCommandMultiplier = message.settings.maxSpellCommandMultiplier;
// Wizardry.settings.castCommandName = message.settings.castCommandName;
// Wizardry.settings.discoverspellCommandName = message.settings.discoverspellCommandName;
// Wizardry.settings.allyCommandName = message.settings.allyCommandName;
// Wizardry.settings.alliesCommandName = message.settings.alliesCommandName;
}
public static class Message implements IMessage {
@@ -49,7 +52,8 @@ public class PacketSyncSettings implements IMessageHandler<Message, IMessage> {
public Settings settings;
// This constructor is required otherwise you'll get errors (used somewhere in fml through reflection)
public Message(){}
public Message(){
}
public Message(Settings settings){
this.settings = settings;
@@ -66,11 +70,11 @@ public class PacketSyncSettings implements IMessageHandler<Message, IMessage> {
settings.smokeBombIsCraftable = buf.readBoolean();
settings.useAlternateScrollRecipe = buf.readBoolean();
settings.discoveryMode = buf.readBoolean();
// settings.maxSpellCommandMultiplier = buf.readDouble();
// settings.castCommandName = ByteBufUtils.readUTF8String(buf);
// settings.discoverspellCommandName = ByteBufUtils.readUTF8String(buf);
// settings.allyCommandName = ByteBufUtils.readUTF8String(buf);
// settings.alliesCommandName = ByteBufUtils.readUTF8String(buf);
// settings.maxSpellCommandMultiplier = buf.readDouble();
// settings.castCommandName = ByteBufUtils.readUTF8String(buf);
// settings.discoverspellCommandName = ByteBufUtils.readUTF8String(buf);
// settings.allyCommandName = ByteBufUtils.readUTF8String(buf);
// settings.alliesCommandName = ByteBufUtils.readUTF8String(buf);
}
@Override
@@ -80,11 +84,11 @@ public class PacketSyncSettings implements IMessageHandler<Message, IMessage> {
buf.writeBoolean(settings.smokeBombIsCraftable);
buf.writeBoolean(settings.useAlternateScrollRecipe);
buf.writeBoolean(settings.discoveryMode);
// buf.writeDouble(settings.maxSpellCommandMultiplier);
// ByteBufUtils.writeUTF8String(buf, settings.castCommandName);
// ByteBufUtils.writeUTF8String(buf, settings.discoverspellCommandName);
// ByteBufUtils.writeUTF8String(buf, settings.allyCommandName);
// ByteBufUtils.writeUTF8String(buf, settings.alliesCommandName);
// buf.writeDouble(settings.maxSpellCommandMultiplier);
// ByteBufUtils.writeUTF8String(buf, settings.castCommandName);
// ByteBufUtils.writeUTF8String(buf, settings.discoverspellCommandName);
// ByteBufUtils.writeUTF8String(buf, settings.allyCommandName);
// ByteBufUtils.writeUTF8String(buf, settings.alliesCommandName);
}
}
}
@@ -7,13 +7,14 @@ 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 a player is teleported due to the transportation spell to spawn
* the particles. */
/**
* <b>[Server -> Client]</b> This packet is sent when a player is teleported due to the transportation spell to spawn
* the particles.
*/
public class PacketTransportation implements IMessageHandler<Message, IMessage> {
@Override
public IMessage onMessage(Message message, MessageContext ctx)
{
public IMessage onMessage(Message message, MessageContext ctx){
// Just to make sure that the side is correct
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
@@ -29,29 +30,26 @@ public class PacketTransportation implements IMessageHandler<Message, IMessage>
return null;
}
public static class Message implements IMessage
{
public static class Message implements IMessage {
/** EntityID of the caster */
public int casterID;
// This constructor is required otherwise you'll get errors (used somewhere in fml through reflection)
public Message() {}
public Message(){
}
public Message(int casterID)
{
public Message(int casterID){
this.casterID = casterID;
}
@Override
public void fromBytes(ByteBuf buf)
{
public void fromBytes(ByteBuf buf){
// The order is important
this.casterID = buf.readInt();
}
@Override
public void toBytes(ByteBuf buf)
{
public void toBytes(ByteBuf buf){
buf.writeInt(casterID);
}
}
@@ -8,11 +8,10 @@ import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import net.minecraftforge.fml.relauncher.Side;
public class WizardryPacketHandler {
public static SimpleNetworkWrapper net;
public static void initPackets()
{
public static void initPackets(){
net = NetworkRegistry.INSTANCE.newSimpleChannel(Wizardry.MODID.toUpperCase());
registerMessage(PacketControlInput.class, PacketControlInput.Message.class);
registerMessage(PacketCastSpell.class, PacketCastSpell.Message.class);
@@ -24,11 +23,11 @@ public class WizardryPacketHandler {
registerMessage(PacketSyncSettings.class, PacketSyncSettings.Message.class);
registerMessage(PacketNPCCastSpell.class, PacketNPCCastSpell.Message.class);
}
private static int nextPacketId = 0;
private static <REQ extends IMessage, REPLY extends IMessage> void registerMessage(Class<? extends IMessageHandler<REQ, REPLY>> packet, Class<REQ> message)
{
private static <REQ extends IMessage, REPLY extends IMessage> void registerMessage(
Class<? extends IMessageHandler<REQ, REPLY>> packet, Class<REQ> message){
net.registerMessage(packet, message, nextPacketId, Side.CLIENT);
net.registerMessage(packet, message, nextPacketId, Side.SERVER);
nextPacketId++;