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

in my EntitySMGRounds(Custom arrow) I've been trying to add custom impact sounds, so far the custom sound plays when it hits an entity, but when I try to register the block coline SMGRound hits a block/the ground, the sound spams, and when shooting a mob, the game freezes. would anyone be able to help?

 

http://pastebin.com/JsTz48hV

EDIT:
updated the pastebin, EntitySMGRounds class is at the bottom

Edited by SparkyFox95

POST CRASH LOG

 

EDIT: Nevermind

 

Edited by Leomelonseeds

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

  • Author
1 hour ago, diesieben07 said:

Read the stacktrace, it points to a line. Read that line. Then understand what a NullPointerException is and the error is obvious.

I already know what variable s missing....and I know I've to call super() in the onHit method, its trying to call the right method I'm looking for that's causing the problem, I tried to explain that at the bottom of the pastebin.

Edited by SparkyFox95

  • Author

In my EntitySMGRounds do I have to have "this.playSound(ModSoundEvent.impact, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));"

in a certain line? if I put it after the super(line 86), the sound spams, but if I have it after if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
the sound doesn't play at all

(I've updated the pastebin with my entitysmgrounds class)

EDIT: Fixed it! I had to

 

    protected void onHit(RayTraceResult raytraceResultIn) {
    		super.onHit(raytraceResultIn);
    		this.playSound(ModSoundEvent.impact, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
    		
        Entity entity = raytraceResultIn.entityHit;

        if (entity != null)
        {
            float f = MathHelper.sqrt(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
            int i = MathHelper.ceil((double)f * this.damage);

            if (this.getIsCritical())
            {
                i += this.rand.nextInt(i / 2 + 2);
            }
        }
    }

I've updated the pastebin again incase anyone wants to use my SMGRounds for any reason

Edited by SparkyFox95

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.