Tadpoling Posted July 10, 2022 Posted July 10, 2022 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 Quote
warjort Posted July 10, 2022 Posted July 10, 2022 (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 July 10, 2022 by warjort Quote 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.
Tadpoling Posted July 10, 2022 Author Posted July 10, 2022 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! Quote
warjort Posted July 10, 2022 Posted July 10, 2022 (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 July 10, 2022 by warjort Quote 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.
warjort Posted July 10, 2022 Posted July 10, 2022 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. Quote 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.
warjort Posted July 10, 2022 Posted July 10, 2022 NOTE: I wrote "? extends ProjectileCopy" in case you want a subclass in future, otherwise it can just be ProjectileCopy. Quote 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.
Recommended Posts
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.