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

So I've been coding more... Now I want to create a multiblox. Basically like immersive egineerings crusher. I want to do something like that, but its the 1.7 version. Most of the code work but... for some reason I cant get my Tile Render working... the one that has the obj file reference thingy....

 

IES Tile render:

package blusunrize.immersiveengineering.client.render;

import net.minecraft.client.renderer.Tessellator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.model.obj.Vertex;

import org.lwjgl.opengl.GL11;

import blusunrize.immersiveengineering.client.ClientUtils;
import blusunrize.immersiveengineering.client.models.ModelIEObj;
import blusunrize.immersiveengineering.common.IEContent;
import blusunrize.immersiveengineering.common.blocks.metal.BlockMetalMultiblocks;
import blusunrize.immersiveengineering.common.blocks.metal.TileEntityCrusher;
import blusunrize.immersiveengineering.common.util.chickenbones.Matrix4;

public class TileRenderCrusher extends TileRenderIE
{
ModelIEObj model = new ModelIEObj("immersiveengineering:models/crusher.obj")
{
	@Override
	public IIcon getBlockIcon(String groupName)
	{
		return IEContent.blockMetalMultiblocks.getIcon(0, BlockMetalMultiblocks.META_crusher);
	}
};

@Override
public void renderStatic(TileEntity tile, Tessellator tes, Matrix4 translationMatrix, Matrix4 rotationMatrix)
{
	TileEntityCrusher crusher = (TileEntityCrusher)tile;

	translationMatrix.translate(.5, 1.5, .5);
	rotationMatrix.rotate(Math.toRadians(crusher.facing==2?180: crusher.facing==4?-90: crusher.facing==5?90: 0), 0,1,0);
	if(crusher.mirrored)
		translationMatrix.scale(new Vertex(crusher.facing<4?-1:1,1,crusher.facing>3?-1:1));

	model.render(tile, tes, translationMatrix, rotationMatrix, 0, crusher.mirrored, "base");
}
@Override
public void renderDynamic(TileEntity tile, double x, double y, double z, float f)
{
	TileEntityCrusher crusher = (TileEntityCrusher)tile;
	if(!crusher.formed || crusher.pos!=17)
		return;
	GL11.glPushMatrix();

	GL11.glTranslated(x+.5, y+1.5, z+.5);
	GL11.glRotatef(crusher.facing==2?180: crusher.facing==4?-90: crusher.facing==5?90: 0, 0,1,0);

	if(crusher.mirrored)
	{
		GL11.glScalef(-1,1,1);
		GL11.glDisable(GL11.GL_CULL_FACE);
	}

	ClientUtils.bindAtlas(0);
	boolean b = crusher.hasPower&&((crusher.active&&crusher.process>0)||crusher.mobGrinding||crusher.grindingTimer>0);
	float angle = crusher.barrelRotation+(b?18*f:0);

	GL11.glTranslated(17/16f,14/16f,-8.5/16f);
	GL11.glRotatef(angle, 1,0,0);
	model.model.renderOnly("drum1");
	GL11.glRotatef(-angle, 1,0,0);
	GL11.glTranslated(0,0,17/16f);
	GL11.glRotatef(-angle, 1,0,0);
	model.model.renderOnly("drum0");

	if(crusher.mirrored)
	{
		GL11.glScalef(-1,1,1);
		GL11.glEnable(GL11.GL_CULL_FACE);
	}
	GL11.glPopMatrix();
}

}

 

ModelIEObj Code used:

package blusunrize.immersiveengineering.client.models;

import java.util.ArrayList;

import net.minecraft.client.renderer.Tessellator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.model.obj.WavefrontObject;
import blusunrize.immersiveengineering.client.ClientUtils;
import blusunrize.immersiveengineering.common.util.chickenbones.Matrix4;

public abstract class ModelIEObj
{
public static ArrayList<ModelIEObj> existingStaticRenders = new ArrayList();

public final String path;
public WavefrontObject model;
public ModelIEObj(String path)
{
	this.path = path;
	this.model = ClientUtils.getModel(path);

	existingStaticRenders.add(this);
}

public WavefrontObject rebindModel()
{
	model = ClientUtils.getModel(path);
	return model;
}

public void render(TileEntity tile, Tessellator tes, Matrix4 translationMatrix, Matrix4 rotationMatrix, int offsetLighting, boolean invertFaces, String... renderedParts)
{
	ClientUtils.renderStaticWavefrontModel(tile, model, tes, translationMatrix, rotationMatrix, offsetLighting, invertFaces, renderedParts);
}

public abstract IIcon getBlockIcon(String groupName);
}

 

Here is what I have....

Tile Render:

package com.duckcreeper.steelcraft.entity;


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

public class SCTileRender extends TileEntitySpecialRenderer 
{
ModelSCObj model = new ModelSCObj("sc:modles/crushT.obj");

@Override
public void renderTileEntityAt(TileEntity p_180535_1_, double posX,
		double posZ, double p_180535_6_, float p_180535_8_, int p_180535_9_) {
	// TODO Auto-generated method stub

}

}

But when i say

ModelSCObj model = new ModelSCObj()

the ModelSCObj is underlined saying

Cannot instantiate the type ModelSCObj

ModelSCObj:

import java.util.ArrayList;

import com.duckcreeper.steelcraft.Matrix4;

import net.minecraft.client.renderer.Tessellator;
import net.minecraft.tileentity.TileEntity;

public abstract class ModelSCObj
{
public static ArrayList<ModelSCObj> existingStaticRenders = new ArrayList();

public final String path;
public WavefrontObject model;
public ModelSCObj(String path)
{
	this.path = path;
	this.model = ClientUtils.getModel(path);

	existingStaticRenders.add(this);
}

public WavefrontObject rebindModel()
{
	model = ClientUtils.getModel(path);
	return model;
}

public void render(TileEntity tile, Tessellator tes, Matrix4 translationMatrix, Matrix4 rotationMatrix, int offsetLighting, boolean invertFaces, String... renderedParts)
{
	ClientUtils.renderStaticWavefrontModel(tile, model, tes, translationMatrix, rotationMatrix, offsetLighting, invertFaces, renderedParts);
}

public abstract IIcon getBlockIcon(String groupName);
}

 

I get errors on,

	public WavefrontObject model;

--- WavefrontObject cannot be resolved to a type ^^

	this.model = ClientUtils.getModel(path);

--- ClientUtils cannot be resolved amd for "this.model" WavefrontObject cannot be resolved to a type


public WavefrontObject rebindModel() <--- Same thing, WavefrontObject cannot be resolved to a type
{
	model = ClientUtils.getModel(path); <--- Same thing
	return model;
}

	ClientUtils.renderStaticWavefrontModel(tile, model, tes, translationMatrix, rotationMatrix, offsetLighting, invertFaces, renderedParts); 

^^^^ ClientUtils cannot be resolved ^^^^^

public abstract IIcon getBlockIcon(String groupName);

^^^^ IIcon cannot be resolved to a type ^^^^

 

I dont know what to do! I'm a fairly new coder. So any tutorials, or explanations would be nice. :D

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.