Started work on Portable Tank

This commit is contained in:
Aidan C. Brady committed 2014-06-18 03:01:23 +02:00
1 parent ead4af2f78
commit fd74ee5c92
22 files changed
+665 -71

No files matched your search

+30
View File
@@ -4,6 +4,12 @@ import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
/**
* Chunk3D - an integer-based way to keep track of and perform operations on chunks in a Minecraft-based environment. This also takes
* in account the dimension the chunk is in.
* @author aidancbrady
*
*/
public class Chunk3D
{
public int dimensionId;
@@ -11,6 +17,12 @@ public class Chunk3D
public int xCoord;
public int zCoord;
/**
* Creates a Chunk3D object from the given x and z coordinates, as well as a dimension.
* @param x - chunk x location
* @param z - chunk z location
* @param dimension - the dimension this Chunk3D is in
*/
public Chunk3D(int x, int z, int dimension)
{
xCoord = x;
@@ -19,6 +31,10 @@ public class Chunk3D
dimensionId = dimension;
}
/**
* Creates a Chunk3D from an entity based on it's location and dimension.
* @param entity - the entity to get the Chunk3D object from
*/
public Chunk3D(Entity entity)
{
xCoord = ((int)entity.posX) >> 4;
@@ -27,6 +43,10 @@ public class Chunk3D
dimensionId = entity.dimension;
}
/**
* Creates a Chunk3D from a Coord4D based on it's coordinates and dimension.
* @param coord - the Coord4D object to get this Chunk3D from
*/
public Chunk3D(Coord4D coord)
{
xCoord = coord.xCoord >> 4;
@@ -35,11 +55,21 @@ public class Chunk3D
dimensionId = coord.dimensionId;
}
/**
* Whether or not this chunk exists in the given world.
* @param world - the world to check in
* @return if the chunk exists
*/
public boolean exists(World world)
{
return world.getChunkProvider().chunkExists(xCoord, zCoord);
}
/**
* Gets a Chunk object corresponding to this Chunk3D's coordinates.
* @param world - the world to get the Chunk object from
* @return the corresponding Chunk object
*/
public Chunk getChunk(World world)
{
return world.getChunkFromChunkCoords(xCoord, zCoord);