Jump to content

Recommended Posts

Posted (edited)

Hellow good days 

 

Im remaking this item for 19.4  and this particular item has 3 types or states i store to a capability 

ih.type = 0 suspension normal unactivated

ih.type = 1 suspension shaking 

ih.type = 3 suspension activated 


im storing the value of type in the capability on the server side
to later retrieve that value in the client side to define what json texture the item gonna use 

 i notice than the values form the capability in the server side are not updating immediately to client side sometimes it does after a while sometimes not ,
but if close the game and open it again then the values appears as expected in both server and client side 

this is whats i see in the console 
 

	//client side
this.comment => 0
this.start_time => 0
this.time => 0
this.type => 0
	//server side
this.comment => 0
this.start_time => 136810
this.time => 21
this.type => 1
	


 

 


##############################

sooo :
* could be than capabilities declaration way has been change and just dont mark as error in mi intellij  installation but still works coze hooked right to the item NBTtag 

* in the capability file some flag must be turned on to make it send the data to client side and that flag is missing 

* Capabiities has violently change whit 19.4 and as this is just copy paste from 19.2 code .

 

i set the capability to the item this way and use a function to get the object and test it using a print function inside on entity swing 
 

  Reveal hidden contents

 

 

the capability 

  Reveal hidden contents

 

full item 

  Reveal hidden contents

 

 

thanks for your time 

Edited by perromercenary00
Solved
Posted

https://forge.gemwire.uk/wiki/Capabilities/Attaching#Synchronizing_Data_with_Clients

The game will synchronize items to the client as part of other operations, e.g. opening your inventory or a container

But it you want it immediately, you will need to do it yourself.

 

If you look at vanilla, instead of sending network packets, the code will often try to predict what the new value should be on the client.

e.g. if you look at EggItem.use() it shrinks the ItemStack count on both the server and client.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

We are not a human search engine. Please do your own research.

https://forge.gemwire.uk/wiki/Capabilities/Attaching

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

Im currently believing is some kind of bug
fireup old 19.2 version and there the capability get the values synced immediately on every change 


anyway i find a workaround  a hacky one 

if in the capability.class manually force it to save the nbtdata to the item It gets immediately updated to the client side looks like no side effect and brings an opening to made a working  onUseTick() function inside the capability 

	    // ########## ########## ########## ##########
    public void save() {
        if (this.container == null) {
            System.out.println("\n#this.container is Null at save()#\n");
            return;
        }
    this.container.setTag(serializeNBT());
    }
	

 

  Reveal hidden contents

 

 




 

  • perromercenary00 changed the title to [WorkArounded][1.19.4] Capability not syncing to local world

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.