diff --git a/common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/ClientLevelMixin.java b/common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/ClientLevelMixin.java index d18dcba47..9392dc90d 100644 --- a/common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/ClientLevelMixin.java +++ b/common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/ClientLevelMixin.java @@ -1,9 +1,29 @@ package dev.latvian.mods.kubejs.core.mixin.common; import dev.latvian.mods.kubejs.core.ClientLevelKJS; +import dev.latvian.mods.rhino.util.HideFromJS; import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.player.AbstractClientPlayer; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.entity.LevelEntityGetter; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +import java.util.List; @Mixin(ClientLevel.class) public abstract class ClientLevelMixin implements ClientLevelKJS { + @Shadow + @Final + @HideFromJS + List players; + + @Shadow + @HideFromJS + public abstract List players(); + + @Shadow + @HideFromJS + protected abstract LevelEntityGetter getEntities(); } diff --git a/common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/EntityMixin.java b/common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/EntityMixin.java index c711ca624..ca6650bdd 100644 --- a/common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/EntityMixin.java +++ b/common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/EntityMixin.java @@ -149,4 +149,12 @@ private void loadKJS(CompoundTag tag, CallbackInfo ci) { @Shadow @RemapForJS("getEntityType") public abstract EntityType getType(); + + @Shadow + @RemapForJS("distanceToEntitySqr") + public abstract double distanceToSqr(Entity arg); + + @Shadow + @RemapForJS("distanceToEntity") + public abstract float distanceTo(Entity arg); } diff --git a/common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/ServerLevelMixin.java b/common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/ServerLevelMixin.java index 62c7013b5..02771268b 100644 --- a/common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/ServerLevelMixin.java +++ b/common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/ServerLevelMixin.java @@ -1,12 +1,25 @@ package dev.latvian.mods.kubejs.core.mixin.common; import dev.latvian.mods.kubejs.core.ServerLevelKJS; +import dev.latvian.mods.rhino.util.HideFromJS; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.entity.LevelEntityGetter; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +import java.util.List; @Mixin(ServerLevel.class) public abstract class ServerLevelMixin implements ServerLevelKJS { + @Shadow + @Final + @HideFromJS + List players; + private CompoundTag kjs$persistentData; @Override @@ -19,4 +32,12 @@ public abstract class ServerLevelMixin implements ServerLevelKJS { return kjs$persistentData; } + + @Shadow + @HideFromJS + public abstract List players(); + + @Shadow + @HideFromJS + protected abstract LevelEntityGetter getEntities(); }