Jump to content

Recommended Posts

Posted

I am having a bit of trouble rendering my custom arrow that I made on my mod. The bow consumes the item perfectly (the custom arrow item) but projectile that it shoots is a white box. I followed some tutorials and searched for this issue but none of the solutions worked. I even tried the Debugger Tool from eclipse but i got nothing. I also checked the console to see if it was giving errors but i didnt get any. Here are my classes and let me know if you need any other class to figure it out! Thank you for your time! 

 

My Main Class:

package com.lassisolet.grandchasemod.main;


import com.lassisolet.grandchasemod.crafting.LISmelting;
import com.lassisolet.grandchasemod.entities.EntityWind;
import com.lassisolet.grandchasemod.entities.render.RenderWindArrow;
import com.lassisolet.grandchasemod.managers.items.tools.WindArrow;
import com.lassisolet.grandchasemod.proxy.CommonProxy;
import com.lassisolet.grandchasemod.util.Reference;
import com.lassisolet.grandchasemod.util.handler.RegistryHandler;
import com.lassisolet.grandchasemod.world.GCMWorldGen;

import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraftforge.fml.client.registry.IRenderFactory;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;


@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)
public class MainClass {

	@Instance(Reference.MOD_ID)
	public static MainClass instance;
	
	@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.COMMON_PROXY_CLASS)
	public static CommonProxy proxy;
		
	@EventHandler
	public void preInit(FMLPreInitializationEvent preEvent) {
		GameRegistry.registerWorldGenerator(new GCMWorldGen(), 3);
		RegistryHandler.preInitRegistries(preEvent);

	}
	
	@EventHandler
	public void Init(FMLInitializationEvent Event) {
		
		//Smelting[_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_]
		LISmelting.init();
		
	}
	
	@EventHandler
	public void postInit(FMLPostInitializationEvent postEvent) {
	
	}
}

 

 

My Custom Arrow Render Class:

package com.lassisolet.grandchasemod.entities.render;

import com.lassisolet.grandchasemod.entities.EntityWind;
import com.lassisolet.grandchasemod.util.Reference;

import net.minecraft.client.renderer.entity.RenderArrow;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.util.ResourceLocation;

public class RenderWindArrow extends RenderArrow<EntityWind>
{

	public RenderWindArrow(RenderManager manager) 
	{
		super(manager);
	}

	
	@Override
	protected ResourceLocation getEntityTexture(EntityWind entity) 
	{
		return new ResourceLocation(Reference.MOD_ID + ":textures/entity/arrows/wind_arrow.png");
	}
}


 

 

My Custom Arrow Class:

package com.lassisolet.grandchasemod.managers.items.tools;

import com.lassisolet.grandchasemod.entities.EntityWind;
import com.lassisolet.grandchasemod.main.MainClass;
import com.lassisolet.grandchasemod.managers.LIItems;
import com.lassisolet.grandchasemod.util.IHasModel;
import com.lassisolet.grandchasemod.util.Reference;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.item.ItemArrow;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class WindArrow extends ItemArrow implements IHasModel
{
	public WindArrow(String name) 
	{
		setUnlocalizedName(name);
		setRegistryName(name);
		setCreativeTab(Reference.liCreativeTab3);
		
		LIItems.ITEMS.add(this);
	}
	
	@Override
	public EntityArrow createArrow(World worldIn, ItemStack stack, EntityLivingBase shooter) 
	{
		EntityWind entityWind = new EntityWind(worldIn, shooter);
		return entityWind;
	}
	
	@Override
	public void registerModels() 
	{
		MainClass.proxy.registerItemRenderer(this, 0, "inventory");
	}
}

 

My Render Handler:

package com.lassisolet.grandchasemod.util.handler;

import com.lassisolet.grandchasemod.entities.EntityWind;
import com.lassisolet.grandchasemod.entities.render.RenderWindArrow;

import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraftforge.fml.client.registry.IRenderFactory;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class RenderHandler 
{
	

	public static void registerEntityRenders()
	{
		
		
		RenderingRegistry.registerEntityRenderingHandler(EntityWind.class, new IRenderFactory<EntityWind>() 
		{
			@Override
			public Render<? super EntityWind> createRenderFor(RenderManager manager) 
			{
				return new RenderWindArrow(manager);
			}
		});
	}
}

 

My Registry Handler:

package com.lassisolet.grandchasemod.util.handler;

import com.lassisolet.grandchasemod.entities.EntityInit;
import com.lassisolet.grandchasemod.managers.LIBlocks;
import com.lassisolet.grandchasemod.managers.LIItems;
import com.lassisolet.grandchasemod.util.IHasModel;

import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@EventBusSubscriber
public class RegistryHandler {

	@SubscribeEvent
	public static void onItemRegister(RegistryEvent.Register<Item> event) {
		event.getRegistry().registerAll(LIItems.ITEMS.toArray(new Item[0]));
	}
	
	@SubscribeEvent
	public static void onBlockRegister(RegistryEvent.Register<Block> event) {
		event.getRegistry().registerAll(LIBlocks.BLOCKS.toArray(new Block[0]));
	}
	
	@SubscribeEvent
	public static void onModelRegister(ModelRegistryEvent event) {
		for (Item item : LIItems.ITEMS) {
			if (item instanceof IHasModel) {
				((IHasModel)item).registerModels();
			}
		}
		
		for (Block block : LIBlocks.BLOCKS) {
			if (block instanceof IHasModel) {
				((IHasModel)block).registerModels();
			}
		}
	}
	
	public static void preInitRegistries(FMLPreInitializationEvent event)
	{

		EntityInit.registerEntities();

	}
	
	
}

 

 

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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