Chisels once again have extra attack damage

This commit is contained in:
tterrag1098 committed 2015-01-19 21:12:11 -05:00
1 parent d4bd181ef1
commit f6213c9f37
2 files changed
+28 -2

No files matched your search

@@ -40,6 +40,8 @@ public class Configurations {
public static int diamondChiselMaxDamage;
public static boolean ironChiselCanLeftClick;
public static boolean ironChiselHasModes;
public static int ironChiselAttackDamage;
public static int diamondChiselAttackDamage;
public static boolean useRoadLineTool;
public static String getRoadLineTool;
@@ -85,6 +87,8 @@ public class Configurations {
diamondChiselMaxDamage = config.get(category, "diamondChiselMaxDamage", 5000, "The max damage of the diamond chisel. Default: 5000").getInt();
ironChiselCanLeftClick = config.get(category, "ironChiselCanLeftClick", true, "If this is true, the iron chisel can left click chisel blocks. If false, it cannot.").getBoolean();
ironChiselHasModes = config.get(category, "ironChiselHasModes", false, "If this is true, the iron chisel can change its chisel mode just as the diamond chisel can.").getBoolean();
ironChiselAttackDamage = config.get(category, "ironChiselAttackDamage", 2, "The extra attack damage points (in half hearts) that the iron chisel inflicts when it is used to attack an entity.").getInt();
diamondChiselAttackDamage = config.get(category, "diamondChiselAttackDamage", 2, "The extra attack damage points (in half hearts) that the diamond chisel inflicts when it is used to attack an entity.").getInt();
/* block */
category = "block";
@@ -4,6 +4,9 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
@@ -16,16 +19,21 @@ import com.cricketcraft.chisel.api.IChiselItem;
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
import com.cricketcraft.chisel.carving.Carving;
import com.cricketcraft.chisel.config.Configurations;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
public class ItemChisel extends Item implements IChiselItem {
public enum ChiselType {
IRON(Configurations.ironChiselMaxDamage), DIAMOND(Configurations.diamondChiselMaxDamage);
IRON(Configurations.ironChiselMaxDamage, Configurations.ironChiselAttackDamage),
DIAMOND(Configurations.diamondChiselMaxDamage, Configurations.diamondChiselAttackDamage);
final int maxDamage;
final int attackDamage;
ChiselType(int maxDamage) {
ChiselType(int maxDamage, int attackDamage) {
this.maxDamage = maxDamage;
this.attackDamage = attackDamage;
}
}
@@ -78,6 +86,20 @@ public class ItemChisel extends Item implements IChiselItem {
return true;
}
@SuppressWarnings("rawtypes")
@Override
public Multimap getAttributeModifiers(ItemStack stack) {
Multimap<String, AttributeModifier> multimap = HashMultimap.create();
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Chisel Damage", type.attackDamage, 0));
return multimap;
}
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
stack.damageItem(1, attacker);
return super.hitEntity(stack, attacker, target);
}
@Override
public boolean canOpenGui(World world, EntityPlayer player, ItemStack chisel) {
return true;