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

Hi! I've been having a really frustrating problem with registering my projectile to my Entity Type registry. 

244719287_ConstructerProblem.thumb.png.1c06db44675af5b3a2ec54570df1e7d8.png

669550309_ConstructerProblem2.thumb.png.f4776da52ebfbbbeace07d46a6ed0a01.png

 As you can see, my Entity Type class cannot resolve my projectile's constructor due to having more than one constructors sharing the same name. When I press Create constructor, it will create this:381998619_ConstructerProblem3.thumb.png.75f7451582976cde410be72903045477.png

However, the constructor does not work as when I put in entityEntityType and world into the super this will happen:

418772937_ConstructerProblem4.thumb.png.f7edf8a81694b9a26b122dd5d15510d4.png

And when I change the EntityType from Entity to an extension, it would simply results in a copy of the first constructor of my entity resulting in a loop where my projectile would simply be unable to be added into my Entity Type registry.๐Ÿฅด

Now, the obvious problem would be that there are more than one constructors sharing the same name, so one should either change the names of the other constructors or remove them. Not so fast buckeroo ๐Ÿ‘ˆ๐Ÿ‘ˆ ๐Ÿค , those constructors help make the projectile move like a projectile in the first place (Moving from one position to another without simply appearing at the other position). What's really frustrating about this, is that most of the game's projectiles are codded no differently than my own, with multiple constructors sharing the same name, one for registering, the others for the projectile to actually shoot from their original position, and are registered properly.

Heck, my projectile is actually a Ghast Fireball that can't be punched nor break blocks! 

Now I am in a dilemma. As you can tell, I'm new to Modding Minecraft as my Entity Type registry is based/copied from Technovision's tutorial(https://www.youtube.com/watch?v=zJkQc2A1PIk&list=PLDhiRTZ_vnoWsCqtoG1X1MbGY5xATTadb&index=18) and I really want to create my own custom projectiles rather than using Minecraft's already existing projectile. 

I even tried to revamp my EntityType Registry to be similar to Minecraft, but it still has the same problem, can't resolve constructor, new having the dreaded red squiggly line and all.

Thank you for reading about my problem! Please, tell me how I can fix this or what I can do! ๐Ÿ˜Š

 

 

  • Author
  On 4/18/2021 at 10:10 AM, diesieben07 said:

Specify the type parameters for EntityType.Builder.create explicitly.

How do I do that?

  • Author
  On 4/18/2021 at 1:32 PM, diesieben07 said:

EntityType.Builder.<TypeParameter>of(...)

2063117032_ConstructerProblem5.thumb.png.09c680e8d0339d62564b8052134922c8.png

Cannot resolve method 'of' in 'Builder'

I'm still quite confused on how to use TypeParameter. The (...) part specifically as I've no clue what I'm supposed to put there. Where does the 'create' go into the code? 

  • Author
  On 4/18/2021 at 9:30 PM, dun said:

2063117032_ConstructerProblem5.thumb.png.09c680e8d0339d62564b8052134922c8.png

Cannot resolve method 'of' in 'Builder'

I'm still quite confused on how to use TypeParameter. The (...) part specifically as I've no clue what I'm supposed to put there. Where does the 'create' go into the code? 

NEVERMIND! I've figured it out! 

137789741_ConstructerProblem6.thumb.png.8261bc69f715ba33cd91875ff0a78af6.png

Looks like I was taking your code example too literally! ๐Ÿ˜…

Now my code is taking the right constructor! I can finally create my own Projectiles now! Thank you so much! ๐Ÿ˜„

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.