Jump to content

Recommended Posts

Posted (edited)

I use:

@OnlyIn(value = Dist.CLIENT, _interface = ItemSupplier.class)
public class BulletEntity extends AbstractArrow implements ItemSupplier{
	public BulletEntity(EntityType<? extends BulletEntity> type, LivingEntity entity, Level world) {
        super(type, entity, world);
    }
	Bla-bla-bla
		BulletEntity entitybullet = new BulletEntity(ForgeModEntities.BULLETENTITY.get(), entity, world);
		entitybullet.shoot(entity.getViewVector(1).x, entity.getViewVector(1).y, entity.getViewVector(1).z, POWER, spreading);
	//...
}

Where:

POWER = 4f

POWER = 5f and >5f

I would like to make the projectile with more power and without visual bugs.

Perhaps I should somehow manually move the entity through ticks or override shoot() and play around with vectors

Edited by Luckydel
Posted

Please provide the entire entity, item, and entity renderer class. The above provides no view on the issue.

Additionally, there does not seem to be any visual bugs. If you're talking about the inaccuracy of the bullets, that's the result of `Projectile#shoot` offsetting the look vector by some amount. It is much more noticeable with smaller projectiles.

Finally, do not use `@OnlyIn`. You should have no need to use it as `ItemSupplier` is not a client only interface.

Posted

Entity 

  Reveal hidden contents

Item class
 

  Reveal hidden contents
  Reveal hidden contents

Render
 

  Reveal hidden contents

Model
 

  Reveal hidden contents

Well, in the 2nd video, you can see that the slime is dying, but the bullet model is in a completely different place.

Posted

1. Don't use `@OnlyIn`. It is never needed anywhere.

2. You don't need the `PlayMessages$SpawnEntity` constructor nor override `Entity#getAddEntityPacket`. You are not syncing custom information from the server when the entity is spawned.

3. Don't ever use nonfinal static fields as instance fields. That's not how instances work. Please learn Java for that.

4. Layer definitions for models need to be registered in `EntityRenderersEvent$RegisterLayerDefinitions`.

5. Entity renderers need to be registered in `EntityRenderersEvent$RegisterRenderers`.

6. Do not combine client and common code. Separate them into different classes.

7. Do not have use a class for more than one purpose (e.g. `Item`, event listener, etc.). That is separation of concerns and leads to poor programming.

8. If you want stack specific behavior, use a capability. If you want client specific behavior, you can use static or instance fields because any mod instance will only have access to at most a single physical client.

Finally, I watched the video on quarter speed and still have no idea what you're talking about. It looks like the bullet is hitting the entity.

Posted (edited)

hay 

you have a custome shoot method 

BulletEntity shoot(Level world, LivingEntity entity, float power, double damage, int knockback, RegistryObject<SoundEvent> soundName, float spreading)

the vainilla arrow uses 
shootFromRotation(Entity le, float rot_pan, float rot_til, float left_offset, float fuerza, float precision)

may when you make your custome is passing values to left_offset thing while it must remain in 0.0F

 




 

Edited by perromercenary00
Posted (edited)

 

Thanks for the advice, I'll fix the code. 
I registered the layer and render as you indicated.
 

  Reveal hidden contents
  Reveal hidden contents


perromercenary00, thanks, I saw the error, tried to use shootFromRotation, the result is identical =(

ChampionAsh5357, I think it looks better here

 

 

Edited by Luckydel
Posted

Ah, ok. Well, I would probably use the `ArrowRenderer` as a baseline here for figuring it out. It seems that the rendering is affected by the rotation of the player, which could be because of plenty of things in terms of rendering, though the most likely is that the rotation doesn't line up or there needs to be some additional translation / scaling.

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.