Skip to content

Commit

Permalink
Changes to sorting and sky rendering & Tag Support 2
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Jul 14, 2024
1 parent f61749e commit f821a30
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.irisshaders.batchedentityrendering.mixin;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.world.entity.Entity;
Expand Down Expand Up @@ -40,17 +42,15 @@ public class MixinLevelRenderer_EntityListSorting {
@Shadow
private ClientLevel level;

@ModifyVariable(method = "renderLevel", at = @At(value = "INVOKE_ASSIGN", target = "Ljava/lang/Iterable;iterator()Ljava/util/Iterator;"),
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderBuffers;bufferSource()Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;"),
to = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/EntityRenderDispatcher;shouldRender(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/client/renderer/culling/Frustum;DDD)Z")), allow = 1)
private Iterator<Entity> batchedentityrendering$sortEntityList(Iterator<Entity> iterator) {
@WrapOperation(method = "renderLevel", at = @At(value = "INVOKE", target = "Ljava/lang/Iterable;iterator()Ljava/util/Iterator;"))
private Iterator<Entity> batchedentityrendering$sortEntityList(Iterable<Entity> instance, Operation<Iterator<Entity>> original) {
// Sort the entity list first in order to allow vanilla's entity batching code to work better.
this.level.getProfiler().push("sortEntityList");

Map<EntityType<?>, List<Entity>> sortedEntities = new HashMap<>();

List<Entity> entities = new ArrayList<>();
iterator.forEachRemaining(entity -> {
original.call(instance).forEachRemaining(entity -> {
sortedEntities.computeIfAbsent(entity.getType(), entityType -> new ArrayList<>(32)).add(entity);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static ImmutableList<StringPair> createStandardEnvironmentDefines() {
define(standardDefines, getVendor());
define(standardDefines, getRenderer());
define(standardDefines, "IS_IRIS");
define(standardDefines, "IRIS_TAG_SUPPORT");
define(standardDefines, "IRIS_TAG_SUPPORT", "2");


if (FabricLoader.getInstance().isModLoaded("distanthorizons") && DHCompat.hasRenderingEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ public void beginLevelRendering() {
// A lot of dimension mods touch sky rendering, FabricSkyboxes injects at HEAD and cancels, etc.
DimensionSpecialEffects.SkyType skyType = Minecraft.getInstance().level.effects().skyType();

if (skyType == DimensionSpecialEffects.SkyType.NORMAL) {
if (skyType == DimensionSpecialEffects.SkyType.NORMAL || Minecraft.getInstance().level.dimensionType().hasSkyLight()) {
RenderSystem.depthMask(false);

RenderSystem.setShaderColor(fogColor.x, fogColor.y, fogColor.z, fogColor.w);
Expand Down

0 comments on commit f821a30

Please sign in to comment.