Guest User

Untitled

a guest
May 31st, 2016
84
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package ed.enderdeath.mod.Tool;
  2.  
  3. import cpw.mods.fml.common.FMLLog;
  4. import cpw.mods.fml.common.eventhandler.Event.Result;
  5. import cpw.mods.fml.relauncher.Side;
  6. import cpw.mods.fml.relauncher.SideOnly;
  7. import ed.enderdeath.mod.common.enderdeath;
  8. import net.minecraft.block.Block;
  9. import net.minecraft.command.IEntitySelector;
  10. import net.minecraft.enchantment.Enchantment;
  11. import net.minecraft.entity.Entity;
  12. import net.minecraft.entity.EntityLivingBase;
  13. import net.minecraft.entity.item.EntityItem;
  14. import net.minecraft.entity.monster.EntityMob;
  15. import net.minecraft.entity.passive.EntityAnimal;
  16. import net.minecraft.entity.player.EntityPlayer;
  17. import net.minecraft.init.Blocks;
  18. import net.minecraft.item.EnumRarity;
  19. import net.minecraft.item.Item;
  20. import net.minecraft.item.ItemSnowball;
  21. import net.minecraft.item.ItemStack;
  22. import net.minecraft.item.ItemSword;
  23. import net.minecraft.nbt.NBTTagCompound;
  24. import net.minecraft.potion.Potion;
  25. import net.minecraft.potion.PotionEffect;
  26. import net.minecraft.util.ChatComponentTranslation;
  27. import net.minecraft.util.MovingObjectPosition;
  28. import net.minecraft.util.Vec3;
  29. import net.minecraft.world.World;
  30. import net.minecraftforge.common.MinecraftForge;
  31. import net.minecraftforge.event.entity.player.UseHoeEvent;
  32.  
  33. public class UltimateSword extends ItemSword {
  34.  
  35. public UltimateSword(ToolMaterial ToolMaterial) {
  36. super(ToolMaterial);
  37.  
  38. }
  39.  
  40. public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
  41.  
  42. if (player.isSneaking()) {
  43. if (!stack.hasTagCompound()) {
  44. stack.setTagCompound(new NBTTagCompound());
  45. }
  46. byte mode = stack.getTagCompound().getByte("mode");
  47. mode++;
  48. if (mode == 3) {
  49. mode = 0;
  50. }
  51. stack.getTagCompound().setByte("mode", mode);
  52. if (!world.isRemote) {
  53. player.addChatMessage(new ChatComponentTranslation("Ultimate.mode.message." + mode));
  54. }
  55.  
  56. } else {
  57. super.onItemRightClick(stack, world, player);
  58. }
  59.  
  60. return stack;
  61. }
  62.  
  63. private ItemStack stack;
  64.  
  65. public boolean hitEntity(ItemStack stack, EntityLivingBase attackedLiving, EntityLivingBase attackerLiving) {
  66.  
  67. if (!stack.hasTagCompound()) {
  68. stack.setTagCompound(new NBTTagCompound());
  69. } else if (stack.getTagCompound().getByte("mode") == 0) {
  70. if (stack.isItemEnchanted() == false) {
  71. stack.addEnchantment(enderdeath.StarsPower, 1);
  72. stack.addEnchantment(Enchantment.sharpness, 5);
  73. System.out.println("Puissance 1");
  74. stack.isItemEnchanted();
  75.  
  76. if (stack.getTagCompound().getByte("mode") == 1) {
  77. stack.isItemEnchantable();
  78.  
  79. }
  80. }
  81.  
  82. }
  83.  
  84. if (stack.getTagCompound().getByte("mode") == 1) {
  85. if (stack.isItemEnchanted() == false) {
  86. stack.addEnchantment(Enchantment.knockback, 3);
  87. stack.addEnchantment(Enchantment.sharpness, 3);
  88. stack.isItemEnchanted();
  89. System.out.println("recul 1");
  90. if (stack.getTagCompound().getByte("mode") == 2) {
  91. stack.isItemEnchantable();
  92.  
  93. }
  94. }
  95.  
  96. } else if (stack.getTagCompound().getByte("mode") == 2) {
  97. if (stack.isItemEnchanted() == false) {
  98. stack.addEnchantment(Enchantment.fireAspect, 10);
  99. stack.addEnchantment(Enchantment.sharpness, 3);
  100. stack.isItemEnchanted();
  101. System.out.println("fire 1");
  102. if (stack.getTagCompound().getByte("mode") == 0) {
  103. stack.isItemEnchantable();
  104.  
  105. }
  106. }
  107.  
  108. } else
  109.  
  110. {
  111.  
  112. }
  113.  
  114. return super.hitEntity(stack, attackedLiving, attackerLiving);
  115. }
  116.  
  117. @Override
  118. @SideOnly(Side.CLIENT)
  119. public EnumRarity getRarity(ItemStack itemstack) {
  120. return EnumRarity.epic;
  121. }
  122.  
  123. @SideOnly(Side.CLIENT)
  124. public boolean hasEffect(ItemStack stack) {
  125. return true;
  126. }
  127.  
  128. }
RAW Paste Data