Update to 1.20
- Remove some devenv mods that are not updated yet - Replace lib39 with fletchingtable for automixins - Use non kotlin entrypoints - Make use of DrawContext in a bunch of places
This commit is contained in:
@@ -10,6 +10,7 @@ plugins {
|
|||||||
id("com.github.johnrengelman.shadow") version "7.1.2"
|
id("com.github.johnrengelman.shadow") version "7.1.2"
|
||||||
id("moe.nea.licenseextractificator")
|
id("moe.nea.licenseextractificator")
|
||||||
id("io.github.juuxel.loom-quiltflower") version "1.10.0"
|
id("io.github.juuxel.loom-quiltflower") version "1.10.0"
|
||||||
|
id("io.shcm.shsupercm.fabric.fletchingtable") version "1.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
@@ -88,8 +89,6 @@ dependencies {
|
|||||||
modImplementation(libs.fabric.kotlin)
|
modImplementation(libs.fabric.kotlin)
|
||||||
modImplementation(libs.modmenu)
|
modImplementation(libs.modmenu)
|
||||||
modImplementation(libs.libgui)
|
modImplementation(libs.libgui)
|
||||||
modImplementation(libs.lib39.core)
|
|
||||||
include(libs.lib39.core)
|
|
||||||
include(libs.libgui)
|
include(libs.libgui)
|
||||||
modApi(libs.fabric.api)
|
modApi(libs.fabric.api)
|
||||||
modApi(libs.architectury)
|
modApi(libs.architectury)
|
||||||
@@ -197,3 +196,5 @@ tasks.create("printAllLicenses", LicenseDiscoveryTask::class.java, licensing).ap
|
|||||||
}
|
}
|
||||||
|
|
||||||
licensing.addExtraLicenseMatchers()
|
licensing.addExtraLicenseMatchers()
|
||||||
|
|
||||||
|
fletchingTable.defaultMixinEnvironment.set("client")
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
[versions]
|
[versions]
|
||||||
minecraft = "1.19.4"
|
minecraft = "1.20"
|
||||||
fabric_loader = "0.14.21"
|
fabric_loader = "0.14.21"
|
||||||
fabric_api = "0.83.0+1.19.4"
|
fabric_api = "0.83.0+1.20"
|
||||||
fabric_kotlin = "1.9.4+kotlin.1.8.21"
|
fabric_kotlin = "1.9.4+kotlin.1.8.21"
|
||||||
yarn = "1.19.4+build.2"
|
yarn = "1.20+build.1"
|
||||||
libgui = "7.1.0+1.19.4"
|
libgui = "8.0.0-beta.1+1.20-rc1" # TODO: Update
|
||||||
rei = "11.0.597"
|
rei = "12.0.613" # TODO: Update
|
||||||
devauth = "1.0.0"
|
devauth = "1.0.0"
|
||||||
modmenu = "6.2.1"
|
modmenu = "7.0.0"
|
||||||
ktor = "2.3.0"
|
ktor = "2.3.0"
|
||||||
dbus_java = "4.2.1"
|
dbus_java = "4.2.1"
|
||||||
architectury = "8.1.79"
|
architectury = "9.0.5" # TODO: Update
|
||||||
neurepoparser = "1.3.1"
|
neurepoparser = "1.3.1"
|
||||||
qolify = "1.2.2-1.19.4"
|
qolify = "1.2.2-1.19.4" # TODO: Update
|
||||||
citresewn = "1.1.3+1.19.4"
|
citresewn = "1.1.3+1.19.4" # TODO: Update
|
||||||
lib39 = "1.4.2"
|
|
||||||
hotswap_agent = "1.4.2-SNAPSHOT"
|
hotswap_agent = "1.4.2-SNAPSHOT"
|
||||||
ncr = "Fabric-1.19.4-v2.1.1"
|
ncr = "Fabric-1.19.4-v2.1.1" # TODO: Update
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
|
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
|
||||||
@@ -29,7 +28,6 @@ repoparser = { module = "moe.nea:neurepoparser", version.ref = "neurepoparser" }
|
|||||||
dbus_java_core = { module = "com.github.hypfvieh:dbus-java-core", version.ref = "dbus_java" }
|
dbus_java_core = { module = "com.github.hypfvieh:dbus-java-core", version.ref = "dbus_java" }
|
||||||
dbus_java_unixsocket = { module = "com.github.hypfvieh:dbus-java-transport-native-unixsocket", version.ref = "dbus_java" }
|
dbus_java_unixsocket = { module = "com.github.hypfvieh:dbus-java-transport-native-unixsocket", version.ref = "dbus_java" }
|
||||||
libgui = { module = "io.github.cottonmc:LibGui", version.ref = "libgui" }
|
libgui = { module = "io.github.cottonmc:LibGui", version.ref = "libgui" }
|
||||||
lib39_core = { module = "com.unascribed:lib39-core", version.ref = "lib39" }
|
|
||||||
|
|
||||||
# Runtime:
|
# Runtime:
|
||||||
hotswap = { module = "virtual.github.hotswapagent:hotswap-agent", version.ref = "hotswap_agent" }
|
hotswap = { module = "virtual.github.hotswapagent:hotswap-agent", version.ref = "hotswap_agent" }
|
||||||
@@ -44,7 +42,12 @@ ncr = { module = "maven.modrinth:no-chat-reports", version.ref = "ncr" }
|
|||||||
[bundles]
|
[bundles]
|
||||||
dbus = ["dbus_java_core", "dbus_java_unixsocket"]
|
dbus = ["dbus_java_core", "dbus_java_unixsocket"]
|
||||||
runtime_required = ["architectury_fabric", "rei_fabric"]
|
runtime_required = ["architectury_fabric", "rei_fabric"]
|
||||||
runtime_optional = ["devauth", "qolify", "citresewn", "ncr"]
|
runtime_optional = [
|
||||||
|
"devauth",
|
||||||
|
# Add back once updated:
|
||||||
|
# "qolify",
|
||||||
|
# "citresewn",
|
||||||
|
# "ncr",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,25 +18,49 @@
|
|||||||
|
|
||||||
package moe.nea.firmament.init;
|
package moe.nea.firmament.init;
|
||||||
|
|
||||||
import com.unascribed.lib39.core.api.AutoMixin;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||||
|
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
// TODO: replace AutoMixin with KSP plugin?
|
public class MixinPlugin implements IMixinConfigPlugin {
|
||||||
public class MixinPlugin extends AutoMixin {
|
|
||||||
|
@Override
|
||||||
|
public void onLoad(String mixinPackage) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRefMapperConfig() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||||
if (!Boolean.getBoolean("firmament.debug") && mixinClassName.contains("devenv.")) {
|
if (!Boolean.getBoolean("firmament.debug") && mixinClassName.contains("devenv.")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return super.shouldApplyMixin(targetClassName, mixinClassName);
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getMixins() {
|
public List<String> getMixins() {
|
||||||
var autoDiscoveredMixins = super.getMixins();
|
return null;
|
||||||
autoDiscoveredMixins.removeIf(it -> !shouldApplyMixin(null, it));
|
}
|
||||||
return autoDiscoveredMixins;
|
|
||||||
|
@Override
|
||||||
|
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ package moe.nea.firmament.mixins;
|
|||||||
import moe.nea.firmament.events.HandledScreenKeyPressedEvent;
|
import moe.nea.firmament.events.HandledScreenKeyPressedEvent;
|
||||||
import moe.nea.firmament.events.IsSlotProtectedEvent;
|
import moe.nea.firmament.events.IsSlotProtectedEvent;
|
||||||
import moe.nea.firmament.events.SlotRenderEvents;
|
import moe.nea.firmament.events.SlotRenderEvents;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.screen.slot.Slot;
|
import net.minecraft.screen.slot.Slot;
|
||||||
@@ -50,19 +51,15 @@ public class MixinHandledScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;drawSlot(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/screen/slot/Slot;)V", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
|
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;drawSlot(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/screen/slot/Slot;)V", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||||
public void onAfterDrawSlot(
|
public void onAfterDrawSlot(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci, int i, int j, int k, Slot slot) {
|
||||||
MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci,
|
SlotRenderEvents.After event = new SlotRenderEvents.After(context, slot, mouseX, mouseY, delta);
|
||||||
int i, int j, int k, Slot slot) {
|
|
||||||
SlotRenderEvents.After event = new SlotRenderEvents.After(matrices, slot, mouseX, mouseY, delta);
|
|
||||||
SlotRenderEvents.After.Companion.publish(event);
|
SlotRenderEvents.After.Companion.publish(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;drawSlot(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/screen/slot/Slot;)V", shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD)
|
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;drawSlot(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/screen/slot/Slot;)V", shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||||
public void onBeforeDrawSlot(
|
public void onBeforeDrawSlot(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci, int i, int j, int k, Slot slot) {
|
||||||
MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci,
|
SlotRenderEvents.Before event = new SlotRenderEvents.Before(context, slot, mouseX, mouseY, delta);
|
||||||
int i, int j, int k, Slot slot) {
|
|
||||||
SlotRenderEvents.Before event = new SlotRenderEvents.Before(matrices, slot, mouseX, mouseY, delta);
|
|
||||||
SlotRenderEvents.Before.Companion.publish(event);
|
SlotRenderEvents.Before.Companion.publish(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
|
|
||||||
@Mixin(WorldRenderer.class)
|
@Mixin(WorldRenderer.class)
|
||||||
public class MixinWorldRenderer {
|
public class MixinWorldRenderer {
|
||||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;applyModelViewMatrix()V", shift = At.Shift.AFTER))
|
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;renderChunkDebugInfo(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/render/Camera;)V", shift = At.Shift.BEFORE))
|
||||||
public void onWorldRenderLast(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f positionMatrix, CallbackInfo ci) {
|
public void onWorldRenderLast(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f positionMatrix, CallbackInfo ci) {
|
||||||
var event = new WorldRenderLastEvent(
|
var event = new WorldRenderLastEvent(
|
||||||
matrices, tickDelta, renderBlockOutline,
|
matrices, tickDelta, renderBlockOutline,
|
||||||
|
|||||||
@@ -19,18 +19,15 @@
|
|||||||
package moe.nea.firmament
|
package moe.nea.firmament
|
||||||
|
|
||||||
import com.mojang.brigadier.CommandDispatcher
|
import com.mojang.brigadier.CommandDispatcher
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.*
|
||||||
import io.ktor.client.plugins.UserAgent
|
import io.ktor.client.plugins.*
|
||||||
import io.ktor.client.plugins.cache.HttpCache
|
import io.ktor.client.plugins.cache.*
|
||||||
import io.ktor.client.plugins.compression.ContentEncoding
|
import io.ktor.client.plugins.compression.*
|
||||||
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
|
import io.ktor.client.plugins.contentnegotiation.*
|
||||||
import io.ktor.client.plugins.logging.LogLevel
|
import io.ktor.client.plugins.logging.*
|
||||||
import io.ktor.client.plugins.logging.Logging
|
import io.ktor.serialization.kotlinx.json.*
|
||||||
import io.ktor.serialization.kotlinx.json.json
|
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import net.fabricmc.api.ClientModInitializer
|
|
||||||
import net.fabricmc.api.ModInitializer
|
|
||||||
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback
|
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback
|
||||||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource
|
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents
|
||||||
@@ -58,7 +55,7 @@ import moe.nea.firmament.repo.RepoManager
|
|||||||
import moe.nea.firmament.util.SBData
|
import moe.nea.firmament.util.SBData
|
||||||
import moe.nea.firmament.util.data.IDataHolder
|
import moe.nea.firmament.util.data.IDataHolder
|
||||||
|
|
||||||
object Firmament : ModInitializer, ClientModInitializer {
|
object Firmament {
|
||||||
const val MOD_ID = "firmament"
|
const val MOD_ID = "firmament"
|
||||||
|
|
||||||
val DEBUG = System.getProperty("firmament.debug") == "true"
|
val DEBUG = System.getProperty("firmament.debug") == "true"
|
||||||
@@ -110,10 +107,12 @@ object Firmament : ModInitializer, ClientModInitializer {
|
|||||||
registerFirmamentCommand(dispatcher)
|
registerFirmamentCommand(dispatcher)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onInitialize() {
|
@JvmStatic
|
||||||
|
fun onInitialize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onInitializeClient() {
|
@JvmStatic
|
||||||
|
fun onClientInitialize() {
|
||||||
dbusConnection.requestBusName("moe.nea.firmament")
|
dbusConnection.requestBusName("moe.nea.firmament")
|
||||||
dbusConnection.exportObject(FirmamentDbusObject)
|
dbusConnection.exportObject(FirmamentDbusObject)
|
||||||
IDataHolder.registerEvents()
|
IDataHolder.registerEvents()
|
||||||
|
|||||||
@@ -18,18 +18,18 @@
|
|||||||
|
|
||||||
package moe.nea.firmament.events
|
package moe.nea.firmament.events
|
||||||
|
|
||||||
import net.minecraft.client.util.math.MatrixStack
|
import net.minecraft.client.gui.DrawContext
|
||||||
import net.minecraft.screen.slot.Slot
|
import net.minecraft.screen.slot.Slot
|
||||||
|
|
||||||
interface SlotRenderEvents {
|
interface SlotRenderEvents {
|
||||||
val matrices: MatrixStack
|
val context: DrawContext
|
||||||
val slot: Slot
|
val slot: Slot
|
||||||
val mouseX: Int
|
val mouseX: Int
|
||||||
val mouseY: Int
|
val mouseY: Int
|
||||||
val delta: Float
|
val delta: Float
|
||||||
|
|
||||||
data class Before(
|
data class Before(
|
||||||
override val matrices: MatrixStack, override val slot: Slot,
|
override val context: DrawContext, override val slot: Slot,
|
||||||
override val mouseX: Int,
|
override val mouseX: Int,
|
||||||
override val mouseY: Int,
|
override val mouseY: Int,
|
||||||
override val delta: Float
|
override val delta: Float
|
||||||
@@ -39,7 +39,7 @@ interface SlotRenderEvents {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data class After(
|
data class After(
|
||||||
override val matrices: MatrixStack, override val slot: Slot,
|
override val context: DrawContext, override val slot: Slot,
|
||||||
override val mouseX: Int,
|
override val mouseX: Int,
|
||||||
override val mouseY: Int,
|
override val mouseY: Int,
|
||||||
override val delta: Float
|
override val delta: Float
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ package moe.nea.firmament.features.inventory
|
|||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.serializer
|
import kotlinx.serialization.serializer
|
||||||
import net.minecraft.client.gui.DrawableHelper
|
import net.minecraft.client.gui.DrawContext
|
||||||
import net.minecraft.entity.player.PlayerInventory
|
import net.minecraft.entity.player.PlayerInventory
|
||||||
import moe.nea.firmament.events.HandledScreenKeyPressedEvent
|
import moe.nea.firmament.events.HandledScreenKeyPressedEvent
|
||||||
import moe.nea.firmament.events.IsSlotProtectedEvent
|
import moe.nea.firmament.events.IsSlotProtectedEvent
|
||||||
@@ -72,8 +72,7 @@ object SlotLocking : FirmamentFeature {
|
|||||||
}
|
}
|
||||||
SlotRenderEvents.Before.subscribe {
|
SlotRenderEvents.Before.subscribe {
|
||||||
if (it.slot.inventory is PlayerInventory && it.slot.index in (lockedSlots ?: setOf())) {
|
if (it.slot.inventory is PlayerInventory && it.slot.index in (lockedSlots ?: setOf())) {
|
||||||
DrawableHelper.fill(
|
it.context.fill(
|
||||||
it.matrices,
|
|
||||||
it.slot.x,
|
it.slot.x,
|
||||||
it.slot.y,
|
it.slot.y,
|
||||||
it.slot.x + 16,
|
it.slot.x + 16,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import io.github.cottonmc.cotton.gui.client.ScreenDrawing
|
|||||||
import io.github.cottonmc.cotton.gui.widget.WWidget
|
import io.github.cottonmc.cotton.gui.widget.WWidget
|
||||||
import io.github.cottonmc.cotton.gui.widget.data.Texture
|
import io.github.cottonmc.cotton.gui.widget.data.Texture
|
||||||
import me.shedaniel.math.Color
|
import me.shedaniel.math.Color
|
||||||
|
import net.minecraft.client.gui.DrawContext
|
||||||
import net.minecraft.client.util.math.MatrixStack
|
import net.minecraft.client.util.math.MatrixStack
|
||||||
import moe.nea.firmament.Firmament
|
import moe.nea.firmament.Firmament
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ open class WBar(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun drawSection(
|
private fun drawSection(
|
||||||
matrices: MatrixStack,
|
context: DrawContext,
|
||||||
texture: Texture,
|
texture: Texture,
|
||||||
x: Int,
|
x: Int,
|
||||||
y: Int,
|
y: Int,
|
||||||
@@ -36,18 +37,18 @@ open class WBar(
|
|||||||
sectionEnd: Double
|
sectionEnd: Double
|
||||||
) {
|
) {
|
||||||
if (sectionEnd < progress && width == 4) {
|
if (sectionEnd < progress && width == 4) {
|
||||||
ScreenDrawing.texturedRect(matrices, x, y, 4, 8, texture, fillColor.color)
|
ScreenDrawing.texturedRect(context, x, y, 4, 8, texture, fillColor.color)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (sectionStart > progress && width == 4) {
|
if (sectionStart > progress && width == 4) {
|
||||||
ScreenDrawing.texturedRect(matrices, x, y, 4, 8, texture, emptyColor.color)
|
ScreenDrawing.texturedRect(context, x, y, 4, 8, texture, emptyColor.color)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val increasePerPixel = (sectionEnd - sectionStart / 4)
|
val increasePerPixel = (sectionEnd - sectionStart / 4)
|
||||||
var valueAtPixel = sectionStart
|
var valueAtPixel = sectionStart
|
||||||
for (i in (0 until width)) {
|
for (i in (0 until width)) {
|
||||||
ScreenDrawing.texturedRect(
|
ScreenDrawing.texturedRect(
|
||||||
matrices, x + i, y, 1, 8,
|
context, x + i, y, 1, 8,
|
||||||
texture.image, texture.u1 + i / 64F, texture.v1, texture.u1 + (i + 1) / 64F, texture.v2,
|
texture.image, texture.u1 + i / 64F, texture.v1, texture.u1 + (i + 1) / 64F, texture.v2,
|
||||||
if (valueAtPixel < progress) fillColor.color else emptyColor.color
|
if (valueAtPixel < progress) fillColor.color else emptyColor.color
|
||||||
)
|
)
|
||||||
@@ -55,11 +56,11 @@ open class WBar(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun paint(matrices: MatrixStack, x: Int, y: Int, mouseX: Int, mouseY: Int) {
|
override fun paint(context: DrawContext, x: Int, y: Int, mouseX: Int, mouseY: Int) {
|
||||||
var i = 0
|
var i = 0
|
||||||
while (i < width - 4) {
|
while (i < width - 4) {
|
||||||
drawSection(
|
drawSection(
|
||||||
matrices,
|
context,
|
||||||
if (i == 0) left else middle,
|
if (i == 0) left else middle,
|
||||||
x + i, y,
|
x + i, y,
|
||||||
(width - (i + 4)).coerceAtMost(4),
|
(width - (i + 4)).coerceAtMost(4),
|
||||||
@@ -67,7 +68,7 @@ open class WBar(
|
|||||||
)
|
)
|
||||||
i += 4
|
i += 4
|
||||||
}
|
}
|
||||||
drawSection(matrices, right, x + width - 4, y, 4, (width - 4) * total / width, total)
|
drawSection(context, right, x + width - 4, y, 4, (width - 4) * total / width, total)
|
||||||
RenderSystem.setShaderColor(1F, 1F, 1F, 1F)
|
RenderSystem.setShaderColor(1F, 1F, 1F, 1F)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import io.github.cottonmc.cotton.gui.widget.WWidget
|
|||||||
import io.github.cottonmc.cotton.gui.widget.data.Insets
|
import io.github.cottonmc.cotton.gui.widget.data.Insets
|
||||||
import io.github.cottonmc.cotton.gui.widget.icon.Icon
|
import io.github.cottonmc.cotton.gui.widget.icon.Icon
|
||||||
import io.github.cottonmc.cotton.gui.widget.icon.ItemIcon
|
import io.github.cottonmc.cotton.gui.widget.icon.ItemIcon
|
||||||
|
import net.minecraft.client.gui.DrawContext
|
||||||
import net.minecraft.client.item.TooltipContext
|
import net.minecraft.client.item.TooltipContext
|
||||||
import net.minecraft.client.util.math.MatrixStack
|
|
||||||
import net.minecraft.item.Items
|
import net.minecraft.item.Items
|
||||||
import net.minecraft.text.Text
|
import net.minecraft.text.Text
|
||||||
import moe.nea.firmament.gui.WTightScrollPanel
|
import moe.nea.firmament.gui.WTightScrollPanel
|
||||||
@@ -27,9 +27,9 @@ object PetsPage : ProfilePage {
|
|||||||
for ((i, pet) in profileViewer.member.pets.withIndex()) {
|
for ((i, pet) in profileViewer.member.pets.withIndex()) {
|
||||||
val stack = SBItemStack(pet.itemId, PetData(pet.tier, pet.type.name, pet.exp)).asItemStack()
|
val stack = SBItemStack(pet.itemId, PetData(pet.tier, pet.type.name, pet.exp)).asItemStack()
|
||||||
it.add(object : WItem(stack) {
|
it.add(object : WItem(stack) {
|
||||||
override fun paint(matrices: MatrixStack?, x: Int, y: Int, mouseX: Int, mouseY: Int) {
|
override fun paint(context: DrawContext?, x: Int, y: Int, mouseX: Int, mouseY: Int) {
|
||||||
BackgroundPainter.SLOT.paintBackground(matrices, x, y, this)
|
BackgroundPainter.SLOT.paintBackground(context, x, y, this)
|
||||||
super.paint(matrices, x, y, mouseX, mouseY)
|
super.paint(context, x, y, mouseX, mouseY)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun addTooltip(tooltip: TooltipBuilder) {
|
override fun addTooltip(tooltip: TooltipBuilder) {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import io.github.cottonmc.cotton.gui.widget.data.Insets
|
|||||||
import net.minecraft.client.util.math.MatrixStack
|
import net.minecraft.client.util.math.MatrixStack
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
import kotlin.math.sin
|
import kotlin.math.sin
|
||||||
|
import net.minecraft.client.gui.DrawContext
|
||||||
|
|
||||||
|
|
||||||
val Insets.vertical get() = bottom + top
|
val Insets.vertical get() = bottom + top
|
||||||
@@ -49,8 +50,8 @@ class ProgressBar(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun paint(matrices: MatrixStack, x: Int, y: Int, mouseX: Int, mouseY: Int) {
|
override fun paint(context: DrawContext, x: Int, y: Int, mouseX: Int, mouseY: Int) {
|
||||||
ScreenDrawing.coloredRect(matrices, x, y, width, height, 0xFF808080.toInt())
|
ScreenDrawing.coloredRect(context, x, y, width, height, 0xFF808080.toInt())
|
||||||
val (l, prog) = synchronized(this) {
|
val (l, prog) = synchronized(this) {
|
||||||
label to (progress to total)
|
label to (progress to total)
|
||||||
}
|
}
|
||||||
@@ -58,7 +59,7 @@ class ProgressBar(
|
|||||||
|
|
||||||
if (t == null) {
|
if (t == null) {
|
||||||
ScreenDrawing.coloredRect(
|
ScreenDrawing.coloredRect(
|
||||||
matrices,
|
context,
|
||||||
(x + (1 + sin(System.currentTimeMillis().toDouble() / 1000)) * width * 3 / 4 / 2).roundToInt(),
|
(x + (1 + sin(System.currentTimeMillis().toDouble() / 1000)) * width * 3 / 4 / 2).roundToInt(),
|
||||||
y,
|
y,
|
||||||
width / 4,
|
width / 4,
|
||||||
@@ -66,10 +67,10 @@ class ProgressBar(
|
|||||||
0xFF00FF00.toInt()
|
0xFF00FF00.toInt()
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
ScreenDrawing.coloredRect(matrices, x, y, width * p / t, height, 0xFF00FF00.toInt())
|
ScreenDrawing.coloredRect(context, x, y, width * p / t, height, 0xFF00FF00.toInt())
|
||||||
}
|
}
|
||||||
ScreenDrawing.drawString(
|
ScreenDrawing.drawString(
|
||||||
matrices,
|
context,
|
||||||
if (t != null) "$l ($p/$t)" else l,
|
if (t != null) "$l ($p/$t)" else l,
|
||||||
HorizontalAlignment.CENTER,
|
HorizontalAlignment.CENTER,
|
||||||
x + insets.left,
|
x + insets.left,
|
||||||
|
|||||||
@@ -23,22 +23,22 @@ import me.shedaniel.rei.api.client.entry.renderer.EntryRenderer
|
|||||||
import me.shedaniel.rei.api.client.gui.widgets.Tooltip
|
import me.shedaniel.rei.api.client.gui.widgets.Tooltip
|
||||||
import me.shedaniel.rei.api.client.gui.widgets.TooltipContext
|
import me.shedaniel.rei.api.client.gui.widgets.TooltipContext
|
||||||
import me.shedaniel.rei.api.common.entry.EntryStack
|
import me.shedaniel.rei.api.common.entry.EntryStack
|
||||||
import net.minecraft.client.util.math.MatrixStack
|
import net.minecraft.client.gui.DrawContext
|
||||||
import moe.nea.firmament.rei.FirmamentReiPlugin.Companion.asItemEntry
|
import moe.nea.firmament.rei.FirmamentReiPlugin.Companion.asItemEntry
|
||||||
|
|
||||||
object NEUItemEntryRenderer : EntryRenderer<SBItemStack> {
|
object NEUItemEntryRenderer : EntryRenderer<SBItemStack> {
|
||||||
override fun render(
|
override fun render(
|
||||||
entry: EntryStack<SBItemStack>,
|
entry: EntryStack<SBItemStack>,
|
||||||
matrices: MatrixStack,
|
context: DrawContext,
|
||||||
bounds: Rectangle,
|
bounds: Rectangle,
|
||||||
mouseX: Int,
|
mouseX: Int,
|
||||||
mouseY: Int,
|
mouseY: Int,
|
||||||
delta: Float
|
delta: Float
|
||||||
) {
|
) {
|
||||||
matrices.push()
|
context.matrices.push()
|
||||||
matrices.translate(0F, 0F, 100F)
|
context.matrices.translate(0F, 0F, 100F)
|
||||||
entry.asItemEntry().render(matrices, bounds, mouseX, mouseY, delta)
|
entry.asItemEntry().render(context, bounds, mouseX, mouseY, delta)
|
||||||
matrices.pop()
|
context.matrices.pop()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getTooltip(entry: EntryStack<SBItemStack>, tooltipContext: TooltipContext): Tooltip? {
|
override fun getTooltip(entry: EntryStack<SBItemStack>, tooltipContext: TooltipContext): Tooltip? {
|
||||||
|
|||||||
@@ -20,17 +20,11 @@
|
|||||||
"icon": "assets/firmament/icon.png",
|
"icon": "assets/firmament/icon.png",
|
||||||
"environment": "client",
|
"environment": "client",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"main": [
|
"main": [
|
||||||
{
|
"moe.nea.firmament.Firmament::onInitialize"
|
||||||
"adapter": "kotlin",
|
],
|
||||||
"value": "moe.nea.firmament.Firmament"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"client": [
|
"client": [
|
||||||
{
|
"moe.nea.firmament.Firmament::onClientInitialize"
|
||||||
"adapter": "kotlin",
|
|
||||||
"value": "moe.nea.firmament.Firmament"
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"rei_client": [
|
"rei_client": [
|
||||||
"moe.nea.firmament.rei.FirmamentReiPlugin"
|
"moe.nea.firmament.rei.FirmamentReiPlugin"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"plugin": "moe.nea.firmament.init.MixinPlugin",
|
"plugin": "moe.nea.firmament.init.MixinPlugin",
|
||||||
"package": "moe.nea.firmament.mixins",
|
"package": "moe.nea.firmament.mixins",
|
||||||
"compatibilityLevel": "JAVA_16",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user