Melonslise
Members-
Posts
183 -
Joined
-
Last visited
Everything posted by Melonslise
-
I did add the factory class to my _factories.json. Since my recipe is pretty much hard coded I don't need any json files for the recipe. Or do I still have to create some basic recipe json?
-
I don't understand. Without registering the recipe with the registry event the recipe doesn't work at all. I did add its factory to the _factories.json. I looked at vanilla too and I've found more specific recipes like book cloning being registered (but in some different way).
-
Right, I think I got it to work. What I don't understand is why I need to instantiate the recipe when registering it with the event if its factory constantly does that. Doesn't that kind of kill the point of registries? Do I even need to keep a static reference to the recipe like I do with all other entries? Also I'm getting a crash if I don't set the recipe's registry name, but I don't understand why that's required since the factory creates copies (which again kills the purpose of registries).
-
But what do I do next, though? My guess is to register the recipe with the registry event? What is the factory needed for in that case? EDIT: Also what is the isDynamic method for in the IRecipe interface? It doesn't have a description.
-
Ok I made an IRecipe implementation as well as a nested factory. What do I do next? Is the factory required? I'm not really parsing anything because I just need access to the items' NBT.
-
I need to know how to copy the NBT of an ingredient and copy it over to the result. Can this be done with the existing system? If not how would I go about doing it? I've read about an IRecipe implementation, but I'm not sure about the rest of the process.
-
Thanks a lot! For some reason I automatically thought a UUID would be stored just like any other data type. Thanks for clearing things up, everything works now.
-
Here's a few problems I've ran into. 1. I have a piece of code which checks if a stack has a specific key every tick. However, the NBTTagCompoud#hasKey method seems to be functioning incorrectly. I've debugged it and it looks like it always returns false. 2. From what I've heard NBT is handled on the server side only. How would I add a string from an item's NBT to its lore? Trying to retrieve tags on the client side in Item#addInformation always returns null. 3. In what case would I want to use capabilities instead of item NBT?
-
[1.12] Applying own knock back to any item
Melonslise replied to Melonslise's topic in Modder Support
Done. I had to clone the repo to github desktop instead of downloading it as a zip. Here's the pull if anyone is interested. -
[1.12] Applying own knock back to any item
Melonslise replied to Melonslise's topic in Modder Support
Ok so I forked the repo, downloaded the 1.12 branch, built forge, modified only the forge project and generated the patches. How do I submit pr now? How do I merge the branch I downloaded with my forked repo? -
[1.12] Applying own knock back to any item
Melonslise replied to Melonslise's topic in Modder Support
Ok how do I PR? -
[1.12] Applying own knock back to any item
Melonslise replied to Melonslise's topic in Modder Support
That's not quite the answer I was expecting. The feature, if even added, will take a long time to be implemented and will only be included in the latest versions of forge (if I understand correctly). -
I'm trying to apply my own knock back to any item with one of my custom attribute modifiers. I've came up with a few ways, but all of them either do half of what I want or don't work at all. My most successful attempt was trying to cancel the LivingAttackEvent, checking if the entity was hit beforehand using a capability, saving the entity's motion, dealing damage, restoring the entity's motion and applying my own knock back. This did work, but since forge is so underdeveloped the LivingAttackEvent posts twice for any player, because EntityPlayer's attackEntityFrom posts the event and calls super which also posts the event. This caused the knock back (and perhaps the damage) to be applied twice. But in certain cases (ray-traced extended reach) the event posts once so it's hard to predict how many times it will post. Here's the code. Checking if the entity was hit before is necessary to prevent recursion. I tried using AttackEntityEvent, but that method also posts 2 (sometimes 3) times and I have no idea why. I also though about using ASM or reflection, but I don't know how to use the former and don't think the latter will help much. Thanks in advance.
-
Thanks for the fast reply! I might have some more question later. Well now that I think about it, I haven't learned much from forge, more from Minecraft. Can you provide examples of some "backwards things" from Forge/Minecraft?
-
1. No, that's not quite what I meant. I'm okay with java. In fact, I've been using it for more than a year now. 2. I didn't mean Loader as a mod, I meant that it loads mods. What interests me is how forge "handles" mods (that would be how they're found, loaded and later accessed). So I've looked at the FMLServerHandler and at Loader and I have some questions. First, in beginServerLoading I see that loadMods is called with an empty immutable list. Second, I can't find where the mods are found. I'm guessing that happens in identifyMods, but I only see mcp and minecraft being added as mods (why?). Third, what is the ModDiscoverer? Fourth, why are the mods sorted? And last, why is there no post init in the Loader? Not quite. Apart from Minecraft I do other things with java. Minecraft and Forge are a great example to me and I've learned quite a bit from them. Understanding and making something similar would be quite beneficial to me.
-
Thanks! There are still a few things that interest me: 1. Due to my lack of java knowledge I don't quite understand how the mod Loader works. Can someone break it down to me? 2. Is there a way of doing the same thing as ASM does with annotations, but without external libraries?
-
Thanks for the quick reply! Your answer cleared most things up for me. However, I'd still like to see Minecraft's "asset-loading mechanisms".
-
So becoming a more experienced coder I've some questions about how forge functions. I couldn't really find anything about this when browsing source (because I'm blind). 1. How are external modules in form of jars loaded? I'm presuming forge uses a custom class loader or reflection for this? 2. How are annotated classes and methods handled? I'm guessing reflection is used here? 3. How are external resources like textures, models and sounds loaded? 4. This one's more about Minecraft. How does the main loop look like and where is it? Thanks.
-
Yeah, I already got that. It's just that I don't want to create a crap load of models for all my combinations.
-
Are there any mods that do this sort of thing that I can take a look at?
-
Is there any way to change item models in-game? EDIT: When a model is loaded by it's ICustomModelLoader class and then processed by it's IModel implementation, does the baked model stay during the session or are new baked models made in real-time? EDIT: I'm asking because I thought I could make a base json model containing all my base textures and multiple overlay json models which extend the base json model. I thought I could assign one of the overlay json models to an item (since these are affected by item's nbt) and then have the IModel select a random base texture from the base json model (since the overlay json models extends it) and then apply the overlay on top of it. And I was wondering if the base texture of the model would change with every created item of that type or it would stay the same for all of them?
-
Wow that still seems awfully complicated and tedious, even more so than creating a separate json for every item. I might just stick to creating separate jsons.
-
So how do I do that? Do I need to make my own implementations of IModel, IBakedModel and ICustomModelLoader like Choonster said? Even if I did, how would I go about selecting certain textures out of a pool?
-
What I'm trying to do is combine a random base texture out of different variants of the base texture with a certain overlay texture depending on the item's nbt. I don't think I'll have too many models, but I wanted to create an easier system for implementing new variants so that I didn't have to create ((number of base textures) * (new overlay texture)) every time I added a new overlay texture.
-
I have read the documentation, but it clearly stated that And the forge json page said nothing about blockstate properties or items at all. Alright, it seems easy enough, but I still don't understand how I can layer certain textures out of a pool depending on an item's nbt? I was guessing I need to use ItemMeshDefinition above, but I'm not sure how to select certain layers out of a single json model.