Skip to content

Commit

Permalink
Update to 1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
SolidBlock-cn committed May 7, 2023
1 parent 4b14d9b commit 8481b14
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 28 deletions.
5 changes: 5 additions & 0 deletions UpdateLog-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Note: Not all versions in this update log are already published. Please refer to relevant pages in CurseForge and Modrinth, or the "releases" section in the GitHub.

### 1.2.1
- Fixed the wrong model of road slab blocks.
- Fixed the issue that using road connection state debugging tool may cause crashes.
- Added more links in the Mod Menu screen.

### 1.2.0

- Adapted to new version BRRP.
Expand Down
5 changes: 5 additions & 0 deletions UpdateLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

注意:更新记录中的版本并不一定都已发布。具体请以 CurseForge、Modrinth 中的下载页面或 GitHub 中的“releases”为准。

### 1.2.1
- 修复了错误的道路台阶模型。
- 修复了使用道路连接状态调试工具可能导致崩溃的问题。
- 在 Mod Menu 的屏幕中添加的更多的链接。

### 1.2.0

- 适应新版本的 BRRP。
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fabric_version=0.76.0+1.19.2
brrp_version=1.0.0

# Mod Properties
mod_version=1.2.0
mod_version=1.2.1
maven_group=pers.solid
archives_base_name=mishanguc

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pers/solid/mishang/uc/arrp/BRRPHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static BlockStateSupplier composeStateForSlab(@NotNull BlockStateSupplier
key.isEmpty() ? "type=bottom" : key + ",type=bottom",
bottomModel);
JsonObject topModel = blockModel.deepCopy();
topModel.addProperty("mode", slabOf(modelId).toString());
topModel.addProperty("model", slabOf(modelId).brrp_suffixed("_top").toString());
slabVariant.add(
key.isEmpty() ? "type=top" : key + ",type=top",
topModel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,17 @@ public static ActionResult sendMessageOfState(
TextBridge.translatable("debug.mishanguc.roadConnectionState.allDir", String.format("%s %s %s", blockPos.getX(), blockPos.getY(), blockPos.getZ()))
.formatted(Formatting.YELLOW),
false);
Direction.Type.HORIZONTAL.forEach(
direction -> {
final RoadConnectionState connectionState =
road.getConnectionStateOf(blockState, direction);
playerEntity.sendMessage(
TextBridge.translatable("debug.mishanguc.roadConnectionState.brief",
RoadConnectionState.text(direction),
(connectionState.offsetLevel() == 0 ? RoadConnectionState.text(connectionState.direction()) : TextBridge.translatable("debug.mishanguc.roadConnectionState.offset", RoadConnectionState.text(direction), RoadConnectionState.text(connectionState.offsetDirection()), connectionState.offsetLevel())).formatted(Formatting.WHITE),
RoadConnectionState.text(connectionState.lineColor()),
RoadConnectionState.text(connectionState.lineType()).formatted(Formatting.WHITE),
RoadConnectionState.text(connectionState.whetherConnected())).styled(style -> style.withColor(0xcccccc)),
false);
});
for (Direction direction : Direction.Type.HORIZONTAL) {
final RoadConnectionState connectionState = road.getConnectionStateOf(blockState, direction);
playerEntity.sendMessage(
TextBridge.translatable("debug.mishanguc.roadConnectionState.brief",
RoadConnectionState.text(direction),
(connectionState.offsetLevel() == 0 ? RoadConnectionState.text(connectionState.direction()) : TextBridge.translatable("debug.mishanguc.roadConnectionState.offset", RoadConnectionState.text(direction), RoadConnectionState.text(connectionState.offsetDirection()), connectionState.offsetLevel())).formatted(Formatting.WHITE),
RoadConnectionState.text(connectionState.lineColor()),
RoadConnectionState.text(connectionState.lineType()).formatted(Formatting.WHITE),
RoadConnectionState.text(connectionState.whetherConnected())).styled(style -> style.withColor(0xcccccc)),
false);
}
return ActionResult.SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ public enum EightHorizontalDirection implements StringIdentifiable {
this.axis = axis;
}

public static EightHorizontalDirection of(Direction direction) {
public static @NotNull EightHorizontalDirection of(@NotNull Direction direction) {
return DIRECTIONS.get(direction);
}

public static EightHorizontalDirection of(HorizontalCornerDirection cornerDirection) {
public static @NotNull EightHorizontalDirection of(@NotNull HorizontalCornerDirection cornerDirection) {
return CORNER_DIRECTIONS.get(cornerDirection);
}

Expand Down
24 changes: 14 additions & 10 deletions src/main/java/pers/solid/mishang/uc/util/RoadConnectionState.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
* @param lineOffset 该道路连接状态的偏移。
* @since 0.2.0-mc1.17+ 此类更改为记录;1.16.5 由于仍为 Java 8,因此仍使用普通类的形式。
*/
public record RoadConnectionState(WhetherConnected whetherConnected, LineColor lineColor, EightHorizontalDirection direction, LineType lineType, @Nullable LineOffset lineOffset) implements Comparable<RoadConnectionState> {
public record RoadConnectionState(WhetherConnected whetherConnected, LineColor lineColor, @Nullable EightHorizontalDirection direction, LineType lineType, @Nullable LineOffset lineOffset) implements Comparable<RoadConnectionState> {

public RoadConnectionState(WhetherConnected whetherConnected, LineColor lineColor, EightHorizontalDirection direction, LineType lineType) {
public RoadConnectionState(WhetherConnected whetherConnected, LineColor lineColor, @Nullable EightHorizontalDirection direction, LineType lineType) {
this(whetherConnected, lineColor, direction, lineType, null);
}

Expand All @@ -46,39 +46,43 @@ public static MutableText text(@Nullable Direction direction) {
return TextBridge.translatable("direction." + direction.asString());
}

public static MutableText text(HorizontalCornerDirection direction) {
return TextBridge.translatable("direction." + direction.asString());
public static MutableText text(@Nullable HorizontalCornerDirection direction) {
if (direction == null) {
return TextBridge.translatable("direction.none");
} else {
return TextBridge.translatable("direction." + direction.asString());
}
}

public static MutableText text(Either<Direction, HorizontalCornerDirection> direction) {
public static MutableText text(@Nullable Either<Direction, HorizontalCornerDirection> direction) {
if (direction == null) {
return TextBridge.translatable("direction.none");
} else {
return direction.map(RoadConnectionState::text, RoadConnectionState::text);
}
}

public static MutableText text(EightHorizontalDirection direction) {
return text(direction.either);
public static MutableText text(@Nullable EightHorizontalDirection direction) {
return direction == null ? text((Direction) null) : text(direction.either);
}

public static MutableText text(WhetherConnected whetherConnected) {
public static MutableText text(@NotNull WhetherConnected whetherConnected) {
return TextBridge.translatable("roadConnectionState.whether." + whetherConnected.asString()).formatted(switch (whetherConnected) {
case NOT_CONNECTED -> Formatting.RED;
case CONNECTED -> Formatting.GREEN;
default -> Formatting.YELLOW;
});
}

public static MutableText text(LineColor lineColor) {
public static MutableText text(@NotNull LineColor lineColor) {
return lineColor.getName().formatted(switch (lineColor) {
case WHITE -> Formatting.WHITE;
case YELLOW -> Formatting.YELLOW;
default -> Formatting.GRAY;
});
}

public static MutableText text(LineType lineType) {
public static MutableText text(@NotNull LineType lineType) {
return lineType.getName();
}

Expand Down
11 changes: 10 additions & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,14 @@
"breaks": {
"minecraft": ">=1.19.3"
},
"custom": {"branch": "1.19.2"}
"custom": {
"branch": "1.19.2",
"modmenu": {
"links": {
"mcmod.cn": "https://www.mcmod.cn/class/5743.html",
"modmenu.modrinth": "https://modrinth.com/mod/mishang-urban-construction",
"modmenu.curseforge": "https://www.curseforge.com/minecraft/mc-mods/mishang-urban-construction"
}
}
}
}

0 comments on commit 8481b14

Please sign in to comment.