39 lines
1.6 KiB
Java
39 lines
1.6 KiB
Java
package dev.hytalemodding.events;
|
|||
|
|
|
||
|
|
import com.hypixel.hytale.component.Archetype;
|
||
|
|
import com.hypixel.hytale.component.ArchetypeChunk;
|
||
|
|
import com.hypixel.hytale.component.CommandBuffer;
|
||
|
|
import com.hypixel.hytale.component.Store;
|
||
|
|
import com.hypixel.hytale.component.query.Query;
|
||
|
|
import com.hypixel.hytale.component.system.EntityEventSystem;
|
||
|
|
import com.hypixel.hytale.server.core.event.events.ecs.BreakBlockEvent;
|
||
|
|
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||
|
|
import dev.hytalemodding.RitualSpawner;
|
||
|
|
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
||
|
|
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
||
|
|
import org.joml.Vector3i;
|
||
|
|
|
||
|
|
public class RitualBreakBlockEvent extends EntityEventSystem<EntityStore, BreakBlockEvent> {
|
||
|
|
private final RitualSpawner ritualSpawner;
|
||
|
|
public RitualBreakBlockEvent(RitualSpawner ritualSpawner) {
|
||
|
|
super(BreakBlockEvent.class);
|
||
|
|
this.ritualSpawner = ritualSpawner;
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public void handle(int index,
|
||
|
|
@NonNullDecl ArchetypeChunk<EntityStore> archetypeChunk,
|
||
|
|
@NonNullDecl Store<EntityStore> store,
|
||
|
|
@NonNullDecl CommandBuffer<EntityStore> commandBuffer,
|
||
|
|
@NonNullDecl BreakBlockEvent breakBlockEvent) {
|
||
|
|
String itemHolding = breakBlockEvent.getItemInHand().getItemId();
|
||
|
|
Vector3i blockPosition = breakBlockEvent.getTargetBlock();
|
||
|
|
ritualSpawner.blockChangeEvent(itemHolding, blockPosition);
|
||
|
|
}
|
||
|
|
|
||
|
|
@NullableDecl
|
||
|
|
@Override
|
||
|
|
public Query<EntityStore> getQuery() {
|
||
|
|
return Archetype.empty();
|
||
|
|
}
|
||
|
|
}
|