Skip to content

Commit

Permalink
chore: Run spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamefrede committed Dec 31, 2023
1 parent 049c6c9 commit f6c2b5f
Show file tree
Hide file tree
Showing 228 changed files with 1,469 additions and 1,472 deletions.
24 changes: 12 additions & 12 deletions src/main/java/vazkii/psi/api/PsiAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ public static void addPieceToGroup(Class<? extends SpellPiece> clazz, ResourceLo
advancementGroups.put(resLoc, clazz);
advancementGroupsInverse.put(clazz, resLoc);

if (main) {
if (mainPieceForGroup.containsKey(resLoc)) {
if(main) {
if(mainPieceForGroup.containsKey(resLoc)) {
LogManager.getLogger(MOD_ID).info("Group " + resLoc + " already has a main piece!");
}
mainPieceForGroup.put(resLoc, clazz);
Expand All @@ -129,15 +129,15 @@ public static void addPieceToGroup(Class<? extends SpellPiece> clazz, ResourceLo
* more than one, this will return null.
*/
public static ItemStack getPlayerCAD(Player player) {
if (player == null) {
if(player == null) {
return ItemStack.EMPTY;
}

ItemStack cad = ItemStack.EMPTY;
for (int i = 0; i < player.getInventory().getContainerSize(); i++) {
for(int i = 0; i < player.getInventory().getContainerSize(); i++) {
ItemStack stackAt = player.getInventory().getItem(i);
if (!stackAt.isEmpty() && stackAt.getItem() instanceof ICAD) {
if (!cad.isEmpty()) {
if(!stackAt.isEmpty() && stackAt.getItem() instanceof ICAD) {
if(!cad.isEmpty()) {
return ItemStack.EMPTY; // Player can only have one CAD
}

Expand All @@ -149,15 +149,15 @@ public static ItemStack getPlayerCAD(Player player) {
}

public static int getPlayerCADSlot(Player player) {
if (player == null) {
if(player == null) {
return -1;
}

int slot = -1;
for (int i = 0; i < player.getInventory().getContainerSize(); i++) {
for(int i = 0; i < player.getInventory().getContainerSize(); i++) {
ItemStack stackAt = player.getInventory().getItem(i);
if (!stackAt.isEmpty() && stackAt.getItem() instanceof ICAD) {
if (slot != -1) {
if(!stackAt.isEmpty() && stackAt.getItem() instanceof ICAD) {
if(slot != -1) {
return -1; // Player can only have one CAD
}

Expand All @@ -169,11 +169,11 @@ public static int getPlayerCADSlot(Player player) {
}

public static boolean canCADBeUpdated(Player player) {
if (player == null) {
if(player == null) {
return false;
}

if (player.containerMenu == null) {
if(player.containerMenu == null) {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/vazkii/psi/api/cad/AssembleCADEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public ItemStack getCad() {
}

public void setCad(ItemStack cad) {
if (!cad.isEmpty() && !(cad.getItem() instanceof ICAD)) {
if(!cad.isEmpty() && !(cad.getItem() instanceof ICAD)) {
throw new IllegalStateException("Only a CAD can be crafted by the CAD Assembler!");
}
this.cad = cad;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/vazkii/psi/api/cad/ICAD.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public interface ICAD {
*/

static void setComponent(ItemStack stack, ItemStack componentStack) {
if (!componentStack.isEmpty() && componentStack.getItem() instanceof ICADComponent) {
if(!componentStack.isEmpty() && componentStack.getItem() instanceof ICADComponent) {
ICADComponent component = (ICADComponent) componentStack.getItem();
EnumCADComponent componentType = component.getComponentType(componentStack);
String name = TAG_COMPONENT_PREFIX + componentType.name();
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/vazkii/psi/api/cad/ISocketable.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ public interface ISocketable {
int MAX_ASSEMBLER_SLOTS = 12;

static Component getSocketedItemName(ItemStack stack, String fallbackKey) {
if (stack.isEmpty() || !isSocketable(stack)) {
if(stack.isEmpty() || !isSocketable(stack)) {
return new TranslatableComponent(fallbackKey);
}

ISocketable socketable = socketable(stack);
ItemStack item = socketable.getSelectedBullet();
if (item.isEmpty()) {
if(item.isEmpty()) {
return new TranslatableComponent(fallbackKey);
}

Expand All @@ -70,8 +70,8 @@ static ISocketable socketable(ItemStack stack) {

default List<Integer> getRadialMenuSlots() {
List<Integer> list = new ArrayList<>();
for (int i = 0; i < MAX_ASSEMBLER_SLOTS; i++) {
if (isSocketSlotAvailable(i)) {
for(int i = 0; i < MAX_ASSEMBLER_SLOTS; i++) {
if(isSocketSlotAvailable(i)) {
list.add(i);
}
}
Expand All @@ -92,7 +92,7 @@ default List<ResourceLocation> getRadialMenuIcons() {

default int getLastSlot() {
int slot = 0;
while (isSocketSlotAvailable(slot + 1)) {
while(isSocketSlotAvailable(slot + 1)) {
slot++;
}
return slot;
Expand All @@ -103,11 +103,11 @@ default ItemStack getSelectedBullet() {
}

default boolean isItemValid(int slot, ItemStack bullet) {
if (!isSocketSlotAvailable(slot)) {
if(!isSocketSlotAvailable(slot)) {
return false;
}

if (!ISpellAcceptor.isContainer(bullet)) {
if(!ISpellAcceptor.isContainer(bullet)) {
return false;
}

Expand Down
18 changes: 9 additions & 9 deletions src/main/java/vazkii/psi/api/cad/RegenPsiEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public RegenPsiEvent(Player player, IPlayerData playerData, ItemStack cad) {
this.previousRegenCooldown = playerData.getRegenCooldown();
this.regenCooldown = Math.max(0, this.previousRegenCooldown - 1);

if (!cad.isEmpty()) {
if(!cad.isEmpty()) {
ICAD cadItem = (ICAD) cad.getItem();
this.cadPsiCapacity = cadItem.getStatValue(cad, EnumCADStat.OVERFLOW);
this.cadPsi = cadItem.getStoredPsi(cad);
Expand Down Expand Up @@ -264,7 +264,7 @@ public void regenCadFirst(boolean regenCadFirst) {
}

private void applyRegen() {
if (regenCooldown != 0) {
if(regenCooldown != 0) {
return;
}

Expand All @@ -274,30 +274,30 @@ private void applyRegen() {

int regenLeft = regenRate;

if (regenCadFirst) {
if(regenCadFirst) {
regenLeft = applyCadRegen(regenLeft);
}
regenLeft = applyPlayerRegen(regenLeft);
if (!regenCadFirst) {
if(!regenCadFirst) {
applyCadRegen(regenLeft);
}
}

private int applyPlayerRegen(int regenLeft) {
int playerRegenTotal = Math.min(playerPsiCapacity - playerPsi, regenLeft);
if (maxPlayerRegen >= 0) {
if(maxPlayerRegen >= 0) {
playerRegenTotal = Math.min(maxPlayerRegen, playerRegenTotal);
}

if (regenLeft > 0 && playerRegenTotal > 0) {
if(regenLeft > 0 && playerRegenTotal > 0) {
playerRegen = playerRegenTotal;
regenLeft -= playerRegenTotal;
} else {
playerRegen = 0;
}

healOverflow = regenLeft > 0;
if (healOverflow && wasOverflowed) {
if(healOverflow && wasOverflowed) {
regenLeft--;
}

Expand All @@ -306,13 +306,13 @@ private int applyPlayerRegen(int regenLeft) {

private int applyCadRegen(int regenLeft) {
int cadRegenTotal = cadPsiCapacity - cadPsi;
if (maxCadRegen >= 0) {
if(maxCadRegen >= 0) {
cadRegenTotal = Math.min(maxCadRegen, cadRegenTotal);
}

cadRegenCost = Math.min(regenLeft, cadRegenTotal * 2);

if (cadRegenCost > 0) {
if(cadRegenCost > 0) {
cadRegen = Math.min(Math.max(1, cadRegenCost / 2), cadRegenTotal);
regenLeft -= cadRegenCost;
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/vazkii/psi/api/exosuit/PsiArmorEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ public PsiArmorEvent(Player player, String type, double damage, LivingEntity att
this.damage = damage;
this.attacker = attacker;

if (type.equals(NONE)) {
if(type.equals(NONE)) {
throw new IllegalArgumentException("Can't you read?");
}
}

public static void post(PsiArmorEvent event) {
if (!posting) {
if(!posting) {
posting = true;
MinecraftForge.EVENT_BUS.post(event);
posting = false;
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/vazkii/psi/api/internal/MathHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public static LinkedHashSet<BlockPos> getBlocksAlongRay(Vec3 origin, Vec3 end) {
*/
public static LinkedHashSet<BlockPos> getBlocksAlongRay(Vec3 origin, Vec3 end, int maxBlocks) {
LinkedHashSet<BlockPos> positions = new LinkedHashSet<>();
if (maxBlocks == 0) {
if(maxBlocks == 0) {
return positions;
}
if (origin.equals(end)) {
if(origin.equals(end)) {
positions.add(new BlockPos(origin.x, origin.y, origin.z));
} else {
double endX = end.x;
Expand All @@ -63,16 +63,16 @@ public static LinkedHashSet<BlockPos> getBlocksAlongRay(Vec3 origin, Vec3 end, i
double totalStepsY = stepSizeY * (signumY > 0 ? 1.0D - net.minecraft.util.Mth.frac(originY) : net.minecraft.util.Mth.frac(originY));
double totalStepsZ = stepSizeZ * (signumZ > 0 ? 1.0D - net.minecraft.util.Mth.frac(originZ) : net.minecraft.util.Mth.frac(originZ));

while ((totalStepsX <= 1.0D || totalStepsY <= 1.0D || totalStepsZ <= 1.0D) && positions.size() != maxBlocks) {
if (totalStepsX < totalStepsY) {
if (totalStepsX < totalStepsZ) {
while((totalStepsX <= 1.0D || totalStepsY <= 1.0D || totalStepsZ <= 1.0D) && positions.size() != maxBlocks) {
if(totalStepsX < totalStepsY) {
if(totalStepsX < totalStepsZ) {
blockX += signumX;
totalStepsX += stepSizeX;
} else {
blockZ += signumZ;
totalStepsZ += stepSizeZ;
}
} else if (totalStepsY < totalStepsZ) {
} else if(totalStepsY < totalStepsZ) {
blockY += signumY;
totalStepsY += stepSizeY;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/vazkii/psi/api/internal/Quat.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public double mag() {

public void normalize() {
double d = mag();
if (d == 0.0D) {} else {
if(d == 0.0D) {} else {
d = 1.0D / d;
x *= d;
y *= d;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/vazkii/psi/api/internal/TooltipHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public final class TooltipHelper {

@OnlyIn(Dist.CLIENT)
public static void tooltipIfShift(List<Component> tooltip, Runnable r) {
if (Screen.hasShiftDown()) {
if(Screen.hasShiftDown()) {
r.run();
} else {
tooltip.add(new TranslatableComponent("psimisc.shift_for_info"));
Expand All @@ -29,7 +29,7 @@ public static void tooltipIfShift(List<Component> tooltip, Runnable r) {

@OnlyIn(Dist.CLIENT)
public static void tooltipIfCtrl(List<Component> tooltip, Runnable r) {
if (Screen.hasControlDown()) {
if(Screen.hasControlDown()) {
r.run();
} else {
tooltip.add(new TranslatableComponent("psimisc.ctrl_for_stats"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public final class VanillaPacketDispatcher {

public static void dispatchTEToNearbyPlayers(BlockEntity tile) {
Level world = tile.getLevel();
for (Player player : world.players()) {
if (player instanceof ServerPlayer) {
for(Player player : world.players()) {
if(player instanceof ServerPlayer) {
ServerPlayer mp = (ServerPlayer) player;
if (MathHelper.pointDistancePlane(mp.getX(), mp.getZ(), tile.getBlockPos().getX() + 0.5, tile.getBlockPos().getZ() + 0.5) < 64) {
if(MathHelper.pointDistancePlane(mp.getX(), mp.getZ(), tile.getBlockPos().getX() + 0.5, tile.getBlockPos().getZ() + 0.5) < 64) {
dispatchTEToPlayer(tile, mp);
}
}
Expand All @@ -32,14 +32,14 @@ public static void dispatchTEToNearbyPlayers(BlockEntity tile) {

public static void dispatchTEToNearbyPlayers(Level world, BlockPos pos) {
BlockEntity tile = world.getBlockEntity(pos);
if (tile != null) {
if(tile != null) {
dispatchTEToNearbyPlayers(tile);
}
}

public static void dispatchTEToPlayer(BlockEntity tile, ServerPlayer p) {
Packet<ClientGamePacketListener> packet = tile.getUpdatePacket();
if (packet != null) {
if(packet != null) {
p.connection.send(packet);
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/vazkii/psi/api/internal/Vector3.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ public Vector3 set(Vector3 vec) {
public double dotProduct(Vector3 vec) {
double d = vec.x * x + vec.y * y + vec.z * z;

if (d > 1 && d < 1.00001) {
if(d > 1 && d < 1.00001) {
d = 1;
} else if (d < -1 && d > -1.00001) {
} else if(d < -1 && d > -1.00001) {
d = -1;
}
return d;
Expand Down Expand Up @@ -197,7 +197,7 @@ public double magSquared() {

public Vector3 normalize() {
double d = mag();
if (d != 0) {
if(d != 0) {
multiply(1 / d);
}

Expand All @@ -211,7 +211,7 @@ public String toString() {
}

public Vector3 perpendicular() {
if (z == 0) {
if(z == 0) {
return zCrossProduct();
}
return xCrossProduct();
Expand Down Expand Up @@ -288,7 +288,7 @@ public double scalarProject(Vector3 b) {

public Vector3 project(Vector3 b) {
double l = b.magSquared();
if (l == 0) {
if(l == 0) {
set(0, 0, 0);
return this;
}
Expand All @@ -305,7 +305,7 @@ public Vector3 rotate(double angle, Vector3 axis) {

@Override
public boolean equals(Object o) {
if (!(o instanceof Vector3)) {
if(!(o instanceof Vector3)) {
return false;
}

Expand Down
Loading

0 comments on commit f6c2b5f

Please sign in to comment.