Java tutorial
/** * AbyssalCraft * Copyright 2012-2015 Shinoow * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.shinoow.abyssalcraft.common.items; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import com.google.common.collect.Multimap; public class ItemCudgel extends Item { public ItemCudgel() { super(); setMaxDamage(2000); setMaxStackSize(1); } @Override public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { par1ItemStack.damageItem(1, par3EntityLivingBase); return true; } @Override public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { return Items.bone == par2ItemStack.getItem() ? true : super.getIsRepairable(par1ItemStack, par2ItemStack); } @Override @SuppressWarnings({ "rawtypes", "unchecked", "deprecation" }) public Multimap getItemAttributeModifiers() { Multimap multimap = super.getItemAttributeModifiers(); multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", 20, 0)); return multimap; } }