forked from mirrors/cobblemon
Compare commits
20
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d8c3df1ab | ||
|
|
ca8ae8f999 | ||
|
|
d902e4dbab | ||
|
|
001efd86f3 | ||
|
|
1f2b6173d4 | ||
|
|
e4844c18fb | ||
|
|
2305a1792d | ||
|
|
cf0a6d17e0 | ||
|
|
6148b58fdc | ||
|
|
1e4936aeac | ||
|
|
15ea72e777 | ||
|
|
3c3d4e4552 | ||
|
|
796e416578 | ||
|
|
7608dfde94 | ||
|
|
b2b871617a | ||
|
|
bc4c8d13b7 | ||
|
|
0f9c51f7dd | ||
|
|
2c2623e0f9 | ||
|
|
8ec85e7d2f | ||
|
|
7af9b0854a |
+7
-1
@@ -302,6 +302,11 @@
|
||||
- Restored Ninjask's ability to do barrel rolls
|
||||
- Fixed a crash caused by adding enchanted items to the Resurrection Machine
|
||||
- Fixed a crash that could occur when starting a PvN battle with only fainted Pokémon.
|
||||
- Fixed the Remember Riding Camera config not being respected when dismounting and resolved the incompatibility with the Auto Third Person mod
|
||||
- Fixed Full Heal block not dropping Full Heals
|
||||
- Fixed status cure items not returning an empty bottle when used
|
||||
- Fixed Panpour consuming its held item when evolving with a Water Stone
|
||||
- Fixed Smoked Tail Curry returning a Wooden Bowl when consumed despite it not being included in the recipe
|
||||
|
||||
### Fixes
|
||||
- Fixed Croagunk's walkspeed
|
||||
@@ -362,7 +367,8 @@
|
||||
- Separated all the functions of MoLangFunctions.kt into their own files.
|
||||
- Spawn buckets and their base weights are now provided by the spawner, with different base weights for world, fishing, snack, and habitat spawn buckets.
|
||||
- Removed "SpawnBucket" class in favour of just storing maps of bucket names to weights.
|
||||
- Fixed nicknames not being applied to Pokémon spawned from `spawn_pool_world` files
|
||||
- Fixed nicknames not being applied to Pokémon spawned from `spawn_pool_world` files.
|
||||
- Added support for `profilePokedexScale`, `profilePokedexTranslation`, `profileSummaryScale`, and `profileSummaryTranslation` in poser files for finer control over profile displays.
|
||||
|
||||
### Molang & Datapacks
|
||||
- Added `moveset_builders` datapack folder for different styles of movesets.
|
||||
|
||||
@@ -10,11 +10,13 @@ package com.cobblemon.mod.common.mixin.client;
|
||||
|
||||
import com.cobblemon.mod.common.OrientationControllable;
|
||||
import com.cobblemon.mod.common.client.render.player.MountedPlayerRenderer;
|
||||
import com.cobblemon.mod.common.client.render.player.RecallArmAnimationTracker;
|
||||
import com.cobblemon.mod.common.duck.RidePassenger;
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity;
|
||||
import net.minecraft.client.model.HumanoidModel;
|
||||
import net.minecraft.client.model.geom.ModelPart;
|
||||
import net.minecraft.client.player.AbstractClientPlayer;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
@@ -96,4 +98,26 @@ public class HumanoidModelMixin {
|
||||
MountedPlayerRenderer.INSTANCE.animate((HumanoidModel<AbstractClientPlayer>)(Object)this, pokemonEntity, player, netHeadYaw, headPitch, ageInTicks, limbSwing, limbSwingAmount);
|
||||
}
|
||||
}
|
||||
|
||||
// Pose the right arm forward while recalling so the held Poké Ball sits out in front.
|
||||
@Inject(method = "setupAnim*", at = @At("TAIL"))
|
||||
public void cobblemon$poseRecallArm(
|
||||
LivingEntity entity,
|
||||
float limbSwing,
|
||||
float limbSwingAmount,
|
||||
float ageInTicks,
|
||||
float netHeadYaw,
|
||||
float headPitch,
|
||||
CallbackInfo ci
|
||||
) {
|
||||
if (!(entity instanceof AbstractClientPlayer player)) return;
|
||||
// Skip while riding so we don't override the mounted-riding arm animation.
|
||||
if (entity.getVehicle() instanceof PokemonEntity) return;
|
||||
float raise = RecallArmAnimationTracker.INSTANCE.raiseFactor(player.getUUID());
|
||||
if (raise <= 0f) return;
|
||||
float armForwardXRot = (float) (-Math.PI / 2.0);
|
||||
this.rightArm.xRot = Mth.lerp(raise, this.rightArm.xRot, armForwardXRot);
|
||||
this.rightArm.yRot = Mth.lerp(raise, this.rightArm.yRot, 0f);
|
||||
this.rightArm.zRot = Mth.lerp(raise, this.rightArm.zRot, 0f);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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.mixin.client;
|
||||
|
||||
import com.cobblemon.mod.common.client.render.player.RecallArmAnimationTracker;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.entity.layers.ItemInHandLayer;
|
||||
import net.minecraft.world.entity.HumanoidArm;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Hides the player's right-hand item while recalling so it doesn't overlap the recall Poké Ball
|
||||
* drawn by PlayerRecallBallRenderer.
|
||||
*/
|
||||
@Mixin(ItemInHandLayer.class)
|
||||
public class ItemInHandLayerMixin {
|
||||
@Inject(method = "renderArmWithItem", at = @At("HEAD"), cancellable = true)
|
||||
private void cobblemon$hideRecallHandItem(
|
||||
LivingEntity entity,
|
||||
ItemStack itemStack,
|
||||
ItemDisplayContext itemDisplayContext,
|
||||
HumanoidArm humanoidArm,
|
||||
PoseStack poseStack,
|
||||
MultiBufferSource multiBufferSource,
|
||||
int light,
|
||||
CallbackInfo ci
|
||||
) {
|
||||
if (humanoidArm == HumanoidArm.RIGHT && RecallArmAnimationTracker.INSTANCE.isRecalling(entity.getUUID())) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -9,6 +9,8 @@
|
||||
package com.cobblemon.mod.common.mixin.client;
|
||||
|
||||
import com.cobblemon.mod.common.OrientationControllable;
|
||||
import com.cobblemon.mod.common.client.render.player.FirstPersonRecallBallRenderer;
|
||||
import com.cobblemon.mod.common.client.render.player.RecallArmAnimationTracker;
|
||||
import com.cobblemon.mod.common.item.PokedexItem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -31,6 +33,12 @@ public class ItemInHandRendererMixin {
|
||||
if (abstractClientPlayer.isUsingItem() && abstractClientPlayer.getUseItem().getItem() instanceof PokedexItem) {
|
||||
ci.cancel();
|
||||
}
|
||||
// While recalling, swap the main-hand item for the rising Poké Ball.
|
||||
else if (interactionHand == InteractionHand.MAIN_HAND
|
||||
&& RecallArmAnimationTracker.INSTANCE.isRecalling(abstractClientPlayer.getUUID())
|
||||
&& FirstPersonRecallBallRenderer.INSTANCE.render(poseStack, multiBufferSource, j, f)) {
|
||||
ci.cancel();
|
||||
}
|
||||
else if (abstractClientPlayer instanceof OrientationControllable controllable && controllable.getOrientationController().isActive()) {
|
||||
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField
|
||||
val BIG_MALASADA = regionalFoodItem("big_malasada", 64, 7, 0.3f, false)
|
||||
@JvmField
|
||||
val SMOKED_TAIL_CURRY = regionalFoodItem("smoked_tail_curry", 64, 10, 0.6f, false, ItemStack(Items.BOWL, 1))
|
||||
val SMOKED_TAIL_CURRY = regionalFoodItem("smoked_tail_curry", 64, 10, 0.6f, false)
|
||||
@JvmField
|
||||
val JUBILIFE_MUFFIN = regionalFoodItem("jubilife_muffin", 64, 7, 0.3f, false)
|
||||
@JvmField
|
||||
|
||||
@@ -44,6 +44,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.PlayerRecallBallRenderer
|
||||
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
|
||||
@@ -405,8 +406,10 @@ object CobblemonClient {
|
||||
var renderer: LivingEntityRenderer<Player, PlayerModel<Player>>? =
|
||||
skinMap?.get(PlayerSkin.Model.WIDE) as LivingEntityRenderer<Player, PlayerModel<Player>>
|
||||
renderer?.addLayer(PokemonOnShoulderRenderer(renderer))
|
||||
renderer?.addLayer(PlayerRecallBallRenderer(renderer))
|
||||
renderer = skinMap[PlayerSkin.Model.SLIM] as LivingEntityRenderer<Player, PlayerModel<Player>>?
|
||||
renderer?.addLayer(PokemonOnShoulderRenderer(renderer))
|
||||
renderer?.addLayer(PlayerRecallBallRenderer(renderer))
|
||||
}
|
||||
|
||||
private fun registerMenuScreens() {
|
||||
|
||||
@@ -49,7 +49,7 @@ object MountedCameraTypeHandler {
|
||||
return
|
||||
}
|
||||
val currentCameraType = mc.options.cameraType
|
||||
if (currentCameraType != unmountedCameraType) {
|
||||
if (Cobblemon.config.rememberRidingCamera && currentCameraType != unmountedCameraType) {
|
||||
mc.options.cameraType = unmountedCameraType
|
||||
}
|
||||
val data = ClientPersistedData.ridingPerspectives
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.cobblemon.mod.common.client.render.models.blockbench.PosableState
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.ActiveAnimation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.PrimaryAnimation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.VaryingModelRepository
|
||||
import com.cobblemon.mod.common.client.render.player.RecallArmAnimationTracker
|
||||
import com.cobblemon.mod.common.client.render.pokemon.PokemonRenderer.Companion.ease
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import com.cobblemon.mod.common.net.messages.server.pokemon.update.ServerboundUpdateRidingStatePacket
|
||||
@@ -320,6 +321,13 @@ class PokemonClientDelegate : PosableState(), PokemonSideDelegate {
|
||||
ballOffset = 0f
|
||||
ballRotOffset = 0f
|
||||
sendOutPosition = null
|
||||
// If a player is recalling, have them hold the matching Poké Ball out in their
|
||||
// right hand for the duration of the beam (see ourRecallArmAnimationTracker class).
|
||||
currentEntity.ownerUUID?.let { ownerId ->
|
||||
if (currentEntity.level().getPlayerByUUID(ownerId) != null) {
|
||||
RecallArmAnimationTracker.start(ownerId, currentEntity.exposedBall, emptySet())
|
||||
}
|
||||
}
|
||||
afterOnClient(seconds = BEAM_EXTEND_TIME) {
|
||||
activeSendoutScale = 1F
|
||||
|
||||
|
||||
@@ -27,10 +27,18 @@ import net.minecraft.client.renderer.RenderType
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.util.Mth
|
||||
import net.minecraft.world.phys.Vec3
|
||||
import org.joml.Quaternionf
|
||||
import org.joml.Vector3f
|
||||
import kotlin.math.atan
|
||||
|
||||
enum class ProfileTransformType {
|
||||
PROFILE,
|
||||
NONE,
|
||||
POKEDEX,
|
||||
SUMMARY,
|
||||
}
|
||||
|
||||
fun drawProfilePokemon(
|
||||
renderablePokemon: RenderablePokemon,
|
||||
matrixStack: PoseStack,
|
||||
@@ -39,7 +47,7 @@ fun drawProfilePokemon(
|
||||
state: PosableState,
|
||||
partialTicks: Float,
|
||||
scale: Float = 20F,
|
||||
applyProfileTransform: Boolean = true,
|
||||
profileTransformType: ProfileTransformType = ProfileTransformType.PROFILE,
|
||||
applyBaseScale: Boolean = false,
|
||||
r: Float = 1F,
|
||||
g: Float = 1F,
|
||||
@@ -56,7 +64,7 @@ fun drawProfilePokemon(
|
||||
state = state.also { it.currentAspects = renderablePokemon.aspects },
|
||||
partialTicks = partialTicks,
|
||||
scale = scale,
|
||||
applyProfileTransform = applyProfileTransform,
|
||||
profileTransformType = profileTransformType,
|
||||
applyBaseScale = applyBaseScale,
|
||||
r = r,
|
||||
g = g,
|
||||
@@ -75,7 +83,7 @@ fun drawProfilePokemon(
|
||||
state: PosableState,
|
||||
partialTicks: Float,
|
||||
scale: Float = 20F,
|
||||
applyProfileTransform: Boolean = true,
|
||||
profileTransformType: ProfileTransformType = ProfileTransformType.PROFILE,
|
||||
applyBaseScale: Boolean = false,
|
||||
doQuirks: Boolean = false,
|
||||
r: Float = 1F,
|
||||
@@ -114,18 +122,38 @@ fun drawProfilePokemon(
|
||||
state.setPoseToFirstSuitable(poseType)
|
||||
state.updatePartialTicks(partialTicks)
|
||||
|
||||
if (applyProfileTransform) {
|
||||
matrixStack.translate(
|
||||
model.profileTranslation.x,
|
||||
model.profileTranslation.y + 1.5 * model.profileScale,
|
||||
model.profileTranslation.z - 4.0
|
||||
)
|
||||
matrixStack.scale(model.profileScale, model.profileScale, 1 / model.profileScale)} else {
|
||||
if (profileTransformType == ProfileTransformType.NONE) {
|
||||
matrixStack.translate(0F, 0F, -4.0F)
|
||||
if (applyBaseScale) {
|
||||
matrixStack.scale(baseScale, baseScale, 1 / baseScale)
|
||||
}
|
||||
} else {
|
||||
var profileScale: Float
|
||||
var profileTranslation: Vec3
|
||||
|
||||
when (profileTransformType) {
|
||||
ProfileTransformType.POKEDEX -> {
|
||||
profileScale = model.profilePokedexScale ?: model.profileScale
|
||||
profileTranslation = model.profilePokedexTranslation ?: model.profileTranslation
|
||||
}
|
||||
ProfileTransformType.SUMMARY -> {
|
||||
profileScale = model.profileSummaryScale ?: model.profileScale
|
||||
profileTranslation = model.profileSummaryTranslation ?: model.profileTranslation
|
||||
}
|
||||
else -> {
|
||||
profileScale = model.profileScale
|
||||
profileTranslation = model.profileTranslation
|
||||
}
|
||||
}
|
||||
|
||||
matrixStack.translate(
|
||||
profileTranslation.x,
|
||||
profileTranslation.y + 1.5 * profileScale,
|
||||
profileTranslation.z - 4.0
|
||||
)
|
||||
matrixStack.scale(profileScale, profileScale, 1 / profileScale)
|
||||
}
|
||||
|
||||
matrixStack.mulPose(rotation)
|
||||
|
||||
model.applyAnimations(null, state, 0F, 0F, 0F, headYaw, headPitch)
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* 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.gui
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.FloatingState
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.VaryingModelRepository
|
||||
import com.mojang.blaze3d.platform.InputConstants
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.world.phys.Vec3
|
||||
|
||||
fun handleProfileDebugKeys(keyCode: Int, poserResourceLocation: ResourceLocation, state: FloatingState) {
|
||||
if (!Cobblemon.config.enableDebugKeys) {
|
||||
return
|
||||
}
|
||||
val model = VaryingModelRepository.getPoser(poserResourceLocation, state)
|
||||
|
||||
val delta = when (keyCode) {
|
||||
InputConstants.KEY_UP -> Vec3(0.0, -0.01, 0.0)
|
||||
InputConstants.KEY_DOWN -> Vec3(0.0, 0.01, 0.0)
|
||||
InputConstants.KEY_LEFT -> Vec3(-0.01, 0.0, 0.0)
|
||||
InputConstants.KEY_RIGHT -> Vec3(0.01, 0.0, 0.0)
|
||||
else -> null
|
||||
}
|
||||
|
||||
if (delta != null) {
|
||||
model.profileTranslation = model.profileTranslation.add(delta)
|
||||
model.profileSummaryTranslation = model.profileSummaryTranslation?.add(delta)
|
||||
model.profilePokedexTranslation = model.profilePokedexTranslation?.add(delta)
|
||||
}
|
||||
|
||||
val scaleDelta = when (keyCode) {
|
||||
InputConstants.KEY_EQUALS -> 0.01F
|
||||
InputConstants.KEY_MINUS -> -0.01F
|
||||
else -> null
|
||||
}
|
||||
|
||||
if (scaleDelta != null) {
|
||||
model.profileScale += scaleDelta
|
||||
model.profileSummaryScale = model.profileSummaryScale?.plus(scaleDelta)
|
||||
model.profilePokedexScale = model.profilePokedexScale?.plus(scaleDelta)
|
||||
}
|
||||
}
|
||||
|
||||
fun logProfileTranslations(poserResourceLocation: ResourceLocation, state: FloatingState) {
|
||||
if (!Cobblemon.config.enableDebugKeys) {
|
||||
return
|
||||
}
|
||||
|
||||
val model = VaryingModelRepository.getPoser(poserResourceLocation, state)
|
||||
val player = Minecraft.getInstance().player
|
||||
|
||||
fun Double.f2() = "%.2f".format(this)
|
||||
fun Float.f2() = "%.2f".format(this)
|
||||
|
||||
fun sendTranslation(name: String, translation: Vec3) {
|
||||
player?.sendSystemMessage(Component.literal("$name Translation: (${translation.x.f2()}, ${translation.y.f2()}, ${translation.z.f2()})"))
|
||||
}
|
||||
|
||||
fun sendScale(name: String, scale: Float) {
|
||||
player?.sendSystemMessage(Component.literal("$name Scale: ${scale.f2()}"))
|
||||
}
|
||||
|
||||
fun logTranslation(name: String, translation: Vec3) {
|
||||
Cobblemon.LOGGER.info("override var ${name.replaceFirstChar(Char::lowercase)}Translation = Vec3(${translation.x.f2()}, ${translation.y.f2()}, ${translation.z.f2()})")
|
||||
}
|
||||
|
||||
fun logScale(name: String, scale: Float) {
|
||||
Cobblemon.LOGGER.info("override var ${name.replaceFirstChar(Char::lowercase)}Scale = ${scale.f2()}F")
|
||||
}
|
||||
|
||||
sendTranslation("Profile", model.profileTranslation)
|
||||
sendScale("Profile", model.profileScale)
|
||||
|
||||
model.profileSummaryTranslation?.let { sendTranslation("Summary Profile", it) }
|
||||
model.profileSummaryScale?.let { sendScale("Summary Profile", it) }
|
||||
|
||||
model.profilePokedexTranslation?.let { sendTranslation("Pokedex Profile", it) }
|
||||
model.profilePokedexScale?.let { sendScale("Pokedex Profile", it) }
|
||||
|
||||
logTranslation("Profile", model.profileTranslation)
|
||||
logScale("Profile", model.profileScale)
|
||||
|
||||
model.profileSummaryTranslation?.let { logTranslation("ProfileSummary", it) }
|
||||
model.profileSummaryScale?.let { logScale("ProfileSummary", it) }
|
||||
|
||||
model.profilePokedexTranslation?.let { logTranslation("ProfilePokedex", it) }
|
||||
model.profilePokedexScale?.let { logScale("ProfilePokedex", it) }
|
||||
}
|
||||
@@ -32,6 +32,8 @@ import com.cobblemon.mod.common.client.ClientMoLangFunctions.setupClient
|
||||
import com.cobblemon.mod.common.client.CobblemonClient
|
||||
import com.cobblemon.mod.common.client.CobblemonResources
|
||||
import com.cobblemon.mod.common.client.gui.CobblemonRenderable
|
||||
import com.cobblemon.mod.common.client.gui.handleProfileDebugKeys
|
||||
import com.cobblemon.mod.common.client.gui.logProfileTranslations
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.PokedexGUIConstants.BASE_HEIGHT
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.PokedexGUIConstants.BASE_WIDTH
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.PokedexGUIConstants.HALF_OVERLAY_WIDTH
|
||||
@@ -427,6 +429,11 @@ class PokedexGUI private constructor(
|
||||
override fun onClose() {
|
||||
if (blockPos != null) AdjustBlockEntityViewerCountPacket(blockPos, false).sendToServer()
|
||||
playSound(CobblemonSounds.POKEDEX_CLOSE)
|
||||
|
||||
selectedEntry?.speciesId?.let { speciesId ->
|
||||
logProfileTranslations(speciesId, pokemonInfoWidget.state)
|
||||
}
|
||||
|
||||
super.onClose()
|
||||
}
|
||||
|
||||
@@ -757,6 +764,12 @@ class PokedexGUI private constructor(
|
||||
return true
|
||||
}
|
||||
|
||||
if (!searchWidget.isFocused) {
|
||||
selectedEntry?.speciesId?.let { speciesId ->
|
||||
handleProfileDebugKeys(keyCode, speciesId, pokemonInfoWidget.state)
|
||||
}
|
||||
}
|
||||
|
||||
return super.keyPressed(keyCode, scanCode, modifiers)
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -22,6 +22,7 @@ import com.cobblemon.mod.common.api.types.ElementalType
|
||||
import com.cobblemon.mod.common.client.ClientMoLangFunctions.setupClient
|
||||
import com.cobblemon.mod.common.client.CobblemonClient
|
||||
import com.cobblemon.mod.common.client.CobblemonResources
|
||||
import com.cobblemon.mod.common.client.gui.ProfileTransformType
|
||||
import com.cobblemon.mod.common.client.gui.TypeIcon
|
||||
import com.cobblemon.mod.common.client.gui.drawProfilePokemon
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.PokedexGUIConstants.HALF_OVERLAY_HEIGHT
|
||||
@@ -386,7 +387,8 @@ class PokemonInfoWidget(val pX: Int, val pY: Int, val updateForm: (PokedexForm)
|
||||
partialTicks = delta,
|
||||
rotation = Quaternionf().fromEulerXYZDegrees(rotationVector),
|
||||
state = state,
|
||||
blockLight = 15
|
||||
blockLight = 15,
|
||||
profileTransformType = ProfileTransformType.POKEDEX,
|
||||
)
|
||||
|
||||
matrices.popPose()
|
||||
|
||||
+2
-1
@@ -11,6 +11,7 @@ package com.cobblemon.mod.common.client.gui.pokedex.widgets
|
||||
import com.cobblemon.mod.common.api.gui.blitk
|
||||
import com.cobblemon.mod.common.api.text.bold
|
||||
import com.cobblemon.mod.common.client.CobblemonResources
|
||||
import com.cobblemon.mod.common.client.gui.ProfileTransformType
|
||||
import com.cobblemon.mod.common.client.gui.drawProfilePokemon
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.PokedexGUIConstants.HALF_OVERLAY_WIDTH
|
||||
import com.cobblemon.mod.common.client.gui.pokedex.PokedexGUIConstants.POKEMON_DESCRIPTION_HEIGHT
|
||||
@@ -90,7 +91,7 @@ class SizeWidget(val pX: Int, val pY: Int) : SoundlessWidget(
|
||||
rotation = Quaternionf().fromEulerXYZDegrees(Vector3f(0F, 0F, 0F)),
|
||||
state = FloatingState(),
|
||||
scale = modelScale,
|
||||
applyProfileTransform = false,
|
||||
profileTransformType = ProfileTransformType.NONE,
|
||||
applyBaseScale = true,
|
||||
r = 0F,
|
||||
g = 0F,
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
package com.cobblemon.mod.common.client.gui.summary
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.CobblemonItems
|
||||
import com.cobblemon.mod.common.CobblemonNetwork.sendToServer
|
||||
import com.cobblemon.mod.common.CobblemonSounds
|
||||
@@ -21,14 +20,8 @@ import com.cobblemon.mod.common.api.text.bold
|
||||
import com.cobblemon.mod.common.api.text.text
|
||||
import com.cobblemon.mod.common.client.CobblemonClient
|
||||
import com.cobblemon.mod.common.client.CobblemonResources
|
||||
import com.cobblemon.mod.common.client.gui.CobblemonRenderable
|
||||
import com.cobblemon.mod.common.client.gui.ExitButton
|
||||
import com.cobblemon.mod.common.client.gui.TypeIcon
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.EvolutionSelectScreen
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.MarkingsWidget
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.ModelWidget
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.NicknameEntryWidget
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.PartyWidget
|
||||
import com.cobblemon.mod.common.client.gui.*
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.*
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.screens.SummaryTab
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.screens.info.InfoWidget
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.screens.marks.MarksWidget
|
||||
@@ -37,7 +30,6 @@ import com.cobblemon.mod.common.client.gui.summary.widgets.screens.moves.MovesWi
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.screens.stats.StatWidget
|
||||
import com.cobblemon.mod.common.client.keybind.keybinds.SummaryBinding
|
||||
import com.cobblemon.mod.common.client.render.drawScaledText
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.VaryingModelRepository
|
||||
import com.cobblemon.mod.common.net.messages.server.pokemon.update.SetItemHiddenPacket
|
||||
import com.cobblemon.mod.common.net.messages.server.storage.party.MovePartyPokemonPacket
|
||||
import com.cobblemon.mod.common.net.messages.server.storage.party.SwapPartyPokemonPacket
|
||||
@@ -715,27 +707,9 @@ class Summary private constructor(party: Collection<Pokemon?>, private val edita
|
||||
) {
|
||||
this.focused = null
|
||||
}
|
||||
if (Cobblemon.config.enableDebugKeys) {
|
||||
val model = VaryingModelRepository.getPoser(selectedPokemon.species.resourceIdentifier, modelWidget.state)
|
||||
if (keyCode == InputConstants.KEY_UP) {
|
||||
model.profileTranslation = model.profileTranslation.add(0.0, -0.01, 0.0)
|
||||
}
|
||||
if (keyCode == InputConstants.KEY_DOWN) {
|
||||
model.profileTranslation = model.profileTranslation.add(0.0, 0.01, 0.0)
|
||||
}
|
||||
if (keyCode == InputConstants.KEY_LEFT) {
|
||||
model.profileTranslation = model.profileTranslation.add(-0.01, 0.0, 0.0)
|
||||
}
|
||||
if (keyCode == InputConstants.KEY_RIGHT) {
|
||||
model.profileTranslation = model.profileTranslation.add(0.01, 0.0, 0.0)
|
||||
}
|
||||
if (keyCode == InputConstants.KEY_EQUALS) {
|
||||
model.profileScale += 0.01F
|
||||
}
|
||||
if (keyCode == InputConstants.KEY_MINUS) {
|
||||
model.profileScale -= 0.01F
|
||||
}
|
||||
}
|
||||
|
||||
handleProfileDebugKeys(keyCode, selectedPokemon.species.resourceIdentifier, modelWidget.state)
|
||||
|
||||
return super.keyPressed(keyCode, scanCode, modifiers)
|
||||
}
|
||||
|
||||
@@ -744,13 +718,8 @@ class Summary private constructor(party: Collection<Pokemon?>, private val edita
|
||||
}
|
||||
|
||||
override fun onClose() {
|
||||
if (Cobblemon.config.enableDebugKeys) {
|
||||
val model = VaryingModelRepository.getPoser(selectedPokemon.species.resourceIdentifier, modelWidget.state)
|
||||
Minecraft.getInstance().player?.sendSystemMessage(Component.literal("Profile Translation: ${model.profileTranslation}"))
|
||||
Minecraft.getInstance().player?.sendSystemMessage(Component.literal("Profile Scale: ${model.profileScale}"))
|
||||
Cobblemon.LOGGER.info("override var profileTranslation = Vec3d(${model.profileTranslation.x}, ${model.profileTranslation.y}, ${model.profileTranslation.z})")
|
||||
Cobblemon.LOGGER.info("override var profileScale = ${model.profileScale}F")
|
||||
}
|
||||
logProfileTranslations(selectedPokemon.species.resourceIdentifier, modelWidget.state)
|
||||
|
||||
super.onClose()
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -11,6 +11,7 @@ package com.cobblemon.mod.common.client.gui.summary.widgets
|
||||
import com.bedrockk.molang.runtime.value.DoubleValue
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.api.tags.CobblemonItemTags
|
||||
import com.cobblemon.mod.common.client.gui.ProfileTransformType
|
||||
import com.cobblemon.mod.common.client.gui.drawProfilePokemon
|
||||
import com.cobblemon.mod.common.client.gui.calculateHeadYawAndPitch
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.FloatingState
|
||||
@@ -116,7 +117,8 @@ class ModelWidget(
|
||||
partialTicks = partialTicks,
|
||||
headYaw = currentYawAndPitch.first,
|
||||
headPitch = currentYawAndPitch.second,
|
||||
blockLight = blockLight
|
||||
blockLight = blockLight,
|
||||
profileTransformType = ProfileTransformType.SUMMARY,
|
||||
)
|
||||
|
||||
heldItemRenderer.renderOnModel(
|
||||
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* 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.layer
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.RenderContext
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.VaryingModelRepository
|
||||
import com.cobblemon.mod.common.client.render.player.RecallArmAnimationTracker
|
||||
import com.mojang.blaze3d.vertex.PoseStack
|
||||
import com.mojang.math.Axis
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.model.PlayerModel
|
||||
import net.minecraft.client.renderer.MultiBufferSource
|
||||
import net.minecraft.client.renderer.RenderType
|
||||
import net.minecraft.client.renderer.entity.ItemRenderer
|
||||
import net.minecraft.client.renderer.entity.RenderLayerParent
|
||||
import net.minecraft.client.renderer.entity.layers.RenderLayer
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture
|
||||
import net.minecraft.world.entity.HumanoidArm
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.phys.Vec3
|
||||
import org.joml.Vector3f
|
||||
|
||||
/**
|
||||
* Draws the matching Poké Ball in a recalling player's right hand and records where the recall beam
|
||||
* should start. Driven by [RecallArmAnimationTracker]; the right arm is posed forward in
|
||||
* HumanoidModelMixin so [PlayerModel.translateToHand] lands on the extended hand.
|
||||
*
|
||||
* The local player in first person is handled by FirstPersonRecallBallRenderer instead, so it's
|
||||
* skipped here.
|
||||
*/
|
||||
class PlayerRecallBallRenderer<T : Player>(
|
||||
renderLayerParent: RenderLayerParent<T, PlayerModel<T>>
|
||||
) : RenderLayer<T, PlayerModel<T>>(renderLayerParent) {
|
||||
|
||||
companion object {
|
||||
private const val BALL_SCALE = 0.5F
|
||||
|
||||
private const val HAND_X = 0.0625
|
||||
private const val HAND_Y = 0.125
|
||||
private const val HAND_Z = -0.625
|
||||
|
||||
private const val BALL_YAW_SPIN = 180F
|
||||
private const val BALL_INFLATE = 1.08F
|
||||
|
||||
private const val BEAM_X_OFFSET = 0F
|
||||
private const val BEAM_Y_OFFSET = 0.18F
|
||||
private const val BEAM_Z_OFFSET = -0.30F
|
||||
}
|
||||
|
||||
private val ballContext = RenderContext().also {
|
||||
it.put(RenderContext.RENDER_STATE, RenderContext.RenderState.WORLD)
|
||||
}
|
||||
|
||||
override fun render(
|
||||
matrixStack: PoseStack,
|
||||
buffer: MultiBufferSource,
|
||||
packedLight: Int,
|
||||
player: T,
|
||||
limbSwing: Float,
|
||||
limbSwingAmount: Float,
|
||||
partialTicks: Float,
|
||||
ageInTicks: Float,
|
||||
netHeadYaw: Float,
|
||||
headPitch: Float
|
||||
) {
|
||||
val anim = RecallArmAnimationTracker.get(player.uuid) ?: return
|
||||
val mc = Minecraft.getInstance()
|
||||
if (player === mc.player && mc.options.cameraType.isFirstPerson) return
|
||||
|
||||
matrixStack.pushPose()
|
||||
getParentModel().translateToHand(HumanoidArm.RIGHT, matrixStack)
|
||||
matrixStack.mulPose(Axis.XP.rotationDegrees(-90F))
|
||||
matrixStack.mulPose(Axis.YP.rotationDegrees(180F))
|
||||
matrixStack.translate(HAND_X, HAND_Y, HAND_Z)
|
||||
|
||||
renderBall(anim, matrixStack, buffer, packedLight, partialTicks)
|
||||
|
||||
matrixStack.popPose()
|
||||
}
|
||||
|
||||
private fun renderBall(
|
||||
anim: RecallArmAnimationTracker.RecallAnim,
|
||||
matrixStack: PoseStack,
|
||||
buffer: MultiBufferSource,
|
||||
packedLight: Int,
|
||||
partialTicks: Float
|
||||
) {
|
||||
val state = anim.ballState
|
||||
val ball = anim.ball
|
||||
matrixStack.pushPose()
|
||||
matrixStack.scale(BALL_INFLATE, BALL_INFLATE, BALL_INFLATE)
|
||||
matrixStack.translate(0.0, (-8.0 / 16.0) * BALL_SCALE, 0.0)
|
||||
matrixStack.scale(BALL_SCALE, -BALL_SCALE, -BALL_SCALE)
|
||||
matrixStack.mulPose(Axis.YP.rotationDegrees(BALL_YAW_SPIN))
|
||||
|
||||
val model = VaryingModelRepository.getPoser(ball.name, state)
|
||||
val texture = VaryingModelRepository.getTexture(ball.name, state)
|
||||
state.updatePartialTicks(partialTicks)
|
||||
model.context = ballContext
|
||||
ballContext.put(RenderContext.ASPECTS, state.aspects)
|
||||
ballContext.put(RenderContext.POSABLE_STATE, state)
|
||||
|
||||
model.applyAnimations(null, state, 0F, 0F, 0F, 0F, 0F)
|
||||
|
||||
state.locatorStates["beam"]?.let { beamLocator ->
|
||||
matrixStack.pushPose()
|
||||
matrixStack.mulPose(beamLocator.matrix)
|
||||
val camRelative = matrixStack.last().pose().transformPosition(Vector3f(BEAM_X_OFFSET, BEAM_Y_OFFSET, BEAM_Z_OFFSET))
|
||||
matrixStack.popPose()
|
||||
val camera = Minecraft.getInstance().gameRenderer.mainCamera.position
|
||||
anim.beamOrigin = Vec3(camera.x + camRelative.x, camera.y + camRelative.y, camera.z + camRelative.z)
|
||||
}
|
||||
val consumer = ItemRenderer.getFoilBufferDirect(buffer, RenderType.entityCutout(texture), false, false)
|
||||
model.render(ballContext, matrixStack, consumer, packedLight, OverlayTexture.NO_OVERLAY, -0x1)
|
||||
model.red = 1F
|
||||
model.green = 1F
|
||||
model.blue = 1F
|
||||
model.resetLayerContext()
|
||||
matrixStack.popPose()
|
||||
}
|
||||
}
|
||||
+5
@@ -134,6 +134,11 @@ open class PosableModel(@Transient override val rootPart: Bone) : ModelFrame {
|
||||
*/
|
||||
open var profileTranslation = Vec3(0.0, 0.0, 0.0)
|
||||
|
||||
open var profilePokedexScale: Float? = null
|
||||
open var profilePokedexTranslation: Vec3? = null
|
||||
open var profileSummaryScale: Float? = null
|
||||
open var profileSummaryTranslation: Vec3? = null
|
||||
|
||||
var red = 1F
|
||||
var green = 1F
|
||||
var blue = 1F
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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.player
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.RenderContext
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.VaryingModelRepository
|
||||
import com.mojang.blaze3d.vertex.PoseStack
|
||||
import com.mojang.math.Axis
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.renderer.MultiBufferSource
|
||||
import net.minecraft.client.renderer.RenderType
|
||||
import net.minecraft.client.renderer.entity.ItemRenderer
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture
|
||||
|
||||
/**
|
||||
* Draws the recalling player's Poké Ball in first person, rising into view from the bottom of the
|
||||
* screen in place of their held item. The world-space beam still starts near the hand (the eye/look
|
||||
* fallback in PokemonRenderer), so this is cosmetic only.
|
||||
*
|
||||
* Called from ItemInHandRendererMixin, which cancels the vanilla main-hand item while recalling.
|
||||
*/
|
||||
object FirstPersonRecallBallRenderer {
|
||||
|
||||
/** Resting position of the ball in view space (right, up, forward). */
|
||||
private const val REST_X = 0.45
|
||||
private const val REST_Y = -0.55
|
||||
private const val REST_Z = -.6
|
||||
/** How far below REST_Y the ball starts before rising into view. */
|
||||
private const val RISE_DISTANCE = 0.6
|
||||
private const val BALL_SCALE = 0.45F
|
||||
|
||||
private val ballContext = RenderContext().also {
|
||||
it.put(RenderContext.RENDER_STATE, RenderContext.RenderState.WORLD)
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if a recall ball was rendered (so the caller should cancel the vanilla item).
|
||||
*/
|
||||
fun render(poseStack: PoseStack, buffer: MultiBufferSource, packedLight: Int, partialTicks: Float): Boolean {
|
||||
val player = Minecraft.getInstance().player ?: return false
|
||||
val anim = RecallArmAnimationTracker.get(player.uuid) ?: return false
|
||||
val rise = RecallArmAnimationTracker.raiseFactor(player.uuid)
|
||||
|
||||
poseStack.pushPose()
|
||||
poseStack.translate(REST_X, REST_Y - RISE_DISTANCE * (1.0 - rise), REST_Z)
|
||||
poseStack.scale(BALL_SCALE, -BALL_SCALE, -BALL_SCALE)
|
||||
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(180F))
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(15F))
|
||||
|
||||
val state = anim.ballState
|
||||
val ball = anim.ball
|
||||
val model = VaryingModelRepository.getPoser(ball.name, state)
|
||||
val texture = VaryingModelRepository.getTexture(ball.name, state)
|
||||
state.updatePartialTicks(partialTicks)
|
||||
model.context = ballContext
|
||||
ballContext.put(RenderContext.ASPECTS, state.aspects)
|
||||
ballContext.put(RenderContext.POSABLE_STATE, state)
|
||||
model.applyAnimations(null, state, 0F, 0F, 0F, 0F, 0F)
|
||||
val consumer = ItemRenderer.getFoilBufferDirect(buffer, RenderType.entityCutout(texture), false, false)
|
||||
model.render(ballContext, poseStack, consumer, packedLight, OverlayTexture.NO_OVERLAY, -0x1)
|
||||
model.red = 1F
|
||||
model.green = 1F
|
||||
model.blue = 1F
|
||||
model.resetLayerContext()
|
||||
|
||||
poseStack.popPose()
|
||||
return true
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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.player
|
||||
|
||||
import com.cobblemon.mod.common.client.battle.ClientBallDisplay
|
||||
import com.cobblemon.mod.common.pokeball.PokeBall
|
||||
import java.util.UUID
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import net.minecraft.util.Mth
|
||||
import net.minecraft.world.phys.Vec3
|
||||
|
||||
/**
|
||||
* Tracks which players are recalling a Pokémon so we can pose their arm, draw the Poké Ball in their
|
||||
* hand, and start the recall beam from it.
|
||||
*
|
||||
* Keyed by player UUID. Entries time out on their own once the beam is done, and a new recall resets
|
||||
* the timer, so nothing has to clear them.
|
||||
*
|
||||
* Written by PokemonClientDelegate on recall (beamMode 3); read by HumanoidModelMixin, the ball
|
||||
* renderers, and PokemonRenderer.
|
||||
*/
|
||||
object RecallArmAnimationTracker {
|
||||
|
||||
// How long the arm stays raised, in seconds.
|
||||
const val ARM_HOLD_SECONDS = 0.8
|
||||
|
||||
// Fraction of the hold spent easing the arm up at the start and down at the end.
|
||||
private const val EASE_SECONDS = 0.15
|
||||
|
||||
class RecallAnim(
|
||||
val ball: PokeBall,
|
||||
val aspects: Set<String>,
|
||||
val startTimeMs: Long
|
||||
) {
|
||||
val ballState = ClientBallDisplay(ball, aspects)
|
||||
var beamOrigin: Vec3? = null
|
||||
}
|
||||
|
||||
private val activeRecalls = ConcurrentHashMap<UUID, RecallAnim>()
|
||||
|
||||
fun start(playerUuid: UUID, ball: PokeBall, aspects: Set<String>) {
|
||||
activeRecalls[playerUuid] = RecallAnim(ball, aspects, System.currentTimeMillis())
|
||||
}
|
||||
|
||||
/** Returns the active recall for the player, or null if there is none or if it has expired. */
|
||||
fun get(playerUuid: UUID): RecallAnim? {
|
||||
val anim = activeRecalls[playerUuid] ?: return null
|
||||
if (secondsSince(anim) > ARM_HOLD_SECONDS) {
|
||||
activeRecalls.remove(playerUuid)
|
||||
return null
|
||||
}
|
||||
return anim
|
||||
}
|
||||
|
||||
fun isRecalling(playerUuid: UUID): Boolean = get(playerUuid) != null
|
||||
|
||||
private fun secondsSince(anim: RecallAnim) = (System.currentTimeMillis() - anim.startTimeMs) / 1000.0
|
||||
|
||||
/** 0..1 ramp: eases in at the start, holds at 1, eases out at the end. 0 when not recalling. */
|
||||
fun raiseFactor(playerUuid: UUID): Float {
|
||||
val anim = get(playerUuid) ?: return 0F
|
||||
val elapsed = secondsSince(anim)
|
||||
val riseIn = Mth.clamp((elapsed / EASE_SECONDS).toFloat(), 0F, 1F)
|
||||
val fallOut = Mth.clamp(((ARM_HOLD_SECONDS - elapsed) / EASE_SECONDS).toFloat(), 0F, 1F)
|
||||
return minOf(riseIn, fallOut)
|
||||
}
|
||||
}
|
||||
+14
-4
@@ -26,6 +26,7 @@ import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PosableP
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.MiscModelRepository
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.RenderContext
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.VaryingModelRepository
|
||||
import com.cobblemon.mod.common.client.render.player.RecallArmAnimationTracker
|
||||
import com.cobblemon.mod.common.client.render.pokeball.PokeBallPosableState
|
||||
import com.cobblemon.mod.common.client.render.renderBeaconBeam
|
||||
import com.cobblemon.mod.common.client.settings.ServerSettings
|
||||
@@ -60,6 +61,7 @@ import net.minecraft.network.chat.Style
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.util.Mth
|
||||
import net.minecraft.world.entity.Entity
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.phys.Vec3
|
||||
import org.joml.*
|
||||
import kotlin.math.*
|
||||
@@ -69,6 +71,9 @@ class PokemonRenderer(
|
||||
) : MobRenderer<PokemonEntity, PosablePokemonEntityModel>(context, PosablePokemonEntityModel(), 0.5f) {
|
||||
companion object {
|
||||
val recallBeamColour = Vector4f(1F, 0.1F, 0.1F, 1F)
|
||||
private const val CAPTURE_BEAM_X_OFFSET = 0.0
|
||||
private const val CAPTURE_BEAM_Y_OFFSET = 0.2
|
||||
private const val CAPTURE_BEAM_Z_OFFSET = 0.45
|
||||
fun ease(x: Double): Double {
|
||||
return 1 - (1 - x).pow(3)
|
||||
}
|
||||
@@ -142,8 +147,6 @@ class PokemonRenderer(
|
||||
}
|
||||
|
||||
modelNow.setLayerContext(buffer, clientDelegate, VaryingModelRepository.getLayers(entity.pokemon.species.resourceIdentifier, clientDelegate))
|
||||
|
||||
|
||||
if (entity.passengers.isNotEmpty()) {
|
||||
renderRiding(entity, entityYaw, partialTicks, poseMatrix, buffer, packedLight)
|
||||
} else {
|
||||
@@ -316,8 +319,15 @@ class PokemonRenderer(
|
||||
fun renderBeam(matrixStack: PoseStack, partialTicks: Float, entity: PokemonEntity, beamTarget: Entity, buffer: MultiBufferSource, offset: Vec3) {
|
||||
val clientDelegate = entity.delegate as PokemonClientDelegate
|
||||
val pokemonPosition = entity.position().add(0.0, entity.bbHeight / 2.0 * clientDelegate.activeSendoutScale.toDouble(), 0.0)
|
||||
var beamSourcePosition = if (beamTarget is EmptyPokeBallEntity) {
|
||||
(beamTarget.delegate as PokeBallPosableState).locatorStates["beam"]?.getOrigin() ?: beamTarget.position()
|
||||
|
||||
// If a player is recalling, start the beam from the Poké Ball held in their hand
|
||||
val recallBallOrigin = (beamTarget as? Player)?.let { RecallArmAnimationTracker.get(it.uuid)?.beamOrigin }
|
||||
var beamSourcePosition = if (recallBallOrigin != null) {
|
||||
recallBallOrigin
|
||||
} else if (beamTarget is EmptyPokeBallEntity) {
|
||||
(beamTarget.delegate as PokeBallPosableState).locatorStates["beam"]
|
||||
?.transformPosition(Vec3(CAPTURE_BEAM_X_OFFSET, CAPTURE_BEAM_Y_OFFSET, CAPTURE_BEAM_Z_OFFSET))
|
||||
?: beamTarget.position()
|
||||
} else {
|
||||
if (beamTarget.uuid == Minecraft.getInstance().player?.uuid) {
|
||||
val lookVec = beamTarget.lookAngle.yRot((PI / 2).toFloat()).multiply(1.0, 0.0, 1.0).normalize()
|
||||
|
||||
@@ -36,7 +36,7 @@ import net.minecraft.world.level.block.Block
|
||||
class StatusCureItem(val itemName: String, vararg val status: Status, block: Block) : ItemNameBlockItem(block, Properties()), PokemonSelectingItem {
|
||||
override val bagItem = object : BagItem {
|
||||
override val itemName = this@StatusCureItem.itemName
|
||||
override val returnItem = Items.AIR
|
||||
override val returnItem = Items.GLASS_BOTTLE
|
||||
override fun canUse(stack: ItemStack, battle: PokemonBattle, target: BattlePokemon) = canUseOnPokemon(stack, target.effectedPokemon)
|
||||
override fun getShowdownInput(actor: BattleActor, battlePokemon: BattlePokemon, data: String?) = "cure_status${status.takeIf { it.isNotEmpty() }?.let { " ${it.joinToString(separator = " ") { it.showdownName } }" } ?: "" }"
|
||||
}
|
||||
|
||||
+2
-1
@@ -2,7 +2,8 @@
|
||||
"portraitScale": 1.03,
|
||||
"portraitTranslation": [-0.31, 0.12, 0],
|
||||
"profileScale": 0.47,
|
||||
"profileTranslation": [0, 0.98, 0.0],
|
||||
"profileTranslation": [0.07, 0.98, 0.0],
|
||||
"profilePokedexTranslation": [0, 0.98, 0],
|
||||
"rootBone": "venusaur",
|
||||
"firstPersonCameraOffset": {
|
||||
"seat_1": [0, 0.25, 0]
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"portraitScale": 1.89,
|
||||
"portraitTranslation": [-0.13, 0.91, 0],
|
||||
"profileScale": 0.63,
|
||||
"profileTranslation": [0, 0.81, 0],
|
||||
"profileScale": 0.77,
|
||||
"profileTranslation": [0, 0.65, 0],
|
||||
"rootBone": "charmeleon",
|
||||
"animations": {
|
||||
"cry": "q.bedrock_stateful('charmeleon', 'cry')"
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"portraitScale": 2.1,
|
||||
"portraitTranslation": [-1.11, 2.43, 0],
|
||||
"profileScale": 0.54,
|
||||
"profileTranslation": [0, 0.96, -10],
|
||||
"profileTranslation": [0, 0.92, -10],
|
||||
"rootBone": "charizard",
|
||||
"firstPersonCameraOffset": {
|
||||
"seat_1": [0, 0.45, 0]
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"portraitScale": 1.89,
|
||||
"portraitTranslation": [-0.8, 1.36, 0.0],
|
||||
"profileScale": 0.59,
|
||||
"profileTranslation": [0, 0.84, 0.0],
|
||||
"profileScale": 0.57,
|
||||
"profileTranslation": [0, 0.81, 0.0],
|
||||
"rootBone": "nidoking",
|
||||
"animations": {
|
||||
"cry": "q.bedrock_stateful('nidoking', 'cry')",
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"portraitScale": 1.8,
|
||||
"portraitTranslation": [-0.35, -0.8, 0],
|
||||
"profileScale": 0.8,
|
||||
"profileTranslation": [0, 0.45, 0.0],
|
||||
"profileTranslation": [0, 0.52, 0.0],
|
||||
"rootBone": "parasect",
|
||||
"firstPersonCameraOffset": {
|
||||
"seat_1": [0, 0.45, 0]
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"portraitScale": 1.96,
|
||||
"portraitTranslation": [ -0.48, 1.61, 0],
|
||||
"portraitTranslation": [ -0.3, 1.86, 0],
|
||||
"profileScale": 0.53,
|
||||
"profileTranslation": [0, 0.92, 0],
|
||||
"rootBone": "mr_rime",
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"portraitScale": 1.73,
|
||||
"portraitTranslation": [-0.45, -1.17, 0],
|
||||
"profileScale": 0.7,
|
||||
"profileTranslation": [-0.06, 0.59, 0],
|
||||
"profileTranslation": [0, 0.59, 0],
|
||||
"rootBone": "dunsparce",
|
||||
"animations": {
|
||||
"cry": "q.bedrock_stateful('dunsparce', 'cry')",
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"portraitScale": 1.73,
|
||||
"portraitTranslation": [-0.09, 0.26, 0],
|
||||
"profileScale": 0.60,
|
||||
"profileTranslation": [0.16, 0.90, 0],
|
||||
"profileTranslation": [0, 0.90, 0],
|
||||
"rootBone": "beautifly",
|
||||
"poses": {
|
||||
"battle-standing": {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"portraitScale": 1.65,
|
||||
"portraitTranslation": [-0.10, 0.16, 0],
|
||||
"profileScale": 0.63,
|
||||
"profileTranslation": [0.13, 0.64, 0],
|
||||
"profileTranslation": [0, 0.64, 0],
|
||||
"rootBone": "dustox",
|
||||
"poses": {
|
||||
"battle-standing": {
|
||||
|
||||
+3
-1
@@ -2,7 +2,9 @@
|
||||
"portraitScale": 1.63,
|
||||
"portraitTranslation": [-1.76, 1.25, 0],
|
||||
"profileScale": 0.53,
|
||||
"profileTranslation": [-0.09, 0.92, 0],
|
||||
"profileTranslation": [0.49, 0.96, 0],
|
||||
"profilePokedexTranslation": [0, 0.96, 0],
|
||||
"profileSummaryTranslation": [-0.30, 0.87, 0],
|
||||
"rootBone": "drapion",
|
||||
"animations": {
|
||||
"cry": "q.bedrock_stateful('drapion', 'cry')"
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"portraitScale": 1.98,
|
||||
"portraitTranslation": [-0.96, 1.39, 0],
|
||||
"profileScale": 0.59,
|
||||
"profileTranslation": [0.13, 0.82, 0],
|
||||
"profileTranslation": [0, 0.84, 0],
|
||||
"rootBone": "pyroar_female",
|
||||
"animations": {
|
||||
"cry": "q.bedrock_stateful('pyroar_female', 'cry')"
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"portraitScale": 1.89,
|
||||
"portraitTranslation": [-1.12, 1.78, 0],
|
||||
"profileScale": 0.51,
|
||||
"profileTranslation": [0.12, 0.94, 0],
|
||||
"profileTranslation": [0, 0.97, 0],
|
||||
"rootBone": "pyroar_male",
|
||||
"animations": {
|
||||
"cry": "q.bedrock_stateful('pyroar_male', 'cry')"
|
||||
|
||||
+2
-1
@@ -2,7 +2,8 @@
|
||||
"portraitScale": 1.1,
|
||||
"portraitTranslation": [-1.2, -0.009, 0],
|
||||
"profileScale": 0.5,
|
||||
"profileTranslation": [-0.18, 0.96, 0],
|
||||
"profileTranslation": [0, 0.96, 0],
|
||||
"profileSummaryTranslation": [-0.20, 0.87, 0],
|
||||
"rootBone": "dudunsparce",
|
||||
"firstPersonCameraOffset": {
|
||||
"seat_1": [0, 0.45, 0],
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"portraitScale": 1.1,
|
||||
"portraitTranslation": [-0.8, -0.009, 0],
|
||||
"profileScale": 0.5,
|
||||
"profileTranslation": [-0.18, 0.96, 0],
|
||||
"profileTranslation": [0, 0.96, 0],
|
||||
"rootBone": "dudunsparce",
|
||||
"firstPersonCameraOffset": {
|
||||
"seat_1": [0, 0.45, 0],
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
"id": "panpour_simipour",
|
||||
"variant": "item_interact",
|
||||
"result": "simipour",
|
||||
"consumeHeldItem": true,
|
||||
"consumeHeldItem": false,
|
||||
"learnableMoves": [],
|
||||
"requirements": [],
|
||||
"requiredContext": "cobblemon:water_stone"
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
"client.EntryListWidgetMixin",
|
||||
"client.GameRendererMixin",
|
||||
"client.HumanoidModelMixin",
|
||||
"client.ItemInHandLayerMixin",
|
||||
"client.ItemInHandRendererMixin",
|
||||
"client.ItemRendererMixin",
|
||||
"client.LivingEntityRendererMixin",
|
||||
|
||||
Reference in New Issue
Block a user