Skip to content

Commit

Permalink
Bump Spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
shartte committed Dec 7, 2024
1 parent 783f325 commit bd8a45f
Show file tree
Hide file tree
Showing 51 changed files with 88 additions and 193 deletions.
25 changes: 13 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,10 @@ configurations {
guideExportOnly
configurations.compileClasspath.extendsFrom(guideExportOnly)
configurations.runtimeClasspath.extendsFrom(guideExportOnly)

internal {
visible = false
canBeConsumed = false
canBeResolved = false
}
configurations.compileClasspath.extendsFrom(internal)
configurations.runtimeClasspath.extendsFrom(internal)
configurations.testCompileClasspath.extendsFrom(internal)
configurations.testRuntimeClasspath.extendsFrom(internal)
}

import com.diffplug.gradle.spotless.JsonExtension

// All jar files from this folder will be added automatically as runtime mod dependencies
def extraModsDir = "extra-mods-${minecraft_version}"
file(extraModsDir).mkdir()
Expand Down Expand Up @@ -532,14 +524,23 @@ spotless {
if (it.contains('*;\n')) {
throw new Error('No wildcard imports allowed')
}

it
}
bumpThisNumberIfACustomStepChanges(1)
}

format 'json', {
json {
target 'src/*/resources/**/*.json'
targetExclude 'src/generated/resources/**'
prettier().config(['parser': 'json'])
var biomeConfig = it.new JsonExtension.BiomeJson(null)
try {
biomeConfig.downloadDir(new File(rootDir, ".gradle/biome").absolutePath)
} catch (Exception ignored) {
}
addStep(biomeConfig.createStep())
indentWithSpaces(2)
endWithNewline()
}
}

Expand Down
3 changes: 0 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ flatbuffers_version=23.5.26
#########################################################
# Gradle #
#########################################################
# Various tasks like runData will fail when run as daemon
org.gradle.daemon=false

