mirror of
https://github.com/YouHaveTrouble/QuickerStacker.git
synced 2026-05-11 21:56:55 +00:00
fully working quick stack interaction
This commit is contained in:
+1
-6
@@ -6,9 +6,7 @@ import com.hypixel.hytale.component.Ref;
|
|||||||
import com.hypixel.hytale.math.util.ChunkUtil;
|
import com.hypixel.hytale.math.util.ChunkUtil;
|
||||||
import com.hypixel.hytale.math.vector.Vector3i;
|
import com.hypixel.hytale.math.vector.Vector3i;
|
||||||
import com.hypixel.hytale.protocol.BlockPosition;
|
import com.hypixel.hytale.protocol.BlockPosition;
|
||||||
import com.hypixel.hytale.protocol.InteractionSyncData;
|
|
||||||
import com.hypixel.hytale.protocol.InteractionType;
|
import com.hypixel.hytale.protocol.InteractionType;
|
||||||
import com.hypixel.hytale.server.core.Message;
|
|
||||||
import com.hypixel.hytale.server.core.entity.InteractionContext;
|
import com.hypixel.hytale.server.core.entity.InteractionContext;
|
||||||
import com.hypixel.hytale.server.core.entity.entities.Player;
|
import com.hypixel.hytale.server.core.entity.entities.Player;
|
||||||
import com.hypixel.hytale.server.core.inventory.Inventory;
|
import com.hypixel.hytale.server.core.inventory.Inventory;
|
||||||
@@ -34,15 +32,12 @@ public class QuickStackToChestInteraction extends SimpleBlockInteraction {
|
|||||||
Ref<EntityStore> ref = interactionContext.getEntity();
|
Ref<EntityStore> ref = interactionContext.getEntity();
|
||||||
Player player = ref.getStore().getComponent(ref, Player.getComponentType());
|
Player player = ref.getStore().getComponent(ref, Player.getComponentType());
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
InteractionSyncData clientState = interactionContext.getClientState();
|
BlockPosition targetBlockPosition = interactionContext.getTargetBlock();
|
||||||
if (clientState == null) return;
|
|
||||||
BlockPosition targetBlockPosition = clientState.blockPosition;
|
|
||||||
if (targetBlockPosition == null) return;
|
if (targetBlockPosition == null) return;
|
||||||
WorldChunk chunk = world.getChunk(ChunkUtil.indexChunkFromBlock(targetBlockPosition.x, targetBlockPosition.z));
|
WorldChunk chunk = world.getChunk(ChunkUtil.indexChunkFromBlock(targetBlockPosition.x, targetBlockPosition.z));
|
||||||
if (chunk == null) return;
|
if (chunk == null) return;
|
||||||
var blockState = chunk.getState(targetBlockPosition.x, targetBlockPosition.y, targetBlockPosition.z);
|
var blockState = chunk.getState(targetBlockPosition.x, targetBlockPosition.y, targetBlockPosition.z);
|
||||||
if (!(blockState instanceof ItemContainerState containerState)) return;
|
if (!(blockState instanceof ItemContainerState containerState)) return;
|
||||||
|
|
||||||
Inventory playerInventory = player.getInventory();
|
Inventory playerInventory = player.getInventory();
|
||||||
if (playerInventory == null) return;
|
if (playerInventory == null) return;
|
||||||
playerInventory.getCombinedHotbarFirst().quickStackTo(containerState.getItemContainer());
|
playerInventory.getCombinedHotbarFirst().quickStackTo(containerState.getItemContainer());
|
||||||
|
|||||||
Reference in New Issue
Block a user