Skip to content

Commit

Permalink
Revert vmp compat fix
Browse files Browse the repository at this point in the history
  • Loading branch information
senseiwells committed Sep 24, 2024
1 parent 02aebcd commit e66c9a6
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package me.senseiwells.replay.mixin.compat.vmp;

import com.ishland.vmp.mixins.playerwatching.optimize_nearby_entity_tracking_lookups.MixinThreadedAnvilChunkStorageEntityTracker;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import me.senseiwells.replay.chunk.ChunkRecordable;
import me.senseiwells.replay.player.PlayerRecorders;
import net.minecraft.server.level.ChunkMap;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import org.spongepowered.asm.mixin.Dynamic;
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;

@Mixin(value = ChunkMap.TrackedEntity.class, priority = 1100)
public class TrackedEntityMixin {
@Shadow
@Final
Entity entity;

@Dynamic(mixin = MixinThreadedAnvilChunkStorageEntityTracker.class)
@ModifyExpressionValue(
method = "tryTick",
at = @At(
value = "INVOKE",
target = "Ljava/util/Set;isEmpty()Z"
),
remap = false
)
private boolean shouldNotTick(boolean original) {
if (!original) {
return false;
}
if (!((ChunkRecordable) this).getRecorders().isEmpty()) {
return false;
}
if (this.entity instanceof ServerPlayer player) {
return !PlayerRecorders.has(player);
}
return true;
}
}
1 change: 1 addition & 0 deletions src/main/resources/serverreplay.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"compat.servux.ServuxPacketMixin",
"compat.syncmatica.SyncmaticaPacketPayloadMixin",
"compat.vmp.NearbyEntityTrackingMixin",
"compat.vmp.TrackedEntityMixin",
"network.IdDispatchCodecAccessor",
"player.ServerCommonPacketListenerImplMixin",
"player.ServerConfigurationPacketListenerImplMixin",
Expand Down

0 comments on commit e66c9a6

Please sign in to comment.