Jump to content

Roboguy99

Members
  • Posts

    230
  • Joined

  • Last visited

Everything posted by Roboguy99

  1. This is super useful, thanks. Two (hopefully) small things though -1) I've got over a hundred items I need to do this to. Can I use the same IFlexibleBakedModel, IPerspectiveAwareModel class for all of them and pass the item through the constructor? 2) Does ModelBakery.registerItemVariants(<item>, <modelA>, <modelB>) replace registering each one with the item model mesher?
  2. Hmm ok, I'm fairly certain I know less about it than you do. I'll look into it though...
  3. I want to make it so my items are rendered using a 2D texture in the inventory screen (as in, in a container slot), but I'd like them to have a completely different 3D model when the player actually holds them and its rendered in their hand. Is this at all possible, and if so how would I go about doing such a thing?
  4. So just to check, in other words I need another packet send to the client with the "return"? I just actually read your reply properly. That makes sense. Just to confirm now I've asked it, would a "return packet" actually work?
  5. I'm creating a packet to handle the creation of an itemstack with an NBT tag so that the NBT is actually saved. The packet works one-way, as in I can send the itemstack and NBT tag to it and then append the tag, but I haven't worked out how to return the stack from the packet. How do I do this? Here's the packet: https://github.com/Roboguy99/Chemistry/blob/master/src/main/java/roboguy99/chemistry/network/packet/CompoundCreate.java And here's where I'm testing it from: https://github.com/Roboguy99/Chemistry/blob/master/src/main/java/roboguy99/chemistry/block/BlockCompoundAnalyser.java#L49
  6. So would it be worth moving the code for naming the compound etc to its own class which uses the itemstack rather than keeping them in the item class or does that not really matter? I could probably answer that myself but it's midnight Other than that, I think I'm sorted; in most cases I should be able to use the NBT code from previous projects.
  7. Sorry to keep this thread alive with off-topic questions, but I'm working on getting the compound to only exist as a single item, and save the data to NBT, and I've completely blanked when trying to work. I think I've got the code for reading/writing the NBT sorted, but I still need help with a few things... How do I (ignoring any network issues likely to come up) go about actually creating a new version of the item in-game on-the fly, with specified NBT data. How do I load the NBT for each itemstack when the world loads etc? Do I even need to do this myself? I'm sure I'm just being stupid at this point; my knowledge of actual item classes and NBT is a little rusty. Any help is appreciated.
  8. That answers quite a bit, thanks. So one last thing - How would I go about actually getting an element from its atomic number?
  9. The reason I've kept every element separate is because I was planning on later down the line actually adding individual properties for each one (i.e. iron might be magnetic while coal burns easily, etc). I'm a little confused by the capabilities. Could you give me an example of how I could use it in my case instead of NBT? In saying this, I have just hit a wall using NBT/multiple elements, because I can't store a class to NBT so instead I have to save a property of the element and then (as far as I can work out) switch over every single element to find the matching one for every one in the compound.
  10. Thanks for that, I'll work my way through and slowly change everything. A few things though: -The reason I put .name in the language file is because otherwise the items are displayed in-game with .name. Should I remove that? -The getCommonName (and in fact the whole naming system) is very much in testing. Once I get it working in English, I'll set it up to be translated properly. I only started working on the mod last night. -As I'm going to have an almost infinite number of compounds generated on-the-fly when the user "crafts" them, would it be much better to have a single "compound" item with NBT data for the name, formula, mass, etc?
  11. That sounds like what I'm doing. Every element is being registered in the language file, and then when combining the names I loop over each element in the compound, use the StatCollector line on each element, and append it to the string, which is returned and set as the compound's unlocalized name. If I don't include that extra .name then the element name is not found to be translated and I get a horrible mess of a combination of unlocalized names making one big unlocalized name. Code's here: https://github.com/Roboguy99/Chemistry/tree/master/src/main/java/roboguy99/chemistry/item
  12. I plan to have the ability to combine constant items, which I can name using the language file system, to give them a procedurally-generated name which is a combination of them. I've just about figured out how to actually get an item's translated name to combine it using: StatCollector.translateToLocal(element.getUnlocalizedName() + ".name") Having to append .name to get it to work feels a little hacky and makes me feel like I'm definitely missing something, but doing this successfully changes "item.x.name" into "x's name". If I use the product of this combination as the unlocalized name for the compound item, I obviously get the "untranslated" "item.x y.name". The possibilities for compounds is essentially endless, so adding every single one to a language file is not possible. With the deprecation of the language registry, how do I go about adding names? Am I missing something really obvious? Why change from a code-based system to one where authors must put names in files?
  13. I'd like to render an item on the HUD using the same 3D model as when its on the floor. Currently I am using RenderItem.renderItemIntoGUI(minecraft.fontRenderer, minecraft.getTextureManager(), inventoryContents[i], itemX, itemY); But this only returns the same icon you get in your inventory, and in the case of items which use a custom 3D model (such as Mekanism's cables) or some more special custom 2D icons (Tinker's Construct tools) don't render properly. In the first case, a missing texture icon is displayed, and in the 2nd nothing happens. If there is not a way to do this, is there another approach I can use? I need it to be compatible with mods that use these special methods.
  14. I haven't really got enough time tonight, and my head isn't quite in the right place. I'm going to just go and sort it out over the weekend, and once the code seems to make some sort of sense I'll come back here. Thanks for the offer though.
  15. Erm..I have no idea, but it sorta works... I tell you what, I'm going to go away for a couple of days and just rework/figure out what I've made and try to fix it. We're both getting equally confused at this.
  16. No, I'm talking about the per-item values. The issue probably does apply to both, though; both sets are held in the Config class...
  17. My problem is that with my current approach, when connected to a server the config values for an item are read as 0, and I'm not sure whether what you previously said still remains correct given the full description of what's going on, or whether I should be doing something else to fix it.
  18. There are 2 sets of values. There are the default config values, which every item should start with as its settings. These are read from a config file, and so are on a per-mod-instance basis, allowing each user to have their own defaults. There is then the item config values, which are loaded/saved from the item using NBT. If these don't exist, the default is used instead. The config file does not need to be changed in game. The server's config file should not be used, as this would stop users from being able to change their own defaults. Obviously the item configs values should be changed and these are what are changed by the GUI.
  19. Ok I think I've still got the wrong idea somewhere, so I thought it makes sense to come back here and ask again before I get way too far into the wrong thing. I've also got a feeling you still haven't 100% understood what I'm trying to do (which is my fault for not explaining it well enough), so here's a picture of my current situation; I'm not ignoring what you've said, I just don't quite have the understanding to incorporate it into the diagram. I hope it's clear enough... I've been working on the packet which contains the defaults, and opens the GUI. Hopefully you'll be able to a) Understand what I want with the diagram and b) Agree that I've done something wrong. https://github.com/Roboguy99/HotbarBag/blob/master/src/main/java/roboguy99/hotbarBag/network/packet/SettingsOpen.java
  20. Ehm... what. "send the instance of the GUI" - No. The server sends a specific packet that contains the serverside defaults and also tells the client to open the GUI. Then client sends back a different packet which contains things like "setting foo is now value bar please". Server then gets player's current Item, checks if it's yours and if so applies the change. Ahh, that makes a lot more sense. Thanks. I've just had nearly 2 weeks of exams so I'm a bit tired, and so a bit slow at the moment
  21. Right, I know that the request from client to server is going to be a packet. Will I send the instance of the GUI to the packet to get the variables, or will this just result in the same problem as before with the client sending data? I'm sorry, I'm getting very confused over this...
  22. My configuration GUI is on a per-item basis, using the configuration file for per-mod-instance defaults. The actual configuration file is not being changed in game.
  23. So if I have a bunch of client-side settings variables (see https://github.com/Roboguy99/HotbarBag/blob/master/src/main/java/roboguy99/hotbarBag/Config.java), which are actually set through the user using a GUI, how would I go about doing this? I assume the settings variables should not be client-side, but as they're different for every instance of the mod (depending on a config file), I don't know how to do this. I hope that made sense...
  24. So I have an NBT tag compound I'm saving to an item, and in single player it saves fine. On a server, all of the tags exist but are set to 0. I know this is an issue syncing something properly, despite having a packet. I've tried playing around with many, many things but I can't get it to work properly. As you can currently see, I've tried constructing the NBTTagCompound and sending that in a packet, but it doesn't seem to actually update. At this point I'm out of ideas.... Here's the packet: https://github.com/Roboguy99/HotbarBag/blob/master/src/main/java/roboguy99/hotbarBag/network/packet/SettingsUpdate.java Here's the NBT saving code: https://github.com/Roboguy99/HotbarBag/blob/master/src/main/java/roboguy99/hotbarBag/inventory/BagInventory.java#L265 Here's where the packet is sent from: https://github.com/Roboguy99/HotbarBag/blob/master/src/main/java/roboguy99/hotbarBag/gui/GuiConfig.java#L316 If anybody could explain what I'm doing wrong, that would be great. Thanks.
×
×
  • Create New...

Important Information

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