Merge branch 'tm-shelf-mipmap-correction' into 'main'
Fix mip map of TM shelf disc textures to be 16x16 Closes #2081 See merge request cable-mc/cobblemon!2398
@@ -59,6 +59,8 @@
|
||||
- Updated various recipes to display in Recipe Groups within the Recipe Book
|
||||
- Updated most recipes to display more logically/consistently within the Recipe Book's categories
|
||||
- Make ride rotations less jittery in multiplayer.
|
||||
- Changes tm shelf discs to use textures instead of tinting and overlays to line up with item display
|
||||
- Blank TM can now be inserted into the Disc Shelf
|
||||
|
||||
### Fixes
|
||||
- Correctly grants "They're Minerals!" advancement when planting a type gem
|
||||
|
||||
@@ -128,6 +128,7 @@ class DiscShelfBlockEntity(pos: BlockPos, state: BlockState) : BlockEntity(Cobbl
|
||||
|
||||
fun isValidItem(stack: ItemStack): Boolean {
|
||||
return stack.item is TechnicalMachineItem
|
||||
|| stack.item == CobblemonItems.BLANK_TM
|
||||
|| stack.item == CobblemonItems.UPGRADE
|
||||
|| stack.item == CobblemonItems.DUBIOUS_DISC
|
||||
|| stack.has(DataComponents.JUKEBOX_PLAYABLE)
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
package com.cobblemon.mod.common.client.render.block
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonItemComponents
|
||||
import com.cobblemon.mod.common.block.entity.DiscShelfBlockEntity
|
||||
import com.cobblemon.mod.common.CobblemonItems
|
||||
import com.cobblemon.mod.common.client.render.color.TechnicalMachineItemColorProvider
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import com.mojang.blaze3d.vertex.PoseStack
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer
|
||||
@@ -37,15 +37,15 @@ class DiscShelfBlockEntityRenderer(ctx: BlockEntityRendererProvider.Context) :
|
||||
private val slotHeightPixels = 2
|
||||
private val textureSize = 16f
|
||||
|
||||
private val slotUMax = slotWidthPixels / textureSize
|
||||
private val slotVMax = slotHeightPixels / textureSize
|
||||
|
||||
private val leftMargin = 1f
|
||||
private val rightMargin = 1f
|
||||
private val topMargin = 1f
|
||||
private val interRowSpacing = 0f
|
||||
private val tmOverlayDepthOffset = -0.0002f
|
||||
private val slotBrightnessMultiplier = 0.65f
|
||||
|
||||
private val tmBaseTexture = cobblemonResource("textures/block/disc_shelf/technical_machine_base.png")
|
||||
private val tmOverlayTexture = cobblemonResource("textures/block/disc_shelf/technical_machine_overlay.png")
|
||||
private val musicDiscUnknownTexture = cobblemonResource("textures/block/disc_shelf/music_disc_unknown.png")
|
||||
|
||||
override fun render(
|
||||
@@ -98,35 +98,19 @@ class DiscShelfBlockEntityRenderer(ctx: BlockEntityRendererProvider.Context) :
|
||||
poseStack.translate(posX, posY, -0.001f)
|
||||
|
||||
if (item.item == CobblemonItems.TECHNICAL_MACHINE) {
|
||||
val baseColor = TechnicalMachineItemColorProvider.getColor(item, 0)
|
||||
val overlayColor = TechnicalMachineItemColorProvider.getColor(item, 1)
|
||||
|
||||
val elementId = item.components.get(CobblemonItemComponents.TM_MOVE)!!.move.elementalType.showdownId
|
||||
val texture = cobblemonResource("textures/block/disc_shelf/${elementId}_tm.png")
|
||||
renderSlotQuad(
|
||||
poseStack,
|
||||
buffer,
|
||||
tmBaseTexture,
|
||||
baseColor,
|
||||
texture,
|
||||
0xFFFFFF,
|
||||
packedLight,
|
||||
slotWidth,
|
||||
slotHeight,
|
||||
tint = true,
|
||||
useTextRenderType = true
|
||||
)
|
||||
|
||||
poseStack.pushPose()
|
||||
poseStack.translate(0.0, 0.0, tmOverlayDepthOffset.toDouble())
|
||||
renderSlotQuad(
|
||||
poseStack,
|
||||
buffer,
|
||||
tmOverlayTexture,
|
||||
overlayColor,
|
||||
packedLight,
|
||||
slotWidth,
|
||||
slotHeight,
|
||||
tint = true,
|
||||
useTextRenderType = true
|
||||
)
|
||||
poseStack.popPose()
|
||||
} else {
|
||||
val tex = getItemTexture(item)
|
||||
renderSlotQuad(
|
||||
@@ -176,13 +160,15 @@ class DiscShelfBlockEntityRenderer(ctx: BlockEntityRendererProvider.Context) :
|
||||
val g = (gBase * slotBrightnessMultiplier).coerceIn(0f, 1f)
|
||||
val b = (bBase * slotBrightnessMultiplier).coerceIn(0f, 1f)
|
||||
|
||||
consumer.addVertex(matrix, 0f, 0f, 0f).setColor(r, g, b, a).setUv(0f, 1f)
|
||||
// The quad faces -Z, so a viewer looking at it sees +X on their left.
|
||||
// U runs from slotUMax at x = 0 to 0 at x = width so the art is not mirrored.
|
||||
consumer.addVertex(matrix, 0f, 0f, 0f).setColor(r, g, b, a).setUv(slotUMax, slotVMax)
|
||||
.setUv1(0, 0).setUv2(light and 0xFFFF, light shr 16).setNormal(0f, 0f, -1f)
|
||||
consumer.addVertex(matrix, 0f, height, 0f).setColor(r, g, b, a).setUv(0f, 0f)
|
||||
consumer.addVertex(matrix, 0f, height, 0f).setColor(r, g, b, a).setUv(slotUMax, 0f)
|
||||
.setUv1(0, 0).setUv2(light and 0xFFFF, light shr 16).setNormal(0f, 0f, -1f)
|
||||
consumer.addVertex(matrix, width, height, 0f).setColor(r, g, b, a).setUv(1f, 0f)
|
||||
consumer.addVertex(matrix, width, height, 0f).setColor(r, g, b, a).setUv(0f, 0f)
|
||||
.setUv1(0, 0).setUv2(light and 0xFFFF, light shr 16).setNormal(0f, 0f, -1f)
|
||||
consumer.addVertex(matrix, width, 0f, 0f).setColor(r, g, b, a).setUv(1f, 1f)
|
||||
consumer.addVertex(matrix, width, 0f, 0f).setColor(r, g, b, a).setUv(0f, slotVMax)
|
||||
.setUv1(0, 0).setUv2(light and 0xFFFF, light shr 16).setNormal(0f, 0f, -1f)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.client.render.color
|
||||
|
||||
import com.cobblemon.mod.common.api.types.ElementalTypes
|
||||
import com.cobblemon.mod.common.item.components.TMMoveComponent.Companion.getTMMove
|
||||
import net.minecraft.client.color.item.ItemColor
|
||||
import net.minecraft.util.FastColor
|
||||
import net.minecraft.world.item.ItemStack
|
||||
|
||||
object TechnicalMachineItemColorProvider : ItemColor {
|
||||
override fun getColor(itemStack: ItemStack, layer: Int): Int {
|
||||
val moveType = getTMMove(itemStack)?.elementalType ?: ElementalTypes.NORMAL
|
||||
val color = when (layer) {
|
||||
0 -> moveType.primaryColor
|
||||
1 -> moveType.secondaryColor
|
||||
else -> 0xFFFFFF
|
||||
}
|
||||
return FastColor.ARGB32.opaque(color)
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 406 B |
|
After Width: | Height: | Size: 406 B |
|
After Width: | Height: | Size: 406 B |
|
After Width: | Height: | Size: 406 B |
|
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 211 B |
|
After Width: | Height: | Size: 408 B |
|
After Width: | Height: | Size: 406 B |
|
Before Width: | Height: | Size: 123 B After Width: | Height: | Size: 103 B |
|
After Width: | Height: | Size: 406 B |
|
After Width: | Height: | Size: 406 B |
|
After Width: | Height: | Size: 408 B |
|
After Width: | Height: | Size: 408 B |
|
After Width: | Height: | Size: 406 B |
|
After Width: | Height: | Size: 406 B |
|
After Width: | Height: | Size: 408 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 414 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 403 B |
|
Before Width: | Height: | Size: 380 B After Width: | Height: | Size: 410 B |
|
Before Width: | Height: | Size: 374 B After Width: | Height: | Size: 401 B |
|
After Width: | Height: | Size: 408 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 405 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 404 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 406 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 407 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 403 B |
|
After Width: | Height: | Size: 404 B |
|
After Width: | Height: | Size: 405 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 411 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 402 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 411 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 411 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 410 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 411 B |
|
Before Width: | Height: | Size: 374 B After Width: | Height: | Size: 412 B |
|
Before Width: | Height: | Size: 374 B After Width: | Height: | Size: 399 B |
|
After Width: | Height: | Size: 394 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 405 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 412 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 411 B |
|
After Width: | Height: | Size: 408 B |
|
After Width: | Height: | Size: 407 B |
|
After Width: | Height: | Size: 406 B |
|
After Width: | Height: | Size: 406 B |
|
After Width: | Height: | Size: 408 B |
|
After Width: | Height: | Size: 408 B |
|
Before Width: | Height: | Size: 124 B |
|
Before Width: | Height: | Size: 364 B |
|
Before Width: | Height: | Size: 370 B |
|
Before Width: | Height: | Size: 383 B After Width: | Height: | Size: 211 B |
|
After Width: | Height: | Size: 406 B |