Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Projectile rendering incorrectly when given a high velocity
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
MysticalMike

Projectile rendering incorrectly when given a high velocity

By MysticalMike, February 19 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

MysticalMike    0

MysticalMike

MysticalMike    0

  • Tree Puncher
  • MysticalMike
  • Members
  • 0
  • 8 posts
Posted February 19

When I spawn a projectile with a high velocity it seems to render in the incorrect location but it ends up hitting the correct block. Better explained by watching this clip: https://youtu.be/ENmASw9UQVQ

 

Here is the basic code I used to spawn the projectile:

spacer.png

 

The only thing that I could think of as the cause would be some kind of de-sync with the client because the projectile doesn't hit mobs or blocks that would be in the way if it was actually where it's rendering.

Any clues on how to fix this would be very helpful.

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7697

diesieben07

diesieben07    7697

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7697
  • 56382 posts
Posted February 19

ArrowEntity uses SSpawnObjectPacket, which can only handle motion between -3.9 and +3.9.

  • Quote

Share this post


Link to post
Share on other sites

MysticalMike    0

MysticalMike

MysticalMike    0

  • Tree Puncher
  • MysticalMike
  • Members
  • 0
  • 8 posts
Posted February 20 (edited)
On 2/19/2021 at 1:19 AM, diesieben07 said:

ArrowEntity uses SSpawnObjectPacket, which can only handle motion between -3.9 and +3.9.

Okay I see what you mean in SSpawnObjectPacket but I'm not sure how I could change that or if there's a different packet I could send. I tried creating a new packet extending SSpawnObjectPacket but minecraft doesn't render custom non-living entities with that packet. Before I was using 'NetworkHooks.getEntitySpawningPacket(this);' which ultimately creates a SCustomPayloadPlayPacket packet which does render custom non-living entities but I don't know how I could edit that packet either. (Both clamp the motion)

 

Edited February 20 by MysticalMike
  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7697

diesieben07

diesieben07    7697

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7697
  • 56382 posts
Posted February 20

Do not make your own "vanilla style" packet (i.e. subclass of IPacket). It won't work.

 

You can implement IEntityAdditionalSpawnData on your entity and encode the motion again, without clamping. This requires the use of NetworkHooks.getEntitySpawningPacket (like all modded entities).

  • Quote

Share this post


Link to post
Share on other sites

MysticalMike    0

MysticalMike

MysticalMike    0

  • Tree Puncher
  • MysticalMike
  • Members
  • 0
  • 8 posts
Posted February 22
On 2/20/2021 at 12:03 PM, diesieben07 said:

Do not make your own "vanilla style" packet (i.e. subclass of IPacket). It won't work.

 

You can implement IEntityAdditionalSpawnData on your entity and encode the motion again, without clamping. This requires the use of NetworkHooks.getEntitySpawningPacket (like all modded entities).

Okay so I got it to write and read my data but how can I use that to actually change the speed for the client?

image.png.c8095e092bf03e14c283ddfea4f2838f.png

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7697

diesieben07

diesieben07    7697

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7697
  • 56382 posts
Posted February 22

Is the method called? Does it read the correct values?

  • Quote

Share this post


Link to post
Share on other sites

MysticalMike    0

MysticalMike

MysticalMike    0

  • Tree Puncher
  • MysticalMike
  • Members
  • 0
  • 8 posts
Posted February 22
2 minutes ago, diesieben07 said:

Is the method called? Does it read the correct values?

Yeah, but even setting the motion even to (0, 0, 0) doesn't seem to change it.

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7697

diesieben07

diesieben07    7697

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7697
  • 56382 posts
Posted February 22

I can't see why that would happen.

Can you post a Git repo of your mod?

  • Quote

Share this post


Link to post
Share on other sites

MysticalMike    0

MysticalMike

MysticalMike    0

  • Tree Puncher
  • MysticalMike
  • Members
  • 0
  • 8 posts
Posted February 22 (edited)
3 hours ago, diesieben07 said:

I can't see why that would happen.

Can you post a Git repo of your mod?

Okay I posted it to my github: https://github.com/MysticalMike/GunMod

I use EMPGun to spawn the projectile: io/github/mysticalmike/gunmod/common/items/EMPGun

