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!

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 

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.

  • Author

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!

 

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.

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.

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

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.