Jump to content

Updating your mod to 1.8


Eternaldoom

Recommended Posts

How to update your mod to 1.8

 

Forge for Minecraft 1.8 has been released, and a few things have changed in vanilla. Updating your mod to 1.8 shouldn't be too hard though. I will go over a few major changes that affect modders and explain how to update your code. Before you update, I highly recommend going through your code and inserting @Override where you have forgotten it.

 

Blocks and Items

For simple blocks, not much has changed except that the

setBlockTextureName()

method is gone. You can delete this from your code, as well as

registerBlockIcons

. If you override methods such as

onBlockActivated()

or

onEntityCollidedWithBlock()

(anything that excepts coordinates as an argument), you need to replace the coordinates with a

BlockPos

. To change the position of the BlockPos, you can use the methods

add

(to add to or subtract from the coordinates), or the offset methods to offset the position. Also, the arguments that once were metadata are now

IBlockState

s. You can easily get an IBlockState from a metadata value with

Block.getStateFromMeta()

. Finally, the side argument (int) in many methods has been replaced with an EnumFacing value. In items, anything with coords also uses a BlockPos now, and the setTextureName method is gone.

 

Why the texture methods are gone, and how to replace them:

In 1.8, textures are set in the block/item's model file. This is a JSON file that defines the shape of the block/item, as well as its texture. For a block, you will need three files to make it load a texture: a blockstate file in assets/modid/blockstates, a block model (the name is defined in the blockstate file) in assets/modid/models/block, and an item model file in assets/models/item. The blockstate file and the item model file must be the name that the block is registered as. The block model can be called whatever you want, as long as you put the name in the blockstate file. For item models, you only need one file, an item model file. NOTE: if it seems tedious to manually create all these files (especially if your mod has a ton of blocks), you can get a tool that I wrote called ModelGenerator here. All you have to do is enter a name when prompted, and it will generate model files for you. Note that this tool may not work on windows. Another good tool (written in java), made by sheenrox82, can be found here.

 

To get the blocks/items to render in your inventory, you need to register the models with:

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(YourItem, metadata, new ModelResourceLocation("modid:items_registered_name", "inventory"));

If they are metadata items, you also need:

ModelBakery.addVariantName(yourItem, new String[]{"different", "variant", "namesOfModelFiles"});

 

Entities

Entities are mostly unchanged, but any logic that requires getting blocks will have to be updated to use BlockPos's instead of coordinates.

 

Rendering

TileEntitySpecialRenderers still exist and can be used like normal. If you have custom block models drawn with the Tessellator, it would be best to use the new JSON model files to draw your model. Have a look at the vanilla assets. Code that still uses the tesselator must be updated, as most of the Tessellator functions have been moved to WorldRenderer. Here's an example of how to update this:

Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
tess.addVertexWithUV ...
...
tess.draw();

This should be updated to:

Tessellator tess = Tessellator.getInstance();
WorldRenderer worldrenderer = tess.getWorldRenderer();
worldrenderer.addVertexWithUV ...
...
tess.draw();

 

World Generation

Because of the BlockPos changes, big worldgen classes will have tons of errors. However, these can be easily fixed by creating helper methods and using find and replace.

 

Good luck updating to 1.8! Feel free to leave questions on this thread.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Link to comment
Share on other sites

  • 4 weeks later...

Looks like there is a few changes for tile entities as well with a good bit of functions been changed into interfaces instead of being in the base class.

 

edit: And correct me if I'm wrong but it looks as if containers and GUIs have changed a bit as well...

Link to comment
Share on other sites

Look at RenderItem.registerItems. That is where Items & Blocks with subtypes are mapped to their model file. You should be able to do that in your normal init method (through your ClientProxy method of course). You get the renderer via Minecraft#getRenderItem. All the new render code is pretty complex to read, but I think that's where it happens.

Nope, that didn't help. I'm presuming you mean use the register method in the item model mesher?

In addition, no error messages are outputted to the client log.

 

for (int i = 0; i < 16; ++i)
modelMesher.register(CppItems.stained_glass_shard, i, new ModelResourceLocation(CppReferences.MODID + ":" + "stained_glass_shard_" + ItemStainedGlassShard.getColorFromMeta(i), "inventory"));

Maker of the Craft++ mod.

Link to comment
Share on other sites

Metadata item files are the same as normal ones. Register them for meshing with:

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, metadata, new ModelResourceLocation(itemName, "inventory"));

 

Then add the variants with:

ModelBakery.addVariantName(item, new String[]{"your", "different", "subitems", "here"});

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Link to comment
Share on other sites

