Skip to content

Commit

Permalink
MinecraftServer x Audience
Browse files Browse the repository at this point in the history
  • Loading branch information
andantet committed Sep 23, 2024
1 parent d310ad9 commit 3ebc8b4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ fabric_kotlin_version=1.10.20+kotlin.1.9.24
kache_version=1.0.5

# Mod Properties
mod_version=2.11.0
mod_version=2.11.1
maven_group=dev.andante
24 changes: 24 additions & 0 deletions src/main/java/dev/andante/audience/mixin/MinecraftServerMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package dev.andante.audience.mixin;

import dev.andante.audience.Audience;
import dev.andante.audience.player.PlayerSet;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.PlayerManager;
import net.minecraft.server.network.ServerPlayerEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;

import java.util.List;

@Mixin(MinecraftServer.class)
public abstract class MinecraftServerMixin implements Audience {
@Shadow private PlayerManager playerManager;

@Unique
@Override
public PlayerSet getAudiencePlayers() {
List<ServerPlayerEntity> players = playerManager.getPlayerList();
return new PlayerSet(players);
}
}
1 change: 1 addition & 0 deletions src/main/resources/audience.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"mixins": [
"BlockMixin",
"BlockStateMixin",
"MinecraftServerMixin",
"ServerPlayerEntityMixin",
"ServerWorldMixin"
],
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"dev/andante/audience/Audience",
"dev/andante/audience/player/PlayerReference"
],
"net/minecraft/server/MinecraftServer": [ "dev/andante/audience/Audience" ],
"net/minecraft/class_3218": [ "dev/andante/audience/Audience" ],
"net/minecraft/class_2248": [ "dev/andante/audience/block/BlockStateLike" ],
"net/minecraft/class_2680": [ "dev/andante/audience/block/BlockStateLike" ]
Expand Down

0 comments on commit 3ebc8b4

Please sign in to comment.