Jump to content

[SOLVED] [1.12.2]Rendering EntityThrowable with RenderSnowball


blfngl

Recommended Posts

Haven't checked in with Forge in a long time and I see there's been a lot of changes. Was attempting to update one of my old mods, and I'm needing to render a projectile, but (obviously) the way I used to do it doesn't work anymore. I'm trying this:

 

Spoiler

package blfngl.fallout.util;

import blfngl.fallout.Fallout;
import blfngl.fallout.entity.EntityBullet;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.event.RegistryEvent.Register;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.EntityEntry;

@EventBusSubscriber
public class RegistryHandler
{
	@SubscribeEvent
	public static void registerBlocks(Register<Block> event)
	{
		for (Block block: Fallout.blockList)
			event.getRegistry().register(block);
	}

	@SubscribeEvent
	public static void registerItemBlocks(Register<Item> register)
	{
		for (Block block: Fallout.itemBlockList)
		{
			ItemBlock iBlock = new ItemBlock(block);
			iBlock.setRegistryName(block.getRegistryName());
			register.getRegistry().register(iBlock);
		}
	}

	@SubscribeEvent
	public static void registerItems(Register<Item> register)
	{
		for (Item item: Fallout.itemList)
		{
			register.getRegistry().register(item);
			ModelResourceLocation modelLoc = new ModelResourceLocation(item.getRegistryName(), "inventory");
			ModelLoader.setCustomModelResourceLocation(item, 0, modelLoc);
		}
	}

	@SubscribeEvent
	public static void renderModels(Register<EntityEntry> register)
	{
		int entityId = 0;

		EntityEntry bullet = new EntityEntry(EntityBullet.class, "fallout_bullet")
				.setRegistryName(Reference.MODID, "fallout_bullet");
		register.getRegistry().register(bullet);

		RenderManager renderBullet = new RenderManager(null, Minecraft.getMinecraft().getRenderItem());
		RenderingRegistry.registerEntityRenderingHandler(EntityBullet.class,
				new RenderSnowball(renderBullet, FalloutItems.ammoSpike, Minecraft.getMinecraft().getRenderItem()));
	}
}

 

but I'm not getting anything rendered. The entity is there and affects the world, but isn't visible. Any ideas?

Edited by blfngl
Marked as solved
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.