diff --git a/ee3_common/com/pahimar/ee3/client/model/ModelAludel.java b/ee3_common/com/pahimar/ee3/client/model/ModelAludel.java index 08c8819f..b75d3fd8 100644 --- a/ee3_common/com/pahimar/ee3/client/model/ModelAludel.java +++ b/ee3_common/com/pahimar/ee3/client/model/ModelAludel.java @@ -1,7 +1,6 @@ package com.pahimar.ee3.client.model; import net.minecraft.client.model.ModelBase; -import net.minecraftforge.client.model.ICustomModel; import net.minecraftforge.client.model.obj.WavefrontObject; import net.minecraftforge.common.ForgeDirection; @@ -25,18 +24,19 @@ import cpw.mods.fml.relauncher.SideOnly; * */ @SideOnly(Side.CLIENT) -public class ModelAludel extends ModelBase implements ICustomModel { +public class ModelAludel extends ModelBase { - private WavefrontObject modelAludelOBJ; + private WavefrontObject modelAludelObj; public ModelAludel() { - modelAludelOBJ = new WavefrontObject(Models.ALUDEL); + modelAludelObj = new WavefrontObject(Models.ALUDEL); + modelAludelObj.load(); } public void render() { - modelAludelOBJ.renderAll(); + modelAludelObj.renderAll(); } public void render(TileAludel aludel, double x, double y, double z) { diff --git a/ee3_common/com/pahimar/ee3/client/model/ModelCalcinator.java b/ee3_common/com/pahimar/ee3/client/model/ModelCalcinator.java index 09566aa4..9cf1407f 100644 --- a/ee3_common/com/pahimar/ee3/client/model/ModelCalcinator.java +++ b/ee3_common/com/pahimar/ee3/client/model/ModelCalcinator.java @@ -1,7 +1,6 @@ package com.pahimar.ee3.client.model; import net.minecraft.client.model.ModelBase; -import net.minecraftforge.client.model.ICustomModel; import net.minecraftforge.client.model.obj.WavefrontObject; import org.lwjgl.opengl.GL11; @@ -24,18 +23,19 @@ import cpw.mods.fml.relauncher.SideOnly; * */ @SideOnly(Side.CLIENT) -public class ModelCalcinator extends ModelBase implements ICustomModel { +public class ModelCalcinator extends ModelBase { - private WavefrontObject modelCalcinatorOBJ; + private WavefrontObject modelCalcinatorObj; public ModelCalcinator() { - modelCalcinatorOBJ = new WavefrontObject(Models.CALCINATOR); + modelCalcinatorObj = new WavefrontObject(Models.CALCINATOR); + modelCalcinatorObj.load(); } public void render() { - modelCalcinatorOBJ.renderAll(); + modelCalcinatorObj.renderAll(); } public void render(TileCalcinator calcinator, double x, double y, double z) { diff --git a/ee3_common/net/minecraftforge/client/model/ICustomModel.java b/ee3_common/net/minecraftforge/client/model/ICustomModel.java deleted file mode 100644 index 205d43a7..00000000 --- a/ee3_common/net/minecraftforge/client/model/ICustomModel.java +++ /dev/null @@ -1,8 +0,0 @@ -package net.minecraftforge.client.model; - - -public interface ICustomModel { - - public abstract void render(); - -} diff --git a/ee3_common/net/minecraftforge/client/model/IModelCustom.java b/ee3_common/net/minecraftforge/client/model/IModelCustom.java new file mode 100644 index 00000000..40a51912 --- /dev/null +++ b/ee3_common/net/minecraftforge/client/model/IModelCustom.java @@ -0,0 +1,13 @@ +package net.minecraftforge.client.model; + + + +public interface IModelCustom { + + public abstract void load(String fileName); + + public abstract void renderAll(); + + public abstract void renderPart(String partName); + +} diff --git a/ee3_common/net/minecraftforge/client/model/obj/WavefrontObject.java b/ee3_common/net/minecraftforge/client/model/obj/WavefrontObject.java index 09d56f58..a8e30fb3 100644 --- a/ee3_common/net/minecraftforge/client/model/obj/WavefrontObject.java +++ b/ee3_common/net/minecraftforge/client/model/obj/WavefrontObject.java @@ -11,6 +11,7 @@ import java.util.regex.Pattern; import java.util.zip.DataFormatException; import net.minecraft.client.renderer.Tessellator; +import net.minecraftforge.client.model.IModelCustom; import org.lwjgl.opengl.GL11; @@ -22,7 +23,7 @@ import cpw.mods.fml.relauncher.SideOnly; * Based heavily off of the specifications found at http://en.wikipedia.org/wiki/Wavefront_.obj_file */ @SideOnly(Side.CLIENT) -public class WavefrontObject +public class WavefrontObject implements IModelCustom { private static Pattern vertexPattern = Pattern.compile("(v( (\\-){0,1}\\d+\\.\\d+){3,4} *\\n)|(v( (\\-){0,1}\\d+\\.\\d+){3,4} *$)"); @@ -51,21 +52,31 @@ public class WavefrontObject try { - parseObjModel(this.getClass().getResource(fileName)); + loadObjModel(this.getClass().getResource(fileName)); } catch (DataFormatException e) { e.printStackTrace(); } } - - public WavefrontObject(URL fileURL) + + public void load(String fileName) { - this.fileName = fileURL.getFile(); - try { - parseObjModel(fileURL); + loadObjModel(this.getClass().getResource(fileName)); + } + catch (DataFormatException e) + { + e.printStackTrace(); + } + } + + public void load() + { + try + { + loadObjModel(this.getClass().getResource(fileName)); } catch (DataFormatException e) { @@ -73,7 +84,7 @@ public class WavefrontObject } } - private void parseObjModel(URL fileURL) throws DataFormatException + private void loadObjModel(URL fileURL) throws DataFormatException { BufferedReader reader = null; InputStream inputStream = null; @@ -212,6 +223,17 @@ public class WavefrontObject } } } + + public void renderPart(String partName) + { + for (GroupObject groupObject : groupObjects) + { + if (partName.equalsIgnoreCase(groupObject.name)) + { + groupObject.render(); + } + } + } public void renderAllExcept(String... excludedGroupNames) {