Jump to content

Androm

Members
  • Posts

    58
  • Joined

  • Last visited

Everything posted by Androm

  1. I didn´t find it. My log (skip the errors with unable loading pngs, because it is something I forgot to add a texture.):
  2. I get an error: my WorldGen code: package de.MhytRPG.www.worldgen; import java.util.Random; import cpw.mods.fml.common.IWorldGenerator; import de.MhytRPG.www.MhytRPG; import de.MhytRPG.www.structures.Schematic; import de.MhytRPG.www.structures.SchematicLoader; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenLiquids; import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraft.world.gen.feature.WorldGenerator; public class WorldGen implements IWorldGenerator{ @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.dimensionId){ case -1: generateNether(world, random, chunkX * 16, chunkZ * 16); break; case 0: generateSurface(world, random, chunkX * 16, chunkZ * 16); break; case 1: generateEnd(world, random, chunkX * 16, chunkZ * 16); break; } } private void generateEnd(World world, Random rand, int chunkX, int chunkZ) {} private void generateSurface(World world, Random rand, int chunkX, int chunkZ) { for(int k = 0; k < 10; k++){ int firstBlockXCoord = chunkX + rand.nextInt(16); int firstBlockYCoord = rand.nextInt(200); int firstBlockZCoord = chunkZ + rand.nextInt(16); (new WorldGenLiquids(MhytRPG.blockgoldenwater)).generate(world, rand, firstBlockXCoord, firstBlockYCoord, firstBlockZCoord); } for(int chanceForChuk = 0; chanceForChuk < 1; chanceForChuk++) { Schematic spring = SchematicLoader.get("spring.schematic"); int firstBlockXCoord = chunkX + rand.nextInt(16); int firstBlockYCoord = rand.nextInt(200); int firstBlockZCoord = chunkZ + rand.nextInt(16); int i = 0; for(int cy = 0; cy < spring.height; cy++) for(int cz = 0; cz < spring.length; cz++) for(int cx = 0; cx < spring.width; cx++){ Block b = Block.getBlockById(spring.blocks[i]); if(b!= Blocks.air) { world.setBlockToAir(cx + firstBlockXCoord , cy + firstBlockYCoord, cz + firstBlockZCoord); world.setBlock(cx + firstBlockXCoord, cy + firstBlockYCoord, cz + firstBlockZCoord, b, spring.data[i] , 2); } i++; } } } private void generateNether(World world, Random rand, int chunkX, int chunkZ) {} } My Line 52 is: for(int cy = 0; cy < spring.height; cy++) I don´t really know why, is the spring.height = 0 ?
  3. Oh, forget my code, i just write before I test. I read your code carefully but because of your rotationthings i am not sure about it, so how do you can generate a structure with the Schematic and blocks[] and data[] ? I used Integer.parseINt(String.valueOf(spring.data)); because i needed an integer and Integer.something returns an integer, but i didn´t saw a byte - convert, so i tried to make first a string from the data stored in data and then I tried to get the value of this string.. Very complicated..
  4. So this would be right in the WorldGenerate method: for(int chanceForChuk = 0; chanceForChuk < 1; chanceForChuk++) { Schematic spring = SchematicLoader.get("spring"); int i = 0; for(int cy = 0; cy < spring.height; cy++) for(int cz = 0; cz < spring.length; cz++) for(int cx = 0; cx < spring.width; cx++){ Block b = Block.getBlockById(spring.blocks[i]); if(b!= Blocks.air) { world.setBlockToAir(cx , cy, cz); world.setBlock(cx, cy, cz, b, Integer.parseInt(String.valueOf(spring.data[i])), 2); } i++; } } Or would it be other if cx, cy, cz are my coordinates ? I am new with structure spawning in the world... Thanks for your help
  5. So in data[0] is the data (position, metadata) for the block from blocks[0] stored ?
  6. Thank you much! I hope this can help me...
  7. Hello modders, I need help with my mod. Can you read schematic files and generate them randomly in the world without converting schematic to java code ? Maybe it is good to read the schematic file into bytes and then set arrays or HashMaps ? Or best with inputStream? And how would you do it ? If you have an idea and a code for the beginning please help me. Thank you.
×
×
  • Create New...

Important Information

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