From 2534ad8452546d64db33d7b8d5117f5a90bd5308 Mon Sep 17 00:00:00 2001 From: zontreck Date: Sat, 20 Jan 2024 23:31:19 -0700 Subject: [PATCH] Initial commit --- CONTRIBUTING.md | 28 ++++++ gradle.properties | 60 +++++++++++++ gradle/wrapper/gradle-wrapper.properties | 5 ++ settings.gradle | 6 ++ src/main/java/dev/zontreck/fire/FireMod.java | 86 +++++++++++++++++++ .../zontreck/fire/events/EventHandler.java | 15 ++++ 6 files changed, 200 insertions(+) create mode 100644 CONTRIBUTING.md create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 settings.gradle create mode 100644 src/main/java/dev/zontreck/fire/FireMod.java create mode 100644 src/main/java/dev/zontreck/fire/events/EventHandler.java diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..791c037 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,28 @@ +How to Contribute +===== + +First of all, thank you for considering, or for contributing to any of the following mods +``` +LibZontreck +Arias-Essentials +OTEMod +ClaimsMod +WatchMyDurability +``` + +It's people like you who make the contrinuted existence of these mods possible. + +Contributing to any of the mods under my development is simple. + +Code Contributions +--- +1) To contribute code, fork the repository, then make a new branch. Name it something like `bugfix_somefeature`, or `feature_newfeature`. When done coding, submit a pull request to have your changes be integrated upstream. + +Asset contribution +---- +2) Contributions are also accepted in the form of artwork or music, or sound, or block models from blockbench. Just simply follow the above steps to create your working base. Then send it to us in a pull request. No coding knowledge is necessary for adding these resources. Someone else can tackle that if you do not know how to code. An example of this is the Possum animal model in OTEMod. This was contributed by PossumTheWarrior via discord. + +Bug reporting or feature requests +---- +3) Bug reports. Please be as detailed as possible when reporting a bug. Include steps on how to reproduce the bug if possible. +4) Feature requests. Please be sure to name your issue ticket accordingly to indicate you are requesting a new feature, and not reporting a bug. Then be as detailed as possible in how you want the feature to work. If the feature is requested for LibZontreck. Please be detailed in how the API would work. You can do this simply by providing a basic interface example. \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..6aa291e --- /dev/null +++ b/gradle.properties @@ -0,0 +1,60 @@ +# Sets default memory used for gradle commands. Can be overridden by user or command line properties. +# This is required to provide enough memory for the Minecraft decompilation process. +org.gradle.jvmargs=-Xmx3G +org.gradle.daemon=false + +libzontreck=1.10.011624.1712 + +## Environment Properties + +# The Minecraft version must agree with the Forge version to get a valid artifact +minecraft_version=1.18.2 +# 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.18.2,1.19) +# The Forge version must agree with the Minecraft version to get a valid artifact +forge_version=40.2.1 +# The Forge version range can use any version of Forge as bounds or match the loader version range +forge_version_range=[40,) +# The loader version range can only use the major version of Forge/FML as bounds +loader_version_range=[40,) +# The mapping channel to use for mappings. +# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"]. +# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin. +# +# | Channel | Version | | +# |-----------|----------------------|--------------------------------------------------------------------------------| +# | official | MCVersion | Official field/method names from Mojang mapping files | +# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official | +# +# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings. +# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md +# +# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge. +# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started +mapping_channel=parchment +# The mapping version to query from the mapping channel. +# This must match the format required by the mapping channel. +mapping_version=2022.11.06-1.18.2 + + +## Mod Properties + +# 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=fire +# The human-readable display name for the mod. +mod_name=Fire! Fire! +# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. +mod_license=GPLv3 +# The mod version. See https://semver.org/ +mod_version=1.0.01202024.2304 +# 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=dev.zontreck +# The authors of the mod. This is a simple text string that is used for display purposes in the mod list. +mod_authors=zontreck +# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list. +mod_description=Let's put the fires out \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ae04661 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..256e08d --- /dev/null +++ b/settings.gradle @@ -0,0 +1,6 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven { url = "https://maven.zontreck.com/repository/internal" } + } +} \ No newline at end of file diff --git a/src/main/java/dev/zontreck/fire/FireMod.java b/src/main/java/dev/zontreck/fire/FireMod.java new file mode 100644 index 0000000..52b6955 --- /dev/null +++ b/src/main/java/dev/zontreck/fire/FireMod.java @@ -0,0 +1,86 @@ +package dev.zontreck.fire; + +import com.mojang.logging.LogUtils; +import dev.zontreck.fire.events.EventHandler; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.InterModComms; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; +import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; +import net.minecraftforge.event.server.ServerStartingEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import org.slf4j.Logger; + +import java.util.stream.Collectors; + +// The value here should match an entry in the META-INF/mods.toml file +@Mod(FireMod.MOD_ID) +public class FireMod +{ + public static final String MOD_ID = "fire"; + + // Directly reference a slf4j logger + private static final Logger LOGGER = LogUtils.getLogger(); + + public FireMod() + { + // Register the setup method for modloading + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); + // Register the enqueueIMC method for modloading + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); + // Register the processIMC method for modloading + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); + + // Register ourselves for server and other game events we are interested in + MinecraftForge.EVENT_BUS.register(this); + MinecraftForge.EVENT_BUS.register(new EventHandler()); + + } + + private void setup(final FMLCommonSetupEvent event) + { + // some preinit code + LOGGER.info("HELLO FROM PREINIT"); + LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); + } + + private void enqueueIMC(final InterModEnqueueEvent event) + { + // Some example code to dispatch IMC to another mod + //InterModComms.sendTo("fire", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); + } + + private void processIMC(final InterModProcessEvent event) + { + // Some example code to receive and process InterModComms from other mods + //LOGGER.info("Got IMC {}", event.getIMCStream(). + // map(m->m.messageSupplier().get()). + // collect(Collectors.toList())); + } + + // You can use SubscribeEvent and let the Event Bus discover methods to call + @SubscribeEvent + public void onServerStarting(ServerStartingEvent event) + { + // Do something when the server starts + LOGGER.info("HELLO from server starting"); + } + + // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD + // Event bus for receiving Registry Events) + @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) + public static class RegistryEvents + { + @SubscribeEvent + public static void onBlocksRegistry(final RegistryEvent.Register blockRegistryEvent) + { + // Register a new block here + LOGGER.info("HELLO from Register Block"); + } + } +} diff --git a/src/main/java/dev/zontreck/fire/events/EventHandler.java b/src/main/java/dev/zontreck/fire/events/EventHandler.java new file mode 100644 index 0000000..5194232 --- /dev/null +++ b/src/main/java/dev/zontreck/fire/events/EventHandler.java @@ -0,0 +1,15 @@ +package dev.zontreck.fire.events; + +import net.minecraft.world.level.block.LevelEvent; +import net.minecraftforge.event.TickEvent; +import net.minecraftforge.event.world.BlockEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; + +public class EventHandler +{ + @SubscribeEvent + public void onBlockBurned(BlockEvent.BreakEvent ev) + { + + } +}