Jump to content

Recommended Posts

Posted

Hello,

 

I wanted to create a custom bow and arrow, but I can't get it shot with a classic bow or my custom bow.
My arrow extends ArrowItem though...

 

I'll see you around.
Delpig

Posted

I don't this so...
I added my arrow to a registry..
But a tag ?

I have something like that

 

{
	"replace": false,
	"values": [
		"alduinmod:training_arrow"
	]
}

Is that you are meaning ?

Posted
24 minutes ago, Delpig said:

[...]

I have something like that

 


{
	"replace": false,
	"values": [
		"alduinmod:training_arrow"
	]
}

Is that you are meaning ?

If this is a json file named "arrows.json" in your "data/minecraft/tags/items" folder, then yes. :D

Make sure this file is in the "minecraft" namespace and not in your modid namespace.

Posted

Oh yes you're genius  ! my json file were in my modid folder not minecraft folder ! It works now !

 

But i have and other issue, my arrow isn't rendering when i shoot it, but if i'm making an effect onHit, it work.. so..
If you could know from where it came

Here's my render class

package com.alduin.alduinmod.client.render;

import com.alduin.alduinmod.AlduinMod;
import com.alduin.alduinmod.entity.training_arrow.EntityTrainingArrow;

import net.minecraft.client.renderer.entity.ArrowRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;

public class RenderTrainingArrow extends ArrowRenderer<EntityTrainingArrow>
{

	public RenderTrainingArrow(EntityRendererManager renderManagerIn) {
		super(renderManagerIn);
		// TODO Auto-generated constructor stub
	}
	@Override
	public ResourceLocation getEntityTexture(EntityTrainingArrow entity) 
	{	Item refItem = entity.getArrowStack().getItem();
		return new ResourceLocation(AlduinMod.MOD_ID + ":textures/entity/projectile/"+ refItem.getRegistryName().getPath());
	}

}

And my ClientSideEvent

 

package com.alduin.alduinmod.client;

import com.alduin.alduinmod.AlduinMod;
import com.alduin.alduinmod.client.render.RenderTrainingArrow;
import com.alduin.alduinmod.init.entityTypes;

import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;

@EventBusSubscriber(modid = AlduinMod.MOD_ID, bus=EventBusSubscriber.Bus.MOD, value=Dist.CLIENT)
public class ClientModEventSubscriber {
	@SubscribeEvent
	public static void onClientSetup(final FMLClientSetupEvent event) {
		RenderingRegistry.registerEntityRenderingHandler(entityTypes.ARROW.get(), RenderTrainingArrow::new);
		
	}
}

 

Posted (edited)
15 minutes ago, Delpig said:

[...]

But i have and other issue, my arrow isn't rendering when i shoot it, but if i'm making an effect onHit, it work.. so..
If you could know from where it came

Here's my render class


package com.alduin.alduinmod.client.render;

import com.alduin.alduinmod.AlduinMod;
import com.alduin.alduinmod.entity.training_arrow.EntityTrainingArrow;

import net.minecraft.client.renderer.entity.ArrowRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;

public class RenderTrainingArrow extends ArrowRenderer<EntityTrainingArrow>
{

	public RenderTrainingArrow(EntityRendererManager renderManagerIn) {
		super(renderManagerIn);
		// TODO Auto-generated constructor stub
	}
	@Override
	public ResourceLocation getEntityTexture(EntityTrainingArrow entity) 
	{	Item refItem = entity.getArrowStack().getItem();
		return new ResourceLocation(AlduinMod.MOD_ID + ":textures/entity/projectile/"+ refItem.getRegistryName().getPath());
	}

}

[...]

Make sure your texture file is really in "textures/entity/projectile/" and look for related errors in your console log. (the vanilla arrow texture is in "projectiles" so you should check if you forgot the s)

Edited by Boy132
Posted (edited)

I added the "s" to my projectile folder but it doesn't change anything, also there isn't any error related in my console when i shoot :/

Maybe it's my projectile png who isn't good.

I don't know..

 

Update:

 

I used this in my entity

@Override
	public IPacket<?> createSpawnPacket(){
		
		return NetworkHooks.getEntitySpawningPacket(this);
	}

This is the new line in my renderer

return new ResourceLocation(AlduinMod.MOD_ID + ":textures/entity/projectiles/"+ refItem.getRegistryName().getPath()+ ".png");

And it works fine

Edited by Delpig

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.