forked from VazkiiMods/Botania
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Workaround for floating flowers in multiblock visualization
"Fix" for VazkiiMods#4181, by switching floating flowers to block model render shape when displaying them as part of a multiblock visualization. (As if setting the simpleFloaters client option, but only for individual "virtual" blocks.) Potentially also fixes other uses of that particular way to render blocks, such as the block held by an enderman.
- Loading branch information
1 parent
97d87f6
commit a097316
Showing
4 changed files
with
47 additions
and
1 deletion.
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
31 changes: 31 additions & 0 deletions
31
Xplat/src/main/java/vazkii/botania/mixin/client/BlockRenderDispatcherMixin.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,31 @@ | ||
package vazkii.botania.mixin.client; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
|
||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.client.renderer.block.BlockRenderDispatcher; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import vazkii.botania.client.patchouli.PatchouliUtils; | ||
|
||
/** | ||
* Hack for Patchouli visualizer rendering of floating flowers. | ||
* TODO: Check if new Patchouli versions can handle rendering non-vanilla block entities in multiblock visualizations. | ||
*/ | ||
@Mixin(BlockRenderDispatcher.class) | ||
public class BlockRenderDispatcherMixin { | ||
@Inject(method = "renderSingleBlock", at = @At("HEAD")) | ||
void enterRenderSingleBlock(BlockState state, PoseStack poseStack, MultiBufferSource buffer, int packedLight, int packedOverlay, CallbackInfo ci) { | ||
PatchouliUtils.setInVisualizer(true); | ||
} | ||
|
||
@Inject(method = "renderSingleBlock", at = @At("RETURN")) | ||
void exitRenderSingleBlock(BlockState state, PoseStack poseStack, MultiBufferSource buffer, int packedLight, int packedOverlay, CallbackInfo ci) { | ||
PatchouliUtils.setInVisualizer(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