|
55 | 55 | import java.util.ArrayList; |
56 | 56 | import java.util.Arrays; |
57 | 57 | import java.util.Collection; |
58 | | -import java.util.HashMap; |
| 58 | +import java.util.Collections; |
59 | 59 | import java.util.List; |
60 | 60 | import java.util.Map; |
61 | 61 |
|
@@ -132,6 +132,8 @@ protected RecipeBuilder(RecipeBuilder<R> recipeBuilder) { |
132 | 132 | this.hidden = recipeBuilder.hidden; |
133 | 133 | this.category = recipeBuilder.category; |
134 | 134 | this.recipePropertyStorage = recipeBuilder.recipePropertyStorage.copy(); |
| 135 | + this.ignoreAllBuildActions = recipeBuilder.ignoreAllBuildActions; |
| 136 | + this.ignoredBuildActions = new Object2ObjectOpenHashMap<>(recipeBuilder.ignoredBuildActions); |
135 | 137 | } |
136 | 138 |
|
137 | 139 | public R cleanroom(@Nullable CleanroomType cleanroom) { |
@@ -909,9 +911,6 @@ public R ignoreBuildAction(ResourceLocation buildActionName) { |
909 | 911 | GTLog.logger.error("Recipe map {} does not contain build action {}!", recipeMap, buildActionName, |
910 | 912 | new Throwable()); |
911 | 913 | return (R) this; |
912 | | - } else if (ignoredBuildActions.containsKey(buildActionName)) { |
913 | | - GTLog.logger.error("Builder already ignores {}!", buildActionName, new Throwable()); |
914 | | - return (R) this; |
915 | 914 | } |
916 | 915 |
|
917 | 916 | ignoredBuildActions.put(buildActionName, recipeMap.getBuildActions().get(buildActionName)); |
@@ -1091,15 +1090,16 @@ public boolean ignoresAllBuildActions() { |
1091 | 1090 |
|
1092 | 1091 | /** |
1093 | 1092 | * Get all ignored build actions for the recipe map. |
1094 | | - * Will return an empty map if none are ignored. |
| 1093 | + * |
| 1094 | + * @return A map of ignored build actions. |
1095 | 1095 | */ |
1096 | 1096 | public @NotNull Map<ResourceLocation, RecipeBuildAction<R>> getIgnoredBuildActions() { |
1097 | 1097 | if (ignoreAllBuildActions) { |
1098 | 1098 | return recipeMap.getBuildActions(); |
1099 | 1099 | } |
1100 | 1100 |
|
1101 | 1101 | if (ignoredBuildActions == null) { |
1102 | | - return new HashMap<>(); |
| 1102 | + return Collections.emptyMap(); |
1103 | 1103 | } |
1104 | 1104 |
|
1105 | 1105 | return ignoredBuildActions; |
|
0 commit comments