Skip to content

Commit

Permalink
Added Copper Tools
Browse files Browse the repository at this point in the history
  • Loading branch information
xYundy committed Mar 7, 2024
1 parent 3931fdf commit 937f257
Show file tree
Hide file tree
Showing 20 changed files with 200 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.20.1+build.10
loader_version=0.15.7

# Mod Properties
mod_version=0.1.0
mod_version=0.2.0
maven_group=pl.xyundy.squaredadditions
archives_base_name=squaredadditions

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// 1.20.1 2024-03-07T23:18:18.414589 Squared Additions/Model Definitions
71776dfec5b5f01ce4a9d3b3e000c3bf53bd5bf5 assets/squaredadditions/models/item/copper_shovel.json
5dc59b79a3e713f07045de3613f4ed4b3e29befc assets/squaredadditions/models/item/copper_sword.json
32fe678c1527b64ea225930db2db5251c0a7ba7a assets/squaredadditions/models/item/copper_pickaxe.json
f6bd2f2c35340d899a2928bdacb127ca28140e3d assets/squaredadditions/models/item/copper_hoe.json
e707267f36198cf7a546e3b58db73fa98b8e056a assets/squaredadditions/models/item/copper_axe.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "squaredadditions:item/copper_axe"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "squaredadditions:item/copper_hoe"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "squaredadditions:item/copper_pickaxe"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "squaredadditions:item/copper_shovel"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "squaredadditions:item/copper_sword"
}
}
12 changes: 4 additions & 8 deletions src/main/java/pl/xyundy/squaredadditions/SquaredAdditions.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,15 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pl.xyundy.squaredadditions.item.ModItems;

public class SquaredAdditions implements ModInitializer {
// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
public static final Logger LOGGER = LoggerFactory.getLogger("squaredadditions");
public static final String MOD_ID = "squaredadditions";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);

