Skip to content

Commit

Permalink
Port to 21.4
Browse files Browse the repository at this point in the history
  • Loading branch information
robotgryphon committed Feb 24, 2025
1 parent 852fd00 commit 510fe4b
Show file tree
Hide file tree
Showing 13 changed files with 112 additions and 110 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/announce-latest-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
with:
webhook-url: ${{ secrets.DISCORD_NIGHTLY_WEBHOOK }}
avatar-url: "https://compactmods.dev/personal-shrinking-device.png"
content: "**New Version Available: Simple Honey v${{ needs.get-package-info.outputs.version }}"
content: "**New Version Available: Simple Honey v${{ needs.get-package-info.outputs.version }}**"
filename: ${{ fromJson(steps.info.outputs.latestJson)[0].name }}
embed-title: "**Mod File Information**"
embed-description: "Filename: ${{ fromJson(steps.info.outputs.latestJson)[0].name}}"
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[versions]
parchmentMC = "1.21"
parchment = "2024.07.28"
parchmentMC = "1.21.4"
parchment = "2025.02.16"
6 changes: 3 additions & 3 deletions gradle/mojang.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
minecraft = "1.21.1"
minecraft = "1.21.4"

[versions.minecraftRange]
require = "[1.21.1, 1.21.2)"
prefer = "1.21.1"
require = "[1.21.4, 1.21.5)"
prefer = "1.21.4"

4 changes: 2 additions & 2 deletions gradle/neoforged.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
neoforge = "21.1.122"
neoforge = "21.4.95-beta"
mdg = "2.0.78"
neoforgeRange = { require = "[21.1.122,)", prefer = "21.1.122" }
neoforgeRange = { require = "[21.4.95-beta,)", prefer = "21.1.95-beta" }

[libraries.testframework]
module = "net.neoforged:testframework"
Expand Down
2 changes: 1 addition & 1 deletion neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ neoForge {
}

this.create("data") {
this.data()
this.clientData()

this.gameDirectory.set(file("runs/data"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import cpw.mods.modlauncher.Environment;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Tuple;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.food.FoodProperties;
Expand Down Expand Up @@ -43,10 +46,14 @@ public class SimpleHoney {
.saturationModifier(0.1f)
.build();

public static ResourceLocation HONEY_RL = ResourceLocation.fromNamespaceAndPath(MOD_ID, "honey_drop");

public static final Item.Properties HONEY_DROP_ITEM_PROPS = new Item.Properties()
.food(HONEY_DROP_FOOD_PROPS);
.food(HONEY_DROP_FOOD_PROPS)
.setId(ResourceKey.create(BuiltInRegistries.ITEM.key(), HONEY_RL));

public static final DeferredItem<Item> HONEY_DROP = ITEMS.register("honey_drop", () -> new Item(HONEY_DROP_ITEM_PROPS));
public static final DeferredItem<Item> HONEY_DROP = ITEMS
.register("honey_drop", () -> new Item(HONEY_DROP_ITEM_PROPS));

public SimpleHoney(IEventBus modEventBus) {
ITEMS.register(modEventBus);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package dev.compactmods.simplehoney.datagen;

import dev.compactmods.simplehoney.SimpleHoney;
import dev.compactmods.simplehoney.datagen.client.ItemAndBlockModels;
import dev.compactmods.simplehoney.datagen.client.lang.EnglishLangGenerator;
import dev.compactmods.simplehoney.datagen.server.SHRecipeProvider;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.data.event.GatherDataEvent;

@EventBusSubscriber(modid = SimpleHoney.MOD_ID, bus = EventBusSubscriber.Bus.MOD)
public class SHDataGeneration {

@SubscribeEvent
public static void gatherData(GatherDataEvent.Client event) {
// Client
event.createProvider(ItemAndBlockModels::new);
event.createProvider(EnglishLangGenerator::new);

// Server
event.createProvider(SHRecipeProvider.Runner::new);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package dev.compactmods.simplehoney.datagen.client;

import dev.compactmods.simplehoney.SimpleHoney;
import net.minecraft.client.data.models.BlockModelGenerators;
import net.minecraft.client.data.models.ItemModelGenerators;
import net.minecraft.client.data.models.ModelProvider;
import net.minecraft.client.data.models.model.ModelTemplates;
import net.minecraft.data.PackOutput;

public class ItemAndBlockModels extends ModelProvider {

public ItemAndBlockModels(PackOutput output) {
super(output, SimpleHoney.MOD_ID);
}

@Override
protected void registerModels(BlockModelGenerators blockModels, ItemModelGenerators itemModels) {
itemModels.generateFlatItem(SimpleHoney.HONEY_DROP.get(), ModelTemplates.FLAT_ITEM);
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package dev.compactmods.simplehoney.datagen.lang;
package dev.compactmods.simplehoney.datagen.client.lang;

import dev.compactmods.simplehoney.SimpleHoney;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;
import net.neoforged.neoforge.common.data.LanguageProvider;

public class EnglishLangGenerator extends LanguageProvider {

public EnglishLangGenerator(DataGenerator gen) {
super(gen.getPackOutput(), SimpleHoney.MOD_ID, "en_us");
public EnglishLangGenerator(PackOutput output) {
super(output, SimpleHoney.MOD_ID, "en_us");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package dev.compactmods.simplehoney.datagen.server;

import dev.compactmods.simplehoney.SimpleHoney;
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.world.item.ItemStack;
import net.minecraft.world.item.Items;

import java.util.concurrent.CompletableFuture;

public class SHRecipeProvider extends RecipeProvider {

protected SHRecipeProvider(HolderLookup.Provider registries, RecipeOutput output) {
super(registries, output);
}

@Override
protected void buildRecipes() {
shapeless(RecipeCategory.FOOD, new ItemStack(Items.HONEY_BOTTLE))
.requires(SimpleHoney.HONEY_DROP)
.requires(Items.GLASS_BOTTLE)
.unlockedBy("honey_drop", has(SimpleHoney.HONEY_DROP))
.save(this.output);

shapeless(RecipeCategory.FOOD, new ItemStack(Items.HONEYCOMB))
.requires(SimpleHoney.HONEY_DROP)
.unlockedBy("honey_drop", has(SimpleHoney.HONEY_DROP))
.save(this.output);
}

public static final class Runner extends RecipeProvider.Runner {
public Runner(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(output, lookupProvider);
}

protected RecipeProvider createRecipeProvider(HolderLookup.Provider lookupProvider, RecipeOutput output) {
return new SHRecipeProvider(lookupProvider, output);
}

public String getName() {
return "NeoForge recipes";
}
}
}

0 comments on commit 510fe4b

Please sign in to comment.