Jump to content

freeradicalx

Members
  • Posts

    13
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

freeradicalx's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Agreed, and that's the reason I was wondering *why* BiomeCache$Block is calling it in the first place with such far-out values. If I can confirm that these calls are relatively inconsequential or erroneous then I won't have a problem just returning an array of BiomeGenBase.plains (Which is what I just started doing and that seems to make it happy) or some other "filler" data that doesn't kick off my heavier methods. If this call is relatively important, then I may have to rethink/restructure my world gen to account for the fact that the game occasionally needs accurate gen data for such far-away lands. I haven't taken the time yet to fly to one of these random chunks to see if it does indeed result in a chunk of Plains biome, so we'll see.
  2. Update: I tried blocking calls from BiomeCache$Block by returning the array it passes right back to it, and that pretty dependably crashes the game. I may just modify my getBiomeGenAt() to pretend it's vanilla if the call comes from BiomeCache$Block. @Anon10W1z: I may try that. Only reason I'm on 1.7.2 is because it was current when I started development, was planning on updating everything to the current version once I had something playable but I may update to 1.7.10 right now since I hear it's relatively painless to do so. @diesieben07: My mod is not altering the use of getBiomeGenAt() at all, it's still returning a 16*16 array of biome IDs as it was before. It's just that my biomes correspond to municipal regions, streets and properties now so in order to return that biome array I have to generate that graph of shapes first if it hasn't been done yet. The shape generation is done by other classes, but can be kicked off by getBiomeGenAt(). I'm using Java Topology Suite for the calculation of all those municipal geometries for maximum efficiency.
  3. Not strictly a Forge question, but relevant. I'm making a world type composed of developed modern-world elements like roads, towns, buildings, etc. I generate the location of these elements in big 100*100 chunk cells. When a chunk loads for the first time it checks to see if its big cell and surrounding cells have been generated yet, and if not it kicks off said generation. Works pretty well for the most part, except I find that as I'm flying through my worlds in creative mode, every minute or so my mod will start generating a group of cells really far away from me. Sometimes thousands of chunks away, as if the game were loading a chunk way over there across the world, nowhere near where it should be operating. Whatever process was generating these calls was doing so by calling the getBiomeGenAt() method in my chunk manager, so I threw in a stack trace to see what it was. Turns out there's an extra class hidden away inside of net.minecraft.world.biome.BiomeCache called Block (Not to be confused with the Block that represents in-game voxel blocks, I believe) that is occasionally polling my chunk manager for the biome and rainfall data for random freaking far-away chunks every minute or so. This call then of course triggers the generation of my mod's cell data for that area of the map, a process that can take a minute or so and thus halts all chunk loading and mob events for the player in the meantime. I can fix this by checking what class is making the call to getBiomeGenAt() and not respond to calls from BiomeCache$Block, but I don't know why it does this and thus am wary to make that change lest I break something that I don't understand. Does anyone know why BiomeCache$Block does this, and if there is a better way to go about dealing with the issue?
  4. Uh duh, I see net.minecraftforge.client.event.RenderGameOverlayEvent now, I assume that's what you're referring to. Thank you, that does indeed look like the access I need (And thanks for writing it!). I think I'll just read a few LWJGL tutorials to figure out how to get a byte array into a texture for the actual rendering since it looks like I can just use that event to trigger some GL11 calls? Seems a lot more straightforward than mucking around in, for example, Notch's Map tile entity code EDIT: Yup, that was easier than expected. Here's my Debug class in case anyone's interested in displaying similar array of debug map data (Right now this just displays a 200 * 200 square of half-transparent blue behind the debug text, but it gives me the ability to write a setter method to add more complex info to a larger map later): public class Debug{ private int textureID; public static ByteBuffer textureBuffer; @SubscribeEvent() public void onRenderDebug(RenderGameOverlayEvent event) { if(event.isCancelable() || event.type != ElementType.DEBUG) { return; } textureBuffer = BufferUtils.createByteBuffer(200*200*4); textureBuffer.order(ByteOrder.nativeOrder()); textureID = GL11.glGenTextures(); for (int i = 0; i < 200*200; i ++) { textureBuffer.put((byte) 0); textureBuffer.put((byte) 0); textureBuffer.put((byte) 255); textureBuffer.put((byte) 128); } textureBuffer.flip(); GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID); GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 200, 200, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, textureBuffer); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); GL11.glEnable(GL11.GL_BLEND); GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3d(0, 0, 0); GL11.glVertex3d(0, 200, 0); GL11.glVertex3d(200, 200, 0); GL11.glVertex3d(200, 0, 0); GL11.glEnd(); GL11.glDisable(GL11.GL_BLEND); } }
  5. So Minecraft seems to use LWJGL's Display object and OpenGL methods to update the game's graphics, right? I'm experimenting with a new WorldType that calculates large geometric shapes to determine biomes across vast regions before any chunks generate, and I need a way to display a map of those shapes in-game so that I don't have to fly around the world for hours to debug their geometry. A simple 2D array of different colored pixels would do fine, maybe injected into Minecraft's main Display.update() loop. Thing is, I don't know where that loop is (Guessing it lives somewhere in net.minecraft.client.renderer?), and even if I did it doesn't look like Forge has any hooks into it. But I'm assuming there are alternative ways to do what I'm trying to accomplish, and I'm hoping someone here can provide some guidance. I really just need a way to: -Convert an array of pixels to a format I can display -Display that format on screen
  6. I'm in the planning stages for a mod that intends to eventually convert the Overworld dimension into a modern "human-influenced" landscape of wilderness, rural, suburban and urban biomes that flow seamlessly into one another ("Urban" biomes would only spawn next to other urban biomes or suburban biomes, suburban biomes would provide broad buffers between urban and rural biomes, and large rural biomes would eventually give way to occasional vanilla-style wilderness biomes). Generating the structures necessary for these biomes has already been taken care of, but I currently have no clue how to create this wilderness->urban->wilderness gradient that would effectively force certain biomes to spawn next to other certain biomes. I know this can be done because, well, beaches. I just don't see in the source how it happens. Can anyone here explain a procedure for getting this to work? As a side note, I've read that world generation is based on a combination of lots of scaling/fractalization (X and Z) and perlin noise (Y, some X and Z), which seems to suggest that the shapes of biomes can't easily be controlled. Is there a way around this? Is there any easy way of getting a biome to spawn as a rough rectangle or other polygon? Thanks, any answers much appreciated.
  7. Ackph! I'm sorry, that IS what I have typed into my main mod class, but I must have been tired when trimming down the code last night to paste here so I must have cut out the wrong line. I have it typed exactly as you do inside my preInit method. I'm having EventHooks() report via System.out.println() whether the entity spawning is a player or not, and it always reports false (Not a player). My code is as typed above, including your correction. Any idea what I'm doing wrong?
  8. Thanks for all the method call tips! I haven't adventured into setting up a proxy just yet, so I think I'm gonna keep my mod single-player while I get my feet wet. Minecraft.getMinecraft() should be just fine for now in that case, right? I did try setting up an event hooks class to listen for LivingSpawnEvent.entityLiving being an instance of EntityPlayer, but it never seems to evaluate true, even after I spawn. Code in question below, any idea what I'm doing wrong here?: EventHooks.class: package freeradicalx.util; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.living.LivingSpawnEvent; public class EventHooks { public static boolean playerSpawned = false; @ForgeSubscribe public void playerSpawned(LivingSpawnEvent event){ if (event.entityLiving instanceof EntityPlayer){ playerSpawned = true; } } public static boolean getPlayerSpawned(){ return playerSpawned; } } And here's how I'm registering it in my main mod class: @PreInit public void preInit(FMLPreInitializationEvent event){ GameRegistry.registerWorldGenerator(roadGen); } PS ObsequiousNewt, this is the roads mod you helped me save data with with last week. The data saving method you suggested works out so far. I'm using the player position to have the starts of roads head into unloaded chunks further away from the player as to avoid ending at already-generated chunks. Check it out (Using pink wool only to test): https://www.dropbox.com/s/vzcmvyp0i1hi56t/roads.jpg
  9. Ah, I see that. Assuming that the spawn point is set before the chunks start generating that would be a good replacement for playerX/Y/Z until the player spawns... But I still run into the problem of needing to know when the player spawns so I can switch over to using their current position instead.
  10. I'm working on a worldgen mod that spawns structures in the world in ways that are dependent on the player's X/Y/Z position, so my worldgen class gets the player's position with Minecraft.getMinecraft().thePlayer. However this is crashing my game instantly upon creation of a new world since the player doesn't even exist in the world until the first few hundred chunks are generated. Is there any way to check to see if the player is currently spawned in the world so that I can bypass using player position if they're not yet? Or any other good mechanism to override/avoid this problem? Thanks!
  11. Not dense at all, that's a great idea. I think that might have been my original plan, but I wasn't sure if data being stored in my WorldGen would get saved on exit the same way that data in Chunk instances do. Would I need do to anything special to make sure my road data saves if it's in the WorldGen or is that already taken care of by Minecraft?
  12. I understand how to make my own WorldGen, I can easily add methods that generate one-off structures during chunk generation. However a road is a continuous, potentially infinite curve that snakes through the world so it has to be generated chunk by chunk as the player explores: Only it's start or end can be one-off events. I achieved this functionality in the non-forge version of my mod by adding an array of three points to Chunk.java called roadData. If the chunk contained a point on a highway's curve, roadData would contain the coordinates of that point and of the two adjacent points, so that chunks generating nearby could detect it and see if they had to continue the roadway (And likewise determine the next point in the road's curve). I can no longer edit Chunk.java if I'm to be forge compatible, and I don't know how I could do so by creating my own WorldGen. I'm not a newb but am by no means a master at this stuff, so some guidance would be totally appreciated. Thanks
  13. Hi, I'm porting my mod that generates roads across the overworld to Forge since I'd like for it to play nice with other mods. This is my first time working with Forge. The original mod modifies Chunk.java by adding a new variable called roadData to keep track of generated roads. How and where would I be able to achieve the same thing in Forge, since the idea is to not modify the base Minecraft classes? Or would I have to do something else entirely?
×
×
  • Create New...

Important Information

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