Jump to content

How to create a single biomed world type.


FrenziedMurder

Recommended Posts

Ok so.  My mod ive made a new World Type and im trying to make it ONLY generator my biome but everytime i run it it loads My biome, roofed forest rivers and oceans.  My goal is to make a custom river biome that instead of water is lava, and a custom ocean that is lava as well but get rid of the roofed forest.  If anyone can help me thatd be appreciated.

 

BiomeGenMYMOD

 

package net.MYMOD.biomes;

 

import net.minecraft.entity.monster.EntitySlime;

import net.minecraft.init.Blocks;

import net.minecraft.world.biome.BiomeGenBase;

 

public class BiomeGenMYMOD extends BiomeGenBase

{

 

public BiomeGenMYMOD(int id){

super(id);

this.topBlock = Blocks.diamond_block;

this.fillerBlock = Blocks.gold_block;

 

}

 

}

 

The diamond block was just to find it easier

BiomeRegister

 

package net.MYMOD.biomes;

 

import net.minecraft.world.biome.BiomeGenBase;

import net.minecraftforge.common.BiomeDictionary;

import net.minecraftforge.common.BiomeDictionary.Type;

import net.minecraftforge.common.BiomeManager;

 

public class BiomeRegistry

{

 

public static void MYMOD()

{

initializeBiome();

registerBiome();

}

 

public static BiomeGenBase MYMOD;

 

public static void initializeBiome()

{

 

MYMOD = new BiomeGenMYMOD(137).setBiomeName("MYMOD");

 

}

 

public static void registerBiome(){

BiomeDictionary.registerBiomeType(MYMOD, Type.FOREST);

BiomeManager.addSpawnBiome(MYMOD);

 

}

 

}

 

MYMODGenLayerBiome

 

package net.MYMOD.biomes;

 

import java.util.ArrayList;

import java.util.List;

 

import net.minecraft.util.WeightedRandom;

import net.minecraft.world.WorldType;

import net.minecraft.world.biome.BiomeGenBase;

import net.minecraft.world.gen.layer.GenLayer;

import net.minecraft.world.gen.layer.IntCache;

import net.minecraftforge.common.BiomeManager;

import net.minecraftforge.common.BiomeManager.BiomeEntry;

 

public class MYMODGenLayerBiome extends GenLayer

{

    private List<BiomeEntry> desertBiomes = new ArrayList<BiomeEntry>();

    private List<BiomeEntry> warmBiomes = new ArrayList<BiomeEntry>();

    private List<BiomeEntry> coolBiomes = new ArrayList<BiomeEntry>();

    private List<BiomeEntry> icyBiomes = new ArrayList<BiomeEntry>();

   

    private static final String __OBFID = "CL_00000555";

 

    public MYMODGenLayerBiome(long p_i2122_1_, GenLayer p_i2122_3_, WorldType p_i2122_4_)

    {

        super(p_i2122_1_);

       

        this.parent = p_i2122_3_;

       

        this.desertBiomes.addAll(BiomeManager.desertBiomes);

        this.warmBiomes.addAll(BiomeManager.warmBiomes);

        this.coolBiomes.addAll(BiomeManager.coolBiomes);

        this.icyBiomes.addAll(BiomeManager.icyBiomes);

       

        if (p_i2122_4_ == WorldType.DEFAULT_1_1)

        {

            //desertBiomes.add(new BiomeEntry(BiomeGenBase.desert, 10));

            //desertBiomes.add(new BiomeEntry(BiomeGenBase.forest, 10));

            //desertBiomes.add(new BiomeEntry(BiomeGenBase.extremeHills, 10));

            //desertBiomes.add(new BiomeEntry(BiomeGenBase.swampland, 10));

            //desertBiomes.add(new BiomeEntry(BiomeGenBase.plains, 10));

            //desertBiomes.add(new BiomeEntry(BiomeGenBase.taiga, 10));

            desertBiomes.add(new BiomeEntry(BiomeRegistry.MYMOD, 10));

        }

        else

        {

          //desertBiomes.add(new BiomeEntry(BiomeGenBase.desert, 30));

          //desertBiomes.add(new BiomeEntry(BiomeGenBase.savanna, 20));

          //desertBiomes.add(new BiomeEntry(BiomeGenBase.plains, 10));

        desertBiomes.add(new BiomeEntry(BiomeRegistry.MYMOD, 10));

        }

    }

 

