-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added double-headed yufeng, as a proof of concept for multi-headed la…
…texes
- Loading branch information
1 parent
0981f4e
commit fe9c7fc
Showing
25 changed files
with
929 additions
and
1 deletion.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
3dmodels/UnifiedLatexModels/DarkLatexYufeng/DarkLatexDoubleYufengUnified.bbmodel
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/net/ltxprogrammer/changed/client/renderer/DarkLatexDoubleYufengRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package net.ltxprogrammer.changed.client.renderer; | ||
|
||
import net.ltxprogrammer.changed.Changed; | ||
import net.ltxprogrammer.changed.client.renderer.layers.CustomEyesLayer; | ||
import net.ltxprogrammer.changed.client.renderer.layers.LatexParticlesLayer; | ||
import net.ltxprogrammer.changed.client.renderer.layers.TransfurCapeLayer; | ||
import net.ltxprogrammer.changed.client.renderer.model.DarkLatexDoubleYufengModel; | ||
import net.ltxprogrammer.changed.client.renderer.model.armor.ArmorLatexMaleWingedDragonModel; | ||
import net.ltxprogrammer.changed.entity.beast.DarkLatexDoubleYufeng; | ||
import net.ltxprogrammer.changed.util.Color3; | ||
import net.minecraft.client.renderer.entity.EntityRendererProvider; | ||
import net.minecraft.resources.ResourceLocation; | ||
|
||
public class DarkLatexDoubleYufengRenderer extends AdvancedHumanoidRenderer<DarkLatexDoubleYufeng, DarkLatexDoubleYufengModel, ArmorLatexMaleWingedDragonModel<DarkLatexDoubleYufeng>> { | ||
public DarkLatexDoubleYufengRenderer(EntityRendererProvider.Context context) { | ||
super(context, new DarkLatexDoubleYufengModel(context.bakeLayer(DarkLatexDoubleYufengModel.LAYER_LOCATION)), ArmorLatexMaleWingedDragonModel.MODEL_SET, 0.5f); | ||
this.addLayer(new LatexParticlesLayer<>(this, getModel(), model::isPartNotMask)); | ||
this.addLayer(TransfurCapeLayer.normalCape(this, context.getModelSet())); | ||
this.addLayer(CustomEyesLayer.builder(this, context.getModelSet()) | ||
.withSclera(Color3.fromInt(0x242424)) | ||
.withIris(CustomEyesLayer.fixedIfNotDarkLatexOverrideLeft(Color3.WHITE), | ||
CustomEyesLayer.fixedIfNotDarkLatexOverrideRight(Color3.WHITE)) | ||
.build()); | ||
} | ||
|
||
@Override | ||
public ResourceLocation getTextureLocation(DarkLatexDoubleYufeng p_114482_) { | ||
return Changed.modResource("textures/dark_latex_yufeng.png"); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
.../java/net/ltxprogrammer/changed/client/renderer/animate/multihead/DoubleHeadAnimator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package net.ltxprogrammer.changed.client.renderer.animate.multihead; | ||
|
||
import net.ltxprogrammer.changed.client.renderer.animate.HumanoidAnimator; | ||
import net.ltxprogrammer.changed.client.renderer.model.AdvancedHumanoidModel; | ||
import net.ltxprogrammer.changed.entity.ChangedEntity; | ||
import net.ltxprogrammer.changed.entity.beast.DoubleHeadedEntity; | ||
import net.minecraft.client.model.geom.ModelPart; | ||
import net.minecraft.util.Mth; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class DoubleHeadAnimator<T extends ChangedEntity & DoubleHeadedEntity, M extends AdvancedHumanoidModel<T>> extends HumanoidAnimator.Animator<T, M> { | ||
private final ModelPart head; | ||
private final ModelPart head2; | ||
|
||
public DoubleHeadAnimator(ModelPart head, ModelPart head2) { | ||
this.head = head; | ||
this.head2 = head2; | ||
} | ||
|
||
@Override | ||
public HumanoidAnimator.AnimateStage preferredStage() { | ||
return HumanoidAnimator.AnimateStage.FINAL; | ||
} | ||
|
||
private float gap = 4.0f; | ||
private float tilt = Mth.DEG_TO_RAD * 5.0f; | ||
@Override | ||
public void setupAnim(@NotNull T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { | ||
boolean fallFlying = entity.getFallFlyingTicks() > 4; | ||
this.head2.copyFrom(this.head); | ||
|
||
float partialTicks = Mth.positiveModulo(ageInTicks, 1.0f); | ||
|
||
float head2Yaw = Mth.clamp((entity.getHead2YRot(partialTicks) - Mth.rotLerp(partialTicks, entity.yBodyRotO, entity.yBodyRot)) % 360.0f, -90.0f, 90.0f); | ||
float head2Pitch = entity.getHead2XRot(partialTicks); | ||
head2.yRot = head2Yaw * ((float)Math.PI / 180F); | ||
head2.zRot = 0.0F; | ||
if (fallFlying) { | ||
head2.xRot = (-(float)Math.PI / 4F); | ||
} else if (core.swimAmount > 0.0F) { | ||
if (entity.isVisuallySwimming()) { | ||
head2.xRot = HumanoidAnimator.rotlerpRad(core.swimAmount, head2.xRot, (-(float)Math.PI / 4F)); | ||
} else { | ||
head2.xRot = HumanoidAnimator.rotlerpRad(core.swimAmount, head2.xRot, head2Pitch * ((float)Math.PI / 180F)); | ||
} | ||
} else { | ||
head2.xRot = head2Pitch * ((float)Math.PI / 180F); | ||
} | ||
|
||
this.head.x = -gap; | ||
this.head2.x = gap; | ||
this.head.zRot -= tilt; | ||
this.head2.zRot += tilt; | ||
} | ||
} |
Oops, something went wrong.