Compare commits
58
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18c837991e | ||
|
|
d8924485ac | ||
|
|
b02a257383 | ||
|
|
a4b666724f | ||
|
|
e92b15c19f | ||
|
|
3fd2da9bf8 | ||
|
|
ff4fbe2029 | ||
|
|
c3d32874a7 | ||
|
|
7b9888c758 | ||
|
|
e0c05df633 | ||
|
|
3af661b256 | ||
|
|
74ebb09ebc | ||
|
|
36396c10b0 | ||
|
|
bc9b84464b | ||
|
|
0ee7c1cf16 | ||
|
|
6d35536862 | ||
|
|
8945193a8a | ||
|
|
546f4b14fa | ||
|
|
e8028cf446 | ||
|
|
6a85860132 | ||
|
|
4b11b8e1bb | ||
|
|
724a6b7a4b | ||
|
|
c785df5fc0 | ||
|
|
de92c06dfd | ||
|
|
31f427a1b6 | ||
|
|
fffcae9c0e | ||
|
|
594dbbcbe9 | ||
|
|
8c4efbbb13 | ||
|
|
5b1dcf63d2 | ||
|
|
beead5773c | ||
|
|
60a5c4ae2f | ||
|
|
d707e20b05 | ||
|
|
14bad1d36f | ||
|
|
7a9bf5f465 | ||
|
|
f290af7b81 | ||
|
|
064d0008f5 | ||
|
|
fbe30d9da5 | ||
|
|
31490069ea | ||
|
|
1b8d5eacc0 | ||
|
|
abdb79598b | ||
|
|
1b5b59317c | ||
|
|
6e4ac65983 | ||
|
|
64cce82140 | ||
|
|
cb79316d6a | ||
|
|
7d34c3838a | ||
|
|
c60152532d | ||
|
|
1894bac11b | ||
|
|
a80ca442e5 | ||
|
|
c69ce24d32 | ||
|
|
e937a886ec | ||
|
|
3e261824ef | ||
|
|
43c3bb11dc | ||
|
|
f57ac05bd4 | ||
|
|
a3c623c202 | ||
|
|
481315f1e6 | ||
|
|
21e50421e5 | ||
|
|
233d52281b | ||
|
|
6807a02de7 |
No files matched your search
+1
-1
@@ -1,2 +1,2 @@
|
||||
github: FlorianMichael
|
||||
custom: ['https://florianmichael.de/donate', 'https://viaversion.com/donate', 'https://creeper123123321.github.io/#donate']
|
||||
custom: ['https://florianmichael.de/donate', 'https://creeper123123321.github.io/#donate']
|
||||
@@ -0,0 +1,10 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "gradle"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
@@ -1,4 +1,4 @@
|
||||
name: ViaRewind CI
|
||||
name: Build
|
||||
on: [pull_request, push, workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
@@ -8,7 +8,7 @@ jobs:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Validate Gradle Wrapper
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
uses: gradle/actions/wrapper-validation@v4
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
|
||||
@@ -13,7 +13,7 @@ jobs:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Validate Gradle Wrapper
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
uses: gradle/actions/wrapper-validation@v4
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
name: Update Gradle Wrapper
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 0 * * 0"
|
||||
|
||||
jobs:
|
||||
update-gradle-wrapper:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Update Gradle Wrapper
|
||||
uses: gradle-update/update-gradle-wrapper-action@v2
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings>
|
||||
<settings default="viarewind-gpl">
|
||||
<module2copyright>
|
||||
<element module="ViaRewind" copyright="viarewind-gpl" />
|
||||
</module2copyright>
|
||||
@@ -37,7 +37,7 @@ Other Links
|
||||
Building
|
||||
-
|
||||
After cloning this repository, build the project with Gradle by running `./gradlew build` and take the created jar out
|
||||
of the `universal/build/libs` directory.
|
||||
of the `build/libs` directory.
|
||||
|
||||
You need JDK 17 or newer to build ViaRewind.
|
||||
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
plugins {
|
||||
id "java-library"
|
||||
id "maven-publish"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = uri("https://repo.viaversion.com")
|
||||
}
|
||||
maven {
|
||||
url = uri("https://repo.maven.apache.org/maven2/")
|
||||
}
|
||||
maven {
|
||||
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
|
||||
}
|
||||
maven {
|
||||
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
|
||||
}
|
||||
maven {
|
||||
url = uri("https://maven.fabricmc.net/")
|
||||
}
|
||||
maven {
|
||||
url = uri("https://repo.spongepowered.org/repository/maven-public/")
|
||||
}
|
||||
maven {
|
||||
url = uri("https://nexus.velocitypowered.com/repository/maven-public/")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly "com.viaversion:viaversion:${project.viaversion_version}"
|
||||
compileOnly "com.viaversion:viabackwards:${project.viabackwards_version}"
|
||||
compileOnly "io.netty:netty-all:${project.netty_version}"
|
||||
compileOnly "com.google.guava:guava:${project.guava_version}"
|
||||
}
|
||||
|
||||
base {
|
||||
archivesName = project.maven_name
|
||||
group = project.maven_group
|
||||
version = project.maven_version
|
||||
description = "ViaBackwards addon to allow 1.8.x and 1.7.x clients on newer server versions."
|
||||
}
|
||||
|
||||
java.sourceCompatibility = JavaVersion.VERSION_17
|
||||
|
||||
tasks {
|
||||
// Variable replacements
|
||||
processResources {
|
||||
for (final def file in ["plugin.yml", "fabric.mod.json"]) {
|
||||
filesMatching(file) {
|
||||
expand(
|
||||
"version": project.version,
|
||||
"description": project.description
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "Via"
|
||||
url = "https://repo.viaversion.com/"
|
||||
|
||||
credentials(PasswordCredentials)
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
}
|
||||
}
|
||||
publications {
|
||||
main(MavenPublication) {
|
||||
artifactId = project.maven_name
|
||||
groupId = project.maven_group
|
||||
version = project.maven_version
|
||||
|
||||
from(components.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
tasks.withType(Javadoc) {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
plugins {
|
||||
id "java-library"
|
||||
id "maven-publish"
|
||||
id "idea"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = "ViaVersion"
|
||||
url "https://repo.viaversion.com"
|
||||
}
|
||||
}
|
||||
|
||||
base {
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
compileJava.options.encoding = compileTestJava.options.encoding = javadoc.options.encoding = "UTF-8"
|
||||
|
||||
group = rootProject.maven_group
|
||||
version = rootProject.maven_version
|
||||
description = rootProject.maven_description
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly "com.viaversion:viaversion:5.0.4-SNAPSHOT"
|
||||
compileOnly "com.viaversion:viabackwards:5.0.4-SNAPSHOT"
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "Via"
|
||||
url = "https://repo.viaversion.com/"
|
||||
|
||||
credentials(PasswordCredentials)
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
}
|
||||
}
|
||||
publications {
|
||||
main(MavenPublication) {
|
||||
artifactId = project.name
|
||||
groupId = project.maven_group
|
||||
version = project.maven_version
|
||||
|
||||
from components.java
|
||||
|
||||
pom {
|
||||
name = "ViaRewind"
|
||||
description = project.description
|
||||
url = "https://github.com/ViaVersion/ViaRewind"
|
||||
licenses {
|
||||
license {
|
||||
name = "GPL-3.0 License"
|
||||
url = "https://github.com/ViaVersion/ViaRewind/blob/main/LICENSE"
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id = "FlorianMichael"
|
||||
name = "EnZaXD"
|
||||
email = "florian.michael07@gmail.com"
|
||||
}
|
||||
}
|
||||
scm {
|
||||
connection = "scm:git:git://github.com/ViaVersion/ViaRewind.git"
|
||||
developerConnection = "scm:git:ssh://github.com/ViaVersion/ViaRewind.git"
|
||||
url = "github.com/ViaVersion/ViaRewind"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
plugins {
|
||||
id "vr.base-conventions"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly project(":viarewind-common")
|
||||
}
|
||||
@@ -1,97 +1,83 @@
|
||||
plugins {
|
||||
id "com.github.johnrengelman.shadow" version "8.1.1"
|
||||
id "vr.base-conventions"
|
||||
|
||||
id "io.papermc.hangar-publish-plugin" version "0.1.2"
|
||||
id "com.modrinth.minotaur" version "2.+"
|
||||
id "java-library"
|
||||
id "maven-publish"
|
||||
}
|
||||
|
||||
base {
|
||||
archivesName = "ViaRewind"
|
||||
}
|
||||
|
||||
configurations {
|
||||
publishInclude
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api project(":viarewind-common")
|
||||
api project(":viarewind-bukkit")
|
||||
api project(":viarewind-fabric")
|
||||
api project(":viarewind-velocity")
|
||||
publishInclude project(":viarewind-common")
|
||||
publishInclude project(":viarewind-bukkit")
|
||||
publishInclude project(":viarewind-fabric")
|
||||
publishInclude project(":viarewind-sponge")
|
||||
publishInclude project(":viarewind-velocity")
|
||||
}
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
jar {
|
||||
dependsOn configurations.publishInclude
|
||||
from {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
configurations.publishInclude.collect {
|
||||
zipTree(it)
|
||||
}
|
||||
} {
|
||||
exclude "META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA"
|
||||
}
|
||||
manifest {
|
||||
attributes["paperweight-mappings-namespace"] = "mojang"
|
||||
attributes(
|
||||
"paperweight-mappings-namespace": "mojang"
|
||||
)
|
||||
}
|
||||
archiveClassifier.set("")
|
||||
archiveBaseName.set("ViaRewind-" + project.maven_version)
|
||||
configurations {
|
||||
api
|
||||
from("LICENSE") {
|
||||
rename { "${it}_${project.name ?: rootProject.name}" }
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "Via"
|
||||
url = "https://repo.viaversion.com/"
|
||||
|
||||
credentials(PasswordCredentials)
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
}
|
||||
}
|
||||
publications {
|
||||
shadow(MavenPublication) { publication ->
|
||||
artifactId = project.maven_name
|
||||
groupId = project.maven_group
|
||||
version = project.maven_version
|
||||
|
||||
from project.shadow.component(publication)
|
||||
idea {
|
||||
module {
|
||||
["run"].each {
|
||||
excludeDirs << file("$it")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
build.dependsOn shadowJar
|
||||
|
||||
// -----------------------------------------------------
|
||||
// Publishing
|
||||
|
||||
def latestCommitHash() {
|
||||
def byteOut = new ByteArrayOutputStream()
|
||||
exec {
|
||||
commandLine 'git', 'rev-parse', '--short', 'HEAD'
|
||||
standardOutput = byteOut
|
||||
}
|
||||
return byteOut.toString('UTF-8').trim()
|
||||
Provider<String> latestCommitHash() {
|
||||
return providers.exec {
|
||||
commandLine = ["git", "rev-parse", "--short", "HEAD"]
|
||||
}.standardOutput.getAsText().map(String::trim)
|
||||
}
|
||||
|
||||
def latestCommitMessage() {
|
||||
def byteOut = new ByteArrayOutputStream()
|
||||
exec {
|
||||
commandLine 'git', 'log', '-1', '--pretty=%B'
|
||||
standardOutput = byteOut
|
||||
}
|
||||
return byteOut.toString('UTF-8').trim()
|
||||
Provider<String> latestCommitMessage() {
|
||||
return providers.exec {
|
||||
commandLine = ["git", "log", "-1", "--pretty=%B"]
|
||||
}.standardOutput.getAsText().map(String::trim)
|
||||
}
|
||||
|
||||
def branchName() {
|
||||
def byteOut = new ByteArrayOutputStream()
|
||||
exec {
|
||||
commandLine 'git', 'rev-parse', '--abbrev-ref', 'HEAD'
|
||||
standardOutput = byteOut
|
||||
}
|
||||
return byteOut.toString('UTF-8').trim()
|
||||
Provider<String> branchName() {
|
||||
return providers.exec {
|
||||
commandLine = ["git", "rev-parse", "--abbrev-ref", "HEAD"]
|
||||
}.standardOutput.getAsText().map(String::trim)
|
||||
}
|
||||
|
||||
def branch = branchName()
|
||||
def branch = branchName().get()
|
||||
def baseVersion = project.maven_version
|
||||
def isRelease = !baseVersion.contains('-')
|
||||
def isMainBranch = branch == "master"
|
||||
if (!isRelease || isMainBranch) { // Only publish releases from the main branch
|
||||
def suffixedVersion = isRelease ? baseVersion : baseVersion + "+" + System.getenv("GITHUB_RUN_NUMBER")
|
||||
def commitHash = latestCommitHash()
|
||||
def changelogContent = "[${commitHash}](https://github.com/ViaVersion/ViaRewind/commit/${commitHash}) ${latestCommitMessage()}"
|
||||
def commitHash = latestCommitHash().get()
|
||||
def changelogContent = "[${commitHash}](https://github.com/ViaVersion/ViaRewind/commit/${commitHash}) ${latestCommitMessage().get()}"
|
||||
modrinth {
|
||||
def mcVersions = project.mcVersions
|
||||
.split(',')
|
||||
@@ -103,7 +89,7 @@ if (!isRelease || isMainBranch) { // Only publish releases from the main branch
|
||||
versionNumber.set(suffixedVersion)
|
||||
versionName.set(suffixedVersion)
|
||||
changelog.set(changelogContent)
|
||||
uploadFile.set(shadowJar.archiveFile)
|
||||
uploadFile.set(jar.archiveFile)
|
||||
gameVersions.set(mcVersions)
|
||||
loaders.add("fabric")
|
||||
loaders.add("paper")
|
||||
@@ -127,7 +113,7 @@ if (!isRelease || isMainBranch) { // Only publish releases from the main branch
|
||||
apiKey = System.getenv("HANGAR_TOKEN")
|
||||
platforms {
|
||||
PAPER {
|
||||
jar = shadowJar.archiveFile
|
||||
jar = project.jar.archiveFile
|
||||
platformVersions = [property('mcVersionRange') as String]
|
||||
dependencies {
|
||||
hangar("ViaVersion") {
|
||||
@@ -139,7 +125,7 @@ if (!isRelease || isMainBranch) { // Only publish releases from the main branch
|
||||
}
|
||||
}
|
||||
VELOCITY {
|
||||
jar = shadowJar.archiveFile
|
||||
jar = project.jar.archiveFile
|
||||
platformVersions = [property("velocityVersion") as String]
|
||||
dependencies {
|
||||
hangar("ViaVersion") {
|
||||
+18
-3
@@ -1,9 +1,24 @@
|
||||
plugins {
|
||||
id "com.viaversion.java-conventions"
|
||||
id "vr.platform-conventions"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "SpigotMC"
|
||||
url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
|
||||
}
|
||||
maven {
|
||||
name = "SpongePowered"
|
||||
url "https://repo.spongepowered.org/repository/maven-public/"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api project(":viarewind-common")
|
||||
|
||||
compileOnly(annotationProcessor("org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT"))
|
||||
}
|
||||
|
||||
processResources {
|
||||
filesMatching("plugin.yml") {
|
||||
expand("version": project.version, "description": project.description)
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
maven_name=viarewind-bukkit
|
||||
@@ -1,6 +1,6 @@
|
||||
name: ViaRewind
|
||||
main: com.viaversion.viarewind.BukkitPlugin
|
||||
authors: [FlorianMichael/EnZaXD, Gerrygames, creeper123321123]
|
||||
authors: [FlorianMichael/EnZaXD, Gerrygames, creeper123123321]
|
||||
version: ${version}
|
||||
description: ${description}
|
||||
website: https://viaversion.com/rewind
|
||||
|
||||
+32
-11
@@ -1,28 +1,49 @@
|
||||
plugins {
|
||||
id "com.viaversion.java-conventions"
|
||||
}
|
||||
id "vr.base-conventions"
|
||||
|
||||
plugins {
|
||||
id "net.raphimc.class-token-replacer" version "1.0.0"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly "io.netty:netty-all:4.0.20.Final"
|
||||
compileOnly "com.google.guava:guava:17.0"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
classTokenReplacer {
|
||||
property("\${version}", rootProject.maven_version)
|
||||
property("\${impl_version}", "git-ViaRewind-${rootProject.maven_version}:${project.latestCommitHash()}")
|
||||
property("\${impl_version}", "git-ViaRewind-${rootProject.maven_version}:${rootProject.latestCommitHash().get()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String latestCommitHash() {
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
exec {
|
||||
commandLine 'git', 'rev-parse', '--short', 'HEAD'
|
||||
standardOutput = stdout
|
||||
// Task to quickly test/debug code changes using https://github.com/ViaVersion/ViaProxy
|
||||
// For further instructions see the ViaProxy repository README
|
||||
tasks.register("runViaProxy", JavaExec) {
|
||||
dependsOn tasks.jar
|
||||
|
||||
def viaProxyConfiguration = configurations.create("viaProxy")
|
||||
viaProxyConfiguration.dependencies.add(dependencies.create("net.raphimc:ViaProxy:3.3.5-SNAPSHOT") {
|
||||
transitive = false
|
||||
})
|
||||
|
||||
mainClass = "net.raphimc.viaproxy.ViaProxy"
|
||||
classpath = viaProxyConfiguration
|
||||
workingDir = file("run")
|
||||
jvmArgs = ["-DskipUpdateCheck"]
|
||||
if (System.getProperty("viaproxy.gui.autoStart") != null) {
|
||||
jvmArgs("-Dviaproxy.gui.autoStart")
|
||||
}
|
||||
return stdout.toString().trim()
|
||||
}
|
||||
|
||||
doFirst {
|
||||
def jarsDir = file("$workingDir/jars")
|
||||
jarsDir.mkdirs()
|
||||
file("$jarsDir/${project.name}.jar").bytes = tasks.jar.archiveFile.get().asFile.bytes
|
||||
}
|
||||
|
||||
doLast {
|
||||
file("$workingDir/jars/${project.name}.jar").delete()
|
||||
file("$workingDir/logs").deleteDir()
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
maven_name=viarewind-common
|
||||
@@ -39,6 +39,8 @@ public class ViaRewindConfig extends Config implements com.viaversion.viarewind.
|
||||
private String worldBorderParticle;
|
||||
private boolean enableOffhand;
|
||||
private String offhandCommand;
|
||||
private boolean emulateLevitationEffect;
|
||||
private boolean handlePlayerCombatPacket;
|
||||
|
||||
public ViaRewindConfig(File configFile, Logger logger) {
|
||||
super(configFile, logger);
|
||||
@@ -61,6 +63,8 @@ public class ViaRewindConfig extends Config implements com.viaversion.viarewind.
|
||||
worldBorderParticle = getString("world-border-particle", "fireworksSpark");
|
||||
enableOffhand = getBoolean("enable-offhand", true);
|
||||
offhandCommand = getString("offhand-command", "/offhand");
|
||||
emulateLevitationEffect = getBoolean("emulate-levitation-effect", true);
|
||||
handlePlayerCombatPacket = getBoolean("handle-player-combat-packet", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,6 +117,16 @@ public class ViaRewindConfig extends Config implements com.viaversion.viarewind.
|
||||
return offhandCommand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean emulateLevitationEffect() {
|
||||
return emulateLevitationEffect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handlePlayerCombatPacket() {
|
||||
return handlePlayerCombatPacket;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getDefaultConfigURL() {
|
||||
return getClass().getClassLoader().getResource("assets/viarewind/config.yml");
|
||||
|
||||
@@ -103,4 +103,18 @@ public interface ViaRewindConfig extends Config {
|
||||
* @return the offhand command
|
||||
*/
|
||||
String getOffhandCommand();
|
||||
|
||||
/**
|
||||
* If enabled, 1.8 players on 1.9+ servers will also experience the levitation effect by sending velocity packets.
|
||||
*
|
||||
* @return true if enabled
|
||||
*/
|
||||
boolean emulateLevitationEffect();
|
||||
|
||||
/**
|
||||
* If enabled, 1.8 players will handle the player combat packet added in 1.9 by showing the custom death message above the hotbar.
|
||||
*
|
||||
* @return true if enabled
|
||||
*/
|
||||
boolean handlePlayerCombatPacket();
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import com.viaversion.viaversion.api.minecraft.ClientWorld;
|
||||
import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType;
|
||||
import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_8;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
@@ -47,20 +48,28 @@ public abstract class VREntityRewriter<C extends ClientboundPacketType, T extend
|
||||
map(Types.UNSIGNED_BYTE); // Game mode
|
||||
map(Types.BYTE); // Dimension
|
||||
handler(playerTrackerHandler());
|
||||
handler(wrapper -> wrapper.user().get(ClientWorld.class).setEnvironment(wrapper.get(Types.BYTE, 0)));
|
||||
handler(getDimensionHandler());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void untrackEntities(final UserConnection connection, final int[] entities) {
|
||||
protected void removeEntities(final UserConnection connection, final int[] entities) {
|
||||
final EntityTrackerBase tracker = tracker(connection);
|
||||
for (int entityId : entities) {
|
||||
tracker.removeEntity(entityId);
|
||||
}
|
||||
}
|
||||
|
||||
protected PacketHandler getDimensionHandler() {
|
||||
return wrapper -> {
|
||||
final int dimension = wrapper.get(Types.BYTE, 0);
|
||||
final ClientWorld clientWorld = wrapper.user().getClientWorld(protocol.getClass());
|
||||
clientWorld.setEnvironment(dimension);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object getDisplayVisibilityMetaValue() {
|
||||
protected Object getDisplayVisibilityDataValue() {
|
||||
return (byte) 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
/*
|
||||
* This file is part of ViaRewind - https://github.com/ViaVersion/ViaRewind
|
||||
* Copyright (C) 2018-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.viarewind.api.type.version;
|
||||
|
||||
import com.viaversion.viarewind.api.type.entitydata.EntityDataListType;
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class Protocol1_7_6_10To1_7_2_5 extends AbstractProtocol<ClientboundPacke
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
this.registerClientbound(State.LOGIN, ClientboundLoginPackets.GAME_PROFILE.getId(), ClientboundLoginPackets.GAME_PROFILE.getId(), new PacketHandlers() {
|
||||
this.registerClientbound(State.LOGIN, ClientboundLoginPackets.GAME_PROFILE, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Types.STRING, REMOVE_DASHES); // Uuid
|
||||
|
||||
+7
-10
@@ -61,11 +61,11 @@ public class Protocol1_8To1_7_6_10 extends BackwardsProtocol<ClientboundPackets1
|
||||
itemRewriter.register();
|
||||
entityRewriter.register();
|
||||
|
||||
PlayerPacketRewriter1_8.register(this);
|
||||
ScoreboardPacketRewriter1_8.register(this);
|
||||
WorldPacketRewriter1_8.register(this);
|
||||
new PlayerPacketRewriter1_8(this).register();
|
||||
new ScoreboardPacketRewriter1_8(this).register();
|
||||
new WorldPacketRewriter1_8(this).register();
|
||||
|
||||
this.registerClientbound(State.LOGIN, ClientboundLoginPackets.HELLO.getId(), ClientboundLoginPackets.HELLO.getId(), new PacketHandlers() {
|
||||
this.registerClientbound(State.LOGIN, ClientboundLoginPackets.HELLO, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Types.STRING); // server hash
|
||||
@@ -73,7 +73,7 @@ public class Protocol1_8To1_7_6_10 extends BackwardsProtocol<ClientboundPackets1
|
||||
map(Types.BYTE_ARRAY_PRIMITIVE, Types.SHORT_BYTE_ARRAY); // verification token
|
||||
}
|
||||
});
|
||||
this.registerClientbound(State.LOGIN, ClientboundLoginPackets.LOGIN_COMPRESSION.getId(), ClientboundLoginPackets.LOGIN_COMPRESSION.getId(), new PacketHandlers() {
|
||||
this.registerClientbound(State.LOGIN, ClientboundLoginPackets.LOGIN_COMPRESSION, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
handler(wrapper -> {
|
||||
@@ -92,7 +92,7 @@ public class Protocol1_8To1_7_6_10 extends BackwardsProtocol<ClientboundPackets1
|
||||
}
|
||||
});
|
||||
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.ENCRYPTION_KEY.getId(), ServerboundLoginPackets.ENCRYPTION_KEY.getId(), new PacketHandlers() {
|
||||
this.registerServerbound(State.LOGIN, ServerboundLoginPackets.ENCRYPTION_KEY, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Types.SHORT_BYTE_ARRAY, Types.BYTE_ARRAY_PRIMITIVE); // shared secret
|
||||
@@ -118,6 +118,7 @@ public class Protocol1_8To1_7_6_10 extends BackwardsProtocol<ClientboundPackets1
|
||||
@Override
|
||||
public void init(UserConnection connection) {
|
||||
connection.addEntityTracker(this.getClass(), new EntityTracker1_8(connection));
|
||||
connection.addClientWorld(this.getClass(), new ClientWorld());
|
||||
|
||||
connection.put(new InventoryTracker(connection));
|
||||
connection.put(new PlayerSessionStorage(connection));
|
||||
@@ -125,10 +126,6 @@ public class Protocol1_8To1_7_6_10 extends BackwardsProtocol<ClientboundPackets1
|
||||
connection.put(new ScoreboardTracker(connection));
|
||||
connection.put(new CompressionStatusTracker(connection));
|
||||
connection.put(new WorldBorderEmulator(connection));
|
||||
|
||||
if (!connection.has(ClientWorld.class)) {
|
||||
connection.put(new ClientWorld());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-6
@@ -174,12 +174,8 @@ public enum EntityDataIndex1_7_6_10 {
|
||||
}
|
||||
|
||||
private static Optional<EntityDataIndex1_7_6_10> getIndex(EntityType type, int index) {
|
||||
Pair<EntityType, Integer> pair = new Pair<>(type, index);
|
||||
if (ENTITY_DATA_REWRITES.containsKey(pair)) {
|
||||
return Optional.of(ENTITY_DATA_REWRITES.get(pair));
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
final Pair<EntityType, Integer> pair = new Pair<>(type, index);
|
||||
return Optional.ofNullable(ENTITY_DATA_REWRITES.get(pair));
|
||||
}
|
||||
|
||||
public EntityTypes1_8.EntityType getClazz() {
|
||||
|
||||
+5
-6
@@ -57,7 +57,7 @@ public class BlockItemPacketRewriter1_8 extends VRBlockItemRewriter<ClientboundP
|
||||
wrapper.write(Types.UNSIGNED_BYTE, windowTypeId); // Window type id
|
||||
|
||||
final JsonElement titleComponent = wrapper.read(Types.COMPONENT); // Title
|
||||
String title = ChatUtil.jsonToLegacy(wrapper.user(), titleComponent);
|
||||
String title = ChatUtil.jsonToLegacy(titleComponent);
|
||||
title = ChatUtil.removeUnusedColor(title, '8');
|
||||
if (title.length() > 32) {
|
||||
title = title.substring(0, 32);
|
||||
@@ -134,7 +134,7 @@ public class BlockItemPacketRewriter1_8 extends VRBlockItemRewriter<ClientboundP
|
||||
Item[] old = items;
|
||||
items = new Item[old.length - 1];
|
||||
items[0] = old[0];
|
||||
System.arraycopy(old, 2, items, 1, old.length - 3);
|
||||
System.arraycopy(old, 2, items, 1, old.length - 2);
|
||||
}
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
items[i] = handleItemToClient(wrapper.user(), items[i]);
|
||||
@@ -277,9 +277,8 @@ public class BlockItemPacketRewriter1_8 extends VRBlockItemRewriter<ClientboundP
|
||||
super.handleItemToClient(connection, item);
|
||||
|
||||
CompoundTag tag = item.tag();
|
||||
if (tag == null) {
|
||||
item.setTag(tag = new CompoundTag());
|
||||
}
|
||||
if (tag == null) return item;
|
||||
|
||||
enchantmentRewriter.handleToClient(item);
|
||||
|
||||
if (item.identifier() == 387) {
|
||||
@@ -292,7 +291,7 @@ public class BlockItemPacketRewriter1_8 extends VRBlockItemRewriter<ClientboundP
|
||||
for (StringTag page : pages) {
|
||||
final String value = page.getValue();
|
||||
oldPages.add(new StringTag(value));
|
||||
page.setValue(ChatUtil.jsonToLegacy(connection, value));
|
||||
page.setValue(ChatUtil.jsonToLegacy(value));
|
||||
}
|
||||
}
|
||||
return item;
|
||||
|
||||
+11
-7
@@ -33,7 +33,6 @@ import com.viaversion.viarewind.protocol.v1_8to1_7_6_10.storage.GameProfileStora
|
||||
import com.viaversion.viarewind.protocol.v1_8to1_7_6_10.storage.PlayerSessionStorage;
|
||||
import com.viaversion.viarewind.protocol.v1_8to1_7_6_10.storage.ScoreboardTracker;
|
||||
import com.viaversion.viaversion.api.minecraft.BlockPosition;
|
||||
import com.viaversion.viaversion.api.minecraft.ClientWorld;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_8;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_8.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
@@ -70,6 +69,7 @@ public class EntityPacketRewriter1_8 extends VREntityRewriter<ClientboundPackets
|
||||
read(Types.BOOLEAN); // Reduced debug info
|
||||
|
||||
handler(playerTrackerHandler());
|
||||
handler(getDimensionHandler());
|
||||
handler(wrapper -> {
|
||||
final int entityId = wrapper.get(Types.INT, 0);
|
||||
|
||||
@@ -81,9 +81,8 @@ public class EntityPacketRewriter1_8 extends VREntityRewriter<ClientboundPackets
|
||||
|
||||
final EntityTracker1_8 tracker = wrapper.user().getEntityTracker(Protocol1_8To1_7_6_10.class);
|
||||
tracker.addPlayer(entityId, wrapper.user().getProtocolInfo().getUuid());
|
||||
tracker.setClientEntityGameMode(wrapper.get(Types.UNSIGNED_BYTE, 0));
|
||||
|
||||
wrapper.user().get(ClientWorld.class).setEnvironment(wrapper.get(Types.BYTE, 0));
|
||||
tracker.setClientEntityGameMode(wrapper.get(Types.UNSIGNED_BYTE, 0));
|
||||
|
||||
// Reset on Velocity server change
|
||||
wrapper.user().put(new ScoreboardTracker(wrapper.user()));
|
||||
@@ -92,7 +91,7 @@ public class EntityPacketRewriter1_8 extends VREntityRewriter<ClientboundPackets
|
||||
});
|
||||
protocol.registerClientbound(ClientboundPackets1_8.REMOVE_ENTITIES, wrapper -> {
|
||||
final int[] entities = wrapper.read(Types.VAR_INT_ARRAY_PRIMITIVE);
|
||||
untrackEntities(wrapper.user(), entities);
|
||||
removeEntities(wrapper.user(), entities);
|
||||
|
||||
wrapper.cancel();
|
||||
|
||||
@@ -102,7 +101,7 @@ public class EntityPacketRewriter1_8 extends VREntityRewriter<ClientboundPackets
|
||||
for (List<Integer> part : parts) {
|
||||
final PacketWrapper destroy = PacketWrapper.create(ClientboundPackets1_7_2_5.REMOVE_ENTITIES, wrapper.user());
|
||||
destroy.write(RewindTypes.INT_ARRAY, part.stream().mapToInt(Integer::intValue).toArray());
|
||||
destroy.scheduleSend(Protocol1_8To1_7_6_10.class);
|
||||
destroy.send(Protocol1_8To1_7_6_10.class);
|
||||
}
|
||||
});
|
||||
protocol.registerClientbound(ClientboundPackets1_8.SET_ENTITY_DATA, new PacketHandlers() {
|
||||
@@ -117,8 +116,13 @@ public class EntityPacketRewriter1_8 extends VREntityRewriter<ClientboundPackets
|
||||
if (tracker.getHolograms().containsKey(entityId)) {
|
||||
wrapper.cancel();
|
||||
tracker.getHolograms().get(entityId).syncState(EntityPacketRewriter1_8.this, entityData);
|
||||
} else {
|
||||
} else if (tracker.hasEntity(entityId)) {
|
||||
handleEntityData(entityId, entityData, wrapper.user());
|
||||
} else {
|
||||
wrapper.cancel();
|
||||
}
|
||||
if (tracker.clientEntityId() == entityId) {
|
||||
tracker.updateEntityData(entityData);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -333,7 +337,7 @@ public class EntityPacketRewriter1_8 extends VREntityRewriter<ClientboundPackets
|
||||
map(Types.SHORT); // Current item
|
||||
map(Types1_8.ENTITY_DATA_LIST, Types1_7_6_10.ENTITY_DATA_LIST); // Entity data
|
||||
|
||||
handler(getTrackerAndMetaHandler(Types1_7_6_10.ENTITY_DATA_LIST, EntityTypes1_8.EntityType.PLAYER));
|
||||
handler(getTrackerAndDataHandler(Types1_7_6_10.ENTITY_DATA_LIST, EntityTypes1_8.EntityType.PLAYER));
|
||||
}
|
||||
});
|
||||
protocol.registerClientbound(ClientboundPackets1_8.SET_EQUIPPED_ITEM, new PacketHandlers() {
|
||||
|
||||
+31
-14
@@ -18,6 +18,7 @@
|
||||
package com.viaversion.viarewind.protocol.v1_8to1_7_6_10.rewriter;
|
||||
|
||||
import com.viaversion.viarewind.ViaRewind;
|
||||
import com.viaversion.viarewind.api.type.version.Types1_7_6_10;
|
||||
import com.viaversion.viarewind.protocol.v1_7_6_10to1_7_2_5.packet.ClientboundPackets1_7_2_5;
|
||||
import com.viaversion.viarewind.protocol.v1_8to1_7_6_10.Protocol1_8To1_7_6_10;
|
||||
import com.viaversion.viarewind.protocol.v1_7_6_10to1_7_2_5.packet.ServerboundPackets1_7_2_5;
|
||||
@@ -30,12 +31,10 @@ import com.viaversion.viarewind.api.minecraft.math.Ray3d;
|
||||
import com.viaversion.viarewind.api.minecraft.math.RayTracing;
|
||||
import com.viaversion.viarewind.api.minecraft.math.Vector3d;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.minecraft.BlockPosition;
|
||||
import com.viaversion.viaversion.api.minecraft.Environment;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_8;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.rewriter.RewriterBase;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
import com.viaversion.nbt.tag.CompoundTag;
|
||||
@@ -51,11 +50,17 @@ import io.netty.buffer.Unpooled;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlayerPacketRewriter1_8 {
|
||||
public class PlayerPacketRewriter1_8 extends RewriterBase<Protocol1_8To1_7_6_10> {
|
||||
|
||||
public static void register(Protocol1_8To1_7_6_10 protocol) {
|
||||
public PlayerPacketRewriter1_8(Protocol1_8To1_7_6_10 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
protocol.registerClientbound(ClientboundPackets1_8.CHAT, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
@@ -101,15 +106,26 @@ public class PlayerPacketRewriter1_8 {
|
||||
final EntityTracker1_8 tracker = wrapper.user().getEntityTracker(Protocol1_8To1_7_6_10.class);
|
||||
tracker.setClientEntityGameMode(wrapper.get(Types.UNSIGNED_BYTE, 1));
|
||||
|
||||
final Environment dimension = Environment.getEnvironmentById(wrapper.get(Types.INT, 0));
|
||||
final int dimension = wrapper.get(Types.INT, 0);
|
||||
|
||||
// Clear entities on dimension change and re-track player
|
||||
final ClientWorld world = wrapper.user().get(ClientWorld.class);
|
||||
if (world.getEnvironment() != dimension) {
|
||||
world.setEnvironment(dimension.id());
|
||||
final ClientWorld world = wrapper.user().getClientWorld(Protocol1_8To1_7_6_10.class);
|
||||
if (world.setEnvironment(dimension)) {
|
||||
tracker.clearEntities();
|
||||
tracker.addEntity(tracker.clientEntityId(), EntityTypes1_8.EntityType.PLAYER);
|
||||
tracker.addPlayer(tracker.clientEntityId(), wrapper.user().getProtocolInfo().getUuid());
|
||||
}
|
||||
|
||||
wrapper.send(Protocol1_8To1_7_6_10.class);
|
||||
wrapper.cancel();
|
||||
|
||||
if (tracker.getEntityData().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// 1.8 clients do keep entity data after respawn, 1.7 clients don't
|
||||
final PacketWrapper setEntityData = PacketWrapper.create(ClientboundPackets1_7_2_5.SET_ENTITY_DATA, wrapper.user());
|
||||
setEntityData.write(Types.VAR_INT, tracker.clientEntityId());
|
||||
setEntityData.write(Types1_7_6_10.ENTITY_DATA_LIST, tracker.getEntityData());
|
||||
setEntityData.send(Protocol1_8To1_7_6_10.class);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -149,7 +165,7 @@ public class PlayerPacketRewriter1_8 {
|
||||
wrapper.write(Types.BOOLEAN, playerSession.onGround);
|
||||
|
||||
final EntityTracker1_8 tracker = wrapper.user().getEntityTracker(Protocol1_8To1_7_6_10.class);
|
||||
if (tracker.spectatingClientEntityId != tracker.clientEntityId()) {
|
||||
if (!Objects.equals(tracker.spectatingClientEntityId, tracker.clientEntityIdOrNull())) {
|
||||
wrapper.cancel();
|
||||
}
|
||||
});
|
||||
@@ -239,7 +255,7 @@ public class PlayerPacketRewriter1_8 {
|
||||
gameProfile.gamemode = gamemode;
|
||||
JsonElement displayName = wrapper.read(Types.OPTIONAL_COMPONENT);
|
||||
if (displayName != null) {
|
||||
gameProfile.setDisplayName(ChatUtil.jsonToLegacy(wrapper.user(), displayName));
|
||||
gameProfile.setDisplayName(ChatUtil.jsonToLegacy(displayName));
|
||||
}
|
||||
|
||||
final PacketWrapper playerInfo = PacketWrapper.create(ClientboundPackets1_7_2_5.PLAYER_INFO, wrapper.user());
|
||||
@@ -302,7 +318,7 @@ public class PlayerPacketRewriter1_8 {
|
||||
packet.scheduleSend(Protocol1_8To1_7_6_10.class);
|
||||
} else if (action == 3) {
|
||||
JsonElement displayNameComponent = wrapper.read(Types.OPTIONAL_COMPONENT);
|
||||
String displayName = displayNameComponent != null ? ChatUtil.jsonToLegacy(wrapper.user(), displayNameComponent) : null;
|
||||
String displayName = displayNameComponent != null ? ChatUtil.jsonToLegacy(displayNameComponent) : null;
|
||||
|
||||
GameProfileStorage.GameProfile gameProfile = gameProfileStorage.get(uuid);
|
||||
if (gameProfile == null || gameProfile.displayName == null && displayName == null) continue;
|
||||
@@ -445,6 +461,7 @@ public class PlayerPacketRewriter1_8 {
|
||||
});
|
||||
|
||||
protocol.cancelClientbound(ClientboundPackets1_8.TAB_LIST);
|
||||
protocol.cancelClientbound(ClientboundPackets1_8.PLAYER_COMBAT);
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_8.RESOURCE_PACK, ClientboundPackets1_7_2_5.CUSTOM_PAYLOAD, new PacketHandlers() {
|
||||
@Override
|
||||
@@ -664,7 +681,7 @@ public class PlayerPacketRewriter1_8 {
|
||||
protocol.registerServerbound(ServerboundPackets1_7_2_5.SIGN_UPDATE, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Types.BLOCK_POSITION1_8, RewindTypes.SHORT_POSITION); // Position
|
||||
map(RewindTypes.SHORT_POSITION, Types.BLOCK_POSITION1_8); // Position
|
||||
handler(wrapper -> {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
final String line = wrapper.read(Types.STRING);
|
||||
|
||||
+8
-2
@@ -22,6 +22,7 @@ import com.viaversion.viarewind.protocol.v1_8to1_7_6_10.Protocol1_8To1_7_6_10;
|
||||
import com.viaversion.viarewind.protocol.v1_8to1_7_6_10.storage.ScoreboardTracker;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.rewriter.RewriterBase;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_8;
|
||||
import com.viaversion.viaversion.util.ChatColorUtil;
|
||||
@@ -30,9 +31,14 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class ScoreboardPacketRewriter1_8 {
|
||||
public class ScoreboardPacketRewriter1_8 extends RewriterBase<Protocol1_8To1_7_6_10> {
|
||||
|
||||
public static void register(Protocol1_8To1_7_6_10 protocol) {
|
||||
public ScoreboardPacketRewriter1_8(Protocol1_8To1_7_6_10 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
protocol.registerClientbound(ClientboundPackets1_8.SET_OBJECTIVE, wrapper -> {
|
||||
String name = wrapper.passthrough(Types.STRING);
|
||||
if (name.length() > 16) {
|
||||
|
||||
+10
-5
@@ -28,6 +28,7 @@ import com.viaversion.viaversion.api.minecraft.BlockChangeRecord;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.rewriter.RewriterBase;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.api.type.types.FixedByteArrayType;
|
||||
import com.viaversion.viaversion.api.type.types.chunk.BulkChunkType1_8;
|
||||
@@ -37,11 +38,16 @@ import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_
|
||||
import com.viaversion.viaversion.util.ChatColorUtil;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
|
||||
public class WorldPacketRewriter1_8 {
|
||||
public class WorldPacketRewriter1_8 extends RewriterBase<Protocol1_8To1_7_6_10> {
|
||||
|
||||
public static void register(Protocol1_8To1_7_6_10 protocol) {
|
||||
public WorldPacketRewriter1_8(Protocol1_8To1_7_6_10 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
protocol.registerClientbound(ClientboundPackets1_8.LEVEL_CHUNK, wrapper -> {
|
||||
final ClientWorld world = wrapper.user().get(ClientWorld.class);
|
||||
final ClientWorld world = wrapper.user().getClientWorld(Protocol1_8To1_7_6_10.class);
|
||||
final Chunk chunk = wrapper.read(ChunkType1_8.forEnvironment(world.getEnvironment()));
|
||||
protocol.getItemRewriter().handleChunk(chunk);
|
||||
|
||||
@@ -173,7 +179,7 @@ public class WorldPacketRewriter1_8 {
|
||||
handler(wrapper -> {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
String line = wrapper.read(Types.STRING);
|
||||
line = ChatUtil.jsonToLegacy(wrapper.user(), line);
|
||||
line = ChatUtil.jsonToLegacy(line);
|
||||
line = ChatUtil.removeUnusedColor(line, '0');
|
||||
|
||||
if (line.length() > 15) {
|
||||
@@ -263,7 +269,6 @@ public class WorldPacketRewriter1_8 {
|
||||
});
|
||||
|
||||
protocol.cancelClientbound(ClientboundPackets1_8.CHANGE_DIFFICULTY);
|
||||
protocol.cancelClientbound(ClientboundPackets1_8.PLAYER_COMBAT);
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_8.SET_BORDER, null, wrapper -> {
|
||||
final WorldBorderEmulator emulator = wrapper.user().get(WorldBorderEmulator.class);
|
||||
|
||||
+28
-4
@@ -24,6 +24,8 @@ import com.viaversion.viarewind.protocol.v1_8to1_7_6_10.data.VirtualHologramEnti
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_8;
|
||||
import com.viaversion.viaversion.api.minecraft.entitydata.EntityData;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
@@ -35,8 +37,7 @@ import com.viaversion.viaversion.libs.fastutil.objects.Object2IntMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.objects.Object2IntOpenHashMap;
|
||||
import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_8;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class EntityTracker1_8 extends EntityTrackerBase {
|
||||
@@ -46,7 +47,9 @@ public class EntityTracker1_8 extends EntityTrackerBase {
|
||||
private final Int2ObjectMap<UUID> entityIdToUUID = new Int2ObjectArrayMap<>();
|
||||
private final Object2IntMap<UUID> entityUUIDToId = new Object2IntOpenHashMap<>();
|
||||
|
||||
public int spectatingClientEntityId = -1;
|
||||
private final List<EntityData> entityData = new ArrayList<>();
|
||||
|
||||
public Integer spectatingClientEntityId;
|
||||
private int clientEntityGameMode;
|
||||
|
||||
public EntityTracker1_8(UserConnection connection) {
|
||||
@@ -81,12 +84,16 @@ public class EntityTracker1_8 extends EntityTrackerBase {
|
||||
|
||||
@Override
|
||||
public void setClientEntityId(int entityId) {
|
||||
if (this.spectatingClientEntityId == this.clientEntityId()) {
|
||||
if (Objects.equals(this.spectatingClientEntityId, clientEntityIdOrNull())) {
|
||||
this.spectatingClientEntityId = entityId;
|
||||
}
|
||||
super.setClientEntityId(entityId);
|
||||
}
|
||||
|
||||
public Integer clientEntityIdOrNull() {
|
||||
return this.hasClientEntityId() ? this.clientEntityId() : null;
|
||||
}
|
||||
|
||||
public void addPlayer(final int entityId, final UUID uuid) {
|
||||
entityUUIDToId.put(uuid, entityId);
|
||||
entityIdToUUID.put(entityId, uuid);
|
||||
@@ -180,4 +187,21 @@ public class EntityTracker1_8 extends EntityTrackerBase {
|
||||
public void setClientEntityGameMode(int clientEntityGameMode) {
|
||||
this.clientEntityGameMode = clientEntityGameMode;
|
||||
}
|
||||
|
||||
public void updateEntityData(List<EntityData> entityData) {
|
||||
this.entityData.removeIf(first -> entityData.stream().anyMatch(second -> first.id() == second.id()));
|
||||
for (final EntityData data : entityData) {
|
||||
final Object value = data.value();
|
||||
if (value instanceof Item item) {
|
||||
this.entityData.add(new EntityData(data.id(), data.dataType(), item.copy()));
|
||||
} else {
|
||||
this.entityData.add(new EntityData(data.id(), data.dataType(), value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<EntityData> getEntityData() {
|
||||
return entityData;
|
||||
}
|
||||
|
||||
}
|
||||
+5
-9
@@ -40,13 +40,13 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class Protocol1_9To1_8 extends BackwardsProtocol<ClientboundPackets1_9, ClientboundPackets1_8, ServerboundPackets1_9, ServerboundPackets1_8> {
|
||||
|
||||
public static final ValueTransformer<Double, Integer> DOUBLE_TO_INT_TIMES_32 = new ValueTransformer<Double, Integer>(Types.INT) {
|
||||
public static final ValueTransformer<Double, Integer> DOUBLE_TO_INT_TIMES_32 = new ValueTransformer<>(Types.INT) {
|
||||
@Override
|
||||
public Integer transform(PacketWrapper wrapper, Double inputValue) {
|
||||
return (int) (inputValue * 32.0D);
|
||||
}
|
||||
};
|
||||
public static final ValueTransformer<Float, Byte> DEGREES_TO_ANGLE = new ValueTransformer<Float, Byte>(Types.BYTE) {
|
||||
public static final ValueTransformer<Float, Byte> DEGREES_TO_ANGLE = new ValueTransformer<>(Types.BYTE) {
|
||||
@Override
|
||||
public Byte transform(PacketWrapper packetWrapper, Float degrees) {
|
||||
return (byte) ((degrees / 360F) * 256);
|
||||
@@ -66,14 +66,14 @@ public class Protocol1_9To1_8 extends BackwardsProtocol<ClientboundPackets1_9, C
|
||||
protected void registerPackets() {
|
||||
entityRewriter.register();
|
||||
itemRewriter.register();
|
||||
|
||||
PlayerPacketRewriter1_9.register(this);
|
||||
WorldPacketRewriter1_9.register(this);
|
||||
new PlayerPacketRewriter1_9(this).register();
|
||||
new WorldPacketRewriter1_9(this).register();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(UserConnection connection) {
|
||||
connection.addEntityTracker(this.getClass(), new EntityTracker1_9(connection));
|
||||
connection.addClientWorld(this.getClass(), new ClientWorld());
|
||||
|
||||
connection.put(new WindowTracker(connection));
|
||||
connection.put(new LevitationStorage());
|
||||
@@ -81,10 +81,6 @@ public class Protocol1_9To1_8 extends BackwardsProtocol<ClientboundPackets1_9, C
|
||||
connection.put(new CooldownStorage());
|
||||
connection.put(new BlockPlaceDestroyTracker());
|
||||
connection.put(new BossBarStorage(connection));
|
||||
|
||||
if (!connection.has(ClientWorld.class)) {
|
||||
connection.put(new ClientWorld());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
-1
@@ -57,7 +57,6 @@ public interface CooldownVisualization {
|
||||
case BOSS_BAR -> BossBarVisualization::new;
|
||||
case ACTION_BAR -> ActionBarVisualization::new;
|
||||
case DISABLED -> DISABLED;
|
||||
default -> throw new IllegalArgumentException("Unexpected: " + indicator);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+1
-5
@@ -37,11 +37,7 @@ public class EntityDataIndex1_8 {
|
||||
|
||||
private static Optional<EntityDataIndex1_9> getIndex(final EntityType type, final int index) {
|
||||
final Pair<EntityType, Integer> pair = new Pair<>(type, index);
|
||||
if (ENTITY_DATA_REWRITES.containsKey(pair)) {
|
||||
return Optional.of(ENTITY_DATA_REWRITES.get(pair));
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.ofNullable(ENTITY_DATA_REWRITES.get(pair));
|
||||
}
|
||||
|
||||
public static EntityDataIndex1_9 searchIndex(final EntityType type, final int index) {
|
||||
|
||||
+1
-2
@@ -22,14 +22,13 @@ import com.viaversion.viaversion.protocols.v1_8to1_9.data.PotionIdMappings1_9;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
// TODO | Check if this is correct???
|
||||
public class PotionIdMappings1_8 {
|
||||
public static final Map<String, String> POTION_NAME_INDEX = new HashMap<>();
|
||||
public static final Map<String, Integer> POTION_NAME_TO_ID = new HashMap<>();
|
||||
|
||||
static {
|
||||
POTION_NAME_TO_ID.putAll(PotionIdMappings1_9.POTION_NAME_TO_ID);
|
||||
POTION_NAME_TO_ID.put("luck", 8203);
|
||||
POTION_NAME_TO_ID.put("luck", 8203); // Map new potion to similar one (luck->leaping)
|
||||
|
||||
POTION_NAME_INDEX.put("water", "§rWater Bottle");
|
||||
POTION_NAME_INDEX.put("mundane", "§rMundane Potion");
|
||||
|
||||
+23
-17
@@ -194,15 +194,11 @@ public class BlockItemPacketRewriter1_9 extends VRBlockItemRewriter<ClientboundP
|
||||
super.handleItemToClient(connection, item);
|
||||
|
||||
CompoundTag tag = item.tag();
|
||||
if (tag == null) {
|
||||
item.setTag(tag = new CompoundTag());
|
||||
}
|
||||
|
||||
enchantmentRewriter.handleToClient(item);
|
||||
|
||||
CompoundTag displayTag = tag.getCompoundTag("display");
|
||||
if (item.data() != 0 && tag.contains("Unbreakable")) {
|
||||
final ByteTag unbreakableTag = tag.getByteTag("Unbreakable");
|
||||
CompoundTag displayTag = tag == null ? null : tag.getCompoundTag("display");
|
||||
if (item.data() != 0) {
|
||||
final ByteTag unbreakableTag = tag == null ? null : tag.getByteTag("Unbreakable");
|
||||
if (unbreakableTag != null && unbreakableTag.asByte() != 0) {
|
||||
tag.put(nbtTagName() + "|Unbreakable", new ByteTag(unbreakableTag.asByte()));
|
||||
tag.remove("Unbreakable");
|
||||
@@ -222,7 +218,7 @@ public class BlockItemPacketRewriter1_9 extends VRBlockItemRewriter<ClientboundP
|
||||
|
||||
if (item.identifier() == 383 && item.data() == 0) { // Spawn eggs
|
||||
int data = 0;
|
||||
final CompoundTag entityTag = tag.getCompoundTag("EntityTag");
|
||||
final CompoundTag entityTag = tag == null ? null : tag.getCompoundTag("EntityTag");
|
||||
if (entityTag != null) {
|
||||
final StringTag idTag = entityTag.getStringTag("id");
|
||||
if (idTag != null) {
|
||||
@@ -246,7 +242,7 @@ public class BlockItemPacketRewriter1_9 extends VRBlockItemRewriter<ClientboundP
|
||||
|
||||
if (potion || splashPotion || lingeringPotion) {
|
||||
int data = 0;
|
||||
final StringTag potionTag = tag.getStringTag("Potion");
|
||||
final StringTag potionTag = tag == null ? null : tag.getStringTag("Potion");
|
||||
if (potionTag != null) {
|
||||
String potionName = Key.stripMinecraftNamespace(potionTag.getValue());
|
||||
if (PotionIdMappings1_8.POTION_NAME_TO_ID.containsKey(potionName)) {
|
||||
@@ -272,7 +268,7 @@ public class BlockItemPacketRewriter1_9 extends VRBlockItemRewriter<ClientboundP
|
||||
item.setData((short) data);
|
||||
}
|
||||
|
||||
final ListTag<CompoundTag> attributeModifiers = tag.getListTag("AttributeModifiers", CompoundTag.class);
|
||||
final ListTag<CompoundTag> attributeModifiers = tag == null ? null : tag.getListTag("AttributeModifiers", CompoundTag.class);
|
||||
if (attributeModifiers != null) {
|
||||
tag.put(nbtTagName() + "|AttributeModifiers", attributeModifiers.copy());
|
||||
attributeModifiers.getValue().removeIf(entries -> {
|
||||
@@ -290,14 +286,14 @@ public class BlockItemPacketRewriter1_9 extends VRBlockItemRewriter<ClientboundP
|
||||
super.handleItemToServer(connection, item);
|
||||
|
||||
CompoundTag tag = item.tag();
|
||||
if (tag == null) {
|
||||
item.setTag(tag = new CompoundTag());
|
||||
}
|
||||
|
||||
enchantmentRewriter.handleToServer(item);
|
||||
|
||||
if (item.identifier() == 383 && item.data() != 0) { // Spawn eggs
|
||||
if (!tag.contains("EntityTag") && EntityIds1_8.ENTITY_ID_TO_NAME.containsKey((int) item.data())) {
|
||||
if ((tag == null || !tag.contains("EntityTag")) && EntityIds1_8.ENTITY_ID_TO_NAME.containsKey((int) item.data())) {
|
||||
if (tag == null) {
|
||||
item.setTag(tag = new CompoundTag());
|
||||
}
|
||||
final CompoundTag entityTag = new CompoundTag();
|
||||
entityTag.put("id", new StringTag(EntityIds1_8.ENTITY_ID_TO_NAME.get((int) item.data())));
|
||||
tag.put("EntityTag", entityTag);
|
||||
@@ -305,20 +301,30 @@ public class BlockItemPacketRewriter1_9 extends VRBlockItemRewriter<ClientboundP
|
||||
item.setData((short) 0);
|
||||
}
|
||||
|
||||
if (item.identifier() == 373 && !tag.contains("Potion")) { // Potions
|
||||
if (item.identifier() == 373 && (tag == null || !tag.contains("Potion"))) { // Potions
|
||||
if (item.data() >= 16384) {
|
||||
item.setIdentifier(438);
|
||||
item.setData((short) (item.data() - 8192));
|
||||
}
|
||||
|
||||
final String name = item.data() == 8192 ? "water" : PotionIdMappings1_9.potionNameFromDamage(item.data());
|
||||
tag.put("Potion", new StringTag("minecraft:" + name));
|
||||
if (tag == null) {
|
||||
item.setTag(tag = new CompoundTag());
|
||||
|
||||
final String name = item.data() == 8192 ? "water" : PotionIdMappings1_9.potionNameFromDamage(item.data());
|
||||
tag.put("Potion", new StringTag("minecraft:" + name));
|
||||
}
|
||||
item.setData((short) 0);
|
||||
}
|
||||
|
||||
if (tag == null) {
|
||||
return item;
|
||||
}
|
||||
final Tag noDisplayTag = tag.remove(nbtTagName() + "|noDisplay");
|
||||
if (noDisplayTag != null) {
|
||||
tag.remove("display");
|
||||
if (tag.isEmpty()) {
|
||||
item.setTag(null);
|
||||
}
|
||||
}
|
||||
final Tag unbreakableTag = tag.remove(nbtTagName() + "|Unbreakable");
|
||||
if (unbreakableTag != null) {
|
||||
|
||||
+15
-11
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
package com.viaversion.viarewind.protocol.v1_9to1_8.rewriter;
|
||||
|
||||
import com.viaversion.viarewind.ViaRewind;
|
||||
import com.viaversion.viarewind.api.minecraft.math.RelativeMoveUtil;
|
||||
import com.viaversion.viarewind.api.rewriter.VREntityRewriter;
|
||||
import com.viaversion.viarewind.protocol.v1_9to1_8.Protocol1_9To1_8;
|
||||
@@ -26,7 +25,6 @@ import com.viaversion.viarewind.protocol.v1_9to1_8.storage.CooldownStorage;
|
||||
import com.viaversion.viarewind.protocol.v1_9to1_8.storage.EntityTracker1_9;
|
||||
import com.viaversion.viarewind.protocol.v1_9to1_8.storage.LevitationStorage;
|
||||
import com.viaversion.viarewind.protocol.v1_9to1_8.storage.PlayerPositionTracker;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.minecraft.BlockPosition;
|
||||
import com.viaversion.viaversion.api.minecraft.EulerAngle;
|
||||
import com.viaversion.viaversion.api.minecraft.Vector;
|
||||
@@ -52,7 +50,6 @@ import com.viaversion.viaversion.util.Pair;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class EntityPacketRewriter1_9 extends VREntityRewriter<ClientboundPackets1_9, Protocol1_9To1_8> {
|
||||
|
||||
@@ -67,7 +64,18 @@ public class EntityPacketRewriter1_9 extends VREntityRewriter<ClientboundPackets
|
||||
protected void registerPackets() {
|
||||
registerJoinGame1_8(ClientboundPackets1_9.LOGIN);
|
||||
registerRemoveEntities(ClientboundPackets1_9.REMOVE_ENTITIES);
|
||||
registerSetEntityData(ClientboundPackets1_9.SET_ENTITY_DATA, Types1_9.ENTITY_DATA_LIST, Types1_8.ENTITY_DATA_LIST);
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_9.SET_ENTITY_DATA, wrapper -> {
|
||||
final int entityId = wrapper.passthrough(Types.VAR_INT);
|
||||
if (!tracker(wrapper.user()).hasEntity(entityId)) {
|
||||
wrapper.cancel();
|
||||
return;
|
||||
}
|
||||
final List<EntityData> entityData = wrapper.read(Types1_9.ENTITY_DATA_LIST);
|
||||
handleEntityData(entityId, entityData, wrapper.user());
|
||||
|
||||
wrapper.write(Types1_8.ENTITY_DATA_LIST, entityData);
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_9.ADD_ENTITY, new PacketHandlers() {
|
||||
@Override
|
||||
@@ -221,7 +229,7 @@ public class EntityPacketRewriter1_9 extends VREntityRewriter<ClientboundPackets
|
||||
create(Types.SHORT, (short) 0); // Current item
|
||||
map(Types1_9.ENTITY_DATA_LIST, Types1_8.ENTITY_DATA_LIST); // Entity data
|
||||
|
||||
handler(getTrackerAndMetaHandler(Types1_8.ENTITY_DATA_LIST, EntityTypes1_9.EntityType.PLAYER));
|
||||
handler(getTrackerAndDataHandler(Types1_8.ENTITY_DATA_LIST, EntityTypes1_9.EntityType.PLAYER));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -401,11 +409,7 @@ public class EntityPacketRewriter1_9 extends VREntityRewriter<ClientboundPackets
|
||||
final int vehicle = wrapper.read(Types.VAR_INT);
|
||||
final IntList oldPassengers = tracker.getPassengers(vehicle);
|
||||
|
||||
final int count = wrapper.read(Types.VAR_INT);
|
||||
final IntList passengers = new IntArrayList();
|
||||
for (int i = 0; i < count; i++) {
|
||||
passengers.add(wrapper.read(Types.VAR_INT));
|
||||
}
|
||||
final IntList passengers = new IntArrayList(wrapper.read(Types.VAR_INT_ARRAY_PRIMITIVE));
|
||||
tracker.setPassengers(vehicle, passengers);
|
||||
|
||||
if (!oldPassengers.isEmpty()) {
|
||||
@@ -417,7 +421,7 @@ public class EntityPacketRewriter1_9 extends VREntityRewriter<ClientboundPackets
|
||||
detach.scheduleSend(Protocol1_9To1_8.class);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < count; i++) {
|
||||
for (int i = 0; i < passengers.size(); i++) {
|
||||
final int attachedEntityId = passengers.getInt(i);
|
||||
final int holdingEntityId = i == 0 ? vehicle : passengers.getInt(i - 1);
|
||||
|
||||
|
||||
+72
-25
@@ -28,7 +28,7 @@ import com.viaversion.viaversion.api.minecraft.entitydata.EntityData;
|
||||
import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_8;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.rewriter.ItemRewriter;
|
||||
import com.viaversion.viaversion.api.rewriter.RewriterBase;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_8;
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
@@ -45,9 +45,14 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlayerPacketRewriter1_9 {
|
||||
public class PlayerPacketRewriter1_9 extends RewriterBase<Protocol1_9To1_8> {
|
||||
|
||||
public static void register(final Protocol1_9To1_8 protocol) {
|
||||
public PlayerPacketRewriter1_9(Protocol1_9To1_8 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
protocol.registerClientbound(ClientboundPackets1_9.BOSS_EVENT, null, wrapper -> {
|
||||
wrapper.cancel();
|
||||
final BossBarStorage bossbar = wrapper.user().get(BossBarStorage.class);
|
||||
@@ -61,7 +66,7 @@ public class PlayerPacketRewriter1_9 {
|
||||
wrapper.read(Types.VAR_INT); // Division
|
||||
wrapper.read(Types.UNSIGNED_BYTE); // Flags
|
||||
|
||||
bossbar.add(uuid, ChatUtil.jsonToLegacy(wrapper.user(), title), health);
|
||||
bossbar.add(uuid, ChatUtil.jsonToLegacy(title), health);
|
||||
} else if (action == 1 /* remove */) {
|
||||
bossbar.remove(uuid);
|
||||
} else if (action == 2 /* update health */) {
|
||||
@@ -69,7 +74,7 @@ public class PlayerPacketRewriter1_9 {
|
||||
bossbar.updateHealth(uuid, health);
|
||||
} else if (action == 3 /* update title */) {
|
||||
final JsonElement title = wrapper.read(Types.COMPONENT);
|
||||
bossbar.updateTitle(uuid, ChatUtil.jsonToLegacy(wrapper.user(), title));
|
||||
bossbar.updateTitle(uuid, ChatUtil.jsonToLegacy(title));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -166,14 +171,51 @@ public class PlayerPacketRewriter1_9 {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Types.INT); // Dimension
|
||||
handler(wrapper -> wrapper.user().get(BossBarStorage.class).reset());
|
||||
handler(wrapper -> {
|
||||
final ClientWorld world = wrapper.user().get(ClientWorld.class);
|
||||
world.setEnvironment(wrapper.get(Types.INT, 0));
|
||||
final ClientWorld world = wrapper.user().getClientWorld(Protocol1_9To1_8.class);
|
||||
final int dimension = wrapper.get(Types.INT, 0);
|
||||
|
||||
if (world.setEnvironment(dimension)) {
|
||||
protocol.getEntityRewriter().clearEntities(wrapper.user());
|
||||
wrapper.user().get(BossBarStorage.class).reset();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Packet implementation doesn't do anything until 1.9
|
||||
protocol.registerClientbound(ClientboundPackets1_9.PLAYER_COMBAT, wrapper -> {
|
||||
if (!ViaRewind.getConfig().handlePlayerCombatPacket()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int action = wrapper.passthrough(Types.VAR_INT);
|
||||
if (action != 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
final EntityTracker1_9 tracker = wrapper.user().getEntityTracker(Protocol1_9To1_8.class);
|
||||
final int entityId = wrapper.passthrough(Types.VAR_INT);
|
||||
wrapper.passthrough(Types.INT); // Killer id
|
||||
|
||||
if (entityId != tracker.clientEntityId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final JsonElement message = wrapper.passthrough(Types.COMPONENT);
|
||||
|
||||
final PacketWrapper killPlayer = wrapper.create(ClientboundPackets1_8.SET_HEALTH);
|
||||
killPlayer.write(Types.FLOAT, 0F); // Health
|
||||
killPlayer.write(Types.VAR_INT, 0); // Food
|
||||
killPlayer.write(Types.FLOAT, 0F); // Food Saturation
|
||||
killPlayer.scheduleSend(Protocol1_9To1_8.class);
|
||||
|
||||
final PacketWrapper chatMessage = wrapper.create(ClientboundPackets1_8.CHAT);
|
||||
chatMessage.write(Types.COMPONENT, message);
|
||||
chatMessage.write(Types.BYTE, (byte) 2); // Position - above hotbar
|
||||
chatMessage.scheduleSend(Protocol1_9To1_8.class);
|
||||
});
|
||||
|
||||
protocol.registerServerbound(ServerboundPackets1_8.CHAT, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
@@ -393,7 +435,7 @@ public class PlayerPacketRewriter1_9 {
|
||||
map(Types.BLOCK_POSITION1_8); // Position
|
||||
handler(wrapper -> {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
wrapper.write(Types.STRING, ChatUtil.jsonToLegacy(wrapper.user(), wrapper.read(Types.COMPONENT)));
|
||||
wrapper.write(Types.STRING, ChatUtil.jsonToLegacy(wrapper.read(Types.COMPONENT)));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -439,25 +481,30 @@ public class PlayerPacketRewriter1_9 {
|
||||
handlerSoftFail(wrapper -> {
|
||||
final String channel = wrapper.get(Types.STRING, 0);
|
||||
if (channel.equals("MC|BEdit") || channel.equals("MC|BSign")) {
|
||||
Item book = wrapper.passthrough(Types.ITEM1_8);
|
||||
final Item book = wrapper.passthrough(Types.ITEM1_8);
|
||||
book.setIdentifier(386);
|
||||
CompoundTag tag = book.tag();
|
||||
if (tag.contains("pages")) {
|
||||
ListTag<StringTag> pages = tag.getListTag("pages", StringTag.class);
|
||||
if (pages.size() > ViaRewind.getConfig().getMaxBookPages()) {
|
||||
wrapper.user().disconnect("Too many book pages");
|
||||
final CompoundTag tag = book.tag();
|
||||
if (tag == null) {
|
||||
return;
|
||||
}
|
||||
final ListTag<StringTag> pages = tag.getListTag("pages", StringTag.class);
|
||||
if (pages == null) {
|
||||
return;
|
||||
}
|
||||
if (pages.size() > ViaRewind.getConfig().getMaxBookPages()) {
|
||||
wrapper.user().disconnect("Too many book pages");
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < pages.size(); i++) {
|
||||
final StringTag pageTag = pages.get(i);
|
||||
final String value = pageTag.getValue();
|
||||
|
||||
if (value.length() > ViaRewind.getConfig().getMaxBookPageSize()) {
|
||||
wrapper.user().disconnect("Book page too large");
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < pages.size(); i++) {
|
||||
StringTag page = pages.get(i);
|
||||
String value = page.getValue();
|
||||
if (value.length() > ViaRewind.getConfig().getMaxBookPageSize()) {
|
||||
wrapper.user().disconnect("Book page too large");
|
||||
return;
|
||||
}
|
||||
value = ChatUtil.jsonToLegacy(wrapper.user(), value);
|
||||
page.setValue(value);
|
||||
}
|
||||
|
||||
pageTag.setValue(ChatUtil.jsonToLegacy(value));
|
||||
}
|
||||
} else if (channel.equals("MC|AdvCdm")) {
|
||||
wrapper.set(Types.STRING, 0, "MC|AdvCmd");
|
||||
|
||||
+10
-6
@@ -21,7 +21,6 @@ import com.viaversion.nbt.tag.Tag;
|
||||
import com.viaversion.viarewind.ViaRewind;
|
||||
import com.viaversion.viarewind.protocol.v1_9to1_8.Protocol1_9To1_8;
|
||||
import com.viaversion.viarewind.protocol.v1_9to1_8.data.EffectIdMappings1_8;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.BlockPosition;
|
||||
import com.viaversion.viaversion.api.minecraft.Environment;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.BaseChunk;
|
||||
@@ -32,6 +31,7 @@ import com.viaversion.viaversion.api.minecraft.chunks.DataPalette;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.PaletteType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.rewriter.RewriterBase;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_8;
|
||||
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_1;
|
||||
@@ -39,13 +39,17 @@ import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_
|
||||
import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_9;
|
||||
import com.viaversion.nbt.tag.CompoundTag;
|
||||
import com.viaversion.nbt.tag.StringTag;
|
||||
import com.viaversion.viaversion.api.minecraft.ClientWorld;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class WorldPacketRewriter1_9 {
|
||||
public class WorldPacketRewriter1_9 extends RewriterBase<Protocol1_9To1_8> {
|
||||
|
||||
public static void register(Protocol1_9To1_8 protocol) {
|
||||
public WorldPacketRewriter1_9(Protocol1_9To1_8 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
protocol.registerClientbound(ClientboundPackets1_9.BLOCK_ENTITY_DATA, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
@@ -107,7 +111,7 @@ public class WorldPacketRewriter1_9 {
|
||||
@Override
|
||||
public void register() {
|
||||
handler(wrapper -> {
|
||||
final Environment environment = wrapper.user().get(ClientWorld.class).getEnvironment();
|
||||
final Environment environment = wrapper.user().getClientWorld(Protocol1_9To1_8.class).getEnvironment();
|
||||
|
||||
final int chunkX = wrapper.read(Types.INT);
|
||||
final int chunkZ = wrapper.read(Types.INT);
|
||||
@@ -121,7 +125,7 @@ public class WorldPacketRewriter1_9 {
|
||||
@Override
|
||||
public void register() {
|
||||
handler(wrapper -> {
|
||||
final Environment environment = wrapper.user().get(ClientWorld.class).getEnvironment();
|
||||
final Environment environment = wrapper.user().getClientWorld(Protocol1_9To1_8.class).getEnvironment();
|
||||
|
||||
Chunk chunk = wrapper.read(ChunkType1_9_1.forEnvironment(environment));
|
||||
|
||||
|
||||
+11
-2
@@ -28,11 +28,12 @@ import java.util.logging.Level;
|
||||
|
||||
public class CooldownStorage implements StorableObject {
|
||||
|
||||
private double attackSpeed = 4.0;
|
||||
private long lastHit = 0;
|
||||
private CooldownVisualization.Factory visualizationFactory = CooldownVisualization.Factory.fromConfiguration();
|
||||
private CooldownVisualization current;
|
||||
|
||||
private double attackSpeed = 4.0;
|
||||
private long lastHit = 0;
|
||||
|
||||
public void tick(final UserConnection connection) {
|
||||
if (!hasCooldown()) {
|
||||
endCurrentVisualization();
|
||||
@@ -110,4 +111,12 @@ public class CooldownStorage implements StorableObject {
|
||||
public void setLastHit(long lastHit) {
|
||||
this.lastHit = lastHit;
|
||||
}
|
||||
|
||||
public CooldownVisualization.Factory getVisualizationFactory() {
|
||||
return visualizationFactory;
|
||||
}
|
||||
|
||||
public void setVisualizationFactory(CooldownVisualization.Factory visualizationFactory) {
|
||||
this.visualizationFactory = visualizationFactory;
|
||||
}
|
||||
}
|
||||
+3
@@ -32,6 +32,9 @@ public class LevitationUpdateTask implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!ViaRewind.getConfig().emulateLevitationEffect()) {
|
||||
return;
|
||||
}
|
||||
for (UserConnection connection : Via.getManager().getConnectionManager().getConnections()) {
|
||||
final LevitationStorage levitation = connection.get(LevitationStorage.class);
|
||||
if (!levitation.isActive()) {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
package com.viaversion.viarewind.utils;
|
||||
|
||||
import com.viaversion.viarewind.ViaRewind;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
import com.viaversion.viaversion.libs.gson.JsonObject;
|
||||
@@ -43,29 +43,35 @@ public class ChatUtil {
|
||||
}
|
||||
};
|
||||
|
||||
public static String jsonToLegacy(UserConnection connection, String json) {
|
||||
if (json == null || json.equals("null") || json.isEmpty()) return "";
|
||||
public static String jsonToLegacy(String json) {
|
||||
if (json == null || json.equals("null") || json.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
return jsonToLegacy(connection, JsonParser.parseString(json));
|
||||
return jsonToLegacy(JsonParser.parseString(json));
|
||||
} catch (Exception e) {
|
||||
ViaRewind.getPlatform().getLogger().log(Level.WARNING, "Could not convert component to legacy text: " + json, e);
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
ViaRewind.getPlatform().getLogger().log(Level.WARNING, "Could not convert component to legacy text: " + json, e);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String jsonToLegacy(UserConnection connection, JsonElement component) {
|
||||
public static String jsonToLegacy(JsonElement component) {
|
||||
if (component.isJsonNull() || component.isJsonArray() && component.getAsJsonArray().isEmpty() || component.isJsonObject() && component.getAsJsonObject().isEmpty()) {
|
||||
return "";
|
||||
} else if (component.isJsonPrimitive()) {
|
||||
return component.getAsString();
|
||||
} else {
|
||||
try {
|
||||
LEGACY_REWRITER.processText(connection, component);
|
||||
LEGACY_REWRITER.processText(null, component);
|
||||
String legacy = ComponentUtil.jsonToLegacy(component);
|
||||
while (legacy.startsWith("§f")) legacy = legacy.substring(2);
|
||||
return legacy;
|
||||
} catch (Exception ex) {
|
||||
ViaRewind.getPlatform().getLogger().log(Level.WARNING, "Could not convert component to legacy text: " + component, ex);
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
ViaRewind.getPlatform().getLogger().log(Level.WARNING, "Could not convert component to legacy text: " + component, ex);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
# Specifies how 1.8.x clients should see the cooldown indicator
|
||||
# You can choose between TITLE, ACTION_BAR, BOSS_BAR and DISABLED
|
||||
# ONLY DISABLE IF YOU HAVE 1.9 COOLDOWN DISABLED ON YOUR SERVER
|
||||
# 1.8 PLAYERS MAY ASK WHY PVP IS NOT WORKING OTHERWISE
|
||||
# 1.8 PLAYERS MAY ASK WHY PVP IS NOT WORKING OTHERWISE.
|
||||
# REQUIRES A SERVER RESTART TO TAKE EFFECT
|
||||
cooldown-indicator: 'TITLE'
|
||||
#
|
||||
# Replaces Adventure mode with Survival mode for 1.7.x clients
|
||||
@@ -11,14 +12,14 @@ cooldown-indicator: 'TITLE'
|
||||
# or 'CanPlaceOn' flags on items
|
||||
replace-adventure: false
|
||||
#
|
||||
# Whether 1.9 particles should be replaced by similar ones in
|
||||
# Whether similar ones should replace 1.9 particles in
|
||||
# 1.8 and lower
|
||||
replace-particles: false
|
||||
#
|
||||
# Max amount of pages for written books before a client gets kicked
|
||||
# Max number of pages for written books before a client gets kicked
|
||||
max-book-pages: 100
|
||||
#
|
||||
# Max amount of characters in the json (!) string of a book page before a client gets kicked
|
||||
# Max number of characters in the json (!) string of a book page before a client gets kicked
|
||||
max-book-page-length: 5000
|
||||
#
|
||||
# Whether to emulate the 1.8+ world border for 1.7.x clients
|
||||
@@ -28,11 +29,17 @@ emulate-world-border: true
|
||||
always-show-original-mob-name: true
|
||||
#
|
||||
# The particle to show the world border for the 1.8+ world border for 1.7.x clients
|
||||
# see https://wiki.vg/index.php?title=Protocol&oldid=7368#Particle_2
|
||||
# sees https://wiki.vg/index.php?title=Protocol&oldid=7368#Particle_2
|
||||
world-border-particle: 'fireworksSpark'
|
||||
#
|
||||
# If enabled, 1.8 players on 1.9+ servers can use /offhand to switch items between their main hand and offhand.
|
||||
enable-offhand: true
|
||||
#
|
||||
# Allows to define the offhand command
|
||||
offhand-command: '/offhand'
|
||||
# Allows defining the offhand command
|
||||
offhand-command: '/offhand'
|
||||
#
|
||||
# If enabled, 1.8 players on 1.9+ servers will also experience the levitation effect by sending velocity packets.
|
||||
emulate-levitation-effect: true
|
||||
#
|
||||
# If enabled, 1.8 players will handle the player combat packet added in 1.9 by showing the custom death message above the hotbar.
|
||||
handle-player-combat-packet: true
|
||||
+14
-3
@@ -1,10 +1,21 @@
|
||||
plugins {
|
||||
id "com.viaversion.java-conventions"
|
||||
id "vr.platform-conventions"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "FabricMC"
|
||||
url "https://maven.fabricmc.net/"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api project(":viarewind-common")
|
||||
|
||||
compileOnly(annotationProcessor("net.fabricmc:fabric-loader:0.11.3"))
|
||||
compileOnly(annotationProcessor("org.apache.logging.log4j:log4j-api:2.17.1"))
|
||||
}
|
||||
|
||||
processResources {
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand("version": project.version, "description": project.description)
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
maven_name=viarewind-fabric
|
||||
@@ -23,9 +23,8 @@
|
||||
]
|
||||
},
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.0",
|
||||
"viafabric": ">=0.4.10",
|
||||
"viabackwards": "*"
|
||||
"viafabric": ">=0.4.14",
|
||||
"viabackwards": ">=5.0.4"
|
||||
},
|
||||
"custom": {
|
||||
"modmenu:api": true,
|
||||
|
||||
+4
-9
@@ -3,16 +3,11 @@ org.gradle.jvmargs=-Xmx8G
|
||||
org.gradle.parallel=true
|
||||
|
||||
# project
|
||||
maven_version=4.0.0
|
||||
maven_group=com.viaversion
|
||||
|
||||
# libraries
|
||||
viaversion_version=5.0.0
|
||||
viabackwards_version=5.0.0
|
||||
netty_version=4.0.20.Final
|
||||
guava_version=17.0
|
||||
maven_version=4.0.4
|
||||
maven_description=ViaBackwards addon to allow 1.8.x and 1.7.x clients on newer server versions.
|
||||
|
||||
# Smile emoji
|
||||
mcVersions=1.21, 1.20.6, 1.20.5, 1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10, 1.9.4, 1.9.3, 1.9.2, 1.9.1, 1.9, 1.8.9, 1.8.8
|
||||
mcVersionRange=1.8-1.21
|
||||
mcVersions=1.21.4, 1.21.3, 1.21.2, 1.21.1, 1.21, 1.20.6, 1.20.5, 1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10, 1.9.4, 1.9.3, 1.9.2, 1.9.1, 1.9, 1.8.9, 1.8.8
|
||||
mcVersionRange=1.8-1.21.4
|
||||
velocityVersion=3.3
|
||||
Vendored
BIN
Binary file not shown.
+2
-1
@@ -1,6 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
distributionSha256Sum=7a00d51fb93147819aab76024feece20b6b84e420694101f276be952e08bef03
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -84,7 +86,7 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
Vendored
+94
-92
@@ -1,92 +1,94 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
+6
-13
@@ -1,23 +1,16 @@
|
||||
import java.util.function.Consumer
|
||||
rootProject.name = "viarewind"
|
||||
|
||||
includeBuild("build-logic")
|
||||
|
||||
setupViaSubproject("common")
|
||||
setupViaSubproject("bukkit")
|
||||
setupViaSubproject("fabric")
|
||||
setupViaSubproject("sponge")
|
||||
setupViaSubproject("velocity")
|
||||
|
||||
setupSubproject("viarewind", project -> {
|
||||
project.projectDir = file("universal")
|
||||
})
|
||||
|
||||
void setupViaSubproject(String name) {
|
||||
setupSubproject("viarewind-" + name, project -> {
|
||||
project.projectDir = file(name)
|
||||
})
|
||||
}
|
||||
var pName = "viarewind-" + name
|
||||
|
||||
void setupSubproject(String name, Consumer<ProjectDescriptor> block) {
|
||||
include name
|
||||
block.accept(project(":" + name))
|
||||
}
|
||||
include pName
|
||||
project(":" + pName).projectDir = file(name)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
plugins {
|
||||
id "vr.platform-conventions"
|
||||
}
|
||||
|
||||
processResources {
|
||||
filesMatching("META-INF/sponge_plugins.json") {
|
||||
expand("version": project.version, "description": project.description)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"loader": {
|
||||
"name": "java_plain",
|
||||
"version": "1.0"
|
||||
},
|
||||
"license": "GNU GPLv3",
|
||||
"global": {
|
||||
"version": "${version}",
|
||||
"links": {
|
||||
"homepage": "https://viaversion.com/rewind",
|
||||
"source": "https://github.com/ViaVersion/ViaRewind",
|
||||
"issues": "https://github.com/ViaVersion/ViaRewind"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "FlorianMichael/EnZaXD",
|
||||
"description": "Author"
|
||||
},
|
||||
{
|
||||
"name": "Gerrygames",
|
||||
"description": "Author"
|
||||
},
|
||||
{
|
||||
"name": "creeper123123321",
|
||||
"description": "Maintainer"
|
||||
}
|
||||
],
|
||||
"dependencies": [
|
||||
{
|
||||
"id": "spongeapi",
|
||||
"version": "8.0.0"
|
||||
},
|
||||
{
|
||||
"id": "viasponge",
|
||||
"version": "1.1.0"
|
||||
},
|
||||
{
|
||||
"id": "viaversion",
|
||||
"version": "[5.0.4-SNAPSHOT,)"
|
||||
},
|
||||
{
|
||||
"id": "viabackwards",
|
||||
"version": "[5.0.4-SNAPSHOT,)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
"id": "viarewind",
|
||||
"name": "ViaRewind",
|
||||
"entrypoint": "com.viaversion.sponge.util.DummyEntrypoint",
|
||||
"description": "${description}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
maven_name=viarewind
|
||||
@@ -1,9 +1,15 @@
|
||||
plugins {
|
||||
id "com.viaversion.java-conventions"
|
||||
id "vr.platform-conventions"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "VelocityPowered"
|
||||
url "https://nexus.velocitypowered.com/repository/maven-public/"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api project(":viarewind-common")
|
||||
|
||||
compileOnly("com.viaversion:viaversion-velocity:5.0.0") // Needed for logger wrapper
|
||||
compileOnly(annotationProcessor("com.velocitypowered:velocity-api:3.1.1"))
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
maven_name=viarewind-velocity
|
||||
@@ -21,7 +21,6 @@ import com.google.inject.Inject;
|
||||
import com.velocitypowered.api.event.PostOrder;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||
import com.velocitypowered.api.event.proxy.ProxyReloadEvent;
|
||||
import com.velocitypowered.api.plugin.Dependency;
|
||||
import com.velocitypowered.api.plugin.Plugin;
|
||||
import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
||||
|
||||
Reference in new issue
Block a user