Skip to content

Commit

Permalink
final touches?
Browse files Browse the repository at this point in the history
from basic testing all seems good
~~guess we'll find out soon enough after release~~
  • Loading branch information
arnokeesman committed Nov 14, 2024
1 parent b893eef commit f4da03a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import net.minecraft.entity.Entity;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.packet.s2c.play.PositionFlag;
import net.minecraft.server.PlayerManager;
import net.minecraft.server.network.ConnectedClientData;
import net.minecraft.server.network.ServerPlayerEntity;
Expand Down Expand Up @@ -105,7 +104,7 @@ public void onRespawnPlayer(
// This target lets us modify respawn position and dimension (player maybe not _fully_ initialized, still)
target = "Lnet/minecraft/server/network/ServerPlayerEntity;<init>(Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/server/world/ServerWorld;Lcom/mojang/authlib/GameProfile;Lnet/minecraft/network/packet/c2s/common/SyncedClientOptions;)V"
))
public void onRespawnPlayer_forResawnLocationOverwrite(
public void onRespawnPlayer_forRespawnLocationOverwrite(
CallbackInfoReturnable<ServerPlayerEntity> cir
, @Local(ordinal = 0, argsOnly = true) ServerPlayerEntity oldServerPlayerEntity
, @Local(ordinal = 0) LocalRef<TeleportTarget> teleportTargetLocalRef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntityMixin implemen
@Shadow
public abstract boolean isSpectator();

@Shadow
public abstract boolean damage(ServerWorld world, DamageSource source, float amount);

@Unique
public QueuedTeleport ecQueuedTeleport;

Expand Down Expand Up @@ -69,13 +66,13 @@ public void onChangeGameMode(GameMode gameMode, CallbackInfoReturnable<Boolean>
target = "Lnet/minecraft/server/PlayerManager;sendPlayerStatus(Lnet/minecraft/server/network/ServerPlayerEntity;)V"
))
public void onTeleportBetweenWorlds(TeleportTarget teleportTarget, CallbackInfoReturnable<Entity> cir) {
var playerData = ((ServerPlayerEntityAccess) this).ec$getPlayerData();
var playerData = this.ec$getPlayerData();
playerData.updatePlayerEntity((ServerPlayerEntity) (Object) this);
}

@Inject(method = "worldChanged", at = @At(value = "RETURN"))
public void onWorldChanged(ServerWorld origin, CallbackInfo ci) {
var playerData = ((ServerPlayerEntityAccess) this).ec$getPlayerData();
var playerData = this.ec$getPlayerData();
if (CONFIG.RECHECK_PLAYER_ABILITY_PERMISSIONS_ON_DIMENSION_CHANGE) {
PlayerDataManager.getInstance().scheduleTask(playerData::clearAbilitiesWithoutPermisisons);
}
Expand Down Expand Up @@ -163,7 +160,7 @@ public void getPlayerListName(CallbackInfoReturnable<Text> cir) {
}

// Teleport hook (for /back)
@Inject(method = "Lnet/minecraft/server/network/ServerPlayerEntity;teleport(Lnet/minecraft/server/world/ServerWorld;DDDLjava/util/Set;FFZ)Z", at = @At("HEAD"))
@Inject(method = "teleport(Lnet/minecraft/server/world/ServerWorld;DDDLjava/util/Set;FFZ)Z", at = @At("HEAD"))
public void onTeleport(ServerWorld world, double destX, double destY, double destZ, Set<PositionFlag> flags, float yaw, float pitch, boolean resetCamera, CallbackInfoReturnable<Boolean> cir) {
if (!isSpectator()) {
this.ec$getPlayerData().setPreviousLocation(new MinecraftLocation((ServerPlayerEntity) (Object) this));
Expand Down

0 comments on commit f4da03a

Please sign in to comment.