• 0

    posted a message on Quick way of downloading mod dependencies?

    I am trying to make an addon, however that requires the mod to be in my workspace. However that mod has optional compatibility for multiple mods, meaning I would have to download all of those as well, in addition to downloading the correct version.


    Is there any way to say automatically get these dependencies, or ignore the compatibility at compile time? I really don't want to go searching through multiple mod versions and downloading them all.

    Posted in: Modification Development
  • 0

    posted a message on Weird crash report

    I'm getting this crash report when modding in 1.12.2:


    https://pastebin.com/gssE8RxU


    The weird thing is it doesn't mention any line of my code, so I don't know what I should post. Was there some change in 1.12.2 with creative tabs? Does every item need to be in one?

    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Do not play new item hand animation when NBT is updated

    Thank you! Not sure how I missed that method.

    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Do not play new item hand animation when NBT is updated

    I have an Item that has NBT that is updated every tick. However, this causes the animation to play each tick, freezing the item below view and sometimes flickering. I would like to override this if possible, so that the animation does not play.


    The animation I am talking about happens when scrolling through your hotbar to a new item. I think that since the NBT is changing it thinks it is a new item and plays the animation.

    Posted in: Modification Development
  • 0

    posted a message on Weird Z-Fighting like visual on JSON model

    I have this JSON model: https://pastebin.com/jLRXqZtN


    But I get this weird flickering on part of the model:


    I don't think I have any duplicated planes, so what could be happening?

    Posted in: Modification Development
  • 0

    posted a message on Disable small lake generation
    Quote from jabelar»

    I think the event works. Instead of cancelling I think you're supposed to change the result. Some events use the result to effectively cancel (not sure why sometimes you cancel and sometimes you change the result). The actual comment for the Populate subevent says:

    * This event has a result. {@link HasResult} <br>
    * This result determines if the chunk is populated with the terrain feature.


    So change the result to Result.DENY after checking that the type is a EventType.LAKE.



    Thank you! This works perfectly. Though I don't think I can specifically target lava lakes looking at the code, do you think that's possible? I wonder if it would be possible to add them back in manually with a custom class. Either way I'll accept this, though control over lava lakes would be nice.


    EDIT: looks like lava lakes are still generating, so I think it's fine.

    Posted in: Modification Development
  • 0

    posted a message on Disable small lake generation
    Quote from alexcouch»

    Well...the event is right there... PopulateChunkEvent.Populate. Just subscribe to that event, check if the EventType is LAKE and then cancel it? That would be my guess.


    It is uncancellable
    Posted in: Modification Development
  • 0

    posted a message on Disable small lake generation

    I want to disable the generation of the small water lakes, this appears to be done in ChunkGeneratorOverworld.class, in the following lines of code:


    https://pastebin.com/FjfDF9xC


    As you can see the biomes are hardcoded in, so I was wondering if there was any way at all to do this. Maybe an event I need to override? I don't want to override base classes but I can't see how to get this out of its hard code.

    Posted in: Modification Development
  • 1

    posted a message on PvP: 1.8 vs 1.9
    Quote from Mastermined»

    I think the problem is nobody is really innovating within the PvP community. All of the subtypes and gamemode are still the same as they have been for years, and all are generally very hectic and require no real skill besides knowing who to spam at when.
    And of course the 1.8 mechanics work better at those gamemodes, that's what they were designed for.

    If people in the PvP community actually bothered to embrace the new mechanics, and develop new PvP modes and games for it, it would have ahd a seriosu change of conquering servers. But unfortunately people tend to stick with what they know, and nobody actually feels like trying something new...


    YES! This is why I was so excited for 1.9, but then people just stayed in 1.8 refusing to try 1.9, splitting the community and leaving few innovators. I'm working on a project to try to make a vanilla 1.9 innovative PvP server, but we get almost no players. It's really a shame, I think 1.9 style PvP and PvE has a lot of potential, but people just aren't willing to confront it.
    Posted in: Discussion
  • 0

    posted a message on Rendering a multi-layer, NBT dependant item
    Quote from Choonster»


    Yes.


    If the loader always returns the same instance, store it in a static final field like ModelDynBucket does.




    This determines whether or not your loader should be used to load the model for that ResourceLocation. You'll want to check if the domain is your mod ID and the path is <model_name>, models/block/<model_name> or models/item/<model_name> (like ModelFluid.FluidLoader does).




    That's called when the loader is first registered and whenever the resources are reloaded. If you've cached any model data that was loaded from disk, you'll want to clear the cache. If you haven't, you can simply do nothing.


    Would it not return the same instance if say there is a broken and repaired state to the tool with different textures? Specifically, I assume different instances of an IModel have different texture variables, but since a bucket only has a filled and empty state, and the empty state is an entire different item, it will always have one instance. I would then assume these models are created once per load, with a loop through all the fluids. However since I am making a mod similar to Tconstruct, where there is a very large amount of possible combinations that would make a model, should I do nested loops or some kind of dynamic thing?


    As for accepts(), that should mean that this code:

    @Override
     public boolean accepts(ResourceLocation modelLocation) {
     // @formatter:off
     return modelLocation.getResourceDomain().equals(AstralTools.MOD_ID) && 
     (modelLocation.getResourcePath().equals("models/item"));
     // @formatter:on
     }


    Should work for the model if the thing it's trying to apply it to has a name of "[modid]:[registry name]" and it is an item. Or does it work differently?


    Hm, I don't know much about caching. Would I need to use it for this kind of item that has a dynamic model based on a state and 2 texture variables?
    Posted in: Modification Development
  • 0

    posted a message on Rendering a multi-layer, NBT dependant item

    So I implemented ICustomModelLoader, and it has 3 methods:

    public void onResourceManagerReload(IResourceManager resourceManager)
    
    public boolean accepts(ResourceLocation modelLocation)
    
    public IModel loadModel(ResourceLocation modelLocation)

    I assume loadModel() can be implemented to simply return an IModel instance. Is there a specific place I should instantiate that IModel?


    Then there is accepts(), which I assume is some kind of "is this the right model" thing, but I'm not sure exactly what conditions should give yes or no, since it's only argument is a ResourceLocation.


    The one I understand the least is onResourceManagerReload(), maybe I just call loadModel in there? I have no idea.

    Posted in: Modification Development
  • 0

    posted a message on Rendering a multi-layer, NBT dependant item
    Quote from Choonster»

    Whenever Forge loads a model, it asks all the registered ICustomModelLoaders if they accept the specified ResourceLocation until it finds one that does. If none do, it asks the default ICustomModelLoaders (ModelLoader.VanillaLoader and ModelLoader.VariantLoader) if they accept it (ModelLoader.VanillaLoader always does).

    Once Forge finds an ICustomModelLoader that accepts the ResourceLocation, it calls ICustomModelLoader#loadModel to load the IModel. This could be loaded from a file (e.g. a JSON file loaded by ModelLoader.VanillaLoader) or created entirely in code (e.g. ModelDynBucket.MODEL loaded by ModelDynBucket.LoaderDynBucket).

    When a model is loaded by a Forge blockstates file, BlockStateLoader.ForgeVariant#runModelHooks is called so the model can process any custom data, replace textures and enable/disable smooth lighting, GUI 3D and UV lock settings specified in the blockstates file.

    When Forge has finished loading every requested IModel, it calls IModel#bake on them all to bake them into IBakedModels.

    When Minecraft renders an IBakedModel for an item, it calls ItemOverrideList#handleItemState on the model's ItemOverrideList to allow the model to be replaced by another according to any overrides specified in the item model.

    ModelDynBucket.BakedDynBucket uses ModelDynBucket.BakedDynBucketOverrideHandler.INSTANCE as its ItemOverrideList, which uses IModel#process to generate a new ModelDynBucket instance with the item's contained fluid and then ModelDynBucket#bake to bake that into a new IBakedModel. It caches these models so they're not re-baked every time.

    Hm this is a lot of info. So just to start off, I think this means that somewhere there is a class that implements ICustomModelLoader, and that has an overridden method loadModel() to specify a IModel class instead of a .json file. And then it is also registered to some registry so forge knows about it. I did a search for ICustomModelLoader, and for buckets it seems like there is an enum inside ModelDynBucket. How does that work? It looks like it has methods, but I thought an enum was just a list of possibilities like a list but as a data type.

    Hm and then also, so loadModel() can also use what I assume is two inner classes of ModelLoader that will do the same process as an IModel but using a .json file to fill in some essentially variables about size and texture. And we want to override that in order to not use a .json file.
    Posted in: Modification Development
  • 0

    posted a message on Rendering a multi-layer, NBT dependant item
    Quote from Choonster»

    I have an explanation of the model loading process (including custom model loaders) here.

    ModelDynBucket.BakedDynBucketOverrideHandler is responsible for generating and returning a new model based on the ItemStack's contained Fluid.

    This is an ItemOverrideList, Minecraft calls ItemOverrideList#handleItemState whenever it's rendering an item model to allow another model to be rendered instead.

    I found the ModelDynBucket class, but I don't see how that file connects to a mod. It looks like it's only being referenced within a forge package, which I can't and shouldn't edit. I could imagine making essentially a copy of this class and putting my custom code in it and linking that to an item, but that doesn't look like how this works. It uses ResourceLocations it looks like, and that would point to a .json file, not a baked model class. I guess I just don't know how to "hook into" the model loading process with a class, which I definitely will need and not just a json.
    Posted in: Modification Development
  • 0

    posted a message on Annotation Based GUI Config, with string and number pair list
    Quote from Choonster»

    It looks like the FieldWrapper.MapWrapper class used by the annotation-based config system for Map fields is a bit broken, I've reported this issue here. I've also reported two other issues with it here and here.

    Ah, I see. Do you think this will be fixed any time soon or should I look into making a custom implementation?
    Posted in: Modification Development
  • 0

    posted a message on Annotation Based GUI Config, with string and number pair list
    Quote from Choonster»


    You can use a static initialiser block to populate the Map with default values.

    The Map will be converted to a category with a property for each key-value pair, with the key as the property name and the value as the property value. Forge will preserve the value type, so a Map<String, Double> will be converted to a category containing double properties.


    Ah, I forgot about those. I added a static initialization block and it seems to appears to not crash, however I set a sysout to print the HashMap on sync(), and it doesn't appear to read any extra values added from the configuration file, even when the game starts with the new lines in the file. I have this as a test:


        specificblocks {
            D:"minecraft:glass"=1.0
            D:"minecraft:stone"=2.0
            D:"minecraft:wool"=2.0
        }

    But only the ones (stone and wool) that are initialized in the static initialization block are printed out. Do I need to do something to manually load new keys from the file?

    Posted in: Modification Development
  • To post a comment, please .