Jump to content

Custom Arrows not Rendering


Jevil001

Recommended Posts

Hi, I'm relatively new to minecraft modding and I'm just learning, but I'm struggling a lot with this and I cannot find my exact answers anywhere (or maybe saw them but didn't know they were my answers).

So basically, I have my customs arrows, they work properly, they get used, we can pick them up when they are stuck somewhere, but they are just not visible, and I've checked that the path to my texture is correct. And I just genuinely don't know what's going on.

 

Renderer:

 

package net.jevil001.ultimateorimod.client.renderer.entity;

import net.jevil001.ultimateorimod.OriMod;
import net.jevil001.ultimateorimod.world.entity.Light_Arrow_Entity;
import net.minecraft.client.renderer.entity.ArrowRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
public class Light_Arrow_Renderer extends ArrowRenderer<Light_Arrow_Entity> {
    public static final ResourceLocation TEXTURE = new ResourceLocation(OriMod.MOD_ID, "textures/entity/projectiles/light_arrow.png");

    public Light_Arrow_Renderer(EntityRendererProvider.Context manager) {
        super(manager);
    }

    @Override
    public ResourceLocation getTextureLocation(Light_Arrow_Entity pEntity) {
        return TEXTURE;
    }
}

Entity:

package net.jevil001.ultimateorimod.world.entity;

import net.jevil001.ultimateorimod.item.Mod_Items;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.network.protocol.Packet;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraftforge.network.NetworkHooks;
import org.jetbrains.annotations.NotNull;

import javax.annotation.Nonnull;

public class Light_Arrow_Entity extends AbstractArrow {
    public Light_Arrow_Entity(EntityType<? extends Light_Arrow_Entity> entityType, Level world) {
        super(entityType, world);
    }

    public Light_Arrow_Entity(Level pLevel, double pX, double pY, double pZ) {
        super(Mod_Entities.LIGHT_ARROW.get(), pX, pY, pZ, pLevel);
    }
    public Light_Arrow_Entity(EntityType<Light_Arrow_Entity> entityType, LivingEntity shooter, Level world) {
        super(Mod_Entities.LIGHT_ARROW.get(), shooter, world);
    }

    public void tick() {
        super.tick();
        if (this.level.isClientSide && !this.inGround) {
            this.level.addParticle(ParticleTypes.INSTANT_EFFECT, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D, 0.0D);
        }

    }
    @Override
    @Nonnull
    public Packet<?> getAddEntityPacket() {
        return NetworkHooks.getEntitySpawningPacket(this);
    }

    @Override
    public @NotNull ItemStack getPickupItem() {
        return new ItemStack(Mod_Items.LIGHT_ARROW.get());
    }
}

Client Setup:

package net.jevil001.ultimateorimod.client;

import net.jevil001.ultimateorimod.OriMod;
import net.jevil001.ultimateorimod.client.renderer.entity.Light_Arrow_Renderer;
import net.jevil001.ultimateorimod.world.entity.Mod_Entities;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

import java.util.function.Consumer;

@Mod.EventBusSubscriber(modid = OriMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)

public class Client_Setup {
    public static void doSetup(){
        MinecraftForge.EVENT_BUS.addListener(Client_Setup::registerEntityRenderers);
    }
    @SubscribeEvent
    public static void registerEntityRenderers(EntityRenderersEvent.RegisterRenderers event) {
        event.registerEntityRenderer(Mod_Entities.LIGHT_ARROW.get(), Light_Arrow_Renderer::new);
    }
}

 

My mod entities:

package net.jevil001.ultimateorimod.world.entity;

import net.jevil001.ultimateorimod.OriMod;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;

public class Mod_Entities {
    public static DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES, OriMod.MOD_ID);

    public static final RegistryObject<EntityType<Light_Arrow_Entity>> LIGHT_ARROW = ENTITY_TYPES.register("light_arrow", () -> EntityType.Builder.<Light_Arrow_Entity>of(Light_Arrow_Entity::new, MobCategory.MISC).sized(0.5F, 0.5F).build(new ResourceLocation(OriMod.MOD_ID, "light_arrow").toString()));

    public static void register(IEventBus eventbus) {
        ENTITY_TYPES.register(eventbus);
    }
}

Main file:

package net.jevil001.ultimateorimod;

import com.mojang.logging.LogUtils;
import net.jevil001.ultimateorimod.block.ModBlocks;
import net.jevil001.ultimateorimod.client.Client_Setup;
import net.jevil001.ultimateorimod.client.renderer.entity.Light_Arrow_Renderer;
import net.jevil001.ultimateorimod.item.Mod_Items;
import net.jevil001.ultimateorimod.util.ModItemProperties;
import net.jevil001.ultimateorimod.world.entity.Mod_Entities;
import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.slf4j.Logger;

// The value here should match an entry in the META-INF/mods.toml file
@Mod(OriMod.MOD_ID)
public class OriMod {
    // Directly reference a slf4j logger
    private static final Logger LOGGER = LogUtils.getLogger();
    public static final String MOD_ID = "ultimateorimod";

    public OriMod() {
        IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();

        Mod_Items.register(eventBus);
        ModBlocks.register(eventBus);
        Mod_Entities.register(eventBus);

        eventBus.addListener(this::setup);
        eventBus.addListener(this::clientSetup);


        // Register ourselves for server and other game events we are interested in
        MinecraftForge.EVENT_BUS.register(this);
    }
    private void clientSetup(final FMLClientSetupEvent event) {

        ModItemProperties.AddCustomProperties();
        Client_Setup.doSetup();
    }

    private void setup(final FMLCommonSetupEvent event) {
        // some preinit code
        LOGGER.info("HELLO FROM PREINIT");
        LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
    }


}

 

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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.