Skip to content

Commit

Permalink
NeoForge 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
yurisuika committed Dec 11, 2024
1 parent 2a94691 commit b9a8405
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 56 deletions.
17 changes: 6 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ group = project.maven_group

repositories {
maven { url "https://maven.parchmentmc.org/" }
maven { url "https://maven.neoforged.net/releases/" }
}

dependencies {
Expand All @@ -20,7 +21,7 @@ dependencies {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${project.minecraft_version}:${project.parchment_version}@zip")
}
forge "net.minecraftforge:forge:${project.forge_version}"
neoForge "net.neoforged:neoforge:${project.neo_version}"
}

processResources {
Expand All @@ -37,12 +38,6 @@ tasks.withType(JavaCompile) {
}

loom {
forge {
mixinConfigs = [
"${project.archives_base_name}.mixins.json"
]
}

mixin {
useLegacyMixinAp = true
defaultRefmapName = "${project.archives_base_name}.refmap.json"
Expand All @@ -55,10 +50,10 @@ java {

jar {
from("LICENSE")
jar.archiveAppendix.set("forge-${project.minecraft_version}")
sourcesJar.archiveAppendix.set("forge-${project.minecraft_version}")
remapJar.archiveAppendix.set("forge-${project.minecraft_version}")
remapSourcesJar.archiveAppendix.set("forge-${project.minecraft_version}")
jar.archiveAppendix.set("neoforge-${project.minecraft_version}")
sourcesJar.archiveAppendix.set("neoforge-${project.minecraft_version}")
remapJar.archiveAppendix.set("neoforge-${project.minecraft_version}")
remapSourcesJar.archiveAppendix.set("neoforge-${project.minecraft_version}")
}

publishing {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
org.gradle.jvmargs = -Xmx3G
loom.platform = forge
loom.platform = neoforge

minecraft_version = 1.20.4
parchment_version = 2024.04.14
Expand All @@ -10,4 +10,4 @@ mod_version = 2.0.0
maven_group = dev.yurisuika.blossom
archives_base_name = blossom

forge_version = 1.20.4-49.1.12
neo_version = 20.4.234
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pluginManagement {
repositories {
maven { url "https://maven.fabricmc.net/" }
maven { url "https://maven.architectury.dev/" }
maven { url "https://files.minecraftforge.net/maven/" }
maven { url "https://maven.neoforged.net/releases/" }
mavenCentral()
gradlePluginPortal()
}
Expand Down
33 changes: 15 additions & 18 deletions src/main/java/dev/yurisuika/blossom/Blossom.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,17 @@
import net.minecraft.world.item.Items;
import net.minecraft.world.level.FoliageColor;
import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RegisterColorHandlersEvent;
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.event.entity.EntityJoinLevelEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent;
import net.neoforged.neoforge.client.event.RegisterParticleProvidersEvent;
import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent;
import net.neoforged.neoforge.event.RegisterCommandsEvent;
import net.neoforged.neoforge.event.entity.EntityJoinLevelEvent;

import java.util.Objects;

Expand Down Expand Up @@ -128,15 +127,13 @@ public static void registerCreativeModeTabs(BuildCreativeModeTabContentsEvent ev

}

public Blossom(FMLJavaModLoadingContext context) {
public Blossom(ModLoadingContext context) {
Config.loadConfig();
Validate.checkBounds();

BlossomBlocks.register(context.getModEventBus());
BlossomItems.register(context.getModEventBus());
BlossomParticleTypes.register(context.getModEventBus());

MinecraftForge.EVENT_BUS.register(this);
BlossomBlocks.register(context.getActiveContainer().getEventBus());
BlossomItems.register(context.getActiveContainer().getEventBus());
BlossomParticleTypes.register(context.getActiveContainer().getEventBus());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

import net.minecraft.core.particles.ParticleType;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import net.minecraft.core.registries.Registries;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredRegister;

import java.util.function.Supplier;

public class BlossomParticleTypes {

public static final DeferredRegister<ParticleType<?>> PARTICLES = DeferredRegister.create(ForgeRegistries.PARTICLE_TYPES, "blossom");
public static final DeferredRegister<ParticleType<?>> PARTICLES = DeferredRegister.create(Registries.PARTICLE_TYPE, "blossom");

public static final RegistryObject<SimpleParticleType> FLOWERING_OAK_LEAVES = PARTICLES.register("flowering_oak_leaves", () -> new SimpleParticleType(false));
public static final Supplier<SimpleParticleType> FLOWERING_OAK_LEAVES = PARTICLES.register("flowering_oak_leaves", () -> new SimpleParticleType(false));

public static void register(IEventBus eventBus) {
PARTICLES.register(eventBus);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import dev.yurisuika.blossom.config.Options;
import net.minecraftforge.fml.loading.FMLPaths;
import net.neoforged.fml.loading.FMLPaths;

import java.io.File;
import java.io.FileWriter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.material.PushReaction;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredBlock;
import net.neoforged.neoforge.registries.DeferredRegister;

public class BlossomBlocks {

public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, "blossom");
public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks("blossom");

public static final RegistryObject<Block> FRUITING_OAK_LEAVES = BLOCKS.register("fruiting_oak_leaves", () -> new FruitingLeavesBlock(Blocks.OAK_LEAVES, Items.APPLE, BlockBehaviour.Properties.of()
public static final DeferredBlock<Block> FRUITING_OAK_LEAVES = BLOCKS.register("fruiting_oak_leaves", () -> new FruitingLeavesBlock(Blocks.OAK_LEAVES, Items.APPLE, BlockBehaviour.Properties.of()
.mapColor(MapColor.PLANT)
.strength(0.2F)
.randomTicks()
Expand All @@ -29,7 +28,7 @@ public class BlossomBlocks {
.ignitedByLava()
.pushReaction(PushReaction.DESTROY)
.isRedstoneConductor(BlocksInvoker::invokeNever)));
public static final RegistryObject<Block> FLOWERING_OAK_LEAVES = BLOCKS.register("flowering_oak_leaves", () -> new FloweringLeavesBlock(Blocks.OAK_LEAVES, FRUITING_OAK_LEAVES.get(), BlockBehaviour.Properties.of()
public static final DeferredBlock<Block> FLOWERING_OAK_LEAVES = BLOCKS.register("flowering_oak_leaves", () -> new FloweringLeavesBlock(Blocks.OAK_LEAVES, FRUITING_OAK_LEAVES.get(), BlockBehaviour.Properties.of()
.mapColor(MapColor.PLANT)
.strength(0.2F)
.randomTicks()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
import dev.yurisuika.blossom.world.level.block.BlossomBlocks;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredItem;
import net.neoforged.neoforge.registries.DeferredRegister;

public class BlossomItems {

public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, "blossom");
public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems("blossom");

public static final RegistryObject<Item> FRUITING_OAK_LEAVES = ITEMS.register("fruiting_oak_leaves", () -> new BlockItem(BlossomBlocks.FRUITING_OAK_LEAVES.get(), new Item.Properties()));
public static final RegistryObject<Item> FLOWERING_OAK_LEAVES = ITEMS.register("flowering_oak_leaves", () -> new BlockItem(BlossomBlocks.FLOWERING_OAK_LEAVES.get(), new Item.Properties()));
public static final DeferredItem<Item> FRUITING_OAK_LEAVES = ITEMS.register("fruiting_oak_leaves", () -> new BlockItem(BlossomBlocks.FRUITING_OAK_LEAVES.get(), new Item.Properties()));
public static final DeferredItem<Item> FLOWERING_OAK_LEAVES = ITEMS.register("flowering_oak_leaves", () -> new BlockItem(BlossomBlocks.FLOWERING_OAK_LEAVES.get(), new Item.Properties()));

public static void register(IEventBus eventBus) {
ITEMS.register(eventBus);
Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "48,)"
loaderVersion = "1,)"
license = "GNU Lesser General Public License v3.0"

[[mods]]
Expand All @@ -15,16 +15,21 @@ description = '''
Apples blossom upon leaves by the pollen from bees!
'''

[[mixins]]
config = "blossom.mixins.json"

[[dependencies.blossom]]
modId = "minecraft"
mandatory = true
type = "required"
versionRange = "[1.20.2,1.20.4]"
ordering = "NONE"
side = "BOTH"

[[dependencies.blossom]]
modId = "forge"
modId = "neoforge"
mandatory = true
versionRange = "[48,)"
type = "required"
versionRange = "[20.2,)"
ordering = "NONE"
side = "BOTH"

0 comments on commit b9a8405

Please sign in to comment.