Skip to content

Commit

Permalink
Merge pull request #675 from mircokroon/mc-1.20.6
Browse files Browse the repository at this point in the history
Minecraft 1.21
  • Loading branch information
mircokroon authored Jun 29, 2024
2 parents 70be0ef + 6935f53 commit c56461e
Show file tree
Hide file tree
Showing 51 changed files with 1,125 additions and 519 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '17'
java-version: '21'
java-package: jdk+fx
- run: |
mvn package -DskipTests
Expand All @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '17'
java-version: '21'
java-package: jdk+fx
- run: |
mvn test
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ If you run into any problems, check the [FAQ](https://github.com/mircokroon/mine
<img src="https://i.imgur.com/7FIJ6fZ.png" width="80%" title="Example of the GUI showing all the downloaded chunks as white squares, which ones from a previous download greyed out.">

### Requirements
- Java 17 or higher
- Minecraft version 1.12.2+ // 1.13.2+ // 1.14.1+ // 1.15.2+ // 1.16.2+ // 1.17+ // 1.18+ // 1.19.3+ // 1.20+
- Java 21 or higher
- Minecraft version 1.12.2+ // 1.13.2+ // 1.14.1+ // 1.15.2+ // 1.16.2+ // 1.17+ // 1.18+ // 1.19.3+ // 1.20+ // 1.21+

### Command-line
[Download](https://github.com/mircokroon/minecraft-world-downloader/releases/latest/download/world-downloader.jar) the cross-platform `world-downloader.jar` and run it using the command-line:
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<version>1.0.0.0</version>
<packaging>jar</packaging>
<properties>
<java.version>17</java.version>
<java.version.max>17</java.version.max>
<java.version>21</java.version>
<java.version.max>21</java.version.max>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand Down Expand Up @@ -43,7 +43,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<version>3.5.3</version>
<configuration>
<minimizeJar>true</minimizeJar>
<filters>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/config/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ public enum Version {
V1_19_3(761, 3218),
V1_20(763, 3463),
V1_20_2(764, 3578),
V1_20_3(765, 3698),
V1_20_4(765, 3698),
V1_20_6(766, 3839),
ANY(0, 0);

public final int dataVersion;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/game/data/LevelData.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static util.ExceptionHandling.attempt;

import config.Config;
import config.Option;
import config.Version;
import game.data.coordinates.Coordinate3D;
import game.data.coordinates.CoordinateDouble3D;
Expand Down Expand Up @@ -224,7 +223,7 @@ private void disableWorldGeneration(CompoundTag data) {
new NamedTag("biome", new StringTag("minecraft:the_void"))
)));

CompoundTag dimensions = new CompoundTag(worldManager.getDimensionCodec().getDimensions().stream().map(dimension -> {
CompoundTag dimensions = new CompoundTag(worldManager.getDimensionRegistry().getDimensions().stream().map(dimension -> {
CompoundTag dim = new CompoundTag();
dim.add("type", new StringTag(dimension.getType()));
dim.add("generator", generator);
Expand Down
26 changes: 18 additions & 8 deletions src/main/java/game/data/WorldManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import static util.ExceptionHandling.attempt;

import game.data.chunk.version.Chunk_1_17;
import game.data.dimension.DimensionType;
import gui.ChunkImageState;
import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -41,7 +43,7 @@
import game.data.coordinates.CoordinateDim2D;
import game.data.coordinates.CoordinateDouble3D;
import game.data.dimension.Dimension;
import game.data.dimension.DimensionCodec;
import game.data.dimension.DimensionRegistry;
import game.data.entity.EntityNames;
import game.data.entity.EntityRegistry;
import game.data.maps.MapRegistry;
Expand All @@ -53,7 +55,6 @@
import packets.DataTypeProvider;
import packets.builder.PacketBuilder;
import proxy.PacketInjector;
import se.llbit.nbt.CompoundTag;
import se.llbit.nbt.Tag;
import util.PathUtils;

Expand Down Expand Up @@ -81,14 +82,15 @@ public class WorldManager {
private ContainerManager containerManager;
private CommandBlockManager commandBlockManager;
private VillagerManager villagerManager;
private DimensionCodec dimensionCodec;
private DimensionRegistry dimensionCodec;
private final RenderDistanceExtender renderDistanceExtender;

private BiConsumer<CoordinateDouble3D, Double> playerPosListener;
private final CoordinateDouble3D playerPosition;
private boolean isBelowGround = false;
private double playerRotation = 0;
private Dimension dimension;
private DimensionType dimensionType;
private final EntityRegistry entityRegistry;
private final ChunkFactory chunkFactory;

Expand Down Expand Up @@ -160,6 +162,11 @@ public void setDimension(Dimension dimension) {
GuiManager.setDimension(this.dimension);
}

public void setDimensionType(DimensionType dimensionType) {
this.dimensionType = dimensionType;
Chunk_1_17.setWorldHeight(dimensionType.getDimensionMinHeight(), dimensionType.getDimensionMaxHeight());
}

private void saveAndUnloadChunks() {
if (saveService == null) {
return;
Expand Down Expand Up @@ -381,20 +388,23 @@ public void touchChunk(ChunkEntities c) {
regions.get(c.getLocation().chunkToDimRegion()).touch();
}

public DimensionCodec getDimensionCodec() {
public DimensionRegistry getDimensionRegistry() {
if (dimensionCodec == null) {
this.dimensionCodec = DimensionRegistry.empty();
}
return dimensionCodec;
}

/**
* Set the dimension codec, used to store information about the dimensions that this server supports.
* Set the dimension registry, used to store information about the dimensions that this server supports.
*/
public void setDimensionCodec(DimensionCodec codec) {
dimensionCodec = codec;
public void setDimensionRegistry(DimensionRegistry registry) {
dimensionCodec = registry;

// We can immediately try to write the dimension data to the proper directory.
try {
Path p = PathUtils.toPath(Config.getWorldOutputDir(), "datapacks", "downloaded", "data");
if (codec.write(p)) {
if (registry.write(p)) {

// we need to copy that pack.mcmeta file from so that Minecraft will recognise the datapack
Path packMeta = PathUtils.toPath(p.getParent().toString(), "pack.mcmeta");
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/game/data/chunk/ChunkSection.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package game.data.chunk;

import game.data.chunk.palette.GlobalPalette;
import game.data.chunk.palette.BlockRegistry;
import java.util.Arrays;

import org.apache.commons.lang3.mutable.MutableBoolean;
Expand Down Expand Up @@ -92,7 +92,7 @@ public byte getY() {
}

public int computeHeight(int x, int z, MutableBoolean foundAir) {
GlobalPalette globalPalette = GlobalPaletteProvider.getGlobalPalette(getDataVersion());
BlockRegistry globalPalette = GlobalPaletteProvider.getGlobalPalette(getDataVersion());

for (int y = 15; y >= 0 ; y--) {
int blockStateId = getNumericBlockStateAt(x, y, z);
Expand Down
Loading

0 comments on commit c56461e

Please sign in to comment.