Jump to content

[1.17.1] "Feature: Not a JSON object"


Nati_Waty

Recommended Posts

 

I want to create a feature to generate a trunk without leaves on my custom biome but when I try to create a new world or entering an existing one, I have this error :

[Render thread/ERROR]: Feature: Not a JSON object: "minecraft:spring_water"; Not a JSON object: "minecraft:patch_pumpkin"; Not a JSON object: "minecraft:patch_sugar_cane"; Not a JSON object: "minecraft:patch_grass_forest"; Not a JSON object: "minecraft:flower_default"; Not a JSON object: "minecraft:glow_lichen"; Not a JSON object: "minecraft:forest_flower_vegetation"; Not a JSON object: "vanillaenhancer:sakura_trunk"

Here are all the files related to the custom feature and biome:

 

In order: Feature JSON, Biome JSON, Feature Class, FeatureInit Class, BiomeInit Class

{
  "type": "minecraft:decorated",
  "config": {
    "decorator": {
      "type": "minecraft:count",
      "config": {
        "count": {
          "type": "minecraft:constant",
          "value": 4
        }
      }
    },
    "feature": {
      "type": "minecraft:decorated",
      "config": {
        "decorator": {
          "type": "minecraft:decorated",
          "config": {
            "outer": {
              "type": "minecraft:square",
              "config": {}
            },
            "inner": {
              "type": "minecraft:heightmap_spread_double",
              "config": {
                "heightmap": "WORLD_SURFACE"
              }
            }
          }
        },
        "feature": {
          "type": "vanillaenhancer:sakura_trunk",
          "config": {}
        }
      }
    }
  }
}

 

{
  "surface_builder": "minecraft:grass",
  "depth": 0.1,
  "scale": 0.2,
  "temperature": 0.6,
  "downfall": 0.6,
  "precipitation": "rain",
  "category": "forest",
  "player_spawn_friendly": false,
  "effects": {
    "sky_color": 8037887,
    "fog_color": 12638463,
    "water_color": 4159204,
    "water_fog_color": 329011,
    "mood_sound": {
      "sound": "minecraft:ambient.cave",
      "tick_delay": 6000,
      "block_search_extent": 8,
      "offset": 2
    }
  },
  "starts": [
    "minecraft:mineshaft",
    "minecraft:stronghold",
    "minecraft:ruined_portal"
  ],
  "spawners": {
    "monster": [
      {
        "type": "minecraft:spider",
        "weight": 100,
        "minCount": 4,
        "maxCount": 4
      },
      {
        "type": "minecraft:zombie",
        "weight": 95,
        "minCount": 4,
        "maxCount": 4
      },
      {
        "type": "minecraft:zombie_villager",
        "weight": 5,
        "minCount": 1,
        "maxCount": 1
      },
      {
        "type": "minecraft:skeleton",
        "weight": 100,
        "minCount": 4,
        "maxCount": 4
      },
      {
        "type": "minecraft:creeper",
        "weight": 100,
        "minCount": 4,
        "maxCount": 4
      },
      {
        "type": "minecraft:slime",
        "weight": 100,
        "minCount": 4,
        "maxCount": 4
      },
      {
        "type": "minecraft:enderman",
        "weight": 10,
        "minCount": 1,
        "maxCount": 4
      },
      {
        "type": "minecraft:witch",
        "weight": 5,
        "minCount": 1,
        "maxCount": 1
      }
    ],
    "creature": [
      {
        "type": "minecraft:sheep",
        "weight": 12,
        "minCount": 4,
        "maxCount": 4
      },
      {
        "type": "minecraft:pig",
        "weight": 10,
        "minCount": 4,
        "maxCount": 4
      },
      {
        "type": "minecraft:chicken",
        "weight": 10,
        "minCount": 4,
        "maxCount": 4
      },
      {
        "type": "minecraft:cow",
        "weight": 8,
        "minCount": 4,
        "maxCount": 4
      }
    ],
    "ambient": [
      {
        "type": "minecraft:bat",
        "weight": 10,
        "minCount": 8,
        "maxCount": 8
      }
    ],
    "underground_water_creature": [
      {
        "type": "minecraft:glow_squid",
        "weight": 10,
        "minCount": 4,
        "maxCount": 6
      },
      {
        "type": "minecraft:axolotl",
        "weight": 10,
        "minCount": 4,
        "maxCount": 6
      }
    ],
    "water_creature": [],
    "water_ambient": [],
    "misc": []
  },
  "spawn_costs": {},
  "carvers": {
    "air": [
      "minecraft:cave",
      "minecraft:canyon"
    ]
  },
  "features": [
    [],
    [
      "minecraft:lake_water",
      "minecraft:lake_lava"
    ],
    [
      "minecraft:amethyst_geode"
    ],
    [
      "minecraft:monster_room"
    ],
    [],
    [],
    [
      "minecraft:ore_dirt",
      "minecraft:ore_gravel",
      "minecraft:ore_granite",
      "minecraft:ore_diorite",
      "minecraft:ore_andesite",
      "minecraft:ore_tuff",
      "minecraft:ore_deepslate",
      "minecraft:ore_coal",
      "minecraft:ore_iron",
      "minecraft:ore_gold",
      "minecraft:ore_redstone",
      "minecraft:ore_diamond",
      "minecraft:ore_lapis",
      "minecraft:ore_copper",
      "minecraft:disk_sand",
      "minecraft:disk_clay",
      "minecraft:disk_gravel"
    ],
    [
      "minecraft:rare_dripstone_cluster",
      "minecraft:rare_small_dripstone"
    ],
    [
      "vanillaenhancer:sakura_trunk",
      "minecraft:forest_flower_vegetation",
      "minecraft:glow_lichen",
      "minecraft:flower_default",
      "minecraft:patch_grass_forest",
      "minecraft:patch_sugar_cane",
      "minecraft:patch_pumpkin",
      "minecraft:spring_water"
    ],
    [
      "minecraft:freeze_top_layer"
    ]
  ]
}
package fr.nati.vanillaenhancer.common.world.feature;

