Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
RedthMC committed Oct 23, 2023
1 parent 9282094 commit 0973f87
Show file tree
Hide file tree
Showing 16 changed files with 257 additions and 162 deletions.
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# gradle.properties file -- CHANGE THE VALUES STARTING WITH `mod_*` AND REMOVE THIS COMMENT.

# Sets the name of your mod.
mod_name=ExampleMod
mod_name=PolyNametag
# Sets the id of your mod that mod loaders use to recognize it.
mod_id=examplemod
mod_id=polynametag
# Sets the version of your mod. Make sure to update this when you make changes according to semver.
mod_version=1.0.0
# Sets the name of the jar file that you put in your 'mods' folder.
mod_archives_name=ExampleMod
mod_archives_name=PolyNametag

# Gradle Configuration -- DO NOT TOUCH THESE VALUES.
polyfrost.defaults.loom=1
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureoncommand=true
org.gradle.parallel.threads=4
org.gradle.jvmargs=-Xmx2G
org.gradle.jvmargs=-Xmx4G
4 changes: 2 additions & 2 deletions root.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

preprocess {
"1.12.2-forge"(11202, "srg") {
// "1.12.2-forge"(11202, "srg") {
"1.8.9-forge"(10809, "srg")
}
// }
}
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ rootProject.buildFileName = "root.gradle.kts"
// Adds all of our build target versions to the classpath if we need to add version-specific code.
listOf(
"1.8.9-forge", // Update this if you want to remove/add a version, along with `build.gradle.kts` and `root.gradle.kts`.
"1.12.2-forge"
// "1.12.2-forge"
).forEach { version ->
include(":$version")
project(":$version").apply {
Expand Down
32 changes: 0 additions & 32 deletions src/main/java/org/polyfrost/example/ExampleMod.java

This file was deleted.

21 changes: 0 additions & 21 deletions src/main/java/org/polyfrost/example/command/ExampleCommand.java

This file was deleted.

48 changes: 0 additions & 48 deletions src/main/java/org/polyfrost/example/config/TestConfig.java

This file was deleted.

20 changes: 0 additions & 20 deletions src/main/java/org/polyfrost/example/hud/TestHud.java

This file was deleted.

21 changes: 0 additions & 21 deletions src/main/java/org/polyfrost/example/mixin/MinecraftMixin.java

This file was deleted.

12 changes: 12 additions & 0 deletions src/main/java/org/polyfrost/polynametag/mixin/RenderAccessor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.polyfrost.polynametag.mixin;

import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(Render.class)
public interface RenderAccessor {
@Invoker
boolean invokeCanRenderName(Entity entity);
}
17 changes: 17 additions & 0 deletions src/main/java/org/polyfrost/polynametag/mixin/RenderMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.polyfrost.polynametag.mixin;

import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import org.polyfrost.polynametag.hooks.HooksKt;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(Render.class)
public class RenderMixin {
@Inject(method = "renderName(Lnet/minecraft/entity/Entity;DDD)V", at = @At("HEAD"))
private void polyNametag$renderName(Entity entity, double x, double y, double z, CallbackInfo callbackInfo) {
HooksKt.callback((RenderAccessor) this, entity, x, y, z, callbackInfo);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.polyfrost.polynametag.mixin;

import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.entity.EntityLivingBase;
import org.polyfrost.polynametag.hooks.HooksKt;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(RendererLivingEntity.class)
public class RendererLivingEntityMixin {
@Inject(method = "renderName(Lnet/minecraft/entity/EntityLivingBase;DDD)V", at = @At("HEAD"))
private void polyNametag$renderName(EntityLivingBase entity, double x, double y, double z, CallbackInfo callbackInfo) {
HooksKt.callback((RenderAccessor) this, entity, x, y, z, callbackInfo);
}
}
17 changes: 17 additions & 0 deletions src/main/kotlin/org/polyfrost/polynametag/PolyNametag.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.polyfrost.polynametag

import net.minecraftforge.fml.common.Mod
import net.minecraftforge.fml.common.event.FMLInitializationEvent
import org.polyfrost.polynametag.config.ModConfig

@Mod(modid = PolyNametag.MODID, name = PolyNametag.NAME, version = PolyNametag.VERSION, modLanguageAdapter = "cc.polyfrost.oneconfig.utils.KotlinLanguageAdapter")
object PolyNametag {
const val MODID = "@ID@"
const val NAME = "@NAME@"
const val VERSION = "@VER@"

@Mod.EventHandler
fun onInit(e: FMLInitializationEvent) {
ModConfig
}
}
42 changes: 42 additions & 0 deletions src/main/kotlin/org/polyfrost/polynametag/config/ModConfig.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.polyfrost.polynametag.config

import cc.polyfrost.oneconfig.config.Config
import cc.polyfrost.oneconfig.config.annotations.*
import cc.polyfrost.oneconfig.config.core.OneColor
import cc.polyfrost.oneconfig.config.data.InfoType
import cc.polyfrost.oneconfig.config.data.Mod
import cc.polyfrost.oneconfig.config.data.ModType
import org.polyfrost.polynametag.PolyNametag

object ModConfig : Config(Mod(PolyNametag.NAME, ModType.UTIL_QOL), "${PolyNametag.MODID}.json") {

@Info(
text = "Some features may have conflict with Patcher",
type = InfoType.WARNING,
size = 2
)
private var warning = false

@Slider(name = "Height offset", min = -0.5f, max = 0.5f)
var heightOffset = 0f

@Slider(name = "Scale", min = 0.5f, max = 2f)
var scale = 1f

@Switch(name = "Text shadow")
var textShadow = false

@Switch(name = "Show self nametag")
var showSelfNametag = true

@Switch(name = "Background")
var background = true

@Color(name = "Background color")
var backgroundColor = OneColor(0f, 0f, 0f, 0.25f)

init {
initialize()
addDependency("backgroundColor", "background")
}
}
Loading

0 comments on commit 0973f87

Please sign in to comment.