Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

Commit

Permalink
Update 1.7, experimental support for mcpe 1.1.0 (beta)
Browse files Browse the repository at this point in the history
  • Loading branch information
protolambda committed May 8, 2017
1 parent 6799e21 commit f6ee8cd
Show file tree
Hide file tree
Showing 18 changed files with 350 additions and 28 deletions.
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

By @protolambda.

## [Download on Google-Play](https://play.google.com/store/apps/details?id=com.protolambda.blocktopograph)

### Screenshots

//TODO screenshots
**NOTE**: This is a *very* old legacy project! Code quality is awful, but I'm not going to rewrite the whole app for "fun".
Feel free to fork it and improve it yourself,
it is licensed under AGPL v3; reverse engineering the MCPE format is time consuming, share your updates.

## [Download on Google-Play](https://play.google.com/store/apps/details?id=com.protolambda.blocktopograph)

### Showcase website

Screenshots, download links, roadmap etc. can all be found on [blocktopograph.protolambda.com](https://blocktopograph.protolambda.com).

//TODO update website.
Screenshots, download links, roadmap etc. can all be found on [blocktopograph.protolambda.com](http://blocktopograph.protolambda.com).


## Get-started
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.protolambda.blocktopograph"
minSdkVersion 16
targetSdkVersion 25
versionCode 8
versionName "1.6.1"
versionCode 9
versionName "1.7"
}

def keystorePropertiesFile = rootProject.file("keystore.properties")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ public void onOpen() {
changeMapType(MapType.END_HEIGHTMAP, Dimension.END);
break;
case(R.id.nav_end_block_light):
changeMapType(MapType.END_HEIGHTMAP, Dimension.END);
changeMapType(MapType.END_BLOCK_LIGHT, Dimension.END);
break;
case(R.id.nav_map_opt_toggle_grid):
//toggle the grid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@

import android.util.SparseArray;

import com.protolambda.blocktopograph.Log;
import com.protolambda.blocktopograph.chunk.terrain.TerrainChunkData;
import com.protolambda.blocktopograph.chunk.terrain.V0_9_TerrainChunkData;
import com.protolambda.blocktopograph.chunk.terrain.V1_0_TerrainChunkData;
import com.protolambda.blocktopograph.chunk.terrain.V1_1_TerrainChunkData;
import com.protolambda.blocktopograph.util.ConvertUtil;

public enum Version {

ERROR("ERROR", "failed to retrieve version number", -2, 0, 0),
NULL("NULL", "no data", -1, 0, 0),
ERROR("ERROR", "failed to retrieve version number", -2, 16, 16),
NULL("NULL", "no data", -1, 16, 16),
OLD_LIMITED("v0.2.0", "classic mcpe, 16x16x16x16x18 world, level.dat; introduced in v0.2.0", 1, 128, 1),
v0_9("v0.9.0", "infinite xz, zlib leveldb; introduced in v0.9.0", 2, 128, 1),
V1_0("v1.0.0", "Stacked sub-chunks, 256 world-height, 16 high sub-chunks; introduced in alpha v1.0.0 (v0.17)", 3, 16, 16);
V1_0("v1.0.0", "Stacked sub-chunks, 256 world-height, 16 high sub-chunks; introduced in alpha v1.0.0 (v0.17)", 3, 16, 16),
V1_1("v1.1.0", "Block-light is not stored anymore", 4, 16, 16);

public static final int LATEST_SUPPORTED_VERSION = V1_1.id;

public final String displayName, description;
public final int id, subChunkHeight, subChunks;
Expand All @@ -35,10 +41,25 @@ public enum Version {
}
}
public static Version getVersion(byte[] data){
//Log.d("Data version: "+ ConvertUtil.bytesToHexStr(data));

//`data` is supposed to be one byte,
// but it might grow to contain more data later on, or larger version ids.
// Looking up the first byte is sufficient for now.
return data != null && data.length > 0 ? versionMap.get(data[0] & 0xff) : NULL;
if(data == null || data.length <= 0) {
return NULL;
} else {
int versionNumber = data[0] & 0xff;

//fallback version
if(versionNumber > LATEST_SUPPORTED_VERSION) {
versionNumber = LATEST_SUPPORTED_VERSION;
}

Version version = versionMap.get(versionNumber);
//check if the returned version exists, fallback on ERROR otherwise.
return version == null ? ERROR : version;
}
}

public TerrainChunkData createTerrainChunkData(Chunk chunk, byte subChunk) throws VersionException {
Expand All @@ -52,9 +73,11 @@ public TerrainChunkData createTerrainChunkData(Chunk chunk, byte subChunk) throw
return new V0_9_TerrainChunkData(chunk, subChunk);
case V1_0:
return new V1_0_TerrainChunkData(chunk, subChunk);
case V1_1:
return new V1_1_TerrainChunkData(chunk, subChunk);
default:
//use the latest version, like nothing will ever happen...
return new V1_0_TerrainChunkData(chunk, subChunk);
return new V1_1_TerrainChunkData(chunk, subChunk);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public TerrainChunkData(Chunk chunk, byte subChunk) {

public abstract byte getBlockLightValue(int x, int y, int z);

public abstract boolean supportsBlockLightValues();

public abstract void setBlockTypeId(int x, int y, int z, int type);

public abstract void setBlockData(int x, int y, int z, int newData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ public byte getBlockLightValue(int x, int y, int z) {
return (byte) ((offset & 1) == 1 ? (dualData >>> 4) & 0xf : dualData & 0xf);
}

@Override
public boolean supportsBlockLightValues() {
return true;
}

/**
* Sets a block type, and also set the corresponding dirty table entry and set the saving flag.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ public byte getBlockLightValue(int x, int y, int z) {
return (byte) ((offset & 1) == 1 ? (dualData >>> 4) & 0xf : dualData & 0xf);
}

@Override
public boolean supportsBlockLightValues() {
return true;
}

/**
* Sets a block type, and also set the corresponding dirty table entry and set the saving flag.
*/
Expand Down
Loading

0 comments on commit f6ee8cd

Please sign in to comment.