Jump to content

Recommended Posts

Posted

Hey guys!

 

I have some problems spawning a test structure in the overworld.

 

 

WorldGenerator for the structure

 

 

  Reveal hidden contents

 

 

 package "mypackage";

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;
import cpw.mods.fml.common.IWorldGenerator;


public class WorldGeneratorSurface 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);
case 0 : generateSurface(world, random,chunkX*16,chunkZ*16);
}
}


private void generateSurface(World world, Random random, int BlockX, int BlockZ) {
for(int i =0; i<40;i++){
int Xcoord = BlockX + random.nextInt(16);
int Zcoord = BlockZ + random.nextInt(16);
int Ycoord = random.nextInt(16);

(new WorldGenMinable(Main."someore".blockID, 4)).generate(world, random, Xcoord, Ycoord, Zcoord);

}
}

private void generateSurface1(World world, Random rand, int i, int j)
{
  for(int k = 0; k<1; k++)
  {
int RandPosX = i + rand.nextInt(16);
int RandPosY = rand.nextInt(128);	
int RandPosZ = j + rand.nextInt(16);
(new teststructure()).generate(world, rand, RandPosX, RandPosY, RandPosZ);
  }
}
}

 

 

And in my main file:

 

 GameRegistry.registerWorldGenerator(new WorldGeneratorSurface());

 

 

I get no errors, but I cant find this structure anywhere. Does anybody know what I did wrong?

Posted

But you're using a different method for generating your structure as you are your ore. You are calling generateStructure() for your ore in the case: 0 check, but from the code above it seems you're not calling generateStructure1() with your structure anywhere.

 

You need to call it from somewhere, be it the case statement of the end of the ore generating method.

Posted

changed it now to this:

 

package "";

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;
import cpw.mods.fml.common.IWorldGenerator;


public class WorldGeneratorSurface 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);
case 0 : generateSurface(world, random,chunkX*16,chunkZ*16);
}
}


private void generateSurface(World world, Random random, int BlockX, int BlockZ) {
for(int i =0; i<40;i++){
int Xcoord = BlockX + random.nextInt(16);
int Zcoord = BlockZ + random.nextInt(16);
int Ycoord = random.nextInt(16);

(new WorldGenMinable(Main."".blockID, 4)).generate(world, random, Xcoord, Ycoord, Zcoord);

for(int k = 0; k<1; k++)
{
int Xcoord1 = BlockX + random.nextInt(16);
int Ycoord1 = random.nextInt(60);
int Zcoord1 = BlockZ + random.nextInt(16);

(new teststructure()).generate(world, random, Xcoord1, Ycoord1, Zcoord1);

}
}
}}

 

still cant find it. Do you notice something else wrong?

Posted

ok guys I got it now. I post the code so maybe I can help someone.

 

WorldGenerator:

 

 package "package";

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;
import cpw.mods.fml.common.IWorldGenerator;


public class WorldGeneratorSurface implements IWorldGenerator {

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);
  case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
}

}

private void generateSurface(World world, Random rand, int l, int j)
{

for(int i =0; i<40; i++){
int Xcoord = l + rand.nextInt(16);
int Zcoord = j + rand.nextInt(16);
int Ycoord = rand.nextInt(16);

(new WorldGenMinable(Main.someore.blockID, 4)).generate(world, rand, Xcoord, Ycoord, Zcoord);

  for(int k = 0; k < 1; k++)
  {
int RandPosX = l + rand.nextInt(16);
int RandPosY = rand.nextInt(128);	
int RandPosZ = j + rand.nextInt(16);
(new teststructure()).generate(world, rand, RandPosX, RandPosY, RandPosZ);



}}}}

 

teststructure:

 

package""package;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;

public class teststructure extends WorldGenerator {

public teststructure()
{

}

public boolean generate(World world, Random rand, int x, int y, int z)
{
if(world.getBlockId(x, y, z)!= Block.sand.blockID || world.getBlockId(x, y + 1, z)!= 0)
   {
   return false;
   }

world.setBlock(x, y + 1, z, Main.someblock.blockID);
world.setBlock(x + 1, y + 1, z, Main.someblock.blockID);
world.setBlock(x, y + 2, z, Main.someblock.blockID);
world.setBlock(x + 1, y + 2, z, Main.someblock.blockID);
world.setBlock(x + 2, y + 2, z, Main.someblock.blockID);
world.setBlock(x - 1, y + 2, z, Main.someblock.blockID);
world.setBlock(x + 3, y + 3, z, Main.someblock.blockID);
world.setBlock(x - 2, y + 3, z, Main.someblock.blockID);
world.setBlock(x + 2, y + 3, z, Main.someblock.blockID);
world.setBlock(x - 1, y + 3, z, Main.someblock.blockID);
world.setBlock(x + 3, y + 4, z, Main.someblock.blockID);
world.setBlock(x - 2, y + 4, z, Main.someblock.blockID);
world.setBlock(x + 2, y + 4, z, Main.someblock.blockID);
world.setBlock(x - 1, y + 4, z, Main.someblock.blockID);
world.setBlock(x + 3, y + 5, z, Main.someblock.blockID);
world.setBlock(x - 2, y + 5, z, Main.someblock.blockID);
world.setBlock(x + 2, y + 5, z, Main.someblock.blockID);
world.setBlock(x - 1, y + 5, z, Main.someblock.blockID);
world.setBlock(x + 2, y + 6, z, Main.someblock.blockID);
world.setBlock(x - 1, y + 6, z, Main.someblock.blockID);
world.setBlock(x, y + 7, z, Main.someblock.blockID);
world.setBlock(x + 1, y + 7, z, Main.someblock.blockID);
world.setBlock(x, y + 6, z, Main.someblock.blockID);
world.setBlock(x + 1, y + 6, z, Main.someblock.blockID);
world.setBlock(x, y + 3, z, Main.someblock.blockID);

return true;
   }  
}

 

