-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '1.20.5' into Common-Tag-Refactor
- Loading branch information
Showing
66 changed files
with
1,417 additions
and
235 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
43 changes: 0 additions & 43 deletions
43
.../src/main/java/net/fabricmc/fabric/api/registry/BrewingRecipeRegistryBuilderCallback.java
This file was deleted.
Oops, something went wrong.
70 changes: 70 additions & 0 deletions
70
...v0/src/main/java/net/fabricmc/fabric/api/registry/FabricBrewingRecipeRegistryBuilder.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,70 @@ | ||
/* | ||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.fabricmc.fabric.api.registry; | ||
|
||
import net.minecraft.item.Item; | ||
import net.minecraft.potion.Potion; | ||
import net.minecraft.recipe.BrewingRecipeRegistry; | ||
import net.minecraft.recipe.Ingredient; | ||
import net.minecraft.registry.entry.RegistryEntry; | ||
import net.minecraft.resource.featuretoggle.FeatureSet; | ||
|
||
import net.fabricmc.fabric.api.event.Event; | ||
import net.fabricmc.fabric.api.event.EventFactory; | ||
|
||
/** | ||
* An extension of {@link BrewingRecipeRegistry.Builder} to support ingredients. | ||
*/ | ||
public interface FabricBrewingRecipeRegistryBuilder { | ||
/** | ||
* An event that is called when the brewing recipe registry is being built. | ||
*/ | ||
Event<FabricBrewingRecipeRegistryBuilder.BuildCallback> BUILD = EventFactory.createArrayBacked(FabricBrewingRecipeRegistryBuilder.BuildCallback.class, listeners -> builder -> { | ||
for (FabricBrewingRecipeRegistryBuilder.BuildCallback listener : listeners) { | ||
listener.build(builder); | ||
} | ||
}); | ||
|
||
default void registerItemRecipe(Item input, Ingredient ingredient, Item output) { | ||
throw new AssertionError("Must be implemented via interface injection"); | ||
} | ||
|
||
default void registerPotionRecipe(RegistryEntry<Potion> input, Ingredient ingredient, RegistryEntry<Potion> output) { | ||
throw new AssertionError("Must be implemented via interface injection"); | ||
} | ||
|
||
default void registerRecipes(Ingredient ingredient, RegistryEntry<Potion> potion) { | ||
throw new AssertionError("Must be implemented via interface injection"); | ||
} | ||
|
||
default FeatureSet getEnabledFeatures() { | ||
throw new AssertionError("Must be implemented via interface injection"); | ||
} | ||
|
||
/** | ||
* Use this event to register custom brewing recipes. | ||
*/ | ||
@FunctionalInterface | ||
interface BuildCallback { | ||
/** | ||
* Called when the brewing recipe registry is being built. | ||
* | ||
* @param builder the {@link BrewingRecipeRegistry} instance | ||
*/ | ||
void build(BrewingRecipeRegistry.Builder builder); | ||
} | ||
} |
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
56 changes: 56 additions & 0 deletions
56
fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/EnchantingContext.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,56 @@ | ||
/* | ||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.fabricmc.fabric.api.item.v1; | ||
|
||
import net.minecraft.enchantment.EnchantmentHelper; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.resource.featuretoggle.FeatureSet; | ||
import net.minecraft.util.math.random.Random; | ||
|
||
/* | ||
* There is one context for each vanilla call to Enchantment#isAcceptableItem. The reason why RANDOM_ENCHANTMENT | ||
* feels like a kitchen sink is because it corresponds to the one in EnchantmentHelper, which is shared across multiple | ||
* uses. | ||
* | ||
* This also gets in the way of adding further context (nullable Player and BlockPos have been suggested | ||
* in the past). It's not impossible to do so, but a probably a bit more brittle. | ||
*/ | ||
/** | ||
* An enum that describes the various contexts in which the game checks whether an enchantment can be applied to an item. | ||
*/ | ||
public enum EnchantingContext { | ||
/** | ||
* When generating a random enchantment for the item. This includes the enchanting table, random | ||
* mob equipment, and the {@code enchant_with_levels} loot function. | ||
* | ||
* @see EnchantmentHelper#generateEnchantments(FeatureSet, Random, ItemStack, int, boolean) | ||
*/ | ||
RANDOM_ENCHANTMENT, | ||
/** | ||
* When trying to apply an enchantment in an anvil. | ||
*/ | ||
ANVIL, | ||
/** | ||
* When using the {@code /enchant} command. | ||
*/ | ||
ENCHANT_COMMAND, | ||
/** | ||
* When randomly enchanting an item using the {@code enchant_randomly} loot function without a list of enchantments | ||
* to choose from. | ||
*/ | ||
LOOT_RANDOM_ENCHANTMENT | ||
} |
Oops, something went wrong.