Jump to content

Problem with Chunk Provider


AssassinHero

Recommended Posts

I am making a chunk provider for my dimension. I have this error

 

Multiple markers at this line
- The method populate(IChunkProvider, World, Random, int, int, boolean, PopulateChunkEvent.Populate.EventType) in the type TerrainGen is not applicable for the arguments (IChunkProvider, World, Random, int, int, 
 boolean, InitMapGenEvent.EventType)
- LAKE cannot be resolved to a variable

 

But yet the tutorial I am following to help me has the same code here as me and it works fine for him. I am coding in the same version of forge and Minecraft to him so i don't understand this.

 

Here is the full code:

package assassinhero.parallelworlds;

import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE;
import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE;
import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE;

import java.util.List;
import java.util.Random;

import net.minecraft.block.BlockSand;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.util.IProgressUpdate;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.*;
import net.minecraft.world.gen.feature.*;
import net.minecraft.world.gen.structure.*;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
import net.minecraftforge.event.terraingen.TerrainGen;
public class ChunkProviderNight implements IChunkProvider {

private Random rand;

private World worldObj;

private final boolean mapFeaturesEnabled;


private double[] noiseArray;
private double[] stoneNoise = new double[256];
private MapGenBase caveGenerator = new MapGenCaves();
private MapGenVillage villageGenerator = new MapGenVillage();
private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature();
private BiomeGenBase[] biomesforGeneration;

{
	caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE);
	villageGenerator = (MapGenVillage)TerrainGen.getModdedMapGen(villageGenerator, VILLAGE);
	scatteredFeatureGenerator = (MapGenScatteredFeature)TerrainGen.getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE);
}


public ChunkProviderNight(World worldObj, long seed, boolean features) {
	this.worldObj = worldObj;
	this.mapFeaturesEnabled = features;
	this.rand = new Random(seed);

}


public boolean chunkExists(int i, int j) {

	return false;
}


public Chunk provideChunk(int i, int j) {

	return null; 
}


public Chunk loadChunk(int i, int j) {

	return null;
}


public void populate(IChunkProvider ichunkprovider, int i, int j) {
	BlockSand.fallInstantly = true;
	int k = i * 16;
	int l = j * 16;
	BiomeGenBase biome = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
	this.rand.setSeed(this.worldObj.getSeed());
	long i1 = this.rand.nextLong() / 2L * 2L + 1L;
	long j1 = this.rand.nextLong() / 2L * 2L + 1L;
	this.rand.setSeed((long)i * i1 + (long)j * j1 ^ this.worldObj.getSeed());
	boolean flag = false;

	MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(ichunkprovider, worldObj, rand, i, j, flag));


	if(mapFeaturesEnabled){
		this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, rand, i, j);
		flag = this.villageGenerator.generateStructuresInChunk(this.worldObj, rand, i, j);
	}

	int k1;
	int l1;
	int i2;

	if(biome != BiomeGenBase.desert && biome != BiomeGenBase.desertHills && !flag && this.rand.nextInt(4) == 0 && TerrainGen.populate(ichunkprovider, this.worldObj, rand, i, j, flag, LAKE)){

	}

}



public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) {

	return false;
}


public boolean unloadQueuedChunks() {

	return false;
}


public boolean canSave() {

	return false;
}


public String makeString() {

	return null;
}


public List getPossibleCreatures(EnumCreatureType enumcreaturetype, int i,
		int j, int k) {

	return null;
}


public ChunkPosition findClosestStructure(World world, String s, int i,
		int j, int k) {

	return null;
}


public int getLoadedChunkCount() {

	return 0;
}


public void recreateStructures(int i, int j) {


}


public void saveExtraData() {


}

}

STOP CRUCIFYING NEW MODDERS!!!!

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

    • They were already updated, and just to double check I even did a cleanup and fresh update from that same page. I'm quite sure drivers are not the problem here. 
    • i tried downloading the drivers but it says no AMD graphics hardware has been detected    
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
  • Topics

×
×
  • Create New...

Important Information

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