Jump to content

Changing attack speed of Sword


TheRedstoneWiz

Recommended Posts

How do i change the attack cooldown of the sword? whenever i try to copy the code for attack speed to my ToolKatana and run it, it still shows the same 1.6 speed. How do i fix this?

 

Here is my code:

 

package com.redstonewiz.ancientweapons.items.tools;

import com.google.common.collect.Multimap;
import com.redstonewiz.ancientweapons.Main;
import com.redstonewiz.ancientweapons.init.ModItems;
import com.redstonewiz.ancientweapons.util.IHasModel;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSword;

public class ToolKatana extends ItemSword implements IHasModel {
	
	private final float attackDamage;

	public ToolKatana(String name, ToolMaterial material)
	{
		super(material);
		setUnlocalizedName(name);
		setRegistryName(name);
		setCreativeTab(CreativeTabs.COMBAT);
		this.attackDamage = 10.0F + material.getAttackDamage();
		
		ModItems.ITEMS.add(this);
	}
	
	@Override
	public void registerModels() {
		// TODO Auto-generated method stub
		Main.proxy.registerItemRenderer(this, 0, "inventory");
	}

	@Override
	public void RegisterModels() {
		// TODO Auto-generated method stub
		
	}
	
	public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot)
    {
        Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot);

        if (equipmentSlot == EntityEquipmentSlot.MAINHAND)
        {
        	
            multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4D, 5));
        }

        return multimap;
    }
	
}

 

Link to comment
Share on other sites

1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

Link to comment
Share on other sites

Or check the ItemAxe directory it has 

protected ItemAxe(Item.ToolMaterial material, float damage, float speed)
    {
        super(material, EFFECTIVE_ON);
        this.attackDamage = damage;
        this.attackSpeed = speed;
    }

You should probably make your custom ItemSword directory and add this.attackSpeed to it

Edited by LordKingBob
Link to comment
Share on other sites

46 minutes ago, TheRedstoneWiz said:

IHasModel

This is useless and pointless. All items need models.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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