Jump to content

[Solved]Importing .obj into Minecraft and Handle it as a Placeable Block


cad435

Recommended Posts

Hello @all,

 

At first please understand i natively don't come from the modding section, but i'm a Modeller/Creater, call it what you want...

 

Yes i can code, in C++/C# (as java seems to be very similar to C# I thought that should make creating mods easier)

 

I heard about the Advanced Model Loader from MinecraftForge,so I thought "well if they implement a complete Loader, it shouldn't be that difficult"...

 

 

Well it isn't, the Fact that some Methodes/Variables are not deobfuscated ("func_1_1004p_1_") AND i don't have any experience with build a code on top of an API really keeps nagging me...

I only have written my own Standalone programms, no big Project or sth :)

 

So i wonder if some of you guys can help me with this isse, due i cant find a clear and Up-To-Date dokumentation about the things around the Advanced Model Loader and the TileEntitySpecialRender...

 

I can't even find out if i need to Draw the object myself with a Tesselator,  or just render it with <ICustomModel>.renderall();

 

So what i Have/what i understand:

Well i can add new Standard Blocks, new items, Crafting recpeices, I THINK i know how to theoretically manage this(but not how to do it praktically)

 

 

So, i think i need

 

a type of an empty block (some BlockContainer Modifikation?) or sth (eg. only the bounds, nothing in that block)

A TileEntity, that is my rendered .obj-File

a connection between the tile and the block, to place the tile inside the Blockbounds

 

 

So it would be very nice if you can correct me (if i'm wrong), give me some tipps where to start, point me to a Tutorial that is not outdatet, or incomplete, or just point out what i should know BEFORE trying this...

(I'am not Lazy and request someone coding this for me! I would really like try this myself ;))

 

cad435

 

(as i just see another forum thread about the upcoming .json block modification, no thats not really an alternative... *.obj is the goal.)

 

Link to comment
Share on other sites

May I ask for a clarification?

 

Are you saying that you would like to implement your own .obj model loader, or that you have an .obj that you'd like to use as a model for a block?

 

I ask because Forge already includes such a model loader. To answer either of the above potential questions I recommend you peek at WavefrontObject.class, and ObjModelLoader.class in the net.minecraftforge.client.model.obj package.

Link to comment
Share on other sites

Sure, i want to use the integrated ModelLoader, cause this ModelLoader is the reason why i start trying to import obj to Minecraft

 

The Question is wheather its possible and if so, HOW its possible to get a loaded .obj that you can place like a block...

 

 

I need a BlockContainer?

than i try to bind a TileEntity to that Container?

than i try to set my obj as the TileEntity?

 

thats how i get it...

But im not sure if thats right, and if its right, how to do so :'D

 

PS: i got it already loaded correctly...

 

Here are my classes (maybe it helps you saying if im completely wrong or not)

 

objloader (Mainclass): http://pastebin.com/ANRxZTk5

ComplexTileEntitySpecialRenderer (extends TileEntitySpecialRenderer): http://pastebin.com/awmM2qL6

ComplexBlock (extends BlockContainer): http://pastebin.com/zMadttiG

ComplexTileEntity (extends TileEntity): http://pastebin.com/0eFu1zHV

Link to comment
Share on other sites

EDIT: I only just saw your PS. The first thing I think you should do is move your rendering stuff to a proxy class so that it doesn't load on a dedicated server, which does not have any of the rendering functions. Minecraft.getMinecraft(), for instance, is client-side only and will crash a dedicated server. I like your gumption but I advise you to start at the beginning of the tutorials on the wiki because you're missing some very necessary boilerplate.

 

It certainly is possible! Have you perused the wiki? -> http://www.minecraftforge.net/wiki/Using_wavefront_model

 

I know you asked for an "up-to-date" tutorial but as far as I am aware the process is the same now as it was then, except you can use ISimpleBlockRenderingHandler instead of TESR.

 

I don't think you need to make a Container or a Tile Entity class if all you want is a simple block with a fancy render, because unless you tell it to the renderer doesn't care what logic the actual Block implementation has.

 

The process is basically:

 

1) Write your rendering handler that implements either ISimpleBLockRenderingHandler or TileEntitySpecialRenderer. (Unless you're doing something extra-fancy, ISBRH is just fine. You'll know if and when you need it, otherwise, just use ISRBH)

2) Register your rendering handler with RenderingRegistry.registerBlockHandler.

