Jump to content

[1.12.2] Check if environment is deobfuscated


Arandomdud

Recommended Posts

I assume you mean whether the MCP names are applied or not, since your mod will never run in a vanilla minecraft environment(unless you are doing jar mods/coremods but we don't talk about that)

You can simply use reflection to check for an existance of any field in vanilla minecraft's code with it's mcp name. If it exists then your environment is the dev environment. If there is no such field then it isn't.

Link to comment
Share on other sites

Forge already supplies a is deobf field somewhere, but I can't remember where it is. You don't need to use reflection.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

You can check if the environment is a developer environment with

	final boolean developerEnvironment = (boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");

 

You can check if runtime deobf is enabled (means that it is not a developer environment) (going away in 1.13) with

	final boolean runtimeDeobfuscationEnabled = (boolean) data.get("runtimeDeobfuscationEnabled");
	

 

You can check if your mod is the mod being developed in a developer environment with

	final File modSource = Something.getActiveModContainer().getSource();
	final boolean amIBeingDeveloped = modSource != null && (modSource.isFile() && modSource.getName().endsWith(".jar"));
	

 

 

Edit: “Something.getActiveModContainer” is actually

	Loader.instance().activeModContainer());
	

but cause I’m on mobile I can’t edit it.

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • hello there, is there any Plugin/Mod/Datapack that can create a skyblock dimension for ech player that using /is create or something. cuz i have a allthemods 9 server and i wanted to make some skyblock out of it but i dont want that every player needs to download a mod for it or anything so i want to make it like the SuperiorSkyblock plugin but it generates worlds and i need Dimensions for forge. if anyone knows how i can make this happen i thank you very much.
    • Hey everyone, I am starting a brand new Minecraft server by the name “WILZON”. This server will include game modes such as Skyblock, PVP, Survival, but it is mainly focused and based on the Survival gamemode. As of right now, the staff that will be recruited won’t be paid so this will only be volunteer work at the moment… BUT in the future when the server starts making money, the staff WILL be paid by splitting the revenue! What am I looking for?: Plugin Manager(s) Someone/People with Server knowledge Someone/People with Server experiences Someone/People who could moderate the server Builder(s) Someone who would be willing to promote/advertise (if possible) Tester(s) If you have anymore questions or are interested, DM me on Discord @wilzonn OR you can join this Server (https://discord.gg/eDwhHwygzW)
    • Damn it was good mod, sad i had to remove it, but it worked and thank you so much for your help! Also, 2 things: do you detect what mod is causing the crash by seeing which mod in the crash report is listed the most? And, this is a random question but, do worldgen mods like tectonic cause less mobs to spawn in vanilla and modded biomes? Again thanks so much for your help.
    • public class FireDot extends MobEffect { public FireDot() { super(MobEffectCategory.HARMFUL, 0x660990); getLogger().info("Test Log 999994 "); } @Override public void applyEffectTick(LivingEntity entity, int amplifier) { if (entity instanceof LivingEntity) { entity.hurt(entity.damageSources().inFire(), 0.1F + amplifier); getLogger().info("Test Log 22333 : ") } } public boolean isDurationEffectTick(int duration, int amplifier) { int tickInterval = 2; return duration % tickInterval == 0; } } this is my custom MobEffect public class ModEffects { public static final DeferredRegister<MobEffect> MOB_EFFECTS = DeferredRegister.create(ForgeRegistries.MOB_EFFECTS, DoJiJoJu.MODID); public static final RegistryObject<MobEffect> FIRE_DOT = MOB_EFFECTS.register("fire_dot", FireDot::new); public static void register(IEventBus eventBus) {MOB_EFFECTS.register(eventBus);} } and I registed in Registry ModEffects.register(modEventBus); in my Main Class ((LivingEntity) this.target).addEffect(new MobEffectInstance(ModEffects.FIRE_DOT.get(), 100, 1)); getLogger().info("Test Log 888884 " + ModEffects.FIRE_DOT.get()); I add the Effect by this way and the `Log 888884` was printed but other Logs wasn't printed. The effect of MobEffectCategory.HARMFUL, 0x660990 was visible. but the hurt code wasn't work why It doesn't work? I tested in Creative mode and solo play Thank you
  • Topics

×
×
  • Create New...

Important Information

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