Skip to content

Commit

Permalink
✅ 新增规则:fasterMovement
Browse files Browse the repository at this point in the history
  • Loading branch information
1024-byteeeee committed Aug 8, 2023
1 parent 2e3b4f9 commit 9dc4848
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 0 deletions.
10 changes: 10 additions & 0 deletions readme_folder/en_us/rules_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,16 @@ When enabled, Random teleportation by EnderMan is prohibited.
- Categroies: `AMS` , `FEATURE` , `EXPERIMENTAL`


## fasterMovement

Three gears are provided to allow players to move faster.

- Type: `String`
- Default: `VANILLA`
- Suggested options: `` , ``, ``, `VANILLA`
- Categroies: `AMS` , `FEATURE` , `EXPERIMENTAL`


## movableEnderChest

Ender chest can be moved by piston or sticky piston.
Expand Down
10 changes: 10 additions & 0 deletions readme_folder/rules_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,16 @@
- 分类: `AMS` , `FEATURE` , `EXPERIMENTAL`


## 更快移动 (fasterMovement)

提供了三个挡位,让玩家移动速度更快。

- 类型: `String`
- 默认值: `VANILLA`
- 参考选项: `` , ``, ``, `VANILLA`
- 分类: `AMS` , `FEATURE` , `EXPERIMENTAL`


## 可移动末地传送门框架(movableEndPortalFrame)

开启后,末地传送门框架可以被活塞/黏性活塞推动。
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/club/mcams/carpet/AmsServerSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ public class AmsServerSettings {
@Rule(categories = {AMS, FEATURE, EXPERIMENTAL})
public static boolean enderManTeleportRandomlyDisabled = false;

@Rule(
options = {"VANILLA", "Ⅰ", "Ⅱ", "Ⅲ"},
categories = {AMS, FEATURE, EXPERIMENTAL}
)
public static String fasterMovement = "VANILLA";

/**
* 可移动方块规则
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package club.mcams.carpet.mixin.rule.fasterMovement;

import club.mcams.carpet.AmsServerSettings;

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.CallbackInfoReturnable;

import java.util.Objects;

@Mixin(PlayerEntity.class)
public abstract class PlayerEntityMixin {
@Inject(method = "getMovementSpeed", at = @At("HEAD"), cancellable = true)
public void getMovementSpeed(CallbackInfoReturnable<Float> cir) {
if (Objects.equals(AmsServerSettings.fasterMovement, "Ⅰ")) {
cir.setReturnValue(0.2F);
} else if (Objects.equals(AmsServerSettings.fasterMovement, "Ⅱ")) {
cir.setReturnValue(0.3F);
} else if (Objects.equals(AmsServerSettings.fasterMovement, "Ⅲ")) {
cir.setReturnValue(0.4F);
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/amscarpet.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"rule.enderManTeleportRandomlyDisabled.EndermanEntityMixin",
"rule.extinguishedCampfire_campfireSmokeParticleDisabled.GetPlacementStateMixin",
"rule.fakePeace.AbstractBlockStateMixin",
"rule.fasterMovement.PlayerEntityMixin",
"rule.infiniteTrades.MerchantEntityMixin",
"rule.kirinArm.AbstractBlockStateMixin",
"rule.largeEnderChest.EnderChestBlockMixin",
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/assets/carpetamsaddition/lang/en_us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ carpetamsaddition:
enderManTeleportRandomlyDisabled:
name: enderManTeleportRandomlyDisabled
desc: Random teleportation by EnderMan is prohibited
fasterMovement:
name: fasterMovement
desc: Three gears are provided to allow players to move faster
extra:
'': '[Ⅰ]'
'': '[Ⅱ]'
'': '[Ⅲ]'
'VANILLA': '[VANILLA]'

# 计划刻催熟规则:
scheduledRandomTickCactus:
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/assets/carpetamsaddition/lang/zh_cn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ carpetamsaddition:
enderManTeleportRandomlyDisabled:
name: 禁止末影人随机传送
desc: 禁止末影人随机传送
fasterMovement:
name: 快速移动
desc: 提供了三个挡位让玩家移动速度变快
extra:
'': '[Ⅰ]'
'': '[Ⅱ]'
'': '[Ⅲ]'
'VANILLA': '[VANILLA]'

# 计划刻催熟规则:
scheduledRandomTickCactus:
Expand Down

0 comments on commit 9dc4848

Please sign in to comment.