Compare commits

..

No commits in common. "1.21.2" and "1.19" have entirely different histories.
1.21.2 ... 1.19

24 changed files with 236 additions and 147 deletions

View File

@ -3,8 +3,8 @@ plugins {
id 'maven-publish' id 'maven-publish'
} }
sourceCompatibility = JavaVersion.VERSION_21 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_17
archivesBaseName = project.archives_base_name archivesBaseName = project.archives_base_name
version = project.mod_version version = project.mod_version
@ -43,8 +43,7 @@ processResources {
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17. // Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
// Minecraft 1.20.5 upwards uses Java 21. it.options.release = 17
it.options.release = 21
} }
java { java {

View File

@ -4,14 +4,14 @@ org.gradle.parallel=true
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/develop # check these on https://fabricmc.net/develop
minecraft_version=1.21.2 minecraft_version=1.19.3
yarn_mappings=1.21.2+build.1 yarn_mappings=1.19.3+build.5
loader_version=0.16.9 loader_version=0.16.9
# Mod Properties # Mod Properties
mod_version = 1.0.2-1.21.2 mod_version = 1.0.2-1.19
maven_group = me.daviddgtnt maven_group = me.daviddgtnt
archives_base_name = stringtools archives_base_name = stringtools
# Dependencies # Dependencies
fabric_version=0.106.1+1.21.2 fabric_version=0.76.1+1.19.3

View File

@ -0,0 +1,10 @@
package me.daviddgtnt.stringtools;
import net.minecraft.item.AxeItem;
import net.minecraft.item.ToolMaterial;
public class CustomAxeItem extends AxeItem {
public CustomAxeItem(ToolMaterial material, float attackDamage, float attackSpeed, Settings settings) {
super(material, attackDamage, attackSpeed, settings);
}
}

View File

@ -0,0 +1,10 @@
package me.daviddgtnt.stringtools;
import net.minecraft.item.HoeItem;
import net.minecraft.item.ToolMaterial;
public class CustomHoeItem extends HoeItem {
public CustomHoeItem(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) {
super(material, attackDamage, attackSpeed, settings);
}
}

View File

@ -0,0 +1,10 @@
package me.daviddgtnt.stringtools;
import net.minecraft.item.PickaxeItem;
import net.minecraft.item.ToolMaterial;
public class CustomPickaxeItem extends PickaxeItem {
public CustomPickaxeItem(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) {
super(material, attackDamage, attackSpeed, settings);
}
}

View File

@ -1,32 +1,38 @@
package me.daviddgtnt.stringtools; package me.daviddgtnt.stringtools;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.item.*; import net.minecraft.item.Item;
import net.minecraft.item.ItemGroups;
import net.minecraft.item.Items;
import net.minecraft.item.ShovelItem;
import net.minecraft.item.SwordItem;
import net.minecraft.item.ToolItem;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class Main implements ModInitializer { public class Main implements ModInitializer {
public static final Item STRING_STICK = new Item(new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of("stringtools","string_stick" )))); public static final Item STRING_STICK = new Item(new FabricItemSettings());
public static final SwordItem STRING_SWORD = new SwordItem(StringToolMaterial.INSTANCE, 4, 1.6F, new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of("stringtools", "string_sword")))); public static final ToolItem STRING_SWORD = new SwordItem(StringToolMaterial.INSTANCE, 4, 1.6F, new Item.Settings());
public static final MiningToolItem STRING_PICKAXE = new PickaxeItem(StringToolMaterial.INSTANCE, 2.0F, 2.4F, new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of("stringtools", "string_pickaxe")))); public static final ToolItem STRING_PICKAXE = new CustomPickaxeItem(StringToolMaterial.INSTANCE, 2, 2.4F, new Item.Settings());
public static final MiningToolItem STRING_AXE = new AxeItem(StringToolMaterial.INSTANCE, 7.0F, 0.8F, new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of("stringtools", "string_axe")))); public static final ToolItem STRING_AXE = new CustomAxeItem(StringToolMaterial.INSTANCE, 7.0F, 0.8F, new Item.Settings());
public static final MiningToolItem STRING_SHOVEL = new ShovelItem(StringToolMaterial.INSTANCE, 2.5F, 1.0F, new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of("stringtools", "string_shovel")))); public static final ToolItem STRING_SHOVEL = new ShovelItem(StringToolMaterial.INSTANCE, 2.5F, 1F, new Item.Settings());
public static final MiningToolItem STRING_HOE = new HoeItem(StringToolMaterial.INSTANCE, 1.0F, 1.0F, new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of("stringtools", "string_hoe")))); public static final ToolItem STRING_HOE = new CustomHoeItem(StringToolMaterial.INSTANCE, 1, 1.0F, new Item.Settings());
@Override @Override
public void onInitialize() { public void onInitialize() {
Registry.register(Registries.ITEM, Identifier.of("stringtools", "string_stick"), STRING_STICK); Registry.register(Registries.ITEM, new Identifier("stringtools", "string_stick"), STRING_STICK);
Registry.register(Registries.ITEM, Identifier.of("stringtools", "string_sword"), STRING_SWORD); Registry.register(Registries.ITEM, new Identifier("stringtools", "string_sword"), STRING_SWORD);
Registry.register(Registries.ITEM, Identifier.of("stringtools", "string_pickaxe"), STRING_PICKAXE); Registry.register(Registries.ITEM, new Identifier("stringtools", "string_pickaxe"), STRING_PICKAXE);
Registry.register(Registries.ITEM, Identifier.of("stringtools", "string_axe"), STRING_AXE); Registry.register(Registries.ITEM, new Identifier("stringtools", "string_axe"), STRING_AXE);
Registry.register(Registries.ITEM, Identifier.of("stringtools", "string_shovel"), STRING_SHOVEL); Registry.register(Registries.ITEM, new Identifier("stringtools", "string_shovel"), STRING_SHOVEL);
Registry.register(Registries.ITEM, Identifier.of("stringtools", "string_hoe"), STRING_HOE); Registry.register(Registries.ITEM, new Identifier("stringtools", "string_hoe"), STRING_HOE);
ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(content -> content.addBefore(Items.STICK, STRING_STICK)); ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(content -> {
content.addBefore(Items.STICK, STRING_STICK);
});
ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register(content -> { ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register(content -> {
content.addBefore(Items.WOODEN_SHOVEL, STRING_HOE); content.addBefore(Items.WOODEN_SHOVEL, STRING_HOE);

View File

@ -1,11 +1,41 @@
package me.daviddgtnt.stringtools; package me.daviddgtnt.stringtools;
import net.minecraft.item.Items;
import net.minecraft.item.ToolMaterial; import net.minecraft.item.ToolMaterial;
import net.minecraft.registry.RegistryKeys; import net.minecraft.recipe.Ingredient;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.registry.tag.TagKey; public class StringToolMaterial implements ToolMaterial {
import net.minecraft.util.Identifier; public static final StringToolMaterial INSTANCE = new StringToolMaterial();
@Override
public int getDurability() {
return 1;
}
@Override
public float getMiningSpeedMultiplier() {
return 2.0F;
}
@Override
public float getAttackDamage() {
return 0.0F;
}
@Override
public int getMiningLevel() {
return 0;
}
@Override
public int getEnchantability() {
return 15;
}
@Override
public Ingredient getRepairIngredient() {
return Ingredient.ofItems(Items.STRING);
}
public class StringToolMaterial {
public static final ToolMaterial INSTANCE = new ToolMaterial(BlockTags.INCORRECT_FOR_WOODEN_TOOL, 1, 2.0F, 0.0F, 15, TagKey.of(RegistryKeys.ITEM, Identifier.of("stringtools", "string")));
} }

View File

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"minecraft:string"
]
}

View File

@ -1,15 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"SS",
"TS",
"T "
],
"key": {
"S": "minecraft:string",
"T": "stringtools:string_stick"
},
"result": {
"id": "stringtools:string_axe"
}
}

View File

@ -1,15 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"SS",
"ST",
" T"
],
"key": {
"S": "minecraft:string",
"T": "stringtools:string_stick"
},
"result": {
"id": "stringtools:string_axe"
}
}

