Jump to content

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


Bomb787

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.