And BulletEntity is the projectile spawned: io/github/mysticalmike/gunmod/common/entities/BulletEntity

Edited February 22 by MysticalMike
  • Quote

Share this post


Link to post
Share on other sites

MysticalMike    0

MysticalMike

MysticalMike    0

  • Tree Puncher
  • MysticalMike
  • Members
  • 0
  • 8 posts
Posted February 23

I'm just going to bump this because I don't think you got a notification since I edited the last message, but there's my project ^^^

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7697

diesieben07

diesieben07    7697

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7697
  • 56382 posts
Posted February 23

Yes... that's why you don't edit posts if you have significant new info... Anyways.

 

SEntityVelocityPacket has the same issue. So you have to disable the default velocity updates (EntityType.Builder#setShouldReceiveVelocityUpdates) and send them yourself using a custom packet.

  • Quote

Share this post


Link to post
Share on other sites

MysticalMike    0

MysticalMike

MysticalMike    0

  • Tree Puncher
  • MysticalMike
  • Members
  • 0
  • 8 posts
Posted February 23

What custom packet do I send?

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7697

diesieben07

diesieben07    7697

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7697
  • 56382 posts
Posted February 23

You need to write it.

  • Quote

Share this post


Link to post
Share on other sites

MysticalMike    0

MysticalMike

MysticalMike    0

  • Tree Puncher
  • MysticalMike
  • Members
  • 0
  • 8 posts
Posted February 23
On 2/20/2021 at 12:03 PM, diesieben07 said:

Do not make your own "vanilla style" packet (i.e. subclass of IPacket). It won't work.

 

You can implement IEntityAdditionalSpawnData on your entity and encode the motion again, without clamping. This requires the use of NetworkHooks.getEntitySpawningPacket (like all modded entities).

How exactly does one write a packet and get forge to send it?

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7697

diesieben07

diesieben07    7697

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7697
  • 56382 posts
Posted February 23

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

 

As for how to send it, that's on you. You have to send it.

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • moyas1009
      Texture for new Layer

      By moyas1009 · Posted 35 minutes ago

      Hi, I'm making a layer that goes over the player's head, so far I've gotten the model to render correctly but I don't know what to put in the json so that the texture renders or if I should even make a json in the first place, any help is greatly appreciated
    • ThisIsNotOriginal
      When I try to run my mod after I just added Deferred Registries it crashes

      By ThisIsNotOriginal · Posted 45 minutes ago

      when i run it the game gets terminated and doesnt give me a log except the one i provided  
    • ThisIsNotOriginal
      When I try to run my mod after I just added Deferred Registries it crashes

      By ThisIsNotOriginal · Posted 51 minutes ago

      idk where that is this si the only file it shows me  
    • samjviana
      When I try to run my mod after I just added Deferred Registries it crashes

      By samjviana · Posted 1 hour ago

      could you send the latest.log or the debug.log files?  
    • keepercreeper22
      I need help with getting a old world of mine back on a older version of forge(yes i know old forge is not supported, i dont care if admins try to help even if people that are experienced would be great

      By keepercreeper22 · Posted 2 hours ago

      my server file seems to get stuck on unloading dimension one, i can easily share if someone would reply with there disco bandicam 2021-03-03 18-49-20-637.mp4 rd i can figure it out quick, it might even be done by the time i get answer. 
  • Topics

    • moyas1009
      0
      Texture for new Layer

      By moyas1009
      Started 35 minutes ago

    • ThisIsNotOriginal
      3
      When I try to run my mod after I just added Deferred Registries it crashes

      By ThisIsNotOriginal
      Started 3 hours ago

    • keepercreeper22
      0
      I need help with getting a old world of mine back on a older version of forge(yes i know old forge is not supported, i dont care if admins try to help even if people that are experienced would be great

      By keepercreeper22
      Started 2 hours ago

    • Retsal
      4
      [1.16.x] Custom block as a shop

      By Retsal
      Started 13 hours ago

    • BurntBeast
      3
      Minecraft with Forge crashes

      By BurntBeast
      Started 5 hours ago

  • Who's Online (See full list)

    • ThisIsNotOriginal
    • mcnuggies
    • PyRoTheLifeLess
    • Megaton_216_
    • ChampionAsh5357
    • moyas1009
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Projectile rendering incorrectly when given a high velocity
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community