rework on shapes. Labels are showing up, but lines don't.

This commit is contained in:
gnembon committed 2021-03-16 15:31:58 -03:00
1 parent e19ae0ef0f
commit 1bd6dcbf12
6 files changed
+89 -63

No files matched your search

@@ -26,7 +26,7 @@ public abstract class PistonBlockEntity_playerHandlingMixin
@Shadow public abstract Direction getMovementDirection();
@Inject(method = "method_23672", at = @At("HEAD"), cancellable = true)
@Inject(method = "moveEntity", at = @At("HEAD"), cancellable = true)
private static void dontPushSpectators(Direction direction, Entity entity, double d, Direction direction2, CallbackInfo ci)
{
if (CarpetSettings.creativeNoClip && entity instanceof PlayerEntity && (((PlayerEntity) entity).isCreative()) && ((PlayerEntity) entity).getAbilities().flying) ci.cancel();
@@ -22,8 +22,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(WorldRenderer.class)
public class WorldRenderer_scarpetRenderMixin
{
@Shadow private /*@Nullable*/ ShaderEffect transparencyShader;
@Inject(method = "<init>", at = @At("RETURN"))
private void addRenderers(MinecraftClient client, BufferBuilderStorage bufferBuilders, CallbackInfo ci)
{
@@ -32,37 +30,23 @@ public class WorldRenderer_scarpetRenderMixin
@Inject(method = "render", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/render/WorldRenderer;renderChunkDebugInfo(Lnet/minecraft/client/render/Camera;)V",
shift = At.Shift.AFTER
target = "Lnet/minecraft/client/render/BufferBuilderStorage;getEffectVertexConsumers()Lnet/minecraft/client/render/VertexConsumerProvider$Immediate;", shift = At.Shift.BEFORE
//target = "Lnet/minecraft/client/render/WorldRenderer;renderChunkDebugInfo(Lnet/minecraft/client/render/Camera;)V", shift = At.Shift.AFTER
//target = "Lnet/minecraft/client/render/BackgroundRenderer;method_23792()V", shift = At.Shift.AFTER
//target = "Lnet/minecraft/client/render/BufferBuilderStorage;getEntityVertexConsumers()Lnet/minecraft/client/render/VertexConsumerProvider$Immediate;", shift = At.Shift.AFTER
//target = "Lnet/minecraft/client/render/WorldRenderer;renderChunkDebugInfo(Lnet/minecraft/client/render/Camera;)V", shift = At.Shift.AFTER // before return
))
private void renderScarpetThings(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, CallbackInfo ci)
{
// in normal circumstances we want to render shapes at the very end so it appears correctly behind stuff.
if (!FabricAPIHooks.WORLD_RENDER_EVENTS && CarpetClient.shapes != null && transparencyShader == null)
// we might actually not need to play with render hooks here.
if (!FabricAPIHooks.WORLD_RENDER_EVENTS && CarpetClient.shapes != null )
{
matrices.push();
//RenderSystem.pushMatrix(); ??
CarpetClient.shapes.render(matrices, camera, tickDelta);
//RenderSystem.popMatrix(); ??
matrices.pop();
}
}
RenderSystem.applyModelViewMatrix();
@Inject(method = "render", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/render/debug/DebugRenderer;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider$Immediate;DDD)V",
shift = At.Shift.AFTER
))
private void renderScarpetThingsFabulously(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, CallbackInfo ci)
{
// with fabulous graphics - stuff doesn't work this way for some reason - need to render with chunk lines.
if (!FabricAPIHooks.WORLD_RENDER_EVENTS && CarpetClient.shapes != null && transparencyShader != null)
{
matrices.push();
//RenderSystem.pushMatrix();
CarpetClient.shapes.render(matrices, camera, tickDelta);
//RenderSystem.popMatrix();
matrices.pop();
}
}
}