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

[1.16.5] Biomes


tal124
 Share

Recommended Posts

I am trying to make a Biome(and plan to make multiple more) But I can't figure out what's wrong with my registry, It gives me a red line for this code

BIOMES.register("chocolate_forest", ChocolateForest::new);

it tells me that "no instance(s) of type variable(s) exist so that ChocolateForest conforms to Biome inference variable I has incompatible bounds: equality constraints: Biome lower bounds: ChocolateForest"

here's the full code

public class ModBiomes {
    public static final DeferredRegister<Biome> BIOMES = DeferredRegister.create(ForgeRegistries.BIOMES, chocolate.MODID);

    public static void init() { BIOMES.register(FMLJavaModLoadingContext.get().getModEventBus()); }

    public static final RegistryObject<Biome> CHOCOLATE_FOREST = BIOMES.register("chocolate_forest", ChocolateForest::new);

}

I have tried to extend Biome to my ChocolateForest class as was shown in an 1.15 tutorial, but I guess something was switched around since then as it tells me that Biome doesn't have a default constructor to take from.

I have also tried looking for something similar and possibly renamed in the code but without any luck.

And heres my ChocolateForest class just in case you need it.

public class ChocolateForest{

    protected ChocolateForest() {
        super();
    }

    protected void configureBiome(Biome.Builder builder) {
        builder.precipitation(Biome.RainType.RAIN).category(Biome.Category.FOREST).depth(-0.1F).temperature(0.6F).downfall(0.9F);

        builder.setEffects((new BiomeAmbience.Builder()).setWaterColor(329011).setWaterFogColor(329011).setFogColor(12638463).withSkyColor(5).withGrassColor(0x85CE71).withFoliageColor(0x63BF66).build());
    }

    protected void configureGeneration(BiomeGenerationSettings.Builder builder) {
        builder.withSurfaceBuilder(ConfiguredSurfaceBuilders.GRASS);

        DefaultBiomeFeatures.withOverworldOres(builder);
        DefaultBiomeFeatures.withCavesAndCanyons(builder);
        DefaultBiomeFeatures.withLavaAndWaterLakes(builder);
        DefaultBiomeFeatures.withMonsterRoom(builder);
    }
    protected void configureMobSpawns(MobSpawnInfo.Builder builder) {
        builder.withSpawner(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.SHEEP, 12, 4, 4));
        builder.withSpawner(EntityClassification.CREATURE, new MobSpawnInfo.Spawners(EntityType.PIG, 10, 4, 4));
        builder.withSpawner(EntityClassification.CREATURE, new MobSpawnInfo.Spawners(EntityType.CHICKEN, 10, 4, 4));
        builder.withSpawner(EntityClassification.CREATURE, new MobSpawnInfo.Spawners(EntityType.COW, 8, 4, 4));
        builder.withSpawner(EntityClassification.AMBIENT, new MobSpawnInfo.Spawners(EntityType.BAT, 10, 8, 8));
        builder.withSpawner(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.SPIDER, 100, 4, 4));
        builder.withSpawner(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.ZOMBIE, 95, 4, 4));
        builder.withSpawner(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.ZOMBIE_VILLAGER, 5, 1, 1));
        builder.withSpawner(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.SKELETON, 100, 4, 4));
        builder.withSpawner(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.CREEPER, 100, 4, 4));
        builder.withSpawner(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.SLIME, 100, 4, 4));
        builder.withSpawner(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.ENDERMAN, 10, 1, 4));
        builder.withSpawner(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.WITCH, 5, 1, 1));
        builder.withSpawner(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(ModEntities.CHOCOLATE_SLIME.get(), 100, 3, 7));
    }
}

I haven't completely finished it as of yet because I've been trying to work out the registry problem.
 

Link to comment
Share on other sites

Well, your ChocolateForest class is not extending the Biome class, its just a normal class that, for the compiler, has absolutely nothing to do with the Biome class. This is why the compiler is complaining there and not accepting the constructor of your class. On the other hand, it is true that you cannot extends the Biome class anymore, so you have to find a different way to obtain a Biome object to supply to your registry object. I suggest taking a good look here: https://github.com/Choonster-Minecraft-Mods/TestMod3/blob/1.16.x/src/main/java/choonster/testmod3/init/ModBiomes.java

