mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-12 08:58:02 -04:00
random animal scale
They look now way more diversed
This commit is contained in:
parent
33ca98b07c
commit
853af48b13
@ -18,6 +18,7 @@ import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.config.profile.delegate.types.StringDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
import de.bixilon.minosoft.config.profile.profiles.entity.EntityProfileManager.latestVersion
|
||||
import de.bixilon.minosoft.config.profile.profiles.entity.animal.AnimalC
|
||||
import de.bixilon.minosoft.config.profile.profiles.entity.features.FeaturesC
|
||||
import de.bixilon.minosoft.config.profile.profiles.entity.general.GeneralC
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
@ -40,6 +41,7 @@ class EntityProfile(
|
||||
|
||||
val general = GeneralC(this)
|
||||
val features = FeaturesC(this)
|
||||
val animal = AnimalC(this)
|
||||
|
||||
override fun toString(): String {
|
||||
return EntityProfileManager.getName(this)
|
||||
|
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.entity.animal
|
||||
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.BooleanDelegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.entity.EntityProfile
|
||||
|
||||
class AnimalC(profile: EntityProfile) {
|
||||
|
||||
var randomScale by BooleanDelegate(profile, true)
|
||||
}
|
@ -16,6 +16,7 @@ package de.bixilon.minosoft.gui.rendering.entities.model.animal
|
||||
import de.bixilon.minosoft.gui.rendering.entities.feature.SkeletalFeature
|
||||
import de.bixilon.minosoft.gui.rendering.entities.model.animator.HeadAnimator
|
||||
import de.bixilon.minosoft.gui.rendering.entities.renderer.EntityRenderer
|
||||
import de.bixilon.minosoft.gui.rendering.entities.renderer.living.animal.AnimalRenderer
|
||||
import de.bixilon.minosoft.gui.rendering.skeletal.baked.BakedSkeletalModel
|
||||
|
||||
class AnimalModel<R : EntityRenderer<*>>(renderer: R, model: BakedSkeletalModel) : SkeletalFeature(renderer, model) {
|
||||
@ -25,4 +26,11 @@ class AnimalModel<R : EntityRenderer<*>>(renderer: R, model: BakedSkeletalModel)
|
||||
super.updatePosition()
|
||||
head?.update()
|
||||
}
|
||||
|
||||
override fun updateInstance() {
|
||||
super.updateInstance()
|
||||
if (renderer is AnimalRenderer<*>) {
|
||||
instance.matrix.scaleAssign(renderer.scale)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,14 +13,19 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.entities.renderer.living.animal
|
||||
|
||||
import de.bixilon.kutil.random.RandomUtil.nextFloat
|
||||
import de.bixilon.minosoft.data.entities.entities.AgeableMob
|
||||
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
||||
import de.bixilon.minosoft.gui.rendering.entities.EntitiesRenderer
|
||||
import de.bixilon.minosoft.gui.rendering.entities.model.animal.AnimalModel
|
||||
import de.bixilon.minosoft.gui.rendering.entities.renderer.living.LivingEntityRenderer
|
||||
import kotlin.random.Random
|
||||
import kotlin.random.asJavaRandom
|
||||
|
||||
abstract class AnimalRenderer<E : AgeableMob>(renderer: EntitiesRenderer, entity: E) : LivingEntityRenderer<E>(renderer, entity) {
|
||||
protected abstract var model: AnimalModel<*>?
|
||||
val scale = if (renderer.profile.animal.randomScale) Random.asJavaRandom().nextFloat(0.9f, 1.1f) else 1.0f
|
||||
|
||||
|
||||
init {
|
||||
entity.data.observe<Boolean>(AgeableMob.BABY) { unload() }
|
||||
|
Loading…
x
Reference in New Issue
Block a user