Skip to content

Commit

Permalink
Use the spotless plugin to format all java files
Browse files Browse the repository at this point in the history
  • Loading branch information
Edivad99 committed Feb 3, 2024
1 parent 9914dcb commit 8ecd2de
Show file tree
Hide file tree
Showing 31 changed files with 86 additions and 66 deletions.
15 changes: 14 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ plugins {
id 'org.spongepowered.mixin' version '0.7.+'
id 'se.bjurr.gitchangelog.git-changelog-gradle-plugin' version '1.81.4'
id 'me.modmuss50.mod-publish-plugin' version '0.4.5'
id 'com.diffplug.spotless' version '6.25.0'
}

def isRelease = System.getenv('CURSEFORGE_TOKEN')
Expand Down Expand Up @@ -127,7 +128,7 @@ dependencies {

annotationProcessor group: 'org.spongepowered', name: 'mixin', version: mixin_version, classifier: 'processor'
testAnnotationProcessor group: 'org.spongepowered', name: 'mixin', version: mixin_version, classifier: 'processor'
testImplementation platform('org.junit:junit-bom:5.10.0')
testImplementation platform("org.junit:junit-bom:$jupiter_version")
testImplementation 'org.junit.jupiter:junit-jupiter'

compileOnly fg.deobf("mezz.jei:jei-$minecraft_version-common-api:$jei_version")
Expand All @@ -145,6 +146,18 @@ test {
}
}