Code: "k < 1" 1 is the rarity. I placed 1 so I could find it fast when it spawns. With 1 you have min 1 of your structure per chunk.

          "if(world.getBlockId(x, y, z)!= Block.sand.blockID || world.getBlockId(x, y + 1, z)!= 0)" Block.sand.blockID is on what block it spawns. In this case sand

Posted

for(int x1 = -2; x1 < 2; x1++)
{
    world.setBlock(x-x1,y,z, BLOCK_OF_YOUR_CHOISE.blockID)
}

That code will spawn a straigt line of five blocks of your choise.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

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

    • wait, i just did that. why didn't it work? also it's the same. help me!!!!
    • Culprit has been located! It was Tough As Nails + (plus) which was among one of the mods *added* before re-entering, in an attempt to improve compatibility. It, for some reason or another, did not want to work!
    • "You can either try to load it with only the vanilla data pack ("safe mode"), or go back to the title screen and fix it manually." Hello! I encountered this error just now while attempting to re-enter my world for the first time. Notably, no mods were removed before encountering this error and, while being able to find this error elsewhere on the internet, in my scenario it is seemingly caused by a specific mod, of which I cannot isolate. Things I have tried: - Enter "Safe Mode" (fails) - Remove datapacks (no change) - Reverted to old save data (no change) Here is the server log: https://mclo.gs/9vJQEfN I use Modrinth mod loader so please let me know how to share my mod list, and if it is needed.
    • So, i'm hosting (or attempting to host) a port-forwarded modded server for 1.12.2. There's quite a few mods in this pack, but they all run and have no compatibility issues (besides something causing the game to crash if you go fullscreen, a problem ive given up trying to identify or fix). It can run on 6gb of ram or less, and works fine in singleplayer. All of my friends that want to join have the exact same mod/config/game setup as I do (I personally helped them set everything up). Just to be safe, we've all allocated 12 gigabytes of RAM to the installation, and I've also allocated 12GB to the server itself. I am able to join with no issue and it runs fine. However, when they try to join, it gets stuck in the 'logging in' screen before their game becomes unresponsive. When they close it, it gives them the exit code 805306369, which usually means not enough RAM, but this cant be the case. On my screen, in the server, it shows them joining, and then disconnecting, so I dont think its a port-forwarding issue. They can all run it just fine in singleplayer as well. The annoying bit about this particular issue is that it generates no crash log. Does anyone have any suggestions? Thanks! Here is my debug log, and his, starting from the same place. MINE: [132647] [Netty Client IO #5INFO] [FML] Attempting connection with missing mods [ctm, fusion] at SERVER 132653.817 [132653] [Client threadINFO] [minecraftGuiConnecting] Connecting to 0, 25565 132654.682 [132654] [Netty Client IO #9INFO] [STDOUT] [xaero.common.core.transformer.ClassNodeTransformertransform29] Transforming class brz net.minecraft.client.network.NetHandlerPlayClient 132654.684 [132654] [Netty Client IO #9INFO] [STDOUT] [xaero.map.core.transformer.ClassNodeTransformertransform29] Transforming class net.minecraft.client.network.NetHandlerPlayClient 132654.764 [132654] [Netty Client IO #9INFO] [FML] Server protocol version 2 132654.777 [132654] [Netty Client IO #9INFO] [FML] Attempting connection with missing mods [ctm, fusion] at SERVER 132656.193 [132656] [Client threadINFO] [FML] Injecting existing registry data into this client instance 132659.081 [132659] [Client threadINFO] [FML] Applying holder lookups 132659.082 [132659] [Client threadINFO] [FML] Holder lookups applied 132659.092 [132659] [Netty Client IO #9INFO] [FML] [Netty Client IO #9] Client side modded connection established HIS: [13:12:16] [Netty Client IO #0/INFO] [FML]: Attempting connection with missing mods [ctm, fusion] at SERVER 13:12:25.597 [13:12:25] [Client thread/INFO] [minecraft/GuiConnecting]: Connecting to (my IP address and the server port 25565) 13:12:26.805 [13:12:26] [Netty Client IO #1/INFO] [STDOUT]: [xaero.common.core.transformer.ClassNodeTransformer:transform:29]: Transforming class brz net.minecraft.client.network.NetHandlerPlayClient 13:12:26.808 [13:12:26] [Netty Client IO #1/INFO] [STDOUT]: [xaero.map.core.transformer.ClassNodeTransformer:transform:29]: Transforming class net.minecraft.client.network.NetHandlerPlayClient 13:12:26.936 [13:12:26] [Netty Client IO #1/INFO] [FML]: Server protocol version 2 13:12:27.114 [13:12:27] [Netty Client IO #1/INFO] [FML]: Attempting connection with missing mods [ctm, fusion] at SERVER 13:12:27.480 [13:12:27] [Client thread/INFO] [FML]: Injecting existing registry data into this client instance 13:12:30.669 [13:12:30] [Client thread/INFO] [FML]: Applying holder lookups 13:12:30.671 [13:12:30] [Client thread/INFO] [FML]: Holder lookups applied 13:13:04.700 Process crashed with exit code -805306369 P.S - Both mods "CTM" and "FUSION" are present in both our folders so idk what that's about.
  • Topics

×
×
  • Create New...

Important Information

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