Jump to content

Forge one-time injection


MGlolenstine

Recommended Posts

1 minute ago, diesieben07 said:

Forge is not "injecting minecraft.jar". The game code is transformed on the fly as it is loaded from disk. That is not the slow part of starting up Minecraft. The slow part is (among other things) the model creating, which just takes a long time with a lot of mods.

Oh, ok so I misunderstood the whole concept of forge :P 

But why is it creating models at every launch?

Couldn't you just store them?

Edited by MGlolenstine
Link to comment
Share on other sites

4 minutes ago, diesieben07 said:

Not necessarily. There is no easy way for Forge to know whether something in a mod has changed that would change the generated model to change. Has this config file you changed caused the Model to change? We don't know. Is this Model download from an URL which has a different model every time? We don't know.

All this prevents from Forge "just storing models". As very often in Computer Science the obvious "just do X" answer is sadly not correct.

Ok, I was wrong and I'm sorry. :P 

Link to comment
Share on other sites

  • 1 year later...

Actually, you are not wrong. I know this is a necropost, but the reason this is not wrong, is because instead of loading all the mods into the RAM, using up CPU power (older machines don't have a lot, so it takes a long time to load mods sometimes), Forge can do a 1 time load onto the hard drive, and leave it like that, and keep an MD5 checksum of every mod, and recheck the MD5 checksum every launch, and if it remains the same, just allow the game to load as NORMAL. This is the only way I can really think of, (yes, I know you can also do an SHA256 and SHA1 checksum, but MD5 is faster to calculate) and if anyone has more idea's of ways, or a way to prove me wrong, please reply to this thread. Thank you, goodbye.

Link to comment
Share on other sites

3 minutes ago, GameGlitz said:

Actually, you are not wrong. I know this is a necropost, but the reason this is not wrong, is because instead of loading all the mods into the RAM, using up CPU power (older machines don't have a lot, so it takes a long time to load mods sometimes), Forge can do a 1 time load onto the hard drive, and leave it like that, and keep an MD5 checksum of every mod, and recheck the MD5 checksum every launch, and if it remains the same, just allow the game to load as NORMAL. This is the only way I can really think of, (yes, I know you can also do an SHA256 and SHA1 checksum, but MD5 is faster to calculate) and if anyone has more idea's of ways, or a way to prove me wrong, please reply to this thread. Thank you, goodbye.

First of all, thank you for replying to this post ?. I was thinking of the same thing, with the hashing and storing everything on the HDD, but I think that the problem with mod updates isa great one, I know you could only rebuild it when mods updare, but still... Thing that I think would be the most trouble, would have to be the different mod distinction, as some mods inject directly into the code and it's hard for Forge to determine which mod the change is coming from.

 

Thanks again, and I hope that we get something along these lines in the future ?

Link to comment
Share on other sites

I think your best shot at skipping the loading screen would be to load Minecraft in a Virtual Machine and saving it's state to disk without quitting Minecraft, instead of shutting it down.

Edited by Busti

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

Link to comment
Share on other sites

On 1/27/2019 at 3:08 PM, Busti said:

 

"I think your best shot at skipping the loading screen would be to load Minecraft in a Virtual Machine and saving it's state to disk without quitting Minecraft, instead of shutting it down." - Busti

 

This makes sense, as Java uses it's own Virtual Machine, called the JVM. Running another JVM inside the main JVM via the framework itself will allow us to run Minecraft once, and then save the state. Then we can launch that machine every time the game starts, but check the MD5 hash of mods and files before starting. This speeds up a LOT.

 

On 1/22/2019 at 7:10 PM, diesieben07 said:

Have you looked at how mod loading works? Probably not, because this is not feasible.

RUDE.

Link to comment
Share on other sites

  1. Forge one-time injection

    diesieben07 replied to MGlolenstine's topic in General Discussion

    Please clarify how I was rude?
  2. diesieben07

    Ore Variant Textures Not Working Properly

    diesieben07 replied to Viking 2481's topic in Modder Support

    That is literally how any programming language works...
  3. diesieben07

    Access transformers doesn't work with forge classes

    diesieben07 replied to hohserg's topic in Modder Support

    No! Don't do this. You must not be accessing the world in your model, since the model may be rendered on a different thread, so you will cause random and seemingly inexplicable crashes. Any information necessary for the model to render must be stored in the IBlockState.
  4. diesieben07

    Access transformers doesn't work with forge classes

    diesieben07 replied to hohserg's topic in Modder Support

    What are you trying to achieve? Why do you need access to this class?
  5. 1.7.10 and older are no longer supported on this forum due to their age. Update to a modern version of Minecraft to receive support. You have been told this already, consider this a warning.

 

This is a paste of all the rude things you have said, PLEASE take it down. It is very selfish.

  • Confused 1
Link to comment
Share on other sites

Updates are not required, as what I am talking about is different. If you intergrate a VM for forge to load mods, and then pass the session over to the JVM on the host computer, it is possible. I have started to experiment in Eclipse, and I have to say I am VERY close to getting this core-mod to work.

Link to comment
Share on other sites

I have actually done it. This core-mod still isn't ready for production, but it works PERFECTLY for me. What I have done is created a Linux distro that contains a very simple architecture (just Java on Arch Linux) which will boot up at Minecraft's start, and then reload mods to the drive if the MD5 hash of any files have changed (apart from the Minecraft settings and Optifine settings). Then, it will hibernate the VM, and then put the session onto a container on the main PC, which will put you on a loading screen overlaying the title screen, which will then take the session out of the container, and close Minecraft, replacing it with the loaded modded version. Then it will close the container, and leave the VM hibernated. This is a very complicated method, and if you manually delete the VM files from the .minecraft\config\GameGlitzVM\ folder, it will have to load each mod again, resulting in no difference of load times. However, when you close the game, shutdown your computer, leave it for 2 mins, and boot it back up, then launch Minecraft, it will automatically restore the session into a container, then onto the host computer.

I am now working on a re-auth system to auth you to the official Minecraft servers again, so that you can play on servers (else what is the use). I have seen a mod called ReAuth that does what I need, but it requires you to enter your account details, so I will find a way to use the account that the launcher used to start the game. Please reply with any way to help me reauth.

Link to comment
Share on other sites

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

    • I am getting an error message that my mods and my server are not on the same minecraft version when they clearly are. My server and my mods are on 1.20.1 and the error says that the server is 1.20 even though it's on forge 47.2.30.  
    • .Omg, I'm so freaking blind I didn't notice that, it works now, thank you so much @Xoroshio
    • On the one off the last lines of code you have put && boots.isEmpty() Instead of && !boots.isEmpty() is that a typo?
    • I'm trying to apply effects to the emerald armor but it doesn't work, I read that the onArmorTick() method doesn't work anymore, but I tried with inventoryTick, onInventoryTick and onArmorTick but they don't apply the effect either, I don't know if I'm writing it wrong, so I need help to fix it. This is the code in question: public class ModArmorItem extends ArmorItem{ private static final Map<ArmorMaterial, MobEffectInstance> MATERIAL_TO_EFFECT_MAP = (new ImmutableMap.Builder<ArmorMaterial, MobEffectInstance>()) .put(ModArmorMaterials.EMERALD, new MobEffectInstance( MobEffects.HERO_OF_THE_VILLAGE, 200, 1, false, false, true)) .build(); public ModArmorItem(ArmorMaterial pMaterial, Type pType, Properties pProperties) { super(pMaterial, pType, pProperties); } @Override public void onArmorTick(ItemStack stack, Level world, Player player){ if (!world.isClientSide()) { if (hasFullSuitOfArmorOn(player)) { evaluateArmorEffects(player); } } } private void evaluateArmorEffects(Player player) { for (Map.Entry<ArmorMaterial,MobEffectInstance> entry : MATERIAL_TO_EFFECT_MAP.entrySet()){ ArmorMaterial mapArmorMaterial = entry.getKey(); MobEffectInstance mapStatusEffect = entry.getValue(); if (hasCorrectArmorOn(mapArmorMaterial, player)) { addStatusEffectForMaterial(player, mapArmorMaterial, mapStatusEffect); } } } private void addStatusEffectForMaterial(Player player, ArmorMaterial mapArmorMaterial, MobEffectInstance mapStatusEffect) { boolean hasPlayerEffect = player.hasEffect(mapStatusEffect.getEffect()); if (hasCorrectArmorOn(mapArmorMaterial, player) && !hasPlayerEffect) { player.addEffect(new MobEffectInstance(mapStatusEffect)); } } private boolean hasCorrectArmorOn(ArmorMaterial material, Player player) { for (ItemStack armorStack : player.getInventory().armor){ if (!(armorStack.getItem() instanceof ArmorItem)) { return false; } } ArmorItem helmet = ((ArmorItem)player.getInventory().getArmor(3).getItem()); ArmorItem brestplace = ((ArmorItem)player.getInventory().getArmor(2).getItem()); ArmorItem leggins = ((ArmorItem)player.getInventory().getArmor(1).getItem()); ArmorItem boots = ((ArmorItem)player.getInventory().getArmor(0).getItem()); return helmet.getMaterial() == material && brestplace.getMaterial() == material && leggins.getMaterial() == material && boots.getMaterial() == material; } private boolean hasFullSuitOfArmorOn(Player player){ ItemStack helmet = player.getInventory().getArmor(3); ItemStack breastplace = player.getInventory().getArmor(2); ItemStack leggins = player.getInventory().getArmor(1); ItemStack boots = player.getInventory().getArmor(0); return !helmet.isEmpty() && !breastplace.isEmpty() && !leggins.isEmpty() && boots.isEmpty(); } } And here is the armor   public static final RegistryObject<Item> EMERALD_HELMET = ITEMS.register( "emerald_helmet", () -> new ModArmorItem(ModArmorMaterials.EMERALD, ArmorItem.Type.HELMET, new Item.Properties()) ); public static final RegistryObject<Item> EMERALD_CHESTPLATE = ITEMS.register( "emerald_chestplate", () -> new ModArmorItem(ModArmorMaterials.EMERALD, ArmorItem.Type.CHESTPLATE, new Item.Properties()) ); public static final RegistryObject<Item> EMERALD_LEGGINS = ITEMS.register( "emerald_leggins", () -> new ModArmorItem(ModArmorMaterials.EMERALD, ArmorItem.Type.LEGGINGS, new Item.Properties()) ); public static final RegistryObject<Item> EMERALD_BOOTS = ITEMS.register( "emerald_boots", () -> new ModArmorItem(ModArmorMaterials.EMERALD, ArmorItem.Type.BOOTS, new Item.Properties()) ); I hope you can help me. Thanks.
    • so ive been having this issue for a little bit, and have honestly no clue on how to fix it. I'm using minecraft 1.20.1 for clarification.  Here is the latest log: https://pastebin.com/neMuxELv
  • Topics

×
×
  • Create New...

Important Information

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