Added option and example for access transformers

This commit is contained in:
Johann Bernhardt committed 2021-11-07 00:25:02 +01:00
1 parent 0bbd636bc6
commit 4c37051951
4 files changed
+33

No files matched your search

+2
View File
@@ -154,6 +154,7 @@ shadowJar {
from refMap
manifest {
attributes([
"FMLAT" : accessTransformersFile.toString(),
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : mixinConfigJson,
"FMLCorePluginContainsFMLMod": true,
@@ -172,6 +173,7 @@ jar {
from refMap
manifest {
attributes([
"FMLAT" : accessTransformersFile.toString(),
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : mixinConfigJson,
"FMLCorePluginContainsFMLMod": true,
+4
View File
@@ -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