Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Projectile rendering incorrectly when given a high velocity


Recommended Posts

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.

Link to post
Share on other sites
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 by MysticalMike
Link to post
Share on other sites

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

Link to post
Share on other sites
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

Link to post
Share on other sites
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 by MysticalMike
Link to post
Share on other sites

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.

Link to post
Share on other sites
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?

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



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • In order, X}   1.  (Force class to load, as was explained)  and was how it was shown.. I am up for 'changing it up' & optimizing it later,     That's  just the method that was shown.  I want to optimize it later for sure. 2.o_hand  ->   is offhand   I got sick to death of doing typos, and used it & m_hand for main hand ...   (offhand is the shield slot typically) 2. .... actually [ target = (LivingEntity)event.getTarget(); ]  inside of  (AttackEntityEvent event) is 100% capable of causing an error. -- Try setting it up & smacking with any melee attack (fist or weapon) the following a.  Any Minecart b. Any End Crystal c. Any Item Frame. d. Any Boat    ----  it literally causes the game to close with an exception.   All those things can both 'trigger the attackEntity event'  and be inside the target of the player, which will cause an exception when cast into a (Living Entity), which was used to apply the potion effects... ~~ Strangely enough,  a armor stand  not only is uneffected by it, but can accept potions applied to it as well. 3.  It does do something,  It fails & does nothing, which means 'target' is null still, and no potion effects get applied to the target that was hit. --- which means, it prevents the game from being shut down from an unintended casting of a target into a living entity object (which is needed to apply potion effects on) 4.  That's just nitpicking really,  That's an old logic habit....    Some reason it slipped my mind,  either way,     (!(thing == thing)) same effect of (thing != thing)   ---likely I honestly fell back into an old habit when inverse of true statement was my thought on that. 5. I know...  It's not complete (i've not  finished the blocks, as I'm working towards combat centric things, and I'm debating what I want to do with it) --- also,  to note, I remember why I put try { atker = (LivingEntity)livi.getAttackingEntity(); } catch (Exception e) { }  (for future use)      things like minecarts & end crystals can harm the player & other entities, and that event fires when an entity get hurt.... and given I just got off of just randomly finding out that casting the target of my hit into a (living entity) object can cause fatal exceptions, it's there to 'do NOTHING' if that happens, and an prevent fatal exceptions from going off because of a weird entity causing damage that isn't a livingentity for some reason. ~~~  Yes I plan to use it later..    that was for an armor thing. 6. meh...   Again   alot of the primary page is tutorial code....   I left what was shown,  and I'm learning what does what.. .and pruning what doesn't work.    -- yes, it annoys me as well but that's not on the short list atm. 7. as for 'fall = falls'  . I don't like doing that, as i prefer the geniune fallback if some unknown reason happens  a valid variable gets assign (right or wrong) and prevents weird unknown errors. 8.  The method is 100% straight forward    It's just a nested if loop that of course tests each string once (effectively) and doesn't attempt to assign an empty tooltip. _NormToolTip Is on it w/ no shift or cntl held down (either one) _When shift or cntrl is held down,  it shows the correct one. _When Shift & Cntrl are held down.. it shows Cntrl over Shift. ---- to be fair I actually didn't think to check for a method that checks if  a string is empty. ~~~  It uses Exclusionary logic, but if you can think of a faster way of doing  -normal tooltip (no keys held) -Shift Tooltip (either shift held) -Cntl ToolTip (either Cntrl held) -Cntl tooltip over  Shift tooltip (when a Cntrl & Shift is held, either side)  I'm all ears if you think you can do that faster and prevent it from using a null value.
    • What I've been trying to do is I have been attempting to implement an item that can create a transparent blue layer around the entire player. I am using Curios' API for this, as the item is meant to be an equippable accessory. There are also other accessories I have implemented to the mod using the API. I have been able to implement everything that handles this rendering with the accessory item, however I've become stuck after running into a specific issue: when the transparent blue layer is active, it will prevent any accessories specifically on the player's arms from rendering. As far as I can tell, this only happens with the accessories on the player's arms (such as the gloves or even Curios' template knuckles item), as accessories rendering on the player's body for some reason render just fine under the transparent layer. Images for better context: I have been at this for quite awhile but haven't able to figure out what is causing this issue, especially since the inconsistency between rendering for body parts has made me even more confused. It could be a Curios issue, but nothing in its accessory layer code exactly stands out as a cause (if it is indeed Curios' fault though it would at least be good to know what the issue is to pass on to the mod dev). The pendant and glove accessories both render with the same RenderType and render buffer, which I duplicated based on the vanilla armor layer's choices for that, as the vanilla armor layer is also immune to the transparency issue on the arm model part: The relevant code for items and renderers can be found below: Pendants: - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/common/item/accessories/pendant/PendantItem.java - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/client/renderer/accessory/model/PendantModel.java Gloves: - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/common/item/accessories/gloves/GlovesItem.java - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/client/renderer/accessory/model/GlovesModel.java Repulsion Shield (the item creating the transparency layer): - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/common/item/accessories/misc/RepulsionShieldItem.java - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/client/renderer/accessory/model/RepulsionShieldModel.java and, if necessary, Curios' Accessory Layer (code not mine, obviously): - https://github.com/TheIllusiveC4/Curios/blob/1.16.x-forge/src/main/java/top/theillusivec4/curios/client/render/CuriosLayer.java Any help would be appreciated, as I've run out of ideas for what could be causing this issue and how I could fix it. I can provide more information if needed.
    • Ok that's fair. But it's still terrible.
    • Really old Minecraft versions are no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • Ah sorry, you're right. I can refer you to the way Lycanites renders all of their .obj model entities, and best of all it's up to date for 1.16, but it is pretty complicated than just your standard java model. Depending on what you're doing it might not be worth it... https://gitlab.com/Lycanite/LycanitesMobs/-/tree/master/src/main/java/com/lycanitesmobs/client
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.