Guest User

Untitled

a guest
Jun 1st, 2016
73
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. } else if (stack.getTagCompound().getByte("mode") == 0) {
  55. if (stack.isItemEnchanted() == false) {
  56. stack.addEnchantment(enderdeath.StarsPower, 1);
  57. stack.addEnchantment(Enchantment.sharpness, 5);
  58. System.out.println("Puissance 1");
  59.  
  60. }
  61.  
  62. if (stack.getTagCompound().getByte("mode") == 1) {
  63. if (stack.isItemEnchanted() == false) {
  64. stack.addEnchantment(Enchantment.knockback, 3);
  65. stack.addEnchantment(Enchantment.sharpness, 3);
  66.  
  67. System.out.println("recul 1");
  68.  
  69. }
  70.  
  71. else if (stack.getTagCompound().getByte("mode") == 2) {
  72. if (stack.isItemEnchanted() == false) {
  73. stack.addEnchantment(Enchantment.fireAspect, 10);
  74. stack.addEnchantment(Enchantment.sharpness, 3);
  75.  
  76. System.out.println("fire 1");
  77.  
  78. }
  79. }
  80. }
  81. }
  82. } else {
  83. super.onItemRightClick(stack, world, player);
  84. }
  85.  
  86. return stack;
  87. }
  88.  
  89. private ItemStack stack;
  90.  
  91. public boolean hitEntity(ItemStack stack, EntityLivingBase attackedLiving, EntityLivingBase attackerLiving) {
  92.  
  93. if (!stack.hasTagCompound()) {
  94. stack.setTagCompound(new NBTTagCompound());
  95. }
  96.  
  97. {
  98.  
  99. }
  100.  
  101. return super.hitEntity(stack, attackedLiving, attackerLiving);
  102. }
  103.  
  104. @Override
  105. @SideOnly(Side.CLIENT)
  106. public EnumRarity getRarity(ItemStack itemstack) {
  107. return EnumRarity.epic;
  108. }
  109.  
  110. @SideOnly(Side.CLIENT)
  111. public boolean hasEffect(ItemStack stack) {
  112. return true;
  113. }
  114.  
  115. }
RAW Paste Data