Package net.minecraft.util.com.google.gson

Examples of net.minecraft.util.com.google.gson.JsonParseException


                    }
                }

                return ichatbasecomponent;
            } else {
                throw new JsonParseException("Don\'t know how to turn " + jsonelement.toString() + " into a Component");
            }
        } else {
            JsonObject jsonobject = jsonelement.getAsJsonObject();
            Object object;

            if (jsonobject.has("text")) {
                object = new ChatComponentText(jsonobject.get("text").getAsString());
            } else {
                if (!jsonobject.has("translate")) {
                    throw new JsonParseException("Don\'t know how to turn " + jsonelement.toString() + " into a Component");
                }

                String s = jsonobject.get("translate").getAsString();

                if (jsonobject.has("with")) {
                    JsonArray jsonarray1 = jsonobject.getAsJsonArray("with");
                    Object[] aobject = new Object[jsonarray1.size()];

                    for (int i = 0; i < aobject.length; ++i) {
                        aobject[i] = this.a(jsonarray1.get(i), type, jsondeserializationcontext);
                        if (aobject[i] instanceof ChatComponentText) {
                            ChatComponentText chatcomponenttext = (ChatComponentText) aobject[i];

                            if (chatcomponenttext.getChatModifier().g() && chatcomponenttext.a().isEmpty()) {
                                aobject[i] = chatcomponenttext.g();
                            }
                        }
                    }

                    object = new ChatMessage(s, aobject);
                } else {
                    object = new ChatMessage(s, new Object[0]);
                }
            }

            if (jsonobject.has("extra")) {
                JsonArray jsonarray2 = jsonobject.getAsJsonArray("extra");

                if (jsonarray2.size() <= 0) {
                    throw new JsonParseException("Unexpected empty array of components");
                }

                for (int j = 0; j < jsonarray2.size(); ++j) {
                    ((IChatBaseComponent) object).addSibling(this.a(jsonarray2.get(j), type, jsondeserializationcontext));
                }
View Full Code Here

TOP

Related Classes of net.minecraft.util.com.google.gson.JsonParseException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.