Skip to content

Commit

Permalink
初始化模组
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuqi154 committed Aug 14, 2024
1 parent 18c5902 commit 0210398
Show file tree
Hide file tree
Showing 34 changed files with 798 additions and 229 deletions.
26 changes: 4 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@

Installation information
=======
# 稗田阿求的书卷 Hieda no Akyuu no Makimono

This template repository can be directly cloned to get you started with a new
mod. Simply create a new repository cloned from this one, by following the
instructions provided by [GitHub](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template).
这是稗茗奉月居创作的用于纪念稗田阿求的模组

Once you have your clone, simply open the repository in the IDE of your choice. The usual recommendation for an IDE is either IntelliJ IDEA or Eclipse.

If at any point you are missing libraries in your IDE, or you've run into problems you can
run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything
{this does not affect your code} and then start the process again.

Mapping Names:
============
By default, the MDK is configured to use the official mapping names from Mojang for methods and fields
in the Minecraft codebase. These names are covered by a specific license. All modders should be aware of this
license. For the latest license text, refer to the mapping file itself, or the reference copy here:
https://github.com/NeoForged/NeoForm/blob/main/Mojang.md

Additional Resources:
==========
Community Documentation: https://docs.neoforged.net/
NeoForged Discord: https://discord.neoforged.net/
保留所有权利
All rights reserved
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
org.gradle.jvmargs=-Xmx1G
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.caching=true
Expand All @@ -16,7 +16,7 @@ minecraft_version=1.21
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.21,1.21.1)
minecraft_version_range=[1.21,1.21.2)
# The Neo version must agree with the Minecraft version to get a valid artifact
neo_version=21.0.167
# The Neo version range can use any version of Neo as bounds
Expand All @@ -28,18 +28,18 @@ loader_version_range=[4,)

# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
# Must match the String constant located in the main mod class annotated with @Mod.
mod_id=examplemod
mod_id=hiedanoakyuunomakimono
# The human-readable display name for the mod.
mod_name=Example Mod
mod_name=Hieda no Akyuu no Makimono
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
mod_version=1.0.0
mod_version=1.0.0-snaphot
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
mod_group_id=com.example.examplemod
mod_group_id=org.hiedacamellia.hiedanoakyuunomakimono
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=YourNameHere, OtherNameHere
mod_authors=Hieda Camellia
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.
mod_description=?????????????????????
63 changes: 0 additions & 63 deletions src/main/java/com/example/examplemod/Config.java

This file was deleted.

136 changes: 0 additions & 136 deletions src/main/java/com/example/examplemod/ExampleMod.java

This file was deleted.

35 changes: 35 additions & 0 deletions src/main/java/org/hiedacamellia/hiedanoakyuunomakimono/Config.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.hiedacamellia.hiedanoakyuunomakimono;

import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.event.config.ModConfigEvent;
import net.neoforged.neoforge.common.ModConfigSpec;

// An example config class. This is not required, but it's a good idea to have one to keep your config organized.
// Demonstrates how to use Neo's config APIs
@EventBusSubscriber(modid = HiedanoAkyuunoMakimono.MODID, bus = EventBusSubscriber.Bus.MOD)
public class Config
{
private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder();

private static final ModConfigSpec.BooleanValue DEBUG = BUILDER
.comment("Set to true to enable debug info")
.comment("设置为true以启用调试信息")
.define("debug", true);


static final ModConfigSpec SPEC = BUILDER.build();

public static boolean debug;

public static void setDebug(boolean debug){
DEBUG.set(debug);
}


@SubscribeEvent
static void onLoad(final ModConfigEvent event)
{
debug = DEBUG.get();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.hiedacamellia.hiedanoakyuunomakimono;


import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.config.ModConfig;
import org.hiedacamellia.hiedanoakyuunomakimono.core.data.Data;
import org.hiedacamellia.hiedanoakyuunomakimono.registers.*;

@Mod(HiedanoAkyuunoMakimono.MODID)
public class HiedanoAkyuunoMakimono {
public static final String MODID = "hiedanoakyuunomakimono";

public HiedanoAkyuunoMakimono(IEventBus modEventBus, ModContainer modContainer)
{
modEventBus.addListener(Data::onGatherData);

HAMBlock.BLOCKS.register(modEventBus);
HAMBlockItem.ITEMS.register(modEventBus);
HAMItem.ITEMS.register(modEventBus);
HAMTab.TABS.register(modEventBus);
HAMAttachment.ATTACHMENTS.register(modEventBus);
HAMDataComponent.DATA_COMPONENTS.register(modEventBus);
HAMEffect.EFFECTS.register(modEventBus);
HAMMenu.MENUS.register(modEventBus);
HAMRicipe.RECIPE_TYPES.register(modEventBus);
HAMRicipeSerializer.RECIPE_SERIALIZERS.register(modEventBus);
HAMBlockEntity.BLOCK_ENTITIES.register(modEventBus);

// NeoForge.EVENT_BUS.register(this);


modContainer.registerConfig(ModConfig.Type.COMMON, Config.SPEC);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.hiedacamellia.hiedanoakyuunomakimono.core.data;

import net.neoforged.neoforge.data.event.GatherDataEvent;
import org.hiedacamellia.hiedanoakyuunomakimono.core.data.lang.ChineseLanguageProvider;
import org.hiedacamellia.hiedanoakyuunomakimono.core.data.lang.ClassicalChineseLanguageProvider;
import org.hiedacamellia.hiedanoakyuunomakimono.core.data.lang.EnglishLanguageProvider;
import org.hiedacamellia.hiedanoakyuunomakimono.core.data.provider.ModelProvider;
import org.hiedacamellia.hiedanoakyuunomakimono.core.data.provider.StateProvider;
import org.hiedacamellia.hiedanoakyuunomakimono.core.data.provider.WGRecipeProvider;

public class Data {
public static void onGatherData(GatherDataEvent event) {
var gen = event.getGenerator();
var packOutput = gen.getPackOutput();
var helper = event.getExistingFileHelper();
gen.addProvider(event.includeClient(), new EnglishLanguageProvider(packOutput));
gen.addProvider(event.includeClient(), new ChineseLanguageProvider(packOutput));
gen.addProvider(event.includeClient(), new ClassicalChineseLanguageProvider(packOutput));
gen.addProvider(event.includeClient(), new ModelProvider(packOutput, helper));
gen.addProvider(event.includeClient(), new StateProvider(packOutput, helper));
gen.addProvider(event.includeServer(), new WGRecipeProvider(packOutput, event.getLookupProvider()));
}
}
Loading

0 comments on commit 0210398

Please sign in to comment.