Jump to content

Recommended Posts

Posted (edited)

Bonjour, je crée ce poste aujourd'hui, car j'ai besoin d'aide pour savoir comment résoudre ce problème. Le problème étant que quelque sois les mods que je met dans mon server 1.12.2, cette fenêtre apparaît.. 
Je ne comprends pas d'où viens le problème car j'ai exactement les même mods partout. Si l'un d'entre vous aurez la réponse :) Merci

 

Hello, I'm creating this post today because I need help to find out how to fix this problem. The problem being that whatever mods I put in my server 1.12.2, this window appears ..
I don't understand where the problem comes from because I have exactly the same mods everywhere. If some o f you will have the answer :) Thank you

 

 

FailedRegisteries 1.12.2.PNG

Edited by Teeoo
  • 2 weeks later...
Posted

dataserializes seems to be a registry added in 1.13, which would lead me to think your world was upgrade, or the server is running 1.13.

Which for obvious reasons wont work on 1.12.

So... try 1.13.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted
22 hours ago, quadraxis said:

Post the latest.log file from when this happens.

[13:32:39] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[13:32:39] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[13:32:39] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLServerTweaker
[13:32:39] [main/INFO] [FML]: Forge Mod Loader version 14.23.5.2836 for Minecraft 1.12.2 loading
[13:32:39] [main/INFO] [FML]: Java is Eclipse OpenJ9 VM, version 1.8.0_192, running on Linux:amd64:4.9.120-xxxx-std-ipv6-64-hz1000, installed at /home/minecraft/java/1.8.0_192_openj9-0.11.0/jre
[13:32:39] [main/INFO] [FML]: Searching /home/minecraft/servers/mine210439/./mods for mods
[13:32:39] [main/WARN] [FML]: Found FMLCorePluginContainsFMLMod marker in wings-1.0.6-1.12.2.jar. This is not recommended, @Mods should be in a separate jar from the coremod.
[13:32:39] [main/WARN] [FML]: The coremod wings (me.paulf.wings.server.asm.plugin.WingsLoadingPlugin) is not signed!
[13:32:39] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[13:32:39] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[13:32:39] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[13:32:39] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[13:32:39] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[13:32:45] [main/INFO] [FML]: Found valid fingerprint for Minecraft Forge. Certificate fingerprint e3c3d50c7c986df74c645c0ac54639741c90a557
[13:32:45] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[13:32:45] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[13:32:48] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[13:32:49] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[13:32:50] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[13:32:50] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[13:32:51] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.server.MinecraftServer}
[13:33:01] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Starting minecraft server version 1.12.2
[13:33:01] [Server thread/INFO] [FML]: MinecraftForge v14.23.5.2836 Initialized
[13:33:01] [Server thread/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients.
[13:33:01] [Server thread/INFO] [FML]: Invalid recipe found with multiple oredict ingredients in the same ingredient...
[13:33:01] [Server thread/INFO] [FML]: Replaced 1227 ore ingredients
[13:33:02] [Server thread/INFO] [FML]: Searching /home/minecraft/servers/mine210439/./mods for mods
[13:33:04] [Server thread/INFO] [FML]: Forge Mod Loader has identified 9 mods to load
[13:33:04] [Server thread/WARN] [FML]: Missing English translation for FML: assets/fml/lang/en_us.lang
[13:33:04] [Server thread/WARN] [FML]: Mod bauble_wings has been disabled through configuration
[13:33:04] [Server thread/WARN] [FML]: Mod mobends_wings has been disabled through configuration
[13:33:05] [Server thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, moreplayermodels, wings, llibrary] at CLIENT
[13:33:05] [Server thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, moreplayermodels, wings, llibrary] at SERVER
[13:33:07] [Server thread/INFO] [FML]: Processing ObjectHolder annotations
[13:33:07] [Server thread/INFO] [FML]: Found 1185 ObjectHolder annotations
[13:33:07] [Server thread/INFO] [FML]: Identifying ItemStackHolder annotations
[13:33:07] [Server thread/INFO] [FML]: Found 0 ItemStackHolder annotations
[13:33:08] [Server thread/INFO] [FML]: Configured a dormant chunk cache size of 0
[13:33:08] [Forge Version Check/INFO] [forge.VersionCheck]: [llibrary] Starting version check at https://gist.githubusercontent.com/gegy1000/a6639456aeb8edd92cbf7cbfcf9d65d9/raw/llibrary_updates.json
[13:33:09] [Server thread/INFO] [FML]: Applying holder lookups
[13:33:09] [Server thread/INFO] [FML]: Holder lookups applied
[13:33:09] [Server thread/INFO] [FML]: Applying holder lookups
[13:33:09] [Server thread/INFO] [FML]: Holder lookups applied
[13:33:09] [Server thread/INFO] [FML]: Applying holder lookups
[13:33:09] [Server thread/INFO] [FML]: Holder lookups applied
[13:33:09] [Server thread/INFO] [FML]: Applying holder lookups
[13:33:09] [Server thread/INFO] [FML]: Holder lookups applied
[13:33:09] [Server thread/INFO] [FML]: Injecting itemstacks
[13:33:09] [Server thread/INFO] [FML]: Itemstack injection complete
[13:33:09] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Loading properties
[13:33:09] [Server thread/WARN] [net.minecraft.server.dedicated.DedicatedServer]: resource-pack-hash is deprecated and found along side resource-pack-sha1. resource-pack-hash will be ignored.
[13:33:09] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Default game type: SURVIVAL
[13:33:09] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Generating keypair
[13:33:09] [Forge Version Check/INFO] [forge.VersionCheck]: [llibrary] Found status: OUTDATED Target: 1.7.18
[13:33:09] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[13:33:10] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Found status: OUTDATED Target: 14.23.5.2838
[13:33:10] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Starting Minecraft server on 176.31.240.84:26122
[13:33:10] [Server thread/INFO] [net.minecraft.network.NetworkSystem]: Using epoll channel type
[13:33:10] [Server thread/WARN] [net.minecraft.server.dedicated.DedicatedServer]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
[13:33:10] [Server thread/WARN] [net.minecraft.server.dedicated.DedicatedServer]: The server will make no attempt to authenticate usernames. Beware.
[13:33:10] [Server thread/WARN] [net.minecraft.server.dedicated.DedicatedServer]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
[13:33:10] [Server thread/WARN] [net.minecraft.server.dedicated.DedicatedServer]: To change this, set "online-mode" to "true" in the server.properties file.
[13:33:10] [Server thread/INFO] [FML]: Applying holder lookups
[13:33:10] [Server thread/INFO] [FML]: Holder lookups applied
[13:33:10] [Server thread/INFO] [FML]: Injecting itemstacks
[13:33:10] [Server thread/INFO] [FML]: Itemstack injection complete
[13:33:11] [Server thread/INFO] [FML]: Forge Mod Loader has successfully loaded 9 mods
[13:33:11] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Preparing level "Angevil"
[13:33:11] [Server thread/INFO] [FML]: Injecting existing registry data into this server instance
[13:33:13] [Server thread/INFO] [FML]: Applying holder lookups
[13:33:13] [Server thread/INFO] [FML]: Holder lookups applied
[13:33:14] [Server thread/INFO] [FML]: Loading dimension 0 (Angevil) (net.minecraft.server.dedicated.DedicatedServer@f01863ba)
[13:33:15] [Server thread/INFO] [net.minecraft.advancements.AdvancementList]: Loaded 488 advancements
[13:33:15] [Server thread/INFO] [FML]: Loading dimension -1 (Angevil) (net.minecraft.server.dedicated.DedicatedServer@f01863ba)
[13:33:15] [Server thread/INFO] [FML]: Loading dimension 1 (Angevil) (net.minecraft.server.dedicated.DedicatedServer@f01863ba)
[13:33:15] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing start region for level 0
[13:33:16] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing spawn area: 8%
[13:33:17] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing spawn area: 35%
[13:33:18] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing spawn area: 63%
[13:33:19] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing spawn area: 86%
[13:33:20] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Done (9.455s)! For help, type "help" or "?"
[13:33:22] [Server thread/INFO] [FML]: Unloading dimension -1
[13:33:22] [Server thread/INFO] [FML]: Unloading dimension 1
[13:33:26] [Server thread/WARN] [net.minecraft.server.MinecraftServer]: Can't keep up! Did the system time change, or is the server overloaded? Running 4944ms behind, skipping 98 tick(s)
[13:34:10] [Server thread/WARN] [net.minecraft.server.MinecraftServer]: Can't keep up! Did the system time change, or is the server overloaded? Running 2092ms behind, skipping 41 tick(s)
[13:34:44] [Netty Epoll Server IO #2/INFO] [FML]: Client protocol version 2
[13:34:44] [Netty Epoll Server IO #2/INFO] [FML]: Client attempting to join with 8 mods : [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
 

20 hours ago, LexManos said:

dataserializes seems to be a registry added in 1.13, which would lead me to think your world was upgrade, or the server is running 1.13.

Which for obvious reasons wont work on 1.12.

So... try 1.13.

But I don't want a server on 1.13

Posted

Do you have multiple versions of Minecraft/Forge installed?

If so, do those versions have their own game directories?

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

Spoiler

Logs (Most issues require logs to diagnose):

Spoiler

Please post logs using one of the following sites (Thank you Lumber Wizard for the list):

https://gist.github.com/100MB Requires member (Free)

https://pastebin.com/: 512KB as guest, 10MB as Pro ($$$)

https://hastebin.com/: 400KB

Do NOT use sites like Mediafire, Dropbox, OneDrive, Google Drive, or a site that has a countdown before offering downloads.

 

What to provide:

...for Crashes and Runtime issues:

Minecraft 1.14.4 and newer:

Post debug.log

Older versions:

Please update...

 

...for Installer Issues:

Post your installer log, found in the same place you ran the installer

This log will be called either installer.log or named the same as the installer but with .log on the end

Note for Windows users:

Windows hides file extensions by default so the installer may appear without the .jar extension then when the .log is added the log will appear with the .jar extension

 

Where to get it:

Mojang Launcher: When using the Mojang launcher debug.log is found in .minecraft\logs.

 

Curse/Overwolf: If you are using the Curse Launcher, their configurations break Forge's log settings, fortunately there is an easier workaround than I originally thought, this works even with Curse's installation of the Minecraft launcher as long as it is not launched THROUGH Twitch:

Spoiler
  1. Make sure you have the correct version of Forge installed (some packs are heavily dependent on one specific build of Forge)
  2. Make a launcher profile targeting this version of Forge.
  3. Set the launcher profile's GameDir property to the pack's instance folder (not the instances folder, the folder that has the pack's name on it).
  4. Now launch the pack through that profile and follow the "Mojang Launcher" instructions above.

Video:

Spoiler

 

 

 

or alternately, 

 

Fallback ("No logs are generated"):

If you don't see logs generated in the usual place, provide the launcher_log.txt from .minecraft

 

Server Not Starting:

Spoiler

If your server does not start or a command window appears and immediately goes away, run the jar manually and provide the output.

 

Reporting Illegal/Inappropriate Adfocus Ads:

Spoiler

Get a screenshot of the URL bar or copy/paste the whole URL into a thread on the General Discussion board with a description of the Ad.

Lex will need the Ad ID contained in that URL to report it to Adfocus' support team.

 

Posting your mod as a GitHub Repo:

Spoiler

When you have an issue with your mod the most helpful thing you can do when asking for help is to provide your code to those helping you. The most convenient way to do this is via GitHub or another source control hub.

When setting up a GitHub Repo it might seem easy to just upload everything, however this method has the potential for mistakes that could lead to trouble later on, it is recommended to use a Git client or to get comfortable with the Git command line. The following instructions will use the Git Command Line and as such they assume you already have it installed and that you have created a repository.

 

  1. Open a command prompt (CMD, Powershell, Terminal, etc).
  2. Navigate to the folder you extracted Forge’s MDK to (the one that had all the licenses in).
  3. Run the following commands:
    1. git init
    2. git remote add origin [Your Repository's URL]
      • In the case of GitHub it should look like: https://GitHub.com/[Your Username]/[Repo Name].git
    3. git fetch
    4. git checkout --track origin/master
    5. git stage *
    6. git commit -m "[Your commit message]"
    7. git push
  4. Navigate to GitHub and you should now see most of the files.
    • note that it is intentional that some are not synced with GitHub and this is done with the (hidden) .gitignore file that Forge’s MDK has provided (hence the strictness on which folder git init is run from)
  5. Now you can share your GitHub link with those who you are asking for help.

[Workaround line, please ignore]

 

Posted

Sorry, I should have perhaps been more clear.

On 5/25/2019 at 2:35 PM, Teeoo said:

When i click "yes", no mods is actived,  all items are invisible

I want the latest.log file from the client where this happens.

Please also upload it to a text-hosting site like pastebin/gist/etc and link it here, rather than trying to put the whole log in your post.

Posted
20 hours ago, DaemonUmbra said:

Do you have multiple versions of Minecraft/Forge installed?

If so, do those versions have their own game directories?

No just 1.12.2 forge is installed

Posted

Hmm, apparently the DataSerializers registry was added to 1.12.2 2 months ago (April 11 2019).

What version of Forge was this world created with?

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

Spoiler

Logs (Most issues require logs to diagnose):

Spoiler

Please post logs using one of the following sites (Thank you Lumber Wizard for the list):

https://gist.github.com/100MB Requires member (Free)

https://pastebin.com/: 512KB as guest, 10MB as Pro ($$$)

https://hastebin.com/: 400KB

Do NOT use sites like Mediafire, Dropbox, OneDrive, Google Drive, or a site that has a countdown before offering downloads.

 

What to provide:

...for Crashes and Runtime issues:

Minecraft 1.14.4 and newer:

Post debug.log

Older versions:

Please update...

 

...for Installer Issues:

Post your installer log, found in the same place you ran the installer

This log will be called either installer.log or named the same as the installer but with .log on the end

Note for Windows users:

Windows hides file extensions by default so the installer may appear without the .jar extension then when the .log is added the log will appear with the .jar extension

 

Where to get it:

Mojang Launcher: When using the Mojang launcher debug.log is found in .minecraft\logs.

 

Curse/Overwolf: If you are using the Curse Launcher, their configurations break Forge's log settings, fortunately there is an easier workaround than I originally thought, this works even with Curse's installation of the Minecraft launcher as long as it is not launched THROUGH Twitch:

Spoiler
  1. Make sure you have the correct version of Forge installed (some packs are heavily dependent on one specific build of Forge)
  2. Make a launcher profile targeting this version of Forge.
  3. Set the launcher profile's GameDir property to the pack's instance folder (not the instances folder, the folder that has the pack's name on it).
  4. Now launch the pack through that profile and follow the "Mojang Launcher" instructions above.

Video:

Spoiler

 

 

 

or alternately, 

 

Fallback ("No logs are generated"):

If you don't see logs generated in the usual place, provide the launcher_log.txt from .minecraft

 

Server Not Starting:

Spoiler

If your server does not start or a command window appears and immediately goes away, run the jar manually and provide the output.

 

Reporting Illegal/Inappropriate Adfocus Ads:

Spoiler

Get a screenshot of the URL bar or copy/paste the whole URL into a thread on the General Discussion board with a description of the Ad.

Lex will need the Ad ID contained in that URL to report it to Adfocus' support team.

 

Posting your mod as a GitHub Repo:

Spoiler

When you have an issue with your mod the most helpful thing you can do when asking for help is to provide your code to those helping you. The most convenient way to do this is via GitHub or another source control hub.

When setting up a GitHub Repo it might seem easy to just upload everything, however this method has the potential for mistakes that could lead to trouble later on, it is recommended to use a Git client or to get comfortable with the Git command line. The following instructions will use the Git Command Line and as such they assume you already have it installed and that you have created a repository.

 

  1. Open a command prompt (CMD, Powershell, Terminal, etc).
  2. Navigate to the folder you extracted Forge’s MDK to (the one that had all the licenses in).
  3. Run the following commands:
    1. git init
    2. git remote add origin [Your Repository's URL]
      • In the case of GitHub it should look like: https://GitHub.com/[Your Username]/[Repo Name].git
    3. git fetch
    4. git checkout --track origin/master
    5. git stage *
    6. git commit -m "[Your commit message]"
    7. git push
  4. Navigate to GitHub and you should now see most of the files.
    • note that it is intentional that some are not synced with GitHub and this is done with the (hidden) .gitignore file that Forge’s MDK has provided (hence the strictness on which folder git init is run from)
  5. Now you can share your GitHub link with those who you are asking for help.

[Workaround line, please ignore]

 

Posted (edited)
On 5/26/2019 at 7:37 PM, quadraxis said:

Sorry, I should have perhaps been more clear.

I want the latest.log file from the client where this happens.

Please also upload it to a text-hosting site like pastebin/gist/etc and link it here, rather than trying to put the whole log in your post.

It's that ? I'm sorry, i don't know it. 

logs_server_minecraft.js

Edited by Teeoo
Posted
On 5/27/2019 at 9:30 PM, DaemonUmbra said:

Hmm, apparently the DataSerializers registry was added to 1.12.2 2 months ago (April 11 2019).

What version of Forge was this world created with?

All this server was created with the version of Forge " forge-1.12.2-14.23.5.2836 "

  • 3 weeks later...
Posted

I'm sorry for bumping this thread, but I have the same issue and I don't know why. I downloaded the SkyFactory 4 modpack and that came with Forge 1.12.2.2838. So, I downloaded Forge 1.12.2.2838 then try to connect to the server and get the "Missing minecraft:dataserializers" and I really want to join the server but I can't even though I'm hosting it. I always see I get disconnected in the console.

Posted

i found the solution 

it is the version of forge i had the same problem with pixelmon dowload this version of forge works fine 14.23.5.2838 

 

  • 3 weeks later...
  • 3 weeks later...
Posted
On 7/7/2019 at 8:20 AM, iii77764553454 said:

I have that same exact version, yet, It still keeps telling me that I'm missing data serializers 

me too

Posted
On 8/2/2019 at 12:47 PM, camisadeCanticle said:

I have this same problem, except it doesn't matter if I hit yes or no because they both take me back to the main menu

Same here ive been trying to figure out how to fix

Posted

Do not hijack other’s thread. Please make your own thread.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

  • 6 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.