Jump to content

[1.7.2] Biome Top and Filler Blocks not working with custom blocks


Recommended Posts

Posted

Hello,

 

I wanted to add a new biome, after a few tries and hours of flying around (I even added an Item for increasing the flying speed just to find it), I found my biome, but the top and filler blocks don't generate, but when I choose vanilla blocks, it works. Now, I guess this is because my custom block's ID exceeds 256, as it was in 1.6.4, but since GameRegistry.registerBlock(); automatically registers an ID, I don't know how to go about this problem.

 

Anyone know what to do?

 

Thanks in advance.

Posted

I have left out anything unrelated

 

MainClass:

package com.nignog.mymod;

@Mod(modid = MainClass.MODID, name = MainClass.NAME, version = MainClass.VERSION)
public class MainClass {
@SidedProxy(clientSide = "com.nignog.mymod.ClientProxy", serverSide = "com.nignog.mymod.CommonProxy")
public static CommonProxy proxy;

public static final String MODID = "mymod";
public static final String VERSION = "3.14159";
public static final String NAME = "My Mod";

public static BiomeGenBase biomeAustralia = new BiomeAustralia(42);

// Blocks
public static Block australiumDust = new AustraliumDust(Material.ground);
public static Block diamondOreDisguise = new DiamondOreDisguise(
		Material.ground);

@EventHandler
public void preinit(FMLPreInitializationEvent e) {

	// Biome Registry
	ModBiomeRegistry.init();

	// Block Registry
	ModBlockRegistry.init();
}

@EventHandler
public void load(FMLInitializationEvent event) {

}

@EventHandler
public void init(FMLPostInitializationEvent event) {

}
}

 

BiomeAustralia:

package com.nignog.mymod.biomes;

import net.minecraft.world.biome.BiomeGenBase;

import com.nignog.mymod.MainClass;

public class BiomeAustralia extends BiomeGenBase {

public BiomeAustralia(int id) {
	super(id);
	setBiomeName("Australia");
	fillerBlock = MainClass.diamondOreDisguise;
	topBlock = MainClass.australiumDust;
	setDisableRain();
	setHeight(height_MidPlains);
	theBiomeDecorator.treesPerChunk = -999;
	theBiomeDecorator.generateLakes = true;
}
}

 

ModBiomeRegistry:

package com.nignog.mymod;

import net.minecraftforge.common.BiomeManager;

public class ModBiomeRegistry {
public static void init() {
	BiomeManager.warmBiomes.add(new BiomeManager.BiomeEntry(
			MainClass.biomeAustralia, 420));
	BiomeManager.addSpawnBiome(MainClass.biomeAustralia);
}
}

Posted

First of all: Don't create any game elements (Biomes, Blocks, Items, etc.) in a static initializer. You must do it in preInit.

And then: You need to create your Biome after your Blocks are created.

 

For Blocks and Items, it doesn't do any harm when you instanciate them in the static initializer anymore (since the removal of the block / item IDs). All the super constructor of a block / item does is setting some internal variables.

For everything else, yes, do it in preInit (since it usually has an ID in its constructor, like for biomes)

Registering them is another story, this should always go into the preInit.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

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.