DuckCreeper Posted February 18, 2016 Share Posted February 18, 2016 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. Quote Link to comment Share on other sites More sharing options...
BusyBeever Posted February 18, 2016 Share Posted February 18, 2016 the ModelSCObj is underlined saying Cannot instantiate the type ModelSCObj thats because ModelSCObj is an abstract class. https://docs.oracle.com/javase/tutorial/java/IandI/abstract.html Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.