moar client-server tick speed separation
This commit is contained in:
1 parent
e0a3060339
commit
df786605c2
23 files changed
+166
-148
No files matched your search
@@ -1,9 +1,12 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.helpers.TickSpeed;
|
||||
import carpet.fakes.MinecraftServerInterface;
|
||||
import carpet.utils.CarpetProfiler;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.ServerFunctionManager;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@@ -11,14 +14,20 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@Mixin(ServerFunctionManager.class)
|
||||
public class ServerFunctionManager_tickMixin
|
||||
{
|
||||
@Shadow @Final MinecraftServer server;
|
||||
CarpetProfiler.ProfilerToken currentSection;
|
||||
|
||||
@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
|
||||
private void beforeDatapacks(CallbackInfo ci)
|
||||
{
|
||||
if (!TickSpeed.process_entities()) ci.cancel();
|
||||
else
|
||||
currentSection = CarpetProfiler.start_section(null, "Datapacks", CarpetProfiler.TYPE.GENERAL);
|
||||
if (! ((MinecraftServerInterface)server).getTickRateManager().process_entities())
|
||||
{
|
||||
ci.cancel();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentSection = CarpetProfiler.start_section(null, "Datapacks", CarpetProfiler.TYPE.GENERAL);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "tick", at = @At("RETURN"))
|
||||
|
||||
Reference in new issue
Block a user