Integrate DuneChest patch 4
|
|
@ -1,6 +1,6 @@
|
|||
plugins { java }
|
||||
group = "com.example"
|
||||
version = "1.0.1"
|
||||
version = "1.0.2"
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
|
|
|
|||
|
|
@ -101,6 +101,13 @@ public final class StorageModule implements Listener, CommandExecutor {
|
|||
@EventHandler(ignoreCancelled = true) public void explode(BlockExplodeEvent e) { e.blockList().removeIf(b -> data.at(b) != null); }
|
||||
|
||||
// ---------- interaction ----------
|
||||
/** The wrench is built on a knowledge book, which vanilla consumes on right-click. Never let any right-click use it up. */
|
||||
@EventHandler(priority = EventPriority.LOWEST) public void wrenchNotConsumed(PlayerInteractEvent e) {
|
||||
var a = e.getAction(); if (a != org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK && a != org.bukkit.event.block.Action.RIGHT_CLICK_AIR) return;
|
||||
ItemStack held = e.getItem(); if (held == null || !StorageItems.WRENCH.equals(items.typeOf(held))) return;
|
||||
e.setUseItemInHand(Event.Result.DENY);
|
||||
}
|
||||
|
||||
/** Wrench: left-click a storage block to open its panel (works on Bedrock, and picks the exact block when several are adjacent). */
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void wrench(PlayerInteractEvent e) {
|
||||
if (e.getAction() != org.bukkit.event.block.Action.LEFT_CLICK_BLOCK || e.getClickedBlock() == null) return;
|
||||
|
|
@ -163,34 +170,48 @@ public final class StorageModule implements Listener, CommandExecutor {
|
|||
}
|
||||
private static String colourName(int c) { String n = DyeColor.values()[StorageRules.wrap(c)].name().toLowerCase(Locale.ROOT).replace('_', ' '); return Character.toUpperCase(n.charAt(0)) + n.substring(1); }
|
||||
|
||||
private static ChatColor chat(int c) {
|
||||
return switch (DyeColor.values()[StorageRules.wrap(c)]) {
|
||||
case WHITE -> ChatColor.WHITE; case ORANGE -> ChatColor.GOLD; case MAGENTA -> ChatColor.LIGHT_PURPLE; case LIGHT_BLUE -> ChatColor.AQUA;
|
||||
case YELLOW -> ChatColor.YELLOW; case LIME -> ChatColor.GREEN; case PINK -> ChatColor.LIGHT_PURPLE; case GRAY -> ChatColor.DARK_GRAY;
|
||||
case LIGHT_GRAY -> ChatColor.GRAY; case CYAN -> ChatColor.DARK_AQUA; case PURPLE -> ChatColor.DARK_PURPLE; case BLUE -> ChatColor.BLUE;
|
||||
case BROWN -> ChatColor.GOLD; case GREEN -> ChatColor.DARK_GREEN; case RED -> ChatColor.RED; case BLACK -> ChatColor.DARK_GRAY;
|
||||
};
|
||||
}
|
||||
private String coloured(int[] c) { return chat(c[0]) + colourName(c[0]) + ChatColor.GRAY + " \u00b7 " + chat(c[1]) + colourName(c[1]) + ChatColor.GRAY + " \u00b7 " + chat(c[2]) + colourName(c[2]); }
|
||||
|
||||
private void tuneMenu(Player pl, String key) {
|
||||
var p = data.blocks.get(key); if (p == null || p.kind != StorageData.Kind.ENDER_CHEST) return;
|
||||
if (!canUse(pl, p)) { say(pl, "This Ender Chest is private."); return; }
|
||||
Inventory model = Bukkit.createInventory(null, 27); Map<Integer, Runnable> actions = new HashMap<>();
|
||||
int[] slots = {11, 13, 15};
|
||||
// Info line first, then the three pads, then the actions: the renderer lays tiles out in slot order.
|
||||
model.setItem(4, legacyIcon(Material.ENDER_EYE, ChatColor.LIGHT_PURPLE + "Frequency", coloured(p.colors),
|
||||
p.priv ? ChatColor.YELLOW + "Private" + ChatColor.GRAY + " \u00b7 only you can open it" : ChatColor.GREEN + "Shared" + ChatColor.GRAY + " \u00b7 every chest with these colours links"));
|
||||
int[] slots = {10, 11, 12};
|
||||
for (int i = 0; i < 3; i++) { final int pad = i;
|
||||
model.setItem(slots[i], legacyIcon(wool(p.colors[i]), "Pad " + (i + 1) + ": " + colourName(p.colors[i]), "Click to choose a colour"));
|
||||
model.setItem(slots[i], legacyIcon(wool(p.colors[i]), ChatColor.GOLD + "Pad " + (i + 1), chat(p.colors[i]) + colourName(p.colors[i]), "Click to change"));
|
||||
actions.put(slots[i], () -> pickerMenu(pl, key, pad)); }
|
||||
model.setItem(4, legacyIcon(Material.ENDER_EYE, "Frequency", describe(p.colors), p.priv ? "Private" : "Shared by everyone with this frequency"));
|
||||
model.setItem(22, legacyIcon(Material.DIAMOND, p.priv ? "Private - click to share" : "Shared - click to make private", "Private chests only open for their owner"));
|
||||
actions.put(22, () -> { var q = data.blocks.get(key); if (q == null) return; q.priv = !q.priv; q.owner = q.priv ? pl.getUniqueId() : null; changed(key, q); tuneMenu(pl, key); });
|
||||
model.setItem(26, legacyIcon(Material.BARREL, "Open storage", "27 slots shared by this frequency"));
|
||||
actions.put(26, () -> { var q = data.blocks.get(key); if (q != null && canUse(pl, q)) pl.openInventory(data.inventory(freq(q))); });
|
||||
model.setItem(14, legacyIcon(Material.DIAMOND, p.priv ? ChatColor.YELLOW + "Private" : ChatColor.GREEN + "Shared", p.priv ? "Click to share it" : "Click to make it private"));
|
||||
actions.put(14, () -> { var q = data.blocks.get(key); if (q == null) return; q.priv = !q.priv; q.owner = q.priv ? pl.getUniqueId() : null; changed(key, q); tuneMenu(pl, key); });
|
||||
model.setItem(15, legacyIcon(Material.BARREL, ChatColor.AQUA + "Open storage", "27 slots shared by this frequency"));
|
||||
actions.put(15, () -> { var q = data.blocks.get(key); if (q != null && canUse(pl, q)) pl.openInventory(data.inventory(freq(q))); });
|
||||
com.example.dunegui.NativeMenus.inventory(plugin, pl, "Ender Chest", model, actions);
|
||||
}
|
||||
|
||||
private void pickerMenu(Player pl, String key, int pad) {
|
||||
var p = data.blocks.get(key); if (p == null || !canUse(pl, p)) return;
|
||||
Inventory model = Bukkit.createInventory(null, 27); Map<Integer, Runnable> actions = new HashMap<>();
|
||||
for (int c = 0; c < 16; c++) { final int colour = c; int slot = (c / 8) * 9 + (c % 8) + 1 + 0;
|
||||
ItemStack icon = legacyIcon(dye(c), colourName(c) + (p.colors[pad] == c ? " (current)" : ""), "Set pad " + (pad + 1) + " to " + colourName(c).toLowerCase(Locale.ROOT));
|
||||
if (p.colors[pad] == c) { ItemMeta m = icon.getItemMeta(); m.setEnchantmentGlintOverride(true); icon.setItemMeta(m); }
|
||||
model.setItem(4, legacyIcon(Material.ENDER_EYE, ChatColor.LIGHT_PURPLE + "Pad " + (pad + 1), "Now " + chat(p.colors[pad]) + colourName(p.colors[pad]), "Pick a colour below"));
|
||||
for (int c = 0; c < 16; c++) { final int colour = c; int slot = 9 + c;
|
||||
boolean cur = p.colors[pad] == c;
|
||||
ItemStack icon = legacyIcon(dye(c), chat(c) + colourName(c) + (cur ? ChatColor.GREEN + " (current)" : ""), cur ? "Already set" : "Set pad " + (pad + 1) + " to this colour");
|
||||
if (cur) { ItemMeta m = icon.getItemMeta(); m.setEnchantmentGlintOverride(true); icon.setItemMeta(m); }
|
||||
model.setItem(slot, icon);
|
||||
actions.put(slot, () -> { var q = data.blocks.get(key); if (q == null) return; q.colors[pad] = colour; changed(key, q); tuneMenu(pl, key); });
|
||||
}
|
||||
model.setItem(22, legacyIcon(Material.ARROW, "Back"));
|
||||
actions.put(22, () -> tuneMenu(pl, key));
|
||||
com.example.dunegui.NativeMenus.inventory(plugin, pl, "Ender Chest - Pad " + (pad + 1), model, actions);
|
||||
model.setItem(26, legacyIcon(Material.ARROW, ChatColor.GRAY + "Back"));
|
||||
actions.put(26, () -> tuneMenu(pl, key));
|
||||
com.example.dunegui.NativeMenus.inventory(plugin, pl, "Ender Chest \u00b7 Pad " + (pad + 1), model, actions);
|
||||
}
|
||||
|
||||
private void openFilter(Player pl, String key, StorageData.Placed p) {
|
||||
|
|
@ -366,7 +387,7 @@ public final class StorageModule implements Listener, CommandExecutor {
|
|||
Location centre = b.getLocation().add(0.5, 0.5, 0.5);
|
||||
centre.setYaw(switch (face) { case WEST -> 90f; case NORTH -> 180f; case EAST -> -90f; default -> 0f; });
|
||||
var body = b.getWorld().spawn(centre, ItemDisplay.class, id -> {
|
||||
id.setItemStack(items.hopperDisplayItem(p.tier, side)); id.setPersistent(false); id.setItemDisplayTransform(ItemDisplay.ItemDisplayTransform.NONE);
|
||||
id.setItemStack(items.hopperDisplayItem(p.tier, side)); id.setPersistent(false); id.setBrightness(new Display.Brightness(15, 15)); id.setItemDisplayTransform(ItemDisplay.ItemDisplayTransform.NONE);
|
||||
id.setTransformation(new Transformation(new Vector3f(), new AxisAngle4f(), new Vector3f(1.01f, 1.01f, 1.01f), new AxisAngle4f()));
|
||||
});
|
||||
displays.put(key, new ArrayList<>(List.of(body.getUniqueId()))); signatures.put(key, sig);
|
||||
|
|
@ -382,14 +403,14 @@ public final class StorageModule implements Listener, CommandExecutor {
|
|||
Location centre = b.getLocation().add(0.5, 0.5, 0.5);
|
||||
centre.setYaw(switch (f) { case WEST -> 90f; case NORTH -> 180f; case EAST -> -90f; default -> 0f; });
|
||||
var body = w.spawn(centre, ItemDisplay.class, id -> {
|
||||
id.setItemStack(items.create(StorageItems.ENDER, 1)); id.setPersistent(false); id.setItemDisplayTransform(ItemDisplay.ItemDisplayTransform.NONE);
|
||||
id.setItemStack(items.create(StorageItems.ENDER, 1)); id.setPersistent(false); id.setBrightness(new Display.Brightness(15, 15)); id.setItemDisplayTransform(ItemDisplay.ItemDisplayTransform.NONE);
|
||||
id.setTransformation(new Transformation(new Vector3f(), new AxisAngle4f(), new Vector3f(1.01f, 1.01f, 1.01f), new AxisAngle4f()));
|
||||
});
|
||||
made.add(body.getUniqueId());
|
||||
for (int i = 0; i < 3; i++) {
|
||||
double[] c = StorageRules.padCentre(f, i); final int idx = i;
|
||||
var d = w.spawn(b.getLocation(), BlockDisplay.class, bd -> {
|
||||
bd.setBlock(wool(p.colors[idx]).createBlockData()); bd.setPersistent(false);
|
||||
bd.setBlock(wool(p.colors[idx]).createBlockData()); bd.setPersistent(false); bd.setBrightness(new Display.Brightness(15, 15));
|
||||
bd.setTransformation(new Transformation(new Vector3f((float) (c[0] - 0.135), 1.012f, (float) (c[1] - 0.135)), new AxisAngle4f(), new Vector3f(0.27f, 0.05f, 0.27f), new AxisAngle4f()));
|
||||
});
|
||||
made.add(d.getUniqueId());
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
name: DuneChest
|
||||
version: 1.0.1
|
||||
version: 1.0.2
|
||||
main: com.example.dunechest.DuneChest
|
||||
api-version: '1.21.8'
|
||||
softdepend: [floodgate, DuneMenus, DuneEss]
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@ S = 32
|
|||
root = sys.argv[1]
|
||||
rng = random.Random(1701)
|
||||
|
||||
BODY = [(38, 24, 58), (44, 28, 66), (33, 20, 50), (50, 32, 74)] # dark violet stone
|
||||
BRASS = [(196, 150, 70), (222, 178, 92), (160, 118, 52)]
|
||||
EDGE = (20, 12, 32)
|
||||
BODY = [(18, 14, 30), (24, 18, 38), (13, 10, 24), (30, 22, 48)] # obsidian
|
||||
BRASS = [(74, 62, 112), (110, 92, 160), (46, 38, 74)] # dim violet-steel trim
|
||||
EDGE = (8, 6, 16)
|
||||
SPECK = [(96, 56, 170), (140, 90, 220), (60, 36, 110)]
|
||||
|
||||
def body():
|
||||
im = Image.new("RGBA", (S, S))
|
||||
|
|
@ -18,12 +19,14 @@ def body():
|
|||
for y in range(S):
|
||||
for x in range(S):
|
||||
px[x, y] = rng.choice(BODY) + (255,)
|
||||
for _ in range(S * S // 40): # violet obsidian flecks
|
||||
px[rng.randrange(S), rng.randrange(S)] = rng.choice(SPECK) + (255,)
|
||||
return im
|
||||
|
||||
def bevel(im):
|
||||
d = ImageDraw.Draw(im)
|
||||
d.rectangle([0, 0, S - 1, S - 1], outline=EDGE + (255,))
|
||||
d.line([(1, 1), (S - 2, 1)], fill=(88, 60, 124, 255)); d.line([(1, 1), (1, S - 2)], fill=(72, 48, 104, 255))
|
||||
d.line([(1, 1), (S - 2, 1)], fill=(52, 36, 84, 255)); d.line([(1, 1), (1, S - 2)], fill=(44, 30, 70, 255))
|
||||
return im
|
||||
|
||||
def band(im, y0, y1):
|
||||
|
|
@ -48,14 +51,14 @@ def eye(im):
|
|||
|
||||
side = bevel(body()); band(side, 1, 5); band(side, S - 6, S - 2); rivets(side, 3); rivets(side, S - 4)
|
||||
front = bevel(body()); band(front, 1, 7); band(front, S - 6, S - 2); eye(front); rivets(front, 4)
|
||||
d = ImageDraw.Draw(front); d.rectangle([S // 2 - 2, 6, S // 2 + 1, 10], fill=BRASS[1] + (255,), outline=BRASS[2] + (255,)) # latch
|
||||
d = ImageDraw.Draw(front); d.rectangle([S // 2 - 2, 6, S // 2 + 1, 10], fill=(222, 178, 92, 255), outline=(160, 118, 52, 255)) # brass latch
|
||||
|
||||
top = bevel(body())
|
||||
d = ImageDraw.Draw(top)
|
||||
for i in range(3): # three recessed pad slots, matching the wool pads placed on top
|
||||
cx = int(round((i + 0.5) / 3 * S))
|
||||
d.rectangle([cx - 5, S // 2 - 5, cx + 5, S // 2 + 5], fill=(14, 8, 22, 255), outline=BRASS[0] + (255,))
|
||||
d.rectangle([cx - 4, S // 2 - 4, cx + 4, S // 2 + 4], outline=(60, 40, 90, 255))
|
||||
d.rectangle([cx - 5, S // 2 - 5, cx + 5, S // 2 + 5], fill=(6, 4, 12, 255), outline=BRASS[1] + (255,))
|
||||
d.rectangle([cx - 4, S // 2 - 4, cx + 4, S // 2 + 4], outline=(40, 28, 64, 255))
|
||||
bottom = bevel(body())
|
||||
|
||||
os.makedirs(os.path.join(root, "textures/block"), exist_ok=True)
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 923 B After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 791 B After Width: | Height: | Size: 860 B |
|
Before Width: | Height: | Size: 769 B After Width: | Height: | Size: 901 B |
|
Before Width: | Height: | Size: 748 B After Width: | Height: | Size: 888 B |
|
|
@ -275,8 +275,12 @@ def plan(artifacts, inventory, expected_source):
|
|||
if not {'dunerealmsgui','mcgui'}.issubset(existing_paths):
|
||||
raise ValueError('DuneChest pack delivery requires the installed GUI and MCGUI runtimes')
|
||||
installed=existing_paths.get('dunechest')
|
||||
if installed is not None and digest(installed)!=chosen[0]['sha256']:
|
||||
raise ValueError('Existing DuneChest differs from this first fleet release')
|
||||
approved_dunechest = {
|
||||
chosen[0]['sha256'],
|
||||
'a1cd67aeea65d4a9dc98b75b1466fd54a120213e3eef31582c9492d546e484c2',
|
||||
}
|
||||
if installed is not None and digest(installed) not in approved_dunechest:
|
||||
raise ValueError('Existing DuneChest differs from the approved release or predecessor')
|
||||
replaced={entry['filename'] for entry in previous}
|
||||
retained=[{'filename':path.name,'sha256':digest(path),'metadata':metadata(path)}
|
||||
for path in sorted(plugins.glob('*.jar')) if path.name not in replaced]
|
||||
|
|
|
|||

Staff