Jump to content

Recommended Posts

Posted (edited)

So I'm working on moving my Mobile Suit type entities over to a non-player based model design and I made the entity class for the Mobile Suits no longer extend EntityMob it now extends Entity and I had to rewrite the renderer but I'm not getting anything to render. The code I've attached is my rendering code.

	public static class MSRender extends Render<MSMob> {
		
		private MobileSuit ms;
		private ModelBase model;
		
		public MSRender(RenderManager rendermanagerIn,MobileSuit ms) {
			super(rendermanagerIn);
			this.model = ms.createModel() == null ? new ModelPlayer(1.0f,false) : ms.createModel();
			this.model.isChild = false;
			this.ms = ms;
		}
		
		protected float handleRotationFloat(MSMob entity,float partialTicks) {
	        return (float)entity.ticksExisted + partialTicks;
	    }
		
		protected float interpolateRotation(float prevYawOffset,float yawOffset,float partialTicks) {
	        float f;
	        for(f = yawOffset-prevYawOffset;f < -180.0F;f += 360.0F);
	        while(f >= 180.0F) f -= 360.0F;
	        return prevYawOffset+partialTicks*f;
	    }
		
		@Override
		public void doRender(MSMob entity,double x,double y,double z,float entityYaw,float partialTicks) {
			GlStateManager.pushMatrix();
			this.scale(entity,partialTicks);
			GlStateManager.translate(x,y,z);
			GlStateManager.rotate(-entityYaw,0,1,0);
			this.getRenderManager().renderEngine.bindTexture(this.getEntityTexture(entity));
			this.model.render(entity,0,0,entity.ticksExisted+partialTicks,entity.rotationYaw,entity.rotationPitch,entity.scale/0.0625F);
			super.doRender(entity,x,y,z,entityYaw,partialTicks);
			GlStateManager.popMatrix();
		}
		
		protected void scale(MSMob mob,float par2) {
			this.shadowSize = mob.scale/2.0f;
		}

		@Override
		protected ResourceLocation getEntityTexture(MSMob entity) {
			return new ResourceLocation(this.ms.getBaseResourceLocation()+".png");
		}
		
		public static class Factory implements IRenderFactory<MSMob> {
			
			private MobileSuit ms;
			
			public Factory(MobileSuit ms) {
				this.ms = ms;
			}
			
			@Override
			public Render<? super MSMob> createRenderFor(RenderManager manager) {
				return new MSRender(manager,this.ms);
			}
		}
	}

 

Edited by Spaceboy Ross

The official YouTuber Spaceboy Ross

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.