Skip to content

Commit

Permalink
build: 24w06a
Browse files Browse the repository at this point in the history
  • Loading branch information
ishland committed Feb 8, 2024
1 parent 98bb99a commit b1a279d
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 28 deletions.
2 changes: 1 addition & 1 deletion c2me-base/src/main/resources/c2me-base.accesswidener
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ accessible method net/minecraft/util/collection/WeightedList
accessible method net/minecraft/nbt/NbtCompound <init> (Ljava/util/Map;)V
accessible method net/minecraft/nbt/NbtList <init> (Ljava/util/List;B)V
accessible method net/minecraft/world/gen/surfacebuilder/MaterialRules$SequenceBlockStateRule <init> (Ljava/util/List;)V
accessible method net/minecraft/world/storage/RegionBasedStorage <init> (Ljava/nio/file/Path;Z)V
accessible method net/minecraft/world/storage/RegionBasedStorage <init> (Lnet/minecraft/class_9240;Ljava/nio/file/Path;Z)V

accessible field net/minecraft/world/storage/StorageIoWorker$Result nbt Lnet/minecraft/nbt/NbtCompound;
accessible field net/minecraft/world/storage/StorageIoWorker$Result future Ljava/util/concurrent/CompletableFuture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.ishland.c2me.rewrites.chunk_serializer.common.ChunkDataSerializer;
import com.ishland.c2me.rewrites.chunk_serializer.common.NbtWriter;
import com.mojang.datafixers.DataFixer;
import net.minecraft.class_9240;
import net.minecraft.nbt.NbtElement;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.server.world.ThreadedAnvilChunkStorage;
Expand Down Expand Up @@ -36,15 +37,17 @@ public abstract class MixinThreadedAnvilChunkStorage extends VersionedChunkStora
@Shadow
ServerWorld world;

public MixinThreadedAnvilChunkStorage(class_9240 arg, Path path, DataFixer dataFixer, boolean bl) {
super(arg, path, dataFixer, bl);
}

@Shadow
private native boolean isLevelChunk(ChunkPos chunkPos);

@Shadow
private native byte mark(ChunkPos chunkPos, ChunkStatus.ChunkType chunkType);

public MixinThreadedAnvilChunkStorage(Path directory, DataFixer dataFixer, boolean dsync) {
super(directory, dataFixer, dsync);
}


