Jump to content

Recommended Posts

Posted

Hi everyone, if you know the solution to this problem please reply.

Whenever I install MC Patcher and Minecraft Forge and I create a new world, Minecraft crashes. A notebook file appears on my desktop. Please help me with this problem! :'(

 

Notebookfile contents:

#

# A fatal error has been detected by the Java Runtime Environment:

#

#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x691ba8f5, pid=7932, tid=3780

#

# JRE version: 6.0_31-b05

# Java VM: Java HotSpot Client VM (20.6-b01 mixed mode windows-x86 )

# Problematic frame:

# C  [atioglxx.dll+0x19a8f5]

#

# If you would like to submit a bug report, please visit:

http://java.sun.com/webapps/bugreport/crash.jsp

# The crash happened outside the Java Virtual Machine in native code.

# See problematic frame for where to report the bug.

#

 

---------------  T H R E A D  ---------------

 

Current thread (0x4d97b000):  JavaThread "Minecraft main thread" daemon [_thread_in_native, id=3780, stack(0x4ec80000,0x4ecd0000)]

 

siginfo: ExceptionCode=0xc0000005, reading address 0x126101b0

 

Registers:

EAX=0x126101b0, EBX=0x126101b0, ECX=0x4ff57844, EDX=0x50723508

ESP=0x4eccf860, EBP=0x4ff57844, ESI=0x5ec93c08, EDI=0x699176c0

EIP=0x691ba8f5, EFLAGS=0x00010202

 

Top of Stack: (sp=0x4eccf860)

0x4eccf860:  69919e40 5ec93c08 4eccf88c 5ec93c08

0x4eccf870:  699176c0 4ff57844 6907a1ad 5ec93c08

0x4eccf880:  00000000 4f84df30 690868c8 00000568

0x4eccf890:  69087459 4f656fd0 5ec93c08 4f656fec

0x4eccf8a0:  00000001 4f656fd0 00000000 00000000

0x4eccf8b0:  00000000 00000000 00000000 00000000

0x4eccf8c0:  69084af3 4f656fd0 4f656fd0 4ed4d780

0x4eccf8d0:  00000000 00000001 6918d645 4f656fd0

 

Instructions: (pc=0x691ba8f5)

0x691ba8d5:  75 eb 8b 6d 18 85 ed 89 6c 24 14 0f 84 e8 00 00

0x691ba8e5:  00 8b 4c 24 14 8b 59 04 85 db 0f 84 cb 00 00 00

0x691ba8f5:  8b 03 3d a0 64 1b 69 75 1d 8b 4b 20 85 c9 0f 84

0x691ba905:  9d 00 00 00 8b 47 10 05 98 25 00 00 e8 da aa 33

 

 

Register to memory mapping:

 

EAX=0x126101b0 is an unallocated location in the heap

EBX=0x126101b0 is an unallocated location in the heap

ECX=0x4ff57844 is an unknown value

EDX=0x50723508 is an unknown value

ESP=0x4eccf860 is pointing into the stack for thread: 0x4d97b000

EBP=0x4ff57844 is an unknown value

ESI=0x5ec93c08 is an unknown value

EDI=0x699176c0 is an unknown value

 

 

Stack: [0x4ec80000,0x4ecd0000],  sp=0x4eccf860,  free space=318k

Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)

C  [atioglxx.dll+0x19a8f5]  atiPPHSN+0xd7c65

 

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)

j  org.lwjgl.opengl.WindowsContextImplementation.nDestroy(Ljava/nio/ByteBuffer;)V+0

j  org.lwjgl.opengl.WindowsContextImplementation.destroy(Lorg/lwjgl/opengl/PeerInfo;Ljava/nio/ByteBuffer;)V+1

j  org.lwjgl.opengl.Context.checkDestroy()V+29

j  org.lwjgl.opengl.Context.destroy()V+47

j  org.lwjgl.opengl.Context.forceDestroy()V+5

j  org.lwjgl.opengl.Display.destroyContext()V+3

j  org.lwjgl.opengl.Display.destroy()V+18

j  net.minecraft.client.Minecraft.d()V+87

j  net.minecraft.client.Minecraft.run()V+137

j  java.lang.Thread.run()V+11

v  ~StubRoutines::call_stub

 

---------------  P R O C E S S  ---------------

 

Java Threads: ( => current thread )

  0x4d97dc00 JavaThread "File IO Thread" daemon [_thread_blocked, id=7388, stack(0x5e3c0000,0x5e410000)]

  0x4d97b800 JavaThread "Thread-12" daemon [_thread_in_native, id=5376, stack(0x4f180000,0x4f1d0000)]

