squeek502 / AppleCore

An API for modifying the food and hunger mechanics of Minecraft
The Unlicense
55 stars 24 forks source link

Conflicting ASMs [1.7] #85

Closed KryptonCaptain closed 7 years ago

KryptonCaptain commented 7 years ago

So, after getting a custom build of Cube's Edge running, I dropped it into my test instance only to find that it (not my code) and this mod are both doing an ASM on the vanilla ItemRenderer, and that's causing problems. Any ideas or suggestions? I wouldn't even know where to start trying to fix this on CE's end, and it hasn't really seen any activity in a while - so I'm hoping you can help.

---- Minecraft Crash Report ----
// Oh - I know what I did wrong!

Time: 15/04/17 12:44 AM
Description: Initializing game

java.lang.NoClassDefFoundError: net/minecraft/client/renderer/ItemRenderer
    at net.minecraft.client.Minecraft.func_71384_a(Unknown Source)
    at net.minecraft.client.Minecraft.func_99999_d(Unknown Source)
    at net.minecraft.client.main.Main.main(SourceFile:148)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:236)
    at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:297)
    at org.multimc.EntryPoint.listen(EntryPoint.java:162)
    at org.multimc.EntryPoint.main(EntryPoint.java:53)
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.renderer.ItemRenderer
    at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 17 more
Caused by: java.lang.RuntimeException: ItemRenderer.renderItemInFirstPerson: INVOKEVIRTUAL getMaxItemUseDuration instruction not found
    at squeek.applecore.asm.module.ModuleFoodEatingSpeed.patchRenderItemInFirstPerson(ModuleFoodEatingSpeed.java:77)
    at squeek.applecore.asm.module.ModuleFoodEatingSpeed.transform(ModuleFoodEatingSpeed.java:58)
    at squeek.applecore.asm.TransformerModuleHandler.transform(TransformerModuleHandler.java:42)
    at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279)
    at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176)
    ... 19 more

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

-- Head --
Stacktrace:
    at net.minecraft.client.Minecraft.func_71384_a(Unknown Source)
    at net.minecraft.client.Minecraft.func_99999_d(Unknown Source)

-- Initialization --
Details:
Stacktrace:
    at net.minecraft.client.main.Main.main(SourceFile:148)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:236)
    at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:297)
    at org.multimc.EntryPoint.listen(EntryPoint.java:162)
    at org.multimc.EntryPoint.main(EntryPoint.java:53)

