mirror of
https://github.com/dragonruler1000/hdm-mod.git
synced 2025-06-29 08:29:33 -05:00
Got the Subtle knife to do damage
Signed-off-by: dragonruler1000 <github@me.minecraftchest2.us>
This commit is contained in:
parent
8d7cb26295
commit
902e814ee5
5 changed files with 85 additions and 6 deletions
|
@ -1,18 +1,17 @@
|
|||
package us.minecraftchest2.hdm_mod.init;
|
||||
|
||||
import net.minecraft.item.Food;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import us.minecraftchest2.hdm_mod.Hdm_mod;
|
||||
import net.minecraft.item.Item;
|
||||
import us.minecraftchest2.hdm_mod.util.ModItemTier;
|
||||
|
||||
public class ItemInit {
|
||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, Hdm_mod.MOD_ID);
|
||||
public static final RegistryObject<Item> KNIFE = ITEMS.register("knife", () -> new Item(new Item.Properties().tab(ModCreativeTab.Items)));
|
||||
public static final RegistryObject<Item> KNIFE = ITEMS.register("knife", () -> new SwordItem(ModItemTier.MGTI, 3,-2.4f, new Item.Properties().tab(ModCreativeTab.Items)));
|
||||
public static final RegistryObject<Item> OMELET = ITEMS.register("omelet", () -> new Item(new Item.Properties().tab(ModCreativeTab.Items).food(new Food.Builder().nutrition(4).saturationMod(2).build())));
|
||||
public static final RegistryObject<Item> SPYGLASS = ITEMS.register("spyglass", () -> new Item(new Item.Properties().tab(ModCreativeTab.Items)));
|
||||
|
||||
public static class ModCreativeTab extends ItemGroup {
|
||||
public static final ModCreativeTab Items = new ModCreativeTab(ItemGroup.TABS.length, "HDM Mod Items");
|
||||
|
|
20
src/main/java/us/minecraftchest2/hdm_mod/items/SpyGlass.java
Normal file
20
src/main/java/us/minecraftchest2/hdm_mod/items/SpyGlass.java
Normal file
|
@ -0,0 +1,20 @@
|
|||
package us.minecraftchest2.hdm_mod.items;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class SpyGlass extends Item {
|
||||
public SpyGlass(Properties properties)
|
||||
{
|
||||
super(properties);
|
||||
}
|
||||
@Override
|
||||
public ActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
|
||||
return super.use(world, player, hand);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package us.minecraftchest2.hdm_mod.util;
|
||||
|
||||
import net.minecraft.item.IItemTier;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.LazyValue;
|
||||
import us.minecraftchest2.hdm_mod.init.ItemInit;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public enum ModItemTier implements IItemTier {
|
||||
MGTI(4, 30000, 10.0F, 20.0F, 5, () -> {
|
||||
return Ingredient.of(ItemInit.KNIFE.get());
|
||||
});
|
||||
|
||||
private final int level;
|
||||
private final int uses;
|
||||
private final float speed;
|
||||
private final float damage;
|
||||
private final int enchantmentValue;
|
||||
private final LazyValue<Ingredient> repairIngredient;
|
||||
|
||||
ModItemTier(int level, int durability, float miningSpeed, float damage, int enchantability, Supplier<Ingredient> repairIngredient) {
|
||||
this.level = level;
|
||||
this.uses = durability;
|
||||
this.speed = miningSpeed;
|
||||
this.damage = damage;
|
||||
this.enchantmentValue = enchantability;
|
||||
this.repairIngredient = new LazyValue<>(repairIngredient);
|
||||
}
|
||||
|
||||
public int getUses() {
|
||||
return this.uses;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return this.speed;
|
||||
}
|
||||
|
||||
public float getAttackDamageBonus() {
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return this.level;
|
||||
}
|
||||
|
||||
public int getEnchantmentValue() {
|
||||
return this.enchantmentValue;
|
||||
}
|
||||
|
||||
public Ingredient getRepairIngredient() {
|
||||
return this.repairIngredient.get();
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"parent": "item/handheld",
|
||||
"textures": {
|
||||
"layer0": "hdm_mod:items/knife"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "hdm_mod:items/omelet"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue