Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

TheXFactor117

Forge Modder
  • Content Count

    82
  • Joined

  • Last visited

Everything posted by TheXFactor117

  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
  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. 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.
  4. 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.
  5. 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.
  6. 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 st
  7. 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
  8. 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
  9. Check to see if the modifier is applied - if not, apply it, else, don't. Remove it in the onUnequipped method.
  10. 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).
  11. 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.
  12. What are your outputs? Does it fail to generate? Is the position spit out in the console?
  13. I am trying to store data on a player and have this data manipulated by mainhand weapons, armor, and stuff like that. The issue I'm trying to tackle is updating this information when these items change and such. Originally I was thinking of updating this information in a player tick event - check to see if the item held/worn is the right type and has the right data, take this data and add it to the player's data. If the item changes, remove it. All of this in a tick event is kinda tricky to handle but is doable. So I started to look into other ways of handling this, and I figured Attributes wo
  14. When saving your structure, place a monster spawner (the default one) and place a data block on top of it and name it like monster_spawner or something. When you add the blocks to the world, you can call a method which will handle the data blocks. Here is my method for handling data blocks for an example. Essentially you just need to loop through all data blocks in the structure - if the data block name matches the one you are looking for, you can do stuff with the block underneath. For example in my structures, I'm setting the loot table for the chest. For monster spawners, you ca
  15. As I said in the other thread, you need to create a Template variable. It takes a TemplateManager (which you can get from WorldServer) and a ResourceLocation for your NBT file (and maybe a couple other parameters). Once you have this, just call the addBlocksToWorld method when you want to generate the structure. I have an example here, though this is kinda complicated code. Just look for Templates in it and it should give you an idea.
  16. It's there for a reason - it's just as easy to spawn multiple structures in next to each other too.
  17. You don't need a structure class. Create a Template variable which loads your NBT file through a ResourceLocation. Once you have a template, just call addBlocksToWorld or whatever the method is called.
  18. Yes, I believe structure blocks were added in 1.10. As for randomization, what exactly do you want randomized? One draw back of loading from NBT that I found is you can't change the blocks that are saved in the NBT. I haven't looked into it too much though, so there might be a way. You can use Data Blocks to put on top of chests or other important blocks to load loot tables for example too.
  19. Yes - instead of having a bunch of setBlockState calls specifying every single block in your structure, you can load your structure from NBT in a very few lines of code. Just call the template method to set the blocks in the world in your WorldGenerator class.
  20. Use Structure Blocks. You can look at Igloos and newer Minecraft structures for example. Basically, all you need to do is build your structure, save it to NBT using Structure Blocks, and load it in through a Template. If you want a structure bigger than 32x32, you can make multiple Structure Blocks and when you spawn the structure in you can the multiple files in and just offset positions depending on the piece. I have some code on my GitHub as well using Structure Blocks.
  21. I got it working now - though one thing isn't working properly and it's the fact that the NBT data isn't actually saving properly. I have a helper method which creates the data and adds it to the stack which gets called properly from within my function. However, this data doesn't actually make it for whatever reason because the tooltip doesn't display anything and the NBT doesn't actually have any of the data. The data gets saved on the server - outputs, when it's in your inventory, show no data is on it, also on the server. I looked into the SetNBT function and they essentially cr
  22. I'll mess with this when I get a chance. Just to make sure I'm understanding this correctly, when I load my own loot table, I need to create a new instance of my own LootTable class? I didn't really understand what you meant be check for that class in your pools - I'm assuming if a loot table is loaded as an instance of my LootTable class, it'll use my own LootContext which can store the chest position. I just need to make sure I'm loading everything properly because obviously I'm doing something wrong.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.