Skip to content

Commit

Permalink
Update to 1.21.2
Browse files Browse the repository at this point in the history
  • Loading branch information
andantet committed Oct 8, 2024
1 parent 3ebc8b4 commit af69dd8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//file:noinspection all

plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
id "org.jetbrains.kotlin.jvm" version "1.9.+"
}
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21
yarn_build=9
loader_version=0.15.11
fabric_version=0.100.8+1.21
minecraft_version=1.21.2-pre1
yarn_build=1
loader_version=0.16.5
fabric_version=0.105.2+1.21.2
fabric_kotlin_version=1.10.20+kotlin.1.9.24
kache_version=1.0.5

# Mod Properties
mod_version=2.11.1
mod_version=2.11.1-1.21.2
maven_group=dev.andante
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
13 changes: 9 additions & 4 deletions src/main/java/dev/andante/audience/Audience.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.network.packet.s2c.play.BundleS2CPacket;
import net.minecraft.network.packet.s2c.play.ClearTitleS2CPacket;
import net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket;
import net.minecraft.network.packet.s2c.play.PositionFlag;
import net.minecraft.network.packet.s2c.play.WorldBorderInitializeS2CPacket;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.PlayerManager;
Expand All @@ -21,6 +22,8 @@
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.border.WorldBorder;

import java.util.Collections;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Function;

Expand All @@ -29,6 +32,8 @@

@SuppressWarnings("unused")
public interface Audience {
Set<PositionFlag> EMPTY_POSITION_FLAG_SET = Collections.emptySet();

/**
* The players of this audience.
*/
Expand All @@ -40,7 +45,7 @@ default PlayerSet getAudiencePlayers() {
* Teleports the audience to the given world using the given position and rotation.
*/
default void teleport(ServerWorld world, Vec3d position, Vec2f rotation) {
forEachAudience(player -> player.teleport(world, position.x, position.y, position.z, rotation.x, rotation.y));
forEachAudience(player -> player.teleport(world, position.x, position.y, position.z, EMPTY_POSITION_FLAG_SET, rotation.x, rotation.y, true));
}

/**
Expand All @@ -49,7 +54,7 @@ default void teleport(ServerWorld world, Vec3d position, Vec2f rotation) {
default void teleport(ServerWorld world, Function<ServerPlayerEntity, Vec3d> positionFunction) {
forEachAudience( player -> {
Vec3d position = positionFunction.apply(player);
player.teleport(world, position.x, position.y, position.z, 0.0f, 0.0f);
player.teleport(world, position.x, position.y, position.z, EMPTY_POSITION_FLAG_SET, 0.0f, 0.0f, true);
});
}

Expand All @@ -61,7 +66,7 @@ default void teleportWithRotation(ServerWorld world, Function<ServerPlayerEntity
Pair<Vec3d, Vec2f> positionAndRotation = positionRotationFunction.apply(player);
Vec3d position = positionAndRotation.getLeft();
Vec2f rotation = positionAndRotation.getRight();
player.teleport(world, position.x, position.y, position.z, rotation.x, rotation.y);
player.teleport(world, position.x, position.y, position.z, EMPTY_POSITION_FLAG_SET, rotation.x, rotation.y, true);
});
}

Expand Down Expand Up @@ -172,7 +177,7 @@ default void stopSound(SoundStop soundStop) {
* Teleports all audience players to the given [world] and [position].
*/
default void teleport(ServerWorld world, Vec3d position) {
forEachAudience(player -> player.teleport(world, position.x, position.y, position.z, 0.0f, 0.0f));
forEachAudience(player -> player.teleport(world, position.x, position.y, position.z, EMPTY_POSITION_FLAG_SET, 0.0f, 0.0f, true));
}

/**
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/dev/andante/audience/mixin/ServerWorldMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import net.minecraft.server.PlayerManager;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.profiler.Profiler;
import net.minecraft.world.MutableWorldProperties;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
Expand All @@ -18,17 +17,16 @@
import org.spongepowered.asm.mixin.Shadow;

import java.util.List;
import java.util.function.Supplier;

@SuppressWarnings("AddedMixinMembersNamePattern")
@Mixin(ServerWorld.class)
public abstract class ServerWorldMixin extends World implements Audience {
private ServerWorldMixin(MutableWorldProperties properties, RegistryKey<World> registryRef, DynamicRegistryManager registryManager, RegistryEntry<DimensionType> dimensionEntry, Supplier<Profiler> profiler, boolean isClient, boolean debugWorld, long biomeAccess, int maxChainedNeighborUpdates) {
super(properties, registryRef, registryManager, dimensionEntry, profiler, isClient, debugWorld, biomeAccess, maxChainedNeighborUpdates);
}

@Shadow @Final private MinecraftServer server;

private ServerWorldMixin(MutableWorldProperties properties, RegistryKey<World> registryRef, DynamicRegistryManager registryManager, RegistryEntry<DimensionType> dimensionEntry, boolean isClient, boolean debugWorld, long seed, int maxChainedNeighborUpdates) {
super(properties, registryRef, registryManager, dimensionEntry, isClient, debugWorld, seed, maxChainedNeighborUpdates);
}

@Override
public PlayerSet getAudiencePlayers() {
RegistryKey<World> registryKey = this.getRegistryKey();
Expand Down

0 comments on commit af69dd8

Please sign in to comment.