=>0x4d97b000 JavaThread "Minecraft main thread" daemon [_thread_in_native, id=3780, stack(0x4ec80000,0x4ecd0000)]

  0x4d97ac00 JavaThread "Timer hack thread" daemon [_thread_blocked, id=6036, stack(0x4d6b0000,0x4d700000)]

  0x4d8bf400 JavaThread "TimerQueue" daemon [_thread_blocked, id=7864, stack(0x4d500000,0x4d550000)]

  0x4d8bbc00 JavaThread "D3D Screen Updater" daemon [_thread_blocked, id=4612, stack(0x4d450000,0x4d4a0000)]

  0x01db9000 JavaThread "DestroyJavaVM" [_thread_blocked, id=5644, stack(0x01400000,0x01450000)]

  0x4a11f000 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=5592, stack(0x4d310000,0x4d360000)]

  0x4a149c00 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3020, stack(0x4a8b0000,0x4a900000)]

  0x4a149400 JavaThread "AWT-Shutdown" [_thread_blocked, id=516, stack(0x4a7e0000,0x4a830000)]

  0x4a146c00 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=7632, stack(0x4a790000,0x4a7e0000)]

  0x01cd4400 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=6160, stack(0x49ff0000,0x4a040000)]

  0x01cbf800 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=5232, stack(0x49fa0000,0x49ff0000)]

  0x01cbc800 JavaThread "Attach Listener" daemon [_thread_blocked, id=568, stack(0x49f50000,0x49fa0000)]

  0x01cbb800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1392, stack(0x01d50000,0x01da0000)]

  0x01c90c00 JavaThread "Finalizer" daemon [_thread_blocked, id=6596, stack(0x01d00000,0x01d50000)]

  0x01c8c000 JavaThread "Reference Handler" daemon [_thread_blocked, id=7356, stack(0x019b0000,0x01a00000)]

 

Other Threads:

  0x01c87000 VMThread [stack: 0x01450000,0x014a0000] [id=6276]

  0x01ce5800 WatcherThread [stack: 0x4a040000,0x4a090000] [id=5704]

 

VM state:not at safepoint (normal execution)

 

VM Mutex/Monitor currently owned by a thread: None

 

Heap

def new generation  total 157376K, used 4666K [0x03dc0000, 0x0e880000, 0x19310000)

  eden space 139904K,  3% used [0x03dc0000, 0x0424eb10, 0x0c660000)

  from space 17472K,  0% used [0x0d770000, 0x0d770000, 0x0e880000)

  to  space 17472K,  0% used [0x0c660000, 0x0c660000, 0x0d770000)

tenured generation  total 349568K, used 56498K [0x19310000, 0x2e870000, 0x43dc0000)

  the space 349568K,  16% used [0x19310000, 0x1ca3ca10, 0x1ca3cc00, 0x2e870000)

compacting perm gen  total 19200K, used 19198K [0x43dc0000, 0x45080000, 0x47dc0000)

  the space 19200K,  99% used [0x43dc0000, 0x4507faf8, 0x4507fc00, 0x45080000)

No shared spaces configured.

 

Code Cache  [0x01dc0000, 0x02180000, 0x03dc0000)

total_blobs=2260 nmethods=1920 adapters=274 free_code_cache=29652992 largest_free_block=192

 

Dynamic libraries:

0x00400000 - 0x00425000 C:\Program Files\Java\jre6\bin\javaw.exe

0x77100000 - 0x77228000 C:\Windows\system32\ntdll.dll

0x75e30000 - 0x75f0c000 C:\Windows\system32\kernel32.dll

0x75970000 - 0x75a36000 C:\Windows\system32\ADVAPI32.dll

0x76220000 - 0x762e3000 C:\Windows\system32\RPCRT4.dll

0x75b60000 - 0x75bfd000 C:\Windows\system32\USER32.dll

0x77250000 - 0x7729b000 C:\Windows\system32\GDI32.dll

0x75f10000 - 0x75f2e000 C:\Windows\system32\IMM32.DLL

0x76ea0000 - 0x76f68000 C:\Windows\system32\MSCTF.dll

0x760f0000 - 0x7619a000 C:\Windows\system32\msvcrt.dll

0x77240000 - 0x77249000 C:\Windows\system32\LPK.DLL

0x761a0000 - 0x7621d000 C:\Windows\system32\USP10.dll

0x7c340000 - 0x7c396000 C:\Program Files\Java\jre6\bin\msvcr71.dll

0x6d7f0000 - 0x6da9f000 C:\Program Files\Java\jre6\bin\client\jvm.dll

