Skip to content

Commit 668b959

Browse files
committed
Snapshot port, remove deprecated stuff, some renames
1 parent 55359e6 commit 668b959

39 files changed

Lines changed: 232 additions & 1759 deletions

build.gradle

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'fabric-loom' version '1.13.+'
2+
id 'net.fabricmc.fabric-loom' version '1.14.+'
33
id 'maven-publish'
44
id "com.modrinth.minotaur" version "2.+"
55
id 'com.matthewprenger.cursegradle' version '1.4.0'
@@ -50,13 +50,12 @@ loom {
5050
dependencies {
5151
// To change the versions see the gradle.properties file
5252
minecraft "com.mojang:minecraft:${project.minecraft_version}"
53-
mappings loom.officialMojangMappings()
54-
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
53+
implementation "net.fabricmc:fabric-loader:${project.loader_version}"
5554

5655
// Fabric API. This is technically optional, but you probably want it anyway.
5756
//modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
58-
modCompileOnly("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")
59-
modLocalRuntime("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")
57+
compileOnly("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")
58+
localRuntime("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")
6059

6160
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
6261
// You may need to force-disable transitiveness on them.
@@ -81,12 +80,12 @@ tasks.withType(JavaCompile).configureEach {
8180
// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
8281
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
8382
// We'll use that if it's available, but otherwise we'll use the older option.
84-
it.options.release = 21
83+
it.options.release = 25
8584
}
8685

8786
java {
88-
sourceCompatibility = JavaVersion.VERSION_21
89-
targetCompatibility = JavaVersion.VERSION_21
87+
sourceCompatibility = JavaVersion.VERSION_25
88+
targetCompatibility = JavaVersion.VERSION_25
9089
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
9190
// if it is present.
9291
// If you remove this line, sources will not be generated.
@@ -107,11 +106,11 @@ publishing {
107106
mavenJava(MavenPublication) {
108107
//artifactId = base.archivesName.get()
109108
// add all the jars that should be included when publishing to maven
110-
artifact(remapJar) {
111-
builtBy remapJar
109+
artifact(jar) {
110+
builtBy jar
112111
}
113112
artifact(sourcesJar) {
114-
builtBy remapSourcesJar
113+
builtBy sourcesJar
115114
}
116115
}
117116
}
@@ -144,13 +143,13 @@ if (System.getenv("MODRINTH")) {
144143
projectId = 'eXts2L7r'// The ID of your modrinth project, slugs will not work.
145144
versionNumber = "" + version // The version of the mod to upload.
146145
versionType = "release"
147-
uploadFile = remapJar // This links to a task that builds your mod jar and sets "uploadFile" to the mod jar.
146+
uploadFile = jar // This links to a task that builds your mod jar and sets "uploadFile" to the mod jar.
148147
gameVersions = [((String) project.minecraft_version)]
149148
changelog = System.getenv("CHANGELOG")
150149
loaders = ["fabric", "quilt"]
151150
}
152151

153-
remapJar {
152+
jar {
154153
finalizedBy project.tasks.modrinth
155154
}
156155
}
@@ -168,18 +167,18 @@ curseforge {
168167
addGameVersion((project.minecraft_version.contains("-") ? ((String) project.minecraft_version.split("-")[0] + "-snapshot") : project.minecraft_version))
169168
addGameVersion "Fabric"
170169
addGameVersion "Quilt"
171-
mainArtifact(remapJar)
170+
mainArtifact(jar)
172171

173172
afterEvaluate {
174-
uploadTask.dependsOn("remapJar")
173+
uploadTask.dependsOn("jar")
175174
}
176175
}
177176
}
178177

179178
options {
180179
forgeGradleIntegration = false
181180
}
182-
remapJar {
181+
jar {
183182
finalizedBy project.tasks.curseforge
184183
}
185184
}

gradle.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx1G
33

44
# Fabric Properties
55
# check these on https://fabricmc.net/use
6-
minecraft_version=1.21.11
7-
loader_version=0.18.2
8-
loom_version=1.13-SNAPSHOT
6+
minecraft_version=26.1-snapshot-1
7+
loader_version=0.18.4
8+
loom_version=1.14-SNAPSHOT
99

1010
# Fabric API
11-
fabric_version=0.140.0+1.21.11
11+
fabric_version=0.140.2+26.1
1212

1313
# Mod Properties
14-
mod_version = 2.9.0+1.21.11
14+
mod_version = 3.0.0-beta.1+26.1-snapshot-1
1515
maven_group = eu.pb4
1616
archives_base_name = placeholder-api

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

src/main/java/eu/pb4/placeholders/api/PlaceholderContext.java

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,10 @@ public record PlaceholderContext(MinecraftServer server,
2828
ViewObject view
2929
) {
3030

31-
public PlaceholderContext(MinecraftServer server,
32-
CommandSourceStack source,
33-
@Nullable ServerLevel world,
34-
@Nullable ServerPlayer player,
35-
@Nullable Entity entity,
36-
@Nullable GameProfile gameProfile,
37-
ViewObject view
38-
) {
39-
this(server, () -> source, world, player, entity, gameProfile, view);
40-
}
41-
4231
public CommandSourceStack source() {
4332
return this.lazySource.get();
4433
}
4534

46-
public PlaceholderContext(MinecraftServer server,
47-
CommandSourceStack source,
48-
@Nullable ServerLevel world,
49-
@Nullable ServerPlayer player,
50-
@Nullable Entity entity,
51-
@Nullable GameProfile gameProfile) {
52-
this(server, source, world, player, entity, gameProfile, ViewObject.DEFAULT);
53-
}
54-
55-
5635
public static ParserContext.Key<PlaceholderContext> KEY = new ParserContext.Key<>("placeholder_context", PlaceholderContext.class);
5736

5837
public boolean hasWorld() {
@@ -115,7 +94,7 @@ public static PlaceholderContext of(CommandSourceStack source) {
11594
}
11695

11796
public static PlaceholderContext of(CommandSourceStack source, ViewObject view) {
118-
return new PlaceholderContext(source.getServer(), source, source.getLevel(), source.getPlayer(), source.getEntity(), source.getPlayer() != null ? source.getPlayer().getGameProfile() : null, view);
97+
return new PlaceholderContext(source.getServer(), () -> source, source.getLevel(), source.getPlayer(), source.getEntity(), source.getPlayer() != null ? source.getPlayer().getGameProfile() : null, view);
11998
}
12099

121100
public static PlaceholderContext of(Entity entity) {

src/main/java/eu/pb4/placeholders/api/PlaceholderResult.java

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
package eu.pb4.placeholders.api;
22

3-
import eu.pb4.placeholders.api.parsers.TextParserV1;
3+
import eu.pb4.placeholders.api.parsers.TagParser;
44
import net.minecraft.ChatFormatting;
55
import net.minecraft.network.chat.Component;
66
import net.minecraft.network.chat.Style;
77

88
public final class PlaceholderResult {
99
private final Component text;
10-
private String string;
1110
private final boolean valid;
1211

1312
private PlaceholderResult(Component text, String reason) {
@@ -29,21 +28,6 @@ public Component text() {
2928
return this.text;
3029
}
3130

32-
/**
33-
* Returns text component as String (without formatting) from placeholder
34-
* It's not recommended for general usage, as it makes it text static/unable to change depending on player's language or other settings
35-
* and removes all styling.
36-
*
37-
* @return String
38-
*/
39-
@Deprecated
40-
public String string() {
41-
if (this.string == null) {
42-
this.string = this.text.getString();
43-
}
44-
return this.string;
45-
}
46-
4731
/**
4832
* Checks if placeholder was valid
4933
*
@@ -86,7 +70,16 @@ public static PlaceholderResult value(Component text) {
8670
* @return PlaceholderResult
8771
*/
8872
public static PlaceholderResult value(String text) {
89-
return new PlaceholderResult(TextParserV1.DEFAULT.parseText(text, null), null);
73+
return new PlaceholderResult(TagParser.DEFAULT.parseComponent(text, ParserContext.of()), null);
74+
}
75+
76+
/**
77+
* Create result for placeholder
78+
*
79+
* @return PlaceholderResult
80+
*/
81+
public static PlaceholderResult value(String text, ParserContext context) {
82+
return new PlaceholderResult(TagParser.DEFAULT.parseComponent(text,context), null);
9083
}
9184
}
9285

0 commit comments

Comments
 (0)