-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: villagers using moon villagers' model (#382)
* fix: villagers using moon villagers' model * chore: forgot license headers oops
- Loading branch information
1 parent
7d1077e
commit dff802d
Showing
9 changed files
with
133 additions
and
111 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
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
68 changes: 68 additions & 0 deletions
68
src/main/java/dev/galacticraft/mod/client/render/entity/model/MoonVillagerModel.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 @@ | ||
/* | ||
* Copyright (c) 2019-2024 Team Galacticraft | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package dev.galacticraft.mod.client.render.entity.model; | ||
|
||
import dev.galacticraft.mod.Constant; | ||
import dev.galacticraft.mod.content.entity.MoonVillagerEntity; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.client.model.VillagerModel; | ||
import net.minecraft.client.model.geom.ModelPart; | ||
import net.minecraft.client.model.geom.PartNames; | ||
import net.minecraft.client.model.geom.PartPose; | ||
import net.minecraft.client.model.geom.builders.CubeListBuilder; | ||
import net.minecraft.client.model.geom.builders.LayerDefinition; | ||
import net.minecraft.client.model.geom.builders.MeshDefinition; | ||
|
||
@Environment(EnvType.CLIENT) | ||
public class MoonVillagerModel extends VillagerModel<MoonVillagerEntity> { | ||
private final ModelPart hat; | ||
private final ModelPart hatRim; | ||
private final ModelPart jacket; | ||
|
||
public MoonVillagerModel(ModelPart modelPart) { | ||
super(modelPart); | ||
this.hat = modelPart.getChild("head").getChild("hat"); | ||
this.hatRim = this.hat.getChild("hat_rim"); | ||
this.jacket = modelPart.getChild("body").getChild("jacket"); | ||
} | ||
|
||
public static LayerDefinition createBodyLayer() { | ||
MeshDefinition mesh = VillagerModel.createBodyModel(); | ||
mesh.getRoot().getChild(PartNames.HEAD).addOrReplaceChild( | ||
Constant.ModelPartName.MOON_VILLAGER_BRAIN, | ||
CubeListBuilder.create().texOffs(0, 38).addBox(-5.0F, -16.0F, -5.0F, 10.0F, 8.0F, 10.0F), | ||
PartPose.ZERO | ||
); | ||
|
||
return LayerDefinition.create(mesh, 64, 64); | ||
} | ||
|
||
@Override | ||
public void setupAnim(MoonVillagerEntity entityGoalInfo, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch) { | ||
super.setupAnim(entityGoalInfo, limbAngle, limbDistance, animationProgress, headYaw, headPitch); | ||
this.hat.visible = false; | ||
this.hatRim.visible = false; | ||
this.jacket.visible = false; | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
src/main/java/dev/galacticraft/mod/content/entity/MoonVillagerEntity.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,33 @@ | ||
/* | ||
* Copyright (c) 2019-2024 Team Galacticraft | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package dev.galacticraft.mod.content.entity; | ||
|
||
import net.minecraft.world.entity.EntityType; | ||
import net.minecraft.world.entity.npc.Villager; | ||
import net.minecraft.world.level.Level; | ||
|
||
public class MoonVillagerEntity extends Villager { | ||
public MoonVillagerEntity(EntityType<? extends MoonVillagerEntity> entityType, Level level) { | ||
super(entityType, level); | ||
} | ||
} |
85 changes: 0 additions & 85 deletions
85
src/main/java/dev/galacticraft/mod/mixin/client/VillagerModelMixin.java
This file was deleted.
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