Jump to content

[1.11] SOLVED Fertilized Dirt HELP


Villfuk02

Recommended Posts

so i made this new 'Ore' called Fertilized Dirt. It generates in the dirt on the surface of a world, but i want it to generate more near Villages.

Is there a way to detect nerby Village when generating the world?

 

BTW The block makes stone sound, even though i've set the material to GROUND, but i think it's problem with Forge, or has anything changed since 1.10?

 

Thanx for any response

Link to comment
Share on other sites

setStepSound()

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

If I did, I'd have said something, but I didn't, so no.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Ok, i made 4 variants - each with different metadata (0-3) and i want them to be randomly mixed in the veins.

 

package vms.archeology.worldgen;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.init.Biomes;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.fml.common.IWorldGenerator;
import vms.archeology.blocks.FertilizedDirt;
import vms.archeology.init.ModBlocks;

public class DepositeGeneration implements IWorldGenerator{

private WorldGenerator villagers;

public DepositeGeneration() {
	fertilizedDirt = new WorldGenMinable(ModBlocks.fertilized_dirt.getDefaultState().withProperty(FertilizedDirt.DROP_ID, 0), 36, new DirtPredicate());
}

private void runGenerator(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight) {
	if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight)
		throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator");

	int heightDiff = maxHeight - minHeight + 1;
	for (int i = 0; i < chancesToSpawn; i ++) {
		int x = chunk_X * 16 + rand.nextInt(16);
	        int y = minHeight + rand.nextInt(heightDiff);
	        int z = chunk_Z * 16 + rand.nextInt(16);
	        generator.generate(world, rand, new BlockPos(x, y, z));
	}
}

@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
	switch(world.provider.getDimension()) {
	case 0:
		if(world.provider.getBiomeForCoords(new BlockPos(chunkX*16+random.nextInt(16),64,chunkZ*16+random.nextInt(16))) == Biomes.PLAINS){
			this.runGenerator(fertilizedDirt, world, random, chunkX, chunkZ, 50, 60, 90);
		}
	case 1:
		break;
	case -1:
		break;


	}
}

}

 

Link to comment
Share on other sites

I have this so far and i tried if it doesn't crash:

 

if (chunkGenerator instanceof ChunkProviderOverworld) {
			ChunkProviderOverworld cpOverworld = (ChunkProviderOverworld) chunkProvider;

			Field f;
			try {
				f = cpOverworld.getClass().getDeclaredField("villageGenerator");

				f.setAccessible(true);
				MapGenVillage genVillage = (MapGenVillage) f.get(cpOverworld);

				Utils.getLogger().info(genVillage.getStructureName());
			} catch (NoSuchFieldException e) {
				e.printStackTrace();
			} catch (SecurityException e) {
				e.printStackTrace();
			} catch (IllegalArgumentException e) {
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				e.printStackTrace();
			}

		}

 

But it crashes and i dont know why:

[19:14:52] [server thread/INFO]: Preparing start region for level 0
[19:14:53] [server thread/ERROR]: Encountered an unexpected exception
java.lang.ClassCastException: net.minecraft.world.gen.ChunkProviderServer cannot be cast to net.minecraft.world.gen.ChunkProviderOverworld
at vms.archeology.worldgen.DepositeGeneration.generate(DepositeGeneration.java:56) ~[DepositeGeneration.class:?]
at net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:122) ~[GameRegistry.class:?]
at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1070) ~[Chunk.class:?]
at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1052) ~[Chunk.class:?]
at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:164) ~[ChunkProviderServer.class:?]
at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:340) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:107) ~[integratedServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:124) ~[integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:507) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_111]

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



×
×
  • Create New...

Important Information

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