Skip to content

Commit

Permalink
(mc1.20.6+) Added rule vaultBlacklistDisabled
Browse files Browse the repository at this point in the history
resolved #163
  • Loading branch information
Fallen-Breath committed Aug 3, 2024
1 parent 592932a commit 4655413
Show file tree
Hide file tree
Showing 10 changed files with 218 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,11 @@ public void onRuleSet(ValidationContext<String> ctx, String newValue)
}
}

//#if MC >= 12006
//$$ @Rule(categories = {TIS, CREATIVE})
//$$ public static boolean vaultBlacklistDisabled = false;
//#endif

@Rule(categories = {TIS, CREATIVE})
public static boolean visualizeProjectileLoggerEnabled = false;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* This file is part of the Carpet TIS Addition project, licensed under the
* GNU Lesser General Public License v3.0
*
* Copyright (C) 2024 Fallen_Breath and contributors
*
* Carpet TIS Addition is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Carpet TIS Addition is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Carpet TIS Addition. If not, see <https://www.gnu.org/licenses/>.
*/

package carpettisaddition.mixins.rule.vaultBlacklistDisabled;

import carpettisaddition.utils.compat.DummyClass;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(DummyClass.class)
public abstract class VaultServerDataMixin
{
// impl in mc1.20.6+
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* This file is part of the Carpet TIS Addition project, licensed under the
* GNU Lesser General Public License v3.0
*
* Copyright (C) 2024 Fallen_Breath and contributors
*
* Carpet TIS Addition is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Carpet TIS Addition is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Carpet TIS Addition. If not, see <https://www.gnu.org/licenses/>.
*/

package carpettisaddition.mixins.rule.vaultBlacklistDisabled;

import carpettisaddition.utils.compat.DummyClass;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(DummyClass.class)
public abstract class VaultSharedDataMixin
{
// impl in mc1.20.6+
}
7 changes: 7 additions & 0 deletions src/main/resources/assets/carpettisaddition/lang/en_us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,13 @@ carpettisaddition:
extra:
'0': Right before a powered activator / powered rail on a lapis ore setting its powered state to false, throw the given JVM throwable
'1': 'false: rule disabled; true: rule enable and use StackOverflowError; others: feature enable and use given throwable'
vaultBlacklistDisabled:
name: vaultBlacklistDisabled
desc: Disable functionalities related to the vault block's player blacklist
extra:
'0': 'After enabling this rule:'
'1': 1. When players open the vault, their UUIDs will not be added to the vault blacklist
'2': 2. Regardless of whether players are on the vault blacklist, they can activate or open the vault
visualizeProjectileLoggerEnabled:
name: visualizeProjectileLoggerEnabled
desc: Enable visualize projectile logger
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/assets/carpettisaddition/lang/zh_cn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,13 @@ carpettisaddition:
extra:
'0': 在青金石矿石上已亮起的激活/充能铁轨将要熄灭时,抛出所提供的JVM异常
'1': 'false: 关闭规则; true: 启用规则并使用StackOverflowError; 其他: 启用规则并使用所给异常'
vaultBlacklistDisabled:
name: 禁用宝库黑名单
desc: 禁用宝库方块实体中储存的玩家黑名单的相关功能
extra:
'0': 在本规则启用后:
'1': 1. 玩家开启宝库后,玩家的UUID不会被添加到宝库黑名单中
'2': 2. 无论玩家是否位于宝库黑名单中,玩家均可激活、开启宝库
visualizeProjectileLoggerEnabled:
name: 可视化投掷物记录器
desc: 启用可视化投掷物记录器
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/carpet-tis-addition.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,8 @@
"rule.undeadDontBurnInSunlight.PhantomEntityMixin",
"rule.undeadDontBurnInSunlight.ZombieEntityMixin",
"rule.updateSuppressionSimulator.PoweredRailBlockMixin",
"rule.vaultBlacklistDisabled.VaultServerDataMixin",
"rule.vaultBlacklistDisabled.VaultSharedDataMixin",
"rule.voidDamageAmount.LivingEntityMixin",
"rule.voidDamageIgnorePlayer.LivingEntityMixin",
"rule.voidRelatedAltitude.AbstractDecorationEntityMixin",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* This file is part of the Carpet TIS Addition project, licensed under the
* GNU Lesser General Public License v3.0
*
* Copyright (C) 2024 Fallen_Breath and contributors
*
* Carpet TIS Addition is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Carpet TIS Addition is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Carpet TIS Addition. If not, see <https://www.gnu.org/licenses/>.
*/

package carpettisaddition.mixins.rule.vaultBlacklistDisabled;

import carpettisaddition.CarpetTISAdditionSettings;
import net.minecraft.block.vault.VaultServerData;
import net.minecraft.entity.player.PlayerEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(VaultServerData.class)
public abstract class VaultServerDataMixin
{
@Inject(method = "markPlayerAsRewarded", at = @At("HEAD"), cancellable = true)
private void vaultBlacklistDisabled_dontAddPlayerToTheBlackList(PlayerEntity player, CallbackInfo ci)
{
if (CarpetTISAdditionSettings.vaultBlacklistDisabled)
{
ci.cancel();
}
}

@Inject(method = "hasRewardedPlayer", at = @At("HEAD"), cancellable = true)
private void vaultBlacklistDisabled_noOneIsInTheBlacklist(CallbackInfoReturnable<Boolean> cir)
{
if (CarpetTISAdditionSettings.vaultBlacklistDisabled)
{
cir.setReturnValue(false);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* This file is part of the Carpet TIS Addition project, licensed under the
* GNU Lesser General Public License v3.0
*
* Copyright (C) 2024 Fallen_Breath and contributors
*
* Carpet TIS Addition is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Carpet TIS Addition is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Carpet TIS Addition. If not, see <https://www.gnu.org/licenses/>.
*/

package carpettisaddition.mixins.rule.vaultBlacklistDisabled;

import carpettisaddition.CarpetTISAdditionSettings;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import net.minecraft.block.vault.VaultSharedData;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(VaultSharedData.class)
public abstract class VaultSharedDataMixin
{
/**
* By hooking here instead of {@link net.minecraft.block.vault.VaultServerData#getRewardedPlayers},
* mods who invokes getRewardedPlayers can still get the unmodified result
*/
@ModifyExpressionValue(
method = "method_56791", // lambda method in updateConnectedPlayers
at = @At(
value = "INVOKE",
target = "Ljava/util/Set;contains(Ljava/lang/Object;)Z",
remap = false
),
remap = true
)
private static boolean vaultBlacklistDisabled_everyoneCanConnectToAndActivateTheVault(boolean contains)
{
if (CarpetTISAdditionSettings.vaultBlacklistDisabled)
{
contains = false;
}
return contains;
}
}
15 changes: 15 additions & 0 deletions website/docs/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -1515,6 +1515,21 @@ Right before a powered activator / powered rail on a lapis ore setting its power
- Categories: `TIS`, `CREATIVE`


## vaultBlacklistDisabled

Disable functionalities related to the vault block's player blacklist

After enabling this rule:

1. When players open the vault, their UUIDs will not be added to the vault blacklist
2. Regardless of whether players are on the vault blacklist, they can activate or open the vault

- Type: `boolean`
- Default value: `false `
- Suggested options: `false`, `true`
- Categories: `TIS`, `CREATIVE`


## visualizeProjectileLoggerEnabled

Enable visualize projectile logger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1515,6 +1515,23 @@ TISCM网络协议的开关
- 分类: `TIS`, `CREATIVE`


## 禁用宝库黑名单 (vaultBlacklistDisabled)

禁用宝库方块实体中储存的玩家黑名单的相关功能

在本规则启用后:

1. 玩家开启宝库后,玩家的 UUID 不会被添加到宝库黑名单中
2. 无论玩家是否位于宝库黑名单中,玩家均可激活、开启宝库

试试 `/log projectiles visualize`

- 类型: `boolean`
- 默认值: `false`
- 参考选项: `false`, `true`
- 分类: `TIS`, `CREATIVE`


## 可视化投掷物记录器 (visualizeProjectileLoggerEnabled)

启用可视化投掷物记录器
Expand Down

0 comments on commit 4655413

Please sign in to comment.