Skip to content

Commit

Permalink
Workaround Mixin generics. Fixes #3647
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Harris-Rouquette <[email protected]>
  • Loading branch information
gabizou committed Mar 19, 2022
1 parent 5c27896 commit c3d9eed
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,12 @@
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ServerResources;
import net.minecraft.server.ServerScoreboard;
import net.minecraft.server.TickTask;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.progress.ChunkProgressListenerFactory;
import net.minecraft.server.packs.repository.PackRepository;
import net.minecraft.server.players.GameProfileCache;
import net.minecraft.server.players.PlayerList;
import net.minecraft.util.Mth;
import net.minecraft.util.thread.ReentrantBlockableEventLoop;
import net.minecraft.world.level.storage.LevelStorageSource;
import net.minecraft.world.level.storage.WorldData;
import org.checkerframework.checker.nullness.qual.NonNull;
Expand All @@ -70,7 +68,6 @@
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface;
import org.spongepowered.asm.mixin.Interface.Remap;
import org.spongepowered.asm.mixin.Intrinsic;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand Down Expand Up @@ -104,9 +101,10 @@
import java.util.Optional;
import java.util.UUID;

@SuppressWarnings("rawtypes")
@Mixin(MinecraftServer.class)
@Implements(value = @Interface(iface = Server.class, prefix = "server$", remap = Remap.NONE))
public abstract class MinecraftServerMixin_API extends ReentrantBlockableEventLoop<TickTask> implements SpongeServer, SpongeRegistryHolder {
@Implements(value = @Interface(iface = Server.class, prefix = "server$", remap = Interface.Remap.NONE))
public abstract class MinecraftServerMixin_API implements SpongeServer, SpongeRegistryHolder {

// @formatter:off
@Shadow @Final public long[] tickTimes;
Expand Down Expand Up @@ -144,10 +142,6 @@ public abstract class MinecraftServerMixin_API extends ReentrantBlockableEventLo
private RegistryHolderLogic api$registryHolder;
private SpongeUserManager api$userManager;

public MinecraftServerMixin_API(final String name) {
super(name);
}

@Inject(method = "<init>", at = @At("TAIL"))
public void api$initializeSpongeFields(final Thread p_i232576_1_, final RegistryAccess.RegistryHolder p_i232576_2_,
final LevelStorageSource.LevelStorageAccess p_i232576_3_, final WorldData p_i232576_4_, final PackRepository p_i232576_5_,
Expand All @@ -163,6 +157,8 @@ public MinecraftServerMixin_API(final String name) {
this.api$userManager = new SpongeUserManager((MinecraftServer) (Object) this);
}



@Override
public RecipeManager recipeManager() {
return (RecipeManager) this.shadow$getRecipeManager();
Expand Down Expand Up @@ -417,7 +413,7 @@ public ServerScheduler scheduler() {

@Override
public boolean onMainThread() {
return this.isSameThread();
return ((MinecraftServer) (Object) this).isSameThread();
}

@Override
Expand Down

0 comments on commit c3d9eed

Please sign in to comment.