Skip to content

Commit

Permalink
Ported rule debugNbtQueryNoPermission
Browse files Browse the repository at this point in the history
  • Loading branch information
Fallen-Breath committed Jun 25, 2024
1 parent 4c90bd7 commit c6826b5
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
18 changes: 18 additions & 0 deletions patches/net/minecraft/network/NetHandlerPlayServer.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,24 @@
{
LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getName().getString(), this.player.getName().getString(), d6, d7, d8);
this.netManager.sendPacket(new SPacketMoveVehicle(entity));
@@ -754,7 +770,7 @@
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.player.getServerWorld());

- if (this.player.hasPermissionLevel(2))
+ if (this.player.hasPermissionLevel(2) /*tiscm start*/ || CarpetSettings.debugNbtQueryNoPermission /*tiscm end*/)
{
Entity entity = this.player.getServerWorld().getEntityByID(packetIn.getEntityId());

@@ -770,7 +786,7 @@
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.player.getServerWorld());

- if (this.player.hasPermissionLevel(2))
+ if (this.player.hasPermissionLevel(2) /*tiscm start*/ || CarpetSettings.debugNbtQueryNoPermission /*tiscm end*/)
{
TileEntity tileentity = this.player.getServerWorld().getTileEntity(packetIn.getPosition());
NBTTagCompound nbttagcompound = tileentity != null ? tileentity.write(new NBTTagCompound()) : null;
@@ -831,6 +847,12 @@
double d10 = this.player.motionX * this.player.motionX + this.player.motionY * this.player.motionY + this.player.motionZ * this.player.motionZ;
double d11 = d7 * d7 + d8 * d8 + d9 * d9;
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/carpet/settings/CarpetSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,16 @@ public String validate(CommandSource source, ParsedRule<String> currentRule, Str
}
}

@Rule(
desc = "Remove the permission requirement for the debug nbt request of client's F3+I action",
extra = {
"In vanilla, the request needs permission level 2 at least",
"Carpet TIS Addition is required to be installed on the client"
},
category = {CLIENT}
)
public static boolean debugNbtQueryNoPermission = false;


// /$$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ /$$ /$$
//|__ $$__/|_ $$_/ /$$__ $$ /$$__ $$| $$$ /$$$
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/assets/carpet/lang/zh_cn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ rule:
creativeOpenContainerForcibly:
name: 创造玩家强制打开容器
desc: 允许创造模式的玩家打开被阻挡的容器,如潜影盒
debugNbtQueryNoPermission:
name: NBT调试拉取请求无需权限
desc: 让客户端F3+I操作所触发的调试请求无需任何权限等级需求
extra:
'0': 在原版中,该操作需要权限等级至少为2
'1': 需要在客户端中安装Carpet TIS Addition模组
deobfuscateCrashReportStackTrace:
name: 反混淆崩溃报告堆栈追踪
desc: 反混淆崩溃报告中输出的堆栈追踪
Expand Down

0 comments on commit c6826b5

Please sign in to comment.