Jump to content

Recommended Posts

Posted

Okay so basically I've been working on this mod for a while, that changes you, the player's size after an action

for example, each time you eat you gain height.

Client sided it seems to be working fine, but the moment I add it to the server it won't even run the server.

I'm trying to get it to work server-wise, so to my understanding I'll have to work on differently with proxies or idk..

I would really like a bit of help, where do I start lol

Posted

Rendering isn't done on server side. Just check on the server, if you for example ate something.

Then, you have to send a Packet to the client.

If you want to know how to implement packets, just read the forge documentation:

https://mcforge.readthedocs.io/en/latest/networking/

Also, the forge docs have an article about clientside/serverside and what you should do on those sides:

https://mcforge.readthedocs.io/en/latest/concepts/sides/

Posted
  On 5/17/2020 at 8:59 PM, Budschie said:

Rendering isn't done on server side. Just check on the server, if you for example ate something.

Then, you have to send a Packet to the client.

If you want to know how to implement packets, just read the forge documentation:

https://mcforge.readthedocs.io/en/latest/networking/

Also, the forge docs have an article about clientside/serverside and what you should do on those sides:

https://mcforge.readthedocs.io/en/latest/concepts/sides/

Expand  

 

Hey thank you!

I've managed to communicate between the server and client

 

Issue is I don't understand how would I increase the size of the specific player who ate something. increasing everyone's size together is okay somewhat >.<

Posted

Make the player size a capability and sync it everywhere (not literally; only to tracking clients and self), and on the client, render the model based on that player's size capability.

Some tips:

  Reveal hidden contents

 

Posted
  On 5/20/2020 at 5:56 AM, DavidM said:

Make the player size a capability and sync it everywhere (not literally; only to tracking clients and self), and on the client, render the model based on that player's size capability.

Expand  

Thanks for replying!

 I have been playing a bit with capabilities, and I seem to be understanding a bit, but not quite enough

image.png.fe3719c0bf805754e606a8297ec9b3f4.png

 

In the giant.setHeight, I'm attempting to update the capability but it doesn't seem to do anything

I've also tried to change it outside the dist.client

Any idea why it wouldn't update? :c

Posted

Replying to myself sorry,

Fixed that issue

But when I try to load other players from a client's pov I can't reach others capabilities because I'm looking for ClientEntityPlayer and I'm getting RemoteClientEntityPlayer when I'm getting the render of another player in RenderPlayerEvent

Posted

You should sync capabilities of other players to the client.

Some tips:

  Reveal hidden contents

 

Posted
  On 5/21/2020 at 12:41 AM, DavidM said:

You should sync capabilities of other players to the client.

Expand  

 

  On 5/20/2020 at 4:55 PM, Melodia said:

Replying to myself sorry,

Fixed that issue

But when I try to load other players from a client's pov I can't reach others capabilities because I'm looking for ClientEntityPlayer and I'm getting RemoteClientEntityPlayer when I'm getting the render of another player in RenderPlayerEvent

Expand  

Sorry for being a newbie, really trying hard on this one

I'm trying to sync the capabilities, is making a list of all the capabilities a good start?

How would I send it as a server to the players?

I don't really understand how would I encode/decode something that isn't primitive >.<

Could you lead me a bit further? I would really appreciate that

Posted (edited)
  On 5/22/2020 at 7:39 PM, Melodia said:

I don't really understand how would I encode/decode something that isn't primitive >.<

Expand  

There are helper functions that allows you to encode complex data (such as ITextComponent and BlockPos) to NBT.

 

  On 5/22/2020 at 7:39 PM, Melodia said:

I'm trying to sync the capabilities, is making a list of all the capabilities a good start?

Expand  

I personally store my capabilities in static fields marked with @CapabilityInject annotation so that the value of the capability is injected at runtime. An example is this.

 

Here are some links to the capability part of my test mod if you need:

My capability object.

My capability provider.

My capability storage.

My event subscriber for attaching capabilities to player.

My packet that syncs the data of capability to the client.

Edited by DavidM

Some tips:

  Reveal hidden contents

 

Posted
  On 5/23/2020 at 12:46 AM, DavidM said:

There are helper functions that allows you to encode complex data (such as ITextComponent and BlockPos) to NBT.

 

I personally store my capabilities in static fields marked with @CapabilityInject annotation so that the value of the capability is injected at runtime. An example is this.

 

Here are some links to the capability part of my test mod if you need:

My capability object.

My capability provider.

My capability storage.

My event subscriber for attaching capabilities to player.

My packet that syncs the data of capability to the client.

Expand  

If possible could you explain this line?

https://github.com/davidmaamoaix/AquaticExploration/blob/d83561ca633053127545d7518bfb50e243e779a1/src/main/java/cn/davidma/aquaticexploration/common/progress/AquaticProgresses.java#L19

 

How does it get updated?

In the readNBT method you're using that declartion but I don't really understand how it get updated

Posted

Oh I'm just being lazy there.

Instead of finding the registry reference during the appropriate time, I used a LazyValue to find it via GameRegistry.findRegistry the first time I call it.

It is functionally the same with:

if (registry == null) {
	registry = findRegistry();
}

doStuffWithRegistry();

 

Some tips:

  Reveal hidden contents

 

Posted
  On 5/23/2020 at 11:35 PM, DavidM said:

Oh I'm just being lazy there.

Instead of finding the registry reference during the appropriate time, I used a LazyValue to find it via GameRegistry.findRegistry the first time I call it.

It is functionally the same with:

if (registry == null) {
	registry = findRegistry();
}

doStuffWithRegistry();

 

Expand  

Thanks a lot.

Eventually I've managed to fix my problems

But for some reason as the player gets taller, I can't seem to break anything at a height higher than the regular reach radius

Is it possible or is there any variable to change the reach radius to be around my hand at a certain player height?

Posted
  On 5/25/2020 at 2:54 PM, Melodia said:

Is it possible or is there any variable to change the reach radius to be around my hand at a certain player height?

Expand  

That is changeable in the player's attribute. Obtain the attribute via LivingEntity#getAttribute and pass in the REACH_DISTANCE in PlayerEntity to obtain the reach attribute. You can modify that to change block reach distance.

Unfortunately I don't think there is a convenient method of changing the reach for entity interactions. You'll have to do some manual ray casting.

  • Like 1

Some tips:

  Reveal hidden contents

 

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.