Add some basic spotless formatting rules.

This commit is contained in:
modmuss50 2022-12-18 12:10:22 +00:00
parent d2e4b92984
commit 4c037bd80b
127 changed files with 590 additions and 654 deletions

View file

@ -31,13 +31,11 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.hud.ChatHud;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

View file

@ -37,7 +37,6 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry;
import org.joml.Matrix4f;
import org.lwjgl.opengl.GL12;

View file

@ -55,7 +55,7 @@ public class RebornFluidRenderManager implements SimpleSynchronousResourceReload
private static void setupFluidRenderer(RebornFluid fluid) {
// Done lazy as we want to ensure we get the sprite at the correct time,
// but also don't want to be making these calls every time its required.
// but also don't want to be making these calls every time its required.
TemporaryLazy<Sprite[]> sprites = new TemporaryLazy<>(() -> {
FluidSettings fluidSettings = fluid.getFluidSettings();
return new Sprite[]{RenderUtil.getSprite(fluidSettings.getStillTexture()), RenderUtil.getSprite(fluidSettings.getFlowingTexture())};

View file

@ -30,7 +30,6 @@ import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.*;
import net.minecraft.client.texture.Sprite;
import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.client.texture.TextureManager;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.fluid.Fluid;
@ -77,7 +76,7 @@ public class RenderUtil {
}
public static void renderGuiTank(FluidInstance fluid, FluidValue capacity, FluidValue amount, double x, double y, double zLevel,
double width, double height) {
double width, double height) {
if (fluid == null || fluid.getFluid() == null || fluid.getAmount().lessThanOrEqual(FluidValue.EMPTY)) {
return;
}

View file

@ -78,4 +78,4 @@ public class ConfigFluidElement extends ElementBase {
public SlotType getType() {
return type;
}
}
}

View file

@ -131,4 +131,4 @@ public class ConfigSlotElement extends ElementBase {
public int getId() {
return id;
}
}
}

View file

@ -171,14 +171,14 @@ public class FluidConfigPopupElement extends ElementBase {
}
public void drawState(GuiBase<?> gui,
World world,
BakedModel model,
BlockState actualState,
BlockPos pos,
BlockRenderManager dispatcher,
int x,
int y,
Quaternionf quaternion) {
World world,
BakedModel model,
BlockState actualState,
BlockPos pos,
BlockRenderManager dispatcher,
int x,
int y,
Quaternionf quaternion) {
MatrixStack matrixStack = new MatrixStack();
matrixStack.push();

View file

@ -177,14 +177,14 @@ public class SlotConfigPopupElement extends ElementBase {
}
public void drawState(GuiBase<?> gui,
World world,
BakedModel model,
BlockState actualState,
BlockPos pos,
BlockRenderManager dispatcher,
int x,
int y,
Quaternionf quaternion) {
World world,
BakedModel model,
BlockState actualState,
BlockPos pos,
BlockRenderManager dispatcher,
int x,
int y,
Quaternionf quaternion) {
MatrixStack matrixStack = new MatrixStack();
matrixStack.push();

View file

@ -59,4 +59,4 @@ public class SlotElement extends ElementBase {
public int getSlotY() {
return slotY;
}
}
}

View file

@ -66,4 +66,4 @@ public enum SlotType {
public Sprite getButtonHoverOverlay() {
return buttonHoverOverlay;
}
}
}

View file

@ -108,15 +108,15 @@ public class Sprite implements ISprite {
}
public record Button(Sprite normal,
Sprite hovered) {
Sprite hovered) {
}
public record ToggleButton(Sprite normal,
Sprite hovered,
Sprite pressed) {
Sprite hovered,
Sprite pressed) {
}
public record CheckBox(Sprite normal,
Sprite ticked) {
Sprite ticked) {
}
}

View file

@ -25,11 +25,9 @@
package reborncore.client.gui.builder.widget;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import reborncore.common.misc.TriConsumer;
import java.util.function.Supplier;
public class GuiButtonExtended extends ButtonWidget {

View file

@ -570,7 +570,7 @@ public class GuiBuilder {
* @param layer {@link GuiBase.Layer} The layer to draw on
*/
public void drawMultiEnergyBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, long energyStored, long maxEnergyStored, int mouseX,
int mouseY, int buttonID, GuiBase.Layer layer) {
int mouseY, int buttonID, GuiBase.Layer layer) {
if (gui.hideGuiElements()) return;
if (layer == GuiBase.Layer.BACKGROUND) {
x += gui.getGuiLeft();

View file

@ -32,10 +32,7 @@ import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -92,12 +89,12 @@ public class RebornCore implements ModInitializer {
BlockWrenchEventHandler.setup();
/*
This is a generic multiblock tick handler. If you are using this code on your
own, you will need to register this with the Forge TickRegistry on both the
client AND server sides. Note that different types of ticks run on different
parts of the system. CLIENT ticks only run on the client, at the start/end of
each game loop. SERVER and WORLD ticks only run on the server. WORLDLOAD
ticks run only on the server, and only when worlds are loaded.
This is a generic multiblock tick handler. If you are using this code on your
own, you will need to register this with the Forge TickRegistry on both the
client AND server sides. Note that different types of ticks run on different
parts of the system. CLIENT ticks only run on the client, at the start/end of
each game loop. SERVER and WORLD ticks only run on the server. WORLDLOAD
ticks run only on the server, and only when worlds are loaded.
*/
ServerTickEvents.START_WORLD_TICK.register(MultiblockRegistry::tickStart);
@ -108,7 +105,7 @@ public class RebornCore implements ModInitializer {
RebornCoreTags.WATER_EXPLOSION_ITEM.toString();
PaddedShapedRecipe.PADDED.toString();
/* register UnloadHandler */
ServerBlockEntityEvents.BLOCK_ENTITY_UNLOAD.register((blockEntity, world) -> {
if (blockEntity instanceof UnloadHandler) ((UnloadHandler) blockEntity).onUnload();

View file

@ -92,6 +92,6 @@ public abstract class BaseBlockEntityProvider extends Block implements BlockEnti
}
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune){
}
}

View file

@ -45,7 +45,6 @@ import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerChunkManager;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.Text;
import net.minecraft.registry.Registry;
import net.minecraft.world.chunk.ChunkStatus;
import reborncore.common.network.ClientBoundPackets;
import reborncore.common.network.IdentifiedPacket;
@ -185,4 +184,4 @@ public class RebornCoreCommands {
IdentifiedPacket packet = ClientBoundPackets.createPacketQueueItemStacksToRender(stacks);
NetworkManager.sendToPlayer(packet, ctx.getSource().getPlayer());
}
}
}

View file

@ -457,7 +457,7 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
}
return false;
}
@Override
public boolean isValid(int slot, ItemStack stack) {
if (slotConfiguration == null) {

View file

@ -151,9 +151,9 @@ public class SlotConfiguration implements NBTSerializable {
sideMap = new HashMap<>();
read(tagCompound);
Validate.isTrue(Arrays.stream(Direction.values())
.map(enumFacing -> sideMap.get(enumFacing))
.noneMatch(Objects::isNull),
"sideMap failed to load from nbt"
.map(enumFacing -> sideMap.get(enumFacing))
.noneMatch(Objects::isNull),
"sideMap failed to load from nbt"
);
}

View file

@ -35,7 +35,6 @@ import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.registry.Registry;
import net.minecraft.world.World;
import reborncore.RebornCore;
import reborncore.api.recipe.IRecipeCrafterProvider;

View file

@ -41,7 +41,6 @@ import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.registry.Registry;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;
import reborncore.common.util.DefaultedListCollector;

View file

@ -32,7 +32,6 @@ import net.minecraft.recipe.ShapedRecipe;
import net.minecraft.registry.Registries;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.JsonHelper;
import net.minecraft.registry.Registry;
import net.minecraft.registry.entry.RegistryEntry;
import java.util.Map;

View file

@ -38,7 +38,6 @@ import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.Lazy;
import net.minecraft.registry.Registry;
import reborncore.common.fluid.container.ItemFluidInfo;
import java.util.ArrayList;

View file

@ -37,7 +37,6 @@ import net.minecraft.recipe.Ingredient;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.registry.Registry;
import org.apache.commons.lang3.Validate;
import java.util.Collections;

View file

@ -35,7 +35,6 @@ import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.registry.Registry;
import net.minecraft.registry.entry.RegistryEntry;
import org.apache.commons.lang3.Validate;

View file

@ -32,7 +32,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtOps;
import net.minecraft.registry.Registries;
import net.minecraft.util.JsonHelper;
import net.minecraft.registry.Registry;
import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RecipeUtils;
import reborncore.common.crafting.ingredient.IngredientFactory;

View file

@ -28,7 +28,6 @@ import com.google.gson.JsonObject;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import org.jetbrains.annotations.NotNull;

View file

@ -44,7 +44,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.text.Text;
import net.minecraft.util.Hand;
import net.minecraft.registry.Registry;
import org.jetbrains.annotations.NotNull;
import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.util.Tank;

View file

@ -30,7 +30,6 @@ import net.minecraft.fluid.Fluids;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry;
import reborncore.common.fluid.FluidValue;
import reborncore.common.util.NBTSerializable;
@ -145,4 +144,4 @@ public class FluidInstance implements NBTSerializable {
if (isEmpty()) return FluidVariant.blank();
else return FluidVariant.of(fluid, tag);
}
}
}

View file

@ -26,5 +26,5 @@ package reborncore.common.misc;
@FunctionalInterface
public interface TriConsumer<A, B, C> {
void accept(A a, B b, C c);
}
void accept(A a, B b, C c);
}

View file

@ -43,7 +43,7 @@ import java.util.Set;
public abstract class IMultiblockPart extends BlockEntity {
public static final int INVALID_DISTANCE = Integer.MAX_VALUE;
public IMultiblockPart(BlockEntityType<?> type, BlockPos pos, BlockState state) {
public IMultiblockPart(BlockEntityType<?> type, BlockPos pos, BlockState state) {
super(type, pos, state);
}
@ -99,7 +99,7 @@ public abstract class IMultiblockPart extends BlockEntity {
* @see #onDetached(MultiblockControllerBase)
*/
public abstract void onOrphaned(MultiblockControllerBase oldController, int oldControllerSize,
int newControllerSize);
int newControllerSize);
// Multiblock fuse/split helper methods. Here there be dragons.

View file

@ -30,7 +30,6 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import reborncore.common.blockentity.FluidConfiguration;

View file

@ -55,7 +55,7 @@ public class ServerBoundPackets {
NetworkManager.sendToTracking(packetFluidConfigSync, legacyMachineBase);
// We update the block to allow pipes that are connecting to detect the update and change their
// connection status if needed
// connection status if needed
World world = legacyMachineBase.getWorld();
BlockState blockState = world.getBlockState(legacyMachineBase.getPos());
world.updateNeighborsAlways(legacyMachineBase.getPos(), blockState.getBlock());

View file

@ -288,7 +288,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
* @return {@code long} Energy stored in block entity
*/
public long getEnergy() {
return getStored();
return getStored();
}
/**

View file

@ -104,7 +104,7 @@ public class RecipeCrafter implements IUpgradeHandler {
};
public RecipeCrafter(RebornRecipeType<?> recipeType, BlockEntity blockEntity, int inputs, int outputs, RebornInventory<?> inventory,
int[] inputSlots, int[] outputSlots) {
int[] inputSlots, int[] outputSlots) {
this.recipeType = recipeType;
this.blockEntity = blockEntity;
if (blockEntity instanceof PowerAcceptorBlockEntity powerAcceptor) {
@ -368,7 +368,7 @@ public class RecipeCrafter implements IUpgradeHandler {
}
// Test with a stack with the max stack size as some independents will check the stack size.
// A bit of a hack but should work.
// A bit of a hack but should work.
ItemStack largeStack = stack.copy();
largeStack.setCount(largeStack.getMaxCount());
for (RebornRecipe recipe : recipeType.getRecipes(blockEntity.getWorld())) {

View file

@ -71,8 +71,8 @@ public class BuiltScreenHandler extends ScreenHandler {
private final MachineBaseBlockEntity blockEntity;
public BuiltScreenHandler(int syncID, final String name, final Predicate<PlayerEntity> canInteract,
final List<Range<Integer>> playerSlotRange,
final List<Range<Integer>> blockEntitySlotRange, MachineBaseBlockEntity blockEntity) {
final List<Range<Integer>> playerSlotRange,
final List<Range<Integer>> blockEntitySlotRange, MachineBaseBlockEntity blockEntity) {
super(null, syncID);
this.name = name;

View file

@ -96,7 +96,7 @@ public class BlockEntityScreenHandlerBuilder {
}
public BlockEntityScreenHandlerBuilder filterSlot(final int index, final int x, final int y,
final Predicate<ItemStack> filter) {
final Predicate<ItemStack> filter) {
this.parent.slots.add(new FilteredSlot(this.inventory, index, x, y).setFilter(filter));
return this;
}

View file

@ -102,7 +102,7 @@ public final class PlayerScreenHandlerBuilder {
}
private PlayerArmorScreenHandlerBuilder armor(final int index, final int xStart, final int yStart,
final EquipmentSlot slotType, final Identifier sprite) {
final EquipmentSlot slotType, final Identifier sprite) {
this.parent.parent.slots.add(new SpriteSlot(this.parent.player, index, xStart, yStart, sprite, 1)
.setFilter(stack -> {
if (stack.getItem() instanceof ArmorItem) {

View file

@ -103,8 +103,8 @@ public class InventoryItem extends InventoryBase {
@Override
public void setStack(int slot,
@NotNull
ItemStack stack) {
@NotNull
ItemStack stack) {
setSlotData(slot, stack.writeNbt(new NbtCompound()));
}
@ -120,8 +120,8 @@ public class InventoryItem extends InventoryBase {
}
public int getStackLimit(int slot,
@NotNull
ItemStack stack) {
@NotNull
ItemStack stack) {
return Math.min(getSlotLimit(slot), stack.getMaxCount());
}

View file

@ -50,7 +50,7 @@ import java.util.function.Predicate;
public class ItemUtils {
public static boolean isItemEqual(final ItemStack a, final ItemStack b,
final boolean matchNBT) {
final boolean matchNBT) {
if (a.isEmpty() || b.isEmpty()) {
return false;
}
@ -61,7 +61,7 @@ public class ItemUtils {
}
public static boolean isItemEqual(ItemStack a, ItemStack b, boolean matchNBT,
boolean useTags) {
boolean useTags) {
if (a.isEmpty() && b.isEmpty()) {
return true;
}
@ -103,7 +103,7 @@ public class ItemUtils {
//TODO tags
public static boolean isInputEqual(Object input, ItemStack other, boolean matchNBT,
boolean useTags) {
boolean useTags) {
if (input instanceof ItemStack) {
return isItemEqual((ItemStack) input, other, matchNBT, useTags);
} else if (input instanceof String) {
@ -171,12 +171,12 @@ public class ItemUtils {
if (player instanceof ServerPlayerEntity serverPlayerEntity) {
serverPlayerEntity.sendMessage(Text.translatable("reborncore.message.energyError")
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.deactivating")
.formatted(Formatting.GOLD)
), true);
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.deactivating")
.formatted(Formatting.GOLD)
), true);
}
stack.getOrCreateNbt().putBoolean("isActive", false);
@ -196,23 +196,23 @@ public class ItemUtils {
if (entity instanceof ServerPlayerEntity serverPlayerEntity) {
serverPlayerEntity.sendMessage(Text.translatable("reborncore.message.setTo")
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.active")
.formatted(Formatting.GOLD)
), true);
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.active")
.formatted(Formatting.GOLD)
), true);
}
} else {
stack.getOrCreateNbt().putBoolean("isActive", false);
if (entity instanceof ServerPlayerEntity serverPlayerEntity) {
serverPlayerEntity.sendMessage(Text.translatable("reborncore.message.setTo")
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.inactive")
.formatted(Formatting.GOLD)
), true);
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.inactive")
.formatted(Formatting.GOLD)
), true);
}
}
}

View file

@ -34,7 +34,6 @@ import net.minecraft.fluid.Fluids;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;

View file

@ -44,4 +44,4 @@ public class TemporaryLazy<T> {
public void reset() {
value = null;
}
}
}

View file

@ -31,7 +31,6 @@ import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.StringNbtReader;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry;
import java.lang.reflect.Type;

View file

@ -52,4 +52,4 @@ public abstract class MixinCraftingResultSlot {
ItemCraftCallback.EVENT.invoker().onCraft(itemStack, input, player);
}
}
}

View file

@ -29,7 +29,6 @@ import net.minecraft.entity.EntityType;
import net.minecraft.entity.ItemEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.explosion.Explosion;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;