Jump to content

[1.19.2] Send package to server whit 2 int values if posible adding an specific itemstack


Recommended Posts

Posted

Good days
Im working to make a way soo i can hold left click and behave like hold right click but doing an different action 

i find and old video form mi mod in 1.8  this is one of the things i would like to accomplish 
in this case the gun shoots by holding right click 

and the chainsaw works by holding left click 

 

 

 

 

 

 

 

minecraft ticks are a little unconstant sometimes there's lag and damage calculations soo to more or less precisely calculate how mutch time the player has hold and release the left click button i need two values 
int ontime = 0;

int offtime = 0;

this values only happens in the client side soo i need to send those values back to serverside 

i been following kapenhoe tutorials but he don't show how to actually serialize and send values 

im pretty sure thats done in this to methods 

	public ExampleC2SPacket(FriendlyByteBuf buf) {
	}
	public void toBytes(FriendlyByteBuf buf) {
	}
	

 

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

in this case i need to send values to an item capability soo if is possible to specifies the itemstack in the package it would be just perfect 

something like 

public ExampleC2SPacket(ItemStack mark) {

FriendlyByteBuf buf = mark.getcapability.serializeallthevaluesinsidethecapability();

send_to_server(buf)

}

public void toBytes(FriendlyByteBuf buf) {

Itemstack mark = itemsendedfromtheclientside;

mark.getcapability.deserializethisvalues(buff);

}

this is the spefic tutorial i benn follow 

 

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

well i need a guidance on how to send values using packages and also the itemstack if its possible

 

thanks for your time  

 

 

 

 


 

 

 

 

 

 

 

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.