container action: remove old stuff

This commit is contained in:
Bixilon 2022-02-26 22:33:39 +01:00
parent 85d7a62ac7
commit a446a66a71
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
6 changed files with 19 additions and 62 deletions

View File

@ -1,59 +0,0 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.data.container.click
@Deprecated("", level = DeprecationLevel.WARNING)
enum class ContainerClickActions(
val mode: Int,
val button: Int,
val slot: Boolean,
val empty: Boolean = false,
) {
LEFT_MOUSE_CLICK(0, 0, true),
RIGHT_MOUSE_CLICK(0, 1, true),
SHIFT_LEFT_MOUSE_CLICK(1, 0, false),
SHIFT_RIGHT_MOUSE_CLICK(1, 1, false),
HOTKEY_SLOT_1(2, 0, true),
HOTKEY_SLOT_2(2, 1, true),
HOTKEY_SLOT_3(2, 2, true),
HOTKEY_SLOT_4(2, 3, true),
HOTKEY_SLOT_5(2, 4, true),
HOTKEY_SLOT_6(2, 5, true),
HOTKEY_SLOT_7(2, 6, true),
HOTKEY_SLOT_8(2, 7, true),
HOTKEY_SLOT_9(2, 8, true),
OFFHAND_SWAP(2, 40, true),
MIDDLE_CLICK(3, 0, true),
DROP_ITEM(4, 0, true, true),
DROP_STACK(4, 1, true, true),
START_LEFT_MOUSE_DRAG(5, 0, false),
START_RIGHT_MOUSE_DRAG(5, 4, false),
START_MIDDLE_MOUSE_DRAG(5, 8, false),
ADD_SLOT_LEFT_CLICK(5, 1, true),
ADD_SLOT_RIGHT_CLICK(5, 5, true),
END_LEFT_MIDDLE_CLICK(5, 9, true),
END_LEFT_MOUSE_DRAG(5, 2, false),
END_RIGHT_MOUSE_DRAG(5, 6, false),
END_MIDDLE_MOUSE_DRAG(5, 10, false),
DOUBLE_CLICK(6, 0, true),
;
}

View File

@ -13,7 +13,20 @@
package de.bixilon.minosoft.data.container.click
@Deprecated("ToDo")
@Deprecated("Not yet implemented")
class DistributeContainerAction : ContainerAction {
private val mode: Int get() = 5
/**
*
START_LEFT_MOUSE_DRAG(5, 0, false),
START_RIGHT_MOUSE_DRAG(5, 4, false),
START_MIDDLE_MOUSE_DRAG(5, 8, false),
ADD_SLOT_LEFT_CLICK(5, 1, true),
ADD_SLOT_RIGHT_CLICK(5, 5, true),
END_LEFT_MIDDLE_CLICK(5, 9, true),
END_LEFT_MOUSE_DRAG(5, 2, false),
END_RIGHT_MOUSE_DRAG(5, 6, false),
END_MIDDLE_MOUSE_DRAG(5, 10, false),
*/
}

View File

@ -22,6 +22,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
class FastMoveContainerAction(
val slot: Int,
) : ContainerAction {
// ToDo: Action reverting
override fun invoke(connection: PlayConnection, containerId: Int, container: Container) {
val source = container.slots[slot] ?: return

View File

@ -24,6 +24,7 @@ import de.bixilon.minosoft.protocol.packets.c2s.play.container.ContainerClickC2S
class PickAllContainerAction(
val slot: Int,
) : ContainerAction {
// ToDo: Action reverting
override fun invoke(connection: PlayConnection, containerId: Int, container: Container) {
container.lock.lock()

View File

@ -22,6 +22,7 @@ class SimpleContainerAction(
val slot: Int?,
val count: ContainerCounts,
) : ContainerAction {
// ToDo: Action reverting
private fun pickItem(connection: PlayConnection, containerId: Int, container: Container) {
val item = container[slot ?: return] ?: return

View File

@ -19,7 +19,7 @@ class SlotSwapContainerAction(
val target: SwapTargets,
) : ContainerAction {
private val mode: Int get() = 2
private val button: Int get() = target.ordinal
private val button: Int get() = target.button
enum class SwapTargets(val button: Int) {
HOTBAR_1(0),