Skip to content

Commit

Permalink
Limit desperation to dedicated server
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskarth committed Jul 13, 2024
1 parent f8dd887 commit 016d9d1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.21+build.2
loader_version=0.15.11

# Mod Properties
mod_version=0.5.3
mod_version=0.5.4
maven_group=net.modfest
archives_base_name=fireblanket

Expand Down
25 changes: 14 additions & 11 deletions src/main/java/net/modfest/fireblanket/Fireblanket.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.modfest.fireblanket;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.ModInitializer;

import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback;
Expand Down Expand Up @@ -191,21 +192,23 @@ public void onInitialize() {
fullRegionSync(player.getServerWorld(), player.networkHandler::sendPacket);
});

Runnable desperateMeasures = () -> {
while (true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER) {
Runnable desperateMeasures = () -> {
while (true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {

}
}

System.gc();
}
};
System.gc();
}
};

Thread desperateTimes = new Thread(desperateMeasures);
Thread desperateTimes = new Thread(desperateMeasures);

desperateTimes.start();
desperateTimes.start();
}
}

public static void fullRegionSync(ServerWorld world, Consumer<Packet<?>> sender) {
Expand Down

0 comments on commit 016d9d1

Please sign in to comment.