-- System Details --
Details:
    Minecraft Version: 1.7.10
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_121, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 1526126168 bytes (1455 MB) / 2677538816 bytes (2553 MB) up to 3817865216 bytes (3641 MB)
    JVM Flags: 5 total; -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xms2048m -Xmx4096m
    AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1614 Optifine OptiFine_1.7.10_HD_D1 57 mods loaded, 57 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
    UCH mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
    UCH FML{7.10.99.99} [Forge Mod Loader] (forge-1.7.10-10.13.4.1614-1.7.10-universal.jar) 
    UCH Forge{10.13.4.1614} [Minecraft Forge] (forge-1.7.10-10.13.4.1614-1.7.10-universal.jar) 
    UCH CodeChickenCore{1.0.7.47} [CodeChicken Core] (minecraft.jar) 
    UCH NotEnoughItems{1.0.5.120} [Not Enough Items] (NotEnoughItems-1.7.10-1.0.5.120-universal.jar) 
    UCH FastCraft{1.23} [FastCraft] (fastcraft-1.23.jar) 
    UCH battlegear2{1.7.10} [Mine & Blade Battlegear 2 - Bullseye] (1.7.10-MB_Battlegear2-Bullseye-1.0.8.2.jar) 
    UCH bspkrsCore{6.15} [bspkrsCore] ([1.7.10]bspkrsCore-universal-6.15.jar) 
    UCH ArmorStatusHUD{1.27} [ArmorStatusHUD] ([1.7.10]ArmorStatusHUD-client-1.27.jar) 
    UCH DamageIndicatorsMod{3.2.3} [Damage Indicators] ([1.7.10]DamIndMod-3.2.3.jar) 
    UCH StatusEffectHUD{1.26} [StatusEffectHUD] ([1.7.10]StatusEffectHUD-client-1.26.jar) 
    UCH Baubles{1.0.1.10} [Baubles] (Baubles-1.7.10-1.0.1.10.jar) 
    UCH Thaumcraft{4.2.3.5} [Thaumcraft] (Thaumcraft-1.7.10-4.2.3.5.jar) 
    UCH Botania{r1.7-515} [A New Dawn: Botania] (A-New-Dawn-Botania r1.7-515.jar) 
    UCH ambiotic{1.2.1} [Ambiotic] (ambiotic-1.2.1.jar) 
    UCH antiqueatlas{1.7.10-4.2.10} [Antique Atlas] (antiqueatlas-1.7.10-4.2.10.jar) 
    UCH AppleCore{1.3.2} [AppleCore] (AppleCore-mc1.7.10-1.3.2.jar) 
    UCH armorchroma{1.2} [Armor Chroma] (armorchroma-1.2-1.7.10.jar) 
    UCH ascribe{1.7.10-0.1} [Ascribe] (Ascribe-1.7.10-0.1.jar) 
    UCH BattleText{1.0.16} [BattleText] (BattleText-1.7.10-1.0.16-64.jar) 
    UCH BetterAchievements{0.1.0} [Better Achievements] (BetterAchievements-1.7.10-0.1.0.jar) 
    UCH BetterFoliage{2.0.15} [Better Foliage] (BetterFoliage-MC1.7.10-2.0.15.jar) 
    UCH BetterHorseHud{1.0} [Better Horse Hud] (BetterHorseHud-1.7.10-1.0.jar) 
    UCH ChatFlow{1.1} [ChatFlow] (ChatFlow-1.1.jar) 
    UCH controlling{1.0.0} [Controlling] (Controlling-1.7.10-1.0.0.jar) 
    UCH cosmeticarmorreworked{1.7.10-v5d} [CosmeticArmorReworked] (CosmeticArmorReworked-1.7.10-v5d.jar) 
    UCH CubesEdge{Alpha 0.2.0} [Cube's Edge] (CubesEdge-[1.7.10] beta 0.3.0-0.jar) 
    UCH dsurround{1.0.5.11} [Dynamic Surroundings] (DynamicSurroundings-1.7.10-1.0.5.11.jar) 
    UCH endercore{1.7.10-0.2.0.39_beta} [EnderCore] (EnderCore-1.7.10-0.2.0.39_beta.jar) 
    UCH fbp{2.2} [Fancy Block Particles] (FancyBlockParticles-1.7.10-2.2.jar) 
    UCH fastleafdecay{1.1} [Fast Leaf Decay] (FastLeafDecay-1.7.10-1.1.jar) 
    UCH HardcoreDarkness{1.7} [Hardcore Darkness] (HardcoreDarkness-MC1.7.10-1.7.jar) 
    UCH HelpFixer{1.0.7} [HelpFixer] (HelpFixer-1.0.7.jar) 
    UCH Mantle{1.7.10-0.3.2.jenkins184} [Mantle] (Mantle-1.7.10-0.3.2.jar) 
    UCH Waila{1.5.10} [Waila] (Waila-1.5.10_1.7.10.jar) 
    UCH TConstruct{1.7.10-1.8.8.build988} [Tinkers' Construct] (TConstruct-1.7.10-1.8.8.jar) 
    UCH InventoryCenterer{1.7.10-0.1.3} [Inventory Centerer] (InventoryCenterer-1.7.10-0.1.3.jar) 
    UCH inventorytweaks{1.59-dev-152-cf6e263} [Inventory Tweaks] (InventoryTweaks-1.59-dev-152.jar) 
    UCH journeymap{5.1.4p2} [JourneyMap] (journeymap-1.7.10-5.1.4p2-unlimited.jar) 
    UCH MineMenu{1.2.0} [MineMenu] (MineMenu-1.7.10-1.2.0.B44-universal.jar) 
    UCH MouseTweaks{2.4.4} [Mouse Tweaks] (MouseTweaks-2.4.4-mc1.7.10.jar) 
    UCH Neat{GRADLE:VERSION-GRADLE:BUILD} [Neat] (Neat_1.1.0-K.jar) 
    UCH recipehandler{1.7.10} [NoMoreRecipeConflict] (NoMoreRecipeConflict-0.3(1.7.10).jar) 
    UCH NoNausea{1.0} [No Nausea] (NoNausea-MC1.7.10-1.0.jar) 
    UCH notes{1.0.1} [Notes] (Notes-1.7.10-1.0.1.jar) 
    UCH shouldersurfing{1.0} [ShoulderSurfing] (shouldersurfing-1.7.10.jar) 
    UCH soundfilters{0.8_for_1.7.X} [Sound Filters] (SoundFilters-0.8_for_1.7.X.jar) 
    UCH Squeedometer{1.0.3} [Squeedometer] (Squeedometer-mc1.7.x-1.0.3.jar) 
    UCH thaumcraftneiplugin{@VERSION@} [Thaumcraft NEI Plugin] (thaumcraftneiplugin-1.7.10-1.7a.jar) 
    UCH thutilities{0.2.0} [Thaumic Utilities] (Thaumic-Utilities-[1.7.10] 0.2.0-0.jar) 
    UCH TiCTooltips{1.2.5} [TiC Tooltips] (TiCTooltips-mc1.7.10-1.2.5.jar) 
    UCH TravellersGear{1.16.6} [Traveller's Gear] (TravellersGear-1.7.10-1.16.6.jar) 
    UCH wailaevents{1.0.0} [Waila Events] (WailaEvents-1.0.0.jar) 
    UCH wailainhib{1.1.0} [Waila Inhibitors] (Waila-Inhibitors-1.1.0.jar) 
    UCH WailaHarvestability{1.1.1} [Waila Harvestability] (WailaHarvestability-mc1.7.x-1.1.1.jar) 
    UCH wawla{1.3.3} [What Are We Looking At] (Wawla-1.3.3-1.7.10.jar) 
    UCH zebrastogglesneak{1.2} [Zebra's Toggle Sneak&Sprint] (zebrastogglesneak-1.7.10-1.2.8-forge.jar) 
    GL info: ' Vendor: 'Intel' Version: '4.0.0 - Build 10.18.10.4358' Renderer: 'Intel(R) HD Graphics 4000'
    A-New-Dawn-Botania: THIS INSTANCE OF MINECRAFT IS USING A FORK OF BOTANIA NOT SANCTIONED BY VAZKII, REPORT ALL CRASHES AT http://bit.ly/1KXdQeZ
    Mantle Environment: DO NOT REPORT THIS CRASH! Unsupported mods in environment: optifine
    TConstruct Environment: Environment healthy.
    Launched Version: MultiMC5
    LWJGL: 2.9.1
    OpenGL: Intel(R) HD Graphics 4000 GL version 4.0.0 - Build 10.18.10.4358, Intel
    GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.

    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Resource Packs: [kryptTexTweaks.zip, netherores.zip, strata.zip, lang fix.zip, Krypt's CartLivery Pack.zip, HarderOres.zip]
    Current Language: English (US)
    Profiler Position: N/A (disabled)
    Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    Anisotropic Filtering: On (2)
    OptiFine Version: OptiFine_1.7.10_HD_D1
    Render Distance Chunks: 12
    Mipmaps: 4
    Anisotropic Filtering: 2
    Antialiasing: 0
    Multitexture: false
    OpenGlVersion: 4.0.0 - Build 10.18.10.4358
    OpenGlRenderer: Intel(R) HD Graphics 4000
    OpenGlVendor: Intel
    CpuCount: 8
squeek502 commented 7 years ago

Looks like CubesEdge is completely overwriting all of ItemRenderer.renderItemFirstPerson's instructions, which is not something that AppleCore can handle.

One thing you could try is changing this line in CE to:

mn.instructions.insertBefore(findFirstInstruction(mn), newList);

and add this method to the ItemRendererTransformer class:

    private AbstractInsnNode findFirstInstruction(MethodNode method)
    {
        for (AbstractInsnNode instruction = method.instructions.getFirst(); instruction != null; instruction = instruction.getNext())
        {
            if (instruction.getType() != AbstractInsnNode.LABEL && instruction.getType() != AbstractInsnNode.LINE)
                return instruction;
        }
        return null;
    }

That will make it so that CE only adds its hook to the top of the method and then returns early, while still leaving the (now unused) original instructions in place for AppleCore to modify (but note that AppleCore's modifications won't have any affect, so the eating speed animation will be a little weird if you have any mods that modify that [The Spice of Life/Hunger Overhaul]).

There is the possibility of this messing up the frames/maxes, so if you get any errors related to that, you can try also changing this line to:

ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
KryptonCaptain commented 7 years ago

First two suggestions worked as probably intended. Testing it with HO, I noticed that food will vanish for a couple of frames when player initially begin eating it, then reappear for the rest of the animation, to presumably conclude at the same time as the event. Didn't seem to affect any animations in CE.

So I subbed in the third line to see if that would fix it, but that just produced the same initial crash

squeek502 commented 7 years ago

In that case, you should just go with the first two. That's as good as it's going to get without much more complicated integration.

KryptonCaptain commented 7 years ago

Thanks for the help with this, much appreciated.