From d482fbda5813f49f3466e147f44054e46afe738b Mon Sep 17 00:00:00 2001 From: cheaterpaul Date: Sat, 15 Jun 2024 14:01:19 +0200 Subject: [PATCH] update neoforge to release - add jei --- gradle.properties | 10 +++--- .../AlchemicalCauldronBlockEntity.java | 6 ++-- .../blockentity/TotemBlockEntity.java | 2 +- .../vampirism/blocks/CoffinBlock.java | 2 +- .../teamlapen/vampirism/blocks/TentBlock.java | 2 +- .../entity/player/ModPlayerEventHandler.java | 35 +++++++++++++------ .../vampirism/items/BloodBottleItem.java | 10 ++---- .../AbstractFurnaceBlockEntityAccessor.java | 2 +- .../jei/AlchemyTableRecipeCategory.java | 3 +- .../vampirism/modcompat/jei/JEIPotionMix.java | 17 ++++----- .../modcompat/jei/VampirismJEIPlugin.java | 31 +++++++++++----- .../jei/WeaponTableRecipeCategory.java | 4 +-- 12 files changed, 73 insertions(+), 51 deletions(-) diff --git a/gradle.properties b/gradle.properties index 127a4744f..95950841f 100755 --- a/gradle.properties +++ b/gradle.properties @@ -6,8 +6,8 @@ org.gradle.debug=false # forge minecraft_version=1.20.6 minecraft_version_range=[1.20.6,1.21) -forge_version=20.6.56-beta -forge_version_range=[20.6.56-beta,) +forge_version=20.6.115 +forge_version_range=[20.6.115,) loader_version_range=[1,) parchment_minecraft_version=1.20.6 parchment_mappings_version=2024.05.01 @@ -36,9 +36,9 @@ type="test" classification="test" #jei setting -include_jei=false -jei_mc_version=1.20.4 -jei_version=17.3.0.48 +include_jei=true +jei_mc_version=1.20.6 +jei_version=18.0.0.62 #guideapi setting include_guideapi=true diff --git a/src/main/java/de/teamlapen/vampirism/blockentity/AlchemicalCauldronBlockEntity.java b/src/main/java/de/teamlapen/vampirism/blockentity/AlchemicalCauldronBlockEntity.java index 5c96226fb..6433a4616 100644 --- a/src/main/java/de/teamlapen/vampirism/blockentity/AlchemicalCauldronBlockEntity.java +++ b/src/main/java/de/teamlapen/vampirism/blockentity/AlchemicalCauldronBlockEntity.java @@ -227,7 +227,7 @@ public static void serverTick(@NotNull Level level, BlockPos pos, BlockState sta if (blockEntity.isBurning() || !itemstackFuel.isEmpty() && !blockEntity.items.get(0).isEmpty() && !blockEntity.items.get(1).isEmpty()) { RecipeHolder cauldronRecipe = blockEntity.quickCheck.getRecipeFor(blockEntity, level).orElse(null); - if (cauldronRecipe != null && !blockEntity.isBurning() && ((AbstractFurnaceBlockEntityAccessor) blockEntity).invoke_canBurn(level.registryAccess(), cauldronRecipe, blockEntity.items, blockEntity.getMaxStackSize()) && blockEntity.canPlayerCook(cauldronRecipe.value())) { + if (cauldronRecipe != null && !blockEntity.isBurning() && ((AbstractFurnaceBlockEntityAccessor) blockEntity).invoke_canBurn(level.registryAccess(), cauldronRecipe, blockEntity.items, blockEntity.getMaxStackSize(), blockEntity) && blockEntity.canPlayerCook(cauldronRecipe.value())) { blockEntity.dataAccess.set(0, blockEntity.getBurnDuration(itemstackFuel)); //Set burn time blockEntity.dataAccess.set(1, blockEntity.dataAccess.get(0)); if (blockEntity.isBurning()) { @@ -244,7 +244,7 @@ public static void serverTick(@NotNull Level level, BlockPos pos, BlockState sta } } - if (cauldronRecipe != null && blockEntity.isBurning() && ((AbstractFurnaceBlockEntityAccessor) blockEntity).invoke_canBurn(level.registryAccess(), cauldronRecipe, blockEntity.items, blockEntity.getMaxStackSize()) && blockEntity.canPlayerCook(cauldronRecipe.value())) { + if (cauldronRecipe != null && blockEntity.isBurning() && ((AbstractFurnaceBlockEntityAccessor) blockEntity).invoke_canBurn(level.registryAccess(), cauldronRecipe, blockEntity.items, blockEntity.getMaxStackSize(), blockEntity) && blockEntity.canPlayerCook(cauldronRecipe.value())) { blockEntity.dataAccess.set(2, blockEntity.dataAccess.get(2) + 1); //Increase cook time if (blockEntity.dataAccess.get(2) == blockEntity.dataAccess.get(3)) { //If finished blockEntity.dataAccess.set(2, 0); @@ -303,7 +303,7 @@ private boolean canPlayerCook(@NotNull AlchemicalCauldronRecipe recipe) { * copy of AbstractFurnaceTileEntity#finishCooking(IRecipe) with modification */ private void finishCooking(RegistryAccess access, @Nullable RecipeHolder recipe) { - if (recipe != null && ((AbstractFurnaceBlockEntityAccessor) this).invoke_canBurn(access, recipe, items, getMaxStackSize()) && canPlayerCook(recipe.value())) { + if (recipe != null && ((AbstractFurnaceBlockEntityAccessor) this).invoke_canBurn(access, recipe, items, getMaxStackSize(), this) && canPlayerCook(recipe.value())) { ItemStack itemstackfluid = this.items.get(0); ItemStack itemstackingredient = this.items.get(1); ItemStack itemstack1result = recipe.value().getResultItem(access); diff --git a/src/main/java/de/teamlapen/vampirism/blockentity/TotemBlockEntity.java b/src/main/java/de/teamlapen/vampirism/blockentity/TotemBlockEntity.java index 8b98007eb..4188a4c9c 100644 --- a/src/main/java/de/teamlapen/vampirism/blockentity/TotemBlockEntity.java +++ b/src/main/java/de/teamlapen/vampirism/blockentity/TotemBlockEntity.java @@ -894,7 +894,7 @@ private boolean capturePreconditions(@Nullable IFaction faction, @NotNull BiC } VampirismVillageEvent.InitiateCapture event = new VampirismVillageEvent.InitiateCapture(this, faction); NeoForge.EVENT_BUS.post(event); - if (event.getResult().equals(Event.Result.DENY)) { + if (event.isCaptureDisallowed()) { if (event.getMessage() != null) { feedback.accept(Component.translatable(event.getMessage()), true); } diff --git a/src/main/java/de/teamlapen/vampirism/blocks/CoffinBlock.java b/src/main/java/de/teamlapen/vampirism/blocks/CoffinBlock.java index ceb122f4f..6322f673d 100644 --- a/src/main/java/de/teamlapen/vampirism/blocks/CoffinBlock.java +++ b/src/main/java/de/teamlapen/vampirism/blocks/CoffinBlock.java @@ -136,7 +136,7 @@ public VoxelShape getShape(@NotNull BlockState state, BlockGetter worldIn, Block } @Override - public boolean isBed(@NotNull BlockState state, BlockGetter world, BlockPos pos, Entity player) { + public boolean isBed(@NotNull BlockState state, BlockGetter world, BlockPos pos, LivingEntity sleeper) { return !state.getValue(CLOSED) || state.getValue(BedBlock.OCCUPIED); } diff --git a/src/main/java/de/teamlapen/vampirism/blocks/TentBlock.java b/src/main/java/de/teamlapen/vampirism/blocks/TentBlock.java index 943cc63af..c7e32b509 100644 --- a/src/main/java/de/teamlapen/vampirism/blocks/TentBlock.java +++ b/src/main/java/de/teamlapen/vampirism/blocks/TentBlock.java @@ -231,7 +231,7 @@ public void fallOn(@NotNull Level worldIn, @NotNull BlockState state, @NotNull B } @Override - public boolean isBed(BlockState state, BlockGetter world, BlockPos pos, @Nullable Entity player) { + public boolean isBed(BlockState state, BlockGetter level, BlockPos pos, LivingEntity sleeper) { return true; } diff --git a/src/main/java/de/teamlapen/vampirism/entity/player/ModPlayerEventHandler.java b/src/main/java/de/teamlapen/vampirism/entity/player/ModPlayerEventHandler.java index cfe44157b..a9370868c 100755 --- a/src/main/java/de/teamlapen/vampirism/entity/player/ModPlayerEventHandler.java +++ b/src/main/java/de/teamlapen/vampirism/entity/player/ModPlayerEventHandler.java @@ -67,6 +67,7 @@ import net.neoforged.bus.api.EventPriority; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.common.util.TriState; import net.neoforged.neoforge.event.entity.EntityEvent; import net.neoforged.neoforge.event.entity.EntityMountEvent; import net.neoforged.neoforge.event.entity.living.*; @@ -224,9 +225,9 @@ public void onBreakSpeed(PlayerEvent.@NotNull BreakSpeed event) { } @SubscribeEvent - public void onItemPickupPre(@NotNull EntityItemPickupEvent event) { - if (VampirismPlayerAttributes.get(event.getEntity()).getVampSpecial().isDBNO) { - event.setCanceled(true); + public void onItemPickupPre(@NotNull ItemEntityPickupEvent.Pre event) { + if (VampirismPlayerAttributes.get(event.getPlayer()).getVampSpecial().isDBNO) { + event.setCanPickup(TriState.FALSE); } } @@ -375,7 +376,7 @@ public void onPlayerInteract(PlayerInteractEvent.@NotNull RightClickBlock event) } } if ((bloodBottle || convert) && block instanceof BloodContainerBlock) { - event.setUseBlock(Event.Result.ALLOW); + event.setUseBlock(TriState.TRUE); } if (convert) { //Dangerous, but only solution I found so far @@ -432,12 +433,25 @@ public void onPlayerName(PlayerEvent.@NotNull NameFormat event) { } @SubscribeEvent - public void sleepTimeCheck(@NotNull SleepingTimeCheckEvent event) { - if (Helper.isVampire(event.getEntity())) { - event.getSleepingLocation().ifPresent((blockPos -> event.setResult(event.getEntity().level().getBlockState(blockPos).getBlock() instanceof CoffinBlock ? event.getEntity().level().isDay() ? Event.Result.ALLOW : Event.Result.DENY : event.getResult()))); + public void sleepTimeCheck(@NotNull CanPlayerSleepEvent event) { + if (Helper.isVampire(event.getEntity()) && event.getState().getBlock() instanceof CoffinBlock) { + if (event.getLevel().isNight() && event.getProblem() == null) { + event.setProblem(Player.BedSleepingProblem.NOT_POSSIBLE_NOW); + } else if (event.getLevel().isDay() && event.getProblem() == Player.BedSleepingProblem.NOT_POSSIBLE_NOW) { + event.setProblem(null); + } } - if (Helper.isHunter(event.getEntity())) { - event.getSleepingLocation().ifPresent((blockPos -> event.setResult(event.getEntity().getCommandSenderWorld().getBlockState(blockPos).getBlock() instanceof TentBlock ? !event.getEntity().getCommandSenderWorld().isDay() ? Event.Result.ALLOW : Event.Result.DENY : event.getResult()))); + } + + @SubscribeEvent + public void canContinueToSleep(CanContinueSleepingEvent event) { + if (Helper.isVampire(event.getEntity()) && event.getEntity().getSleepingPos().map(s -> event.getEntity().level().getBlockState(s)).map(s -> s.getBlock() instanceof CoffinBlock).orElse(false)) { + boolean day = event.getEntity().level().isDay(); + if (day && event.getProblem() == Player.BedSleepingProblem.NOT_POSSIBLE_NOW) { + event.setContinueSleeping(true); + } else if (!day) { + event.setContinueSleeping(false); + } } } @@ -502,8 +516,7 @@ public void onPlayerAttackCritical(@NotNull CriticalHitEvent event) { if (!stack.isEmpty() && stack.getItem() instanceof IFactionSlayerItem item) { IFaction faction = VampirismAPI.factionRegistry().getFaction(event.getTarget()); if (faction != null && faction.equals(item.getSlayedFaction())) { - event.setResult(Event.Result.ALLOW); - event.setDamageModifier(event.getDamageModifier() + (event.getOldDamageModifier() * (item.getDamageMultiplierForFaction(stack) - 1))); + event.setDamageMultiplier(event.getDamageMultiplier() + (event.getVanillaMultiplier() * (item.getDamageMultiplierForFaction(stack) - 1))); } } } diff --git a/src/main/java/de/teamlapen/vampirism/items/BloodBottleItem.java b/src/main/java/de/teamlapen/vampirism/items/BloodBottleItem.java index 4c763f74d..feeecce9f 100644 --- a/src/main/java/de/teamlapen/vampirism/items/BloodBottleItem.java +++ b/src/main/java/de/teamlapen/vampirism/items/BloodBottleItem.java @@ -80,17 +80,11 @@ public boolean doesSneakBypassUse(ItemStack stack, @NotNull LevelReader world, @ @Override public void generateCreativeTab(CreativeModeTab.@NotNull ItemDisplayParameters parameters, CreativeModeTab.Output output) { - for (int i = 0; i < BloodBottleItem.AMOUNT; i++) { + for (int i = 0; i <= BloodBottleItem.AMOUNT; i++) { ItemStack stack = getDefaultInstance(); stack.set(ModDataComponents.BOTTLE_BLOOD, new BottleBlood(i)); - output.accept(stack, CreativeModeTab.TabVisibility.SEARCH_TAB_ONLY); + output.accept(stack, i == 0 || i == BloodBottleItem.AMOUNT ? CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS : CreativeModeTab.TabVisibility.SEARCH_TAB_ONLY); } - ItemStack stack0 = getDefaultInstance(); - stack0.set(ModDataComponents.BOTTLE_BLOOD, BottleBlood.EMPTY); - output.accept(stack0, CreativeModeTab.TabVisibility.PARENT_TAB_ONLY); - ItemStack stack9 = getDefaultInstance(); - stack9.set(ModDataComponents.BOTTLE_BLOOD, new BottleBlood(BloodBottleItem.AMOUNT)); - output.accept(stack9, CreativeModeTab.TabVisibility.PARENT_TAB_ONLY); } @Nullable diff --git a/src/main/java/de/teamlapen/vampirism/mixin/accessor/AbstractFurnaceBlockEntityAccessor.java b/src/main/java/de/teamlapen/vampirism/mixin/accessor/AbstractFurnaceBlockEntityAccessor.java index 684a95d9f..b0bf35b61 100644 --- a/src/main/java/de/teamlapen/vampirism/mixin/accessor/AbstractFurnaceBlockEntityAccessor.java +++ b/src/main/java/de/teamlapen/vampirism/mixin/accessor/AbstractFurnaceBlockEntityAccessor.java @@ -14,7 +14,7 @@ public interface AbstractFurnaceBlockEntityAccessor { @Invoker("canBurn") - boolean invoke_canBurn(RegistryAccess registryAccess, @Nullable RecipeHolder recipe, NonNullList availableItems, int maxStackSize); + boolean invoke_canBurn(RegistryAccess registryAccess, @Nullable RecipeHolder recipe, NonNullList availableItems, int maxStackSize, AbstractFurnaceBlockEntity furnace); @Invoker("getTotalCookTime") static int getTotalCookTime(Level pLevel, AbstractFurnaceBlockEntity pBlockEntity) { diff --git a/src/main/java/de/teamlapen/vampirism/modcompat/jei/AlchemyTableRecipeCategory.java b/src/main/java/de/teamlapen/vampirism/modcompat/jei/AlchemyTableRecipeCategory.java index 0c75f980f..82ccdeb37 100644 --- a/src/main/java/de/teamlapen/vampirism/modcompat/jei/AlchemyTableRecipeCategory.java +++ b/src/main/java/de/teamlapen/vampirism/modcompat/jei/AlchemyTableRecipeCategory.java @@ -4,6 +4,7 @@ import de.teamlapen.vampirism.REFERENCE; import de.teamlapen.vampirism.api.entity.player.skills.ISkill; import de.teamlapen.vampirism.core.ModBlocks; +import de.teamlapen.vampirism.items.component.OilContent; import de.teamlapen.vampirism.recipes.AlchemyTableRecipe; import de.teamlapen.vampirism.util.OilUtils; import mezz.jei.api.constants.VanillaTypes; @@ -90,7 +91,7 @@ public void draw(@NotNull RecipeHolder holder, IRecipeSlotsV this.blazeHeat.draw(graphics, 33 - 9 - 2, 60 - 10 - 2); this.arrow.draw(graphics, 73 - 9 - 2, 57 - 10 - 2); - int color = OilUtils.getOil(RecipeUtil.getResultItem(recipe)).getColor(); + int color = OilContent.getOil(RecipeUtil.getResultItem(recipe)).value().getColor(); graphics.setColor(((color >> 16) & 0xFF) / 255f, ((color >> 8) & 0xFF) / 255f, ((color) & 0xFF) / 255f, 1F); this.pool.draw(graphics, 104 - 9 - 2, 36 - 10 - 2); graphics.setColor(1, 1, 1, 1); diff --git a/src/main/java/de/teamlapen/vampirism/modcompat/jei/JEIPotionMix.java b/src/main/java/de/teamlapen/vampirism/modcompat/jei/JEIPotionMix.java index 273403a64..ee60facaa 100644 --- a/src/main/java/de/teamlapen/vampirism/modcompat/jei/JEIPotionMix.java +++ b/src/main/java/de/teamlapen/vampirism/modcompat/jei/JEIPotionMix.java @@ -2,12 +2,13 @@ import de.teamlapen.vampirism.api.items.ExtendedPotionMix; +import net.minecraft.core.Holder; import net.minecraft.world.effect.MobEffectCategory; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.alchemy.Potion; -import net.minecraft.world.item.alchemy.PotionUtils; +import net.minecraft.world.item.alchemy.PotionContents; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -21,17 +22,17 @@ public class JEIPotionMix { List in1 = Arrays.stream(mix.reagent1.get().getItems()).map(ItemStack::copy).peek(s -> s.setCount(mix.reagent1Count)).filter(s -> !s.isEmpty()).collect(Collectors.toList()); List in2 = Arrays.stream(mix.reagent2.get().getItems()).map(ItemStack::copy).peek(s -> s.setCount(mix.reagent2Count)).filter(s -> !s.isEmpty()).collect(Collectors.toList()); List recipes = new ArrayList<>(3); - recipes.add(build(mix, Items.POTION, mix.input.get(), mix.output.get(), in1, in2)); - if (mix.output.get().getEffects().stream().noneMatch(s -> s.getEffect().getCategory() != MobEffectCategory.HARMFUL)) { - recipes.add(build(mix, Items.LINGERING_POTION, mix.input.get(), mix.output.get(), in1, in2)); - recipes.add(build(mix, Items.SPLASH_POTION, mix.input.get(), mix.output.get(), in1, in2)); + recipes.add(build(mix, Items.POTION, mix.input, mix.output, in1, in2)); + if (mix.output.value().getEffects().stream().noneMatch(s -> s.getEffect().value().getCategory() != MobEffectCategory.HARMFUL)) { + recipes.add(build(mix, Items.LINGERING_POTION, mix.input, mix.output, in1, in2)); + recipes.add(build(mix, Items.SPLASH_POTION, mix.input, mix.output, in1, in2)); } return recipes; } - private static @NotNull JEIPotionMix build(ExtendedPotionMix mix, Item base, @NotNull Potion in, @NotNull Potion out, List in1, List in2) { - ItemStack potionIn = PotionUtils.setPotion(new ItemStack(base), in); - ItemStack potionOut = PotionUtils.setPotion(new ItemStack(base), out); + private static @NotNull JEIPotionMix build(ExtendedPotionMix mix, Item base, @NotNull Holder in, @NotNull Holder out, List in1, List in2) { + ItemStack potionIn = PotionContents.createItemStack(base, in); + ItemStack potionOut = PotionContents.createItemStack(base, out); return new JEIPotionMix(mix, potionIn, in1, in2, potionOut); } diff --git a/src/main/java/de/teamlapen/vampirism/modcompat/jei/VampirismJEIPlugin.java b/src/main/java/de/teamlapen/vampirism/modcompat/jei/VampirismJEIPlugin.java index e3de864df..ad20b1561 100755 --- a/src/main/java/de/teamlapen/vampirism/modcompat/jei/VampirismJEIPlugin.java +++ b/src/main/java/de/teamlapen/vampirism/modcompat/jei/VampirismJEIPlugin.java @@ -9,6 +9,7 @@ import de.teamlapen.vampirism.api.items.IFactionExclusiveItem; import de.teamlapen.vampirism.api.items.IWeaponTableRecipe; import de.teamlapen.vampirism.api.items.oil.IApplicableOil; +import de.teamlapen.vampirism.api.items.oil.IOil; import de.teamlapen.vampirism.client.gui.screens.AlchemicalCauldronScreen; import de.teamlapen.vampirism.client.gui.screens.AlchemyTableScreen; import de.teamlapen.vampirism.client.gui.screens.PotionTableScreen; @@ -19,6 +20,7 @@ import de.teamlapen.vampirism.inventory.WeaponTableMenu; import de.teamlapen.vampirism.items.BlessableItem; import de.teamlapen.vampirism.items.component.AppliedOilContent; +import de.teamlapen.vampirism.items.component.BottleBlood; import de.teamlapen.vampirism.items.component.OilContent; import de.teamlapen.vampirism.recipes.AlchemicalCauldronRecipe; import de.teamlapen.vampirism.recipes.AlchemyTableRecipe; @@ -30,6 +32,7 @@ import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.ingredients.subtypes.IIngredientSubtypeInterpreter; import mezz.jei.api.ingredients.subtypes.UidContext; +import mezz.jei.api.recipe.RecipeType; import mezz.jei.api.recipe.vanilla.IJeiAnvilRecipe; import mezz.jei.api.recipe.vanilla.IVanillaRecipeFactory; import mezz.jei.api.registration.*; @@ -40,6 +43,7 @@ import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -105,6 +109,7 @@ public void registerRecipeTransferHandlers(@NotNull IRecipeTransferRegistration @Override public void registerItemSubtypes(@NotNull ISubtypeRegistration registration) { registration.registerSubtypeInterpreter(ModItems.OIL_BOTTLE.get(), OilNBT.INSTANCE); + registration.registerSubtypeInterpreter(ModItems.BLOOD_BOTTLE.get(), BloodNBT.INSTANCE); } private static class OilNBT implements IIngredientSubtypeInterpreter { @@ -114,12 +119,20 @@ private OilNBT() { } @Override - public @NotNull String apply(@NotNull ItemStack itemStack, UidContext context) { - CompoundTag nbtTagCompound = itemStack.getTag(); - if (nbtTagCompound == null || nbtTagCompound.isEmpty()) { - return IIngredientSubtypeInterpreter.NONE; - } - return RegUtil.id(OilUtils.getOil(itemStack)).toString(); + public @NotNull String apply(@NotNull ItemStack itemStack, @NotNull UidContext context) { + return Optional.ofNullable(itemStack.get(ModDataComponents.OIL)).map(OilContent::oil).flatMap(Holder::unwrapKey).map(ResourceKey::location).map(ResourceLocation::toString).orElse(IIngredientSubtypeInterpreter.NONE); + } + } + + private static class BloodNBT implements IIngredientSubtypeInterpreter { + public static final BloodNBT INSTANCE = new BloodNBT(); + + private BloodNBT() { + } + + @Override + public @NotNull String apply(@NotNull ItemStack itemStack, @NotNull UidContext context) { + return Optional.ofNullable(itemStack.get(ModDataComponents.BOTTLE_BLOOD)).map(BottleBlood::blood).map(Object::toString).orElse(IIngredientSubtypeInterpreter.NONE); } } @@ -148,9 +161,9 @@ public void registerVanillaCategoryExtensions(@NotNull IVanillaCategoryExtension Map> items = Maps.newHashMap(); Ingredient ironIngredient = Tiers.IRON.getRepairIngredient(); items.put(ironIngredient, Lists.newArrayList(ModItems.HUNTER_AXE_NORMAL.get(), ModItems.HUNTER_AXE_ENHANCED.get(), ModItems.HUNTER_AXE_ULTIMATE.get(), ModItems.BASIC_TECH_CROSSBOW.get(), ModItems.ENHANCED_TECH_CROSSBOW.get(), ModItems.HUNTER_COAT_CHEST_NORMAL.get(), ModItems.HUNTER_COAT_CHEST_ENHANCED.get(), ModItems.HUNTER_COAT_CHEST_ULTIMATE.get(), ModItems.HUNTER_COAT_HEAD_NORMAL.get(), ModItems.HUNTER_COAT_HEAD_ENHANCED.get(), ModItems.HUNTER_COAT_HEAD_ULTIMATE.get(), ModItems.HUNTER_COAT_LEGS_NORMAL.get(), ModItems.HUNTER_COAT_LEGS_ENHANCED.get(), ModItems.HUNTER_COAT_LEGS_ULTIMATE.get(), ModItems.HUNTER_COAT_FEET_NORMAL.get(), ModItems.HUNTER_COAT_FEET_ENHANCED.get(), ModItems.HUNTER_COAT_FEET_ULTIMATE.get())); - Ingredient stringIngredient = Ingredient.of(Tags.Items.STRING); + Ingredient stringIngredient = Ingredient.of(Tags.Items.STRINGS); items.put(stringIngredient, Lists.newArrayList(ModItems.BASIC_CROSSBOW.get(), ModItems.BASIC_DOUBLE_CROSSBOW.get(), ModItems.ENHANCED_CROSSBOW.get(), ModItems.ENHANCED_DOUBLE_CROSSBOW.get())); - Ingredient leather = Ingredient.of(Tags.Items.LEATHER); + Ingredient leather = Ingredient.of(Tags.Items.LEATHERS); items.put(leather, Lists.newArrayList(ModItems.ARMOR_OF_SWIFTNESS_CHEST_NORMAL.get(), ModItems.ARMOR_OF_SWIFTNESS_CHEST_ENHANCED.get(), ModItems.ARMOR_OF_SWIFTNESS_CHEST_ULTIMATE.get(), ModItems.ARMOR_OF_SWIFTNESS_HEAD_NORMAL.get(), ModItems.ARMOR_OF_SWIFTNESS_HEAD_ENHANCED.get(), ModItems.ARMOR_OF_SWIFTNESS_HEAD_ULTIMATE.get(), ModItems.ARMOR_OF_SWIFTNESS_LEGS_NORMAL.get(), ModItems.ARMOR_OF_SWIFTNESS_LEGS_ENHANCED.get(), ModItems.ARMOR_OF_SWIFTNESS_LEGS_ULTIMATE.get(), ModItems.ARMOR_OF_SWIFTNESS_FEET_NORMAL.get(), ModItems.ARMOR_OF_SWIFTNESS_FEET_ENHANCED.get(), ModItems.ARMOR_OF_SWIFTNESS_FEET_ULTIMATE.get())); Ingredient bloodIngot = Ingredient.of(ModItems.BLOOD_INFUSED_IRON_INGOT.get()); items.put(bloodIngot, Lists.newArrayList(ModItems.HEART_SEEKER_NORMAL.get(), ModItems.HEART_STRIKER_NORMAL.get())); @@ -193,7 +206,7 @@ public void registerVanillaCategoryExtensions(@NotNull IVanillaCategoryExtension .map(Item::getDefaultInstance) .filter(item -> (!(item.getItem() instanceof IFactionExclusiveItem) || ((IFactionExclusiveItem) item.getItem()).getExclusiveFaction(item) == VReference.HUNTER_FACTION)) .filter(item -> oil.value().canBeApplied(item)) - .map(stack -> new RecipeHolder(new ResourceLocation(REFERENCE.MODID, (oil.unwrapKey().get().toString() + RegUtil.id(stack.getItem())).replace(':', '_')), new ShapelessRecipe( "", CraftingBookCategory.EQUIPMENT, AppliedOilContent.apply(stack.copy(), oil), NonNullList.of(Ingredient.EMPTY, Ingredient.of(stack), Ingredient.of(OilContent.createItemStack(ModItems.OIL_BOTTLE.get(), oil))))))).toList(); + .map(stack -> new RecipeHolder(new ResourceLocation(REFERENCE.MODID, (oil.unwrapKey().orElseThrow().location().toString() + RegUtil.id(stack.getItem())).replace(':', '_')), new ShapelessRecipe( "", CraftingBookCategory.EQUIPMENT, AppliedOilContent.apply(stack.copy(), oil), NonNullList.of(Ingredient.EMPTY, Ingredient.of(stack), Ingredient.of(OilContent.createItemStack(ModItems.OIL_BOTTLE.get(), oil))))))).toList(); } private @NotNull List> getCleanOilRecipes(RegistryAccess registryAccess) { diff --git a/src/main/java/de/teamlapen/vampirism/modcompat/jei/WeaponTableRecipeCategory.java b/src/main/java/de/teamlapen/vampirism/modcompat/jei/WeaponTableRecipeCategory.java index d6780639b..0c32aa153 100644 --- a/src/main/java/de/teamlapen/vampirism/modcompat/jei/WeaponTableRecipeCategory.java +++ b/src/main/java/de/teamlapen/vampirism/modcompat/jei/WeaponTableRecipeCategory.java @@ -136,8 +136,8 @@ public void setRecipe(IRecipeLayoutBuilder builder, RecipeHolder shaped ? shaped.getRecipeHeight() : 4; - int width = recipe instanceof IShapedRecipe shaped ? shaped.getRecipeWidth() : 4; + int height = recipe instanceof IShapedRecipe shaped ? shaped.getHeight() : 4; + int width = recipe instanceof IShapedRecipe shaped ? shaped.getWidth() : 4; for (int i = 0; i < inputs.size(); i++) { int index = getCraftingIndex(i, width, height);