Metadata item files are the same as normal ones. Register them for meshing with:

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, metadata, new ModelResourceLocation(itemName, "inventory"));

 

Then add the variants with:

ModelBakery.addVariantName(item, new String[]{"your", "different", "subitems", "here"});

Thanks, I just need a couple of things clarified.

Does the item name in the model mesh registration refer to the name with metadata? And the subitems are in the format "stained_glass_shard_red" right? Thanks again.

Maker of the Craft++ mod.

Link to comment
Share on other sites

is there something specific needed for entity textures?

 

i've been fighting with this for a while, but each time i attempt to spawn an entity, all i get is a crash:

 

[Client thread/ERROR]: Couldn't render entity

java.lang.NullPointerException

at net.minecraft.client.renderer.entity.Render.bindTexture(Render.java:86) ~[Render.class:?]

at net.minecraft.client.renderer.entity.Render.bindEntityTexture(Render.java:79) ~[Render.class:?]

at net.minecraft.client.renderer.entity.RendererLivingEntity.renderModel(RendererLivingEntity.java:252) ~[RendererLivingEntity.class:?]

at net.minecraft.client.renderer.entity.RendererLivingEntity.doRender(RendererLivingEntity.java:168) [RendererLivingEntity.class:?]

at net.minecraft.client.renderer.entity.RenderLiving.doRender(RenderLiving.java:50) [RenderLiving.class:?]

at net.minecraft.client.renderer.entity.RenderLiving.doRender(RenderLiving.java:172) [RenderLiving.class:?]

at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:370) [RenderManager.class:?]

at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:327) [RenderManager.class:?]

at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:294) [RenderManager.class:?]

at net.minecraft.client.renderer.RenderGlobal.func_180446_a(RenderGlobal.java:631) [RenderGlobal.class:?]

at net.minecraft.client.renderer.EntityRenderer.func_175068_a(EntityRenderer.java:1294) [EntityRenderer.class:?]

at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1207) [EntityRenderer.class:?]

at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1032) [EntityRenderer.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1048) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:345) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]

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(GradleStartCommon.java:78) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

 

 

i'm pretty sure i have the texture defined with private static final ResourceLocation and later on a ResourceLocation getEntityTexture that refers to it, but i still get that the moment the entity's spawned.

 

edit: apparently i should've waited a few more hours before posting this. i didn't initialize the rendering correctly, my old method doesn't seem to work anymore. i fixed the problem.

Link to comment
Share on other sites

edit: apparently i should've waited a few more hours before posting this. i didn't initialize the rendering correctly, my old method doesn't seem to work anymore. i fixed the problem.

 

Could you explain how you fixed your problem? I get the exact same error and it's likely I made the same mistake as you.

Thanks.

 

Edit:Fixed.

Link to comment
Share on other sites

  • 2 weeks later...

Forgive me if this is a newb question, but the getItemModelMesher().register accepts Item as its first argument, what do I do for blocks to make them render in my inventory? The block I'm talking about already has its json files set up, and renders fine in the world.

Item.getItemFromBlock(Block)

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Any guess how the change to updateEntity in TileEntity effect things? I was a little confused when i took a look at one of my tile entities and tried to fix the error with onUpdate. I had to look at TileEntityFurnace to figure out that you now need to implement IUpdatePlayerListBox (That seems like a weird name?) and implement its "update" method which seems to replace updateEntity.

 

My only guess is it is to make non-updating tileEntitys more efficient but im guessing thats not why it was changed.

I am the author of Draconic Evolution

Link to comment
Share on other sites

Also, there have been changes to item rendering. RenderItem has been changed to require a TextureManager and ModelManager argument, but you can get an instance of the RenderItem in Minecraft#getRenderItem(). It appears the rendering bit isn't deobfuscated, but RenderItem#func_175042_a(ItemStack, int, int) will draw your item. Args: item stack to draw, x coord, y coord. This also seems to draw any effects, combining the two separate methods in 1.7.

 

GuiScreens can now throw exceptions on key and mouse inputs, so those will need to be handled accordingly too.

Link to comment
Share on other sites

  • 4 weeks later...

A trap to watch out for - in 1.8, your IMessageHandler now runs in a separate thread (i.e. not in the client or server thread).  If you try to access vanilla objects in your handler, it will cause concurrency bugs (i.e. crashes, corruption and general weirdness).

 

This link talks a bit more about how to modify for 1.8

http://greyminecraftcoder.blogspot.com.au/2015/01/thread-safety-with-network-messages.html

 

