XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

MyDimension

【Java】我的维度模组

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/MyDimension

优化投影建造器分段渲染与依赖机制

大幅优化投影建造器的分段生成与渲染一致性: - 引入分段边界检测与原子依赖组,避免跨分段伪影 - 新增 SectionBoundary、BoundarySignature 等结构提升依赖检测效率 - 投影方块面剔除与区块渲染逻辑一致,修复边界灰面问题 - 重构核心结构,完善单元测试覆盖分段与依赖逻辑 - UI 选中提示与模型细节优化,提升交互体验 - 增强对不兼容模组方块的兼容性与警告机制 - 同步更新依赖与导入,确保新特性集成

fec3cde
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

11 个文件 +741 -114
Modified src/main/java/com/xfestudio/mydimension/client/builder/BuilderHudRenderer.java +37 -0
@@ -128,6 +128,43 @@ public final class BuilderHudRenderer {
128 128 ? (adjusting ? 0xFF65E9D5 : 0xFFC5A1FF)
129 129 : 0x8E78688E);
130 130 }
131
132 // Keep the sectors pictogram-only, but identify the one focused action in a compact
133 // tooltip outside the wheel. This is intentionally not drawn in the centre: the icon
134 // and adjustment chevrons remain readable, and the crosshair area stays unobstructed.
135 renderSelectedActionHint(graphics, minecraft, screenWidth, screenHeight, centerX, centerY,
136 outerRadius, active, adjusting);
137 }
138
139 private static void renderSelectedActionHint(GuiGraphics graphics, Minecraft minecraft,
140 int screenWidth, int screenHeight,
141 int centerX, int centerY, int outerRadius,
142 BlueprintAltActionController.Action active,
143 boolean adjusting) {
144 Component label = Component.translatable(active.translationKey());
145 int textWidth = minecraft.font.width(label);
146 int panelWidth = Math.min(screenWidth - 12, Math.max(72, textWidth + 24));
147 int panelHeight = 17;
148 int preferredTop = centerY + outerRadius + 8;
149 int top = preferredTop + panelHeight <= screenHeight - 4
150 ? preferredTop
151 : centerY - outerRadius - panelHeight - 8;
152 int left = Mth.clamp(centerX - panelWidth / 2, 6, Math.max(6, screenWidth - panelWidth - 6));
153 int right = left + panelWidth;
154
155 int border = adjusting ? 0xD85DE6D2 : 0xD2A77BF2;
156 int innerAccent = adjusting ? 0x6056D9C8 : 0x606D48A1;
157 graphics.fill(left + 3, top, right - 3, top + panelHeight, 0xC8140E20);
158 graphics.fill(left + 1, top + 3, right - 1, top + panelHeight - 3, 0xC8140E20);
159 graphics.fill(left + 4, top, right - 4, top + 1, border);
160 graphics.fill(left + 4, top + panelHeight - 1, right - 4, top + panelHeight, border);
161 graphics.fill(left, top + 4, left + 1, top + panelHeight - 4, border);
162 graphics.fill(right - 1, top + 4, right, top + panelHeight - 4, border);
163 graphics.fill(left + 5, top + 2, left + 7, top + panelHeight - 2, innerAccent);
164 graphics.fill(right - 7, top + 2, right - 5, top + panelHeight - 2, innerAccent);
165
166 graphics.drawCenteredString(minecraft.font, label, left + panelWidth / 2, top + 5,
167 adjusting ? 0xFFB6FFF1 : 0xFFF1E8FF);
131 168 }
132 169
133 170 private static void drawChevron(GuiGraphics graphics, int x, int y, boolean pointsRight,
Modified src/main/java/com/xfestudio/mydimension/client/builder/BuilderPreviewRenderTypes.java +1 -1
@@ -68,7 +68,7 @@ public final class BuilderPreviewRenderTypes {
68 68 false,
69 69 RenderType.CompositeState.builder()
70 70 .setShaderState(new RenderStateShard.ShaderStateShard(
71 GameRenderer::getRendertypeEntityTranslucentShader))
71 GameRenderer::getRendertypeEntityTranslucentEmissiveShader))
72 72 .setTextureState(new RenderStateShard.TextureStateShard(
73 73 net.minecraft.world.inventory.InventoryMenu.BLOCK_ATLAS, false, false))
74 74 .setTransparencyState(TRANSLUCENT)
Modified src/main/java/com/xfestudio/mydimension/client/builder/RealmwrightScepterRenderer.java +3 -1
@@ -29,7 +29,9 @@ public final class RealmwrightScepterRenderer extends BlockEntityWithoutLevelRen
29 29 private static final ResourceLocation FLOATING_MODEL = model("realmwright_scepter_floating");
30 30 private static final ResourceLocation FLOATING_SECONDARY_MODEL = model("realmwright_scepter_floating_secondary");
31 31
32 private static final float LOWER_RING_PIVOT_Y = -2.0F / 16.0F;
32 // Both orbit rings live on the upper shaft so neither is hidden by the hand in first person.
33 // The former lower ring is now the higher, slightly smaller orbit.
34 private static final float LOWER_RING_PIVOT_Y = 12.5F / 16.0F;
33 35 private static final float UPPER_RING_PIVOT_Y = 8.25F / 16.0F;
34 36
35 37 public RealmwrightScepterRenderer(BlockEntityRenderDispatcher dispatcher, EntityModelSet modelSet) {
Modified src/main/resources/assets/mydimension/models/item/realmwright_scepter_base.json +37 -23
@@ -21,10 +21,15 @@
21 21 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
22 22 },
23 23 {
24 "name": "pommel_fang", "from": [8.55, -15.0, 7.1], "to": [10.0, -11.8, 8.9],
24 "name": "pommel_fang_right", "from": [8.55, -15.0, 7.1], "to": [10.0, -11.8, 8.9],
25 25 "rotation": { "origin": [8.7, -12.1, 8], "axis": "z", "angle": -22.5, "rescale": true },
26 26 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
27 27 },
28 {
29 "name": "pommel_fang_left", "from": [6.0, -15.0, 7.1], "to": [7.45, -11.8, 8.9],
30 "rotation": { "origin": [7.3, -12.1, 8], "axis": "z", "angle": 22.5, "rescale": true },
31 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "east": { "uv": [0, 0, 16, 16], "texture": "#body" } }
32 },
28 33 {
29 34 "name": "shaft_lower", "from": [7.0, -12.0, 7.0], "to": [9.0, -2.0, 9.0],
30 35 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#body" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#body" } }
@@ -38,20 +43,29 @@
38 43 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#body" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#body" } }
39 44 },
40 45 {
41 "name": "shaft_rift_lower", "from": [7.25, -10.9, 6.96], "to": [7.85, -3.0, 6.99],
46 "name": "shaft_rift_lower_left", "from": [7.25, -10.9, 6.96], "to": [7.85, -3.0, 6.99],
42 47 "rotation": { "origin": [7.55, -6.95, 6.98], "axis": "z", "angle": -22.5, "rescale": false }, "shade": false,
43 48 "faces": { "north": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
44 49 },
45 50 {
46 "name": "shaft_rift_middle", "from": [7.75, -1.3, 6.81], "to": [8.4, 6.8, 6.84],
47 "rotation": { "origin": [8.08, 2.75, 6.83], "axis": "z", "angle": 22.5, "rescale": false }, "shade": false,
51 "name": "shaft_rift_lower_right", "from": [8.15, -10.9, 6.96], "to": [8.75, -3.0, 6.99],
52 "rotation": { "origin": [8.45, -6.95, 6.98], "axis": "z", "angle": 22.5, "rescale": false }, "shade": false,
48 53 "faces": { "north": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
49 54 },
50 55 {
51 "name": "shaft_rift_upper", "from": [7.15, 8.8, 6.61], "to": [7.85, 15.9, 6.64],
56 "name": "shaft_rift_middle", "from": [7.68, -1.3, 6.81], "to": [8.32, 6.8, 6.84], "shade": false,
57 "faces": { "north": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
58 },
59 {
60 "name": "shaft_rift_upper_left", "from": [7.15, 8.8, 6.61], "to": [7.85, 15.9, 6.64],
52 61 "rotation": { "origin": [7.5, 12.35, 6.63], "axis": "z", "angle": -22.5, "rescale": false }, "shade": false,
53 62 "faces": { "north": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
54 63 },
64 {
65 "name": "shaft_rift_upper_right", "from": [8.15, 8.8, 6.61], "to": [8.85, 15.9, 6.64],
66 "rotation": { "origin": [8.5, 12.35, 6.63], "axis": "z", "angle": 22.5, "rescale": false }, "shade": false,
67 "faces": { "north": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
68 },
55 69 {
56 70 "name": "head_collar", "from": [5.6, 16.6, 5.6], "to": [10.4, 18.2, 10.4],
57 71 "rotation": { "origin": [8, 17.4, 8], "axis": "z", "angle": 45, "rescale": true },
@@ -67,8 +81,8 @@
67 81 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "east": { "uv": [0, 0, 16, 16], "texture": "#body" } }
68 82 },
69 83 {
70 "name": "right_lower_cradle", "from": [9.45, 17.75, 6.2], "to": [12.55, 20.55, 9.8],
71 "rotation": { "origin": [9.7, 18.2, 8], "axis": "z", "angle": -22.5, "rescale": true },
84 "name": "right_lower_cradle", "from": [9.35, 17.4, 6.15], "to": [12.55, 20.75, 9.85],
85 "rotation": { "origin": [9.65, 18.1, 8], "axis": "z", "angle": -22.5, "rescale": true },
72 86 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
73 87 },
74 88 {
@@ -92,33 +106,33 @@
92 106 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "east": { "uv": [0, 0, 16, 16], "texture": "#body" } }
93 107 },
94 108 {
95 "name": "left_inner_prong", "from": [3.15, 25.3, 6.45], "to": [4.75, 28.8, 9.55],
96 "rotation": { "origin": [3.6, 25.45, 8], "axis": "z", "angle": -22.5, "rescale": true },
109 "name": "left_inner_prong", "from": [3.45, 25.3, 6.45], "to": [5.05, 28.8, 9.55],
110 "rotation": { "origin": [3.9, 25.45, 8], "axis": "z", "angle": -22.5, "rescale": true },
97 111 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "east": { "uv": [0, 0, 16, 16], "texture": "#body" } }
98 112 },
99 113 {
100 "name": "right_lower_jaw", "from": [12.0, 18.4, 6.0], "to": [14.8, 22.6, 10.0],
101 "rotation": { "origin": [12.2, 18.6, 8], "axis": "z", "angle": -22.5, "rescale": true },
114 "name": "right_lower_jaw", "from": [12.0, 18.2, 6.0], "to": [14.8, 22.2, 10.0],
115 "rotation": { "origin": [12.2, 18.5, 8], "axis": "z", "angle": -22.5, "rescale": true },
102 116 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
103 117 },
104 118 {
105 "name": "right_outer_arc", "from": [14.0, 21.3, 6.0], "to": [16.8, 27.6, 10.0],
106 "rotation": { "origin": [14.15, 21.5, 8], "axis": "z", "angle": -22.5, "rescale": true },
119 "name": "right_outer_arc", "from": [14.4, 20.0, 6.0], "to": [17.2, 25.6, 10.0],
120 "rotation": { "origin": [14.55, 20.2, 8], "axis": "z", "angle": -45, "rescale": true },
107 121 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
108 122 },
109 123 {
110 "name": "right_horn_spine", "from": [15.8, 24.8, 6.1], "to": [18.5, 31.2, 9.9],
111 "rotation": { "origin": [16.0, 25.0, 8], "axis": "z", "angle": 22.5, "rescale": true },
124 "name": "right_horn_spine", "from": [16.35, 23.1, 6.1], "to": [19.0, 27.8, 9.9],
125 "rotation": { "origin": [16.5, 23.3, 8], "axis": "z", "angle": -22.5, "rescale": true },
112 126 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
113 127 },
114 128 {
115 "name": "right_horn_tip", "from": [14.9, 29.1, 6.4], "to": [17.3, 32.0, 9.6],
116 "rotation": { "origin": [16.0, 29.2, 8], "axis": "z", "angle": 22.5, "rescale": true },
129 "name": "right_horn_tip", "from": [17.6, 25.8, 6.45], "to": [19.7, 29.0, 9.55],
130 "rotation": { "origin": [17.8, 26.0, 8], "axis": "z", "angle": 22.5, "rescale": true },
117 131 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
118 132 },
119 133 {
120 "name": "right_inner_prong", "from": [10.9, 25.0, 6.45], "to": [12.4, 29.8, 9.55],
121 "rotation": { "origin": [11.95, 25.15, 8], "axis": "z", "angle": 22.5, "rescale": true },
134 "name": "right_inner_prong", "from": [10.95, 25.3, 6.45], "to": [12.55, 28.8, 9.55],
135 "rotation": { "origin": [12.1, 25.45, 8], "axis": "z", "angle": 22.5, "rescale": true },
122 136 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
123 137 },
124 138 {
@@ -132,13 +146,13 @@
132 146 "faces": { "north": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
133 147 },
134 148 {
135 "name": "right_arc_rift_inlay", "from": [15.75, 22.0, 5.96], "to": [16.5, 26.5, 5.99],
136 "rotation": { "origin": [15.9, 22.15, 5.98], "axis": "z", "angle": -22.5, "rescale": false }, "shade": false,
149 "name": "right_arc_rift_inlay", "from": [15.9, 20.9, 5.96], "to": [16.6, 24.7, 5.99],
150 "rotation": { "origin": [16.0, 21.0, 5.98], "axis": "z", "angle": -45, "rescale": false }, "shade": false,
137 151 "faces": { "north": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
138 152 },
139 153 {
140 "name": "right_horn_rift_inlay", "from": [17.0, 25.8, 6.06], "to": [17.7, 30.2, 6.09],
141 "rotation": { "origin": [17.15, 25.95, 6.08], "axis": "z", "angle": 22.5, "rescale": false }, "shade": false,
154 "name": "right_horn_rift_inlay", "from": [18.0, 23.8, 6.06], "to": [18.65, 27.1, 6.09],
155 "rotation": { "origin": [18.0, 24.0, 6.08], "axis": "z", "angle": -22.5, "rescale": false }, "shade": false,
142 156 "faces": { "north": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
143 157 },
144 158 {
Modified src/main/resources/assets/mydimension/models/item/realmwright_scepter_floating.json +2 -2
@@ -14,8 +14,8 @@
14 14 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "south": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "west": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "east": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
15 15 },
16 16 {
17 "name": "floating_shard_upper_right", "from": [12.4, 30.0, 7.15], "to": [13.2, 31.4, 8.85],
18 "rotation": { "origin": [12.8, 30.7, 8], "axis": "z", "angle": -22.5, "rescale": true }, "shade": false,
17 "name": "floating_shard_far_right", "from": [19.1, 20.5, 6.65], "to": [21.0, 24.0, 9.35],
18 "rotation": { "origin": [20.0, 22.25, 8], "axis": "z", "angle": 22.5, "rescale": true }, "shade": false,
19 19 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "south": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "west": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "east": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
20 20 }
21 21 ]
Modified src/main/resources/assets/mydimension/models/item/realmwright_scepter_floating_secondary.json +2 -2
@@ -14,8 +14,8 @@
14 14 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "south": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "west": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "east": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
15 15 },
16 16 {
17 "name": "floating_shard_far_right", "from": [19.0, 22.0, 6.9], "to": [20.4, 24.8, 9.1],
18 "rotation": { "origin": [19.7, 23.4, 8], "axis": "z", "angle": 22.5, "rescale": true }, "shade": false,
17 "name": "floating_shard_upper_right", "from": [13.3, 28.0, 7.1], "to": [14.2, 29.5, 8.9],
18 "rotation": { "origin": [13.75, 28.75, 8], "axis": "z", "angle": -22.5, "rescale": true }, "shade": false,
19 19 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "south": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "west": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "east": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
20 20 }
21 21 ]
Modified src/main/resources/assets/mydimension/models/item/realmwright_scepter_ring_lower.json +12 -17
@@ -10,45 +10,40 @@
10 10 },
11 11 "elements": [
12 12 {
13 "name": "lower_ring_north", "from": [6.0, -2.5, 4.15], "to": [10.0, -1.5, 5.25],
13 "name": "lower_ring_north", "from": [6.0, 12.0, 4.15], "to": [10.0, 13.0, 5.25],
14 14 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#body" } }
15 15 },
16 16 {
17 "name": "lower_ring_south", "from": [6.0, -2.5, 10.75], "to": [10.0, -1.5, 11.85],
17 "name": "lower_ring_south", "from": [6.0, 12.0, 10.75], "to": [10.0, 13.0, 11.85],
18 18 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#body" } }
19 19 },
20 20 {
21 "name": "lower_ring_west", "from": [4.15, -2.5, 6.0], "to": [5.25, -1.5, 10.0],
21 "name": "lower_ring_west", "from": [4.15, 12.0, 6.0], "to": [5.25, 13.0, 10.0],
22 22 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "east": { "uv": [0, 0, 16, 16], "texture": "#body" } }
23 23 },
24 24 {
25 "name": "lower_ring_east", "from": [10.75, -2.5, 6.0], "to": [11.85, -1.5, 10.0],
25 "name": "lower_ring_east", "from": [10.75, 12.0, 6.0], "to": [11.85, 13.0, 10.0],
26 26 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
27 27 },
28 28 {
29 "name": "lower_ring_north_west", "from": [4.43, -2.5, 4.8], "to": [6.27, -1.5, 5.9],
30 "rotation": { "origin": [5.35, -2.0, 5.35], "axis": "y", "angle": -45, "rescale": true },
29 "name": "lower_ring_north_west", "from": [4.43, 12.0, 4.8], "to": [6.27, 13.0, 5.9],
30 "rotation": { "origin": [5.35, 12.5, 5.35], "axis": "y", "angle": -45, "rescale": true },
31 31 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#body" } }
32 32 },
33 33 {
34 "name": "lower_ring_north_east", "from": [9.73, -2.5, 4.8], "to": [11.57, -1.5, 5.9],
35 "rotation": { "origin": [10.65, -2.0, 5.35], "axis": "y", "angle": 45, "rescale": true },
34 "name": "lower_ring_north_east", "from": [9.73, 12.0, 4.8], "to": [11.57, 13.0, 5.9],
35 "rotation": { "origin": [10.65, 12.5, 5.35], "axis": "y", "angle": 45, "rescale": true },
36 36 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "south": { "uv": [0, 0, 16, 16], "texture": "#body" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#body" } }
37 37 },
38 38 {
39 "name": "lower_ring_south_east", "from": [9.73, -2.5, 10.1], "to": [11.57, -1.5, 11.2],
40 "rotation": { "origin": [10.65, -2.0, 10.65], "axis": "y", "angle": -45, "rescale": true },
39 "name": "lower_ring_south_east", "from": [9.73, 12.0, 10.1], "to": [11.57, 13.0, 11.2],
40 "rotation": { "origin": [10.65, 12.5, 10.65], "axis": "y", "angle": -45, "rescale": true },
41 41 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#body" } }
42 42 },
43 43 {
44 "name": "lower_ring_south_west", "from": [4.43, -2.5, 10.1], "to": [6.27, -1.5, 11.2],
45 "rotation": { "origin": [5.35, -2.0, 10.65], "axis": "y", "angle": 45, "rescale": true },
44 "name": "lower_ring_south_west", "from": [4.43, 12.0, 10.1], "to": [6.27, 13.0, 11.2],
45 "rotation": { "origin": [5.35, 12.5, 10.65], "axis": "y", "angle": 45, "rescale": true },
46 46 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#body" } }
47 },
48 {
49 "name": "lower_ring_orbit_crystal", "from": [10.55, -2.9, 3.95], "to": [12.15, -1.1, 5.55],
50 "rotation": { "origin": [11.35, -2.0, 4.75], "axis": "z", "angle": 45, "rescale": true }, "shade": false,
51 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "south": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "west": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "east": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
52 47 }
53 48 ]
54 49 }
Modified src/main/resources/assets/mydimension/models/item/realmwright_scepter_ring_upper.json +0 -5
@@ -44,11 +44,6 @@
44 44 "name": "upper_ring_south_west", "from": [3.86, 7.65, 10.435], "to": [6.02, 8.85, 11.685],
45 45 "rotation": { "origin": [4.94, 8.25, 11.06], "axis": "y", "angle": 45, "rescale": true },
46 46 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#body" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#body" }, "south": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "west": { "uv": [0, 0, 16, 16], "texture": "#body" }, "east": { "uv": [0, 0, 16, 16], "texture": "#body" } }
47 },
48 {
49 "name": "upper_ring_orbit_crystal", "from": [3.3, 7.25, 10.95], "to": [5.15, 9.25, 12.8],
50 "rotation": { "origin": [4.225, 8.25, 11.875], "axis": "z", "angle": -45, "rescale": true }, "shade": false,
51 "faces": { "down": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "up": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "north": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "south": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "west": { "uv": [0, 0, 16, 16], "texture": "#crystal" }, "east": { "uv": [0, 0, 16, 16], "texture": "#crystal" } }
52 47 }
53 48 ]
54 49 }
Added src/test/java/com/xfestudio/mydimension/client/builder/BuilderPreviewFaceCullingTest.java +54 -0
@@ -0,0 +1,54 @@
1 package com.xfestudio.mydimension.client.builder;
2
3 import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
4 import it.unimi.dsi.fastutil.longs.LongSet;
5 import net.minecraft.core.BlockPos;
6 import net.minecraft.core.Direction;
7 import org.junit.jupiter.api.Test;
8
9 import static org.junit.jupiter.api.Assertions.assertFalse;
10 import static org.junit.jupiter.api.Assertions.assertTrue;
11
12 class BuilderPreviewFaceCullingTest {
13 @Test
14 void adjacencyIsDetectedInsideOneSection() {
15 assertAdjacent(new BlockPos(14, 64, 5), Direction.EAST);
16 }
17
18 @Test
19 void adjacencyCrossesPositiveSectionBoundaryOnEveryAxis() {
20 assertAdjacent(new BlockPos(15, 7, 9), Direction.EAST);
21 assertAdjacent(new BlockPos(7, 15, 9), Direction.UP);
22 assertAdjacent(new BlockPos(7, 9, 15), Direction.SOUTH);
23 }
24
25 @Test
26 void adjacencyCrossesNegativeSectionBoundaryOnEveryAxis() {
27 assertAdjacent(new BlockPos(-1, 7, 9), Direction.EAST);
28 assertAdjacent(new BlockPos(7, -1, 9), Direction.UP);
29 assertAdjacent(new BlockPos(7, 9, -1), Direction.SOUTH);
30 }
31
32 @Test
33 void removingNeighbourMakesFaceVisibleAgain() {
34 BlockPos origin = new BlockPos(15, 64, 0);
35 LongSet projected = new LongOpenHashSet();
36 projected.add(origin.relative(Direction.EAST).asLong());
37 assertTrue(BuilderPreviewSectionMeshCache.hasProjectedNeighbour(
38 projected, origin, Direction.EAST));
39
40 projected.clear();
41 assertFalse(BuilderPreviewSectionMeshCache.hasProjectedNeighbour(
42 projected, origin, Direction.EAST));
43 }
44
45 private static void assertAdjacent(BlockPos origin, Direction direction) {
46 LongSet projected = new LongOpenHashSet();
47 projected.add(origin.relative(direction).asLong());
48
49 assertTrue(BuilderPreviewSectionMeshCache.hasProjectedNeighbour(
50 projected, origin, direction));
51 assertFalse(BuilderPreviewSectionMeshCache.hasProjectedNeighbour(
52 projected, origin, direction.getOpposite()));
53 }
54 }
Modified src/test/java/com/xfestudio/mydimension/client/builder/BuilderPreviewGenerationPolicyTest.java +36 -0
@@ -4,7 +4,9 @@ import net.minecraft.core.BlockPos;
4 4 import org.junit.jupiter.api.Test;
5 5
6 6 import java.util.ArrayList;
7 import java.util.LinkedHashSet;
7 8 import java.util.List;
9 import java.util.Set;
8 10
9 11 import static org.junit.jupiter.api.Assertions.assertEquals;
10 12 import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -81,6 +83,40 @@ class BuilderPreviewGenerationPolicyTest {
81 83 assertTrue(BuilderPreviewSectionMeshCache.requireGhostCompletion(false, true));
82 84 }
83 85
86 @Test
87 void boundaryDependentSectionsFormOneAtomicPublicationGroup() {
88 BuilderPreviewSectionMeshCache.SectionKey first =
89 new BuilderPreviewSectionMeshCache.SectionKey(0, 4, 0);
90 BuilderPreviewSectionMeshCache.SectionKey neighbour =
91 new BuilderPreviewSectionMeshCache.SectionKey(1, 4, 0);
92 BuilderPreviewSectionMeshCache.SectionKey independent =
93 new BuilderPreviewSectionMeshCache.SectionKey(4, 4, 0);
94 Set<BuilderPreviewSectionMeshCache.SectionKey> changed =
95 new LinkedHashSet<>(List.of(first, neighbour, independent));
96 Set<BuilderPreviewSectionMeshCache.SectionBoundary> dependencies = Set.of(
97 new BuilderPreviewSectionMeshCache.SectionBoundary(first, neighbour));
98
99 List<Set<BuilderPreviewSectionMeshCache.SectionKey>> groups =
100 BuilderPreviewSectionMeshCache.connectedPublicationGroups(
101 changed, dependencies);
102
103 assertEquals(2, groups.size());
104 Set<BuilderPreviewSectionMeshCache.SectionKey> sharedGroup = groups.stream()
105 .filter(group -> group.contains(first)).findFirst().orElseThrow();
106 assertEquals(Set.of(first, neighbour), sharedGroup);
107 assertFalse(BuilderPreviewSectionMeshCache.publicationGroupReady(
108 sharedGroup, Set.of(first)::contains),
109 "one ready side must not expose a new/old cross-section face pair");
110 assertTrue(BuilderPreviewSectionMeshCache.publicationGroupReady(
111 sharedGroup, Set.of(first, neighbour)::contains));
112
113 Set<BuilderPreviewSectionMeshCache.SectionKey> independentGroup = groups.stream()
114 .filter(group -> group.contains(independent)).findFirst().orElseThrow();
115 assertTrue(BuilderPreviewSectionMeshCache.publicationGroupReady(
116 independentGroup, Set.of(independent)::contains),
117 "unrelated sections retain their one-section progressive publication");
118 }
119
84 120 private static BuilderPreviewState.Snapshot snapshot(int cellCount, int revision) {
85 121 List<BuilderPreviewState.Cell> cells = new ArrayList<>(cellCount);
86 122 for (int index = 0; index < cellCount; index++) {