dylandmrl Posted January 9, 2020 Share Posted January 9, 2020 Hello guys, happy new year, I am facing again another problem with capabilities, first of all I decided to remove every NBT for capabilities, am I right or not ? If I am right, then I am facing a problem. Indeed, I am trying to add two capabilities that are exactly the same. Let me explain, I have a storage capabilities that store a queue of number and I want to have two queues inside a same object. I could reimplement my code two times as two different capabilities but I will just reuse the same code again and I don't really like it. Do I have another choice ? I know that I need two different provider but a provider are directly linked to his interface or the interface should be the same twice so how can I do this well? For the moment I just think about adding two interface that are extending the parent one but then I have to write two times the same implementation on that implements interface 1 and another one interface 2. Also I can't immediatly create a capability that contains both queue since another tile depend on only one queue. I am sure I am missing something but what ? Quote Link to comment Share on other sites More sharing options...
dylandmrl Posted January 9, 2020 Author Share Posted January 9, 2020 I don't know for the first one since the capability is in both case very different, one is a buffer the other one if a storage but both implementation are exactly similar. For your second comment, sorry I didn't use the good vocabulary's word. I am talking about all the tile entity stuff to store data without using capabilities (handleUpdateTag and stuff). However it was simple with this, since the block that use two times the queue was extending by the one using only one queue. I just had to override the writeNBT and readNBT to add the second one and create an new instance inside the second block with another name. if (te instanceof TileAbstractPipe) { event.addCapability(new ResourceLocation(Datacraft.MOD_ID, "buffer_capability"), new PacketsProvider()); } if (te instanceof TileAnalyser) { event.addCapability(new ResourceLocation(Datacraft.MOD_ID, "packet_capability"), new PacketsProvider()); } You see it's something like this where TileAnalyser extends TileAbstractPipe so the analyser should have both capability. Of cours here the provider is the same, it won't work but since the provider depend of an interface I can't create another one. Or maybe my block can have two times this capability but one with the direction "north" and another one with the "sud" hmmm ? Quote Link to comment Share on other sites More sharing options...
Cadiboo Posted January 9, 2020 Share Posted January 9, 2020 Are those both your tile entities? Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme) Link to comment Share on other sites More sharing options...
dylandmrl Posted January 9, 2020 Author Share Posted January 9, 2020 Yep Quote Link to comment Share on other sites More sharing options...
Cadiboo Posted January 9, 2020 Share Posted January 9, 2020 Then why aren’t you overriding getCapability in your TileEntity classes? The event is for attaching capabilities to objects that you do not have direct control over Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme) Link to comment Share on other sites More sharing options...
dylandmrl Posted January 9, 2020 Author Share Posted January 9, 2020 Because honestly I didn't know, thank you ! However that doesn't fix my problem. Quote Link to comment Share on other sites More sharing options...
dylandmrl Posted January 9, 2020 Author Share Posted January 9, 2020 Ok ok, I will check that out. I see just one problem, capability has their own NBT storage or do they "insert" their own storage inside the tile entity write and read functions ? Because since I will have two times the same storage's tags maybe they will overlap ? Quote Link to comment Share on other sites More sharing options...
dylandmrl Posted January 9, 2020 Author Share Posted January 9, 2020 That's why I am blocking, I have only one capability storage since it is only one capability and I can't use direction in my class that implement IStorage<E>. And I see no place where you link your Storage to your provider. If I am understanding (and I am not sure that I am), all is link using the interface of our implementation. So what can I do ? Quote Link to comment Share on other sites More sharing options...
dylandmrl Posted January 9, 2020 Author Share Posted January 9, 2020 I will need to find an example since I am not sure about my own implementation but thanks you. I will may come back if I have more question. Again thank you for your help diesieben07! Quote Link to comment Share on other sites More sharing options...
dylandmrl Posted January 9, 2020 Author Share Posted January 9, 2020 (edited) I know about this one is just the whole stuff about capability, I don't really understand why they are useful when you store variables for you own stuffs and I need a good and simple tile implementation to produce something clean. I will look for it on github. Edited January 9, 2020 by dylandmrl Quote Link to comment Share on other sites More sharing options...
dylandmrl Posted January 9, 2020 Author Share Posted January 9, 2020 Since I just want to, at least, provide a prototype of my mod that works first, I will pass for the moment with all that capabilities stuff even if it doesn't seem to be difficult at all. Thank you again :)! Quote Link to comment Share on other sites More sharing options...
Cadiboo Posted January 9, 2020 Share Posted January 9, 2020 1 hour ago, dylandmrl said: I will look for it on github. https://github.com/Cadiboo/Example-Mod/tree/1.15.1/src/main/java/io/github/cadiboo/examplemod/tileentity/ 1 Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme) Link to comment Share on other sites More sharing options...
dylandmrl Posted January 9, 2020 Author Share Posted January 9, 2020 What the fuck you have a whole tutorial section that I never saw, you really should to create a place on forge forum with all that usefull tutorials that are not so easy to find out. For people who want to check his amazing tutorials: https://cadiboo.github.io/tutorials/1.15.1/forge/ 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.