diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt b/common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt index c6cd749a70..ffd5969da5 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt @@ -55,6 +55,7 @@ import com.cobblemon.mod.common.client.render.entity.PokeBobberEntityRenderer import com.cobblemon.mod.common.client.render.generic.GenericBedrockRenderer import com.cobblemon.mod.common.client.render.item.CobblemonBuiltinItemRendererRegistry import com.cobblemon.mod.common.client.render.item.PokemonItemRenderer +import com.cobblemon.mod.common.client.render.layer.CobblemonBagRenderer import com.cobblemon.mod.common.client.render.layer.PokemonOnShoulderRenderer import com.cobblemon.mod.common.client.render.models.blockbench.bedrock.animation.BedrockAnimationRepository import com.cobblemon.mod.common.client.render.models.blockbench.repository.BerryModelRepository @@ -415,8 +416,10 @@ object CobblemonClient { var renderer: LivingEntityRenderer>? = skinMap?.get(PlayerSkin.Model.WIDE) as LivingEntityRenderer> renderer?.addLayer(PokemonOnShoulderRenderer(renderer)) + renderer?.addLayer(CobblemonBagRenderer(renderer)) renderer = skinMap[PlayerSkin.Model.SLIM] as LivingEntityRenderer>? renderer?.addLayer(PokemonOnShoulderRenderer(renderer)) + renderer?.addLayer(CobblemonBagRenderer(renderer)) } private fun registerMenuScreens() { diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/client/gui/bag/CobblemonBagScreen.kt b/common/src/main/kotlin/com/cobblemon/mod/common/client/gui/bag/CobblemonBagScreen.kt index dd7979e1fc..6790c01b71 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/client/gui/bag/CobblemonBagScreen.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/client/gui/bag/CobblemonBagScreen.kt @@ -37,6 +37,7 @@ import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen import net.minecraft.client.resources.sounds.SimpleSoundInstance import net.minecraft.network.chat.Component import net.minecraft.sounds.SoundEvent +import net.minecraft.sounds.SoundEvents import net.minecraft.world.entity.player.Inventory import net.minecraft.world.inventory.ClickType import net.minecraft.world.inventory.Slot @@ -120,6 +121,8 @@ class CobblemonBagScreen( playSound(CobblemonSounds.GUI_CLICK) } }.also { addRenderableWidget(it) } + + playSound(SoundEvents.ARMOR_EQUIP_GENERIC.value()) } override fun renderBg(context: GuiGraphics, partialTick: Float, mouseX: Int, mouseY: Int) {} diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/client/render/layer/CobblemonBagRenderer.kt b/common/src/main/kotlin/com/cobblemon/mod/common/client/render/layer/CobblemonBagRenderer.kt new file mode 100644 index 0000000000..0266583d06 --- /dev/null +++ b/common/src/main/kotlin/com/cobblemon/mod/common/client/render/layer/CobblemonBagRenderer.kt @@ -0,0 +1,36 @@ +package com.cobblemon.mod.common.client.render.layer + +import com.cobblemon.mod.common.item.bag.CobblemonBagItem +import com.mojang.blaze3d.vertex.PoseStack +import net.minecraft.client.model.PlayerModel +import net.minecraft.client.renderer.MultiBufferSource +import net.minecraft.client.renderer.entity.RenderLayerParent +import net.minecraft.client.renderer.entity.layers.RenderLayer +import net.minecraft.world.entity.EquipmentSlot +import net.minecraft.world.entity.player.Player + +class CobblemonBagRenderer(renderLayerParent: RenderLayerParent>): RenderLayer>(renderLayerParent) { + override fun render( + poseStack: PoseStack, + bufferSource: MultiBufferSource, + packedLight: Int, + player: T, + limbSwing: Float, + limbSwingAmount: Float, + partialTick: Float, + ageInTicks: Float, + netHeadYaw: Float, + headPitch: Float + ) { + val bagItem = player.getItemBySlot(EquipmentSlot.CHEST) + if (bagItem.item !is CobblemonBagItem) return + + player.level().profiler.push("cobblemon_bag_render") + poseStack.pushPose() + + val model = + + poseStack.popPose() + player.level().profiler.pop() + } +} \ No newline at end of file diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/item/bag/CobblemonBagItem.kt b/common/src/main/kotlin/com/cobblemon/mod/common/item/bag/CobblemonBagItem.kt index 92517defa1..fef3e645a1 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/item/bag/CobblemonBagItem.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/item/bag/CobblemonBagItem.kt @@ -8,25 +8,20 @@ package com.cobblemon.mod.common.item.bag -import com.cobblemon.mod.common.Cobblemon import com.cobblemon.mod.common.item.CobblemonItem import net.minecraft.network.chat.Component -import net.minecraft.server.level.ServerPlayer import net.minecraft.world.InteractionHand import net.minecraft.world.InteractionResultHolder import net.minecraft.world.MenuProvider -import net.minecraft.world.SimpleContainer -import net.minecraft.world.SimpleMenuProvider +import net.minecraft.world.entity.EquipmentSlot import net.minecraft.world.entity.player.Inventory import net.minecraft.world.entity.player.Player import net.minecraft.world.inventory.AbstractContainerMenu -import net.minecraft.world.inventory.ChestMenu -import net.minecraft.world.inventory.MenuConstructor -import net.minecraft.world.item.Item +import net.minecraft.world.item.Equipable import net.minecraft.world.item.ItemStack import net.minecraft.world.level.Level -class CobblemonBagItem: CobblemonItem(Item.Properties().stacksTo(1)), MenuProvider { +class CobblemonBagItem: CobblemonItem(Properties().stacksTo(1)), MenuProvider, Equipable { override fun use(level: Level, player: Player, usedHand: InteractionHand): InteractionResultHolder { val itemStack = player.getItemInHand(usedHand) player.openMenu(this) @@ -43,4 +38,8 @@ class CobblemonBagItem: CobblemonItem(Item.Properties().stacksTo(1)), MenuProvid override fun getDisplayName(): Component? { return Component.translatable("cobblemon.container.bag") } + + override fun getEquipmentSlot(): EquipmentSlot = EquipmentSlot.CHEST + + fun get } \ No newline at end of file diff --git a/common/src/main/resources/assets/cobblemon/models/item/bag.json b/common/src/main/resources/assets/cobblemon/models/item/bag.json new file mode 100644 index 0000000000..9df0bf50a9 --- /dev/null +++ b/common/src/main/resources/assets/cobblemon/models/item/bag.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "cobblemon:item/evolution/dawn_stone" + } +} \ No newline at end of file diff --git a/common/src/main/resources/assets/cobblemon/models/item/bag/bag_penny.json b/common/src/main/resources/assets/cobblemon/models/item/bag/bag_penny.json new file mode 100644 index 0000000000..31f138427b --- /dev/null +++ b/common/src/main/resources/assets/cobblemon/models/item/bag/bag_penny.json @@ -0,0 +1,131 @@ +{ + "format_version": "1.9.0", + "credit": "Made with Blockbench", + "texture_size": [64, 64], + "textures": { + "texture": "cobblemon:item/bag/", + "particle": "block/bag_penny" + }, + "elements": [ + { + "name": "straps", + "from": [-4.35, 11.65, -2.35], + "to": [4.35, 24.35, 2.35], + "faces": { + "north": {"uv": [1, 1, 3, 4], "texture": "#texture"}, + "east": {"uv": [0, 1, 1, 4], "texture": "#texture"}, + "south": {"uv": [4, 1, 6, 4], "texture": "#texture"}, + "west": {"uv": [3, 1, 4, 4], "texture": "#texture"}, + "up": {"uv": [3, 1, 1, 0], "texture": "#texture"}, + "down": {"uv": [5, 0, 3, 1], "texture": "#texture"} + } + }, + { + "name": "bag", + "from": [-3.49, 19.01, 2.01], + "to": [3.49, 21.99, 4.99], + "rotation": {"angle": 0, "axis": "y", "origin": [-1.5, 19.5, 3.5]}, + "faces": { + "north": {"uv": [6.75, 2.5, 8.5, 3.25], "texture": "#texture"}, + "east": {"uv": [6, 2.5, 6.75, 3.25], "texture": "#texture"}, + "south": {"uv": [9.25, 2.5, 11, 3.25], "texture": "#texture"}, + "west": {"uv": [8.5, 2.5, 9.25, 3.25], "texture": "#texture"}, + "up": {"uv": [8.5, 2.5, 6.75, 1.75], "texture": "#texture"}, + "down": {"uv": [10.25, 1.75, 8.5, 2.5], "texture": "#texture"} + } + }, + { + "name": "bag", + "from": [-6.01, 21.99, 4.49], + "to": [6.01, 26.01, 4.51], + "rotation": {"angle": 22.5, "axis": "x", "origin": [0, 22, 4.5]}, + "faces": { + "north": {"uv": [7.5, 3.75, 10.5, 4.75], "texture": "#texture"}, + "east": {"uv": [7.5, 3.75, 7.5, 4.75], "texture": "#texture"}, + "south": {"uv": [10.5, 3.75, 13.5, 4.75], "texture": "#texture"}, + "west": {"uv": [10.5, 3.75, 10.5, 4.75], "texture": "#texture"}, + "up": {"uv": [10.5, 3.75, 7.5, 3.75], "texture": "#texture"}, + "down": {"uv": [13.5, 3.75, 10.5, 3.75], "texture": "#texture"} + } + }, + { + "name": "bag", + "from": [-3.49, 12.51, 2.01], + "to": [3.49, 16.49, 4.99], + "rotation": {"angle": 0, "axis": "y", "origin": [-1.5, 14, 3.5]}, + "faces": { + "north": {"uv": [6.75, 0.75, 8.5, 1.75], "texture": "#texture"}, + "east": {"uv": [6, 0.75, 6.75, 1.75], "texture": "#texture"}, + "south": {"uv": [9.25, 0.75, 11, 1.75], "texture": "#texture"}, + "west": {"uv": [8.5, 0.75, 9.25, 1.75], "texture": "#texture"}, + "up": {"uv": [8.5, 0.75, 6.75, 0], "texture": "#texture"}, + "down": {"uv": [10.25, 0, 8.5, 0.75], "texture": "#texture"} + } + }, + { + "name": "bag", + "from": [-3.01, 11.49, 3.99], + "to": [3.01, 12.51, 4.01], + "rotation": {"angle": 0, "axis": "y", "origin": [-1.5, 12, 3]}, + "faces": { + "north": {"uv": [6, 5, 7.5, 5.25], "texture": "#texture"}, + "east": {"uv": [6, 5, 6, 5.25], "texture": "#texture"}, + "south": {"uv": [7.5, 5, 9, 5.25], "texture": "#texture"}, + "west": {"uv": [7.5, 5, 7.5, 5.25], "texture": "#texture"}, + "up": {"uv": [7.5, 5, 6, 5], "texture": "#texture"}, + "down": {"uv": [9, 5, 7.5, 5], "texture": "#texture"} + } + }, + { + "name": "bag", + "from": [-2.01, 8.49, 2.99], + "to": [2.01, 12.51, 3.01], + "rotation": {"angle": 0, "axis": "y", "origin": [-1.5, 10, 2.5]}, + "faces": { + "north": {"uv": [6, 5.5, 7, 6.5], "texture": "#texture"}, + "east": {"uv": [6, 5.5, 6, 6.5], "texture": "#texture"}, + "south": {"uv": [7, 5.5, 8, 6.5], "texture": "#texture"}, + "west": {"uv": [7, 5.5, 7, 6.5], "texture": "#texture"}, + "up": {"uv": [7, 5.5, 6, 5.5], "texture": "#texture"}, + "down": {"uv": [8, 5.5, 7, 5.5], "texture": "#texture"} + } + }, + { + "name": "bag", + "from": [-3.99, 16.01, 1.51], + "to": [3.99, 18.99, 5.49], + "rotation": {"angle": 0, "axis": "y", "origin": [-1.5, 16.5, 3]}, + "faces": { + "north": {"uv": [1, 5, 3, 5.75], "texture": "#texture"}, + "east": {"uv": [0, 5, 1, 5.75], "texture": "#texture"}, + "south": {"uv": [4, 5, 6, 5.75], "texture": "#texture"}, + "west": {"uv": [3, 5, 4, 5.75], "texture": "#texture"}, + "up": {"uv": [3, 5, 1, 4], "texture": "#texture"}, + "down": {"uv": [5, 4, 3, 5], "texture": "#texture"} + } + }, + { + "name": "bag", + "from": [-4.2, 15.8, 1.3], + "to": [4.2, 19.2, 5.7], + "rotation": {"angle": 0, "axis": "y", "origin": [-1.5, 16.5, 3]}, + "faces": { + "north": {"uv": [1, 6.75, 3, 7.5], "texture": "#texture"}, + "east": {"uv": [0, 6.75, 1, 7.5], "texture": "#texture"}, + "south": {"uv": [4, 6.75, 6, 7.5], "texture": "#texture"}, + "west": {"uv": [3, 6.75, 4, 7.5], "texture": "#texture"}, + "up": {"uv": [3, 6.75, 1, 5.75], "texture": "#texture"}, + "down": {"uv": [5, 5.75, 3, 6.75], "texture": "#texture"} + } + } + ], + "groups": [ + { + "name": "bag", + "origin": [0, 0, 0], + "scope": 0, + "color": 0, + "children": [0, 1, 2, 3, 4, 5, 6, 7] + } + ] +} \ No newline at end of file