Jump to content

[1.7.10] Disguise player as Entity/Block


clienthax

Recommended Posts

No, he means have you written any code yet to try to accomplish this: disguise the player as an entity as a block.

 

People aren't inclined to help if you haven't already tried.  Why are you asking us?  How do you think you'd disguise the player? 

 

At least tell people what you've tried, or tell them what you think might work, otherwise your question sounds like "write my mod for me".  It's not just about being lazy, you really need to struggle through the thought process yourself if you want to really get good at modding.

 

So, here are some questions to figure out for yourself:

- what code controls how the player looks?

- how do you think you can intercept that code to modify it?

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

Link to comment
Share on other sites

Oh, didn't see that part.

 

You could give invisibility to the player and then spawn the entity/set the block at the player's location.

 

Mhm il give that a go, i think ima make a instance of the entity and store it instead of making it each tick however.

Link to comment
Share on other sites

I don't think it can be server side only, or at least it would be extremely difficult.  The client is aware of the player, and is also does all the rendering (i.e. the "disguise" part).  Even if you made a new entity, the client would have to have the mod for that entity.

 

Anything that requires displaying something different would need client-side.

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

Link to comment
Share on other sites

Create extendedProperties for your players.

 

When disquised, keep track of it in the extendedProperties.  Whenver a change of disquise occurs, sync with all the clients via packets.  I would recommend doing this also on some time frequency just in case.  Once a second won't hurt, if you are efficient this won't even be noticable network traffic compared to minecraft itself.

 

On the clients, have setup the render event and when it occurs for a player that has a disquise, cancel the render and utilize your disquise render instead.

 

This isn't that hard to map out based upon other discussions you can search for.  As Jabelar said, get out and try something first. 

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

Create extendedProperties for your players.

 

When disquised, keep track of it in the extendedProperties.  Whenver a change of disquise occurs, sync with all the clients via packets.  I would recommend doing this also on some time frequency just in case.  Once a second won't hurt, if you are efficient this won't even be noticable network traffic compared to minecraft itself.

 

On the clients, have setup the render event and when it occurs for a player that has a disquise, cancel the render and utilize your disquise render instead.

 

This isn't that hard to map out based upon other discussions you can search for.  As Jabelar said, get out and try something first.

Server only mod, ive mostly worked it out now, i just need to figure out how to stop the entity from trying to walk off.

Link to comment
Share on other sites

You could make this mod server only mod but you have to keep track of the following (at least):

 

The player changes to a disguise (some packet the disguising player sends):

-> Server has to send a LogoffEvent? to all other players and not display the player on the serverlist anymore (so that the disguise is good) or despawn the EntityPlayer in the world. I can't tell you if it will be respawned but the disguised player should not be sent these Events

-> Server has to spawn a new Entity in the world (the disguise) and keep it in synch with the actual player movement. If it is a block the server has to prevent movement.

 

Player changes disguise: Pretty much the same as changing to a disguise

 

Player changes to normal: Reverse the process

 

With this implementation the server could be fully aware of the player without changing it's state internally but all sent updates have to be modified which can be extremely difficult to catch all of them (especially when other mods interfere). Also the player wouldn't know about his own state because HIS client never received any updates. How could he, he doesn't support a player being a block.

 

To sum this all up: The mod should be clientside, too.

Link to comment
Share on other sites

You could make this mod server only mod but you have to keep track of the following (at least):

 

The player changes to a disguise (some packet the disguising player sends):

-> Server has to send a LogoffEvent? to all other players and not display the player on the serverlist anymore (so that the disguise is good) or despawn the EntityPlayer in the world. I can't tell you if it will be respawned but the disguised player should not be sent these Events

-> Server has to spawn a new Entity in the world (the disguise) and keep it in synch with the actual player movement. If it is a block the server has to prevent movement.

 

Player changes disguise: Pretty much the same as changing to a disguise

 

Player changes to normal: Reverse the process

 

With this implementation the server could be fully aware of the player without changing it's state internally but all sent updates have to be modified which can be extremely difficult to catch all of them (especially when other mods interfere). Also the player wouldn't know about his own state because HIS client never received any updates. How could he, he doesn't support a player being a block.

 

To sum this all up: The mod should be clientside, too.

 

easy way,

set player to invisible, spawn in mob on server side, in world tick update the entity with players info.

Link to comment
Share on other sites

I really don't understand how that could be a server-side only mod.  If you have a custom entity that the client can see (in disguise) at some point a client has to render it and furthermore won't there be trouble when the server tries to send packets about the entity to the client (which it normally does for all entities) if the client doesn't have the same custom entity class?.  Any custom entity created on server would need to be rendered on the client.  Or maybe I don't understand what you're saying you're doing -- right now it sounds like you're placing a custom entity that is rendered with a disguise.

 

Or are you placing an actual block on the server from an invisible entity?

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

Link to comment
Share on other sites

I've done it with Bukkit before as server only, but like you said its only for vanilla things. 

 

If you are using forge, why not unlock the potential and have a client side as well?

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

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.