Posted April 19, 201510 yr I started a thread asking how to use an .obj model for a block. It didn't get any replies, so I tryed to code it myself. Using this tutorial as a reference: https://emxtutorials.wordpress.com/using-wavefront-obj-models-for-blocks/ It didn't render, leaving the only a blank spot in the world to indicate that it was even there: I can't break it, there is no wire-frame thingy. There is probably something I'm doing wrong, I wouldn't know. No one gave me any guidelines. Honestly when I tested it, I expected it to crash. Here's my code: The Block: public class LuminaOrb extends BlockContainer{ public LuminaOrb(Material material) { super(material); this.setBlockName("luminaOrb"); this.setCreativeTab(CreativeTabs.tabMisc); } @Override public TileEntity createNewTileEntity(World world, int par2) { return new TileEntityLuminaOrb(); } } The TileEntity: public class TileEntityLuminaOrb extends TileEntity { public float rotation = 0; @Override public void updateEntity(){ if (worldObj.isRemote) rotation += 0.5; } The TileEntitySpecialRenderer: public class LuminaOrbRenderer extends TileEntitySpecialRenderer { @Override public void renderTileEntityAt(TileEntity te, double posX, double posY, double posZ, float timeSinceLastTick) { ResourceLocation texture = new ResourceLocation(Lumina.MODID, "models/LuminaOrbTexture"); ResourceLocation objModelLocation = new ResourceLocation(Lumina.MODID, "models/LuminaOrb"); TileEntityLuminaOrb orb = (TileEntityLuminaOrb) te; float scale = 1F; float rotation = orb.rotation + (timeSinceLastTick / 2F); bindTexture(texture); IModelCustom model = AdvancedModelLoader.loadModel(objModelLocation); GL11.glPushMatrix(); GL11.glScalef(scale, scale, scale); GL11.glRotatef(rotation, 0F, 1F, 0.5F); model.renderAll(); GL11.glPopMatrix(); } } My ClientProxy: public class ClientProxy extends CommonProxy { public static void registerRenderers(){ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLuminaOrb.class, new LuminaOrbRenderer()); } } If you need more code just ask!
April 19, 201510 yr All custom rendered blocks must have these methods (techne model or obj, doesn't matter) (in block class): renderAsNormalBlock - return false; getRenderType - return -1; isOpaqueCube - return false; Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
April 19, 201510 yr Now to model rendering: Wait, no, you're destroying 25 fps!!!! Correct this right now!!! Make resource locations - fields in class and define them in constructor, like that, no need to reload them 120 times / second... ( i mean that each time you do new resourceLocation, it loads it from drive) Do same thing with model... Now to model: Do you think that creating new model loader will render it? no So - just call: model.renderAll, to render all... Seriously, couldn't you just look in ICustomModel Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
April 19, 201510 yr So, like this? public class LuminaOrbRenderer extends TileEntitySpecialRenderer { ResourceLocation texture = new ResourceLocation(Lumina.MODID, "models/LuminaOrbTexture"); ResourceLocation objModelLocation = new ResourceLocation(Lumina.MODID, "models/LuminaOrb"); IModelCustom model = AdvancedModelLoader.loadModel(objModelLocation); @Override public void renderTileEntityAt(TileEntity te, double posX, double posY, double posZ, float timeSinceLastTick) { TileEntityLuminaOrb orb = (TileEntityLuminaOrb) te; float scale = 1F; float rotation = orb.rotation + (timeSinceLastTick / 2F); bindTexture(texture); GL11.glPushMatrix(); GL11.glScalef(scale, scale, scale); GL11.glRotatef(rotation, 0F, 1F, 0.5F); model.renderAll(); GL11.glPopMatrix(); } }
April 19, 201510 yr Sorry, but do you now what constructor is??? This will also work, but better go like this: public class TERenderer { private ResourceLocation loc; public TERenderer(){ loc = new ResourceLocation(Constructor.MODID, "this is constructor"); } Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
April 19, 201510 yr Oh, I see what you mean now. Yes I know what a constructor is, I just misunderstood I guess. Ok, so you mean like this? public class LuminaOrbRenderer extends TileEntitySpecialRenderer { ResourceLocation texture; ResourceLocation objModelLocation; IModelCustom model; public LuminaOrbRenderer(){ texture = new ResourceLocation(Lumina.MODID, "models/LuminaOrbTexture"); objModelLocation = new ResourceLocation(Lumina.MODID, "models/LuminaOrb"); model = AdvancedModelLoader.loadModel(objModelLocation); } @Override public void renderTileEntityAt(TileEntity te, double posX, double posY, double posZ, float timeSinceLastTick) { TileEntityLuminaOrb orb = (TileEntityLuminaOrb) te; float scale = 1F; float rotation = orb.rotation + (timeSinceLastTick / 2F); bindTexture(texture); GL11.glPushMatrix(); GL11.glScalef(scale, scale, scale); GL11.glRotatef(rotation, 0F, 1F, 0.5F); model.renderAll(); GL11.glPopMatrix(); } }
April 19, 201510 yr Yes. Try it. , also i think that texture bind happens inside push/pop, outside will work too... Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
April 19, 201510 yr There's a crash now: java.lang.IllegalArgumentException: The resource name is not valid at net.minecraftforge.client.model.AdvancedModelLoader.loadModel(AdvancedModelLoader.java:55) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?] at awesomespider.lumina.Blocks.LuminaOrbRenderer.<init>(LuminaOrbRenderer.java:22) ~[Lumina/:?] at awesomespider.lumina.ClientProxy.registerRenderers(ClientProxy.java:12) ~[Lumina/:?] at awesomespider.lumina.Lumina.init(Lumina.java:56) ~[Lumina/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_11] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_11] at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_11] at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_11] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_11] at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_11] at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?] at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?] at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_11] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_11] at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_11] at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?] at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?] at cpw.mods.fml.common.Loader.initializeMods(Loader.java:691) [Loader.class:?] at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:586) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:931) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_11] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_11] at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_11] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?] at GradleStart.main(Unknown Source) [start/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_11] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_11] at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_11] at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140) [idea_rt.jar:?] [15:10:26] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ---- // Don't be sad, have a hug! <3 Time: 4/19/15 3:10 PM Description: Initializing game java.lang.IllegalArgumentException: The resource name is not valid at net.minecraftforge.client.model.AdvancedModelLoader.loadModel(AdvancedModelLoader.java:55) at awesomespider.lumina.Blocks.LuminaOrbRenderer.<init>(LuminaOrbRenderer.java:22) at awesomespider.lumina.ClientProxy.registerRenderers(ClientProxy.java:12) at awesomespider.lumina.Lumina.init(Lumina.java:56) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:691) at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288) at net.minecraft.client.Minecraft.startGame(Minecraft.java:586) at net.minecraft.client.Minecraft.run(Minecraft.java:931) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraftforge.client.model.AdvancedModelLoader.loadModel(AdvancedModelLoader.java:55) at awesomespider.lumina.Blocks.LuminaOrbRenderer.<init>(LuminaOrbRenderer.java:22) at awesomespider.lumina.ClientProxy.registerRenderers(ClientProxy.java:12) at awesomespider.lumina.Lumina.init(Lumina.java:56) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:691) at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288) at net.minecraft.client.Minecraft.startGame(Minecraft.java:586) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:931) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 8.1 (x86) version 6.3 Java Version: 1.8.0_11, Oracle Corporation Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation Memory: 766209208 bytes (730 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.05 FML v7.10.85.1291 Minecraft Forge 10.13.2.1291 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized FML{7.10.85.1291} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized->Initialized Forge{10.13.2.1291} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized->Initialized lumina{0.0.1} [lumina] (Lumina) Unloaded->Constructed->Pre-initialized->Errored Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: Intel(R) HD Graphics GL version 4.0.0 - Build 10.18.10.3349, Intel GL Caps: Using GL 1.3 multitexturing. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Anisotropic filtering is supported and maximum anisotropy is 16. Shaders are available because OpenGL 2.1 is supported. Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: English (US) Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Anisotropic Filtering: Off (1) [15:10:26] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:398]: #@!@# Game crashed! Crash report saved to: #@!@# D:\NewMods\Lumina\eclipse\.\crash-reports\crash-2015-04-19_15.10.26-client.txt AL lib: (EE) alc_cleanup: 1 device not closed Java HotSpot(TM) Client VM warning: Using incremental CMS is deprecated and will likely be removed in a future release Process finished with exit code -1 It says resource name invalid or something.
April 20, 201510 yr Ok, now, antoher thing that i forgot about resource locations: you need to precise file extension in the end of name, or it will not be found... Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
April 20, 201510 yr Still invisible, but now the block below it is dark: 1) try to fly around and look in different angles from ddieffernt distance. Place block in midair... 2) Your final relevant code, if you can... Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
April 20, 201510 yr 1) Nope. I have now tried flying at different angles. All sides are invisible. 2) Here's my new code: Renderer: public class LuminaOrbRenderer extends TileEntitySpecialRenderer { ResourceLocation texture; ResourceLocation objModelLocation; IModelCustom model; public LuminaOrbRenderer(){ texture = new ResourceLocation(Lumina.MODID, "models/LuminaOrbTexture.png"); objModelLocation = new ResourceLocation(Lumina.MODID, "models/LuminaOrb.obj"); model = AdvancedModelLoader.loadModel(objModelLocation); } @Override public void renderTileEntityAt(TileEntity te, double posX, double posY, double posZ, float timeSinceLastTick) { TileEntityLuminaOrb orb = (TileEntityLuminaOrb) te; float scale = 1F; float rotation = orb.rotation + (timeSinceLastTick / 2F); bindTexture(texture); GL11.glPushMatrix(); GL11.glScalef(scale, scale, scale); GL11.glRotatef(rotation, 0F, 1F, 0.5F); model.renderAll(); GL11.glPopMatrix(); } } Tile Entity: public class TileEntityLuminaOrb extends TileEntity { public float rotation = 0; @Override public void updateEntity(){ if (worldObj.isRemote) rotation += 0.5; } } Block: public class LuminaOrb extends BlockContainer{ public LuminaOrb(Material material) { super(material); this.setBlockName("luminaOrb"); this.setCreativeTab(CreativeTabs.tabMisc); } @Override public boolean renderAsNormalBlock(){ return false; } @Override public int getRenderType(){ return -1; } @Override public boolean isOpaqueCube(){ return false; } @Override public TileEntity createNewTileEntity(World world, int par2) { return new TileEntityLuminaOrb(); } } ClientProxy (Where I register the renderer): public class ClientProxy extends CommonProxy { public static void registerRenderers(){ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLuminaOrb.class, new LuminaOrbRenderer()); } } Main class (calls registerRenderers()): @EventHandler public void init(FMLInitializationEvent event) { log.info(LOGPREFIX + " " + LangUtil.tranlate("log.init.text")); ClientProxy.registerRenderers(); GameRegistry.registerBlock(luminaOrb, "luminaOrb"); } If you need more code just ask.
April 20, 201510 yr 1) Nope. I have now tried flying at different angles. All sides are invisible. 2) Here's my new code: Renderer: public class LuminaOrbRenderer extends TileEntitySpecialRenderer { ResourceLocation texture; ResourceLocation objModelLocation; IModelCustom model; public LuminaOrbRenderer(){ texture = new ResourceLocation(Lumina.MODID, "models/LuminaOrbTexture.png"); objModelLocation = new ResourceLocation(Lumina.MODID, "models/LuminaOrb.obj"); model = AdvancedModelLoader.loadModel(objModelLocation); } @Override public void renderTileEntityAt(TileEntity te, double posX, double posY, double posZ, float timeSinceLastTick) { TileEntityLuminaOrb orb = (TileEntityLuminaOrb) te; float scale = 1F; float rotation = orb.rotation + (timeSinceLastTick / 2F); bindTexture(texture); GL11.glPushMatrix(); GL11.glScalef(scale, scale, scale); GL11.glRotatef(rotation, 0F, 1F, 0.5F); model.renderAll(); GL11.glPopMatrix(); } } Tile Entity: public class TileEntityLuminaOrb extends TileEntity { public float rotation = 0; @Override public void updateEntity(){ if (worldObj.isRemote) rotation += 0.5; } } Block: public class LuminaOrb extends BlockContainer{ public LuminaOrb(Material material) { super(material); this.setBlockName("luminaOrb"); this.setCreativeTab(CreativeTabs.tabMisc); } @Override public boolean renderAsNormalBlock(){ return false; } @Override public int getRenderType(){ return -1; } @Override public boolean isOpaqueCube(){ return false; } @Override public TileEntity createNewTileEntity(World world, int par2) { return new TileEntityLuminaOrb(); } } ClientProxy (Where I register the renderer): public class ClientProxy extends CommonProxy { public static void registerRenderers(){ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLuminaOrb.class, new LuminaOrbRenderer()); } } Main class (calls registerRenderers()): @EventHandler public void init(FMLInitializationEvent event) { log.info(LOGPREFIX + " " + LangUtil.tranlate("log.init.text")); ClientProxy.registerRenderers(); GameRegistry.registerBlock(luminaOrb, "luminaOrb"); } If you need more code just ask. Hmm... I think... What will be easier for you: send me obj model or zipped src folder... or significant advancements has github repository??? Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
April 20, 201510 yr Well, at the moment I'm not working on Significant Advancements, but the mod I am working on (Lumina) has a GitHub repository yes. Here it is: https://github.com/AwesomeSpider/Lumina If you need anything else just ask.
April 21, 201510 yr Well, at the moment I'm not working on Significant Advancements, but the mod I am working on (Lumina) has a GitHub repository yes. Here it is: https://github.com/AwesomeSpider/Lumina If you need anything else just ask. Okay, i downloaded project and started debugging... 1) Proxys problems...: 1. never do static method in proxys, always not static. And call them not from main method like ClientProxy.rr, because it will crash on server. Proxy anotation is made for it: you call proxy.rr and method will be called on good proxy (client-client, server-server), that's why you have client proxy extending server proxy (you have it! but not non static methods) 2) Material.air: Go look in WorldRenderer.class, and you will see that blocks with air material are not rendered at all. So why it wasn't rendering??? 3) I had to GL11.glScaled(0.05, 0.05, 0.05); in order to fit in render zone. Why this happens: a) too big model (remember: 1 meter in blender = 1 block) b) that's normal... Now it's rendered more or less correctly. Do you want me to fork on github, or send you modified src??? Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
April 21, 201510 yr I think I can fix it myself. If I can't you can fork the repository. Okay, i'll fork it (because i made some more changes, that i forgot to mention, like not registered tile entity, not made item renderer...) Edit: nope, forking isn't what i want. And i think i can't contribute to it too... (i'm not familliar with github). So tell my if you will still need working version... Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
April 21, 201510 yr Ok, using what you said, I sort of fixed it: But as you can see it has no texture. It also follows my screen which is extremely weird. Here's the new code: The Renderer: public class LuminaOrbRenderer extends TileEntitySpecialRenderer { ResourceLocation texture; ResourceLocation objModelLocation; IModelCustom model; public LuminaOrbRenderer(){ texture = new ResourceLocation(Lumina.MODID, "models/LuminaOrbTexture.png"); objModelLocation = new ResourceLocation(Lumina.MODID, "models/LuminaOrb.obj"); model = AdvancedModelLoader.loadModel(objModelLocation); } @Override public void renderTileEntityAt(TileEntity te, double posX, double posY, double posZ, float timeSinceLastTick) { TileEntityLuminaOrb orb = (TileEntityLuminaOrb) te; float scale = 0.05F; float rotation = orb.rotation + (timeSinceLastTick / 2F); bindTexture(texture); GL11.glPushMatrix(); GL11.glScalef(scale, scale, scale); GL11.glRotatef(rotation, 0F, 1F, 0.5F); model.renderAll(); GL11.glPopMatrix(); } } ClientProxy: public class ClientProxy extends CommonProxy { public void registerRenderers(){ GameRegistry.registerTileEntity(TileEntityLuminaOrb.class, "tileLuminaOrb"); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLuminaOrb.class, new LuminaOrbRenderer()); } } Main class: @Mod(modid = Lumina.MODID, version = Lumina.VERSION) public class Lumina { public static final String MODID = "lumina"; public static final String VERSION = "0.0.1"; public static final String LOGPREFIX = "[Lumina]"; @SidedProxy(clientSide = "awesomespider.lumina.ClientProxy", serverSide = "awesomespider.lumina.CommonProxy") public static CommonProxy proxy; public static Logger log; public static File dataFolder; public static File configFile; public static BlockContainer luminaOrb; @EventHandler public void preinit(FMLPreInitializationEvent event) { log = event.getModLog(); log.info(LOGPREFIX + " " + LangUtil.tranlate("log.preinit.text")); dataFolder = event.getModConfigurationDirectory(); configFile = event.getSuggestedConfigurationFile(); try { ConfigUtil.initialize(); } catch (IOException e) { e.printStackTrace(); } //Initialize Blocks luminaOrb = new LuminaOrb(Material.rock); } @EventHandler public void init(FMLInitializationEvent event) { log.info(LOGPREFIX + " " + LangUtil.tranlate("log.init.text")); proxy.registerRenderers(); GameRegistry.registerBlock(luminaOrb, "luminaOrb"); } @EventHandler public void postinit(FMLPostInitializationEvent event) { log.info(LOGPREFIX + " " + LangUtil.tranlate("log.postinit.text")); } } Oh and by the way, I'm not very experienced with GitHub either, but I think it's a pull request you want.
April 21, 201510 yr I was able to make it smaller (what I want), but it still follows my screen: [/img] [/img] And the texture is still not working.
April 21, 201510 yr I was able to make it smaller (what I want), but it still follows my screen: [/img] [/img] And the texture is still not working. Hint: when modding/debugging , look in console, because some times there are some usefull stuff... Like FileNotFoundException... Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
April 21, 201510 yr Well, I fixed the texture, it was named lightOrbTexture.png instead of luminaOrbTexture.png. But it still follows my mouse. What would cause this? Here's the code I changed: Renderer: public class LuminaOrbRenderer extends TileEntitySpecialRenderer { ResourceLocation texture; ResourceLocation objModelLocation; IModelCustom model; public LuminaOrbRenderer(){ texture = new ResourceLocation(Lumina.MODID, "models/LuminaOrbTexture.png"); objModelLocation = new ResourceLocation(Lumina.MODID, "models/LuminaOrb.obj"); model = AdvancedModelLoader.loadModel(objModelLocation); } @Override public void renderTileEntityAt(TileEntity te, double posX, double posY, double posZ, float timeSinceLastTick) { TileEntityLuminaOrb orb = (TileEntityLuminaOrb) te; float scale = 0.02F; float rotation = orb.rotation + (timeSinceLastTick / 2F); bindTexture(texture); GL11.glPushMatrix(); GL11.glScalef(scale, scale, scale); GL11.glTranslatef((float) posX, (float) posY, (float) posZ); GL11.glRotatef(rotation, 0F, 1F, 0.5F); model.renderAll(); GL11.glPopMatrix(); } }
April 22, 201510 yr Well, I fixed the texture, it was named lightOrbTexture.png instead of luminaOrbTexture.png. But it still follows my mouse. What would cause this? Here's the code I changed: Renderer: public class LuminaOrbRenderer extends TileEntitySpecialRenderer { ResourceLocation texture; ResourceLocation objModelLocation; IModelCustom model; public LuminaOrbRenderer(){ texture = new ResourceLocation(Lumina.MODID, "models/LuminaOrbTexture.png"); objModelLocation = new ResourceLocation(Lumina.MODID, "models/LuminaOrb.obj"); model = AdvancedModelLoader.loadModel(objModelLocation); } @Override public void renderTileEntityAt(TileEntity te, double posX, double posY, double posZ, float timeSinceLastTick) { TileEntityLuminaOrb orb = (TileEntityLuminaOrb) te; float scale = 0.02F; float rotation = orb.rotation + (timeSinceLastTick / 2F); bindTexture(texture); GL11.glPushMatrix(); GL11.glScalef(scale, scale, scale); GL11.glTranslatef((float) posX, (float) posY, (float) posZ); GL11.glRotatef(rotation, 0F, 1F, 0.5F); model.renderAll(); GL11.glPopMatrix(); } } Well, this is the one problem that i couldn't debug... How ever other models are working for me in another mod... Try to change orb to cube model and see if it changes... If not - i did what i could, sorry... Try to google then... Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
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.