mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 12:42:05 -07:00
net.minecraft
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
--- a/net/minecraft/ChatFormatting.java
|
--- a/net/minecraft/ChatFormatting.java
|
||||||
+++ b/net/minecraft/ChatFormatting.java
|
+++ b/net/minecraft/ChatFormatting.java
|
||||||
@@ -112,6 +112,18 @@
|
@@ -112,6 +_,19 @@
|
||||||
return name == null ? null : FORMATTING_BY_NAME.get(cleanName(name));
|
return friendlyName == null ? null : FORMATTING_BY_NAME.get(cleanName(friendlyName));
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - add method to get by hex value
|
+ // Paper start - add method to get by hex value
|
||||||
+ @Nullable public static ChatFormatting getByHexValue(int i) {
|
+ @Nullable
|
||||||
|
+ public static ChatFormatting getByHexValue(int i) {
|
||||||
+ for (ChatFormatting value : values()) {
|
+ for (ChatFormatting value : values()) {
|
||||||
+ if (value.getColor() != null && value.getColor() == i) {
|
+ if (value.getColor() != null && value.getColor() == i) {
|
||||||
+ return value;
|
+ return value;
|
||||||
@@ -17,5 +18,5 @@
|
|||||||
+ // Paper end - add method to get by hex value
|
+ // Paper end - add method to get by hex value
|
||||||
+
|
+
|
||||||
@Nullable
|
@Nullable
|
||||||
public static ChatFormatting getById(int colorIndex) {
|
public static ChatFormatting getById(int index) {
|
||||||
if (colorIndex < 0) {
|
if (index < 0) {
|
@@ -1,22 +1,22 @@
|
|||||||
--- a/net/minecraft/CrashReport.java
|
--- a/net/minecraft/CrashReport.java
|
||||||
+++ b/net/minecraft/CrashReport.java
|
+++ b/net/minecraft/CrashReport.java
|
||||||
@@ -34,8 +34,10 @@
|
@@ -32,8 +_,10 @@
|
||||||
private final SystemReport systemReport = new SystemReport();
|
private final SystemReport systemReport = new SystemReport();
|
||||||
|
|
||||||
public CrashReport(String message, Throwable cause) {
|
public CrashReport(String title, Throwable exception) {
|
||||||
+ io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(cause); // Paper
|
+ io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(exception); // Paper
|
||||||
this.title = message;
|
this.title = title;
|
||||||
this.exception = cause;
|
this.exception = exception;
|
||||||
+ this.systemReport.setDetail("CraftBukkit Information", new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit
|
+ this.systemReport.setDetail("CraftBukkit Information", new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
@@ -251,7 +253,7 @@
|
@@ -218,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void preload() {
|
public static void preload() {
|
||||||
- MemoryReserve.allocate();
|
- MemoryReserve.allocate();
|
||||||
+ // MemoryReserve.allocate(); // Paper - Disable memory reserve allocating
|
+ //MemoryReserve.allocate(); // Paper - Disable memory reserve allocating
|
||||||
(new CrashReport("Don't panic!", new Throwable())).getFriendlyReport(ReportType.CRASH);
|
new CrashReport("Don't panic!", new Throwable()).getFriendlyReport(ReportType.CRASH);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,9 +1,9 @@
|
|||||||
--- a/net/minecraft/CrashReportCategory.java
|
--- a/net/minecraft/CrashReportCategory.java
|
||||||
+++ b/net/minecraft/CrashReportCategory.java
|
+++ b/net/minecraft/CrashReportCategory.java
|
||||||
@@ -110,6 +110,7 @@
|
@@ -138,6 +_,7 @@
|
||||||
} else {
|
} else {
|
||||||
this.stackTrace = new StackTraceElement[stackTraceElements.length - 3 - ignoredCallCount];
|
this.stackTrace = new StackTraceElement[stackTrace.length - 3 - size];
|
||||||
System.arraycopy(stackTraceElements, 3 + ignoredCallCount, this.stackTrace, 0, this.stackTrace.length);
|
System.arraycopy(stackTrace, 3 + size, this.stackTrace, 0, this.stackTrace.length);
|
||||||
+ this.stackTrace = io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateStacktrace(this.stackTrace); // Paper
|
+ this.stackTrace = io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateStacktrace(this.stackTrace); // Paper
|
||||||
return this.stackTrace.length;
|
return this.stackTrace.length;
|
||||||
}
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/Util.java
|
--- a/net/minecraft/Util.java
|
||||||
+++ b/net/minecraft/Util.java
|
+++ b/net/minecraft/Util.java
|
||||||
@@ -92,9 +92,26 @@
|
@@ -92,9 +_,26 @@
|
||||||
private static final int DEFAULT_MAX_THREADS = 255;
|
private static final int DEFAULT_MAX_THREADS = 255;
|
||||||
private static final int DEFAULT_SAFE_FILE_OPERATION_RETRIES = 10;
|
private static final int DEFAULT_SAFE_FILE_OPERATION_RETRIES = 10;
|
||||||
private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads";
|
private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads";
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
private static final DateTimeFormatter FILENAME_DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss", Locale.ROOT);
|
private static final DateTimeFormatter FILENAME_DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss", Locale.ROOT);
|
||||||
public static final int LINEAR_LOOKUP_THRESHOLD = 8;
|
public static final int LINEAR_LOOKUP_THRESHOLD = 8;
|
||||||
private static final Set<String> ALLOWED_UNTRUSTED_LINK_PROTOCOLS = Set.of("http", "https");
|
private static final Set<String> ALLOWED_UNTRUSTED_LINK_PROTOCOLS = Set.of("http", "https");
|
||||||
@@ -136,7 +153,7 @@
|
@@ -135,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getNanos() {
|
public static long getNanos() {
|
||||||
@@ -37,36 +37,37 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static long getEpochMillis() {
|
public static long getEpochMillis() {
|
||||||
@@ -147,15 +164,16 @@
|
@@ -146,15 +_,17 @@
|
||||||
return FILENAME_DATE_TIME_FORMATTER.format(ZonedDateTime.now());
|
return FILENAME_DATE_TIME_FORMATTER.format(ZonedDateTime.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
- private static TracingExecutor makeExecutor(String name) {
|
- private static TracingExecutor makeExecutor(String name) {
|
||||||
+ private static TracingExecutor makeExecutor(String name, final int priorityModifier) { // Paper - Perf: add priority
|
+ private static TracingExecutor makeExecutor(String name, final int priorityModifier) { // Paper - Perf: add priority
|
||||||
int i = maxAllowedExecutorThreads();
|
int i = maxAllowedExecutorThreads();
|
||||||
- ExecutorService executorService;
|
- ExecutorService directExecutorService;
|
||||||
+ // Paper start - Perf: use simpler thread pool that allows 1 thread and reduce worldgen thread worker count for low core count CPUs
|
+ // Paper start - Perf: use simpler thread pool that allows 1 thread and reduce worldgen thread worker count for low core count CPUs
|
||||||
+ final ExecutorService executorService;
|
+ final ExecutorService directExecutorService;
|
||||||
if (i <= 0) {
|
if (i <= 0) {
|
||||||
executorService = MoreExecutors.newDirectExecutorService();
|
directExecutorService = MoreExecutors.newDirectExecutorService();
|
||||||
} else {
|
} else {
|
||||||
- AtomicInteger atomicInteger = new AtomicInteger(1);
|
AtomicInteger atomicInteger = new AtomicInteger(1);
|
||||||
- executorService = new ForkJoinPool(i, pool -> {
|
- directExecutorService = new ForkJoinPool(i, forkJoinPool -> {
|
||||||
- final String string2 = "Worker-" + name + "-" + atomicInteger.getAndIncrement();
|
- final String string = "Worker-" + name + "-" + atomicInteger.getAndIncrement();
|
||||||
+ executorService = Executors.newFixedThreadPool(i, target -> new io.papermc.paper.util.ServerWorkerThread(target, name, priorityModifier));
|
+ directExecutorService = Executors.newFixedThreadPool(i, target -> new io.papermc.paper.util.ServerWorkerThread(target, name, priorityModifier));
|
||||||
+ }
|
+ }
|
||||||
+ /* final String string2 = "Worker-" + name + "-" + atomicInteger.getAndIncrement();
|
+ /* final String string = "Worker-" + name + "-" + atomicInteger.getAndIncrement();
|
||||||
ForkJoinWorkerThread forkJoinWorkerThread = new ForkJoinWorkerThread(pool) {
|
ForkJoinWorkerThread forkJoinWorkerThread = new ForkJoinWorkerThread(forkJoinPool) {
|
||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
@@ -177,13 +195,26 @@
|
@@ -176,13 +_,27 @@
|
||||||
forkJoinWorkerThread.setName(string2);
|
forkJoinWorkerThread.setName(string);
|
||||||
return forkJoinWorkerThread;
|
return forkJoinWorkerThread;
|
||||||
}, Util::onThreadException, true);
|
}, Util::onThreadException, true);
|
||||||
- }
|
- }
|
||||||
+ }*/
|
+ }*/
|
||||||
|
+ // Paper end
|
||||||
|
|
||||||
return new TracingExecutor(executorService);
|
return new TracingExecutor(directExecutorService);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int maxAllowedExecutorThreads() {
|
public static int maxAllowedExecutorThreads() {
|
||||||
@@ -88,15 +89,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static int getMaxThreads() {
|
private static int getMaxThreads() {
|
||||||
@@ -229,10 +260,25 @@
|
@@ -233,6 +_,21 @@
|
||||||
TracyClient.setThreadName(string2, namePrefix.hashCode());
|
}));
|
||||||
thread.setName(string2);
|
}
|
||||||
thread.setDaemon(daemon);
|
|
||||||
+ thread.setUncaughtExceptionHandler(Util::onThreadException);
|
|
||||||
+ return thread;
|
|
||||||
+ }));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // Paper start - Separate dimension data IO pool
|
+ // Paper start - Separate dimension data IO pool
|
||||||
+ private static TracingExecutor makeExtraIoExecutor(String namePrefix) {
|
+ private static TracingExecutor makeExtraIoExecutor(String namePrefix) {
|
||||||
+ AtomicInteger atomicInteger = new AtomicInteger(1);
|
+ AtomicInteger atomicInteger = new AtomicInteger(1);
|
||||||
@@ -106,24 +102,16 @@
|
|||||||
+ TracyClient.setThreadName(string2, namePrefix.hashCode());
|
+ TracyClient.setThreadName(string2, namePrefix.hashCode());
|
||||||
+ thread.setName(string2);
|
+ thread.setName(string2);
|
||||||
+ thread.setDaemon(false);
|
+ thread.setDaemon(false);
|
||||||
thread.setUncaughtExceptionHandler(Util::onThreadException);
|
+ thread.setUncaughtExceptionHandler(Util::onThreadException);
|
||||||
return thread;
|
+ return thread;
|
||||||
}));
|
+ }));
|
||||||
}
|
+ }
|
||||||
+ // Paper end - Separate dimension data IO pool
|
+ // Paper end - Separate dimension data IO pool
|
||||||
|
+
|
||||||
public static void throwAsRuntime(Throwable t) {
|
public static void throwAsRuntime(Throwable throwable) {
|
||||||
throw t instanceof RuntimeException ? (RuntimeException)t : new RuntimeException(t);
|
throw throwable instanceof RuntimeException ? (RuntimeException)throwable : new RuntimeException(throwable);
|
||||||
@@ -537,7 +583,7 @@
|
}
|
||||||
public static <K extends Enum<K>, V> EnumMap<K, V> makeEnumMap(Class<K> enumClass, Function<K, V> mapper) {
|
@@ -1075,16 +_,7 @@
|
||||||
EnumMap<K, V> enumMap = new EnumMap<>(enumClass);
|
|
||||||
|
|
||||||
- for (K enum_ : (Enum[])enumClass.getEnumConstants()) {
|
|
||||||
+ for (K enum_ : enumClass.getEnumConstants()) { // Paper - decompile error
|
|
||||||
enumMap.put(enum_, mapper.apply(enum_));
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1057,16 +1103,7 @@
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openUri(URI uri) {
|
public void openUri(URI uri) {
|
Reference in New Issue
Block a user