Skip to content

Commit 7b7ac44

Browse files
screretgithub-actions[bot]gustovafing
authored
Pipe model rework (#4283)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Gustavo <77560533+gustovafing@users.noreply.github.com>
1 parent c04379a commit 7b7ac44

132 files changed

Lines changed: 4422 additions & 1108 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/content/Modpacks/Changes/v7.4.0.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,3 @@ to
2424
`roll(RecipeCapability<?> cap, List<Content> chancedEntries, ChanceBoostFunction boostFunction, int recipeTier, int chanceTier, Object2IntMap<?> cache, int times)`
2525

2626
(The chance roll function now also requires the RecipeCapability that is currently being processed to be passed in.)
27-

docs/content/Modpacks/Changes/v7.5.0.md

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ title: "Version 7.5.0"
44

55

66
# Updating from `7.4.1` to `7.5.0`
7+
## Machine Builder Generics
8+
We have added a second Generic argument to our (Multiblock)MachineBuilder. This effectively means that anywhere where you used to store a partially finished `MachineBuilder<?>`, you now need to store a `MachineBuilder<?, ?>`. The same holds for `MultiblockMachineBuilder<?, ?>`.
79

8-
## MachineBuilder Generics
9-
We have added a second Generic argument to our (Multiblock)MachineBuilder. This effectively means that anywhere where you used to store a partially finished `MachineBuilder<?>`, you now need to store a `MachineBuilder<?, ?>`. The same holds for `MultiblockMachineBuilder<?,?>`.
10+
## Machine & Cover Copy/Paste System
11+
A new system for copying machines using the Machine Memory Card has been added, see [this page](../Other-Topics/Cover-Machine-Copy-Paste-Support.md) if you want to add extra copy/paste behaviour to your own machines and covers.
1012

1113
## RecipeCondition Generics
1214
We have added a Generic argument to `RecipeCondition` describing the condition.
@@ -20,14 +22,53 @@ You also need to adjust the generics of `getType()` and `createTemplate()` to ma
2022
- public RecipeCondition createTemplate() {
2123
+ public ExampleCondition createTemplate() {
2224
```
23-
24-
## Machine & Cover Copy/Paste System
25-
A new system for copying machines using the Machine Memory Card has been added, see [this page](../Other-Topics/Cover-Machine-Copy-Paste-Support.md) if you want to add extra copy/paste behaviour to your own machines and covers.
26-
2725
## Mortar Recipe Fix
2826
Previously, adding GTToolType.MORTAR to your tool did not automatically generate the recipe. This has been fixed. If you previously generated a recipe using this, you need to remove your manual recipe.
2927

28+
## Pipe rendering changes
29+
_This is only relevant to add-on mods with custom pipe types._
30+
Addons with custom pipe implementations will have to tweak their code slightly to function with the new rendering code (see example below).
31+
32+
```patch
33+
-public final PipeModel model = new PipeModel(pipeType.getThickness(), () -> [side texture], () -> [end texture], null, null);
34+
-@Getter
35+
-private final PipeBlockRenderer renderer = new PipeBlockRenderer(model);
36+
37+
...
38+
39+
@Override
40+
-public PipeModel getPipeModel() {
41+
- return model;
42+
+public PipeModel createPipeModel(GTBlockstateProvider provider) {
43+
+ return new PipeModel(this, pipeType.getThickness(), [side texture], [end texture], provider);
44+
}
45+
```
46+
If your pipe is generated from a material property (or equivalent), you should also call `PipeModel#dynamicModel()`
47+
to have models be generated at runtime.
48+
If so, must also add a **Mod bus** event listener for `RegisterDynamicResourcesEvent`, like so:
49+
```java
50+
@SubscribeEvent
51+
public static void registerDynamicResources(RegisterDynamicResourcesEvent event) {
52+
for (var block : MyBlocks.MY_PIPE_BLOCKS) block.get().createPipeModel(RuntimeExistingFileHelper.INSTANCE).dynamicModel();
53+
}
54+
```
55+
Replace `MyBlocks.MY_PIPE_BLOCKS` with a reference to your pipe block array/map value collection.
56+
57+
58+
Conversely, if the pipe is **not** generated, but has a constant set of variants (such as optical fiber cables or laser pipes),
59+
you should **NOT** use `PipeModel#dynamicModel()` and instead set the model with `GTBlockBuilder#gtBlockstate` as such:
60+
```java
61+
// on your pipe block builder
62+
... = REGISTRATE.block(...)
63+
.properties(...)
64+
.gtBlockstate(GTModels::createPipeBlockModel)
65+
...more builder things...
66+
.item(...)
67+
.model(NonNullBiConsumer.noop())
68+
...more builder things...
69+
```
70+
3071
## Lamp Predicates
3172
Previously, lamps were not useable with the terminal in multiblocks. There are new lamp predicates that will help solve this problem.
3273
The predicate to use all lamps is: `Predicates.anyLamp()`
33-
The predicate to use a specific color is: `Predicates.lampsByColor(DyeColor.DYE_COLOR)`. Where DYE_COLOR is the name of the color you want.
74+
The predicate to use a specific color is: `Predicates.lampsByColor(DyeColor.DYE_COLOR)`. Where DYE_COLOR is the name of the color you want.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "gtceu:block/huge_duct_pipe"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "gtceu:block/large_duct_pipe"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "gtceu:block/normal_duct_pipe"
5+
}
6+
}
7+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"variants": {
3+
"active=false": {
4+
"model": "gtceu:block/normal_laser_pipe"
5+
},
6+
"active=true": {
7+
"model": "gtceu:block/normal_laser_pipe_active"
8+
}
9+
}
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"variants": {
3+
"active=false": {
4+
"model": "gtceu:block/normal_optical_pipe"
5+
},
6+
"active=true": {
7+
"model": "gtceu:block/normal_optical_pipe_active"
8+
}
9+
}
10+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "gtceu:block/small_duct_pipe"
5+
}
6+
}
7+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"parent": "gtceu:block/pipe/huge_duct_pipe/center",
3+
"loader": "gtceu:pipe",
4+
"parts": {
5+
"center": {
6+
"model": "gtceu:block/pipe/huge_duct_pipe/center"
7+
},
8+
"down": {
9+
"model": "gtceu:block/pipe/huge_duct_pipe/connection"
10+
},
11+
"east": {
12+
"model": "gtceu:block/pipe/huge_duct_pipe/connection",
13+
"x": 90,
14+
"y": 270
15+
},
16+
"north": {
17+
"model": "gtceu:block/pipe/huge_duct_pipe/connection",
18+
"x": 90,
19+
"y": 180
20+
},
21+
"south": {
22+
"model": "gtceu:block/pipe/huge_duct_pipe/connection",
23+
"x": 90
24+
},
25+
"up": {
26+
"model": "gtceu:block/pipe/huge_duct_pipe/connection",
27+
"x": 180
28+
},
29+
"west": {
30+
"model": "gtceu:block/pipe/huge_duct_pipe/connection",
31+
"x": 90,
32+
"y": 90
33+
}
34+
},
35+
"restrictors": {
36+
"down": {
37+
"model": "gtceu:block/pipe/restrictor/down/thickness_14.0"
38+
},
39+
"east": {
40+
"model": "gtceu:block/pipe/restrictor/east/thickness_14.0"
41+
},
42+
"north": {
43+
"model": "gtceu:block/pipe/restrictor/north/thickness_14.0"
44+
},
45+
"south": {
46+
"model": "gtceu:block/pipe/restrictor/south/thickness_14.0"
47+
},
48+
"up": {
49+
"model": "gtceu:block/pipe/restrictor/up/thickness_14.0"
50+
},
51+
"west": {
52+
"model": "gtceu:block/pipe/restrictor/west/thickness_14.0"
53+
}
54+
}
55+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"parent": "gtceu:block/pipe/large_duct_pipe/center",
3+
"loader": "gtceu:pipe",
4+
"parts": {
5+
"center": {
6+
"model": "gtceu:block/pipe/large_duct_pipe/center"
7+
},
8+
"down": {
9+
"model": "gtceu:block/pipe/large_duct_pipe/connection"
10+
},
11+
"east": {
12+
"model": "gtceu:block/pipe/large_duct_pipe/connection",
13+
"x": 90,
14+
"y": 270
15+
},
16+
"north": {
17+
"model": "gtceu:block/pipe/large_duct_pipe/connection",
18+
"x": 90,
19+
"y": 180
20+
},
21+
"south": {
22+
"model": "gtceu:block/pipe/large_duct_pipe/connection",
23+
"x": 90
24+
},
25+
"up": {
26+
"model": "gtceu:block/pipe/large_duct_pipe/connection",
27+
"x": 180
28+
},
29+
"west": {
30+
"model": "gtceu:block/pipe/large_duct_pipe/connection",
31+
"x": 90,
32+
"y": 90
33+
}
34+
},
35+
"restrictors": {
36+
"down": {
37+
"model": "gtceu:block/pipe/restrictor/down/thickness_12.0"
38+
},
39+
"east": {
40+
"model": "gtceu:block/pipe/restrictor/east/thickness_12.0"
41+
},
42+
"north": {
43+
"model": "gtceu:block/pipe/restrictor/north/thickness_12.0"
44+
},
45+
"south": {
46+
"model": "gtceu:block/pipe/restrictor/south/thickness_12.0"
47+
},
48+
"up": {
49+
"model": "gtceu:block/pipe/restrictor/up/thickness_12.0"
50+
},
51+
"west": {
52+
"model": "gtceu:block/pipe/restrictor/west/thickness_12.0"
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)