-
-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmap #472
base: fabric
Are you sure you want to change the base?
cmap #472
Conversation
src/main/java/net/earthcomputer/clientcommands/command/MapCommand.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool command, just a few code style changes mostly.
src/main/java/net/earthcomputer/clientcommands/command/MapCommand.java
Outdated
Show resolved
Hide resolved
src/main/java/net/earthcomputer/clientcommands/command/MapCommand.java
Outdated
Show resolved
Hide resolved
src/main/java/net/earthcomputer/clientcommands/command/MapCommand.java
Outdated
Show resolved
Hide resolved
src/main/java/net/earthcomputer/clientcommands/command/MapCommand.java
Outdated
Show resolved
Hide resolved
I still like @haykam821's suggestion of extending the functionality of this command to maps you are looking at. Should I open a separate issue for that? |
he can pr that xd |
that was much harder than expected but it works |
wait, since when can I not request multiple reviews |
src/main/java/net/earthcomputer/clientcommands/command/MapCommand.java
Outdated
Show resolved
Hide resolved
int width = mapInfo[0].length * 128 * upscale; | ||
int height = mapInfo.length * 128 * upscale; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could 128
be replaced with size constants? These constants could be initialized to FilledMapItem.field_30907
and FilledMapItem.field_30908
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which one is which
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd assume FilledMapItem.field_30907
is width and FilledMapItem.field_30908
is height.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some style changes.
import static com.mojang.brigadier.arguments.IntegerArgumentType.getInteger; | ||
import static com.mojang.brigadier.arguments.IntegerArgumentType.integer; | ||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument; | ||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe your latest commit may have turned these back into non-wildcard imports again.
dispatcher.register(literal("cmap") | ||
.then(literal("export") | ||
.executes(ctx -> exportMap(ctx.getSource(), 1)) | ||
.then(argument("upscale", integer(1, 16)) | ||
.executes(ctx -> exportMap(ctx.getSource(), getInteger(ctx, "upscale"))) | ||
) | ||
) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has become convention to not put the closing parentheses on a newline.
int y = vec.getComponentAlongAxis(yAxis.getAxis()) * yAxis.getDirection().offset(); | ||
int x = vec.getComponentAlongAxis(xAxis.getAxis()) * xAxis.getDirection().offset(); | ||
// this should never be possible | ||
if (flattened.put(new Vec2i(x, y), next) != null) throw new IllegalStateException("Duplicate item frame at " + nextPos); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add curly brackets.
public int width() { | ||
if (rotation % 2 == 0) { | ||
return FilledMapItem.field_30907; | ||
} else { | ||
return FilledMapItem.field_30908; | ||
} | ||
} | ||
|
||
public int height() { | ||
if (rotation % 2 == 0) { | ||
return FilledMapItem.field_30908; | ||
} else { | ||
return FilledMapItem.field_30907; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These functions are unused.
private record Vec2i(int x, int z) { | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JOML already provides a Vector2i
.
save held map to file