-TGG

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

    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 Daftar Slot Kocok303 adalah bocoran slot rekomendasi gacor dari Kocok303 yang bisa anda temukan di SLOT Kocok303. Situs SLOT Kocok303 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Kocok303 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Kocok303 merupakan SLOT Kocok303 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Kocok303. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Kocok303 hari ini yang telah disediakan SLOT Kocok303. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Kocok303 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Kocok303 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Kocok303 di link SLOT Kocok303.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 Slot Aster88 adalah bocoran slot rekomendasi gacor dari Aster88 yang bisa anda temukan di SLOT Aster88. Situs SLOT Aster88 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Aster88 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Aster88 merupakan SLOT Aster88 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Aster88. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Aster88 hari ini yang telah disediakan SLOT Aster88. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Aster88 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Aster88 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Aster88 di link SLOT Aster88.
    • 🚀Link Daftar Klik Disini🚀 Tips Bermain Slot Bank Jago agar Meraih Maxwin dan Jackpot di MAXWINBET77 Bermain slot online Bank jago adalah cara yang seru dan mengasyikkan untuk mencari keuntungan besar di MAXWINBET77. Jika kamu ingin meningkatkan peluangmu untuk meraih maxwin dan jackpot secara terus-menerus, ada beberapa tips dan strategi yang bisa kamu terapkan. Berikut adalah panduan lengkapnya: Pilih Slot dengan RTP Tinggi: RTP (Return to Player) adalah persentase rata-rata dari total taruhan yang dikembalikan kepada pemain sebagai kemenangan. Pilihlah mesin slot Bank jago yang memiliki RTP tinggi, karena ini meningkatkan peluangmu untuk meraih kemenangan dalam jangka panjang. Kenali Fitur Bonus: Setiap slot Bank jago memiliki fitur bonus yang berbeda, seperti putaran gratis, simbol liar (wild), dan bonus game. Pelajari dengan baik fitur-fitur ini karena mereka dapat membantu meningkatkan peluang meraih kemenangan besar. Kelola Taruhan dengan Bijak: Tentukan batasan taruhan yang sesuai dengan budget dan jangan tergoda untuk bertaruh melebihi kemampuan finansialmu. Terapkan strategi taruhan yang bijak untuk memaksimalkan penggunaan saldo. Mainkan Slot Bank jago Progresif: Jika tujuanmu adalah meraih jackpot besar, coba mainkan slot Bank jago progresif di MAXWINBET77. Jackpot pada jenis slot Bank ini terus bertambah seiring dengan taruhan pemain lainnya, sehingga dapat mencapai jumlah yang sangat besar. Manfaatkan Promosi dan Bonus: MAXWINBET77 sering kali menawarkan promosi dan bonus kepada pemainnya. Manfaatkan bonus-bonus ini untuk meningkatkan peluangmu meraih kemenangan tanpa menggunakan modal tambahan. Berkonsentrasi dan Bersabar: Fokuslah saat bermain slot bank jago dan jangan terburu-buru. Bersabarlah meskipun tidak langsung mendapatkan hasil yang diharapkan. Kadang-kadang diperlukan waktu dan keberuntungan untuk mencapai maxwin atau jackpot. Baca Aturan Permainan: Sebelum bermain, pastikan untuk membaca aturan dan pembayaran pada slot Bank Jago yang dipilih. Mengetahui cara kerja mesin slot akan membantu mengoptimalkan strategi bermainmu. Dengan menerapkan tips-tips di atas dan tetap bermain secara bertanggung jawab, kamu dapat meningkatkan peluang meraih maxwin dan jackpot di Slot Bank Jago MAXWINBET77. Selamat bermain dan semoga sukses meraih kemenangan besar Anda Hari Ini.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 SLOT BCA 10K adalah bocoran slot rekomendasi gacor dari RATUASIA77 yang bisa anda temukan di SLOT BCA 10K. Situs SLOT BCA 5K hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT BSI 5K terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT BCA 10K merupakan SLOT BCA 10K hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT BSI 10K. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT BCA 10K hari ini yang telah disediakan SLOT BCA 10K. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs RATUASIA77 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT BCA 10K terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT BCA 10K di link SLOT BCA RATUASIA77.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 SLOT BSI 10K adalah bocoran slot rekomendasi gacor dari RATUASIA77 yang bisa anda temukan di SLOT BSI 10K. Situs SLOT BSI 5K hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT BSI 5K terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT BSI 10K merupakan SLOT BSI 10K hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT BSI 10K. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT BSI 10K hari ini yang telah disediakan SLOT BSI 10K. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs RATUASIA77 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT BSI 10K terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT BSI 10K di link SLOT BSI RATUASIA77.
  • Topics

×
×
  • Create New...

Important Information

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