diff --git a/gradle.properties b/gradle.properties index 9516bab..8643f48 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,7 @@ # Sets default memory used for gradle commands. Can be overridden by user or command line properties. -org.gradle.jvmargs=-Xmx1G +#org.gradle.jvmargs=-Xmx1G +org.gradle.jvmargs=-Xmx2048m + org.gradle.daemon=true org.gradle.parallel=true org.gradle.caching=true diff --git a/src/main/java/com/github/herat/GemCraft/common/datagen/GCBlockStatesProvider/GCBlockStatesProvider.java b/src/main/java/com/github/herat/GemCraft/common/datagen/GCBlockStatesProvider.java similarity index 87% rename from src/main/java/com/github/herat/GemCraft/common/datagen/GCBlockStatesProvider/GCBlockStatesProvider.java rename to src/main/java/com/github/herat/GemCraft/common/datagen/GCBlockStatesProvider.java index 35daf95..f7b7675 100644 --- a/src/main/java/com/github/herat/GemCraft/common/datagen/GCBlockStatesProvider/GCBlockStatesProvider.java +++ b/src/main/java/com/github/herat/GemCraft/common/datagen/GCBlockStatesProvider.java @@ -1,4 +1,4 @@ -package com.github.herat.GemCraft.common.datagen.GCBlockStatesProvider; +package com.github.herat.GemCraft.common.datagen; import net.minecraft.data.PackOutput; import net.neoforged.neoforge.client.model.generators.BlockStateProvider; diff --git a/src/main/java/com/github/herat/GemCraft/common/datagen/GCDataGeneratorHandler.java b/src/main/java/com/github/herat/GemCraft/common/datagen/GCDataGeneratorHandler.java index d77a16e..cfa060a 100644 --- a/src/main/java/com/github/herat/GemCraft/common/datagen/GCDataGeneratorHandler.java +++ b/src/main/java/com/github/herat/GemCraft/common/datagen/GCDataGeneratorHandler.java @@ -1,8 +1,6 @@ package com.github.herat.GemCraft.common.datagen; import com.github.herat.GemCraft.GemCraft; -import com.github.herat.GemCraft.common.datagen.GCBlockStatesProvider.GCBlockStatesProvider; -import com.github.herat.GemCraft.common.datagen.GCModelProvider.GCItemModelProvider; import com.github.herat.GemCraft.common.datagen.LanguageProvider.GCLanguageProvider; import com.github.herat.GemCraft.common.datagen.LanguageProvider.GCLanguageProviderCN; import net.minecraft.data.DataProvider; @@ -19,6 +17,13 @@ public class GCDataGeneratorHandler { @SubscribeEvent public static void gatherData(GatherDataEvent event) { ExistingFileHelper efh = event.getExistingFileHelper(); + var lp = event.getLookupProvider(); + + // recipe + event.getGenerator().addProvider( + event.includeServer(), + (DataProvider.Factory) pOutput -> new GCRecipeProvider(pOutput,lp) + ); //blockstates @@ -47,7 +52,5 @@ public static void gatherData(GatherDataEvent event) { event.includeClient(), (DataProvider.Factory) pOutput -> new GCLanguageProviderCN(pOutput,GemCraft.MODID,"zh_cn") ); - - } } diff --git a/src/main/java/com/github/herat/GemCraft/common/datagen/GCItemModelProvider.java b/src/main/java/com/github/herat/GemCraft/common/datagen/GCItemModelProvider.java new file mode 100644 index 0000000..1e0db9b --- /dev/null +++ b/src/main/java/com/github/herat/GemCraft/common/datagen/GCItemModelProvider.java @@ -0,0 +1,40 @@ +package com.github.herat.GemCraft.common.datagen; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.PackOutput; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.neoforged.neoforge.client.model.generators.ItemModelProvider; +import net.neoforged.neoforge.common.data.ExistingFileHelper; + +import java.util.Objects; + +/** + * @author herat + */ +public class GCItemModelProvider extends ItemModelProvider { + public GCItemModelProvider(PackOutput output, String modid , ExistingFileHelper existingFileHelper) { + super(output,modid,existingFileHelper); + } + + @Override + protected void registerModels() { + this.withExistingParent("ruby",mcLoc("item/generated")).texture("layer0","gemcraft:item/ruby"); + this.withExistingParent("ruby_sword",mcLoc("item/handheld")).texture("layer0","gemcraft:item/ruby_sword"); +// this.withExistingParent("ruby_sword",mcLoc("item/generated")).texture("layer0","gemcraft:item/ruby_sword"); +// this.withExistingParent("ruby_pickaxe",mcLoc("item/generated")).texture("layer0","gemcraft:item/ruby_pickaxe"); +// this.withExistingParent("ruby_shovel",mcLoc("item/generated")).texture("layer0","gemcraft:item/ruby_shovel"); +// this.withExistingParent("ruby_axe",mcLoc("item/generated")).texture("layer0","gemcraft:item/ruby_axe"); +// this.withExistingParent("ruby_hoe",mcLoc("item/generated")).texture("layer0","gemcraft:item/ruby_hoe"); +// this.withExistingParent("sapphire",mcLoc("item/generated")).texture("layer0","gemcraft:item/sapphire"); +// this.withExistingParent("sapphire_sword",mcLoc("item/generated")).texture("layer0","gemcraft:item/sapphire_sword"); +// this.withExistingParent("sapphire_pickaxe",mcLoc("item/generated")).texture("layer0","gemcraft:item/sapphire_pickaxe"); +// this.withExistingParent("ruby_shovel",mcLoc("item/generated")).texture("layer0","gemcraft:item/ruby_shovel"); +// this.withExistingParent("sapphire_axe",mcLoc("item/generated")).texture("layer0","gemcraft:item/sapphire_axe"); +// this.withExistingParent("sapphire_hoe",mcLoc("item/generated")).texture("layer0","gemcraft:item/sapphire_hoe"); + } + + public ResourceLocation getResourceLocation(Item item) { + return Objects.requireNonNull(BuiltInRegistries.ITEM.getKey(item)); + } +} diff --git a/src/main/java/com/github/herat/GemCraft/common/datagen/GCModelProvider/GCItemModelProvider.java b/src/main/java/com/github/herat/GemCraft/common/datagen/GCModelProvider/GCItemModelProvider.java deleted file mode 100644 index ac99407..0000000 --- a/src/main/java/com/github/herat/GemCraft/common/datagen/GCModelProvider/GCItemModelProvider.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.github.herat.GemCraft.common.datagen.GCModelProvider; - -import com.github.herat.GemCraft.common.register.GemCraftItem; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.data.PackOutput; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Item; -import net.neoforged.neoforge.client.model.generators.ItemModelProvider; -import net.neoforged.neoforge.common.data.ExistingFileHelper; - -import java.util.Objects; - -/** - * @author herat - */ -public class GCItemModelProvider extends ItemModelProvider { - public GCItemModelProvider(PackOutput output, String modid , ExistingFileHelper existingFileHelper) { - super(output,modid,existingFileHelper); - } - - @Override - protected void registerModels() { - this.basicItem(GemCraftItem.RUBY.get()); - this.basicItem(GemCraftItem.RUBY_SWORD.get()); - this.basicItem(GemCraftItem.RUBY_PICKAXE.get()); - this.basicItem(GemCraftItem.RUBY_SHOVEL.get()); - this.basicItem(GemCraftItem.RUBY_AXE.get()); - this.basicItem(GemCraftItem.RUBY_HOE.get()); - this.basicItem(GemCraftItem.SAPPHIRE.get()); - this.basicItem(GemCraftItem.SAPPHIRE_SWORD.get()); - this.basicItem(GemCraftItem.SAPPHIRE_PICKAXE.get()); - this.basicItem(GemCraftItem.SAPPHIRE_SHOVEL.get()); - this.basicItem(GemCraftItem.SAPPHIRE_AXE.get()); - this.basicItem(GemCraftItem.SAPPHIRE_HOE.get()); - } - - public ResourceLocation getResourceLocation(Item item) { - return Objects.requireNonNull(BuiltInRegistries.ITEM.getKey(item)); - } -} diff --git a/src/main/java/com/github/herat/GemCraft/common/datagen/GCRecipeProvider.java b/src/main/java/com/github/herat/GemCraft/common/datagen/GCRecipeProvider.java new file mode 100644 index 0000000..363f814 --- /dev/null +++ b/src/main/java/com/github/herat/GemCraft/common/datagen/GCRecipeProvider.java @@ -0,0 +1,34 @@ +package com.github.herat.GemCraft.common.datagen; + +import com.github.herat.GemCraft.common.register.GemCraftItem; +import net.minecraft.core.HolderLookup; +import net.minecraft.data.PackOutput; +import net.minecraft.data.recipes.RecipeCategory; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.data.recipes.RecipeProvider; +import net.minecraft.data.recipes.ShapedRecipeBuilder; +import net.minecraft.world.item.Items; +import org.jetbrains.annotations.NotNull; + +import java.util.concurrent.CompletableFuture; + +/** + * @author herat + */ +public class GCRecipeProvider extends RecipeProvider { + public GCRecipeProvider(PackOutput pPackOutput, CompletableFuture lookupProvider) { + super(pPackOutput, lookupProvider); + } + + @Override + protected void buildRecipes(@NotNull RecipeOutput pRecipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, GemCraftItem.RUBY_SWORD.get()) + .pattern(" a ") + .pattern(" a ") + .pattern(" b ") + .define('a', GemCraftItem.RUBY.get()) + .define('b', Items.STICK) + .save(pRecipeOutput); +// ShapedRecipeBuilder.shaped(RecipeCategory.MISC, GemCraftItem.RUBY_SWORD.get()) + } +} diff --git a/src/main/java/com/github/herat/GemCraft/common/datagen/LanguageProvider/GCLanguageProvider.java b/src/main/java/com/github/herat/GemCraft/common/datagen/LanguageProvider/GCLanguageProvider.java index 5e4c448..5d4d95e 100644 --- a/src/main/java/com/github/herat/GemCraft/common/datagen/LanguageProvider/GCLanguageProvider.java +++ b/src/main/java/com/github/herat/GemCraft/common/datagen/LanguageProvider/GCLanguageProvider.java @@ -21,7 +21,6 @@ protected void addTranslations() { this.add(GemCraftItem.RUBY_SHOVEL.get(),"Ruby Shovel"); this.add(GemCraftItem.RUBY_AXE.get(),"Ruby Axe"); this.add(GemCraftItem.RUBY_HOE.get(),"Ruby Hoe"); - this.add(GemCraftItem.SAPPHIRE_HOE.get(),"Sapphire Hoe"); this.add(GemCraftItem.SAPPHIRE.get(),"Sapphire"); this.add(GemCraftItem.SAPPHIRE_SWORD.get(),"Sapphire Sword"); this.add(GemCraftItem.SAPPHIRE_PICKAXE.get(),"Sapphire Pickaxe"); diff --git a/src/main/java/com/github/herat/GemCraft/common/datagen/LanguageProvider/GCLanguageProviderCN.java b/src/main/java/com/github/herat/GemCraft/common/datagen/LanguageProvider/GCLanguageProviderCN.java index 64cc662..1209aa1 100644 --- a/src/main/java/com/github/herat/GemCraft/common/datagen/LanguageProvider/GCLanguageProviderCN.java +++ b/src/main/java/com/github/herat/GemCraft/common/datagen/LanguageProvider/GCLanguageProviderCN.java @@ -18,15 +18,14 @@ protected void addTranslations() { this.add(GemCraftItem.RUBY.get(),"红宝石"); this.add(GemCraftItem.RUBY_SWORD.get(),"红宝石剑"); this.add(GemCraftItem.RUBY_PICKAXE.get(),"红宝石镐"); - this.add(GemCraftItem.RUBY_SHOVEL.get(),"红宝石铲子"); - this.add(GemCraftItem.RUBY_AXE.get(),"红宝石斧头"); - this.add(GemCraftItem.RUBY_HOE.get(),"红宝石锄头"); - this.add(GemCraftItem.SAPPHIRE_HOE.get(),"蓝宝石锄头"); + this.add(GemCraftItem.RUBY_SHOVEL.get(),"红宝石铲"); + this.add(GemCraftItem.RUBY_AXE.get(),"红宝石斧"); + this.add(GemCraftItem.RUBY_HOE.get(),"红宝石锄"); this.add(GemCraftItem.SAPPHIRE.get(),"蓝宝石"); this.add(GemCraftItem.SAPPHIRE_SWORD.get(),"蓝宝石剑"); this.add(GemCraftItem.SAPPHIRE_PICKAXE.get(),"蓝宝石镐"); - this.add(GemCraftItem.SAPPHIRE_SHOVEL.get(),"蓝宝石铲子"); - this.add(GemCraftItem.SAPPHIRE_AXE.get(),"蓝宝石斧头"); - this.add(GemCraftItem.SAPPHIRE_HOE.get(),"蓝宝石锄头"); + this.add(GemCraftItem.SAPPHIRE_SHOVEL.get(),"蓝宝石铲"); + this.add(GemCraftItem.SAPPHIRE_AXE.get(),"蓝宝石斧"); + this.add(GemCraftItem.SAPPHIRE_HOE.get(),"蓝宝石锄"); } } diff --git a/src/main/resources/assets/gemcraft/models/item/ruby.json b/src/main/resources/assets/gemcraft/models/item/ruby.json deleted file mode 100644 index 95a5a77..0000000 --- a/src/main/resources/assets/gemcraft/models/item/ruby.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:item/generated", - "textures": { - "layer0": "gemcraft:item/ruby" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/gemcraft/models/item/sapphire.json b/src/main/resources/assets/gemcraft/models/item/sapphire.json deleted file mode 100644 index 47827bf..0000000 --- a/src/main/resources/assets/gemcraft/models/item/sapphire.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:item/generated", - "textures": { - "layer0": "gemcraft:item/sapphire" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/gemcraft/textures/item/ruby.png b/src/main/resources/assets/gemcraft/textures/item/ruby.png new file mode 100644 index 0000000..8235a65 Binary files /dev/null and b/src/main/resources/assets/gemcraft/textures/item/ruby.png differ diff --git a/src/main/resources/assets/gemcraft/textures/item/ruby_sword.png b/src/main/resources/assets/gemcraft/textures/item/ruby_sword.png new file mode 100644 index 0000000..24aba06 Binary files /dev/null and b/src/main/resources/assets/gemcraft/textures/item/ruby_sword.png differ