Jump to content

Socratic_Phoenix

Members
  • Posts

    105
  • Joined

  • Last visited

Everything posted by Socratic_Phoenix

  1. I'm developing a mod that will have many machines & custom recipes (which aren't simply subclasses of IRecipe). I'd very much like to support a JSON recipe system, similar to the vanilla crafting system already supported by Forge.... I've done some peeking into how forge & minecraft actually load their files, and it looks like it's primarily done through CraftingManager#findFiles. My question is, is this a reliable method to discover recipes (supposedly located in assets/modid/extra_recipes)? Furthermore, how do I go about creating a registry for these recipes? I know forge has a built in registry system that supports custom registries, but I don't know where to start to implement my own custom registry... Thanks for any help provided!
  2. You can also invoke sendTo with an IMessage & Player, to send to a specific player when they log in.
  3. Well, assuming the worst case, that they're all longs, you'd have about 300*8 bytes, or 3.2 kilobytes. I wouldn't consider that a lot of data, especially since you'd only be sending it on login. Furthermore, 3.2 kilobytes is worst case - I don't know how many longs vs. ints and booleans you plan on sending, it could easily cut my estimate in half, or more. Also note that Forge tests network transmissions of 2 MB, which is quite a lot larger than your packet. You could also compress the data...
  4. Yep, see the diamond sword recipe from vanilla: { "type": "crafting_shaped", "pattern": [ "X", "X", "#" ], "key": { "#": { "item": "minecraft:stick" }, "X": { "item": "minecraft:diamond" } }, "result": { "item": "minecraft:diamond_sword" } }
  5. How much data do you plan on sending? I doubt the amount of data you'll need to send will show any drop in performance, especially since you'll only be sending the config packet once, on join. The easiest way to fix this would be to just always send the configuration packet... In fact, that's probably the best way to do it. The only way to know if the values were different would be to send all the values either from client->server or from server->client, so you may as well just send them from server->client anyway... Abstract away the config into an object or into static fields. When the client joins the server, the server should send the configuration values, and the client should set all the fields to the received values. Don't save it. Unless you're storing large amounts of data, caching will likely be more trouble than it's worth.. -------------------------------- How much data do you plan on sending? If it really is just a config file of integer settings for machines, it shouldn't be too much...
  6. I'm not really sure how to do this, but the easiest way would probably be to have a single armor piece set all the other armor slots to un-obtainable armor pieces that exist just to show the model... probably not the best way though.... Also, quick note to prevent problems later, you have a type in your armor material texture, you have MODID + ";hjarmor", but it should be a colon, not a semi-colon.
  7. So... I'm a little confused. What exactly are you trying to do? Do you have to blow the block up? Or do you just want to remove it?
  8. hmm... I've experienced the exact same thing. Im not sure how to fix it, but I can tell you that for some reason one of the if statements in WorldGenMineable::generate never passes with a vein size of 1... Not sure which one though... I can't access a computer right now... Edit: Not entirely sure why - I'm not that great at math, but with some debugging I'm pretty sure that it's this line in WorldGenMineable...
  9. Discontinued... MCP isn't discontinued.. it's still used to develop forge and mods. And besides, why do you want to change the source code? Most of the time a forge mod should be sufficient...
  10. I shouldn't have to, no... I've been doing some research, is WorldSavedData what I'm looking for? I need to be able to access the data client side, and the data needs to be synced... will I have to do that manually? Edit: Hmm... WorldSaveData doesn't appear to be what I want... Is there some unique id I can use? Such as a UUID or maybe the save dir name?
  11. When storing information during, how can I uniquely identify a world? Some context: I am rewriting my mod which previously used the world seed (I know, terrible), but obviously more than one world with the same seed can exist. I was also previously storing information in a Map<Seed, MyObjects> which is also pretty terrible. So: What can I use to uniquely identify a world? Is there a better way than using a Map? Is there any easy way to sync data between world & client? Is there any easy way to allow the data to be fully configurable?
  12. I'm no expert, but try returning something other than FAIL. Pretty sure there's a SUCCESS? What I think is happening is your item is opening the GUI, but not saying to ignore block options with it's return, so the chest then opens it's GUI just after, in the same tick. I could be wrong though. Edit: just checked the code for an item of mine that opens a GUI, and I'm fairly sure this is your problem..
  13. Do you want to completely change the texture - or just the color? Just changing the color (like Leather Armor) is extremely easy (look at how `ItemArmor` does it). If you actually want to change the model/texture... I have no idea how to do that.
  14. Issue: The method getArmorDisplay in ISpecialArmor does not work as I believe it is intended. Whatever value is returned there is displayed added to the ArmorMaterial reduction amount. Environment: I've tested this bug only in my development environment, in MC 1.12, and with the forge versions 1.12-14.21.1.2426 and 1.12-14.21.1.2387. The Bug: I have an ISpecialArmor with the following getArmorDisplay method (the armor material also has a reduction array of {1, 1, 1, 1}): @Override public int getArmorDisplay(EntityPlayer player, @Nonnull ItemStack armor, int slot) { return 1; } This results in the below display when wearing the helmet. Notice that there is 1 full shield, when there should only be a half-shield. Research: I've traced the issue back to ForgeHooks#getTotalArmorValue, which is used to calculate this display. I'm not entirely sure what is happening behind the scenes, but I believe that the method Player#getTotalArmorValue is retrieving the armor's reduction from the armor's attribute modifiers, and then the ISpecialArmor's getArmorDisplay method is being added to that. Thus, in the above example, the attribute modifier 1 is being added to the ISpecialArmor display of 1, getting a total count of 2. Test Mod: The mod I've tested this with is here. It's not really a full mod - texture and model errors are thrown, but it is runnable enough to test this bug. Log: I don't see how an FML log could possibly be useful in this scenario, but here it is anyway...
  15. CraftingBlocks simply contains the instances of the block objects....
  16. Edit: This has been resolved. The problem had something to do with texture variables, but it's working now... So I have a block, and it's color depends on a tile entity, etc. The block works fine, but I want to do the same thing, but with a torch. What I'm doing with the block is: using a model to specify an overlay using BlockColors to set the color setting the block to CUTOUT However, I don't fully understand the torch block state / model, so I'm not exactly sure how do do it with a torch. I've tried copying JSONs from minecraft, and adding overlay portions, but that fails to work... Can anyone help me get a working overlay torch model thingy? At the moment, all torches display like this: And no, there are no texture errors in the log or console... Relevant files: Overlay block state Overlay block model Overlay torch state Overlay torch model Overlay torch wall model Thanks for any help provided!
  17. @IlTosaerba You're not supposed to copy the code... your supposed to look at the code and ask questions if you need help, I'm just providing another example. The Keys class just stores some constants, and the Tome class isn't at all connected to the crafting table... Use the example to write your own classes.
  18. Go figure! I've done this exact thing! See here and here for the relevant files. Basically, what you have to do is: Create the block (if you want to store the items in the block after a player has quit, you will need a TileEntity - normal crafting table & my crafting table do not do this) Create the container & gui Register the slots in the container & the textures in the gui Setup a GUI handler Add an right-click action to the block so that it opens the gui Create a custom recipe class or use minecraft's IRecipe (I created my own so it could access the player doing the crafting - this is probably not necessary, but it depends on what you're doing) If you made your own class, create some kind of registry to hold the recipes you want to have, otherwise just use CraftingManager Add checks in the crafting slot / container to see if the recipe is matched, and if it is, get the result and clear the table Voila! Tables! If you have any specific questions, I'd be willing to help when I've got time.
  19. Oh... It's that simple? May as well follow convention then... Thanks
  20. I'm not even sure what happened there... My keyboard is being weird. Anyway, thanks!
  21. As I understand it, 1.12 recipes should primarily be done through JSON, however, due to the nature of my mod, this isn't possible. I have to have at least one custom IRecipe implementation. The problem is, this implementation is not a generic recipe, and would only be initialized once. Therefore, it doesn't make sense to use JSON to declare a single recipe with no properties. Therefore, my question is, can I continue to rely on registering the recipe in GameRegistry/CraftingManager, or can I expect those methods to be removed/changed? Also (since IRecipe is now a registerable thing), would it be better to register this recipe in a RegistryEvent (is there one for recipes?)?
  22. Thanks, I'll be using TileEntities then. To explain further, I was previously reloading textures every time the world starts. With the TileEntities, I'll be using BlockColors, not any special rendering.
  23. So this may be a vague question, but how performance intensive are tile entities? Allow me to explain: I'm developing a new iteration of my mod, and I'm trying to weigh performance costs, but I don't really know how tile entities work. Basically, I'm trying to use 1 block as a sort of "flexible" block that can have whatever properties I assign to it, roughly. The tile entity itself would simply server too hold two nbt values: a long and an int. These values specify the definition of the block's properties. The reason I'd prefer 1 block is because I originally had 600 different blocks; 300 ores and 300 bricks. And, due to the nature of my mod, the textures for all these blocks were reloaded whenever the world started. It is also important to note that their will be a lot of these tile entities in the world, as they would generate as ores. So, my question is, would it be less performance intensive to have one tile entity with two nbt tags (and no reloading textures), or to have these 300 ores that reload every time a world starts...
  24. Ignore everything I just said... I included the listener in the item file, not the mod file (they have very similar names...)... [solved]
×
×
  • Create New...

Important Information

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