Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.20.1' into 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wdog5734 committed Oct 28, 2024
2 parents eb9fe8a + 25cb1fd commit 8c081e8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ protected MixinServerLevel(WritableLevelData writableLevelData, ResourceKey<Leve
}

@Inject(method = "<init>", at = @At(value = "RETURN"))
private void banner$initWorldServer(MinecraftServer minecraftServer, Executor executor, LevelStorageSource.LevelStorageAccess levelStorageAccess, ServerLevelData serverLevelData, ResourceKey resourceKey, LevelStem levelStem, ChunkProgressListener chunkProgressListener, boolean bl, long l, List list, boolean bl2, RandomSequences randomSequences, CallbackInfo ci) {
private void banner$initWorldServer(MinecraftServer minecraftServer, Executor executor, LevelStorageSource.LevelStorageAccess levelStorageAccess, ServerLevelData serverLevelData, ResourceKey<Level> resourceKey, LevelStem levelStem, ChunkProgressListener chunkProgressListener, boolean bl, long l, List<CustomSpawner> list, boolean bl2, RandomSequences randomSequences, CallbackInfo ci) {
this.banner$setPvpMode(minecraftServer.isPvpAllowed());
this.convertable = levelStorageAccess;
var typeKey = ((InjectionLevelStorageAccess) levelStorageAccess).bridge$getTypeKey();
Expand Down Expand Up @@ -197,9 +197,6 @@ protected MixinServerLevel(WritableLevelData writableLevelData, ResourceKey<Leve
this.uuid = WorldUUID.getUUID(levelStorageAccess.getDimensionPath(this.dimension()).toFile());
this.getWorldBorder().banner$setWorld((ServerLevel) (Object) this);
this.K.setWorld((ServerLevel) (Object) this);
var data = this.getDataStorage().computeIfAbsent(LevelPersistentData::new,
() -> new LevelPersistentData(null), "bukkit_pdc");
this.getWorld().readBukkitValues(data.getTag());
}

@Redirect(method = "<init>", at = @At(value = "INVOKE",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.mohistmc.banner.mixin.world.entity;

import com.google.common.collect.ImmutableList;
import com.mohistmc.banner.asm.annotation.TransformAccess;
import com.mohistmc.banner.bukkit.BukkitSnapshotCaptures;
import com.mohistmc.banner.injection.world.entity.InjectionEntity;
import java.util.Optional;
Expand Down Expand Up @@ -79,6 +80,7 @@
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.objectweb.asm.Opcodes;
import org.spigotmc.ActivationRange;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand Down Expand Up @@ -983,6 +985,7 @@ protected Optional<BlockUtil.FoundRectangle> getExitPortal(ServerLevel serverWor
}

@Unique
@TransformAccess(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC)
private static int nextEntityId() {
return ENTITY_COUNTER.incrementAndGet();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public abstract class MixinPrimaryLevelData implements InjectionPrimaryLevelData

@Shadow private boolean thundering;
@Shadow public LevelSettings settings;
@Shadow public abstract Difficulty getDifficulty();
@Unique
public ServerLevel world;
@Unique
Expand Down Expand Up @@ -90,10 +91,10 @@ public abstract class MixinPrimaryLevelData implements InjectionPrimaryLevelData

@Inject(method = "setDifficulty", at = @At("RETURN"))
private void banner$sendDiffChange(Difficulty newDifficulty, CallbackInfo ci) {
ClientboundChangeDifficultyPacket packet = new ClientboundChangeDifficultyPacket(newDifficulty, this.isDifficultyLocked());
ClientboundChangeDifficultyPacket packet = new ClientboundChangeDifficultyPacket(getDifficulty(), this.isDifficultyLocked());
if (this.world != null) {
for (Player player : this.world.players()) {
((ServerPlayer) player).connection.send(packet);
for (ServerPlayer player : this.world.players()) {
player.connection.send(packet);
}
}
}
Expand All @@ -118,7 +119,12 @@ public void checkName(String name) {
// CraftBukkit start - Add world and pdc
@Override
public void setWorld(ServerLevel world) {
if (this.world != null) {
return;
}
this.world = world;
world.getWorld().readBukkitValues(pdc);
pdc = null;
}
// CraftBukkit end
}

0 comments on commit 8c081e8

Please sign in to comment.