@Override
public void onInitialize() {
// This code runs as soon as Minecraft is in a mod-load-ready state.
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.

ModItems.registerModItems();
LOGGER.info("SquaredAdditions initialized!");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import pl.xyundy.squaredadditions.datagen.ModModelProvider;

public class SquaredAdditionsDataGenerator implements DataGeneratorEntrypoint {
@Override
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
FabricDataGenerator.Pack pack = fabricDataGenerator.createPack();

pack.addProvider(ModModelProvider::new);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package pl.xyundy.squaredadditions.datagen;

import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider;
import net.minecraft.data.client.BlockStateModelGenerator;
import net.minecraft.data.client.ItemModelGenerator;
import pl.xyundy.squaredadditions.item.ModItems;
import net.minecraft.data.client.Models;
public class ModModelProvider extends FabricModelProvider {
public ModModelProvider(FabricDataOutput output) {
super(output);
}

@Override
public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) {

}

@Override
public void generateItemModels(ItemModelGenerator itemModelGenerator) {
itemModelGenerator.register(ModItems.COPPER_SWORD, Models.HANDHELD);
itemModelGenerator.register(ModItems.COPPER_PICKAXE, Models.HANDHELD);
itemModelGenerator.register(ModItems.COPPER_SHOVEL, Models.HANDHELD);
itemModelGenerator.register(ModItems.COPPER_AXE, Models.HANDHELD);
itemModelGenerator.register(ModItems.COPPER_HOE, Models.HANDHELD);
}
}
49 changes: 49 additions & 0 deletions src/main/java/pl/xyundy/squaredadditions/item/ModItems.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package pl.xyundy.squaredadditions.item;

import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.item.*;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import pl.xyundy.squaredadditions.SquaredAdditions;

public class ModItems {

public static final Item COPPER_SWORD = registerItem("copper_sword",
new SwordItem(ModToolMaterial.COPPER_INGOT, 2, 2f, new FabricItemSettings()));
public static final Item COPPER_PICKAXE = registerItem("copper_pickaxe",
new PickaxeItem(ModToolMaterial.COPPER_INGOT, 1, 1f, new FabricItemSettings()));
public static final Item COPPER_SHOVEL = registerItem("copper_shovel",
new ShovelItem(ModToolMaterial.COPPER_INGOT, 0, 0f, new FabricItemSettings()));
public static final Item COPPER_AXE = registerItem("copper_axe",
new AxeItem(ModToolMaterial.COPPER_INGOT, 6, -2f, new FabricItemSettings()));
public static final Item COPPER_HOE = registerItem("copper_hoe",
new HoeItem(ModToolMaterial.COPPER_INGOT, 0, 0f, new FabricItemSettings()));



private static Item registerItem(String name, Item item) {
return Registry.register(Registries.ITEM, new Identifier(SquaredAdditions.MOD_ID, name), item);
}


public static void itemGroupCombat(FabricItemGroupEntries entries) {
entries.add(COPPER_SWORD);
entries.add(COPPER_PICKAXE);
}
public static void itemGroupTools(FabricItemGroupEntries entries) {
entries.add(COPPER_PICKAXE);
entries.add(COPPER_SHOVEL);
entries.add(COPPER_AXE);
entries.add(COPPER_HOE);
}

public static void registerModItems() {
SquaredAdditions.LOGGER.info("Registering Mod Items for " + SquaredAdditions.MOD_ID);

ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register(ModItems::itemGroupTools);
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register(ModItems::itemGroupCombat);
}
}
59 changes: 59 additions & 0 deletions src/main/java/pl/xyundy/squaredadditions/item/ModToolMaterial.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package pl.xyundy.squaredadditions.item;

import net.minecraft.item.Items;
import net.minecraft.item.ToolMaterial;
import net.minecraft.recipe.Ingredient;
import net.minecraft.util.Lazy;

import java.util.function.Supplier;

public enum ModToolMaterial implements ToolMaterial {
COPPER_INGOT(5, 1500, 11.0f, 5.0f, 28, () -> Ingredient.ofItems(Items.COPPER_INGOT));

private final int miningLevel;
private final int itemDurability;
private final float miningSpeed;
private final float attackDamage;
private final int enchantability;
private final Lazy<Ingredient> repairIngredient;

ModToolMaterial(int miningLevel, int itemDurability, float miningSpeed, float attackDamage,
int enchantability, Supplier<Ingredient> repairIngredient) {
this.miningLevel = miningLevel;
this.itemDurability = itemDurability;
this.miningSpeed = miningSpeed;
this.attackDamage = attackDamage;
this.enchantability = enchantability;
this.repairIngredient = new Lazy<>(repairIngredient);
}

@Override
public int getDurability() {
return this.itemDurability;
}

@Override
public float getMiningSpeedMultiplier() {
return this.miningSpeed;
}

@Override
public float getAttackDamage() {
return this.attackDamage;
}

@Override
public int getMiningLevel() {
return this.miningLevel;
}

@Override
public int getEnchantability() {
return this.enchantability;
}

@Override
public Ingredient getRepairIngredient() {
return this.repairIngredient.get();
}
}
8 changes: 7 additions & 1 deletion src/main/resources/assets/squaredadditions/lang/de_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@
"_comment2": "Copying English entries will cause them to become outdated when this file changes",
"_comment3": "Untranslated entries will automatically be inherited from this file.",
"_comment4": "Once again, don't copy from English, and THANK YOU for your hard work!",
"_comment5": "Hinweis für Übersetzer: KOPIEREN SIE KEINE EINTRÄGE AUS DEM ENGLISCHEN"
"_comment5": "Hinweis für Übersetzer: KOPIEREN SIE KEINE EINTRÄGE AUS DEM ENGLISCHEN",

"item.squaredadditions.copper_sword": "Kupfer Schwert",
"item.squaredadditions.copper_shovel": "Kupfer Schaufel",
"item.squaredadditions.copper_hoe": "Kupfer Hacke",
"item.squaredadditions.copper_axe": "Kupfer Axt",
"item.squaredadditions.copper_pickaxe": "Kupfer Spitzhacke"
}
8 changes: 7 additions & 1 deletion src/main/resources/assets/squaredadditions/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@
"_comment1": "I repeat: do NOT copy entries from English!!",
"_comment2": "Copying English entries will cause them to become outdated when this file changes",
"_comment3": "Untranslated entries will automatically be inherited from this file.",
"_comment4": "Once again, don't copy from English, and THANK YOU for your hard work!"
"_comment4": "Once again, don't copy from English, and THANK YOU for your hard work!",

"item.squaredadditions.copper_sword": "Copper Sword",
"item.squaredadditions.copper_shovel": "Copper Shovel",
"item.squaredadditions.copper_hoe": "Copper Hoe",
"item.squaredadditions.copper_axe": "Copper Axe",
"item.squaredadditions.copper_pickaxe": "Copper Pickaxe"
}
8 changes: 7 additions & 1 deletion src/main/resources/assets/squaredadditions/lang/pl_pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@
"_comment2": "Copying English entries will cause them to become outdated when this file changes",
"_comment3": "Untranslated entries will automatically be inherited from this file.",
"_comment4": "Once again, don't copy from English, and THANK YOU for your hard work!",
"_comment5": "Uwaga dla tłumaczy: NIE KOPIUJ WPISÓW Z JĘZYKA ANGIELSKIEGO"
"_comment5": "Uwaga dla tłumaczy: NIE KOPIUJ WPISÓW Z JĘZYKA ANGIELSKIEGO",

"item.squaredadditions.copper_sword": "Miedziany Miecz",
"item.squaredadditions.copper_shovel": "Miedziana Łopata",
"item.squaredadditions.copper_hoe": "Miedziana Motyka",
"item.squaredadditions.copper_axe": "Miedziana Siekiera",
"item.squaredadditions.copper_pickaxe": "Miedziany Kilof"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 937f257

Please sign in to comment.