View File

@ -1,15 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"SS",
" T",
" T"
],
"key": {
"S": "minecraft:string",
"T": "stringtools:string_stick"
},
"result": {
"id": "stringtools:string_hoe"
}
}

View File

@ -1,15 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"SS",
"T ",
"T "
],
"key": {
"S": "minecraft:string",
"T": "stringtools:string_stick"
},
"result": {
"id": "stringtools:string_hoe"
}
}

View File

@ -1,15 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"SSS",
" T ",
" T "
],
"key": {
"S": "minecraft:string",
"T": "stringtools:string_stick"
},
"result": {
"id": "stringtools:string_pickaxe"
}
}

View File

@ -1,15 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"S",
"T",
"T"
],
"key": {
"S": "minecraft:string",
"T": "stringtools:string_stick"
},
"result": {
"id": "stringtools:string_shovel"
}
}

View File

@ -1,15 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"S",
"S",
"T"
],
"key": {
"S": "minecraft:string",
"T": "stringtools:string_stick"
},
"result": {
"id": "stringtools:string_sword"
}
}

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"SS",
"TS",
"T "
],
"key": {
"S": {
"item": "minecraft:string"
},
"T": {
"item": "stringtools:string_stick"
}
},
"result": {
"item": "stringtools:string_axe"
}
}

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"SS",
"ST",
" T"
],
"key": {
"S": {
"item": "minecraft:string"
},
"T": {
"item": "stringtools:string_stick"
}
},
"result": {
"item": "stringtools:string_axe"
}
}

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"SS",
" T",
" T"
],
"key": {
"S": {
"item": "minecraft:string"
},
"T": {
"item": "stringtools:string_stick"
}
},
"result": {
"item": "stringtools:string_hoe"
}
}

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"SS",
"T ",
"T "
],
"key": {
"S": {
"item": "minecraft:string"
},
"T": {
"item": "stringtools:string_stick"
}
},
"result": {
"item": "stringtools:string_hoe"
}
}

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"SSS",
" T ",
" T "
],
"key": {
"S": {
"item": "minecraft:string"
},
"T": {
"item": "stringtools:string_stick"
}
},
"result": {
"item": "stringtools:string_pickaxe"
}
}

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"S",
"T",
"T"
],
"key": {
"S": {
"item": "minecraft:string"
},
"T": {
"item": "stringtools:string_stick"
}
},
"result": {
"item": "stringtools:string_shovel"
}
}

View File

@ -5,10 +5,12 @@
"S" "S"
], ],
"key": { "key": {
"S": "minecraft:string" "S": {
"item": "minecraft:string"
}
}, },
"result": { "result": {
"id": "stringtools:string_stick", "item": "stringtools:string_stick",
"count": 4 "count": 4
} }
} }

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"S",
"S",
"T"
],
"key": {
"S": {
"item": "minecraft:string"
},
"T": {
"item": "stringtools:string_stick"
}
},
"result": {
"item": "stringtools:string_sword"
}
}

View File

@ -1,7 +1,7 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"id": "stringtools", "id": "stringtools",
"version": "1.0.2-1.21.2", "version": "1.0.2-1.19",
"name": "String Tools", "name": "String Tools",
"description": "Single use tools made out of string!", "description": "Single use tools made out of string!",
@ -26,7 +26,7 @@
"depends": { "depends": {
"fabricloader": ">=0.16.9", "fabricloader": ">=0.16.9",
"fabric-api": "*", "fabric-api": "*",
"minecraft": "~1.21.2", "minecraft": "~1.19.3",
"java": ">=21" "java": ">=17"
} }
} }