Skip to content

Commit

Permalink
✅ 新增两个规则
Browse files Browse the repository at this point in the history
  • Loading branch information
1024-byteeeee committed Apr 9, 2024
1 parent a70c693 commit 058ca6b
Show file tree
Hide file tree
Showing 7 changed files with 269 additions and 63 deletions.
142 changes: 79 additions & 63 deletions src/main/java/club/mcams/carpet/AmsServerSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* This file is part of the Carpet AMS Addition project, licensed under the
* GNU Lesser General Public License v3.0
*
* Copyright (C) 2023 A Minecraft Server and contributors
* Copyright (C) 2024 A Minecraft Server and contributors
*
* Carpet AMS 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
Expand All @@ -11,11 +11,11 @@
*
* Carpet AMS 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
* 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 AMS Addition. If not, see <https://www.gnu.org/licenses/>.
* along with Carpet AMS Addition. If not, see <https://www.gnu.org/licenses/>.
*/

package club.mcams.carpet;
Expand All @@ -28,6 +28,9 @@
import club.mcams.carpet.validators.rule.commandPlayerChunkLoadController.MaxRangeValidator;
import club.mcams.carpet.validators.rule.enhancedWorldEater.BlastResistanceValidator;
import club.mcams.carpet.validators.rule.maxClientInteractionReachDistance.MaxClientInteractionReachDistanceValidator;
//#if MC>=12000
//$$ import club.mcams.carpet.validators.rule.easyGetPitcherPod.CountValidator;
//#endif

