Skip to content

Commit

Permalink
[BREAKING] BlockCache: rename getTypeId to getType.
Browse files Browse the repository at this point in the history
  • Loading branch information
asofold committed Dec 18, 2017
1 parent ce98d2a commit af44f13
Show file tree
Hide file tree
Showing 27 changed files with 58 additions and 58 deletions.
Expand Up @@ -45,7 +45,7 @@ public BlockCache setAccess(World world) {
@Override
public double[] fetchBounds(int x, int y, int z) {
try {
return helper.nmsWorld_fetchBlockShape(this.nmsWorld, this.getTypeId(x, y, z), x, y, z);
return helper.nmsWorld_fetchBlockShape(this.nmsWorld, this.getType(x, y, z), x, y, z);
}
catch (ReflectFailureException ex) {
return super.fetchBounds(x, y, z);
Expand Down
Expand Up @@ -43,7 +43,7 @@ public class BlockCacheCB2512 extends BlockCache {
@SuppressWarnings("deprecation")
@Override
public int getTypeId(int x, int y, int z) {
return BlockCacheCB2512.this.getTypeId(x, y, z).getId();
return BlockCacheCB2512.this.getType(x, y, z).getId();
}

@Override
Expand Down Expand Up @@ -109,7 +109,7 @@ public double[] fetchBounds(final int x, final int y, final int z){

// TODO: change api for this / use nodes (!)
@SuppressWarnings("deprecation")
final int id = getTypeId(x, y, z).getId();
final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_4_5.Block block = net.minecraft.server.v1_4_5.Block.byId[id];
if (block == null) return null;
block.updateShape(iBlockAccess, x, y, z); // TODO: use THIS instead of world.
Expand Down
Expand Up @@ -43,7 +43,7 @@ public class BlockCacheCB2545 extends BlockCache {
@SuppressWarnings("deprecation")
@Override
public int getTypeId(final int x, final int y, final int z) {
return BlockCacheCB2545.this.getTypeId(x, y, z).getId();
return BlockCacheCB2545.this.getType(x, y, z).getId();
}


Expand Down
Expand Up @@ -45,7 +45,7 @@ public class BlockCacheCB2602 extends BlockCache {
@SuppressWarnings("deprecation")
@Override
public int getTypeId(int x, int y, int z) {
return BlockCacheCB2602.this.getTypeId(x, y, z).getId();
return BlockCacheCB2602.this.getType(x, y, z).getId();
}

@Override
Expand Down Expand Up @@ -111,7 +111,7 @@ public double[] fetchBounds(final int x, final int y, final int z){

// TODO: change api for this / use nodes (!)
@SuppressWarnings("deprecation")
final int id = getTypeId(x, y, z).getId();
final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_4_R1.Block block = net.minecraft.server.v1_4_R1.Block.byId[id];
if (block == null) {
return null;
Expand Down
Expand Up @@ -44,7 +44,7 @@ public class BlockCacheCB2645 extends BlockCache {
@SuppressWarnings("deprecation")
@Override
public int getTypeId(int x, int y, int z) {
return BlockCacheCB2645.this.getTypeId(x, y, z).getId();
return BlockCacheCB2645.this.getType(x, y, z).getId();
}

@Override
Expand Down Expand Up @@ -110,7 +110,7 @@ public double[] fetchBounds(final int x, final int y, final int z){

// TODO: change api for this / use nodes (!)
@SuppressWarnings("deprecation")
final int id = getTypeId(x, y, z).getId();
final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_5_R1.Block block = net.minecraft.server.v1_5_R1.Block.byId[id];
if (block == null) return null;
block.updateShape(iBlockAccess, x, y, z); // TODO: use THIS instead of world.
Expand Down
Expand Up @@ -44,7 +44,7 @@ public class BlockCacheCB2691 extends BlockCache {
@SuppressWarnings("deprecation")
@Override
public int getTypeId(final int x, final int y, final int z) {
return BlockCacheCB2691.this.getTypeId(x, y, z).getId();
return BlockCacheCB2691.this.getType(x, y, z).getId();
}

@Override
Expand Down Expand Up @@ -110,7 +110,7 @@ public double[] fetchBounds(final int x, final int y, final int z){

// TODO: change api for this / use nodes (!)
@SuppressWarnings("deprecation")
final int id = getTypeId(x, y, z).getId();
final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_5_R2.Block block = net.minecraft.server.v1_5_R2.Block.byId[id];
if (block == null) return null;
block.updateShape(iBlockAccess, x, y, z); // TODO: use THIS instead of world.
Expand Down
Expand Up @@ -44,7 +44,7 @@ public class BlockCacheCB2763 extends BlockCache {
@SuppressWarnings("deprecation")
@Override
public int getTypeId(final int x, final int y, final int z) {
return BlockCacheCB2763.this.getTypeId(x, y, z).getId();
return BlockCacheCB2763.this.getType(x, y, z).getId();
}

@Override
Expand Down
Expand Up @@ -44,7 +44,7 @@ public class BlockCacheCB2794 extends BlockCache {
@SuppressWarnings("deprecation")
@Override
public int getTypeId(final int x, final int y, final int z) {
return BlockCacheCB2794.this.getTypeId(x, y, z).getId();
return BlockCacheCB2794.this.getType(x, y, z).getId();
}

@Override
Expand Down Expand Up @@ -110,7 +110,7 @@ public double[] fetchBounds(final int x, final int y, final int z){

// TODO: change api for this / use nodes (!)
@SuppressWarnings("deprecation")
final int id = getTypeId(x, y, z).getId();
final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_6_R1.Block block = net.minecraft.server.v1_6_R1.Block.byId[id];
if (block == null) return null;
block.updateShape(iBlockAccess, x, y, z);
Expand Down
Expand Up @@ -44,7 +44,7 @@ public class BlockCacheCB2808 extends BlockCache {
@SuppressWarnings("deprecation")
@Override
public int getTypeId(final int x, final int y, final int z) {
return BlockCacheCB2808.this.getTypeId(x, y, z).getId();
return BlockCacheCB2808.this.getType(x, y, z).getId();
}

@Override
Expand Down Expand Up @@ -110,7 +110,7 @@ public double[] fetchBounds(final int x, final int y, final int z){

// TODO: change api for this / use nodes (!)
@SuppressWarnings("deprecation")
final int id = getTypeId(x, y, z).getId();
final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_6_R2.Block block = net.minecraft.server.v1_6_R2.Block.byId[id];
if (block == null) return null;
block.updateShape(iBlockAccess, x, y, z); // TODO: use THIS instead of world.
Expand Down
Expand Up @@ -44,7 +44,7 @@ public class BlockCacheCB2882 extends BlockCache {
@SuppressWarnings("deprecation")
@Override
public int getTypeId(int x, int y, int z) {
return BlockCacheCB2882.this.getTypeId(x, y, z).getId();
return BlockCacheCB2882.this.getType(x, y, z).getId();
}

@Override
Expand Down Expand Up @@ -110,7 +110,7 @@ public double[] fetchBounds(final int x, final int y, final int z){

// TODO: change api for this / use nodes (!)
@SuppressWarnings("deprecation")
final int id = getTypeId(x, y, z).getId();
final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_6_R3.Block block = net.minecraft.server.v1_6_R3.Block.byId[id];
if (block == null) return null;
block.updateShape(iBlockAccess, x, y, z);
Expand Down
Expand Up @@ -99,7 +99,7 @@ public int fetchData(final int x, final int y, final int z) {
public double[] fetchBounds(final int x, final int y, final int z){
// TODO: change api for this / use nodes (!)
@SuppressWarnings("deprecation")
final int id = getTypeId(x, y, z).getId();
final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_7_R1.Block block = net.minecraft.server.v1_7_R1.Block.e(id);
if (block == null) return null;
block.updateShape(iBlockAccess, x, y, z); // data from cache.
Expand Down
Expand Up @@ -94,7 +94,7 @@ public double[] fetchBounds(final int x, final int y, final int z){

// TODO: change api for this / use nodes (!)
@SuppressWarnings("deprecation")
final int id = getTypeId(x, y, z).getId();
final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_7_R2.Block block = net.minecraft.server.v1_7_R2.Block.e(id);
if (block == null) return null;
block.updateShape(iBlockAccess, x, y, z); // getData from cache.
Expand Down
Expand Up @@ -94,7 +94,7 @@ public double[] fetchBounds(final int x, final int y, final int z){

// TODO: change api for this / use nodes (!)
@SuppressWarnings("deprecation")
final int id = getTypeId(x, y, z).getId();
final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_7_R3.Block block = net.minecraft.server.v1_7_R3.Block.e(id);
if (block == null) return null;
block.updateShape(iBlockAccess, x, y, z); // getData from cache.
Expand Down
Expand Up @@ -92,7 +92,7 @@ public int fetchData(final int x, final int y, final int z) {
@Override
public double[] fetchBounds(final int x, final int y, final int z){
@SuppressWarnings("deprecation")
final int id = getTypeId(x, y, z).getId();
final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_7_R4.Block block = net.minecraft.server.v1_7_R4.Block.getById(id);
if (block == null) {
// TODO: Convention for null bounds -> full ?
Expand Down
Expand Up @@ -94,7 +94,7 @@ public int fetchData(final int x, final int y, final int z) {

@Override
public double[] fetchBounds(final int x, final int y, final int z){
final Material id = getTypeId(x, y, z);
final Material id = getType(x, y, z);
@SuppressWarnings("deprecation")
final net.minecraft.server.v1_11_R1.Block block = net.minecraft.server.v1_11_R1.Block.getById(id.getId());
if (block == null) {
Expand Down
Expand Up @@ -66,7 +66,7 @@ public int fetchData(final int x, final int y, final int z) {
@Override
public double[] fetchBounds(final int x, final int y, final int z){
@SuppressWarnings("deprecation")
final int id = getTypeId(x, y, z).getId();
final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_10_R1.Block block = net.minecraft.server.v1_10_R1.Block.getById(id);
if (block == null) {
// TODO: Convention for null blocks -> full ?
Expand Down
Expand Up @@ -65,7 +65,7 @@ public int fetchData(final int x, final int y, final int z) {
@Override
public double[] fetchBounds(final int x, final int y, final int z){
@SuppressWarnings("deprecation")
final int id = getTypeId(x, y, z).getId();
final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_8_R1.Block block = net.minecraft.server.v1_8_R1.Block.getById(id);
if (block == null) {
// TODO: Convention for null bounds -> full ?
Expand Down
Expand Up @@ -65,7 +65,7 @@ public int fetchData(final int x, final int y, final int z) {
@Override
public double[] fetchBounds(final int x, final int y, final int z){
@SuppressWarnings("deprecation")
final int id = getTypeId(x, y, z).getId();
final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_8_R2.Block block = net.minecraft.server.v1_8_R2.Block.getById(id);
if (block == null) {
// TODO: Convention for null bounds -> full ?
Expand Down
Expand Up @@ -65,7 +65,7 @@ public int fetchData(final int x, final int y, final int z) {
@Override
public double[] fetchBounds(final int x, final int y, final int z){
@SuppressWarnings("deprecation")
final int id = getTypeId(x, y, z).getId();
final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_8_R3.Block block = net.minecraft.server.v1_8_R3.Block.getById(id);
if (block == null) {
// TODO: Convention for null bounds -> full ?
Expand Down
Expand Up @@ -66,7 +66,7 @@ public int fetchData(final int x, final int y, final int z) {
@Override
public double[] fetchBounds(final int x, final int y, final int z){
@SuppressWarnings("deprecation")
final int id = getTypeId(x, y, z).getId();
final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_9_R1.Block block = net.minecraft.server.v1_9_R1.Block.getById(id);
if (block == null) {
// TODO: Convention for null blocks -> full ?
Expand Down
Expand Up @@ -66,7 +66,7 @@ public int fetchData(final int x, final int y, final int z) {
@Override
public double[] fetchBounds(final int x, final int y, final int z){
@SuppressWarnings("deprecation")
final int id = getTypeId(x, y, z).getId();
final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_9_R2.Block block = net.minecraft.server.v1_9_R2.Block.getById(id);
if (block == null) {
// TODO: Convention for null blocks -> full ?
Expand Down
Expand Up @@ -53,7 +53,7 @@ protected boolean step(int blockX, int blockY, int blockZ, double oX, double oY,
if (margin > 0) {
recordCuboid(worldAccess, recorder, blockX - margin, blockY - margin, blockZ - margin, blockX + margin, blockY + margin, blockZ + margin);
} else {
recorder.set(blockX, blockY, blockZ, worldAccess.getTypeId(blockX, blockY, blockZ), worldAccess.getData(blockX, blockY, blockZ), worldAccess.getBounds(blockX, blockY, blockZ));
recorder.set(blockX, blockY, blockZ, worldAccess.getType(blockX, blockY, blockZ), worldAccess.getData(blockX, blockY, blockZ), worldAccess.getBounds(blockX, blockY, blockZ));
}
return true;
}
Expand All @@ -78,7 +78,7 @@ public static void recordCuboid(final BlockCache worldAccess, final FakeBlockCac
for (int y = yMin; y <= yMax; y ++) {
if (!recorder.hasIdEntry(x, y, z)) {
// Use get... methods for efficiency in certain use cases..
recorder.set(x, y, z, worldAccess.getTypeId(x, y, z), worldAccess.getData(x, y, z), worldAccess.getBounds(x, y, z));
recorder.set(x, y, z, worldAccess.getType(x, y, z), worldAccess.getData(x, y, z), worldAccess.getBounds(x, y, z));
}
}
}
Expand Down
Expand Up @@ -110,7 +110,7 @@ public void cleanup() {
* @return
*/
private boolean doesCollide(final int blockX, final int blockY, final int blockZ) {
final Material id = blockCache.getTypeId(blockX, blockY, blockZ);
final Material id = blockCache.getType(blockX, blockY, blockZ);
final long flags = BlockProperties.getBlockFlags(id);
if ((flags & BlockProperties.F_SOLID) == 0) {
// Ignore non solid blocks anyway.
Expand Down
Expand Up @@ -445,7 +445,7 @@ public void setBlockFlags(Long blockFlags) {
* @return the type id above
*/
public Material getTypeIdAbove() {
return blockCache.getTypeId(blockX, blockY + 1, blockZ);
return blockCache.getType(blockX, blockY + 1, blockZ);
}

/**
Expand Down Expand Up @@ -533,7 +533,7 @@ public Integer getData() {
* @return the type id
*/
public final Material getTypeId(final int x, final int y, final int z) {
return blockCache.getTypeId(x, y, z);
return blockCache.getType(x, y, z);
}

/**
Expand Down
Expand Up @@ -329,8 +329,8 @@ private BlockCacheNode getOrCreateNode(final int x, final int y, final int z) {
* the z
* @return the type id
*/
public Material getTypeId(double x, double y, double z) {
return getTypeId(Location.locToBlock(x), Location.locToBlock(y), Location.locToBlock(z));
public Material getType(double x, double y, double z) {
return getType(Location.locToBlock(x), Location.locToBlock(y), Location.locToBlock(z));
}

/**
Expand All @@ -352,8 +352,8 @@ public IBlockCacheNode getOrCreateBlockCacheNode(double x, double y, double z, b
* the block
* @return the type id
*/
public Material getTypeId(final Block block) {
return getTypeId(block.getX(), block.getY(), block.getZ());
public Material getType(final Block block) {
return getType(block.getX(), block.getY(), block.getZ());
}

/**
Expand All @@ -367,7 +367,7 @@ public Material getTypeId(final Block block) {
* the z
* @return the type id
*/
public Material getTypeId(final int x, final int y, final int z) {
public Material getType(final int x, final int y, final int z) {
return getOrCreateNode(x, y, z).getType();
}

Expand Down

0 comments on commit af44f13

Please sign in to comment.