How to Make a Void Room in Minecraft TUTORIAL

How to Make a Void Room in Minecraft

A Beginner'southward Guide to Modding Minecraft (With Java)

A quick note before we begin: as of June 2020 this guide is now over 2 years old, some changes over these last two years (including changes to Gradle) seem to have thrown some additional problems for users into the mix. Minecraft Forge for 1.seven.10 itself has not been updated since 2015. I am leaving this guide online every bit a reference for ane.7.ten'south modding community, but I cannot guarantee that things today are working the same as they did at the time of writing. You lot may discover new errors that I am unfamiliar with and I am unable to offering much support as I haven't been working with one.7.x in over a year now. If yous do come up across an error and have a solution for information technology please comment below or contact me straight and I tin update the article.

In this post I'll be explaining how to get started modding Minecraft. For the sake of this tutorial I'll be working with Minecraft one.7.ten (which I'1000 rather familiar with modding for). Ahead, we'll get the tools needed to mod Minecraft, setup a mod project, and create our own custom block: "Amethyst Ore" from which we'll be able to mine Amethyst and nosotros'll modern this block such that it generates randomly throughout the map. I'll recommend that you lot meet the following prerequisites to get the nigh out of this guide:

  • A cursory knowledge of object-oriented Java programming would be incredibly useful but isn't necessarily required. We'll be writing more than a few dozen lines of Java code across a handful of classes though and then if you have an idea of how to code information technology will make things easier.
  • An understanding of how to apply Minecraft Forge. As a requirement, you'll need to sympathise how to install Minecraft Forge and how to install mods for it, otherwise, how would y'all test your modernistic?

Want to read this story later? Save it in Journal.

Thankfully, both object-oriented Java programming and Minecraft Forge usage already have endless tutorials bachelor online, and then if you'd like to try post-obit along with this guide and refer to Google for other such tutorials if you demand some supporting information.

Allow's accept a quick overview beginning. I've broken this guide downwards into five steps, although the steps are non equal: they vary in difficulty, and they grow in size until we reach footstep 5, which is where nosotros'll really go into the "modding" office and then information technology's the biggest step past far. The steps are:

  • [Pace ane] Getting Your Tools: Java & Eclipse
  • [Footstep 2] Getting Your Tools: Forge
  • [Pace 3] Setting upwards Your Eclipse Project
  • [Step 4] Decompiling Minecraft
  • [Step 5] Modifying Minecraft

[Step i] Getting Your Tools: Java & Eclipse

Outset things first — you're going to need the Coffee Development Kit (JDK). You tin detect it on Oracle'due south website here. As Oracle puts it on their website: "The JDK is a development surroundings for building applications, applets, and components using the Coffee programming language." To explicate a bit on that, you might recall of your Minecraft mod equally a "component" in that context.

In any case, once y'all've installed the Java Evolution Kit, adjacent yous'll demand the Eclipse IDE. An "IDE" is an Integrated Development Surroundings, and at a first glance you might recollect IDE's are fancy text editors for writing code in, although they have a lot of features to assist united states with our programming across that.

In any instance, the Eclipse IDE is our go-to tool and is perhaps the nigh pop IDE for writing Coffee. Download the Eclipse installer here, and when yous get-go it up, y'all should go prompted with a window similar to this:

You'll want to select the first pick: "Eclipse IDE for Coffee Developers". For those of yous who are all-new to this: Minecraft's code is written in the Java programming language so as a result this is the programming language we'll exist working with to create mods for information technology. The Eclipse installer is quite straightforward, y'all can just follow along accepting the standard options and select "Launch" once it has completed. Finally, when the installation is over and the Eclipse Launcher starts upward it will prompt y'all to select a directory for your workspace, I'yard naming mine "MinecraftWorkspace" as you tin can meet hither:

Feel gratuitous to cheque the "Apply this as the default and do non ask once more" box if you'll simply be using Eclipse for your Minecraft modding, as y'all'll exist able to manage multiple projects in this workspace. Otherwise, click that Launch button at the bottom and nosotros're set to motion on to the next step.

[Step two] Getting Your Tools: Forge

Now we'll demand to go Minecraft Forge, in particular we'll want the 1.7.10 Minecraft Forge as we'll exist modding Minecraft 1.7.10. It'south important that the versions match up, trust me. Head hither to get the most recent version of Minecraft Forge for one.vii.x.

This is the Minecraft Forge website, you'll detect there are several downloads available. This time effectually, ignore the "Windows Installer" and download the "Src". It will be a .zip file, excerpt this and drag the resulting folder into your MinecraftWorkspace directory that we created with Eclipse in the previous footstep. Your MinecraftWorkspace directory should now expect something like this:

[Pace 3] Setting upward Your Eclipse Project

Dorsum in Eclipse, assuming you've left it running, yous should find yourself at the 'Welcome' screen. From here, simply click File -> Open Projects from File System… then navigate to your Minecraft Forge directory which y'all've simply placed in your MinecraftWorkspace directory in the previous step. For example, here is mine:

One time you've selected your Forge directory, click the Stop button. At this point y'all should encounter something similar this:

If, for whatever reason, this view doesn't appear for you automatically, just navigate to Window -> Evidence View -> Package Explorer. In any instance, you should be seeing that we have an ExampleMod.coffee file — an example mod for Minecraft, yet you should exist seeing that information technology has a number of errors. Let'due south fix these.

[EDIT (December 2020)]: Before proceeding to Step 4 yous will need to make some quick fixes to your build.gradle file due to changes that crave Gradle to at present use HTTPS instead of HTTP. Meet this Git-Hub Gist for an case build.gradle file with the fixes you'll need to get going. (Have notice of the comments in that example file on lines 1, six, and 25).

[Step iv] Decompiling Minecraft

Let'due south open upwards our MinecraftWorkspace directory and do a Shift+Right Click on our Forge binder, selecting the "Open PowerShell window here" pick to first upward PowerShell.

You should see the following (take note that you should be located straight inside the 'forge-1.7.x-…' directory):

Here nosotros'll enter:

.\gradlew tasks

This will show us all the bachelor tasks nosotros tin run, in that location are quite a few, but we're most interested in running "setupDecompWorkspace" so let's go ahead and exercise that by entering:

.\gradlew setupDecompWorkspace

This command volition run for a fair corporeality of time, equally it needs to decompile Minecraft for us. Thankfully, nosotros'll but need to practice this once. Yous'll know it's washed because it will say "BUILD SUCCESSFUL" if everything goes according to plan. This volition setup our environment such that we are ready to modify Minecraft. Next we'll demand to run a final control:

.\gradlew eclipse

This control will set upwardly an Eclipse project (which we'll be working in) for us. This command will run a off-white scrap quicker, and when it's done you lot should notice that the errors have vanished from our Eclipse projection. Handy!

[EDIT (September 2019)]: You may observe yous are still having import errors at this point. This seems to happen for some readers but not others. I haven't exactly figured out why, but it seems that removing your project from Eclipse and re-importing it may resolve the trouble in some cases.

[Step 5] Modifying Minecraft

If you oasis't had as well much problem following along with the setup stage of this tutorial, congratulations, nosotros're now set to start modding Minecraft. Yous'll notice that this Footstep 5 is quite lengthy. I wanted to comprehensively display how to add and customize a new block for you, don't worry if it seems intimidating we'll go through it step by step. For now, we'll go started past making a custom block — don't worry I'll supply some textures so you don't demand to be a pixel artist but yet. In any instance, you should now go ahead and open up your ExampleMod.java file by navigating to information technology in the Package Explorer pane.

You'll notice that this code really isn't doing much. That's okay, nosotros'll add some of our own code to spruce things up a fleck. Let'southward beginning by removing that Organization.out.println() and creating a skeleton for a new private class. The code inside our ExampleMod class should now look like this (throughout this tutorial I'll be bolding code that I've added in that step, so pay careful attention to the bolding!):

                      public static final String MODID = "examplemod";
public static terminal String VERSION = "1.0";
@EventHandler
public void init(FMLInitializationEvent issue)
{

}

private class ModBlock extends Block
{

}

Now yous can probably estimate where this is going —the Block class is a vanilla Minecraft block. Past extending it with our ModBlock class we tin can create our own block, featuring backdrop of our design. Let's start fleshing out this course by adding a constructor:

          private class ModBlock extends Block
{
public ModBlock(Fabric cloth, String blockName)
{
super(material);
this.setBlockName(blockName);
this.setBlockTextureName(MODID + ":" + blockName);
}

}

This constructor should be pretty straightforward. We pass in a Material and a name for our cake. There are a number of materials we tin choose from that will give our block sure backdrop, such as rock, cloth or wood, just for at present we won't worry well-nigh that. Permit'southward talk instead about .setBlockName() and .setBlockTextureName(). .setBlockName() is how we determine what our block will be identified as by the game, and .setBlockTextureName() identifies what the name of the texture our cake will be using is. It's very of import that our block's texture proper name follows the convention of "[Mod ID]:[Block Name]". Finally lets add one more line of code to our constructor so that our cake is available to us in Creative Mode, our constructor becomes:

          private course ModBlock extends Block
{
public ModBlock(Cloth material, String blockName)
{
super(material);
this.setBlockName(blockName);
this.setBlockTextureName(MODID + ":" + blockName);
this.setCreativeTab(CreativeTabs.tabBlock);
}
}

The above change tells the game which "tab" our block should show upwardly under in the Creative Mode bill of fare. With this, our ModBlock class is set up to be used. Let'south brand our concluding additions to the code.

          @Mod(modid = ExampleMod.MODID, version = ExampleMod.VERSION)
public grade ExampleMod
{
public static concluding Cord MODID = "examplemod";
public static final Cord VERSION = "1.0";

@EventHandler
public void init(FMLInitializationEvent event)
{
Block amethystOre = new ModBlock(Material.rock, "amethystOre");
GameRegistry.registerBlock(amethystOre, "amethystOre");

}

private grade ModBlock extends Block
{
public ModBlock(Textile material, String blockName)
{
super(fabric);
this.setBlockName(blockName);
this.setBlockTextureName(MODID + ":" + blockName);
this.setCreativeTab(CreativeTabs.tabBlock);
}
}

}

Here we are using our "init" function to initialize a new ModBlock named "amethystOre" and and so using the GameRegistry to annals the block. Registering the block is a disquisitional step, as an unregistered block will not be present in the game. With this, nosotros can build our mod, let'south render to PowerShell, and run

.\gradlew build

Once over again, once the build command has finished we'll get a positive "BUILD SUCCESSFUL" message. Yous should detect, inside your forge directory, that your modern has been built to the build/libs/ subdirectory every bit "modid-1.0":

Hopefully you're familiar with installing a Forge modern, if you aren't there are plenty of tutorials elsewhere online that can aid y'all out.

One time you have installed your mod and started upward Minecraft,you should be able to locate a strange looking pink and blackness block named "tile.amethystOre.proper name". Information technology's pink and black because we haven't given it a texture to display, and its name is a bit off because we haven't specified the plain English name all the same. Let's go ahead and do these things because they'll be quite piece of cake to practise and will make our cake look much better.

First of all, here is the image I will use for our amethyst ore:

Get alee and relieve that (making sure to proper name it amethystOre.png) we'll desire to add it to our Eclipse project in a specific directory then that the game is able to locate information technology. The directory we desire to place our block textures in is "src\main\resource\assets\examplemod\textures\blocks". Make certain this is added properly to your eclipse project, it should look just as it does in my Package Explorer pane hither:

Next nosotros'll want to create our language file (this is where we'll specify that we'd like our block to be chosen "Amethyst Ore" instead of "tile.amethystOre.name"). This file will named "en_US.lang" (it must be named this to exist recognized past the game) and it will be placed in the "src\main\resource\assets\examplemod\lang\" directory, just similar this:

Inside our en_US.lang file, equally you tin can come across higher up, we demand to enter this line, in order to map the "patently English" proper name to the game's identifier:

tile.amethystOre.proper name=Amethyst Ore

Make sure you relieve your en_US.lang file and then head dorsum to PowerShell to run another build! With that y'all should find our Amethyst Ore cake is quite functional!

Congratulations are due, as at this point, you've created a simple mod for Minecraft! Y'all may, however, have noticed that this cake breaks quite easily, and doesn't drop an ore as do other ore blocks in Minecraft similar Iron or Gold. So let's keep working on it past offset returning to our ModBlock subclass:

          individual grade ModBlock extends Block
{
public ModBlock(Textile textile, String blockName)
{
super(material);
this.setBlockName(blockName);
this.setBlockTextureName(MODID + ":" + blockName);
this.setCreativeTab(CreativeTabs.tabBlock);
this.setHardness(4.0F);
this.setHarvestLevel("pickaxe", 1);

}
}

The higher up lines I'm adding (.setHardness() and .setHarvestLevel()) are incredibly important to customizing your cake.

  • .setHardness() determines how long it volition accept you lot to interruption the block, as you lot tin can see it accepts a float value. For comparing, Iron Ore has a hardness of 3.0F, while Obsidian has a hardness of 50.0F.
  • .setHarvestLevel() determines what tool you tin can utilize to break this block. It accepts two parameters, a hardcoded string such every bit "axe" or "shovel" that determines the usable tool type and an integer representing the "level" of
    * @param level Harvest level:
    * Wood: 0
    * Stone: 1
    * Iron: ii
    * Diamond: 3
    * Gold: 0
    */
                      * @param level Harvest level:
* Wood: 0
* Stone: 1
* Fe: 2
* Diamond: 3
* Gold: 0
*/

And so knowing that, you can see that I'm programming our Amethyst Ore to be a flake tougher to intermission than Iron, and to require a Pickaxe that is fabricated of Rock or a tougher material in order to properly harvest the block — that isn't to say a wooden pickaxe couldn't pause it, but that you wouldn't receive the block's drops when you employ a wooden pickaxe, much like Atomic number 26 Ore.

If you'd like, feel free to pause here, build your modernistic and test out these changes. When you're ready, let'south make our cake drop Amethysts instead of dropping the Amethyst Ore block itself.

Over again, here is the prototype I'll exist using for the amethyst itself, go alee and save it:

Because this is an particular and not a block we need to salvage it to a slightly different directory: "src\chief\resources\assets\examplemod\textures\items" to confirm what this looks like inside Eclipse, here's a screenshot of my Bundle Explorer at this indicate in developing our mod:

Now we'll need to code our Amethyst item. This lawmaking looks very similar to our lawmaking for calculation a block, essentially we'll create a ModItem class that extends the Minecraft Particular class and we'll set our own properties. We'll then utilize the GameRegistry once once more to register our item. And then back in ExampleMod.java, permit'southward create our ModItem class:

                      private course ModItem extends Item
{
public ModItem(String itemName)
{
this.setUnlocalizedName(itemName);
this.setTextureName(MODID + ":" + itemName);
this.setCreativeTab(CreativeTabs.tabMisc);
}

}

Looks pretty similar to our ModBlock grade doesn't it? This time nosotros're not passing in a material, simply the name of our particular however. Once once more, nosotros set the item's proper noun so that the game knows how to identify it, we gear up the texture name so the game knows where to detect the texture for our item, and we set up which Creative Mode tab the item should exist located in. Now we but need to edit our init() phone call to initialize the Amethyst item:

          @EventHandler
public void init(FMLInitializationEvent event)
{
Item amethyst = new ModItem("amethyst");
GameRegistry.registerItem(amethyst, "amethyst");
Block amethystOre = new ModBlock(Textile.rock, "amethystOre");
GameRegistry.registerBlock(amethystOre, "amethystOre");
}

Take note that, just like with our ModBlock, we're instantiating our ModItem then registering it using the GameRegistry. Let'due south go alee and add the "manifestly english language" name for our item to our en_US.lang file so that the game displays "Amethyst" instead of item.amethyst.proper noun! Our en_US.lang file should now await like this:

          tile.amethystOre.name=Amethyst Ore
particular.amethyst.name=Amethyst

And with that we've added a new item to the game! Feel gratis to run a build and test out the modernistic again to find our new particular in the "Miscellaneous" tab in Artistic Mode:

Note that I take some other mods installed hither besides, including some of my ain custom content, just your Amethyst should wait just the aforementioned.

Now, every bit you've probably guessed, nosotros would like our Amethyst Ore block to drop our Amethyst item when we break information technology with a pickaxe! Allow's get alee and code that as it's a rather accessible change to make. First nosotros'll want to edit our ModBlock class to override the Item course' .getItemDropped() method, this volition await like this:

                      private form ModBlock extends Cake
{
individual Item toDrop;

public ModBlock(Material material, String blockName)
{
super(material);
this.setBlockName(blockName);
this.setBlockTextureName(MODID + ":" + blockName);
this.setCreativeTab(CreativeTabs.tabBlock);
this.setHardness(4.0F);
this.setHarvestLevel("pickaxe", 1);
}

@Override
public Particular getItemDropped(int i, Random random, int j)
{
if(toDrop != cipher)
{
return toDrop;
}
else return Item.getItemFromBlock(this);
}

}

Okay, so that'southward a considerable change we're making. Nosotros're giving our grade the property of an Particular named "toDrop", this will correspond which item our ModBlock will drop. Our overridden method, .getItemDropped() is existence overridden to accomplish the change of dropping our "toDrop" detail instead of the usual block. Of class, if we don't fix a "toDrop" detail it will default to the block-dropping behaviour. Now we'll desire to change our constructor so that we tin laissez passer in which item we want to drop. Our new constructor volition look like this:

          public ModBlock(Cloth material, Cord blockName, Item toDrop)
{
super(material);
this.setBlockName(blockName);
this.setBlockTextureName(MODID + ":" + blockName);
this.setCreativeTab(CreativeTabs.tabBlock);
this.setHardness(4.0F);
this.setHarvestLevel("pickaxe", 1);
this.toDrop = toDrop;
}

Once we make this change, we'll of grade have to change how we're instantiating this class in our .init() phone call:

          @EventHandler
public void init(FMLInitializationEvent event)
{
Item amethyst = new ModItem("amethyst");
GameRegistry.registerItem(amethyst, "amethyst");

Cake amethystOre = new ModBlock(Fabric.rock, "amethystOre", amethyst);
GameRegistry.registerBlock(amethystOre, "amethystOre");
}

And with that final change, y'all should find that your Amethyst Ore is now dropping Amethysts when harvested using a pickaxe that is made of Stone (or a stronger textile):

Hey, wait at that, breaking an Amethyst Ore block really did drop an Amethyst.

Allow's take a moment to review, considering at this signal we've not but just gotten our modding tools and surroundings setup, but we've also used them and added a new block and a new particular to the game, and we've done so in about 70 new lines of Java lawmaking, 2 new textures, and a piddling bit of editing to our .lang file. Obviously in that location's lots of routes we tin have this in that you're probably wondering about, for example:

  • How can I make my Amethyst Ore block generate randomly throughout the map?

We'll go there — don't worry, this is after all, intended to be a very comprehensive guide. However, I'd like to bespeak out that this is the start part of the tutorial you've completed. In the next role we'll restructure our projection and and then delve deeper into some of the modifications we tin can brand with our cake— but you should experience more than than complimentary to take a break here.

Welcome to the 2d part of the guide. I'd like to do some refactoring as our lawmaking, in its current state, is a bit messy. I'd like to rename our modernistic, and move our ModBlock and ModItem classes out into their own .coffee files for system purposes.

I'm going to name my mod "aubreymoddemo" but feel free to name your mod whatever y'all please. Renaming our mod is actually going to be a rather complicated procedure as there are a number of places nosotros will want to take into consideration:

  • Our Eclipse projection proper noun
  • Our chief packet, currently named com.instance.examplemod
  • Our main Java file, currently named ExampleMod.java
  • Our MODID property within that ExampleMod class.
  • Our textures location, currently named avails.examplemod.textures
  • Our lang files location, currently named avails.examplemod.lang
  • Our mcmod.info file (which nosotros have yet to look at)
  • Our build.gradle file (which we have as well yet to look at)

So long as we are consistent with our naming convention however we should accept no trouble. Allow's tackle this renaming process in the same society above.

  • Get-go things first let'due south right-click our "forge-one.7.ten-…" project in the Parcel Explorer, and select Refactor -> Rename and rename our projection.
  • Now, allow's right-click our com.instance.examplemod package, and again select Refactor -> Rename and rename it.
  • Next I'm going to Refactor -> Rename our ExampleMod.java and name it "Main.java" equally it is the main component of our mod.
  • Now permit's Refactor -> Rename our assets.examplemod.textures and assets.examplemod.lang package that our resources are in.
  • Next, allow's open up our mcmod.info file (information technology should have been created for you lot and should exist visible inside 'src/main/resources' in the Package Explorer). You should see a number of fields you will want to edit, such as "modid", "proper name", "clarification" and "authorList". Hither'due south how I've edited mine:

  • Finally, let's open upward our build.gradle file (you should also be able to locate this in the Package Explorer). We'll want to brand changes to the lines around line xx where the values are set for "group" and "archivesBaseName". Once once again, here's how I've edited mine (note the just changes I made were on lines 21 and 22):

Make sure you salve everything and and so run a build. You should detect that when your mod is built now, information technology's really named with your modid! That'due south a issue of the change nosotros made to our build.gradle.

It's important for u.s.a. to build and test our mod at this point equally it'southward all likewise easy to slip up and misname something. If you find you have missing (pinkish and black textures) or your "plain English" names aren't beingness displayed, go back and double check the listing above to ensure you've named everything identically. In case it may help you, hither's a glance at my Package Explorer later on making these changes:

Next, we're going to split the code in our Main.java into distinct classes. Correct-click the "com.example.aubreymoddemo" parcel (or any you may accept named it) and select New -> Class. We'll exercise this twice, naming one "ModBlock" and the other "ModItem". No demand to worry about all the options here, you tin can just select 'Cease' after entering the name of the grade.

We'll at present cutting and paste the code from our classes, currently in Main.coffee, into their new homes in ModBlock.java and ModItem.java. For each grade there will be some minor changes, so look carefully:

                      public            class ModBlock extends Cake
{
individual Item toDrop;

public ModBlock(Material material, Cord blockName, Particular toDrop)
{
super(material);
this.setBlockName(blockName);
this.setBlockTextureName(Main.MODID + ":" + blockName);
this.setCreativeTab(CreativeTabs.tabBlock);
this.setHardness(4.0F);
this.setHarvestLevel("pickaxe", one);
this.toDrop = toDrop;
}

@Override
public Item getItemDropped(int i, Random random, int j)
{
if(toDrop != nothing)
{
return toDrop;
}
else render Item.getItemFromBlock(this);
}
}

Accept note that our course is at present declared as "public" in that first line above. Also note that our MODID value is really stored in Main.java, so nosotros'll need to refer to it by adding a prefix, changing it to Primary.MODID. These same changes will apply to your ModItem grade equally well.

Once again, afterwards making these changes permit's ensure we've saved everything and then run a build and test our modern. Frequent testing when you're modding will help narrow down the troubleshooting process should something go wrong, so it'south a not bad habit to build while you're ahead.

In any case, with those changes out of the fashion, we're fix to start earthworks deeper into our mod. Let'south kickoff by making our block, Amethyst Ore starting time spawning at random throughout the globe!

To do this, we'll need implement the IWorldGenerator course, so let's correct-click our "com.instance.aubreymoddemo" packet (or again, whatsoever you've named your modern) and select New -> Form. Once again, nosotros only need to worry ourselves with the name of the class, and we tin can telephone call it ModWorldGenerator. Permit's open upward our new grade and implement IWorldGenerator, similar this:

          public form ModWorldGenerator implements IWorldGenerator
{
@Override
public void generate(Random random, int chunkX, int chunkZ, World globe, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
// TODO Auto-generated method stub

}
}

You'll notice that by just adding the keywords "implements IWorldGenerator" you'll be prompted to implement the .generate() method. Nosotros'll leave this class in this state for now, equally we'll need to make some changes in Main.coffee in order to access our amethystOre block in our ModWorldGenerator. What we need to do in Main.java is declare our items and blocks so that they are publicly available. This will expect something like this:

          @Modern(modid = Main.MODID, version = Master.VERSION)
public class Chief
{
public static final String MODID = "aubreymoddemo";
public static terminal String VERSION = "ane.0";

public static Particular amethyst;
public static Cake amethystOre;

@EventHandler
public void init(FMLInitializationEvent issue)
{
amethyst = new ModItem("amethyst");

GameRegistry.registerItem(amethyst, "amethyst");

amethystOre = new ModBlock(Material.stone, "amethystOre", amethyst);
GameRegistry.registerBlock(amethystOre, "amethystOre");
}

}

Annotation the new public static declarations near the tiptop. Now that our blocks and items are publicly attainable let's head dorsum to MapWorldGenerator.java to go things going. First, we'll want to add together a block property and a veinSize belongings and a constructor that accepts these as parameters. Your course should look something similar this:

          public class ModWorldGenerator implements IWorldGenerator
{
individual Block block;
private int veinSize;

ModWorldGenerator(Cake block, int veinSize)
{
this.cake = cake;
this.veinSize = veinSize;
}

@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
// TODO Automobile-generated method stub

}
}

Now we can mankind out our .generate() method:

          @Override
public void generate(Random random, int chunkX, int chunkZ, World earth, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
if (world.provider.dimensionId == 0) {
this.runGenerator(new WorldGenMinable(block, veinSize), globe, random, chunkX, chunkZ, 20, 0, 64);
}

}

Now, you'll detect that nosotros haven't created a .runGenerator() method nonetheless. Our .runGenerator() method will do a scrap of work for the states to ensure that the veins of amethystOre (or whatever other block) are truly randomized. I wanted to make special note of this .runGenerator() method as I learned information technology from this excellent tutorial. At large, this method had just been lifted as it was in that tutorial equally it truly is a standard in world generation, and information technology can exist used for all world generation purposes actually. In any case here it is:

          private void runGenerator(WorldGenerator generator, World globe, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight)
{
if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight)
{
throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator");
}

int heightDiff = maxHeight - minHeight + 1;
for (int i = 0; i < chancesToSpawn; i ++)
{
int x = chunk_X * 16 + rand.nextInt(16);
int y = minHeight + rand.nextInt(heightDiff);
int z = chunk_Z * 16 + rand.nextInt(xvi);
generator.generate(world, rand, 10, y, z);
}
}

Concluding, only not least, we'll need to caput dorsum to Primary.java and utilize the GameRegistry to register our new WorldGenerator:

          @EventHandler
public void init(FMLInitializationEvent event)
{
amethyst = new ModItem("amethyst");
GameRegistry.registerItem(amethyst, "amethyst");

amethystOre = new ModBlock(Material.rock, "amethystOre", amethyst);
GameRegistry.registerBlock(amethystOre, "amethystOre");

GameRegistry.registerWorldGenerator(new ModWorldGenerator(amethystOre, 6), 0);
}

Have notation that here nosotros are instantiating a new ModWorldGenerator inside the .registerWorldGenerator() telephone call. We pass the values of amethystOre (to specify which block we want to generate in the world) and 6 (to specify the size of the veins to generate of amethystOre). You may notice that .registerWorldGenerator() is actually actually accepting 2 parameters, our new ModWorldGenerator() AND and integer, in this case "0" — in case you're wondering, according to the JavaDoc this zero represents "a weight to assign to this generator. Heavy weights tend to sink to the bottom of
* list of earth generators (i.east. they run later)".

Again, let's ensure everything is saved and and then run a build, install our new build and test our modern. You'll want to create a new globe (or explore some uncharted territory in an old ane) to activate your newly implemented earth generation. It actually didn't take me too long to stumble across some Amethyst Ore in the wild:

Now congratulations are really in order! You've gone from installing Eclipse to implementing globe generation in your modernistic with simply a unmarried guide!

DOWNLOAD HERE

How to Make a Void Room in Minecraft TUTORIAL

Posted by: jamestery1948.blogspot.com

Comments

Popular

Candy Doll Laura B : Candydoll Tv Laura B Model - Foto

星ひとみ - 星蘭ひとみ(宝塚歌劇団(星組娘役))のまとめ

Menina Dancando Ok Ru : Mc Biônica 27 | CANDY ONLINE : Menina dançando dança da manivela namorado atormentado, combatchy anitta lexa .




banner



Featured Post

Blue Jacket Anime Character Briefcase Door Frame Meme

Image
Blue Jacket Anime Character Briefcase Door Frame Meme Aid : Search Box Search TheFreeDictionary using our four dissimilar search options, or search the spider web. Search TheFreeDictionary A default search includes all of TheFreeDictionary reference databases (all dictionaries and encyclopedias). Your initial search results will correspond to whatsoever tab (representing a dictionary or encyclopedia) is currently agile. If the Wikipedia tab is agile, the brandish results will originate from Wikipedia. If you lot are on the homepage, results displayed volition originate from the default Lexicon/Thesaurus tab. Every time you perform a search, you tin easily access the relevant entries in our other dictionaries and encyclopedias; just click on some other tab. Word/Commodity This is the most common type of search, and it satisfies m