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.

Projectile Entity Constructor Missing Access Level Modifier Preventing Direct Extension

Featured Replies

Posted

Even though some classes extend ProjectileEntity, its constructor is protected. I tried extending it and my IDE told me I needed a "constructor matching super" so I made one but of-course the constructor is protected so a super() is not an option. Am I missing something or is there no way to directly extend ProjectileEntity?

 

Thanks in advance

Edited by Iron1601

20 minutes ago, Iron1601 said:

constructor is protected

extends ProjectileEntity and set the constructor to public that you register you entity

if you extends a class which has protect methods you can use them

  • Author
Quote

'ProjectileEntity(net.minecraft.entity.EntityType<? extends net.minecraft.entity.projectile.ProjectileEntity>, net.minecraft.world.World)' is not public in 'net.minecraft.entity.projectile.ProjectileEntity'. Cannot be accessed from outside package

Thanks for the suggestion I tried it and the IDE gave me ^ that. To me this sounds like its not public in the class itself let alone extending classes. Regardless this seems like a mistake of some sort since it is highly unusual to not have a modifier.

 

  • Author

So I have to piggyback off of some other class and override its methods and logic? If so, why?

  • Author

Indeed that is the last resort though I haven't managed to get the formatting down. F.e how do I express "EntityType<? extends [class name]> or a return type of void?

  • Author

I have seen, and following that I made 

Quote

public net.minecraft.entity.projectile.ProjectileEntity(Lnet/minecraft/entity/EntityType; Lnet/minecraft/world/World)

Which doesn't seem to work; still fails at runtime.

Edited by Iron1601

  • Author

 So this?

Quote

public net.minecraft.entity.projectile.ProjectileEntity <init>(Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/World)

If yes the error is now

Quote

Could not find net.minecraftforge:forge:1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3_at_8792c...

 

Edited by Iron1601

  • Author
Quote

Could not resolve all files for configuration ':compileClasspath'.
> Could not find net.minecraftforge:forge:1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3_at_7f64862d2fbb7783bd9b00c37ce20f3f46067451.
  Searched in the following locations:
    - https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3_at_7f64862d2fbb7783bd9b00c37ce20f3f46067451/forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3_at_7f64862d2fbb7783bd9b00c37ce20f3f46067451.pom
    - https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3_at_7f64862d2fbb7783bd9b00c37ce20f3f46067451/forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3_at_7f64862d2fbb7783bd9b00c37ce20f3f46067451.jar
    - file:/C:/Users/Iftach/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3_at_7f64862d2fbb7783bd9b00c37ce20f3f46067451/forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3_at_7f64862d2fbb7783bd9b00c37ce20f3f46067451.pom
    - file:/C:/Users/Iftach/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3_at_7f64862d2fbb7783bd9b00c37ce20f3f46067451/forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3_at_7f64862d2fbb7783bd9b00c37ce20f3f46067451.jar
    - https://libraries.minecraft.net/net/minecraftforge/forge/1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3_at_7f64862d2fbb7783bd9b00c37ce20f3f46067451/forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3_at_7f64862d2fbb7783bd9b00c37ce20f3f46067451.jar
    - https://repo.maven.apache.org/maven2/net/minecraftforge/forge/1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3_at_7f64862d2fbb7783bd9b00c37ce20f3f46067451/forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3_at_7f64862d2fbb7783bd9b00c37ce20f3f46067451.pom
    - https://repo.maven.apache.org/maven2/net/minecraftforge/forge/1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3_at_7f64862d2fbb7783bd9b00c37ce20f3f46067451/forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3_at_7f64862d2fbb7783bd9b00c37ce20f3f46067451.jar
  Required by:
      project :

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

 

  • Author

I would imagine this means there is something wrong with the line since puttin a space between the "private com.example.examplemod" and the "<init>" fixes it.

I guess this means there is some syntax problem with 

Quote

public net.minecraft.entity.projectile.ProjectileEntity <init>(Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/World;)

Same error on both to be clear

 

I see now it says "Syntax error" so I guess there's that but what error?

Edited by Iron1601

  • Author

The log was of the examplemod of the mdk to have a control test and the same exact errors came up in both i checked

Also I AT'd my own mod so it wont screw up anything else that might be used somewhere else

Edited by Iron1601

  • Author

Im confident you can AT your own mod so long as you dont actively mess something up.


My entire AT is the one line

Quote

public net.minecraft.entity.projectile.ProjectileEntity <init>(Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/World;)

Not sure what an update error log is? updated?

  • Author

Excuse me if i'm jumping to conclusions or if this is wrong but removing the (Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/World;)

fixes the error but just nerfs the AT so now it just doesn't compile

  • Author

What's the return type of a constructor? stack overflow says void which by the forge docs means that no return type is needed?

 

And yes I agree there is no reason to AT your code but this was just a temporary measure just to not cause any other errors.

 

This is the :comileJava error message I'm assuming that's what you mean. I cant really find any log file in the run/logs or logs  folders that seems relevant.

log,txt

  • Author
Quote

No idea why the docs say that, it is not true

So I do need a return type in the AT.

Quote

What?

I made a new project to make sure the only things that could be a problem was the AT and AT'd the Mod class to not mess with minecraft or forge's internal libraries. In general I don't think that matters a whole lot since that doesn't seem to be the problem.

  • Author

I'm looking to make the constructor of ProjectileEntity public or at least protected and im getting

Quote

line 1:30 no viable alternative at input 'public net.minecraft.entity.projectile.ProjectileEntity <init>(Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/World;)'
Exception in thread "main" java.lang.RuntimeException: 
    at net.minecraftforge.accesstransformer.parser.AtParserErrorListener.syntaxError(AtParserErrorListener.java:8)

which to me means that there is a syntax error.  I haven't managed to locate the problem.

Any help would be appreciated.

  • Author

I meant the AT'd mod class wasn't the problem, the AT is almost certainly the problem. Excuse me if that wasn't clear. I would imagine this is a solvable problem just by someone that knows the syntax.

Edited by Iron1601

  • Author

I apologize for this dragging on however, it appears the winning formula is 

Quote

public net.minecraft.entity.projectile.ProjectileEntity <init>(Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/World;)V

With your context clues, other AT's and patience I found this working.

Thanks for the help.

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.