    /**

    * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall

    * amounts, or biomeList[] indices based on the particular GenLayer subclass.

    */

    public int[] getInts(int p_75904_1_, int p_75904_2_, int p_75904_3_, int p_75904_4_)

    {

        int[] aint = this.parent.getInts(p_75904_1_, p_75904_2_, p_75904_3_, p_75904_4_);

        int[] aint1 = IntCache.getIntCache(p_75904_3_ * p_75904_4_);

 

        for (int i1 = 0; i1 < p_75904_4_; ++i1)

        {

            for (int j1 = 0; j1 < p_75904_3_; ++j1)

            {

                this.initChunkSeed((long)(j1 + p_75904_1_), (long)(i1 + p_75904_2_));

                int k1 = aint[j1 + i1 * p_75904_3_];

                int l1 = (k1 & 3840) >> 8;

                k1 &= -3841;

 

                if (isBiomeOceanic(BiomeRegistry.MYMOD.biomeID))

                {

                    aint1[j1 + i1 * p_75904_3_] = BiomeRegistry.MYMOD.biomeID;

                }

                else if (k1 == BiomeRegistry.MYMOD.biomeID)

                {

                    aint1[j1 + i1 * p_75904_3_] = BiomeRegistry.MYMOD.biomeID;

                }

                else if (k1 == 1)

                {

                    if (l1 > 0)

                    {

                        if (this.nextInt(3) == 0)

                        {

                            aint1[j1 + i1 * p_75904_3_] = BiomeRegistry.MYMOD.biomeID;

                        }

                        else

                        {

                            aint1[j1 + i1 * p_75904_3_] = BiomeRegistry.MYMOD.biomeID;

                        }

                    }

                    else

                    {

                        aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.desertBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.desertBiomes) / 10) * 10))).biome.biomeID;

                    }

                }

                else if (k1 == 2)

                {

                    if (l1 > 0)

                    {

                        aint1[j1 + i1 * p_75904_3_] = BiomeRegistry.MYMOD.biomeID;

                    }

                    else

                    {

                        aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.warmBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.warmBiomes) / 10) * 10))).biome.biomeID;

                    }

                }

                else if (k1 == 3)

                {

                    if (l1 > 0)

                    {

                        aint1[j1 + i1 * p_75904_3_] = BiomeRegistry.MYMOD.biomeID;

                    }

                    else

                    {

                        aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.coolBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.coolBiomes) / 10) * 10))).biome.biomeID;

                    }

                }

                else if (k1 == 4)

                {

                    aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.icyBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.icyBiomes) / 10) * 10))).biome.biomeID;

                }

                else

                {

                    aint1[j1 + i1 * p_75904_3_] = BiomeRegistry.MYMOD.biomeID;

                }

            }

        }

 

        return aint1;

    }

}

 

WorldTypeMYMOD

 

package net.MYMOD.biomes;

 

import net.minecraft.world.WorldType;

import net.minecraft.world.gen.layer.GenLayer;

import net.minecraft.world.gen.layer.GenLayerBiome;

import net.minecraft.world.gen.layer.GenLayerBiomeEdge;

import net.minecraft.world.gen.layer.GenLayerZoom;

 

public class WorldTypeMYMOD extends WorldType

{

 

public WorldTypeMYMOD(int par1, String name)

{

super(name);

}

 

 

public GenLayer getBiomeLayer(long worldSeed, GenLayer parentLayer)

    {

        GenLayer ret = new MYMODGenLayerBiome(200L, parentLayer, this);

        ret = GenLayerZoom.magnify(1000L, ret, 2);

        ret = new GenLayerBiomeEdge(1000L, ret);

        return ret;

    }

 

}

 

MYMOD(MainFile)

 

 

package net.MYMOD.mod;

 

import net.MYMOD.biomes.BiomeRegistry;

import net.MYMOD.biomes.WorldTypeMYMOD;

import net.minecraft.block.Block;

import net.minecraft.init.Blocks;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.world.WorldType;

import net.minecraft.world.biome.BiomeGenBase;

import net.minecraftforge.common.MinecraftForge;

