Jump to content

[1.7.10]Issues with client data not syncing?


deadrecon98

Recommended Posts

Apparently the EntityPlayerExtended class that I have created is not updating the data properly. I only have it sync whenever data changes so it's not due to the data in a state of change. For some reason the client never recieves the data. Here are a few classes to look into. I'm not really sure where the issue could be. (Also ignore my bad server packet system)

EventManager# http://bit.ly/1UeWkGP

EntityPlayerExtended# http://bit.ly/1GT6lPQ

ClientPacketAndManager# http://bit.ly/1LYoTCs

 

You can view the rest of the source if you click one of the links above. I have uploaded the entire source into a git repo. Thanks to anyone who can help, this really is something that I don't understand too well.

Link to comment
Share on other sites

I will note out all "bad" things in your code and ofc the issue with packets.

 

1. First things 1st - Java Name Convention (don't use capitals on non-static stuff, etc.)

2. In your player tick event ("public void onPlayerTick(TickEvent.PlayerTickEvent event)");

You are not setting phase - Every tick even has 2 phases - START and END - pick one, otherwise code runs twice per tick.

Also - you used static 500 ticks globally, but then you are using them for every player (player tick even is for every player), therefore faster decrementstion ("tick --;") Don't forget to settle that (I know it's beta).

3.

EntityPlayerExtended.get(player).sync();
	if(!player.worldObj.isRemote){

You could put sync() after check (and remove sync's check) jsut saying :D

 

4.

if(FMLCommonHandler.instance().getSide() == Side.CLIENT){
		BetaManager.doBetaCheck();
		network.registerMessage(PacketUpdateClientIEEPData.Handler.class, PacketUpdateClientIEEPData.class, 0, Side.CLIENT);
		MinecraftForge.EVENT_BUS.register(new OverlayInGame());
	}

This will not work on dedic, but I guess it is supposed to be that way? (I was checking if you registered msg).

 

5. I'd also like to note out: "playerLoginEvent(EntityJoinWorldEvent" - don't confuse those - there is separate PlayerLoggedInEvent. Just pointing out.

 

6. In packet's code: (not static)

    private static int XP, Level, difficulty;

 

I have no idea for 1.7.10, if it was 1.8 it would be threads problem (thread safety with netty).

 

I had a glance on those ServerPacketManager and events - you are doing some packet reading there, but I don't really get what's the point, could you explain? YOu might be breaking something somewhere where I don't (can't) see it.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

@Ernio

Ok, so i've went through and changed a good bit of code to match your recommendations(Other than the variable naming, I just don't care to change those atm.). I am still getting the issue but I have noticed that it doesn't seem to sync the player data when you login. After I set the difficulty in the gui it works fine but for some reason it isn't actually syncing properly before then. Oh, as for the server packet thingy, basically it sends the player difficulty to the server so that the server can update the player on it's end.

If it were my guess i'd say the issue was in the entity created or the entity constructed event but I can't really be sure. I've updated my new code so that you can get a better idea as to where i'm at now.

 

EDIT: I did move network.registerMessage() out of only being called on the client side. It is now called on both.

Also, you can see here that the data is correct on the server side but on the client side it's still reverted to it's defaults... https://i.pitter.us/khANHQv4e/jgxunwzGC.png

 

EDIT: I have tried tracing the issue to it's root cause and I think that I may have found it but i'm not sure how to fix it. I was able to trace it back into the packet itself. The packet can send the data but it seems the client never recieves it to begin with. You can see where I am pointing these out here. http://bit.ly/1HAiZrI

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.