mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-25 09:59:15 +00:00
[ci skip] Cleanup
This commit is contained in:
@@ -10,6 +10,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class AsyncChunkSend {
|
||||
|
||||
public static final ExecutorService POOL = new ThreadPoolExecutor(
|
||||
1, 1, 0L, TimeUnit.MILLISECONDS,
|
||||
new LinkedBlockingQueue<>(),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.dreeam.leaf.async.chunk;
|
||||
|
||||
public class AsyncChunkSendThread extends Thread {
|
||||
|
||||
protected AsyncChunkSendThread(Runnable task) {
|
||||
super(task);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.RejectedExecutionHandler;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
@@ -191,11 +190,11 @@ public class MultithreadedTracker {
|
||||
|
||||
private static @NotNull ThreadFactory getThreadFactory() {
|
||||
return new ThreadFactoryBuilder()
|
||||
.setThreadFactory(MultithreadedTrackerThread::new)
|
||||
.setNameFormat(THREAD_PREFIX + " Thread - %d")
|
||||
.setPriority(Thread.NORM_PRIORITY - 2)
|
||||
.setUncaughtExceptionHandler(Util::onThreadException)
|
||||
.build();
|
||||
.setThreadFactory(MultithreadedTrackerThread::new)
|
||||
.setNameFormat(THREAD_PREFIX + " Thread - %d")
|
||||
.setPriority(Thread.NORM_PRIORITY - 2)
|
||||
.setUncaughtExceptionHandler(Util::onThreadException)
|
||||
.build();
|
||||
}
|
||||
|
||||
private static @NotNull RejectedExecutionHandler getRejectedPolicy() {
|
||||
|
||||
@@ -14,7 +14,7 @@ public class AlternativeJoin extends ConfigModules {
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
enabled = config.getBoolean(getBasePath() + ".async-switch-state", enabled, config.pickStringRegionBased(
|
||||
"Async switch connection state",
|
||||
"..."));
|
||||
"Async switch connection state.",
|
||||
"异步切换连接状态."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ public class OptimizeItemTicking extends ConfigModules {
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
onlyTickItemsInHand = config.getBoolean(getBasePath() + ".only-tick-items-in-hand", onlyTickItemsInHand, config.pickStringRegionBased("""
|
||||
Whether to only tick/update items in main hand and offhand instead of the entire inventory.""",
|
||||
Whether to only tick / update items in main hand and offhand instead of the entire inventory.""",
|
||||
"""
|
||||
是否只对主手和副手中的物品进行tick/更新,而不是整个物品栏中的所有物品。"""));
|
||||
是否只对主手和副手中的物品进行 tick / 更新,而不是整个物品栏中的所有物品。"""));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.resources.ResourceLocation;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class DoABarrelRollPackets {
|
||||
|
||||
private static <T extends LeafCustomPayload> LeafCustomPayload.@NotNull Type<T> createType(String path) {
|
||||
return new LeafCustomPayload.Type<>(ResourceLocation.fromNamespaceAndPath(DoABarrelRollProtocol.NAMESPACE, path));
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.util.List;
|
||||
import java.util.OptionalInt;
|
||||
|
||||
public class DoABarrelRollProtocol implements Protocol {
|
||||
|
||||
protected static final String NAMESPACE = "do_a_barrel_roll";
|
||||
private static final Logger LOGGER = LogManager.getLogger(NAMESPACE);
|
||||
private static final int PROTOCOL_VERSION = 4;
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface LeafCustomPayload extends CustomPacketPayload {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
Type<? extends LeafCustomPayload> type();
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
interface Protocol {
|
||||
|
||||
String namespace();
|
||||
|
||||
List<Protocols.TypeAndCodec<FriendlyByteBuf, ? extends LeafCustomPayload>> c2s();
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class Protocols {
|
||||
|
||||
private static final ObjectArrayList<Protocol> PROTOCOLS = new ObjectArrayList<>();
|
||||
|
||||
static void register(Protocol protocol) {
|
||||
|
||||
@@ -15,8 +15,8 @@ import java.util.NoSuchElementException;
|
||||
* A List implementation that maintains a hash-based counter for O(1) element lookup.
|
||||
* Combines an array-based list for order with a hash map for fast containment checks.
|
||||
*/
|
||||
public class HashedReferenceList<T>
|
||||
implements List<T> {
|
||||
public class HashedReferenceList<T> implements List<T> {
|
||||
|
||||
// The actual ordered storage of elements
|
||||
private final ReferenceArrayList<T> list = new ReferenceArrayList<>();
|
||||
// Tracks occurrence count of each element for O(1) contains checks
|
||||
|
||||
@@ -10,8 +10,9 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.AbstractMap.SimpleEntry;
|
||||
|
||||
/// fast array backend map with O(1) get & put & remove
|
||||
// fast array backend map with O(1) get & put & remove
|
||||
public class AttributeInstanceArrayMap implements Map<Holder<Attribute>, AttributeInstance>, Cloneable {
|
||||
|
||||
private int size = 0;
|
||||
private transient AttributeInstance[] a = new AttributeInstance[32];
|
||||
private transient KeySet keys;
|
||||
|
||||
Reference in New Issue
Block a user