Modding 1.4.7: Updating to 1.5.1

In this tutorial I will show you how to update your code from 1.4.7 up to 1.5.1.
I won’t cover every single little detail about updating, but I will cover everything I come across when updating the source code.
The first thing you will have to do is set up MCP correctly. I won’t go into detail about how to do that here. You can look how to do that over here.
Next up would be to copy over all the source code from the old MCP into the new one. To do that go into your MCP set-up. Then enter the src folder and after that minecraft. In here you should take all the folders you have created. The folders should be anything but cpw, ibxm, net and paulscode. Now paste them in the same folder of your new MCP. Now open Eclipse on the new MCP.
This is where the coding starts.

When you open up your Eclipse you will see that there are quite a lot of errors. The files you will have to change for sure are the ClientProxy, mod file and all the Item and Block files. We will start with the mod file. This is the 1.4.7 file.


package tutorial;

import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
importnet.minecraft.entity.EntityEggInfo;
import net.minecraft.entity.EntityList;
importnet.minecraft.entity.EnumCreatureType;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
importnet.minecraft.world.biome.BiomeGenBase;
importnet.minecraftforge.common.DimensionManager;
importnet.minecraftforge.common.DungeonHooks;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.SidedProxy;
importcpw.mods.fml.common.event.FMLInitializationEvent;
importcpw.mods.fml.common.network.NetworkMod;
importcpw.mods.fml.common.registry.EntityRegistry;
importcpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = “Tutorial_Tutorialmod”, name = “Tutorial”, version = “1.0”)
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
publicclass Tutorial
{
       @SidedProxy(clientSide = “tutorial.ClientProxyTutorial”, serverSide = “tutorial.CommonProxyTutorial”)
       publicstatic CommonProxyTutorial proxy;
      
       staticintstartEntityId = 300;
      
       publicstaticintdimension = 20;
      
       publicstatic Block portal;
      
       publicstatic Item portalPlacer;
      
       publicstatic BiomeGenBase tutorialBiome;
      
       @Init
       publicvoid load(FMLInitializationEvent event)
       {
             proxy.registerRenderThings();
            
             tutorialBiome = new BiomeGenTutorial(53).setColor(2900485).setBiomeName(“Tutorial Biome”).setTemperatureRainfall(1F, 0.5F).setMinMaxHeight(0.2F, 1F);
            
             GameRegistry.addBiome(tutorialBiome);
            
             portalPlacer = new ItemPortalPlacer(5000).setIconIndex(0).setItemName(“tutorial”);
            
             LanguageRegistry.addName(portalPlacer, “Portal Placer”);
             
             portal = newBlockPortalTutorial(3500, 1).setBlockName(“portal”);
             GameRegistry.registerBlock(portal, “Wuppy29_Portal”);
             LanguageRegistry.addName(portal, “Custom Portal”);
            
             EntityRegistry.registerModEntity(EntityTutorial.class, “Tutorial”, 1, this, 80, 3, true);
            
             EntityRegistry.addSpawn(EntityTutorial.class, 10, 2, 4, EnumCreatureType.monster, BiomeGenBase.desert, BiomeGenBase.desertHills, BiomeGenBase.forest);
            
              LanguageRegistry.instance().addStringLocalization(“entity.Tutorial_Tutorialmod.Tutorial.name”, “Tutorial”);
            
             registerEntityEgg(EntityTutorial.class, 0x7A65CF, 0x4DF200);
            
             DimensionManager.registerProviderType(dimension, WorldProviderTutorial.class, false);
             DimensionManager.registerDimension(dimension, dimension);
            
             GameRegistry.addRecipe(new ItemStack(Block.blockGold, 2), new Object[]
             {
                    “XXX”,
                    “XZX”,
                    “XXX”,
                    ‘X’, Item.coal, ‘Z’, new ItemStack(Item.dyePowder, 1, 15)
             });
            
             DungeonHooks.addDungeonMob(“Tutorial”, 50);
       }
      
       publicstaticint getUniqueEntityId()
       {
             do
             {
                    startEntityId++;
             }
             while(EntityList.getStringFromID(startEntityId) != null);
                   
             returnstartEntityId;
       }
      
       publicstaticvoid registerEntityEgg(Class <? extends Entity> entity, int primaryColor, int secondaryColor)
       {
             int id = getUniqueEntityId();
             EntityList.IDtoClassMapping.put(id, entity);
             EntityList.entityEggs.put(id, new EntityEggInfo(id, primaryColor, secondaryColor));
       }
}

