Skip to content

Commit

Permalink
Make iterateVisibleBlockEntities Mixin an Overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmangohands committed Aug 18, 2024
1 parent 783b4db commit b2ca8a3
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.world.level.block.entity.BlockEntity;
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 org.spongepowered.asm.mixin.Overwrite;

import java.util.function.Consumer;

@Mixin(LevelRenderer.class)
public class LevelRendererMixin {
@Inject(method = "iterateVisibleBlockEntities", at = @At("HEAD"), cancellable = true)
public void replaceBlockEntityIteration(Consumer<BlockEntity> blockEntityConsumer, CallbackInfo ci) {
ci.cancel();

/**
* @author MrMangoHands
* @reason Redirect iteration of visible block entities to our renderer
*/
@Overwrite
public void iterateVisibleBlockEntities(Consumer<BlockEntity> blockEntityConsumer) {
SodiumWorldRenderer.instance().iterateVisibleBlockEntities(blockEntityConsumer);
}
}

0 comments on commit b2ca8a3

Please sign in to comment.