
HeidFanatic
Members-
Posts
10 -
Joined
-
Last visited
HeidFanatic's Achievements

Tree Puncher (2/8)
0
Reputation
-
I wrote code to remove effect from player suck as blindness under certain situcation: @SubscribeEvent public static void shadowbornEnchantmentEvent(TickEvent.PlayerTickEvent event){ if(!event.player.world.isRemote()){ if(event.player.isPotionActive(Effects.BLINDNESS)){ if(event.player.world.getLight(new BlockPos(event.player.getPosition()))>=5){ if(PlayerUtil.isPlayerArmorEnchanted(event.player,EnchantmentRegistry.shadowborn_enchantment.get())){ event.player.removeActivePotionEffect(Effects.BLINDNESS); } } } if(event.player.world.getLight(new BlockPos(event.player.getPosition()))<=5){ if(PlayerUtil.isPlayerArmorEnchanted(event.player,EnchantmentRegistry.shadowborn_enchantment.get())){ if(!event.player.isPotionActive(Effects.NIGHT_VISION)){ event.player.addPotionEffect(new EffectInstance(Effects.NIGHT_VISION,1200)); } } } } } I think this thing is purely logic-thing so i run it on !world.isRemote, the logic server-side. But in game(Client), the blindness effect has never been removed. I checked the debug panel and it's said the the effect has been removed in server-side. SO is it a bug or I wrote code wrongly? If it's a bug how can I fix or bypass it? Thanks so much!
-
Hello. I've registered an enchantment which can be applied to sword and axe: public class CustomEnchantment extends Enchantment{ public CustomEnchantment(Rarity p_i46731_1_) { super(p_i46731_1_,EnchantmentType.create("AXE_AND_SWORD", (item)->(item instanceof SwordItem || item instanceof AxeItem)), new EquipmentSlotType[]{EquipmentSlotType.MAINHAND}); } } But it doesn't show up in either Tool Tab or BattleGear Tab like other enchantment. The only way to find it in creative mode is to search it via searchbar. How can I fix it? Thank you so much!
-
[Solved][1.16.5]Enchantment Registry Problem
HeidFanatic replied to HeidFanatic's topic in Modder Support
Problem Solved. I've checked other people's code: package x.x.flowingagony.registry; import love.marblegate.flowingagony.enchantment.ShadowbornEnchantment; import net.minecraft.enchantment.Enchantment; import net.minecraft.inventory.EquipmentSlotType; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; public class EnchantmentRegistry { private static final EquipmentSlotType[] ARMOR_SLOTS = new EquipmentSlotType[]{EquipmentSlotType.HEAD, EquipmentSlotType.CHEST, EquipmentSlotType.LEGS, EquipmentSlotType.FEET}; public static final DeferredRegister<Enchantment> ENCHANTMENT = DeferredRegister.create(ForgeRegistries.ENCHANTMENTS, "flowingagony"); public static final RegistryObject<Enchantment> shadowborn_enchantment = ENCHANTMENT.register("shadowborn", () -> new ShadowbornEnchantment(Enchantment.Rarity.VERY_RARE, ARMOR_SLOTS)); } This code works! -
Ok, I made a new enchantment and tried to register it. But the IDE told me "Inferred type 'I' for type parameter 'I' is not within its bound; should extend 'net.minecraft.enchantment.Enchantment'". The question is: I've already "extends Enchantment" in my custom enchantment code. What is wrong with my code or registry? Really Grateful for helping! My Custom Enchantment Code: package x.x.enchantment; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentType; import net.minecraft.inventory.EquipmentSlotType; public class ShadowbornEnchantment extends Enchantment { public ShadowbornEnchantment(Rarity p_i46731_1_, EquipmentSlotType[] p_i46731_3_) { super(p_i46731_1_, EnchantmentType.ARMOR_HEAD, p_i46731_3_); } public int getMinEnchantability(int p_77321_1_) { return 10; } public int getMaxEnchantability(int p_223551_1_) { return super.getMinEnchantability(p_223551_1_) + 50; } public int getMaxLevel() { return 1; } } My register Code: package love.marblegate.flowingagony.registry; import love.x.x.enchantment.ShadowbornEnchantment; import net.minecraft.enchantment.Enchantment; import net.minecraft.inventory.EquipmentSlotType; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; public class EnchantmentRegistry { private static final EquipmentSlotType[] ARMOR_SLOTS = new EquipmentSlotType[]{EquipmentSlotType.HEAD, EquipmentSlotType.CHEST, EquipmentSlotType.LEGS, EquipmentSlotType.FEET}; public static final DeferredRegister<Enchantment> ENCHANTMENT = DeferredRegister.create(ForgeRegistries.ENCHANTMENTS, "flowingagony"); public static final RegistryObject<Enchantment> shadowborn_enchantment = ENCHANTMENT.register("shadowborn", new ShadowbornEnchantment(Enchantment.Rarity.VERY_RARE, ARMOR_SLOTS)); }
-
I checked it for several time including repeatedly reconnecting. I'm sure that the debug.log stop logging at the exact moment this sentence show up: [Netty Client IO #8/INFO] [net.minecraftforge.fml.network.NetworkHooks/]: Connected to a modded server. Here is what I got from server console when I set -Dforge.logging.console.level=all Gist
-
THIS SITUATION IS CAUSED BY PACKET ERROR! ----------------------------------------------------------------- Original post: Hello Everyone, it's a newbee modder here. My mod works fine when runClient. And runServer also works fine until player is trying to join in server. Here is what happen when player trying to connect server: ON SERVER CONSOLE: [18八月2020 15:14:05.120] [Server thread/INFO] [net.minecraftforge.common.AdvancementLoadFix/]: Using new advancement loading for net.minecraft.advancements.PlayerAdvancements@3f183a2a [18八月2020 15:14:05.123] [Server thread/INFO] [net.minecraft.server.management.PlayerList/]: Dev[/192.168.0.104:10376] logged in with entity id 176 at (55.5, 63.0, -44.5) [18八月2020 15:14:05.124] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer/]: Dev joined the game [18八月2020 15:14:05.129] [Netty Server IO #8/ERROR] [net.minecraft.command.arguments.ArgumentTypes/]: Could not serialize net.minecraftforge.server.command.ModIdArgument@3e41a31e (class net.minecraftforge.server.command.ModIdArgument) - will not be sent to client! [18八月2020 15:14:05.129] [Netty Server IO #8/ERROR] [net.minecraft.command.arguments.ArgumentTypes/]: Could not serialize net.minecraftforge.server.command.EnumArgument@6349126 (class net.minecraftforge.server.command.EnumArgument) - will not be sent to client! [18八月2020 15:14:05.174] [Server thread/INFO] [net.minecraft.network.play.ServerPlayNetHandler/]: Dev lost connection: Disconnected [18八月2020 15:14:05.174] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer/]: Dev left the game ON PLAYER CLIENT: Internal Exception: io.netty.handler.codec.DecoderException: io.netty.handler.codec.EncoderException: java.io.UTFDataFormatException: malformed input around byte 9