generated from Polyfrost/OneConfigExampleMod
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
102 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,6 @@ preprocess { | |
"1.8.9-forge"(10809, "srg") { | ||
"1.8.9-fabric"(10809, "yarn") | ||
} | ||
|
||
strictExtraMappings.set(true) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/kotlin/org/polyfrost/polynametag/PolyNametagMixinPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.polyfrost.polynametag | ||
|
||
import org.objectweb.asm.tree.ClassNode | ||
import org.polyfrost.oneconfig.api.platform.v1.LoaderPlatform.Loaders | ||
import org.polyfrost.oneconfig.api.platform.v1.Platform | ||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin | ||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo | ||
|
||
|
||
class PolyNametagMixinPlugin : IMixinConfigPlugin { | ||
override fun onLoad(mixinPackage: String?) {} | ||
override fun getRefMapperConfig(): String? { | ||
return null | ||
} | ||
|
||
override fun shouldApplyMixin(targetClassName: String?, mixinClassName: String?): Boolean { | ||
return true | ||
} | ||
|
||
override fun acceptTargets(myTargets: Set<String>?, otherTargets: Set<String>?) {} | ||
override fun getMixins(): List<String> { | ||
val mixins: MutableList<String> = ArrayList() | ||
val loader = Platform.loader().loader | ||
val version = Platform.loader().minecraftVersion | ||
if (loader == Loaders.FABRIC || version > 11202) { //todo idk what happens for this after 1.12 lol | ||
mixins.add("GLXMixin_LastBrightness") | ||
} | ||
return mixins | ||
} | ||
|
||
override fun preApply( | ||
targetClassName: String, | ||
targetClass: ClassNode, | ||
mixinClassName: String, | ||
mixinInfo: IMixinInfo | ||
) { | ||
} | ||
|
||
override fun postApply( | ||
targetClassName: String, | ||
targetClass: ClassNode, | ||
mixinClassName: String, | ||
mixinInfo: IMixinInfo | ||
) { | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/kotlin/org/polyfrost/polynametag/render/GlHelperHook.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.polyfrost.polynametag.render | ||
|
||
import net.minecraft.client.renderer.OpenGlHelper | ||
|
||
object GlHelperHook { | ||
var lastBrightnessX | ||
//#if MC<=11202 && FORGE | ||
get() = OpenGlHelper.lastBrightnessX | ||
set(value) { | ||
OpenGlHelper.lastBrightnessX = value | ||
} | ||
//#else | ||
//$$ = 0F | ||
//#endif | ||
var lastBrightnessY | ||
//#if MC<=11202 && FORGE | ||
get() = OpenGlHelper.lastBrightnessY | ||
set(value) { | ||
OpenGlHelper.lastBrightnessY = value | ||
} | ||
//#else | ||
//$$ = 0F | ||
//#endif | ||
} |
26 changes: 26 additions & 0 deletions
26
...s/1.8.9-fabric/src/main/java/org/polyfrost/polynametag/mixin/GLXMixin_LastBrightness.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.polyfrost.polynametag.mixin; | ||
|
||
//#if FABRIC || MC > 1.12.2 | ||
|
||
import com.mojang.blaze3d.platform.GLX; | ||
import org.polyfrost.polynametag.render.GlHelperHook; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(GLX.class) | ||
public class GLXMixin_LastBrightness { | ||
|
||
@Shadow public static int lightmapTextureUnit; | ||
|
||
@Inject(method = "gl13MultiTexCoord2f", at = @At("TAIL")) | ||
private static void setLastBrightness(int i, float f1, float f2, CallbackInfo ci) { | ||
if (i == lightmapTextureUnit) { | ||
GlHelperHook.INSTANCE.setLastBrightnessX(f1); | ||
GlHelperHook.INSTANCE.setLastBrightnessY(f2); | ||
} | ||
} | ||
} | ||
//#endif |