Edited by Beethoven92

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

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.

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

    • I am trying to create a custom anvil for my mod and the approach i am trying is to create a normal vanilla anvil with custom recipe container - i tried creating the block and passing a custom container to it but i do feel a bit stuck and confused on how to do this. Some explanation and guidence would be great! Thanks in advance. package com.vassdeniss.makoru.blocks; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.inventory.container.SimpleNamedContainerProvider; import net.minecraft.stats.Stats; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.IWorldPosCallable; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.World; import net.minecraftforge.fml.network.NetworkHooks; public class AngelAnvilBlock extends Block { private static final ITextComponent AngelAnvilContainer = new TranslationTextComponent("container.crafting"); public AngelAnvilBlock() { super(Block.Properties.create()); } @Override public ActionResultType onBlockActivated(BlockState p_225533_1_, World worldIn, BlockPos p_225533_3_, PlayerEntity player, Hand p_225533_5_, BlockRayTraceResult p_225533_6_) { if (worldIn.isRemote) { return ActionResultType.SUCCESS; } else { NetworkHooks.openGui(player, ); player.addStat(Stats.INTERACT_WITH_ANVIL); return ActionResultType.CONSUME; } } @Override public INamedContainerProvider getContainer(BlockState state, World world, BlockPos pos) { return new SimpleNamedContainerProvider((id, inventory, player) -> new AngelAnvilContainer(id, inventory, IWorldPosCallable.of(world, pos)), AngelAnvilContainer); } } package com.vassdeniss.makoru.blocks; import com.vassdeniss.makoru.util.RegistryHandler; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.RepairContainer; import net.minecraft.util.IWorldPosCallable; public class AngelAnvilContainer extends RepairContainer { private final IWorldPosCallable field_217070_e; public AngelAnvilContainer(int id, PlayerInventory playerInventory, IWorldPosCallable p_i50102_3_) { super(id, playerInventory, p_i50102_3_); this.field_217070_e = p_i50102_3_; } @Override public boolean canInteractWith(PlayerEntity player) { return isWithinUsableDistance(this.field_217070_e, player, RegistryHandler.ANGEL_ANVIL.get()); } }  
    • I'm making some tools and I'm using a Set of type Block to specify on what blocks the tools would work. This is all in my ItemInit class which I use to register items. See below. private static Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.ANDESITE); This works fine with minecraft blocks. Problems occur when I want to use mod blocks like this: private static Set<Block> EFFECTIVE_ON = Sets.newHashSet(BlockInit.AMBER_BLOCK.get());   I get an error while loading the game, which is a NullPointerException.  Exception message: java.lang.NullPointerException: Registry Object not present: extinctioncraft:amber_block   It seems my block can't be found by this set despite the block working fine in the game itself.    I already tried the following without success: - Checked if the BlockInit is registered in the main class. ( BlockInit.BLOCKS.register(bus); ) - Checked if the block is registered in the BlockInit class. 
    • As the name implies I am trying to make a block with a "condition" value. I am doing this because I will be adding future features where a very strong type of block would be useful. I have started out with making a simple custom blockstate property (1-4) which determines the model (Polished, Un-polished, scuffed, cracked). However, I want those 4 states to then be determined by a larger number (more wiggle room with how much damage a certain event can do to this type of block). I was thinking 3000-5000, which I can then say "oh the block durability has to be at 200 to be cracked, but 750 for scuffed". I think the large health number think could be done with a tile entity I also want certain states to be maintained even after it has been picked up such as the larger number (maybe not the 1-4 since I think I would have to do something funky with datagen for my 90 items to have 360 item models), so perhaps NBT (which I have never done before). ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I could probably figure this out on my own given a good bit of time, but dual-enrollment does not allow much time in a day. So, basically just looking either for a github repos that shows persistent data & some funky tile entities (if that is the best route for the block health thing), or suggestions.    
    • ObfuscationReflectionHelper methods always take SRG names, even in the development environment. In development, the SRG name is automatically remapped to the corresponding MCP name.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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