Jump to content

Recommended Posts

Posted

Hi!

For the past few days I've tried looking for a good example or guide from which I could understand how to make a new Projectile, but it has largely been unsuccessful. I've searched Youtube for guides, the internet for examples, I tried looking up source code of some mods, but I still largely don't get what's required. 

So I'd greatly appreciate it if anyone could share some (simple) custom made projectile, and how they add it to the registry, or alternatively some guide that shows what's necessary so that I can base my own custom projectile off of. 

Thanks a lot 

Posted (edited)

Projectiles are just special Entities that extend the Projectile class or one of its subclasses like AbstractArrow.

So tutorials for creating entities will get you a lot of the way there. e.g. registering your EntityType and EntityRenderer

For the actual implementation, look at one of the vanilla projectiles or a mod that does something close to what you want.

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

Well I tried doing as you said, copying a Projectile From Minecraft

I basically Copied the LamaSpit Class with some minor edits to make it work:

The important Parts of the ProjectileCopy Class: As in the two constructors(There are no other constructors)

https://imgur.com/a/uPbkOrz

Registering the Projectile:

https://imgur.com/a/qZestoE

 

the error under the constructor says that "Cannot resolve constructor 'ProjectileCopy' " 

Which I know means it cant find the correct constructor, because it wants a constructor that Accepts the parameters (EntityType<Entity>, Level)

But trying to make that constructor doesn't work, well rather calling to the father's constructor doesnt work because it requires a Class that inherits from Projectile, rather than Entity, which is what we gave it

 

https://imgur.com/a/3EEpKDm

Here's an example of what I did(Only to demonstrate the Issue, 

because keeping this constructor conflicts with the second constructor from above)

Thank for you for your time!

 

Posted (edited)

First, please don't post code in images. Either paste the code snippets using the <> option or put your code on github if it is large.

 

Your question is a misunderstanding of lambdas again, like with the BlockEntity problem you had. But this time with generics.

 

Your constructor needs to mention the actual entity class as the generic parameter, not Entity.

public class ProjectileCopy extends Projectile {
   public ProjectileCopy(EntityType<? extends ProjectileCopy> entityType, Level level) {
Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

The other constructor that takes a Llama as a parameter, you obviously don't need.

Unless you want to do something similar to Llama.spit() but then it won't be a Llama for your projectile.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

NOTE: I wrote "? extends ProjectileCopy" in case you want a subclass in future, otherwise it can just be ProjectileCopy.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

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.