Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement interface of various inventories #196

Merged
merged 15 commits into from
Jun 5, 2024
Merged
3 changes: 3 additions & 0 deletions Sources/Core/Sources/GUI/GUISprite.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public enum GUISprite {
case singleChestTopHalf
case singleChestBottomHalf
case doubleChest // No top/bottom half since it just uses the full image
FloofyPlasma marked this conversation as resolved.
Show resolved Hide resolved
case generic9x1
case generic9x4
case generic9x5
FloofyPlasma marked this conversation as resolved.
Show resolved Hide resolved
/// The descriptor for the sprite.
Expand Down Expand Up @@ -65,6 +66,8 @@ public enum GUISprite {
return GUISpriteDescriptor(slice: .genericContainer, position: [0, 125], size: [176, 97])
case .doubleChest:
return GUISpriteDescriptor(slice: .genericContainer, position: [0, 0], size: [176, 222])
case .generic9x1:
return GUISpriteDescriptor(slice: .genericContainer, position: [0, 0], size: [176, 35])
case .generic9x4:
return GUISpriteDescriptor(slice: .genericContainer, position: [0, 0], size: [176, 89])
case .generic9x5:
Expand Down
33 changes: 32 additions & 1 deletion Sources/Core/Sources/GUI/WindowType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,37 @@ public struct WindowType {
)

// Generic window types
public static let generic9x4 = WindowType(
public static let generic9x1 = WindowType(
id: .vanilla(0),
identifier: Identifier(namespace: "minecraft", name: "generic_9x1"),
background: GUIElement.list(spacing: 0) {
GUIElement.sprite(.generic9x1)
GUIElement.sprite(.singleChestBottomHalf)
},
FloofyPlasma marked this conversation as resolved.
Show resolved Hide resolved
slotCount: 45,
areas: [
WindowArea(
startIndex: 0,
width: 9,
height: 1,
position: Vec2i(8, 18)
),
WindowArea(
startIndex: 9,
width: 9,
height: 3,
position: Vec2i(8, 33)
),
WindowArea(
startIndex: 36,
width: 9,
height: 1,
position: Vec2i(8, 91)
)
]
)

public static let generic9x4 = WindowType(
id: .vanilla(3),
identifier: Identifier(namespace: "minecraft", name: "generic_9x4"),
background: GUIElement.list(spacing: 0) {
Expand Down Expand Up @@ -188,6 +218,7 @@ public static let generic9x5 = WindowType(
craftingTable,
chest,
doubleChest,
generic9x1,
generic9x4,
generic9x5
],
Expand Down
Loading