This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
SlightlyVanilla/src/main/java/com/thebrokenrail/slightlyvanilla/mixin/MixinServerPlayerEntity.java

21 lines
1020 B
Java

package com.thebrokenrail.slightlyvanilla.mixin;
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ServerPlayerEntity.class)
public class MixinServerPlayerEntity {
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;setSpawnPoint(Lnet/minecraft/util/registry/RegistryKey;Lnet/minecraft/util/math/BlockPos;FZZ)V"), method = "trySleep")
public void setSpawnPoint(ServerPlayerEntity obj, RegistryKey<World> dimension, BlockPos pos, float angle, boolean spawnPointSet, boolean bl) {
if (SlightlyVanilla.getConfig().bedsSetSpawn) {
obj.setSpawnPoint(dimension, pos, angle, spawnPointSet, bl);
}
}
}