spotless {
java {
target 'src/*/java/**/*.java'
importOrder('\\#', 'java|javax|org|com|')

endWithNewline()
trimTrailingWhitespace()
removeUnusedImports()
indentWithSpaces(2)
}
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.compilerArgs.addAll(['-Xmaxerrs', '100000'])
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ mod_license=https://github.com/railcraft-reborn/railcraft/blob/1.20.x/LICENSE.md

# Dependencies
mixin_version=0.8.5
jupiter_version=5.10.0
jei_version=15.2.0.27
patchouli_version=1.20.1-84-FORGE
20 changes: 10 additions & 10 deletions src/api/java/mods/railcraft/api/carts/RollingStock.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

/**
* Main capability for all things minecart/locomotive related.
*
*
* @author Sm0keySa1m0n
*/
@AutoRegisterCapability
Expand Down Expand Up @@ -67,15 +67,15 @@ static RollingStock getOrThrow(AbstractMinecart minecart) {

/**
* Called upon minecart tick.
*
*
* @apiNote Called by Railcraft.
*/
@ApiStatus.Internal
void tick();

/**
* Called upon minecart removal.
*
*
* @param reason - the reason
* @apiNote Called by Railcraft.
*/
Expand Down Expand Up @@ -111,7 +111,7 @@ default boolean isEnd() {

/**
* Retrieves the {@link RollingStock} linked to the specified {@link Side}.
*
*
* @param side - the {@link Side} to retrieve
* @return the linked {@link RollingStock} or {@link Optional#empty()} if no link exists.
*/
Expand All @@ -133,7 +133,7 @@ default Optional<RollingStock> backLink() {

/**
* Retrieves the {@link Side} on which the specified {@link RollingStock} is linked.
*
*
* @param rollingStock - the {@link RollingStock} to check for
* @return the {@link Side} on which it's linked or {@link Optional#empty()} if no link exists.
*/
Expand All @@ -151,15 +151,15 @@ default Optional<Side> disabledSide() {

/**
* Link with the specified {@link RollingStock}.
*
*
* @param rollingStock - the {@code RollingStock} to link
* @return {@code true} if linking was successful, {@code false} otherwise
*/
boolean link(RollingStock rollingStock);

/**
* Called when a link is completed.
*
*
* @param rollingStock - the {@code RollingStock} to link
* @apiNote To be called by implementations of {@link RollingStock}
*/
Expand All @@ -168,7 +168,7 @@ default Optional<Side> disabledSide() {

/**
* Determine whether the specified {@link RollingStock} can be linked with.
*
*
* @param rollingStock - the {@link RollingStock} being linked
* @return {@code true} if it can, {@code false} otherwise
* @apiNote To be called by implementations of {@link RollingStock}
Expand All @@ -187,7 +187,7 @@ default boolean isLinkableWith(RollingStock rollingStock) {

/**
* Called when a link is removed.
*
*
* @param side - the link side to be removed
* @apiNote To be called by implementations of {@link RollingStock}
*/
Expand All @@ -207,7 +207,7 @@ default boolean unlink(RollingStock minecart) {
/**
* Traverses all {@link RollingStock} on the specified {@link Side} and swaps their front and back
* links.
*
*
* @apiNote To be called by implementations of {@link RollingStock}.
*/
@ApiStatus.Internal
Expand Down
2 changes: 1 addition & 1 deletion src/api/java/mods/railcraft/api/charge/ChargeBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ enum ConnectType {

/**
* A ChargeSpec defines the electrical properties of the block.
*
*
* @param connectType - this controls how our block will connect to other blocks. Many blocks can
* only connect in specific ways due to block shape.
* @param losses - the cost of connecting this block to the charge network due to resistance
Expand Down
4 changes: 2 additions & 2 deletions src/api/java/mods/railcraft/api/charge/ChargeStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This work (the API) is licensed under the "MIT" License,
*
* <p>
* Such that sometimes:
*
*
* <pre>
* {@code
* ChargeStorage bat1 = Charge.distribution.network(level).access(pos).storage().get();
Expand Down Expand Up @@ -122,7 +122,7 @@ default void setState(State state) {}

/**
* Storage spec.
*
*
* @param initialState The initial state of the battery.
* @param capacity The capacity of the battery.
* @param maxDraw How much charge can be drawn from this battery per tick.
Expand Down
2 changes: 1 addition & 1 deletion src/api/java/mods/railcraft/api/package-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ This work (the API) is licensed under the "MIT" License,
package mods.railcraft.api;

import javax.annotation.ParametersAreNonnullByDefault;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.MethodsReturnNonnullByDefault;
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This work (the API) is licensed under the "MIT" License,
import net.minecraftforge.common.util.INBTSerializable;

/**
*
*
* @author Sm0keySa1m0n
*
* @param <T>
Expand Down
2 changes: 1 addition & 1 deletion src/api/java/mods/railcraft/api/signal/SignalNetwork.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This work (the API) is licensed under the "MIT" License,

/**
* Provides access to a signal network.
*
*
* @author Sm0keySa1m0n
*
* @param <T> - node type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/**
* A signal which monitors a section of track.
*
*
* @author Sm0keySa1m0n
*
* @param <T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/**
* A signal or a signal box.
*
*
* @author Sm0keySa1m0n
*/
public interface SignalEntity extends BlockEntityLike, Nameable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

/**
* Copy of {@link MinecartModel} that accepts a {@link CubeDeformation}.
*
*
* @author Sm0keySa1m0n
*
* @param <T> - entity type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ public float getQuadSize(float partialTicks) {
(this.age + partialTicks) / this.lifetime * 32.0F, 0, 1.0F);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class SignalReceiverBoxRenderer extends AbstractSignalBoxRenderer {

public static final ResourceLocation TEXTURE_LOCATION =
RailcraftConstants.rl("entity/signal_box/signal_receiver_box");

@Override
protected ResourceLocation getTopTextureLocation() {
return TEXTURE_LOCATION;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void render(SteamTurbineBlockEntity blockEntity, float partialTick, PoseS
zz++;
fx = 1;
rz = -1;
}
}
} else {
if (patternPos.getZ() == 0) {
xx++;
Expand Down
17 changes: 12 additions & 5 deletions src/main/java/mods/railcraft/season/Seasons.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

public final class Seasons {

public static final boolean HARVEST;
public static final boolean HALLOWEEN;
public static final boolean CHRISTMAS;
private static final boolean HARVEST;
private static final boolean HALLOWEEN;
private static final boolean CHRISTMAS;
public static final String GHOST_TRAIN = "Ghost Train";
public static final String POLAR_EXPRESS = "Polar Express";

Expand Down Expand Up @@ -47,7 +47,7 @@ public final class Seasons {

/**
* Clientside only.
*
*
* @param cart The cart.
*/
public static boolean isGhostTrain(AbstractMinecart cart) {
Expand All @@ -61,7 +61,7 @@ public static boolean isGhostTrain(AbstractMinecart cart) {

/**
* Clientside only.
*
*
* @param cart The cart.
*/
public static boolean isPolarExpress(AbstractMinecart cart) {
Expand All @@ -73,4 +73,11 @@ public static boolean isPolarExpress(AbstractMinecart cart) {
|| level.getBiome(cart.blockPosition()).value().shouldSnow(level, cart.blockPosition())
: season == Season.CHRISTMAS;
}

/**
* Clientside only.
*/
public static boolean isHalloween() {
return HALLOWEEN;
}
}
5 changes: 2 additions & 3 deletions src/main/java/mods/railcraft/util/ValidateSlots.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import mods.railcraft.mixin.SlotMixin;
import net.minecraft.world.Container;
import net.minecraft.world.inventory.Slot;

/**
* Annotated {@link Container} classes will have their {@link Slot} instances call
* {@link Container#canPlaceItem(int, net.minecraft.world.item.ItemStack)}.
*
*
* @see {@link SlotMixin}
*
*
* @author Sm0keySa1m0n
*/
@Retention(RetentionPolicy.RUNTIME)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mods/railcraft/util/VoxelShapeUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import net.minecraft.world.phys.shapes.VoxelShape;

/**
*
*
* @author Sm0keySa1m0n
*
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* An extension of {@link SimpleContainer} with callback support, implementation of
* {@link ContainerManipulator} and maintains item indices when persisting.
*
*
* @author Sm0keySa1m0n
*/
public class AdvancedContainer extends SimpleContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,3 @@ public <T> LazyOptional<T> getCapability(@NotNull Capability<T> capability,
return ForgeCapabilities.FLUID_HANDLER_ITEM.orEmpty(capability, this.holder);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,4 @@ public MerchantOffer getOffer(Entity trader, RandomSource random) {
return new MerchantOffer(new ItemStack(Items.EMERALD, size), stack, 12, 15, 7);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ private void adjustCart() {
/**
* This is where the physics magic actually gets performed. It uses Spring Forces and Damping
* Forces to maintain a fixed distance between carts.
*
*
* @return {@code true} if linked, {@code false} otherwise
*/
public boolean maintainLink(Side linkSide) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import mods.railcraft.world.level.material.steam.SteamConstants;
import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.syncher.EntityDataAccessor;
Expand Down Expand Up @@ -173,12 +174,14 @@ private void clientTick() {
var y = this.getY() + 1.5;
var z = this.getZ() - Math.sin(rads) * offset;

if (Seasons.HALLOWEEN && this.random.nextInt(4) == 0) { // 20%?
this.level().addParticle(RailcraftParticleTypes.PUMPKIN.get(), x, y, z, 0, 0.02, 0);
SimpleParticleType particle;
if (Seasons.isHalloween() && this.random.nextInt(4) == 0) { // 20%?
particle = RailcraftParticleTypes.PUMPKIN.get();
} else {
// smog obviously.
this.level().addParticle(ParticleTypes.CAMPFIRE_COSY_SMOKE, x, y, z, 0, 0.02, 0);
particle = ParticleTypes.CAMPFIRE_COSY_SMOKE;
}
this.level().addParticle(particle, x, y, z, 0, 0.02, 0);
}
// steam spawns ON the engine itself, spreading left or right
// as the pistons are on the train's sides
Expand Down Expand Up @@ -282,4 +285,3 @@ private FluidStack checkFill(FluidStack resource) {
return this.boiler.checkFill(resource, this::explode);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import net.minecraft.world.item.ItemStack;

public class EmptyFluidContainerSlot extends Slot {

public EmptyFluidContainerSlot(Container container, int slot, int x, int y) {
super(container, slot, x, y);
}
Expand Down

0 comments on commit 8ecd2de

Please sign in to comment.