-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b6ca83
commit bb0c832
Showing
6 changed files
with
77 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/java/com/cjburkey/claimchunk/gui/screens/MapMenu.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.cjburkey.claimchunk.gui.screens; | ||
|
||
import com.cjburkey.claimchunk.ClaimChunk; | ||
import com.cjburkey.claimchunk.chunk.ChunkPos; | ||
import com.cjburkey.claimchunk.gui.GuiMenuScreen; | ||
|
||
import org.bukkit.Material; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class MapMenu extends GuiMenuScreen { | ||
|
||
private static final int MAP_HEIGHT = 5; | ||
|
||
public MapMenu(ClaimChunk claimChunk) { | ||
super(claimChunk, MAP_HEIGHT, claimChunk.getMessages().guiMapMenuTitle); | ||
} | ||
|
||
@Override | ||
protected void onBuildGui() { | ||
if (player == null) return; | ||
|
||
ChunkPos centerChunk = new ChunkPos(player.getLocation().getChunk()); | ||
|
||
int halfHeight = Math.floorDiv(MAP_HEIGHT, 2); | ||
|
||
// Inventory width is 9, so go 4 eastward and westward | ||
for (int offsetX = -4; offsetX <= 4; offsetX++) { | ||
// Inventory height is `MAP_HEIGHT`, so go `halfHeight` northward and southward | ||
for (int offsetZ = -halfHeight; offsetZ <= halfHeight; offsetZ++) { | ||
int slot = (offsetX + 4) + 9 * (offsetZ + halfHeight); | ||
ChunkPos offsetChunk = | ||
new ChunkPos( | ||
centerChunk.world(), | ||
centerChunk.x() + offsetX, | ||
centerChunk.z() + offsetZ); | ||
|
||
// TODO: CHANGE MATERIAL | ||
|
||
addInteractiveButton( | ||
slot, | ||
Material.DIRT, | ||
"&r&fChunk at " + offsetChunk, | ||
new ArrayList<>(), | ||
(clickType, stack) -> {}); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters