Skip to content

Default lockon type improvement#2055

Merged
DonBruce64 merged 2 commits intoDonBruce64:masterfrom
Wartich:Default-lockon-change
Apr 17, 2026
Merged

Default lockon type improvement#2055
DonBruce64 merged 2 commits intoDonBruce64:masterfrom
Wartich:Default-lockon-change

Conversation

@Wartich
Copy link
Copy Markdown
Contributor

@Wartich Wartich commented Mar 10, 2026

Makes so that default lockon can use distance and cone angle, just like boresight

@Wartich Wartich changed the title Default lockon type Default lockon type improvement Mar 10, 2026
//Uses lockRange and lockMaxAngle from JSON like boresight.
startPoint = controller.getEyePosition();
searchVector = controller.getLineOfSight(RAYTRACE_DISTANCE);
coneAngle = DEFAULT_CONE_ANGLE;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is DEFAULT_CONE_ANGLE used anywhere else in the code? If so, does it need to be replaced with the lockMaxAngle? If it's not used anywhere else, it'd be good to delete it from this file since it's un-used.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It probably isn't, i'm pretty sure legacy compat already accounts for it. I'll try building without it and testing if anything breaks. IDE says it isn't used too so
image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, actually, unrelated, but i think something in this commit is causing crashes i haven't seen it cause before

---- Minecraft Crash Report ----

WARNING: coremods are present:
SuperMartijn642's Core Lib Plugin (_supermartijn642corelib-1.1.20-forge-mc1.12.jar)
IELoadingPlugin (ImmersiveEngineering-core-0.12-98.jar)
XaeroMinimapPlugin (Xaeros_Minimap_23.9.7_Forge_1.12.jar)
weaponlib (mw_2.0-0.4.6.2_mc1.12.2.jar)
XaeroWorldMapPlugin (XaerosWorldMap_1.37.7_Forge_1.12.jar)
Contact their authors BEFORE contacting forge

// Daisy, daisy...

Time: 3/12/26 4:39 PM
Description: Unexpected error

java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:592)
at java.lang.Integer.parseInt(Integer.java:615)
at minecrafttransportsimulator.baseclasses.ComputedVariable.getVariableNumber(ComputedVariable.java:107)
at minecrafttransportsimulator.entities.instances.EntityVehicleF_Physics.createComputedVariable(EntityVehicleF_Physics.java:845)
at minecrafttransportsimulator.entities.components.AEntityD_Definable.getOrCreateVariable(AEntityD_Definable.java:1099)
at minecrafttransportsimulator.entities.instances.EntityVehicleF_Physics.getOrCreateVariable(EntityVehicleF_Physics.java:706)
at minecrafttransportsimulator.entities.components.AEntityD_Definable.getAnimatedVariableValue(AEntityD_Definable.java:1070)
at minecrafttransportsimulator.entities.components.AEntityD_Definable.getAnimatedVariableValue(AEntityD_Definable.java:1079)
at minecrafttransportsimulator.baseclasses.AnimationSwitchbox.runSwitchbox(AnimationSwitchbox.java:95)
at minecrafttransportsimulator.entities.components.AEntityD_Definable.updateSounds(AEntityD_Definable.java:723)
at minecrafttransportsimulator.entities.components.AEntityB_Existing.update(AEntityB_Existing.java:163)
at minecrafttransportsimulator.entities.components.AEntityC_Renderable.update(AEntityC_Renderable.java:51)
at minecrafttransportsimulator.entities.components.AEntityD_Definable.update(AEntityD_Definable.java:339)
at minecrafttransportsimulator.entities.components.AEntityE_Interactable.update(AEntityE_Interactable.java:214)
at minecrafttransportsimulator.entities.components.AEntityF_Multipart.update(AEntityF_Multipart.java:125)
at minecrafttransportsimulator.entities.components.AEntityG_Towable.update(AEntityG_Towable.java:73)
at minecrafttransportsimulator.entities.instances.AEntityVehicleC_Colliding.update(AEntityVehicleC_Colliding.java:52)
at minecrafttransportsimulator.entities.instances.AEntityVehicleD_Moving.update(AEntityVehicleD_Moving.java:159)
at minecrafttransportsimulator.entities.instances.AEntityVehicleE_Powered.update(AEntityVehicleE_Powered.java:113)
at minecrafttransportsimulator.entities.instances.EntityVehicleF_Physics.update(EntityVehicleF_Physics.java:168)
at minecrafttransportsimulator.baseclasses.EntityManager.doTick(EntityManager.java:350)
at minecrafttransportsimulator.baseclasses.EntityManager.lambda$tickAll$3(EntityManager.java:215)
at java.lang.Iterable.forEach(Iterable.java:75)
at minecrafttransportsimulator.baseclasses.EntityManager.tickAll(EntityManager.java:213)
at mcinterface1122.InterfaceClient.onIVClientTick(InterfaceClient.java:202)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_35_InterfaceClient_onIVClientTick_ClientTickEvent.invoke(.dynamic)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182)
at net.minecraftforge.fml.common.FMLCommonHandler.onPreClientTick(FMLCommonHandler.java:344)
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1708)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1098)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:398)
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:498)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
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:498)
at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:243)
at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:278)
at org.multimc.EntryPoint.listen(EntryPoint.java:143)
at org.multimc.EntryPoint.main(EntryPoint.java:34)

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

