• Recently Browsing

    No registered users viewing this page.

  • Posts

    • public class PlayerMentalCapabilityMessage { ClientPlayerEntity player = Minecraft.getInstance().player; //getInstance().playerをplayerにぶち込む LazyOptional<PlayerMentalInterface> cap = player.getCapability(PlayerMentalCapabilityRegistry.PLAYER_MENTAL_CAPABILITY); //playerからキャパビリティを取得してplayerMentalInterfaceにぶち込む int currentMental = cap.orElseThrow(IllegalArgumentException::new).getMental(); //int currentMental = ((PlayerMentalInterface) playerMentalInterface).getMental(); //playerMentalInterfaceからmentalの値を取得してcurrentMentalにぶち込む public PlayerMentalCapabilityMessage(int currentMental) { this.currentMental = currentMental; } public static void encode(PlayerMentalCapabilityMessage message, PacketBuffer buf) { buf.writeInt(message.currentMental); } public static PlayerMentalCapabilityMessage decode(PacketBuffer buf) { int currentMental = buf.readInt(); return new PlayerMentalCapabilityMessage(currentMental); } public static void handle(PlayerMentalCapabilityMessage message, Supplier<NetworkEvent.Context> ctx) { ctx.get().enqueueWork(() -> { DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> Handle.handleClient(message.currentMental)); }); ctx.get().setPacketHandled(true); } //@SuppressWarnings("resource") public static class Handle { public static DistExecutor.SafeRunnable handleClient(int currentMental) { return new DistExecutor.SafeRunnable() { @Override public void run() { LazyOptional<PlayerMentalInterface> cap = Minecraft.getInstance().player.getCapability(PlayerMentalCapabilityRegistry.PLAYER_MENTAL_CAPABILITY); cap.orElseThrow(IllegalArgumentException::new).setMental(currentMental); } }; } } I fixed the code in the network message and it seems that it crashed for another reason, but I don't know ...   ---- Minecraft Crash Report ---- // Don't do that. Time: 20/10/26 13:32 Description: Ticking player java.lang.ExceptionInInitializerError: null     at depression_mod.potion.ModEffect.lambda$0(ModEffect.java:30) ~[?:?] {re:classloading}     at net.minecraftforge.common.util.LazyOptional.ifPresent(LazyOptional.java:161) ~[?:?] {re:classloading}     at depression_mod.potion.ModEffect.performEffect(ModEffect.java:27) ~[?:?] {re:classloading}     at depression_mod.potion.ModEffect.affectEntity(ModEffect.java:37) ~[?:?] {re:classloading}     at net.minecraft.item.PotionItem.onItemUseFinish(PotionItem.java:47) ~[?:?] {re:classloading}     at net.minecraft.item.ItemStack.onItemUseFinish(ItemStack.java:213) ~[?:?] {re:classloading}     at net.minecraft.entity.LivingEntity.onItemUseFinish(LivingEntity.java:2876) ~[?:?] {re:classloading}     at net.minecraft.entity.player.ServerPlayerEntity.onItemUseFinish(ServerPlayerEntity.java:1027) ~[?:?] {re:classloading,pl:accesstransformer:B}     at net.minecraft.entity.LivingEntity.updateActiveHand(LivingEntity.java:2754) ~[?:?] {re:classloading}     at net.minecraft.entity.LivingEntity.tick(LivingEntity.java:2185) ~[?:?] {re:classloading}     at net.minecraft.entity.player.PlayerEntity.tick(PlayerEntity.java:237) ~[?:?] {re:classloading,pl:accesstransformer:B}     at net.minecraft.entity.player.ServerPlayerEntity.playerTick(ServerPlayerEntity.java:379) ~[?:?] {re:classloading,pl:accesstransformer:B}     at net.minecraft.network.play.ServerPlayNetHandler.tick(ServerPlayNetHandler.java:188) ~[?:?] {re:classloading}     at net.minecraft.network.NetworkManager.tick(NetworkManager.java:250) ~[?:?] {re:classloading}     at net.minecraft.network.NetworkSystem.tick(NetworkSystem.java:152) ~[?:?] {re:classloading}     at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:903) ~[?:?] {re:classloading,pl:accesstransformer:B}     at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:821) ~[?:?] {re:classloading,pl:accesstransformer:B}     at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:662) [?:?] {re:classloading,pl:accesstransformer:B}     at java.lang.Thread.run(Thread.java:748) [?:1.8.0_261] {} Caused by: java.lang.IllegalArgumentException: Registration of network channels is locked     at net.minecraftforge.fml.network.NetworkRegistry.createInstance(NetworkRegistry.java:130) ~[?:?] {re:classloading}     at net.minecraftforge.fml.network.NetworkRegistry.newSimpleChannel(NetworkRegistry.java:97) ~[?:?] {re:classloading}     at depression_mod.network.DepressionModPacketHandler.<clinit>(DepressionModPacketHandler.java:13) ~[?:?] {re:classloading}     ... 20 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Server thread Stacktrace:     at depression_mod.potion.ModEffect.lambda$0(ModEffect.java:30)     at net.minecraftforge.common.util.LazyOptional.ifPresent(LazyOptional.java:161)     at depression_mod.potion.ModEffect.performEffect(ModEffect.java:27)     at depression_mod.potion.ModEffect.affectEntity(ModEffect.java:37)     at net.minecraft.item.PotionItem.onItemUseFinish(PotionItem.java:47)     at net.minecraft.item.ItemStack.onItemUseFinish(ItemStack.java:213)     at net.minecraft.entity.LivingEntity.onItemUseFinish(LivingEntity.java:2876)     at net.minecraft.entity.player.ServerPlayerEntity.onItemUseFinish(ServerPlayerEntity.java:1027)     at net.minecraft.entity.LivingEntity.updateActiveHand(LivingEntity.java:2754)     at net.minecraft.entity.LivingEntity.tick(LivingEntity.java:2185)     at net.minecraft.entity.player.PlayerEntity.tick(PlayerEntity.java:237) -- Player being ticked -- Details:     Entity Type: minecraft:player (net.minecraft.entity.player.ServerPlayerEntity)     Entity ID: 134     Entity Name: Dev     Entity's Exact location: -140.36, 70.20, -5.77     Entity's Block location: World: (-141,70,-6), Chunk: (at 3,4,10 in -9,-1; contains blocks -144,0,-16 to -129,255,-1), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1)     Entity's Momentum: 0.00, 0.01, 0.00     Entity's Passengers: []     Entity's Vehicle: ~~ERROR~~ NullPointerException: null Stacktrace:     at net.minecraft.entity.player.ServerPlayerEntity.playerTick(ServerPlayerEntity.java:379)     at net.minecraft.network.play.ServerPlayNetHandler.tick(ServerPlayNetHandler.java:188)     at net.minecraft.network.NetworkManager.tick(NetworkManager.java:250) -- Ticking connection -- Details:     Connection: net.minecraft.network.NetworkManager@20737ec4 Stacktrace:     at net.minecraft.network.NetworkSystem.tick(NetworkSystem.java:152)     at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:903)     at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:821)     at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120)     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:662)     at java.lang.Thread.run(Thread.java:748) -- System Details -- Details:     Minecraft Version: 1.15.2     Minecraft Version ID: 1.15.2     Operating System: Windows 10 (amd64) version 10.0     Java Version: 1.8.0_261, Oracle Corporation     Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation     Memory: 435238600 bytes (415 MB) / 1243086848 bytes (1185 MB) up to 1873805312 bytes (1787 MB)     CPUs: 12     JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump     ModLauncher: 5.1.2+70+master.2845bb9     ModLauncher launch target: fmluserdevclient     ModLauncher naming: mcp     ModLauncher services:          /eventbus-2.2.0-service.jar eventbus PLUGINSERVICE          /forge-1.15.2-31.2.41_mapped_snapshot_20200514-1.15.1-launcher.jar object_holder_definalize PLUGINSERVICE          /forge-1.15.2-31.2.41_mapped_snapshot_20200514-1.15.1-launcher.jar runtime_enum_extender PLUGINSERVICE          /accesstransformers-2.1.3-shadowed.jar accesstransformer PLUGINSERVICE          /forge-1.15.2-31.2.41_mapped_snapshot_20200514-1.15.1-launcher.jar capability_inject_definalize PLUGINSERVICE          /forge-1.15.2-31.2.41_mapped_snapshot_20200514-1.15.1-launcher.jar runtimedistcleaner PLUGINSERVICE          /forge-1.15.2-31.2.41_mapped_snapshot_20200514-1.15.1-launcher.jar fml TRANSFORMATIONSERVICE      FML: 31.2     Forge: net.minecraftforge:31.2.41     FML Language Providers:          javafml@31.2         minecraft@1     Mod List:          client-extra.jar Minecraft {minecraft@1.15.2 DONE}         forge-1.15.2-31.2.41_mapped_snapshot_20200514-1.15.1-recomp.jar Forge {forge@31.2.41 DONE}         main Depression Mod {depression_mod@NONE DONE}     Player Count: 1 / 8; [ServerPlayerEntity['Dev'/134, l='New World', x=-140.36, y=70.20, z=-5.77]]     Data Packs: vanilla, mod:forge (incompatible), mod:depression_mod     Type: Integrated Server (map_client.txt)     Is Modded: Definitely; Client brand changed to 'forge'
    • i made a server on crazy craft portforwarded everything is working i invited my friends but they keep timing out when connecting only one of them can join for some reason i dont know how to fix it please help
    • Don't usually post on forums like this because I'm too nervous but I seriously can't find anything anywhere about how to fix this bug so I guess this is my only option. Currently playing on forge 1.16.3 with OptiFine and for some reason whenever I enter a boat my hunger bar disappears. Figured I would just use a different version of forge 1.16.3 but I've tried just about every single version and this bug happens in every single one of them. For me anyway. I'm playing with OptiFine and at first I thought it was a bug with that, but I deleted it and the bug still persists. I know this isn't supposed to be happening because in vanilla 1.16.3 the hunger bar still shows whenever I'm in a boat. I don't know if this is an issue with forge itself or maybe something else I'm unaware of that's affecting it, but can somebody please tell me how to fix this? I know it wouldn't matter to most people but its driving me crazy. Let me know if I need to provide more information.
    • You are right there, thanks for the assist, I hope it works fine from here.
  • Topics

  • Who's Online (See full list)