alpha-blend translucent block and entity texels (stained glass, slime skin, text backgrounds)
This commit is contained in:
1 parent
37fa1d8f56
commit
9a6c8b538d
8 files changed
+283
-110
No files matched your search
@@ -56,6 +56,7 @@ public class PPTest extends JavaPlugin {
|
||||
scenes.put("pistondown", new Scene("pistondown", this::piston, -1.6, 2.6, -1.6, 0.5, 1.4, 0.5));
|
||||
scenes.put("pistonup", new Scene("pistonup", this::piston, 0.4, 2.6, -1.6, 2.5, 1.4, 0.5));
|
||||
scenes.put("vehicles", new Scene("vehicles", this::vehicles, 5, 3, -7, 5, 0.6, 1.5));
|
||||
scenes.put("translucent", new Scene("translucent", this::translucent, 4.5, 2.8, -5.5, 4.5, 0.8, 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -474,4 +475,39 @@ public class PPTest extends JavaPlugin {
|
||||
spawn(o, 6, 0, 3, 90, EntityType.CHERRY_CHEST_BOAT);
|
||||
spawn(o, 9, 0, 3, 120, EntityType.MANGROVE_BOAT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alpha blending: a stained-glass wall (inner faces culled) and stacked glass colours in front of a striped
|
||||
* wool wall, ice/tinted glass/slime/honey blocks, connected panes, glass under water, a slime and a sulfur
|
||||
* cube (translucent outer skins, one behind glass) and a text display with the default background.
|
||||
*/
|
||||
private void translucent(Location o) {
|
||||
java.util.function.BiConsumer<int[], String> put = (p, data) -> o.clone().add(p[0], p[1], p[2]).getBlock()
|
||||
.setBlockData(Bukkit.createBlockData("minecraft:" + data), false);
|
||||
for (int x = -1; x <= 10; x++)
|
||||
for (int y = 0; y <= 4; y++) put.accept(new int[] {x, y, 5}, (x + y) % 2 == 0 ? "white_wool" : "black_wool");
|
||||
for (int x = 0; x <= 2; x++) for (int y = 0; y <= 1; y++) put.accept(new int[] {x, y, 1}, "red_stained_glass");
|
||||
put.accept(new int[] {3, 0, 1}, "blue_stained_glass");
|
||||
put.accept(new int[] {3, 0, 0}, "yellow_stained_glass");
|
||||
put.accept(new int[] {4, 0, 1}, "ice");
|
||||
put.accept(new int[] {4, 1, 1}, "tinted_glass");
|
||||
put.accept(new int[] {5, 0, 1}, "slime_block");
|
||||
put.accept(new int[] {6, 0, 1}, "honey_block");
|
||||
put.accept(new int[] {7, 0, 1}, "lime_stained_glass_pane[east=true]");
|
||||
put.accept(new int[] {8, 0, 1}, "lime_stained_glass_pane[west=true,east=true]");
|
||||
put.accept(new int[] {9, 0, 1}, "lime_stained_glass_pane[west=true]");
|
||||
for (int x = 0; x <= 2; x++) put.accept(new int[] {x, -1, -2}, "water");
|
||||
put.accept(new int[] {1, -2, -2}, "magenta_stained_glass");
|
||||
put.accept(new int[] {0, -2, -2}, "sand");
|
||||
put.accept(new int[] {2, -2, -2}, "sand");
|
||||
Slime slime = spawn(o, 1.5, 0, 3, 200, Slime.class);
|
||||
slime.setSize(2);
|
||||
Slime front = spawn(o, 7.5, 0, -1.5, 160, Slime.class);
|
||||
front.setSize(1);
|
||||
EntityType sulfur = Registry.ENTITY_TYPE.get(NamespacedKey.minecraft("sulfur_cube"));
|
||||
if (sulfur != null) spawn(o, 5.5, 0, -1.5, 200, sulfur);
|
||||
TextDisplay t = spawn(o, 4.5, 2.6, 0, 0, TextDisplay.class);
|
||||
t.text(Component.text("Default background"));
|
||||
t.setBillboard(Display.Billboard.CENTER);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user