Skip to content

Commit

Permalink
Fixed moobloom layer
Browse files Browse the repository at this point in the history
  • Loading branch information
Faboslav committed Sep 28, 2024
1 parent d1b8fc6 commit fb44baf
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.0.2

- Fixed incorrect moobloom texture layer

## 3.0.1

- Fixed villager trades not being specific to the beekeeper villager profession
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@
@Environment(EnvType.CLIENT)
public final class MoobloomFlowerFeatureRenderer<T extends MoobloomEntity> extends FeatureRenderer<T, CowEntityModel<T>>
{
private final BlockRenderManager blockRenderManager;

public MoobloomFlowerFeatureRenderer(
FeatureRendererContext<T, CowEntityModel<T>> featureRendererContext
) {
super(featureRendererContext);
this.blockRenderManager = MinecraftClient.getInstance().getBlockRenderManager();
}

public void render(
Expand All @@ -41,8 +44,6 @@ public void render(
float l
) {
if (!moobloomEntity.isBaby() && !moobloomEntity.isInvisible()) {
BlockRenderManager blockRenderManager = MinecraftClient.getInstance().getBlockRenderManager();

PlantBlock flower = moobloomEntity.getVariant().getFlower();
BlockState blockState = moobloomEntity.getVariant().getFlower().getDefaultState();

Expand All @@ -61,37 +62,37 @@ public void render(

MinecraftClient minecraftClient = MinecraftClient.getInstance();
boolean renderAsModel = minecraftClient.hasOutline(moobloomEntity) && moobloomEntity.isInvisible();
BakedModel bakedModel = blockRenderManager.getModel(blockState);
BakedModel bakedModel = this.blockRenderManager.getModel(blockState);

// Head
matrixStack.push();
this.getContextModel().getHead().rotate(matrixStack);
matrixStack.translate(0.09D, -0.6D, -0.185D);
matrixStack.scale(-scaleFactor, -scaleFactor, scaleFactor);
matrixStack.translate(-0.5D, yOffset, -0.5D);
this.renderFlower(matrixStack, vertexConsumerProvider, light, renderAsModel, blockRenderManager, blockState, overlay, bakedModel);
this.renderFlower(matrixStack, vertexConsumerProvider, light, renderAsModel, blockState, overlay, bakedModel);
matrixStack.pop();

// Body
matrixStack.push();
matrixStack.translate(0.22D, -0.28D, -0.06D);
matrixStack.scale(-scaleFactor, -scaleFactor, scaleFactor);
matrixStack.translate(-0.5D, yOffset, -0.5D);
this.renderFlower(matrixStack, vertexConsumerProvider, light, renderAsModel, blockRenderManager, blockState, overlay, bakedModel);
this.renderFlower(matrixStack, vertexConsumerProvider, light, renderAsModel, blockState, overlay, bakedModel);
matrixStack.pop();

matrixStack.push();
matrixStack.translate(-0.2D, -0.22D, 0.01D);
matrixStack.scale(-scaleFactor, -scaleFactor, scaleFactor);
matrixStack.translate(-0.5D, yOffset, -0.5D);
this.renderFlower(matrixStack, vertexConsumerProvider, light, renderAsModel, blockRenderManager, blockState, overlay, bakedModel);
this.renderFlower(matrixStack, vertexConsumerProvider, light, renderAsModel, blockState, overlay, bakedModel);
matrixStack.pop();

matrixStack.push();
matrixStack.translate(0.03D, -0.28D, 0.47D);
matrixStack.scale(-scaleFactor, -scaleFactor, scaleFactor);
matrixStack.translate(-0.5D, yOffset, -0.5D);
this.renderFlower(matrixStack, vertexConsumerProvider, light, renderAsModel, blockRenderManager, blockState, overlay, bakedModel);
this.renderFlower(matrixStack, vertexConsumerProvider, light, renderAsModel, blockState, overlay, bakedModel);
matrixStack.pop();
}
}
Expand All @@ -101,15 +102,14 @@ private void renderFlower(
VertexConsumerProvider vertexConsumers,
int light,
boolean renderAsModel,
BlockRenderManager blockRenderManager,
BlockState moobloomState,
int overlay,
BakedModel moobloomModel
) {
if (renderAsModel) {
blockRenderManager.getModelRenderer().render(matrices.peek(), vertexConsumers.getBuffer(RenderLayer.getOutline(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE)), moobloomState, moobloomModel, 0.0F, 0.0F, 0.0F, light, overlay);
this.blockRenderManager.getModelRenderer().render(matrices.peek(), vertexConsumers.getBuffer(RenderLayer.getOutline(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE)), moobloomState, moobloomModel, 0.0F, 0.0F, 0.0F, light, overlay);
} else {
blockRenderManager.renderBlockAsEntity(moobloomState, matrices, vertexConsumers, light, overlay);
this.blockRenderManager.renderBlockAsEntity(moobloomState, matrices, vertexConsumers, light, overlay);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.faboslav.friendsandfoes.common.FriendsAndFoes;
import com.faboslav.friendsandfoes.common.client.render.entity.feature.MoobloomFlowerFeatureRenderer;
import com.faboslav.friendsandfoes.common.entity.MoobloomEntity;
import com.faboslav.friendsandfoes.common.init.FriendsAndFoesEntityModelLayers;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRendererFactory;
Expand All @@ -16,7 +17,7 @@
public final class MoobloomEntityRenderer extends MobEntityRenderer<MoobloomEntity, CowEntityModel<MoobloomEntity>>
{
public MoobloomEntityRenderer(EntityRendererFactory.Context context) {
super(context, new CowEntityModel(context.getPart(EntityModelLayers.MOOSHROOM)), 0.7F);
super(context, new CowEntityModel(context.getPart(FriendsAndFoesEntityModelLayers.MOOBLOOM_LAYER)), 0.7F);
this.addFeature(new MoobloomFlowerFeatureRenderer(this));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public final class FriendsAndFoesEntityModelLayers
public static final EntityModelLayer GLARE_LAYER = new EntityModelLayer(FriendsAndFoes.makeID("glare"), "main");
public static final EntityModelLayer ICEOLOGER_ICE_CHUNK_LAYER = new EntityModelLayer(FriendsAndFoes.makeID("iceologer_ice_chunk"), "main");
public static final EntityModelLayer MAULER_LAYER = new EntityModelLayer(FriendsAndFoes.makeID("mauler"), "main");
public static final EntityModelLayer MOOBLOOM_LAYER = new EntityModelLayer(FriendsAndFoes.makeID("moobloom"), "main");
public static final EntityModelLayer RASCAL_LAYER = new EntityModelLayer(FriendsAndFoes.makeID("rascal"), "main");
public static final EntityModelLayer TUFF_GOLEM_LAYER = new EntityModelLayer(FriendsAndFoes.makeID("tuff_golem"), "main");
public static final EntityModelLayer WILDFIRE_LAYER = new EntityModelLayer(FriendsAndFoes.makeID("wildfire"), "main");
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ org.gradle.caching=false
mod_java_version=17
mod_name=Friends & Foes
mod_id=friendsandfoes
mod_version=3.0.1
mod_version=3.0.2
mod_author=Faboslav
mod_description=Adds outvoted and forgotten mobs from the mob vote, expanding on their original concepts and introducing new vanilla-like features.
maven_group=com.faboslav.friendsandfoes
Expand Down

0 comments on commit fb44baf

Please sign in to comment.