Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

[Creating Mods][ModLoader] Creating a Flower! [05/08/11]


  • Please log in to reply
11 replies to this topic

#1

xxmatthewo
  • Location: Intercourse, Pennsylvania

Posted 05 August 2011 - 05:27 PM

First Tutorial, it probably sucks, but I will try my best.

In this tutorial you will creating a fancy new flower.
The first thing you new to do is make the basic structure
package net.minecraft.src;

public class mod_newflower extends BaseMod
{
	
	public mod_newflower()
	{

	}
	
	public String Version() 
	{
		return "1.7.3";
	}
}

Now you need to make the flower. The flower is a little bit different than making a flower, but is sorta the same.
Here is the block thing you place at the top
public static final BlockFlower newflower = (BlockFlower)(new BlockFlower(111, 0)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setBlockName("newflower");
Quick explanation of that:
What to change:
newflower: change to the name of your flower
111: change to any id.
What not to change:
BlockFlower: There is already a BlockFlower class, and it is not needed, unless you want to have you flower not placed on grass. I may go into some other time...

Carrying on...
Now register your block, add its name, set it's texture etc. You should know how to do this.
ModLoader.RegisterBlock(newflower);
newflower.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/moarflowers/newflower.png");
ModLoader.AddName(newflower, "New Flower");

Now you will have to generate your new flower. This is how:
First you need to import:
import java.util.Random;
Place that at the very top of your code.
Now you need to generation code:
public void GenerateSurface(World var1, Random var2, int var3, int var4) 
	{
		int var5;
		int var6;
		int var7;
		int var8;
		   for(var5 = 0; var5 < 2; ++var5) 
		   {
			  var6 = var3 + var2.nextInt(16) + 8;
			  var7 = var2.nextInt(128);
			  var8 = var4 + var2.nextInt(16) + 8;
			  (new WorldGenFlowers(mod_newflower.newflower.blockID)).generate(var1, var2, var6, var7, var8);
		   }
	}
If you don't know where to place that, look at my example down below
What you need to change is: mod_newflower.newflower to whatever you file is called then '.' your block's name.

I think that var5 < 2, if you change the 2, it changes how rare they are, but I am not sure.

This is my completed .java file:
Spoiler:

When I help you, just press the +1 button so I feel better, instead of just leaving the thread.
Posted Image

Register or log in to remove.

#2

oblivious12123
  • Location: London, UK
  • Minecraft: Sir_Porkchop

Posted 05 August 2011 - 07:31 PM

Sorry total noob here. What program do you use to do this?

Posted Image


#3

madcrazydrumma
  • Location: Dubai, United Arab Emirates
  • Minecraft: madcrazydrumma
  • Xbox:SinfulDrumma

Posted 05 August 2011 - 07:48 PM

Oblivious U can take a look at my tutorials here: http://www.minecraft...inner-advanced/

There is a section in the OP which tells you what editors u can use

Best choices are:

Windows: NotePad, Wordpad, Textpad++, Netbeans (BEST) or Eclipse (second best)

Mac: Netbeans (Best), Eclipse, Unitron (second (my choice) best) or Editrocket

#4

madcrazydrumma
  • Location: Dubai, United Arab Emirates
  • Minecraft: madcrazydrumma
  • Xbox:SinfulDrumma

Posted 05 August 2011 - 07:48 PM

Bump - For an awesome tutorial :D

#5

TheDarkside1

Posted 06 August 2011 - 02:53 AM

ive been lookin for a tut on this thanks :lol:  :D

#6

jbond98
    jbond98

    Retired Staff

  • Retired Staff
  • 1793 posts
  • Location: Weston, Florida
  • Minecraft: jbond98
  • Xbox:degel98

Posted 16 August 2011 - 12:19 PM

I can't get this to work :(

Think twice before posting... Read the forum rules!

Minecraft Discussion - Mapping/Modding - Other Platforms - Servers - Support - Show Your Creations - Off Topic


Posted Image
Check out my Minecraft Modding Tutorials!


Have any questions or just want to chat? PM me or Join the #jbondmodding channel on esper.net

This applies to asking about forum rules or for modding help.


#7

jbond98
    jbond98

    Retired Staff

  • Retired Staff
  • 1793 posts
  • Location: Weston, Florida
  • Minecraft: jbond98
  • Xbox:degel98

Posted 16 August 2011 - 12:19 PM

I get this error report:

== MCP v4.3 ==
> Recompiling client...
javac.exe -g -verbose -classpath "lib/;lib/*;jars/bin/minecraft.jar;jars/bin/jin
put.jar;jars/bin/lwjgl.jar;jars/bin/lwjgl_util.jar" -sourcepath src/minecraft -d
 bin/minecraft src/minecraft\net\minecraft\client\*.java src/minecraft\net\minec
raft\isom\*.java src/minecraft\net\minecraft\src\*.java  conf/patches/*.java fai
led.
Return code : 1

== ERRORS FOUND ==

src\minecraft\net\minecraft\src\mod_Wolfestone.java:125: GenerateSurface(net.min
ecraft.src.World,java.util.Random,int,int) is already defined in net.minecraft.s
rc.mod_Wolfestone
public void GenerateSurface(World var1, Random var2, int var3, int var4)
^

1 error
==================

> Done in 2.59 seconds
> Recompiling server...
> Done in 5.23 seconds
Press any key to continue . . .

Think twice before posting... Read the forum rules!

Minecraft Discussion - Mapping/Modding - Other Platforms - Servers - Support - Show Your Creations - Off Topic


Posted Image
Check out my Minecraft Modding Tutorials!


Have any questions or just want to chat? PM me or Join the #jbondmodding channel on esper.net

This applies to asking about forum rules or for modding help.


#8

Merk Gamer
  • Minecraft: merkgamer

Posted 02 September 2011 - 03:01 AM

I followed this to the dot but every time i destroy the flower i get a textured block stone circle thing how would i fix this

#9

Bakker
    Bakker

    Carpenter

  • Members
  • 60 posts
  • Minecraft: Skittles_11

Posted 20 October 2011 - 08:18 PM

yes same here please can someone help us

would we have to make a new BlockNewFlower and put idDrop the flower?
Posted Image

#10

riccardoNL
  • Minecraft: riccardoNL

Posted 28 October 2011 - 10:54 PM

View PostBakker, on 20 October 2011 - 08:18 PM, said:

yes same here please can someone help us

would we have to make a new BlockNewFlower and put idDrop the flower?

You ONLY have to make this mod_newflower.java file, no extra files. You just extend the excisting class file 'BlockFlower' , built in in minecraft. If you just copy the complete code, it will work. I came here to see how he did the generation :P
Posted Image

#11

havvy
    havvy

    Zombie Killer

  • Members
  • 151 posts
  • Minecraft: Havvy

Posted 29 October 2011 - 06:08 AM

public void GenerateSurface(World var1, Random var2, int var3, int var4) 
		{
		int var5;
		int var6;
		int var7;
		int var8;
		   for(var5 = 0; var5 < 2; ++var5) 
		   {
			  var6 = var3 + var2.nextInt(16) + 8;
			  var7 = var2.nextInt(128);
			  var8 = var4 + var2.nextInt(16) + 8;
			  (new WorldGenFlowers(mod_newflower.newflower.blockID)).generate(var1, var2, var6, var7, var8);
		   }
	}

Can be read as

public void GenerateSurface(World world, Random random, int chunkX, int chunkZ) 
		{
		int x, y, z;
		   for(int i = 0; i < 2; i++) 
		   {
			  x = chunkX + random.nextInt(16) + 8;
			  y = random.nextInt(128);
			  z = chunkZ + random.nextInt(16) + 8;
			  (new WorldGenFlowers(mod_newflower.newflower.blockID)).generate(world, random, x, y, z);
		   }
	}


#12

Bloodtake
  • Minecraft: bloodtake

Posted 05 January 2012 - 06:51 PM

The item that drops has a faulty texture how do I make it the one that it shows in the world?
Sssssss...