Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.16.1] Tree Generation


Willzigos
 Share

Recommended Posts

public static final ConfiguredFeature<?,?> MAPLE =
            new MapleTreeFeature( BaseTreeFeatureConfig.field_236676_a_)
                    .withConfiguration(
                    new BaseTreeFeatureConfig.Builder(
                            new SimpleBlockStateProvider(MapleLog.INSTANCE.getDefaultState()),
                            new SimpleBlockStateProvider(MapleLeaves.INSTANCE.getDefaultState()),
                            new BlobFoliagePlacer(2,0,0,0,3),
                            new StraightTrunkPlacer(4,2,0),
                            new TwoLayerFeature(1,0,1))
                            .func_236700_a_().func_236703_a_(ImmutableList.of(new BeehiveTreeDecorator(0.002F))).build()
            ).withPlacement(Placement.COUNT_EXTRA_HEIGHTMAP.configure(new AtSurfaceWithExtraConfig(2,0.1F,1)));

This is my tree config code. I'm getting the following error:

net.minecraft.world.gen.feature.DecoratedFeatureConfig cannot be cast to net.minecraft.world.gen.feature.BaseTreeFeatureConfig

Link to comment
Share on other sites

[15Sep2021 18:45:47.320] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmluserdevclient, --fml.mcpVersion, 20200625.160719, --fml.mcVersion, 1.16.1, --fml.forgeGroup, net.minecraftforge, --fml.forgeVersion, 32.0.108, --version, MOD_DEV, --assetIndex, 1.16, --assetsDir, C:\Users\wsode\.gradle\caches\forge_gradle\assets, --username, Dev, --accessToken, ????????, --userProperties, {}]
[15Sep2021 18:45:47.335] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 6.1.3+75+master.851120a starting: java version 1.8.0_302 by Temurin
[15Sep2021 18:45:47.617] [main/INFO] [net.minecraftforge.fml.loading.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust
[15Sep2021 18:45:47.648] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8 Source=file:/C:/Users/wsode/.gradle/caches/modules-2/files-2.1/org.spongepowered/mixin/0.8/dbe9e5db694a7c3cd644d5bb98f8a21295c75048/mixin-0.8.jar Service=ModLauncher Env=CLIENT
[15Sep2021 18:45:48.756] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'fmluserdevclient' with arguments [--version, MOD_DEV, --gameDir, ., --assetsDir, C:\Users\wsode\.gradle\caches\forge_gradle\assets, --assetIndex, 1.16, --username, Dev, --accessToken, ????????, --userProperties, {}]
[15Sep2021 18:45:59.119] [Render thread/INFO] [com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService/]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', name='PROD'
[15Sep2021 18:45:59.139] [Render thread/INFO] [net.minecraft.client.Minecraft/]: Setting user: Dev
[15Sep2021 18:45:59.432] [Render thread/INFO] [net.minecraft.client.Minecraft/]: Backend library: LWJGL version 3.2.2 build 10
[15Sep2021 18:46:00.478] [modloading-worker-1/INFO] [net.minecraftforge.common.ForgeMod/FORGEMOD]: Forge mod loading, version 32.0.108, for MC 1.16.1 with MCP 20200625.160719
[15Sep2021 18:46:00.478] [modloading-worker-1/INFO] [net.minecraftforge.common.MinecraftForge/FORGE]: MinecraftForge v32.0.108 Initialized
[15Sep2021 18:46:00.870] [Render thread/INFO] [geodemod/]: Registering Blocks
[15Sep2021 18:46:00.980] [Render thread/INFO] [geodemod/]: Registering Items
[15Sep2021 18:46:01.003] [Render thread/ERROR] [net.minecraft.util.Util/]: No data fixer registered for red_mushroom_chicken
[15Sep2021 18:46:01.012] [Render thread/ERROR] [net.minecraft.util.Util/]: No data fixer registered for red_creeper
[15Sep2021 18:46:01.015] [Render thread/INFO] [geodemod/]: Registering Biomes
[15Sep2021 18:46:01.074] [Render thread/INFO] [geodemod/]: Registering Entities
[15Sep2021 18:46:03.793] [Render thread/INFO] [com.mojang.text2speech.NarratorWindows/]: Narrator library for x64 successfully loaded
[15Sep2021 18:46:03.870] [Render thread/INFO] [net.minecraft.resources.SimpleReloadableResourceManager/]: Reloading ResourceManager: Default, Mod Resources
[15Sep2021 18:46:03.892] [modloading-worker-4/INFO] [geodemod/]: Mod Setup Step
[15Sep2021 18:46:03.926] [modloading-worker-4/INFO] [geodemod/]: Client Setup Step
[15Sep2021 18:46:03.937] [Forge Version Check/INFO] [net.minecraftforge.fml.VersionChecker/]: [forge] Starting version check at https://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[15Sep2021 18:46:04.809] [Forge Version Check/INFO] [net.minecraftforge.fml.VersionChecker/]: [forge] Found status: BETA Current: 32.0.108 Target: 32.0.108
[15Sep2021 18:46:08.028] [Render thread/INFO] [net.minecraft.client.audio.SoundSystem/]: OpenAL initialized.
[15Sep2021 18:46:08.029] [Render thread/INFO] [net.minecraft.client.audio.SoundEngine/SOUNDS]: Sound engine started
[15Sep2021 18:46:08.198] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 1024x512x4 minecraft:textures/atlas/blocks.png-atlas
[15Sep2021 18:46:08.222] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 256x128x4 minecraft:textures/atlas/signs.png-atlas
[15Sep2021 18:46:08.222] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 512x512x4 minecraft:textures/atlas/banner_patterns.png-atlas
[15Sep2021 18:46:08.222] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 512x512x4 minecraft:textures/atlas/shield_patterns.png-atlas
[15Sep2021 18:46:08.223] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 256x256x4 minecraft:textures/atlas/chest.png-atlas
[15Sep2021 18:46:08.223] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 512x256x4 minecraft:textures/atlas/beds.png-atlas
[15Sep2021 18:46:08.223] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 512x256x4 minecraft:textures/atlas/shulker_boxes.png-atlas
[15Sep2021 18:46:08.647] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 256x256x0 minecraft:textures/atlas/particles.png-atlas
[15Sep2021 18:46:08.648] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 256x256x0 minecraft:textures/atlas/paintings.png-atlas
[15Sep2021 18:46:08.648] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 128x128x0 minecraft:textures/atlas/mob_effects.png-atlas
[15Sep2021 18:46:09.055] [Realms Notification Availability checker #1/INFO] [com.mojang.realmsclient.client.RealmsClient/]: Could not authorize you against Realms server: Invalid session id
[15Sep2021 18:46:19.715] [Render thread/WARN] [net.minecraft.command.Commands/]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498]
[15Sep2021 18:46:19.716] [Render thread/WARN] [net.minecraft.command.Commands/]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[15Sep2021 18:46:19.716] [Render thread/WARN] [net.minecraft.command.Commands/]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0]
[15Sep2021 18:46:19.717] [Render thread/WARN] [net.minecraft.command.Commands/]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498]
[15Sep2021 18:46:19.717] [Render thread/WARN] [net.minecraft.command.Commands/]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[15Sep2021 18:46:19.721] [Render thread/INFO] [net.minecraft.resources.SimpleReloadableResourceManager/]: Reloading ResourceManager: Default, forge-1.16.1-32.0.108_mapped_snapshot_20200514-1.16-recomp.jar, main
[15Sep2021 18:46:21.581] [Render thread/INFO] [net.minecraft.item.crafting.RecipeManager/]: Loaded 7 recipes
[15Sep2021 18:46:22.982] [Render thread/INFO] [net.minecraft.advancements.AdvancementList/]: Loaded 927 advancements
[15Sep2021 18:46:23.135] [Render thread/INFO] [net.minecraftforge.registries.GameData/REGISTRIES]: Injecting existing registry data into this CLIENT instance
[15Sep2021 18:46:23.446] [Render thread/INFO] [com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService/]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', name='PROD'
[15Sep2021 18:46:23.522] [Server thread/INFO] [net.minecraft.server.integrated.IntegratedServer/]: Starting integrated minecraft server version 1.16.1
[15Sep2021 18:46:23.523] [Server thread/INFO] [net.minecraft.server.integrated.IntegratedServer/]: Generating keypair
[15Sep2021 18:46:24.126] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Preparing start region for dimension minecraft:overworld
[15Sep2021 18:46:24.426] [Render thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Preparing spawn area: 0%
[15Sep2021 18:46:24.594] [Render thread/INFO] [net.minecraft.world.chunk.listener.LoggingChunkStatusListener/]: Time elapsed: 468 ms
[15Sep2021 18:46:24.735] [Server thread/INFO] [net.minecraft.server.integrated.IntegratedServer/]: Changing view distance to 11, from 10
[15Sep2021 18:46:25.841] [Netty Local Client IO #0/INFO] [net.minecraftforge.fml.network.NetworkHooks/]: Connected to a modded server.
[15Sep2021 18:46:25.886] [Server thread/INFO] [net.minecraftforge.common.AdvancementLoadFix/]: Using new advancement loading for net.minecraft.advancements.PlayerAdvancements@5ffb5413
[15Sep2021 18:46:25.899] [Server thread/INFO] [net.minecraft.server.management.PlayerList/]: Dev[local:E:7dcf0608] logged in with entity id 83 at (-11.662333709986715, 4.0, 24.741047174960396)
[15Sep2021 18:46:25.915] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Dev joined the game
[15Sep2021 18:46:26.750] [Server thread/INFO] [net.minecraft.server.integrated.IntegratedServer/]: Saving and pausing game...
[15Sep2021 18:46:26.760] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving chunks for level 'ServerLevel[Sapling Experiments]'/minecraft:overworld
[15Sep2021 18:46:26.858] [Render thread/INFO] [net.minecraft.advancements.AdvancementList/]: Loaded 3 advancements
[15Sep2021 18:46:26.860] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving chunks for level 'ServerLevel[Sapling Experiments]'/minecraft:the_nether
[15Sep2021 18:46:26.862] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving chunks for level 'ServerLevel[Sapling Experiments]'/minecraft:the_end
[15Sep2021 18:46:36.594] [Server thread/FATAL] [net.minecraft.util.concurrent.ThreadTaskExecutor/]: Error executing task on Server
java.lang.ClassCastException: net.minecraft.world.gen.feature.DecoratedFeatureConfig cannot be cast to net.minecraft.world.gen.feature.BaseTreeFeatureConfig
	at net.minecraft.block.trees.Tree.func_230339_a_(Tree.java:28) ~[?:?]
	at net.minecraft.block.SaplingBlock.func_226942_a_(SaplingBlock.java:46) ~[?:?]
	at net.minecraft.block.SaplingBlock.grow(SaplingBlock.java:63) ~[?:?]
	at net.minecraft.item.BoneMealItem.applyBonemeal(BoneMealItem.java:70) ~[?:?]
	at net.minecraft.item.BoneMealItem.onItemUse(BoneMealItem.java:33) ~[?:?]
	at net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(ForgeHooks.java:601) ~[?:?]
	at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:190) ~[?:?]
	at net.minecraft.server.management.PlayerInteractionManager.func_219441_a(PlayerInteractionManager.java:359) ~[?:?]
	at net.minecraft.network.play.ServerPlayNetHandler.processTryUseItemOnBlock(ServerPlayNetHandler.java:923) ~[?:?]
	at net.minecraft.network.play.client.CPlayerTryUseItemOnBlockPacket.processPacket(CPlayerTryUseItemOnBlockPacket.java:45) ~[?:?]
	at net.minecraft.network.play.client.CPlayerTryUseItemOnBlockPacket.processPacket(CPlayerTryUseItemOnBlockPacket.java:12) ~[?:?]
	at net.minecraft.network.PacketThreadUtil.lambda$checkThreadAndEnqueue$0(PacketThreadUtil.java:19) ~[?:?]
	at net.minecraft.util.concurrent.TickDelayedTask.run(TickDelayedTask.java:20) ~[?:?]
	at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:139) ~[?:?]
	at net.minecraft.util.concurrent.RecursiveEventLoop.run(RecursiveEventLoop.java:22) ~[?:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:760) ~[?:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:157) ~[?:?]
	at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:109) ~[?:?]
	at net.minecraft.server.MinecraftServer.driveOneInternal(MinecraftServer.java:743) ~[?:?]
	at net.minecraft.server.MinecraftServer.driveOne(MinecraftServer.java:737) ~[?:?]
	at net.minecraft.util.concurrent.ThreadTaskExecutor.driveUntil(ThreadTaskExecutor.java:122) ~[?:?]
	at net.minecraft.server.MinecraftServer.runScheduledTasks(MinecraftServer.java:723) ~[?:?]
	at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:669) ~[?:?]
	at net.minecraft.server.MinecraftServer.lambda$func_240784_a_$0(MinecraftServer.java:231) ~[?:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_302]
[15Sep2021 18:46:38.387] [Server thread/INFO] [net.minecraft.server.integrated.IntegratedServer/]: Saving and pausing game...
[15Sep2021 18:46:38.393] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving chunks for level 'ServerLevel[Sapling Experiments]'/minecraft:overworld
[15Sep2021 18:46:38.445] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving chunks for level 'ServerLevel[Sapling Experiments]'/minecraft:the_nether
[15Sep2021 18:46:38.446] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving chunks for level 'ServerLevel[Sapling Experiments]'/minecraft:the_end
[15Sep2021 18:58:08.844] [Server thread/INFO] [net.minecraft.network.play.ServerPlayNetHandler/]: Dev lost connection: Disconnected
[15Sep2021 18:58:08.845] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Dev left the game
[15Sep2021 18:58:08.850] [Server thread/INFO] [net.minecraft.network.play.ServerPlayNetHandler/]: Stopping singleplayer server as player logged out
[15Sep2021 18:58:08.887] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Stopping server
[15Sep2021 18:58:08.887] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving players
[15Sep2021 18:58:08.887] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving worlds
[15Sep2021 18:58:08.887] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving chunks for level 'ServerLevel[Sapling Experiments]'/minecraft:overworld
[15Sep2021 18:58:09.024] [Server thread/INFO] [net.minecraft.world.server.ChunkManager/]: ThreadedAnvilChunkStorage (Sapling Experiments): All chunks are saved
[15Sep2021 18:58:09.024] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving chunks for level 'ServerLevel[Sapling Experiments]'/minecraft:the_nether
[15Sep2021 18:58:09.025] [Server thread/INFO] [net.minecraft.world.server.ChunkManager/]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
[15Sep2021 18:58:09.025] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving chunks for level 'ServerLevel[Sapling Experiments]'/minecraft:the_end
[15Sep2021 18:58:09.025] [Server thread/INFO] [net.minecraft.world.server.ChunkManager/]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
[15Sep2021 18:58:09.039] [Server thread/INFO] [net.minecraft.world.server.ChunkManager/]: ThreadedAnvilChunkStorage (Sapling Experiments): All chunks are saved
[15Sep2021 18:58:09.050] [Server thread/INFO] [net.minecraft.world.server.ChunkManager/]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
[15Sep2021 18:58:09.051] [Server thread/INFO] [net.minecraft.world.server.ChunkManager/]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
[15Sep2021 18:58:09.743] [Render thread/INFO] [net.minecraft.client.Minecraft/]: Stopping!

