mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-03 22:26:19 +00:00
Readd PWT
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
|
||||
Date: Thu, 24 Apr 2025 16:36:16 -0400
|
||||
Subject: [PATCH] Paw optimization
|
||||
|
||||
Some random optimizations
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
||||
index 34a2e07dabc546799df6881de30252397d856f05..d8aca1d7ffad3eccaae676263a41a9a1f04988b9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
||||
@@ -244,13 +244,37 @@ public class CraftBlockData implements BlockData {
|
||||
|
||||
if (!states.isEmpty()) {
|
||||
stateString.append('[');
|
||||
- stateString.append(states.entrySet().stream().map(StateHolder.PROPERTY_ENTRY_TO_STRING_FUNCTION).collect(Collectors.joining(",")));
|
||||
+ // Leaf start - paw optimization
|
||||
+ int i = 0;
|
||||
+ for (Map.Entry<Property<?>, Comparable<?>> propertyEntry : states.entrySet()) {
|
||||
+ if (propertyEntry == null) {
|
||||
+ stateString.append("<NULL>");
|
||||
+ } else {
|
||||
+ Property<?> property = propertyEntry.getKey();
|
||||
+ Comparable<?> value = propertyEntry.getValue();
|
||||
+
|
||||
+ stateString.append(property.getName()).append("=").append(getValueName(property, value));
|
||||
+ }
|
||||
+
|
||||
+ if (i < states.size() - 1) {
|
||||
+ stateString.append(",");
|
||||
+ }
|
||||
+
|
||||
+ i++;
|
||||
+ }
|
||||
+ // Leaf end - paw optimization
|
||||
stateString.append(']');
|
||||
}
|
||||
|
||||
return stateString.toString();
|
||||
}
|
||||
|
||||
+ // Leaf start - paw optimization
|
||||
+ private <T extends Comparable<T>> String getValueName(Property<T> property, Comparable<?> value) {
|
||||
+ return property.getName((T) value);
|
||||
+ }
|
||||
+ // Leaf end - paw optimization
|
||||
+
|
||||
public Map<String, String> toStates(boolean hideUnspecified) {
|
||||
return (hideUnspecified && this.parsedStates != null) ? CraftBlockData.toStates(this.parsedStates) : CraftBlockData.toStates(this.state.getValues());
|
||||
}
|
||||
Reference in New Issue
Block a user