Jump to content

The game crashed whilst exception in server tick loop Error: java.lang.NoSuchMethodError: 'void


Recommended Posts

Posted

Hello! I've been having this error lately with my minecraft 1.18.2, once I enter the loading screen everything goes great, but when I create a world I get out of the game and throws this error

I would be very helpful if you can help me.

Thx :D

My error log :

---- Minecraft Crash Report ----
// Ooh. Shiny.

Time: 17/7/22 23:14
Description: Exception in server tick loop

java.lang.NoSuchMethodError: 'void net.minecraft.server.level.DistanceManager.addRegionTicket(net.minecraft.server.level.TicketType, net.minecraft.world.level.ChunkPos, int, java.lang.Object, boolean)'
    at net.minecraft.server.level.ServerChunkCache.addRegionTicket(ServerChunkCache.java:429) ~[client-1.18.2-20220404.173914-srg.jar%23117!/:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.server.level.ServerChunkCache.m_8387_(ServerChunkCache.java:425) ~[client-1.18.2-20220404.173914-srg.jar%23117!/:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.server.MinecraftServer.m_129940_(MinecraftServer.java:471) ~[client-1.18.2-20220404.173914-srg.jar%23117!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:A}
    at net.minecraft.server.MinecraftServer.m_130006_(MinecraftServer.java:318) ~[client-1.18.2-20220404.173914-srg.jar%23117!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:A}
    at net.minecraft.client.server.IntegratedServer.m_7038_(IntegratedServer.java:84) ~[client-1.18.2-20220404.173914-srg.jar%23117!/:?] {re:classloading,xf:OptiFine:default}
    at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:661) ~[client-1.18.2-20220404.173914-srg.jar%23117!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:A}
    at net.minecraft.server.MinecraftServer.m_177918_(MinecraftServer.java:261) ~[client-1.18.2-20220404.173914-srg.jar%23117!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:A}
    at java.lang.Thread.run(Thread.java:833) [?:?] {}


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- System Details --
Details:
    Minecraft Version: 1.18.2
    Minecraft Version ID: 1.18.2
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 17.0.1, Microsoft
    Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Microsoft
    Memory: 2813447552 bytes (2683 MiB) / 6039797760 bytes (5760 MiB) up to 8589934592 bytes (8192 MiB)
    CPUs: 12
    Processor Vendor: GenuineIntel
    Processor Name: Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz
    Identifier: Intel64 Family 6 Model 165 Stepping 5
    Microarchitecture: unknown
    Frequency (GHz): 2,90
    Number of physical packages: 1
    Number of physical CPUs: 6
    Number of logical CPUs: 12
    Graphics card #0 name: NVIDIA GeForce GTX 1050
    Graphics card #0 vendor: NVIDIA (0x10de)
    Graphics card #0 VRAM (MB): 2048,00
    Graphics card #0 deviceId: 0x1c81
    Graphics card #0 versionInfo: DriverVersion=30.0.15.1123
    Memory slot #0 capacity (MB): 8192,00
    Memory slot #0 clockSpeed (GHz): 2,40
    Memory slot #0 type: DDR4
    Memory slot #1 capacity (MB): 8192,00
    Memory slot #1 clockSpeed (GHz): 2,40
    Memory slot #1 type: DDR4
    Virtual memory max (MB): 32697,05
    Virtual memory used (MB): 17865,17
    Swap memory total (MB): 16384,00
    Swap memory used (MB): 227,55
    JVM Flags: 9 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xss1M -Xmx8G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M
    Server Running: true
    Player Count: 0 / 8; []
    Data Packs: vanilla, mod:betterdungeons, mod:blue_skies (incompatible), mod:jei (incompatible), mod:conjurer_illager, mod:goblintraders (incompatible), mod:stalwart_dungeons, mod:waystones (incompatible), mod:xaeroworldmap, mod:citadel (incompatible), mod:alexsmobs (incompatible), mod:naturescompass (incompatible), mod:artifacts, mod:yungsapi, mod:feature_nbt_deadlock_be_gone (incompatible), mod:dungeoncrawl, mod:charginggadgets (incompatible), mod:shrink (incompatible), mod:guardvillagers (incompatible), mod:bonsaitrees3, mod:mahoutsukai, mod:balm (incompatible), mod:waterstrainer, mod:walljump (incompatible), mod:terralith, mod:mininggadgets (incompatible), mod:forge, mod:dragonmounts (incompatible), mod:scuba_gear (incompatible), mod:structure_gel, mod:dungeons_arise, mod:castle_in_the_sky (incompatible), mod:mcwbridges, mod:amplifiednether, mod:repurposed_structures, mod:ambientsounds (incompatible), mod:toolbelt, mod:silentlib, mod:jade (incompatible), mod:creativecore (incompatible), mod:botania (incompatible), mod:easy_villagers (incompatible), mod:curios (incompatible), mod:patchouli (incompatible), mod:xaerominimap, mod:backpacked (incompatible), mod:cgm, mod:libnonymous, mod:elevatorid, mod:betterstrongholds, mod:tombstone, mod:structures_compass, mod:cfm, mod:architectury (incompatible), mod:findme (incompatible), mod:appleskin (incompatible), mod:vampirism (incompatible), mod:globalxp (incompatible), mod:undergarden, mod:framework (incompatible), mod:scalinghealth, mod:expandability (incompatible), mod:bettermineshafts, mod:geckolib3 (incompatible), mod:creeperoverhaul (incompatible)
    World Generation: Experimental
    Type: Integrated Server (map_client.txt)
    Is Modded: Definitely; Client brand changed to 'forge'; Server brand changed to 'forge'
    OptiFine Version: OptiFine_1.18.2_HD_U_H7
    OptiFine Build: 20220410-185216
    Render Distance Chunks: 12
    Mipmaps: 4
    Anisotropic Filtering: 1
    Antialiasing: 0
    Multitexture: false
    Shaders: null
    OpenGlVersion: 3.2.0 NVIDIA 511.23
    OpenGlRenderer: NVIDIA GeForce GTX 1050/PCIe/SSE2
    OpenGlVendor: NVIDIA Corporation
    CpuCount: 12
    ModLauncher: 9.1.3+9.1.3+main.9b69c82a
    ModLauncher launch target: forgeclient
    ModLauncher naming: srg
    ModLauncher services: 
         mixin PLUGINSERVICE 
         eventbus PLUGINSERVICE 
         slf4jfixer PLUGINSERVICE 
         object_holder_definalize PLUGINSERVICE 
         runtime_enum_extender PLUGINSERVICE 
         capability_token_subclass PLUGINSERVICE 
         accesstransformer PLUGINSERVICE 
         runtimedistcleaner PLUGINSERVICE 
         mixin TRANSFORMATIONSERVICE 
         OptiFine TRANSFORMATIONSERVICE 
         fml TRANSFORMATIONSERVICE 
    FML Language Providers: 
        [email protected]
        lowcodefml@null
        javafml@null
    Mod List: 
        YungsBetterDungeons-1.18.2-Forge-2.1.0.jar        |YUNG's Better Dungeons        |betterdungeons                |1.18.2-Forge-2.1.0  |DONE      |Manifest: NOSIGNATURE
        blue_skies-1.18.2-1.3.12.jar                      |Blue Skies                    |blue_skies                    |1.3.12              |DONE      |Manifest: NOSIGNATURE
        jei-1.18.2-9.7.0.195.jar                          |Just Enough Items             |jei                           |9.7.0.195           |DONE      |Manifest: NOSIGNATURE
        the-conjurer-1.18.2-1.1.1.jar                     |The Conjurer                  |conjurer_illager              |1.1.1               |DONE      |Manifest: NOSIGNATURE
        goblintraders-1.7.2-1.18.2.jar                    |Goblin Traders                |goblintraders                 |1.7.2               |DONE      |Manifest: NOSIGNATURE
        stalwart-dungeons-1.18.2-1.2.2.jar                |Stalwart Dungeons             |stalwart_dungeons             |1.2.2               |DONE      |Manifest: NOSIGNATURE
        waystones-forge-1.18.2-10.0.0.jar                 |Waystones                     |waystones                     |10.0.0              |DONE      |Manifest: NOSIGNATURE
        XaerosWorldMap_1.21.2_Forge_1.18.2.jar            |Xaero's World Map             |xaeroworldmap                 |1.21.2              |DONE      |Manifest: NOSIGNATURE
        citadel-1.11.3-1.18.2.jar                         |Citadel                       |citadel                       |1.11.3              |DONE      |Manifest: NOSIGNATURE
        alexsmobs-1.18.3.jar                              |Alex's Mobs                   |alexsmobs                     |1.18.3              |DONE      |Manifest: NOSIGNATURE
        NaturesCompass-1.18.2-1.9.5-forge.jar             |Nature's Compass              |naturescompass                |1.18.2-1.9.5-forge  |DONE      |Manifest: NOSIGNATURE
        artifacts-1.18.2-4.0.7.jar                        |Artifacts                     |artifacts                     |1.18.2-4.0.7        |DONE      |Manifest: NOSIGNATURE
        YungsApi-1.18.2-Forge-2.0.8.jar                   |YUNG's API                    |yungsapi                      |1.18.2-Forge-2.0.8  |DONE      |Manifest: NOSIGNATURE
        feature_nbt_deadlock_be_gone_forge-2.0.0+1.18.2.ja|Feature NBT Deadlock Be Gone  |feature_nbt_deadlock_be_gone  |2.0.0+1.18.2        |DONE      |Manifest: NOSIGNATURE
        DungeonCrawl-1.18.2-2.3.8.jar                     |Dungeon Crawl                 |dungeoncrawl                  |2.3.8               |DONE      |Manifest: NOSIGNATURE
        charginggadgets-1.7.0.jar                         |Charging Gadgets              |charginggadgets               |1.7.0               |DONE      |Manifest: NOSIGNATURE
        Shrink-1.18.2-1.3.3.jar                           |Shrink                        |shrink                        |1.3.3               |DONE      |Manifest: NOSIGNATURE
        guardvillagers-1.18.2.1.4.1.jar                   |Guard Villagers               |guardvillagers                |1.4.1               |DONE      |Manifest: NOSIGNATURE
        bonsaitrees3-3.1.0.jar                            |Bonsai Trees 3                |bonsaitrees3                  |3.1.0               |DONE      |Manifest: NOSIGNATURE
        mahoutsukai-1.18.2-v1.34.15.jar                   |Mahou Tsukai                  |mahoutsukai                   |1.18.2-v1.34.15     |DONE      |Manifest: NOSIGNATURE
        balm-3.0.3+0.jar                                  |Balm                          |balm                          |3.0.3+0             |DONE      |Manifest: NOSIGNATURE
        WaterStrainer-1.18.2-13.0.0.jar                   |Water Strainer                |waterstrainer                 |1.18.2-13.0.0       |DONE      |Manifest: NOSIGNATURE
        walljump-forge-1.18.1-1.3.7.jar                   |Wall-Jump!                    |walljump                      |1.18.1-1.3.7        |DONE      |Manifest: NOSIGNATURE
        Terralith_v2.2.1a.jar                             |Terralith                     |terralith                     |0.0NONE             |DONE      |Manifest: NOSIGNATURE
        mininggadgets-1.11.0.jar                          |Mining Gadgets                |mininggadgets                 |1.11.0              |DONE      |Manifest: NOSIGNATURE
        forge-1.18.2-40.1.68-universal.jar                |Forge                         |forge                         |40.1.68             |DONE      |Manifest: 84:ce:76:e8:45:35:e4:0e:63:86:df:47:59:80:0f:67:6c:c1:5f:6e:5f:4d:b3:54:47:1a:9f:7f:ed:5e:f2:90
        dragonmounts-1.18.2-BETA_1.1.0b1.jar              |Dragon Mounts: Legacy         |dragonmounts                  |1.18.2-BETA_1.1.0b1 |DONE      |Manifest: NOSIGNATURE
        scuba_gear-1.18.2-1.0.4.jar                       |Scuba Gear                    |scuba_gear                    |1.0.4               |DONE      |Manifest: NOSIGNATURE
        structure_gel-1.18.2-2.2.3.jar                    |Structure Gel API             |structure_gel                 |2.2.3               |DONE      |Manifest: NOSIGNATURE
        DungeonsArise-1.18.2-2.1.50d-beta.jar             |When Dungeons Arise           |dungeons_arise                |2.1.50d-1.18.2      |DONE      |Manifest: NOSIGNATURE
        castle_in_the_sky-1.18.2-0.4.1.jar                |Castle in the sky             |castle_in_the_sky             |1.18.2              |DONE      |Manifest: NOSIGNATURE
        client-1.18.2-20220404.173914-srg.jar             |Minecraft                     |minecraft                     |1.18.2              |DONE      |Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f
        mcw-bridges-2.0.3-mc1.18.2.jar                    |Macaw's Bridges               |mcwbridges                    |2.0.3               |DONE      |Manifest: NOSIGNATURE
        Amplified_Nether_v1.1.1.jar                       |Amplified Nether              |amplifiednether               |0.0NONE             |DONE      |Manifest: NOSIGNATURE
        repurposed_structures_forge-5.1.8+1.18.2.jar      |Repurposed Structures         |repurposed_structures         |5.1.8+1.18.2        |DONE      |Manifest: NOSIGNATURE
        AmbientSounds_FORGE_v5.0.16_mc1.18.2.jar          |Ambient Sounds                |ambientsounds                 |5.0.16              |DONE      |Manifest: NOSIGNATURE
        ToolBelt-1.18.2-1.18.8.jar                        |Tool Belt                     |toolbelt                      |1.18.8              |DONE      |Manifest: NOSIGNATURE
        silent-lib-1.18.2-6.2.0.jar                       |Silent Lib                    |silentlib                     |6.2.0               |DONE      |Manifest: NOSIGNATURE
        Jade-1.18.2-5.1.0.jar                             |Jade                          |jade                          |5.1.0               |DONE      |Manifest: NOSIGNATURE
        CreativeCore_FORGE_v2.6.9_mc1.18.2.jar            |CreativeCore                  |creativecore                  |2.6.9               |DONE      |Manifest: NOSIGNATURE
        Botania-1.18.2-432.jar                            |Botania                       |botania                       |1.18.2-432          |DONE      |Manifest: NOSIGNATURE
        easy_villagers-1.18.2-1.0.5.jar                   |Easy Villagers                |easy_villagers                |1.18.2-1.0.5        |DONE      |Manifest: NOSIGNATURE
        curios-forge-1.18.2-5.0.7.0.jar                   |Curios API                    |curios                        |1.18.2-5.0.7.0      |DONE      |Manifest: NOSIGNATURE
        Patchouli-1.18.2-67.jar                           |Patchouli                     |patchouli                     |1.18.2-67           |DONE      |Manifest: NOSIGNATURE
        Xaeros_Minimap_22.7.0_Forge_1.18.2.jar            |Xaero's Minimap               |xaerominimap                  |22.7.0              |DONE      |Manifest: NOSIGNATURE
        backpacked-2.1.6-1.18.2.jar                       |Backpacked                    |backpacked                    |2.1.6               |DONE      |Manifest: NOSIGNATURE
        cgm-1.2.5-1.18.2.jar                              |MrCrayfish's Gun Mod          |cgm                           |1.2.5               |DONE      |Manifest: NOSIGNATURE
        libnonymous-2.1.0.jar                             |libnonymous                   |libnonymous                   |2.1.0               |DONE      |Manifest: NOSIGNATURE
        elevatorid-1.18.2-1.8.4.jar                       |Elevator Mod                  |elevatorid                    |1.18.2-1.8.4        |DONE      |Manifest: NOSIGNATURE
        YungsBetterStrongholds-1.18.2-Forge-2.1.1.jar     |YUNG's Better Strongholds     |betterstrongholds             |1.18.2-Forge-2.1.1  |DONE      |Manifest: NOSIGNATURE
        tombstone-7.4.5-1.18.2.jar                        |Corail Tombstone              |tombstone                     |7.4.5               |DONE      |Manifest: NOSIGNATURE
        structures_compass-1.18.2-1.4.1.jar               |Structures Compass            |structures_compass            |1.18.2-1.4.1        |DONE      |Manifest: NOSIGNATURE
        cfm-7.0.0-pre29-1.18.2.jar                        |MrCrayfish's Furniture Mod    |cfm                           |7.0.0-pre29         |DONE      |Manifest: NOSIGNATURE
        architectury-4.4.60.jar                           |Architectury                  |architectury                  |4.4.60              |DONE      |Manifest: NOSIGNATURE
        findme-3.0.6-forge.jar                            |FindMe                        |findme                        |3.0.6               |DONE      |Manifest: NOSIGNATURE
        appleskin-forge-mc1.18-2.4.0.jar                  |AppleSkin                     |appleskin                     |2.4.0+mc1.18        |DONE      |Manifest: NOSIGNATURE
        Vampirism-1.18.2-1.8.2.jar                        |Vampirism                     |vampirism                     |1.8.2               |DONE      |Manifest: NOSIGNATURE
        globalxp-1.18.2-1.10.jar                          |Global XP                     |globalxp                      |1.10                |DONE      |Manifest: NOSIGNATURE
        The_Undergarden-1.18.2-0.7.0.jar                  |The Undergarden               |undergarden                   |0.7.0               |DONE      |Manifest: NOSIGNATURE
        framework-0.2.3-1.18.2.jar                        |Framework                     |framework                     |0.2.3               |DONE      |Manifest: NOSIGNATURE
        ScalingHealth-1.18.2-6.2.1+4.jar                  |Scaling Health                |scalinghealth                 |6.2.1+4             |DONE      |Manifest: NOSIGNATURE
        expandability-6.0.0.jar                           |ExpandAbility                 |expandability                 |6.0.0               |DONE      |Manifest: NOSIGNATURE
        YungsBetterMineshafts-1.18.2-Forge-2.1.3.jar      |YUNG's Better Mineshafts      |bettermineshafts              |1.18.2-Forge-2.1.3  |DONE      |Manifest: NOSIGNATURE
        geckolib-1.18-forge-3.0.18.jar                    |GeckoLib                      |geckolib3                     |3.0.18              |DONE      |Manifest: NOSIGNATURE
        creeperoverhaul-1.18.2-1.3.0-forge.jar            |Creeper Overhaul              |creeperoverhaul               |1.3.0               |DONE      |Manifest: NOSIGNATURE
    Crash Report UUID: 76ee1bb4-2738-417f-9ae6-7ecbda8234cb
    FML: 40.1
    Forge: net.minecraftforge:40.1.68

Posted

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

  • 1 month later...
Posted

It's Optifine, go into your mod folder and rename Optifne to optifine.jar.disabled. Once a new version of Forge or Optifine for 1.18.2 is released rename your optifine back to its original name. If you get the error again just follow the same steps. Hope this helps you out

  • Confused 1
  • 8 months later...
  • 2 weeks later...
Posted

I have the exact same error on the same version. I figured out that it's for sure optifine that is at least somewhat of the issue because it works fine when I remove it.  

  • 4 months later...
Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
    • Do you use features of inventory profiles next (ipnext) or is there a change without it?
    • Remove rubidium - you are already using embeddium, which is a fork of rubidium
  • Topics

×
×
  • Create New...

Important Information

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