Jump to content

Recommended Posts

Posted

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 ?

Posted

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 ?

Posted

Are those both your tile entities?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.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)

Posted

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

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.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)

Posted

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 ? 

Posted

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 ?

Posted

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!

Posted (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 by dylandmrl
Posted

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 :)!

Posted
  • Thanks 1

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.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)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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