/* * Decompiled with CFR 0.152. * * Could not load the following classes: * com.google.common.collect.ArrayListMultimap * com.google.common.collect.ImmutableList * com.google.common.collect.ImmutableList$Builder * com.google.common.collect.Multimap * org.jspecify.annotations.Nullable */ package net.minecraft.client.resources.model; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ImmutableList; import com.google.common.collect.Multimap; import java.lang.runtime.SwitchBootstraps; import java.util.Collection; import java.util.List; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.core.Direction; import org.jspecify.annotations.Nullable; public class QuadCollection { public static final QuadCollection EMPTY = new QuadCollection(List.of(), List.of(), List.of(), List.of(), List.of(), List.of(), List.of(), List.of()); private final List all; private final List unculled; private final List north; private final List south; private final List east; private final List west; private final List up; private final List down; private QuadCollection(List all, List unculled, List north, List south, List east, List west, List up, List down) { this.all = all; this.unculled = unculled; this.north = north; this.south = south; this.east = east; this.west = west; this.up = up; this.down = down; } public List getQuads(@Nullable Direction direction) { Direction direction2 = direction; int n = 0; return switch (SwitchBootstraps.enumSwitch("enumSwitch", new Object[]{"NORTH", "SOUTH", "EAST", "WEST", "UP", "DOWN"}, (Direction)direction2, n)) { default -> throw new MatchException(null, null); case -1 -> this.unculled; case 0 -> this.north; case 1 -> this.south; case 2 -> this.east; case 3 -> this.west; case 4 -> this.up; case 5 -> this.down; }; } public List getAll() { return this.all; } public static class Builder { private final ImmutableList.Builder unculledFaces = ImmutableList.builder(); private final Multimap culledFaces = ArrayListMultimap.create(); public Builder addCulledFace(Direction direction, BakedQuad quad) { this.culledFaces.put((Object)direction, (Object)quad); return this; } public Builder addUnculledFace(BakedQuad quad) { this.unculledFaces.add((Object)quad); return this; } private static QuadCollection createFromSublists(List all, int unculledCount, int northCount, int southCount, int eastCount, int westCount, int upCount, int downCount) { int index = 0; List unculled = all.subList(index, index += unculledCount); List north = all.subList(index, index += northCount); List south = all.subList(index, index += southCount); List east = all.subList(index, index += eastCount); List west = all.subList(index, index += westCount); List up = all.subList(index, index += upCount); List down = all.subList(index, index + downCount); return new QuadCollection(all, unculled, north, south, east, west, up, down); } public QuadCollection build() { ImmutableList unculledFaces = this.unculledFaces.build(); if (this.culledFaces.isEmpty()) { if (unculledFaces.isEmpty()) { return EMPTY; } return new QuadCollection((List)unculledFaces, (List)unculledFaces, List.of(), List.of(), List.of(), List.of(), List.of(), List.of()); } ImmutableList.Builder quads = ImmutableList.builder(); quads.addAll((Iterable)unculledFaces); Collection north = this.culledFaces.get((Object)Direction.NORTH); quads.addAll((Iterable)north); Collection south = this.culledFaces.get((Object)Direction.SOUTH); quads.addAll((Iterable)south); Collection east = this.culledFaces.get((Object)Direction.EAST); quads.addAll((Iterable)east); Collection west = this.culledFaces.get((Object)Direction.WEST); quads.addAll((Iterable)west); Collection up = this.culledFaces.get((Object)Direction.UP); quads.addAll((Iterable)up); Collection down = this.culledFaces.get((Object)Direction.DOWN); quads.addAll((Iterable)down); return Builder.createFromSublists((List)quads.build(), unculledFaces.size(), north.size(), south.size(), east.size(), west.size(), up.size(), down.size()); } } }