import cpw.mods.fml.common.FMLCommonHandler;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

import cpw.mods.fml.common.event.FMLPostInitializationEvent;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import cpw.mods.fml.common.registry.EntityRegistry;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.common.registry.LanguageRegistry;

 

@Mod(modid = MYMOD.modid, version = MYMOD.version)

public class MYMOD

{

    public static final String modid = "MYMOD";

    public static final String version = "Alpha v0.1";

 

   

    @EventHandler

    public void preinit(FMLPreInitializationEvent event)

    {

    //Items

    //Register Items

        //Register Biomes

        BiomeRegistry.MYMOD();

        //Remove Biomes

       

    }

    @EventHandler

    public void PostLoad(FMLPostInitializationEvent PostEvent)

    {

    WorldType MYMOD = new WorldTypeMYMOD(15, "MYMOD");

    }

}

 

 

I havent made the River or Ocean Biome Gen because i dont know how to go about doing that and making it lava instead of water.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Here's a simple example to solve this particular issue: public class ModArmorMaterials { public static final DeferredRegister<ArmorMaterial> ARMORS = DeferredRegister.create(Registries.ARMOR_MATERIAL, MyModName.MOD_ID); public static final RegistryObject<ArmorMaterial> COPPER = registerArmor("copper", Util.make(new EnumMap<>(ArmorItem.Type.class), enumMap -> { enumMap.put(ArmorItem.Type.BOOTS, 1); enumMap.put(ArmorItem.Type.LEGGINGS, 4); enumMap.put(ArmorItem.Type.CHESTPLATE, 5); enumMap.put(ArmorItem.Type.HELMET, 2); enumMap.put(ArmorItem.Type.BODY, 4); }), 12, SoundEvents.ARMOR_EQUIP_IRON, 0.0F, 0.0F, () -> Ingredient.of(Items.COPPER_INGOT)); private static RegistryObject<ArmorMaterial> registerArmor(String pGroup, EnumMap<ArmorItem.Type, Integer> pEnumMap, int pEnchantmentValue, Holder<SoundEvent> pEquipSound, float pToughness, float pKnockbackResistance, Supplier<Ingredient> pRepairIngredient) { List<ArmorMaterial.Layer> pLayerList = List.of(new ArmorMaterial.Layer(new ResourceLocation(pGroup))); return registerArmor(pGroup, pEnumMap, pEnchantmentValue, pEquipSound, pToughness, pKnockbackResistance, pRepairIngredient, pLayerList); } private static RegistryObject<ArmorMaterial> registerArmor( String pGroup, EnumMap<ArmorItem.Type, Integer> pEnumMap, int pEnchantmentValue, Holder<SoundEvent> pEquipSound, float pToughness, float pKnockbackResistance, Supplier<Ingredient> pRepairIngredient, List<ArmorMaterial.Layer> pLayerList) { return ARMORS.register(pGroup, () -> new ArmorMaterial(pEnumMap, pEnchantmentValue, pEquipSound, pRepairIngredient, pLayerList, pToughness, pKnockbackResistance)); } public static void register(IEventBus eventBus) { ARMORS.register(eventBus); } } Essentially, the TierSortingRegistry has been removed and so you now need to set up your own DeferredRegister. Please see the minecraftforge GitHub for more information; I found this solution through their issues (https://github.com/MinecraftForge/MinecraftForge/issues/9961)
    • How did I even leave that in there? I’ll try it in a bit, that very well could be it.
    • Greetings, I met a problem with my Forge server (47.2.0-1.20.1) that I can't join with the following line. (singleplayer world working fine) [net.minecraft.server.network.ServerGamePacketListenerImpl/]: Sharyna lost connection: Internal Exception: io.netty.handler.codec.EncoderException: java.lang.NullPointerException: Cannot invoke "net.minecraft.resources.ResourceLocation.toString()" because "p_130086_" is null   At first it was errored with packet size error, but I fixed that with the Connectivity mod, however, after that this popped up and can't find the source of it. Since the logs are big, I couldn't upload on paste.gg or other site ... so here it is (if the files are deleted, please notice me and I'll upload again. Debug and Latest log
    • Дерево тис
  • Topics

×
×
  • Create New...

Important Information

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