This commit is contained in:
GearShocky 2025-03-05 07:08:49 +05:00
parent ffee09ec0f
commit 6b7f1fb949
6 changed files with 99 additions and 0 deletions

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