Add creative tab access wideners (#370)

* Add tab access wideners

* Replace with autogeneration
This commit is contained in:
itsmeow
2022-12-23 09:52:05 -05:00
committed by GitHub
parent 1c566142fd
commit d979caa4ab
2 changed files with 30 additions and 0 deletions

View File

@@ -52,6 +52,8 @@ task generateAccessWidener {
generateBlockConstructors(lines, fs)
lines.add("")
generateRenderTypeRelated(lines, fs)
lines.add("")
generateCreativeTabs(lines, fs)
}
file('.gradle/generated.accesswidener').text = String.join('\n', lines) + '\n'
@@ -127,6 +129,18 @@ static def generateRenderTypeRelated(List<String> lines, FileSystem fs) {
}
}
static def generateCreativeTabs(List<String> lines, FileSystem fs) {
lines.add("# CreativeModeTabs fields")
def node = loadClass(fs.getPath("net/minecraft/world/item/CreativeModeTabs.class"))
for (def field : node.fields) {
if ((field.access & Opcodes.ACC_STATIC) != 0 && field.desc == "Lnet/minecraft/world/item/CreativeModeTab;") {
if ((field.access & Opcodes.ACC_PUBLIC) == 0) {
lines.add("transitive-accessible field $node.name $field.name $field.desc")
}
}
}
}
static ClassNode loadClass(Path path) {
def node = new ClassNode()

View File

@@ -354,3 +354,19 @@ transitive-accessible class net/minecraft/client/renderer/RenderStateShard$Outpu
transitive-accessible class net/minecraft/client/renderer/RenderStateShard$LineStateShard
transitive-accessible class net/minecraft/client/renderer/RenderStateShard$OffsetTexturingStateShard
transitive-accessible class net/minecraft/client/renderer/RenderStateShard$MultiTextureStateShard
# CreativeModeTabs fields
transitive-accessible field net/minecraft/world/item/CreativeModeTabs BUILDING_BLOCKS Lnet/minecraft/world/item/CreativeModeTab;
transitive-accessible field net/minecraft/world/item/CreativeModeTabs COLORED_BLOCKS Lnet/minecraft/world/item/CreativeModeTab;
transitive-accessible field net/minecraft/world/item/CreativeModeTabs NATURAL_BLOCKS Lnet/minecraft/world/item/CreativeModeTab;
transitive-accessible field net/minecraft/world/item/CreativeModeTabs FUNCTIONAL_BLOCKS Lnet/minecraft/world/item/CreativeModeTab;
transitive-accessible field net/minecraft/world/item/CreativeModeTabs REDSTONE_BLOCKS Lnet/minecraft/world/item/CreativeModeTab;
transitive-accessible field net/minecraft/world/item/CreativeModeTabs HOTBAR Lnet/minecraft/world/item/CreativeModeTab;
transitive-accessible field net/minecraft/world/item/CreativeModeTabs SEARCH Lnet/minecraft/world/item/CreativeModeTab;
transitive-accessible field net/minecraft/world/item/CreativeModeTabs TOOLS_AND_UTILITIES Lnet/minecraft/world/item/CreativeModeTab;
transitive-accessible field net/minecraft/world/item/CreativeModeTabs COMBAT Lnet/minecraft/world/item/CreativeModeTab;
transitive-accessible field net/minecraft/world/item/CreativeModeTabs FOOD_AND_DRINKS Lnet/minecraft/world/item/CreativeModeTab;
transitive-accessible field net/minecraft/world/item/CreativeModeTabs INGREDIENTS Lnet/minecraft/world/item/CreativeModeTab;
transitive-accessible field net/minecraft/world/item/CreativeModeTabs SPAWN_EGGS Lnet/minecraft/world/item/CreativeModeTab;
transitive-accessible field net/minecraft/world/item/CreativeModeTabs OP_BLOCKS Lnet/minecraft/world/item/CreativeModeTab;
transitive-accessible field net/minecraft/world/item/CreativeModeTabs INVENTORY Lnet/minecraft/world/item/CreativeModeTab;