Skip to content

Commit

Permalink
fix: Fix auto sieve rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Jun 30, 2024
1 parent e709a88 commit 571eaad
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ public AbstractContainerMenu createMenu(int windowId, Inventory inventory, Playe
}

public SieveAnimationType getAnimationType() {
return SieveAnimationType.DEFAULT;
return SieveAnimationType.DEFAULT; // TODO maybe make this based on skin now that mana sieve is gone
}

public void applyFoodBoost(FoodProperties food) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.mojang.blaze3d.vertex.PoseStack;
import net.blay09.mods.excompressum.api.ExNihiloProvider;
import net.blay09.mods.excompressum.client.render.BlockRenderUtils;
import net.blay09.mods.excompressum.client.render.RenderUtils;
import net.blay09.mods.excompressum.item.ModItems;
import net.blay09.mods.excompressum.registry.ExNihilo;
import net.blay09.mods.excompressum.block.entity.AutoHammerBlockEntity;
Expand Down Expand Up @@ -106,7 +105,7 @@ public void render(AutoHammerBlockEntity tileEntity, float partialTicks, PoseSta
BlockRenderDispatcher dispatcher = Minecraft.getInstance().getBlockRenderer();
dispatcher.renderSingleBlock(contentState, poseStack, buffers, combinedLight, combinedOverlay);

if (tileEntity.getProgress() > 0f) { // TODO block break not showing on regular hammer?
if (tileEntity.getProgress() > 0f) {
int blockDamage = Math.min(9, (int) (tileEntity.getProgress() * 9f));
BlockRenderUtils.renderBlockBreak(contentState, poseStack, buffers, combinedLight, combinedOverlay, blockDamage + 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.blay09.mods.excompressum.block.HeavySieveBlock;
import net.blay09.mods.excompressum.block.ModBlocks;
import net.blay09.mods.excompressum.client.ModModels;
import net.blay09.mods.excompressum.client.render.RenderUtils;
import net.blay09.mods.excompressum.client.render.model.TinyHumanModel;
import net.blay09.mods.excompressum.block.entity.AbstractAutoSieveBlockEntity;
import net.blay09.mods.excompressum.utils.StupidUtils;
Expand All @@ -27,6 +26,7 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import org.joml.AxisAngle4f;
import org.joml.Math;
import org.joml.Quaternionf;

import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -66,14 +66,14 @@ public void render(AbstractAutoSieveBlockEntity blockEntity, float partialTicks,

poseStack.pushPose();
poseStack.translate(0.5f, 0f, 0.5f);
poseStack.mulPose(new Quaternionf(new AxisAngle4f(RenderUtils.getRotationAngle(blockEntity.getFacing()), 0f, 1f, 0f)));
poseStack.mulPose(blockEntity.getFacing().getRotation());
poseStack.mulPose(new Quaternionf(new AxisAngle4f(Math.toRadians(-90), 0f, 1f, 0f)));

// TODO human is laying on the sieve
// Render the tiny human
poseStack.pushPose();
poseStack.mulPose(new Quaternionf(new AxisAngle4f(90, 0, 1f, 0)));
poseStack.mulPose(new Quaternionf(new AxisAngle4f(180, 1f, 0, 0)));
poseStack.translate(0, -1.2f, 0.25f);
poseStack.mulPose(new Quaternionf(new AxisAngle4f(Math.toRadians(-90), 0f, 0f, 1f)));
poseStack.mulPose(new Quaternionf(new AxisAngle4f(Math.toRadians(90), 0, 1f, 0)));
poseStack.translate(0f, -1.2f, 0.25f);
poseStack.scale(0.75f, 0.75f, 0.75f);
MinecraftProfileTexture skin = getPlayerSkin(blockEntity.getCustomSkin());
TinyHumanModel playerModel = getPlayerModel(skin);
Expand All @@ -84,7 +84,7 @@ public void render(AbstractAutoSieveBlockEntity blockEntity, float partialTicks,
// Render the glass around player head if underwater
if (blockEntity.isWaterlogged()) {
poseStack.pushPose();
poseStack.translate(-0.425f, 0.6f, -0.175f);
poseStack.translate(-0.95f, -0.42f, -0.175f);
float glassScale = 0.35f;
poseStack.scale(glassScale, glassScale, glassScale);
dispatcher.renderSingleBlock(Blocks.GLASS.defaultBlockState(), poseStack, buffer, combinedLight, combinedOverlay);
Expand All @@ -96,9 +96,11 @@ public void render(AbstractAutoSieveBlockEntity blockEntity, float partialTicks,
poseStack.scale(0.5f, 0.5f, 0.5f);
poseStack.translate(-0.25f, 0f, -0.5f);

poseStack.mulPose(new Quaternionf(new AxisAngle4f(Math.toRadians(90), 0f, 0f, 1f)));
poseStack.translate(-0.2f, -0.1f, 0f);

// Render the sieve
poseStack.pushPose();
poseStack.translate(0f, 0.01f, 0f);
dispatcher.getModelRenderer().tesselateBlock(level, sieveModel, blockEntity.getBlockState(), blockEntity.getBlockPos(), poseStack, buffer.getBuffer(RenderType.solid()), false, random, 0, Integer.MAX_VALUE);
poseStack.popPose();

Expand Down

0 comments on commit 571eaad

Please sign in to comment.