Jump to content

Recommended Posts

Posted

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?

Posted

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.

Posted
  On 1/26/2017 at 3:46 AM, Draco18s said:

Do not make core mods.

You do not need Access Transformers: use reflection.

 

But reflection can make my code ugly, and is slightly slower.

Posted

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.

Posted
  On 1/26/2017 at 4:36 AM, Draco18s said:

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.

Posted
  On 1/26/2017 at 4:49 AM, lethinh said:

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.

Posted
  On 1/26/2017 at 6:20 AM, Draco18s said:

  Quote

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.

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

    • Hello all. I'm currently grappling with the updateShape method in a custom class extending Block.  My code currently looks like this: The conditionals in CheckState are there to switch blockstate properties, which is working fine, as it functions correctly every time in getStateForPlacement.  The problem I'm running into is that when I update a state, the blocks seem to call CheckState with the position of the block which was changed updated last.  If I build a wall I can see the same change propagate across. My question thus is this: is updateShape sending its return to the neighbouring block?  Is each block not independently executing the updateShape method, thus inserting its own current position?  The first statement appears to be true, and the second false (each block is not independently executing the method). I have tried to fix this by saving the block's own position to a variable myPos at inception, and then feeding this in as CheckState(myPos) but this causes a worse outcome, where all blocks take the update of the first modified block, rather than just their neighbour.  This raises more questions than it answers, obviously: how is a different instance's variable propagating here?  I also tried changing it so that CheckState did not take a BlockPos, but had myPos built into the body - same problem. I have previously looked at neighbourUpdate and onNeighbourUpdate, but could not find a way to get this to work at all.  One post on here about updatePostPlacement and other methods has proven itself long superceded.  All other sources on the net seem to be out of date. Many thanks in advance for any help you might offer me, it's been several days now of trying to get this work and several weeks of generally trying to get round this roadblock.  - Sandermall
    • sorry, I might be stupid, but how do I open it? because the only options I have are too X out, copy it, which doesn't work and send crash report, which doesn't show it to me, also, sorry for taking so long.
    • Can you reproduce this with version 55.0.21? A whole lot of plant placement issues were just fixed in this PR.
    • Necro'ing that thread to ask if you found a solution ? I'm encountering the same crash on loading the world. I created the world in Creative to test my MP, went into survival to test combat, died, crashed on respawn and since then crash on loading the world. Deactivating Oculus isn't fixing it either, and I don't have Optifine (Twilight forest is incompatible)
  • Topics

×
×
  • Create New...

Important Information

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