One very important thing in the 1.5 update is that there are no longer any sprite sheets. Every image has to be in a serparate 16×16 file. There are quite some rules for those images which I will go over later, but first we will fix up the code.
Because there aren’t  any sprite sheets in the code you will no longer need the code that gives Java the information where on the spritesheet to look. This means that you can no longer have the .setIconIndex() behind the items. With blocks you used to set the index for the image in the constructor, so you will have to remove the second number in the constructor for the blocks in this file. At first this will get you more errors, but we will fix that later.
To fix the errors under .setBlockName and .setItemName you simply change Item or Block into Unlocalized making both the methods .setUnlocalizedName.
Now you should have fixed almost all the errors in your mod file. You created some under the block constructors, but we will fix those in just a minute. First you will have to make a new variable at the top of your file. It should be something like this.


publicstaticfinal String modid = “Tutorial_Tutorialmod”;


You might be thinking why you should ask this. This is because you will need it in every single Block and Item file.
Another thing you should do with this is go into your @Mod line and change modid = “blah” into modid = Tutorial.modid. So the mod file . the variable you just created.
The file should now look like this.


package tutorial;

import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
importnet.minecraft.entity.EntityEggInfo;
import net.minecraft.entity.EntityList;
importnet.minecraft.entity.EnumCreatureType;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
importnet.minecraft.world.biome.BiomeGenBase;
importnet.minecraftforge.common.DimensionManager;
importnet.minecraftforge.common.DungeonHooks;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.SidedProxy;
importcpw.mods.fml.common.event.FMLInitializationEvent;
importcpw.mods.fml.common.network.NetworkMod;
importcpw.mods.fml.common.registry.EntityRegistry;
importcpw.mods.fml.common.registry.GameRegistry;
importcpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = “Tutorial_Tutorialmod”, name = “Tutorial”, version = “1.0”)
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
publicclass Tutorial
{
       publicstaticfinal String modid = “Tutorial_Tutorialmod”;
      
       @SidedProxy(clientSide = “tutorial.ClientProxyTutorial”, serverSide = “tutorial.CommonProxyTutorial”)
       publicstatic CommonProxyTutorial proxy;
      
       staticintstartEntityId = 300;
      
       publicstaticintdimension = 20;
      
       publicstatic Block portal;
      
       publicstatic Item portalPlacer;
      
       publicstatic BiomeGenBase tutorialBiome;
      
       @Init
       publicvoid load(FMLInitializationEvent event)
       {
             proxy.registerRenderThings();
            
             tutorialBiome = new BiomeGenTutorial(53).setColor(2900485).setBiomeName(“Tutorial Biome”).setTemperatureRainfall(1F, 0.5F).setMinMaxHeight(0.2F, 1F);
            
             GameRegistry.addBiome(tutorialBiome);
            
             portalPlacer = new ItemPortalPlacer(5000).setUnlocalizedName(“tutorial”);
            
             LanguageRegistry.addName(portalPlacer, “Portal Placer”);
            
             portal = newBlockPortalTutorial(3500).setUnlocalizedName(“portal”);
             GameRegistry.registerBlock(portal, “Wuppy29_Portal”);
             LanguageRegistry.addName(portal, “Custom Portal”);
            
             EntityRegistry.registerModEntity(EntityTutorial.class, “Tutorial”, 1, this, 80, 3, true);
            
             EntityRegistry.addSpawn(EntityTutorial.class, 10, 2, 4, EnumCreatureType.monster, BiomeGenBase.desert, BiomeGenBase.desertHills, BiomeGenBase.forest);
            
              LanguageRegistry.instance().addStringLocalization(“entity.Tutorial_Tutorialmod.Tutorial.name”, “Tutorial”);
            
             registerEntityEgg(EntityTutorial.class, 0x7A65CF, 0x4DF200);
            
             DimensionManager.registerProviderType(dimension, WorldProviderTutorial.class, false);
             DimensionManager.registerDimension(dimension, dimension);
            
             GameRegistry.addRecipe(new ItemStack(Block.blockGold, 2), new Object[]
             {
                    “XXX”,
                    “XZX”,
                    “XXX”,
                    ‘X’, Item.coal, ‘Z’, new ItemStack(Item.dyePowder, 1, 15)
             });
            
             DungeonHooks.addDungeonMob(“Tutorial”, 50);
       }
      
       publicstaticint getUniqueEntityId()
       {
             do
             {
                    startEntityId++;
             }
             while(EntityList.getStringFromID(startEntityId) != null);
                   
             returnstartEntityId;
       }
      
       publicstaticvoid registerEntityEgg(Class <? extends Entity> entity, int primaryColor, int secondaryColor)
       {
             int id = getUniqueEntityId();
             EntityList.IDtoClassMapping.put(id, entity);
             EntityList.entityEggs.put(id, new EntityEggInfo(id, primaryColor, secondaryColor));
       }
}

