Skip to content

Commit 3ff63da

Browse files
Adrijanedemanuele3d
authored andcommitted
Added some javadocs (#3217)
Javadocs work by Adrijaned
1 parent 1a2273d commit 3ff63da

File tree

9 files changed

+299
-35
lines changed

9 files changed

+299
-35
lines changed

engine/src/main/java/org/terasology/utilities/subscribables/AbstractGeneralSubscribable.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,15 @@
1818
import java.beans.PropertyChangeListener;
1919
import java.beans.PropertyChangeSupport;
2020

21-
/**
22-
* {@inheritDoc}
23-
*/
2421
public class AbstractGeneralSubscribable implements GeneralSubscribable {
2522

2623
protected transient PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
2724

28-
/**
29-
* {@inheritDoc}
30-
*/
3125
@Override
3226
public void subscribe(PropertyChangeListener changeListener) {
3327
this.propertyChangeSupport.addPropertyChangeListener(changeListener);
3428
}
3529

36-
/**
37-
* {@inheritDoc}
38-
*/
3930
@Override
4031
public void unsubscribe(PropertyChangeListener changeListener) {
4132
this.propertyChangeSupport.removePropertyChangeListener(changeListener);

engine/src/main/java/org/terasology/utilities/subscribables/AbstractSpecificSubscribable.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,15 @@
1818
import java.beans.PropertyChangeListener;
1919
import java.beans.PropertyChangeSupport;
2020

21-
/**
22-
* {@inheritDoc}
23-
*/
2421
public class AbstractSpecificSubscribable implements SpecificSubscribable {
2522

2623
protected transient PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
2724

28-
/**
29-
* {@inheritDoc}
30-
*/
3125
@Override
3226
public void subscribe(String propertyName, PropertyChangeListener changeListener) {
3327
this.propertyChangeSupport.addPropertyChangeListener(propertyName, changeListener);
3428
}
3529

36-
/**
37-
* {@inheritDoc}
38-
*/
3930
@Override
4031
public void unsubscribe(String propertyName, PropertyChangeListener changeListener) {
4132
this.propertyChangeSupport.removePropertyChangeListener(propertyName, changeListener);

engine/src/main/java/org/terasology/utilities/subscribables/AbstractSubscribable.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,25 @@
1818
import java.beans.PropertyChangeListener;
1919
import java.beans.PropertyChangeSupport;
2020

21-
/**
22-
* {@inheritDoc}
23-
*/
2421
public abstract class AbstractSubscribable implements Subscribable {
2522

2623
protected transient PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
2724

28-
/**
29-
* {@inheritDoc}
30-
*/
3125
@Override
3226
public void subscribe(PropertyChangeListener changeListener) {
3327
this.propertyChangeSupport.addPropertyChangeListener(changeListener);
3428
}
3529

36-
/**
37-
* {@inheritDoc}
38-
*/
3930
@Override
4031
public void unsubscribe(PropertyChangeListener changeListener) {
4132
this.propertyChangeSupport.removePropertyChangeListener(changeListener);
4233
}
4334

44-
/**
45-
* {@inheritDoc}
46-
*/
4735
@Override
4836
public void subscribe(String propertyName, PropertyChangeListener changeListener) {
4937
this.propertyChangeSupport.addPropertyChangeListener(propertyName, changeListener);
5038
}
5139

52-
/**
53-
* {@inheritDoc}
54-
*/
5540
@Override
5641
public void unsubscribe(String propertyName, PropertyChangeListener changeListener) {
5742
this.propertyChangeSupport.removePropertyChangeListener(propertyName, changeListener);

engine/src/main/java/org/terasology/world/block/BlockUri.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
/**
2828
* Identifier for both blocks and block families. It is a combination of the ResourceUrn of a block family definition, the id of a block, and optionally the
2929
* ResourceUrn of a shape.
30-
* The final pattern is
30+
* The final pattern is (see {@link BlockUri} for details):
3131
* [package]:[blockFamily]:[shapePackage]:[shapeName].[blockIdentifier]
3232
* the third and forth parts are only used for blocks that don't use the engine:cube shape, and which
3333
* are generated from a multi-shape block.

engine/src/main/java/org/terasology/world/chunks/Chunk.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
import org.terasology.module.sandbox.API;
2020

2121
/**
22+
* Chunks are a box-shaped logical grouping of Terasology's blocks, for performance reasons.
23+
*
24+
* For example the renderer renders a single mesh for all opaque blocks in a chunk rather
25+
* than rendering each block as a separate mesh.
26+
*
27+
* For details on dimensions and other chunks characteristics see {@link ChunkConstants}.
2228
*/
2329
@API
2430
public interface Chunk extends ManagedChunk, RenderableChunk {

engine/src/main/java/org/terasology/world/chunks/CoreChunk.java

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,56 +37,211 @@
3737
*/
3838
@API
3939
public interface CoreChunk {
40+
/**
41+
* @return Position of the chunk in world, where units of distance from origin are blocks
42+
*/
4043
Vector3i getPosition();
4144

45+
/**
46+
* Returns block at given position relative to the chunk.
47+
*
48+
* @param pos Position of the block relative to corner of the chunk
49+
* @return Block at given position
50+
*/
4251
Block getBlock(BaseVector3i pos);
4352

53+
/**
54+
* Returns block at given position relative to the chunk.
55+
*
56+
* @param x X offset from the corner of the chunk
57+
* @param y Y offset from the corner of the chunk
58+
* @param z Z offset from the corner of the chunk
59+
* @return Block at given position
60+
*/
4461
Block getBlock(int x, int y, int z);
4562

63+
/**
64+
* Sets type of block at given position relative to the chunk.
65+
*
66+
* @param x X offset from the corner of the chunk
67+
* @param y Y offset from the corner of the chunk
68+
* @param z Z offset from the corner of the chunk
69+
* @param block Block to set block at given position to
70+
* @return Old Block at given position
71+
*/
4672
Block setBlock(int x, int y, int z, Block block);
4773

74+
/**
75+
* Sets type of block at given position relative to the chunk.
76+
*
77+
* @param pos Position of the block relative to corner of the chunk
78+
* @param block Block to set block at given position to
79+
* @return Old Block at given position
80+
*/
4881
Block setBlock(BaseVector3i pos, Block block);
4982

83+
/**
84+
* Sets biome at given position relative to the chunk.
85+
*
86+
* @param x X offset from the corner of the chunk
87+
* @param y Y offset from the corner of the chunk
88+
* @param z Z offset from the corner of the chunk
89+
* @param biome Biome to set block at given position to
90+
* @return Old Biome at given position
91+
*/
5092
Biome setBiome(int x, int y, int z, Biome biome);
5193

94+
/**
95+
* Sets biome at given position relative to the chunk.
96+
*
97+
* @param pos Position of the block relative to corner of the chunk
98+
* @param biome Biome to set block at given position to
99+
* @return Old Biome at given position
100+
*/
52101
Biome setBiome(BaseVector3i pos, Biome biome);
53102

103+
/**
104+
* Returns Biome at given position relative to the chunk.
105+
*
106+
* @param x X offset from the corner of the chunk
107+
* @param y Y offset from the corner of the chunk
108+
* @param z Z offset from the corner of the chunk
109+
* @return Biome at given position
110+
*/
54111
Biome getBiome(int x, int y, int z);
55112

113+
/**
114+
* Returns Biome at given position relative to the chunk.
115+
*
116+
* @param pos Position of the block relative to corner of the chunk
117+
* @return Biome at given position
118+
*/
56119
Biome getBiome(BaseVector3i pos);
57120

121+
/**
122+
* Sets liquid state at given position relative to the chunk.
123+
*
124+
* @param pos Position of the block relative to corner of the chunk
125+
* @param state Liquid state to set the block to
126+
*/
58127
void setLiquid(BaseVector3i pos, LiquidData state);
59128

129+
/**
130+
* Sets liquid state at given position relative to the chunk.
131+
*
132+
* @param x X offset from the corner of the chunk
133+
* @param y Y offset from the corner of the chunk
134+
* @param z Z offset from the corner of the chunk
135+
* @param newState Liquid state to set the block to
136+
*/
60137
void setLiquid(int x, int y, int z, LiquidData newState);
61138

139+
/**
140+
* Returns liquid state at given position relative to the chunk.
141+
*
142+
* @param pos Position of the block relative to corner of the chunk
143+
* @return Liquid state currently assigned to the block
144+
*/
62145
LiquidData getLiquid(BaseVector3i pos);
63146

147+
/**
148+
* Returns liquid state at given position relative to the chunk.
149+
*
150+
* @param x X offset from the corner of the chunk
151+
* @param y Y offset from the corner of the chunk
152+
* @param z Z offset from the corner of the chunk
153+
* @return Liquid state currently assigned to the block
154+
*/
64155
LiquidData getLiquid(int x, int y, int z);
65156

157+
/**
158+
* Returns offset of this chunk to the world center (0:0:0), with one unit being one chunk.
159+
*
160+
* @return Offset of this chunk from world center in chunks
161+
*/
66162
Vector3i getChunkWorldOffset();
67163

164+
/**
165+
* Returns X offset of this chunk to the world center (0:0:0), with one unit being one chunk.
166+
*
167+
* @return X offset of this chunk from world center in chunks
168+
*/
68169
int getChunkWorldOffsetX();
69170

171+
/**
172+
* Returns Y offset of this chunk to the world center (0:0:0), with one unit being one chunk.
173+
*
174+
* @return Y offset of this chunk from world center in chunks
175+
*/
70176
int getChunkWorldOffsetY();
71177

178+
/**
179+
* Returns Z offset of this chunk to the world center (0:0:0), with one unit being one chunk.
180+
*
181+
* @return Z offset of this chunk from world center in chunks
182+
*/
72183
int getChunkWorldOffsetZ();
73184

185+
/**
186+
* Returns position in this chunk transformed to world coordinates.
187+
*
188+
* @param blockPos Position in this chunk you want to transform
189+
* @return Transformed position
190+
*/
74191
Vector3i chunkToWorldPosition(BaseVector3i blockPos);
75192

193+
/**
194+
* Returns position in this chunk transformed to world coordinates.
195+
*
196+
* @param x X position in this chunk you want to transform
197+
* @param y Y position in this chunk you want to transform
198+
* @param z Z position in this chunk you want to transform
199+
* @return Transformed position
200+
*/
76201
Vector3i chunkToWorldPosition(int x, int y, int z);
77202

203+
/**
204+
* Returns X position in this chunk transformed to world coordinate.
205+
*
206+
* @param x X position in this chunk you want to transform
207+
* @return Transformed position
208+
*/
78209
int chunkToWorldPositionX(int x);
79210

211+
/**
212+
* Returns Y position in this chunk transformed to world coordinate.
213+
*
214+
* @param y Y position in this chunk you want to transform
215+
* @return Transformed position
216+
*/
80217
int chunkToWorldPositionY(int y);
81218

219+
/**
220+
* Returns Z position in this chunk transformed to world coordinate.
221+
*
222+
* @param z Z position in this chunk you want to transform
223+
* @return Transformed position
224+
*/
82225
int chunkToWorldPositionZ(int z);
83226

227+
/**
228+
* @return Size of the chunk along the X axis.
229+
*/
84230
int getChunkSizeX();
85231

232+
/**
233+
* @return Size of the chunk along the Y axis.
234+
*/
86235
int getChunkSizeY();
87236

237+
/**
238+
* @return Size of the chunk along the Z axis.
239+
*/
88240
int getChunkSizeZ();
89241

242+
/**
243+
* @return Chunk's Region
244+
*/
90245
Region3i getRegion();
91246

92247
int getEstimatedMemoryConsumptionInBytes();

0 commit comments

Comments
 (0)