29 lines
967 B
Java
29 lines
967 B
Java
package com.thebrokenrail.sorcerycraft.mixin;
|
|
|
|
import com.thebrokenrail.sorcerycraft.client.gui.CastingTableScreen;
|
|
import net.fabricmc.api.EnvType;
|
|
import net.fabricmc.api.Environment;
|
|
import net.minecraft.client.MinecraftClient;
|
|
import net.minecraft.client.network.ClientPlayerEntity;
|
|
import net.minecraft.util.Identifier;
|
|
import org.spongepowered.asm.mixin.Final;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.Shadow;
|
|
|
|
import java.util.Map;
|
|
|
|
@SuppressWarnings("unused")
|
|
@Mixin(ClientPlayerEntity.class)
|
|
@Environment(EnvType.CLIENT)
|
|
public class MixinClientPlayerEntity extends MixinPlayerEntity {
|
|
@Shadow @Final protected MinecraftClient client;
|
|
|
|
@Override
|
|
public void setDiscoveredSpells(Map<Identifier, Integer> spells) {
|
|
super.setDiscoveredSpells(spells);
|
|
if (client.currentScreen instanceof CastingTableScreen) {
|
|
((CastingTableScreen) client.currentScreen).resetIndex();
|
|
}
|
|
}
|
|
}
|