Skip to content

Commit

Permalink
Removed scaling on the nether; it was preventing loading of Entities.…
Browse files Browse the repository at this point in the history
… Also added an alias for wither skeletons.
  • Loading branch information
MithrilMania committed Jun 11, 2021
1 parent 3b4f405 commit 64d6476
Show file tree
Hide file tree
Showing 23 changed files with 123 additions and 2,285 deletions.
11 changes: 7 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
//apply plugin: 'io.fabric'

android {
compileSdkVersion 29
Expand Down Expand Up @@ -40,15 +40,16 @@ android {
dependencies {
implementation fileTree(include: ['*.jar', '*.so', '*.aar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
// implementation project(':android-leveldb')
implementation project(':leveldb')
implementation project(':tileview')
implementation 'com.github.clans:fab:1.6.4'
implementation 'com.github.bmelnychuk:atv:1.2.8'
implementation 'com.github.woxthebox:draglistview:1.6.3'
implementation 'com.andreabaccega:android-edittext-validator:1.3.5'
//core is the new recommended alias for analytics
implementation 'com.google.firebase:firebase-core:17.2.2'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
//implementation 'com.google.firebase:firebase-core:18.0.2'
//implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
//implementation 'org.jetbrains:annotations-java5:15.0'
implementation 'com.tomergoldst.android:tooltips:1.0.10'
implementation 'androidx.annotation:annotation:1.1.0'
Expand All @@ -64,7 +65,9 @@ dependencies {
implementation 'net.lingala.zip4j:zip4j:2.3.1'
implementation 'commons-io:commons-io:2.4'
implementation 'org.apache.commons:commons-lang3:3.9'


//debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.1'
}

apply plugin: 'com.google.gms.google-services'
//apply plugin: 'com.google.gms.google-services'
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
android:theme="@style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning,UnusedAttribute">

<meta-data
<!--<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />
<meta-data
android:name="firebase_analytics_collection_enabled"
android:value="false" />

-->
<activity
android:name=".worldlist.WorldItemListActivity"
android:label="@string/app_name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_create_world);
//mBinding.scroll.post(()->mBinding.scroll.doOverScroll());
mToolTipsManager = new ToolTipsManager();
Log.logFirebaseEvent(this, Log.CustomFirebaseEvent.CREATE_WORLD_OPEN);
// Log.logFirebaseEvent(this, Log.CustomFirebaseEvent.CREATE_WORLD_OPEN);

setBiomeToView(Biome.JUNGLE);
}
Expand Down Expand Up @@ -355,7 +355,7 @@ protected void onPostExecute(Boolean aBoolean) {
else type = 3 + layers.size();
} else type = 0;
params.putInt(Log.ANA_PARAM_CREATE_WORLD_TYPE, type);
Log.logFirebaseEvent(activity, Log.CustomFirebaseEvent.CREATE_WORLD_SAVE, params);
//Log.logFirebaseEvent(activity, Log.CustomFirebaseEvent.CREATE_WORLD_SAVE, params);
if (aBoolean) {
Toast.makeText(activity,
activity.getString(R.string.general_done),
Expand Down
24 changes: 13 additions & 11 deletions app/src/main/java/com/mithrilmania/blocktopograph/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

import androidx.annotation.NonNull;

import com.crashlytics.android.Crashlytics;
import com.google.firebase.analytics.FirebaseAnalytics;
//import com.crashlytics.android.Crashlytics;
//import com.google.firebase.analytics.FirebaseAnalytics;

import java.io.PrintWriter;
import java.io.StringWriter;

import io.fabric.sdk.android.Fabric;
//import io.fabric.sdk.android.Fabric;

public class Log {

Expand All @@ -23,7 +23,7 @@ public class Log {

private static final String LOG_TAG = "Blocktopo";

private static FirebaseAnalytics mFirebaseAnalytics;
//private static FirebaseAnalytics mFirebaseAnalytics;

private static PrintWriter mFileLogger;

Expand All @@ -38,13 +38,13 @@ private static String concat(@NonNull Object caller, @NonNull String msg) {
}

public static void enableFirebaseAnalytics(@NonNull Context context) {
getFirebaseAnalytics(context).setAnalyticsCollectionEnabled(true);
// getFirebaseAnalytics(context).setAnalyticsCollectionEnabled(true);
mIsFirebaseAnalyticsEnabled = true;
}

public static void enableCrashlytics(@NonNull Context context) {
if (!BuildConfig.DEBUG) {
Fabric.with(context, new Crashlytics());
//Fabric.with(context, new Crashlytics());
mIsCrashlyticsEnabled = true;
}
}
Expand All @@ -61,19 +61,20 @@ public static void d(@NonNull Object caller, @NonNull Throwable throwable) {
}

public static void e(@NonNull Object caller, @NonNull String msg) {
if (mIsCrashlyticsEnabled)
Crashlytics.log(android.util.Log.DEBUG, LOG_TAG, concat(caller, msg));
//if (mIsCrashlyticsEnabled)
// Crashlytics.log(android.util.Log.DEBUG, LOG_TAG, concat(caller, msg));
}

public static void e(@NonNull Object caller, @NonNull Throwable throwable) {
StringWriter sw = new StringWriter(4096);
PrintWriter pw = new PrintWriter(sw);
throwable.printStackTrace(pw);
android.util.Log.e(LOG_TAG, concat(caller, sw.toString()));
if (mIsCrashlyticsEnabled) Crashlytics.logException(throwable);
//if (mIsCrashlyticsEnabled) Crashlytics.logException(throwable);
}

/*
private synchronized static FirebaseAnalytics getFirebaseAnalytics(@NonNull Context context) {
if (mFirebaseAnalytics == null) {
mFirebaseAnalytics = FirebaseAnalytics.getInstance(context);
Expand All @@ -82,6 +83,7 @@ private synchronized static FirebaseAnalytics getFirebaseAnalytics(@NonNull Cont
//mFirebaseAnalytics.setAnalyticsCollectionEnabled(true);
}
return mFirebaseAnalytics;
}
public static void logFirebaseEvent(@NonNull Context context, @NonNull CustomFirebaseEvent firebaseEvent) {
Expand All @@ -93,7 +95,7 @@ public static void logFirebaseEvent(@NonNull Context context, @NonNull CustomFir
if (mIsFirebaseAnalyticsEnabled)
getFirebaseAnalytics(context).logEvent(firebaseEvent.eventID, eventContent);
}

*/
// Firebase events, these are meant to be as anonymous as possible,
// pure counters for usage analytics.
// Do not remove! Removing analytics in a fork skews the results to the original userbase!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,6 @@ protected void onCreate(Bundle savedInstanceState) {
String worldSeed = String.valueOf(this.world.getWorldSeed());
subtitle.setText(worldSeed);

Bundle bundle = new Bundle();
bundle.putString("seed", worldSeed);
bundle.putString("name", this.world.getWorldDisplayName());

// Open the world-map as default content
openWorldMap();

Expand Down Expand Up @@ -197,7 +193,7 @@ protected void onCreate(Bundle savedInstanceState) {
if (mapVersionData != null) bundle.putAll(mapVersionData);

// anonymous global counter of opened worlds
Log.logFirebaseEvent(this, Log.CustomFirebaseEvent.WORLD_OPEN, bundle);
//Log.logFirebaseEvent(this, Log.CustomFirebaseEvent.WORLD_OPEN, bundle);

Log.d(this, "World activity created");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public enum Version {

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("V0", "Old format", 0, 16, 16),
Beta_Palletted("v1.2.0", "Beta Palletted chunks", 1, 16, 16),
v0_9("v0.9.0", "infinite xz, zlib leveldb; introduced in v0.9.0", 2, 128, 1),
Expand Down Expand Up @@ -63,11 +64,6 @@ public static Version getVersion(@Nullable byte[] data) {
//check if the returned version exists, fallback on ERROR otherwise.
return version == null ? ERROR : version;
}

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

}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.mithrilmania.blocktopograph.chunk.Chunk;
import com.mithrilmania.blocktopograph.chunk.ChunkData;
import com.mithrilmania.blocktopograph.util.Noise;
import com.mithrilmania.blocktopograph.map.BlockDatabase;


public abstract class TerrainChunkData extends ChunkData {
Expand All @@ -22,6 +23,8 @@ public final boolean hasNotFailed() {
return mNotFailed;
}

protected final BlockDatabase _blockDB;

public abstract boolean loadTerrain();

public abstract boolean load2DData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,15 @@ public byte getBlockTypeId(int x, int y, int z) {
}

@Override
public byte getBlockData(int x, int y, int z) {
public short getBlockData(int x, int y, int z) {
if (x >= chunkW || y >= chunkH || z >= chunkL || x < 0 || y < 0 || z < 0) {
return 0;
}
return (byte) (getBlockState(x, y, z) & 0xf);
}

public String getBlockKeyValue(int x, int y, int z, String key) { return ""; }

@Override
public byte getSkyLightValue(int x, int y, int z) {
if (x >= chunkW || y >= chunkH || z >= chunkL || x < 0 || y < 0 || z < 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.mithrilmania.blocktopograph.chunk.Chunk;
import com.mithrilmania.blocktopograph.chunk.ChunkTag;
import com.mithrilmania.blocktopograph.map.Biome;
import com.mithrilmania.blocktopograph.map.Block;
import com.mithrilmania.blocktopograph.block.Block;
import com.mithrilmania.blocktopograph.nbt.convert.DataConverter;
import com.mithrilmania.blocktopograph.nbt.tags.CompoundTag;
import com.mithrilmania.blocktopograph.nbt.tags.Tag;
Expand All @@ -15,6 +15,7 @@
import java.util.ArrayList;

/*
* NOTE:oO0oO0oO0o0o00's changes make this class obsolete. Keeping it commented for posterity.
* Beta palleted chunk format.
* This version was not used very long; it was introduced around the first Update Aquatic and replaced
* around the second.
Expand All @@ -30,6 +31,8 @@
* With 4096 blocks per chunk, there will never be more than 4096 entries, so the maximum specified value (16) will be sufficient.
* See https://gist.github.com/Tomcc/a96af509e275b1af483b25c543cfbf37 for further details.
*/

/*
public class V1_2_beta_TerrainChunkData extends TerrainChunkData {
public volatile ByteBuffer terrainData, data2D;
Expand Down Expand Up @@ -334,10 +337,11 @@ public byte getBlockLightValue(int x, int y, int z) {
public boolean supportsBlockLightValues() {
return false;
}

*/
/**
* Sets a block type, and also set the corresponding dirty table entry and set the saving flag.
*/
/*
@Override
public void setBlockTypeId(int x, int y, int z, int type) {
if (x >= chunkW || y >= chunkH || z >= chunkL || x < 0 || y < 0 || z < 0) {
Expand Down Expand Up @@ -371,8 +375,11 @@ public byte getBiome(int x, int z) {
}
private int getNoise(int base, int x, int z){
*/
// noise values are between -1 and 1
// 0.0001 is added to the coordinates because integer values result in 0
/*
double oct1 = Noise.noise(
((double) (this.chunk.x * chunkW + x) / 100.0) + 0.0001,
((double) (this.chunk.z * chunkL + z) / 100.0) + 0.0001);
Expand All @@ -384,12 +391,12 @@ private int getNoise(int base, int x, int z){
((double) (this.chunk.z * chunkL + z) / 3.0) + 0.0001);
return (int) (base + 60 + (40 * oct1) + (14 * oct2) + (6 * oct3));
}

*/
/*
MCPE 1.0 stopped embedding foliage color data in the chunk data,
so now we fake the colors by combining biome colors with Perlin noise
*/

/*
@Override
public byte getGrassR(int x, int z) {
Biome biome = Biome.getBiome(getBiome(x, z) & 0xff);
Expand Down Expand Up @@ -430,3 +437,4 @@ public int getHeightMapValue(int x, int z) {
return ((h & 0xff) << 8) | ((h >> 8) & 0xff);//little endian to big endian
}
}
*/
12 changes: 6 additions & 6 deletions app/src/main/java/com/mithrilmania/blocktopograph/map/Biome.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,16 @@ public enum Biome {
MESA_PLATEAU_F_M(166, "Mesa Plateau F M", ColorWrapper.fromRGB(255, 234, 179)),
MESA_PLATEAU_M(167, "Mesa Plateau M", ColorWrapper.fromRGB(255, 220, 184)),
BAMBOO_JUNGLE(168, "Bamboo Jungle", ColorWrapper.fromRGB(255, 220, 184)),
BAMBOO_JUNGLE_HILLS(169, "Bamboo Jungle Hills", ColorWrapper.fromRGB(255, 220, 184));
BAMBOO_JUNGLE_HILLS(169, "Bamboo Jungle Hills", ColorWrapper.fromRGB(255, 220, 184)),

//Nether biome in 1.16.0 nether update.
NETHER_WASTES(8, "Nether Wastes", ColorWrapper.fromRGB(132, 65, 65));
NETHER_WASTES(8, "Nether Wastes", ColorWrapper.fromRGB(132, 65, 65)),

SOUL_SAND_VALLEY(170, "Soul Sand Valley", ColorWrapper.fromRGB(66, 113, 114));
SOUL_SAND_VALLEY(170, "Soul Sand Valley", ColorWrapper.fromRGB(66, 113, 114)),

CRIMSON_FOREST(171, "Crimson Forest", ColorWrapper.fromRGB(141, 30, 40));
CRIMSON_FOREST(171, "Crimson Forest", ColorWrapper.fromRGB(141, 30, 40)),

WARPED_FOREST(172, "Warped Forest", ColorWrapper.fromRGB(22, 126, 134));
WARPED_FOREST(172, "Warped Forest", ColorWrapper.fromRGB(22, 126, 134)),

BASALT_DELTAS(173, "Basalt Deltas", ColorWrapper.fromRGB(75, 69, 71));

Expand Down
Loading

0 comments on commit 64d6476

Please sign in to comment.