Skip to content

Commit

Permalink
Merge branch 'leveldb-format-testing'
Browse files Browse the repository at this point in the history
  • Loading branch information
tryashtar committed Apr 14, 2021
2 parents 4a05ab2 + 6f90ef7 commit 435f997
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 507 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
[submodule "zlib"]
path = zlib
url = https://github.com/tryashtar/zlib-win-build
[submodule "leveldb-mcpe"]
url = https://github.com/tryashtar/leveldb-mcpe
path = leveldb-mcpe
[submodule "fNbt"]
url = https://github.com/tryashtar/fNbt
path = fNbt
[submodule "LevelDBWrapper"]
path = LevelDBWrapper
url = https://github.com/tryashtar/LevelDBWrapper
24 changes: 24 additions & 0 deletions Image Map 3/JavaDefinitions/JavaVersions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,4 +426,28 @@ public override IEnumerable<Color> GetBaseColors()

public override string ToString() => "1.16+";
}

// 21w15a+
public class Java1p17Version : AbstractJavaVersion
{
public static Java1p17Version Instance = new Java1p17Version();
private Java1p17Version() { }

public override NbtCompound CreateMapItem(byte slot, long mapid) => Java1p14Version.Instance.CreateMapItem(slot, mapid);
public override NbtCompound CreateMapCompound(long mapid, byte[] colors) => Java1p16Version.Instance.CreateMapCompound(mapid, colors);

public override IEnumerable<Color> GetAlternateColors(Color color) => Java1p8Version.Instance.GetAlternateColors(color);
public override IEnumerable<Color> GetBaseColors()
{
var old_colors = Java1p16Version.Instance.GetBaseColors();
var new_colors = FixShading(new List<Color>
{
Color.FromArgb(100, 100, 100),
Color.FromArgb(216, 175, 147)
});
return old_colors.Concat(new_colors);
}

public override string ToString() => "1.17+";
}
}
2 changes: 2 additions & 0 deletions Image Map 3/JavaDefinitions/JavaWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ private static IJavaVersion DetermineVersionFromLevelDat(NbtCompound leveldat)
var dataversion = leveldat["DataVersion"];
if (dataversion is NbtInt intversion)
{
if (intversion.Value >= 2709)
return Java1p17Version.Instance;
if (intversion.Value >= 2562) // 1.16 pre-6
return Java1p16Version.Instance;
if (intversion.Value >= 1128) // 17w17a
Expand Down
4 changes: 4 additions & 0 deletions Image Map 3/UI/TheForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ private void OpenWorld(Func<MinecraftWorld> getworld)
if (!WorldView.HasUnsavedChanges() || MessageBox.Show("You have unsaved maps waiting to be imported! If you select a new world, these will be lost!\n\nDiscard unsaved maps?", "Wait a minute!", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
MinecraftWorld world = null;
#if DEBUG
world = getworld();
#else
try
{
world = getworld();
Expand All @@ -55,6 +58,7 @@ private void OpenWorld(Func<MinecraftWorld> getworld)
{
MessageBox.Show($"Error opening that world:\n\n{Util.ExceptionMessage(ex)}", "World error!");
}
#endif
if (world != null)
DoOpenWorld(world);
}
Expand Down
1 change: 1 addition & 0 deletions LevelDBWrapper
Submodule LevelDBWrapper added at b88685
6 changes: 0 additions & 6 deletions LevelDBWrapper/App.config

This file was deleted.

Loading

0 comments on commit 435f997

Please sign in to comment.