beginning of the neocomputer
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -451,4 +451,5 @@ FodyWeavers.xsd
|
||||
*.msp
|
||||
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
*.sln.iml
|
||||
/.kotlin/
|
||||
|
||||
59
README.md
59
README.md
@@ -1,50 +1,15 @@
|
||||
# Stonecutter template
|
||||
# NeoComputers
|
||||
A rewrite of OpenComputers for modern Minecraft, alongside our own additions. Based off of the https://github.com/JumperOnJava/Stonecutter-Arch-Template template.
|
||||
### Project setup
|
||||
This uses a combination of Architectury, Architectury API, Stonecutter, and Kotlin. Stonecutter is the most important one
|
||||
to read about. Don't forget to Gradle -> Tasks -> stonecutter -> "Set active project to [version]-[loader]" before building/testing
|
||||
the mod for that version!
|
||||
|
||||
If you have some issues with template ping me (@JavaJumper) in [Kiku's realm](https://discord.gg/TBgNUCfryS) or official fabric discord
|
||||
Also, try reading about how stonecutter's conditional macros work (those can be seen as the `//?` statements in the code).
|
||||
Stonecutter automatically comments and uncomments them when you switch between versions or loaders, you shouldn't do it yourself.
|
||||
|
||||
This template allows you create multiloader multversion mod using stonecutter and architectury
|
||||
The minecraft version this mod is currently being developed on is 1.21.11 neoforge or fabric. Although the project stonecutter.gradle.kts
|
||||
is currently using 1.21.9-fabric, you can easily change it with the gradle task.
|
||||
|
||||
It is based on my CustomCursor project
|
||||
|
||||
## Setup
|
||||
|
||||
To change versions check settings.gradle.kts
|
||||
Currently default versions are these,
|
||||
but you can easily add other versions if you need that
|
||||
- 1.20.1, fabric, lexforge
|
||||
- 1.20.4, fabric, neoforge
|
||||
- 1.21.1, fabric, neoforge
|
||||
- 1.21.3, fabric, neoforge
|
||||
- 1.21.4, fabric, neoforge
|
||||
- 1.21.5, fabric, neoforge
|
||||
- 1.21.6, fabric, neoforge
|
||||
- 1.21.7, fabric, neoforge
|
||||
- 1.21.8, fabric, neoforge
|
||||
- 1.21.9, fabric, neoforge
|
||||
- 1.21.10, fabric, neoforge
|
||||
- 1.21.11, fabric, neoforge
|
||||
|
||||
You can use c# script to automatically change all template names.
|
||||
Open RenameTemplate.cs, change names in replacements array and run "dotnet run" in this directory
|
||||
I would highly recommend to do this before opening project in your IDE, and then remove all c# related files from project
|
||||
(obj and bin folders, .csproj and script itself). Also you can remove c# stuff from .gitignore (there is comment for that)
|
||||
|
||||
|
||||
## Build tools usage
|
||||
|
||||
To start current active version use runActive task
|
||||
|
||||
For testing all versions you can use chiseledRunAllClients, it runs all possible version and loader variants (in random(?) order)
|
||||
|
||||
Also template had publishing set up, you need to specify project id for modrinth and curseforge in gradle.properties, and tokens for these sites in local.properties (it is gitignored, check local.properties.example). After that use chiseledPublishMods task
|
||||
|
||||
## Template usage
|
||||
|
||||
Template already has some code setup:
|
||||
- common and platform specific entrypoints
|
||||
- ModPlatform interface for platform specific code
|
||||
- example config screen with mod menu integration
|
||||
- example mixin (clientside)
|
||||
- class for simple file IO
|
||||
- common entrypoint with logger, modid, ModPlatform object instance
|
||||
- en_us lang file
|
||||
The recommended IDE for this is IntelliJ IDEA 2026.1, and the JDK used is Eclipse Temurin 25.0.2 (from Adoptium), although
|
||||
you should be able to use any other build of OpenJDK 26.
|
||||
@@ -1,60 +0,0 @@
|
||||
List<string> FindAllFiles(string directoryPath)
|
||||
{
|
||||
return Directory.GetFiles(directoryPath, "*.*", SearchOption.AllDirectories)
|
||||
.Select(file => Path.GetRelativePath(directoryPath, file))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
var replacements = new[]
|
||||
{
|
||||
//ORDER MATTERS
|
||||
new { Old = "com.example", New = "io.github.cooldev" }, //change mod package
|
||||
new { Old = "template", New = "coolmod" }, //change modid
|
||||
new { Old = "Template", New = "Cool Mod" }, //change mod display name
|
||||
// ↕ <- Letter L is different case here
|
||||
new { Old = "TempLate", New = "CoolMod" }, //change mod init class and other places where mod name is in PascalCase
|
||||
new { Old = "AuthorExample", New = "CoolDev" }
|
||||
};
|
||||
|
||||
var files = FindAllFiles(Directory.GetCurrentDirectory());
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
var oldFile = file.Replace("\\", "/");
|
||||
var newFile = oldFile;
|
||||
Console.WriteLine("checking: " + oldFile);
|
||||
|
||||
if (oldFile.StartsWith("."))
|
||||
continue;
|
||||
if (oldFile.Contains(".cs"))
|
||||
continue;
|
||||
if (oldFile.Contains(".git"))
|
||||
continue;
|
||||
if (oldFile.Contains(".gradle/"))
|
||||
continue;
|
||||
if (oldFile.Contains("build/"))
|
||||
continue;
|
||||
if (oldFile.Contains("LICENSE"))
|
||||
continue;
|
||||
if (oldFile.Contains("bin"))
|
||||
continue;
|
||||
if (oldFile.Contains("obj"))
|
||||
continue;
|
||||
|
||||
var fileContent = File.ReadAllText(oldFile);
|
||||
|
||||
foreach (var replacement in replacements)
|
||||
{
|
||||
fileContent = fileContent.Replace(replacement.Old, replacement.New);
|
||||
newFile = newFile.Replace(replacement.Old.Replace(".", "/"), replacement.New.Replace(".", "/"));
|
||||
}
|
||||
Console.WriteLine($"Moving \n\t< {oldFile} \n\t> {newFile}");
|
||||
File.Delete(oldFile);
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(newFile));
|
||||
}
|
||||
catch { }
|
||||
;
|
||||
File.WriteAllText(newFile, fileContent);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>Stonecutter_Arch_Template</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,6 +1,7 @@
|
||||
import java.util.*
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "2.3.20"
|
||||
id("dev.architectury.loom")
|
||||
id("architectury-plugin")
|
||||
id("me.modmuss50.mod-publish-plugin")
|
||||
@@ -27,26 +28,33 @@ repositories {
|
||||
maven("https://maven.terraformersmc.com/")
|
||||
//placeholder api (modmenu depencency)
|
||||
maven("https://maven.nucleoid.xyz/")
|
||||
maven {
|
||||
name = "Kotlin for Forge"
|
||||
setUrl("https://thedarkcolour.github.io/KotlinForForge/")
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
minecraft("com.mojang:minecraft:$minecraft")
|
||||
mappings(loom.officialMojangMappings())
|
||||
|
||||
modApi("dev.architectury:architectury:${mod.dep("architectury_version")}")
|
||||
if (loader == "fabric") {
|
||||
modImplementation("net.fabricmc:fabric-loader:${mod.dep("fabric_loader")}")
|
||||
// mappings("net.fabricmc:yarn:$minecraft+build.${mod.dep("yarn_build")}:v2")
|
||||
modImplementation("com.terraformersmc:modmenu:${mod.dep("modmenu_version")}")
|
||||
|
||||
//some features (like automatic resource loading from non vanilla namespaces) work only with fabric API installed
|
||||
//for example translations from assets/modid/lang/en_us.json won't be working, same stuff with textures
|
||||
//but we keep runtime only to not accidentally depend on fabric's api, because it doesn't exist in neo/forge
|
||||
modRuntimeOnly("net.fabricmc.fabric-api:fabric-api:${mod.dep("fabric_version")}")
|
||||
|
||||
modImplementation("net.fabricmc:fabric-language-kotlin:1.13.10+kotlin.2.3.20")
|
||||
modApi("dev.architectury:architectury-fabric:${mod.dep("architectury_version")}")
|
||||
}
|
||||
if (loader == "forge") {
|
||||
"forge"("net.minecraftforge:forge:${minecraft}-${mod.dep("forge_loader")}")
|
||||
//implementation("thedarkcolour:kotlinforforge:1.16.0")
|
||||
// mappings("net.fabricmc:yarn:$minecraft+build.${mod.dep("yarn_build")}:v2")
|
||||
|
||||
modApi("dev.architectury:architectury-forge:${mod.dep("architectury_version")}")
|
||||
"io.github.llamalad7:mixinextras-forge:${mod.dep("mixin_extras")}".let {
|
||||
implementation(it)
|
||||
include(it)
|
||||
@@ -61,11 +69,17 @@ dependencies {
|
||||
// }
|
||||
// })
|
||||
|
||||
modApi("dev.architectury:architectury-forge:${mod.dep("architectury_version")}")
|
||||
implementation("thedarkcolour:kotlinforforge-neoforge:6.0.0")
|
||||
}
|
||||
}
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0")
|
||||
}
|
||||
}
|
||||
|
||||
loom {
|
||||
accessWidenerPath = rootProject.file("src/main/resources/template.accesswidener")
|
||||
accessWidenerPath = rootProject.file("src/main/resources/neocomputers.accesswidener")
|
||||
|
||||
decompilers {
|
||||
get("vineflower").apply { // Adds names to lambdas - useful for mixins
|
||||
@@ -74,13 +88,12 @@ loom {
|
||||
}
|
||||
if (loader == "forge") {
|
||||
forge.mixinConfigs(
|
||||
"template-common.mixins.json",
|
||||
"template-forge.mixins.json",
|
||||
"neocomputers-common.mixins.json",
|
||||
"neocomputers-forge.mixins.json",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
val localProperties = Properties()
|
||||
val localPropertiesFile = rootProject.file("local.properties")
|
||||
if (localPropertiesFile.exists()) {
|
||||
@@ -108,8 +121,12 @@ publishMods {
|
||||
targets.forEach(minecraftVersions::add)
|
||||
if (loader == "fabric") {
|
||||
requires("fabric-api")
|
||||
requires("fabric-language-kotlin")
|
||||
optional("modmenu")
|
||||
}
|
||||
if (loader == "neoforge") {
|
||||
requires("kotlinforforge-neoforge")
|
||||
}
|
||||
}
|
||||
|
||||
curseforge {
|
||||
@@ -118,8 +135,12 @@ publishMods {
|
||||
targets.forEach(minecraftVersions::add)
|
||||
if (loader == "fabric") {
|
||||
requires("fabric-api")
|
||||
requires("fabric-language-kotlin")
|
||||
optional("modmenu")
|
||||
}
|
||||
if (loader == "neoforge") {
|
||||
requires("kotlinforforge-neoforge")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +151,11 @@ java {
|
||||
sourceCompatibility = java
|
||||
}
|
||||
|
||||
kotlin {
|
||||
val java = if (stonecutter.eval(minecraft, ">=1.20.5")) 21 else 17
|
||||
jvmToolchain(java)
|
||||
}
|
||||
|
||||
val shadowBundle: Configuration by configurations.creating {
|
||||
isCanBeConsumed = false
|
||||
isCanBeResolved = true
|
||||
|
||||
@@ -8,9 +8,9 @@ org.gradle.parallel=false
|
||||
|
||||
# Mod properties
|
||||
mod.version=1.0.0
|
||||
mod.group=com.example
|
||||
mod.id=template
|
||||
mod.name=Template
|
||||
mod.group=org.neoflock.neocomputers
|
||||
mod.id=neocomputers
|
||||
mod.name=NeoComputers
|
||||
|
||||
# Used for the mod metadata
|
||||
mod.mc_dep_fabric=[VERSIONED]
|
||||
@@ -24,6 +24,7 @@ mod.mc_targets=[VERSIONED]
|
||||
deps.mixin_extras=0.4.1
|
||||
deps.fabric_loader=0.18.3
|
||||
deps.fabric_version=[VERSIONED]
|
||||
deps.architectury_version=9.1.12
|
||||
|
||||
deps.forge_loader=[VERSIONED]
|
||||
deps.neoforge_loader=[VERSIONED]
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@@ -21,13 +21,15 @@ stonecutter {
|
||||
fun mc(loader: String, vararg versions: String) {
|
||||
for (version in versions) vers("$version-$loader", version)
|
||||
}
|
||||
//i would recommend to use neoforge for mc > 1.20.1, i haven't tested template for forge on versions higher than that
|
||||
mc("fabric","1.20.1","1.20.4", "1.21.1", "1.21.3", "1.21.4", "1.21.5", "1.21.6", "1.21.7", "1.21.8", "1.21.9", "1.21.10", "1.21.11")
|
||||
mc("forge","1.20.1")
|
||||
//i would recommend to use neoforge for mc > 1.20.1, i haven't tested neocomputers for forge on versions higher than that
|
||||
//mc("fabric","1.20.1","1.20.4", "1.21.1", "1.21.3", "1.21.4", "1.21.5", "1.21.6", "1.21.7", "1.21.8", "1.21.9", "1.21.10", "1.21.11")
|
||||
mc("fabric", "1.20.1", "1.20.4", "1.21.9", "1.21.11")
|
||||
mc("forge", "1.20.1")
|
||||
//WARNING: neoforge uses mods.toml instead of neoforge.mods.toml for versions 1.20.4 (?) and earlier
|
||||
mc("neoforge", "1.20.4", "1.21.1", "1.21.3", "1.21.4", "1.21.5", "1.21.6", "1.21.7", "1.21.8", "1.21.9", "1.21.10", "1.21.11")
|
||||
//mc("neoforge", "1.20.4", "1.21.1", "1.21.3", "1.21.4", "1.21.5", "1.21.6", "1.21.7", "1.21.8", "1.21.9", "1.21.10", "1.21.11")
|
||||
mc("neoforge", "1.20.4", "1.21.9", "1.21.11")
|
||||
}
|
||||
create(rootProject)
|
||||
}
|
||||
|
||||
rootProject.name = "TempLate"
|
||||
rootProject.name = "NeoComputers"
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.example.template;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class TempLateInit
|
||||
{
|
||||
public static final String MODID = "template";
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger("Template");
|
||||
public static ModPlatform PLATFORM = null;
|
||||
|
||||
public static void entrypoint(ModPlatform platform) {
|
||||
TempLateInit.PLATFORM = platform;
|
||||
LOGGER.info("Started mod in %s loader".formatted(TempLateInit.PLATFORM.getModloader()));
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.template;
|
||||
package org.neoflock.neocomputers;
|
||||
|
||||
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.template;
|
||||
package org.neoflock.neocomputers;
|
||||
|
||||
|
||||
/**
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.neoflock.neocomputers;
|
||||
|
||||
import org.neoflock.neocomputers.platforms.fabric.NeoComputersFabric;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/*public class NeoComputersInit
|
||||
{
|
||||
public static final String MODID = "neocomputers";
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger("NeoComputers");
|
||||
public static ModPlatform PLATFORM = null;
|
||||
|
||||
public static void entrypoint(ModPlatform platform) {
|
||||
NeoComputersInit.PLATFORM = platform;
|
||||
LOGGER.info("Started mod in %s loader".formatted(NeoComputersInit.PLATFORM.getModloader()));
|
||||
LOGGER.info("Kotlin: %s".formatted(NeoComputers.INSTANCE.hello()));
|
||||
|
||||
}
|
||||
}*/
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.example.template.mixin;
|
||||
package org.neoflock.neocomputers.mixin;
|
||||
|
||||
import com.example.template.TempLateInit;
|
||||
import org.neoflock.neocomputers.NeoComputers;
|
||||
import net.minecraft.client.gui.screens.TitleScreen;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -12,7 +12,7 @@ public class ExampleMixin {
|
||||
|
||||
@Inject(method = "init",at=@At("HEAD"))
|
||||
void init(CallbackInfo ci){
|
||||
TempLateInit.LOGGER.info("Stonecutter example mixin init in %s".formatted(TempLateInit.PLATFORM.getModloader()));
|
||||
NeoComputers.INSTANCE.getLOGGER().info("Stonecutter example mixin init in %s".formatted(NeoComputers.INSTANCE.getPLATFORM().getModloader()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
//? if fabric {
|
||||
/*package com.example.template.platforms.fabric;
|
||||
package org.neoflock.neocomputers.platforms.fabric;
|
||||
|
||||
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
||||
import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||
import com.example.template.ConfigScreen;
|
||||
import org.neoflock.neocomputers.ConfigScreen;
|
||||
|
||||
public class ModMenuIntegration implements ModMenuApi {
|
||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||
return ConfigScreen::createConfigScreen;
|
||||
}
|
||||
}
|
||||
*///?}
|
||||
//?}
|
||||
@@ -1,15 +1,15 @@
|
||||
//? if fabric {
|
||||
/*package com.example.template.platforms.fabric;
|
||||
package org.neoflock.neocomputers.platforms.fabric;
|
||||
|
||||
import com.example.template.ModPlatform;
|
||||
import org.neoflock.neocomputers.ModPlatform;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import com.example.template.TempLateInit;
|
||||
import org.neoflock.neocomputers.NeoComputers;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
|
||||
public class TempLateFabric implements ModInitializer {
|
||||
public class NeoComputersFabric implements ModInitializer {
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
TempLateInit.entrypoint(new FabricPlatform());
|
||||
NeoComputers.INSTANCE.entrypoint(new FabricPlatform());
|
||||
}
|
||||
public static class FabricPlatform implements ModPlatform{
|
||||
|
||||
@@ -24,4 +24,4 @@ public class TempLateFabric implements ModInitializer {
|
||||
}
|
||||
}
|
||||
}
|
||||
*///?}
|
||||
//?}
|
||||
@@ -1,17 +1,18 @@
|
||||
//? if forge {
|
||||
/*package com.example.template.platforms.forge;
|
||||
/*package org.neoflock.neocomputers.neocomputers.platforms.forge;
|
||||
|
||||
import com.example.template.ConfigScreen;
|
||||
import com.example.template.TempLateInit;
|
||||
import com.example.template.ModPlatform;
|
||||
import org.neoflock.neocomputers.ConfigScreen;
|
||||
import org.neoflock.neocomputers.NeoComputersInit;
|
||||
import org.neoflock.neocomputers.ModPlatform;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import org.neoflock.neocomputers.NeoComputers;
|
||||
|
||||
@Mod("template")
|
||||
public class TempLateForge {
|
||||
public TempLateForge() {
|
||||
TempLateInit.entrypoint(new ForgePlatform());
|
||||
@Mod("neocomputers")
|
||||
public class NeoComputersForge {
|
||||
public NeoComputersForge() {
|
||||
NeoComputers.INSTANCE.entrypoint(new ForgePlatform());
|
||||
MinecraftForge.registerConfigScreen(ConfigScreen::createConfigScreen);
|
||||
}
|
||||
public static class ForgePlatform implements ModPlatform {
|
||||
@@ -1,28 +1,29 @@
|
||||
//? if neoforge {
|
||||
package com.example.template.platforms.neoforge;
|
||||
/*package org.neoflock.neocomputers.neocomputers.platforms.neoforge;
|
||||
|
||||
import com.example.template.ConfigScreen;
|
||||
import com.example.template.TempLateInit;
|
||||
import com.example.template.ModPlatform;
|
||||
import org.neoflock.neocomputers.ConfigScreen;
|
||||
import org.neoflock.neocomputers.NeoComputersInit;
|
||||
import org.neoflock.neocomputers.ModPlatform;
|
||||
import net.neoforged.fml.ModList;
|
||||
import net.neoforged.fml.ModLoadingContext;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import org.neoflock.neocomputers.NeoComputers;
|
||||
//? if <1.21 {
|
||||
/*import net.neoforged.neoforge.client.ConfigScreenHandler;
|
||||
*///?} else {
|
||||
/^import net.neoforged.neoforge.client.ConfigScreenHandler;
|
||||
^///?} else {
|
||||
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
|
||||
//?}
|
||||
@Mod("template")
|
||||
public class TempLateNeoForge {
|
||||
public TempLateNeoForge() {
|
||||
TempLateInit.entrypoint(new NeoForgePlatform());
|
||||
@Mod("neocomputers")
|
||||
public class NeoComputersNeoForge {
|
||||
public NeoComputersNeoForge() {
|
||||
NeoComputers.INSTANCE.entrypoint(new NeoForgePlatform());
|
||||
ModLoadingContext.get().registerExtensionPoint(
|
||||
//? if <1.21 {
|
||||
/*ConfigScreenHandler.ConfigScreenFactory.class,
|
||||
/^ConfigScreenHandler.ConfigScreenFactory.class,
|
||||
() -> new ConfigScreenHandler.ConfigScreenFactory(
|
||||
((client, parent) -> ConfigScreen.createConfigScreen(parent))
|
||||
)
|
||||
*///?} else {
|
||||
^///?} else {
|
||||
IConfigScreenFactory.class,
|
||||
() -> (client, parent) -> ConfigScreen.createConfigScreen(parent)
|
||||
//?}
|
||||
@@ -40,4 +41,4 @@ public class TempLateNeoForge {
|
||||
}
|
||||
}
|
||||
}
|
||||
//?}
|
||||
*///?}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.template.util;
|
||||
package org.neoflock.neocomputers.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
19
src/main/kotlin/org/neoflock/neocomputers/NeoComputers.kt
Normal file
19
src/main/kotlin/org/neoflock/neocomputers/NeoComputers.kt
Normal file
@@ -0,0 +1,19 @@
|
||||
package org.neoflock.neocomputers
|
||||
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
|
||||
|
||||
object NeoComputers {
|
||||
const val MODID: String = "neocomputers"
|
||||
val LOGGER: Logger = LoggerFactory.getLogger("NeoComputers")
|
||||
var PLATFORM: ModPlatform? = null
|
||||
|
||||
fun entrypoint(platform: ModPlatform?) {
|
||||
PLATFORM = platform
|
||||
//LOGGER.info("Started mod in %s loader".formatted(NeoComputersInit.PLATFORM.getModloader()))
|
||||
//LOGGER.info("Kotlin: %s".formatted(NeoComputers.hello()))
|
||||
LOGGER.info("Started mod in ${NeoComputers.PLATFORM?.modloader} loader")
|
||||
LOGGER.info("Hello from kotlin!")
|
||||
}
|
||||
}
|
||||
14
src/main/kotlin/org/neoflock/neocomputers/block/BaseBlock.kt
Normal file
14
src/main/kotlin/org/neoflock/neocomputers/block/BaseBlock.kt
Normal file
@@ -0,0 +1,14 @@
|
||||
package org.neoflock.neocomputers.block
|
||||
|
||||
import net.minecraft.world.level.block.Block
|
||||
|
||||
class BaseBlock : Block {
|
||||
protected val tier: Int
|
||||
constructor(tier: Int): super(Properties.of()) {
|
||||
this.tier = tier
|
||||
}
|
||||
|
||||
public fun getTier(): Int {
|
||||
return tier
|
||||
}
|
||||
}
|
||||
50
src/main/kotlin/org/neoflock/neocomputers/block/Blocks.kt
Normal file
50
src/main/kotlin/org/neoflock/neocomputers/block/Blocks.kt
Normal file
@@ -0,0 +1,50 @@
|
||||
package org.libreflock.neocomputers.block
|
||||
|
||||
import dev.architectury.registry.registries.DeferredRegister
|
||||
import dev.architectury.registry.registries.RegistrySupplier
|
||||
import net.minecraft.core.registries.Registries
|
||||
import net.minecraft.world.item.BlockItem
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.level.block.Block
|
||||
import org.libreflock.neocomputers.item.Items
|
||||
import org.libreflock.neocomputers.item.Tabs
|
||||
import org.neoflock.neocomputers.NeoComputers
|
||||
import org.neoflock.neocomputers.block.BaseBlock
|
||||
import java.util.function.Consumer
|
||||
import java.util.function.Supplier
|
||||
|
||||
object Blocks {
|
||||
val BLOCKS: DeferredRegister<Block?> = DeferredRegister.create(NeoComputers.MODID, Registries.BLOCK)
|
||||
|
||||
|
||||
val CASE: MutableList<RegistrySupplier<Block?>?>? =
|
||||
BaseBlock.register(intArrayOf(0, 1, 2), "case", { tier -> CaseBlock(tier) })
|
||||
|
||||
// public static final RegistrySupplier<Block> CASE0 = BLOCKS.register("case0", () -> new CaseBlock(0));
|
||||
// public static final RegistrySupplier<Block> CASE1 = BLOCKS.register("case1", () -> new CaseBlock(1));
|
||||
// public static final RegistrySupplier<Block> CASE2 = BLOCKS.register("case2", () -> new CaseBlock(2));
|
||||
// public static final RegistrySupplier<Block> CABLE = BLOCKS.register("cable", () -> new CableBlock());
|
||||
val SCREEN: RegistrySupplier<Block?>? = BLOCKS.register<Block?>("screen", Supplier { ScreenBlock() })
|
||||
val CABLE: RegistrySupplier<Block?>? = BLOCKS.register<Block?>("cable", Supplier { CableBlock() })
|
||||
|
||||
fun registerBlockItems() {
|
||||
BLOCKS.forEach(Consumer { sup: RegistrySupplier<Block?>? ->
|
||||
// sup.pre
|
||||
// sup.((blk) -> {
|
||||
// NeoComputers.LOGGER.info(blk.getDescriptionId());
|
||||
// if (blk instanceof BaseBlock) {
|
||||
// Items.ITEMS.register(sup.getId().getPath(), () -> new BaseBlock.BaseBlockItem(blk, new Item.Properties().arch$tab(Tabs.TAB)));
|
||||
// } else {
|
||||
// Items.ITEMS.register(sup.getId().getPath(), () -> new BlockItem(blk, new Item.Properties().arch$tab(Tabs.TAB)));
|
||||
// }
|
||||
// });
|
||||
Items.ITEMS.register(sup!!.getId().getPath(), {
|
||||
if (sup.get() is BaseBlock) {
|
||||
return@register BaseBlockItem(sup.get(), Item.Properties().`arch$tab`(Tabs.TAB))
|
||||
} else {
|
||||
return@register BlockItem(sup.get(), Item.Properties().`arch$tab`(Tabs.TAB))
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "*"
|
||||
license = "LGPLv3"
|
||||
issueTrackerURL="https://AuthorExample/TempLate/issues"
|
||||
issueTrackerURL="https://github.com/NeoFlock/NeoComputers/issues"
|
||||
|
||||
[[mods]]
|
||||
modId = "template"
|
||||
modId = "neocomputers"
|
||||
version = "${version}"
|
||||
displayName = "${name}"
|
||||
authors = "AuthorExample"
|
||||
authors = "NeoFlock Team"
|
||||
description = ""
|
||||
logoFile = "assets/template/icon.png"
|
||||
logoFile = "assets/neocomputers/icon.png"
|
||||
logoBlur = false
|
||||
|
||||
[[mixins]]
|
||||
config = "template-common.mixins.json"
|
||||
config = "neocomputers-common.mixins.json"
|
||||
|
||||
[[mixins]]
|
||||
config = "template-neoforge.mixins.json"
|
||||
config = "neocomputers-neoforge.mixins.json"
|
||||
@@ -1,19 +1,19 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "*"
|
||||
license = "LGPLv3"
|
||||
issueTrackerURL="https://AuthorExample/TempLate/issues"
|
||||
issueTrackerURL="https://github.com/NeoFlock/NeoComputers/issues"
|
||||
|
||||
[[mods]]
|
||||
modId = "template"
|
||||
modId = "neocomputers"
|
||||
version = "${version}"
|
||||
displayName = "${name}"
|
||||
authors = "AuthorExample"
|
||||
authors = "NeoFlock Team"
|
||||
description = ""
|
||||
logoFile = "assets/template/icon.png"
|
||||
logoFile = "assets/neocomputers/icon.png"
|
||||
logoBlur = false
|
||||
|
||||
[[mixins]]
|
||||
config = "template-common.mixins.json"
|
||||
config = "neocomputers-common.mixins.json"
|
||||
|
||||
[[mixins]]
|
||||
config = "template-neoforge.mixins.json"
|
||||
config = "neocomputers-neoforge.mixins.json"
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"accessWidener": "template.accesswidener"
|
||||
"accessWidener": "neocomputers.accesswidener"
|
||||
}
|
||||
4
src/main/resources/assets/neocomputers/lang/en_us.json
Normal file
4
src/main/resources/assets/neocomputers/lang/en_us.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"neocomputers.confirm": "Confirm",
|
||||
"neocomputers.cancel": "Cancel"
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"template.confirm": "Confirm",
|
||||
"template.cancel": "Cancel"
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
"name": "${name}",
|
||||
"description": "",
|
||||
"authors": [
|
||||
"AuthorExample"
|
||||
"NeoFlock Team"
|
||||
],
|
||||
"contact": {
|
||||
},
|
||||
@@ -14,18 +14,19 @@
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"com.example.template.platforms.fabric.TempLateFabric"
|
||||
"org.neoflock.neocomputers.platforms.fabric.NeoComputersFabric"
|
||||
],
|
||||
"modmenu": [
|
||||
"com.example.template.platforms.fabric.ModMenuIntegration"
|
||||
"org.neoflock.neocomputers.platforms.fabric.ModMenuIntegration"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"template-common.mixins.json",
|
||||
"template-fabric.mixins.json"
|
||||
"neocomputers-common.mixins.json",
|
||||
"neocomputers-fabric.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.15",
|
||||
"minecraft": "${minecraft}"
|
||||
"minecraft": "${minecraft}",
|
||||
"fabric-language-kotlin": ">=1.13.10+kotlin.2.3.20"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "com.example.template.mixin",
|
||||
"package": "org.neoflock.neocomputers.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "com.example.template.platforms.neoforge.mixin",
|
||||
"package": "org.neoflock.neocomputers.platforms.fabric.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "com.example.template.platforms.fabric.mixin",
|
||||
"package": "org.neoflock.neocomputers.platforms.forge.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "com.example.template.platforms.forge.mixin",
|
||||
"package": "org.neoflock.neocomputers.platforms.neoforge.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
@@ -5,7 +5,7 @@ plugins {
|
||||
id("com.gradleup.shadow") version "9.3.0" apply false
|
||||
id("me.modmuss50.mod-publish-plugin") version "0.8.4" apply false
|
||||
}
|
||||
stonecutter active "1.21.9-neoforge" /* [SC] DO NOT EDIT */
|
||||
stonecutter active "1.21.9-fabric" /* [SC] DO NOT EDIT */
|
||||
stonecutter.automaticPlatformConstants = true
|
||||
|
||||
// Builds every version into `build/libs/{mod.version}/{loader}`
|
||||
|
||||
Reference in New Issue
Block a user