0x73e30000 - 0x73e62000 C:\Windows\system32\WINMM.dll

0x757d0000 - 0x75915000 C:\Windows\system32\ole32.dll

0x772d0000 - 0x7735d000 C:\Windows\system32\OLEAUT32.dll

0x73770000 - 0x737a9000 C:\Windows\system32\OLEACC.dll

0x75600000 - 0x7562c000 C:\Windows\system32\apphelp.dll

0x6d7a0000 - 0x6d7ac000 C:\Program Files\Java\jre6\bin\verify.dll

0x6d320000 - 0x6d33f000 C:\Program Files\Java\jre6\bin\java.dll

0x6d7e0000 - 0x6d7ef000 C:\Program Files\Java\jre6\bin\zip.dll

0x6d000000 - 0x6d14c000 C:\Program Files\Java\jre6\bin\awt.dll

0x72690000 - 0x726d2000 C:\Windows\system32\WINSPOOL.DRV

0x74610000 - 0x747ae000 C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6002.18305_none_5cb72f2a088b0ed3\COMCTL32.dll

0x76320000 - 0x76379000 C:\Windows\system32\SHLWAPI.dll

0x6e3e0000 - 0x6e3ec000 C:\Windows\system32\DWMAPI.DLL

0x747c0000 - 0x747ff000 C:\Windows\system32\uxtheme.dll

0x4a900000 - 0x4a953000 C:\ProgramData\Anti-phishing Domain Advisor\visicom_antiphishing.dll

0x74e60000 - 0x74e68000 C:\Windows\system32\VERSION.dll

0x772a0000 - 0x772cd000 C:\Windows\system32\WS2_32.dll

0x77230000 - 0x77236000 C:\Windows\system32\NSI.dll

0x76380000 - 0x76e91000 C:\Windows\system32\SHELL32.dll

0x75680000 - 0x7569e000 C:\Windows\system32\USERENV.dll

0x75660000 - 0x75674000 C:\Windows\system32\Secur32.dll

0x6d230000 - 0x6d27f000 C:\Program Files\Java\jre6\bin\fontmanager.dll

0x6df80000 - 0x6e13a000 C:\Windows\system32\d3d9.dll

0x6df40000 - 0x6df46000 C:\Windows\system32\d3d8thk.dll

0x6a010000 - 0x6a3e2000 C:\Windows\system32\atiumdag.dll

0x6b540000 - 0x6b998000 C:\Windows\system32\atiumdva.dll

0x6d600000 - 0x6d613000 C:\Program Files\Java\jre6\bin\net.dll

0x749e0000 - 0x749f4000 C:\Windows\system32\wpclsp.dll

0x754c0000 - 0x75536000 C:\Windows\system32\NETAPI32.dll

0x757c0000 - 0x757c7000 C:\Windows\system32\PSAPI.DLL

0x74df0000 - 0x74e2b000 C:\Windows\system32\mswsock.dll

0x74e50000 - 0x74e55000 C:\Windows\System32\wship6.dll

0x6d620000 - 0x6d629000 C:\Program Files\Java\jre6\bin\nio.dll

0x74ab0000 - 0x74ab5000 C:\Windows\System32\wshtcpip.dll

0x73530000 - 0x7353f000 C:\Windows\system32\NLAapi.dll

0x75060000 - 0x75079000 C:\Windows\system32\IPHLPAPI.DLL

0x75020000 - 0x75055000 C:\Windows\system32\dhcpcsvc.DLL

0x752a0000 - 0x752cc000 C:\Windows\system32\DNSAPI.dll

0x75010000 - 0x75017000 C:\Windows\system32\WINNSI.DLL

0x74fe0000 - 0x75002000 C:\Windows\system32\dhcpcsvc6.DLL

0x71a10000 - 0x71a1f000 C:\Windows\system32\napinsp.dll

0x719d0000 - 0x719e2000 C:\Windows\system32\pnrpnsp.dll

0x71a00000 - 0x71a08000 C:\Windows\System32\winrnr.dll

0x75920000 - 0x75969000 C:\Windows\system32\WLDAP32.dll

0x71820000 - 0x71841000 C:\Program Files\Bonjour\mdnsNSP.dll

0x722a0000 - 0x722a6000 C:\Windows\system32\rasadhlp.dll

0x74b70000 - 0x74bab000 C:\Windows\system32\rsaenh.dll

0x6d780000 - 0x6d788000 C:\Program Files\Java\jre6\bin\sunmscapi.dll

0x75100000 - 0x751f2000 C:\Windows\system32\CRYPT32.dll

0x75260000 - 0x75272000 C:\Windows\system32\MSASN1.dll