-- Head --
Thread: Client thread
Stacktrace:
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:592)
at java.lang.Integer.parseInt(Integer.java:615)
at minecrafttransportsimulator.baseclasses.ComputedVariable.getVariableNumber(ComputedVariable.java:107)
at minecrafttransportsimulator.entities.instances.EntityVehicleF_Physics.createComputedVariable(EntityVehicleF_Physics.java:845)
at minecrafttransportsimulator.entities.components.AEntityD_Definable.getOrCreateVariable(AEntityD_Definable.java:1099)
at minecrafttransportsimulator.entities.instances.EntityVehicleF_Physics.getOrCreateVariable(EntityVehicleF_Physics.java:706)
at minecrafttransportsimulator.entities.components.AEntityD_Definable.getAnimatedVariableValue(AEntityD_Definable.java:1070)
at minecrafttransportsimulator.entities.components.AEntityD_Definable.getAnimatedVariableValue(AEntityD_Definable.java:1079)
at minecrafttransportsimulator.baseclasses.AnimationSwitchbox.runSwitchbox(AnimationSwitchbox.java:95)
at minecrafttransportsimulator.entities.components.AEntityD_Definable.updateSounds(AEntityD_Definable.java:723)
at minecrafttransportsimulator.entities.components.AEntityB_Existing.update(AEntityB_Existing.java:163)
at minecrafttransportsimulator.entities.components.AEntityC_Renderable.update(AEntityC_Renderable.java:51)
at minecrafttransportsimulator.entities.components.AEntityD_Definable.update(AEntityD_Definable.java:339)
at minecrafttransportsimulator.entities.components.AEntityE_Interactable.update(AEntityE_Interactable.java:214)
at minecrafttransportsimulator.entities.components.AEntityF_Multipart.update(AEntityF_Multipart.java:125)
at minecrafttransportsimulator.entities.components.AEntityG_Towable.update(AEntityG_Towable.java:73)
at minecrafttransportsimulator.entities.instances.AEntityVehicleC_Colliding.update(AEntityVehicleC_Colliding.java:52)
at minecrafttransportsimulator.entities.instances.AEntityVehicleD_Moving.update(AEntityVehicleD_Moving.java:159)
at minecrafttransportsimulator.entities.instances.AEntityVehicleE_Powered.update(AEntityVehicleE_Powered.java:113)
at minecrafttransportsimulator.entities.instances.EntityVehicleF_Physics.update(EntityVehicleF_Physics.java:168)
at minecrafttransportsimulator.baseclasses.EntityManager.doTick(EntityManager.java:350)
at minecrafttransportsimulator.baseclasses.EntityManager.lambda$tickAll$3(EntityManager.java:215)
at java.lang.Iterable.forEach(Iterable.java:75)
at minecrafttransportsimulator.baseclasses.EntityManager.tickAll(EntityManager.java:213)
at mcinterface1122.InterfaceClient.onIVClientTick(InterfaceClient.java:202)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_35_InterfaceClient_onIVClientTick_ClientTickEvent.invoke(.dynamic)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182)
at net.minecraftforge.fml.common.FMLCommonHandler.onPreClientTick(FMLCommonHandler.java:344)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityPlayerSP['Wartich'/53, l='MpServer', x=-1436.64, y=4.00, z=66.05]]
Chunk stats: MultiplayerChunkCache: 3481, 3481
Level seed: 0
Level generator: ID 01 - flat, ver 0. Features enabled: false
Level generator options:
Level spawn location: World: (-1435,4,65), Chunk: (at 5,0,1 in -90,4; contains blocks -1440,0,64 to -1425,255,79), Region: (-3,0; contains chunks -96,0 to -65,31, blocks -1536,0,0 to -1025,255,511)
Level time: 4299 game time, 4299 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 23 total; [EntitySlime['Слизень'/320, l='MpServer', x=-1512.67, y=4.00, z=55.86], EntityItem['item.item.auweschvebm.auweschveb_vehicle_a_yf40_camoflague'/2, l='MpServer', x=-1437.00, y=4.00, z=70.15], EntitySlime['Слизень'/258, l='MpServer', x=-1488.73, y=5.25, z=4.11], EntitySlime['Слизень'/330, l='MpServer', x=-1507.12, y=4.92, z=135.12], EntitySlime['Слизень'/203, l='MpServer', x=-1468.34, y=4.00, z=47.78], EntitySlime['Слизень'/338, l='MpServer', x=-1501.36, y=4.95, z=82.51], EntityItemFrame['entity.ItemFrame.name'/23, l='MpServer', x=-1490.50, y=7.50, z=192.03], BuilderEntityExisting['entity.mts_entity.name'/344, l='MpServer', x=-1440.50, y=4.00, z=66.50], EntitySlime['Слизень'/281, l='MpServer', x=-1500.01, y=4.00, z=32.28], EntityItemFrame['entity.ItemFrame.name'/34, l='MpServer', x=-1471.97, y=7.50, z=180.50], EntitySlime['Слизень'/298, l='MpServer', x=-1501.60, y=5.02, z=72.60], BuilderEntityExisting['entity.mts_entity.name'/176, l='MpServer', x=-1436.79, y=4.00, z=66.05], BuilderEntityRenderForwarder['entity.mts_entity_renderer.name'/178, l='MpServer', x=-1437.76, y=5.68, z=66.06], EntityPig['Свинья'/179, l='MpServer', x=-1497.50, y=4.00, z=31.50], EntityPig['Свинья'/180, l='MpServer', x=-1498.31, y=4.00, z=30.40], EntityPig['Свинья'/181, l='MpServer', x=-1499.64, y=4.00, z=27.67], EntityHorse['Лошадь'/182, l='MpServer', x=-1490.79, y=4.00, z=34.32], EntitySlime['Слизень'/310, l='MpServer', x=-1484.95, y=4.64, z=61.89], EntityHorse['Лошадь'/183, l='MpServer', x=-1491.74, y=4.00, z=33.85], EntityHorse['Лошадь'/184, l='MpServer', x=-1490.78, y=4.00, z=32.71], EntitySlime['Слизень'/313, l='MpServer', x=-1501.70, y=4.64, z=141.24], EntitySlime['Слизень'/316, l='MpServer', x=-1502.93, y=4.08, z=47.42], EntityPlayerSP['Wartich'/53, l='MpServer', x=-1436.64, y=4.00, z=66.05]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:532)
at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:2741)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:427)
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:498)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
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:498)
at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:243)
at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:278)
at org.multimc.EntryPoint.listen(EntryPoint.java:143)
at org.multimc.EntryPoint.main(EntryPoint.java:34)

Any idea what causes that? I can't find any empty fields in my json and it does not crash when i build without this pr

@DonBruce64
Copy link
Copy Markdown
Owner

@Wartich
minecrafttransportsimulator.entities.instances.EntityVehicleF_Physics.createComputedVariable(EntityVehicleF_Physics.java:845)

Check that line in that class. It should tell you what computed variable it doesn't like that it's trying to make. Probably something to do with radar or something.

@Wartich
Copy link
Copy Markdown
Contributor Author

Wartich commented Apr 17, 2026

Alright crash report was my stupidity. I tested in my "master" branch with other stuff piled in, and vehicle had missile_lockedonto variable on it, so when i spawned that vehicle in this PR branch it crashed since there's no such thing. Removed the unused stuff in commit, it's in the legacy compact anyway. Works, doesn't crash. Also, mind explaining how to attach commits to replies?

@DonBruce64
Copy link
Copy Markdown
Owner

I don't now how to attach a commit to a reply. But I can always just re-review the thing when I see the reply noted, like I do now. Looks good to me sir! Merged.

@DonBruce64 DonBruce64 merged commit 4bb4efe into DonBruce64:master Apr 17, 2026
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.

2 participants