mirror of
https://github.com/TechnoVisionDev/Forge-Modding-Tutorial-1.16
synced 2024-10-27 20:34:04 +00:00
Custom Tools
This commit is contained in:
parent
6b3eb0f676
commit
e34e51e48c
@ -0,0 +1,60 @@
|
|||||||
|
package com.technovision.tutorial.tools;
|
||||||
|
|
||||||
|
import com.technovision.tutorial.util.RegistryHandler;
|
||||||
|
import net.minecraft.item.IItemTier;
|
||||||
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
public enum ModItemTier implements IItemTier {
|
||||||
|
|
||||||
|
RUBY(2, 800, 7.0F, 3.0F, 12, () -> {
|
||||||
|
return Ingredient.fromItems(RegistryHandler.RUBY_SWORD.get());
|
||||||
|
});
|
||||||
|
|
||||||
|
private final int harvestLevel;
|
||||||
|
private final int maxUses;
|
||||||
|
private final float efficiency;
|
||||||
|
private final float attackDamage;
|
||||||
|
private final int enchantability;
|
||||||
|
private final Supplier<Ingredient> repairMaterial;
|
||||||
|
|
||||||
|
ModItemTier(int harvestLevel, int maxUses, float efficiency, float attackDamage, int enchantability, Supplier<Ingredient> repairMaterial) {
|
||||||
|
this.harvestLevel = harvestLevel;
|
||||||
|
this.maxUses = maxUses;
|
||||||
|
this.efficiency = efficiency;
|
||||||
|
this.attackDamage = attackDamage;
|
||||||
|
this.enchantability = enchantability;
|
||||||
|
this.repairMaterial = repairMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxUses() {
|
||||||
|
return maxUses;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getEfficiency() {
|
||||||
|
return efficiency;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getAttackDamage() {
|
||||||
|
return attackDamage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHarvestLevel() {
|
||||||
|
return harvestLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getEnchantability() {
|
||||||
|
return enchantability;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Ingredient getRepairMaterial() {
|
||||||
|
return repairMaterial.get();
|
||||||
|
}
|
||||||
|
}
|
@ -4,8 +4,9 @@ import com.technovision.tutorial.Tutorial;
|
|||||||
import com.technovision.tutorial.blocks.BlockItemBase;
|
import com.technovision.tutorial.blocks.BlockItemBase;
|
||||||
import com.technovision.tutorial.blocks.RubyBlock;
|
import com.technovision.tutorial.blocks.RubyBlock;
|
||||||
import com.technovision.tutorial.items.ItemBase;
|
import com.technovision.tutorial.items.ItemBase;
|
||||||
|
import com.technovision.tutorial.tools.ModItemTier;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.*;
|
||||||
import net.minecraftforge.fml.RegistryObject;
|
import net.minecraftforge.fml.RegistryObject;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
import net.minecraftforge.registries.DeferredRegister;
|
import net.minecraftforge.registries.DeferredRegister;
|
||||||
@ -24,6 +25,22 @@ public class RegistryHandler {
|
|||||||
// Items
|
// Items
|
||||||
public static final RegistryObject<Item> RUBY = ITEMS.register("ruby", ItemBase::new);
|
public static final RegistryObject<Item> RUBY = ITEMS.register("ruby", ItemBase::new);
|
||||||
|
|
||||||
|
// Tools
|
||||||
|
public static final RegistryObject<SwordItem> RUBY_SWORD = ITEMS.register("ruby_sword", () ->
|
||||||
|
new SwordItem(ModItemTier.RUBY, 2, -2.4F, new Item.Properties().group(Tutorial.TAB)));
|
||||||
|
|
||||||
|
public static final RegistryObject<PickaxeItem> RUBY_PICKAXE = ITEMS.register("ruby_pickaxe", () ->
|
||||||
|
new PickaxeItem(ModItemTier.RUBY, 0, -2.8F, new Item.Properties().group(Tutorial.TAB)));
|
||||||
|
|
||||||
|
public static final RegistryObject<ShovelItem> RUBY_SHOVEL = ITEMS.register("ruby_shovel", () ->
|
||||||
|
new ShovelItem(ModItemTier.RUBY,0.5F, -3.0F, new Item.Properties().group(Tutorial.TAB)));
|
||||||
|
|
||||||
|
public static final RegistryObject<AxeItem> RUBY_AXE = ITEMS.register("ruby_axe", () ->
|
||||||
|
new AxeItem(ModItemTier.RUBY, 5, -3.1F, new Item.Properties().group(Tutorial.TAB)));
|
||||||
|
|
||||||
|
public static final RegistryObject<HoeItem> RUBY_HOE = ITEMS.register("ruby_hoe", () ->
|
||||||
|
new HoeItem(ModItemTier.RUBY, -1.0F, new Item.Properties().group(Tutorial.TAB)));
|
||||||
|
|
||||||
// Blocks
|
// Blocks
|
||||||
public static final RegistryObject<Block> RUBY_BLOCK = BLOCKS.register("ruby_block", RubyBlock::new);
|
public static final RegistryObject<Block> RUBY_BLOCK = BLOCKS.register("ruby_block", RubyBlock::new);
|
||||||
|
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
{
|
{
|
||||||
"item.tutorial.ruby": "Ruby",
|
"item.tutorial.ruby": "Ruby",
|
||||||
"block.tutorial.ruby_block": "Block of Ruby",
|
"block.tutorial.ruby_block": "Block of Ruby",
|
||||||
"itemGroup.tutorialTab": "Tutorial"
|
"itemGroup.tutorialTab": "Tutorial",
|
||||||
|
"item.tutorial.ruby_sword": "Ruby Sword",
|
||||||
|
"item.tutorial.ruby_pickaxe": "Ruby Pickaxe",
|
||||||
|
"item.tutorial.ruby_shovel": "Ruby Shovel",
|
||||||
|
"item.tutorial.ruby_axe": "Ruby Axe",
|
||||||
|
"item.tutorial.ruby_hoe": "Ruby Hoe"
|
||||||
}
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "item/handheld",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "tutorial:items/ruby_axe"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "item/handheld",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "tutorial:items/ruby_hoe"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "item/handheld",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "tutorial:items/ruby_pickaxe"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "item/handheld",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "tutorial:items/ruby_shovel"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "item/handheld",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "tutorial:items/ruby_sword"
|
||||||
|
}
|
||||||
|
}
|
BIN
src/main/resources/assets/tutorial/textures/items/ruby_axe.png
Normal file
BIN
src/main/resources/assets/tutorial/textures/items/ruby_axe.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 275 B |
BIN
src/main/resources/assets/tutorial/textures/items/ruby_hoe.png
Normal file
BIN
src/main/resources/assets/tutorial/textures/items/ruby_hoe.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 159 B |
Binary file not shown.
After Width: | Height: | Size: 303 B |
Binary file not shown.
After Width: | Height: | Size: 276 B |
BIN
src/main/resources/assets/tutorial/textures/items/ruby_sword.png
Normal file
BIN
src/main/resources/assets/tutorial/textures/items/ruby_sword.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 273 B |
16
src/main/resources/data/tutorial/recipes/ruby.json
Normal file
16
src/main/resources/data/tutorial/recipes/ruby.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shapeless",
|
||||||
|
"ingredients": [
|
||||||
|
{
|
||||||
|
"item": "minecraft:emerald"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"item": "minecraft:red_dye"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"result":
|
||||||
|
{
|
||||||
|
"item": "tutorial:ruby",
|
||||||
|
"count": 3
|
||||||
|
}
|
||||||
|
}
|
25
src/main/resources/data/tutorial/recipes/ruby_block.json
Normal file
25
src/main/resources/data/tutorial/recipes/ruby_block.json
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"pattern":
|
||||||
|
[
|
||||||
|
"xxx",
|
||||||
|
"xdx",
|
||||||
|
"xxx"
|
||||||
|
],
|
||||||
|
"key":
|
||||||
|
{
|
||||||
|
"x":
|
||||||
|
{
|
||||||
|
"item": "tutorial:ruby"
|
||||||
|
},
|
||||||
|
"d":
|
||||||
|
{
|
||||||
|
"item": "minecraft:diamond"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"result":
|
||||||
|
{
|
||||||
|
"item": "tutorial:ruby_block",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
9
src/main/resources/data/tutorial/recipes/ruby_smelt.json
Normal file
9
src/main/resources/data/tutorial/recipes/ruby_smelt.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:smelting",
|
||||||
|
"ingredient": {
|
||||||
|
"item": "minecraft:emerald"
|
||||||
|
},
|
||||||
|
"result": "tutorial:ruby",
|
||||||
|
"experience": 1.0,
|
||||||
|
"cookingtime": 100
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user