Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Fabric Properties
org.gradle.java.installations.paths=E:/Coding/Minecraft/tools/jdk-25.0.3+9
# check these on https://fabricmc.net/develop
minecraft_version=26.2
loader_version=0.19.2
Expand Down
15 changes: 10 additions & 5 deletions src/main/java/com/tick_ins/tick/TickThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ public static void addTask(RunnableWithLast first, RunnableWithLast second) {
runAfterTick(() -> {
if (second != null) {
runNow(() -> {
second.task().run();
clearLookLock();
try {
second.task().run();
} finally {
clearLookLock();
}
});
} else {
runNow(TickThread::clearLookLock);
Expand All @@ -55,8 +58,11 @@ public static void addLastTask(RunnableWithLast task) {
runNow(task.task());
runAfterTick(() -> {
runNow(() -> {
task.cache().run();
clearLookLock();
try {
task.cache().run();
} finally {
clearLookLock();
}
});
}, 1);
}
Expand Down Expand Up @@ -116,7 +122,6 @@ public static void clearLookLock() {
public static void onClientDisconnected() {
TASK_EPOCH.incrementAndGet();
clearLookLock();
clientStopping = false;
}

public static void onClientShutdown() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public static class useItemOnAction {
public static BlockState pistonBlockState = null;
// Global placement rate limiter (anti-cheat protection)
private static volatile long lastGlobalPlacementTime = 0;
private static volatile long lastPruneTime = 0;
private static final long PLACEMENT_OVERRIDE_TTL_MS = 1200L;
private static final int PLACEMENT_OVERRIDE_MAX_SIZE = 512;
private static final int PLACEMENT_OVERRIDE_USES = 4;
Expand Down Expand Up @@ -191,8 +192,9 @@ public static boolean isPlacementCooling(BlockPos pos) {
long now = System.currentTimeMillis();
long threshold = Ping2Server.getRtt() + 100;

// Prune stale entries to prevent memory leak (entries older than 10 seconds)
if (lastPlacementTimeMap.size() > 256) {
// Prune stale entries periodically to prevent memory leak and CPU bottleneck
if (now - lastPruneTime > 5000L) {
lastPruneTime = now;
lastPlacementTimeMap.entrySet().removeIf(e -> now - e.getValue() > 10_000L);
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/uiop/easyplacefix/until/doEasyPlace.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ else if (ReplacedBlock instanceof CoralFanBlock)//coral fans
stack1 = findBlockInInventory(playerInventory, predicate);
}
if (stack1 == null) {
HashSet<ItemStack> itemStackHashSet = LoosenModeData.loadFromFile();
return loosenMode2(itemStackHashSet);
return loosenMode2(null);

}
return stack1;
Expand Down
Loading