Posted January 26, 20178 yr Hi. I'm creating mods that with access transformers but it doesn't work (doesn't change modifier from private to public). Here is my build.gradle file: buildscript { repositories { jcenter() maven { url = "http://files.minecraftforge.net/maven" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' } } apply plugin: 'net.minecraftforge.gradle.forge' //Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. version = "1.11-1.0.0" group = "vn.lethinh.hptweaks" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "hptweaks" sourceCompatibility = targetCompatibility = "1.8" // Need this here so eclipse task generates correctly. compileJava { sourceCompatibility = targetCompatibility = "1.8" } minecraft { version = "1.11-13.19.1.2199" runDir = "run" // the mappings can be changed at any time, and must be in the following format. // snapshot_YYYYMMDD snapshot are built nightly. // stable_# stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not always work. // simply re-run your setup task after changing the mappings to update your workspace. mappings = "snapshot_20161220" // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. useDepAts = true } dependencies { // you may put jars on which you depend on in ./libs // or you may define them like so.. //compile "some.group:artifact:version:classifier" //compile "some.group:artifact:version" // real examples //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' // the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided, // except that these dependencies get remapped to your current MCP mappings //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev' //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev' // for more info... // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html } processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion expand 'version':project.version, 'mcversion':project.minecraft.version } // copy everything else except the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } rename '(.+_at.cfg)', 'META-INF/$1' } jar { manifest { attributes 'FMLAT': 'hptweaks_at.cfg' } } task deobfJar(type: Jar) { from sourceSets.main.output classifier = 'deobf' manifest { attributes 'FMLAT': 'hptweaks_at.cfg' } } artifacts { archives deobfJar } idea { module { inheritOutputDirs = true } } My hptweaks_at.cfg file: # High Passive Tweaks -- Access Transformer # GuiContainer public net.minecraft.client.gui.inventory.GuiContainer field_146999_f # xSize public net.minecraft.client.gui.inventory.GuiContainer field_147000_g # ySize #GlStateManager public net.minecraft.client.renderer.GlStateManager$BooleanState public net.minecraft.client.renderer.GlStateManager$BooleanState field_179202_a # capability public net.minecraft.client.renderer.GlStateManager field_179160_a # alphaState public net.minecraft.client.renderer.GlStateManager field_179174_p # textureState public net.minecraft.client.renderer.GlStateManager field_179162_o # activeTextureUnit public net.minecraft.client.renderer.GlStateManager field_179156_d # colorMaterialState public net.minecraft.client.renderer.GlStateManager field_179157_e # blendState public net.minecraft.client.renderer.GlStateManager field_179155_g # fogState public net.minecraft.client.renderer.GlStateManager field_179167_h # cullState public net.minecraft.client.renderer.GlStateManager field_179168_i # polygonOffsetState public net.minecraft.client.renderer.GlStateManager field_179165_j # colorLogicState public net.minecraft.client.renderer.GlStateManager field_179163_l # clearState public net.minecraft.client.renderer.GlStateManager field_179171_s # colorMaskState public net.minecraft.client.renderer.GlStateManager field_179170_t # colorState public net.minecraft.client.renderer.GlStateManager$TexGenCoord public net.minecraft.client.renderer.GlStateManager field_179067_a # textureGen public net.minecraft.client.renderer.GlStateManager field_179065_b # coord public net.minecraft.client.renderer.GlStateManager field_179066_c # param public net.minecraft.client.renderer.GlStateManager field_190627_av # currentState public net.minecraft.client.renderer.GlStateManager field_179166_k # texGenState public net.minecraft.client.renderer.GlStateManager field_179154_f # depthState public net.minecraft.client.renderer.GlStateManager field_179172_r # rescaleNormalState public net.minecraft.client.renderer.GlStateManager field_179161_n # normalizeState public net.minecraft.client.renderer.GlStateManager field_179159_c # lightState My hptweaks_at.cfg file is in src/main/resources. Does anyone know to fix this?
January 26, 20178 yr Do not make core mods. You do not need Access Transformers: 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.
January 26, 20178 yr Author Do not make core mods. You do not need Access Transformers: use reflection. But reflection can make my code ugly, and is slightly slower.
January 26, 20178 yr Not if you do it right. Get the field or method once and save a reference to it. The rest is pretty darn fast. 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.
January 26, 20178 yr Author Not if you do it right. Get the field or method once and save a reference to it. The rest is pretty darn fast. How can I do the reflection? By the way, I see the mod author use the access transformer more than the reflection.
January 26, 20178 yr the mod author "the mod author"? What mod? If you mean Forge, then yes, Forge is allowed to do it because it's making things public for modders. It's part of Forge's patches. Anyway, this is good reflection: 1) https://github.com/Draco18s/HarderStuff/blob/master/src/main/java/com/draco18s/wildlife/WildlifeEventHandler.java#L136 2) https://github.com/Draco18s/HarderStuff/blob/master/src/main/java/com/draco18s/wildlife/WildlifeBase.java#L330-L331 3) https://github.com/Draco18s/HarderStuff/blob/master/src/main/java/com/draco18s/wildlife/WildlifeEventHandler.java#L1149 Mind, it could be better (I can't find any of my reflection stuff in 1.10 right now). But that should give you an idea. 1) Declare a field 2) Set it to something, and do that once.* 3) Use it a lot *This is where I could do better. I have it set to look for the SRG name, then in the error handling look for the MCP name. I could instead use ReflectionHelper. ReflectionHelper will do a lot for you, it's a great class. 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.
January 26, 20178 yr Author the mod author "the mod author"? What mod? If you mean Forge, then yes, Forge is allowed to do it because it's making things public for modders. It's part of Forge's patches. Anyway, this is good reflection: 1) https://github.com/Draco18s/HarderStuff/blob/master/src/main/java/com/draco18s/wildlife/WildlifeEventHandler.java#L136 2) https://github.com/Draco18s/HarderStuff/blob/master/src/main/java/com/draco18s/wildlife/WildlifeBase.java#L330-L331 3) https://github.com/Draco18s/HarderStuff/blob/master/src/main/java/com/draco18s/wildlife/WildlifeEventHandler.java#L1149 Mind, it could be better (I can't find any of my reflection stuff in 1.10 right now). But that should give you an idea. 1) Declare a field 2) Set it to something, and do that once.* 3) Use it a lot *This is where I could do better. I have it set to look for the SRG name, then in the error handling look for the MCP name. I could instead use ReflectionHelper. ReflectionHelper will do a lot for you, it's a great class. Nevermine. I fixed the problem. My file name was wrong: hptweaks-at.cfg but actually is hptweaks_at.cfg. But anyway, thank you for your help.
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.