feat: 假人多次生成bug修复及附魔机制修改
This commit is contained in:
1 parent
68c8482eee
commit
a3e3fb361f
7 files changed
+55
-25
No files matched your search
@@ -27,6 +27,12 @@ public class SLSCarpetSettings {
|
|||||||
@Rule(categories = {CARPET_ID, RuleCategory.FEATURE})
|
@Rule(categories = {CARPET_ID, RuleCategory.FEATURE})
|
||||||
public static boolean canUseSitCommand = false;
|
public static boolean canUseSitCommand = false;
|
||||||
|
|
||||||
|
@Rule(categories = {CARPET_ID}, strict = false, options = {"#none"})
|
||||||
|
public static String botPrefix = "#none";
|
||||||
|
|
||||||
|
@Rule(categories = {CARPET_ID, RuleCategory.FEATURE})
|
||||||
|
public static boolean creativeObeyEnchantmentRule = false;
|
||||||
|
|
||||||
@Rule(categories = {CARPET_ID, RuleCategory.FEATURE})
|
@Rule(categories = {CARPET_ID, RuleCategory.FEATURE})
|
||||||
public static boolean fakePlayersNotOccupiedSleepQuota = false;
|
public static boolean fakePlayersNotOccupiedSleepQuota = false;
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import carpet.helpers.EntityPlayerActionPack;
|
|||||||
import carpet.patches.EntityPlayerMPFake;
|
import carpet.patches.EntityPlayerMPFake;
|
||||||
import carpet.patches.FakeClientConnection;
|
import carpet.patches.FakeClientConnection;
|
||||||
import carpet.utils.Messenger;
|
import carpet.utils.Messenger;
|
||||||
|
import com.github.zly2006.carpetslsaddition.SLSCarpetSettings;
|
||||||
import com.github.zly2006.carpetslsaddition.ServerMain;
|
import com.github.zly2006.carpetslsaddition.ServerMain;
|
||||||
import com.github.zly2006.carpetslsaddition.util.access.PlayerAccess;
|
import com.github.zly2006.carpetslsaddition.util.access.PlayerAccess;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
@@ -197,7 +198,7 @@ public class BotCommand {
|
|||||||
|
|
||||||
private static boolean cantSpawn(CommandContext<ServerCommandSource> context)
|
private static boolean cantSpawn(CommandContext<ServerCommandSource> context)
|
||||||
{
|
{
|
||||||
String playerName = StringArgumentType.getString(context, "player");
|
String playerName = getBotPrefix() + StringArgumentType.getString(context, "player");
|
||||||
MinecraftServer server = context.getSource().getServer();
|
MinecraftServer server = context.getSource().getServer();
|
||||||
PlayerManager manager = server.getPlayerManager();
|
PlayerManager manager = server.getPlayerManager();
|
||||||
|
|
||||||
@@ -231,6 +232,10 @@ public class BotCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getBotPrefix() {
|
||||||
|
return SLSCarpetSettings.botPrefix.equals("#none") ? "" : SLSCarpetSettings.botPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
private static int kill(CommandContext<ServerCommandSource> context)
|
private static int kill(CommandContext<ServerCommandSource> context)
|
||||||
{
|
{
|
||||||
if (cantReMove(context)) return 0;
|
if (cantReMove(context)) return 0;
|
||||||
@@ -274,7 +279,7 @@ public class BotCommand {
|
|||||||
source.getWorld().getRegistryKey()
|
source.getWorld().getRegistryKey()
|
||||||
);
|
);
|
||||||
|
|
||||||
String playerName = "bot_" + StringArgumentType.getString(context, "player");
|
String playerName = getBotPrefix() + StringArgumentType.getString(context, "player");
|
||||||
if (playerName.length() > maxNameLength(source.getServer()))
|
if (playerName.length() > maxNameLength(source.getServer()))
|
||||||
{
|
{
|
||||||
Messenger.m(source, "rb Player name: " + playerName + " is too long");
|
Messenger.m(source, "rb Player name: " + playerName + " is too long");
|
||||||
|
|||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
package com.github.zly2006.carpetslsaddition.mixin.screen;
|
||||||
|
|
||||||
|
import com.github.zly2006.carpetslsaddition.SLSCarpetSettings;
|
||||||
|
import net.minecraft.entity.player.PlayerAbilities;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.screen.AnvilScreenHandler;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(AnvilScreenHandler.class)
|
||||||
|
public class MixinAnvilScreenHandler {
|
||||||
|
@Redirect(
|
||||||
|
method = "updateResult",
|
||||||
|
at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/entity/player/PlayerEntity;getAbilities()Lnet/minecraft/entity/player/PlayerAbilities;"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
private PlayerAbilities updateResult(PlayerEntity instance) {
|
||||||
|
if (SLSCarpetSettings.creativeObeyEnchantmentRule) {
|
||||||
|
var ability = new PlayerAbilities();
|
||||||
|
ability.creativeMode = false;
|
||||||
|
return ability;
|
||||||
|
}
|
||||||
|
|
||||||
|
return instance.getAbilities();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,11 +30,8 @@ public class ShulkerBoxItemUtil {
|
|||||||
if (itemStack.getItem() instanceof BlockItem &&
|
if (itemStack.getItem() instanceof BlockItem &&
|
||||||
((BlockItem) itemStack.getItem()).getBlock() instanceof ShulkerBoxBlock) {
|
((BlockItem) itemStack.getItem()).getBlock() instanceof ShulkerBoxBlock) {
|
||||||
NbtComponent tag = itemStack.getComponents().get(DataComponentTypes.BLOCK_ENTITY_DATA);
|
NbtComponent tag = itemStack.getComponents().get(DataComponentTypes.BLOCK_ENTITY_DATA);
|
||||||
if (tag != null) {
|
if (tag != null && tag.contains("Items")) {
|
||||||
if (tag.contains("Items")) {
|
return tag.getNbt().getList("Items", 10).isEmpty();
|
||||||
NbtList tagList = tag.getNbt().getList("Items", 10);
|
|
||||||
return tagList.size() <= 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
"carpet.rule.skipTicksForJoblessVillager.name": "Skip ticks for jobless villager",
|
"carpet.rule.skipTicksForJoblessVillager.name": "Skip ticks for jobless villager",
|
||||||
"carpet.rule.creativeNoInfinitePickup.name": "Creative mode cannot infinite pickup",
|
"carpet.rule.creativeNoInfinitePickup.name": "Creative mode cannot infinite pickup",
|
||||||
"carpet.rule.noBatSpawning.name": "No bat spawning",
|
"carpet.rule.noBatSpawning.name": "No bat spawning",
|
||||||
"carpet.rule.pcaSyncProtocol.name": "Enable PCA Sync Protocol",
|
"carpet.rule.botPrefix.name": "The prefix of the bot",
|
||||||
"carpet.rule.pcaSyncPlayerEntity.name": "Set PCA Sync Protocol's entity scope",
|
"carpet.rule.creativeObeyEnchantmentRule.name": "Creative player enchantments follows the rules of vanilla",
|
||||||
"carpet.rule.emptyShulkerBoxStack.name": "Empty shulker boxes can be stacked",
|
"carpet.rule.emptyShulkerBoxStack.name": "Empty shulker boxes can be stacked",
|
||||||
"carpet.rule.useDyeOnShulkerBox.name": "Shulker box blocks can be dyed",
|
"carpet.rule.useDyeOnShulkerBox.name": "Shulker box blocks can be dyed",
|
||||||
"carpet.rule.xaeroWorldName.name": "Xaero world name",
|
"carpet.rule.xaeroWorldName.name": "Xaero world name",
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
"carpet.rule.skipTicksForJoblessVillager.desc": "For jobless/nitwit villagers, after performing a set number of tick operations, skip the 1 tick operation.",
|
"carpet.rule.skipTicksForJoblessVillager.desc": "For jobless/nitwit villagers, after performing a set number of tick operations, skip the 1 tick operation.",
|
||||||
"carpet.rule.creativeNoInfinitePickup.desc": "If my inventory is full, don't pick up items in creative mode.",
|
"carpet.rule.creativeNoInfinitePickup.desc": "If my inventory is full, don't pick up items in creative mode.",
|
||||||
"carpet.rule.noBatSpawning.desc": "Prevents bats from spawning.",
|
"carpet.rule.noBatSpawning.desc": "Prevents bats from spawning.",
|
||||||
"carpet.rule.pcaSyncProtocol.desc": "Using PCA protocol to support sync entity and blockEntity from server",
|
"carpet.rule.botPrefix.desc": "Set the prefix for the bot players, value #none for no prefix.",
|
||||||
"carpet.rule.pcaSyncPlayerEntity.desc": "Which player entity can be sync",
|
"carpet.rule.creativeObeyEnchantmentRule.desc": "Making creative player to enchant with anvils and enchanted books also need to follow the vanilla rules",
|
||||||
"carpet.rule.emptyShulkerBoxStack.desc": "Empty shulker boxes stack",
|
"carpet.rule.emptyShulkerBoxStack.desc": "Empty shulker boxes stack",
|
||||||
"carpet.rule.useDyeOnShulkerBox.desc": "Dyes can be used on shulker boxes, empty potion will clean color",
|
"carpet.rule.useDyeOnShulkerBox.desc": "Dyes can be used on shulker boxes, empty potion will clean color",
|
||||||
"carpet.rule.xaeroWorldName.desc": "set xaero world name to sync word id to xaerominimap, \"#none\" is disable.",
|
"carpet.rule.xaeroWorldName.desc": "set xaero world name to sync word id to xaerominimap, \"#none\" is disable.",
|
||||||
@@ -47,11 +47,6 @@
|
|||||||
"carpet.rule.skipTicksForJoblessVillager.extra.2": "To prevents villagers from getting completely stuck when set to 1",
|
"carpet.rule.skipTicksForJoblessVillager.extra.2": "To prevents villagers from getting completely stuck when set to 1",
|
||||||
"carpet.rule.maxUpdateQueueSize.extra.0": "If set to a value not greater than 0, turn off this function and run according to Vanilla",
|
"carpet.rule.maxUpdateQueueSize.extra.0": "If set to a value not greater than 0, turn off this function and run according to Vanilla",
|
||||||
"carpet.rule.maxUpdateQueueSize.extra.1": "Otherwise, when the number of single updates exceeds the set value, an OutOfMemoryError will be thrown to generate update suppression",
|
"carpet.rule.maxUpdateQueueSize.extra.1": "Otherwise, when the number of single updates exceeds the set value, an OutOfMemoryError will be thrown to generate update suppression",
|
||||||
"carpet.rule.pcaSyncPlayerEntity.extra.0": "NOBODY: nobody will be sync",
|
|
||||||
"carpet.rule.pcaSyncPlayerEntity.extra.1": "BOT: carpet bot will be sync",
|
|
||||||
"carpet.rule.pcaSyncPlayerEntity.extra.2": "OPS: carpet bot will be sync, and op can sync everyone's player entity data.",
|
|
||||||
"carpet.rule.pcaSyncPlayerEntity.extra.3": "OPS_AND_SELF: carpet bot and self data will be sync, and op can sync everyone's player entity data.",
|
|
||||||
"carpet.rule.pcaSyncPlayerEntity.extra.4": "EVERYONE: everyone's player entity will be sync",
|
|
||||||
"carpet.rule.emptyShulkerBoxStack.extra.0": "Empty shulker boxes can stack in a player's inventory or hand",
|
"carpet.rule.emptyShulkerBoxStack.extra.0": "Empty shulker boxes can stack in a player's inventory or hand",
|
||||||
"carpet.rule.emptyShulkerBoxStack.extra.1": "Empty shulker boxes will not stack in other inventories, such as chests or hoppers"
|
"carpet.rule.emptyShulkerBoxStack.extra.1": "Empty shulker boxes will not stack in other inventories, such as chests or hoppers"
|
||||||
}
|
}
|
||||||
@@ -8,8 +8,8 @@
|
|||||||
"carpet.rule.skipTicksForJoblessVillager.name": "无业村民跳刻",
|
"carpet.rule.skipTicksForJoblessVillager.name": "无业村民跳刻",
|
||||||
"carpet.rule.creativeNoInfinitePickup.name": "创造模式满背包无法拾取",
|
"carpet.rule.creativeNoInfinitePickup.name": "创造模式满背包无法拾取",
|
||||||
"carpet.rule.noBatSpawning.name": "禁止蝙蝠生成",
|
"carpet.rule.noBatSpawning.name": "禁止蝙蝠生成",
|
||||||
"carpet.rule.pcaSyncProtocol.name": "启动兼容PCA的同步协议",
|
"carpet.rule.botPrefix.name": "机器人前缀",
|
||||||
"carpet.rule.pcaSyncPlayerEntity.name": "PCA同步协议作用范围",
|
"carpet.rule.creativeObeyEnchantmentRule.name": "创造铁砧附魔遵守基本法",
|
||||||
"carpet.rule.emptyShulkerBoxStack.name": "空潜影盒背包可堆叠",
|
"carpet.rule.emptyShulkerBoxStack.name": "空潜影盒背包可堆叠",
|
||||||
"carpet.rule.useDyeOnShulkerBox.name": "潜影盒方块可染色",
|
"carpet.rule.useDyeOnShulkerBox.name": "潜影盒方块可染色",
|
||||||
"carpet.rule.xaeroWorldName.name": "Xaero 小地图世界名",
|
"carpet.rule.xaeroWorldName.name": "Xaero 小地图世界名",
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
"carpet.rule.skipTicksForJoblessVillager.desc": "对于无业/傻子村民,执行设定数量的tick运算后,跳过1tick的运算",
|
"carpet.rule.skipTicksForJoblessVillager.desc": "对于无业/傻子村民,执行设定数量的tick运算后,跳过1tick的运算",
|
||||||
"carpet.rule.creativeNoInfinitePickup.desc": "创造模式下,玩家不能无限制地拾取物品",
|
"carpet.rule.creativeNoInfinitePickup.desc": "创造模式下,玩家不能无限制地拾取物品",
|
||||||
"carpet.rule.noBatSpawning.desc": "禁止任何区域蝙蝠生成",
|
"carpet.rule.noBatSpawning.desc": "禁止任何区域蝙蝠生成",
|
||||||
"carpet.rule.pcaSyncProtocol.desc": "借助PCA同步协议,支持同步 BlockEntity 和 Entity 到客户端",
|
"carpet.rule.botPrefix.desc": "设定使用/bot召唤出的假人玩家名称前缀,#none代表无前缀",
|
||||||
"carpet.rule.pcaSyncPlayerEntity.desc": "决定哪些玩家的数据将会被同步",
|
"carpet.rule.creativeObeyEnchantmentRule.desc": "让创造玩家使用铁砧与附魔书为物品附魔时,也需要遵守原版的附魔规则",
|
||||||
"carpet.rule.emptyShulkerBoxStack.desc": "空潜影盒可堆叠,但是不会改变容器中潜影盒的堆叠行为",
|
"carpet.rule.emptyShulkerBoxStack.desc": "空潜影盒可堆叠,但是不会改变容器中潜影盒的堆叠行为",
|
||||||
"carpet.rule.useDyeOnShulkerBox.desc": "可以使用染料直接对地上的潜影盒染色,用水瓶可以洗掉潜影盒的颜色",
|
"carpet.rule.useDyeOnShulkerBox.desc": "可以使用染料直接对地上的潜影盒染色,用水瓶可以洗掉潜影盒的颜色",
|
||||||
"carpet.rule.xaeroWorldName.desc": "设置 Xaero 世界名来同步世界 ID,\"#none\" 表示不同步",
|
"carpet.rule.xaeroWorldName.desc": "设置 Xaero 世界名来同步世界 ID,\"#none\" 表示不同步",
|
||||||
@@ -47,11 +47,6 @@
|
|||||||
"carpet.rule.skipTicksForJoblessVillager.extra.2": "以此避免在设置为1的时候,村民完全卡死",
|
"carpet.rule.skipTicksForJoblessVillager.extra.2": "以此避免在设置为1的时候,村民完全卡死",
|
||||||
"carpet.rule.maxUpdateQueueSize.extra.0": "如果设定了不超过0的值,将关闭该功能,更新机制继续依照Vanilla运行",
|
"carpet.rule.maxUpdateQueueSize.extra.0": "如果设定了不超过0的值,将关闭该功能,更新机制继续依照Vanilla运行",
|
||||||
"carpet.rule.maxUpdateQueueSize.extra.1": "否则,在单次更新数量超过设定最大容量后,服务器将抛出OutOfMemoryError,以达到快速更新抑制的效果",
|
"carpet.rule.maxUpdateQueueSize.extra.1": "否则,在单次更新数量超过设定最大容量后,服务器将抛出OutOfMemoryError,以达到快速更新抑制的效果",
|
||||||
"carpet.rule.pcaSyncPlayerEntity.extra.0": "NOBODY:所有玩家数据都无法同步",
|
|
||||||
"carpet.rule.pcaSyncPlayerEntity.extra.1": "BOT:地毯 mod 召唤出的 bot 的数据可以被同步",
|
|
||||||
"carpet.rule.pcaSyncPlayerEntity.extra.2": "OPS:地毯 mod 召唤出的 bot 的数据可以被同步, op 可以同步所有玩家的数据",
|
|
||||||
"carpet.rule.pcaSyncPlayerEntity.extra.3": "OPS_AND_SELF:地毯 mod 召唤出的 bot 和玩家自己的数据可以被同步,op 可以同步所有玩家的数据",
|
|
||||||
"carpet.rule.pcaSyncPlayerEntity.extra.4": "EVERYONE:所有人的数据都可以被同步",
|
|
||||||
"carpet.rule.emptyShulkerBoxStack.extra.0": "空潜影盒可以在玩家的背包进行自动堆叠,同时玩家可以手动堆叠空潜影盒",
|
"carpet.rule.emptyShulkerBoxStack.extra.0": "空潜影盒可以在玩家的背包进行自动堆叠,同时玩家可以手动堆叠空潜影盒",
|
||||||
"carpet.rule.emptyShulkerBoxStack.extra.1": "但是空潜影盒无法在容器中自动堆叠,比如箱子,漏斗"
|
"carpet.rule.emptyShulkerBoxStack.extra.1": "但是空潜影盒无法在容器中自动堆叠,比如箱子,漏斗"
|
||||||
}
|
}
|
||||||
@@ -22,6 +22,9 @@
|
|||||||
"entity.MixinServerPlayerEntity",
|
"entity.MixinServerPlayerEntity",
|
||||||
"entity.MixinVillagerEntity",
|
"entity.MixinVillagerEntity",
|
||||||
"player.MixinPlayerInventory",
|
"player.MixinPlayerInventory",
|
||||||
|
"player.AccessorPlayerAbilities",
|
||||||
|
"screen.MixinAnvilScreenHandler",
|
||||||
|
"screen.MixinSlot",
|
||||||
"server.MixinMinecraftServer",
|
"server.MixinMinecraftServer",
|
||||||
"shulker.MixinItemStack",
|
"shulker.MixinItemStack",
|
||||||
"shulker.MixinScreenHandler",
|
"shulker.MixinScreenHandler",
|
||||||
|
|||||||
Reference in new issue
Block a user