import club.mcams.carpet.settings.CraftingRule;
import club.mcams.carpet.settings.Rule;
Expand Down Expand Up @@ -80,9 +83,9 @@ public class AmsServerSettings {
public static boolean safeFlight = false;

@Rule(
options = {"none", "minecraft:bone_block", "minecraft:diamond_ore", "minecraft:magma_block"},
categories = {AMS, FEATURE},
strict = false
options = {"none", "minecraft:bone_block", "minecraft:diamond_ore", "minecraft:magma_block"},
categories = {AMS, FEATURE},
strict = false
)
public static String customBlockUpdateSuppressor = "none";

Expand Down Expand Up @@ -132,8 +135,8 @@ public class AmsServerSettings {
public static boolean endermanTeleportRandomlyDisabled = false;

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

Expand All @@ -144,8 +147,8 @@ public class AmsServerSettings {
public static boolean easyWitherSkeletonSkullDrop = false;

@Rule(
options = {"0", "1", "2", "3", "4", "ops", "true", "false"},
categories = {AMS, FEATURE, SURVIVAL, COMMAND}
options = {"0", "1", "2", "3", "4", "ops", "true", "false"},
categories = {AMS, FEATURE, SURVIVAL, COMMAND}
)
public static String commandAnvilInteractionDisabled = "false";

Expand Down Expand Up @@ -174,56 +177,56 @@ public class AmsServerSettings {
public static boolean largeShulkerBox = false;

@Rule(
options = {"-1"},
categories = {AMS, FEATURE, SURVIVAL},
validators = MaxPlayerBlockInteractionRangeValidator.class,
strict = false
options = {"-1"},
categories = {AMS, FEATURE, SURVIVAL},
validators = MaxPlayerBlockInteractionRangeValidator.class,
strict = false
)
public static double maxPlayerBlockInteractionRange = -1.0D;

@Rule(
options = {"-1"},
categories = {AMS, FEATURE, SURVIVAL},
validators = MaxPlayerEntityInteractionRangeValidator.class,
strict = false
options = {"-1"},
categories = {AMS, FEATURE, SURVIVAL},
validators = MaxPlayerEntityInteractionRangeValidator.class,
strict = false
)
public static double maxPlayerEntityInteractionRange = -1.0D;

//#if MC<12005
@GameVersion(version = "Minecraft < 1.20.5", desc = "1.20.5后或许不再需要这个功能?")
@Rule(
options = {"-1"},
categories = {AMS, FEATURE, SURVIVAL},
validators = MaxClientInteractionReachDistanceValidator.class,
strict = false
options = {"-1"},
categories = {AMS, FEATURE, SURVIVAL},
validators = MaxClientInteractionReachDistanceValidator.class,
strict = false
)
public static double maxClientInteractionReachDistance = -1.0D;
//#endif

@Rule(
options = {"VANILLA", "minecraft:bedrock", "minecraft:bedrock,minecraft:obsidian"},
categories = {AMS, FEATURE},
strict = false
options = {"VANILLA", "minecraft:bedrock", "minecraft:bedrock,minecraft:obsidian"},
categories = {AMS, FEATURE},
strict = false
)
public static String customMovableBlock = "VANILLA";

@Rule(categories = {AMS, FEATURE})
public static boolean easyMaxLevelBeacon = false;

@Rule(
options = {"0", "1", "2", "3", "4", "ops", "true", "false"},
categories = {AMS, FEATURE, SURVIVAL, TNT, COMMAND}
options = {"0", "1", "2", "3", "4", "ops", "true", "false"},
categories = {AMS, FEATURE, SURVIVAL, TNT, COMMAND}
)
public static String commandCustomBlockBlastResistance = "false";

@Rule(categories = {AMS, FEATURE})
public static boolean regeneratingDragonEgg = false;

@Rule(
options = {"-1"},
categories = {AMS, SURVIVAL, FEATURE, TNT},
validators = BlastResistanceValidator.class,
strict = false
options = {"-1"},
categories = {AMS, SURVIVAL, FEATURE, TNT},
validators = BlastResistanceValidator.class,
strict = false
)
public static double enhancedWorldEater = -1.0D;

Expand All @@ -249,8 +252,8 @@ public class AmsServerSettings {
public static boolean useItemCooldownDisabled = false;

@Rule(
options = {"0", "1", "2", "3", "4", "5"},
categories = {AMS, FEATURE, SURVIVAL}
options = {"0", "1", "2", "3", "4", "5"},
categories = {AMS, FEATURE, SURVIVAL}
)
public static int flippinCactusSoundEffect = 0;

Expand All @@ -267,9 +270,9 @@ public class AmsServerSettings {
public static boolean easyMineDragonEgg = false;

@Rule(
options = {"none", "apple", "stone"},
categories = {AMS, FEATURE},
strict = false
options = {"none", "apple", "stone"},
categories = {AMS, FEATURE},
strict = false
)
public static String breedableParrots = "none";

Expand All @@ -291,35 +294,35 @@ public class AmsServerSettings {
//#endif

@Rule(
options = {"0", "1", "2", "3", "4", "ops", "true", "false"},
categories = {AMS, COMMAND}
options = {"0", "1", "2", "3", "4", "ops", "true", "false"},
categories = {AMS, COMMAND}
)
public static String commandHere = "false";

@Rule(
options = {"0", "1", "2", "3", "4", "ops", "true", "false"},
categories = {AMS, COMMAND}
options = {"0", "1", "2", "3", "4", "ops", "true", "false"},
categories = {AMS, COMMAND}
)
public static String commandWhere = "false";

@Rule(
options = {"MainHandOnly", "NoPickUp", "false"},
categories = {AMS, FEATURE, SURVIVAL}
options = {"MainHandOnly", "NoPickUp", "false"},
categories = {AMS, FEATURE, SURVIVAL}
)
public static String fakePlayerPickUpController = "false";

@Rule(categories = {AMS, FEATURE, SURVIVAL})
public static boolean sneakToEatCake = false;

@Rule(
options = {"0", "1", "2", "3", "4", "ops", "true", "false"},
categories = {AMS, COMMAND}
options = {"0", "1", "2", "3", "4", "ops", "true", "false"},
categories = {AMS, COMMAND}
)
public static String commandPlayerLeader = "false";

@Rule(
options = {"0", "1", "2", "3", "4", "ops", "true", "false"},
categories = {AMS, COMMAND}
options = {"0", "1", "2", "3", "4", "ops", "true", "false"},
categories = {AMS, COMMAND}
)
public static String commandPacketInternetGroper = "false";

Expand All @@ -333,8 +336,8 @@ public class AmsServerSettings {
public static boolean welcomeMessage = false;

@Rule(
options = {"0", "1", "2", "3", "4", "ops", "true", "false"},
categories = {AMS, COMMAND}
options = {"0", "1", "2", "3", "4", "ops", "true", "false"},
categories = {AMS, COMMAND}
)
public static String commandGetSaveSize = "false";

Expand All @@ -359,23 +362,36 @@ public class AmsServerSettings {
public static boolean foliageGenerateDisabled = false;

@Rule(
options = {"0", "1", "2", "3", "4", "ops", "true", "false"},
categories = {AMS, COMMAND}
options = {"0", "1", "2", "3", "4", "ops", "true", "false"},
categories = {AMS, COMMAND}
)
public static String commandGetSystemInfo = "false";

@Rule(categories = {AMS, FEATURE, SURVIVAL})
public static boolean ironGolemNoDropFlower = false;

//#if MC>=12000
//$$ @Rule(
//$$ options = {"0"},
//$$ categories = {AMS, FEATURE, SURVIVAL},
//$$ validators = CountValidator.class,
//$$ strict = false
//$$ )
//$$ public static int easyGetPitcherPod = 0;
//#endif

/*
* 区块加载规则
*/
@Rule(
options = {"bone_block", "wither_skeleton_skull", "note_block", "false"},
categories = {AMS, FEATURE, AMS_CHUNKLOADER}
options = {"bone_block", "wither_skeleton_skull", "note_block", "false"},
categories = {AMS, FEATURE, AMS_CHUNKLOADER}
)
public static String noteBlockChunkLoader = "false";

@Rule(
options = {"bone_block", "bedrock", "all", "false"},
categories = {AMS, FEATURE, AMS_CHUNKLOADER}
options = {"bone_block", "bedrock", "all", "false"},
categories = {AMS, FEATURE, AMS_CHUNKLOADER}
)
public static String pistonBlockChunkLoader = "false";

Expand All @@ -389,26 +405,26 @@ public class AmsServerSettings {
public static boolean keepWorldTickUpdate = false;

@Rule(
options = {"300"},
categories = {AMS, FEATURE, AMS_CHUNKLOADER},
validators = MaxTimeValidator.class,
strict = false
options = {"300"},
categories = {AMS, FEATURE, AMS_CHUNKLOADER},
validators = MaxTimeValidator.class,
strict = false
)
public static int blockChunkLoaderTimeController = 300;

@Rule(
options = {"3"},
categories = {AMS, FEATURE, AMS_CHUNKLOADER},
validators = MaxRangeValidator.class,
strict = false
options = {"3"},
categories = {AMS, FEATURE, AMS_CHUNKLOADER},
validators = MaxRangeValidator.class,
strict = false
)
public static int blockChunkLoaderRangeController = 3;

@Rule(categories = {AMS, COMMAND, AMS_CHUNKLOADER})
public static boolean commandPlayerChunkLoadController = false;

/*
* 合成表规则
* 合成表规�?
*/
@SuppressWarnings("unused")
@CraftingRule(recipes = "enchanted_golden_apples.json")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* This file is part of the Carpet AMS Addition project, licensed under the
* GNU Lesser General Public License v3.0
*
* Copyright (C) 2024 A Minecraft Server and contributors
*
* Carpet AMS 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 AMS 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 AMS Addition. If not, see <https://www.gnu.org/licenses/>.
*/

package club.mcams.carpet.mixin.rule.easyGetPitcherPod;

import top.byteeeee.annotationtoolbox.annotation.GameVersion;

//#if MC>=12000
//$$ import club.mcams.carpet.AmsServerSettings;
//$$ import net.minecraft.block.Block;
//$$ import net.minecraft.block.BlockState;
//$$ import net.minecraft.block.Blocks;
//$$ import net.minecraft.entity.player.PlayerEntity;
//$$ import net.minecraft.item.ItemStack;
//$$ import net.minecraft.item.Items;
//$$ import net.minecraft.util.math.BlockPos;
//$$ import net.minecraft.world.World;
//$$ 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.Random;
//$$ import static net.minecraft.block.Block.dropStack;
//#else
import club.mcams.carpet.utils.compat.DummyClass;
//#endif

import org.spongepowered.asm.mixin.Mixin;

@GameVersion(version = "Minecraft >= 1.20")
//#if MC>=12000
//$$ @Mixin(Block.class)
//$$ public abstract class BlockMixin {
//$$ @Inject(method = "onBreak", at = @At("HEAD"))
//$$ private void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player, CallbackInfoReturnable<BlockState> cir) {
//$$ if (AmsServerSettings.easyGetPitcherPod != 0 && state.getBlock().equals(Blocks.PITCHER_CROP)) {
//$$ if (!player.isCreative()) {
//$$ Random random = new Random();
//$$ int minDrops = 2;
//$$ int maxDrops = AmsServerSettings.easyGetPitcherPod;
//$$ int dropCount = minDrops + random.nextInt(maxDrops - minDrops + 1);
//$$ for (int i = 0; i < dropCount; i++) {
//$$ ItemStack cakeStack = new ItemStack(Items.PITCHER_POD);
//$$ dropStack(world, pos, cakeStack);
//$$ }
//$$ }
//$$ }
//$$ }
//$$ }
//#else
@Mixin(DummyClass.class)
public abstract class BlockMixin {}
//#endif
Loading

0 comments on commit 058ca6b

Please sign in to comment.