feat: trialSpawnerCD

This commit is contained in:
zly2006 committed 2025-09-02 09:17:44 +08:00
1 parent 74e9ccd687
commit caa65d1ba7
10 files changed
+75 -15

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
plugins { plugins {
id 'fabric-loom' version '1.9.2' id 'fabric-loom' version '1.10.5'
id 'maven-publish' id 'maven-publish'
} }
+9 -12
View File
@@ -2,17 +2,14 @@
org.gradle.jvmargs=-Xmx3G org.gradle.jvmargs=-Xmx3G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/develop # check these on https://fabricmc.net/develop
minecraft_version=1.21 minecraft_version=1.21
yarn_mappings=1.21+build.9 yarn_mappings=1.21+build.9
loader_version=0.15.11 loader_version=0.15.11
# Mod Properties # Mod Properties
mod_version = 0.22 mod_version = 0.23
maven_group = com.github.zly2006 maven_group = com.github.zly2006
archives_base_name = carpet-sls-addition archives_base_name = carpet-sls-addition
# Dependencies # Dependencies
fabric_version=0.102.0+1.21 fabric_version=0.102.0+1.21
carpet_core_version=1.21-1.4.147+v240613 carpet_core_version=1.21-1.4.147+v240613
+1 -1
View File
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
@@ -65,4 +65,7 @@ public class SLSCarpetSettings {
@Rule(categories = {SLSA, RuleCategory.FEATURE}) @Rule(categories = {SLSA, RuleCategory.FEATURE})
public static int netherPortalSize = 21; public static int netherPortalSize = 21;
@Rule(categories = {SLSA, RuleCategory.FEATURE})
public static int trialSpawnerCD = -1;
} }
@@ -0,0 +1,27 @@
package com.github.zly2006.carpetslsaddition.mixin.block;
import com.github.zly2006.carpetslsaddition.SLSCarpetSettings;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.block.spawner.TrialSpawnerConfig;
import net.minecraft.block.spawner.TrialSpawnerData;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@Mixin(TrialSpawnerData.class)
public class MixinTrialSpawnerData {
@WrapOperation(
method = "resetAndClearMobs",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/spawner/TrialSpawnerConfig;getCooldownLength()J"
)
)
private long hackCooldown(TrialSpawnerConfig instance, Operation<Integer> original) {
if (SLSCarpetSettings.trialSpawnerCD < 0) {
return original.call(instance);
} else {
return SLSCarpetSettings.trialSpawnerCD;
}
}
}
@@ -0,0 +1,28 @@
package com.github.zly2006.carpetslsaddition.mixin.block;
import com.github.zly2006.carpetslsaddition.SLSCarpetSettings;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.block.enums.TrialSpawnerState;
import net.minecraft.block.spawner.TrialSpawnerLogic;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@Mixin(TrialSpawnerState.class)
public class MixinTrialSpawnerState {
@WrapOperation(
method = "tick",
at = @At(
value = "INVOKE",
ordinal = 0,
target = "Lnet/minecraft/block/spawner/TrialSpawnerLogic;getCooldownLength()I"
)
)
private int tick(TrialSpawnerLogic instance, Operation<Integer> original) {
if (SLSCarpetSettings.trialSpawnerCD < 0) {
return original.call(instance);
} else {
return SLSCarpetSettings.trialSpawnerCD;
}
}
}
@@ -50,6 +50,7 @@
"carpet.rule.spectatorCannotUseLeash.desc": "If a player is a spectator, they cannot use the leash.", "carpet.rule.spectatorCannotUseLeash.desc": "If a player is a spectator, they cannot use the leash.",
"carpet.rule.offlineFakePlayers.desc": "假人强制离线uuid", "carpet.rule.offlineFakePlayers.desc": "假人强制离线uuid",
"carpet.rule.armadilloImmediateDespawns.desc": "Armadillos will despawn immediately if they are 128 blocks away from the player.", "carpet.rule.armadilloImmediateDespawns.desc": "Armadillos will despawn immediately if they are 128 blocks away from the player.",
"carpet.rule.trialSpawnerCD.desc": "trialSpawnerCD.",
"carpet.rule.skipTicksForJoblessVillager.extra.0": "Set to 0 to maintain the vanilla behavior", "carpet.rule.skipTicksForJoblessVillager.extra.0": "Set to 0 to maintain the vanilla behavior",
"carpet.rule.skipTicksForJoblessVillager.extra.1": "Set to a number greater than 0, the value will be +1 based on the setting", "carpet.rule.skipTicksForJoblessVillager.extra.1": "Set to a number greater than 0, the value will be +1 based on the setting",
@@ -50,6 +50,7 @@
"carpet.rule.botMaxOnlineTime.desc": "设置由Carpet SLS Addition生成的Bot的最大存活时间", "carpet.rule.botMaxOnlineTime.desc": "设置由Carpet SLS Addition生成的Bot的最大存活时间",
"carpet.rule.offlineFakePlayers.desc": "假人强制离线uuid", "carpet.rule.offlineFakePlayers.desc": "假人强制离线uuid",
"carpet.rule.spectatorCannotUseLeash.desc": "若启用,则观察者模式的玩家不再能使用拴绳,已经拴住动物的拴绳也会自动失效", "carpet.rule.spectatorCannotUseLeash.desc": "若启用,则观察者模式的玩家不再能使用拴绳,已经拴住动物的拴绳也会自动失效",
"carpet.rule.trialSpawnerCD.desc": "trialSpawnerCD.",
"carpet.rule.skipTicksForJoblessVillager.extra.0": "设置为0则保持原版行为", "carpet.rule.skipTicksForJoblessVillager.extra.0": "设置为0则保持原版行为",
"carpet.rule.skipTicksForJoblessVillager.extra.1": "设置为大于0的数,将在设置的基础上将该值+1", "carpet.rule.skipTicksForJoblessVillager.extra.1": "设置为大于0的数,将在设置的基础上将该值+1",
+2 -1
View File
@@ -2,4 +2,5 @@ accessWidener v1 named
accessible class net/minecraft/world/block/ChainRestrictedNeighborUpdater$Entry accessible class net/minecraft/world/block/ChainRestrictedNeighborUpdater$Entry
accessible class net/minecraft/entity/mob/EndermanEntity$PickUpBlockGoal accessible class net/minecraft/entity/mob/EndermanEntity$PickUpBlockGoal
accessible method net/minecraft/entity/Entity unsetRemoved ()V accessible method net/minecraft/entity/Entity unsetRemoved ()V
accessible field net/minecraft/entity/player/PlayerEntity PLAYER_MODEL_PARTS Lnet/minecraft/entity/data/TrackedData; accessible field net/minecraft/entity/player/PlayerEntity PLAYER_MODEL_PARTS Lnet/minecraft/entity/data/TrackedData;
accessible field net/minecraft/block/spawner/TrialSpawnerData spawnedMobsAlive Ljava/util/Set;
@@ -9,6 +9,8 @@
"block.BlockPatternTestTransformInvoker", "block.BlockPatternTestTransformInvoker",
"block.MixinNetherPortal", "block.MixinNetherPortal",
"block.MixinRedstoneWireBlock", "block.MixinRedstoneWireBlock",
"block.MixinTrialSpawnerData",
"block.MixinTrialSpawnerState",
"carpet.MixinEntityPlayerMPFake", "carpet.MixinEntityPlayerMPFake",
"carpet.MixinPlayerCommand", "carpet.MixinPlayerCommand",
"datapack.MixinVanillaResourcePackProvider", "datapack.MixinVanillaResourcePackProvider",