generated from NeoForgeMDKs/MDK-1.21-ModDevGradle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f39b71
commit aa5cc18
Showing
29 changed files
with
725 additions
and
40 deletions.
There are no files selected for viewing
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
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
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
61 changes: 61 additions & 0 deletions
61
src/main/java/io/github/afamiliarquiet/familiar_magic/client/CatHatLayer.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,61 @@ | ||
package io.github.afamiliarquiet.familiar_magic.client; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import com.mojang.math.Axis; | ||
import net.minecraft.client.model.CatModel; | ||
import net.minecraft.client.model.geom.ModelPart; | ||
import net.minecraft.client.renderer.ItemInHandRenderer; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.client.renderer.entity.RenderLayerParent; | ||
import net.minecraft.client.renderer.entity.layers.RenderLayer; | ||
import net.minecraft.world.entity.animal.Cat; | ||
import net.minecraft.world.item.ItemDisplayContext; | ||
import net.minecraft.world.item.ItemStack; | ||
import org.joml.Quaternionf; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
import static io.github.afamiliarquiet.familiar_magic.FamiliarTricks.getHat; | ||
|
||
@ParametersAreNonnullByDefault | ||
public class CatHatLayer extends RenderLayer<Cat, CatModel<Cat>> { | ||
private final ItemInHandRenderer actuallyItsAHatRenderer; | ||
public CatHatLayer(RenderLayerParent<Cat, CatModel<Cat>> renderer, ItemInHandRenderer itemInHandRenderer) { | ||
super(renderer); | ||
this.actuallyItsAHatRenderer = itemInHandRenderer; | ||
} | ||
|
||
@Override | ||
public void render( | ||
PoseStack poseStack, | ||
MultiBufferSource buffer, | ||
int packedLight, | ||
Cat cat, | ||
float limbSwing, | ||
float limbSwingAmount, | ||
float partialTick, | ||
float ageInTicks, | ||
float netHeadYaw, | ||
float headPitch | ||
) { | ||
ItemStack hat = getHat(cat); | ||
if (hat.isEmpty()) { | ||
return; | ||
} | ||
|
||
poseStack.pushPose(); | ||
|
||
ModelPart littleFishyHead = this.getParentModel().head; | ||
poseStack.translate(littleFishyHead.x / 16.0f, littleFishyHead.y / 16.0f, littleFishyHead.z / 16.0f); | ||
poseStack.mulPose(new Quaternionf().rotationZYX(littleFishyHead.zRot, littleFishyHead.yRot, littleFishyHead.xRot)); | ||
poseStack.scale(littleFishyHead.xScale, littleFishyHead.yScale, littleFishyHead.zScale); | ||
|
||
poseStack.mulPose(Axis.ZP.rotationDegrees(180)); | ||
poseStack.translate(0f, 0f, -0.0625f); | ||
|
||
poseStack.scale(0.375f, 0.375f, 0.375f); | ||
|
||
this.actuallyItsAHatRenderer.renderItem(cat, hat, ItemDisplayContext.HEAD, false, poseStack, buffer, packedLight); | ||
poseStack.popPose(); | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
src/main/java/io/github/afamiliarquiet/familiar_magic/client/FoxHatLayer.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,67 @@ | ||
package io.github.afamiliarquiet.familiar_magic.client; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import com.mojang.math.Axis; | ||
import net.minecraft.client.model.FoxModel; | ||
import net.minecraft.client.model.geom.ModelPart; | ||
import net.minecraft.client.renderer.ItemInHandRenderer; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.client.renderer.entity.RenderLayerParent; | ||
import net.minecraft.client.renderer.entity.layers.RenderLayer; | ||
import net.minecraft.world.entity.animal.Fox; | ||
import net.minecraft.world.item.ItemDisplayContext; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.neoforged.api.distmarker.Dist; | ||
import net.neoforged.api.distmarker.OnlyIn; | ||
import org.joml.Quaternionf; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
import static io.github.afamiliarquiet.familiar_magic.FamiliarTricks.getHat; | ||
|
||
@OnlyIn(Dist.CLIENT) | ||
@ParametersAreNonnullByDefault | ||
public class FoxHatLayer extends RenderLayer<Fox, FoxModel<Fox>> { | ||
private final ItemInHandRenderer actuallyItsAHatRenderer; | ||
|
||
public FoxHatLayer(RenderLayerParent<Fox, FoxModel<Fox>> renderer, ItemInHandRenderer itemInHandRenderer) { | ||
super(renderer); | ||
this.actuallyItsAHatRenderer = itemInHandRenderer; | ||
} | ||
|
||
// do NOT copy from the fox held item layer i dont know WHAT they were cooking with all that translation and rotation | ||
// just copy the head part's translation/rotation/scale(baby) | ||
@Override | ||
public void render( | ||
PoseStack poseStack, | ||
MultiBufferSource buffer, | ||
int packedLight, | ||
Fox fox, | ||
float limbSwing, | ||
float limbSwingAmount, | ||
float partialTicks, | ||
float ageInTicks, | ||
float netHeadYaw, | ||
float headPitch | ||
) { | ||
ItemStack hat = getHat(fox); | ||
if (hat.isEmpty()) { | ||
return; | ||
} | ||
|
||
poseStack.pushPose(); | ||
|
||
ModelPart littleFishyHead = this.getParentModel().head; | ||
poseStack.translate(littleFishyHead.x / 16.0f, littleFishyHead.y / 16.0f, littleFishyHead.z / 16.0f); | ||
poseStack.mulPose(new Quaternionf().rotationZYX(littleFishyHead.zRot, littleFishyHead.yRot, littleFishyHead.xRot)); | ||
poseStack.scale(littleFishyHead.xScale, littleFishyHead.yScale, littleFishyHead.zScale); | ||
|
||
poseStack.mulPose(Axis.ZP.rotationDegrees(180)); | ||
poseStack.translate(-0.0625f, 0f, -0.125f); | ||
|
||
poseStack.scale(0.5625f, 0.5625f, 0.5625f); | ||
|
||
this.actuallyItsAHatRenderer.renderItem(fox, hat, ItemDisplayContext.HEAD, false, poseStack, buffer, packedLight); | ||
poseStack.popPose(); | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
src/main/java/io/github/afamiliarquiet/familiar_magic/client/ParrotHatLayer.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,61 @@ | ||
package io.github.afamiliarquiet.familiar_magic.client; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import com.mojang.math.Axis; | ||
import net.minecraft.client.model.ParrotModel; | ||
import net.minecraft.client.model.geom.ModelPart; | ||
import net.minecraft.client.renderer.ItemInHandRenderer; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.client.renderer.entity.RenderLayerParent; | ||
import net.minecraft.client.renderer.entity.layers.RenderLayer; | ||
import net.minecraft.world.entity.animal.Parrot; | ||
import net.minecraft.world.item.ItemDisplayContext; | ||
import net.minecraft.world.item.ItemStack; | ||
import org.joml.Quaternionf; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
import static io.github.afamiliarquiet.familiar_magic.FamiliarTricks.getHat; | ||
|
||
@ParametersAreNonnullByDefault | ||
public class ParrotHatLayer extends RenderLayer<Parrot, ParrotModel> { | ||
private final ItemInHandRenderer actuallyItsAHatRenderer; | ||
public ParrotHatLayer(RenderLayerParent<Parrot, ParrotModel> renderer, ItemInHandRenderer itemInHandRenderer) { | ||
super(renderer); | ||
this.actuallyItsAHatRenderer = itemInHandRenderer; | ||
} | ||
|
||
@Override | ||
public void render( | ||
PoseStack poseStack, | ||
MultiBufferSource buffer, | ||
int packedLight, | ||
Parrot parrot, | ||
float limbSwing, | ||
float limbSwingAmount, | ||
float partialTick, | ||
float ageInTicks, | ||
float netHeadYaw, | ||
float headPitch | ||
) { | ||
ItemStack hat = getHat(parrot); | ||
if (hat.isEmpty()) { | ||
return; | ||
} | ||
|
||
poseStack.pushPose(); | ||
|
||
ModelPart littleFishyHead = this.getParentModel().head; | ||
poseStack.translate(littleFishyHead.x / 16.0f, littleFishyHead.y / 16.0f, littleFishyHead.z / 16.0f); | ||
poseStack.mulPose(new Quaternionf().rotationZYX(littleFishyHead.zRot, littleFishyHead.yRot, littleFishyHead.xRot)); | ||
poseStack.scale(littleFishyHead.xScale, littleFishyHead.yScale, littleFishyHead.zScale); | ||
|
||
poseStack.mulPose(Axis.ZP.rotationDegrees(180)); | ||
poseStack.translate(0f, 0.0625f, -0.0625f); | ||
|
||
poseStack.scale(0.3125f, 0.3125f, 0.3125f); | ||
|
||
this.actuallyItsAHatRenderer.renderItem(parrot, hat, ItemDisplayContext.HEAD, false, poseStack, buffer, packedLight); | ||
poseStack.popPose(); | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
src/main/java/io/github/afamiliarquiet/familiar_magic/client/SilverfishHatLayer.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,68 @@ | ||
package io.github.afamiliarquiet.familiar_magic.client; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import com.mojang.math.Axis; | ||
import net.minecraft.client.model.SilverfishModel; | ||
import net.minecraft.client.model.geom.ModelPart; | ||
import net.minecraft.client.renderer.ItemInHandRenderer; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.client.renderer.entity.RenderLayerParent; | ||
import net.minecraft.client.renderer.entity.layers.RenderLayer; | ||
import net.minecraft.world.entity.monster.Silverfish; | ||
import net.minecraft.world.item.ItemDisplayContext; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.neoforged.api.distmarker.Dist; | ||
import net.neoforged.api.distmarker.OnlyIn; | ||
import org.joml.Quaternionf; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
import static io.github.afamiliarquiet.familiar_magic.FamiliarTricks.getHat; | ||
|
||
@OnlyIn(Dist.CLIENT) | ||
@ParametersAreNonnullByDefault | ||
public class SilverfishHatLayer extends RenderLayer<Silverfish, SilverfishModel<Silverfish>> { | ||
private final ItemInHandRenderer actuallyItsAHatRenderer; | ||
|
||
public SilverfishHatLayer(RenderLayerParent<Silverfish, SilverfishModel<Silverfish>> renderer, ItemInHandRenderer itemInHandRenderer) { | ||
super(renderer); | ||
this.actuallyItsAHatRenderer = itemInHandRenderer; | ||
} | ||
|
||
@Override | ||
public void render( | ||
PoseStack poseStack, | ||
MultiBufferSource buffer, | ||
int packedLight, | ||
Silverfish silverfish, | ||
float limbSwing, | ||
float limbSwingAmount, | ||
float partialTick, | ||
float ageInTicks, | ||
float netHeadYaw, | ||
float headPitch | ||
) { | ||
ItemStack hat = getHat(silverfish); | ||
if (hat.isEmpty()) { | ||
return; | ||
} | ||
|
||
poseStack.pushPose(); | ||
|
||
if (!this.getParentModel().root().hasChild("segment0")) { | ||
return; | ||
} | ||
ModelPart littleFishyHead = this.getParentModel().root().getChild("segment0"); | ||
poseStack.translate(littleFishyHead.x / 16.0f, littleFishyHead.y / 16.0f, littleFishyHead.z / 16.0f); | ||
poseStack.mulPose(new Quaternionf().rotationZYX(littleFishyHead.zRot, littleFishyHead.yRot, littleFishyHead.xRot)); | ||
|
||
poseStack.mulPose(Axis.ZP.rotationDegrees(180)); | ||
|
||
poseStack.translate(0f, -0.05f, 0f); | ||
|
||
poseStack.scale(0.25f, 0.25f, 0.25f); | ||
|
||
this.actuallyItsAHatRenderer.renderItem(silverfish, hat, ItemDisplayContext.HEAD, false, poseStack, buffer, packedLight); | ||
poseStack.popPose(); | ||
} | ||
} |
Oops, something went wrong.