From bd8a45f34cd01a7d367d15d6e855bd71ccbccbb8 Mon Sep 17 00:00:00 2001 From: Sebastian Hartte Date: Sat, 7 Dec 2024 14:53:54 +0100 Subject: [PATCH] Bump Spotless --- build.gradle | 25 ++-- gradle.properties | 3 - .../java/appeng/libs/mdast/MdastCompiler.java | 4 +- .../appeng/libs/mdast/AbstractMdAstTest.java | 2 +- settings.gradle | 3 +- .../api/features/P2PTunnelAttunement.java | 2 +- src/main/java/appeng/api/parts/IPartItem.java | 4 +- .../appeng/blockentity/AEBaseBlockEntity.java | 2 +- .../grid/AENetworkBlockEntity.java | 2 +- .../guidebook/compiler/Frontmatter.java | 2 +- .../guidebook/compiler/PageCompiler.java | 2 +- .../compiler/tags/RecipeCompiler.java | 2 +- .../extensions/DefaultExtensions.java | 2 +- .../guidebook/extensions/ExtensionPoint.java | 2 +- .../guidebook/indices/CategoryIndex.java | 2 +- .../client/guidebook/indices/ItemIndex.java | 2 +- .../guidebook/indices/MultiValuedIndex.java | 2 +- .../client/guidebook/indices/UniqueIndex.java | 2 +- .../client/guidebook/screen/GuideScreen.java | 2 +- .../ClearPatternAccessTerminalPacket.java | 2 +- .../sync/packets/CraftingStatusPacket.java | 2 +- .../packets/PatternAccessTerminalPacket.java | 2 +- .../providers/models/BlockModelProvider.java | 2 +- .../models/DecorationModelProvider.java | 2 +- .../providers/models/ItemModelProvider.java | 16 +-- src/main/java/appeng/debug/DebugCardItem.java | 2 +- .../appeng/hooks/RenderBlockOutlineHook.java | 2 +- .../hooks/ticking/ServerBlockEntityRepo.java | 2 +- .../igtooltip/parts/PartTooltipProviders.java | 4 +- .../integration/modules/jei/JEIPlugin.java | 2 +- .../integration/modules/rei/ReiPlugin.java | 2 +- .../rei/transfer/AbstractTransferHandler.java | 2 +- .../theoneprobe/BlockEntityInfoProvider.java | 8 +- .../appeng/items/parts/PartModelsHelper.java | 2 +- .../appeng/me/cells/BasicCellHandler.java | 2 +- .../java/appeng/me/service/P2PService.java | 4 +- .../appeng/me/storage/NetworkStorage.java | 2 +- .../appeng/menu/locator/MenuLocators.java | 2 +- .../mixins/ResizableSlotHighlightMixin.java | 2 +- .../java/appeng/parts/CableBusContainer.java | 2 +- src/main/java/appeng/parts/PartPlacement.java | 2 +- .../appeng/parts/networking/CablePart.java | 2 +- .../java/appeng/parts/p2p/P2PTunnelPart.java | 4 +- .../entropy/EntropyRecipeSerializer.java | 6 +- .../server/testplots/P2PPlotHelper.java | 2 +- .../testworld/BlockEntityCustomizer.java | 2 +- .../server/testworld/PartCustomizer.java | 2 +- .../server/testworld/RectanglePacking.java | 4 +- .../java/appeng/util/CraftingRecipeUtil.java | 2 +- .../ae2/models/block/mysterious_cube.json | 118 ++---------------- .../api/networking/GridServicesTest.java | 4 +- 51 files changed, 88 insertions(+), 193 deletions(-) diff --git a/build.gradle b/build.gradle index 7e414e3d017..3705dc7af8c 100644 --- a/build.gradle +++ b/build.gradle @@ -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() @@ -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() } } diff --git a/gradle.properties b/gradle.properties index a5effa0f9bf..f8863c52bfb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 \ diff --git a/libs/markdown/src/main/java/appeng/libs/mdast/MdastCompiler.java b/libs/markdown/src/main/java/appeng/libs/mdast/MdastCompiler.java index 85577e13353..ee1b47ce7ed 100644 --- a/libs/markdown/src/main/java/appeng/libs/mdast/MdastCompiler.java +++ b/libs/markdown/src/main/java/appeng/libs/mdast/MdastCompiler.java @@ -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 MdAstParentparent)) { + if (!(context instanceof MdAstParent parent)) { throw new IllegalStateException("expected `parent`"); } var tail = (MdAstNode) parent.children().get(parent.children().size() - 1); @@ -809,7 +809,7 @@ private void onexitlabel() { // Assume a reference. inReference = true; - if (node instanceof MdAstLink link && fragment instanceof MdAstParentcontainer) { + if (node instanceof MdAstLink link && fragment instanceof MdAstParent container) { for (var child : container.children()) { link.addChild((MdAstNode) child); } diff --git a/libs/markdown/src/test/java/appeng/libs/mdast/AbstractMdAstTest.java b/libs/markdown/src/test/java/appeng/libs/mdast/AbstractMdAstTest.java index 4632816246f..56d018ceebd 100644 --- a/libs/markdown/src/test/java/appeng/libs/mdast/AbstractMdAstTest.java +++ b/libs/markdown/src/test/java/appeng/libs/mdast/AbstractMdAstTest.java @@ -116,7 +116,7 @@ protected static JsonElement normalizeTree(JsonElement element) { protected static MdAstNode removePosition(MdAstNode node) { node.position = null; - if (node instanceof MdAstParentparent) { + if (node instanceof MdAstParent parent) { for (var child : parent.children()) { if (child instanceof MdAstNode childNode) { removePosition(childNode); diff --git a/settings.gradle b/settings.gradle index 7e4b77d6bb2..c6754e74b04 100644 --- a/settings.gradle +++ b/settings.gradle @@ -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' } diff --git a/src/main/java/appeng/api/features/P2PTunnelAttunement.java b/src/main/java/appeng/api/features/P2PTunnelAttunement.java index 34bffd674eb..dff8faf5879 100644 --- a/src/main/java/appeng/api/features/P2PTunnelAttunement.java +++ b/src/main/java/appeng/api/features/P2PTunnelAttunement.java @@ -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 PartItempartItem)) { + if (!(item instanceof PartItem partItem)) { throw new IllegalArgumentException("Given tunnel part item is not a part"); } diff --git a/src/main/java/appeng/api/parts/IPartItem.java b/src/main/java/appeng/api/parts/IPartItem.java index df93accf2c7..7dcaee4a090 100644 --- a/src/main/java/appeng/api/parts/IPartItem.java +++ b/src/main/java/appeng/api/parts/IPartItem.java @@ -87,7 +87,7 @@ static int getNetworkId(IPartItem item) { @Nullable static IPartItem byId(ResourceLocation id) { var item = BuiltInRegistries.ITEM.get(id); - if (item instanceof IPartItempartItem) { + if (item instanceof IPartItem partItem) { return partItem; } return null; @@ -99,7 +99,7 @@ static IPartItem byId(ResourceLocation id) { @Nullable static IPartItem byNetworkId(int id) { var item = BuiltInRegistries.ITEM.byId(id); - if (item instanceof IPartItempartItem) { + if (item instanceof IPartItem partItem) { return partItem; } return null; diff --git a/src/main/java/appeng/blockentity/AEBaseBlockEntity.java b/src/main/java/appeng/blockentity/AEBaseBlockEntity.java index 3fc9afde29e..bd4f4091299 100644 --- a/src/main/java/appeng/blockentity/AEBaseBlockEntity.java +++ b/src/main/java/appeng/blockentity/AEBaseBlockEntity.java @@ -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 AEBaseEntityBlockblock) { + if (currentState.getBlock() instanceof AEBaseEntityBlock block) { BlockState newState = block.getBlockEntityBlockState(currentState, this); if (currentState != newState) { AELog.blockUpdate(this.worldPosition, currentState, newState, this); diff --git a/src/main/java/appeng/blockentity/grid/AENetworkBlockEntity.java b/src/main/java/appeng/blockentity/grid/AENetworkBlockEntity.java index 5d734020749..9f35d09bb91 100644 --- a/src/main/java/appeng/blockentity/grid/AENetworkBlockEntity.java +++ b/src/main/java/appeng/blockentity/grid/AENetworkBlockEntity.java @@ -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 AEBaseEntityBlockblock) { + if (currentState.getBlock() instanceof AEBaseEntityBlock block) { BlockState newState = block.getBlockEntityBlockState(currentState, this); if (currentState != newState) { this.markForUpdate(); diff --git a/src/main/java/appeng/client/guidebook/compiler/Frontmatter.java b/src/main/java/appeng/client/guidebook/compiler/Frontmatter.java index 4787b88c5e5..75ba5766a7d 100644 --- a/src/main/java/appeng/client/guidebook/compiler/Frontmatter.java +++ b/src/main/java/appeng/client/guidebook/compiler/Frontmatter.java @@ -23,7 +23,7 @@ public static Frontmatter parse(ResourceLocation pageId, String yamlText) { Map data = yaml.load(yamlText); var navigationObj = data.remove("navigation"); if (navigationObj != null) { - if (!(navigationObj instanceof MapnavigationMap)) { + if (!(navigationObj instanceof Map navigationMap)) { throw new IllegalArgumentException("The navigation key in the frontmatter has to be a map"); } diff --git a/src/main/java/appeng/client/guidebook/compiler/PageCompiler.java b/src/main/java/appeng/client/guidebook/compiler/PageCompiler.java index d6c79bf043e..210bc88b167 100644 --- a/src/main/java/appeng/client/guidebook/compiler/PageCompiler.java +++ b/src/main/java/appeng/client/guidebook/compiler/PageCompiler.java @@ -491,6 +491,6 @@ public void clearCompilerState(State state) { compilerState.remove(state); } - public record State (String name, Class dataClass, T defaultValue) { + public record State(String name, Class dataClass, T defaultValue) { } } diff --git a/src/main/java/appeng/client/guidebook/compiler/tags/RecipeCompiler.java b/src/main/java/appeng/client/guidebook/compiler/tags/RecipeCompiler.java index 4b8d0aff410..4925e6abc75 100644 --- a/src/main/java/appeng/client/guidebook/compiler/tags/RecipeCompiler.java +++ b/src/main/java/appeng/client/guidebook/compiler/tags/RecipeCompiler.java @@ -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, C extends Container> ( + private record RecipeTypeMapping, C extends Container>( RecipeType recipeType, Function factory) { @Nullable diff --git a/src/main/java/appeng/client/guidebook/extensions/DefaultExtensions.java b/src/main/java/appeng/client/guidebook/extensions/DefaultExtensions.java index ca3d1700ae9..bf106f6949c 100644 --- a/src/main/java/appeng/client/guidebook/extensions/DefaultExtensions.java +++ b/src/main/java/appeng/client/guidebook/extensions/DefaultExtensions.java @@ -83,7 +83,7 @@ private static List sceneElementTagCompilers() { new DiamondAnnotationElementCompiler()); } - private record Registration (ExtensionPoint extensionPoint, + private record Registration(ExtensionPoint extensionPoint, Supplier> factory) { } } diff --git a/src/main/java/appeng/client/guidebook/extensions/ExtensionPoint.java b/src/main/java/appeng/client/guidebook/extensions/ExtensionPoint.java index 5874741c8ef..8bcfb69dd2b 100644 --- a/src/main/java/appeng/client/guidebook/extensions/ExtensionPoint.java +++ b/src/main/java/appeng/client/guidebook/extensions/ExtensionPoint.java @@ -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 (Class extensionPointClass) { +public record ExtensionPoint(Class extensionPointClass) { } diff --git a/src/main/java/appeng/client/guidebook/indices/CategoryIndex.java b/src/main/java/appeng/client/guidebook/indices/CategoryIndex.java index ab9c3c7a002..f4c581c3d7d 100644 --- a/src/main/java/appeng/client/guidebook/indices/CategoryIndex.java +++ b/src/main/java/appeng/client/guidebook/indices/CategoryIndex.java @@ -34,7 +34,7 @@ private static List> getCategories(ParsedGuidePage page return List.of(); } - if (!(categoriesNode instanceof ListcategoryList)) { + if (!(categoriesNode instanceof List categoryList)) { LOGGER.warn("Page {} contains malformed categories frontmatter", page.getId()); return List.of(); } diff --git a/src/main/java/appeng/client/guidebook/indices/ItemIndex.java b/src/main/java/appeng/client/guidebook/indices/ItemIndex.java index 0960d96b7ae..8e0efcb7cc8 100644 --- a/src/main/java/appeng/client/guidebook/indices/ItemIndex.java +++ b/src/main/java/appeng/client/guidebook/indices/ItemIndex.java @@ -37,7 +37,7 @@ private static List> getItemAnchors(ParsedGui return List.of(); } - if (!(itemIdsNode instanceof ListitemIdList)) { + if (!(itemIdsNode instanceof List itemIdList)) { LOGGER.warn("Page {} contains malformed item_ids frontmatter", page.getId()); return List.of(); } diff --git a/src/main/java/appeng/client/guidebook/indices/MultiValuedIndex.java b/src/main/java/appeng/client/guidebook/indices/MultiValuedIndex.java index 7f8df922c6e..a3c2213c046 100644 --- a/src/main/java/appeng/client/guidebook/indices/MultiValuedIndex.java +++ b/src/main/java/appeng/client/guidebook/indices/MultiValuedIndex.java @@ -114,6 +114,6 @@ public interface EntryFunction { Iterable> getEntry(ParsedGuidePage page); } - private record Record (ResourceLocation pageId, V value) { + private record Record(ResourceLocation pageId, V value) { } } diff --git a/src/main/java/appeng/client/guidebook/indices/UniqueIndex.java b/src/main/java/appeng/client/guidebook/indices/UniqueIndex.java index f56cc6d3972..fdbd3393c93 100644 --- a/src/main/java/appeng/client/guidebook/indices/UniqueIndex.java +++ b/src/main/java/appeng/client/guidebook/indices/UniqueIndex.java @@ -121,6 +121,6 @@ public interface EntryFunction { Iterable> getEntry(ParsedGuidePage page); } - private record Record (ResourceLocation pageId, V value) { + private record Record(ResourceLocation pageId, V value) { } } diff --git a/src/main/java/appeng/client/guidebook/screen/GuideScreen.java b/src/main/java/appeng/client/guidebook/screen/GuideScreen.java index 0b95e55b1e2..0ff8aa5cff2 100644 --- a/src/main/java/appeng/client/guidebook/screen/GuideScreen.java +++ b/src/main/java/appeng/client/guidebook/screen/GuideScreen.java @@ -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)); } } diff --git a/src/main/java/appeng/core/sync/packets/ClearPatternAccessTerminalPacket.java b/src/main/java/appeng/core/sync/packets/ClearPatternAccessTerminalPacket.java index 5533067bb3a..b4bbe4901cb 100644 --- a/src/main/java/appeng/core/sync/packets/ClearPatternAccessTerminalPacket.java +++ b/src/main/java/appeng/core/sync/packets/ClearPatternAccessTerminalPacket.java @@ -29,7 +29,7 @@ public ClearPatternAccessTerminalPacket() { @Override @OnlyIn(Dist.CLIENT) public void clientPacketData(Player player) { - if (Minecraft.getInstance().screen instanceof PatternAccessTermScreenpatternAccessTerminal) { + if (Minecraft.getInstance().screen instanceof PatternAccessTermScreen patternAccessTerminal) { patternAccessTerminal.clear(); } } diff --git a/src/main/java/appeng/core/sync/packets/CraftingStatusPacket.java b/src/main/java/appeng/core/sync/packets/CraftingStatusPacket.java index 34b64a57e7d..1f872347eb6 100644 --- a/src/main/java/appeng/core/sync/packets/CraftingStatusPacket.java +++ b/src/main/java/appeng/core/sync/packets/CraftingStatusPacket.java @@ -49,7 +49,7 @@ public CraftingStatusPacket(CraftingStatus status) { public void clientPacketData(Player player) { Screen screen = Minecraft.getInstance().screen; - if (screen instanceof CraftingCPUScreencpuScreen) { + if (screen instanceof CraftingCPUScreen cpuScreen) { cpuScreen.postUpdate(this.status); } } diff --git a/src/main/java/appeng/core/sync/packets/PatternAccessTerminalPacket.java b/src/main/java/appeng/core/sync/packets/PatternAccessTerminalPacket.java index e3af05e4769..d7f37f81ca8 100644 --- a/src/main/java/appeng/core/sync/packets/PatternAccessTerminalPacket.java +++ b/src/main/java/appeng/core/sync/packets/PatternAccessTerminalPacket.java @@ -100,7 +100,7 @@ public static PatternAccessTerminalPacket incrementalUpdate(long inventoryId, @Override @OnlyIn(Dist.CLIENT) public void clientPacketData(Player player) { - if (Minecraft.getInstance().screen instanceof PatternAccessTermScreenpatternAccessTerminal) { + if (Minecraft.getInstance().screen instanceof PatternAccessTermScreen patternAccessTerminal) { if (fullUpdate) { patternAccessTerminal.postFullUpdate(this.inventoryId, sortBy, group, inventorySize, slots); } else { diff --git a/src/main/java/appeng/datagen/providers/models/BlockModelProvider.java b/src/main/java/appeng/datagen/providers/models/BlockModelProvider.java index 89649a65ecc..ec6c28a1776 100644 --- a/src/main/java/appeng/datagen/providers/models/BlockModelProvider.java +++ b/src/main/java/appeng/datagen/providers/models/BlockModelProvider.java @@ -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(); diff --git a/src/main/java/appeng/datagen/providers/models/DecorationModelProvider.java b/src/main/java/appeng/datagen/providers/models/DecorationModelProvider.java index 4a4a5176d76..16eacc88994 100644 --- a/src/main/java/appeng/datagen/providers/models/DecorationModelProvider.java +++ b/src/main/java/appeng/datagen/providers/models/DecorationModelProvider.java @@ -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", diff --git a/src/main/java/appeng/datagen/providers/models/ItemModelProvider.java b/src/main/java/appeng/datagen/providers/models/ItemModelProvider.java index fb890e4b42a..181a90ce8f5 100644 --- a/src/main/java/appeng/datagen/providers/models/ItemModelProvider.java +++ b/src/main/java/appeng/datagen/providers/models/ItemModelProvider.java @@ -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) { @@ -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() { @@ -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 diff --git a/src/main/java/appeng/debug/DebugCardItem.java b/src/main/java/appeng/debug/DebugCardItem.java index 697b63aa752..7a34ed4f842 100644 --- a/src/main/java/appeng/debug/DebugCardItem.java +++ b/src/main/java/appeng/debug/DebugCardItem.java @@ -195,7 +195,7 @@ public InteractionResult onItemUseFirst(ItemStack stack, UseOnContext context) { this.outputSecondaryMessage(player, "Cable Distance", Integer.toString(length)); } - if (center.getOwner() instanceof P2PTunnelParttunnelPart) { + if (center.getOwner() instanceof P2PTunnelPart tunnelPart) { this.outputSecondaryMessage(player, "Freq", Integer.toString(tunnelPart.getFrequency())); } } else { diff --git a/src/main/java/appeng/hooks/RenderBlockOutlineHook.java b/src/main/java/appeng/hooks/RenderBlockOutlineHook.java index d08f2d5d575..62663231105 100644 --- a/src/main/java/appeng/hooks/RenderBlockOutlineHook.java +++ b/src/main/java/appeng/hooks/RenderBlockOutlineHook.java @@ -178,7 +178,7 @@ private static void showPartPlacementPreview( BlockHitResult blockHitResult, ItemStack itemInHand, boolean insideBlock) { - if (itemInHand.getItem() instanceof IPartItempartItem) { + if (itemInHand.getItem() instanceof IPartItem partItem) { var placement = PartPlacement.getPartPlacement(player, player.level(), itemInHand, diff --git a/src/main/java/appeng/hooks/ticking/ServerBlockEntityRepo.java b/src/main/java/appeng/hooks/ticking/ServerBlockEntityRepo.java index dec4b5dbee0..cc858ce172f 100644 --- a/src/main/java/appeng/hooks/ticking/ServerBlockEntityRepo.java +++ b/src/main/java/appeng/hooks/ticking/ServerBlockEntityRepo.java @@ -38,7 +38,7 @@ * A class to hold data related to ticking block entities. */ class ServerBlockEntityRepo { - record FirstTickInfo (T blockEntity, Consumer initFunction) { + record FirstTickInfo(T blockEntity, Consumer initFunction) { void callInit() { initFunction.accept(blockEntity); } diff --git a/src/main/java/appeng/integration/modules/igtooltip/parts/PartTooltipProviders.java b/src/main/java/appeng/integration/modules/igtooltip/parts/PartTooltipProviders.java index ba813cb5418..b28d1a7c511 100644 --- a/src/main/java/appeng/integration/modules/igtooltip/parts/PartTooltipProviders.java +++ b/src/main/java/appeng/integration/modules/igtooltip/parts/PartTooltipProviders.java @@ -124,10 +124,10 @@ private static CachedProviders createProviderLists(Class clazz) { compatibleNameProviders); } - private record Registration (Class baseClass, T provider, int priority) { + private record Registration(Class baseClass, T provider, int priority) { } - record CachedProviders (List> serverDataProviders, + record CachedProviders(List> serverDataProviders, List> bodyProviders, List> iconProviders, List> nameProviders) { diff --git a/src/main/java/appeng/integration/modules/jei/JEIPlugin.java b/src/main/java/appeng/integration/modules/jei/JEIPlugin.java index 4fd14e8cf32..9656e90997b 100644 --- a/src/main/java/appeng/integration/modules/jei/JEIPlugin.java +++ b/src/main/java/appeng/integration/modules/jei/JEIPlugin.java @@ -264,7 +264,7 @@ private Optional> makeClickableIngredient(StackWithBound return Optional.of(new ClickableIngredient<>(ingredient, stackWithBounds.bounds())); } - private record ClickableIngredient (ITypedIngredient ingredient, + private record ClickableIngredient(ITypedIngredient ingredient, Rect2i area) implements IClickableIngredient { @Override public ITypedIngredient getTypedIngredient() { diff --git a/src/main/java/appeng/integration/modules/rei/ReiPlugin.java b/src/main/java/appeng/integration/modules/rei/ReiPlugin.java index 2d1b25a8ef7..3498c2e6e8e 100644 --- a/src/main/java/appeng/integration/modules/rei/ReiPlugin.java +++ b/src/main/java/appeng/integration/modules/rei/ReiPlugin.java @@ -157,7 +157,7 @@ public void registerScreens(ScreenRegistry registry) { registry.registerDraggableStackVisitor(new GhostIngredientHandler()); registry.registerFocusedStack((screen, mouse) -> { - if (screen instanceof AEBaseScreenaeScreen) { + if (screen instanceof AEBaseScreen aeScreen) { var stack = aeScreen.getStackUnderMouse(mouse.x, mouse.y); if (stack != null) { for (var converter : IngredientConverters.getConverters()) { diff --git a/src/main/java/appeng/integration/modules/rei/transfer/AbstractTransferHandler.java b/src/main/java/appeng/integration/modules/rei/transfer/AbstractTransferHandler.java index a2bb91b2d2c..62ddd18770c 100644 --- a/src/main/java/appeng/integration/modules/rei/transfer/AbstractTransferHandler.java +++ b/src/main/java/appeng/integration/modules/rei/transfer/AbstractTransferHandler.java @@ -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 Reciperecipe ? recipe : null; + return origin instanceof Recipe recipe ? recipe : null; } protected final boolean isCraftingRecipe(Recipe recipe, Display display) { diff --git a/src/main/java/appeng/integration/modules/theoneprobe/BlockEntityInfoProvider.java b/src/main/java/appeng/integration/modules/theoneprobe/BlockEntityInfoProvider.java index 637b1447f6c..ef66e895425 100644 --- a/src/main/java/appeng/integration/modules/theoneprobe/BlockEntityInfoProvider.java +++ b/src/main/java/appeng/integration/modules/theoneprobe/BlockEntityInfoProvider.java @@ -218,7 +218,7 @@ private static TooltipContext getContext(Player player, IProbeHitData data, Comp player); } - record NameCustomizer (Class beClass, NameProvider provider, int priority) { + record NameCustomizer(Class beClass, NameProvider provider, int priority) { public Component getName(BlockEntity blockEntity, TooltipContext context) { if (beClass.isInstance(blockEntity)) { return provider.getName(beClass.cast(blockEntity), context); @@ -227,7 +227,7 @@ public Component getName(BlockEntity blockEntity, TooltipContext context) { } } - record IconCustomizer (Class beClass, IconProvider provider, int priority) { + record IconCustomizer(Class beClass, IconProvider provider, int priority) { public ItemStack getIcon(BlockEntity blockEntity, TooltipContext context) { if (beClass.isInstance(blockEntity)) { return provider.getIcon(beClass.cast(blockEntity), context); @@ -236,7 +236,7 @@ public ItemStack getIcon(BlockEntity blockEntity, TooltipContext context) { } } - record ModNameCustomizer (Class beClass, ModNameProvider provider, int priority) { + record ModNameCustomizer(Class beClass, ModNameProvider provider, int priority) { public String getModName(BlockEntity blockEntity, TooltipContext context) { if (beClass.isInstance(blockEntity)) { return provider.getModName(beClass.cast(blockEntity), context); @@ -245,7 +245,7 @@ public String getModName(BlockEntity blockEntity, TooltipContext context) { } } - record BodyCustomizer (Class beClass, BodyProvider provider, int priority) { + record BodyCustomizer(Class beClass, BodyProvider provider, int priority) { public void buildTooltip(BlockEntity blockEntity, TooltipContext context, TooltipBuilder tooltipBuilder) { if (beClass.isInstance(blockEntity)) { provider.buildTooltip(beClass.cast(blockEntity), context, tooltipBuilder); diff --git a/src/main/java/appeng/items/parts/PartModelsHelper.java b/src/main/java/appeng/items/parts/PartModelsHelper.java index 160b1772c5a..8f25bd97aa2 100644 --- a/src/main/java/appeng/items/parts/PartModelsHelper.java +++ b/src/main/java/appeng/items/parts/PartModelsHelper.java @@ -122,7 +122,7 @@ private static void convertAndAddLocation(Object source, Object value, Listvalues) { + } else if (value instanceof Collection values) { // Check that each object is an IPartModel for (Object candidate : values) { if (!(candidate instanceof IPartModel)) { diff --git a/src/main/java/appeng/me/cells/BasicCellHandler.java b/src/main/java/appeng/me/cells/BasicCellHandler.java index af9478ad0be..d531b68b4a5 100644 --- a/src/main/java/appeng/me/cells/BasicCellHandler.java +++ b/src/main/java/appeng/me/cells/BasicCellHandler.java @@ -65,7 +65,7 @@ public void addCellInformationToTooltip(ItemStack is, List lines) { if (handler.isPreformatted()) { var list = (handler.getPartitionListMode() == IncludeExclude.WHITELIST ? GuiText.Included : GuiText.Excluded) - .text(); + .text(); if (handler.isFuzzy()) { lines.add(GuiText.Partitioned.withSuffix(" - ").append(list).append(" ").append(GuiText.Fuzzy.text())); diff --git a/src/main/java/appeng/me/service/P2PService.java b/src/main/java/appeng/me/service/P2PService.java index a6ccbe097da..1a66d13fa3d 100644 --- a/src/main/java/appeng/me/service/P2PService.java +++ b/src/main/java/appeng/me/service/P2PService.java @@ -80,7 +80,7 @@ public void wakeInputTunnels() { @Override public void removeNode(IGridNode node) { - if (node.getOwner() instanceof P2PTunnelParttunnel) { + if (node.getOwner() instanceof P2PTunnelPart tunnel) { if (tunnel instanceof MEP2PTunnelPart && !node.hasFlag(GridFlags.REQUIRE_CHANNEL)) { return; } @@ -97,7 +97,7 @@ public void removeNode(IGridNode node) { @Override public void addNode(IGridNode node, @Nullable CompoundTag savedData) { - if (node.getOwner() instanceof P2PTunnelParttunnel) { + if (node.getOwner() instanceof P2PTunnelPart tunnel) { if (tunnel instanceof MEP2PTunnelPart && !node.hasFlag(GridFlags.REQUIRE_CHANNEL)) { return; } diff --git a/src/main/java/appeng/me/storage/NetworkStorage.java b/src/main/java/appeng/me/storage/NetworkStorage.java index aed3135d71b..f0c7bd80f02 100644 --- a/src/main/java/appeng/me/storage/NetworkStorage.java +++ b/src/main/java/appeng/me/storage/NetworkStorage.java @@ -269,7 +269,7 @@ public Component getDescription() { return GuiText.MENetworkStorage.text(); } - sealed interface QueuedOperation permits MountOperation,UnmountOperation { + sealed interface QueuedOperation permits MountOperation, UnmountOperation { } private record MountOperation(int priority, MEStorage storage) implements QueuedOperation { diff --git a/src/main/java/appeng/menu/locator/MenuLocators.java b/src/main/java/appeng/menu/locator/MenuLocators.java index e200bdbe000..7f13d59d337 100644 --- a/src/main/java/appeng/menu/locator/MenuLocators.java +++ b/src/main/java/appeng/menu/locator/MenuLocators.java @@ -114,7 +114,7 @@ private static int getPlayerInventorySlotFromHand(Player player, InteractionHand throw new IllegalArgumentException("Could not find item held in hand " + hand + " in player inventory"); } - private record Registration ( + private record Registration( Class locatorClass, BiConsumer writeToPacket, Function readFromPacket) { diff --git a/src/main/java/appeng/mixins/ResizableSlotHighlightMixin.java b/src/main/java/appeng/mixins/ResizableSlotHighlightMixin.java index a9eee53bbca..a21d567332f 100644 --- a/src/main/java/appeng/mixins/ResizableSlotHighlightMixin.java +++ b/src/main/java/appeng/mixins/ResizableSlotHighlightMixin.java @@ -24,7 +24,7 @@ private static void renderResizableSlotHighlight(GuiGraphics guiGraphics, int x, } var screen = minecraft.screen; - if (screen instanceof AEBaseScreenself) { + if (screen instanceof AEBaseScreen self) { self.renderCustomSlotHighlight(guiGraphics, x, y, z); ci.cancel(); } diff --git a/src/main/java/appeng/parts/CableBusContainer.java b/src/main/java/appeng/parts/CableBusContainer.java index c09c4e8f850..2732b27b30e 100644 --- a/src/main/java/appeng/parts/CableBusContainer.java +++ b/src/main/java/appeng/parts/CableBusContainer.java @@ -146,7 +146,7 @@ public boolean canAddPart(ItemStack is, Direction side) { return true; } - if (is.getItem() instanceof IPartItempartItem) { + if (is.getItem() instanceof IPartItem partItem) { var part = partItem.createPart(); if (part == null) { return false; diff --git a/src/main/java/appeng/parts/PartPlacement.java b/src/main/java/appeng/parts/PartPlacement.java index 302ce6c6855..bc1ac6cef8d 100644 --- a/src/main/java/appeng/parts/PartPlacement.java +++ b/src/main/java/appeng/parts/PartPlacement.java @@ -36,7 +36,7 @@ public static InteractionResult place(UseOnContext context) { var partStack = context.getItemInHand(); var side = context.getClickedFace(); - if (!(partStack.getItem() instanceof IPartItempartItem)) { + if (!(partStack.getItem() instanceof IPartItem partItem)) { return InteractionResult.PASS; } diff --git a/src/main/java/appeng/parts/networking/CablePart.java b/src/main/java/appeng/parts/networking/CablePart.java index 0f689a7e816..c3238692f38 100644 --- a/src/main/java/appeng/parts/networking/CablePart.java +++ b/src/main/java/appeng/parts/networking/CablePart.java @@ -92,7 +92,7 @@ public BusSupport supportsBuses() { @Override public AEColor getCableColor() { - if (getPartItem() instanceof ColoredPartItemcoloredPartItem) { + if (getPartItem() instanceof ColoredPartItem coloredPartItem) { return coloredPartItem.getColor(); } return AEColor.TRANSPARENT; diff --git a/src/main/java/appeng/parts/p2p/P2PTunnelPart.java b/src/main/java/appeng/parts/p2p/P2PTunnelPart.java index ed4b1383061..78127d9efb9 100644 --- a/src/main/java/appeng/parts/p2p/P2PTunnelPart.java +++ b/src/main/java/appeng/parts/p2p/P2PTunnelPart.java @@ -167,7 +167,7 @@ public boolean onPartActivate(Player player, InteractionHand hand, Vec3 pos) { newBus = this.getHost().replacePart(partItem, this.getSide(), player, hand); } - if (newBus instanceof P2PTunnelPartnewTunnel) { + if (newBus instanceof P2PTunnelPart newTunnel) { newTunnel.importSettings(SettingsFrom.MEMORY_CARD, configData, player); } @@ -181,7 +181,7 @@ public boolean onPartActivate(Player player, InteractionHand hand, Vec3 pos) { // Attunement via held item replaces the tunnel part with the desired target part type var newType = P2PTunnelAttunement.getTunnelPartByTriggerItem(is); if (!newType.isEmpty() && newType.getItem() != getPartItem() - && newType.getItem() instanceof IPartItempartItem) { + && newType.getItem() instanceof IPartItem partItem) { var oldOutput = isOutput(); var myFreq = getFrequency(); diff --git a/src/main/java/appeng/recipes/entropy/EntropyRecipeSerializer.java b/src/main/java/appeng/recipes/entropy/EntropyRecipeSerializer.java index fb0dbf0b67a..0d3bd03615e 100644 --- a/src/main/java/appeng/recipes/entropy/EntropyRecipeSerializer.java +++ b/src/main/java/appeng/recipes/entropy/EntropyRecipeSerializer.java @@ -366,15 +366,15 @@ private void serializeStateMatchers(List matchers, JsonObject json var properties = new JsonObject(); for (var matcher : matchers) { JsonElement serializedMatcher; - if (matcher instanceof SingleValueMatchersingleMatcher) { + if (matcher instanceof SingleValueMatcher singleMatcher) { serializedMatcher = new JsonPrimitive(singleMatcher.getValueName()); - } else if (matcher instanceof MultipleValuesMatchermultiMatcher) { + } else if (matcher instanceof MultipleValuesMatcher multiMatcher) { var values = new JsonArray(); for (var valueName : multiMatcher.getValueNames()) { values.add(valueName); } serializedMatcher = values; - } else if (matcher instanceof RangeValueMatcherrangeMatcher) { + } else if (matcher instanceof RangeValueMatcher rangeMatcher) { var range = new JsonObject(); range.addProperty("min", rangeMatcher.getMinValueName()); range.addProperty("max", rangeMatcher.getMaxValueName()); diff --git a/src/main/java/appeng/server/testplots/P2PPlotHelper.java b/src/main/java/appeng/server/testplots/P2PPlotHelper.java index f602318b2b8..6e3d86fa5bb 100644 --- a/src/main/java/appeng/server/testplots/P2PPlotHelper.java +++ b/src/main/java/appeng/server/testplots/P2PPlotHelper.java @@ -89,7 +89,7 @@ public static short linkTunnels(IGrid grid, private static P2PTunnelPart getTunnelAt(Level level, PosAndSide posAndSide) { var part = PartHelper.getPart(level, posAndSide.pos(), posAndSide.side()); - if (!(part instanceof P2PTunnelPartp2PTunnelPart)) { + if (!(part instanceof P2PTunnelPart p2PTunnelPart)) { throw new IllegalStateException("No P2P @ " + posAndSide); } return p2PTunnelPart; diff --git a/src/main/java/appeng/server/testworld/BlockEntityCustomizer.java b/src/main/java/appeng/server/testworld/BlockEntityCustomizer.java index 06d289e50a7..72b9e478f56 100644 --- a/src/main/java/appeng/server/testworld/BlockEntityCustomizer.java +++ b/src/main/java/appeng/server/testworld/BlockEntityCustomizer.java @@ -13,7 +13,7 @@ * Calls a customization function on each placed block entity of the given type in the bounding box. Blocks that do not * contain such a block entity are skipped. */ -public record BlockEntityCustomizer (BoundingBox bb, +public record BlockEntityCustomizer(BoundingBox bb, BlockEntityType type, Consumer consumer) implements BlockPlacingBuildAction { @Override diff --git a/src/main/java/appeng/server/testworld/PartCustomizer.java b/src/main/java/appeng/server/testworld/PartCustomizer.java index 983ca98b7a9..b17751df1ca 100644 --- a/src/main/java/appeng/server/testworld/PartCustomizer.java +++ b/src/main/java/appeng/server/testworld/PartCustomizer.java @@ -13,7 +13,7 @@ import appeng.core.definitions.ItemDefinition; import appeng.items.parts.PartItem; -public record PartCustomizer (BoundingBox bb, +public record PartCustomizer(BoundingBox bb, Direction side, ItemDefinition> part, Consumer partCustomizer) implements BlockPlacingBuildAction { diff --git a/src/main/java/appeng/server/testworld/RectanglePacking.java b/src/main/java/appeng/server/testworld/RectanglePacking.java index 160d8dcc022..e3e58a8a66e 100644 --- a/src/main/java/appeng/server/testworld/RectanglePacking.java +++ b/src/main/java/appeng/server/testworld/RectanglePacking.java @@ -151,9 +151,9 @@ public Positioned toPositioned() { public record Size(int w, int h) { } - public record PositionedArea (int w, int h, List> rectangles) { + public record PositionedArea(int w, int h, List> rectangles) { } - public record Positioned (int x, int y, int w, int h, T what) { + public record Positioned(int x, int y, int w, int h, T what) { } } diff --git a/src/main/java/appeng/util/CraftingRecipeUtil.java b/src/main/java/appeng/util/CraftingRecipeUtil.java index e1084fc54df..7c61a196cf7 100644 --- a/src/main/java/appeng/util/CraftingRecipeUtil.java +++ b/src/main/java/appeng/util/CraftingRecipeUtil.java @@ -27,7 +27,7 @@ public static NonNullList ensure3by3CraftingMatrix(Recipe recipe) // shaped recipes can be smaller than 3x3, expand to 3x3 to match the crafting // matrix - if (recipe instanceof IShapedRecipeshapedRecipe) { + if (recipe instanceof IShapedRecipe shapedRecipe) { var width = shapedRecipe.getRecipeWidth(); var height = shapedRecipe.getRecipeHeight(); Preconditions.checkArgument(width <= 3 && height <= 3); diff --git a/src/main/resources/assets/ae2/models/block/mysterious_cube.json b/src/main/resources/assets/ae2/models/block/mysterious_cube.json index 8b5aeac733e..ff211aed0d2 100644 --- a/src/main/resources/assets/ae2/models/block/mysterious_cube.json +++ b/src/main/resources/assets/ae2/models/block/mysterious_cube.json @@ -4630,34 +4630,8 @@ "origin": [8, 8, 8], "color": 9, "children": [ - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39 + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 ] }, { @@ -4665,23 +4639,7 @@ "origin": [0, 0, 0], "color": 0, "children": [ - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56 + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56 ] }, { @@ -4689,36 +4647,8 @@ "origin": [0, 0, 0], "color": 0, "children": [ - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 82, - 83, - 84, - 85, - 86 + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86 ] }, { @@ -4726,41 +4656,9 @@ "origin": [0, 0, 0], "color": 0, "children": [ - 87, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - 96, - 97, - 98, - 99, - 100, - 101, - 102, - 103, - 104, - 105, - 106, - 107, - 108, - 109, - 110, - 111, - 112, - 113, - 114, - 115, - 116, - 117, - 118, - 119, - 120, - 121 + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121 ] } ] diff --git a/src/test/java/appeng/api/networking/GridServicesTest.java b/src/test/java/appeng/api/networking/GridServicesTest.java index bdf02e33d17..a5145b263f3 100644 --- a/src/test/java/appeng/api/networking/GridServicesTest.java +++ b/src/test/java/appeng/api/networking/GridServicesTest.java @@ -128,8 +128,8 @@ void testMustHavePublicConstructor() { void testNoAmbiguousConstructorAllowed() { assertThatThrownBy( () -> GridServices.register(AmbiguousConstructorClass.class, AmbiguousConstructorClass.class)) - .hasMessageContaining("Grid service implementation class") - .hasMessageContaining("has 2 public constructors. It needs exactly 1"); + .hasMessageContaining("Grid service implementation class") + .hasMessageContaining("has 2 public constructors. It needs exactly 1"); } interface PublicInterface {