Jump to content

TheXFactor117

Forge Modder
  • Posts

    82
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • URL
    http://github.com/TheXFactor117
  • Location
    Georgia

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

TheXFactor117's Achievements

Stone Miner

Stone Miner (3/8)

9

Reputation

  1. I'm looking to dynamically alter the number of monsters that are spawning in the world dependent on a few different factors, however, I can't seem to find a working solution. It seems that this might be hardcoded into the game, perhaps in WorldEntitySpawner. Essentially, my goal is to have certain custom monsters be able to spawn during the day, though ideally, monsters wouldn't be as common during the day. There are also some other factors that would go into this, though they don't pertain to the issue. I've tried adding different restrictions which would either stop the entity from spawning in its canSpawnHere method or canceling a spawning event. The is only prolongs the time it takes for Minecraft to spawn what appears to be the max cap of entities that can spawn around the player (which looks like it gets set to 70 for entities of the monster type). Regardless of my checks and restrictions, eventually there will be the same amount of monsters spawned as their typically would be at night. If anyone knows of a way to limit this that I have perhaps looked over, I would appreciate that. To me, it looks like it's hardcoded into the game, but maybe there is a way.
  2. Use Minecraft's Structure Blocks to save a structure to NBT, which you can then use in code to load the structure. Create a new Template instance with the resource location of your structure.nbt file, and call Template#addBlocksToWorld to spawn the structure. You can do this in your WorldGenerator class.
  3. You didn't read what I said earlier.
  4. Without looking at your code, I'd imagine it's an issue with naming. In your IDE, uppercase/lowercase doesn't necessarily matter, so you'll have textures fine in your IDE. But once you build it, names of items or textures need to be lowercase. If you have upper case names, it won't load properly. If you do have lowercase names and such, than you know the issue is elsewhere. Post your code to GitHub too - not everyone is going to download a random zip file.
  5. I think it would be easier to do what what I mentioned above, considering these structures should be fairly common. I'm going to try and implement it and see what kind of results I get. I need to finish re-writing portions of it first, however.
  6. Well it is pretty easy actually. You do everything the algorithm normally would but you don't place any blocks and you store the position and individual structure into a map or whatever. Whenever new chunks are generated, you check to see if your positions of the structures are in it and you generate if so. Seems to make since to me, so I'll try and implement this soon. I think Minecraft does this by checking if a given structure is inside of the bounding box of the chunk, and if so, it generates. So that's the kinda check you would need.
  7. Potential solution: When I go to generate the dungeon, instead of building each individual room during generation, I'm thinking I can just generate the positions of each individual structure and store the position and template into a map. If the bounding box of the structure intersects with the current chunk (which has an offset), generate the corresponding room. If it's outside of the currently generated chunks, it won't generate. As new chunks are generated through the WorldGenerator, I'm thinking about looping through all the pending structures, checking to see if the bounding box of the structure intersects with the current chunk and if it does, generate it and remove it from the map. I'm not sure if this will work properly, so if anyone happens to find a flaw in it, I'd like to hear it before I try and implement it. If it sounds good, I'll work on implementing it.
  8. I don't think that's the best solution, at least in terms of what I'm trying to do. I've been digging around in vanilla world generation (Stronghold/Village generation) to figure out how they generate structures without causing runaway chunk generation. It looks like vanilla generation (say a Stronghold) will generate the positions of the Stronghold and store them somehow (MapGenStronghold#generatePositions looks like it does this, but I don't see how this works fully). Somehow the Stronghold's StructureStart gets a list of components to be generated and builds them out. Anyways, I think my conclusion is vanilla world generation is a mess and is hard to trace and track down how everything works. As for how to fix this, I'm thinking the easiest thing is to generate a "virtual" dungeon through the algorithm, but not to build anything during this time and storing each structure in a map. Then I would generate it when chunks are loaded and everything is ok for it to generate. The problem is, how would I go about generating it this way? Is it even possible?
  9. In one of my projects, I have a simple procedurally generating dungeon algorithm which generates the mod's dungeons. I've recently decided to rewrite to be more complex and accommodate more features than before. Before I do this though, I wanted to generate it in a way that it won't cause cascading world generation, which the current algorithm doesn't prevent. Right now it works kind of like this: I'll generate a structure on the surface somewhere, which will spawn staircases underneath it. From there, rooms can branch off of these staircases, and each room can generate new rooms off of it and so on until it reaches the maximum amount of "tries". This is done through recursion which is simple enough to do. So I've been trying to come up with a way to prevent the cascading generation from happening because it's not as simple as just adding an offset. I won't know how many chunks the dungeon will take up until after I generate it. I'm wondering about what the easiest solution to this would be. Could I generate all of the parts of the structure that are in loaded chunks only and then generate the others once those chunks have been loaded? I think that's the fundamental solution but how would you go about knowing/storing where a structure should be, and then generating that structure when the chunk is loaded? Maybe this isn't entirely right and there is another way around it, I'm not sure. Anyways, any help on solving this issue would be much appreciated.
  10. LivingHurtEvent perhaps?
  11. Check to see if the modifier is applied - if not, apply it, else, don't. Remove it in the onUnequipped method.
  12. Yes, that should work.
  13. Use AttributeModifiers to modify the damage. This won't work for bows so you'll have to find a workaround (unless bow damage is influenced by the players attack damage which I don't think it is).
  14. Your ResourceLocation doesn't need structures in the path name (unless you made a second structures package). You also don't need to include .nbt at the end of the name. Try that and see what happens.
  15. What are your outputs? Does it fail to generate? Is the position spit out in the console?
×
×
  • Create New...

Important Information

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