Merge branch '1.21' into worldgen-placement-providers

This commit is contained in:
DBotThePony 2025-03-05 10:52:04 +07:00
commit cbc95e8e5b
Signed by: DBot
GPG Key ID: DCC23B5715498507
8 changed files with 138 additions and 13 deletions

File diff suppressed because one or more lines are too long

View File

@ -106,24 +106,50 @@ public class LoaderAnimation {
public static final AnimationDefinition ATTACK = AnimationDefinition.Builder.withLength(0.48F).looping()
.addAnimation("LeftArm", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.2F, KeyframeAnimations.degreeVec(-135F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
new Keyframe(0.0F, KeyframeAnimations.degreeVec(19.27F, 2.7545F, -11.804F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.degreeVec(25.4138F, -37.1586F, -16.0129F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("LeftArm", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, -1.1F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.posVec(-4.0F, -1.0F, 6.9F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(-1.0F, 0.0F, 0.9F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("ElbowR", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-2F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.2F, KeyframeAnimations.degreeVec(-24.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-2F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.degreeVec(-22.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.32F, KeyframeAnimations.degreeVec(-75.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-20.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightArm", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.2F, KeyframeAnimations.degreeVec(-135F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
new Keyframe(0.0F, KeyframeAnimations.degreeVec(2.0031F, 14.8687F, 7.7614F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.32F, KeyframeAnimations.degreeVec(-105.5693F, -6.858F, 48.036F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-4.4119F, -9.6204F, 22.9232F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightArm", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 1.4F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.posVec(3.0F, 3.0F, -9.6F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(0.0F, 2.0F, -2.6F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("ElbowL", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-2F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.2F, KeyframeAnimations.degreeVec(-24.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-2F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-32.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.2F, KeyframeAnimations.degreeVec(-60.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-25.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("Head", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(-0.6F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.posVec(3.0F, 0.0F, -2.6F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(1.0F, 0.0F, -1.6F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("Body", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 7.5F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.degreeVec(0.0F, -35.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(0.0F, -12.5F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("LeftLeg", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-4.9953F, -0.2178F, -2.4905F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightLeg", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(7.4929F, -0.3262F, 2.4786F), AnimationChannel.Interpolations.LINEAR)
))
.build();
}

View File

@ -0,0 +1,23 @@
package ru.dbotthepony.mc.otm.client.render.entity
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.core.ResourceLocation
import net.minecraft.client.model.PlayerModel
import net.minecraft.client.renderer.entity.EntityRendererProvider
import net.minecraft.client.renderer.entity.HumanoidMobRenderer
import net.minecraft.client.model.geom.ModelLayers
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.entity.EntityType
import net.minecraft.world.entity.Mob
class RogueAndroidRenderer<T : Mob>(context: EntityRendererProvider.Context, private val entityType: EntityType<T>, private val androidTexture: String) :
HumanoidMobRenderer<T, PlayerModel<T>>(
context, PlayerModel(context.bakeLayer(ModelLayers.PLAYER), false), 0.5f
) {
override fun getTextureLocation(entity: T): ResourceLocation {
return ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/entity/android/$androidTexture.png")
}
}

View File

@ -0,0 +1,56 @@
package ru.dbotthepony.mc.otm.entity
import net.minecraft.sounds.SoundEvent
import net.minecraft.sounds.SoundEvents
import net.minecraft.world.entity.EntityType
import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.ai.attributes.AttributeSupplier
import net.minecraft.world.entity.ai.attributes.Attributes
import net.minecraft.world.entity.ai.goal.LeapAtTargetGoal
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal
import net.minecraft.world.entity.ai.goal.MeleeAttackGoal
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal
import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal
import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal
import net.minecraft.world.entity.ai.navigation.GroundPathNavigation
import net.minecraft.world.entity.ai.navigation.PathNavigation
import net.minecraft.world.entity.monster.Monster
import net.minecraft.world.entity.player.Player
import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.Level
class AndroidMelee(type: EntityType<AndroidMelee>, level: Level) : Monster(type, level) {
override fun registerGoals() {
goalSelector.addGoal(8, RandomLookAroundGoal(this))
goalSelector.addGoal(7, WaterAvoidingRandomStrollGoal(this, 0.8))
goalSelector.addGoal(8, LookAtPlayerGoal(this, Player::class.java, 8f))
goalSelector.addGoal(3, NearestAttackableTargetGoal(this, LivingEntity::class.java , true, true))
goalSelector.addGoal(3, NearestAttackableTargetGoal(this, Player::class.java , true, true))
goalSelector.addGoal(1, LeapAtTargetGoal(this, 0.4f))
goalSelector.addGoal(2, MeleeAttackGoal(this, 1.3, true))
targetSelector.addGoal(1, HurtByTargetGoal(this))
}
override fun getArmorSlots(): MutableIterable<ItemStack> {
return super.getArmorSlots()
}
override fun getHurtSound(damageSource: net.minecraft.world.damagesource.DamageSource): SoundEvent {
return SoundEvents.IRON_GOLEM_HURT
}
override fun createNavigation(level: Level): PathNavigation = GroundPathNavigation(this, level)
companion object {
fun createAttributes() : AttributeSupplier.Builder {
return createMonsterAttributes()
.add(Attributes.MAX_HEALTH, 16.0)
.add(Attributes.MOVEMENT_SPEED, 0.3)
.add(Attributes.ATTACK_DAMAGE, 3.0)
}
}
}

View File

@ -330,6 +330,10 @@ object MNames {
const val BREAD_MONSTER = "bread_monster"
const val LOADER = "loader"
const val ANDROID_MELEE = "android_melee"
const val ANDROID_RANGED = "android_melee"
const val ANDROID_OVERSEER = "android_melee"
const val PHANTOM_ATTRACTOR = "phantom_attractor"
const val JUMP_BOOST = "jump_boost"
const val ENDER_TELEPORTER = "ender_teleporter"

View File

@ -16,6 +16,7 @@ import net.neoforged.neoforge.event.entity.EntityAttributeCreationEvent
import ru.dbotthepony.mc.otm.client.render.entity.BreadMonsterRenderer
import ru.dbotthepony.mc.otm.client.render.entity.LoaderRenderer
import ru.dbotthepony.mc.otm.client.render.entity.PlasmaProjectileRenderer
import ru.dbotthepony.mc.otm.client.render.entity.RogueAndroidRenderer
import ru.dbotthepony.mc.otm.entity.*
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
import ru.dbotthepony.mc.otm.registry.MNames
@ -57,6 +58,16 @@ object MEntityTypes {
.build(MNames.LOADER)
}
val ANDROID_MELEE: EntityType<AndroidMelee> by registry.register(MNames.ANDROID_MELEE) {
EntityType.Builder.of(::AndroidMelee, MobCategory.MONSTER)
.sized(1.2f, 2.5f)
.eyeHeight(2.0f)
.passengerAttachments(2.5f)
.clientTrackingRange(12)
.build(MNames.ANDROID_MELEE)
}
fun register(bus: IEventBus) {
registry.register(bus)
bus.addListener(this::registerAttributes)
@ -66,6 +77,7 @@ object MEntityTypes {
private fun registerAttributes(event: EntityAttributeCreationEvent) {
event.put(BREAD_MONSTER, BreadMonster.createAttributes().build())
event.put(LOADER, Loader.createAttributes().build())
event.put(ANDROID_MELEE, Loader.createAttributes().build())
}
@Suppress("unchecked_cast")
@ -80,6 +92,10 @@ object MEntityTypes {
EntityRenderers.register(RIDEABLE_DUMMY, ::NoopRenderer)
EntityRenderers.register(BREAD_MONSTER, ::BreadMonsterRenderer)
EntityRenderers.register(LOADER, ::LoaderRenderer)
EntityRenderers.register(ANDROID_MELEE) { context ->
RogueAndroidRenderer(context, ANDROID_MELEE, "melee")
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB