当前位置: 首页>>代码示例>>Java>>正文


Java JsonException类代码示例

本文整理汇总了Java中net.minecraft.client.util.JsonException的典型用法代码示例。如果您正苦于以下问题:Java JsonException类的具体用法?Java JsonException怎么用?Java JsonException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JsonException类属于net.minecraft.client.util包,在下文中一共展示了JsonException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initTarget

import net.minecraft.client.util.JsonException; //导入依赖的package包/类
private void initTarget(JsonElement p_148027_1_) throws JsonException
{
    if (JsonUtils.isString(p_148027_1_))
    {
        this.addFramebuffer(p_148027_1_.getAsString(), this.mainFramebufferWidth, this.mainFramebufferHeight);
    }
    else
    {
        JsonObject jsonobject = JsonUtils.getJsonObject(p_148027_1_, "target");
        String s = JsonUtils.getString(jsonobject, "name");
        int i = JsonUtils.getInt(jsonobject, "width", this.mainFramebufferWidth);
        int j = JsonUtils.getInt(jsonobject, "height", this.mainFramebufferHeight);

        if (this.mapFramebuffers.containsKey(s))
        {
            throw new JsonException(s + " is already defined");
        }

        this.addFramebuffer(s, i, j);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:22,代码来源:ShaderGroup.java

示例2: activateBatch

import net.minecraft.client.util.JsonException; //导入依赖的package包/类
public void activateBatch()
{
    if(batch != null)
    {
        if(OpenGlHelper.shadersSupported)
        {
            try
            {
                ShaderGroup theShaderGroup = batch.toShaderGroup(resManager);
                theShaderGroup.createBindFramebuffers(Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
                ObfuscationReflectionHelper.setPrivateValue(EntityRenderer.class, Minecraft.getMinecraft().entityRenderer, theShaderGroup, 51);
                ObfuscationReflectionHelper.setPrivateValue(EntityRenderer.class, Minecraft.getMinecraft().entityRenderer, true, 55);
            }
            catch(JsonException e)
            {
                e.printStackTrace();
            }
        }
    }
}
 
开发者ID:jglrxavpok,项目名称:ShadyMod,代码行数:21,代码来源:ShadyMod.java

示例3: initTarget

import net.minecraft.client.util.JsonException; //导入依赖的package包/类
private void initTarget(JsonElement p_148027_1_) throws JsonException
{
    if (JsonUtils.jsonElementTypeIsString(p_148027_1_))
    {
        this.addFramebuffer(p_148027_1_.getAsString(), this.mainFramebufferWidth, this.mainFramebufferHeight);
    }
    else
    {
        JsonObject var2 = JsonUtils.getJsonElementAsJsonObject(p_148027_1_, "target");
        String var3 = JsonUtils.getJsonObjectStringFieldValue(var2, "name");
        int var4 = JsonUtils.getJsonObjectIntegerFieldValueOrDefault(var2, "width", this.mainFramebufferWidth);
        int var5 = JsonUtils.getJsonObjectIntegerFieldValueOrDefault(var2, "height", this.mainFramebufferHeight);

        if (this.mapFramebuffers.containsKey(var3))
        {
            throw new JsonException(var3 + " is already defined");
        }

        this.addFramebuffer(var3, var4, var5);
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:22,代码来源:ShaderGroup.java

示例4: initTarget

import net.minecraft.client.util.JsonException; //导入依赖的package包/类
private void initTarget(JsonElement p_148027_1_) throws JsonException
{
    if (JsonUtils.jsonElementTypeIsString(p_148027_1_))
    {
        this.addFramebuffer(p_148027_1_.getAsString(), this.mainFramebufferWidth, this.mainFramebufferHeight);
    }
    else
    {
        JsonObject jsonobject = JsonUtils.getJsonElementAsJsonObject(p_148027_1_, "target");
        String s = JsonUtils.getJsonObjectStringFieldValue(jsonobject, "name");
        int i = JsonUtils.getJsonObjectIntegerFieldValueOrDefault(jsonobject, "width", this.mainFramebufferWidth);
        int j = JsonUtils.getJsonObjectIntegerFieldValueOrDefault(jsonobject, "height", this.mainFramebufferHeight);

        if (this.mapFramebuffers.containsKey(s))
        {
            throw new JsonException(s + " is already defined");
        }

        this.addFramebuffer(s, i, j);
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:22,代码来源:ShaderGroup.java

示例5: createProgram

import net.minecraft.client.util.JsonException; //导入依赖的package包/类
public int createProgram() throws JsonException
{
    int i = OpenGlHelper.glCreateProgram();

    if (i <= 0)
    {
        throw new JsonException("Could not create shader program (returned program ID " + i + ")");
    }
    else
    {
        return i;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:14,代码来源:ShaderLinkHelper.java

示例6: loadShader

import net.minecraft.client.util.JsonException; //导入依赖的package包/类
public static ShaderLoader loadShader(IResourceManager resourceManager, ShaderLoader.ShaderType type, String filename) throws IOException
{
    ShaderLoader shaderloader = (ShaderLoader)type.getLoadedShaders().get(filename);

    if (shaderloader == null)
    {
        ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + filename + type.getShaderExtension());
        BufferedInputStream bufferedinputstream = new BufferedInputStream(resourceManager.getResource(resourcelocation).getInputStream());
        byte[] abyte = toByteArray(bufferedinputstream);
        ByteBuffer bytebuffer = BufferUtils.createByteBuffer(abyte.length);
        bytebuffer.put(abyte);
        bytebuffer.position(0);
        int i = OpenGlHelper.glCreateShader(type.getShaderMode());
        OpenGlHelper.glShaderSource(i, bytebuffer);
        OpenGlHelper.glCompileShader(i);

        if (OpenGlHelper.glGetShaderi(i, OpenGlHelper.GL_COMPILE_STATUS) == 0)
        {
            String s = StringUtils.trim(OpenGlHelper.glGetShaderInfoLog(i, 32768));
            JsonException jsonexception = new JsonException("Couldn\'t compile " + type.getShaderName() + " program: " + s);
            jsonexception.func_151381_b(resourcelocation.getResourcePath());
            throw jsonexception;
        }

        shaderloader = new ShaderLoader(type, i, filename);
        type.getLoadedShaders().put(filename, shaderloader);
    }

    return shaderloader;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:31,代码来源:ShaderLoader.java

示例7: parseSampler

import net.minecraft.client.util.JsonException; //导入依赖的package包/类
private void parseSampler(JsonElement p_147996_1_) throws JsonException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_147996_1_, "sampler");
    String s = JsonUtils.getString(jsonobject, "name");

    if (!JsonUtils.isString(jsonobject, "file"))
    {
        this.shaderSamplers.put(s, (Object)null);
        this.samplerNames.add(s);
    }
    else
    {
        this.samplerNames.add(s);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:16,代码来源:ShaderManager.java

示例8: ShaderGroup

import net.minecraft.client.util.JsonException; //导入依赖的package包/类
public ShaderGroup(TextureManager p_i1050_1_, IResourceManager p_i1050_2_, Framebuffer p_i1050_3_, ResourceLocation p_i1050_4_) throws JsonException, IOException, JsonSyntaxException
{
    this.resourceManager = p_i1050_2_;
    this.mainFramebuffer = p_i1050_3_;
    this.field_148036_j = 0.0F;
    this.field_148037_k = 0.0F;
    this.mainFramebufferWidth = p_i1050_3_.framebufferWidth;
    this.mainFramebufferHeight = p_i1050_3_.framebufferHeight;
    this.shaderGroupName = p_i1050_4_.toString();
    this.resetProjectionMatrix();
    this.parseGroup(p_i1050_1_, p_i1050_4_);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:13,代码来源:ShaderGroup.java

示例9: loadShader

import net.minecraft.client.util.JsonException; //导入依赖的package包/类
public static ShaderLoader loadShader(IResourceManager resourceManager, ShaderLoader.ShaderType type, String filename) throws IOException
{
    ShaderLoader shaderloader = (ShaderLoader)type.getLoadedShaders().get(filename);

    if (shaderloader == null)
    {
        ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + filename + type.getShaderExtension());
        IResource iresource = resourceManager.getResource(resourcelocation);

        try
        {
            byte[] abyte = IOUtils.toByteArray((InputStream)(new BufferedInputStream(iresource.getInputStream())));
            ByteBuffer bytebuffer = BufferUtils.createByteBuffer(abyte.length);
            bytebuffer.put(abyte);
            bytebuffer.position(0);
            int i = OpenGlHelper.glCreateShader(type.getShaderMode());
            OpenGlHelper.glShaderSource(i, bytebuffer);
            OpenGlHelper.glCompileShader(i);

            if (OpenGlHelper.glGetShaderi(i, OpenGlHelper.GL_COMPILE_STATUS) == 0)
            {
                String s = StringUtils.trim(OpenGlHelper.glGetShaderInfoLog(i, 32768));
                JsonException jsonexception = new JsonException("Couldn\'t compile " + type.getShaderName() + " program: " + s);
                jsonexception.setFilenameAndFlush(resourcelocation.getResourcePath());
                throw jsonexception;
            }

            shaderloader = new ShaderLoader(type, i, filename);
            type.getLoadedShaders().put(filename, shaderloader);
        }
        finally
        {
            IOUtils.closeQuietly((Closeable)iresource);
        }
    }

    return shaderloader;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:39,代码来源:ShaderLoader.java

示例10: parseSampler

import net.minecraft.client.util.JsonException; //导入依赖的package包/类
private void parseSampler(JsonElement element) throws JsonException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(element, "sampler");
    String s = JsonUtils.getString(jsonobject, "name");

    if (!JsonUtils.isString(jsonobject, "file"))
    {
        this.shaderSamplers.put(s, (Object)null);
        this.samplerNames.add(s);
    }
    else
    {
        this.samplerNames.add(s);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:16,代码来源:ShaderManager.java

示例11: ShaderGroup

import net.minecraft.client.util.JsonException; //导入依赖的package包/类
public ShaderGroup(TextureManager p_i1050_1_, IResourceManager resourceManagerIn, Framebuffer mainFramebufferIn, ResourceLocation p_i1050_4_) throws JsonException, IOException, JsonSyntaxException
{
    this.resourceManager = resourceManagerIn;
    this.mainFramebuffer = mainFramebufferIn;
    this.time = 0.0F;
    this.lastStamp = 0.0F;
    this.mainFramebufferWidth = mainFramebufferIn.framebufferWidth;
    this.mainFramebufferHeight = mainFramebufferIn.framebufferHeight;
    this.shaderGroupName = p_i1050_4_.toString();
    this.resetProjectionMatrix();
    this.parseGroup(p_i1050_1_, p_i1050_4_);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:ShaderGroup.java

示例12: loadShader

import net.minecraft.client.util.JsonException; //导入依赖的package包/类
public static int loadShader(String filename, int shaderType) throws IOException
{
    int shaderID = -1;
    InputStream stream = MalmoMod.class.getClassLoader().getResourceAsStream(filename);
    if (stream == null)
    {
        System.out.println("Cannot find shader.");
        return -1;
    }
    try
    {
        byte[] abyte = IOUtils.toByteArray((InputStream) (new BufferedInputStream(stream)));
        ByteBuffer bytebuffer = BufferUtils.createByteBuffer(abyte.length);
        bytebuffer.put(abyte);
        bytebuffer.position(0);
        shaderID = OpenGlHelper.glCreateShader(shaderType);
        OpenGlHelper.glShaderSource(shaderID, bytebuffer);
        OpenGlHelper.glCompileShader(shaderID);

        if (OpenGlHelper.glGetShaderi(shaderID, OpenGlHelper.GL_COMPILE_STATUS) == 0)
        {
            String s = StringUtils.trim(OpenGlHelper.glGetShaderInfoLog(shaderID, 32768));
            JsonException jsonexception = new JsonException("Couldn\'t compile shader program: " + s);
            throw jsonexception;
        }
    }
    finally
    {
        IOUtils.closeQuietly(stream);
    }
    return shaderID;
}
 
开发者ID:Microsoft,项目名称:malmo,代码行数:33,代码来源:TextureHelper.java

示例13: func_148078_c

import net.minecraft.client.util.JsonException; //导入依赖的package包/类
public int func_148078_c() throws JsonException
{
    int var1 = GL20.glCreateProgram();

    if (var1 <= 0)
    {
        throw new JsonException("Could not create shader program (returned program ID " + var1 + ")");
    }
    else
    {
        return var1;
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:14,代码来源:ShaderLinkHelper.java

示例14: func_148057_a

import net.minecraft.client.util.JsonException; //导入依赖的package包/类
public static ShaderLoader func_148057_a(IResourceManager p_148057_0_, ShaderLoader.ShaderType p_148057_1_, String p_148057_2_) throws IOException
{
    ShaderLoader var3 = (ShaderLoader)p_148057_1_.func_148064_d().get(p_148057_2_);

    if (var3 == null)
    {
        ResourceLocation var4 = new ResourceLocation("shaders/program/" + p_148057_2_ + p_148057_1_.func_148063_b());
        BufferedInputStream var5 = new BufferedInputStream(p_148057_0_.getResource(var4).getInputStream());
        byte[] var6 = IOUtils.toByteArray(var5);
        ByteBuffer var7 = BufferUtils.createByteBuffer(var6.length);
        var7.put(var6);
        var7.position(0);
        int var8 = GL20.glCreateShader(p_148057_1_.func_148065_c());
        GL20.glShaderSource(var8, var7);
        GL20.glCompileShader(var8);

        if (GL20.glGetShaderi(var8, 35713) == 0)
        {
            String var9 = StringUtils.trim(GL20.glGetShaderInfoLog(var8, 32768));
            JsonException var10 = new JsonException("Couldn\'t compile " + p_148057_1_.func_148062_a() + " program: " + var9);
            var10.func_151381_b(var4.getResourcePath());
            throw var10;
        }

        var3 = new ShaderLoader(p_148057_1_, var8, p_148057_2_);
        p_148057_1_.func_148064_d().put(p_148057_2_, var3);
    }

    return var3;
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:31,代码来源:ShaderLoader.java

示例15: ShaderGroup

import net.minecraft.client.util.JsonException; //导入依赖的package包/类
public ShaderGroup(IResourceManager p_i45088_1_, Framebuffer p_i45088_2_, ResourceLocation p_i45088_3_) throws JsonException
{
    this.resourceManager = p_i45088_1_;
    this.mainFramebuffer = p_i45088_2_;
    this.field_148036_j = 0.0F;
    this.field_148037_k = 0.0F;
    this.mainFramebufferWidth = p_i45088_2_.framebufferWidth;
    this.mainFramebufferHeight = p_i45088_2_.framebufferHeight;
    this.shaderGroupName = p_i45088_3_.toString();
    this.resetProjectionMatrix();
    this.initFromLocation(p_i45088_3_);
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:13,代码来源:ShaderGroup.java


注:本文中的net.minecraft.client.util.JsonException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。