Skip to content

Commit

Permalink
build: 23w51b
Browse files Browse the repository at this point in the history
  • Loading branch information
ishland committed Dec 19, 2023
1 parent dd2b476 commit 9532cfa
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: ./gradlew build
- name: upload to modrinth and curseforge
run: ./gradlew modrinth curseforge
if: github.ref == 'refs/heads/ver/1.20.4'
if: github.ref == 'refs/heads/ver/1.20.5'
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_UPLOAD_TOKEN }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_API_TOKEN }}
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx2G

# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.1
loader_version=0.15.1
minecraft_version=23w51b
yarn_mappings=23w51b+build.1
loader_version=0.15.3

# Mod Properties
mod_version = 0.2.0+beta.7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import net.minecraft.nbt.NbtCompound;

import java.util.Optional;

public interface IAsyncChunkPlayer {

void markPlayerForAsyncChunkLoad();

void setPlayerData(NbtCompound nbtCompound);
void setPlayerData(Optional<NbtCompound> nbtCompound);

NbtCompound getPlayerData();
Optional<NbtCompound> getPlayerData();

boolean isChunkLoadCompleted();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.Optional;
import java.util.UUID;
import java.util.function.BiConsumer;
import java.util.function.Function;
Expand Down Expand Up @@ -72,9 +73,9 @@ private void redirectRequestTeleport(ServerPlayNetworkHandler instance, double x
instance.player.getServerWorld().onPlayerConnected(instance.player);
instance.player.onSpawn();

final NbtCompound playerData = ((IAsyncChunkPlayer) instance.player).getPlayerData();
((IAsyncChunkPlayer) instance.player).setPlayerData(null);
vmp$mountSavedVehicles(instance.player, playerData);
final Optional<NbtCompound> playerData = ((IAsyncChunkPlayer) instance.player).getPlayerData();
((IAsyncChunkPlayer) instance.player).setPlayerData(Optional.empty());
vmp$mountSavedVehicles(instance.player, playerData.orElse(null));

((IAsyncChunkPlayer) instance.player).onChunkLoadComplete();
LOGGER.info("Async chunk loading for player {} completed", instance.player.getName().getString());
Expand Down Expand Up @@ -149,7 +150,7 @@ private void delayPlayerSpawn(ServerPlayerEntity instance) {
}

@Inject(method = "loadPlayerData", at = @At(value = "RETURN"))
private void onLoadPlayerData(ServerPlayerEntity player, CallbackInfoReturnable<NbtCompound> cir) {
private void onLoadPlayerData(ServerPlayerEntity player, CallbackInfoReturnable<Optional<NbtCompound>> cir) {
((IAsyncChunkPlayer) player).setPlayerData(cir.getReturnValue());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.Optional;

@Mixin(ServerPlayerEntity.class)
public class MixinServerPlayerEntity implements IAsyncChunkPlayer {

@Unique
private NbtCompound playerData = null;
private Optional<NbtCompound> playerData = Optional.empty();

@Unique
private boolean chunkLoadCompleted = true;
Expand All @@ -24,12 +26,12 @@ public void markPlayerForAsyncChunkLoad() {
}

@Override
public void setPlayerData(NbtCompound nbtCompound) {
public void setPlayerData(Optional<NbtCompound> nbtCompound) {
this.playerData = nbtCompound;
}

@Override
public NbtCompound getPlayerData() {
public Optional<NbtCompound> getPlayerData() {
return this.playerData;
}

Expand Down

0 comments on commit 9532cfa

Please sign in to comment.