Skip to content

Commit 3b7ff53

Browse files
committed
Fix utils
1 parent 4ea72ae commit 3b7ff53

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/main/resources/forge-1.15.2/utils/mcelements.ftl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,28 @@
3535
<#function toBlockPos x y z>
3636
<#return "new BlockPos(" + opt.removeParentheses(x) + "," + opt.removeParentheses(y) + "," + opt.removeParentheses(z) +")">
3737
</#function>
38+
39+
<#function toPlacedFeature featureType featureConfig placement="">
40+
<#local placementPattern = r'\$([^$]+)\$'>
41+
<#local placementMatches = placement?matches(placementPattern)>
42+
<#local hasHardcodedElements = (placementMatches?size > 0)>
43+
<#local nonHardcodedElements = placement>
44+
45+
<#if hasHardcodedElements>
46+
<#local nonHardcodedElements = placement?replace(placementPattern, "", "r")>
47+
</#if>
48+
49+
<#if featureType == "placed_feature_inline">
50+
<#return featureConfig>
51+
<#else>
52+
<#if featureType == "configured_feature_reference" && placement == "">
53+
<#return featureConfig>
54+
<#elseif featureType == "configured_feature_reference">
55+
<#return featureConfig + nonHardcodedElements>
56+
<#elseif placement == "">
57+
<#return generator.map(featureType, "features", 3) + '.withConfiguration(' + featureConfig + ')'>
58+
<#else>
59+
<#return generator.map(featureType, "features", 3) + '.withConfiguration(' + featureConfig + ')' + nonHardcodedElements>
60+
</#if>
61+
</#if>
62+
</#function>

src/main/resources/forge-1.15.2/utils/mcitems.ftl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,10 @@
370370
</#if>
371371
</#function>
372372

373+
<#function toStateProvidertoFeatureState block>
374+
<#return toFeatureState(mappedBlockToBlockStateProvider(block))>
375+
</#function>
376+
373377
<#function toStatetoFeatureState block>
374378
<#return toFeatureState(mappedBlockToBlockStateCode(block))>
375379
</#function>

0 commit comments

Comments
 (0)