Rename mixins after what they do, rather than where they do it

[no changelog]
Mixins are now named after what they do, and mixins for the same class that do different things should be in two
separate mixins now.
This commit is contained in:
nea
2023-10-28 04:07:47 +02:00
parent 9e7da2829c
commit ad490f2ea7
24 changed files with 33 additions and 33 deletions

View File

@@ -14,7 +14,7 @@ Priority 1:
- Pet/Equipment hud in inventory - Pet/Equipment hud in inventory
- Pet Overlay - Pet Overlay
- Price Graphs - Price Graphs
- Minion Helper - Minion -Helper
- Fishing - Fishing
- Highlighters - Highlighters
- Metal Detector - Metal Detector

View File

@@ -16,7 +16,7 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
@Mixin(value = CommandNode.class, remap = false) @Mixin(value = CommandNode.class, remap = false)
public class MixinCommandNode<S> { public class CaseInsensitiveCommandMapPatch<S> {
@WrapOperation(method = "getRelevantNodes", at = @At(value = "INVOKE", target = "Ljava/util/Map;get(Ljava/lang/Object;)Ljava/lang/Object;"), remap = false) @WrapOperation(method = "getRelevantNodes", at = @At(value = "INVOKE", target = "Ljava/util/Map;get(Ljava/lang/Object;)Ljava/lang/Object;"), remap = false)
public Object modify(Map map, Object text, Operation<Object> op) { public Object modify(Map map, Object text, Operation<Object> op) {
var original = op.call(map, text); var original = op.call(map, text);

View File

@@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
@Mixin(ChatHud.class) @Mixin(ChatHud.class)
public class MixinChatHud { public class ChatPeekingPatch {
@ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;isChatFocused()Z")) @ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;isChatFocused()Z"))
public boolean onGetChatHud(boolean old) { public boolean onGetChatHud(boolean old) {

View File

@@ -25,7 +25,7 @@ import java.util.Map;
import java.util.function.BiFunction; import java.util.function.BiFunction;
@Mixin(ModelLoader.class) @Mixin(ModelLoader.class)
public abstract class MixinModelLoader { public abstract class CustomModelBakerPatch {
@Shadow @Shadow
protected abstract void addModel(ModelIdentifier modelId); protected abstract void addModel(ModelIdentifier modelId);

View File

@@ -19,7 +19,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(ItemModels.class) @Mixin(ItemModels.class)
public class MixinItemModels { public class CustomModelEventPatch {
@Shadow @Shadow
@Final @Final
private BakedModelManager modelManager; private BakedModelManager modelManager;

View File

@@ -17,7 +17,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(SkullBlockEntityRenderer.class) @Mixin(SkullBlockEntityRenderer.class)
public class MixinSkullBlockEntityRenderer { public class CustomSkullTexturePatch {
@Inject(method = "getRenderLayer", at = @At("HEAD"), cancellable = true) @Inject(method = "getRenderLayer", at = @At("HEAD"), cancellable = true)
private static void onGetRenderLayer(SkullBlock.SkullType type, GameProfile profile, CallbackInfoReturnable<RenderLayer> cir) { private static void onGetRenderLayer(SkullBlock.SkullType type, GameProfile profile, CallbackInfoReturnable<RenderLayer> cir) {
CustomSkyBlockTextures.INSTANCE.modifySkullTexture(type, profile, cir); CustomSkyBlockTextures.INSTANCE.modifySkullTexture(type, profile, cir);

View File

@@ -22,12 +22,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.Map; import java.util.Map;
@Mixin(EntityIdFix.class) @Mixin(EntityIdFix.class)
public abstract class MixinEntityIdFix extends DataFix { public abstract class DFUEntityIdFixPatch extends DataFix {
@Shadow @Shadow
@Final @Final
private static Map<String, String> RENAMED_ENTITIES; private static Map<String, String> RENAMED_ENTITIES;
public MixinEntityIdFix(Schema outputSchema, boolean changesType) { public DFUEntityIdFixPatch(Schema outputSchema, boolean changesType) {
super(outputSchema, changesType); super(outputSchema, changesType);
} }

View File

@@ -23,7 +23,7 @@ import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ControlsListWidget.KeyBindingEntry.class) @Mixin(ControlsListWidget.KeyBindingEntry.class)
public class MixinKeybindsScreen { public class FirmKeybindsInVanillaControlsPatch {
@Mutable @Mutable
@Shadow @Shadow

View File

@@ -18,7 +18,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(InGameHud.class) @Mixin(InGameHud.class)
public class MixinInGameHud { public class HudRenderEvents {
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getSleepTimer()I")) @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getSleepTimer()I"))
public void renderCallBack(DrawContext context, float tickDelta, CallbackInfo ci) { public void renderCallBack(DrawContext context, float tickDelta, CallbackInfo ci) {
HudRenderEvent.Companion.publish(new HudRenderEvent(context, tickDelta)); HudRenderEvent.Companion.publish(new HudRenderEvent(context, tickDelta));

View File

@@ -19,7 +19,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ClientPlayNetworkHandler.class) @Mixin(ClientPlayNetworkHandler.class)
public abstract class MixinClientPacketHandler { public abstract class IncomingPacketListenerPatches {
@ModifyExpressionValue(method = "onCommandTree", at = @At(value = "NEW", target = "(Lcom/mojang/brigadier/tree/RootCommandNode;)Lcom/mojang/brigadier/CommandDispatcher;")) @ModifyExpressionValue(method = "onCommandTree", at = @At(value = "NEW", target = "(Lcom/mojang/brigadier/tree/RootCommandNode;)Lcom/mojang/brigadier/CommandDispatcher;"))

View File

@@ -14,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Keyboard.class) @Mixin(Keyboard.class)
public class MixinKeyboard { public class KeyPressInWorldEventPatch {
@Inject(method = "onKey", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;onKeyPressed(Lnet/minecraft/client/util/InputUtil$Key;)V")) @Inject(method = "onKey", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;onKeyPressed(Lnet/minecraft/client/util/InputUtil$Key;)V"))
public void onKeyBoardInWorld(long window, int key, int scancode, int action, int modifiers, CallbackInfo ci) { public void onKeyBoardInWorld(long window, int key, int scancode, int action, int modifiers, CallbackInfo ci) {

View File

@@ -15,7 +15,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ClientCommonNetworkHandler.class) @Mixin(ClientCommonNetworkHandler.class)
public class MixinClientCommonNetworkHandler { public class OutgoingPacketEventPatch {
@Inject(method = "sendPacket(Lnet/minecraft/network/packet/Packet;)V", at = @At("HEAD"), cancellable = true) @Inject(method = "sendPacket(Lnet/minecraft/network/packet/Packet;)V", at = @At("HEAD"), cancellable = true)
public void onSendPacket(Packet<?> packet, CallbackInfo ci) { public void onSendPacket(Packet<?> packet, CallbackInfo ci) {
if (OutgoingPacketEvent.Companion.publish(new OutgoingPacketEvent(packet)).getCancelled()) { if (OutgoingPacketEvent.Companion.publish(new OutgoingPacketEvent(packet)).getCancelled()) {

View File

@@ -17,8 +17,8 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(ClientPlayerEntity.class) @Mixin(ClientPlayerEntity.class)
public abstract class MixinClientPlayerEntity extends PlayerEntity { public abstract class PlayerDropEventPatch extends PlayerEntity {
public MixinClientPlayerEntity() { public PlayerDropEventPatch() {
super(null, null, 0, null); super(null, null, 0, null);
} }

View File

@@ -16,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.security.PublicKey; import java.security.PublicKey;
@Mixin(value = Property.class, remap = false) @Mixin(value = Property.class, remap = false)
public class MixinProperty { public class PropertySignatureIgnorePatch {
@Inject(method = "isSignatureValid", cancellable = true, at = @At("HEAD"), remap = false) @Inject(method = "isSignatureValid", cancellable = true, at = @At("HEAD"), remap = false)
public void onValidateSignature(PublicKey publicKey, CallbackInfoReturnable<Boolean> cir) { public void onValidateSignature(PublicKey publicKey, CallbackInfoReturnable<Boolean> cir) {
if (Fixes.TConfig.INSTANCE.getFixUnsignedPlayerSkins()) { if (Fixes.TConfig.INSTANCE.getFixUnsignedPlayerSkins()) {

View File

@@ -17,7 +17,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Mouse.class) @Mixin(Mouse.class)
public class MixinMouse { public class SaveCursorPositionPatch {
@Shadow @Shadow
private double x; private double x;

View File

@@ -6,7 +6,7 @@
package moe.nea.firmament.mixins; package moe.nea.firmament.mixins;
import moe.nea.firmament.events.ScreenOpenEvent; import moe.nea.firmament.events.ScreenChangeEvent;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -17,15 +17,15 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MinecraftClient.class) @Mixin(MinecraftClient.class)
public abstract class MixinMinecraft { public abstract class ScreenChangeEventPatch {
@Shadow @Shadow
@Nullable @Nullable
public Screen currentScreen; public Screen currentScreen;
@Inject(method = "setScreen", at = @At("HEAD"), cancellable = true) @Inject(method = "setScreen", at = @At("HEAD"), cancellable = true)
public void onScreenChange(Screen screen, CallbackInfo ci) { public void onScreenChange(Screen screen, CallbackInfo ci) {
var event = new ScreenOpenEvent(currentScreen, screen); var event = new ScreenChangeEvent(currentScreen, screen);
if (ScreenOpenEvent.Companion.publish(event).getCancelled()) { if (ScreenChangeEvent.Companion.publish(event).getCancelled()) {
ci.cancel(); ci.cancel();
} }
} }

View File

@@ -14,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(KeyBinding.class) @Mixin(KeyBinding.class)
public class MixinKeyBinding { public class ToggleSprintPatch {
@Inject(method = "isPressed", at = @At("HEAD"), cancellable = true) @Inject(method = "isPressed", at = @At("HEAD"), cancellable = true)
public void onIsPressed(CallbackInfoReturnable<Boolean> cir) { public void onIsPressed(CallbackInfoReturnable<Boolean> cir) {
Fixes.INSTANCE.handleIsPressed((KeyBinding) (Object) this, cir); Fixes.INSTANCE.handleIsPressed((KeyBinding) (Object) this, cir);

View File

@@ -14,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(DownloadingTerrainScreen.class) @Mixin(DownloadingTerrainScreen.class)
public class MixinDownloadingTerrainScreen { public class WorldReadyEventPatch {
@Inject(method = "close", at = @At("HEAD")) @Inject(method = "close", at = @At("HEAD"))
public void onClose(CallbackInfo ci) { public void onClose(CallbackInfo ci) {
WorldReadyEvent.Companion.publish(new WorldReadyEvent()); WorldReadyEvent.Companion.publish(new WorldReadyEvent());

View File

@@ -18,7 +18,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(WorldRenderer.class) @Mixin(WorldRenderer.class)
public class MixinWorldRenderer { public class WorldRenderLastEventPatch {
@Shadow @Shadow
@Final @Final
private BufferBuilderStorage bufferBuilders; private BufferBuilderStorage bufferBuilders;

View File

@@ -15,7 +15,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(value = YggdrasilServicesKeyInfo.class, remap = false) @Mixin(value = YggdrasilServicesKeyInfo.class, remap = false)
public class MixinYggdrasilServicesKeyInfo { public class YggdrasilSignatureIgnorePatch {
@Inject(method = "validateProperty", at = @At("HEAD"), cancellable = true, remap = false) @Inject(method = "validateProperty", at = @At("HEAD"), cancellable = true, remap = false)
public void validate(Property property, CallbackInfoReturnable<Boolean> cir) { public void validate(Property property, CallbackInfoReturnable<Boolean> cir) {
if (Fixes.TConfig.INSTANCE.getFixUnsignedPlayerSkins()) { if (Fixes.TConfig.INSTANCE.getFixUnsignedPlayerSkins()) {

View File

@@ -8,6 +8,6 @@ package moe.nea.firmament.events
import net.minecraft.client.gui.screen.Screen import net.minecraft.client.gui.screen.Screen
data class ScreenOpenEvent(val old: Screen?, val new: Screen?) : FirmamentEvent.Cancellable() { data class ScreenChangeEvent(val old: Screen?, val new: Screen?) : FirmamentEvent.Cancellable() {
companion object : FirmamentEventBus<ScreenOpenEvent>() companion object : FirmamentEventBus<ScreenChangeEvent>()
} }

View File

@@ -15,7 +15,7 @@ import net.minecraft.util.hit.HitResult
import moe.nea.firmament.events.CustomItemModelEvent import moe.nea.firmament.events.CustomItemModelEvent
import moe.nea.firmament.events.HandledScreenKeyPressedEvent import moe.nea.firmament.events.HandledScreenKeyPressedEvent
import moe.nea.firmament.events.ItemTooltipEvent import moe.nea.firmament.events.ItemTooltipEvent
import moe.nea.firmament.events.ScreenOpenEvent import moe.nea.firmament.events.ScreenChangeEvent
import moe.nea.firmament.events.TickEvent import moe.nea.firmament.events.TickEvent
import moe.nea.firmament.events.WorldKeyboardEvent import moe.nea.firmament.events.WorldKeyboardEvent
import moe.nea.firmament.features.FirmamentFeature import moe.nea.firmament.features.FirmamentFeature
@@ -91,7 +91,7 @@ object PowerUserTools : FirmamentFeature {
lastCopiedStack = null lastCopiedStack = null
lastCopiedStackViewTime = false lastCopiedStackViewTime = false
} }
ScreenOpenEvent.subscribe { ScreenChangeEvent.subscribe {
lastCopiedStack = null lastCopiedStack = null
} }
HandledScreenKeyPressedEvent.subscribe { HandledScreenKeyPressedEvent.subscribe {

View File

@@ -8,7 +8,7 @@ package moe.nea.firmament.features.inventory.storageoverlay
import java.util.* import java.util.*
import kotlinx.serialization.serializer import kotlinx.serialization.serializer
import moe.nea.firmament.events.ScreenOpenEvent import moe.nea.firmament.events.ScreenChangeEvent
import moe.nea.firmament.events.TickEvent import moe.nea.firmament.events.TickEvent
import moe.nea.firmament.features.FirmamentFeature import moe.nea.firmament.features.FirmamentFeature
import moe.nea.firmament.gui.config.ManagedConfig import moe.nea.firmament.gui.config.ManagedConfig
@@ -36,7 +36,7 @@ object StorageOverlay : FirmamentFeature {
var currentHandler: StorageBackingHandle? = StorageBackingHandle.None var currentHandler: StorageBackingHandle? = StorageBackingHandle.None
override fun onLoad() { override fun onLoad() {
ScreenOpenEvent.subscribe { event -> ScreenChangeEvent.subscribe { event ->
currentHandler = StorageBackingHandle.fromScreen(event.new) currentHandler = StorageBackingHandle.fromScreen(event.new)
if (event.old is StorageOverlayScreen && !event.old.isClosing) { if (event.old is StorageOverlayScreen && !event.old.isClosing) {
event.old.setHandler(currentHandler) event.old.setHandler(currentHandler)

View File

@@ -13,7 +13,7 @@ import net.minecraft.client.MinecraftClient
import net.minecraft.server.command.CommandOutput import net.minecraft.server.command.CommandOutput
import net.minecraft.text.Text import net.minecraft.text.Text
import moe.nea.firmament.Firmament import moe.nea.firmament.Firmament
import moe.nea.firmament.events.ScreenOpenEvent import moe.nea.firmament.events.ScreenChangeEvent
interface IDataHolder<T> { interface IDataHolder<T> {
companion object { companion object {
@@ -60,7 +60,7 @@ interface IDataHolder<T> {
} }
fun registerEvents() { fun registerEvents() {
ScreenOpenEvent.subscribe { event -> ScreenChangeEvent.subscribe { event ->
performSaves() performSaves()
val p = MinecraftClient.getInstance().player val p = MinecraftClient.getInstance().player
if (p != null) { if (p != null) {