diff --git a/scripts/proguard.pro b/scripts/proguard.pro index 52b843dd..af920a59 100644 --- a/scripts/proguard.pro +++ b/scripts/proguard.pro @@ -23,6 +23,13 @@ -keep class baritone.api.utils.MyChunkPos { *; } # even in standalone we need to keep this for gson reflect +# Keep any class or member annotated with @KeepName so we dont have to put everything in the script +-keep,allowobfuscation @interface baritone.KeepName +-keep @baritone.KeepName class * +-keepclassmembers class * { + @baritone.KeepName *; +} + # setting names are reflected from field names, so keep field names -keepclassmembers class baritone.api.Settings { public ; diff --git a/src/main/java/baritone/KeepName.java b/src/main/java/baritone/KeepName.java new file mode 100644 index 00000000..20f08e7b --- /dev/null +++ b/src/main/java/baritone/KeepName.java @@ -0,0 +1,21 @@ +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Baritone. If not, see . + */ + +package baritone; + +// Annotation for classes and class members that should not be renamed by proguard +public @interface KeepName { } diff --git a/src/main/java/baritone/command/defaults/FollowCommand.java b/src/main/java/baritone/command/defaults/FollowCommand.java index 755fc535..c6347020 100644 --- a/src/main/java/baritone/command/defaults/FollowCommand.java +++ b/src/main/java/baritone/command/defaults/FollowCommand.java @@ -17,6 +17,7 @@ package baritone.command.defaults; +import baritone.KeepName; import baritone.api.IBaritone; import baritone.api.command.Command; import baritone.api.command.datatypes.EntityClassById; @@ -130,6 +131,7 @@ public class FollowCommand extends Command { ); } + @KeepName private enum FollowGroup { ENTITIES(EntityLiving.class::isInstance), PLAYERS(EntityPlayer.class::isInstance); /* , @@ -142,6 +144,7 @@ public class FollowCommand extends Command { } } + @KeepName private enum FollowList { ENTITY(EntityClassById.INSTANCE), PLAYER(NearbyPlayer.INSTANCE);