Jump to content

KakesRevenge

Members
  • Posts

    153
  • Joined

  • Last visited

Everything posted by KakesRevenge

  1. Hello, my goal is to make property displayed next to players name so now in vanilla my name would be displayed like : "KakesRevenge". And for example i want to display another name next to players name like that : "[AnythingGoesHere]KakesRevenge". My question is how to do it ?
  2. Wow cool i just dont understand the detectAndSendChanges thing but thank you very much
  3. I want just add the same item when the item is right clicked no matter what. Idealy the onItemRightClick would be void. I just dont know how to deal with the return statement.
  4. I did that here : @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { player.inventory.addItemStackToInventory(new ItemStack(this)); return stack ; } or i dont understand you
  5. Basically what i need to do - the current stack + another one.
  6. Hey, Im trying to make an item and when you right click it you will get another item (same one) and this: @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { player.inventory.addItemStackToInventory(new ItemStack(this)); return stack ; } i know why but is there any way to solve it ?
  7. Ok so make it like diesieben said : switch (meta) { case 0: return <>; case 1: return <>; ... ... default: return <default value for unknown meta>; }
  8. lol sorry i didnt say the main thing but never mind i figured it out thank you
  9. So i have my armor class like this : package fewmorethings.items.armor; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; import fewmorethings.Main; import fewmorethings.items.ArmoryHandler; public class EmeraldArmor extends ItemArmor { private static Item bootsEmerald; private String [] armorTypes = new String [] {"EmeraldHelmet", "EmeraldChestplate", "EmeraldLeggings", "EmeraldBoots"}; public EmeraldArmor(ArmorMaterial armorMaterial, int renderIndex, int armorType){ super(armorMaterial, renderIndex, armorType); this.setCreativeTab(Main.fmtab); } @Override public String getArmorTexture(ItemStack stack, Entity entity,int slot, String layer){ if(stack.getItem().equals(ArmoryHandler.EmeraldHelmet)|| stack.getItem().equals(ArmoryHandler.EmeraldChestplate)|| stack.getItem().equals(ArmoryHandler.EmeraldBoots)){ return "fmt:textures/armor/EmeraldArmor1.png"; } if(stack.getItem().equals(ArmoryHandler.EmeraldLeggings)){ return "fmt:textures/armor/EmeraldArmor2.png"; } else return null; } @Override public void registerIcons(IIconRegister reg){ if(this == ArmoryHandler.EmeraldHelmet) this.itemIcon = reg.registerIcon("fmt:EmeraldHelmet"); if(this == ArmoryHandler.EmeraldChestplate) this.itemIcon = reg.registerIcon("fmt:EmeraldChestplate"); if(this == ArmoryHandler.EmeraldLeggings) this.itemIcon = reg.registerIcon("fmt:EmeraldLeggings"); if(this == ArmoryHandler.EmeraldBoots) this.itemIcon = reg.registerIcon("fmt:EmeraldBoots"); } @Override public void onArmorTick(World world, EntityPlayer player, ItemStack itemstack){ if(player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(1) !=null && player.getCurrentArmor(0) != null){ ItemStack helmet = player.getCurrentArmor(3); ItemStack plate = player.getCurrentArmor(2); ItemStack leggings = player.getCurrentArmor(1); ItemStack boots = player.getCurrentArmor(0); if(helmet.getItem() == ArmoryHandler.EmeraldHelmet && plate.getItem() == ArmoryHandler.EmeraldChestplate && leggings.getItem() == ArmoryHandler.EmeraldLeggings && boots.getItem() == ArmoryHandler.EmeraldBoots){ player.addPotionEffect( new PotionEffect(Potion.resistance.getId(), 10, 60)); } } } } and init armor : public static Item EmeraldHelmet = new EmeraldArmor(ArmorEmerald, 5, 0).setUnlocalizedName("EmeraldHelmet"); public static Item EmeraldChestplate = new EmeraldArmor(ArmorEmerald, 5, 1).setUnlocalizedName("EmeraldChestplate"); public static Item EmeraldLeggings = new EmeraldArmor(ArmorEmerald, 5, 2).setUnlocalizedName("EmeraldLeggings"); public static Item EmeraldBoots = new EmeraldArmor(ArmorEmerald, 5, 3).setUnlocalizedName("EmeraldBoots");
  10. So for better explanation (sorry for my english) : basically what switch case is doing - you will say @Override public Item getItemDropped(int meta, Random random, int fortune) { Item drop = new Item(); //drop variable switch (meta or any other integer) { //in this case its the integer meta which is basically saying what block you mean case 1: //in case the meta int is eqal to 1 drop = Items.apple // change the drop variable to apple break; //STOP case 2: //in case the meta is equal to 2 drop = Items.diamond // change the drop variable to apple break; } return drop; //now we need to return the item which will be dropped which will be the drop variable for dropping item as block simply : Item.getItemFromBlock(Blocks.dirt);
  11. @Override public Item getItemDropped(int meta, Random random, int int2) { Item drop = new Item(); switch (meta) { case 1: drop = Items.diamond; break; case 2: drop = Items.apple; } return drop; } (int meta, Random random, int int2) int meta
  12. You can make switch case of the 1st int like this : @Override public Item getItemDropped(int meta, Random random, int int2) { Item drop = new Item(); switch (meta) { case 1: drop = Items.diamond; break; case 2: drop = Items.apple; } return drop; }
  13. In the method onItemDropped just check if meta == 2 then drop this and if meta == 1 drop this
  14. Hello everyone, Im trying to make armor which will work only if player.someBoolean == true that means that if the boolean is == false then player cannot place armor in his armor slot. I was looking in ItemArmor.class but i cant find some method which is placing the armor in slot. Thx for any help
  15. I know just a little bit of java and thank you very much finally fixed it.
  16. I know what should i do but i dont know how .. thats why i would like to see an example
  17. I dont know how the icon field should look like
  18. Could you write an example for me please ?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.