diff --git a/dev_resources/models/defender.bbmodel b/dev_resources/models/defender.bbmodel new file mode 100644 index 0000000000..f6e1acb4f1 --- /dev/null +++ b/dev_resources/models/defender.bbmodel @@ -0,0 +1 @@ +{"meta":{"format_version":"4.5","model_format":"modded_entity","box_uv":true},"name":"defender","model_identifier":"","modded_entity_version":"1.17","modded_entity_flip_y":true,"visible_box":[1,1,0],"variable_placeholders":"","variable_placeholder_buttons":[],"unhandled_root_fields":{},"resolution":{"width":24,"height":24},"elements":[{"name":"cube","box_uv":true,"rescale":false,"locked":false,"render_order":"default","allow_mirror_modeling":true,"from":[-6,0,0],"to":[6,12,0.01],"autouv":0,"color":8,"origin":[0,0,0],"uv_offset":[-0.01,-0.01],"faces":{"north":{"uv":[0,0,12,12]},"east":{"uv":[-0.01,0,0,12]},"south":{"uv":[12.01,0,24.009999999999998,12]},"west":{"uv":[12,0,12.01,12]},"up":{"uv":[12,0,-2.1337098754514727e-16,-0.01]},"down":{"uv":[24,-0.01,12.000000000000002,0]}},"type":"cube","uuid":"885a951a-9019-d169-e38c-73726f062998"},{"name":"cube","box_uv":true,"rescale":false,"locked":false,"render_order":"default","allow_mirror_modeling":true,"from":[-6,0,0],"to":[6,12,0.01],"autouv":0,"color":8,"origin":[0,0,0],"uv_offset":[-0.01,-0.01],"faces":{"north":{"uv":[0,0,12,12]},"east":{"uv":[-0.01,0,0,12]},"south":{"uv":[12.01,0,24.009999999999998,12]},"west":{"uv":[12,0,12.01,12]},"up":{"uv":[12,0,-2.1337098754514727e-16,-0.01]},"down":{"uv":[24,-0.01,12.000000000000002,0]}},"type":"cube","uuid":"582ecae4-b50c-0c1c-8816-198d159fe599"}],"outliner":[{"name":"cube","origin":[0,0,0],"rotation":[0,45,0],"color":0,"nbt":"{}","uuid":"677d5f39-9d0b-763c-37f0-5e7a804c1cd8","export":true,"mirror_uv":false,"isOpen":true,"locked":false,"visibility":true,"autouv":0,"children":["885a951a-9019-d169-e38c-73726f062998"]},{"name":"cube2","origin":[0,0,0],"rotation":[0,-45,0],"color":0,"nbt":"{}","uuid":"33e45818-f49a-7047-f0e1-5660d2f7b10e","export":true,"mirror_uv":false,"isOpen":true,"locked":false,"visibility":true,"autouv":0,"children":["582ecae4-b50c-0c1c-8816-198d159fe599"]}],"textures":[]} \ No newline at end of file diff --git a/src/main/java/de/teamlapen/vampirism/client/model/RemainsDefenderModel.java b/src/main/java/de/teamlapen/vampirism/client/model/RemainsDefenderModel.java index 815664e21f..4ce7438ac6 100644 --- a/src/main/java/de/teamlapen/vampirism/client/model/RemainsDefenderModel.java +++ b/src/main/java/de/teamlapen/vampirism/client/model/RemainsDefenderModel.java @@ -11,32 +11,34 @@ public class RemainsDefenderModel extends EntityModel { - private static final String MAIN = "main"; + private static final String PART1 = "part1"; + private static final String PART2 = "part2"; - protected final @NotNull ModelPart main; + protected final @NotNull ModelPart part1; + protected final @NotNull ModelPart part2; public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); - PartDefinition main = partdefinition.addOrReplaceChild(MAIN, CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -4.0F, -4.0F, 8.0F, 4.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); + PartDefinition cube = partdefinition.addOrReplaceChild(PART1, CubeListBuilder.create().texOffs(0, 0).addBox(-6.0F, -12.0F, 0.0F, 12.0F, 12.0F, 0.01F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 24.0F, 0.0F, 0.0F, -0.7854F, 0.0F)); + PartDefinition cube2 = partdefinition.addOrReplaceChild(PART2, CubeListBuilder.create().texOffs(0, 0).addBox(-6.0F, -12.0F, 0.0F, 12.0F, 12.0F, 0.01F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 24.0F, 0.0F, 0.0F, 0.7854F, 0.0F)); - return LayerDefinition.create(meshdefinition, 32, 32); + return LayerDefinition.create(meshdefinition, 24, 24); } public RemainsDefenderModel(ModelPart part) { - this.main = part.getChild(MAIN); + this.part1 = part.getChild(PART1); + this.part2 = part.getChild(PART2); } @Override public void setupAnim(RemainsDefenderEntity pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { - main.yRot = 0; - main.zRot = 0; - main.xRot = 0; } @Override public void renderToBuffer(PoseStack pPoseStack, VertexConsumer pBuffer, int pPackedLight, int pPackedOverlay, float pRed, float pGreen, float pBlue, float pAlpha) { - this.main.render(pPoseStack, pBuffer, pPackedLight, pPackedOverlay); + this.part1.render(pPoseStack, pBuffer, pPackedLight, pPackedOverlay); + this.part2.render(pPoseStack, pBuffer, pPackedLight, pPackedOverlay); } } diff --git a/src/main/java/de/teamlapen/vampirism/client/renderer/entity/RemainsDefenderRenderer.java b/src/main/java/de/teamlapen/vampirism/client/renderer/entity/RemainsDefenderRenderer.java index 60ef5700c3..dd53cd0b17 100644 --- a/src/main/java/de/teamlapen/vampirism/client/renderer/entity/RemainsDefenderRenderer.java +++ b/src/main/java/de/teamlapen/vampirism/client/renderer/entity/RemainsDefenderRenderer.java @@ -7,11 +7,16 @@ import de.teamlapen.vampirism.entity.RemainsDefenderEntity; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.MobRenderer; +import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; import org.jetbrains.annotations.NotNull; public class RemainsDefenderRenderer extends MobRenderer { - private final ResourceLocation TEX = new ResourceLocation(REFERENCE.MODID, "textures/entity/remains_defender.png"); + private final ResourceLocation TEX1 = new ResourceLocation(REFERENCE.MODID, "textures/entity/remains_defender/remains_defender1.png"); + private final ResourceLocation TEX2 = new ResourceLocation(REFERENCE.MODID, "textures/entity/remains_defender/remains_defender2.png"); + private final ResourceLocation TEX3 = new ResourceLocation(REFERENCE.MODID, "textures/entity/remains_defender/remains_defender3.png"); + private final ResourceLocation TEX4 = new ResourceLocation(REFERENCE.MODID, "textures/entity/remains_defender/remains_defender4.png"); public RemainsDefenderRenderer(EntityRendererProvider.Context pContext) { super(pContext, new RemainsDefenderModel(pContext.bakeLayer(ModEntitiesRender.REMAINS_DEFENDER)), 0f); @@ -19,7 +24,16 @@ public RemainsDefenderRenderer(EntityRendererProvider.Context pContext) { @Override public @NotNull ResourceLocation getTextureLocation(@NotNull RemainsDefenderEntity pEntity) { - return TEX; + int t = pEntity.tickCount % 20; + if (t> 15) { + return TEX4; + } else if (t > 10) { + return TEX3; + } else if (t > 5) { + return TEX2; + } else { + return TEX1; + } } @Override @@ -28,4 +42,10 @@ protected void setupRotations(RemainsDefenderEntity pEntityLiving, PoseStack pMa pMatrixStack.mulPose(pEntityLiving.getAttachFace().getOpposite().getRotation()); pMatrixStack.translate(0,-0.5,0); } + + @Override + protected int getBlockLightLevel(RemainsDefenderEntity pEntity, BlockPos pPos) { + int i = (int) Mth.clampedLerp(0.0F, 15.0F, (float)pEntity.getLightTicksRemaining() / 10.0F); + return i == 15 ? 15 : Math.max(i, super.getBlockLightLevel(pEntity, pPos)); + } } diff --git a/src/main/java/de/teamlapen/vampirism/entity/RemainsDefenderEntity.java b/src/main/java/de/teamlapen/vampirism/entity/RemainsDefenderEntity.java index 715c320b47..513fea5c28 100644 --- a/src/main/java/de/teamlapen/vampirism/entity/RemainsDefenderEntity.java +++ b/src/main/java/de/teamlapen/vampirism/entity/RemainsDefenderEntity.java @@ -38,6 +38,8 @@ public class RemainsDefenderEntity extends AbstractGolem implements IRemainsEntity { protected static final EntityDataAccessor DATA_ATTACH_FACE_ID = SynchedEntityData.defineId(RemainsDefenderEntity.class, EntityDataSerializers.DIRECTION); + private static final EntityDataAccessor DATA_LIGHT_TICKS_REMAINING = SynchedEntityData.defineId(RemainsDefenderEntity.class, EntityDataSerializers.INT); + public static AttributeSupplier.Builder createAttributes() { return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 20.0D).add(Attributes.ARMOR, 15).add(Attributes.ATTACK_DAMAGE, 5).add(Attributes.ARMOR_TOUGHNESS, 6); @@ -75,6 +77,15 @@ public void tick() { } } + @Override + public void aiStep() { + super.aiStep(); + int i = this.getLightTicksRemaining(); + if (i > 0) { + this.setLightTicksRemaining(i - 1); + } + } + @Override public boolean isInvulnerableTo(@NotNull DamageSource pSource) { return pSource.is(ModTags.DamageTypes.MOTHER_RESISTANT_TO) || pSource.is(DamageTypes.IN_WALL) || pSource.is(DamageTypes.DROWN) || super.isInvulnerableTo(pSource); @@ -94,18 +105,21 @@ protected SoundEvent getDeathSound() { protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ATTACH_FACE_ID, Direction.DOWN); + this.entityData.define(DATA_LIGHT_TICKS_REMAINING, 0); } @Override public void readAdditionalSaveData(@NotNull CompoundTag pCompound) { super.readAdditionalSaveData(pCompound); this.setAttachFace(Direction.from3DDataValue(pCompound.getByte("AttachFace"))); + this.setLightTicksRemaining(pCompound.getInt("LightTicks")); } @Override public void addAdditionalSaveData(@NotNull CompoundTag pCompound) { super.addAdditionalSaveData(pCompound); pCompound.putByte("AttachFace", (byte) this.getAttachFace().get3DDataValue()); + pCompound.putInt("LightTicks", this.getLightTicksRemaining()); } @Override @@ -204,6 +218,14 @@ public Optional getDummy() { return Optional.ofNullable(this.getVehicle()).filter(VulnerableRemainsDummyEntity.class::isInstance).map(VulnerableRemainsDummyEntity.class::cast); } + private void setLightTicksRemaining(int ticks) { + this.entityData.set(DATA_LIGHT_TICKS_REMAINING, ticks); + } + + public int getLightTicksRemaining() { + return this.entityData.get(DATA_LIGHT_TICKS_REMAINING); + } + class RemainsDefenderAttackGoal extends Goal { private int attackTime; @@ -253,6 +275,7 @@ public void tick() { projectile.setDamage((float) RemainsDefenderEntity.this.getAttributeValue(Attributes.ATTACK_DAMAGE), 0); projectile.excludeShooter(); RemainsDefenderEntity.this.level().addFreshEntity(projectile); + RemainsDefenderEntity.this.setLightTicksRemaining(40); } } else { RemainsDefenderEntity.this.setTarget(null); diff --git a/src/main/resources/assets/vampirism/textures/entity/remains_defender.png b/src/main/resources/assets/vampirism/textures/entity/remains_defender.png deleted file mode 100644 index bcee9d9130..0000000000 Binary files a/src/main/resources/assets/vampirism/textures/entity/remains_defender.png and /dev/null differ diff --git a/src/main/resources/assets/vampirism/textures/entity/remains_defender/remains_defender1.png b/src/main/resources/assets/vampirism/textures/entity/remains_defender/remains_defender1.png new file mode 100644 index 0000000000..063477c587 Binary files /dev/null and b/src/main/resources/assets/vampirism/textures/entity/remains_defender/remains_defender1.png differ diff --git a/src/main/resources/assets/vampirism/textures/entity/remains_defender/remains_defender2.png b/src/main/resources/assets/vampirism/textures/entity/remains_defender/remains_defender2.png new file mode 100644 index 0000000000..feabd3311d Binary files /dev/null and b/src/main/resources/assets/vampirism/textures/entity/remains_defender/remains_defender2.png differ diff --git a/src/main/resources/assets/vampirism/textures/entity/remains_defender/remains_defender3.png b/src/main/resources/assets/vampirism/textures/entity/remains_defender/remains_defender3.png new file mode 100644 index 0000000000..157b6135b8 Binary files /dev/null and b/src/main/resources/assets/vampirism/textures/entity/remains_defender/remains_defender3.png differ diff --git a/src/main/resources/assets/vampirism/textures/entity/remains_defender/remains_defender4.png b/src/main/resources/assets/vampirism/textures/entity/remains_defender/remains_defender4.png new file mode 100644 index 0000000000..ceb86543ed Binary files /dev/null and b/src/main/resources/assets/vampirism/textures/entity/remains_defender/remains_defender4.png differ diff --git a/src/main/resources/assets/vampirism/textures/item/mother_core.png b/src/main/resources/assets/vampirism/textures/item/mother_core.png index cb6876b7df..b60fff697e 100644 Binary files a/src/main/resources/assets/vampirism/textures/item/mother_core.png and b/src/main/resources/assets/vampirism/textures/item/mother_core.png differ diff --git a/src/main/resources/assets/vampirism/textures/item/mother_core.png.mcmeta b/src/main/resources/assets/vampirism/textures/item/mother_core.png.mcmeta new file mode 100644 index 0000000000..4a650b1888 --- /dev/null +++ b/src/main/resources/assets/vampirism/textures/item/mother_core.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 5 + } +}