Skip to content

Commit

Permalink
Scan all block states for empty geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
rtm516 committed Apr 5, 2024
1 parent 8297238 commit ceda7c5
Showing 1 changed file with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,28 +127,28 @@ private void preProcess(@NotNull PackPreProcessContext<BlockPackModule> context)
DefaultedRegistry<Block> registry = BuiltInRegistries.BLOCK;
for (Block block : blocks) {
ResourceLocation blockLocation = registry.getKey(block);
BlockState state = block.defaultBlockState();
for (BlockState state : block.getStateDefinition().getPossibleStates()) {
ModelDefinition definition = getModel(context, blockLocation, state);
if (definition == null) {
continue;
}

ModelDefinition definition = getModel(context, blockLocation, state);
if (definition == null) {
continue;
}
Model model = definition.model();
Key key = model.key();

Model model = definition.model();
Key key = model.key();
// Skip unit cube models
if (isUnitCube(model.parent())) {
continue;
}

// Skip unit cube models
if (isUnitCube(model.parent())) {
continue;
}
// Check if the model is empty
Model stitchedModel = new ModelStitcher(context.modelProvider(), model, new PackLogListener(context.logger())).stitch();
if (!stitchedModel.elements().isEmpty()) {
continue;
}

// Check if the model is empty
Model stitchedModel = new ModelStitcher(context.modelProvider(), model, new PackLogListener(context.logger())).stitch();
if (!stitchedModel.elements().isEmpty()) {
continue;
emptyModels.add(key.toString());
}

emptyModels.add(key.toString());
}
}

Expand Down

0 comments on commit ceda7c5

Please sign in to comment.