Even more touchscreen improvements

- Fixed #222
Touch-specific improvements
- Interactive items can now be used correctly
- Drop button now works
- Most Keybinds will now work correctly while in touchscreen mode
- Added Touch category to simple options screen
This commit is contained in:
Motschen
2023-10-02 20:33:12 +02:00
parent eb4f30913a
commit 233ae36343
15 changed files with 218 additions and 49 deletions

View File

@@ -4,6 +4,8 @@ import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.Camera;
import net.minecraft.entity.projectile.ProjectileUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.util.UseAction;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.util.hit.HitResult;
@@ -57,4 +59,8 @@ public class TouchUtils {
return new Vec3d(target.x, target.y, target.z).add(camera.getPos());
}
public static boolean hasInWorldUseAction(ItemStack stack) {
UseAction action = stack.getUseAction();
return action == UseAction.BOW || action == UseAction.BRUSH || action == UseAction.SPEAR;
}
}