Skip to content

Commit

Permalink
Mappings: Move to utils package
Browse files Browse the repository at this point in the history
The launch package is ignored by the kotlin verification plugin, and
this is the easiest solution.
  • Loading branch information
mattco98 committed Jul 30, 2023
1 parent 224ceff commit 6e72348
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 11 deletions.
7 changes: 7 additions & 0 deletions api/ctjs.api
Original file line number Diff line number Diff line change
Expand Up @@ -2400,6 +2400,13 @@ public final class com/chattriggers/ctjs/utils/Config : gg/essential/vigilance/V
public final fun setShowUpdatesInChat (Z)V
}

public final class com/chattriggers/ctjs/utils/Mappings {
public static final field INSTANCE Lcom/chattriggers/ctjs/utils/Mappings;
public static final fun mapClassName (Ljava/lang/String;)Ljava/lang/String;
public static final fun unmapClass (Ljava/lang/Class;)Ljava/lang/String;
public static final fun unmapClassName (Ljava/lang/String;)Ljava/lang/String;
}

public final class com/chattriggers/ctjs/utils/vec/Vec2f {
public fun <init> ()V
public fun <init> (F)V
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.chattriggers.ctjs.launch

import com.chattriggers.ctjs.utils.Mappings
import org.mozilla.javascript.JavaObjectMappingProvider
import java.lang.reflect.Modifier

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.chattriggers.ctjs.launch

import com.chattriggers.ctjs.console.printTraceToConsole
import com.chattriggers.ctjs.engine.module.ModuleManager
import com.chattriggers.ctjs.utils.Mappings
import com.llamalad7.mixinextras.MixinExtrasBootstrap
import org.objectweb.asm.tree.ClassNode
import org.slf4j.LoggerFactory
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/com/chattriggers/ctjs/launch/Descriptor.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.chattriggers.ctjs.launch

import com.chattriggers.ctjs.launch.generation.Utils
import com.chattriggers.ctjs.utils.Mappings
import org.objectweb.asm.Type

sealed interface Descriptor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.chattriggers.ctjs.engine.module.ModuleManager
import com.chattriggers.ctjs.launch.generation.DynamicMixinGenerator
import com.chattriggers.ctjs.launch.generation.GenerationContext
import com.chattriggers.ctjs.launch.generation.Utils
import com.chattriggers.ctjs.utils.Mappings
import kotlinx.serialization.json.*
import org.spongepowered.asm.mixin.Mixins
import java.io.ByteArrayInputStream
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.chattriggers.ctjs.launch.generation

import com.chattriggers.ctjs.launch.Descriptor
import com.chattriggers.ctjs.launch.Mappings
import com.chattriggers.ctjs.launch.Mixin
import com.chattriggers.ctjs.utils.Mappings
import org.spongepowered.asm.mixin.transformer.ClassInfo

internal data class GenerationContext(val mixin: Mixin) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import com.chattriggers.ctjs.engine.js.JSLoader
import com.chattriggers.ctjs.launch.Descriptor
import com.chattriggers.ctjs.launch.InvokeDynamicSupport
import com.chattriggers.ctjs.launch.Local
import com.chattriggers.ctjs.launch.Mappings
import com.chattriggers.ctjs.utils.Mappings
import com.chattriggers.ctjs.utils.descriptorString
import com.chattriggers.ctjs.utils.descriptor
import com.llamalad7.mixinextras.sugar.ref.*
import org.objectweb.asm.Handle
import org.objectweb.asm.Opcodes
import org.objectweb.asm.tree.MethodNode

internal abstract class InjectorGenerator(protected val ctx: GenerationContext, val id: Int) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.chattriggers.ctjs.launch.generation

import com.chattriggers.ctjs.launch.Descriptor
import com.chattriggers.ctjs.launch.Mappings
import com.chattriggers.ctjs.launch.Redirect
import com.chattriggers.ctjs.utils.Mappings
import com.chattriggers.ctjs.utils.descriptorString
import org.objectweb.asm.tree.MethodNode
import org.spongepowered.asm.mixin.injection.Redirect as SPRedirect
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.chattriggers.ctjs.launch.generation

import com.chattriggers.ctjs.launch.*
import com.chattriggers.ctjs.utils.Mappings
import com.chattriggers.ctjs.utils.descriptor
import com.chattriggers.ctjs.utils.descriptorString
import net.fabricmc.accesswidener.AccessWidenerReader
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.chattriggers.ctjs.launch.generation

import com.chattriggers.ctjs.launch.Descriptor
import com.chattriggers.ctjs.launch.Mappings
import com.chattriggers.ctjs.launch.WrapOperation
import com.chattriggers.ctjs.utils.Mappings
import com.chattriggers.ctjs.utils.descriptor
import com.chattriggers.ctjs.utils.descriptorString
import com.llamalad7.mixinextras.injector.wrapoperation.Operation
import org.objectweb.asm.Opcodes
import org.objectweb.asm.tree.MethodNode
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation as SPWrapOperation

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.chattriggers.ctjs.launch.generation

import com.chattriggers.ctjs.launch.Descriptor
import com.chattriggers.ctjs.launch.Mappings
import com.chattriggers.ctjs.launch.WrapWithCondition
import com.chattriggers.ctjs.utils.Mappings
import com.chattriggers.ctjs.utils.descriptorString
import org.objectweb.asm.tree.MethodNode
import com.llamalad7.mixinextras.injector.WrapWithCondition as SPWrapWithCondition
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.chattriggers.ctjs.launch
package com.chattriggers.ctjs.utils

import com.chattriggers.ctjs.CTJS
import com.chattriggers.ctjs.utils.urlEncode
import net.fabricmc.loader.api.FabricLoader
import net.fabricmc.mapping.tree.Descriptored
import net.fabricmc.mapping.tree.Mapped
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(function(global) {
global.Mappings = com.chattriggers.ctjs.launch.Mappings.INSTANCE;
global.Mappings = com.chattriggers.ctjs.utils.Mappings.INSTANCE;

function getJavaType(clazz) {
const mappedName = Mappings.mapClassName(clazz);
Expand Down

0 comments on commit 6e72348

Please sign in to comment.