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 Overlay
- Price Graphs
- Minion Helper
- Minion -Helper
- Fishing
- Highlighters
- Metal Detector

View File

@@ -16,7 +16,7 @@ import java.util.Locale;
import java.util.Map;
@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)
public Object modify(Map map, Object text, Operation<Object> op) {
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;
@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"))
public boolean onGetChatHud(boolean old) {

View File

@@ -25,7 +25,7 @@ import java.util.Map;
import java.util.function.BiFunction;
@Mixin(ModelLoader.class)
public abstract class MixinModelLoader {
public abstract class CustomModelBakerPatch {
@Shadow
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;
@Mixin(ItemModels.class)
public class MixinItemModels {
public class CustomModelEventPatch {
@Shadow
@Final
private BakedModelManager modelManager;

View File

@@ -17,7 +17,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(SkullBlockEntityRenderer.class)
public class MixinSkullBlockEntityRenderer {
public class CustomSkullTexturePatch {
@Inject(method = "getRenderLayer", at = @At("HEAD"), cancellable = true)
private static void onGetRenderLayer(SkullBlock.SkullType type, GameProfile profile, CallbackInfoReturnable<RenderLayer> 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;
@Mixin(EntityIdFix.class)
public abstract class MixinEntityIdFix extends DataFix {
public abstract class DFUEntityIdFixPatch extends DataFix {
@Shadow
@Final
private static Map<String, String> RENAMED_ENTITIES;
public MixinEntityIdFix(Schema outputSchema, boolean changesType) {
public DFUEntityIdFixPatch(Schema outputSchema, boolean 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;
@Mixin(ControlsListWidget.KeyBindingEntry.class)
public class MixinKeybindsScreen {
public class FirmKeybindsInVanillaControlsPatch {
@Mutable
@Shadow

View File

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

View File

@@ -14,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@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"))
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;
@Mixin(ClientCommonNetworkHandler.class)
public class MixinClientCommonNetworkHandler {
public class OutgoingPacketEventPatch {
@Inject(method = "sendPacket(Lnet/minecraft/network/packet/Packet;)V", at = @At("HEAD"), cancellable = true)
public void onSendPacket(Packet<?> packet, CallbackInfo ci) {
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;
@Mixin(ClientPlayerEntity.class)
public abstract class MixinClientPlayerEntity extends PlayerEntity {
public MixinClientPlayerEntity() {
public abstract class PlayerDropEventPatch extends PlayerEntity {
public PlayerDropEventPatch() {
super(null, null, 0, null);
}

View File

@@ -16,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.security.PublicKey;
@Mixin(value = Property.class, remap = false)
public class MixinProperty {
public class PropertySignatureIgnorePatch {
@Inject(method = "isSignatureValid", cancellable = true, at = @At("HEAD"), remap = false)
public void onValidateSignature(PublicKey publicKey, CallbackInfoReturnable<Boolean> cir) {
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;
@Mixin(Mouse.class)
public class MixinMouse {
public class SaveCursorPositionPatch {
@Shadow
private double x;

View File

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

View File

@@ -14,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(KeyBinding.class)
public class MixinKeyBinding {
public class ToggleSprintPatch {
@Inject(method = "isPressed", at = @At("HEAD"), cancellable = true)
public void onIsPressed(CallbackInfoReturnable<Boolean> 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;
@Mixin(DownloadingTerrainScreen.class)
public class MixinDownloadingTerrainScreen {
public class WorldReadyEventPatch {
@Inject(method = "close", at = @At("HEAD"))
public void onClose(CallbackInfo ci) {
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;
@Mixin(WorldRenderer.class)
public class MixinWorldRenderer {
public class WorldRenderLastEventPatch {
@Shadow
@Final
private BufferBuilderStorage bufferBuilders;

View File

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

View File

@@ -8,6 +8,6 @@ package moe.nea.firmament.events
import net.minecraft.client.gui.screen.Screen
data class ScreenOpenEvent(val old: Screen?, val new: Screen?) : FirmamentEvent.Cancellable() {
companion object : FirmamentEventBus<ScreenOpenEvent>()
data class ScreenChangeEvent(val old: Screen?, val new: Screen?) : FirmamentEvent.Cancellable() {
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.HandledScreenKeyPressedEvent
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.WorldKeyboardEvent
import moe.nea.firmament.features.FirmamentFeature
@@ -91,7 +91,7 @@ object PowerUserTools : FirmamentFeature {
lastCopiedStack = null
lastCopiedStackViewTime = false
}
ScreenOpenEvent.subscribe {
ScreenChangeEvent.subscribe {
lastCopiedStack = null
}
HandledScreenKeyPressedEvent.subscribe {

View File

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

View File

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