Skip to content

Adjust render nice check #746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ private void init(final BlueprintPreviewData previewData, final Map<Object, Exce
blockAccess.setBlockEntities(tileEntitiesMap);
blockAccess.setEntities(entities);
blockAccess.setSolidSubstitutionOverride(previewData.getSolidSubstitutionOverride());
blockAccess.setRenderBlocksNiceOverride(previewData.getRenderBlocksNice());

final PoseStack matrixStack = new PoseStack();
matrixStack.translate(0.001, 0.001, 0.001);
Expand Down Expand Up @@ -151,7 +152,7 @@ private void init(final BlueprintPreviewData previewData, final Map<Object, Exce
}
else
{
state = blockAccess.prepareBlockStateForRendering(state, blockPos, previewData);
state = blockAccess.prepareBlockStateForRendering(state, blockPos);
}

final FluidState fluidState = state.getFluidState();
Expand Down Expand Up @@ -194,6 +195,7 @@ private void init(final BlueprintPreviewData previewData, final Map<Object, Exce
}

blockAccess.setSolidSubstitutionOverride(null);
blockAccess.setRenderBlocksNiceOverride(Structurize.getConfig().getClient().renderPlaceholdersNice.get());

clearVertexBuffers();
vertexBuffers = new Reference2ObjectArrayMap<>(RenderType.chunkBufferLayers().size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.ldtteam.structurize.blockentities.BlockEntityTagSubstitution;
import com.ldtteam.structurize.blocks.ModBlocks;
import com.ldtteam.structurize.blueprints.v1.Blueprint;
import com.ldtteam.structurize.storage.rendering.types.BlueprintPreviewData;
import com.ldtteam.structurize.util.BlockUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
Expand All @@ -29,6 +28,11 @@ public class BlueprintBlockAccess extends FakeLevel<Blueprint>
*/
private BlockState solidSubstitutionOverride = null;

/**
* Override for rendering placeholders nicely
*/
private boolean renderNice = Structurize.getConfig().getClient() != null && Structurize.getConfig().getClient().renderPlaceholdersNice.get();

public BlueprintBlockAccess(final Blueprint blueprint)
{
super(blueprint, LIGHT_PROVIDER, Minecraft.getInstance().level, SCOREBOARD, true);
Expand All @@ -48,12 +52,7 @@ public BlockState getBlockState(final BlockPos pos)

public BlockState prepareBlockStateForRendering(final BlockState state, final BlockPos pos)
{
return prepareBlockStateForRendering(state, pos, null);
}

public BlockState prepareBlockStateForRendering(final BlockState state, final BlockPos pos, final BlueprintPreviewData previewData)
{
if (previewData == null ? Structurize.getConfig().getClient().renderPlaceholdersNice.get() : previewData.getRenderBlocksNice())
if (renderNice)
{
if (state.getBlock() == ModBlocks.blockSolidSubstitution.get())
{
Expand Down Expand Up @@ -86,11 +85,17 @@ else if (state.getBlock() == ModBlocks.blockTagSubstitution.get())

/**
* Set the solid placeholder blockstate override, only updates when the renderer is recalculated
*
* @return
*/
public void setSolidSubstitutionOverride(final BlockState solidSubstitutionOverride)
{
this.solidSubstitutionOverride = solidSubstitutionOverride;
}

/**
* Set the render nice override for placeholders, only updates when the renderer is recalculated
*/
public void setRenderBlocksNiceOverride(final boolean renderNice)
{
this.renderNice = renderNice;
}
}