Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix trailers friction and make them slowdown gracefully #466

Open
wants to merge 2 commits into
base: 1.16.X
Choose a base branch
from

Conversation

enricotagliavini
Copy link

This commit fix an issue reported multiple times such as

#450
#448

I tested this change in 1.16.5. I had to use a commit from a few days ago as the very latest from 1.16.X crashes my game and am not sure why as of yet.

Disclaimer: first time ever I try to code on a Minecraft mod, hopefully I've done nothing completely dumb :)

Basic logic to stop a trailer when unhitched while moving to prevent
infinite motion in last direction.

Can implement a nicer slow down logic in a later commit
Implement the same slowdown mechanics as the PoweredVehicle for trailers
@enricotagliavini
Copy link
Author

enricotagliavini commented Jun 13, 2021

Oh I'm 19 hours late apparently, I see this might have been fixed already ^_^'''

EDIT: or maybe not. The code was changed to the new mappings(?), but I can't see any slowdown logic. Unfortunately I can't test the new code, I get a crash on world load

net.minecraftforge.fml.common.ObfuscationReflectionHelper$UnableToFindFieldException: java.lang.NoSuchFieldException: layers
	at net.minecraftforge.fml.common.ObfuscationReflectionHelper.findField(ObfuscationReflectionHelper.java:242) ~[forge:?] {re:classloading}
	at net.minecraftforge.fml.common.ObfuscationReflectionHelper.getPrivateValue(ObfuscationReflectionHelper.java:87) ~[forge:?] {re:classloading}
	at com.mrcrayfish.vehicle.client.handler.HeldVehicleHandler.patchPlayerRender(HeldVehicleHandler.java:43) ~[vehicle:0.45.2-1.16.3] {re:classloading}
	at com.mrcrayfish.vehicle.client.handler.HeldVehicleHandler.onRenderPlayer(HeldVehicleHandler.java:35) ~[vehicle:0.45.2-1.16.3] {re:classloading}
	at net.minecraftforge.eventbus.ASMEventHandler_54_HeldVehicleHandler_onRenderPlayer_Pre.invoke(.dynamic) ~[?:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-4.0.0.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?] {}
	at net.minecraft.client.renderer.entity.PlayerRenderer.func_225623_a_(PlayerRenderer.java:63) ~[?:?] {re:classloading,xf:fml:forge:crossbows.2,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.entity.PlayerRenderer.func_225623_a_(PlayerRenderer.java:41) ~[?:?] {re:classloading,xf:fml:forge:crossbows.2,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.entity.EntityRendererManager.func_229084_a_(EntityRendererManager.java:251) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.WorldRenderer.func_228418_a_(WorldRenderer.java:1202) ~[?:?] {re:classloading,xf:fml:journeymap:WorldRenderer.markForRerender,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.WorldRenderer.func_228426_a_(WorldRenderer.java:1010) ~[?:?] {re:classloading,xf:fml:journeymap:WorldRenderer.markForRerender,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.func_228378_a_(GameRenderer.java:608) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.func_195458_a(GameRenderer.java:425) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:976) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:607) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:184) ~[1.16.5-forge-36.1.18.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_292] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_292] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_292] {}
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_292] {}
	at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51) ~[forge-1.16.5-36.1.18.jar:36.1] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {}
Caused by: java.lang.NoSuchFieldException: layers
	at java.lang.Class.getDeclaredField(Class.java:2070) ~[?:1.8.0_292] {}
	at net.minecraftforge.fml.common.ObfuscationReflectionHelper.findField(ObfuscationReflectionHelper.java:236) ~[forge:?] {re:classloading}
	... 27 more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant