Skip to content

Commit d2e7c00

Browse files
committed
Example recipes, hide WIP field projection
1 parent de9cef7 commit d2e7c00

File tree

3 files changed

+281
-12
lines changed

3 files changed

+281
-12
lines changed

recipes/diamond_block.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"structure": {
3+
"minSize": 5,
4+
"layers": [
5+
{
6+
"layerType": "pattern",
7+
8+
// pattern here is (top = north)
9+
"pattern": [
10+
"CCCCC",
11+
"CCCCC",
12+
"CCCCC",
13+
"CCCCC",
14+
"CCCCC"
15+
]
16+
},
17+
18+
{
19+
"layerType": "filled",
20+
"key": "C"
21+
},
22+
23+
// {
24+
// "layerType": "air"
25+
// },
26+
27+
{
28+
"layerType": "hollow",
29+
"key": "C"
30+
},
31+
32+
{
33+
"layerType": "filled",
34+
"key": "C"
35+
},
36+
]
37+
},
38+
39+
"ingredients": {
40+
"C": {
41+
"type": "minecraft:item",
42+
"item": "minecraft:coal_block"
43+
}
44+
},
45+
46+
"outputs": [
47+
{
48+
"type": "item",
49+
"count": 1,
50+
"item": "minecraft:diamond_block"
51+
}
52+
]
53+
}

recipes/large_machine.json

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"structure": {
3+
// if either size is not set, recipe loader will clip to the maximum dimensions of recipe itself
4+
"minSize": 5, // optional; minimum size needed to create the pattern (gate keeping)
5+
"maxSize": 5, // optional; maximum size needed to create
6+
7+
// mixed (default, uses layers) or solid (uses one component)
8+
"type": "mixed",
9+
10+
// recipe components (required)
11+
"components": {
12+
"W": {
13+
"item": "compactmachines:wall_breakable"
14+
},
15+
16+
"D": {
17+
"item": "minecraft:diamond_block"
18+
}
19+
},
20+
21+
// for mixed recipes, this is the layer specification
22+
"layers": [
23+
{
24+
"type": "filled",
25+
"component": "W"
26+
},
27+
28+
{
29+
"type": "hollow",
30+
"component": "W"
31+
},
32+
33+
{
34+
// patterns: mixed type, uses multiple components
35+
// anything not in the component list is assumed to be minecraft:air
36+
"type": "pattern",
37+
"pattern": [
38+
"WWWWW",
39+
"W---W",
40+
"W-D-W",
41+
"W---W",
42+
"WWWWW"
43+
]
44+
},
45+
46+
{
47+
"type": "hollow",
48+
"component": "W"
49+
},
50+
51+
{
52+
"type": "filled",
53+
"component": "W"
54+
}
55+
]
56+
},
57+
58+
"catalyst": {
59+
"item": "minecraft:ender_pearl"
60+
},
61+
62+
"outputs": [
63+
{
64+
"item": "compactmachines:machine_large",
65+
"count": 1
66+
}
67+
]
68+
}

src/main/java/com/robotgryphon/compactcrafting/client/render/FieldProjectorRenderer.java

Lines changed: 160 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void render(FieldProjectorTile tileEntityIn, float partialTicks, MatrixSt
5252
renderDish(tileEntityIn, matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn);
5353

5454
AxisAlignedBB cube = new AxisAlignedBB(tileEntityIn.getPos()).grow(3);
55-
renderFaces(matrixStackIn, bufferIn, cube, 0);
55+
renderFaces(tileEntityIn, matrixStackIn, bufferIn, cube, 0);
5656
}
5757

