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 had a really cool idea for my mod and started making a tile entity,made a model and the TESR but it fails at binding the texture i think.

Thanks in advance to anyone who answers.

 

My TESR:

package com.SlothBear.SocketingCrystals.Blocks.TileEntities;

import org.lwjgl.opengl.GL11;

import com.SlothBear.SocketingCrystals.Reference.Reference;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
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 GemCutterRender extends TileEntitySpecialRenderer
{
 private GemCutterModel model;
 public static final ResourceLocation idle = new ResourceLocation(Reference.modid + ":textures/blocks/Gem Cutter_idle.png");
 public static final ResourceLocation active = new ResourceLocation(Reference.modid + ":textures/blocks/Gem Cutter_active.png");
 public static final ResourceLocation completed = new ResourceLocation(Reference.modid + ":textures/blocks/Gem Cutter_completed.png");
     
     public void TileEntityGemCutterRender() 
     {
             this.model = new GemCutterModel();
     }
     private void adjustRotatePivotViaMeta(World world, int x, int y, int z) 
     {
         int meta = world.getBlockMetadata(x, y, z);
         GL11.glPushMatrix();
         GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);
         GL11.glPopMatrix();
     }
     @Override
     public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) 
     {
    	 	 TileEntityCutter cutter;
    	 	 int nTex = 0;
    	 	 if(te.hasWorldObj())
    	 		 cutter = (TileEntityCutter)te;
    	 	 else
    	 		 cutter = null;
             GL11.glPushMatrix();
             GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
             if(cutter != null && cutter.isIdle())
             {
            	 this.bindTexture(idle);
            	 nTex = Minecraft.getMinecraft().renderEngine.getTexture(idle).getGlTextureId();
             }
             else if(cutter != null && !cutter.isIdle() && !cutter.isFinished())
             {
            	 this.bindTexture(active);
            	 nTex = Minecraft.getMinecraft().renderEngine.getTexture(active).getGlTextureId();
             }
             else if(cutter != null && cutter.isFinished())
             {
            	 this.bindTexture(completed);
            	 nTex = Minecraft.getMinecraft().renderEngine.getTexture(completed).getGlTextureId();
             }
             GL11.glPushMatrix();
             GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
             GL11.glBindTexture(GL11.GL_TEXTURE_2D, nTex);
             this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
             GL11.glPopMatrix();
             GL11.glPopMatrix();
     }     
     private void adjustLightFixture(World world, int i, int j, int k, Block block) 
     {
             Tessellator tess = Tessellator.instance;
             float brightness = block.getLightValue(world, i, j, k);
             int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
             int modulousModifier = skyLight % 65536;
             int divModifier = skyLight / 65536;
             tess.setColorOpaque_F(brightness, brightness, brightness);
             OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit,  (float) modulousModifier,  divModifier);
     }
}

 

The Error:

at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:148) ~[TileEntityRendererDispatcher.class:?]
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:126) ~[TileEntityRendererDispatcher.class:?]
at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:544) ~[RenderGlobal.class:?]
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1295) ~[EntityRenderer.class:?]
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1098) ~[EntityRenderer.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1024) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:912) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_67]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
Caused by: java.lang.NullPointerException
at com.SlothBear.SocketingCrystals.Blocks.TileEntities.GemCutterRender.renderTileEntityAt(GemCutterRender.java:64) ~[GemCutterRender.class:?]
at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:141) ~[TileEntityRendererDispatcher.class:?]

Hi

 

            this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

 

this.model is null because you have misnamed your GemCutterRender constructor and it has created a default constructor with nothing in it...

 

-TGG

  • Author

Again thanks for the help (i knew i was being an idiot) :)

Happy New Year to you Sir.

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.