-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Fabric api version and added API features
- Loading branch information
Showing
70 changed files
with
1,923 additions
and
473 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
Binary file not shown.
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
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
57 changes: 57 additions & 0 deletions
57
remappedSrc/cutefox/betterenchanting/Util/BetterEnchantingApi.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,57 @@ | ||
package cutefox.betterenchanting.Util; | ||
|
||
import cutefox.betterenchanting.datagen.ModEnchantIngredientMap; | ||
import net.minecraft.enchantment.Enchantment; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.registry.Registry; | ||
import net.minecraft.registry.RegistryKeys; | ||
import net.minecraft.util.Identifier; | ||
|
||
import java.util.List; | ||
|
||
public class BetterEnchantingApi { | ||
|
||
/** | ||
* Add the ingredients for the enchantment of the identifier in parameters | ||
* If possible, prefer the {@link #addEnchantmentIngredient(Enchantment, List)} of this call. | ||
* @param enchantmentId The Identifier of the enchantment | ||
* @param ingredients A list of the ingredients for the enchantment, ordered by level. (so first entry is for Enchantment I, then Enchantment II etc.) | ||
* @return True if enchantment is found and successfully added to the map. False otherwise. | ||
*/ | ||
public static boolean addEnchantmentIngredient(Identifier enchantmentId, List<Item> ingredients){ | ||
Registry<Enchantment> enchantRegistry = Utils.getRegistryManager().get(RegistryKeys.ENCHANTMENT); | ||
Enchantment enchantment = enchantRegistry.get(enchantmentId); | ||
|
||
return addEnchantmentIngredient(enchantment, ingredients); | ||
|
||
} | ||
|
||
/** | ||
* Add ingredients for enchantment of the enchantments of "enchantmentId". | ||
* If possible, prefer the {@link #addEnchantmentIngredient(Enchantment, List)} of this call. | ||
* @param enchantmentId The enchantment identifier as a String (includind namespace. Ex : "minecraft:smite") | ||
* @param ingredients | ||
* @return | ||
*/ | ||
public static boolean addEnchantmentIngredient(String enchantmentId, List<Item> ingredients){ | ||
|
||
Identifier enchantId = Identifier.of(enchantmentId); | ||
return addEnchantmentIngredient(enchantId, ingredients); | ||
} | ||
|
||
/** | ||
* Add the ingredients for the enchantment of the identifier in parameters. | ||
* This is the preferred method as it's the more robust and error-free one. | ||
* @param enchantment The Enchantment to be added | ||
* @param ingredients A list of the ingredients for the enchantment, ordered by level. (so first entry is for Enchantment I, then Enchantment II etc.) | ||
* @return True if enchantment is found and successfully added to the map. False otherwise. | ||
*/ | ||
public static boolean addEnchantmentIngredient(Enchantment enchantment, List<Item> ingredients){ | ||
|
||
if(enchantment == null) | ||
return false; | ||
|
||
return ModEnchantIngredientMap.addEnchantmentIngredient(enchantment,ingredients); | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...enchanting/BetterEnchantingConstants.java → ...nting/Util/BetterEnchantingConstants.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package cutefox.betterenchanting; | ||
package cutefox.betterenchanting.Util; | ||
|
||
import net.minecraft.util.Identifier; | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...nting/EnchantingIngredientMapPayload.java → .../Util/EnchantingIngredientMapPayload.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package cutefox.betterenchanting.Util; | ||
|
||
import net.minecraft.registry.DynamicRegistryManager; | ||
import net.minecraft.util.Identifier; | ||
|
||
public class Utils { | ||
|
||
private static DynamicRegistryManager registryManager; | ||
|
||
public static Identifier id(String path) { | ||
return Identifier.of("betterenchanting", path); | ||
} | ||
|
||
public static Identifier id() { | ||
return Identifier.of("betterenchanting"); | ||
} | ||
|
||
|
||
public static DynamicRegistryManager getRegistryManager() { | ||
return registryManager; | ||
} | ||
|
||
public static void setRegistryManager(DynamicRegistryManager registryManager) { | ||
Utils.registryManager = registryManager; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.