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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • that happens every time I enter a new dimension.
    • This is the last line before the crash: [ebwizardry]: Synchronising spell emitters for PixelTraveler But I have no idea what this means
    • What in particular? I barely used that mod this time around, and it's never been a problem in the past.
    • Im trying to build my mod using shade since i use the luaj library however i keep getting this error Reason: Task ':reobfJar' uses this output of task ':shadowJar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. So i try adding reobfJar.dependsOn shadowJar  Could not get unknown property 'reobfJar' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. my gradle file plugins { id 'eclipse' id 'idea' id 'maven-publish' id 'net.minecraftforge.gradle' version '[6.0,6.2)' id 'com.github.johnrengelman.shadow' version '7.1.2' id 'org.spongepowered.mixin' version '0.7.+' } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' apply plugin: 'com.github.johnrengelman.shadow' version = mod_version group = mod_group_id base { archivesName = mod_id } // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. java.toolchain.languageVersion = JavaLanguageVersion.of(17) //jarJar.enable() println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { mappings channel: mapping_channel, version: mapping_version copyIdeResources = true runs { configureEach { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' arg "-mixin.config=derp.mixin.json" mods { "${mod_id}" { source sourceSets.main } } } client { // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. property 'forge.enabledGameTestNamespaces', mod_id } server { property 'forge.enabledGameTestNamespaces', mod_id args '--nogui' } gameTestServer { property 'forge.enabledGameTestNamespaces', mod_id } data { workingDirectory project.file('run-data') args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') } } } sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { flatDir { dirs './libs' } maven { url = "https://jitpack.io" } } configurations { shade implementation.extendsFrom shade } dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" implementation 'org.luaj:luaj-jse-3.0.2' implementation fg.deobf("com.github.Virtuoel:Pehkui:${pehkui_version}") annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' minecraftLibrary 'luaj:luaj-jse:3.0.2' shade 'luaj:luaj-jse:3.0.2' } // Example for how to get properties into the manifest for reading at runtime. tasks.named('jar', Jar).configure { manifest { attributes([ 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors, 'Specification-Version' : '1', // We are version 1 of ourselves 'Implementation-Title' : project.name, 'Implementation-Version' : project.jar.archiveVersion, 'Implementation-Vendor' : mod_authors, 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", "TweakOrder" : 0, "MixinConfigs" : "derp.mixin.json" ]) } rename 'mixin.refmap.json', 'derp.mixin-refmap.json' } shadowJar { archiveClassifier = '' configurations = [project.configurations.shade] finalizedBy 'reobfShadowJar' } assemble.dependsOn shadowJar reobf { re shadowJar {} } publishing { publications { mavenJava(MavenPublication) { artifact jar } } repositories { maven { url "file://${project.projectDir}/mcmodsrepo" } } } my entire project:https://github.com/kevin051606/DERP-Mod/tree/Derp-1.0-1.20
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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