5858
private IBakedModel getModel() {
@@ -115,7 +115,142 @@ private void renderDish(FieldProjectorTile te, MatrixStack mx, IRenderTypeBuffer
115115
mx.pop();
116116
}
117117

118-
private void renderFaces(MatrixStack mx, IRenderTypeBuffer buffer, AxisAlignedBB cube, double extraLength) {
118+
/**
119+
* TODO - Main projector (single, NORTH projector)
120+
* TODO - render scan line animated over main crafting projection
121+
* TODO - render main crafting projection cube
122+
*
123+
* TODO - All projectors (individually)
124+
* TODO - render projection arc connecting projector to large cube
125+
*/
126+
127+
/**
128+
* Handles rendering the main projection cube in the center of the projection area.
129+
* Should only be called by the main projector (typically the NORTH projector)
130+
*/
131+
private void renderProjectionCube() {
132+
// Draw the faces
133+
// buffer.pos(x1, y1, z1).color(cR, cG, cB, cA).endVertex();
134+
// buffer.pos(x1, y2, z1).color(cR, cG, cB, cA).endVertex();
135+
// buffer.pos(x2, y2, z1).color(cR, cG, cB, cA).endVertex();
136+
// buffer.pos(x2, y1, z1).color(cR, cG, cB, cA).endVertex();
137+
// buffer.pos(x1, y1, z2).color(cR, cG, cB, cA).endVertex();
138+
// buffer.pos(x2, y1, z2).color(cR, cG, cB, cA).endVertex();
139+
// buffer.pos(x2, y2, z2).color(cR, cG, cB, cA).endVertex();
140+
// buffer.pos(x1, y2, z2).color(cR, cG, cB, cA).endVertex();
141+
//
142+
// buffer.pos(x1, y1, z1).color(cR, cG, cB, cA).endVertex();
143+
// buffer.pos(x2, y1, z1).color(cR, cG, cB, cA).endVertex();
144+
// buffer.pos(x2, y1, z2).color(cR, cG, cB, cA).endVertex();
145+
// buffer.pos(x1, y1, z2).color(cR, cG, cB, cA).endVertex();
146+
// buffer.pos(x1, y2, z1).color(cR, cG, cB, cA).endVertex();
147+
// buffer.pos(x1, y2, z2).color(cR, cG, cB, cA).endVertex();
148+
// buffer.pos(x2, y2, z2).color(cR, cG, cB, cA).endVertex();
149+
// buffer.pos(x2, y2, z1).color(cR, cG, cB, cA).endVertex();
150+
//
151+
// buffer.pos(x1, y1, z1).color(cR, cG, cB, cA).endVertex();
152+
// buffer.pos(x1, y1, z2).color(cR, cG, cB, cA).endVertex();
153+
// buffer.pos(x1, y2, z2).color(cR, cG, cB, cA).endVertex();
154+
// buffer.pos(x1, y2, z1).color(cR, cG, cB, cA).endVertex();
155+
// buffer.pos(x2, y1, z1).color(cR, cG, cB, cA).endVertex();
156+
// buffer.pos(x2, y2, z1).color(cR, cG, cB, cA).endVertex();
157+
// buffer.pos(x2, y2, z2).color(cR, cG, cB, cA).endVertex();
158+
// buffer.pos(x2, y1, z2).color(cR, cG, cB, cA).endVertex();
159+
}
160+
161+
/**
162+
* Handles drawing the projection arcs that connect the projector blocks to the main projection
163+
* in the center of the crafting area.
164+
*/
165+
private void drawProjectorArcs() {
166+
// // Render projection planes
167+
// double zAngle = ((Math.sin(Math.toDegrees(RenderTickCounter.renderTicks) / -5000) + 1.0d) / 2) * (cube.maxY - cube.minY);
168+
// double y3 = y1 + zAngle;
169+
// float cA2 = 0.105f;
170+
//
171+
// // Ensure both sides of the plane are visible
172+
// GlStateManager.disableCull();
173+
// GL11.glDisable(GL11.GL_CULL_FACE);
174+
// // north -> south
175+
// buffer.pos(x1, y3, z1).color(cR, cG, cB, cA2).endVertex();
176+
// buffer.pos(x2, y3, z1).color(cR, cG, cB, cA2).endVertex();
177+
// buffer.pos(x2-(radius-0.2f), y4, z1-(radius+0.8f+extraLength)).color(cR, cG, cB, cA2).endVertex();
178+
// buffer.pos(x1+(radius-0.2f), y4, z1-(radius+0.8f+extraLength)).color(cR, cG, cB, cA2).endVertex();
179+
//
180+
// // east -> west
181+
// buffer.pos(x2, y3, z1).color(cR, cG, cB, cA2).endVertex();
182+
// buffer.pos(x2, y3, z2).color(cR, cG, cB, cA2).endVertex();
183+
// buffer.pos(x2+(radius+0.8f+extraLength), y4, z2-(radius-0.2f)).color(cR, cG, cB, cA2).endVertex();
184+
// buffer.pos(x2+(radius+0.8f+extraLength), y4, z1+(radius-0.2f)).color(cR, cG, cB, cA2).endVertex();
185+
//
186+
// // south -> north
187+
// buffer.pos(x1, y3, z2).color(cR, cG, cB, cA2).endVertex();
188+
// buffer.pos(x2, y3, z2).color(cR, cG, cB, cA2).endVertex();
189+
// buffer.pos(x2-(radius-0.2f), y4, z2+(radius+0.8f+extraLength)).color(cR, cG, cB, cA2).endVertex();
190+
// buffer.pos(x1+(radius-0.2f), y4, z2+(radius+0.8f+extraLength)).color(cR, cG, cB, cA2).endVertex();
191+
//
192+
// // west -> east
193+
// buffer.pos(x1, y3, z1).color(cR, cG, cB, cA2).endVertex();
194+
// buffer.pos(x1, y3, z2).color(cR, cG, cB, cA2).endVertex();
195+
// buffer.pos(x1-(radius+0.8f+extraLength), y4, z2-(radius-0.2f)).color(cR, cG, cB, cA2).endVertex();
196+
// buffer.pos(x1-(radius+0.8f+extraLength), y4, z1+(radius-0.2f)).color(cR, cG, cB, cA2).endVertex();
197+
//
198+
//
199+
// tessellator.draw();
200+
// GlStateManager.enableCull();
201+
}
202+
203+
/**
204+
* Handles drawing the brighter "scan line" around the main projection cube. These lines show visibly
205+
* where the projection arcs meet the main projection cube.
206+
*/
207+
private void drawScanLines() {
208+
// Tessellator tessellator = Tessellator.getInstance();
209+
// BufferBuilder buffer = tessellator.getBuffer();
210+
// buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
211+
//
212+
// int color = 0xFF6A00;
213+
// float cR = (color >> 16 & 255) / 255.0f;
214+
// float cG = (color >> 8 & 255) / 255.0f;
215+
// float cB = (color & 255) / 255.0f;
216+
// float cA = 0.5f;
217+
//
218+
// double x1 = cube.minX;
219+
// double x2 = cube.maxX;
220+
// double y1 = cube.minY;
221+
// double y2 = cube.maxY;
222+
// double z1 = cube.minZ;
223+
// double z2 = cube.maxZ;
224+
//
225+
// // Draw the up and down bouncing lines on the sides
226+
// double zAngle = ((Math.sin(Math.toDegrees(RenderTickCounter.renderTicks) / -5000) + 1.0d) / 2) * (y2 - y1);
227+
// double y3 = y1 + zAngle;
228+
// buffer.pos(x1, y3, z1).color(cR, cG, cB, cA).endVertex();
229+
// buffer.pos(x2, y3, z1).color(cR, cG, cB, cA).endVertex();
230+
//
231+
// buffer.pos(x1, y3, z1).color(cR, cG, cB, cA).endVertex();
232+
// buffer.pos(x1, y3, z2).color(cR, cG, cB, cA).endVertex();
233+
//
234+
// buffer.pos(x2, y3, z2).color(cR, cG, cB, cA).endVertex();
235+
// buffer.pos(x2, y3, z1).color(cR, cG, cB, cA).endVertex();
236+
//
237+
// buffer.pos(x1, y3, z2).color(cR, cG, cB, cA).endVertex();
238+
// buffer.pos(x2, y3, z2).color(cR, cG, cB, cA).endVertex();
239+
//
240+
// tessellator.draw();
241+
}
242+
243+
/**
244+
*
245+
* @param mx
246+
* @param buffer
247+
* @param cube
248+
* @param extraLength
249+
*/
250+
private void renderFaces(FieldProjectorTile tile, MatrixStack mx, IRenderTypeBuffer buffer, AxisAlignedBB cube, double extraLength) {
251+
252+
BlockState state = tile.getBlockState();
253+
Direction facing = state.get(FieldProjectorBlock.FACING);
119254

120255
try {
121256
IVertexBuilder builder = buffer.getBuffer(RenderTypesExtensions.PROJECTION_FIELD_RENDERTYPE);
@@ -126,16 +261,29 @@ private void renderFaces(MatrixStack mx, IRenderTypeBuffer buffer, AxisAlignedBB
126261
// Draw the faces
127262
Vector3d start = new Vector3d(cube.minX, cube.minY, cube.minZ);
128263
Vector3d end = new Vector3d(cube.maxX, cube.maxY, cube.maxZ);
129-
130-
addColoredVertex(builder, mx, fieldColor, new Vector3f(0, 0, .5f));
131-
addColoredVertex(builder, mx, fieldColor, new Vector3f(1, 0, .5f));
132-
addColoredVertex(builder, mx, fieldColor, new Vector3f(1, 1, .5f));
133-
addColoredVertex(builder, mx, fieldColor, new Vector3f(0, 1, .5f));
134-
135-
addColoredVertex(builder, mx, fieldColor, new Vector3f(0, 1, .5f));
136-
addColoredVertex(builder, mx, fieldColor, new Vector3f(1, 1, .5f));
137-
addColoredVertex(builder, mx, fieldColor, new Vector3f(1, 0, .5f));
138-
addColoredVertex(builder, mx, fieldColor, new Vector3f(0, 0, .5f));
264+
265+
Vector3f bl = new Vector3f(0, 0, 0);
266+
Vector3f tr = new Vector3f(1, 1, 0);
267+
268+
// mx.push();
269+
270+
// float angle = facing.getHorizontalAngle() - 90;
271+
// mx.rotate(Vector3f.YN.rotationDegrees(angle));
272+
//
273+
// addColoredVertex(builder, mx, fieldColor, new Vector3f(bl.getX(), bl.getY(), bl.getZ()));
274+
// addColoredVertex(builder, mx, fieldColor, new Vector3f(tr.getX(), bl.getY(), tr.getZ()));
275+
// addColoredVertex(builder, mx, fieldColor, new Vector3f(tr.getX(), tr.getY(), tr.getZ()));
276+
// addColoredVertex(builder, mx, fieldColor, new Vector3f(bl.getX(), tr.getY(), bl.getZ()));
277+
//
278+
//
279+
//
280+
// mx.pop();
281+
282+
283+
// addColoredVertex(builder, mx, fieldColor, new Vector3f(0, 1, .5f));
284+
// addColoredVertex(builder, mx, fieldColor, new Vector3f(1, 1, .5f));
285+
// addColoredVertex(builder, mx, fieldColor, new Vector3f(1, 0, .5f));
286+
// addColoredVertex(builder, mx, fieldColor, new Vector3f(0, 0, .5f));
139287

140288
// lines.pos(x2, y2, z1).color(cR, cG, cB, cA).endVertex();
141289
// lines.pos(x2, y1, z1).color(cR, cG, cB, cA).endVertex();

0 commit comments

Comments
 (0)