Jump to content

Jay Avery

Members
  • Posts

    884
  • Joined

  • Last visited

  • Days Won

    9

Posts posted by Jay Avery

  1. It looks like you might need to study some Java fundamentals, because this is fairly basic syntax that you seem to be having trouble with. The correct line is:

    ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));

     

  2. net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model bte:block/limonaric_mud with loader VanillaLoader.INSTANCE, skipping
      ...
    Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 3 column 6 path 

    There is a syntax error in your bte:block/limonaric_mud file. In future run your json files through a validator like jsonlint or an IDE plugin to catch mistakes like this.

  3. Oh, I just realised the problem, your model files are missing important things.

     

          "faces": {
              "down": { "cullface": "down" },
              "up": { "cullface": "up" },
              "north": { "cullface": "north" },
              "south": { "cullface": "south" },
              "west": { "cullface": "west" },
              "east": { "cullface": "east" }
          }

    Each of the faces ("down" etc) needs to contain a "texture" element - a string referring to the texture label (as defined in the "textures" section at the start of your file) and starting with #. You likely also want a "uv" element - an array of four numbers - to define which area of the texture to apply to the face. Here is a random example from a model in my mod:

        "faces": {
            "down":  { "uv": [ 15, 14, 0, 2 ], "texture": "#cotton1" },
            "up":    { "uv": [ 1, 4, 16, 16 ], "texture": "#cotton1" },
            "north": { "uv": [ 0, 15, 15, 16 ], "texture": "#cotton1" },
            "south": { "uv": [ 1, 15, 16, 16 ], "texture": "#cotton1" },
            "west":  { "uv": [ 2, 15, 14, 16 ], "texture": "#cotton1" },
            "east":  { "uv": [ 2, 15, 14, 16 ], "texture": "#cotton1" }
        }

     

  4. You can use the forge multi-layer model with the forge blockstates format, to render parts of the model in different layers. In your block, override Block#canRenderInLayer to return true for every layer which your block has. Then in the blockstates file, define the model as "forge:multi-layer". Add a "custom" tag, and inside that define each of the layers with the model to be rendered. I have an example which uses both translucent and cutout layers for different parts of the model: blockstates, block code.

    • Like 2
  5. To make an ItemStack with metadata, use the constructor new ItemStack(item, stackSize, metadata). To get a random number for the metadata you can use the method Random#nextInt(max), which returns an integer between 0 and max-1. World has a rand field which you can use for this.

  6. 2 hours ago, meee39 said:

    Exception loading model for variant occultcraft:athanor#facing=west,is_on=true for blockstate "occultcraft:athanor[facing=west,is_on=true]"

    The variant it's looking for:

    [facing=west,is_on=true]

    The variant in your blockstates file:

    "is_on=true,facing=west": {

     

    Can you spot the difference? Fully-defined variants are simply strings, they must be an exact match - forge doesn't know that you mean the same thing when you have the variants written in a different order. The correct order to write the variants is with the variant names in alphabetical order, so "facing" comes before "is_on".

  7. Thanks anyway. I just tried to use the verbose approach, but it's giving me a "Not a JSON object" error. :S Here is the full blockstates file:

    Spoiler
    
    {
        "forge_marker": 1,
        "defaults": {
            "model": "geomastery:trees/tree_small",
            "textures": {
                "bark": "geomastery:blocks/trees/barksize1oak",
                "endgrain": "geomastery:blocks/trees/endgrainoak",
                "all": "geomastery:blocks/trees/leavesoak"
            }
        },
        "variants": {
            "type": {
                "oak": {},
                "birch": {
                    "textures": {
                        "bark": "geomastery:blocks/trees/barksize1birch",
                        "endgrain": "geomastery:blocks/trees/endgrainbirch",
                        "all": "geomastery:blocks/trees/leavesbirch"
                    }
                },
                "larch": {
                    "textures": {
                        "bark": "geomastery:blocks/trees/barksize1larch",
                        "endgrain": "geomastery:blocks/trees/endgrainlarch",
                        "all": "geomastery:blocks/trees/leaveslarch"
                    }
                },
                "pine": {
                    "textures": {
                        "bark": "geomastery:blocks/trees/barksize1pine",
                        "endgrain": "geomastery:blocks/trees/endgrainpine",
                        "all": "geomastery:blocks/trees/leavespine"
                    }
                },
                "spruce": {
                    "textures": {
                        "bark": "geomastery:blocks/trees/barksize1spruce",
                        "endgrain": "geomastery:blocks/trees/endgrainspruce",
                        "all": "geomastery:blocks/trees/leavesspruce"
                    }
                },
                "willow": {
                    "textures": {
                        "bark": "geomastery:blocks/trees/barksize1willow",
                        "endgrain": "geomastery:blocks/trees/endgrainwillow",
                        "all": "geomastery:blocks/trees/leaveswillow"
                    }
                },
                "beech": {
                    "textures": {
                        "bark": "geomastery:blocks/trees/barksize1beech",
                        "endgrain": "geomastery:blocks/trees/endgrainbeech",
                        "all": "geomastery:blocks/trees/leavesbeech"
                    }
                },
                "brazil": [
                    {
                        "model": "geomastery:trees/tree_small",
                        "textures": {
                            "bark": "geomastery:blocks/trees/barksize1brazil",
                            "endgrain": "geomastery:blocks/trees/endgrainbrazil",
                            "all": "geomastery:blocks/trees/leavesbrazil"
                        }
                    },
                    {
                        "model": "geomastery:trees/tree_small_brazil_alt",
                        "textures": {
                            "bark": "geomastery:blocks/trees/barksize1brazil",
                            "endgrain": "geomastery:blocks/trees/endgrainbrazil",
                            "all": "geomastery:blocks/trees/leavesbrazil"
                        }
                    }
                ],
                "mahogany": {
                    "textures": {
                        "bark": "geomastery:blocks/trees/barksize1mahogany",
                        "endgrain": "geomastery:blocks/trees/endgrainmahogany",
                        "all": "geomastery:blocks/trees/leavesmahogany"
                    }
                },
                "ebony": {
                    "textures": {
                        "bark": "geomastery:blocks/trees/barksize12ebony",
                        "endgrain": "geomastery:blocks/trees/endgrainebony",
                        "all": "geomastery:blocks/trees/leavesebony"
                    }
                }
            },
            "leaves": {
                "true": { "submodel": { "leaves": { "model": "cube_all" } } },
                "false": {}
            },
            "inventory": [{}]
        }
    }

     

    The variant I'm trying to define as an array is this:

    "brazil": [
      {
        "model": "geomastery:trees/tree_small",
        "textures": {
          "bark": "geomastery:blocks/trees/barksize1brazil",
          "endgrain": "geomastery:blocks/trees/endgrainbrazil",
          "all": "geomastery:blocks/trees/leavesbrazil"
        }
      },
      {
        "model": "geomastery:trees/tree_small_brazil_alt",
        "textures": {
          "bark": "geomastery:blocks/trees/barksize1brazil",
          "endgrain": "geomastery:blocks/trees/endgrainbrazil",
          "all": "geomastery:blocks/trees/leavesbrazil"
        }
      }
    ],

     

    The whole error from the console:

    Spoiler
    
    java.lang.Exception: Could not load model definition for variant geomastery:block_tree_small
    	at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:297) ~[ModelLoader.class:?]
    	at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:121) ~[ModelBakery.class:?]
    	at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:252) ~[ModelLoader.class:?]
    	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:159) ~[ModelLoader.class:?]
    	at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
    	at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122) [SimpleReloadableResourceManager.class:?]
    	at net.minecraft.client.Minecraft.init(Minecraft.java:541) [Minecraft.class:?]
    	at net.minecraft.client.Minecraft.run(Minecraft.java:387) [Minecraft.class:?]
    	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_121]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121]
    	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
    	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_121]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121]
    	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
    	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    	at GradleStart.main(GradleStart.java:26) [start/:?]
    Caused by: java.lang.RuntimeException: Encountered an exception when loading model definition of 'geomastery:block_tree_small' from: 'geomastery:blockstates/block_tree_small.json' in resourcepack: 'FMLFileResourcePack:Geomastery'
    	at net.minecraft.client.renderer.block.model.ModelBakery.loadModelBlockDefinition(ModelBakery.java:246) ~[ModelBakery.class:?]
    	at net.minecraft.client.renderer.block.model.ModelBakery.loadMultipartMBD(ModelBakery.java:223) ~[ModelBakery.class:?]
    	at net.minecraft.client.renderer.block.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:208) ~[ModelBakery.class:?]
    	at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:293) ~[ModelLoader.class:?]
    	... 20 more
    Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Not a JSON Object: [{"model":"geomastery:trees/tree_small","textures":{"bark":"geomastery:blocks/trees/barksize1brazil","endgrain":"geomastery:blocks/trees/endgrainbrazil","all":"geomastery:blocks/trees/leavesbrazil"}},{"model":"geomastery:trees/tree_small_brazil_alt","textures":{"bark":"geomastery:blocks/trees/barksize1brazil","endgrain":"geomastery:blocks/trees/endgrainbrazil","all":"geomastery:blocks/trees/leavesbrazil"}}]
    	at com.google.gson.Gson.fromJson(Gson.java:815) ~[Gson.class:?]
    	at com.google.gson.Gson.fromJson(Gson.java:868) ~[Gson.class:?]
    	at com.google.gson.Gson$1.deserialize(Gson.java:126) ~[Gson$1.class:?]
    	at net.minecraftforge.client.model.ForgeBlockStateV1$Deserializer.deserialize(ForgeBlockStateV1.java:110) ~[ForgeBlockStateV1$Deserializer.class:?]
    	at net.minecraftforge.client.model.ForgeBlockStateV1$Deserializer.deserialize(ForgeBlockStateV1.java:67) ~[ForgeBlockStateV1$Deserializer.class:?]
    	at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) ~[TreeTypeAdapter.class:?]
    	at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?]
    	at com.google.gson.Gson.fromJson(Gson.java:741) ~[Gson.class:?]
    	at net.minecraftforge.client.model.BlockStateLoader.load(BlockStateLoader.java:81) ~[BlockStateLoader.class:?]
    	at net.minecraft.client.renderer.block.model.ModelBlockDefinition.parseFromReader(ModelBlockDefinition.java:37) ~[ModelBlockDefinition.class:?]
    	at net.minecraft.client.renderer.block.model.ModelBakery.loadModelBlockDefinition(ModelBakery.java:242) ~[ModelBakery.class:?]
    	at net.minecraft.client.renderer.block.model.ModelBakery.loadMultipartMBD(ModelBakery.java:223) ~[ModelBakery.class:?]
    	at net.minecraft.client.renderer.block.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:208) ~[ModelBakery.class:?]
    	at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:293) ~[ModelLoader.class:?]
    	... 20 more
    Caused by: java.lang.IllegalStateException: Not a JSON Object: [{"model":"geomastery:trees/tree_small","textures":{"bark":"geomastery:blocks/trees/barksize1brazil","endgrain":"geomastery:blocks/trees/endgrainbrazil","all":"geomastery:blocks/trees/leavesbrazil"}},{"model":"geomastery:trees/tree_small_brazil_alt","textures":{"bark":"geomastery:blocks/trees/barksize1brazil","endgrain":"geomastery:blocks/trees/endgrainbrazil","all":"geomastery:blocks/trees/leavesbrazil"}}]
    	at com.google.gson.JsonElement.getAsJsonObject(JsonElement.java:90) ~[JsonElement.class:?]
    	at net.minecraftforge.client.model.ForgeBlockStateV1$Variant$Deserializer.deserialize(ForgeBlockStateV1.java:480) ~[ForgeBlockStateV1$Variant$Deserializer.class:?]
    	at net.minecraftforge.client.model.ForgeBlockStateV1$Variant$Deserializer.deserialize(ForgeBlockStateV1.java:440) ~[ForgeBlockStateV1$Variant$Deserializer.class:?]
    	at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) ~[TreeTypeAdapter.class:?]
    	at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?]
    	at com.google.gson.Gson.fromJson(Gson.java:868) ~[Gson.class:?]
    	at com.google.gson.Gson$1.deserialize(Gson.java:126) ~[Gson$1.class:?]
    	at net.minecraftforge.client.model.ForgeBlockStateV1$Deserializer.deserialize(ForgeBlockStateV1.java:110) ~[ForgeBlockStateV1$Deserializer.class:?]
    	at net.minecraftforge.client.model.ForgeBlockStateV1$Deserializer.deserialize(ForgeBlockStateV1.java:67) ~[ForgeBlockStateV1$Deserializer.class:?]
    	at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) ~[TreeTypeAdapter.class:?]
    	at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?]
    	at com.google.gson.Gson.fromJson(Gson.java:741) ~[Gson.class:?]
    	at net.minecraftforge.client.model.BlockStateLoader.load(BlockStateLoader.java:81) ~[BlockStateLoader.class:?]
    	at net.minecraft.client.renderer.block.model.ModelBlockDefinition.parseFromReader(ModelBlockDefinition.java:37) ~[ModelBlockDefinition.class:?]
    	at net.minecraft.client.renderer.block.model.ModelBakery.loadModelBlockDefinition(ModelBakery.java:242) ~[ModelBakery.class:?]
    	at net.minecraft.client.renderer.block.model.ModelBakery.loadMultipartMBD(ModelBakery.java:223) ~[ModelBakery.class:?]
    	at net.minecraft.client.renderer.block.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:208) ~[ModelBakery.class:?]
    	at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:293) ~[ModelLoader.class:?]
    	... 20 more

     

    What am I doing wrong?

  8. I'm trying to figure out the syntax of a blockstates file. For each variant, I need to define several textures which are always the same, and also define several possible models which will be chosen from randomly. The texture definitions don't need to be different for different models (they have the same texture labels). But the only way I've seen of choosing randomly between models/textures is to make the entire variant definition an array, which would mean having to copy the textures definitions for each model. Is there any way to get around doing that? A way to define the textures once for the variant, and also give an array of possible models to choose from for that variant?

  9. 2 hours ago, TheRPGAdventurer said:

    int height = world.getChunkFromChunkCoords(xy, zy).getHeight(new BlockPos(x & 15, 0, z & 15));

    The getHeight method returns (generally) the topmost solids block. In the nether, that's the bedrock on top of the world. If you want your structure to generate at a different altitude, you need to use a different y co-ordinate.

     

    2 hours ago, TheRPGAdventurer said:

    Also, how do I make my code give me the exact location of the structure instead of saying "Nest here at true" in the console.

    
    Utils.getLogger().info("Nest here at: " + dragonNestNether.generate(world, random, new BlockPos(x,y,z)));

    The generate method returns a boolean. If you want to print a BlockPos, then put a BlockPos inside the logger statement.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.