Jump to content

Recommended Posts

Posted

I would like my mod to support vanilla clients when running on a server, as much as possible. I know that the following work:

  • The server will accept connections from vanilla clients if I set acceptableRemoteVersions = "*"
  • If I add a recipe, the client will not see a preview of the result, but they can still shift-click the output box and perform the recipe. I'm OK with this.
  • I saw items with the default model (purple/black box) while playing on a server using a vanilla client. So I know that in some cases the vanilla client will use this when it doesn't know how to render an item (but I don't know the details).

When I naively tried to connect to a server with my mod, I found out:

  • The vanilla client will crash if the server sends it an unknown item id.

I am wondering if I can get the server to substitute a vanilla item when it sends packets to a vanilla client; ie the server will know the player is holding mymod:item, but it will check if the client is vanilla, and if so it will tell the client the player is holding minecraft:dirt. Is there any hook I could use to accomplish this, or another approach?

 

See https://github.com/stewbasic/CommandItem if more specifics are needed.

Posted

Hmmm, that is a tricky situation.

 

One approach might be to use an item stack NBT on a stack of a vanilla item. I am not sure but suspect that the client would tolerate getting NBT data that it doesn't care about.

 

The hard part then is that the item will actually be the vanilla item (with NBT) on the server, so you'll have to intercept a bunch of events for interaction with the item, etc. where you would check the NBT to see if it is your special item.

 

For clients that actually have the mod installed, then you'd have to intercept the rendering of the item to show it properly.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.