Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed search field in controls loosing the text when window is resized #44

Open
wants to merge 13 commits into
base: 1.17
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added changes corresponding to the change for hotbar scroll in amecs api
  • Loading branch information
Klotzi111 committed Sep 20, 2021
commit 69bb021c854456a43f8c4b292dc4562672246825
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies {

modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"

include(modImplementation("de.siphalor:amecsapi-1.17:1.1.5+mc21w16a") {
include(modImplementation("de.siphalor:amecsapi-1.17:1.2.1+") {
exclude group: "net.fabricmc.fabric-api"
exclude module: "nmuk-1.17"
})
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ yarn_mappings = 10
loader_version = 0.11.6

#Mod properties
mod_version = 1.4.0
mod_version = 1.4.1
maven_group = de.siphalor.amecs
archives_base_name = amecs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public abstract class MixinMinecraftClient {
private boolean justDroppedStack = false;

// we add in the dropEntireStack logic before keyDrop is checked
@Inject(method = "handleInputEvents()V", at = @At(value = "FIELD", shift = Shift.BEFORE, opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/client/option/GameOptions;keyDrop:Lnet/minecraft/client/option/KeyBinding;", ordinal = 0))
@Inject(method = "handleInputEvents()V", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, shift = Shift.BY, by = -2, target = "Lnet/minecraft/client/option/GameOptions;keyDrop:Lnet/minecraft/client/option/KeyBinding;", ordinal = 0))
private void addIn_dropEntireStack(CallbackInfo ci) {
justDroppedStack = Amecs.KEYBINDING_DROP_STACK.handleDropItemStackEvent((MinecraftClient) (Object) this);
}
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/de/siphalor/amecs/mixin/MixinMouse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package de.siphalor.amecs.mixin;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.Mouse;
import net.minecraft.client.gui.hud.SpectatorHud;
import net.minecraft.entity.player.PlayerAbilities;
import net.minecraft.entity.player.PlayerInventory;

// set very high "priority"" because we want to do it late after all other mods did their thing
@Environment(EnvType.CLIENT)
@Mixin(value = Mouse.class, priority = 2000)
public abstract class MixinMouse {

// we redirect the following methods to do nothing because we made a keybinding for this and we do not want that these actions are done double

@Redirect(method = "onMouseScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/SpectatorHud;cycleSlot(D)V"))
private void redirect_cycleSlot(SpectatorHud hud, double offset) {
// do nothing
}

@Redirect(method = "onMouseScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerAbilities;setFlySpeed(F)V"))
private void redirect_setFlySpeed(PlayerAbilities abilities, float flySpeed) {
// do nothing
}

@Redirect(method = "onMouseScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerInventory;scrollInHotbar(D)V"))
private void redirect_scrollInHotbar(PlayerInventory inventory, double scrollAmount) {
// do nothing
}

}
1 change: 1 addition & 0 deletions src/main/resources/amecs.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"ControlsOptionsScreenAccessor",
"MixinControlsOptionsScreen",
"MixinMinecraftClient",
"MixinMouse",
"MixinPlayerInventory",
"MixinScreen"
],
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"depends": {
"fabricloader": ">=0.4.0",
"fabric": "*",
"amecsapi": ">=1.2"
"amecsapi": ">=1.2.1"
}
}