Skip to content

Commit dfad56c

Browse files
committed
Minor config fix
1 parent c682711 commit dfad56c

File tree

3 files changed

+39
-40
lines changed

3 files changed

+39
-40
lines changed

src/main/java/net/himeki/mcmtfabric/ParallelProcessor.java

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -345,17 +345,15 @@ public static void postChunkTick(ServerWorld world) {
345345
}
346346
}
347347

348-
if (!config.disabled && !config.disableEnvironment) {
349-
// Process delayed chunk tasks
350-
List<Runnable> tasks = delayedChunkTasks.remove(world);
351-
if (tasks != null) {
352-
WorldTickStats stats = worldTickStats.computeIfAbsent(world, w -> new WorldTickStats());
353-
for (Runnable task : tasks) {
354-
long startTime = System.nanoTime();
355-
task.run();
356-
long endTime = System.nanoTime();
357-
stats.chunkTickTimesCurrent.add(endTime - startTime);
358-
}
348+
// Process delayed chunk tasks
349+
List<Runnable> tasks = delayedChunkTasks.remove(world);
350+
if (tasks != null) {
351+
WorldTickStats stats = worldTickStats.computeIfAbsent(world, w -> new WorldTickStats());
352+
for (Runnable task : tasks) {
353+
long startTime = System.nanoTime();
354+
task.run();
355+
long endTime = System.nanoTime();
356+
stats.chunkTickTimesCurrent.add(endTime - startTime);
359357
}
360358
}
361359
}
@@ -457,23 +455,22 @@ public static void postEntityTick(ServerWorld world) {
457455
}
458456
}
459457

460-
if (!config.disabled && !config.disableEntity) {
461-
// Process delayed entity tasks
462-
List<Runnable> tasks = delayedEntityTasks.remove(world);
463-
if (tasks != null) {
464-
WorldTickStats stats = worldTickStats.computeIfAbsent(world, w -> new WorldTickStats());
465-
for (Runnable task : tasks) {
466-
long startTime = System.nanoTime();
467-
task.run();
468-
long endTime = System.nanoTime();
469-
stats.entityTickTimesCurrent.add(endTime - startTime);
470-
}
458+
// Process delayed entity tasks
459+
List<Runnable> tasks = delayedEntityTasks.remove(world);
460+
if (tasks != null) {
461+
WorldTickStats stats = worldTickStats.computeIfAbsent(world, w -> new WorldTickStats());
462+
for (Runnable task : tasks) {
463+
long startTime = System.nanoTime();
464+
task.run();
465+
long endTime = System.nanoTime();
466+
stats.entityTickTimesCurrent.add(endTime - startTime);
471467
}
472468
}
469+
473470
}
474471

475472
public static void preBlockEntityTick(ServerWorld world) {
476-
if (config.disabled || config.disableTileEntity) {
473+
if (config.disabled || config.disableBlockEntity) {
477474
return;
478475
}
479476
synchronized (threadedChunksRegions) {
@@ -496,6 +493,11 @@ public static void callBlockEntityTick(BlockEntityTickInvoker tte, World world)
496493
return;
497494
}
498495

496+
if (config.disabled || config.disableBlockEntity) {
497+
tte.tick();
498+
return;
499+
}
500+
499501
BlockEntity blockEntity = ((WorldChunk.DirectBlockEntityTickInvoker<?>) wrappedInvoker.wrapped).blockEntity;
500502
int chunkX = blockEntity.getPos().getX() >> 4;
501503
int chunkZ = blockEntity.getPos().getZ() >> 4;
@@ -562,17 +564,15 @@ public static void postBlockEntityTick(ServerWorld world) {
562564
}
563565
}
564566

565-
if (!config.disabled && !config.disableTileEntity) {
566-
// Process delayed block entity tasks
567-
List<Runnable> tasks = delayedBlockEntityTasks.remove(world);
568-
if (tasks != null) {
569-
WorldTickStats stats = worldTickStats.computeIfAbsent(world, w -> new WorldTickStats());
570-
for (Runnable task : tasks) {
571-
long startTime = System.nanoTime();
572-
task.run();
573-
long endTime = System.nanoTime();
574-
stats.blockEntityTickTimesCurrent.add(endTime - startTime);
575-
}
567+
// Process delayed block entity tasks
568+
List<Runnable> tasks = delayedBlockEntityTasks.remove(world);
569+
if (tasks != null) {
570+
WorldTickStats stats = worldTickStats.computeIfAbsent(world, w -> new WorldTickStats());
571+
for (Runnable task : tasks) {
572+
long startTime = System.nanoTime();
573+
task.run();
574+
long endTime = System.nanoTime();
575+
stats.blockEntityTickTimesCurrent.add(endTime - startTime);
576576
}
577577
}
578578

src/main/java/net/himeki/mcmtfabric/commands/ConfigCommand.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
3939
cmdCtx.getSource().sendFeedback(() -> message, true);
4040
return 1;
4141
}).then(literal("te").executes(cmdCtx -> {
42-
config.disableTileEntity = !config.disableTileEntity;
42+
config.disableBlockEntity = !config.disableBlockEntity;
4343
MutableText message = Text.literal("MCMT's tile entity threading is now "
44-
+ (config.disableTileEntity ? "disabled" : "enabled"));
44+
+ (config.disableBlockEntity ? "disabled" : "enabled"));
4545
cmdCtx.getSource().sendFeedback(() -> message, true);
4646
return 1;
4747
})).then(literal("entity").executes(cmdCtx -> {
@@ -76,7 +76,7 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
7676
if (!config.disabled) {
7777
messageString.append(" World:" + (config.disableWorld ? "disabled" : "enabled"));
7878
messageString.append(" Entity:" + (config.disableEntity ? "disabled" : "enabled"));
79-
messageString.append(" TE:" + (config.disableTileEntity ? "disabled"
79+
messageString.append(" TE:" + (config.disableBlockEntity ? "disabled"
8080
: "enabled" + (config.chunkLockModded ? "(ChunkLocking Modded)" : "")));
8181
messageString.append(" Env:" + (config.disableEnvironment ? "disabled" : "enabled"));
8282
messageString.append(" SCP:" + (config.disableChunkProvider ? "disabled" : "enabled"));

src/main/java/net/himeki/mcmtfabric/config/GeneralConfig.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package net.himeki.mcmtfabric.config;
22

3-
import me.shedaniel.autoconfig.AutoConfig;
43
import me.shedaniel.autoconfig.ConfigData;
54
import me.shedaniel.autoconfig.annotation.Config;
65
import me.shedaniel.autoconfig.annotation.ConfigEntry;
@@ -47,8 +46,8 @@ public class GeneralConfig implements ConfigData {
4746
public boolean disableEntity = false;
4847

4948
// TE
50-
@Comment("Disable tile entity parallelisation")
51-
public boolean disableTileEntity = false;
49+
@Comment("Disable block entity parallelisation")
50+
public boolean disableBlockEntity = false;
5251

5352
@Comment("Use chunklocks for any unknown (i.e. modded) tile entities\n"
5453
+ "Chunklocking means we prevent multiple tile entities a 1 chunk radius of each other being ticked to limit concurrency impacts")

0 commit comments

Comments
 (0)