Skip to content

Commit d9622f9

Browse files
Ore Maceration Changes (#4020)
Co-authored-by: Ghostipedia / Caitlynn <46772882+Ghostipedia@users.noreply.github.com>
1 parent a58e051 commit d9622f9

File tree

6 files changed

+28
-51
lines changed

6 files changed

+28
-51
lines changed

src/main/java/com/gregtechceu/gtceu/common/data/GTMaterials.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public static void init() {
184184

185185
for (TagPrefix prefix : ORES.keySet()) {
186186
TagPrefix.OreType oreType = ORES.get(prefix);
187-
if (oreType.shouldDropAsItem() && oreType.material() != null) {
187+
if (oreType.material() != null) {
188188
prefix.addSecondaryMaterial(new MaterialStack(oreType.material().get(), dust.materialAmount()));
189189
}
190190
}

src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/MaceratorLogic.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@
2121
import org.jetbrains.annotations.NotNull;
2222
import org.jetbrains.annotations.Nullable;
2323

24-
import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.dust;
25-
import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.dustSmall;
26-
import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.dustTiny;
27-
import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.turbineBlade;
24+
import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*;
2825
import static com.gregtechceu.gtceu.common.data.GTRecipeCategories.MACERATOR_RECYCLING;
2926
import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.MACERATOR_RECIPES;
3027

@@ -46,7 +43,7 @@ public enum MaceratorLogic implements GTRecipeType.ICustomRecipeLogic {
4643
return null;
4744
}
4845

49-
private @Nullable GTRecipe search(ItemStack stack) {
46+
public @Nullable GTRecipe search(ItemStack stack) {
5047
var turbineBehaviour = TurbineRotorBehaviour.getBehaviour(stack);
5148
if (turbineBehaviour != null) {
5249
float durability = 1.f - (float) turbineBehaviour.getPartDamage(stack) /

src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,13 +370,18 @@ protected boolean doPostProcessing(NonNullList<ItemStack> blockDrops, BlockState
370370

371371
var matches = machine.getRecipeType().searchRecipe(this, r -> RecipeHelper.matchContents(this, r).isSuccess());
372372

373+
GTRecipe recipe = null; // attempt ore block that has a static gt recipe
373374
while (matches.hasNext()) {
374375
GTRecipe match = matches.next();
375376
if (match == null) continue;
377+
recipe = match;
378+
break;
379+
}
376380

377-
long eut = match.getInputEUt().getTotalEU();
381+
if (recipe != null) {
382+
long eut = recipe.getInputEUt().getTotalEU();
378383
if (GTUtil.getTierByVoltage(eut) <= getVoltageTier()) {
379-
if (RecipeHelper.handleRecipeIO(this, match, IO.OUT, this.chanceCaches).isSuccess()) {
384+
if (RecipeHelper.handleRecipeIO(this, recipe, IO.OUT, this.chanceCaches).isSuccess()) {
380385
blockDrops.clear();
381386
var result = new ArrayList<ItemStack>();
382387
for (int i = 0; i < outputItemHandler.storage.getSlots(); ++i) {

src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,6 @@ public static class WorldGenConfigs {
361361
@Configurable.DecimalRange(min = 0f, max = 1f)
362362
public float rubberTreeSpawnChance = 0.5f;
363363

364-
@Configurable
365-
@Configurable.Comment({ "Should all Stone Types drop unique Ore Item Blocks?",
366-
"Default: false (meaning only Stone, Netherrack, and Endstone)" })
367-
public boolean allUniqueStoneTypes = false;
368-
369364
@Configurable
370365
@Configurable.Comment({ "Should Sand-like ores fall?", "This includes gravel, sand, and red sand ores.",
371366
"Default: false (no falling ores)" })

src/main/java/com/gregtechceu/gtceu/core/MixinHelpers.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,6 @@ public static void generateGTDynamicLoot(Map<ResourceLocation, LootTable> lootTa
269269
"blocks/" + blockEntry.getId().getPath());
270270
Block block = blockEntry.get();
271271

272-
if (!type.shouldDropAsItem() && !ConfigHolder.INSTANCE.worldgen.allUniqueStoneTypes) {
273-
TagPrefix orePrefix = type.isDoubleDrops() ? TagPrefix.oreNetherrack : TagPrefix.ore;
274-
block = ChemicalHelper.getBlock(orePrefix, material);
275-
}
276-
277272
ItemStack dropItem = ChemicalHelper.get(TagPrefix.rawOre, material);
278273
if (dropItem.isEmpty()) dropItem = ChemicalHelper.get(TagPrefix.gem, material);
279274
if (dropItem.isEmpty()) dropItem = ChemicalHelper.get(TagPrefix.dust, material);
@@ -284,8 +279,8 @@ public static void generateGTDynamicLoot(Map<ResourceLocation, LootTable> lootTa
284279
LootItem.lootTableItem(dropItem.getItem())
285280
.apply(SetItemCountFunction
286281
.setCount(ConstantValue.exactly(oreMultiplier)))));
287-
// .apply(ApplyBonusCount.addOreBonusCount(Enchantments.BLOCK_FORTUNE)))); //disable fortune for
288-
// balance reasons. (for now, until we can think of a better solution.)
282+
// disable fortune for balance reasons. (for now, until we can think of a better solution.)
283+
// .apply(ApplyBonusCount.addOreBonusCount(Enchantments.BLOCK_FORTUNE))));
289284

290285
LootPool.Builder pool = LootPool.lootPool();
291286
boolean isEmpty = true;
@@ -295,7 +290,6 @@ public static void generateGTDynamicLoot(Map<ResourceLocation, LootTable> lootTa
295290
pool.add(LootItem.lootTableItem(dustStack.getItem())
296291
.when(BlockLootSubProvider.HAS_NO_SILK_TOUCH)
297292
.apply(SetItemCountFunction.setCount(UniformGenerator.between(0, 1)))
298-
.apply(ApplyBonusCount.addUniformBonusCount(Enchantments.BLOCK_FORTUNE))
299293
.apply(LimitCount.limitCount(IntRange.range(0, 2)))
300294
.apply(ApplyExplosionDecay.explosionDecay()));
301295
isEmpty = false;

src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
import net.minecraft.tags.TagKey;
2020
import net.minecraft.world.item.Item;
2121
import net.minecraft.world.item.ItemStack;
22-
import net.minecraft.world.item.crafting.Ingredient;
23-
import net.minecraftforge.common.crafting.IntersectionIngredient;
2422

2523
import it.unimi.dsi.fastutil.objects.ObjectIntPair;
2624
import org.jetbrains.annotations.NotNull;
@@ -46,9 +44,7 @@ public static void run(@NotNull Consumer<FinishedRecipe> provider, @NotNull Mate
4644
}
4745

4846
for (TagPrefix ore : ORES.keySet()) {
49-
if (ConfigHolder.INSTANCE.worldgen.allUniqueStoneTypes || ORES.get(ore).shouldDropAsItem()) {
50-
processOre(provider, ore, property, material);
51-
}
47+
processOre(provider, ore, property, material);
5248
}
5349

5450
processRawOre(provider, property, material);
@@ -81,6 +77,8 @@ private static void processOre(@NotNull Consumer<FinishedRecipe> provider, @NotN
8177
return;
8278
}
8379

80+
var inputStack = ChemicalHelper.get(orePrefix, material);
81+
8482
Material byproductMaterial = property.getOreByProduct(0, material);
8583
ItemStack byproductStack = ChemicalHelper.get(gem, byproductMaterial);
8684
if (byproductStack.isEmpty()) {
@@ -106,29 +104,28 @@ private static void processOre(@NotNull Consumer<FinishedRecipe> provider, @NotN
106104

107105
String prefixString = orePrefix == ore ? "" : orePrefix.name + "_";
108106
if (!crushedStack.isEmpty()) {
107+
int crushedCount = property.getOreMultiplier() * oreTypeMultiplier;
109108
GTRecipeBuilder builder = FORGE_HAMMER_RECIPES
110109
.recipeBuilder("hammer_" + prefixString + material.getName() + "_ore_to_crushed_ore")
111-
.inputItems(IntersectionIngredient.of(Ingredient.of(orePrefix.getItemTags(material)[0]),
112-
Ingredient.of(orePrefix.getItemParentTags()[0])))
113-
.category(GTRecipeCategories.ORE_FORGING)
114-
.duration(10).EUt(16);
110+
.inputItems(inputStack)
111+
.EUt(16)
112+
.duration(10)
113+
.category(GTRecipeCategories.ORE_FORGING);
115114
if (material.hasProperty(PropertyKey.GEM) && !ChemicalHelper.get(gem, material).isEmpty()) {
116-
builder.outputItems(ChemicalHelper.get(gem, material)
117-
.copyWithCount(property.getOreMultiplier() * oreTypeMultiplier));
115+
builder.outputItems(ChemicalHelper.get(gem, material).copyWithCount(crushedCount));
118116
} else {
119-
builder.outputItems(crushedStack.copyWithCount(property.getOreMultiplier() * oreTypeMultiplier));
117+
builder.outputItems(crushedStack.copyWithCount(crushedCount));
120118
}
121119
builder.save(provider);
122120

123121
builder = MACERATOR_RECIPES
124122
.recipeBuilder("macerate_" + prefixString + material.getName() + "_ore_to_crushed_ore")
125-
.inputItems(IntersectionIngredient.of(Ingredient.of(orePrefix.getItemTags(material)[0]),
126-
Ingredient.of(orePrefix.getItemParentTags()[0])))
127-
.outputItems(crushedStack.copyWithCount(property.getOreMultiplier() * 2 * oreTypeMultiplier))
123+
.inputItems(inputStack)
124+
.outputItems(crushedStack.copyWithCount(crushedCount * 2))
128125
.chancedOutput(byproductStack, 1400, 0)
129126
.EUt(2)
130-
.category(GTRecipeCategories.ORE_CRUSHING)
131-
.duration(400);
127+
.duration(400)
128+
.category(GTRecipeCategories.ORE_CRUSHING);
132129

133130
for (MaterialStack secondaryMaterial : orePrefix.secondaryMaterials()) {
134131
if (secondaryMaterial.material().hasProperty(PropertyKey.DUST)) {
@@ -144,14 +141,10 @@ private static void processOre(@NotNull Consumer<FinishedRecipe> provider, @NotN
144141
if (!ingotStack.isEmpty() && doesMaterialUseNormalFurnace(smeltingMaterial) && !orePrefix.isIgnored(material)) {
145142
float xp = Math.round(((1 + oreTypeMultiplier * 0.5f) * 0.5f - 0.05f) * 10f) / 10f;
146143
VanillaRecipeHelper.addSmeltingRecipe(provider,
147-
"smelt_" + prefixString + material.getName() + "_ore_to_ingot",
148-
IntersectionIngredient.of(Ingredient.of(orePrefix.getItemTags(material)[0]),
149-
Ingredient.of(orePrefix.getItemParentTags()[0])),
144+
"smelt_" + prefixString + material.getName() + "_ore_to_ingot", inputStack,
150145
ingotStack, xp);
151146
VanillaRecipeHelper.addBlastingRecipe(provider,
152-
"smelt_" + prefixString + material.getName() + "_ore_to_ingot",
153-
IntersectionIngredient.of(Ingredient.of(orePrefix.getItemTags(material)[0]),
154-
Ingredient.of(orePrefix.getItemParentTags()[0])),
147+
"smelt_" + prefixString + material.getName() + "_ore_to_ingot", inputStack,
155148
ingotStack, xp);
156149
}
157150
}
@@ -207,13 +200,6 @@ private static void processRawOre(@NotNull Consumer<FinishedRecipe> provider, @N
207200
.category(GTRecipeCategories.ORE_CRUSHING)
208201
.duration(400);
209202

210-
for (MaterialStack secondaryMaterial : ore.secondaryMaterials()) {
211-
if (secondaryMaterial.material().hasProperty(PropertyKey.DUST)) {
212-
ItemStack dustStack = ChemicalHelper.getGem(secondaryMaterial);
213-
builder.chancedOutput(dustStack, 6700, 0);
214-
}
215-
}
216-
217203
builder.save(provider);
218204
}
219205

0 commit comments

Comments
 (0)