Skip to content

Commit

Permalink
fix: preview rendering of cutout blocks
Browse files Browse the repository at this point in the history
Closes #260
  • Loading branch information
klikli-dev committed Oct 31, 2024
1 parent d975189 commit c6a66d4
Show file tree
Hide file tree
Showing 21 changed files with 210 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,11 @@ public static RenderType remap(RenderType in) {
if (in instanceof GhostRenderLayer) {
return in;
} else {
return remappedTypes.computeIfAbsent(in, GhostRenderLayer::new);
return remappedTypes.computeIfAbsent(in, (type) -> {
if(type.name.contains("cutout")) //hack to address https://github.com/klikli-dev/modonomicon/issues/260, but it should work reasonably well
type = RenderType.translucent();
return new GhostRenderLayer(type);
});
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,18 @@ public void buildMultiblocks() {
.block('L', () -> Blocks.LAVA)
.block('W', () -> Blocks.WATER)
);

this.add(this.modLoc("demo_transparency"), new DenseMultiblockBuilder()
.layer(
"G F",
" 0 ",
"I C"
)
.block('G', () -> Blocks.GLASS_PANE)
.block('F', () -> Blocks.GRAY_STAINED_GLASS_PANE)
.block('I', () -> Blocks.IRON_BARS)
.block('C', () -> Blocks.CHAIN)
);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ protected void generatePages() {
.withMultiblockId(this.modLoc("demo_fluid"))
);


this.page("demo_transparency", () -> BookMultiblockPageModel.create()
.withMultiblockId(this.modLoc("demo_transparency"))
);
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion common/src/main/resources/modonomicon.accesswidener
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ accessible method net/minecraft/client/gui/GuiGraphics flushIfUnmanaged ()V
extendable method net/minecraft/client/gui/components/AbstractWidget render (Lnet/minecraft/client/gui/GuiGraphics;IIF)V
accessible method net/minecraft/client/resources/model/ModelBakery getModel (Lnet/minecraft/resources/ResourceLocation;)Lnet/minecraft/client/resources/model/UnbakedModel;
extendable method net/minecraft/client/gui/screens/Screen renderWithTooltip (Lnet/minecraft/client/gui/GuiGraphics;IIF)V
extendable method net/minecraft/client/gui/screens/Screen init (Lnet/minecraft/client/Minecraft;II)V
extendable method net/minecraft/client/gui/screens/Screen init (Lnet/minecraft/client/Minecraft;II)V
accessible field net/minecraft/client/renderer/RenderStateShard name Ljava/lang/String;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// 1.21.1 2024-10-04T09:42:34.7869509 Modonomicon/Books: modonomicon
336f53e3e836f762a8ea5efdb4921a259b5d52b9 data\modonomicon\modonomicon\books\demo\entries\features\multiblock.json
// 1.21.1 2024-10-31T11:53:05.6378924 Modonomicon/Books: modonomicon
26a65c788648651d5b79a2e9e19e6ce88479550e data\modonomicon\modonomicon\books\demo\entries\features\multiblock.json
1026c22d26aacaf4cdbc863df4fb00229af152a3 data\modonomicon\modonomicon\books\demo\categories\features.json
357539b3d8a74d7bfced6fc27c1280d9b05acf3b data\modonomicon\modonomicon\books\demo\entries\features\recipe.json
eff793d776fcd5711c6efdb0eb30124a8f633448 data\modonomicon\modonomicon\books\demo_leaflet\entries\leaflet\leaflet.json
Expand All @@ -17,8 +17,8 @@ ee56ca8dcb97da78c75ef5c31b561e1e9e7c9e65 data\modonomicon\modonomicon\books\demo
5048a72f0a37443cf6eb107ce8f8197eb34a25c7 data\modonomicon\modonomicon\books\demo\entries\features\condition_level_1.json
2a948b807be3b8c919e3a1391ae4ffbba7123364 data\modonomicon\modonomicon\books\demo\entries\features\entity.json
3dd53ac01f9fed78bf000d9c669bc1bf131a0bcc data\modonomicon\modonomicon\books\demo\entries\formatting\link.json
aa468bfbbd816f8d06107ab2fecf5e278c6740ab data\modonomicon\modonomicon\books\demo\entries\features\custom_icon.json
59bf0a22c269e4a45fdee22c7d61577b2b9801a9 data\modonomicon\modonomicon\books\demo\entries\index_mode\demo1.json
aa468bfbbd816f8d06107ab2fecf5e278c6740ab data\modonomicon\modonomicon\books\demo\entries\features\custom_icon.json
631f8d62bf05e90eba6f7ce2e441e069099b7198 data\modonomicon\modonomicon\books\demo_leaflet\book.json
1bce112b72f69f69141c36a2c67ee5d650e38172 data\modonomicon\modonomicon\books\demo\entries\features\condition_root.json
99a977c14e496a823810fd889776aa6f8629fc4a data\modonomicon\modonomicon\books\demo\entries\features\redirect.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.21.1 2024-10-04T09:42:34.7889517 Modonomicon/Languages: en_us
// 1.21.1 2024-10-31T11:53:05.6408937 Modonomicon/Languages: en_us
1aef02be3cff1a218e12e0114f8fe3ddc2ebef13 assets\modonomicon\lang\en_us.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// 1.21.1 2024-10-04T09:42:34.7889517 Modonomicon/Tags for minecraft:item
// 1.21.1 2024-10-31T11:53:05.6408937 Modonomicon/Tags for minecraft:item
44de4772d365fcc0e5706dbfcd83d2967ec352c0 data\minecraft\tags\item\bookshelf_books.json
44de4772d365fcc0e5706dbfcd83d2967ec352c0 data\minecraft\tags\item\lectern_books.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21.1 2024-10-04T09:42:34.7889517 Modonomicon/Model Definitions
// 1.21.1 2024-10-31T11:53:05.6398931 Modonomicon/Model Definitions
b02e0bc9f75e0fde6807935577e74b75348413fb assets\modonomicon\models\item\modonomicon_blue.json
83adea7fd65acd9581797454e1a6dc6122d8a826 assets\modonomicon\models\item\modonomicon_green.json
a4a605637998b2d6d6b7cd9c002d5ba0163622c0 assets\modonomicon\models\item\modonomicon_red.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// 1.21.1 2024-10-04T09:42:34.7879533 Modonomicon/Multiblocks: modonomicon
// 1.21.1 2024-10-31T11:53:05.6398931 Modonomicon/Multiblocks: modonomicon
fc1e7363336d456dd0d1583fcfdaa27a8c4bf23e data\modonomicon\modonomicon\multiblocks\demo_predicate.json
89b499dd4f3850c8099ad26ae3c286e95ac8cf99 data\modonomicon\modonomicon\multiblocks\demo_fluid.json
fd00692e28c040e5100a022e97ea32e7e951945b data\modonomicon\modonomicon\multiblocks\demo_tag.json
866630ccfeeea8b012ceab80396939c0e944f132 data\modonomicon\modonomicon\multiblocks\demo_transparency.json
d359278a8bc55267387b95977def04965a54dd17 data\modonomicon\modonomicon\multiblocks\demo_block_entity.json
6af533f5fa171fb2cf2d27b166e16ec54b2c5c06 data\modonomicon\modonomicon\multiblocks\test_non_square.json
9dc306d79a39ee2085be7e1384d8e39640d79e49 data\modonomicon\modonomicon\multiblocks\demo_dense.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@
"multiblock_name": "",
"show_visualize_button": true,
"text": ""
},
{
"type": "modonomicon:multiblock",
"anchor": "",
"condition": {
"type": "modonomicon:none"
},
"multiblock_id": "demo_transparency",
"multiblock_name": "",
"show_visualize_button": true,
"text": ""
}
],
"show_when_any_parent_unlocked": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"type": "modonomicon:dense",
"mapping": {
"*": {
"type": "modonomicon:display",
"display": "minecraft:basalt"
},
"+": {
"type": "modonomicon:display",
"display": "minecraft:stone"
},
"C": {
"type": "modonomicon:block",
"block": "minecraft:chain"
},
"F": {
"type": "modonomicon:block",
"block": "minecraft:gray_stained_glass_pane"
},
"G": {
"type": "modonomicon:block",
"block": "minecraft:glass_pane"
},
"I": {
"type": "modonomicon:block",
"block": "minecraft:iron_bars"
}
},
"pattern": [
[
"_____",
"_G_F_",
"__0__",
"_I_C_",
"_____"
],
[
"*+*+*",
"+*+*+",
"*+*+*",
"+*+*+",
"*+*+*"
]
]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21.1 2024-10-04T09:43:36.9512315 Books: modonomicon
// 1.21.1 2024-10-31T11:05:51.138905 Books: modonomicon
ea82c1ec5ac99b6c53186c37a2964666b6824399 data/modonomicon/modonomicon/books/demo/book.json
9bf40644b1a94e0f93e2d4d49e6f9ed6bd942ae5 data/modonomicon/modonomicon/books/demo/categories/conditional.json
1026c22d26aacaf4cdbc863df4fb00229af152a3 data/modonomicon/modonomicon/books/demo/categories/features.json
Expand All @@ -17,7 +17,7 @@ aa468bfbbd816f8d06107ab2fecf5e278c6740ab data/modonomicon/modonomicon/books/demo
ee56ca8dcb97da78c75ef5c31b561e1e9e7c9e65 data/modonomicon/modonomicon/books/demo/entries/features/empty.json
2a948b807be3b8c919e3a1391ae4ffbba7123364 data/modonomicon/modonomicon/books/demo/entries/features/entity.json
defe203f16f628d8c88a2b7228e9c0de704b364d data/modonomicon/modonomicon/books/demo/entries/features/image.json
336f53e3e836f762a8ea5efdb4921a259b5d52b9 data/modonomicon/modonomicon/books/demo/entries/features/multiblock.json
26a65c788648651d5b79a2e9e19e6ce88479550e data/modonomicon/modonomicon/books/demo/entries/features/multiblock.json
357539b3d8a74d7bfced6fc27c1280d9b05acf3b data/modonomicon/modonomicon/books/demo/entries/features/recipe.json
99a977c14e496a823810fd889776aa6f8629fc4a data/modonomicon/modonomicon/books/demo/entries/features/redirect.json
3d02ebee99a4bfcdae31dc5bc54ee732ebbf3a1c data/modonomicon/modonomicon/books/demo/entries/features/spotlight.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// 1.21.1 2024-09-11T09:39:53.351444 Multiblocks: modonomicon
// 1.21.1 2024-10-31T11:46:46.9045185 Multiblocks: modonomicon
d359278a8bc55267387b95977def04965a54dd17 data/modonomicon/modonomicon/multiblocks/demo_block_entity.json
9dc306d79a39ee2085be7e1384d8e39640d79e49 data/modonomicon/modonomicon/multiblocks/demo_dense.json
89b499dd4f3850c8099ad26ae3c286e95ac8cf99 data/modonomicon/modonomicon/multiblocks/demo_fluid.json
fc1e7363336d456dd0d1583fcfdaa27a8c4bf23e data/modonomicon/modonomicon/multiblocks/demo_predicate.json
fd00692e28c040e5100a022e97ea32e7e951945b data/modonomicon/modonomicon/multiblocks/demo_tag.json
866630ccfeeea8b012ceab80396939c0e944f132 data/modonomicon/modonomicon/multiblocks/demo_transparency.json
6af533f5fa171fb2cf2d27b166e16ec54b2c5c06 data/modonomicon/modonomicon/multiblocks/test_non_square.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@
"multiblock_name": "",
"show_visualize_button": true,
"text": ""
},
{
"type": "modonomicon:multiblock",
"anchor": "",
"condition": {
"type": "modonomicon:none"
},
"multiblock_id": "demo_transparency",
"multiblock_name": "",
"show_visualize_button": true,
"text": ""
}
],
"show_when_any_parent_unlocked": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"type": "modonomicon:dense",
"mapping": {
"*": {
"type": "modonomicon:display",
"display": "minecraft:basalt"
},
"+": {
"type": "modonomicon:display",
"display": "minecraft:stone"
},
"C": {
"type": "modonomicon:block",
"block": "minecraft:chain"
},
"F": {
"type": "modonomicon:block",
"block": "minecraft:gray_stained_glass_pane"
},
"G": {
"type": "modonomicon:block",
"block": "minecraft:glass_pane"
},
"I": {
"type": "modonomicon:block",
"block": "minecraft:iron_bars"
}
},
"pattern": [
[
"_____",
"_G_F_",
"__0__",
"_I_C_",
"_____"
],
[
"*+*+*",
"+*+*+",
"*+*+*",
"+*+*+",
"*+*+*"
]
]
}
1 change: 1 addition & 0 deletions forge/src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ public net.minecraft.world.item.crafting.LegacyUpgradeRecipe f_265910_ # additio
public net.minecraft.client.gui.GuiGraphics m_286081_()V # flushIfUnmanaged
public-f net.minecraft.client.gui.components.AbstractWidget m_88315_(Lnet/minecraft/client/gui/GuiGraphics;IIF)V # render
public-f net.minecraft.client.gui.Gui f_316662_ # layeredDraw;
public net.minecraft.client.renderer.RenderStateShard f_110133_ # name
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21 2024-10-04T08:59:56.8409955 Books: modonomicon
// 1.21 2024-10-31T11:07:09.3753188 Books: modonomicon
ea82c1ec5ac99b6c53186c37a2964666b6824399 data/modonomicon/modonomicon/books/demo/book.json
9bf40644b1a94e0f93e2d4d49e6f9ed6bd942ae5 data/modonomicon/modonomicon/books/demo/categories/conditional.json
1026c22d26aacaf4cdbc863df4fb00229af152a3 data/modonomicon/modonomicon/books/demo/categories/features.json
Expand All @@ -17,7 +17,7 @@ aa468bfbbd816f8d06107ab2fecf5e278c6740ab data/modonomicon/modonomicon/books/demo
ee56ca8dcb97da78c75ef5c31b561e1e9e7c9e65 data/modonomicon/modonomicon/books/demo/entries/features/empty.json
2a948b807be3b8c919e3a1391ae4ffbba7123364 data/modonomicon/modonomicon/books/demo/entries/features/entity.json
defe203f16f628d8c88a2b7228e9c0de704b364d data/modonomicon/modonomicon/books/demo/entries/features/image.json
336f53e3e836f762a8ea5efdb4921a259b5d52b9 data/modonomicon/modonomicon/books/demo/entries/features/multiblock.json
26a65c788648651d5b79a2e9e19e6ce88479550e data/modonomicon/modonomicon/books/demo/entries/features/multiblock.json
357539b3d8a74d7bfced6fc27c1280d9b05acf3b data/modonomicon/modonomicon/books/demo/entries/features/recipe.json
99a977c14e496a823810fd889776aa6f8629fc4a data/modonomicon/modonomicon/books/demo/entries/features/redirect.json
3d02ebee99a4bfcdae31dc5bc54ee732ebbf3a1c data/modonomicon/modonomicon/books/demo/entries/features/spotlight.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// 1.21 2024-09-11T09:39:19.9789931 Multiblocks: modonomicon
// 1.21 2024-10-31T11:10:42.8838888 Multiblocks: modonomicon
d359278a8bc55267387b95977def04965a54dd17 data/modonomicon/modonomicon/multiblocks/demo_block_entity.json
9dc306d79a39ee2085be7e1384d8e39640d79e49 data/modonomicon/modonomicon/multiblocks/demo_dense.json
89b499dd4f3850c8099ad26ae3c286e95ac8cf99 data/modonomicon/modonomicon/multiblocks/demo_fluid.json
fc1e7363336d456dd0d1583fcfdaa27a8c4bf23e data/modonomicon/modonomicon/multiblocks/demo_predicate.json
fd00692e28c040e5100a022e97ea32e7e951945b data/modonomicon/modonomicon/multiblocks/demo_tag.json
866630ccfeeea8b012ceab80396939c0e944f132 data/modonomicon/modonomicon/multiblocks/demo_transparency.json
6af533f5fa171fb2cf2d27b166e16ec54b2c5c06 data/modonomicon/modonomicon/multiblocks/test_non_square.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@
"multiblock_name": "",
"show_visualize_button": true,
"text": ""
},
{
"type": "modonomicon:multiblock",
"anchor": "",
"condition": {
"type": "modonomicon:none"
},
"multiblock_id": "demo_transparency",
"multiblock_name": "",
"show_visualize_button": true,
"text": ""
}
],
"show_when_any_parent_unlocked": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"type": "modonomicon:dense",
"mapping": {
"*": {
"type": "modonomicon:display",
"display": "minecraft:basalt"
},
"+": {
"type": "modonomicon:display",
"display": "minecraft:stone"
},
"C": {
"type": "modonomicon:block",
"block": "minecraft:chain"
},
"F": {
"type": "modonomicon:block",
"block": "minecraft:gray_stained_glass_pane"
},
"G": {
"type": "modonomicon:block",
"block": "minecraft:glass_pane"
},
"I": {
"type": "modonomicon:block",
"block": "minecraft:iron_bars"
}
},
"pattern": [
[
"_____",
"_G_F_",
"__0__",
"_I_C_",
"_____"
],
[
"*+*+*",
"+*+*+",
"*+*+*",
"+*+*+",
"*+*+*"
]
]
}
3 changes: 2 additions & 1 deletion neo/src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ public net.minecraft.world.item.crafting.SmithingTrimRecipe template
public net.minecraft.world.item.crafting.LegacyUpgradeRecipe base
public net.minecraft.world.item.crafting.LegacyUpgradeRecipe addition
public net.minecraft.client.gui.GuiGraphics flushIfUnmanaged()V
public-f net.minecraft.client.gui.components.AbstractWidget render(Lnet/minecraft/client/gui/GuiGraphics;IIF)V
public-f net.minecraft.client.gui.components.AbstractWidget render(Lnet/minecraft/client/gui/GuiGraphics;IIF)V
public net.minecraft.client.renderer.RenderStateShard name

0 comments on commit c6a66d4

Please sign in to comment.