Strip all Phase references, TODO/FUTURE roadmap notes, and internal planning comments from the codebase. Run Prettier for consistent formatting across all Java files.
51 lines
1.4 KiB
Java
51 lines
1.4 KiB
Java
package com.tiedup.remake.v2.bondage;
|
|
|
|
import java.util.List;
|
|
import net.minecraft.world.item.ItemStack;
|
|
|
|
/**
|
|
* Result of attempting to equip a V2 bondage item.
|
|
* Carries displaced stacks for swap/supersede cases.
|
|
*/
|
|
public record V2EquipResult(Type type, List<ItemStack> displaced) {
|
|
public enum Type {
|
|
/** Item equipped successfully into empty regions. */
|
|
SUCCESS,
|
|
/** Single conflicting item was swapped out. */
|
|
SWAPPED,
|
|
/** Global item superseded multiple sub-region items. */
|
|
SUPERSEDED,
|
|
/** Item could not be equipped due to unresolvable conflicts. */
|
|
BLOCKED,
|
|
}
|
|
|
|
/** Convenience: check if equip was blocked. */
|
|
public boolean isBlocked() {
|
|
return type == Type.BLOCKED;
|
|
}
|
|
|
|
/** Convenience: check if equip succeeded (any non-blocked result). */
|
|
public boolean isSuccess() {
|
|
return type != Type.BLOCKED;
|
|
}
|
|
|
|
// ===== Factory methods =====
|
|
|
|
public static final V2EquipResult SUCCESS = new V2EquipResult(
|
|
Type.SUCCESS,
|
|
List.of()
|
|
);
|
|
public static final V2EquipResult BLOCKED = new V2EquipResult(
|
|
Type.BLOCKED,
|
|
List.of()
|
|
);
|
|
|
|
public static V2EquipResult swapped(ItemStack displaced) {
|
|
return new V2EquipResult(Type.SWAPPED, List.of(displaced));
|
|
}
|
|
|
|
public static V2EquipResult superseded(List<ItemStack> displaced) {
|
|
return new V2EquipResult(Type.SUPERSEDED, List.copyOf(displaced));
|
|
}
|
|
}
|