-
Notifications
You must be signed in to change notification settings - Fork 135
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
bb95be0
commit a238ffa
Showing
4 changed files
with
52 additions
and
3 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
core/src/main/java/de/bluecolored/bluemap/core/map/hires/entity/ChickenRenderer.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,45 @@ | ||
package de.bluecolored.bluemap.core.map.hires.entity; | ||
|
||
import de.bluecolored.bluemap.core.map.TextureGallery; | ||
import de.bluecolored.bluemap.core.map.hires.RenderSettings; | ||
import de.bluecolored.bluemap.core.map.hires.TileModelView; | ||
import de.bluecolored.bluemap.core.resources.ResourcePath; | ||
import de.bluecolored.bluemap.core.resources.pack.resourcepack.ResourcePack; | ||
import de.bluecolored.bluemap.core.resources.pack.resourcepack.entitystate.Part; | ||
import de.bluecolored.bluemap.core.resources.pack.resourcepack.model.Model; | ||
import de.bluecolored.bluemap.core.util.Key; | ||
import de.bluecolored.bluemap.core.world.Entity; | ||
import de.bluecolored.bluemap.core.world.block.BlockNeighborhood; | ||
import de.bluecolored.bluemap.core.world.mca.entity.AgeEntity; | ||
|
||
public class ChickenRenderer extends ResourceModelRenderer { | ||
|
||
private final ResourcePath<Model> | ||
CHICKEN_ADULT = new ResourcePath<>(Key.MINECRAFT_NAMESPACE, "entity/chicken/adult"), | ||
CHICKEN_BABY = new ResourcePath<>(Key.MINECRAFT_NAMESPACE, "entity/chicken/baby"); | ||
|
||
public ChickenRenderer(ResourcePack resourcePack, TextureGallery textureGallery, RenderSettings renderSettings) { | ||
super(resourcePack, textureGallery, renderSettings); | ||
} | ||
|
||
@Override | ||
public void render(Entity entity, BlockNeighborhood block, Part part, TileModelView tileModel) { | ||
if (!(entity instanceof AgeEntity chicken)) return; | ||
|
||
// choose correct model | ||
ResourcePath<Model> model; | ||
if (chicken.getAge() < 0) { | ||
model = CHICKEN_BABY; | ||
} else { | ||
model = CHICKEN_ADULT; | ||
} | ||
|
||
// render chosen model | ||
super.render(entity, block, model.getResource(resourcePack::getModel), TintColorProvider.NO_TINT, tileModel); | ||
|
||
// apply part transform | ||
if (part.isTransformed()) | ||
tileModel.transform(part.getTransformMatrix()); | ||
} | ||
|
||
} |
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
2 changes: 1 addition & 1 deletion
2
core/src/main/resourceExtensions/assets/minecraft/entitystates/chicken.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"parts": [ | ||
{ "model": "minecraft:entity/chicken/adult" } | ||
{ "renderer": "minecraft:chicken" } | ||
] | ||
} |