paper is fighting me

This commit is contained in:
Telesphoreo 2023-12-10 13:12:22 -06:00
parent 569338c315
commit 747552d1a2
6 changed files with 35 additions and 30 deletions

2
.gitignore vendored
View file

@ -50,3 +50,5 @@ Scissors-Server
Scissors-API
!gradle/wrapper/gradle-wrapper.jar
paper-api-generator

View file

@ -8,3 +8,5 @@
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
minecraft net/minecraft/network/chat/HoverEvent

View file

@ -65,6 +65,15 @@ paperweight {
serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
serverOutputDir.set(layout.projectDirectory.dir("Scissors-Server"))
patchTasks {
register("generatedApi") {
isBareDirectory.set(true)
upstreamDirPath.set("paper-api-generator/generated")
patchDir.set(layout.projectDirectory.dir("patches/generatedApi"))
outputDir.set(layout.projectDirectory.dir("paper-api-generator/generated"))
}
}
}
}
}

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

14
gradlew vendored
View file

@ -145,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@ -153,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Video <videogamesm12@gmail.com>
Date: Sat, 12 Mar 2022 19:34:59 -0700
From: Telesphoreo <me@telesphoreo.me>
Date: Sun, 10 Dec 2023 13:11:22 -0600
Subject: [PATCH] UUID validation
@ -22,26 +22,18 @@ index b65dcff9812dbc3256c080ac264c4aafd83ce276..82b53a7bfb37bfa1752a016a8a454c0b
// Paper end
String string = nbt.getString("Name");
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
index 3ad05bbab726c59e7b67d9614af4b208d4520cb3..c0633f9553fb5aa52e8ffc863159521d09cb3bd5 100644
index 7fd85ae2ebd7225f06d874aa7e37fbdb89e3ea92..b2cc15da40aa7bbcfc234b4e147ed0e53f359efa 100644
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
@@ -174,7 +174,14 @@ public class HoverEvent {
} else {
JsonObject jsonObject = json.getAsJsonObject();
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(GsonHelper.getAsString(jsonObject, "type")));
- UUID uUID = UUID.fromString(GsonHelper.getAsString(jsonObject, "id"));
+ // Scissors start
+ UUID uUID;
+ try {
+ uUID = UUID.fromString(GsonHelper.getAsString(jsonObject, "id"));
+ } catch (Exception ex) {
+ return null;
+ }
+ // Scissors end
Component component = Component.Serializer.fromJson(jsonObject.get("name"));
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
}
@@ -186,7 +193,14 @@ public class HoverEvent {
@@ -20,6 +20,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.TagParser;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.ExtraCodecs;
+import net.minecraft.util.GsonHelper;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.Item;
@@ -161,7 +162,14 @@ public class HoverEvent {
CompoundTag compoundTag = TagParser.parseTag(text.getString());
Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
@ -54,6 +46,6 @@ index 3ad05bbab726c59e7b67d9614af4b208d4520cb3..c0633f9553fb5aa52e8ffc863159521d
+ return null;
+ }
+ // Scissors end
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
return DataResult.success(new HoverEvent.EntityTooltipInfo(entityType, uUID, component));
} catch (Exception var5) {
return null;
return DataResult.error(() -> {