• 0

    posted a message on Overriding health bar position

    You need to cancel the health bar rendering and render your own health bar. There's plenty of examples out there on how to do this, just google it (especially on the Forge forums because I've looked at some of them a while back).

    Posted in: Modification Development
  • 0

    posted a message on Item/Stack name depending on NBT

    What's at line 71? I'm assuming it's storing the stack's NBTTagCompound into a local variable. The problem is when you are setting up the names and such, there is no NBTTagCompound. You need to access the NBTTagCompound after the item is created, then check to see if it has a compound there - if yes, add your stuff and change the name, else create your own compound and add stuff/change name.


    For example, I have an item which is named based on NBT data. This particular code is fired when an item is created from a loot table, though you can use this wherever your item is actually being created. My NameHelper.generateName method will take the NBTTagCompound and determine the name from the values stored in it (which I created beforehand in the same method), and I use ItemStack#setItemStackDisplayName to set the actual name.

    Posted in: Modification Development
  • 0

    posted a message on Cascading worldgen error

    It probably doesn't matter too much. I personally have mine registered in init.

    Posted in: Modification Development
  • 0

    posted a message on Cascading worldgen error
    Quote from TheMasterCaver»

    This is done in the method that is called when a chunk is populated, which is (in 1.6.4) "generateStructuresInChunk", which checks to see if the bounding boxes of each structure stored within the structure map intersects the current chunk (or rather, offset chunk area), with a further check done for each individual structure piece in StructureStart (which has its own list of individual components), and yet another on each get/setblock call, which are placed inside of wrapper methods in StructureComponent which compare the coordinates of each block to the bounding box of the area being populated.

    Also, the fact that the game iterates over the entire structure map in MapGenStructure explains MC-33134, as it has to iterate through more and more structures as time goes on (not just when generating them, but when determining if structure-specific mobs should spawn and anything else that needs to check for a structure), which is particularly significant for mineshafts because they are so common and rather complex; structure saving amplifies this since all structures ever created, not just in chunks loaded in the current session, are stored.

    Ok, that makes sense. If I'm understanding this correctly, what I need to do is generate the structure through a WorldGenerator like normal (with an offset), but first just generate the positions of each individual structure (through the algorithm I've created). In order to prevent runaway chunk generation, I need to check to make sure each individual structure (which has a StructureBoundingBox) is intersecting with the current chunk (which is offset). If yes, generate the actual structure, else don't. In terms of generating the pieces that don't pass the initial check, would I just have a loop or something in the WorldGenerator which loops through all the pending structures checking to see if they intersect with a newly loaded chunk? (I'm assuming WorldGenerator#generate is called once per chunk IIRC).

    I just want to make sure I'm not misunderstanding anything before I implement it.
    Posted in: Modification Development
  • 0

    posted a message on Cascading worldgen error
    Quote from mariot»

    I've tried this after I read the Reddit post but I still get the same error.


    int randX = blockX + rand.nextInt(16 + 8);
    int randZ = blockZ + rand.nextInt(16 + 8);


    You need to add the 8 to your block position first.
    Quote from TheMasterCaver»

    -snip-

    So in the case of a Stronghold, the game looks like it generates the positions for the Stronghold first and stores them somewhere. At first, I thought it stored them in a map in MapGenStructure but that actually looks like it stores ALL structures ever generated. It looks like the actual pieces that are built are in a list in the StructureStart. I can't see where this gets built out though. Though I think fundamentally, vanilla Strongholds are using generatePositions to generate the structure without placing any of the blocks. Then StructureStart is called and it generates the actual pieces and builds them. One thing I don't understand though is where and how does vanilla generate and build a portion of a structure, and not the parts that are in unloaded chunks (or non-generated chunks).
    Posted in: Modification Development
  • 0

    posted a message on RPG Skill System and/or Player Progression, Class System

    It'll probably change names eventually once it I make it more public and such.

    Posted in: Mods Discussion
  • 0

    posted a message on Cascading worldgen error

    I do have a question regarding this topic and larger structures. If I were to generate large, randomized structures (think an underground, procedurally generated dungeon), how would you go about fixing that because it isn't as simple as adding an offset?

    Posted in: Modification Development
  • 1

    posted a message on RPG Skill System and/or Player Progression, Class System

    I'm developing a mod that is very similar to what you are describing. It's an action-RPG based on the old Hack/Mine mod. As of right now, it is in a pre-alpha testing stage, though if you join the Discord server you'll be able to keep up with development and download testing builds to playtest.


    Some of the features I've added is a player class, leveling, and stat system. You'll be able to level and spend skill points to increase stats (which upgrade health, mana, attack damage, things like that) or in the future class abilities too. There's also randomly generated weapons with different rarities, damage and attack speed values, and even attributes. I've also added procedurally generated dungeons (which I'm actually re-writing it now).


    Anyways, if this sounds like something you are looking for, feel free to join our Discord server (https://discord.gg/qDtkjke).

    Posted in: Mods Discussion
  • 0

    posted a message on Cascading worldgen error

    Read this Reddit post - it goes into very good detail about explaining the issue and fixing it as well.

    Posted in: Modification Development
  • 0

    posted a message on Crash Upon Using Custom Entity

    Take some time to learn some Java. The method tells you what you need to return (ActionResult<ItemStack>).

    Posted in: Modification Development
  • 0

    posted a message on Crash Upon Using Custom Entity

    You're returning null to a method...that is almost never good.

    Posted in: Modification Development
  • 0

    posted a message on Converting buildings from viewable into code?

    Create a class which implements ITemplateProcessor and modify the processBlock method to check what biome you are in and change the block accordingly. When you go to spawn the structure in, call the addBlocksToWorld method which allows you to specify the processor you want to use and use yours instead of the default one.

    Posted in: Modification Development
  • 0

    posted a message on Crash Upon Using Custom Entity

    Of course it won't work - directly copying what I have will not work. Instead, modify it to what you need. Like I said, I'm doing a lot of extra stuff you won't need, some of that flows down. Just remove the extra stuff I've added, and do what you normally do. I was just showing that all you need to do is create an instance of your projectile (using your parameters, not mine), and spawn it in.

    Posted in: Modification Development
  • 0

    posted a message on Crash Upon Using Custom Entity

    Thanks!


    Why are you specifying the onImpact method again? In your sword class, you should create an instance of your entity (SwordBeam entity = new SwordBeam(setup stuff here);) and then spawn it in. The class itself should handle the logic so you don't have to specify it every time you create an instance of your projectile. For example, this is how I handle spawning projectiles (do note I have a lot of extra stuff going on, but the three highlighted lines are all you need - call that whenever you want to spawn a projectile). I believe the way you are doing it could be causing the NPE (you can verify it by looking through that error log some more and finding where it calls your code).

    Posted in: Modification Development
  • 0

    posted a message on Crash Upon Using Custom Entity

    Your entity class is abstract, meaning you can't instantiate an instance of it. That really shouldn't even compile properly - regardless, don't make it abstract and it should work.

    Posted in: Modification Development
  • To post a comment, please or register a new account.