Skip to content

Commit c46db2b

Browse files
committed
1.3.6, closes #78, closes #77
1 parent e13bff1 commit c46db2b

16 files changed

Lines changed: 68 additions & 8 deletions

File tree

CHANGELOG-LATEST.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
### Added
2+
3+
- Added new "item only" config option to fully disable mod behaviour.
4+
5+
### Fixed
6+
7+
- Fixed shield cooldown not working properly.

CHANGELOG.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
* Fix server config syncing.
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.3.6] - 2026-02-09
9+
10+
### Added
11+
12+
- Added new "item only" config option to fully disable mod behaviour.
13+
14+
### Fixed
15+
16+
- Fixed shield cooldown not working properly.

common/src/main/java/org/infernalstudios/shieldexp/compat/BetterCombatAttackListener.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ public class BetterCombatAttackListener {
1010

1111
public static void register() {
1212
BetterCombatClientEvents.ATTACK_START.register((player, hand) -> {
13+
if (ShieldExpansionConfig.ITEM_ONLY_MODE) return;
14+
1315
Item item = player.getOffhandItem().getItem();
1416
if (ShieldExpansionConfig.isShield(item)) {
1517
Services.NETWORK.sendToServer(new SyncBlocking(player.getUUID(), false));

common/src/main/java/org/infernalstudios/shieldexp/config/ClothConfigIntegration.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ public static Screen createScreen(Screen parent) {
4444
.setSaveConsumer(list -> ShieldExpansionConfig.SHIELD_BLACKLIST = list)
4545
.build());
4646

47+
modifiers.addEntry(entryBuilder.startBooleanToggle(Component.translatable("config.shieldexp.option.item_only_mode"), ShieldExpansionConfig.ITEM_ONLY_MODE)
48+
.setDefaultValue(false)
49+
.setTooltip(Component.translatable("config.shieldexp.tooltip.item_only_mode"))
50+
.setSaveConsumer(newValue -> ShieldExpansionConfig.ITEM_ONLY_MODE = newValue)
51+
.build());
52+
4753
modifiers.addEntry(entryBuilder.startBooleanToggle(Component.translatable("config.shieldexp.option.lowering_cooldown"), ShieldExpansionConfig.STASHING_COOLDOWN)
4854
.setDefaultValue(true)
4955
.setTooltip(Component.translatable("config.shieldexp.tooltip.lowering_cooldown"))

common/src/main/java/org/infernalstudios/shieldexp/config/ShieldExpansionConfig.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public class ShieldExpansionConfig {
2121
public static List<String> SHIELD_LIST = new ArrayList<>();
2222
public static List<String> SHIELD_BLACKLIST = new ArrayList<>();
2323

24+
public static boolean ITEM_ONLY_MODE = false;
25+
2426
public static boolean TOOLTIPS = true;
2527

2628
public static boolean TOOLTIP_COOLDOWN = true;
@@ -54,6 +56,7 @@ public static void load() {
5456
if (data != null) {
5557
SHIELD_LIST = data.shieldList;
5658
SHIELD_BLACKLIST = data.shieldBlacklist;
59+
ITEM_ONLY_MODE = data.itemOnlyMode;
5760
STASHING_COOLDOWN = data.stashingCooldown;
5861
GENERAL_COOLDOWN = data.generalCooldown;
5962
SPEED_MODIFICATION = data.speedModification;
@@ -77,6 +80,7 @@ public static void save() {
7780
ConfigData data = new ConfigData();
7881
data.shieldList = SHIELD_LIST;
7982
data.shieldBlacklist = SHIELD_BLACKLIST;
83+
data.itemOnlyMode = ITEM_ONLY_MODE;
8084
data.stashingCooldown = STASHING_COOLDOWN;
8185
data.generalCooldown = GENERAL_COOLDOWN;
8286
data.speedModification = SPEED_MODIFICATION;
@@ -141,6 +145,7 @@ public static Boolean lenientStaminaEnabled() {
141145
private static class ConfigData {
142146
List<String> shieldList = new ArrayList<>();
143147
List<String> shieldBlacklist = new ArrayList<>();
148+
boolean itemOnlyMode = false;
144149
boolean stashingCooldown = true;
145150
boolean generalCooldown = true;
146151
boolean speedModification = true;

common/src/main/java/org/infernalstudios/shieldexp/events/FovEvents.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
55
import net.minecraft.world.entity.ai.attributes.Attributes;
66
import net.minecraft.world.entity.player.Player;
7+
import org.infernalstudios.shieldexp.config.ShieldExpansionConfig;
78

89
public class FovEvents {
910

1011
public static float onComputeFov(Player player, float currentFovModifier) {
12+
if (ShieldExpansionConfig.ITEM_ONLY_MODE) return currentFovModifier;
13+
1114
AttributeInstance speedAttribute = player.getAttribute(Attributes.MOVEMENT_SPEED);
1215
if (speedAttribute != null) {
1316
AttributeModifier shieldMod = speedAttribute.getModifier(ShieldEvents.SPEED_MODIFIER_ID);

common/src/main/java/org/infernalstudios/shieldexp/events/ShieldEvents.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public class ShieldEvents {
3333
public static final UUID SPEED_MODIFIER_ID = UUID.fromString("3c1b8a2e-3c62-4f5c-9e9a-5b92fcae4d2c");
3434

3535
public static boolean onStartUsing(Entity entity, ItemStack stack) {
36+
if (ShieldExpansionConfig.ITEM_ONLY_MODE) return false;
37+
3638
Item item = stack.getItem();
3739
if (entity instanceof Player player && player.getCooldowns().isOnCooldown(item)) {
3840
return true;
@@ -63,6 +65,8 @@ public static boolean onStartUsing(Entity entity, ItemStack stack) {
6365
}
6466

6567
public static void onStopUsing(Entity entity, ItemStack stack) {
68+
if (ShieldExpansionConfig.ITEM_ONLY_MODE) return;
69+
6670
Item item = stack.getItem();
6771
if (entity instanceof Player player && ShieldExpansionConfig.isShield(item)) {
6872
removeBlocking(player);
@@ -72,6 +76,8 @@ public static void onStopUsing(Entity entity, ItemStack stack) {
7276
}
7377

7478
public static void onUseTick(Entity entity, ItemStack stack) {
79+
if (ShieldExpansionConfig.ITEM_ONLY_MODE) return;
80+
7581
Item item = stack.getItem();
7682
if (entity instanceof Player player && ShieldExpansionConfig.isShield(item) && LivingEntityAccess.get(player).getBlocking() && player.attackAnim > 0) {
7783
removeBlocking(player);
@@ -82,6 +88,8 @@ public static void onUseTick(Entity entity, ItemStack stack) {
8288
}
8389

8490
public static void onPlayerTick(Player player) {
91+
if (ShieldExpansionConfig.ITEM_ONLY_MODE) return;
92+
8593
Item item = player.getUseItem().getItem();
8694
Item lastShield = LivingEntityAccess.get(player).getLastShield().getItem();
8795

@@ -104,6 +112,8 @@ public static void onPlayerTick(Player player) {
104112
}
105113

106114
public static boolean onLivingHurt(LivingEntity entity, DamageSource source, float amount) {
115+
if (ShieldExpansionConfig.ITEM_ONLY_MODE) return false;
116+
107117
if (!(entity instanceof Player player)) return false;
108118

109119
if (validateBlocking(player) && (source.getMsgId().equals("player") || source.getMsgId().equals("mob"))) {
@@ -194,6 +204,8 @@ private static void handleExplosion(Player player, DamageSource source, float am
194204
}
195205

196206
public static boolean onProjectileImpact(Entity entity, Entity projectile) {
207+
if (ShieldExpansionConfig.ITEM_ONLY_MODE) return false;
208+
197209
if (entity instanceof Player player && validateBlocking(player)) {
198210
Item item = player.getUseItem().getItem();
199211
player.level().playSound(null, player.getOnPos(), SoundEvents.SHIELD_BLOCK, SoundSource.HOSTILE, 1.0f, 1.0f);

common/src/main/java/org/infernalstudios/shieldexp/events/TooltipEvents.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
public class TooltipEvents {
1313
public static void addTooltip(ItemStack stack, Player player, List<Component> tooltip) {
14+
if (ShieldExpansionConfig.ITEM_ONLY_MODE) return;
15+
1416
Item item = stack.getItem();
1517
if (player != null && ShieldExpansionConfig.isShield(item) && ShieldExpansionConfig.TOOLTIPS) {
1618
tooltip.add(Component.literal(" "));

common/src/main/java/org/infernalstudios/shieldexp/network/SyncConfig.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import org.infernalstudios.shieldexp.config.ShieldExpansionConfig;
66

77
public class SyncConfig implements IPacket {
8+
private final boolean itemOnlyMode;
89
private final boolean stashingCooldown;
910
private final boolean generalCooldown;
1011
private final boolean speedModification;
@@ -13,6 +14,7 @@ public class SyncConfig implements IPacket {
1314
private final boolean lenientStamina;
1415

1516
public SyncConfig() {
17+
this.itemOnlyMode = ShieldExpansionConfig.ITEM_ONLY_MODE;
1618
this.stashingCooldown = ShieldExpansionConfig.STASHING_COOLDOWN;
1719
this.generalCooldown = ShieldExpansionConfig.GENERAL_COOLDOWN;
1820
this.speedModification = ShieldExpansionConfig.SPEED_MODIFICATION;
@@ -22,6 +24,7 @@ public SyncConfig() {
2224
}
2325

2426
public SyncConfig(FriendlyByteBuf buf) {
27+
this.itemOnlyMode = buf.readBoolean();
2528
this.stashingCooldown = buf.readBoolean();
2629
this.generalCooldown = buf.readBoolean();
2730
this.speedModification = buf.readBoolean();
@@ -32,6 +35,7 @@ public SyncConfig(FriendlyByteBuf buf) {
3235

3336
@Override
3437
public void encode(FriendlyByteBuf buf) {
38+
buf.writeBoolean(itemOnlyMode);
3539
buf.writeBoolean(stashingCooldown);
3640
buf.writeBoolean(generalCooldown);
3741
buf.writeBoolean(speedModification);
@@ -43,6 +47,7 @@ public void encode(FriendlyByteBuf buf) {
4347
@Override
4448
public void handle(Player player) {
4549
if (player.level().isClientSide || player.hasPermissions(2)) {
50+
ShieldExpansionConfig.ITEM_ONLY_MODE = this.itemOnlyMode;
4651
ShieldExpansionConfig.STASHING_COOLDOWN = this.stashingCooldown;
4752
ShieldExpansionConfig.GENERAL_COOLDOWN = this.generalCooldown;
4853
ShieldExpansionConfig.SPEED_MODIFICATION = this.speedModification;

common/src/main/resources/assets/shieldexp/lang/en_us.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
"config.shieldexp.option.cooldown": "Shield Cooldowns",
1616
"config.shieldexp.tooltip.cooldown": "Enable shield cooldowns mechanisms.",
1717

18+
"config.shieldexp.option.item_only_mode": "Item Only Mode",
19+
"config.shieldexp.tooltip.item_only_mode": "Disable all Shield Expansion behaviour (for use with other shield mods like Guarding).",
20+
1821
"config.shieldexp.option.speed_modifier": "Speed Adjustment",
1922
"config.shieldexp.tooltip.speed_modifier": "Enable the speed adjustment to make blocking faster (reduces the vanilla movement penalty).",
2023

0 commit comments

Comments
 (0)