Next up go into your ClientProxy. The 1.4.7 tutorial file looks like this.


package tutorial;

importcpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
importnet.minecraftforge.client.MinecraftForgeClient;
publicclass ClientProxyTutorial extendsCommonProxyTutorial
{
       @Override
       publicvoid registerRenderThings()
       {
             MinecraftForgeClient.preloadTexture(“/tutorialblocks.png”);
             MinecraftForgeClient.preloadTexture(“/tutorialitems.png”);
             RenderingRegistry.registerEntityRenderingHandler(EntityTutorial.class, new RenderTutorial(new ModelTutorial(), 0.3F));
       }
}

Since we are no longer using the sprite sheets you will have to remove the lines that are .preloadTexture.
This is again something that doesn’t give you errors, but it will slow down and maybe even crash MC for you once you get it running.
The file should look something like this after changing it.


package tutorial;

importcpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
importnet.minecraftforge.client.MinecraftForgeClient;
publicclass ClientProxyTutorial extendsCommonProxyTutorial
{
       @Override
       publicvoid registerRenderThings()
       {
             RenderingRegistry.registerEntityRenderingHandler(EntityTutorial.class, new RenderTutorial(new ModelTutorial(), 0.3F));
       }
}

The next step in the updating process will not involve any coding. This part is also really boring.
The first thing you need to do know is make a folder structure somewhere where you want to store your mod images. The folder structure looks like this.
mods\[mod id]\textures\
In this folder you can have blocks, items and models, but if you don’t have any of those things you won’t need that folder.
Now you will have to go into your spritesheet and cut out 16×16 images for every block (side and metadata) and item (metadata). The name for these files is just as important as the folder structure. You will have to give the images the name you give the block/item at .setUnlocalizedName. If you have any metadata you will have to add the number of the metadata right behind it. Same goes for sided textures. Add a number right behind the name. If you have blocks give them 2 numbers with a space in between, but make sure you get the order right every time. I won’t go over the textures for metadata or sides, but you will have to add the number for metadata/side behind the Icon name.
The structure and file names are very important. If you get an Item Image in the blocks folder it will not work. If your folder is named block instead of blocks it will also break. There are quite a lot of rules involved, but it does make coding it really easy. After checking this you can simply paste the mods folder in the minecraft.jar located inside of the mcp/jars folder.

One important thing to note is that you will have to change the line that gets the texture in the Entity file, because you just changed that.

Now most of the annoying work is done. The next part is to go into every Block/Item file and add a simple method. If you have done the naming and placing of the Item/Block files correctly this method is the same for every Item and Block that doesn’t have metadata or sided textures.
The method you want to add in every file is this.


publicvoid registerIcons(IconRegister par1IconRegister)

    {
        this.blockIcon = par1IconRegister.registerIcon(Tutorial.modid + “:” + this.getUnlocalizedName2());
    }

Now this method is for all the Block files. If you want to have this method in an Item file the only thing you will have to change is this.blockIcon into this.iconIndex.

One thing we didn’t  do earlier is fix the errors in the block files though.
This is the code before I added the registerIcons method.


package tutorial;

import net.minecraft.block.Block;
importnet.minecraft.block.material.Material;
importnet.minecraft.creativetab.CreativeTabs;
publicclass BlockTutorialBlock extends Block
{
       public BlockTutorialBlock(int id, int texture)
       {
             super(id, texture, Material.cloth);
             this.setCreativeTab(CreativeTabs.tabBlock);
       }
      
       public String getTextureFile()
    {
            return“/tutorialblocks.png”;
    }
}

Now you will have to remove the second int in the constructor. You will also have to remove it from the super. After that you can also remove the getTextureFile method.
Then the file should look like this.


package tutorial;

import net.minecraft.block.Block;
importnet.minecraft.block.material.Material;
importnet.minecraft.client.renderer.texture.IconRegister;
importnet.minecraft.creativetab.CreativeTabs;
publicclass BlockTutorialBlock extends Block
{
       public BlockTutorialBlock(int id)
       {
             super(id, Material.cloth);
             this.setCreativeTab(CreativeTabs.tabBlock);
       }
      
       publicvoid registerIcons(IconRegister par1IconRegister)
    {
        this.blockIcon = par1IconRegister.registerIcon(Tutorial.modid + “:” + this.getUnlocalizedName2());
    }
}

For items you have to do the same, but the method name is updateIcons and this.blockIcon has to be changed into this.iconIndex.

Except for people with a dimension or code that places blocks in certain ways all the errors should be gone. If you don’t have any more errors you can just skip to the end of this tutorial. From now on it will only be about dimensions.
So when you look at your code you see errors in your BlockPortal, Teleporter and ChunkProvider file.
Let’s start by fixing the block.
This is the file I will start with.


package tutorial;

import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPortal;
importnet.minecraft.client.renderer.texture.IconRegister;
importnet.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
importnet.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.world.World;
publicclass BlockPortalTutorial extends BlockPortal
{
       public BlockPortalTutorial(int id)
       {
             super(id);
             this.setCreativeTab(CreativeTabs.tabBlock);
       }
      
       publicvoid registerIcons(IconRegister par1IconRegister)
    {
        this.blockIcon = par1IconRegister.registerIcon(Tutorial.modid + “:” + this.getUnlocalizedName2());
    }
      
       publicvoid updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
       {
       }
      
       publicvoid onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
       {
             if (par5Entity.ridingEntity == null && par5Entity.riddenByEntity == null)
             {
                    if (par5Entity instanceof EntityPlayerMP)
                    {
                           EntityPlayerMP thePlayer = (EntityPlayerMP) par5Entity;
                           if (par5Entity.dimension != Tutorial.dimension)
                           {
                                  thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, Tutorial.dimension, new TeleporterTutorial(thePlayer.mcServer.worldServerForDimension(Tutorial.dimension)));
                           }
                           else
                           {
                                  thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, new TeleporterTutorial(thePlayer.mcServer.worldServerForDimension(0)));
                           }
                    }
             }
       }
      
       publicboolean tryToCreatePortal(World par1World, int par2, int par3, int par4)
    {
        byte var5 = 0;
        byte var6 = 0;
        if(par1World.getBlockId(par2 – 1, par3, par4) == Block.sandStone.blockID || par1World.getBlockId(par2 + 1, par3, par4) == Block.sandStone.blockID)
        {
            var5 = 1;
        }
        if(par1World.getBlockId(par2, par3, par4 – 1) == Block.sandStone.blockID || par1World.getBlockId(par2, par3, par4 + 1) == Block.sandStone.blockID)
        {
            var6 = 1;
        }
        if (var5 == var6)
        {
            returnfalse;
        }
        else
        {
            if(par1World.getBlockId(par2 – var5, par3, par4 – var6) == 0)
            {
                par2 -= var5;
                par4 -= var6;
            }
            int var7;
            int var8;
            for (var7 = -1; var7 <= 2; ++var7)
            {
                for (var8 = -1; var8 <= 3; ++var8)
                {
                    boolean var9 = var7 == -1 || var7 == 2 || var8 == -1 || var8 == 3;
                    if (var7 != -1 && var7 != 2 || var8 != -1 && var8 != 3)
                    {
                        int var10 = par1World.getBlockId(par2 + var5 * var7, par3 + var8, par4 + var6 * var7);
                        if (var9)
                        {
                            if (var10 != Block.sandStone.blockID)
                            {
                                returnfalse;
                            }
                        }
                        elseif (var10 != 0 && var10 != Block.fire.blockID)
                        {
                            returnfalse;
                        }
                    }
                }
            }
            par1World.editingBlocks = true;
            for (var7 = 0; var7 < 2; ++var7)
            {
                for (var8 = 0; var8 < 3; ++var8)
                {
                    par1World.setBlockWithNotify(par2 + var5 * var7, par3 + var8, par4 + var6 * var7, this.blockID);
                }
            }
            par1World.editingBlocks = false;
            returntrue;
        }
    }
      
       publicvoid randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
    {
       
    }
      
       publicvoid onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
       {
             byte var6 = 0;
             byte var7 = 1;
             if(par1World.getBlockId(par2 – 1, par3, par4) == this.blockID || par1World.getBlockId(par2 + 1, par3, par4) == this.blockID)
             {
                    var6 = 1;
                    var7 = 0;
             }
             int var8;
             for (var8 = par3; par1World.getBlockId(par2, var8 – 1, par4) == this.blockID; –var8)
             {
                    ;
             }
             if(par1World.getBlockId(par2, var8 – 1, par4) != Block.sandStone.blockID)
             {
                    par1World.setBlockWithNotify(par2, par3, par4, 0);
             }
             else
             {
                    int var9;
                    for (var9 = 1; var9 < 4 && par1World.getBlockId(par2, var8 + var9, par4) == this.blockID; ++var9)
                    {
                           ;
                    }
                    if (var9 == 3 && par1World.getBlockId(par2, var8 + var9, par4) == Block.sandStone.blockID)
                    {
                           boolean var10 = par1World.getBlockId(par2 – 1, par3, par4) == this.blockID || par1World.getBlockId(par2 + 1, par3, par4) == this.blockID;
                           boolean var11 = par1World.getBlockId(par2, par3, par4 – 1) == this.blockID || par1World.getBlockId(par2, par3, par4 + 1) == this.blockID;
                           if (var10 && var11)
                           {
                                  par1World.setBlockWithNotify(par2, par3, par4, 0);
                           }
                           else
                           {
                                  if((par1World.getBlockId(par2 + var6, par3, par4 + var7) != Block.sandStone.blockID || par1World.getBlockId(par2 – var6, par3, par4 – var7) != this.blockID) && (par1World.getBlockId(par2 – var6, par3, par4 – var7) != Block.sandStone.blockID || par1World.getBlockId(par2 + var6, par3, par4 + var7) != this.blockID))
                                  {
                                        par1World.setBlockWithNotify(par2, par3, par4, 0);
                                  }
                           }
                    }
                    else
                    {
                           par1World.setBlockWithNotify(par2, par3, par4, 0);
                    }
             }
       }
}

If you look at all the errors in this file all of them have something to do with placing Blocks.
All of the errors are inside the tryToCreatePortal and onNeighborBlockChange methods. The easiest thing to do is just copy those 2 methods over from BlockPortal and change the Blocks used in those methods into the blocks used for your portal.
The reason why there are errors here is that the .setBlockWithNotify method has changed. There are some new methods that do things for you.
This is the same file, but with all the errors fixed.


package tutorial;

import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPortal;
importnet.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
importnet.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.world.World;
publicclass BlockPortalTutorial extends BlockPortal
{
       public BlockPortalTutorial(int id)
       {
             super(id);
             this.setCreativeTab(CreativeTabs.tabBlock);
       }
      
       publicvoid registerIcons(IconRegister par1IconRegister)
    {
        this.blockIcon = par1IconRegister.registerIcon(Tutorial.modid + “:” + this.getUnlocalizedName2());
    }
      
       publicvoid updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
       {
       }
      
       publicvoid onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
       {
             if (par5Entity.ridingEntity == null && par5Entity.riddenByEntity == null)
             {
                    if (par5Entity instanceof EntityPlayerMP)
                    {
                           EntityPlayerMP thePlayer = (EntityPlayerMP) par5Entity;
                           if (par5Entity.dimension != Tutorial.dimension)
                           {
                                  thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, Tutorial.dimension, new TeleporterTutorial(thePlayer.mcServer.worldServerForDimension(Tutorial.dimension)));
                           }
                           else
                           {
                                  thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, new TeleporterTutorial(thePlayer.mcServer.worldServerForDimension(0)));
                           }
                    }
             }
       }
      
       publicboolean tryToCreatePortal(World par1World, int par2, int par3, int par4)
    {
        byte b0 = 0;
        byte b1 = 0;
        if(par1World.getBlockId(par2 – 1, par3, par4) == Block.sandStone.blockID || par1World.getBlockId(par2 + 1, par3, par4) == Block.sandStone.blockID)
        {
            b0 = 1;
        }
        if(par1World.getBlockId(par2, par3, par4 – 1) == Block.sandStone.blockID || par1World.getBlockId(par2, par3, par4 + 1) == Block.sandStone.blockID)
        {
            b1 = 1;
        }
        if (b0 == b1)
        {
            returnfalse;
        }
        else
        {
            if (par1World.getBlockId(par2 – b0, par3, par4 – b1) == 0)
            {
                par2 -= b0;
                par4 -= b1;
            }
            int l;
            int i1;
            for (l = -1; l <= 2; ++l)
            {
                for (i1 = -1; i1 <= 3; ++i1)
                {
                    boolean flag = l == -1 || l == 2 || i1 == -1 || i1 == 3;
                    if (l != -1 && l != 2 || i1 != -1 && i1 != 3)
                    {
                        int j1 = par1World.getBlockId(par2 + b0 * l, par3 + i1, par4 + b1 * l);
                        if (flag)
                        {
                            if (j1 != Block.sandStone.blockID)
                            {
                                returnfalse;
                            }
                        }
                        elseif (j1 != 0 && j1 != Block.fire.blockID)
                        {
                            returnfalse;
                        }
                    }
                }
            }
            for (l = 0; l < 2; ++l)
            {
                for (i1 = 0; i1 < 3; ++i1)
                {
                    par1World.setBlock(par2 + b0 * l, par3 + i1, par4 + b1 * l, Tutorial.portal.blockID, 0, 2);
                }
            }
            returntrue;
        }
    }
      
       publicvoid randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
    {
       
    }
      
       publicvoid onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
    {
        byte b0 = 0;
        byte b1 = 1;
        if(par1World.getBlockId(par2 – 1, par3, par4) == this.blockID || par1World.getBlockId(par2 + 1, par3, par4) == this.blockID)
        {
            b0 = 1;
            b1 = 0;
        }
        int i1;
        for (i1 = par3; par1World.getBlockId(par2, i1 – 1, par4) == this.blockID; –i1)
        {
            ;
        }
        if(par1World.getBlockId(par2, i1 – 1, par4) != Block.sandStone.blockID)
        {
            par1World.setBlockToAir(par2, par3, par4);
        }
        else
        {
            int j1;
            for (j1 = 1; j1 < 4 && par1World.getBlockId(par2, i1 + j1, par4) == this.blockID; ++j1)
            {
                ;
            }
            if (j1 == 3 && par1World.getBlockId(par2, i1 + j1, par4) == Block.sandStone.blockID)
            {
                boolean flag = par1World.getBlockId(par2 – 1, par3, par4) == this.blockID || par1World.getBlockId(par2 + 1, par3, par4) == this.blockID;
                boolean flag1 = par1World.getBlockId(par2, par3, par4 – 1) == this.blockID || par1World.getBlockId(par2, par3, par4 + 1) == this.blockID;
                if (flag && flag1)
                {
                    par1World.setBlockToAir(par2, par3, par4);
                }
                else
                {
                    if((par1World.getBlockId(par2 + b0, par3, par4 + b1) != Block.sandStone.blockID || par1World.getBlockId(par2 – b0, par3, par4 – b1) != this.blockID) && (par1World.getBlockId(par2 – b0, par3, par4 – b1) != Block.sandStone.blockID || par1World.getBlockId(par2 + b0, par3, par4 + b1) != this.blockID))
                    {
                        par1World.setBlockToAir(par2, par3, par4);
                    }
                }
            }
            else
            {
                par1World.setBlockToAir(par2, par3, par4);
            }
        }
    }
}

Next up would be the ChunkProvider. In here you can see 3 errors. The first one is fixable by hovering over the ChunkProvider and clicking add unimplemented methods. Clicking this will make sure it returns the correct value. This isn’t always so, but this time it is.
The next 2 errors are both in populate. To fix this simply remove the WithNotify from the 2 methods used.

Now there is just one file left to go which is the Teleporter.
Because of the complexity of this code, changed methods and some other things it is wise to just copy over the code from the Teleporter file.
Next use Ctrl, F and search for obsidian. Replace it with your structure block. After that do the same for Block.portal and change it to your portal.

That should be everything to get your mod ready for the new version of Minecraft. If there is anything I missed or there is a 1.5.2 I will edit this tutorial. Next up is restarting the 1.4.7 tutorials in 1.5 though.

This is the last tutorial for 1.4.7.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">