/**
* @author Kroppeb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.ishland.c2me.base.mixin.access.IRegionFile;
import it.unimi.dsi.fastutil.longs.Long2ReferenceLinkedOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectArraySet;
import net.minecraft.class_9240;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtIo;
import net.minecraft.nbt.NbtSizeTracker;
Expand Down Expand Up @@ -62,8 +63,8 @@ public class C2MEStorageThread extends Thread {
};
private final ObjectArraySet<CompletableFuture<Void>> writeFutures = new ObjectArraySet<>();

public C2MEStorageThread(Path directory, boolean dsync, String name) {
this.storage = new RegionBasedStorage(directory, dsync);
public C2MEStorageThread(class_9240 arg, Path path, boolean dsync) {
this.storage = new RegionBasedStorage(arg, path, dsync);
this.setName("C2ME Storage #%d".formatted(SERIAL.incrementAndGet()));
this.setDaemon(true);
this.setUncaughtExceptionHandler((t, e) -> LOGGER.error("Thread %s died".formatted(t), e));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.common.base.Preconditions;
import com.ishland.c2me.base.common.theinterface.IDirectStorage;
import net.minecraft.class_9240;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.scanner.NbtScanner;
import net.minecraft.util.math.ChunkPos;
Expand All @@ -16,9 +17,9 @@ public class C2MEStorageVanillaInterface extends StorageIoWorker implements IDir

private final C2MEStorageThread backend;

public C2MEStorageVanillaInterface(Path directory, boolean dsync, String name) {
super(null, dsync, name);
this.backend = new C2MEStorageThread(directory, dsync, name);
public C2MEStorageVanillaInterface(class_9240 arg, Path path, boolean dsync) {
super(arg, path, dsync);
this.backend = new C2MEStorageThread(arg, path, dsync);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ishland.c2me.rewrites.chunkio.mixin;

import com.ishland.c2me.rewrites.chunkio.common.C2MEStorageVanillaInterface;
import net.minecraft.class_9240;
import net.minecraft.world.storage.ChunkPosKeyedStorage;
import net.minecraft.world.storage.StorageIoWorker;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -12,9 +13,9 @@
@Mixin(ChunkPosKeyedStorage.class)
public class MixinChunkPosKeyedStorage {

@Redirect(method = "<init>", at = @At(value = "NEW", target = "(Ljava/nio/file/Path;ZLjava/lang/String;)Lnet/minecraft/world/storage/StorageIoWorker;"))
private StorageIoWorker redirectStorageIoWorker(Path directory, boolean dsync, String name) {
return new C2MEStorageVanillaInterface(directory, dsync, name);
@Redirect(method = "<init>", at = @At(value = "NEW", target = "(Lnet/minecraft/class_9240;Ljava/nio/file/Path;Z)Lnet/minecraft/world/storage/StorageIoWorker;"))
private StorageIoWorker redirectStorageIoWorker(class_9240 arg, Path path, boolean bl) {
return new C2MEStorageVanillaInterface(arg, path, bl);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ishland.c2me.rewrites.chunkio.mixin;

import com.ishland.c2me.rewrites.chunkio.common.C2MEStorageVanillaInterface;
import net.minecraft.class_9240;
import net.minecraft.world.storage.RecreatedChunkStorage;
import net.minecraft.world.storage.StorageIoWorker;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -12,9 +13,9 @@
@Mixin(RecreatedChunkStorage.class)
public class MixinRecreatedChunkStorage {

@Redirect(method = "<init>", at = @At(value = "NEW", target = "(Ljava/nio/file/Path;ZLjava/lang/String;)Lnet/minecraft/world/storage/StorageIoWorker;"))
private StorageIoWorker redirectStorageIoWorker(Path directory, boolean dsync, String name) {
return new C2MEStorageVanillaInterface(directory, dsync, name);
@Redirect(method = "<init>", at = @At(value = "NEW", target = "(Lnet/minecraft/class_9240;Ljava/nio/file/Path;Z)Lnet/minecraft/world/storage/StorageIoWorker;"))
private StorageIoWorker redirectStorageIoWorker(class_9240 arg, Path path, boolean bl) {
return new C2MEStorageVanillaInterface(arg, path, bl);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ishland.c2me.rewrites.chunkio.mixin;

import com.ishland.c2me.rewrites.chunkio.common.C2MEStorageVanillaInterface;
import net.minecraft.class_9240;
import net.minecraft.world.storage.RecreationStorage;
import net.minecraft.world.storage.StorageIoWorker;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -12,9 +13,9 @@
@Mixin(RecreationStorage.class)
public class MixinRecreationStorage {

@Redirect(method = "<init>", at = @At(value = "NEW", target = "(Ljava/nio/file/Path;ZLjava/lang/String;)Lnet/minecraft/world/storage/StorageIoWorker;"))
private StorageIoWorker redirectStorageIoWorker(Path directory, boolean dsync, String name) {
return new C2MEStorageVanillaInterface(directory, dsync, name);
@Redirect(method = "<init>", at = @At(value = "NEW", target = "(Lnet/minecraft/class_9240;Ljava/nio/file/Path;Z)Lnet/minecraft/world/storage/StorageIoWorker;"))
private StorageIoWorker redirectStorageIoWorker(class_9240 arg, Path path, boolean bl) {
return new C2MEStorageVanillaInterface(arg, path, bl);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ishland.c2me.rewrites.chunkio.mixin;

import com.ishland.c2me.rewrites.chunkio.common.C2MEStorageVanillaInterface;
import net.minecraft.class_9240;
import net.minecraft.world.storage.StorageIoWorker;
import net.minecraft.world.storage.VersionedChunkStorage;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -12,9 +13,9 @@
@Mixin(VersionedChunkStorage.class)
public class MixinVersionedChunkStorage {

@Redirect(method = "<init>", at = @At(value = "NEW", target = "(Ljava/nio/file/Path;ZLjava/lang/String;)Lnet/minecraft/world/storage/StorageIoWorker;"))
private StorageIoWorker redirectStorageIoWorker(Path directory, boolean dsync, String name) {
return new C2MEStorageVanillaInterface(directory, dsync, name);
@Redirect(method = "<init>", at = @At(value = "NEW", target = "(Lnet/minecraft/class_9240;Ljava/nio/file/Path;Z)Lnet/minecraft/world/storage/StorageIoWorker;"))
private StorageIoWorker redirectStorageIoWorker(class_9240 arg, Path path, boolean bl) {
return new C2MEStorageVanillaInterface(arg, path, bl);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import it.unimi.dsi.fastutil.longs.Long2ByteMaps;
import it.unimi.dsi.fastutil.objects.ReferenceArrayList;
import net.minecraft.SharedConstants;
import net.minecraft.class_9240;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.server.world.ChunkHolder;
import net.minecraft.server.world.ServerWorld;
Expand Down Expand Up @@ -64,8 +65,8 @@
@Mixin(ThreadedAnvilChunkStorage.class)
public abstract class MixinThreadedAnvilChunkStorage extends VersionedChunkStorage implements ChunkHolder.PlayersWatchingChunkProvider {

public MixinThreadedAnvilChunkStorage(Path path, DataFixer dataFixer, boolean bl) {
super(path, dataFixer, bl);
public MixinThreadedAnvilChunkStorage(class_9240 arg, Path path, DataFixer dataFixer, boolean bl) {
super(arg, path, dataFixer, bl);
}

@Shadow
Expand Down Expand Up @@ -272,7 +273,7 @@ private CompletableFuture<Optional<NbtCompound>> getUpdatedChunkNbtAtAsync(Chunk
* @reason skip datafixer if possible
*/
@Overwrite
public CompletableFuture<Optional<NbtCompound>> getUpdatedChunkNbt(ChunkPos chunkPos) {
private CompletableFuture<Optional<NbtCompound>> getUpdatedChunkNbt(ChunkPos chunkPos) {
// return this.getNbt(chunkPos).thenApplyAsync(nbt -> nbt.map(this::updateChunkNbt), Util.getMainWorkerExecutor());
return this.getNbt(chunkPos).thenCompose(nbt -> {
if (nbt.isPresent()) {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ org.gradle.parallel=true
fabric.loom.multiProjectOptimisation=true
# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version=24w05b
yarn_mappings=24w05b+build.2
minecraft_version=24w06a
yarn_mappings=24w06a+build.4
loader_version=0.15.6
# Mod Properties
mod_version=0.2.0+alpha.11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.class_9240;
import net.minecraft.datafixer.Schemas;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtList;
Expand Down Expand Up @@ -316,9 +317,9 @@ private static WorldHandle getWorldHandle(File worldFolder, String description)
final HashMap<RegistryKey<World>, StorageIoWorker> regionIoWorkers = new HashMap<>();
final HashMap<RegistryKey<World>, StorageIoWorker> poiIoWorkers = new HashMap<>();
for (RegistryKey<World> world : worldKeys) {
regionIoWorkers.put(world, new StorageIoWorker(session.getWorldDirectory(world).resolve("region"), true, "chunk") {
regionIoWorkers.put(world, new StorageIoWorker(new class_9240(session.getDirectoryName(), world, "entities"), session.getWorldDirectory(world).resolve("region"), true) {
});
poiIoWorkers.put(world, new StorageIoWorker(session.getWorldDirectory(world).resolve("poi"), true, "poi") {
poiIoWorkers.put(world, new StorageIoWorker(new class_9240(session.getDirectoryName(), world, "entities"), session.getWorldDirectory(world).resolve("poi"), true) {
});
}
return new WorldHandle(
Expand Down

0 comments on commit b1a279d

Please sign in to comment.