Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
4acd70e
sometihng about CTM quads
screret Apr 10, 2026
b9de7ce
Merge branch '1.20.1' into sc/something-about-ctm-quads
screret Apr 17, 2026
8fa9899
"remake" the baked model replacement stuff (but not really)
screret Apr 17, 2026
9979fe3
reimplement LDLib's CTM wrapper model
screret Jun 23, 2025
9253abc
Rip out almost* all LDLib CustomBakedModel usages & replace them with…
screret Apr 17, 2026
96721b3
Move CTM things to `client.model.ctm`
screret Apr 18, 2026
e86f965
Clean up CTMBakedModel#getQuads
screret Apr 18, 2026
3d21cdf
Move quad utils to `client.util.quad`
screret Apr 18, 2026
75c5a96
Rename `ModelUtils` to `ModelEventHelper` and move unrelated utility …
screret Apr 18, 2026
ee18024
Fix up the CTM reload listener in ClientProxy
screret Apr 18, 2026
2bb52f8
Add copyright headers to all the classes I copied from CTM
screret Apr 18, 2026
6fc6f14
Add a simplified version of Fabric's dynamic model API
screret Apr 18, 2026
271e51d
Move all internal asset reload listeners (including the CTM model rep…
screret Apr 18, 2026
5eff24f
Move GTQuadTransformers to `client.util.quad.transformers`
screret Apr 18, 2026
5226e48
Add GTTextureMetadata (forgot to commit this)
screret Apr 18, 2026
b327fe6
Move classes again
screret Apr 18, 2026
624ee1d
Import CCL quad transformers from AE2
screret Apr 18, 2026
a6628ea
Use the Fabric quad modification pipeline for connected textures
screret Apr 18, 2026
7c941bc
Reformat doc comments
screret Apr 18, 2026
469b346
Rename the "connection" metadata field to "connection_texture"
screret Apr 18, 2026
78a0ad7
Fix all the resource files
screret Apr 18, 2026
df0c06b
spotless
screret Apr 18, 2026
0648242
Fix errors caused by dropping commits a bit too hastily
screret Apr 18, 2026
40efad0
Fix corrupt JSON
screret Apr 18, 2026
4000a51
Make world load
screret Apr 18, 2026
18a7165
Force our reload listener to the front of the queue
screret Apr 18, 2026
aa375a3
quh.
screret Apr 18, 2026
d7326c1
Make CTMCache have a stable hash
screret Apr 19, 2026
734ac55
Fix the quads' UV layout
screret Apr 19, 2026
8cbb15c
Use thread-local variables for vectors to reduce garbage collection p…
screret Apr 19, 2026
7987e77
Remove unused bits & bobs
screret Apr 19, 2026
c2ccc3e
Fix my UV normalization being bad
screret Apr 19, 2026
70dce9e
Make Submap lookup use a 2D array as the LUT
screret Apr 19, 2026
8498f99
Clean up related util files & improve new ones' documentation(s)
screret Apr 19, 2026
2f61fe3
Fix lamp model wrapping corrupting block models
screret Apr 19, 2026
874c0b0
Bad direction offset doc
screret Apr 19, 2026
98d02c6
Revert "Bad direction offset doc"
screret Apr 19, 2026
bbf445f
it _almost_ works. It's taunting me.
screret Apr 19, 2026
b26a46b
Rename QuadUtils to CTMHelper
screret Apr 20, 2026
613de01
The 'is dynamic resources enabled' check is needed, actually
screret Apr 20, 2026
4a4b975
Add a CTM UV test block
screret Apr 20, 2026
4488f70
Remove bad offsets
screret Apr 20, 2026
f529c74
Run datagen for CTM test block
screret Apr 20, 2026
2f833bc
Fix CTM UV layouts
screret Apr 20, 2026
66271b1
Do, a copy, do it deep
screret Apr 20, 2026
66339bb
nonnull normal face, less copying
screret Apr 20, 2026
7174561
Fix the bottom face being off
screret Apr 20, 2026
42eb7d0
remove no longer correct doc comments
screret Apr 20, 2026
6041b87
Merge branch 'refs/heads/1.20.1' into sc/something-about-ctm-quads
screret Apr 21, 2026
54d8b9a
Re-enable ARGB->ABGR color translation
screret Apr 21, 2026
d3c6afa
Spotless
screret Apr 21, 2026
768d994
Add update doc
screret Apr 24, 2026
ce6bff4
CTM layout documentation
screret Apr 24, 2026
0758c32
Apply patch
screret May 1, 2026
0455aa2
Fix quad derotation not working as intended
screret May 1, 2026
fd05e9b
Oops, that belonged to a different branch
screret May 1, 2026
09ad0c3
Merge branch '1.20.1' into sc/something-about-ctm-quads
screret May 2, 2026
98e3f09
Fix CTM not working when embeddium isn't installed
screret May 7, 2026
5141557
Remove quad caching; it didn't really do much and has the possibility…
screret May 7, 2026
bf63e04
Add debake method to MutableQuadView
screret May 7, 2026
60b7cb4
more checks; clearer names
screret May 7, 2026
0f5ed47
client.util.quad.CTMHelper -> client.model.ctm.CTMMeshBuilder
screret May 7, 2026
2e73836
Merge branch '1.20.1' into sc/something-about-ctm-quads
screret May 7, 2026
65943ae
Rename CTMCache -> TextureConnections
screret May 7, 2026
575997c
More util methods
screret May 7, 2026
a11439a
make ConnectionCheck a static utility class; we don't allow using cus…
screret May 7, 2026
79bf7e2
Remove extra `@Nullable` IntelliJ didn't like
screret May 7, 2026
4d16858
rename functions
screret May 7, 2026
dbbfa56
Spotless
screret May 7, 2026
e71eafd
Fix light gray lamps' connections
screret May 7, 2026
7c7e0d1
Merge branch '1.20.1' into sc/something-about-ctm-quads
screret May 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/content/Modpacks/Changes/v8.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,19 @@ A large number of machine feature interfaces have been removed, and have had the
- `IFluidRendererMulti` - Use `MultiblockFluidRendererTrait`


## Connected texture reimplementation
The mod's connected texture logic has been reimplemented in GTM proper.
Texture packs, addons, and modpacks will have to change their texture metadata files for connected texures slightly.
A few regexes for fixing all the MCMeta files is follows, run them in order:

1. Match: `"ldlib":([\s\{]*)"connection"(:\s".*?")(?:,\s.*)?`
Replace with: `"gtceu":$1"connection_texture"$2`
2. Match: `\s*\},\s*"shimmer":\s*\{(\s*"bloom":.*)`
Replace with: `,$1`
3. Match: `(\{\s*)"shimmer":(\s*\{\s*"bloom":.*)`
Replace with: `$1"gtceu":$2`


## Other Changes

- `BlastingRecipeBuilder`, `CampfireRecipeBuilder`, `SmeltingRecipeBuilder` and `SmokingRecipeBuilder` have been merged into `SimpleCookingRecipeBuilder`
Expand Down
63 changes: 63 additions & 0 deletions docs/content/Modpacks/Other-Topics/Connected-Textures.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: Creating Connected Textures
---

**Connected textures** are, as the name would imply, textures that connect with neighboring blocks.

The CTM renderer will draw the block faces by assembling 4 quadrants from the 5 available block textures.
The normal `texture.png` is the block's "unconnected" texture, and is used when CTM is disabled or the block
has nothing to connect to.
`texture.png` has the outside corner quadrants and `texture_ctm.png` contains the connections.
```
┌─────────────────┐ ┌────────────────────────────────┐
│ texture.png │ │ texture_ctm.png │
│ ╔══════╤══════╗ │ │ ──────┼────── ║ ─────┼───── ║ │
│ ║ │ ║ │ │ │ │ │║ │ ║ │
│ ║ 4/4 │ 4/5 ║ │ │ │ 0/0 │ 0/1 │║ 0/2 │ 0/3 ║ │
│ ╟──────┼──────╢ │ │ ┼──────┼──────┼╟──────┼──────╢ │
│ ║ │ ║ │ │ │ │ │║ │ ║ │
│ ║ 5/4 │ 5/5 ║ │ │ │ 1/0 │ 1/1 │║ 1/2 │ 1/3 ║ │
│ ╚══════╧══════╝ │ │ ──────┼────── ║ ─────┼───── ║ │
└─────────────────┘ │ ═══════╤═══════╝ ─────┼───── ╚ │
│ │ │ ││ │ │ │
│ │ 2/0 │ 2/1 ││ 2/2 │ 2/3 │ │
│ ┼──────┼──────┼┼──────┼──────┼ │
│ │ │ ││ │ │ │
│ │ 3/0 │ 3/1 ││ 3/2 │ 3/3 │ │
│ ═══════╧═══════╗ ─────┼───── ╔ │
└────────────────────────────────┘
```

For example, combining sections 4/4, 2/1, 5/4, and 3/1, we can generate a texture connected to the right!
```
╔══════╤═══════
║ │ │
║ 4/4 │ 2/1 │
╟──────┼──────┼
║ │ │
║ 5/4 │ 3/1 │
╚══════╧═══════
```
Combining sections 0/2, 2/3, 5/4, and 3/1, we can generate a texture in the shape of an L (connected to the right and up):
```
║ ─────┼───── ╚
║ │ │
║ 0/2 │ 2/3 │
╟──────┼──────┼
║ │ │
║ 5/4 │ 3/1 │
╚══════╧═══════
```


??? example "Example MCMeta file"
(For a texture `mypack/assets/textures/blocks/texture.png` with a ctm texture `mypack/assets/textures/blocks/texture_ctm.png`)
```json title="mypack:blocks/texture.png.mcmeta"
{
"gtceu": {
"connection_texture": "mypack:blocks/texture_ctm"
}
}
```
The CTM texture layout is [here](https://github.com/GregTechCEu/GregTech-Modern/blob/1.20.1/src/main/resources/assets/gtceu/textures/block/ctm_test.png) for the unconnected texture and [here](https://github.com/GregTechCEu/GregTech-Modern/blob/1.20.1/src/main/resources/assets/gtceu/textures/block/ctm_test_ctm.png) for its connections.
Its MCMeta metadata file is [this one](https://github.com/GregTechCEu/GregTech-Modern/blob/1.20.1/src/main/resources/assets/gtceu/textures/block/ctm_test.png.mcmeta).
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "gtceu:block/ctm_test"
}
}
}
1 change: 1 addition & 0 deletions src/generated/resources/assets/gtceu/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
"block.gtceu.creative_tank": "ʞuɐ⟘ ǝʌıʇɐǝɹƆ",
"block.gtceu.creosote": "ǝʇosoǝɹƆ",
"block.gtceu.crushing_wheels": "sןǝǝɥM buıɥsnɹƆ",
"block.gtceu.ctm_test": "ʞɔoןᗺ ʇsǝ⟘ ǝɹnʇxǝ⟘ pǝʇɔǝuuoƆ",
"block.gtceu.cupronickel_coil_block": "ʞɔoןᗺ ןıoƆ ןǝʞɔıuoɹdnƆ",
"block.gtceu.cyan_borderless_lamp": "dɯɐꞀ ssǝןɹǝpɹoᗺ uɐʎƆ",
"block.gtceu.cyan_lamp": "dɯɐꞀ uɐʎƆ",
Expand Down
1 change: 1 addition & 0 deletions src/generated/resources/assets/gtceu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
"block.gtceu.creative_tank": "Creative Tank",
"block.gtceu.creosote": "Creosote",
"block.gtceu.crushing_wheels": "Crushing Wheels",
"block.gtceu.ctm_test": "Connected Texture Test Block",
"block.gtceu.cupronickel_coil_block": "Cupronickel Coil Block",
"block.gtceu.cyan_borderless_lamp": "Cyan Borderless Lamp",
"block.gtceu.cyan_lamp": "Cyan Lamp",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "gtceu:block/ctm_test"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "gtceu:block/ctm_test"
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,22 @@
import com.gregtechceu.gtceu.api.transfer.fluid.IFluidHandlerModifiable;
import com.gregtechceu.gtceu.client.model.IBlockEntityRendererBakedModel;
import com.gregtechceu.gtceu.client.model.machine.MachineRenderState;
import com.gregtechceu.gtceu.client.util.ModelUtils;
import com.gregtechceu.gtceu.client.util.RenderUtil;
import com.gregtechceu.gtceu.common.cover.FluidFilterCover;
import com.gregtechceu.gtceu.common.cover.ItemFilterCover;
import com.gregtechceu.gtceu.common.cover.data.ManualIOMode;
import com.gregtechceu.gtceu.common.machine.owner.MachineOwner;
import com.gregtechceu.gtceu.common.machine.owner.PlayerOwner;
import com.gregtechceu.gtceu.common.machine.trait.AutoOutputTrait;
import com.gregtechceu.gtceu.utils.ExtendedUseOnContext;
import com.gregtechceu.gtceu.utils.GTStringUtils;
import com.gregtechceu.gtceu.utils.data.TagCompatibilityFixer;

