Skip to content

Commit 9a8d969

Browse files
committed
优化替换模式 移除部分gradle注释
1 parent c0810df commit 9a8d969

File tree

5 files changed

+59
-157
lines changed

5 files changed

+59
-157
lines changed

build.gradle

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -42,53 +42,6 @@ preprocess {
4242
mc12105.link(mc12106, file("versions/mapping-1.21.5-1.21.6.txt"))
4343
}
4444

45-
//ext {
46-
// env = System.getenv()
47-
//
48-
// getVersionGit = { List paths ->
49-
// if (grgit == null) {
50-
// return "nogit"
51-
// }
52-
//
53-
// List latestCommits = paths.isEmpty() ? grgit.log(maxCommits: 1) : grgit.log(paths: paths, maxCommits: 1)
54-
// return latestCommits.isEmpty() ? "uncommited" : "${latestCommits.get(0).id.substring(0, 7)}"
55-
// }
56-
//
57-
// getBuildNumber = {
58-
// return ext.env.GITHUB_RUN_NUMBER ? ext.env.GITHUB_RUN_NUMBER : Integer.MAX_VALUE
59-
// }
60-
//
61-
// getVersionType = {
62-
// switch (ext.env.BUILD_TYPE) {
63-
// case "RELEASE":
64-
// return "stable"
65-
// case "BETA":
66-
// return "beta"
67-
// default:
68-
// return "dev"
69-
// }
70-
// }
71-
//
72-
// getVersionPatch = { List paths ->
73-
// if (grgit == null) {
74-
// return 0
75-
// }
76-
//
77-
// List latestCommits = paths.isEmpty() ? grgit.log() : grgit.log(paths: paths)
78-
// return latestCommits.size()
79-
// }
80-
//
81-
// getMavenArtifactVersion = {
82-
// return ext.getVersionType() == "stable" ? "${project.mod_version}.${ext.getVersionPatch([])}" : project.version
83-
// }
84-
//
85-
// getModVersion = {
86-
// return "${project.mod_version}.${getVersionPatch([])}+${getVersionGit([])}-${getVersionType()}"
87-
// }
88-
//}
89-
//
90-
//setVersion(project.getModVersion())
91-
9245
tasks.register("cleanPreprocessSources") {
9346
it.group("${project.mod_id}")
9447

common.gradle

Lines changed: 2 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import com.google.common.collect.ImmutableList
22
import com.google.common.collect.ImmutableMap
3-
import net.fabricmc.loom.util.Platform
43
import org.objectweb.asm.ClassReader
54
import org.objectweb.asm.ClassWriter
65
import org.objectweb.asm.tree.ClassNode
@@ -124,7 +123,7 @@ def mod_dependencies = [
124123
[(mcVersion > 12004 ? "curse.maven:carpet-349239" : "maven.modrinth:carpet"), "carpet", 1],
125124
["net.kyrptonaught:kyrptconfig", "kyrptconfig", 1],
126125
["net.kyrptonaught:shulkerutils", "shulkerutils", mcVersion > 12004 ? 0 : 1],
127-
[getSbYacl(), "yacl", mcVersion >= 12001 ? 1 : 0],
126+
[getYacl(), "yacl", mcVersion >= 12001 ? 1 : 0],
128127
["maven.modrinth:chest-tracker", "chesttracker", mcVersion < 12105 ? 1 : 4], //TODO 箱子追踪未更新21.5
129128
["maven.modrinth:where-is-it", "whereisit", mcVersion < 12105 ? 1 : 4],
130129
["red.jackf.jackfredlib:jackfredlib", "jackfredlib", mcVersion >= 12001 ? 1 : 0],
@@ -135,10 +134,9 @@ def mod_dependencies = [
135134
["io.github.cottonmc:LibGui", "LibGui", mcVersion < 12001 ? 1 : 0],
136135
]
137136

138-
String getSbYacl() {
137+
String getYacl() {
139138
// return "maven.modrinth:yacl";
140139
return mcVersion == 12002 ? "maven.modrinth:yacl" : "dev.isxander:yet-another-config-lib";
141-
// return"maven.modrinth:yacl";
142140
}
143141

144142
String getQuiShulkerBox() {
@@ -281,76 +279,6 @@ loom {
281279
}
282280
}
283281

284-
//tasks.register("serverPropertiesJar", Jar) {
285-
// File propsFile = file("build/tmp/install.properties")
286-
//
287-
// doFirst {
288-
// if (propsFile.exists()) {
289-
// propsFile.delete()
290-
// }
291-
//
292-
// BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(propsFile))
293-
// bufferedWriter.writeLine("fabric-loader-version=${project.loader_version}")
294-
// bufferedWriter.writeLine("game-version=${project.minecraft_version}")
295-
// bufferedWriter.close()
296-
// }
297-
//
298-
// archiveFileName.set("server-properties.jar")
299-
// destinationDirectory.set(file("build/tmp"))
300-
// from(propsFile)
301-
//}
302-
303-
//tasks.register("runProductionClient", JavaExec) {
304-
// dependsOn(tasks.remapJar)
305-
// classpath.from(configurations.productionRuntimeClient)
306-
// mainClass.set("net.fabricmc.loader.impl.launch.knot.KnotClient")
307-
// workingDir(file("run/client"))
308-
//
309-
// doFirst {
310-
// classpath.from(loom.minecraftProvider.minecraftClientJar)
311-
// args(
312-
// "--assetIndex", loom.minecraftProvider.versionInfo.assetIndex().fabricId(loom.minecraftProvider.minecraftVersion()),
313-
// "--assetsDir", file("${loom.files.userCache}/assets").absolutePath,
314-
// "--gameDir", workingDir.absolutePath,
315-
// "--width", "1280",
316-
// "--height", "720",
317-
// )
318-
// jvmArgs("-Dmixin.debug.export=true")
319-
// jvmArgs("-Dfabric.addMods=${configurations.productionRuntimeMods.files.join(File.pathSeparator)}${File.pathSeparator}${tasks.remapJar.archiveFile.get().asFile.absolutePath}")
320-
//
321-
//
322-
// if (Platform.CURRENT.operatingSystem.isMacOS()) {
323-
// jvmArgs("-XstartOnFirstThread")
324-
// }
325-
// }
326-
//}
327-
328-
//tasks.register("runProductionServer", JavaExec) {
329-
// dependsOn(tasks.remapJar)
330-
// classpath.from(configurations.productionRuntimeServer, tasks.named("serverPropertiesJar"))
331-
// mainClass.set("net.fabricmc.installer.ServerLauncher")
332-
// workingDir(file("run/server"))
333-
//
334-
// doFirst {
335-
// args("nogui")
336-
// jvmArgs("-Dmixin.debug.export=true")
337-
// jvmArgs("-Dfabric.addMods=${configurations.productionRuntimeMods.files.join(File.pathSeparator)}${File.pathSeparator}${tasks.remapJar.archiveFile.get().asFile.absolutePath}")
338-
// }
339-
//}
340-
341-
//["serverPropertiesJar",
342-
// "runClient", "runServer",
343-
// "runMixinAuditClient", "runMixinAuditServer",
344-
// "runProductionClient", "runProductionServer",
345-
// "preprocessCode", "preprocessResources",
346-
// "preprocessTestCode", "preprocessTestResources"].forEach {
347-
// if (tasks.getNames().contains(it)) {
348-
// tasks.named(it) {
349-
// it.group("${mod_id}")
350-
// }
351-
// }
352-
//}
353-
354282
tasks.withType(JavaCompile).configureEach {
355283
options.encoding("UTF-8")
356284
}

src/main/java/me/aleksilassila/litematica/printer/printer/PlacementGuide.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ public PlacementGuide(@NotNull MinecraftClient client) {
5252

5353
return buildAction(world, worldSchematic, pos, ClassHook.DEFAULT);
5454
}
55+
public @Nullable ClassHook getClassHook(BlockState requiredState) {
56+
for (ClassHook hook : ClassHook.values()) {
57+
for (Class<?> clazz : hook.classes) {
58+
if (clazz != null && clazz.isInstance(requiredState.getBlock())) {
59+
return hook;
60+
}
61+
}
62+
}
63+
return ClassHook.DEFAULT;
64+
}
5565

5666
// public static Placement getPlacement(BlockState requiredState, MinecraftClient client) {
5767
// Placement placement = _getPlacement(requiredState, client);
@@ -107,10 +117,11 @@ public PlacementGuide(@NotNull MinecraftClient client) {
107117
return placement;
108118
}
109119

120+
public @Nullable Action buildAction(World world, WorldSchematic worldSchematic, BlockPos pos, ClassHook requiredType) {
121+
return buildAction(world, world.getBlockState(pos), worldSchematic.getBlockState(pos), pos, requiredType);
122+
}
110123
@SuppressWarnings("EnhancedSwitchMigration")
111-
private @Nullable Action buildAction(World world, WorldSchematic worldSchematic, BlockPos pos, ClassHook requiredType) {
112-
BlockState requiredState = worldSchematic.getBlockState(pos);
113-
BlockState currentState = world.getBlockState(pos);
124+
public @Nullable Action buildAction(World world, BlockState currentState, BlockState requiredState, BlockPos pos, ClassHook requiredType) {
114125

115126
if (LitematicaMixinMod.PRINT_WATER_LOGGED_BLOCK.getBooleanValue()
116127
&& canWaterLogged(requiredState)

0 commit comments

Comments
 (0)