Skip to content

Commit

Permalink
AbstractSimpleEntrySet: Renamed parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Xelbayria committed Jan 15, 2025
1 parent f208363 commit cd86cdd
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
import java.util.regex.Pattern;

//contrary to popular belief this class is indeed not simple. Its usage however is
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "removal"})
public abstract class AbstractSimpleEntrySet<T extends BlockType, B extends Block, I extends Item> implements EntrySet<T> {

protected static final ResourceLocation NO_TAB_MARKER = new ResourceLocation("none");
Expand Down Expand Up @@ -637,14 +637,14 @@ public BL createPaletteFromChild(String childKey) {
}

public BL createPaletteFromChild(Consumer<Palette> paletteTransform, String childKey, Predicate<String> whichSide) {
return this.setPalette((blockType, m) -> makePaletteFromChild(paletteTransform, childKey, whichSide, w, m));
return this.setPalette((blockType, m) -> makePaletteFromChild(paletteTransform, childKey, whichSide, blockType, m));
}
}

// utility function
public static <T extends BlockType> @NotNull Pair<List<Palette>, @Nullable AnimationMetadataSection> makePaletteFromChild(Consumer<Palette> paletteTransform, String childKey, Predicate<String> whichSide, T w, ResourceManager m) {
var c = blockType.getChild(childKey);
if (c instanceof Block b) {
public static <T extends BlockType> @NotNull Pair<List<Palette>, @Nullable AnimationMetadataSection> makePaletteFromChild(Consumer<Palette> paletteTransform, String childKey, Predicate<String> whichSide, T blockType, ResourceManager m) {
var child = blockType.getChild(childKey);
if (child instanceof Block b) {
if (whichSide != null) {
try (TextureImage blockTexture = TextureImage.open(m,
RPUtils.findFirstBlockTextureLocation(m, b, whichSide))) {
Expand All @@ -655,7 +655,7 @@ public BL createPaletteFromChild(Consumer<Palette> paletteTransform, String chil
} catch (Exception e) {
throw new RuntimeException(String.format("Failed to generate palette for %s : %s", blockType, e));
}
} else { // whichSide should be defaulted to use top_texture -Xelbayria's assumption
} else { // whichSide should be defaulted to use all_texture (like planks) -Xelbayria's assumption
try (TextureImage plankTexture = TextureImage.open(m,
RPUtils.findFirstBlockTextureLocation(m, b))) {

Expand All @@ -666,7 +666,7 @@ public BL createPaletteFromChild(Consumer<Palette> paletteTransform, String chil
throw new RuntimeException(String.format("Failed to generate palette for %s : %s", blockType, e));
}
}
} else if (c instanceof Item i) {
} else if (child instanceof Item i) {
try (TextureImage plankTexture = TextureImage.open(m,
RPUtils.findFirstItemTextureLocation(m, i))) {

Expand Down

0 comments on commit cd86cdd

Please sign in to comment.