Skip to content

Commit 00a0761

Browse files
committed
Make forge on fabric not allow the game to continue
1 parent a16504c commit 00a0761

6 files changed

Lines changed: 198 additions & 2 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
plugins {
2+
}
3+
4+
configurations {
5+
shadow
6+
}
7+
8+
architectury {
9+
platformSetupLoomIde()
10+
}
11+
12+
repositories {
13+
mavenCentral()
14+
maven {
15+
name = "Fabric"
16+
url = "https://maven.fabricmc.net/"
17+
}
18+
}
19+
20+
sourceCompatibility = JavaVersion.VERSION_1_8
21+
targetCompatibility = JavaVersion.VERSION_1_8
22+
23+
dependencies {
24+
//to change the versions see the gradle.properties file
25+
minecraft "com.mojang:minecraft:${project.minecraft_version}"
26+
mappings("net.fabricmc:yarn:${rootProject.mappings}:v2")
27+
28+
modImplementation(include(fabricApi.module("fabric-lifecycle-events-v1", "0.32.5+1.16")))
29+
}
30+
31+
processResources {
32+
filesMatching("fabric.mod.json") {
33+
expand "version": project.version
34+
}
35+
inputs.property "version", project.version
36+
}
37+
38+
remapJar {
39+
archiveClassifier = "forge-on-fabric-warning"
40+
}
41+
42+
processResources {
43+
inputs.property "version", project.version
44+
45+
from(sourceSets.main.resources.srcDirs) {
46+
include "fabric.mod.json"
47+
expand "version": project.version
48+
}
49+
50+
from(sourceSets.main.resources.srcDirs) {
51+
exclude "fabric.mod.json"
52+
}
53+
}
54+
55+
// ensure that the encoding is set to UTF-8, no matter what the system default is
56+
// this fixes some edge cases with special characters not displaying correctly
57+
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
58+
tasks.withType(JavaCompile) {
59+
options.encoding = "UTF-8"
60+
}
61+
62+
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
63+
// if it is present.
64+
// If you remove this task, sources will not be generated.
65+
task sourcesJar(type: Jar, dependsOn: classes) {
66+
classifier = "sources"
67+
from sourceSets.main.allSource
68+
}
69+
70+
jar {
71+
from "LICENSE"
72+
}
73+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2021 OroArmor (Eli Orona)
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
package com.oroarmor.netherite_plus;
26+
27+
import net.minecraft.client.gui.screen.TitleScreen;
28+
import net.minecraft.text.LiteralText;
29+
30+
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
31+
32+
public class NetheritePlusModWarning {
33+
public static void onInitializeClient() {
34+
ClientTickEvents.END_CLIENT_TICK.register(client -> {
35+
if (client.currentScreen instanceof TitleScreen) {
36+
client.openScreen(new WarningScreen(new LiteralText("Wrong mod Installed")));
37+
}
38+
});
39+
}
40+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2021 OroArmor (Eli Orona)
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
package com.oroarmor.netherite_plus;
26+
27+
import net.minecraft.client.MinecraftClient;
28+
import net.minecraft.client.gui.screen.Screen;
29+
import net.minecraft.client.util.math.MatrixStack;
30+
import net.minecraft.text.Text;
31+
32+
public class WarningScreen extends Screen {
33+
protected WarningScreen(Text title) {
34+
super(title);
35+
}
36+
37+
@Override
38+
public void init(MinecraftClient client, int width, int height) {
39+
super.init(client, width, height);
40+
// this.addChild(new TextFieldWidget(client.textRenderer, 100, 100, width, height, new LiteralText("Forge Netherite Plus is installed. Get the fabric version")));
41+
}
42+
43+
@Override
44+
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
45+
super.render(matrices, mouseX, mouseY, delta);
46+
this.renderBackground(matrices);
47+
String text = "Forge Netherite Plus is Installed. Get the Fabric Version.";
48+
this.textRenderer.draw(matrices, text, this.width / 2f - this.textRenderer.getWidth(text) / 2f, this.height / 2f, 0xFFFFFF);
49+
}
50+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"schemaVersion": 1,
3+
"id": "netherite_plus",
4+
"version": "${version}",
5+
"name": "Netherite Plus Mod",
6+
"description": "This mod adds extra netherite features that aren't vanillia.\n\nNOTE: Editing the config requires a game restart",
7+
"authors": [
8+
"OroArmor",
9+
"1198159",
10+
"Ron (Texture Artist)"
11+
],
12+
"contact": {
13+
"sources": "https://github.com/OroArmor/Netherite-Plus-Mod/",
14+
"homepage": "https://www.curseforge.com/minecraft/mc-mods/netherite-plus-mod",
15+
"issues": "https://github.com/OroArmor/Netherite-Plus-Mod/issues"
16+
},
17+
"license": "MIT",
18+
"icon": "assets/netherite_plus/icon.png",
19+
"environment": "*",
20+
"entrypoints": {
21+
"client": [
22+
"com.oroarmor.netherite_plus.NetheritePlusModWarning::onInitializeClient"
23+
]
24+
},
25+
"depends": {
26+
"fabricloader": ">=0.7.4",
27+
"minecraft": ">=1.16.4"
28+
},
29+
"suggests": {
30+
"flamingo": "*"
31+
}
32+
}

forge/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ dependencies {
5555
exclude(module: "fabric-loader")
5656
transitive = false
5757
}
58+
59+
shadow(rootProject.files("/forge-on-fabric-warning/build/libs/netherite-plus-mod-${rootProject.mod_version}-${rootProject.architectury.minecraft}.jar"))
5860
}
5961

6062
processResources {
@@ -72,8 +74,6 @@ processResources {
7274

7375

7476
shadowJar {
75-
exclude "fabric.mod.json"
76-
7777
configurations = [project.configurations.shadow]
7878
classifier "shadow"
7979
}

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ pluginManagement {
1111
include("common")
1212
include("fabric")
1313
include("forge")
14+
include("forge-on-fabric-warning")
1415

1516
rootProject.name = "netherite-plus-mod"

0 commit comments

Comments
 (0)