From bc109e8020f95469f1b8cf9329811948fac6ef8b Mon Sep 17 00:00:00 2001 From: GearShocky Date: Wed, 5 Mar 2025 17:46:30 +0500 Subject: [PATCH] frogs --- .../render/entity/RogueAndroidRenderer.kt | 18 +++++++++- .../dbotthepony/mc/otm/entity/AndroidMelee.kt | 33 +++++++++++++------ .../dbotthepony/mc/otm/entity/BreadMonster.kt | 8 ++++- .../ru/dbotthepony/mc/otm/entity/Loader.kt | 13 +++++++- .../mc/otm/registry/game/MEntityTypes.kt | 4 +-- 5 files changed, 61 insertions(+), 15 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/entity/RogueAndroidRenderer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/entity/RogueAndroidRenderer.kt index ad7c1a5d4..9f7340a4d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/entity/RogueAndroidRenderer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/entity/RogueAndroidRenderer.kt @@ -1,4 +1,5 @@ package ru.dbotthepony.mc.otm.client.render.entity +import net.minecraft.client.model.HumanoidModel import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.core.ResourceLocation @@ -6,17 +7,32 @@ 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.client.renderer.entity.layers.HumanoidArmorLayer +import net.minecraft.client.renderer.entity.layers.ItemInHandLayer +import net.minecraft.client.resources.model.ModelManager import net.minecraft.resources.ResourceLocation import net.minecraft.world.entity.EntityType import net.minecraft.world.entity.Mob -class RogueAndroidRenderer(context: EntityRendererProvider.Context, private val entityType: EntityType, private val androidTexture: String) : +class RogueAndroidRenderer(context: EntityRendererProvider.Context, private val entityType: EntityType, private val androidTexture: String,private val modelManager: ModelManager) : HumanoidMobRenderer>( context, PlayerModel(context.bakeLayer(ModelLayers.PLAYER), false), 0.5f ) { + init { + addLayer(ItemInHandLayer(this, context.itemInHandRenderer)) + addLayer( + HumanoidArmorLayer( + this, + HumanoidModel(context.bakeLayer(ModelLayers.PLAYER_INNER_ARMOR)), + HumanoidModel(context.bakeLayer(ModelLayers.PLAYER_OUTER_ARMOR)), + modelManager + ) + ) + } + override fun getTextureLocation(entity: T): ResourceLocation { return ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/entity/android/$androidTexture.png") } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/entity/AndroidMelee.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/entity/AndroidMelee.kt index 0df65bc77..4a827f31a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/entity/AndroidMelee.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/entity/AndroidMelee.kt @@ -6,7 +6,7 @@ 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.AvoidEntityGoal import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal import net.minecraft.world.entity.ai.goal.MeleeAttackGoal import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal @@ -15,7 +15,9 @@ 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.animal.frog.Frog +import net.minecraft.world.entity.monster.* +import net.minecraft.world.entity.npc.Villager import net.minecraft.world.entity.player.Player import net.minecraft.world.item.ItemStack import net.minecraft.world.level.Level @@ -24,14 +26,19 @@ class AndroidMelee(type: EntityType, level: Level) : Monster(type, override fun registerGoals() { goalSelector.addGoal(8, RandomLookAroundGoal(this)) - goalSelector.addGoal(7, WaterAvoidingRandomStrollGoal(this, 0.8)) + goalSelector.addGoal(7, WaterAvoidingRandomStrollGoal(this, 0.6)) 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(3, NearestAttackableTargetGoal(this, LivingEntity::class.java, 10, true, true) { entity -> + entity is Player || + entity is Villager || + entity is AbstractIllager || + entity is Zombie || + entity is AbstractSkeleton + }) - goalSelector.addGoal(1, LeapAtTargetGoal(this, 0.4f)) - goalSelector.addGoal(2, MeleeAttackGoal(this, 1.3, true)) + goalSelector.addGoal(1, AvoidEntityGoal(this, Frog::class.java, 8.0F, 1.2, 1.5)) + goalSelector.addGoal(2, MeleeAttackGoal(this, 1.0, true)) targetSelector.addGoal(1, HurtByTargetGoal(this)) } @@ -40,7 +47,11 @@ class AndroidMelee(type: EntityType, level: Level) : Monster(type, } override fun getHurtSound(damageSource: net.minecraft.world.damagesource.DamageSource): SoundEvent { - return SoundEvents.IRON_GOLEM_HURT + return SoundEvents.HEAVY_CORE_BREAK + } + + override fun getDeathSound(): SoundEvent { + return SoundEvents.VAULT_BREAK } override fun createNavigation(level: Level): PathNavigation = GroundPathNavigation(this, level) @@ -48,9 +59,11 @@ class AndroidMelee(type: EntityType, level: Level) : Monster(type, companion object { fun createAttributes() : AttributeSupplier.Builder { return createMonsterAttributes() - .add(Attributes.MAX_HEALTH, 16.0) + .add(Attributes.MAX_HEALTH, 30.0) + .add(Attributes.ARMOR, 4.0) + .add(Attributes.SCALE, 1.1) .add(Attributes.MOVEMENT_SPEED, 0.3) - .add(Attributes.ATTACK_DAMAGE, 3.0) + .add(Attributes.ATTACK_DAMAGE, 4.0) } } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/entity/BreadMonster.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/entity/BreadMonster.kt index f13fd15dc..512563d84 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/entity/BreadMonster.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/entity/BreadMonster.kt @@ -14,7 +14,11 @@ 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.AbstractIllager +import net.minecraft.world.entity.monster.AbstractSkeleton import net.minecraft.world.entity.monster.Monster +import net.minecraft.world.entity.monster.Zombie +import net.minecraft.world.entity.npc.Villager import net.minecraft.world.entity.player.Player import net.minecraft.world.level.Level @@ -29,8 +33,10 @@ class BreadMonster(type: EntityType, level: Level) : Monster(type, 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(3, NearestAttackableTargetGoal(this, LivingEntity::class.java, 10, true, true) { entity -> + entity !is BreadMonster + }) goalSelector.addGoal(1, LeapAtTargetGoal(this, 0.4f)) goalSelector.addGoal(2, MeleeAttackGoal(this, 1.3, true)) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/entity/Loader.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/entity/Loader.kt index 38ecf9013..d0d3a5e50 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/entity/Loader.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/entity/Loader.kt @@ -12,6 +12,7 @@ import net.minecraft.sounds.SoundEvents import net.minecraft.world.entity.AnimationState import net.minecraft.world.entity.Entity 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.LookAtPlayerGoal @@ -22,7 +23,11 @@ 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.AbstractIllager +import net.minecraft.world.entity.monster.AbstractSkeleton import net.minecraft.world.entity.monster.Monster +import net.minecraft.world.entity.monster.Zombie +import net.minecraft.world.entity.npc.Villager import net.minecraft.world.entity.player.Player import net.minecraft.world.level.Level import ru.dbotthepony.mc.otm.OverdriveThatMatters @@ -68,7 +73,13 @@ class Loader(type: EntityType, level: Level) : Monster(type, level) { 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, Player::class.java , true, true)) + goalSelector.addGoal(3, NearestAttackableTargetGoal(this, LivingEntity::class.java, 10, true, true) { entity -> + entity is Player || + entity is Villager || + entity is AbstractIllager || + entity is Zombie || + entity is AbstractSkeleton + }) goalSelector.addGoal(2, MeleeAttackGoal(this, 1.0, true)) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MEntityTypes.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MEntityTypes.kt index af4a6b109..ebfa596c4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MEntityTypes.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MEntityTypes.kt @@ -77,7 +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()) + event.put(ANDROID_MELEE, AndroidMelee.createAttributes().build()) } @Suppress("unchecked_cast") @@ -94,7 +94,7 @@ object MEntityTypes { EntityRenderers.register(LOADER, ::LoaderRenderer) EntityRenderers.register(ANDROID_MELEE) { context -> - RogueAndroidRenderer(context, ANDROID_MELEE, "melee") + RogueAndroidRenderer(context, ANDROID_MELEE, "melee",context.modelManager) } } }