Skip to content

Commit

Permalink
Merge branch '1.20/dev' into 1.19.4/next
Browse files Browse the repository at this point in the history
# Conflicts:
#	gradle.properties
#	src/client/java/nl/enjarai/doabarrelroll/DoABarrelRollClient.java
  • Loading branch information
enjarai committed Nov 12, 2023
2 parents 72d0c2d + 5f66eda commit f637d65
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 10 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
- Fixed a crash on dedicated servers. (#113)
- As an exception to existing limitations, thrusting will now be allowed when the player is an operator on a Realm.
This does not apply to normal servers.
- Changed the default toggle keybind to I to avoid conflicting with the advancements button.
- Fixed an incompatibility with Keybind Fix.
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ org.gradle.jvmargs=-Xmx4096M
minecraft_version=1.19.4

archives_base_name=do-a-barrel-roll
mod_version=3.3.5
mod_version=3.3.6
maven_group=nl.enjarai

yarn_version=1.19.4+build.1

loader_version=0.14.21
loader_version=0.14.24
fabric_version=0.75.3+1.19.4

cicada_version=0.4.4
cicada_version=0.4.6
# https://modrinth.com/mod/modmenu/versions#all-versions
modmenu_version=6.1.0-beta.3
# https://github.com/isXander/YetAnotherConfigLib/releases
yacl_version=3.1.1+1.19.4
# https://github.com/isXander/Controlify/releases
controlify_version=1.2.0+1.19.4
mixin_extras_version=0.2.0-beta.8
mixin_extras_version=0.2.0
mixin_squared_version=0.1.1
permissions_api_version=0.2-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,8 @@ public static boolean isFallFlying() {
}
return player.isFallFlying();
}

public static boolean isConnectedToRealms() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class ModKeybindings {
public static final KeyBinding TOGGLE_ENABLED = new KeyBinding(
"key.do_a_barrel_roll.toggle_enabled",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_L,
GLFW.GLFW_KEY_I,
"category.do_a_barrel_roll.do_a_barrel_roll"
);
public static final KeyBinding TOGGLE_THRUST = new KeyBinding(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ConfirmScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.screen.ScreenTexts;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
Expand All @@ -31,9 +32,12 @@
public class YACLImplementation {
public static Screen generateConfigScreen(Screen parent) {
var inWorld = MinecraftClient.getInstance().world != null;
ClientPlayerEntity player;
var onRealms = DoABarrelRollClient.isConnectedToRealms() &&
(player = MinecraftClient.getInstance().player) != null && player.hasPermissionLevel(2);
var serverConfig = DoABarrelRollClient.HANDSHAKE_CLIENT.getConfig();

var thrustingAllowed = new Dependable(serverConfig.map(LimitedModConfigServer::allowThrusting).orElse(!inWorld));
var thrustingAllowed = new Dependable(serverConfig.map(LimitedModConfigServer::allowThrusting).orElse(!inWorld || onRealms));
var allowDisabled = new Dependable(!serverConfig.map(LimitedModConfigServer::forceEnabled).orElse(false));

var builder = YetAnotherConfigLib.createBuilder()
Expand Down
17 changes: 15 additions & 2 deletions src/client/java/nl/enjarai/doabarrelroll/config/ModConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import nl.enjarai.doabarrelroll.DoABarrelRollClient;
import nl.enjarai.doabarrelroll.api.event.RollContext;
import nl.enjarai.doabarrelroll.api.rotation.RotationInstant;
Expand Down Expand Up @@ -161,8 +163,19 @@ public boolean getSimulateControlSurfaceEfficacy() {
}// = false;

public boolean getEnableThrust() {
return general.thrust.enable_thrust && DoABarrelRollClient.HANDSHAKE_CLIENT
.getConfig().map(LimitedModConfigServer::allowThrusting).orElse(false);
if (general.thrust.enable_thrust) {
ClientPlayerEntity player;
if (DoABarrelRollClient.isConnectedToRealms() &&
(player = MinecraftClient.getInstance().player) != null && player.hasPermissionLevel(2)) {
return true;
}

return DoABarrelRollClient.HANDSHAKE_CLIENT.getConfig()
.map(LimitedModConfigServer::allowThrusting)
.orElse(false);
}

return false;
}

public boolean getEnableThrustClient() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ public void onInitialize() {
public boolean shouldCancel(List<String> targetClassNames, String mixinClassName) {
if (mixinClassName.equals("com.anthonyhilyard.equipmentcompare.mixin.KeyMappingMixin") && MixinAnnotationReader.getPriority(mixinClassName) == 1000) {
DoABarrelRoll.LOGGER.warn("Equipment Compare detected, disabling their overly invasive keybinding mixin. Report any relevant issues to them.");
DoABarrelRoll.LOGGER.warn("If the author of Equipment Compare is reading this: see #31 on your github. Once the issue is fixed, you can set the priority of this mixin to anything other than 1000 to stop it being disabled.");
DoABarrelRoll.LOGGER.warn("If the author of Equipment Compare is reading this: see #31 on your github. Once the issue is resolved, you can set the priority of this mixin to anything other than 1000 to stop it being disabled.");
return true;
}
if (mixinClassName.equals("me.fzzyhmstrs.keybind_fix.mixins.KeybindingMixin") && MixinAnnotationReader.getPriority(mixinClassName) == 1000) {
DoABarrelRoll.LOGGER.warn("Keybind Fix detected, disabling their overly invasive keybinding mixin (Ironic, I know). Report any relevant issues to them.");
DoABarrelRoll.LOGGER.warn("If the author of Keybind Fix is reading this: please don't use unconditionally cancelled injects... try looking into MixinExtras! Once the issue is resolved, you can set the priority of this mixin to anything other than 1000 to stop it being disabled.");
return true;
}
return false;
Expand Down

0 comments on commit f637d65

Please sign in to comment.