Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I got my block class for the plant extending FlowerBlock

package com.lethalmap.stardewmod.common.blocks;


import com.lethalmap.stardewmod.Constants;
import net.minecraft.block.*;
import net.minecraft.block.material.Material;
import net.minecraft.potion.Effects;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;


public class Worms extends FlowerBlock {
    protected static final VoxelShape SHAPE = Block.makeCuboidShape(5.0D, 0.0D, 5.0D, 11.0D, 5.0D, 11.0D);

    public Worms() {
        super(Effects.WEAKNESS,9,Block.Properties.create(Material.PLANTS).doesNotBlockMovement().hardnessAndResistance(0).sound(SoundType.PLANT));
        setRegistryName(Constants.MODID,Constants.WORMS);
    }


    /**
     * Get the OffsetType for this Block. Determines if the model is rendered slightly offset.
     */
    public Block.OffsetType getOffsetType() {
        return Block.OffsetType.XZ;
    }

    @Override
    public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
        Vec3d vec3d = state.getOffset(worldIn, pos);
        return this.SHAPE.withOffset(vec3d.x, vec3d.y, vec3d.z);
    }
}

And got a class to generate things over the world, but I dont know how to generate this flower

package com.lethalmap.stardewmod.common.world;


import com.lethalmap.stardewmod.common.blocks.BlockList;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.GenerationStage;
import net.minecraft.world.gen.blockstateprovider.SimpleBlockStateProvider;
import net.minecraft.world.gen.feature.*;
import net.minecraftforge.registries.ForgeRegistries;


public class WormGeneration {
    public void WormGeneration(){
        for(Biome biome : ForgeRegistries.BIOMES)
        {
                biome.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, new DecoratedFeature(Feature.DECORATED_FLOWER, new SimpleBlockStateProvider(BlockList.worms));

        }
    }
}

I don´t know what to do to generate this, Im quite noob modding :(

  • Author
1 hour ago, Ugdhar said:

Check out vanilla code, it's super helpful :)

net.minecraft.world.biome.DefaultBiomeFeatures is where it's at :)

Im looking at it, but I don´t know what to do with that

3 minutes ago, BurstSword said:

Im looking at it, but I don´t know what to do with that

Well, you should have a basic-intermediate grasp of Java before starting modding, so you should be able to follow the code paths and see how features are set up.

Think of what already happens in Minecraft that is similar to what you want to do, and look at the code for it. So find where, say, the flowers are setup in the plains biome or something like that.

  • Author

I know how to program in Java, but there is 0 documentation, and sry if i dont understand a parameter called a_45437624_az

Ok, I think I see what you need to do, you need to put that in your FMLCommonSetupEvent , I believe using DeferredWorkQueue, because the biome stuff isn't threadsafe.

 

If you search these forums for DeferredWorkQueue, I believe there's an example of how it's used. And the FMLCommonSetupEvent I believe is demonstrated in the examplemod that comes with the MDK.

Edited by Ugdhar

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.