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

Hi, sorry for the new thread, this isn't urgent but it would be nice to clear up. I followed

for rendering techne models as blocks. The block works fine but it renders as a flat texture that I gave it in my inventory. From 33:40 he talks about using the tile entity renderer in you inventory but mine dosn't seem to work, no crashes but nothing is changed. Just wondering if anyone can notice the stupid mistake I probably made.

 

Nothing related to the render in my INIT class

 

Client Proxy:

package com.deb.debmodularships.proxies;

import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraftforge.client.MinecraftForgeClient;

import com.deb.debmodularships.ModularshipsINIT;
import com.deb.debmodularships.entities.EntityController;
import com.deb.debmodularships.renders.ItemRenderController;
import com.deb.debmodularships.renders.RenderController;
import com.deb.debmodularships.renders.RenderTEController;
import com.deb.debmodularships.tileentities.TileEntityController;

import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;

public class ClientProxy extends CommonProxy{
public void registerRenderers() {
	RenderingRegistry.registerEntityRenderingHandler(EntityController.class, new RenderController());
	TileEntitySpecialRenderer crender = new RenderTEController();
	ClientRegistry.bindTileEntitySpecialRenderer(TileEntityController.class, crender);
	MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModularshipsINIT.BlockController), new ItemRenderController(crender, new TileEntityController()));
}

public void registerTileEntitySpecialRenderer() {

}
}

 

Item Renderer:

package com.deb.debmodularships.renders;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.client.IItemRenderer;

public class ItemRenderController implements IItemRenderer{

TileEntitySpecialRenderer render;
private TileEntity entity;

public ItemRenderController(TileEntitySpecialRenderer render, TileEntity entity) {
	this.entity = entity;
	this.render = render;
}

@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	return true;
}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
	return true;
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
	if (type == IItemRenderer.ItemRenderType.ENTITY)
		GL11.glTranslatef(-0.5f, 0.0f, -0.5f);
	this.render.renderTileEntityAt(this.entity, 0.0d, 0.0d, 0.0d, 0.0f);
}

}

 

Renderer:

package com.deb.debmodularships.renders;

import org.lwjgl.opengl.GL11;

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

import com.deb.debmodularships.ModularshipsINIT;
import com.deb.debmodularships.models.ModelController;
import com.deb.debmodularships.tileentities.TileEntityController;

public class RenderTEController extends TileEntitySpecialRenderer{

public static final ResourceLocation Ctexture = new ResourceLocation(ModularshipsINIT.MODID + ":textures/entity/entitycontroller.png");
private ModelController model;

public RenderTEController() {
	this.model = new ModelController();
}

@Override
public void renderTileEntityAt(TileEntity TE, double x, double y, double z, float f) {
	TileEntityController TEC = (TileEntityController)TE;
	GL11.glPushMatrix();
		GL11.glTranslatef((float)x + 0.5f, (float)y + 1f, (float)z + 0.5f);
		GL11.glRotatef(180f, 0f, 0f, 1f);
		GL11.glRotatef(180 + TEC.rotation, 0f, 1f, 0f);
		this.bindTexture(Ctexture);
		GL11.glPushMatrix();
			this.model.renderModel(0.03125f);
		GL11.glPopMatrix();
	GL11.glPopMatrix();
}

}

 

Let me know if you might need other classes!

Hi

 

Do you know if renderItem is being called?  (i.e. breakpoint or System.out.println?)

 

If so - something is wrong with your renderer, eg is rendering at the wrong coordinates, offscreen etc.

If not - probably you haven't registered the Item renderer properly.

 

I don't see obvious problems but there might be something subtle I'm missing.

 

-TGG

  • Author

FIGURED IT OUT!!!

 

I called the proxy method before setting the block variable to a block, the renderer was registered for a null variable! ("facepalm"). Thanks for trying to help, I realize you couldn't have seen the problem as I didn't post the INIT class.

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.