Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello,

I have a tile entity that is changing the motion of certain entities around it, like snowballs. If I change the motionX/Y/Z of the snowball, the movement is pretty strange. First it goes like it should, then goes hyperspeed in the middle of flight(almost teleports) and then returns back to normal.

6891dd0d25.png

Is this a bug in vanilla minecraft/forge, or am I changing the motion incorrectly? This is basically all I'm doing:

entity.motionX = someForceVariable;

Any help is appreciated.

  • Author

After some experimenting, I also discovered that when I only push the entity on the client side(worldObj.isRemote), it goes the first half of the flight, and the opposite for the server.

ff70a6fb8c.png

I guess that means that without an isRemote or !isRemote check, the two are combined into one, so the snowball has to move quickly to get to the server bit after the client part is done, which explains the fast zone.

Dude those diagrams are awesome, seriously!  I wish all posters were so clear about describing their problem :)

 

Sounds like you've run into a client-server synchronisation problem.  Anything you do to the entity on the client side will only last a short time until the server resynchronises it and your client changes are lost/overwritten.  There is a similar problem I wrestled with quite some time ago for EntityArrow http://www.minecraftforge.net/forum/index.php/topic,14315.msg73758.html#msg73758

 

Changes are often done to both the client and the server at the same time to reduce the apparent lag caused by packet transmission time, normally they stay in synch closely enough that when the resynch occurs the difference is small and you don't notice it.  It looks like there's something slightly different about Snowball so that when you push on both client and server, they have different effects so there is a big desynchronisation happening.  Unfortunately I don't know why that is.  The easiest fix might be to push the Entity on the server only and force a resynch (1.6.4 this was by sending Packet28 and/or Packet34, which will be slightly different in 1.7.2 but probably still very similar)

 

-TGG

 

  • Author

Hello,

I'm not sure how to send the packet, but I have found the classes. :P I've googled for a while but can't find the answer. Thanks for the help so far though!

  • Author

After exploring some random classes, I found this piece of code:

WorldServer ws = (WorldServer) e.worldObj;
ws.getEntityTracker().func_151248_b(e, new S12PacketEntityVelocity(e));

Also, a method .func_151247_a() exists but has similar features. Unsure about which to use. After putting that after my push code, and inserting an !isRemote, the issue seemed to be fixed for long distances, but still exists if the snowball is close to the player.

  • Author

Forgot to post this earlier, but I found that 8_b eventually calls 7_a. :P

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.