mirror of
https://github.com/GTNewHorizons/Postea.git
synced 2026-11-12 16:37:38 +00:00
Merge pull request #3 from SinTh0r4s/add-forge-access-transformers
Added option and example for access transformers
This commit is contained in:
4 files changed
+61
-12
No files matched your search
+30
-12
@@ -150,17 +150,26 @@ task generateAssets {
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
def manifestAttributes = [:]
|
||||
manifestAttributes += ["FMLCorePluginContainsFMLMod" : true]
|
||||
|
||||
if(accessTransformersFile.isEmpty() == false) {
|
||||
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
|
||||
}
|
||||
|
||||
if(usesMixins.toBoolean()) {
|
||||
from refMap
|
||||
manifest {
|
||||
attributes([
|
||||
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
||||
"MixinConfigs" : mixinConfigJson,
|
||||
"FMLCorePluginContainsFMLMod": true,
|
||||
"ForceLoadAsMod" : loadNormalModAfterApplingMixins.toBoolean()
|
||||
])
|
||||
manifestAttributes += [
|
||||
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
||||
"MixinConfigs" : mixinConfigJson,
|
||||
"ForceLoadAsMod" : loadNormalModAfterApplingMixins.toBoolean()
|
||||
]
|
||||
}
|
||||
}
|
||||
manifest {
|
||||
attributes(manifestAttributes)
|
||||
}
|
||||
|
||||
minimize()
|
||||
configurations = [project.configurations.shadowImplementation]
|
||||
@@ -168,17 +177,26 @@ shadowJar {
|
||||
}
|
||||
|
||||
jar {
|
||||
def manifestAttributes = [:]
|
||||
manifestAttributes += ["FMLCorePluginContainsFMLMod" : true]
|
||||
|
||||
if(accessTransformersFile.isEmpty() == false) {
|
||||
manifestAttributes += ["FMLAT" : accessTransformersFile.toString()]
|
||||
}
|
||||
|
||||
if(usesMixins.toBoolean()) {
|
||||
from refMap
|
||||
manifest {
|
||||
attributes([
|
||||
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
||||
"MixinConfigs" : mixinConfigJson,
|
||||
"FMLCorePluginContainsFMLMod": true,
|
||||
"ForceLoadAsMod" : loadNormalModAfterApplingMixins.toBoolean()
|
||||
])
|
||||
manifestAttributes += [
|
||||
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
||||
"MixinConfigs" : mixinConfigJson,
|
||||
"ForceLoadAsMod" : loadNormalModAfterApplingMixins.toBoolean()
|
||||
]
|
||||
}
|
||||
}
|
||||
manifest {
|
||||
attributes(manifestAttributes)
|
||||
}
|
||||
|
||||
if(usesShadowedDependencies.toBoolean()) {
|
||||
dependsOn(shadowJar)
|
||||
|
||||
@@ -28,6 +28,10 @@ gradleTokenGroupName = GRADLETOKEN_GROUPNAME
|
||||
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
||||
apiPackage =
|
||||
|
||||
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
|
||||
# Example value: mymodid_at.cfg
|
||||
accessTransformersFile = mymodid_at.cfg
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = true
|
||||
# Specify the location of your implementation of IMixinPlugin. Leave it empty otherwise.
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.myname.mymodid;
|
||||
|
||||
import cpw.mods.fml.common.event.*;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.gui.GuiScreenBook;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
public class CommonProxy {
|
||||
|
||||
@@ -20,7 +23,14 @@ public class CommonProxy {
|
||||
|
||||
// postInit "Handle interaction with other mods, complete your setup based on this."
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
// Access originally package-private subclass
|
||||
GuiScreenBook.NextPageButton button = null;
|
||||
|
||||
// Access originally private field
|
||||
Material air = Blocks.air.blockMaterial;
|
||||
|
||||
// Access originally protected method
|
||||
Blocks.air.disableStats();
|
||||
}
|
||||
|
||||
public void serverAboutToStart(FMLServerAboutToStartEvent event) {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# Override visibility of Vanilla Minecraft code only! It will not work on mods!
|
||||
|
||||
# Warning: Whenever you change this file you must run 'setupDecompWorkspace' again and afterwards reimport the gradle project!
|
||||
|
||||
# https://mcforge.readthedocs.io/en/latest/advanced/accesstransformers/
|
||||
|
||||
# Classes
|
||||
# <access modifier> <fully qualified class name>
|
||||
public net.minecraft.client.gui.GuiScreenBook$NextPageButton
|
||||
|
||||
# Fields
|
||||
# <access modifier> <fully qualified class name> <field name>
|
||||
public net.minecraft.block.Block field_149764_J # blockMaterial
|
||||
|
||||
# Methods
|
||||
# <access modifier> <fully qualified class name> <method name>(<parameter types>)<return type>
|
||||
public net.minecraft.block.Block func_149649_H()Lnet.minecraft.block.Block; # disableStats
|
||||
Reference in new issue
Block a user