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

I have already created this topic (sorry). but I have ran into another problem, my model was working correctly but now the rotating parts don't render, I used to be able to render only one rotating part but now they don't render at all. can someone please point me in the right direction?

 

render of model without rotation:

pCk1H4Q.png

render of model with rotation:

pHaCaWW.png

code for model class:

package com.example.gammacraft.models;

import com.example.gammacraft.TileEntity.MiniJetTileEntity;

import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;

public class ModelMiniJet extends ModelBase
{
  //fields
    ModelRenderer base;
    ModelRenderer layer145;
    ModelRenderer layer190;
    ModelRenderer Shape1;
    ModelRenderer layer1452;
    ModelRenderer layer1902;
    ModelRenderer Blade1;
    ModelRenderer Blade2;
    ModelRenderer Blade3;
    ModelRenderer Blade_4;
    
  public ModelMiniJet()
  {
    textureWidth = 64;
    textureHeight = 32;
    
    
      //base
      base = new ModelRenderer(this, 0, 0);
      base.addBox(0F, 0F, 0F, 16, 1, 16);
      base.setRotationPoint(-8F, -1F, -8F);
      base.setTextureSize(64, 32);
      base.mirror = true;
      setRotation(base, 0F, 0F, 0F);
      
      //layer 1
      layer145 = new ModelRenderer(this, 0, 0);
      layer145.addBox(-2.5F, 0F, -2.5F, 5, 1, 5);
      layer145.setRotationPoint(0F, -2F, 0F);
      layer145.setTextureSize(64, 32);
      layer145.mirror = true;
      setRotation(layer145, 0F, -0.7853982F, 0F);
      
      layer190 = new ModelRenderer(this, 0, 0);
      layer190.addBox(-2.5F, 0F, -2.5F, 5, 1, 5);
      layer190.setRotationPoint(0F, -2F, 0F);
      layer190.setTextureSize(64, 32);
      layer190.mirror = true;
      setRotation(layer190, 0F, 0F, 0F);
      
      //pole
      Shape1 = new ModelRenderer(this, 0, 0);
      Shape1.addBox(-1.5F, 0F, -1.5F, 3, 17, 3);
      Shape1.setRotationPoint(0F, -19F, 0F);
      Shape1.setTextureSize(64, 32);
      Shape1.mirror = true;
      setRotation(Shape1, 0F, 0F, 0F);
      
      //layer 2
      layer1452 = new ModelRenderer(this, 0, 0);
      layer1452.addBox(-2.5F, 0F, -2.5F, 5, 1, 5);
      layer1452.setRotationPoint(0F, -20F, 0F);
      layer1452.setTextureSize(64, 32);
      layer1452.mirror = true;
      setRotation(layer1452, 0F, -0.7853982F, 0F);
      
      layer1902 = new ModelRenderer(this, 0, 0);
      layer1902.addBox(-2.5F, 0F, -2.5F, 5, 1, 5);
      layer1902.setRotationPoint(0F, -20F, 0F);
      layer1902.setTextureSize(64, 32);
      layer1902.mirror = true;
      setRotation(layer1902, 0F, 0F, 0F);
      
      //turbines
      Blade1 = new ModelRenderer(this, 0, 0);
      Blade1.addBox(-0.4666667F, 0F, -7F, 1, 17, 14);
      Blade1.setRotationPoint(0F, -19F, 0F);
      Blade1.setTextureSize(64, 32);
      Blade1.mirror = true;
      setRotation(Blade1, 0F, -0.7853982F, 0F);
      
      Blade2 = new ModelRenderer(this, 0, 0);
      Blade2.addBox(-0.5F, 0F, -7F, 1, 17, 14);
      Blade2.setRotationPoint(0F, -19F, 0F);
      Blade2.setTextureSize(64, 32);
      Blade2.mirror = true;
      setRotation(Blade2, 0F, 0F, 0F);
      
      Blade3 = new ModelRenderer(this, 0, 0);
      Blade3.addBox(-0.5F, 0F, -7F, 1, 17, 14);
      Blade3.setRotationPoint(0F, -19F, 0F);
      Blade3.setTextureSize(64, 32);
      Blade3.mirror = true;
      setRotation(Blade3, 0F, 1.570796F, 0F);
      
      Blade_4 = new ModelRenderer(this, 0, 0);
      Blade_4.addBox(-0.5F, 0F, -7F, 1, 17, 14);
      Blade_4.setRotationPoint(0F, -19F, 0F);
      Blade_4.setTextureSize(64, 32);
      Blade_4.mirror = true;
      setRotation(Blade_4, 0F, 0.7853982F, 0F);
      
  }
  
  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
  {
    super.render(entity, f, f1, f2, f3, f4, f5);
    
    setRotationAngles(f, f1, f2, f3, f4, f5,entity);
    base.render(f5);
    layer145.render(f5);
    layer190.render(f5);
    Shape1.rotationPointY=((float)Minecraft.getSystemTime()%3600)/100F;
    Shape1.render(f5);
    Blade1.rotationPointY=((float)Minecraft.getSystemTime()%3600)/100F;
    Blade1.render(f5);
    Blade2.rotationPointY=((float)Minecraft.getSystemTime()%3600)/100F;
    Blade2.render(f5);
    Blade3.rotationPointY=((float)Minecraft.getSystemTime()%3600)/100F;
    Blade3.render(f5);
    Blade_4.rotationPointY=((float)Minecraft.getSystemTime()%3600)/100F;
    Blade_4.render(f5);
    layer1452.render(f5);
    layer1902.render(f5);
  }
  
  private void setRotation(ModelRenderer model, float x, float y, float z)
  {
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
  }
  
  public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5,Entity entity)
  {
    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
  }

}

 

I would've used spoilers but they're derping again

The proud(ish) developer of Ancients

  • Author

also how could I set the Block's item texture? currently they are just the default pink and black squares.

The proud(ish) developer of Ancients

Post your render class. For the item, use an IItemRenderer. Look at TheGreyGhost's tutorial.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

  • Author

the render class is fairly useless considering the "render" method is in the model but whatever. Also I will check out the  IItemRenderer tutorial.

 

package blockRenderers;

import org.lwjgl.opengl.GL11;

import com.example.gammacraft.TileEntity.TurbineTileEntity;
import com.example.gammacraft.models.ModelMiniJet;

import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;

public class TurbineRenderer extends TileEntitySpecialRenderer{

private static ModelTurbine model;

public TurbineRenderer() {
	this.model = new ModelTurbine();
}

@Override
public void renderTileEntityAt(TileEntity te, double x, double y,double z, float scale) {
	System.out.println("rendering");


	GL11.glTranslated(x, y, z);
	this.bindTexture(new ResourceLocation("gammacraft:textures/blocks/Candle.png"));


	this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
	GL11.glTranslated(-x, -y, -z);

}

}

The proud(ish) developer of Ancients

And don't forget to add your original rotation angles (-0.7853982F for Blade1).

 

And try (float)(Minecraft.getSystemTime()%628)/100F

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.