Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[SOLVED] [1.12.2]Rendering EntityThrowable with RenderSnowball

Featured Replies

Posted

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

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.