emissives?

This commit is contained in:
GearShocky 2025-03-11 02:41:22 +05:00
parent d2371b03f6
commit 091895fb10
6 changed files with 98 additions and 20 deletions

View File

@ -6,24 +6,29 @@ import net.minecraft.client.animation.Keyframe;
import net.minecraft.client.animation.KeyframeAnimations; import net.minecraft.client.animation.KeyframeAnimations;
public class EnforcerAnimation { public class EnforcerAnimation {
public static final AnimationDefinition CHARGE = AnimationDefinition.Builder.withLength(0.0F).looping() public static final AnimationDefinition CHARGE = AnimationDefinition.Builder.withLength(0.12F).looping()
.addAnimation("root", new AnimationChannel(AnimationChannel.Targets.POSITION, .addAnimation("root", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0.0F, -1.1F, 0.0F), AnimationChannel.Interpolations.LINEAR)
)) ))
.addAnimation("Body", new AnimationChannel(AnimationChannel.Targets.ROTATION, .addAnimation("Body", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(7.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) new Keyframe(0.0F, KeyframeAnimations.degreeVec(7.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
)) ))
.addAnimation("leg_FL", new AnimationChannel(AnimationChannel.Targets.ROTATION, .addAnimation("leg_FL", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.3244F, 25.5371F, -4.9817F), AnimationChannel.Interpolations.LINEAR) new Keyframe(0.0F, KeyframeAnimations.degreeVec(-0.0089F, 24.7408F, -0.0342F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.degreeVec(-0.8438F, 24.7408F, -0.0342F), AnimationChannel.Interpolations.LINEAR)
)) ))
.addAnimation("leg_FR", new AnimationChannel(AnimationChannel.Targets.ROTATION, .addAnimation("leg_FR", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.5426F, -23.0465F, 4.9996F), AnimationChannel.Interpolations.LINEAR) new Keyframe(0.0F, KeyframeAnimations.degreeVec(-0.0452F, -24.7102F, -0.3574F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.degreeVec(-0.8765F, -24.7156F, -0.3213F), AnimationChannel.Interpolations.LINEAR)
)) ))
.addAnimation("leg_BR", new AnimationChannel(AnimationChannel.Targets.ROTATION, .addAnimation("leg_BR", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-0.3244F, 25.5371F, 4.9817F), AnimationChannel.Interpolations.LINEAR) new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0089F, 24.7408F, 0.0342F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.degreeVec(0.9506F, 24.7408F, 0.0342F), AnimationChannel.Interpolations.LINEAR)
)) ))
.addAnimation("leg_BL", new AnimationChannel(AnimationChannel.Targets.ROTATION, .addAnimation("leg_BL", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-0.3244F, -25.5371F, -4.9817F), AnimationChannel.Interpolations.LINEAR) new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0089F, -24.7408F, -0.0342F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.degreeVec(0.9506F, -24.7408F, -0.0342F), AnimationChannel.Interpolations.LINEAR)
)) ))
.build(); .build();

View File