3) Make getRenderType method in your block class return the render ID corresponding to your rendering handler.

Link to comment
Share on other sites

haha, i just edited my classes to the post above^^

And yes i've read it, many times the last tree days...

 

ok, it seems I'm not completely wrong;

 

Rendering Handler: should be that code here: http://pastebin.com/awmM2qL6 (TESR)

Ok, second Point i don't understand, if i want a new Block, in need a new Blockclass that extends the original block.Block?

and this extension needs a "super(material)" to the block.Block class, right? So i have to write my own complete Block class, will I?

 

I Just try to register the rendering Handler, at the FMLPreinit event: "RenderingRegistry.registerBlockHandler(ComplexTileEntitySpecialRenderer());" but it won't let me (I have a TESR, need i rewrite it to a ISBR?)...

Do you have a tutorial/doc/etc to explain what "render ID" is?

Link to comment
Share on other sites

This is basic stuff dude.

 

The block and the renderer are separate and distinct classes.

 

To register the renderer, you need to do this (from my own project):

 

TileEntitySpecialRenderer render = new TESRWindvane();
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityWindvane.class, render);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(OresBase.blockvane), new ItemModelRenderer(render, new TileEntityWindvane()));

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

You're extending BlockContainer, and BlockContainer already extends Block, so that's your Block class.

 

Since you're using a TESR and not a ISBRH, you should register your renderer with ClientRegistry.bindTileEntitySpecialRenderer, as the tutorial suggests. This is typically done somewhere in the main mod file, during Init. I'm sorry if I was unclear, those directions were written under the assumption that you'd be using ISBRH.

 

You're using a TESR, so you don't need to worry about Render IDs. FYI though, A Render ID is basically a number (integer) that Minecraft uses to correlate a block with a renderer. When it comes time to render the world, the Minecraft client polls the getRenderType method on each block and calls the renderer corresponding to the number it receives. You may have noticed that (among others) there are two other accessible methods in RenderingRegistry, a registerBlockHandler that accepts an integer and a handler, and getNetAvailableRenderID. That's what these two are for.

 

TL;DR - Use ClientRegistry.bindTileEntitySpecialRenderer like the tutorial said, since you're using a TESR.

Link to comment
Share on other sites

Since you're using a TESR and not a ISBRH, you should register your renderer with ClientRegistry.bindTileEntitySpecialRenderer, as the tutorial suggests. This is typically done somewhere in the main mod file, during Init. I'm sorry if I was unclear, those directions were written under the assumption that you'd be using ISBRH.

 

*Cough* Client proxy.  *Cough*

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Dalam dunia perjudian online yang berkembang pesat, mencari platform yang dapat memberikan kemenangan maksimal dan hasil terbaik adalah impian setiap penjudi. OLXTOTO, dengan bangga, mempersembahkan dirinya sebagai jawaban atas pencarian itu. Sebagai platform terbesar untuk kemenangan maksimal dan hasil optimal, OLXTOTO telah menciptakan gelombang besar di komunitas perjudian online. Satu dari banyak keunggulan yang dimiliki OLXTOTO adalah koleksi permainan yang luas dan beragam. Dari togel hingga slot online, dari live casino hingga permainan kartu klasik, OLXTOTO memiliki sesuatu untuk setiap pemain. Dibangun dengan teknologi terkini dan dikembangkan oleh para ahli industri, setiap permainan di platform ini dirancang untuk memberikan pengalaman yang tak tertandingi bagi para penjudi. Namun, keunggulan OLXTOTO tidak hanya terletak pada variasi permainan yang mereka tawarkan. Mereka juga menonjol karena komitmen mereka terhadap keamanan dan keadilan. Dengan sistem keamanan tingkat tinggi dan proses audit yang ketat, OLXTOTO memastikan bahwa setiap putaran permainan berjalan dengan adil dan transparan. Para pemain dapat merasa aman dan yakin bahwa pengalaman berjudi mereka di OLXTOTO tidak akan terganggu oleh masalah keamanan atau keadilan. Tak hanya itu, OLXTOTO juga terkenal karena layanan pelanggan yang luar biasa. Tim dukungan mereka selalu siap sedia untuk membantu para pemain dengan segala pertanyaan atau masalah yang mereka hadapi. Dengan respon cepat dan solusi yang efisien, OLXTOTO memastikan bahwa pengalaman berjudi para pemain tetap mulus dan menyenangkan. Dengan semua fitur dan keunggulan yang ditawarkannya, tidak mengherankan bahwa OLXTOTO telah menjadi pilihan utama bagi jutaan penjudi online di seluruh dunia. Jika Anda mencari platform yang dapat memberikan kemenangan maksimal dan hasil optimal, tidak perlu mencari lebih jauh dari OLXTOTO. Bergabunglah dengan OLXTOTO hari ini dan mulailah petualangan Anda menuju kemenangan besar dan hasil terbaik!
    • Selamat datang di OLXTOTO, situs slot gacor terpanas yang sedang booming di industri perjudian online. Jika Anda mencari pengalaman bermain yang luar biasa, maka OLXTOTO adalah tempat yang tepat untuk Anda. Dapatkan sensasi tidak biasa dengan variasi slot online terlengkap dan peluang memenangkan jackpot slot maxwin yang sering. Di sini, Anda akan merasakan keseruan yang luar biasa dalam bermain judi slot. DAFTAR OLXTOTO DISINI LOGIN OLXTOTO DISINI AKUN PRO OLXTOTO DISINI   Jackpot Slot Maxwin Sering Untuk Peluang Besar Di OLXTOTO, kami tidak hanya memberikan hadiah slot biasa, tapi juga memberikan kesempatan kepada pemain untuk memenangkan jackpot slot maxwin yang sering. Dengan demikian, Anda dapat meraih keberuntungan besar dan memenangkan ribuan rupiah sebagai hadiah jackpot slot maxwin kami. Jackpot slot maxwin merupakan peluang besar bagi para pemain judi slot untuk meraih keuntungan yang lebih besar. Dalam permainan kami, Anda tidak harus terpaku pada kemenangan biasa saja. Kami hadir dengan jackpot slot maxwin yang sering, sehingga Anda memiliki peluang yang lebih besar untuk meraih kemenangan besar dengan hadiah yang menggiurkan. Dalam permainan judi slot, pengalaman bermain bukan hanya tentang keseruan dan hiburan semata. Kami memahami bahwa para pemain juga menginginkan kesempatan untuk meraih keberuntungan besar. Oleh karena itu, OLXTOTO hadir dengan jackpot slot maxwin yang sering untuk memberikan peluang besar kepada para pemain kami. Peluang Besar Menang Jackpot Slot Maxwin Peluang menang jackpot slot maxwin di OLXTOTO sangatlah besar. Anda tidak perlu khawatir tentang batasan atau pembatasan dalam meraih jackpot tersebut. Kami ingin memberikan kesempatan kepada semua pemain kami untuk merasakan sensasi menang dalam jumlah yang luar biasa. Jackpot slot maxwin kami dibuka untuk semua pemain judi slot di OLXTOTO. Anda memiliki peluang yang sama dengan pemain lainnya untuk memenangkan hadiah jackpot yang besar. Kami percaya bahwa semua orang memiliki kesempatan untuk meraih keberuntungan besar, dan itulah mengapa kami menyediakan jackpot slot maxwin yang sering untuk memenuhi harapan dan keinginan Anda.   Kesimpulan OLXTOTO adalah situs slot gacor terbaik yang memberikan pengalaman bermain judi slot online yang tak terlupakan. Dengan variasi slot online terlengkap dan peluang memenangkan jackpot slot maxwin yang sering, OLXTOTO menjadi pilihan terbaik bagi para pemain yang mencari kesenangan dan kemenangan besar dalam perjudian online. Di samping itu, OLXTOTO juga menawarkan layanan pelanggan yang ramah dan responsif, siap membantu setiap pemain dalam mengatasi masalah teknis atau pertanyaan seputar perjudian online. Kami menjaga integritas game dan memberikan lingkungan bermain yang adil serta menjalankan kebijakan perlindungan pelanggan yang cermat. Bergabunglah dengan OLXTOTO sekarang dan nikmati pengalaman bermain slot online yang luar biasa. Jadilah bagian dari komunitas perjudian yang mengagumkan ini dan raih kesempatan untuk meraih kemenangan besar. Dapatkan akses mudah dan praktis ke situs OLXTOTO dan rasakan sensasi bermain judi slot yang tak terlupakan.  
    • OLXTOTO: Platform Maxwin dan Gacor Terbesar Sepanjang Masa Di dunia perjudian online yang begitu kompetitif, mencari platform yang dapat memberikan kemenangan maksimal (Maxwin) dan hasil terbaik (Gacor) adalah prioritas bagi para penjudi yang cerdas. Dalam upaya ini, OLXTOTO telah muncul sebagai pemain kunci yang mengubah lanskap perjudian online dengan menawarkan pengalaman tanpa tandingan.     Sejak diluncurkan, OLXTOTO telah menjadi sorotan industri perjudian online. Dikenal sebagai "Platform Maxwin dan Gacor Terbesar Sepanjang Masa", OLXTOTO telah menarik perhatian pemain dari seluruh dunia dengan reputasinya yang solid dan kinerja yang luar biasa. Salah satu fitur utama yang membedakan OLXTOTO dari pesaingnya adalah komitmen mereka untuk memberikan pengalaman berjudi yang unik dan memuaskan. Dengan koleksi game yang luas dan beragam, termasuk togel, slot online, live casino, dan banyak lagi, OLXTOTO menawarkan sesuatu untuk semua orang. Dibangun dengan teknologi terkini dan didukung oleh tim ahli yang berdedikasi, platform ini memastikan bahwa setiap pengalaman berjudi di OLXTOTO tidak hanya menghibur, tetapi juga menguntungkan. Namun, keunggulan OLXTOTO tidak hanya terletak pada permainan yang mereka tawarkan. Mereka juga terkenal karena keamanan dan keadilan yang mereka berikan kepada para pemain mereka. Dengan sistem keamanan tingkat tinggi dan audit rutin yang dilakukan oleh otoritas regulasi independen, para pemain dapat yakin bahwa setiap putaran permainan di OLXTOTO adalah adil dan transparan. Tidak hanya itu, OLXTOTO juga dikenal karena layanan pelanggan yang luar biasa. Dengan tim dukungan yang ramah dan responsif, para pemain dapat yakin bahwa setiap pertanyaan atau masalah mereka akan ditangani dengan cepat dan efisien. Dengan semua fitur dan keunggulan yang ditawarkannya, tidak mengherankan bahwa OLXTOTO telah menjadi platform pilihan bagi para penjudi online yang mencari kemenangan maksimal dan hasil terbaik. Jadi, jika Anda ingin bergabung dengan jutaan pemain yang telah merasakan keajaiban OLXTOTO, jangan ragu untuk mendaftar dan mulai bermain hari ini!  
    • OLXTOTO adalah bandar slot yang terkenal dan terpercaya di Indonesia. Mereka menawarkan berbagai jenis permainan slot yang menarik dan menghibur. Dengan tampilan yang menarik dan grafis yang berkualitas tinggi, pemain akan merasa seperti berada di kasino sungguhan. OLXTOTO juga menyediakan layanan pelanggan yang ramah dan responsif, siap membantu pemain dengan segala pertanyaan atau masalah yang mereka hadapi. Daftar =  https://surkale.me/Olxtotodotcom1
    • DAFTAR & LOGIN BIGO4D   Bigo4D adalah situs slot online yang populer dan menarik perhatian banyak pemain slot di Indonesia. Dengan berbagai game slot yang unik dan menarik, Bigo4D menjadi tempat yang ideal untuk pemula dan pahlawan slot yang berpengalaman. Dalam artikel ini, kami akan membahas tentang Bigo4D sebagai situs slot terbesar dan menarik yang saat ini banyak dijajaki oleh pemain slot online.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.