Here is the full log

Link to comment
Share on other sites

I have:

public class MapleTreeFeature extends TreeFeature {
    public MapleTreeFeature(Codec<BaseTreeFeatureConfig> p_i231999_1_) {
        super(p_i231999_1_);
    }
}

and:

public class MapleTree extends Tree {

    @Nullable
    @Override
    protected ConfiguredFeature<BaseTreeFeatureConfig, ?> getTreeFeature(Random randomIn, boolean p_225546_2_) {
        return  TreeGenerator.MAPLE;
    }
}

It's possible that the problem could be something related to the version since I based this code off of something from 16.5

Edited by Willzigos
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
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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Hello, I'm using the Forge 37.0.126 MDK with eclipse and GitHub Desktop. And sth. keeps generating a .gitignore file in bin/main, that I don't want there. What program generates it and how can I disable it?
    • Hi everyone, I use the Curse Forge app for overwatch and I created a plain 1.17.1 forge 37.1.0 profile. It crashes immediately when I click "play" in the minecraft launcher. I just installed Java 16 and set minecraft to use it in the curse forge app settings. I don't have any mods installed and my log looks like this: [12:36:42] [main/INFO]: ModLauncher running: args [--username, MrKatuffel, --version, forge-37.1.0, --gameDir, C:\Users\Benni\Documents\Minecraft\Instances\1.17.1, --assetsDir, C:\Users\Benni\Documents\Minecraft\Install\assets, --assetIndex, 1.17, --uuid, 2021e6cbc7bc4d2a81effa163cfd62d9, --accessToken, ????????, --userType, mojang, --versionType, release, --width, 1024, --height, 768, --launchTarget, forgeclient, --fml.forgeVersion, 37.1.0, --fml.mcVersion, 1.17.1, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20210706.113038] [12:36:42] [main/INFO]: ModLauncher 9.0.7+91+master.8569cdf starting: java version 16.0.1 by Microsoft [12:36:42] [main/INFO]: SpongePowered MIXIN Subsystem Version=0.8.4 Source=union:/C:/Users/Benni/Documents/Minecraft/Install/libraries/org/spongepowered/mixin/0.8.4/mixin-0.8.4.jar%2318! Service=ModLauncher Env=CLIENT [12:36:43] [main/INFO]: Found mod file fmlcore-1.17.1-37.1.0.jar of type LIBRARY with locator net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@6cc0bcf6 [12:36:43] [main/INFO]: Found mod file javafmllanguage-1.17.1-37.1.0.jar of type LANGPROVIDER with locator net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@6cc0bcf6 [12:36:43] [main/INFO]: Found mod file mclanguage-1.17.1-37.1.0.jar of type LANGPROVIDER with locator net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@6cc0bcf6 [12:36:43] [main/INFO]: Found mod file client-1.17.1-20210706.113038-srg.jar of type MOD with locator net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@6cc0bcf6 [12:36:43] [main/INFO]: Found mod file forge-1.17.1-37.1.0-universal.jar of type MOD with locator net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@6cc0bcf6 So I can see it is indeed using Java 16. The error message of the minecraft launcher is just: So that isn't helping. Anyone have any ideas?
    • Further testing revealed that Forge will not successfully load any library in the IDE at all, if the library is not a mod. This means this is either a Forge bug, or the way to include a library at runtime has been changed. Tested with a random library for Java not included in Minecraft or Forge: build.gradle dependencies { minecraft 'net.minecraftforge:forge:1.18-38.0.8' implementation 'com.github.ben-manes.caffeine:caffeine:3.0.4' } ExampleMod.java package com.example.examplemod; import com.github.benmanes.caffeine.cache.Caffeine; import net.minecraftforge.fml.common.Mod; @Mod("examplemod") public class ExampleMod { public ExampleMod() { Caffeine<Object, Object> graphs = Caffeine.newBuilder(); } } Will result in java.lang.NoClassDefFoundError: com/github/benmanes/caffeine/cache/Caffeine Should I file a bug report?
    • Thank you! I managed to get this working finally after puzzling through it, and your answer gave me a good place to start. I ended up using a combination of several for loops and an int array which was filled with the values of my "weight" json attribute for each recipe. Iterating through each recipe in my main list, I could add to a new array several repeats of the same number for the weight, and this number would correlate to a specific recipe in the main list. E.g. if the weight for the recipe in index 0 was 5, then 0 would be added to the array 5 times. My random number would then be chosen from this new array, and the recipe fetched from the main list using it. This works like an absolute charm. Hope this helps anyone else that might stumble on this thread! 
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.