Minecraft 1.21.4 Sword mace mod #4554
Unanswered
Kageyori
asked this question in
Mod Dev Support
Replies: 1 comment
-
|
Yeah manepear has it in his latest video and i wanna find the pack if someone made it public |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Hi, I'm trying to make a mod, where when you fall with a sword in your hand and a mace in your hotbar, the sword acts like the mace with all encantments. I'm currently having issues with the reading of the enchantements from the mace and sword, when i run the code i get the following error:
error: cannot find symbol
return stack.getEnchantments().stream()
^
symbol: method stream()
location: class ItemEnchantmentsComponent
I'm programming for version 1.21.4 with JDK 21,
this is the code i made with ChatGPT because i am a beginner pls help:
Java code:
package net.kageyori.swordmacemod;
import com.mojang.serialization.MapCodec;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.player.AttackEntityCallback;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.world.World;
import java.util.Map;
public class SwordMaceMod implements ModInitializer {
@OverRide
public void onInitialize() {
AttackEntityCallback.EVENT.register(this::onAttack);
}
}
Beta Was this translation helpful? Give feedback.
All reactions