# Temp fix for Spotless / Remove Unused Imports:
# https://github.com/diffplug/spotless/issues/834
org.gradle.jvmargs=-Xmx2G \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ private void onexitlineending(MdastContext ignored, Token token) {

// If we’re at a hard break, include the line ending in there.
if (atHardBreak) {
if (!(context instanceof MdAstParent<?>parent)) {
if (!(context instanceof MdAstParent<?> parent)) {
throw new IllegalStateException("expected `parent`");
}
var tail = (MdAstNode) parent.children().get(parent.children().size() - 1);
Expand Down Expand Up @@ -809,7 +809,7 @@ private void onexitlabel() {
// Assume a reference.
inReference = true;

if (node instanceof MdAstLink link && fragment instanceof MdAstParent<?>container) {
if (node instanceof MdAstLink link && fragment instanceof MdAstParent<?> container) {
for (var child : container.children()) {
link.addChild((MdAstNode) child);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ protected static JsonElement normalizeTree(JsonElement element) {

protected static MdAstNode removePosition(MdAstNode node) {
node.position = null;
if (node instanceof MdAstParent<?>parent) {
if (node instanceof MdAstParent<?> parent) {
for (var child : parent.children()) {
if (child instanceof MdAstNode childNode) {
removePosition(childNode);
Expand Down
3 changes: 1 addition & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ pluginManagement {
}
plugins {
id 'net.neoforged.moddev.legacyforge' version '2.0.56-beta'
id 'com.diffplug.spotless' version '5.12.4'
id 'io.github.juuxel.loom-quiltflower' version '1.10.0'
id 'com.diffplug.spotless' version '6.25.0'
id 'com.gradleup.shadow' version '8.3.5'
id 'de.undercouch.download' version '5.4.0'
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/appeng/api/features/P2PTunnelAttunement.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private static Item validateTunnelPartItem(ItemLike itemLike) {
Objects.requireNonNull(itemLike, "item");
var item = itemLike.asItem();
Objects.requireNonNull(item, "item");
if (!(item instanceof PartItem<?>partItem)) {
if (!(item instanceof PartItem<?> partItem)) {
throw new IllegalArgumentException("Given tunnel part item is not a part");
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/appeng/api/parts/IPartItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static int getNetworkId(IPartItem<?> item) {
@Nullable
static IPartItem<?> byId(ResourceLocation id) {
var item = BuiltInRegistries.ITEM.get(id);
if (item instanceof IPartItem<?>partItem) {
if (item instanceof IPartItem<?> partItem) {
return partItem;
}
return null;
Expand All @@ -99,7 +99,7 @@ static IPartItem<?> byId(ResourceLocation id) {
@Nullable
static IPartItem<?> byNetworkId(int id) {
var item = BuiltInRegistries.ITEM.byId(id);
if (item instanceof IPartItem<?>partItem) {
if (item instanceof IPartItem<?> partItem) {
return partItem;
}
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/appeng/blockentity/AEBaseBlockEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public void markForUpdate() {
boolean alreadyUpdated = false;
// Let the block update its own state with our internal state changes
BlockState currentState = getBlockState();
if (currentState.getBlock() instanceof AEBaseEntityBlock<?>block) {
if (currentState.getBlock() instanceof AEBaseEntityBlock<?> block) {
BlockState newState = block.getBlockEntityBlockState(currentState, this);
if (currentState != newState) {
AELog.blockUpdate(this.worldPosition, currentState, newState, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void onReady() {
// the state that was saved to disk. This ensures the BlockState after readying
// the entity is up-to-date.
BlockState currentState = getBlockState();
if (currentState.getBlock() instanceof AEBaseEntityBlock<?>block) {
if (currentState.getBlock() instanceof AEBaseEntityBlock<?> block) {
BlockState newState = block.getBlockEntityBlockState(currentState, this);
if (currentState != newState) {
this.markForUpdate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static Frontmatter parse(ResourceLocation pageId, String yamlText) {
Map<String, Object> data = yaml.load(yamlText);
var navigationObj = data.remove("navigation");
if (navigationObj != null) {
if (!(navigationObj instanceof Map<?, ?>navigationMap)) {
if (!(navigationObj instanceof Map<?, ?> navigationMap)) {
throw new IllegalArgumentException("The navigation key in the frontmatter has to be a map");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,6 @@ public <T> void clearCompilerState(State<T> state) {
compilerState.remove(state);
}

public record State<T> (String name, Class<T> dataClass, T defaultValue) {
public record State<T>(String name, Class<T> dataClass, T defaultValue) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ protected void compile(PageCompiler compiler, LytBlockContainer parent, MdxJsxEl
/**
* Maps a recipe type to a factory that can create a layout block to display it.
*/
private record RecipeTypeMapping<T extends Recipe<C>, C extends Container> (
private record RecipeTypeMapping<T extends Recipe<C>, C extends Container>(
RecipeType<T> recipeType,
Function<T, LytBlock> factory) {
@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private static List<SceneElementTagCompiler> sceneElementTagCompilers() {
new DiamondAnnotationElementCompiler());
}

private record Registration<T extends Extension> (ExtensionPoint<T> extensionPoint,
private record Registration<T extends Extension>(ExtensionPoint<T> extensionPoint,
Supplier<Collection<T>> factory) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
* An extension point is offered by the guidebook to plug in additional functionality. Each extension point defines an
* interface or base-class that needs to be implemented (or extended) by an extension.
*/
public record ExtensionPoint<T extends Extension> (Class<T> extensionPointClass) {
public record ExtensionPoint<T extends Extension>(Class<T> extensionPointClass) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private static List<Pair<String, PageAnchor>> getCategories(ParsedGuidePage page
return List.of();
}

if (!(categoriesNode instanceof List<?>categoryList)) {
if (!(categoriesNode instanceof List<?> categoryList)) {
LOGGER.warn("Page {} contains malformed categories frontmatter", page.getId());
return List.of();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private static List<Pair<ResourceLocation, PageAnchor>> getItemAnchors(ParsedGui
return List.of();
}

if (!(itemIdsNode instanceof List<?>itemIdList)) {
if (!(itemIdsNode instanceof List<?> itemIdList)) {
LOGGER.warn("Page {} contains malformed item_ids frontmatter", page.getId());
return List.of();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ public interface EntryFunction<K, V> {
Iterable<Pair<K, V>> getEntry(ParsedGuidePage page);
}

private record Record<V> (ResourceLocation pageId, V value) {
private record Record<V>(ResourceLocation pageId, V value) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,6 @@ public interface EntryFunction<K, V> {
Iterable<Pair<K, V>> getEntry(ParsedGuidePage page);
}

private record Record<V> (ResourceLocation pageId, V value) {
private record Record<V>(ResourceLocation pageId, V value) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ private void renderTooltip(GuiGraphics guiGraphics, int x, int y) {
dispatchInteraction(
hoveredElement,
el -> el.getTooltip(docPos.getX(), docPos.getY()))
.ifPresent(tooltip -> renderTooltip(guiGraphics, tooltip, x, y));
.ifPresent(tooltip -> renderTooltip(guiGraphics, tooltip, x, y));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public ClearPatternAccessTerminalPacket() {
@Override
@OnlyIn(Dist.CLIENT)
public void clientPacketData(Player player) {
if (Minecraft.getInstance().screen instanceof PatternAccessTermScreen<?>patternAccessTerminal) {
if (Minecraft.getInstance().screen instanceof PatternAccessTermScreen<?> patternAccessTerminal) {
patternAccessTerminal.clear();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public CraftingStatusPacket(CraftingStatus status) {
public void clientPacketData(Player player) {
Screen screen = Minecraft.getInstance().screen;

if (screen instanceof CraftingCPUScreen<?>cpuScreen) {
if (screen instanceof CraftingCPUScreen<?> cpuScreen) {
cpuScreen.postUpdate(this.status);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static PatternAccessTerminalPacket incrementalUpdate(long inventoryId,
@Override
@OnlyIn(Dist.CLIENT)
public void clientPacketData(Player player) {
if (Minecraft.getInstance().screen instanceof PatternAccessTermScreen<?>patternAccessTerminal) {
if (Minecraft.getInstance().screen instanceof PatternAccessTermScreen<?> patternAccessTerminal) {
if (fullUpdate) {
patternAccessTerminal.postFullUpdate(this.inventoryId, sortBy, group, inventorySize, slots);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected void registerStatesAndModels() {
var inscriber = models().getExistingFile(AppEng.makeId("inscriber"));
multiVariantGenerator(AEBlocks.INSCRIBER,
Variant.variant().with(VariantProperties.MODEL, inscriber.getLocation()))
.with(createFacingSpinDispatch());
.with(createFacingSpinDispatch());

crystalResonanceGenerator();
wirelessAccessPoint();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected void registerStatesAndModels() {
makeId("block/quartz_pillar_side"), makeId("block/quartz_pillar_top"));
multiVariantGenerator(AEBlocks.QUARTZ_PILLAR,
Variant.variant().with(VariantProperties.MODEL, quartzPillar.getLocation()))
.with(BlockModelGenerators.createRotatedPillar());
.with(BlockModelGenerators.createRotatedPillar());
simpleBlockItem(AEBlocks.QUARTZ_PILLAR.block(), quartzPillar);

stairsBlock(AEBlocks.QUARTZ_PILLAR_STAIRS, "block/quartz_pillar_top", "block/quartz_pillar_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private void storageCell(ItemDefinition<?> item, String background) {
mcLoc("item/generated"),
"layer0",
makeId(background))
.texture("layer1", "item/storage_cell_led");
.texture("layer1", "item/storage_cell_led");
}

private void portableCell(ItemDefinition<?> item, String housingType, String tier) {
Expand All @@ -149,9 +149,9 @@ private void portableCell(ItemDefinition<?> item, String housingType, String tie
mcLoc("item/generated"),
"layer0",
makeId("item/portable_cell_screen"))
.texture("layer1", "item/portable_cell_led")
.texture("layer2", "item/portable_cell_%s_housing".formatted(housingType))
.texture("layer3", "item/portable_cell_side_%s".formatted(tier));
.texture("layer1", "item/portable_cell_led")
.texture("layer2", "item/portable_cell_%s_housing".formatted(housingType))
.texture("layer3", "item/portable_cell_side_%s".formatted(tier));
}

private void registerHandheld() {
Expand Down Expand Up @@ -180,10 +180,10 @@ private void registerHandheld() {
// The color applicator uses a separate model when colored
var coloredColorApplicator = withExistingParent(AEItems.COLOR_APPLICATOR.id().getPath() + "_colored",
"item/generated")
.texture("layer0", makeId("item/color_applicator"))
.texture("layer1", makeId("item/color_applicator_tip_dark"))
.texture("layer2", makeId("item/color_applicator_tip_medium"))
.texture("layer3", makeId("item/color_applicator_tip_bright"));
.texture("layer0", makeId("item/color_applicator"))
.texture("layer1", makeId("item/color_applicator_tip_dark"))
.texture("layer2", makeId("item/color_applicator_tip_medium"))
.texture("layer3", makeId("item/color_applicator_tip_bright"));
withExistingParent(AEItems.COLOR_APPLICATOR.id().getPath(), "item/generated")
.texture("layer0", makeId("item/color_applicator"))
// Use different model when colored
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/appeng/debug/DebugCardItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public InteractionResult onItemUseFirst(ItemStack stack, UseOnContext context) {
this.outputSecondaryMessage(player, "Cable Distance", Integer.toString(length));
}

if (center.getOwner() instanceof P2PTunnelPart<?>tunnelPart) {
if (center.getOwner() instanceof P2PTunnelPart<?> tunnelPart) {
this.outputSecondaryMessage(player, "Freq", Integer.toString(tunnelPart.getFrequency()));
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/appeng/hooks/RenderBlockOutlineHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private static void showPartPlacementPreview(
BlockHitResult blockHitResult,
ItemStack itemInHand,
boolean insideBlock) {
if (itemInHand.getItem() instanceof IPartItem<?>partItem) {
if (itemInHand.getItem() instanceof IPartItem<?> partItem) {
var placement = PartPlacement.getPartPlacement(player,
player.level(),
itemInHand,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* A class to hold data related to ticking block entities.
*/
class ServerBlockEntityRepo {
record FirstTickInfo<T extends BlockEntity> (T blockEntity, Consumer<? super T> initFunction) {
record FirstTickInfo<T extends BlockEntity>(T blockEntity, Consumer<? super T> initFunction) {
void callInit() {
initFunction.accept(blockEntity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ private static <U> CachedProviders<U> createProviderLists(Class<U> clazz) {
compatibleNameProviders);
}

private record Registration<T> (Class<?> baseClass, T provider, int priority) {
private record Registration<T>(Class<?> baseClass, T provider, int priority) {
}

record CachedProviders<U> (List<ServerDataProvider<? super U>> serverDataProviders,
record CachedProviders<U>(List<ServerDataProvider<? super U>> serverDataProviders,
List<BodyProvider<? super U>> bodyProviders,
List<IconProvider<? super U>> iconProviders,
List<NameProvider<? super U>> nameProviders) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ private Optional<IClickableIngredient<?>> makeClickableIngredient(StackWithBound
return Optional.of(new ClickableIngredient<>(ingredient, stackWithBounds.bounds()));
}

private record ClickableIngredient<T> (ITypedIngredient<T> ingredient,
private record ClickableIngredient<T>(ITypedIngredient<T> ingredient,
Rect2i area) implements IClickableIngredient<T> {
@Override
public ITypedIngredient<T> getTypedIngredient() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void registerScreens(ScreenRegistry registry) {

registry.registerDraggableStackVisitor(new GhostIngredientHandler());
registry.registerFocusedStack((screen, mouse) -> {
if (screen instanceof AEBaseScreen<?>aeScreen) {
if (screen instanceof AEBaseScreen<?> aeScreen) {
var stack = aeScreen.getStackUnderMouse(mouse.x, mouse.y);
if (stack != null) {
for (var converter : IngredientConverters.getConverters()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private Recipe<?> getRecipe(Display display) {
// Displays can be based on completely custom objects, or on actual Vanilla recipes
var origin = DisplayRegistry.getInstance().getDisplayOrigin(display);

return origin instanceof Recipe<?>recipe ? recipe : null;
return origin instanceof Recipe<?> recipe ? recipe : null;
}

protected final boolean isCraftingRecipe(Recipe<?> recipe, Display display) {
Expand Down
Loading

0 comments on commit bd8a45f

Please sign in to comment.