Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.21 #16

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ license.name=GPLv3
license.url=https://www.gnu.org/licenses/gpl-3.0.en.html
license.file=LICENSE

neogradle.subsystems.parchment.minecraftVersion=1.20.6
neogradle.subsystems.parchment.mappingsVersion=2024.06.16
neogradle.subsystems.parchment.minecraftVersion=1.21
neogradle.subsystems.parchment.mappingsVersion=2024.07.28

mc_version=1.20.6
mc_version_range=[1.20.6,1.21)
mc_version=1.21
mc_version_range=[1.21,1.21.1)

neo_version=20.6.119
neo_version_range=[20.6.115,21)
neo_version=21.0.143
neo_version_range=[21.0.143,21.1)

dependency.jei.version=18.0.0.65
dependency.jei.version.range=[18,19)
dependency.jei.version=19.5.2.66
dependency.jei.version.range=[19.5,20)

loader.version=[3,)
loader.version=[4,)

mc-publish.curseforge=382836
mc-publish.modrinth=ZZLWU8jS
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void clientSetup(FMLClientSetupEvent e) {
e.enqueueWork(() -> {
@SuppressWarnings("deprecation")
ItemPropertyFunction propertyFunction = (stack, world, living, seed) -> stack.getOrDefault(PotionBundles.USES, 0);
ResourceLocation uses = new ResourceLocation(PotionBundles.MODID, "uses");
ResourceLocation uses = ResourceLocation.fromNamespaceAndPath(PotionBundles.MODID, "uses");
for (DeferredHolder<Item, ?> item : PotionBundles.ITEMS.getEntries()) {
ItemProperties.register(item.get(), uses, propertyFunction);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import mezz.jei.api.constants.RecipeTypes;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.JeiPlugin;
import mezz.jei.api.constants.ModIds;
import mezz.jei.api.ingredients.subtypes.IIngredientSubtypeInterpreter;
import mezz.jei.api.registration.IRecipeRegistration;
import mezz.jei.api.registration.ISubtypeRegistration;
Expand Down Expand Up @@ -37,7 +36,7 @@
public class JEICompat implements IModPlugin {
@Override
public ResourceLocation getPluginUid() {
return new ResourceLocation(PotionBundles.MODID, PotionBundles.MODID);
return ResourceLocation.fromNamespaceAndPath(PotionBundles.MODID, PotionBundles.MODID);
}

@Override
Expand Down Expand Up @@ -74,7 +73,7 @@ private Stream<RecipeHolder<CraftingRecipe>> mapRecipes(final PotionBundleRecipe
inputs.set(maxUses, recipe.getString());
ItemStack output = PotionContents.createItemStack(bundleItem, potion);
PotionBundleUtils.setUses(output, maxUses);
ResourceLocation id = new ResourceLocation(ModIds.MINECRAFT_ID, group + "." + output.getDescriptionId() + "." + Potion.getName(Optional.of(potion), ""));
ResourceLocation id = ResourceLocation.withDefaultNamespace(group + "." + output.getDescriptionId() + "." + Potion.getName(Optional.of(potion), ""));
return new RecipeHolder<>(id, new ShapelessRecipe(group, CraftingBookCategory.EQUIPMENT, output, inputs));
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.world.inventory.CraftingContainer;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.alchemy.PotionContents;
import net.minecraft.world.item.crafting.CraftingBookCategory;
import net.minecraft.world.item.crafting.CustomRecipe;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.item.crafting.*;
import net.minecraft.world.level.Level;

import java.util.Objects;
Expand Down Expand Up @@ -51,11 +47,11 @@ public PotionBundleRecipe(Ingredient string, Item potion, AbstractPotionBundle b
}

@Override
public boolean matches(CraftingContainer inv, Level world) {
public boolean matches(CraftingInput inv, Level world) {
int potions = 0;
boolean string = false;
PotionContents potionContents = null;
for (int i = 0; i < inv.getContainerSize(); i++) {
for (int i = 0; i < inv.size(); i++) {
ItemStack is = inv.getItem(i);
if (this.string.test(is)) {
if (string) return false;
Expand All @@ -81,10 +77,10 @@ public boolean matches(CraftingContainer inv, Level world) {
}

@Override
public ItemStack assemble(CraftingContainer inv, HolderLookup.Provider provider) {
public ItemStack assemble(CraftingInput inv, HolderLookup.Provider provider) {
PotionBundleString string = null;
PotionContents potionContents = null;
for (int i = 0; i < inv.getContainerSize(); i++) {
for (int i = 0; i < inv.size(); i++) {
ItemStack is = inv.getItem(i);
if (potionContents == null && is.is(this.potion)) {
potionContents = is.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public static void testPotionBundle(GameTestHelper helper) {
MobEffectInstance customEffect = new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 20);
ItemStack bundle = potionBundle.createStack(string, Potions.WATER, List.of(customEffect), null);
assertUses(bundle, maxUses, "Uses don't use items max uses");
int duration = potionBundle.getUseDuration(bundle);
Player player = setupPlayer(helper, bundle);
int duration = potionBundle.getUseDuration(bundle, player);
GameTestSequence sequence = helper.startSequence();
for (int i = 0; i < maxUses; i++) {
int index = i + 1;
Expand Down