Jump to content

Help
Latest News Article

TechGuy's Modding Tutorials (22nd/May/2012)

modloader 1.2.5

2025 replies to this topic

#1

  • Location: QLD, Australia

Posted 21 January 2012 - 11:49 AM

*
POPULAR

Welcome to my tutorials!

In this thread I will be writing tutorials on how to mod utilizing ModLoader. I aim not to do the same tutorials as everyone else, but will still go over the basics for those who are just starting to mod. I also want to explain in quite great depth about what each part of the code does so that the people using these tutorials actually understand what it means, and hope that they wont just copy & paste the code I have written. I also aim to make tutorials that don't edit a single base class.


Getting Set-Up

Spoiler



The ModLoader Basics

Spoiler



The Tutorials


All tutorials updated for 1.2.5! Please let me know of any problems you encounter.


Block

Spoiler

Item

Spoiler

Textures

Spoiler

Crafting & Smelting Recipes

(Incl. Dyes)

Spoiler

Food

Spoiler

Potion Effected Food

Spoiler

Human NPC

Spoiler

Custom NPC

Spoiler


Other NPC Information

Spoiler

Advanced Blocks

Spoiler

Achievement

Spoiler

Structure Generation

Spoiler

Ore Generation

Spoiler

Other World Generation

Spoiler

Multi-Textured Blocks

Spoiler

Biome

Spoiler

Fuels

Spoiler

Adding Blocks to Creative Inventory

Spoiler

More tutorials on the post below!



List to Do, Not taking any more requests at this time:
  • Crop
  • Armour, Bow, Gun
  • Trees

Tips & Info

  • .blockID is only used for blocks.
  • .shiftedIndex is used for items only.
  • If the game crashes when starting the MCP client, and says it can't find your image, check your images location, its name and where you have told minecraft to look for it in your code.
  • Only use one mod_ class for your whole mod.

Thank-you Posted Image

  • Posted Image -Reaper- - For helping people when I'm not around.
  • Posted Image HellishINC - For letting me know of some errors so I could fix them.
  • Posted Image RainbowLuigi - For support and helping people when I'm not around
  • Posted Image KoadMaster - For heaps of support and helping people when I'm not around
  • Posted Image PhantomJedi759 - For giving great help to people when I'm not around

Banners

Spoiler



My Mods

1.SuperFoods - Adds Cocoa trees for all your cocoa bean needs, and heaps more!

2.Undead+ - Heaps of new hostiles! RandumbDude, lockNload147, MrCompost and myself are currently working very hard on this mod.



Final Notes


More to Come! Please do not troll saying "These tutorials have all been done before!". My main aim is to teach people what the code means. Most of the, so called, 'tutorials' on the forums, have no explanation whatsoever. Please remember there are people out there, who are just starting out. That's why they come here. TO LEARN. If I helped you understand something better, or think I should keep the tutorials coming, please hit that Posted Image button on the bottom right hand of this post, it helps and motivates me a lot.




If you have used someone else's tutorials and you have a problem with your code, do not ask for help here. I WILL ignore you. I will only help people who are having problems with their code from using my tutorials.


On the same note, if you are having trouble modding, don't just ask here, go and ask in the Mod Development section. As I said above, this thread is ONLY for people who are using the tutorials I have written and need some help.



How to Get Help

Spoiler

I suggest that everyone takes a look at this page, even if you aren't having trouble. It will help you a great deal.

Posted Image


Register or log in to remove.

#2

  • Location: QLD, Australia

Posted 21 January 2012 - 12:16 PM

More Tutorials


Tools

Spoiler

Posted Image


#3

  • Location: UK or Singapore
  • Minecraft: jaredjeya
  • Xbox:jaredjeya

Posted 21 January 2012 - 12:28 PM

View PostTechGuy543, on 21 January 2012 - 11:49 AM, said:

Welcome to my tutorials!

In this thread I will be writing tutorials on how to mod utilizing ModLoader. I aim not to do the same tutorials as everyone else, but will still go over the basics for those who are just starting to mod. I also want to explain in quite great depth about what each part of the code does so that the person using these tutorials actually understands what it means, and hope that they wont just copy & paste the code I have written.

More to Come! Please do not troll saying "Its just a block tutorial! Its so easy!". My main aim is to teach people what the code means. Yes, they need to know what the code is, but they should know what it means too.Please remember there are people out there, that aren't as knowledgeable as you yet. That's why they come here. TO LEARN.

If I helped you understand something better, or think I should keep the tutorials coming(More advanced ones, with explanations) please hit that Posted Image button over there ---->

Thanks, this is incredibly useful. I am glad someone is making a tutorial which isn't just 'do this and get a block'
Posted Image

#4

    jojo54

    Coal Miner

  • Members
  • 144 posts

Posted 22 January 2012 - 01:48 AM

Remember to add how to add potion effects to food c:

#5

  • Location: QLD, Australia

Posted 22 January 2012 - 05:24 AM

View Postjojo54, on 22 January 2012 - 01:48 AM, said:

Remember to add how to add potion effects to food c:

I've got that written, posting it now.

Posted Image


#6

  • Location: QLD, Australia

Posted 22 January 2012 - 12:32 PM

Added an item tutorial, with a bit of an explanation. I mainly put in what the differences were to the block, as I have explained a lot of things already in the ModLoader basics information and block tutorial. Food, Potion-affected-food, MCP and Eclipse set-up tutorials coming tomorrow.

Posted Image


#7

  • Location: Stalker?
  • Minecraft: Charuka

Posted 23 January 2012 - 12:56 AM

hi dude. I have a question. How do you add a modded item to a recipe?

Posted Image


#8

  • Location: Some Where Far Away

Posted 23 January 2012 - 02:53 AM

Hey do you or someone you know, or even a random tutorial How to make a boundry for my custom generated villages and make it so that stuff like trees, grass and other crap will not spawn there. If you know how to do this please help :( .. as my mod basically needs this to work.

#9

  • Location: QLD, Australia

Posted 23 January 2012 - 05:30 AM

View PostDoom-bob, on 23 January 2012 - 12:56 AM, said:

hi dude. I have a question. How do you add a modded item to a recipe?
I'll put up a section on recipes, and explain everything like that :)

View PostMrLimey, on 23 January 2012 - 02:53 AM, said:

Hey do you or someone you know, or even a random tutorial How to make a boundry for my custom generated villages and make it so that stuff like trees, grass and other crap will not spawn there. If you know how to do this please help :( .. as my mod basically needs this to work.

The only way I think you could do this, would be to edit the world generator class. As long as the ground is grass or dirt, you wouldn't need to worry about trees and grass. If you are doing your village in one world gen file(no components like the normal villages), then for pathways and things you would probably just need to set the blocks as air.

world.setBlockWithNotify(i, j, k, 0);
That is the code for setting a block to air if you need it.

Posted Image


#10

  • Location: Some Where Far Away

Posted 23 January 2012 - 11:41 PM

View PostTechGuy543, on 23 January 2012 - 05:30 AM, said:

I'll put up a section on recipes, and explain everything like that :)



The only way I think you could do this, would be to edit the world generator class. As long as the ground is grass or dirt, you wouldn't need to worry about trees and grass. If you are doing your village in one world gen file(no components like the normal villages), then for pathways and things you would probably just need to set the blocks as air.

world.setBlockWithNotify(i, j, k, 0);
That is the code for setting a block to air if you need it.

Alright thanks bro ima try it out! Ill link you to my mod if you want, when im done it atleast. ;)

#11

  • Location: QLD, Australia

Posted 24 January 2012 - 08:01 AM

I just re-read my post. I meant that if the ground is grass or dirt, then trees and grass and things would generate, if it isnt, then you dont need to worry about it.

Posted Image


#12

    jojo54

    Coal Miner

  • Members
  • 144 posts

Posted 24 January 2012 - 08:42 PM

Make a tutorial on how to make a new bow.

#13

  • Minecraft: Captain_Cowpig

Posted 24 January 2012 - 10:37 PM

A tutorial for MC 1.1! Awesome.
Go with what works, I guess.
Posted Image

#14

  • Location: Stalker?
  • Minecraft: Charuka

Posted 25 January 2012 - 03:06 AM

can u do a smelting tut? and like have an example with a random item?

Posted Image


#15

  • Location: QLD, Australia

Posted 25 January 2012 - 06:06 AM

View Postjojo54, on 24 January 2012 - 08:42 PM, said:

Make a tutorial on how to make a new bow.

I'll try. I've got to figure out how to make one myself first Posted Image

Added crafting and smelting recipe tutorials.

Posted Image


#16

  • Location: UK or Singapore
  • Minecraft: jaredjeya
  • Xbox:jaredjeya

Posted 25 January 2012 - 11:10 AM

I have a massive problem. Whenever I decompile MC and Modloader in MCP, and then try to test run it in eclipse (without adding any of my code), Minecraft will crash upon having a log block in your inventory (or maybe hotbar). This has happened upon launch of creative worlds (which contain logs in the hotbar, I think), and whenever punch trees. Here is the error log if anyone is interested:

Mods loaded: 1 ModLoader 1.1        Minecraft has crashed!             ----------------------        Minecraft has stopped running because it encountered a problem.  If you wish to report this, please copy this entire text and email it to support@mojang.com. Please include a description of what you did when the error occured.    --- BEGIN ERROR REPORT 9c4f49b2 -------- Generated 25/01/12 11:09  Minecraft: Minecraft 1.1 OS: Windows 7 (amd64) version 6.1 Java: 1.6.0_29, Sun Microsystems Inc. VM: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Sun Microsystems Inc. LWJGL: 2.4.2 OpenGL: Intel(R) HD Graphics Family version 3.1.0 - Build 8.15.10.2476, Intel  java.lang.NullPointerException 	at net.minecraft.src.ItemMetadata.getIconFromDamage(ItemMetadata.java:17) 	at net.minecraft.src.Item.getIconIndex(Item.java:201) 	at net.minecraft.src.ItemStack.getIconIndex(ItemStack.java:81) 	at net.minecraft.src.RenderItem.renderItemIntoGUI(RenderItem.java:229) 	at net.minecraft.src.GuiIngame.renderInventorySlot(GuiIngame.java:574) 	at net.minecraft.src.GuiIngame.renderGameOverlay(GuiIngame.java:245) 	at net.minecraft.src.EntityRenderer.updateCameraAndRender(EntityRenderer.java:761) 	at net.minecraft.src.EntityRendererProxy.updateCameraAndRender(EntityRendererProxy.java:17) 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:737) 	at net.minecraft.client.Minecraft.run(Minecraft.java:634) 	at java.lang.Thread.run(Unknown Source) --- END ERROR REPORT 75caaa72 ----------  