@ -37,18 +37,23 @@ public class EnforcerModel {
MeshDefinition meshdefinition = new MeshDefinition(); MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot(); PartDefinition partdefinition = meshdefinition.getRoot();
PartDefinition root = partdefinition.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 25.0F, 0.0F)); PartDefinition root = partdefinition.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 24.0F, 0.0F));
PartDefinition cube_r1 = root.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(178, 168).addBox(0.0F, -18.5F, -1.0F, 0.0F, 19.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(8.0F, -41.5F, 8.0F, -0.1745F, 0.0F, 0.0F));
PartDefinition base = root.addOrReplaceChild("base", CubeListBuilder.create().texOffs(140, 104).addBox(-8.0F, -4.0F, -7.0F, 16.0F, 5.0F, 14.0F, new CubeDeformation(0.0F)) PartDefinition base = root.addOrReplaceChild("base", CubeListBuilder.create().texOffs(140, 104).addBox(-8.0F, -4.0F, -7.0F, 16.0F, 5.0F, 14.0F, new CubeDeformation(0.0F))
.texOffs(92, 33).addBox(-5.0F, -2.0F, -10.0F, 10.0F, 14.0F, 20.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -22.0F, 0.0F)); .texOffs(92, 33).addBox(-5.0F, -2.0F, -10.0F, 10.0F, 14.0F, 20.0F, new CubeDeformation(0.0F))
.texOffs(70, 0).addBox(-8.0F, -1.0F, -11.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(70, 5).addBox(5.0F, -1.0F, -11.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -22.0F, 0.0F));
PartDefinition Body = base.addOrReplaceChild("Body", CubeListBuilder.create().texOffs(80, 76).addBox(-11.0F, -17.4F, 10.9F, 22.0F, 14.0F, 14.0F, new CubeDeformation(0.0F)) PartDefinition Body = base.addOrReplaceChild("Body", CubeListBuilder.create().texOffs(70, 0).addBox(-9.0F, -18.4F, -8.1F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(70, 5).addBox(-5.0F, -18.4F, -8.1F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(80, 76).addBox(-11.0F, -17.4F, 10.9F, 22.0F, 14.0F, 14.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(-12.0F, -15.4F, -11.1F, 24.0F, 16.0F, 22.0F, new CubeDeformation(0.0F)) .texOffs(0, 0).addBox(-12.0F, -15.4F, -11.1F, 24.0F, 16.0F, 22.0F, new CubeDeformation(0.0F))
.texOffs(0, 38).addBox(-12.0F, -15.4F, -11.1F, 24.0F, 16.0F, 22.0F, new CubeDeformation(0.5F)) .texOffs(0, 38).addBox(-12.0F, -15.4F, -11.1F, 24.0F, 16.0F, 22.0F, new CubeDeformation(0.5F))
.texOffs(122, 168).addBox(12.0F, -13.4F, -6.1F, 2.0F, 12.0F, 12.0F, new CubeDeformation(0.0F)) .texOffs(122, 168).addBox(12.0F, -13.4F, -6.1F, 2.0F, 12.0F, 12.0F, new CubeDeformation(0.0F))
.texOffs(150, 168).addBox(-14.0F, -13.4F, -6.1F, 2.0F, 12.0F, 12.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -4.6F, 0.1F)); .texOffs(150, 168).addBox(-14.0F, -13.4F, -6.1F, 2.0F, 12.0F, 12.0F, new CubeDeformation(0.0F))
.texOffs(140, 123).addBox(-7.0F, -2.0F, 10.0F, 15.0F, 5.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -4.6F, 0.1F));
PartDefinition cube_r1 = Body.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(178, 168).addBox(0.0F, -18.5F, -1.0F, 0.0F, 19.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(8.0F, -14.9F, 7.9F, -0.1745F, 0.0F, 0.0F));
PartDefinition Head = Body.addOrReplaceChild("Head", CubeListBuilder.create().texOffs(92, 67).addBox(-4.0F, -3.0F, -1.0F, 7.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(-4.0F, 1.6F, -11.1F)); PartDefinition Head = Body.addOrReplaceChild("Head", CubeListBuilder.create().texOffs(92, 67).addBox(-4.0F, -3.0F, -1.0F, 7.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(-4.0F, 1.6F, -11.1F));
@ -60,19 +65,19 @@ public class EnforcerModel {
PartDefinition cube_r2 = flamethrower.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(152, 33).addBox(-4.0F, -4.0F, 0.5F, 8.0F, 8.0F, 15.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(7.75F, 5.7346F, 6.5272F, 0.5236F, 0.0F, 0.0F)); PartDefinition cube_r2 = flamethrower.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(152, 33).addBox(-4.0F, -4.0F, 0.5F, 8.0F, 8.0F, 15.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(7.75F, 5.7346F, 6.5272F, 0.5236F, 0.0F, 0.0F));
PartDefinition leg_FL = root.addOrReplaceChild("leg_FL", CubeListBuilder.create().texOffs(158, 0).addBox(-4.5F, -5.5F, -9.5F, 9.0F, 11.0F, 13.0F, new CubeDeformation(0.0F)) PartDefinition leg_FL = root.addOrReplaceChild("leg_FL", CubeListBuilder.create().texOffs(80, 104).addBox(-5.5F, -2.5F, -24.5F, 11.0F, 13.0F, 19.0F, new CubeDeformation(0.0F))
.texOffs(80, 104).addBox(-5.5F, -2.5F, -24.5F, 11.0F, 13.0F, 19.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(9.5F, -13.5F, -6.5F, 0.1047F, -0.5061F, -0.0349F)); .texOffs(158, 0).addBox(-4.5F, -5.5F, -9.5F, 9.0F, 11.0F, 13.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(9.5F, -13.5F, -6.5F, 0.1571F, -0.5061F, -0.0349F));
PartDefinition leg_FR = root.addOrReplaceChild("leg_FR", CubeListBuilder.create().texOffs(0, 125).addBox(-5.5F, -2.5F, -24.5F, 11.0F, 13.0F, 19.0F, new CubeDeformation(0.0F)) PartDefinition leg_FR = root.addOrReplaceChild("leg_FR", CubeListBuilder.create().texOffs(0, 125).addBox(-5.5F, -2.5F, -24.5F, 11.0F, 13.0F, 19.0F, new CubeDeformation(0.0F))
.texOffs(152, 80).addBox(-4.5F, -5.5F, -9.5F, 9.0F, 11.0F, 13.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-9.5F, -13.5F, -6.5F, 0.1047F, 0.5061F, 0.0349F)); .texOffs(152, 80).addBox(-4.5F, -5.5F, -9.5F, 9.0F, 11.0F, 13.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-9.5F, -13.5F, -6.5F, 0.1571F, 0.5061F, 0.0349F));
PartDefinition leg_BL = root.addOrReplaceChild("leg_BL", CubeListBuilder.create().texOffs(60, 136).addBox(-5.5F, -2.1667F, 5.1667F, 11.0F, 13.0F, 19.0F, new CubeDeformation(0.0F)) PartDefinition leg_BL = root.addOrReplaceChild("leg_BL", CubeListBuilder.create().texOffs(60, 136).addBox(-5.5F, -2.1667F, 5.1667F, 11.0F, 13.0F, 19.0F, new CubeDeformation(0.0F))
.texOffs(199, 24).addBox(-4.5F, -7.1667F, 13.1667F, 9.0F, 11.0F, 13.0F, new CubeDeformation(0.0F)) .texOffs(199, 24).addBox(-4.5F, -7.1667F, 13.1667F, 9.0F, 11.0F, 13.0F, new CubeDeformation(0.0F))
.texOffs(0, 157).addBox(-4.5F, -5.1667F, -3.8333F, 9.0F, 11.0F, 13.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(9.5F, -13.8333F, 6.8333F, -0.1047F, 0.5061F, -0.0349F)); .texOffs(0, 157).addBox(-4.5F, -5.1667F, -3.8333F, 9.0F, 11.0F, 13.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(9.5F, -13.8333F, 6.8333F, -0.1571F, 0.5061F, -0.0349F));
PartDefinition leg_BR = root.addOrReplaceChild("leg_BR", CubeListBuilder.create().texOffs(152, 56).addBox(-4.5F, -5.1667F, -3.1667F, 9.0F, 11.0F, 13.0F, new CubeDeformation(0.0F)) PartDefinition leg_BR = root.addOrReplaceChild("leg_BR", CubeListBuilder.create().texOffs(152, 56).addBox(-4.5F, -5.1667F, -3.1667F, 9.0F, 11.0F, 13.0F, new CubeDeformation(0.0F))
.texOffs(120, 136).addBox(-5.5F, -2.1667F, 5.8333F, 11.0F, 13.0F, 19.0F, new CubeDeformation(0.0F)) .texOffs(120, 136).addBox(-5.5F, -2.1667F, 5.8333F, 11.0F, 13.0F, 19.0F, new CubeDeformation(0.0F))
.texOffs(202, 0).addBox(-4.5F, -7.1667F, 13.8333F, 9.0F, 11.0F, 13.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-9.5F, -13.8333F, 6.1667F, -0.1047F, -0.5061F, 0.0349F)); .texOffs(202, 0).addBox(-4.5F, -7.1667F, 13.8333F, 9.0F, 11.0F, 13.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-9.5F, -13.8333F, 6.1667F, -0.1571F, -0.5061F, 0.0349F));
model = null; model = null;
return def = LayerDefinition.create(meshdefinition, 256, 256); return def = LayerDefinition.create(meshdefinition, 256, 256);

View File

@ -1,9 +1,15 @@
package ru.dbotthepony.mc.otm.client.render.entity package ru.dbotthepony.mc.otm.client.render.entity
import com.mojang.blaze3d.vertex.PoseStack
import net.minecraft.client.model.HierarchicalModel import net.minecraft.client.model.HierarchicalModel
import net.minecraft.client.renderer.MultiBufferSource
import net.minecraft.client.renderer.RenderType
import net.minecraft.client.renderer.entity.EntityRendererProvider import net.minecraft.client.renderer.entity.EntityRendererProvider
import net.minecraft.client.renderer.entity.MobRenderer import net.minecraft.client.renderer.entity.MobRenderer
import net.minecraft.client.renderer.entity.layers.RenderLayer
import net.minecraft.client.renderer.texture.OverlayTexture
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.OverdriveThatMatters.loc import ru.dbotthepony.mc.otm.OverdriveThatMatters.loc
import ru.dbotthepony.mc.otm.client.model.entity.EnforcerModel import ru.dbotthepony.mc.otm.client.model.entity.EnforcerModel
import ru.dbotthepony.mc.otm.entity.Enforcer import ru.dbotthepony.mc.otm.entity.Enforcer
@ -12,7 +18,41 @@ class EnforcerRenderer(context: EntityRendererProvider.Context)
: MobRenderer<Enforcer, HierarchicalModel<Enforcer>>(context, EnforcerModel.getModel(), 2.2f) { : MobRenderer<Enforcer, HierarchicalModel<Enforcer>>(context, EnforcerModel.getModel(), 2.2f) {
override fun getTextureLocation(entity: Enforcer): ResourceLocation = TEXTURE_LOCATION override fun getTextureLocation(entity: Enforcer): ResourceLocation = TEXTURE_LOCATION
init {
this.addLayer(EnforcerEmissiveLayer(this, model))
}
companion object { companion object {
private val TEXTURE_LOCATION = loc("textures/entity/enforcer.png") private val TEXTURE_LOCATION = loc("textures/entity/enforcer.png")
} }
} }
class EnforcerEmissiveLayer(
entityRenderer: EnforcerRenderer,
model: HierarchicalModel<Enforcer>
) : RenderLayer<Enforcer, HierarchicalModel<Enforcer>>(entityRenderer) {
private val emissive = loc("textures/entity/enforcer_emissive.png")
override fun render(
poseStack: PoseStack,
bufferSource: MultiBufferSource,
packedLight: Int,
entity: Enforcer,
limbSwing: Float,
limbSwingAmount: Float,
partialTicks: Float,
ageInTicks: Float,
netHeadYaw: Float,
headPitch: Float
) {
val buffer = bufferSource.getBuffer(RenderType.eyes(emissive))
this.parentModel.renderToBuffer(
poseStack,
buffer,
15728640,
OverlayTexture.NO_OVERLAY
)
}
}

View File

@ -1,9 +1,11 @@
package ru.dbotthepony.mc.otm.entity package ru.dbotthepony.mc.otm.entity
import net.minecraft.server.level.ServerBossEvent
import net.minecraft.sounds.SoundEvent import net.minecraft.sounds.SoundEvent
import net.minecraft.sounds.SoundEvents import net.minecraft.sounds.SoundEvents
import net.minecraft.sounds.SoundSource import net.minecraft.sounds.SoundSource
import net.minecraft.util.Mth import net.minecraft.util.Mth
import net.minecraft.world.BossEvent
import net.minecraft.world.phys.Vec3 import net.minecraft.world.phys.Vec3
import net.minecraft.world.entity.AnimationState import net.minecraft.world.entity.AnimationState
import net.minecraft.world.entity.EntityType import net.minecraft.world.entity.EntityType
@ -19,6 +21,8 @@ import net.minecraft.world.entity.monster.*
import net.minecraft.world.entity.npc.Villager import net.minecraft.world.entity.npc.Villager
import net.minecraft.world.entity.player.Player import net.minecraft.world.entity.player.Player
import net.minecraft.world.level.Level import net.minecraft.world.level.Level
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.registry.MNames
import ru.dbotthepony.mc.otm.registry.game.MSoundEvents import ru.dbotthepony.mc.otm.registry.game.MSoundEvents
class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) { class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
@ -55,9 +59,33 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
return SoundEvents.VAULT_BREAK return SoundEvents.VAULT_BREAK
} }
private val bossEvent: ServerBossEvent =
ServerBossEvent(TranslatableComponent(MNames.ENFORCER), BossEvent.BossBarColor.RED, BossEvent.BossBarOverlay.PROGRESS)
override fun startSeenByPlayer(player: net.minecraft.server.level.ServerPlayer) {
super.startSeenByPlayer(player)
bossEvent.addPlayer(player)
}
override fun stopSeenByPlayer(player: net.minecraft.server.level.ServerPlayer) {
super.stopSeenByPlayer(player)
bossEvent.removePlayer(player)
}
override fun aiStep() {
super.aiStep()
bossEvent.progress = this.health / this.maxHealth
}
override fun die(cause: net.minecraft.world.damagesource.DamageSource) {
super.die(cause)
bossEvent.removeAllPlayers()
}
//charge attack, could possibly leave a smoke trail too idk //charge attack, could possibly leave a smoke trail too idk
class RammingGoal(private val mob: Enforcer) : Goal() { class RammingGoal(private val mob: Enforcer) : Goal() {
private var target: LivingEntity? = null private var target: LivingEntity? = null
private var chargeTime = 0 private var chargeTime = 0
private val windupTime = 20 private val windupTime = 20
private val maxChargeTime = 40 private val maxChargeTime = 40
@ -116,7 +144,7 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
mob.yRot = (-Mth.atan2(dir.x, dir.z) * (180f / Math.PI)).toFloat() mob.yRot = (-Mth.atan2(dir.x, dir.z) * (180f / Math.PI)).toFloat()
mob.yHeadRot = mob.yRot mob.yHeadRot = mob.yRot
mob.move(net.minecraft.world.entity.MoverType.SELF, dir.scale(1.2)) mob.move(net.minecraft.world.entity.MoverType.SELF, dir.scale(1.8))
if (mob.horizontalCollision) { if (mob.horizontalCollision) {
@ -157,7 +185,7 @@ class Enforcer(type: EntityType<Enforcer>, level: Level) : Monster(type,level) {
fun createAttributes() : AttributeSupplier.Builder { fun createAttributes() : AttributeSupplier.Builder {
return createMonsterAttributes() return createMonsterAttributes()
.add(Attributes.MAX_HEALTH, 300.0) .add(Attributes.MAX_HEALTH, 300.0)
.add(Attributes.ARMOR, 10.0) .add(Attributes.ARMOR, 20.0)
.add(Attributes.MOVEMENT_SPEED, 0.3) .add(Attributes.MOVEMENT_SPEED, 0.3)
.add(Attributes.STEP_HEIGHT, 1.0) .add(Attributes.STEP_HEIGHT, 1.0)
.add(Attributes.KNOCKBACK_RESISTANCE, 1.0) .add(Attributes.KNOCKBACK_RESISTANCE, 1.0)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B