Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

DoktuhParadox

Members
  • Posts

    21
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

DoktuhParadox's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. How would I go about getting the damage from items used in a recipe? Say I wanted to craft a paxel, and it's crafted from all of the tools. To avoid exploitation, the pickaxes and other tools cannot be damaged in order to craft the recipe, but this is bothersome. Is there a way to scan the crafting table, getting the damages of all of the items in the table, and damaging the paxel with the sum of the damages?
  2. Fixed it! It turns out that the unlocalized name switch needed the cases for the two other damage values in order to make a different unlocalized name.
  3. Well, here's the block file now: public class XailiteBlock extends Block { public XailiteBlock(int id) { super(id, Material.rock); this.setCreativeTab(Xailite.xailiteTab); this.setHardness(5.5F); } @SideOnly(Side.CLIENT) private Icon[] blockTextures; public void registerIcons(IconRegister iconRegister) { blockTextures = new Icon[4]; //Change this according to how many blocks there are for (int i = 0; i < blockTextures.length; i++) { blockTextures[i] = iconRegister.registerIcon("xailite:" + (i == 0 ? "XailiteOre" : i == 1 ? "XailiteBlock" : i == 2 ? "TemperedXailiteOre" : i == 3 ? "RefinedXailiteBlock" : null)); } } @Override public Icon getIcon(int id, int metadata) { return blockTextures[metadata]; } @Override public void getSubBlocks(int id, CreativeTabs tab, List subBlockList) { for (int i = 0; i < blockTextures.length; ++i) { subBlockList.add(new ItemStack(id, 1, i)); } } @Override public int damageDropped(int metadata) { this.setUnlocalizedName("XailiteBlock|" + metadata); return metadata; } @Override public boolean isBeaconBase(World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) { return worldObj.getBlockMetadata(x, y, z) == 1; } public String getUnlocalizedName(ItemStack itemStack) { return this.getUnlocalizedName() + "Xailite"; } } But it doesn't seem to work. And it's definitely the last two blocks having the same unlocalized name.
  4. Move that to where? The block class or the item block class?
  5. It may be your tick handler, then. Make sure it implements ITickHandler and it's server side, then use ModLoader.getMinecraftInstance.thePlayer for the player.
  6. Wait, the item you're checking for has a damage value?
  7. With getCurrentItemOrArmor you're checking the four armor slots. To get the current held item, it's getCurrentEquippedItem which returns an itemstack.
  8. I have a block with four subblocks including itself. The first two have their appropriate names, the last two have the same name. I tested adding a fifth sub block, and its name was the same as the other two as well. Here are the snippets of interest: In the Block.class: private Icon[] icons; ... public void registerIcons(IconRegister iconRegister) { blockTextures = new Icon[4]; //Change this according to how many blocks there are for (int i = 0; i < blockTextures.length; i++) { this.setUnlocalizedName("XailiteBlock|" + i); blockTextures[i] = iconRegister.registerIcon("xailite:" + (i == 0 ? "XailiteOre" : i == 1 ? "XailiteBlock" : i == 2 ? "TemperedXailiteOre" : i == 3 ? "RefinedXailiteBlock" : null)); } } In the ItemBlock.class: public String getUnlocalizedName(ItemStack itemstack) { String name; switch (itemstack.getItemDamage()) { case 0: name = "world"; break; case 1: name = "nether"; break; default: name = "broken"; break; } return this.getUnlocalizedName() + "." + name; } Registering the block: GameRegistry.registerBlock(xailiteBlock, ItemXailiteBlock.class, "Xailite" + xailiteBlock.getUnlocalizedName().substring(5)); Giving them display names: LanguageRegistry.addName(new ItemStack(xailiteBlock, 1, 2), "Refined Xailite Block"); LanguageRegistry.addName(new ItemStack(xailiteBlock, 1, 3), "Tempered Xailite Ore"); The two blocks with the same name are the refined block and the tempered ore. They return the correct block when broken, the recipes are correct, etc. the only discrepancy is them having the same name.
  9. In the mod I'm developing, the armor has a special attribute; it disappears with the player when the player uses an invisibility potion. It works well, but since the armor disappearance is only visual (it just sets the armor skin texture to an empty .png), mobs can still track the player normally. I already have a tick handler set up for my other armor effects, so it's just a matter of removing the player from mob trackers after a potion check. How would I go about doing this?
  10. I've made a tile entity similar to a furnace, and it used to work. Now, when I right click it, the game crashes with this: I will post code when/if necessary.
  11. I'm trying to make an ingame GUI to be able to configure my mod easily. I have all of the buttons and other GUI elements down, but I need to know how to overwrite a key in the configuration file. I'm also doing this in a class that's outside the class that the configuration file keys and the file itself are defined in, if that makes a difference.
  12. I made a configuration file, and some of the stuff should really be in a different category that isn't a default one. Is there a way to make a custom one?
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.