Created
March 16, 2012 20:31
-
-
Save thvortex/2052469 to your computer and use it in GitHub Desktop.
ModLoader.addLocalization() example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.minecraft.src; | |
public class mod_MetaBlocks extends BaseMod | |
{ | |
public mod_MetaBlocks() | |
{ | |
ModLoader.AddLocalization("tile.itemmeta.name", "Mallorn Leaves"); | |
Block.blocksList[20] = null; // Avoid exception throw in Block() constructor | |
Block glass = new BlockGlassMeta(20, 49, Material.glass // ... the rest is the same as the "glass" static initializer in Blocks.java | |
glass.initializeBlock(); // Not needed but for completness | |
Item.itemsList[20] = new ItemMeta(20 - 256); // | |
} | |
public String Version() | |
{ | |
return "1.7.3-0.1"; | |
} | |
} | |
public class BlockGlassMeta extends BlockGlass | |
{ | |
public BlockGlassMeta(int i, int j, Material material, boolean flag) | |
{ | |
super(i, j, material, flag); | |
} | |
public int getBlockTextureFromSideAndMetadata(int i, int j) | |
{ | |
if(j == 1) | |
{ | |
return 0; | |
} | |
else | |
{ | |
return blockIndexInTexture; | |
} | |
} | |
// Doesn't work in SMP without server side mod | |
protected int damageDropped(int i) | |
{ | |
return i; | |
} | |
} | |
public class ItemMeta extends ItemBlock | |
{ | |
public ItemMeta(int i) | |
{ | |
super(i); | |
setMaxDamage(0); | |
setHasSubtypes(true); | |
} | |
// Doesn't work in SMP without server side mod | |
public int getPlacedBlockMetadata(int i) | |
{ | |
return i; | |
} | |
public String getItemNameIS(ItemStack itemstack) | |
{ | |
return "tile.itemmeta"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment