-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed shift-click crashing. Closes #895
- Loading branch information
Showing
8 changed files
with
74 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
common/src/main/java/toughasnails/init/ModRecipePropertySets.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/******************************************************************************* | ||
* Copyright 2024, the Glitchfiend Team. | ||
* All rights reserved. | ||
******************************************************************************/ | ||
package toughasnails.init; | ||
|
||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.crafting.RecipePropertySet; | ||
import toughasnails.core.ToughAsNails; | ||
|
||
public class ModRecipePropertySets | ||
{ | ||
public static final ResourceKey<RecipePropertySet> WATER_PURIFYING = register("water_purifying"); | ||
|
||
private static ResourceKey<RecipePropertySet> register(String name) | ||
{ | ||
return ResourceKey.create(RecipePropertySet.TYPE_KEY, ResourceLocation.fromNamespaceAndPath(ToughAsNails.MOD_ID, name)); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
common/src/main/java/toughasnails/mixin/MixinRecipeManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/******************************************************************************* | ||
* Copyright 2024, the Glitchfiend Team. | ||
* All rights reserved. | ||
******************************************************************************/ | ||
package toughasnails.mixin; | ||
|
||
import com.google.common.collect.ImmutableMap; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.world.item.crafting.Ingredient; | ||
import net.minecraft.world.item.crafting.RecipeManager; | ||
import net.minecraft.world.item.crafting.RecipePropertySet; | ||
import net.minecraft.world.item.crafting.SmithingRecipe; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import toughasnails.crafting.WaterPurifierRecipe; | ||
import toughasnails.init.ModRecipePropertySets; | ||
|
||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
@Mixin(RecipeManager.class) | ||
public class MixinRecipeManager | ||
{ | ||
@Shadow private static Map<ResourceKey<RecipePropertySet>, RecipeManager.IngredientExtractor> RECIPE_PROPERTY_SETS; | ||
|
||
@Inject(method = "<clinit>", at = @At("TAIL")) | ||
private static void onInit(CallbackInfo ci) | ||
{ | ||
RECIPE_PROPERTY_SETS = ImmutableMap.<ResourceKey<RecipePropertySet>, RecipeManager.IngredientExtractor>builder().putAll(RECIPE_PROPERTY_SETS).put(ModRecipePropertySets.WATER_PURIFYING, recipe -> recipe instanceof WaterPurifierRecipe waterPurifierRecipe ? Optional.of(Ingredient.of(waterPurifierRecipe.input().getItem())) : Optional.empty()).build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters