Jump to content

Recommended Posts

Posted (edited)

Hey thanks for popping in. I'll give some background; I'm brand new to forge modding, and have only created on other thing before this attempt. I'm trying to create a client-side only mod that will render a horse being ridden as a different mob only while riding it, depending on the name of the saddle (Stop me if this isn't even possible). So far in my attempts, I've gotten some invisible horses, and some white blobs. Since I'm not looking to create any custom mobs or models, I figured it would be easier to implement, but I was woefully wrong, so here I am. To start I would at least like to be able to see a horse, mount it and have it's model change into a cow, and then dismount it and see the horse once again.

 

I'll preemptively show what I have so far;

 

Renderer?

public class RenderBySaddle extends RenderEntity {
	
	private boolean wasRiding = false; //Default false
	
	
	protected RenderBySaddle(RenderManager renderManager) {
		super(renderManager);
	}
	
	@Override
	public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks) {
		
		EntityPlayerSP player = Minecraft.getMinecraft().player;
		
		if ( (player.isRiding()) 
				&& !this.wasRiding
				&& (player.getRidingEntity() instanceof EntityHorse)){
			super.doRender(player.getRidingEntity(), x, y, z, entityYaw, partialTicks);
		}
		
	}
}

 

Factory?
 

public class RenderFactory implements IRenderFactory<EntityCow> {
	
	public static final RenderFactory INSTANCE = new RenderFactory();
	
	@Override
	public Render<? super EntityCow> createRenderFor(RenderManager manager) {
		
		return new RenderBySaddle(manager);
	}

}

 

Main file

 

public class TPR
{
    @EventHandler
    public void preInit(FMLPreInitializationEvent event) {
        
        RenderingRegistry.registerEntityRenderingHandler(EntityCow.class, RenderFactory.INSTANCE);
    }

    @EventHandler
    public void init(FMLInitializationEvent event) {
    	
    }
    
    @EventHandler
    public void postInit(FMLPostInitializationEvent event) {
    	
    }
}

 

I know there's not much here, but after spending the later half of last night trying to figure it out to no avail & countless Google searches, as well as coding and deleting; I'm at a loss.

Any help or guidance would be appreciated,

 

Thanks muchly!

Edited by Catnipped
Typo

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.