import com.mojang.serialization.Codec;

import fr.nati.vanillaenhancer.core.init.BlockInit;
import net.minecraft.core.BlockPos;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.LevelSimulatedReader;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;

public class SakuraTrunk extends Feature<NoneFeatureConfiguration>{
	private static final BlockState SAKURA_LOG = BlockInit.SAKURA_LOG.get().defaultBlockState();

	public SakuraTrunk(Codec<NoneFeatureConfiguration> codec) {
		super(codec);
	}
	
	@Override
	public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> context) {
		BlockPos pos = context.origin();
		WorldGenLevel reader = context.level();
		while (pos.getY() > 1) {
			pos = pos.below();
		}
		pos = pos.above();
		
		for (int i = 0; i < 4; i++) 
			setBlock(reader, pos.above(i), SAKURA_LOG);

		return false;
	}
}
package fr.nati.vanillaenhancer.core.init;

import fr.nati.vanillaenhancer.VanillaEnhancer;
import fr.nati.vanillaenhancer.common.world.feature.SakuraTrunk;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraftforge.fmllegacy.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

public class FeatureInit {

	public static final DeferredRegister<Feature<?>> FEATURES = DeferredRegister.create(ForgeRegistries.FEATURES,
			VanillaEnhancer.MOD_ID);

	public static final RegistryObject<SakuraTrunk> SAKURA_TRUNK = FEATURES.register("sakura_trunk",
			() -> new SakuraTrunk(NoneFeatureConfiguration.CODEC));

}
package fr.nati.vanillaenhancer.core.init;

import java.util.function.Supplier;

import fr.nati.vanillaenhancer.VanillaEnhancer;
import net.minecraft.core.Registry;
import net.minecraft.data.worldgen.biome.VanillaBiomes;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome;
import net.minecraftforge.common.BiomeManager;
import net.minecraftforge.fmllegacy.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

public class BiomeInit {

	public static final DeferredRegister<Biome> BIOMES = DeferredRegister.create(ForgeRegistries.BIOMES,
			VanillaEnhancer.MOD_ID);

	static {
		createBiome("sakura_forest", VanillaBiomes::theVoidBiome);
	}
	
	public static ResourceKey<Biome> SAKURA_FOREST = registerBiome("sakura_forest");

	public static ResourceKey<Biome> registerBiome(String biomeName) {
		return ResourceKey.create(Registry.BIOME_REGISTRY, new ResourceLocation(VanillaEnhancer.MOD_ID, biomeName));
	}

	public static RegistryObject<Biome> createBiome(String biomeName, Supplier<Biome> biome) {
		return BIOMES.register(biomeName, biome);
	}

	public static void registerBiomes() {
		BiomeManager.addBiome(BiomeManager.BiomeType.COOL, new BiomeManager.BiomeEntry(SAKURA_FOREST, 10));
	}
}

 

Edited by Nati_Waty
Link to comment
Share on other sites

8 hours ago, Nati_Waty said:

Not a JSON object: "vanillaenhancer:sakura_trunk"

inside your Json Biome you are using this features:

  • "minecraft:spring_water"
  • "minecraft:patch_pumpkin"
  • "minecraft:patch_sugar_cane"
  • "minecraft:patch_grass_forest"
  • "minecraft:flower_default"
  • "minecraft:glow_lichen"
  • "minecraft:forest_flower_vegetation"
  • "vanillaenhancer:sakura_trunk"

try without this features, if you have the same error again something is wrong with your json biome
if it works fine check the names of the features

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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