This commit is contained in:
parent
cd04ee146c
commit
7e10655ca7
@ -19,7 +19,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fabricApi {
|
fabricApi {
|
||||||
configureDataGeneration {
|
configureDataGeneration() {
|
||||||
client = true
|
client = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
package basic.vfngamingmod;
|
package basic.vfngamingmod;
|
||||||
|
|
||||||
|
import basic.vfngamingmod.recipes.datagen.VFNGamingRecipeProvider;
|
||||||
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
|
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
|
||||||
|
|
||||||
public class VFNGamingModDataGenerator implements DataGeneratorEntrypoint {
|
public class VFNGamingModDataGenerator implements DataGeneratorEntrypoint {
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
|
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
|
||||||
|
FabricDataGenerator.Pack pack = fabricDataGenerator.createPack();
|
||||||
|
pack.addProvider(VFNGamingRecipeProvider::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
34
src/main/java/basic/vfngamingmod/VFNGamingModLogger.java
Normal file
34
src/main/java/basic/vfngamingmod/VFNGamingModLogger.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package basic.vfngamingmod;
|
||||||
|
|
||||||
|
import net.fabricmc.api.ModInitializer;
|
||||||
|
|
||||||
|
import net.fabricmc.loader.impl.util.log.LogLevel;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
public class VFNGamingModLogger 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.
|
||||||
|
private static Logger _instance;
|
||||||
|
private LogLevel logLevel;
|
||||||
|
public static final String MOD_ID = "vfngamingmod";
|
||||||
|
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.
|
||||||
|
|
||||||
|
LOGGER.info("Hello Fabric world!");
|
||||||
|
_instance = LOGGER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Logger getInstance() {
|
||||||
|
if(_instance == null){
|
||||||
|
_instance = LoggerFactory.getLogger(MOD_ID);
|
||||||
|
}
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
package basic.vfngamingmod.recipes.datagen;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
import net.minecraft.data.recipe.RecipeExporter;
|
||||||
|
import net.minecraft.data.recipe.RecipeGenerator;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
|
import net.minecraft.recipe.book.RecipeCategory;
|
||||||
|
import net.minecraft.registry.RegistryKeys;
|
||||||
|
import net.minecraft.registry.RegistryWrapper;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||||
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
|
||||||
|
|
||||||
|
public class VFNGamingRecipeProvider extends FabricRecipeProvider {
|
||||||
|
public VFNGamingRecipeProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||||
|
super(output, registriesFuture);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected RecipeGenerator getRecipeGenerator(RegistryWrapper.WrapperLookup registryLookup, RecipeExporter exporter) {
|
||||||
|
return new RecipeGenerator(registryLookup, exporter) {
|
||||||
|
@Override
|
||||||
|
public void generate() {
|
||||||
|
RegistryWrapper.Impl<Item> itemLookup = registries.getOrThrow(RegistryKeys.ITEM);
|
||||||
|
createShapeless(RecipeCategory.MISC, Items.QUARTZ, 4) // You can also specify an int to produce more than one
|
||||||
|
.input(Items.QUARTZ_BLOCK) // You can also specify an int to require more than one, or a tag to accept multiple things
|
||||||
|
// Create an advancement that gives you the recipe
|
||||||
|
.criterion(hasItem(Items.QUARTZ_BLOCK), conditionsFromItem(Items.QUARTZ_BLOCK))
|
||||||
|
.offerTo(exporter);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "VFNGamingRecipeProvider";
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
src/main/resources/assets/vfngamingmod/VFNFull.png
Normal file
BIN
src/main/resources/assets/vfngamingmod/VFNFull.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 72 KiB |
@ -3,20 +3,21 @@
|
|||||||
"id": "vfngamingmod",
|
"id": "vfngamingmod",
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
"name": "VFNGamingMod",
|
"name": "VFNGamingMod",
|
||||||
"description": "This is an example description! Tell everyone what your mod is about!",
|
"description": "Mod für den VFN Gaming Server",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Me!"
|
"Marius Rometsch"
|
||||||
],
|
],
|
||||||
"contact": {
|
"contact": {
|
||||||
"homepage": "https://fabricmc.net/",
|
"homepage": "https://vfn-gaming.org",
|
||||||
"sources": "https://github.com/FabricMC/fabric-example-mod"
|
"sources": "https://git.vfn-gaming.org/VFN/vfngamingmod-fabric"
|
||||||
},
|
},
|
||||||
"license": "CC0-1.0",
|
"license": "CC0-1.0",
|
||||||
"icon": "assets/vfngamingmod/icon.png",
|
"icon": "assets/vfngamingmod/VFNFull.png",
|
||||||
"environment": "*",
|
"environment": "*",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"main": [
|
"main": [
|
||||||
"basic.vfngamingmod.VFNGamingMod"
|
"basic.vfngamingmod.VFNGamingMod",
|
||||||
|
"basic.vfngamingmod.VFNGamingModLogger"
|
||||||
],
|
],
|
||||||
"fabric-datagen": [
|
"fabric-datagen": [
|
||||||
"basic.vfngamingmod.VFNGamingModDataGenerator"
|
"basic.vfngamingmod.VFNGamingModDataGenerator"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user