Skip to content

Commit 2360fc3

Browse files
Updated to support Minecraft 1.19
1 parent dbbda17 commit 2360fc3

File tree

14 files changed

+562
-536
lines changed

14 files changed

+562
-536
lines changed

Build and copy to mods.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@echo off
2-
set MCVERSION=1.18.1
2+
set MCVERSION=1.19
33
set MODVERSION=1.1
44
gradlew build && copy "build\libs\PlayerStatisticsList-%MCVERSION%-%MODVERSION%.jar" "%AppData%\.minecraft\mods\PlayerStatisticsList-%MCVERSION%-%MODVERSION%.jar"
55
pause

Forge-README.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
4040

4141
Additional Resources:
4242
=========================
43-
Community Documentation: http://mcforge.readthedocs.io/en/latest/gettingstarted/
43+
Community Documentation: https://mcforge.readthedocs.io/en/latest/gettingstarted/
4444
LexManos' Install Video: https://www.youtube.com/watch?v=8VEdtQLuLO0
4545
Forge Forum: https://forums.minecraftforge.net/
46-
Forge Discord: https://discord.gg/UvedJ9m
46+
Forge Discord: https://discord.gg/UvedJ9m

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ A Minecraft Forge mod showing relevant statistics about the player and the world
33

44
This mod is client-side only, meaning the server(s) you are joining don't need to be modded in order for this mod to work for you.
55

6+
The code in this project is several years old and in need of a huge refactor. Read it at your own risk. :)
7+
68
## Requirements
79
For running:
8-
- Minecraft Forge Client 39.0.10 or higher (MC version 1.18.1)
10+
- Minecraft Forge Client 41.0.98 or higher (MC version 1.19)
911

1012
For building:
1113
- Java SE Development Kit 17 / OpenJDK 17 or higher

