Skip to content

Commit c5e60dd

Browse files
committed
code style is now consistent across all files
1 parent e544c07 commit c5e60dd

21 files changed

+498
-439
lines changed

src/main/java/one/pouekdev/coordinatelist/CList.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
import org.slf4j.Logger;
77
import org.slf4j.LoggerFactory;
88

9-
public class CList implements ModInitializer {
10-
public static final String MOD_ID = "coordinatelist";
11-
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
12-
@Override
13-
public void onInitialize() {
14-
MidnightConfig.init(MOD_ID, CListConfig.class);
15-
ClientCommandRegistrationCallback.EVENT.register(new CListCommand());
16-
}
9+
public class CList implements ModInitializer{
10+
public static final String MOD_ID = "coordinatelist";
11+
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
12+
13+
@Override
14+
public void onInitialize(){
15+
MidnightConfig.init(MOD_ID, CListConfig.class);
16+
ClientCommandRegistrationCallback.EVENT.register(new CListCommand());
17+
}
1718
}

src/main/java/one/pouekdev/coordinatelist/CListClient.java

Lines changed: 118 additions & 105 deletions
Large diffs are not rendered by default.

src/main/java/one/pouekdev/coordinatelist/CListCommand.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,23 @@
77
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
88
import net.minecraft.command.CommandRegistryAccess;
99

10-
public class CListCommand implements ClientCommandRegistrationCallback {
10+
public class CListCommand implements ClientCommandRegistrationCallback{
1111
@Override
12-
public void register(CommandDispatcher<FabricClientCommandSource> dispatcher, CommandRegistryAccess registryAccess) {
12+
public void register(CommandDispatcher<FabricClientCommandSource> dispatcher, CommandRegistryAccess registryAccess){
1313
dispatcher.register(ClientCommandManager.literal("clist")
14-
.then(ClientCommandManager.argument("x", IntegerArgumentType.integer(Integer.MIN_VALUE,Integer.MAX_VALUE))
15-
.then(ClientCommandManager.argument("y", IntegerArgumentType.integer(Integer.MIN_VALUE,Integer.MAX_VALUE))
16-
.then(ClientCommandManager.argument("z", IntegerArgumentType.integer(Integer.MIN_VALUE,Integer.MAX_VALUE))
17-
.executes(ctx -> {
18-
int x = IntegerArgumentType.getInteger(ctx,"x");
19-
int y = IntegerArgumentType.getInteger(ctx,"y");
20-
int z = IntegerArgumentType.getInteger(ctx,"z");
21-
CListClient.addNewWaypoint(x,y,z,false,true);
22-
return 0;
23-
})))));
14+
.then(ClientCommandManager.argument("x", IntegerArgumentType.integer(Integer.MIN_VALUE, Integer.MAX_VALUE))
15+
.then(ClientCommandManager.argument("y", IntegerArgumentType.integer(Integer.MIN_VALUE, Integer.MAX_VALUE))
16+
.then(ClientCommandManager.argument("z", IntegerArgumentType.integer(Integer.MIN_VALUE, Integer.MAX_VALUE))
17+
.executes(ctx -> {
18+
int x = IntegerArgumentType.getInteger(ctx, "x");
19+
int y = IntegerArgumentType.getInteger(ctx, "y");
20+
int z = IntegerArgumentType.getInteger(ctx, "z");
21+
CListClient.addNewWaypoint(x, y, z, false, true);
22+
return 0;
23+
})
24+
)
25+
)
26+
)
27+
);
2428
}
2529
}

src/main/java/one/pouekdev/coordinatelist/CListConfig.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
public class CListConfig extends MidnightConfig {
66
@Entry(min=5,max=200) public static int multiplier = 10;
7-
@Entry(min=0) public static int render_distance = 0;
8-
@Entry public static boolean waypoints_toggled = true;
9-
@Entry public static boolean can_place_deathpoints = true;
10-
@Entry public static boolean waypoint_text_background = true;
11-
@Entry public static boolean square_waypoints = false;
7+
@Entry(min=0) public static int renderDistance = 0;
8+
@Entry public static boolean waypointsToggled = true;
9+
@Entry public static boolean canPlaceDeathpoints = true;
10+
@Entry public static boolean waypointTextBackground = true;
11+
@Entry public static boolean squareWaypoints = false;
1212
}

src/main/java/one/pouekdev/coordinatelist/CListData.java

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,67 +8,61 @@
88
import java.nio.file.Files;
99
import java.util.List;
1010

11-
public class CListData {
12-
public static void saveListToFile(String fileName, List<CListWaypoint> waypointList) {
13-
if (!Files.exists(FabricLoader.getInstance().getConfigDir().resolve("coordinatelist"))) {
14-
try {
11+
public class CListData{
12+
public static void saveListToFile(String fileName, List<CListWaypoint> waypointList){
13+
if(!Files.exists(FabricLoader.getInstance().getConfigDir().resolve("coordinatelist"))){
14+
try{
1515
Files.createDirectories(FabricLoader.getInstance().getConfigDir().resolve("coordinatelist"));
16-
} catch (IOException ignored) {
1716
}
17+
catch(IOException ignored){}
1818
}
1919
File dataDir = FabricLoader.getInstance().getConfigDir().resolve("coordinatelist").toFile();
2020
File file = new File(dataDir, fileName);
21-
22-
try (PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8)))) {
23-
for (int i = 0; i < waypointList.size(); i++) {
24-
writer.println(CListClient.variables.waypoints.get(i).getCoordinates() + "~" + CListClient.variables.waypoints.get(i).name.replaceAll("~","") + "~" + CListClient.variables.waypoints.get(i).dimension + "~" + CListClient.variables.colors.get(i).getHexNoAlpha() + "~" + CListClient.variables.waypoints.get(i).render + "~" + CListClient.variables.waypoints.get(i).deathpoint);
21+
try(PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8)))){
22+
for(int i = 0; i < waypointList.size(); i++){
23+
writer.println(CListClient.variables.waypoints.get(i).getCoordinates() + "~" + CListClient.variables.waypoints.get(i).name.replaceAll("~", "") + "~" + CListClient.variables.waypoints.get(i).dimension + "~" + CListClient.variables.colors.get(i).getHexNoAlpha() + "~" + CListClient.variables.waypoints.get(i).render + "~" + CListClient.variables.waypoints.get(i).deathpoint);
2524
}
26-
} catch (IOException ignored) {
2725
}
26+
catch(IOException ignored){}
2827
}
2928

30-
public static List<CListWaypoint> loadListFromFile(String fileName) {
29+
public static List<CListWaypoint> loadListFromFile(String fileName){
3130
File dataDir = FabricLoader.getInstance().getConfigDir().resolve("coordinatelist").toFile();
3231
File file = new File(dataDir, fileName);
33-
34-
if (!file.exists()) {
32+
if(!file.exists()){
3533
return null;
3634
}
37-
38-
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) {
35+
try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))){
3936
List<CListWaypoint> waypointList = Lists.newArrayList();
4037
String line;
41-
42-
while ((line = reader.readLine()) != null) {
38+
while((line = reader.readLine()) != null){
4339
String[] segments = line.split("~");
44-
if (segments.length >= 3) {
40+
if(segments.length >= 3){
4541
String coords = segments[0];
4642
String name = segments[1];
4743
String dimension = segments[2];
48-
String color = null,bool = null,deathpoint = null;
44+
String color = null, bool = null, deathpoint = null;
4945
try{
5046
color = segments[3];
5147
bool = segments[4];
5248
deathpoint = segments[5];
5349
}
54-
catch (IndexOutOfBoundsException ignored){}
50+
catch(IndexOutOfBoundsException ignored){}
5551
CListWaypoint waypoint = new CListWaypoint(coords, name, dimension, Boolean.parseBoolean(bool), Boolean.parseBoolean(deathpoint));
5652
if(color == null){
5753
CListClient.addRandomWaypointColor();
5854
}
5955
else{
60-
CListWaypointColor color_class = new CListWaypointColor(0,0,0);
56+
CListWaypointColor color_class = new CListWaypointColor(0, 0, 0);
6157
color_class.set(color);
6258
CListClient.variables.colors.add(color_class);
6359
}
6460
waypointList.add(waypoint);
6561
}
6662
}
67-
6863
return waypointList;
69-
} catch (IOException ignored) {
7064
}
71-
65+
catch(IOException ignored){}
7266
return null;
7367
}
7468

@@ -80,26 +74,21 @@ public static void deleteLegacyFile(String fileName){
8074
}
8175
}
8276

83-
public static List<String> loadListFromFileLegacy(String fileName) {
77+
public static List<String> loadListFromFileLegacy(String fileName){
8478
File dataDir = FabricLoader.getInstance().getConfigDir().resolve("coordinatelist").toFile();
8579
File file = new File(dataDir, fileName);
86-
87-
if (!file.exists()) {
80+
if(!file.exists()){
8881
return null;
8982
}
90-
91-
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) {
83+
try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))){
9284
List<String> stringList = Lists.newArrayList();
9385
String line;
94-
95-
while ((line = reader.readLine()) != null) {
86+
while((line = reader.readLine()) != null){
9687
stringList.add(line);
9788
}
98-
9989
return stringList;
100-
} catch (IOException ignored) {
10190
}
102-
91+
catch(IOException ignored){}
10392
return null;
10493
}
10594
}

src/main/java/one/pouekdev/coordinatelist/CListDelayedEvent.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
package one.pouekdev.coordinatelist;
22

3-
public class CListDelayedEvent {
3+
public class CListDelayedEvent{
44
private float ticks;
55
private final Runnable function;
6+
67
public CListDelayedEvent(float seconds, Runnable function){
7-
this.ticks = seconds*20;
8+
this.ticks = seconds * 20;
89
this.function = function;
910
}
11+
1012
public boolean update(){
1113
this.ticks -= 1;
12-
if(ticks<=0){
14+
if(ticks <= 0){
1315
this.function.run();
1416
return true;
1517
}

src/main/java/one/pouekdev/coordinatelist/CListRenderLayers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import java.util.function.Function;
1212

13-
public class CListRenderLayers {
13+
public class CListRenderLayers{
1414
private static final RenderPipeline POSITION_TEX_COLOR_PIPELINE = RenderPipelines.register(
1515
RenderPipeline.builder(RenderPipelines.POSITION_TEX_COLOR_SNIPPET)
1616
.withLocation("pipeline/position_tex_color")
@@ -27,7 +27,7 @@ public class CListRenderLayers {
2727
false,
2828
true,
2929
POSITION_TEX_COLOR_PIPELINE,
30-
RenderLayer.MultiPhaseParameters.builder().texture(new RenderPhase.Texture(texture,false)).build(false)
30+
RenderLayer.MultiPhaseParameters.builder().texture(new RenderPhase.Texture(texture, false)).build(false)
3131
)
3232
);
3333
}

src/main/java/one/pouekdev/coordinatelist/CListReverseColoredQuadGuiElementRenderState.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,67 +11,67 @@
1111
import org.joml.Matrix3x2f;
1212

1313
@Environment(EnvType.CLIENT)
14-
public record CListReverseColoredQuadGuiElementRenderState(RenderPipeline pipeline, TextureSetup textureSetup, Matrix3x2f pose, int x0, int y0, int x1, int y1, int col1, int col2, @Nullable ScreenRect scissorArea, @Nullable ScreenRect bounds) implements SimpleGuiElementRenderState {
15-
public CListReverseColoredQuadGuiElementRenderState(RenderPipeline pipeline, TextureSetup textureSetup, Matrix3x2f pose, int x0, int y0, int x1, int y1, int col1, int col2, @Nullable ScreenRect scissorArea) {
14+
public record CListReverseColoredQuadGuiElementRenderState(RenderPipeline pipeline, TextureSetup textureSetup, Matrix3x2f pose, int x0, int y0, int x1, int y1, int col1, int col2, @Nullable ScreenRect scissorArea, @Nullable ScreenRect bounds) implements SimpleGuiElementRenderState{
15+
public CListReverseColoredQuadGuiElementRenderState(RenderPipeline pipeline, TextureSetup textureSetup, Matrix3x2f pose, int x0, int y0, int x1, int y1, int col1, int col2, @Nullable ScreenRect scissorArea){
1616
this(pipeline, textureSetup, pose, x0, y0, x1, y1, col1, col2, scissorArea, createBounds(x0, y0, x1, y1, pose, scissorArea));
1717
}
1818

19-
public void setupVertices(VertexConsumer vertices, float depth) {
20-
vertices.vertex(this.pose(), (float)this.x0(), (float)this.y0(), depth).color(this.col1());
21-
vertices.vertex(this.pose(), (float)this.x0(), (float)this.y1(), depth).color(this.col1());
22-
vertices.vertex(this.pose(), (float)this.x1(), (float)this.y1(), depth).color(this.col2());
23-
vertices.vertex(this.pose(), (float)this.x1(), (float)this.y0(), depth).color(this.col2());
19+
public void setupVertices(VertexConsumer vertices, float depth){
20+
vertices.vertex(this.pose(), (float) this.x0(), (float) this.y0(), depth).color(this.col1());
21+
vertices.vertex(this.pose(), (float) this.x0(), (float) this.y1(), depth).color(this.col1());
22+
vertices.vertex(this.pose(), (float) this.x1(), (float) this.y1(), depth).color(this.col2());
23+
vertices.vertex(this.pose(), (float) this.x1(), (float) this.y0(), depth).color(this.col2());
2424
}
2525

2626
@Nullable
27-
private static ScreenRect createBounds(int x0, int y0, int x1, int y1, Matrix3x2f pose, @Nullable ScreenRect scissorArea) {
27+
private static ScreenRect createBounds(int x0, int y0, int x1, int y1, Matrix3x2f pose, @Nullable ScreenRect scissorArea){
2828
ScreenRect screenRect = (new ScreenRect(x0, y0, x1 - x0, y1 - y0)).transformEachVertex(pose);
2929
return scissorArea != null ? scissorArea.intersection(screenRect) : screenRect;
3030
}
3131

32-
public RenderPipeline pipeline() {
32+
public RenderPipeline pipeline(){
3333
return this.pipeline;
3434
}
3535

36-
public TextureSetup textureSetup() {
36+
public TextureSetup textureSetup(){
3737
return this.textureSetup;
3838
}
3939

40-
public Matrix3x2f pose() {
40+
public Matrix3x2f pose(){
4141
return this.pose;
4242
}
4343

44-
public int x0() {
44+
public int x0(){
4545
return this.x0;
4646
}
4747

48-
public int y0() {
48+
public int y0(){
4949
return this.y0;
5050
}
5151

52-
public int x1() {
52+
public int x1(){
5353
return this.x1;
5454
}
5555

56-
public int y1() {
56+
public int y1(){
5757
return this.y1;
5858
}
5959

60-
public int col1() {
60+
public int col1(){
6161
return this.col1;
6262
}
6363

64-
public int col2() {
64+
public int col2(){
6565
return this.col2;
6666
}
6767

6868
@Nullable
69-
public ScreenRect scissorArea() {
69+
public ScreenRect scissorArea(){
7070
return this.scissorArea;
7171
}
7272

7373
@Nullable
74-
public ScreenRect bounds() {
74+
public ScreenRect bounds(){
7575
return this.bounds;
7676
}
7777
}

src/main/java/one/pouekdev/coordinatelist/CListVariables.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
import net.minecraft.client.MinecraftClient;
44
import net.minecraft.client.world.ClientWorld;
55
import org.apache.commons.compress.utils.Lists;
6+
67
import java.util.List;
78

8-
public class CListVariables {
9+
public class CListVariables{
910
public List<CListWaypoint> waypoints = Lists.newArrayList();
1011
public List<CListWaypointColor> colors = Lists.newArrayList();
11-
public static List<CListDelayedEvent> delayed_events = Lists.newArrayList();
12+
public static List<CListDelayedEvent> delayedEvents = Lists.newArrayList();
1213
public String worldName;
13-
public ClientWorld last_world;
14-
public static MinecraftClient minecraft_client = MinecraftClient.getInstance();
15-
public boolean saved_since_last_update;
16-
public boolean loaded_last_world;
17-
public boolean had_death_waypoint_placed;
18-
public boolean is_world_error;
14+
public ClientWorld lastWorld;
15+
public static MinecraftClient minecraftClient = MinecraftClient.getInstance();
16+
public boolean savedSinceLastUpdate;
17+
public boolean loadedLastWorld;
18+
public boolean hadDeathWaypointPlaced;
19+
public boolean isWorldError;
1920
}

0 commit comments

Comments
 (0)