Created
November 22, 2021 03:45
-
-
Save gentijo/378de2d46318702a4a1f8a34b5e19dee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.mcreator.dadsminecraftmod.item; | |
import net.minecraftforge.registries.ObjectHolder; | |
import net.minecraftforge.api.distmarker.OnlyIn; | |
import net.minecraftforge.api.distmarker.Dist; | |
import net.minecraft.item.crafting.Ingredient; | |
import net.minecraft.item.SwordItem; | |
import net.minecraft.item.ItemStack; | |
import net.minecraft.item.ItemGroup; | |
import net.minecraft.item.Item; | |
import net.minecraft.item.IItemTier; | |
import net.mcreator.dadsminecraftmod.DadsMinecraftModModElements; | |
@DadsMinecraftModModElements.ModElement.Tag | |
public class CustomSwordItem extends DadsMinecraftModModElements.ModElement { | |
@ObjectHolder("dads_minecraft_mod:custom_sword") | |
public static final Item block = null; | |
public CustomSwordItem(DadsMinecraftModModElements instance) { | |
super(instance, 1); | |
} | |
@Override | |
public void initElements() { | |
elements.items.add(() -> new SwordItem(new IItemTier() { | |
public int getMaxUses() { | |
return 100; | |
} | |
public float getEfficiency() { | |
return 4f; | |
} | |
public float getAttackDamage() { | |
return 2f; | |
} | |
public int getHarvestLevel() { | |
return 1; | |
} | |
public int getEnchantability() { | |
return 2; | |
} | |
public Ingredient getRepairMaterial() { | |
return Ingredient.EMPTY; | |
} | |
}, 3, -3f, new Item.Properties().group(ItemGroup.COMBAT)) { | |
@Override | |
@OnlyIn(Dist.CLIENT) | |
public boolean hasEffect(ItemStack itemstack) { | |
return true; | |
} | |
}.setRegistryName("custom_sword")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment