Compare commits

..

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

16 changed files with 66 additions and 32 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.20.5 minecraft_version=1.19.3
yarn_mappings=1.20.5+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.20.5 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.97.8+1.20.5 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,19 +1,25 @@
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.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()); public static final Item STRING_STICK = new Item(new FabricItemSettings());
public static final ToolItem STRING_SWORD = new SwordItem(StringToolMaterial.INSTANCE, new Item.Settings().attributeModifiers(SwordItem.createAttributeModifiers(StringToolMaterial.INSTANCE, 4, 1.6F))); public static final ToolItem STRING_SWORD = new SwordItem(StringToolMaterial.INSTANCE, 4, 1.6F, new Item.Settings());
public static final ToolItem STRING_PICKAXE = new PickaxeItem(StringToolMaterial.INSTANCE, new Item.Settings().attributeModifiers(PickaxeItem.createAttributeModifiers(StringToolMaterial.INSTANCE, 2.0F, 2.4F))); public static final ToolItem STRING_PICKAXE = new CustomPickaxeItem(StringToolMaterial.INSTANCE, 2, 2.4F, new Item.Settings());
public static final ToolItem STRING_AXE = new AxeItem(StringToolMaterial.INSTANCE, new Item.Settings().attributeModifiers(AxeItem.createAttributeModifiers(StringToolMaterial.INSTANCE, 7.0F, 0.8F))); public static final ToolItem STRING_AXE = new CustomAxeItem(StringToolMaterial.INSTANCE, 7.0F, 0.8F, new Item.Settings());
public static final ToolItem STRING_SHOVEL = new ShovelItem(StringToolMaterial.INSTANCE, new Item.Settings().attributeModifiers(ShovelItem.createAttributeModifiers(StringToolMaterial.INSTANCE, 2.5F, 1.0F))); public static final ToolItem STRING_SHOVEL = new ShovelItem(StringToolMaterial.INSTANCE, 2.5F, 1F, new Item.Settings());
public static final ToolItem STRING_HOE = new HoeItem(StringToolMaterial.INSTANCE, new Item.Settings().attributeModifiers(HoeItem.createAttributeModifiers(StringToolMaterial.INSTANCE, 1.0F, 1.0F))); public static final ToolItem STRING_HOE = new CustomHoeItem(StringToolMaterial.INSTANCE, 1, 1.0F, new Item.Settings());
@Override @Override
public void onInitialize() { public void onInitialize() {
@ -24,7 +30,9 @@ public class Main implements ModInitializer {
Registry.register(Registries.ITEM, new Identifier("stringtools", "string_shovel"), STRING_SHOVEL); Registry.register(Registries.ITEM, new Identifier("stringtools", "string_shovel"), STRING_SHOVEL);
Registry.register(Registries.ITEM, new Identifier("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,8 @@
package me.daviddgtnt.stringtools; package me.daviddgtnt.stringtools;
import net.minecraft.block.Block;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.item.ToolMaterial; import net.minecraft.item.ToolMaterial;
import net.minecraft.recipe.Ingredient; import net.minecraft.recipe.Ingredient;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.registry.tag.TagKey;
public class StringToolMaterial implements ToolMaterial { public class StringToolMaterial implements ToolMaterial {
public static final StringToolMaterial INSTANCE = new StringToolMaterial(); public static final StringToolMaterial INSTANCE = new StringToolMaterial();
@ -26,8 +23,8 @@ public class StringToolMaterial implements ToolMaterial {
} }
@Override @Override
public TagKey<Block> getInverseTag() { public int getMiningLevel() {
return BlockTags.INCORRECT_FOR_WOODEN_TOOL; return 0;
} }
@Override @Override

View File

@ -14,6 +14,6 @@
} }
}, },
"result": { "result": {
"id": "stringtools:string_axe" "item": "stringtools:string_axe"
} }
} }

View File

@ -14,6 +14,6 @@
} }
}, },
"result": { "result": {
"id": "stringtools:string_axe" "item": "stringtools:string_axe"
} }
} }

View File

@ -14,6 +14,6 @@
} }
}, },
"result": { "result": {
"id": "stringtools:string_hoe" "item": "stringtools:string_hoe"
} }
} }

View File

@ -14,6 +14,6 @@
} }
}, },
"result": { "result": {
"id": "stringtools:string_hoe" "item": "stringtools:string_hoe"
} }
} }

View File

@ -14,6 +14,6 @@
} }
}, },
"result": { "result": {
"id": "stringtools:string_pickaxe" "item": "stringtools:string_pickaxe"
} }
} }

View File

@ -14,6 +14,6 @@
} }
}, },
"result": { "result": {
"id": "stringtools:string_shovel" "item": "stringtools:string_shovel"
} }
} }

View File

@ -10,7 +10,7 @@
} }
}, },
"result": { "result": {
"id": "stringtools:string_stick", "item": "stringtools:string_stick",
"count": 4 "count": 4
} }
} }

View File

@ -14,6 +14,6 @@
} }
}, },
"result": { "result": {
"id": "stringtools:string_sword" "item": "stringtools:string_sword"
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"id": "stringtools", "id": "stringtools",
"version": "1.0.2-1.20.5", "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.20.5", "minecraft": "~1.19.3",
"java": ">=21" "java": ">=17"
} }
} }