Skip to content

Commit 94050c2

Browse files
committed
chore: 🔧 spotless / pmd setup and a bit of cleanup
1 parent 6c58a0b commit 94050c2

281 files changed

Lines changed: 3067 additions & 4161 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.gradle

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ plugins {
33
id 'idea'
44
id 'maven-publish'
55
id 'net.neoforged.moddev' version '2.0.110'
6-
id "org.sonarqube" version "5.0.0.4638"
76
id "net.darkhax.curseforgegradle" version "1.1.15"
87
id "com.modrinth.minotaur" version "2.+"
98
id "com.diffplug.spotless" version "7.0.4"
9+
id "org.openrewrite.rewrite" version "7.35.0"
1010
}
1111

12+
def sharedCodeQualityScript = file('../gradle/code-quality.gradle')
13+
apply from: sharedCodeQualityScript.exists() ? sharedCodeQualityScript : 'https://raw.githubusercontent.com/P3pp3rF1y/MultiWorkspace/1.21.10/gradle/code-quality.gradle'
14+
1215
idea {
1316
module {
1417
downloadJavadoc = true
@@ -24,7 +27,7 @@ spotless {
2427
target spotlessFiles == null ? "src/*/java/**/*.java" : spotlessFiles.toString().split(/\s*,\s*/).findAll { it.endsWith(".java") }
2528

2629
eclipse().configFile "$projectDir/codeformat/eclipse-java-format.xml"
27-
importOrder "", "javax", "java"
30+
importOrder "", "javax", "java", "\\#"
2831
removeUnusedImports()
2932
trimTrailingWhitespace()
3033
endWithNewline()
@@ -253,10 +256,3 @@ tasks.modrinth {
253256
dependsOn(tasks.generateChangelog)
254257
onlyIf { !project.ext.changelog.isEmpty() }
255258
}
256-
257-
sonar {
258-
properties {
259-
property "sonar.projectKey", "xreliquary:Reliquary"
260-
property "sonar.organization", "p3pp3rf1y-github"
261-
}
262-
}

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ pluginManagement {
88

99
plugins {
1010
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
11-
}
11+
}

src/main/java/reliquary/Reliquary.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import net.neoforged.neoforge.event.OnDatapackSyncEvent;
1717
import reliquary.client.init.ModParticles;
1818
import reliquary.crafting.AlkahestryRecipeRegistry;
19-
import reliquary.crafting.InfernalTearValueRecipe;
2019
import reliquary.data.DataGenerators;
2120
import reliquary.handler.ClientEventHandler;
2221
import reliquary.handler.CommonEventHandler;
@@ -31,8 +30,7 @@ public class Reliquary {
3130
public static final String MOD_ID = "reliquary";
3231
private static String networkProtocolVersion;
3332

34-
35-
@SuppressWarnings("java:S1118") //needs to be public for mod to work
33+
@SuppressWarnings("java:S1118") // needs to be public for mod to work
3634
public Reliquary(IEventBus modBus, Dist dist, ModContainer container) {
3735
networkProtocolVersion = container.getModInfo().getVersion().toString();
3836
NeoForgeMod.enableMilkFluid();

src/main/java/reliquary/api/IPedestal.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import net.neoforged.neoforge.transfer.transaction.Transaction;
99

1010
import javax.annotation.Nullable;
11+
1112
import java.util.List;
1213
import java.util.Optional;
1314

src/main/java/reliquary/api/client/IPedestalItemRenderer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
import reliquary.client.render.PedestalRenderer;
66

77
public interface IPedestalItemRenderer {
8-
void submitRender(SubmitNodeCollector submitNodeCollector, PedestalRenderer.PedestalRenderState renderState, Object itemData, float partialTicks, PoseStack poseStack, int packedLight, int packedOverlay);
8+
void submitRender(SubmitNodeCollector submitNodeCollector, PedestalRenderer.PedestalRenderState renderState, Object itemData, float partialTicks,
9+
PoseStack poseStack, int packedLight, int packedOverlay);
910
}

src/main/java/reliquary/api/client/package-info.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Auto generated package-info by MCP
22

3-
@ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault
3+
@ParametersAreNonnullByDefault
4+
@MethodsReturnNonnullByDefault
45
package reliquary.api.client;
56

67
import net.minecraft.MethodsReturnNonnullByDefault;

src/main/java/reliquary/api/package-info.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

22
// Auto generated package-info by MCP
33

4-
@ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault
4+
@ParametersAreNonnullByDefault
5+
@MethodsReturnNonnullByDefault
56
package reliquary.api;
67

78
import net.minecraft.MethodsReturnNonnullByDefault;

src/main/java/reliquary/block/AlkahestryAltarBlock.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import reliquary.util.BlockEntityHelper;
3434

3535
import javax.annotation.Nullable;
36+
3637
import java.util.function.Consumer;
3738

3839
public class AlkahestryAltarBlock extends Block implements EntityBlock, ICreativeTabItemGenerator {
@@ -80,14 +81,17 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, Block
8081

8182
@Override
8283
public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource rand) {
83-
if (Boolean.FALSE.equals(state.getValue(ACTIVE)) || level.getDayTime() >= 12000 || !level.canSeeSkyFromBelowWater(pos.above()) || rand.nextInt(3) != 0) {
84+
if (Boolean.FALSE.equals(state.getValue(ACTIVE)) || level.getDayTime() >= 12000 || !level.canSeeSkyFromBelowWater(pos.above())
85+
|| rand.nextInt(3) != 0) {
8486
return;
8587
}
86-
level.addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.9F, 0.9F, 0.0F), pos.getX() + 0.5D + rand.nextGaussian() / 8, pos.getY() + 1.1D, pos.getZ() + 0.5D + rand.nextGaussian() / 8, 0D, 0D, 0D);
88+
level.addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.9F, 0.9F, 0.0F), pos.getX() + 0.5D + rand.nextGaussian() / 8,
89+
pos.getY() + 1.1D, pos.getZ() + 0.5D + rand.nextGaussian() / 8, 0D, 0D, 0D);
8790
}
8891

8992
@Override
90-
protected InteractionResult useItemOn(ItemStack heldItem, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult p_316140_) {
93+
protected InteractionResult useItemOn(ItemStack heldItem, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand,
94+
BlockHitResult p_316140_) {
9195
if (Boolean.TRUE.equals(state.getValue(ACTIVE))) {
9296
return InteractionResult.CONSUME;
9397
}
@@ -120,9 +124,11 @@ protected InteractionResult useItemOn(ItemStack heldItem, BlockState state, Leve
120124
}
121125

122126
private void playSoundAndSpawnParticles(Level level, BlockPos pos, AlkahestryAltarBlockEntity altar) {
123-
level.playSound(null, pos, SoundEvents.LAVA_EXTINGUISH, SoundSource.BLOCKS, 0.3F, 0.5F + 0.5F * altar.getRedstoneCount() + (float) (level.random.nextGaussian() / 8));
127+
level.playSound(null, pos, SoundEvents.LAVA_EXTINGUISH, SoundSource.BLOCKS, 0.3F,
128+
0.5F + 0.5F * altar.getRedstoneCount() + (float) (level.random.nextGaussian() / 8));
124129
for (int particles = level.random.nextInt(3); particles < 3 + altar.getRedstoneCount() * 4 + altar.getRedstoneCount(); particles++) {
125-
level.addParticle(DustParticleOptions.REDSTONE, pos.getX() + 0.5D + level.random.nextGaussian() / 5, pos.getY() + 1.2D, pos.getZ() + 0.5D + level.random.nextGaussian() / 5, 1D, 0D, 0D);
130+
level.addParticle(DustParticleOptions.REDSTONE, pos.getX() + 0.5D + level.random.nextGaussian() / 5, pos.getY() + 1.2D,
131+
pos.getZ() + 0.5D + level.random.nextGaussian() / 5, 1D, 0D, 0D);
126132
}
127133
}
128134

src/main/java/reliquary/block/ApothecaryCauldronBlock.java

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,19 @@
3333
import reliquary.util.WorldHelper;
3434

3535
import javax.annotation.Nullable;
36+
3637
import java.util.function.Consumer;
3738
import java.util.stream.Stream;
3839

3940
public class ApothecaryCauldronBlock extends Block implements EntityBlock, ICreativeTabItemGenerator {
4041

4142
public static final IntegerProperty LEVEL = IntegerProperty.create("level", 0, 3);
4243
private static final VoxelShape INSIDE = box(2.0D, 4.0D, 2.0D, 14.0D, 16.0D, 14.0D);
43-
private static final VoxelShape SHAPE = Stream.of(
44-
Block.box(1, 1, 1, 15, 2, 15),
45-
Block.box(2, 0, 2, 4, 1, 4),
46-
Block.box(12, 0, 2, 14, 1, 4),
47-
Block.box(12, 0, 12, 14, 1, 14),
48-
Block.box(2, 0, 12, 4, 1, 14),
49-
Block.box(0, 2, 0, 16, 13, 2),
50-
Block.box(0, 2, 14, 16, 13, 16),
51-
Block.box(14, 2, 2, 16, 13, 14),
52-
Block.box(0, 2, 2, 2, 13, 14),
53-
Block.box(1, 13, 2, 2, 14, 14),
54-
Block.box(1, 13, 1, 15, 14, 2),
55-
Block.box(1, 13, 14, 15, 14, 15),
56-
Block.box(14, 13, 2, 15, 14, 14),
57-
Block.box(0, 14, 2, 2, 16, 14),
58-
Block.box(0, 14, 0, 16, 16, 2),
59-
Block.box(14, 14, 2, 16, 16, 14),
60-
Block.box(0, 14, 14, 16, 16, 16)
61-
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
44+
private static final VoxelShape SHAPE = Stream.of(Block.box(1, 1, 1, 15, 2, 15), Block.box(2, 0, 2, 4, 1, 4), Block.box(12, 0, 2, 14, 1, 4),
45+
Block.box(12, 0, 12, 14, 1, 14), Block.box(2, 0, 12, 4, 1, 14), Block.box(0, 2, 0, 16, 13, 2), Block.box(0, 2, 14, 16, 13, 16),
46+
Block.box(14, 2, 2, 16, 13, 14), Block.box(0, 2, 2, 2, 13, 14), Block.box(1, 13, 2, 2, 14, 14), Block.box(1, 13, 1, 15, 14, 2),
47+
Block.box(1, 13, 14, 15, 14, 15), Block.box(14, 13, 2, 15, 14, 14), Block.box(0, 14, 2, 2, 16, 14), Block.box(0, 14, 0, 16, 16, 2),
48+
Block.box(14, 14, 2, 16, 16, 14), Block.box(0, 14, 14, 16, 16, 16)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
6249

6350
public ApothecaryCauldronBlock(Properties properties) {
6451
super(properties.mapColor(MapColor.METAL).strength(1.5F, 5.0F).noOcclusion());
@@ -99,7 +86,8 @@ protected void entityInside(BlockState state, Level level, BlockPos pos, Entity
9986
}
10087

10188
@Override
102-
protected InteractionResult useItemOn(ItemStack heldItem, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
89+
protected InteractionResult useItemOn(ItemStack heldItem, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand,
90+
BlockHitResult hitResult) {
10391
if (level.isClientSide()) {
10492
return !heldItem.isEmpty() ? InteractionResult.SUCCESS : InteractionResult.CONSUME;
10593
} else {

src/main/java/reliquary/block/ApothecaryMortarBlock.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,16 @@
3232
import reliquary.util.WorldHelper;
3333

3434
import javax.annotation.Nullable;
35+
3536
import java.util.function.Consumer;
3637
import java.util.stream.Stream;
3738

3839
public class ApothecaryMortarBlock extends Block implements EntityBlock, ICreativeTabItemGenerator {
3940
public static final EnumProperty<Direction> FACING = HorizontalDirectionalBlock.FACING;
40-
private static final VoxelShape MORTAR_SHAPE = Stream.of(
41-
Block.box(6, 1.5, 6, 10, 2.5, 10),
42-
Block.box(5, 2.5, 5, 11, 3.5, 11),
43-
Block.box(5, 0, 5, 11, 1.5, 11),
44-
Block.box(4, 3.5, 5, 5, 6.5, 11),
45-
Block.box(11, 3.5, 5, 12, 6.5, 11),
46-
Block.box(5, 3.5, 11, 11, 6.5, 12),
47-
Block.box(5, 3.5, 4, 11, 6.5, 5)
48-
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
41+
private static final VoxelShape MORTAR_SHAPE = Stream
42+
.of(Block.box(6, 1.5, 6, 10, 2.5, 10), Block.box(5, 2.5, 5, 11, 3.5, 11), Block.box(5, 0, 5, 11, 1.5, 11), Block.box(4, 3.5, 5, 5, 6.5, 11),
43+
Block.box(11, 3.5, 5, 12, 6.5, 11), Block.box(5, 3.5, 11, 11, 6.5, 12), Block.box(5, 3.5, 4, 11, 6.5, 5))
44+
.reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
4945

5046
public ApothecaryMortarBlock(Properties properties) {
5147
super(properties.mapColor(MapColor.STONE).strength(1.5F, 2.0F));
@@ -80,7 +76,8 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
8076
protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) {
8177
return level.getBlockEntity(pos, ModBlocks.APOTHECARY_MORTAR_TILE_TYPE.get()).map(mortar -> {
8278
if (player.isCrouching()) {
83-
InventoryHelper.executeOnItemHandlerAt(level, pos, state, mortar, itemHandler -> InventoryHelper.tryRemovingLastStack(itemHandler, level, mortar.getBlockPos()));
79+
InventoryHelper.executeOnItemHandlerAt(level, pos, state, mortar,
80+
itemHandler -> InventoryHelper.tryRemovingLastStack(itemHandler, level, mortar.getBlockPos()));
8481
return InteractionResult.SUCCESS;
8582
}
8683

@@ -94,9 +91,10 @@ protected InteractionResult useWithoutItem(BlockState state, Level level, BlockP
9491
}
9592

9693
@Override
97-
protected InteractionResult useItemOn(ItemStack heldItem, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
94+
protected InteractionResult useItemOn(ItemStack heldItem, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand,
95+
BlockHitResult hitResult) {
9896
return level.getBlockEntity(pos, ModBlocks.APOTHECARY_MORTAR_TILE_TYPE.get()).map(mortar -> {
99-
//if we're in cooldown prevent player from insta inserting essence that they just got from mortar
97+
// if we're in cooldown prevent player from insta inserting essence that they just got from mortar
10098
if (mortar.isInCooldown(level) && heldItem.getItem() == ModItems.POTION_ESSENCE.get()) {
10199
return InteractionResult.FAIL;
102100
}
@@ -118,7 +116,8 @@ protected InteractionResult useItemOn(ItemStack heldItem, BlockState state, Leve
118116

119117
if (!putItemInSlot) {
120118
if (mortar.usePestle(level)) {
121-
level.playSound(null, pos, soundType.getStepSound(), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F);
119+
level.playSound(null, pos, soundType.getStepSound(), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F,
120+
soundType.getPitch() * 0.8F);
122121
return InteractionResult.CONSUME;
123122
} else {
124123
return InteractionResult.FAIL;

0 commit comments

Comments
 (0)