Skip to content

Commit e0c871e

Browse files
committed
remove check code style
1 parent 7bac871 commit e0c871e

8 files changed

Lines changed: 193 additions & 146 deletions

File tree

build.gradle

Lines changed: 0 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -51,150 +51,4 @@ sourceSets {
5151
srcDirs = []
5252
}
5353
}
54-
}
55-
56-
// Put licenser here otherwise it tries to license all source sets including decompiled MC sources
57-
license {
58-
header = file('codeformat/HEADER.txt')
59-
skipExistingHeaders = true
60-
tasks {
61-
neoforge {
62-
// Add all NeoForge sources
63-
files.from rootProject.fileTree("src", {
64-
include "**/*.java"
65-
})
66-
}
67-
}
68-
}
69-
70-
// Put spotless here because it wants the files to live inside the project root
71-
immaculate {
72-
workflows.named("java") {
73-
files.from rootProject.fileTree("buildSrc/src", {
74-
include "**/*.java"
75-
})
76-
files.from rootProject.fileTree("src", {
77-
include "**/*.java"
78-
})
79-
}
80-
workflows.register("patches") {
81-
files.from(rootProject.fileTree("patches"))
82-
83-
custom 'noImportChanges', { String fileContents ->
84-
if (fileContents.contains('+import') || fileContents.contains('-import')) {
85-
throw new GradleException("Import changes are not allowed in patches!")
86-
}
87-
return fileContents
88-
}
89-
90-
def interfaceChange = Pattern.compile('[-+].*(implements|(interface.*extends))(.*)\\{')
91-
custom 'noInterfaceModifications', { String fileContents ->
92-
// FIXME: remove when handling of Holder is resolved
93-
// Special case: removal of sealed and permits incorrectly triggers interface change detection
94-
if (fileContents.startsWith("--- a/net/minecraft/core/Holder.java")) {
95-
return fileContents
96-
}
97-
98-
def interfaceChanges = fileContents.lines().filter { it.matches(interfaceChange) }.toList()
99-
if (interfaceChanges.isEmpty()) return fileContents
100-
String oldInterfaces = ""
101-
// we expect interface additions/removals in pairs of - and then +
102-
interfaceChanges.each { String change ->
103-
final match = change =~ interfaceChange
104-
match.find()
105-
final values = match.group(3).trim()
106-
if (change.startsWith('-')) {
107-
oldInterfaces = values
108-
} else if (oldInterfaces != values) {
109-
throw new GradleException("Modification of interfaces via patches is not allowed!")
110-
}
111-
}
112-
return fileContents
113-
}
114-
115-
//Note: This doesn't detect changing access level to or from package private
116-
//TODO: Eventually try and make this support checking package private access level changes?
117-
def accessLevelChange = Pattern.compile('^[-+]\\s*(public|private|protected)\\s.*\$', Pattern.UNIX_LINES | Pattern.MULTILINE)
118-
custom 'noAccessChanges', { String fileContents ->
119-
// Special case: we need to make the field private for our coremod
120-
if (fileContents.startsWith("--- a/net/minecraft/world/level/levelgen/structure/Structure.java")) {
121-
return fileContents
122-
}
123-
124-
// The anvil menu patches a method to be final, which cannot be done with an AT, but trips this check otherwise.
125-
if (fileContents.startsWith("--- a/net/minecraft/world/inventory/AnvilMenu.java")) {
126-
return fileContents
127-
}
128-
129-
def accessChanges = fileContents.findAll(accessLevelChange)
130-
if (accessChanges.isEmpty()) return fileContents
131-
Map<String, Set<String>> removals = Map.of("private", new HashSet<>(), "protected", new HashSet<>(), "public", new HashSet<>())
132-
accessChanges.each { String change ->
133-
//Get the type of match
134-
String[] data = change.substring(1).trim().split(" ", 2)
135-
String lineStart = data[1].substring(0, Math.min(30, data[1].length()))
136-
if (change.startsWith('-')) {//Removal
137-
removals.get(data[0]).add(lineStart)
138-
} else {//Addition
139-
for (var entry : removals.entrySet()) {
140-
if (entry.key == data[0]) {
141-
continue
142-
}
143-
if (entry.value.remove(lineStart)) {
144-
throw new GradleException("Changing access level via patches is not allowed, use an AT! Changed line: " + change)
145-
}
146-
}
147-
}
148-
}
149-
//Note: We allow mismatched counts in case we are removing a method entirely for some reason
150-
return fileContents
151-
}
152-
153-
//Trim any trailing whitespace from patch additions
154-
def trailingWhitespace = Pattern.compile('^\\+.*[ \t]+\$', Pattern.UNIX_LINES | Pattern.MULTILINE)
155-
custom 'trimTrailingWhitespacePatches', { String fileContents ->
156-
Matcher matcher = trailingWhitespace.matcher(fileContents)
157-
StringBuilder sb = new StringBuilder()
158-
while (matcher.find()) {
159-
matcher.appendReplacement(sb, matcher.group().trim())
160-
}
161-
matcher.appendTail(sb)
162-
return sb.toString()
163-
}
164-
165-
// Disallow explicit not null in patches, it's always implied.
166-
custom 'noNotNull', { String fileContents ->
167-
fileContents.eachLine {
168-
if (!it.startsWith("+")) return
169-
if (it.contains('@NotNull') || it.contains('@Nonnull')
170-
|| it.contains('@org.jetbrains.annotations.NotNull')
171-
|| it.contains('@javax.annotation.Nonnull')) {
172-
throw new GradleException('@NotNull and @Nonnull are disallowed.')
173-
}
174-
}
175-
}
176-
177-
//Replace any FQN versions of javax/jetbrains @Nullable with the jspecify variant
178-
custom 'jetbrainsNullablePatches', { String fileContents ->
179-
fileContents.replace('@javax.annotation.Nullable', '@org.jspecify.annotations.Nullable')
180-
fileContents.replace('@org.jetbrains.annotations.Nullable', '@org.jspecify.annotations.Nullable')
181-
}
182-
}
183-
}
184-
185-
final task = tasks.register('checkSourcesAreSplit', CheckSplitSources) {
186-
serverClientFolder = project.provider { project.layout.projectDirectory.dir('src/main/java/net/neoforged/neoforge/client') }
187-
.map { it.asFile.exists() ? it : null }
188-
clientClientFolder = project.layout.projectDirectory.dir('src/client/java/net/neoforged/neoforge/client')
189-
}
190-
191-
tasks.named('checkFormatting') {
192-
dependsOn(task)
193-
}
194-
195-
tasks.withType(JavaCompile).configureEach {
196-
it.options.release = 25
197-
options.encoding = 'UTF-8'
198-
options.warnings = false
199-
options.compilerArgs << "-Xlint:-removal" << "-Xlint:-deprecation" << "-Xlint:-dep-ann" << "-Xlint:-varargs" << "-Xdiags:verbose"
20054
}

