feat: offlineFakePlayers
This commit is contained in:
7 files changed
+35
-2
No files matched your search
+1
-1
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id 'fabric-loom' version '1.7-SNAPSHOT'
|
||||
id 'fabric-loom' version '1.9.2'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -60,6 +60,9 @@ public class SLSCarpetSettings {
|
||||
@Rule(categories = {SLSA, RuleCategory.FEATURE})
|
||||
public static boolean armadilloImmediateDespawns = false;
|
||||
|
||||
@Rule(categories = {SLSA, RuleCategory.FEATURE})
|
||||
public static boolean offlineFakePlayers = false;
|
||||
|
||||
@Rule(categories = {SLSA, RuleCategory.FEATURE})
|
||||
public static int netherPortalSize = 21;
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.github.zly2006.carpetslsaddition.mixin.carpet;
|
||||
|
||||
import carpet.commands.PlayerCommand;
|
||||
import com.github.zly2006.carpetslsaddition.SLSCarpetSettings;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.util.UserCache;
|
||||
import net.minecraft.util.Uuids;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import java.util.Optional;
|
||||
|
||||
@Mixin(PlayerCommand.class)
|
||||
public abstract class MixinPlayerCommand {
|
||||
|
||||
@Redirect(
|
||||
method = "cantSpawn",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/UserCache;findByName(Ljava/lang/String;)Ljava/util/Optional;")
|
||||
)
|
||||
private static Optional<GameProfile> redirectFindByName(UserCache instance, String playerName) {
|
||||
if (SLSCarpetSettings.offlineFakePlayers) {
|
||||
return Optional.of(Uuids.getOfflinePlayerProfile(playerName));
|
||||
} else {
|
||||
return instance.findByName(playerName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,7 @@
|
||||
"carpet.rule.elytraCraftable.desc": "Make elytra craftable for Minecraft 1.20.6+ (eltra wont disappear when crafting)",
|
||||
"carpet.rule.botMaxOnlineTime.desc": "Set the maximum living time of the bot which create by carpet sls addition.",
|
||||
"carpet.rule.spectatorCannotUseLeash.desc": "If a player is a spectator, they cannot use the leash.",
|
||||
"carpet.rule.offlineFakePlayers.desc": "假人强制离线uuid",
|
||||
"carpet.rule.armadilloImmediateDespawns.desc": "Armadillos will despawn immediately if they are 128 blocks away from the player.",
|
||||
|
||||
"carpet.rule.skipTicksForJoblessVillager.extra.0": "Set to 0 to maintain the vanilla behavior",
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
"carpet.rule.printStackTraceOnVillagerSpawn.desc": "当有村民生成时,将会生成一份包含调用栈的报告,显示在控制端中",
|
||||
"carpet.rule.elytraCraftable.desc": "使鞘翅在 1.20.6+ 可合成 (合成时不会消失)",
|
||||
"carpet.rule.botMaxOnlineTime.desc": "设置由Carpet SLS Addition生成的Bot的最大存活时间",
|
||||
"carpet.rule.offlineFakePlayers.desc": "假人强制离线uuid",
|
||||
"carpet.rule.spectatorCannotUseLeash.desc": "若启用,则观察者模式的玩家不再能使用拴绳,已经拴住动物的拴绳也会自动失效",
|
||||
|
||||
"carpet.rule.skipTicksForJoblessVillager.extra.0": "设置为0则保持原版行为",
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"block.MixinNetherPortal",
|
||||
"block.MixinRedstoneWireBlock",
|
||||
"carpet.MixinEntityPlayerMPFake",
|
||||
"carpet.MixinPlayerCommand",
|
||||
"datapack.MixinVanillaResourcePackProvider",
|
||||
"elytra.MixinElytraItem",
|
||||
"elytra.MixinItem",
|
||||
|
||||
Reference in new issue
Block a user