Skip to content

Commit

Permalink
fix: Access handling for playees
Browse files Browse the repository at this point in the history
  • Loading branch information
gabizou committed May 18, 2024
1 parent cb2b0df commit dc3b827
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ public void sendMessage(final @NonNull Component message, final net.kyori.advent
if (this.impl$isFake) {
return;
}
this.connection.sendDisguisedChatMessage(SpongeAdventure.asVanilla(message), SpongeAdventure.asVanilla(this.level.registryAccess(), boundChatType));
this.connection.sendDisguisedChatMessage(SpongeAdventure.asVanilla(message), SpongeAdventure.asVanilla(this.shadow$level().registryAccess(), boundChatType));
}

@Override
Expand All @@ -479,7 +479,7 @@ public void sendMessage(final @NonNull SignedMessage signedMessage, final net.ky
// TODO: implement once we actually expose a way to get signed messages in-api
this.connection.sendDisguisedChatMessage(
SpongeAdventure.asVanilla(Objects.requireNonNullElse(signedMessage.unsignedContent(), Component.text(signedMessage.message()))),
SpongeAdventure.asVanilla(this.level.registryAccess(), boundChatType)
SpongeAdventure.asVanilla(this.shadow$level().registryAccess(), boundChatType)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.RelativeMovement;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.spongepowered.api.data.Keys;
Expand Down Expand Up @@ -80,17 +81,17 @@
public abstract class EntityMixin_API implements org.spongepowered.api.entity.Entity {

// @formatter:off
@Shadow public float yRot;
@Shadow public float xRot;
@Shadow private float yRot;
@Shadow private float xRot;
@Shadow @Final protected net.minecraft.util.RandomSource random;
@Shadow protected UUID uuid;
@Shadow @Final private net.minecraft.world.entity.EntityType<?> type;
@Shadow public net.minecraft.world.level.Level level;
@Shadow private Level level;

@Shadow public abstract double shadow$getX();
@Shadow public abstract double shadow$getY();
@Shadow public abstract double shadow$getZ();
@Shadow public abstract net.minecraft.world.level.Level shadow$getCommandSenderWorld();
@Shadow public abstract Level shadow$getCommandSenderWorld();
@Shadow @Nullable public abstract MinecraftServer shadow$getServer();
@Shadow public abstract boolean shadow$isRemoved();
@Shadow public abstract UUID shadow$getUUID();
Expand All @@ -101,6 +102,7 @@ public abstract class EntityMixin_API implements org.spongepowered.api.entity.En
@Shadow public abstract void shadow$discard();
@Shadow public abstract void shadow$lookAt(EntityAnchorArgument.Anchor param0, Vec3 param1);
@Shadow public abstract CompoundTag shadow$saveWithoutId(CompoundTag $$0);
@Shadow public abstract Level shadow$level();
// @formatter:on

@Override
Expand Down

0 comments on commit dc3b827

Please sign in to comment.