projects/neoforge/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ changelog {
2525
disableAutomaticPublicationRegistration()
2626
}
2727

28+
tasks.withType(JavaCompile).configureEach {
29+
it.options.release = 25
30+
options.encoding = 'UTF-8'
31+
options.warnings = false
32+
options.compilerArgs << "-Xlint:-removal" << "-Xlint:-deprecation" << "-Xlint:-dep-ann" << "-Xlint:-varargs" << "-Xdiags:verbose"
33+
}
34+
2835
sourceSets {
2936
main {
3037
java {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Modified Class list,check it when migrate
2+
net/minecraft/commands/Commands # add inner class
3+
net/minecraft/world/level/block/ChestBlock # add inner class
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package org.teneted.neotenet;
2+
3+
import net.neoforged.neoforge.common.NeoForgeVersion;
4+
import org.apache.logging.log4j.LogManager;
5+
import org.apache.logging.log4j.Logger;
6+
7+
import java.time.ZoneId;
8+
9+
public class NeoTenet {
10+
11+
public static final String MOD_ID = "neotenet";
12+
public static final Logger LOGGER = LogManager.getLogger();
13+
public static final float javaVersion = Float.parseFloat(System.getProperty("java.class.version"));
14+
15+
// ANSI color codes
16+
private static final String CYAN = "\u001B[36m";
17+
private static final String YELLOW = "\u001B[33m";
18+
private static final String RESET = "\u001B[0m";
19+
20+
public static void run() throws Exception {
21+
System.out.println(YELLOW + "Welcome to NeoTenet for NeoForge " + NeoForgeVersion.getVersion() + ", Java " + javaVersion + RESET);
22+
23+
ZoneId zoneId = ZoneId.of("Asia/Shanghai");
24+
if (zoneId.getId().contains("China")) {
25+
System.out.println("官方吃瓜交流QQ群: 211128424");
26+
System.out.println("官方反馈交流QQ群: 1021810052");
27+
System.out.println("如果控制台出现中文乱码请添加启动参数: -Dfile.encoding=GBK%n");
28+
}
29+
}
30+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This is the main configuration file for Bukkit.
2+
# As you can see, there's actually not that much to configure without any plugins.
3+
# For a reference for any variable inside this file, check out the Bukkit Wiki at
4+
# https://www.spigotmc.org/go/bukkit-yml
5+
#
6+
# If you need help on this file, feel free to join us on Discord or leave a message
7+
# on the forums asking for advice.
8+
#
9+
# Discord: https://www.spigotmc.org/go/discord
10+
# Forums: https://www.spigotmc.org/
11+
# Bug tracker: https://www.spigotmc.org/go/bugs
12+
13+
14+
settings:
15+
allow-nether: true
16+
allow-end: true
17+
warn-on-overload: true
18+
permissions-file: permissions.yml
19+
update-folder: update
20+
plugin-profiling: false
21+
connection-throttle: 4000
22+
query-plugins: true
23+
deprecated-verbose: default
24+
shutdown-message: Server closed
25+
minimum-api: none
26+
use-map-color-cache: true
27+
compatibility:
28+
allow-old-keys-in-registry: false
29+
enum-compatibility-mode: false
30+
spawn-limits:
31+
monsters: 70
32+
animals: 10
33+
water-animals: 5
34+
water-ambient: 20
35+
water-underground-creature: 5
36+
axolotls: 5
37+
ambient: 15
38+
chunk-gc:
39+
period-in-ticks: 600
40+
ticks-per:
41+
animal-spawns: 400
42+
monster-spawns: 1
43+
water-spawns: 1
44+
water-ambient-spawns: 1
45+
water-underground-creature-spawns: 1
46+
axolotl-spawns: 1
47+
ambient-spawns: 1
48+
autosave: 6000
49+
aliases: now-in-commands.yml
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This is the commands configuration file for Bukkit.
2+
# For documentation on how to make use of this file, check out the Bukkit Wiki at
3+
# https://www.spigotmc.org/go/commands-yml
4+
#
5+
# If you need help on this file, feel free to join us on Discord or leave a message
6+
# on the forums asking for advice.
7+
#
8+
# Discord: https://www.spigotmc.org/go/discord
9+
# Forums: https://www.spigotmc.org/
10+
# Bug tracker: https://www.spigotmc.org/go/bugs
11+
12+
command-block-overrides: []
13+
ignore-vanilla-permissions: false
14+
aliases:
15+
icanhasbukkit:
16+
- "version $1-"
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# This is the help configuration file for Bukkit.
2+
#
3+
# By default you do not need to modify this file. Help topics for all plugin commands are automatically provided by
4+
# or extracted from your installed plugins. You only need to modify this file if you wish to add new help pages to
5+
# your server or override the help pages of existing plugin commands.
6+
#
7+
# This file is divided up into the following parts:
8+
# -- general-topics: lists admin defined help topics
9+
# -- index-topics: lists admin defined index topics
10+
# -- amend-topics: lists topic amendments to apply to existing help topics
11+
# -- ignore-plugins: lists any plugins that should be excluded from help
12+
#
13+
# Examples are given below. When amending command topic, the string <text> will be replaced with the existing value
14+
# in the help topic. Color codes can be used in topic text. The color code character is & followed by 0-F.
15+
# ================================================================
16+
#
17+
# Set this to true to list the individual command help topics in the master help.
18+
# command-topics-in-master-index: true
19+
#
20+
# Each general topic will show up as a separate topic in the help index along with all the plugin command topics.
21+
# general-topics:
22+
# Rules:
23+
# shortText: Rules of the server
24+
# fullText: |
25+
# &61. Be kind to your fellow players.
26+
# &B2. No griefing.
27+
# &D3. No swearing.
28+
# permission: topics.rules
29+
#
30+
# Each index topic will show up as a separate sub-index in the help index along with all the plugin command topics.
31+
# To override the default help index (displayed when the user executes /help), name the index topic "Default".
32+
# index-topics:
33+
# Ban Commands:
34+
# shortText: Player banning commands
35+
# preamble: Moderator - do not abuse these commands
36+
# permission: op
37+
# commands:
38+
# - /ban
39+
# - /ban-ip
40+
# - /banlist
41+
#
42+
# Topic amendments are used to change the content of automatically generated plugin command topics.
43+
# amended-topics:
44+
# /stop:
45+
# shortText: Stops the server cold....in its tracks!
46+
# fullText: <text> - This kills the server.
47+
# permission: you.dont.have
48+
#
49+
# Any plugin in the ignored plugins list will be excluded from help. The name must match the name displayed by
50+
# the /plugins command. Ignore "Bukkit" to remove the standard bukkit commands from the index. Ignore "All"
51+
# to completely disable automatic help topic generation.
52+
# ignore-plugins:
53+
# - PluginNameOne
54+
# - PluginNameTwo
55+
# - PluginNameThree
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Configuration status="WARN">
3+
<Appenders>
4+
<Console name="SysOut" target="SYSTEM_OUT">
5+
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg{nolookups}%n" />
6+
</Console>
7+
<Queue name="ServerGuiConsole">
8+
<PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg{nolookups}%n" />
9+
</Queue>
10+
<Queue name="TerminalConsole">
11+
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg{nolookups}%n" />
12+
</Queue>
13+
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
14+
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg{nolookups}%n" />
15+
<Policies>
16+
<TimeBasedTriggeringPolicy />
17+
<OnStartupTriggeringPolicy />
18+
</Policies>
19+
<DefaultRolloverStrategy max="1000"/>
20+
</RollingRandomAccessFile>
21+
</Appenders>
22+
<Loggers>
23+
<Root level="info">
24+
<filters>
25+
<MarkerFilter marker="NETWORK_PACKETS" onMatch="DENY" onMismatch="NEUTRAL" />
26+
</filters>
27+
<AppenderRef ref="SysOut"/>
28+
<AppenderRef ref="File"/>
29+
<AppenderRef ref="ServerGuiConsole"/>
30+
<AppenderRef ref="TerminalConsole"/>
31+
</Root>
32+
</Loggers>
33+
</Configuration>

0 commit comments

Comments
 (0)