fix fading with sodium
This commit is contained in:
@@ -66,6 +66,13 @@ import java.util.concurrent.AbstractExecutorService;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_21_11
|
||||
#else
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.level.LevelRenderContext;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.level.LevelRenderEvents;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.level.LevelTerrainRenderContext;
|
||||
#endif
|
||||
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
@@ -91,6 +98,7 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy
|
||||
private static final MinecraftClientWrapper MC = MinecraftClientWrapper.INSTANCE;
|
||||
private static final AbstractPluginPacketSender PACKET_SENDER = (AbstractPluginPacketSender) SingletonInjector.INSTANCE.get(IPluginPacketSender.class);
|
||||
|
||||
@Deprecated // just use the static reference
|
||||
private static final ClientApi clientApi = ClientApi.INSTANCE;
|
||||
|
||||
HashSet<Integer> previouslyPressKeyCodes = new HashSet<>();
|
||||
@@ -108,17 +116,10 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy
|
||||
|
||||
|
||||
|
||||
//========================//
|
||||
// register mod accessors //
|
||||
//========================//
|
||||
|
||||
SodiumAccessor sodiumAccessor = (SodiumAccessor) ModAccessorInjector.INSTANCE.get(ISodiumAccessor.class);
|
||||
|
||||
|
||||
|
||||
//==============//
|
||||
// chunk events //
|
||||
//==============//
|
||||
//region
|
||||
|
||||
// ClientChunkLoadEvent
|
||||
ClientChunkEvents.CHUNK_LOAD.register((level, chunk) ->
|
||||
@@ -214,12 +215,14 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy
|
||||
return InteractionResult.PASS;
|
||||
});
|
||||
|
||||
//endregion
|
||||
|
||||
|
||||
|
||||
//==============//
|
||||
// render event //
|
||||
//==============//
|
||||
|
||||
//region
|
||||
|
||||
#if MC_VER < MC_1_21_9
|
||||
WorldRenderEvents.AFTER_SETUP.register((renderContext) ->
|
||||
@@ -298,6 +301,27 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy
|
||||
});
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_21_11
|
||||
#else
|
||||
LevelRenderEvents.AFTER_TRANSLUCENT_TERRAIN.register((LevelRenderContext levelRenderContext) ->
|
||||
{
|
||||
ClientApi.INSTANCE.renderFadeTransparent();
|
||||
});
|
||||
|
||||
LevelRenderEvents.AFTER_OPAQUE_TERRAIN.register((LevelTerrainRenderContext levelTerrainRenderContext) ->
|
||||
{
|
||||
ClientApi.INSTANCE.renderFadeOpaque();
|
||||
});
|
||||
#endif
|
||||
|
||||
//endregion
|
||||
|
||||
|
||||
|
||||
//=================//
|
||||
// keyboard events //
|
||||
//=================//
|
||||
//region
|
||||
|
||||
// Debug keyboard event
|
||||
// FIXME: Use better hooks so it doesn't trigger key press events in text boxes
|
||||
@@ -309,11 +333,14 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy
|
||||
}
|
||||
});
|
||||
|
||||
//endregion
|
||||
|
||||
|
||||
|
||||
//==================//
|
||||
// networking event //
|
||||
//==================//
|
||||
//region
|
||||
|
||||
#if MC_VER < MC_1_20_6
|
||||
ClientPlayNetworking.registerGlobalReceiver(AbstractPluginPacketSender.WRAPPER_PACKET_RESOURCE, (client, handler, buffer, packetSender) ->
|
||||
@@ -345,6 +372,11 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy
|
||||
ClientApi.INSTANCE.pluginMessageReceived(payload.message());
|
||||
});
|
||||
#endif
|
||||
|
||||
//endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void onKeyInput()
|
||||
|
||||
-12
@@ -105,22 +105,10 @@ public class MixinChunkSectionsToRender
|
||||
}
|
||||
else if (chunkSectionLayerGroup == ChunkSectionLayerGroup.OPAQUE)
|
||||
{
|
||||
ClientApi.INSTANCE.renderFadeTransparent();
|
||||
ClientApi.INSTANCE.renderLods();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "renderGroup", order = 800)
|
||||
private void renderDeferredLayerReturn(ChunkSectionLayerGroup chunkSectionLayerGroup, GpuSampler gpuSampler, CallbackInfo ci)
|
||||
{
|
||||
ClientApi.RENDER_STATE.canRenderOrThrow();
|
||||
|
||||
if (chunkSectionLayerGroup == ChunkSectionLayerGroup.TRANSLUCENT)
|
||||
{
|
||||
ClientApi.INSTANCE.renderFadeOpaque();
|
||||
}
|
||||
}
|
||||
|
||||
//endregion
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user