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

Fix server-side keybind handling #27

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
dependencies {
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-527-GTNH:dev')
api('com.github.GTNewHorizons:bdlib:1.10.0-GTNH:dev')
api('com.github.GTNewHorizons:GTNHLib:0.6.5:dev')

implementation('com.github.GTNewHorizons:waila:1.8.2:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.7.25-GTNH:dev')
Expand Down
7 changes: 5 additions & 2 deletions src/main/scala/net/bdew/ae2stuff/AE2Stuff.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

package net.bdew.ae2stuff

import java.io.File
import com.gtnewhorizon.gtnhlib.keybind.SyncedKeybind

import java.io.File
import cpw.mods.fml.common.Mod
import cpw.mods.fml.common.Mod.EventHandler
import cpw.mods.fml.common.event._
Expand All @@ -27,13 +28,14 @@ import net.bdew.ae2stuff.network.NetHandler
import net.bdew.lib.Event
import net.bdew.lib.gui.GuiHandler
import org.apache.logging.log4j.Logger
import org.lwjgl.input.Keyboard

@Mod(
modid = AE2Stuff.modId,
version = "GRADLETOKEN_VERSION",
name = "AE2 Stuff",
dependencies =
"required-after:appliedenergistics2;required-after:bdlib@[1.9.4.109,)",
"required-after:appliedenergistics2;required-after:bdlib@[1.9.4.109,);required-after:gtnhlib@[0.6.5,)",
modLanguage = "scala"
)
object AE2Stuff {
Expand All @@ -46,6 +48,7 @@ object AE2Stuff {
var configDir: File = null

val guiHandler = new GuiHandler
val keybindLCtrl: SyncedKeybind = SyncedKeybind.create(Keyboard.KEY_LCONTROL)

def logDebug(msg: String, args: Any*) = log.debug(msg.format(args: _*))
def logInfo(msg: String, args: Any*) = log.info(msg.format(args: _*))
Expand Down
10 changes: 5 additions & 5 deletions src/main/scala/net/bdew/ae2stuff/items/AdvWirelessKit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package net.bdew.ae2stuff.items

import appeng.api.config.SecurityPermissions
import appeng.api.exceptions.FailedConnection
import net.bdew.ae2stuff.AE2Stuff
import net.bdew.ae2stuff.grid.Security
import net.bdew.ae2stuff.machines.wireless.{BlockWireless, TileWireless}
import net.bdew.ae2stuff.misc.AdvItemLocationStore
Expand All @@ -20,7 +21,6 @@ import net.bdew.lib.items.SimpleItem
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemStack
import net.minecraft.world.World
import org.lwjgl.input.Keyboard

import java.util

Expand Down Expand Up @@ -53,7 +53,7 @@ object AdvWirelessKit
): ItemStack = {
import net.bdew.lib.helpers.ChatHelper._
if (!world.isRemote && player.isSneaking) {
if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) {
if (AE2Stuff.keybindLCtrl.isKeyDown(player)) {
while (hasLocation(stack)) {
popLocation(stack)
}
Expand Down Expand Up @@ -97,7 +97,7 @@ object AdvWirelessKit
if (!pos.blockIs(world, BlockWireless)) return false
if (!world.isRemote) {
if (player.isSneaking) {
if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) {
if (AE2Stuff.keybindLCtrl.isKeyDown(player)) {
while (hasLocation(stack)) {
popLocation(stack)
}
Expand Down Expand Up @@ -149,7 +149,7 @@ object AdvWirelessKit
return true
}
isHub = tempTE.isHub
if (isHub && Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) {
if (isHub && AE2Stuff.keybindLCtrl.isKeyDown(player)) {
val t = 32 - tempTE.connectionsList.length
var i = 0
while (i < t) {
Expand Down Expand Up @@ -184,7 +184,7 @@ object AdvWirelessKit
while (doLoop) {
doLoop = false
if (hasLocation(stack)) {
if (tile.isHub && Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) {
if (tile.isHub && AE2Stuff.keybindLCtrl.isKeyDown(player)) {
if (
tile.connectionsList.length < 31 && getLocations(stack)
.tagCount() > 1
Expand Down