Skip to content

Commit 8eb8b82

Browse files
committed
chore: 🔧 spotless / pmd setup and a bit of cleanup
1 parent 4c855e5 commit 8eb8b82

276 files changed

Lines changed: 2990 additions & 4097 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.63-beta'
6-
id "org.sonarqube" version "5.0.0.4638"
6+
id "org.openrewrite.rewrite" version "7.35.0"
77
id "net.darkhax.curseforgegradle" version "1.1.15"
88
id "com.modrinth.minotaur" version "2.+"
99
id "com.diffplug.spotless" version "7.0.4"
1010
}
1111

12+
def sharedCodeQualityScript = file('../gradle/code-quality.gradle')
13+
apply from: sharedCodeQualityScript.exists() ? sharedCodeQualityScript : 'https://raw.githubusercontent.com/P3pp3rF1y/MultiWorkspace/1.21.5/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()
@@ -246,10 +249,3 @@ tasks.modrinth {
246249
dependsOn(tasks.generateChangelog)
247250
onlyIf { !project.ext.changelog.isEmpty() }
248251
}
249-
250-
sonar {
251-
properties {
252-
property "sonar.projectKey", "xreliquary:Reliquary"
253-
property "sonar.organization", "p3pp3rf1y-github"
254-
}
255-
}

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.fluids.capability.IFluidHandler;
99

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

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: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,18 @@
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 ApothecaryCauldronBlock extends Block implements EntityBlock, ICreativeTabItemGenerator {
3940

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

6248
public ApothecaryCauldronBlock(Properties properties) {
6349
super(properties.mapColor(MapColor.METAL).strength(1.5F, 5.0F).noOcclusion());
@@ -98,7 +84,8 @@ protected void entityInside(BlockState state, Level level, BlockPos pos, Entity
9884
}
9985

10086
@Override
101-
protected InteractionResult useItemOn(ItemStack heldItem, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
87+
protected InteractionResult useItemOn(ItemStack heldItem, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand,
88+
BlockHitResult hitResult) {
10289
if (level.isClientSide) {
10390
return !heldItem.isEmpty() ? InteractionResult.SUCCESS : InteractionResult.CONSUME;
10491
} else {
@@ -123,18 +110,16 @@ public void handlePrecipitation(BlockState state, Level level, BlockPos pos, Bio
123110
}
124111

125112
/**
126-
* If this returns true, then comparators facing away from this block will
127-
* use the value from getComparatorInputOverride instead of the actual
128-
* redstone signal strength.
113+
* If this returns true, then comparators facing away from this block will use the value from getComparatorInputOverride instead of the actual redstone
114+
* signal strength.
129115
*/
130116
@Override
131117
public boolean hasAnalogOutputSignal(BlockState state) {
132118
return true;
133119
}
134120

135121
/**
136-
* If hasComparatorInputOverride returns true, the return value from this is
137-
* used instead of the redstone signal strength when this block inputs to a
122+
* If hasComparatorInputOverride returns true, the return value from this is used instead of the redstone signal strength when this block inputs to a
138123
* comparator.
139124
*/
140125
@Override

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

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,15 @@
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.of(box(6, 1.5, 6, 10, 2.5, 10), box(5, 2.5, 5, 11, 3.5, 11), box(5, 0, 5, 11, 1.5, 11),
42+
box(4, 3.5, 5, 5, 6.5, 11), box(11, 3.5, 5, 12, 6.5, 11), box(5, 3.5, 11, 11, 6.5, 12), box(5, 3.5, 4, 11, 6.5, 5))
43+
.reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
4944

5045
public ApothecaryMortarBlock(Properties properties) {
5146
super(properties.mapColor(MapColor.STONE).strength(1.5F, 2.0F));
@@ -80,7 +75,8 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
8075
protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) {
8176
return level.getBlockEntity(pos, ModBlocks.APOTHECARY_MORTAR_TILE_TYPE.get()).map(mortar -> {
8277
if (player.isCrouching()) {
83-
InventoryHelper.executeOnItemHandlerAt(level, pos, state, mortar, itemHandler -> InventoryHelper.tryRemovingLastStack(itemHandler, level, mortar.getBlockPos()));
78+
InventoryHelper.executeOnItemHandlerAt(level, pos, state, mortar,
79+
itemHandler -> InventoryHelper.tryRemovingLastStack(itemHandler, level, mortar.getBlockPos()));
8480
return InteractionResult.SUCCESS;
8581
}
8682

@@ -94,9 +90,10 @@ protected InteractionResult useWithoutItem(BlockState state, Level level, BlockP
9490
}
9591

9692
@Override
97-
protected InteractionResult useItemOn(ItemStack heldItem, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
93+
protected InteractionResult useItemOn(ItemStack heldItem, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand,
94+
BlockHitResult hitResult) {
9895
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
96+
// if we're in cooldown prevent player from insta inserting essence that they just got from mortar
10097
if (mortar.isInCooldown(level) && heldItem.getItem() == ModItems.POTION_ESSENCE.get()) {
10198
return InteractionResult.FAIL;
10299
}
@@ -114,7 +111,8 @@ protected InteractionResult useItemOn(ItemStack heldItem, BlockState state, Leve
114111

115112
if (!putItemInSlot) {
116113
if (mortar.usePestle(level)) {
117-
level.playSound(null, pos, soundType.getStepSound(), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F);
114+
level.playSound(null, pos, soundType.getStepSound(), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F,
115+
soundType.getPitch() * 0.8F);
118116
return InteractionResult.CONSUME;
119117
} else {
120118
return InteractionResult.FAIL;

src/main/java/reliquary/block/FertileLilyPadBlock.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class FertileLilyPadBlock extends BushBlock implements ICreativeTabItemGe
3737
public static final MapCodec<BushBlock> CODEC = simpleCodec(FertileLilyPadBlock::new);
3838
private static final Map<ResourceKey<Level>, Long> currentDimensionTicks = new HashMap<>();
3939
private static final Map<ResourceKey<Level>, Set<BlockPos>> dimensionPositionsTicked = new HashMap<>();
40-
private static final VoxelShape AABB = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 1.5D, 15.0D);
40+
private static final VoxelShape AABB = box(1.0D, 0.0D, 1.0D, 15.0D, 1.5D, 15.0D);
4141

4242
public FertileLilyPadBlock(Properties properties) {
4343
super(properties.mapColor(MapColor.PLANT));
@@ -72,7 +72,8 @@ public void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource
7272

7373
@Override
7474
public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource rand) {
75-
level.addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.0F, 0.9F, 0.5F), pos.getX() + 0.5D + rand.nextGaussian() / 8, pos.getY(), pos.getZ() + 0.5D + rand.nextGaussian() / 8, 0D, 0D, 0D);
75+
level.addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.0F, 0.9F, 0.5F), pos.getX() + 0.5D + rand.nextGaussian() / 8, pos.getY(),
76+
pos.getZ() + 0.5D + rand.nextGaussian() / 8, 0D, 0D, 0D);
7677
}
7778

7879
private int secondsBetweenGrowthTicks() {
@@ -121,7 +122,8 @@ private boolean isGrowable(Block cropBlock) {
121122
return true;
122123
}
123124

124-
return cropBlock instanceof SpecialPlantable || cropBlock instanceof BonemealableBlock || cropBlock.asItem().builtInRegistryHolder().is(Tags.Items.CROPS);
125+
return cropBlock instanceof SpecialPlantable || cropBlock instanceof BonemealableBlock
126+
|| cropBlock.asItem().builtInRegistryHolder().is(Tags.Items.CROPS);
125127
}
126128

127129
private int getNumberOfPotencySteps() {

0 commit comments

Comments
 (0)