build.gradle

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,32 @@
1-
buildscript {
2-
repositories {
3-
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below
4-
maven { url = 'https://maven.minecraftforge.net' }
5-
mavenCentral()
6-
}
7-
dependencies {
8-
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
9-
}
1+
plugins {
2+
id 'eclipse'
3+
id 'maven-publish'
4+
id 'net.minecraftforge.gradle' version '5.1.+'
105
}
11-
apply plugin: 'net.minecraftforge.gradle'
12-
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
13-
apply plugin: 'eclipse'
14-
apply plugin: 'maven-publish'
156

16-
version = '1.18.1-1.1'
7+
version = '1.19-1.1'
178
group = 'com.mydoomsite.statsmod' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
189
archivesBaseName = 'PlayerStatisticsList'
1910

2011
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
2112
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
2213

23-
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
14+
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
2415
minecraft {
2516
// The mappings can be changed at any time and must be in the following format.
2617
// Channel: Version:
27-
// snapshot YYYYMMDD Snapshot are built nightly.
28-
// stable # Stables are built at the discretion of the MCP team.
29-
// official MCVersion Official field/method names from Mojang mapping files
18+
// official MCVersion Official field/method names from Mojang mapping files
19+
// parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
3020
//
31-
// You must be aware of the Mojang license when using the 'official' mappings.
21+
// You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
3222
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
3323
//
24+
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
25+
// Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started
26+
//
3427
// Use non-default mappings at your own risk. They may not always work.
3528
// Simply re-run your setup task after changing the mappings to update your workspace.
36-
mappings channel: 'official', version: '1.18.1'
29+
mappings channel: 'official', version: '1.19'
3730

3831
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.
3932

@@ -55,8 +48,11 @@ minecraft {
5548
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
5649
property 'forge.logging.console.level', 'debug'
5750

51+
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
52+
property 'forge.enabledGameTestNamespaces', 'mydoomsite_statsmod'
53+
5854
mods {
59-
examplemod {
55+
mydoomsite_statsmod {
6056
source sourceSets.main
6157
}
6258
}
@@ -65,18 +61,31 @@ minecraft {
6561
server {
6662
workingDirectory project.file('run')
6763

68-
// Recommended logging data for a userdev environment
69-
// The markers can be added/remove as needed separated by commas.
70-
// "SCAN": For mods scan.
71-
// "REGISTRIES": For firing of registry events.
72-
// "REGISTRYDUMP": For getting the contents of all registries.
7364
property 'forge.logging.markers', 'REGISTRIES'
7465

75-
// Recommended logging level for the console
76-
// You can set various levels here.
77-
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
7866
property 'forge.logging.console.level', 'debug'
7967

68+
property 'forge.enabledGameTestNamespaces', 'mydoomsite_statsmod'
69+
70+
mods {
71+
mydoomsite_statsmod {
72+
source sourceSets.main
73+
}
74+
}
75+
}
76+
77+
// This run config launches GameTestServer and runs all registered gametests, then exits.
78+
// By default, the server will crash when no gametests are provided.
79+
// The gametest system is also enabled by default for other run configs under the /test command.
80+
gameTestServer {
81+
workingDirectory project.file('run')
82+
83+
property 'forge.logging.markers', 'REGISTRIES'
84+
85+
property 'forge.logging.console.level', 'debug'
86+
87+
property 'forge.enabledGameTestNamespaces', 'mydoomsite_statsmod'
88+
8089
mods {
8190
mydoomsite_statsmod {
8291
source sourceSets.main
@@ -87,16 +96,8 @@ minecraft {
8796
data {
8897
workingDirectory project.file('run')
8998

90-
// Recommended logging data for a userdev environment
91-
// The markers can be added/remove as needed separated by commas.
92-
// "SCAN": For mods scan.
93-
// "REGISTRIES": For firing of registry events.
94-
// "REGISTRYDUMP": For getting the contents of all registries.
9599
property 'forge.logging.markers', 'REGISTRIES'
96100

97-
// Recommended logging level for the console
98-
// You can set various levels here.
99-
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
100101
property 'forge.logging.console.level', 'debug'
101102

102103
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
@@ -128,7 +129,7 @@ dependencies {
128129
// Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed
129130
// that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied.
130131
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
131-
minecraft 'net.minecraftforge:forge:1.18.1-39.0.10'
132+
minecraft 'net.minecraftforge:forge:1.19-41.0.98'
132133

133134
// Real mod deobf dependency examples - these get remapped to your current mappings
134135
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
@@ -176,3 +177,7 @@ publishing {
176177
}
177178
}
178179
}
180+
181+
tasks.withType(JavaCompile).configureEach {
182+
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
183+
}

gradle/wrapper/gradle-wrapper.jar

285 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
#
4-
# Copyright © 2015-2021 the original authors.
4+
# Copyright © 2015-2021 the original authors.
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
@@ -32,10 +32,10 @@
3232
# Busybox and similar reduced shells will NOT work, because this script
3333
# requires all of these POSIX shell features:
3434
# * functions;
35-
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36-
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37-
# * compound commands having a testable exit status, especially «case»;
38-
# * various built-in commands including «command», «set», and «ulimit».
35+
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36+
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37+
# * compound commands having a testable exit status, especially «case»;
38+
# * various built-in commands including «command», «set», and «ulimit».
3939
#
4040
# Important for patching:
4141
#

settings.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pluginManagement {
2+
repositories {
3+
gradlePluginPortal()
4+
maven { url = 'https://maven.minecraftforge.net/' }
5+
}
6+
}

src/main/java/com/mydoomsite/statsmod/Main/Drawing.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.mydoomsite.statsmod.lib.TextMetrics;
66

77
import net.minecraft.client.Minecraft;
8-
import net.minecraft.network.chat.TextComponent;
8+
import net.minecraft.network.chat.Component;
99

1010
public class Drawing
1111
{
@@ -97,6 +97,6 @@ public static void DrawTextScaled(PoseStack matrixStack, String text, float x, f
9797

9898
public static void sendChatMessageToClient(String message)
9999
{
100-
minecraft.player.sendMessage(new TextComponent("\u00A7l\u00A7e[Statistics List]\u00A7r " + message), null);
100+
minecraft.player.displayClientMessage(Component.literal("\u00A7l\u00A7e[Statistics List]\u00A7r " + message), false); // false = Display in chat, true = Display above status bar
101101
}
102102
}

src/main/java/com/mydoomsite/statsmod/Main/MainRegistry.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.mydoomsite.statsmod.Main;
22

33
import net.minecraftforge.api.distmarker.Dist;
4+
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
45
import net.minecraftforge.common.MinecraftForge;
56
import net.minecraftforge.fml.DistExecutor;
67
import net.minecraftforge.fml.IExtensionPoint;
@@ -29,6 +30,7 @@ public MainRegistry()
2930
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
3031
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::Setup);
3132
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::ClientSetup);
33+
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::RegisterKeyBindings);
3234
});
3335
}
3436

@@ -41,7 +43,12 @@ private void ClientSetup(final FMLClientSetupEvent event)
4143
{
4244
StringHelper.Initialize();
4345
MinecraftForge.EVENT_BUS.register(RenderHandler.Instance);
44-
MinecraftForge.EVENT_BUS.register(new KeyBindings());
46+
MinecraftForge.EVENT_BUS.register(KeyBindings.Instance);
4547
MinecraftForge.EVENT_BUS.register(new TickHandlers());
4648
}
49+
50+
private void RegisterKeyBindings(RegisterKeyMappingsEvent event)
51+
{
52+
KeyBindings.RegisterKeyBindings(event);
53+
}
4754
}

0 commit comments

Comments
 (0)