Posted Image

#17

  • Location: QLD, Australia

Posted 25 January 2012 - 11:34 AM

View Postjaredjeya, on 25 January 2012 - 11:10 AM, said:

I have a massive problem. Whenever I decompile MC and Modloader in MCP, and then try to test run it in eclipse (without adding any of my code), Minecraft will crash upon having a log block in your inventory (or maybe hotbar). This has happened upon launch of creative worlds (which contain logs in the hotbar, I think), and whenever punch trees. Here is the error log if anyone is interested:

Mods loaded: 1 ModLoader 1.1        Minecraft has crashed!         	----------------------        Minecraft has stopped running because it encountered a problem.  If you wish to report this, please copy this entire text and email it to support@mojang.com. Please include a description of what you did when the error occured.    --- BEGIN ERROR REPORT 9c4f49b2 -------- Generated 25/01/12 11:09  Minecraft: Minecraft 1.1 OS: Windows 7 (amd64) version 6.1 Java: 1.6.0_29, Sun Microsystems Inc. VM: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Sun Microsystems Inc. LWJGL: 2.4.2 OpenGL: Intel(R) HD Graphics Family version 3.1.0 - Build 8.15.10.2476, Intel  java.lang.NullPointerException 	at net.minecraft.src.ItemMetadata.getIconFromDamage(ItemMetadata.java:17) 	at net.minecraft.src.Item.getIconIndex(Item.java:201) 	at net.minecraft.src.ItemStack.getIconIndex(ItemStack.java:81) 	at net.minecraft.src.RenderItem.renderItemIntoGUI(RenderItem.java:229) 	at net.minecraft.src.GuiIngame.renderInventorySlot(GuiIngame.java:574) 	at net.minecraft.src.GuiIngame.renderGameOverlay(GuiIngame.java:245) 	at net.minecraft.src.EntityRenderer.updateCameraAndRender(EntityRenderer.java:761) 	at net.minecraft.src.EntityRendererProxy.updateCameraAndRender(EntityRendererProxy.java:17) 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:737) 	at net.minecraft.client.Minecraft.run(Minecraft.java:634) 	at java.lang.Thread.run(Unknown Source) --- END ERROR REPORT 75caaa72 ----------  

Try updating your jdk. I have 1.6.0_30 and it works fine. You have 1.6.0_29. There might be a bug fix in that release, I'm not sure.

Posted Image


#18

  • Location: UK or Singapore
  • Minecraft: jaredjeya
  • Xbox:jaredjeya

Posted 25 January 2012 - 01:06 PM

View PostTechGuy543, on 25 January 2012 - 11:34 AM, said:

Try updating your jdk. I have 1.6.0_30 and it works fine. You have 1.6.0_29. There might be a bug fix in that release, I'm not sure.

Thanks, I'll try it now.
Posted Image

#19

  • Location: UK or Singapore
  • Minecraft: jaredjeya
  • Xbox:jaredjeya

Posted 25 January 2012 - 01:57 PM

View Postjaredjeya, on 25 January 2012 - 01:06 PM, said:

Thanks, I'll try it now.

I installed the JRE, then the JDK, and it still says 1.6.0.29 or whatever. Do I need to upgrade Eclipse?
Posted Image

#20

  • Minecraft: secondstomarz

Posted 25 January 2012 - 02:19 PM

View PostTechGuy543, on 21 January 2012 - 11:49 AM, said:


public static final Block Namehere = new BlockName(160, 0).setBlockName("anynamehere").setHardness(3F).setResistance(4F).setLightValue(1F);


Thanks for this! :D :Diamond: :Diamond:

How do you make it only set the light value if it's being powered by redstone?

Also, what do you do with this code? I put it into eclipse, but I don't know how to export it, or if I should name it a certain thing.