make it compile for 2026.03.26-89796e57b

This commit is contained in:
2026-03-26 17:09:55 +01:00
parent 0200b98312
commit 51c720abce
4 changed files with 17 additions and 23 deletions
+2 -2
View File
@@ -20,8 +20,8 @@
<maven.compiler.source>25</maven.compiler.source>
<maven.compiler.target>25</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hytale.version>2026.02.19-1a311a592</hytale.version>
<revision>1.3.0</revision>
<hytale.version>2026.03.26-89796e57b</hytale.version>
<revision>1.4.0</revision>
</properties>
<build>
@@ -97,7 +97,7 @@ public class QuickerStacker extends JavaPlugin {
InteractionManager interactionManager = new InteractionManager(player, playerRef, new InteractionSimulationHandler());
BlockType blockType = world.getBlockType(x, y, z);
if (blockType == null) return false;
var event = new UseBlockEvent.Pre(InteractionType.Use, InteractionContext.forProxyEntity(interactionManager, player, ref), new Vector3i(x, y, z), blockType);
var event = new UseBlockEvent.Pre(InteractionType.Use, InteractionContext.forProxyEntity(interactionManager, ref, ref, ref.getStore()), new Vector3i(x, y, z), blockType);
ref.getStore().invoke(ref, event);
return !event.isCancelled();
}
@@ -2,7 +2,6 @@ package me.youhavetrouble.quickerstacker.interaction;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.math.util.ChunkUtil;
import com.hypixel.hytale.math.vector.Vector3i;
@@ -13,16 +12,16 @@ import com.hypixel.hytale.server.core.entity.InteractionContext;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.inventory.Inventory;
import com.hypixel.hytale.server.core.inventory.ItemStack;
import com.hypixel.hytale.server.core.inventory.container.SimpleItemContainer;
import com.hypixel.hytale.server.core.inventory.transaction.ItemStackTransaction;
import com.hypixel.hytale.server.core.inventory.transaction.ListTransaction;
import com.hypixel.hytale.server.core.inventory.transaction.MoveTransaction;
import com.hypixel.hytale.server.core.modules.block.components.ItemContainerBlock;
import com.hypixel.hytale.server.core.modules.interaction.interaction.CooldownHandler;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.client.SimpleBlockInteraction;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.chunk.WorldChunk;
import com.hypixel.hytale.server.core.universe.world.meta.BlockStateModule;
import com.hypixel.hytale.server.core.universe.world.meta.state.ItemContainerState;
import com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.server.core.util.NotificationUtil;
@@ -51,13 +50,12 @@ public class QuickStackToChestInteraction extends SimpleBlockInteraction {
if (chunk == null) return;
Ref<ChunkStore> blockRef = chunk.getBlockComponentEntity(x, y, z);
if (blockRef == null) return;
ComponentType<ChunkStore, ItemContainerState> stashComponentType = BlockStateModule.get().getComponentType(ItemContainerState.class);
if (stashComponentType == null) return;
ItemContainerState containerState = blockRef.getStore().getComponent(blockRef, stashComponentType);
if (containerState == null) return;
ItemContainerBlock containerBlock = blockRef.getStore().getComponent(blockRef, ItemContainerBlock.getComponentType());
if (containerBlock == null) return;
SimpleItemContainer container = containerBlock.getItemContainer();
Inventory playerInventory = player.getInventory();
if (playerInventory == null) return;
ListTransaction<MoveTransaction<ItemStackTransaction>> transaction = playerInventory.getCombinedHotbarFirst().quickStackTo(containerState.getItemContainer());
ListTransaction<MoveTransaction<ItemStackTransaction>> transaction = playerInventory.getCombinedHotbarFirst().quickStackTo(container);
if (transaction.size() <= 0) return;
PlayerRef playerRef = ref.getStore().getComponent(ref, PlayerRef.getComponentType());
if (playerRef == null) return;
@@ -2,7 +2,6 @@ package me.youhavetrouble.quickerstacker.interaction;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.math.util.ChunkUtil;
@@ -19,14 +18,13 @@ import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
import com.hypixel.hytale.server.core.inventory.transaction.ItemStackTransaction;
import com.hypixel.hytale.server.core.inventory.transaction.ListTransaction;
import com.hypixel.hytale.server.core.inventory.transaction.MoveTransaction;
import com.hypixel.hytale.server.core.modules.block.components.ItemContainerBlock;
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
import com.hypixel.hytale.server.core.modules.interaction.interaction.CooldownHandler;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.client.SimpleBlockInteraction;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.chunk.WorldChunk;
import com.hypixel.hytale.server.core.universe.world.meta.BlockStateModule;
import com.hypixel.hytale.server.core.universe.world.meta.state.ItemContainerState;
import com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.server.core.util.NotificationUtil;
@@ -52,12 +50,12 @@ public class QuickStackToNearbyChestsInteraction extends SimpleBlockInteraction
if (playerRef == null) return;
BlockPosition targetBlockPosition = interactionContext.getTargetBlock();
if (targetBlockPosition == null) return;
Collection<ItemContainerState> nearbyContainers = getNearbyContainers(world, ref, ref.getStore(), 10);
Collection<ItemContainerBlock> nearbyContainers = getNearbyContainers(world, ref, ref.getStore(), 10);
if (nearbyContainers.isEmpty()) return;
Inventory playerInventory = player.getInventory();
if (playerInventory == null) return;
int itemsMoved = 0;
for (ItemContainerState containerState : nearbyContainers) {
for (ItemContainerBlock containerState : nearbyContainers) {
ItemContainer itemContainer = containerState.getItemContainer();
ListTransaction<MoveTransaction<ItemStackTransaction>> transaction = playerInventory.getCombinedHotbarFirst().quickStackTo(itemContainer);
for (var tr : transaction.getList()) {
@@ -83,13 +81,11 @@ public class QuickStackToNearbyChestsInteraction extends SimpleBlockInteraction
* @param range Range to search in
* @return Collection of found item containers
*/
private Collection<ItemContainerState> getNearbyContainers(World world, Ref<EntityStore> ref, Store<EntityStore> store, int range) {
ArrayList<ItemContainerState> foundContainers = new ArrayList<>();
private Collection<ItemContainerBlock> getNearbyContainers(World world, Ref<EntityStore> ref, Store<EntityStore> store, int range) {
ArrayList<ItemContainerBlock> foundContainers = new ArrayList<>();
TransformComponent transformComponent = store.getComponent(ref, TransformComponent.getComponentType());
if (transformComponent == null) return foundContainers;
Vector3d position = transformComponent.getPosition();
ComponentType<ChunkStore, ItemContainerState> stashComponentType = BlockStateModule.get().getComponentType(ItemContainerState.class);
if (stashComponentType == null) return foundContainers;
for (int x = -range; x <= range; x++) {
for (int y = -range; y < range; y++) {
for (int z = -range; z <= range; z++) {
@@ -104,9 +100,9 @@ public class QuickStackToNearbyChestsInteraction extends SimpleBlockInteraction
if (chunk == null) continue;
Ref<ChunkStore> blockRef = chunk.getBlockComponentEntity((int) position.getX() + x, (int) position.getY() + y, (int) position.getZ() + z);
if (blockRef == null) continue;
ItemContainerState containerState = blockRef.getStore().getComponent(blockRef, stashComponentType);
if (containerState == null) continue;
foundContainers.add(containerState);
ItemContainerBlock containerBlock = blockRef.getStore().getComponent(blockRef, ItemContainerBlock.getComponentType());
if (containerBlock == null) continue;
foundContainers.add(containerBlock);
}
}
}