feat: Highlight century cake slice players
This commit is contained in:
@@ -7,11 +7,13 @@ import net.minecraft.client.gui.hud.InGameHud
|
||||
import net.minecraft.client.gui.screen.Screen
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen
|
||||
import net.minecraft.client.network.ClientPlayerEntity
|
||||
import net.minecraft.client.render.GameRenderer
|
||||
import net.minecraft.client.render.WorldRenderer
|
||||
import net.minecraft.client.render.item.ItemRenderer
|
||||
import net.minecraft.client.world.ClientWorld
|
||||
import net.minecraft.entity.Entity
|
||||
import net.minecraft.item.Item
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.network.packet.c2s.play.CommandExecutionC2SPacket
|
||||
import net.minecraft.registry.BuiltinRegistries
|
||||
import net.minecraft.registry.RegistryKeys
|
||||
@@ -85,6 +87,7 @@ object MC {
|
||||
inline val resourceManager get() = (instance.resourceManager as ReloadableResourceManagerImpl)
|
||||
inline val itemRenderer: ItemRenderer get() = instance.itemRenderer
|
||||
inline val worldRenderer: WorldRenderer get() = instance.worldRenderer
|
||||
inline val gameRenderer: GameRenderer get() = instance.gameRenderer
|
||||
inline val networkHandler get() = player?.networkHandler
|
||||
inline val instance get() = MinecraftClient.getInstance()
|
||||
inline val keyboard get() = instance.keyboard
|
||||
@@ -96,6 +99,7 @@ object MC {
|
||||
inline val soundManager get() = instance.soundManager
|
||||
inline val player: ClientPlayerEntity? get() = TestUtil.unlessTesting { instance.player }
|
||||
inline val camera: Entity? get() = instance.cameraEntity
|
||||
inline val stackInHand: ItemStack? get() = player?.inventory?.mainHandStack
|
||||
inline val guiAtlasManager get() = instance.guiAtlasManager
|
||||
inline val world: ClientWorld? get() = TestUtil.unlessTesting { instance.world }
|
||||
inline val playerName: String? get() = player?.name?.unformattedString
|
||||
|
||||
44
src/main/kotlin/util/render/TintedOverlayTexture.kt
Normal file
44
src/main/kotlin/util/render/TintedOverlayTexture.kt
Normal file
@@ -0,0 +1,44 @@
|
||||
package moe.nea.firmament.util.render
|
||||
|
||||
import com.mojang.blaze3d.platform.GlConst
|
||||
import com.mojang.blaze3d.systems.RenderSystem
|
||||
import me.shedaniel.math.Color
|
||||
import net.minecraft.client.render.OverlayTexture
|
||||
import net.minecraft.util.math.ColorHelper
|
||||
import moe.nea.firmament.util.ErrorUtil
|
||||
|
||||
class TintedOverlayTexture : OverlayTexture() {
|
||||
companion object {
|
||||
val size = 16
|
||||
}
|
||||
|
||||
private var lastColor: Color? = null
|
||||
fun setColor(color: Color): TintedOverlayTexture {
|
||||
val image = ErrorUtil.notNullOr(texture.image, "Disposed TintedOverlayTexture written to") { return this }
|
||||
if (color == lastColor) return this
|
||||
lastColor = color
|
||||
|
||||
for (i in 0..<size) {
|
||||
for (j in 0..<size) {
|
||||
if (i < 8) {
|
||||
image.setColorArgb(j, i, 0xB2FF0000.toInt())
|
||||
} else {
|
||||
val k = ((1F - j / 15F * 0.75F) * 255F).toInt()
|
||||
image.setColorArgb(j, i, ColorHelper.withAlpha(k, color.color))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RenderSystem.activeTexture(GlConst.GL_TEXTURE1)
|
||||
texture.bindTexture()
|
||||
texture.setFilter(false, false)
|
||||
texture.setClamp(true)
|
||||
image.upload(0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
image.width, image.height,
|
||||
false)
|
||||
RenderSystem.activeTexture(GlConst.GL_TEXTURE0)
|
||||
return this
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,9 @@ object SkyBlockItems {
|
||||
val DIAMOND = SkyblockId("DIAMOND")
|
||||
val ANCESTRAL_SPADE = SkyblockId("ANCESTRAL_SPADE")
|
||||
val REFORGE_ANVIL = SkyblockId("REFORGE_ANVIL")
|
||||
val SLICE_OF_BLUEBERRY_CAKE = SkyblockId("SLICE_OF_BLUEBERRY_CAKE")
|
||||
val SLICE_OF_CHEESECAKE = SkyblockId("SLICE_OF_CHEESECAKE")
|
||||
val SLICE_OF_GREEN_VELVET_CAKE = SkyblockId("SLICE_OF_GREEN_VELVET_CAKE")
|
||||
val SLICE_OF_RED_VELVET_CAKE = SkyblockId("SLICE_OF_RED_VELVET_CAKE")
|
||||
val SLICE_OF_STRAWBERRY_SHORTCAKE = SkyblockId("SLICE_OF_STRAWBERRY_SHORTCAKE")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user