Jump to content

HeidFanatic

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by HeidFanatic

  1. 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!
  2. 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!
  3. 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!
  4. 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)); }
  5. I'm really sorry I didn't add forge.logging.mojang.level=DEBUG correctly. I have already used stacktrace find my bugs. Really thank you for your help and your patience!
  6. OK... Sometimes There is one more sentence after that: [18八月2020 20:01:50.440] [Netty Client IO #2/DEBUG] [net.minecraftforge.coremod.transformer.CoreModBaseTransformer/COREMOD]: Transforming func_192799_a with desc (Lnet/minecraft/network/play/server/SAdvancementInfoPacket;)V
  7. 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
  8. Thank you so much! I added server & client debug.log to the post!
  9. 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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.