Jump to content

Qronicle

Members
  • Posts

    3
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Qronicle's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Thx I'm guessing you're talking about setBlockAndNotify and the likes? Those weren't really faster. (If you meant those, but I doubt that.) Editing chunks directly sounds more like it . But googling this stuff doesn't yield much results. I'll try some more later today (I'm at work now). But if you or someone could just point me a bit further in the right direction (like with a link or method name), that would probably help a lot. Most stuff that I find is coded roughly the same way as what I'm doing, so I'm guessing I'm missing an important keyword or something
  2. Those aren't really relevant to the problem (private/protected/package/public keywords only define where the properties can be accessed, and in this case private would be enough, since it's only the owner class accessing them). Stuff like this would also throw an exception when used incorrectly (I guess, long time since I programmed in Java). My problem is just that world.setBlock seems to execute very slowly, possibly because it fires a whole range of things that need to be calculated for it. So the question here is whether there is a better way to do what I'm doing.
  3. Hello all, Today I started to dive into modding Minecraft (with Forge 4). I'm thinking of generating some pretty big structures, so I started messing around with a custom world generator. But one of my tests (simply adding some sort of brick stone roof with glass windows over the complete world) is generating really slow. My IWorldGenerator implementation: public class QWorldGenerator implements IWorldGenerator { protected WorldGenRoof roofGenerator = new WorldGenRoof(); // left out some inherited methods private void generateSurface(World world, Random random, int x, int z) { roofGenerator.generate(world, random, x, 0, z); } } The actual WorldGenerator: public class WorldGenRoof extends WorldGenerator { public boolean generate(World world, Random random, int chunkX, int chunkY, int chunkZ) { int blockId = 0; for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { blockId = Block.stoneBrick.blockID; if (x > 6 && x < 13 && z > 6 && z < 13) { blockId = Block.glass.blockID; } world.setBlock(chunkX + x, 100, chunkZ + z, blockId); } } return true; } } The code works fine, but as I said, really slow. It takes like five minutes instead of the normal couple of seconds to generate a new world. When I remove the world.setBlock(...) there is no real drop in performance. So is there some kind of other process I should use when doing things like this? Or maybe some mode to set while setting blocks in a loop? (I tried world.editingBlocks, but that didn't really help ) Any ideas welcome!
×
×
  • Create New...

Important Information

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