Jump to content

[1.18.2] Adding Entities


MultiCoder

Recommended Posts

I am trying to add a few custom arrows for a project i'm currently working on.

I have the classes all there and setup however there are some errors on a couple of constructors (see below)


import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.projectile.Arrow;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.EntityHitResult;
import org.multicoder.mcpaintball.init.entityinit;

public class RedPaintballArrowEntity extends Arrow
{

    public RedPaintballArrowEntity(EntityType<? extends RedPaintballArrowEntity> p_36858_, Level p_36859_) {
        super(p_36858_, p_36859_);
    }

    public RedPaintballArrowEntity(Level p_36861_, double p_36862_, double p_36863_, double p_36864_) {
        super(entityinit.RED_PAINTBALL.get(),p_36861_, p_36862_, p_36863_, p_36864_);
    }

    public RedPaintballArrowEntity(Level p_36866_, LivingEntity p_36867_) {
        super(entityinit.RED_PAINTBALL.get(), p_36866_, p_36867_);
    }

    @Override
    protected ItemStack getPickupItem()
    {
        return ItemStack.EMPTY;
    }

    @Override
    protected void onHitEntity(EntityHitResult p_36757_)
    {

    }
}

The error is with the bottom 2 constructors and it is saying cannot resolve method 'super', I am completely stuck on what to do or why this is happening to begin with. Am I missing something.

import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import org.multicoder.mcpaintball.MCPaintball;
import org.multicoder.mcpaintball.entity.RedPaintballArrowEntity;

public class entityinit
{
    public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES, MCPaintball.MODID);

    public static final RegistryObject<EntityType<RedPaintballArrowEntity>> RED_PAINTBALL = ENTITY_TYPES.register("red_paintball",() -> EntityType.Builder.of(RedPaintballArrowEntity::new, MobCategory.MISC).sized(0.5f,0.5f).build("red_paintball"));
}

This is my entitytype register.

Link to comment
Share on other sites

As the compiler is telling you, those constructors don't exist.

They do exist on AbstractArrow, but you aren't extending that class.


Please don't post basic java questions in this forum. Buy a book or whatever you need to learn the language.

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.

Link to comment
Share on other sites

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.