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.

[1.7.10]Custom Rendered Model Won't Rotate According to Player Position

Featured Replies

Posted

I'm making a mod focused on 3d models but I can't figure out how to set the model rotation when placed.

 

Block:

package com.bomb787.modelingmod.Blocks;


import com.bomb787.modelingmod.rendering.tiles.TileEntityTable;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;

public class BlockTable extends BlockContainer{

	public BlockTable() {
		super(Material.wood);
		this.setBlockName("table");
		this.setResistance(1.0F);
		this.setHardness(1.0F);
		
	}
	
	@Override
	public int getRenderType() {
		return -1;
	}
	
	public boolean isOpaqueCube() {
		return false;
	}
	
	public boolean isNormalCube() {
		return false;
	}
	
	public boolean renderAsNormalBlock() {
		return false;
	}
	
	@SideOnly(Side.CLIENT)
    public IIcon getIcon(int p_149691_1_, int p_149691_2_)
    {
        return Blocks.planks.getBlockTextureFromSide(p_149691_1_);
    }

	@Override
	public TileEntity createNewTileEntity(World world, int id) {
		return new TileEntityTable();
	}
}

 

Render Class:

package com.bomb787.modelingmod.rendering.tileentities;

import org.lwjgl.opengl.GL11;

import com.bomb787.modelingmod.ModelingMod;
import com.bomb787.modelingmod.models.ModelTable;
import com.bomb787.modelingmod.rendering.tiles.TileEntityTable;

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


public class RenderTable extends TileEntitySpecialRenderer{
	
	private ModelTable model;
	private ResourceLocation texture = new ResourceLocation("modelingmod:textures/blocks/Table.png");
	
	public RenderTable() {
		this.model = new ModelTable();
	}
	

	public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float scale) {
		GL11.glPushMatrix();
			GL11.glTranslated(x+1, y, z-0.5);
			GL11.glRotated(180, 0, 0, 1);
			this.bindTexture(texture);
			this.model.render((Entity)null, 0, -0.1f, 0, 0, 0, 0.0625f);
		GL11.glPopMatrix();	
	}
}

 

Tile Entity Class:

package com.bomb787.modelingmod.rendering.tiles;

import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.tileentity.TileEntity;

public class TileEntityTable extends TileEntity{

}

 

How do I make it rotate?

1.7.10 is no longer supported here.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Guest locked this topic
Guest
This topic is now closed to further replies.

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.