Jump to content

Projectile Entity Constructor Missing Access Level Modifier Preventing Direct Extension


Recommended Posts

Posted (edited)

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

Expand  

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.

 

Posted

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?

Posted (edited)

I have seen, and following that I made 

  Quote

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

Expand  

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

Edited by Iron1601
Posted (edited)

 So this?

  Quote

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

Expand  

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

Expand  

 

Edited by Iron1601
Posted
  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

Expand  

 

Posted (edited)

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

Expand  

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
Posted (edited)

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
Posted

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

Expand  

Not sure what an update error log is? updated?

Posted

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

Posted

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,txtFetching info...

Posted
  Quote

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

Expand  

So I do need a return type in the AT.

  Quote

What?

Expand  

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.

Posted

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)

Expand  

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

Any help would be appreciated.

Posted (edited)

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
Posted

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

Expand  

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

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