import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture;
import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture;
import com.lowdragmc.lowdraglib.utils.DummyWorld;

import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
Expand Down Expand Up @@ -661,7 +660,7 @@ public void addDebugOverlayText(Consumer<String> lines) {
// add render state info
MachineRenderState renderState = this.getRenderState();
for (var property : renderState.getValues().entrySet()) {
lines.accept(ModelUtils.getPropertyValueString(property));
lines.accept(GTStringUtils.getPropertyValueString(property));
}
}

Expand Down Expand Up @@ -1011,8 +1010,7 @@ public int getDefaultPaintingColor() {
@OnlyIn(Dist.CLIENT)
@Override
public AABB getRenderBoundingBox() {
BlockRenderDispatcher blockRenderDispatcher = Minecraft.getInstance().getBlockRenderer();
BakedModel model = blockRenderDispatcher.getBlockModel(this.getBlockState());
BakedModel model = RenderUtil.getModelForState(this.getBlockState());

if (model instanceof IBlockEntityRendererBakedModel<?> modelWithBER) {
if (modelWithBER.getBlockEntityType() == this.getType()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.gregtechceu.gtceu.client.renderer.machine.DynamicRenderManager;
import com.gregtechceu.gtceu.client.renderer.machine.impl.*;
import com.gregtechceu.gtceu.client.renderer.machine.impl.BoilerMultiPartRender;
import com.gregtechceu.gtceu.client.util.ModelEventHelper;
import com.gregtechceu.gtceu.common.CommonEventListener;
import com.gregtechceu.gtceu.common.CommonProxy;
import com.gregtechceu.gtceu.common.data.GTBlockEntities;
Expand Down Expand Up @@ -72,6 +73,8 @@
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;

import java.util.*;

public class ClientProxy extends CommonProxy {

public static final BiMap<ResourceLocation, GTOreDefinition> CLIENT_ORE_VEINS = HashBiMap.create();
Expand All @@ -91,6 +94,7 @@ public static void init() {
CommonEventListener.registerCapes(new RegisterGTCapesEvent());
}
initializeDynamicRenders();
ModelEventHelper.initInternalAssetReloadListeners();
}

@SubscribeEvent
Expand Down Expand Up @@ -158,7 +162,7 @@ public void onClientSetup(FMLClientSetupEvent event) {
}
}

public static void initializeDynamicRenders() {
private static void initializeDynamicRenders() {
DynamicRenderManager.register(GTCEu.id("quantum_tank_fluid"), QuantumTankFluidRender.TYPE);
DynamicRenderManager.register(GTCEu.id("quantum_chest_item"), QuantumChestItemRender.TYPE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class GTModelProperties {

public static final ModelProperty<BlockAndTintGetter> LEVEL = new ModelProperty<>();
public static final ModelProperty<BlockPos> POS = new ModelProperty<>();
public static final ModelProperty<ModelData> PARENT_MODEL_DATA = new ModelProperty<>();

public static final ModelProperty<Map<Direction, ModelData>> COVER_MODEL_DATA = new ModelProperty<>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.gregtechceu.gtceu.client.model;

import com.gregtechceu.gtceu.client.util.GTQuadTransformers;
import com.gregtechceu.gtceu.client.util.quad.transformers.GTQuadTransformers;

import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.block.model.BakedQuad;
Expand All @@ -14,7 +14,6 @@
import net.minecraftforge.client.model.data.ModelData;

import lombok.Getter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.*;
Expand All @@ -23,7 +22,6 @@ public class TextureOverrideModel<T extends BakedModel> extends BakedModelWrappe

public static final IQuadTransformer OVERLAY_OFFSET = GTQuadTransformers.offset(0.002f);

@NotNull
@Getter
protected final Map<String, TextureAtlasSprite> textureOverrides;

Expand All @@ -37,10 +35,9 @@ public BakedModel getChild() {
}

@Override
public @NotNull List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side,
@NotNull RandomSource rand, @NotNull ModelData extraData,
@Nullable RenderType renderType) {
return retextureQuads(super.getQuads(state, side, rand, extraData, renderType), textureOverrides);
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side,
RandomSource rand, ModelData modelData, @Nullable RenderType renderType) {
return retextureQuads(super.getQuads(state, side, rand, modelData, renderType), textureOverrides);
}

public static List<BakedQuad> retextureQuads(List<BakedQuad> quads, Map<String, TextureAtlasSprite> overrides) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.gregtechceu.gtceu.client.model.ctm;

import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.model.BakedModelWrapper;
import net.minecraftforge.client.model.data.ModelData;

import org.jetbrains.annotations.Nullable;

import java.util.*;

import static com.gregtechceu.gtceu.client.model.GTModelProperties.*;

public class CTMBakedModel<T extends BakedModel> extends BakedModelWrapper<T> {

public CTMBakedModel(T parent) {
super(parent);
}

public BakedModel getParent() {
return this.originalModel;
}

@SuppressWarnings("DataFlowIssue")
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side,
RandomSource rand, ModelData data, @Nullable RenderType renderType) {
ModelData parentModelData = data.has(PARENT_MODEL_DATA) ? data.get(PARENT_MODEL_DATA) : data;
if (state == null || side == null) {
return super.getQuads(state, side, rand, parentModelData, renderType);
}
BlockAndTintGetter level = data.get(LEVEL);
BlockPos pos = data.get(POS);
if (level == null || pos == null) {
return super.getQuads(state, side, rand, parentModelData, renderType);
}

TextureConnections connections = TextureConnections.getInstance();
connections.fillSubmapCache(level, pos, state, side);
return CTMMeshBuilder.buildCTMQuads(connections, super.getQuads(state, side, rand, parentModelData, renderType),
side);
}

@Override
public ModelData getModelData(BlockAndTintGetter level, BlockPos pos, BlockState state, ModelData modelData) {
ModelData parentModelData = super.getModelData(level, pos, state, modelData);
return ModelData.builder()
.with(LEVEL, level)
.with(POS, pos)
.with(PARENT_MODEL_DATA, parentModelData)
.build();
}
}
Loading
Loading