Jump to content

Recommended Posts

Posted

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!

  • 4 weeks later...
Posted

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

Posted
  On 11/28/2014 at 1:48 AM, diesieben07 said:

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.

Posted

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!

Posted
  On 11/28/2014 at 7:22 PM, Eternaldoom said:

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.

Posted

The item name for meshing it should be the registered name. For variants, you can call it whatever you want.

Check out my mod, Realms of Chaos, here.

 

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

Posted
  On 11/29/2014 at 2:27 AM, Eternaldoom said:

The item name for meshing it should be the registered name. For variants, you can call it whatever you want.

Thanks, I've solved my problem!

Maker of the Craft++ mod.

Posted

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:

 

  Reveal hidden contents

 

 

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.

Posted
  On 11/30/2014 at 8:25 PM, yarrmateys said:

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.

  • 2 weeks later...
Posted

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.

Posted
  On 12/13/2014 at 8:52 PM, cppietime said:

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/

Posted

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

Posted

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.

  • 4 weeks later...
Posted

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

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

    • Looking for the best Temu coupon code $100 off? You’re in the right place! We’ve got the ultimate deal that helps you save big on your favorite items. Our exclusive ACS670886 Temu coupon code is perfect for shoppers in the USA, Canada, and Europe. Whether you're a new or existing customer, this code ensures you get maximum benefits. By using the Temu coupon $100 off, you can unlock exciting savings on Temu’s vast collection. Don’t miss this chance to claim your Temu 100 off coupon code today! What Is The Coupon Code For Temu $100 Off? Both new and existing customers can enjoy incredible benefits with our Temu coupon $100 off on the Temu app and website. This $100 off Temu coupon ensures huge savings for everyone! ACS670886 – Get a flat $100 off on selected purchases. ACS670886 – Unlock a $100 coupon pack for multiple uses. ACS670886 – Enjoy a $100 flat discount if you're a new customer. ACS670886 – Existing customers can claim an extra $100 promo code. ACS670886 – This $100 coupon is valid for shoppers in the USA and Canada. Temu Coupon Code $100 Off For New Users In 2025 New users can maximize their savings by applying our Temu coupon $100 off on the Temu app. This Temu coupon code $100 off unlocks amazing deals for first-time shoppers. ACS670886 – Get a flat $100 discount for new users. ACS670886 – Receive a $100 coupon bundle as a welcome offer. ACS670886 – Unlock up to $100 in coupons for multiple uses. ACS670886 – Enjoy free shipping to 68 countries. ACS670886 – Get an extra 30% off on any purchase as a first-time user. How To Redeem The Temu Coupon $100 Off For New Customers? Using the Temu $100 coupon is easy! Follow these steps to redeem your Temu $100 off coupon code for new users: Sign up on the Temu app or website. Browse and add your favorite items to the cart. Enter ACS670886 at checkout. See the $100 discount applied instantly. Complete your purchase and enjoy your savings! Temu Coupon $100 Off For Existing Customers Existing customers can also benefit from our exclusive Temu $100 coupon codes for existing users. Use this Temu coupon $100 off for existing customers free shipping deal and save more! ACS670886 – Get an extra $100 discount for existing users. ACS670886 – Enjoy a $100 coupon bundle for multiple purchases. ACS670886 – Receive a free gift with express shipping across the USA/Canada. ACS670886 – Grab an extra 30% off on top of existing discounts. ACS670886 – Avail free shipping to 68 countries. How To Use The Temu Coupon Code $100 Off For Existing Customers? Redeeming your Temu coupon code $100 off as an existing user is simple. Just follow these steps: Log in to your Temu account. Select your desired products and add them to your cart. Apply ACS670886 at checkout. Your Temu coupon $100 off code will be applied automatically. Confirm your order and enjoy massive savings! Latest Temu Coupon $100 Off First Order First-time buyers get the best deals with our Temu coupon code $100 off first order. This Temu coupon code first order ensures maximum savings. ACS670886 – Flat $100 discount for the first order. ACS670886 – Special $100 Temu coupon code for new customers. ACS670886 – Get up to $100 in coupons for multiple uses. ACS670886 – Free shipping to 68 countries. ACS670886 – Extra 30% off on any first-time purchase. How To Find The Temu Coupon Code $100 Off? Finding a Temu coupon $100 off is easy! Check out the Temu coupon $100 off Reddit section or follow these tips: Subscribe to the Temu newsletter for exclusive deals. Follow Temu’s official social media pages for the latest updates. Visit trusted coupon sites for verified and working codes. Is Temu $100 Off Coupon Legit? Yes, our Temu $100 Off Coupon Legit and verified! Wondering if the Temu 100 off coupon legit? Here’s why: The ACS670886 code is officially tested and confirmed. Valid for all customers in the USA, Canada, and Europe. No expiration date—use it anytime! How Does Temu $100 Off Coupon Work? The Temu coupon code $100 off first-time user works instantly upon applying at checkout. Simply enter the Temu coupon codes 100 off, and the discount is automatically deducted. How To Earn Temu $100 Coupons As A New Customer? To earn a Temu coupon code $100 off, sign up on Temu, make your first purchase, and refer friends. This 100 off Temu coupon code can be unlocked through special promotions. What Are The Advantages Of Using The Temu Coupon $100 Off? $100 discount on the first order $100 coupon bundle for multiple uses 70% discount on popular items Extra 30% off for existing customers Up to 90% off on selected products Free gifts for new users Free delivery to 68 countries Temu $100 Discount Code And Free Gift For New And Existing Customers Enjoy the Temu $100 off coupon code and get amazing benefits! Our $100 off Temu coupon code ensures huge savings. ACS670886 – $100 discount for the first order. ACS670886 – Extra 30% off on any item. ACS670886 – Free gift for new Temu users. ACS670886 – Up to 70% discount on all Temu items. ACS670886 – Free shipping in 68 countries including the USA and UK. Final Note: Use The Latest Temu Coupon Code $100 Off Using the Temu coupon code $100 off is the smartest way to save on Temu! Don’t wait—grab your discount now. Our Temu coupon $100 off is available for all customers, ensuring maximum savings. Get yours today! FAQs Of Temu $100 Off Coupon Q: How can I get the Temu $100 off coupon? A: Use code ACS670886 at checkout to claim your $100 discount. Q: Is the Temu $100 coupon valid for existing customers? A: Yes! Existing users can also apply ACS670886 and enjoy savings. Q: Does the Temu $100 off coupon have an expiration date? A: No, ACS670886 is valid indefinitely. Q: Can I use the Temu coupon on multiple orders? A: Yes! ACS670886 allows multiple redemptions. Q: Is the Temu $100 coupon applicable worldwide? A: Yes, it’s valid in the USA, Canada, Europe, and 68 other countries.
    • I tried both Vanilla and Optfine like you said, and both gave the same result. So I believe the issue is most likely with Minecraft in general and not Forge
    • https://pastebin.com/xWy0mWXA Like I said Modded Java Edition 1.12.2 using Forge Version 14.23.5.2859 Oh yeah and Exit Code: 1  
    • I love GTA V — Minecraft feels like a kids' game to me.
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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