|
1 | | -package net.morbz.minecraft.world; |
2 | | - |
3 | | -/* |
4 | | -* The MIT License (MIT) |
5 | | -* |
6 | | -* Copyright (c) 2014-2015 Merten Peetz |
7 | | -* |
8 | | -* Permission is hereby granted, free of charge, to any person obtaining a copy |
9 | | -* of this software and associated documentation files (the "Software"), to deal |
10 | | -* in the Software without restriction, including without limitation the rights |
11 | | -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
12 | | -* copies of the Software, and to permit persons to whom the Software is |
13 | | -* furnished to do so, subject to the following conditions: |
14 | | -* |
15 | | -* The above copyright notice and this permission notice shall be included in all |
16 | | -* copies or substantial portions of the Software. |
17 | | -* |
18 | | -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
19 | | -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
20 | | -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
21 | | -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
22 | | -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
23 | | -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
24 | | -* SOFTWARE. |
25 | | -*/ |
26 | | - |
27 | | -/** |
28 | | - * The interface for all classes that contain blocks. |
29 | | - * |
30 | | - * @author MorbZ |
31 | | - */ |
32 | | -public interface IBlockContainer { |
33 | | - /** |
34 | | - * Returns the transparency level of the block at given position. If there is no block |
35 | | - * World.DEFAULT_TRANSPARENCY will be returned. 0 means fully opaque, 1 means fully transparent |
36 | | - * and values > 1 mean transparent but the light level is decreased by n at this block. |
37 | | - * |
38 | | - * @param x The local X-coordinate |
39 | | - * @param y The local Y-coordinate |
40 | | - * @param z The local Z-coordinate |
41 | | - * @return The transparency level |
42 | | - */ |
43 | | - public byte getTransparency(int x, int y, int z); |
44 | | - |
45 | | - /** |
46 | | - * Returns the sky light level of the block at given position. If there is no block |
47 | | - * World.DEFAULT_SKY_LIGHT will be returned. |
48 | | - * |
49 | | - * @param x The local X-coordinate |
50 | | - * @param y The local Y-coordinate |
51 | | - * @param z The local Z-coordinate |
52 | | - * @return The transparency level |
53 | | - */ |
54 | | - public byte getSkyLight(int x, int y, int z); |
55 | | - |
56 | | - /** |
57 | | - * Sets the sky light level of the block at given position. |
58 | | - * |
59 | | - * @param x The local X-coordinate |
60 | | - * @param y The local Y-coordinate |
61 | | - * @param z The local Z-coordinate |
62 | | - * @param light The sky light level |
63 | | - */ |
64 | | - public void setSkyLight(int x, int y, int z, byte light); |
65 | | -} |
| 1 | +package net.morbz.minecraft.world; |
| 2 | + |
| 3 | +/* |
| 4 | +* The MIT License (MIT) |
| 5 | +* |
| 6 | +* Copyright (c) 2014-2015 Merten Peetz |
| 7 | +* |
| 8 | +* Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 | +* of this software and associated documentation files (the "Software"), to deal |
| 10 | +* in the Software without restriction, including without limitation the rights |
| 11 | +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 | +* copies of the Software, and to permit persons to whom the Software is |
| 13 | +* furnished to do so, subject to the following conditions: |
| 14 | +* |
| 15 | +* The above copyright notice and this permission notice shall be included in all |
| 16 | +* copies or substantial portions of the Software. |
| 17 | +* |
| 18 | +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 21 | +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 | +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 | +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 24 | +* SOFTWARE. |
| 25 | +*/ |
| 26 | + |
| 27 | +/** |
| 28 | + * The interface for all classes that contain blocks. |
| 29 | + * |
| 30 | + * @author MorbZ |
| 31 | + */ |
| 32 | +public interface IBlockContainer { |
| 33 | + /** |
| 34 | + * Returns the sky light level of the block at given position. If there is no block |
| 35 | + * World.DEFAULT_SKY_LIGHT will be returned. |
| 36 | + * |
| 37 | + * @param x The local X-coordinate |
| 38 | + * @param y The local Y-coordinate |
| 39 | + * @param z The local Z-coordinate |
| 40 | + * @return The sky light level |
| 41 | + */ |
| 42 | + public byte getSkyLight(int x, int y, int z); |
| 43 | + |
| 44 | + /** |
| 45 | + * Returns the sky light level of a block that is out of bounds of the child block container. |
| 46 | + * |
| 47 | + * @param child The child block container |
| 48 | + * @param childX The local X-coordinate |
| 49 | + * @param childY The local Y-coordinate |
| 50 | + * @param childZ The local Z-coordinate |
| 51 | + * @return The sky light level |
| 52 | + */ |
| 53 | + public byte getSkyLightFromParent(IBlockContainer child, int childX, int childY, int childZ); |
| 54 | + |
| 55 | + /** |
| 56 | + * Spreads the skylight. For each block that has the given light level it's adjacent blocks will |
| 57 | + * be lit if their current light level is lower. |
| 58 | + * |
| 59 | + * @param light The light level |
| 60 | + */ |
| 61 | + public void spreadSkyLight(byte light); |
| 62 | +} |
0 commit comments