Skip to content

Commit

Permalink
Retrieve quads on incorrect cullface lists if direction matches
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedt committed Dec 24, 2023
1 parent 60b3728 commit 97ba361
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.embeddedt.modernfix.render;

import com.google.common.collect.ImmutableList;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.ItemOverrides;
Expand Down Expand Up @@ -42,19 +41,20 @@ private boolean isCorrectDirectionForType(Direction direction) {

@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) {
if(side != null) {
return isCorrectDirectionForType(side) ? wrappedItem.getQuads(state, side, rand) : ImmutableList.of();
} else {
nullQuadList.clear();
List<BakedQuad> realList = wrappedItem.getQuads(state, null, rand);
for(int i = 0; i < realList.size(); i++) {
BakedQuad quad = realList.get(i);
if(isCorrectDirectionForType(quad.getDirection())) {
nullQuadList.add(quad);
}
boolean isWholeListValid = isCorrectDirectionForType(side);
List<BakedQuad> realList = wrappedItem.getQuads(state, side, rand);
if (isWholeListValid) {
return realList;
}
nullQuadList.clear();
//noinspection ForLoopReplaceableByForEach
for(int i = 0; i < realList.size(); i++) {
BakedQuad quad = realList.get(i);
if(isCorrectDirectionForType(quad.getDirection())) {
nullQuadList.add(quad);
}
return nullQuadList;
}
return nullQuadList;
}

@Override
Expand Down

0 comments on commit 97ba361

Please sign in to comment.