Jump to content

Recommended Posts

Posted

Same thing but it said this 

---- Minecraft Crash Report ----
// This doesn't make any sense!

Time: 7/13/17 11:29 AM
Description: There was a severe problem during mod loading that has caused the game to fail

net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Wearable Backpacks (wearablebackpacks)
Caused by: java.lang.NoSuchMethodError: net.mcft.copy.backpacks.item.ItemBackpack.setUnlocalizedName(Ljava/lang/String;)Lnet/minecraft/item/Item;
    at net.mcft.copy.backpacks.item.ItemBackpack.<init>(ItemBackpack.java:67)
    at net.mcft.copy.backpacks.BackpacksContent.init(BackpacksContent.java:27)
    at net.mcft.copy.backpacks.WearableBackpacks.preInit(WearableBackpacks.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:628)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
    at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
    at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
    at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
    at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
    at com.google.common.eventbus.EventBus.post(EventBus.java:217)
    at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:252)
    at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:230)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
    at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
    at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
    at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
    at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
    at com.google.common.eventbus.EventBus.post(EventBus.java:217)
    at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:147)
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:604)
    at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:266)
    at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:466)
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:377)
    at net.minecraft.client.main.Main.main(SourceFile:123)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)


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

-- System Details --
Details:
    Minecraft Version: 1.12
    Operating System: Windows 7 (amd64) version 6.1
    Java Version: 1.8.0_25, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 149196760 bytes (142 MB) / 344530944 bytes (328 MB) up to 1060372480 bytes (1011 MB)
    JVM Flags: 6 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP 9.40 Powered by Forge 14.21.1.2407 8 mods loaded, 8 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
    UCH    minecraft{1.12} [Minecraft] (minecraft.jar) 
    UCH    mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
    UCH    FML{8.0.99.99} [Forge Mod Loader] (forge-1.12-14.21.1.2407.jar) 
    UCH    forge{14.21.1.2407} [Minecraft Forge] (forge-1.12-14.21.1.2407.jar) 
    UCH    biomesoplenty{7.0.0.2289} [Biomes O' Plenty] (BiomesOPlenty-1.12-7.0.0.2289-universal.jar) 
    UCH    forestry{5.4.3.129} [Forestry] (forestry_1.12-5.4.3.129.jar) 
    UCH    infernalmobs{1.7.2} [Infernal Mobs] (InfernalMobs-1.12 (1).jar) 
    UCE    wearablebackpacks{3.0.1} [Wearable Backpacks] (Wearable-Backpacks-Mod-1.12.jar) 
    Loaded coremods (and transformers): 
    GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.4.12874 Compatibility Profile Context 14.100.0.0' Renderer: 'AMD Radeon HD 5450'

  • Replies 63
  • Created
  • Last Reply

Top Posters In This Topic

Posted
3 hours ago, ZachGamer9er said:

Same thing but it said this 

---- Minecraft Crash Report ----
// This doesn't make any sense!

Time: 7/13/17 11:29 AM
Description: There was a severe problem during mod loading that has caused the game to fail

net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Wearable Backpacks (wearablebackpacks)
Caused by: java.lang.NoSuchMethodError: net.mcft.copy.backpacks.item.ItemBackpack.setUnlocalizedName(Ljava/lang/String;)Lnet/minecraft/item/Item;
    at net.mcft.copy.backpacks.item.ItemBackpack.<init>(ItemBackpack.java:67)
    at net.mcft.copy.backpacks.BackpacksContent.init(BackpacksContent.java:27)
    at net.mcft.copy.backpacks.WearableBackpacks.preInit(WearableBackpacks.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:628)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
    at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
    at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
    at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
    at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
    at com.google.common.eventbus.EventBus.post(EventBus.java:217)
    at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:252)
    at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:230)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
    at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
    at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
    at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
    at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
    at com.google.common.eventbus.EventBus.post(EventBus.java:217)
    at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:147)
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:604)
    at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:266)
    at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:466)
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:377)
    at net.minecraft.client.main.Main.main(SourceFile:123)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)


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

-- System Details --
Details:
    Minecraft Version: 1.12
    Operating System: Windows 7 (amd64) version 6.1
    Java Version: 1.8.0_25, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 149196760 bytes (142 MB) / 344530944 bytes (328 MB) up to 1060372480 bytes (1011 MB)
    JVM Flags: 6 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP 9.40 Powered by Forge 14.21.1.2407 8 mods loaded, 8 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
    UCH    minecraft{1.12} [Minecraft] (minecraft.jar) 
    UCH    mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
    UCH    FML{8.0.99.99} [Forge Mod Loader] (forge-1.12-14.21.1.2407.jar) 
    UCH    forge{14.21.1.2407} [Minecraft Forge] (forge-1.12-14.21.1.2407.jar) 
    UCH    biomesoplenty{7.0.0.2289} [Biomes O' Plenty] (BiomesOPlenty-1.12-7.0.0.2289-universal.jar) 
    UCH    forestry{5.4.3.129} [Forestry] (forestry_1.12-5.4.3.129.jar) 
    UCH    infernalmobs{1.7.2} [Infernal Mobs] (InfernalMobs-1.12 (1).jar) 
    UCE    wearablebackpacks{3.0.1} [Wearable Backpacks] (Wearable-Backpacks-Mod-1.12.jar) 
    Loaded coremods (and transformers): 
    GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.4.12874 Compatibility Profile Context 14.100.0.0' Renderer: 'AMD Radeon HD 5450'

I think its one of the mods you have.

Posted (edited)

Also, me and Choonster (A Forge Modder) were chatting and this is what we chatted about, also he said that he DIDNT MIND if I posted this in this thread so also if there is anything you guys can find into this please let me know, thank you:

Conversation

Hey, I really need your help with my 1.12 forge which is not working currently. If you can please read in on the reply I sent in the 1.12 forge thread please message or reply me back if you have ANY suggestions. Thank you. (also, sorry if sending you this counts as a form of harrasment, I am not really sure which is basically.)

I don't know what the cause of the problem is, so I can't help you any further.

Apperently, everytime I try to play minecraft with forge 1.12 it just either crashes or it just never loads. So I un-extracted every mod I had in forge 1.12 but it is still not working. I also deleted proof of the extracted mod in the fml section thing and made a seperate game directory for it but it is still not doing anything.  Can you please get any suggestions of help on why this is happening, I havent played minecraft in general for I think 2 weeks now.

All I can suggest is reinstalling Minecraft.

So I uninstall Minecraft and Download it agian? And also, what do Ii do about my forge?

 

14 hours ago, ThatGuyThomas said:

So I uninstall Minecraft and Download it agian? And also, what do Ii do about my forge?

 

Yes. Reinstall Forge after you've installed Minecraft.

So how do I uninstall Minecraft Install Minecraft agian Uninstall Forge 1.12 and Re Install it agian? (did i mention that I was a major idiot?)

Sorry I have to go we will discuss this tomorrow.

To uninstall Minecraft (or any other program) on Windows 10, open the Start menu, type in "Apps and Features" and click on Apps & Features in the search results. Find Minecraft in the list, click on it and click Uninstall.

 

To install Minecraft, go to minecraft.net, log in and then download and run the installer.

 

To install Forge, go to files.minecraftforge.net and download and run the installer for the version you want.

Okay so do you mean if you are using Windows 10 to play minecraft or if you are using minecraft Windows 10 EDITION?

I will still try that but please reply with an answer.

1 hour ago, ThatGuyThomas said:

Okay so do you mean if you are using Windows 10 to play minecraft or if you are using minecraft Windows 10 EDITION?

I will still try that but please reply with an answer.

 

I'm talking about the regular edition of Minecraft on Windows 10, not the Windows 10 Edition.

Okay, so I am trying to type in ""Apps & Features"" but then the windows search button vanished with the bottom apps slide...

Is that a problem? (Okay so nevermind everything is coming back, I have no clue what just hapened xD)

Okay, so are you SURE that all of my data and proof that I was even playing on mineccraft wont be deleted because it says here "This app and its related info will be uninstalled" I wont try it unless I get an answer because I am so afraid that it might delete my WHOLE minecraft account.

1 hour ago, ThatGuyThomas said:

Okay, so are you SURE that all of my data and proof that I was even playing on mineccraft wont be deleted because it says here "This app and its related info will be uninstalled" I wont try it unless I get an answer because I am so afraid that it might delete my WHOLE minecraft account.

 

Your account won't be affected, that's controlled by Mojang and not stored on your computer.

 

Any local data (e.g. saves) will likely be deleted, so back up anything you want to keep (i.e. copy it to a directory outside of the .minecraftdirectory).

So like all of the resource packs, servers, skins, mods, realms, etc. I had will all be deleted?!

55 minutes ago, ThatGuyThomas said:

So like all of the resource packs, servers, skins, mods, realms, etc. I had will all be deleted?!

 

Probably, yes. If you want to keep them, back them up before uninstalling and then copy them back to the original locations after reinstalling.

Okay, so I don't want to risk it, so is there any other way to fix my forge 1.12 problem? If not, thank you for your previous help.

52 minutes ago, ThatGuyThomas said:

Okay, so I don't want to risk it, so is there any other way to fix my forge 1.12 problem? If not, thank you for your previous help.

 

I don't know what's causing the problem, so I can't suggest any solutions to it. All I'm saying is that uninstalling may fix it.

Okay, so instead of trying that, I'm gonna try deleting every mod I had in the forge mod folder, but if that doesnt work, Ii may have to download the other forge 1.12 or even a 1.11 one or something. If none of those work, then I MAY have to uninstall and install my Minecraft. Thank you for your help, and I will tell you when its working agian.

So I deleted the 1 mod I had in forge and tried loading it agian, but it is still not loading so I wil try SAVING what I deleted.

So I deleted the extracted mod but it is still not loading, also, would you mind if I could copy and paste this conversation into the thread I made a week ago?

13 minutes ago, ThatGuyThomas said:

So I deleted the extracted mod but it is still not loading, also, would you mind if I could copy and paste this conversation into the thread I made a week ago?

 

I don't mind.

10 minutes ago, Choonster said:

 

I don't mind.

Okay thanks

Edited by ThatGuyThomas
Hes actualy A FORGE MODDER sorry.
Posted (edited)
2 minutes ago, ThatGuyThomas said:

Also, me and Choonster (A Forge Site Moderator)

 

I'm not a moderator.

 

Reality Controller is a title based on the number of posts I've made and Forge Modder was an opt-in group for mod developers before the site revamp (I'm not sure if it's still possible to opt-in).

Edited by Choonster

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted (edited)

Okay, so good news and bad news!

Good news: I finally got forge 1.12 to work!!! :D

Bad news: all of my mods in it are gone...

So, what I think I'm gonna do is re download all of them then put it in my mods folder WITHOUT extracting them next time.

This thread glitch is still not finished or fixed, so if there are any updates with it, I will let you guys know.

Thank you to EVERYONE who participated in helping me out with this, Happy Summer!! :)

Edited by ThatGuyThomas
typos :I
Posted

Okay, so what I did was instead of playing the actual forge 1.12 I used the regular vanilla miencraft 1.12 an, strangley, it still had forge in it. But atleast it worked from there. But, I re-downloaded all the mods I had (which was basically 1 xD) and I put them in the mods folder WITHOUT extracting them and now it isnt working. I think I messed it up somehow but I dont know since people were telling me the reason it wasnt working was because I had the mod EXTRACTED but it is no longer extracted from WinRAR to a folder but it is yet still not working. But I also know that the mod I have is the problem since when I dont have the mod inside the mods folder, it works perfectly fine. So, can somebody please tell me a way for me to have the mod AND play minecraft forge 1.12 with it? Thank you. MOD LINK: https://minecraft.curseforge.com/projects/quark (Its called The Quark Mod) Please tell me what is wrong with it.

Posted

Hey! So, you may have heard, my forge finally got fixed! And it was all thanks to samuelvelter2 who gave me instructions on discord! If you want to thank him to, his discord name is: samuelvelter2. And mine is: ThatGuyThomas. Okay, sorry for getting off topic. Anyways, so what he told me is that to fix this is to download something called MultiMC. So I sadly dont remember ALL of the instructions but, Im just so happy I finally got this fixed! Thank you to EVERYBODY who helped me on this. Espessialy samuelvelter2! So this will be the last time I am posting on this thread, sadly. But I am still happy I got it fixed! Thank you all and have a Happppppppppppy Summer! :D

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements




  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
    • Okay, but does the modpack works with 1.12 or just with 1.12.2, because I need the Forge client specifically for Minecraft 1.12, not 1.12.2
    • 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() ); } }  
  • Topics

×
×
  • Create New...

Important Information

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