0x4de60000 - 0x4decb000 C:\Users\Cole\AppData\Roaming\.minecraft\bin\natives\lwjgl.dll

0x737d0000 - 0x7389b000 C:\Windows\system32\OPENGL32.dll

0x73c60000 - 0x73c83000 C:\Windows\system32\GLU32.dll

0x678c0000 - 0x679a5000 C:\Windows\system32\DDRAW.dll

0x73e00000 - 0x73e06000 C:\Windows\system32\DCIMAN32.dll

0x76f70000 - 0x770fa000 C:\Windows\system32\SETUPAPI.dll

0x6d350000 - 0x6d356000 C:\Program Files\Java\jre6\bin\jawt.dll

0x69020000 - 0x699a3000 C:\Windows\system32\atioglxx.dll

0x4dda0000 - 0x4ddb3000 C:\Users\Cole\AppData\Roaming\.minecraft\bin\natives\jinput-dx8.dll

0x671e0000 - 0x67213000 C:\Windows\system32\DINPUT8.dll

0x733d0000 - 0x733d9000 C:\Windows\system32\HID.DLL

0x74810000 - 0x7483d000 C:\Windows\system32\WINTRUST.dll

0x762f0000 - 0x76319000 C:\Windows\system32\imagehlp.dll

0x4de30000 - 0x4de42000 C:\Users\Cole\AppData\Roaming\.minecraft\bin\natives\jinput-raw.dll

0x6d690000 - 0x6d700000 C:\Windows\system32\dsound.dll

0x74ad0000 - 0x74aea000 C:\Windows\system32\POWRPROF.dll

0x75a40000 - 0x75ac4000 C:\Windows\system32\CLBCatQ.DLL

0x73620000 - 0x73648000 C:\Windows\System32\MMDevApi.dll

0x73540000 - 0x7356f000 C:\Windows\system32\wdmaud.drv

0x73730000 - 0x73734000 C:\Windows\system32\ksuser.dll

0x73740000 - 0x73747000 C:\Windows\system32\AVRT.dll

0x73410000 - 0x73431000 C:\Windows\system32\AUDIOSES.DLL

0x73150000 - 0x731b6000 C:\Windows\system32\audioeng.dll

0x73500000 - 0x73509000 C:\Windows\system32\msacm32.drv

0x733f0000 - 0x73404000 C:\Windows\system32\MSACM32.dll

0x733e0000 - 0x733e7000 C:\Windows\system32\midimap.dll

0x670d0000 - 0x67144000 C:\Windows\system32\RICHED20.DLL

 

VM Arguments:

jvm_args: -Xms512m -Xmx1024m

java_command: C:\Users\Cole\Desktop\Minecraft.exe

Launcher Type: SUN_STANDARD

 

Environment Variables:

CLASSPATH=.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip

PATH=C:\Windows\system32;C:\Windows;C:\Windows\system32\wbem;C:\Windows\system32\windowspowershell\v1.0\;c:\program files\ati technologies\ati.ace\core-static;c:\progra~1\common~1\uleads~1\mpeg;c:\program files\microsoft sql server\90\tools\binn\;c:\program files\checkpoint\fde;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Java\jre6\bin

USERNAME=Cole

OS=Windows_NT

PROCESSOR_IDENTIFIER=x86 Family 6 Model 23 Stepping 6, GenuineIntel

 

 

 

---------------  S Y S T E M  ---------------

 

OS: Windows Vista Build 6002 Service Pack 2

 

CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 23 stepping 6, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1

 

Memory: 4k page, physical 3139540k(1090876k free), swap 6484868k(3355068k free)

 

vm_info: Java HotSpot Client VM (20.6-b01) for windows-x86 JRE (1.6.0_31-b05), built on Feb  3 2012 18:44:09 by "java_re" with MS VC++ 7.1 (VS2003)

 

time: Sun Jul 22 16:21:04 2012

elapsed time: 94 seconds

 

 

 

Posted

Firstly, don't use MCPatcher with Forge. Ever. Install it manually or try other patchers. I hear MultiMC is fine.

Secondly, use spoiler tags when you're sending info like that.

 

[spoiler]Put the information here.[/spoiler]

 

And lastly, this belongs, if anywhere at all, on the Support & Bug Reports Topic.

 

:)

Check out my

Texture Packs Thread here on the Forge Forum. :)

Currently in the process of adding some mod support for JohnSmith Texture Pack.

width=105 height=12https://www.sugarsync.com/piv/D8135159_67366891_21351[/img]

 

width=209 height=19https://www.sugarsync.com/piv/D8135159_67366891_772852[/img]

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

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