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.

Featured Replies

Posted

So i made an item that launches another custom item, and it is working, but i want the render to look like the snowball looks when you throw it I don't want a custom model.

 

How would i go about this?

Edited by MinecraftWero

If you want something to behave similar to vanilla, look at the vanilla implementation and either re-use or extend it as appropriate.

 

In this case, use or extend RenderSnowball to render an entity as an item model.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

  • Author
On 5/29/2017 at 0:31 AM, Choonster said:

If you want something to behave similar to vanilla, look at the vanilla implementation and either re-use or extend it as appropriate.

 

In this case, use or extend RenderSnowball to render an entity as an item model.

 

I tried using this 

	RenderingRegistry.registerEntityRenderingHandler(EntityBacon.class, new RenderSnowball(ModItems.rawbacon ));

 

 

But it asks me to add arguments and i tried everything but can't figure it out.

  • Author
5 hours ago, Jay Avery said:

What arguments does it ask for? Are they objects which you have access to?

 

heres the error 

 

EDIT: Here's my code:

 

	package com.minecraftwero.baconmod.renders;
	 
	import org.lwjgl.opengl.GL11;
	 
	import com.minecraftwero.baconmod.Bacon;
	import com.minecraftwero.baconmod.Reference;
	import com.minecraftwero.baconmod.entities.EntityBacon;
	 
	import net.minecraft.client.renderer.GlStateManager;
	import net.minecraft.client.renderer.Tessellator;
	import net.minecraft.client.renderer.VertexBuffer;
	import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
	import net.minecraft.client.renderer.entity.Render;
	import net.minecraft.client.renderer.entity.RenderEntity;
	import net.minecraft.client.renderer.entity.RenderManager;
	import net.minecraft.client.renderer.entity.RenderSnowball;
	import net.minecraft.client.renderer.texture.TextureMap;
	import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
	import net.minecraft.entity.Entity;
	import net.minecraft.item.ItemStack;
	import net.minecraft.util.ResourceLocation;
	 
	public class RenderBacon extends RenderEntity {
	 
	 
	public RenderBacon(RenderManager renderManagerIn) {
	super(renderManagerIn);
	}
	 
	@Override
	protected ResourceLocation getEntityTexture(Entity entity) {
	return new ResourceLocation(":textures/entity/rawbacon");
	}
	}
	

 

	 
	package com.minecraftwero.baconmod.init;
	import com.minecraftwero.baconmod.Bacon;
import com.minecraftwero.baconmod.Reference;
import com.minecraftwero.baconmod.entities.EntityBacon;
import com.minecraftwero.baconmod.handlers.EntityHandler;
import com.minecraftwero.baconmod.items.BaconLauncher;
import com.minecraftwero.baconmod.items.CookedBacon;
import com.minecraftwero.baconmod.items.RawBacon;
import com.minecraftwero.baconmod.renders.RenderBacon;
import com.minecraftwero.baconmod.util.Utils;
	import net.minecraft.client.Minecraft;
import net.minecraft.client.main.Main;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.registry.GameData;
import net.minecraftforge.fml.common.registry.GameRegistry;
	public class ModItems {
	    private static final String Harvester = null;
    public static Item rawbacon;
    public static Item cookedbacon;
    public static Item baconlauncher;
    
    
    public static void init(){
        rawbacon = new RawBacon("rawbacon", "rawbacon");
        cookedbacon = new CookedBacon("cookedbacon", "cookedbacon");
        baconlauncher = new BaconLauncher("baconlauncher", "baconlauncher");
        
        //Entity Registration
        ResourceLocation baconbullet = new ResourceLocation(Reference.MODID + ":" + "baconbullet" , "inventory");
    //    EntityHandler.registerModEntity(entitybaconres, EntityBacon.class, "entitybaconres", Bacon.instance, 16, 20, true);
        EntityRegistry.registerModEntity(baconbullet, EntityBacon.class, "baconbullet", 1, Reference.MODID, 128, 1, true);
        RenderingRegistry.registerEntityRenderingHandler(EntityBacon.class, new RenderSnowball(ModItems.rawbacon ));
        }
    
    public static void register(){
        registerItem(rawbacon);
        registerItem(cookedbacon);
        registerItem(baconlauncher);
    }
    
    public static void registerRenders(){
        registerRender(rawbacon);
        registerRender(cookedbacon);
        registerRender(baconlauncher);
    }
    
    public static void registerItem(Item item){
        item.setCreativeTab(Bacon.items);
        GameRegistry.register(item);
        Utils.getLogger().info("Registered Item: " + item.getUnlocalizedName().substring(5));
    }
    
    public static void registerRender(Item item){
        ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(new ResourceLocation(Reference.MODID, item.getUnlocalizedName().substring(5)), "inventory"));
        Utils.getLogger().info("Registered render for " + item.getUnlocalizedName().substring(5));
    }
    
}
 
	

Edited by MinecraftWero

Well, your IDE told you what arguments you need to provide. RenderItem can be obtained at Minecraft::getRenderItem(). To obtain a RenderManager you need to properly register your renderer using RenderingRegistry::registerEntityRenderingHandler(Class, IRenderFactory). IRenderFactory::createRenderFor has RenderManager as an argument.

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.