Skip to content

Commit 30afd17

Browse files
committed
Add CombatModule#DISABLE_BLOCK_MISS_PENALTY
1 parent c081a26 commit 30afd17

6 files changed

Lines changed: 59 additions & 0 deletions

File tree

api/src/main/java/com/lunarclient/apollo/module/combat/CombatModule.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,22 @@ public final class CombatModule extends ApolloModule {
5252
.node("disable-miss-penalty").type(TypeToken.get(Boolean.class))
5353
.defaultValue(false).notifyClient().build();
5454

55+
/**
56+
* Whether the player gets a hit delay for a missed hit while
57+
* targeting a block. Applies to all versions 1.8 and above.
58+
*
59+
* <p>Enabling this option may cause compatibility issues with anti-cheats.</p>
60+
*
61+
* @since 1.2.8
62+
*/
63+
public static final SimpleOption<Boolean> DISABLE_BLOCK_MISS_PENALTY = Option.<Boolean>builder()
64+
.comment(
65+
"Set to 'true' to remove the miss penalty when targeting a block on all versions 1.8 and above, otherwise 'false'.",
66+
"Enabling this option may cause compatibility issues with anti-cheats."
67+
)
68+
.node("disable-block-miss-penalty").type(TypeToken.get(Boolean.class))
69+
.defaultValue(false).notifyClient().build();
70+
5571
/**
5672
* Whether the player can dig and use an item at the same time,
5773
* like in 1.7. Applies to all versions 1.8 and above.
@@ -71,6 +87,7 @@ public final class CombatModule extends ApolloModule {
7187
CombatModule() {
7288
this.registerOptions(
7389
CombatModule.DISABLE_MISS_PENALTY,
90+
CombatModule.DISABLE_BLOCK_MISS_PENALTY,
7491
CombatModule.ALLOW_DIG_AND_USE
7592
);
7693
}

docs/developers/lightweight/json/packet-util.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ static {
3535
// While using the Apollo plugin this would be equivalent to modifying the config.yml
3636
CONFIG_MODULE_PROPERTIES.put("colored_fire", "persist-colors-on-unload", false);
3737
CONFIG_MODULE_PROPERTIES.put("combat", "disable-miss-penalty", false);
38+
CONFIG_MODULE_PROPERTIES.put("combat", "disable-block-miss-penalty", false);
3839
CONFIG_MODULE_PROPERTIES.put("combat", "allow-dig-and-use", false);
3940
CONFIG_MODULE_PROPERTIES.put("packet_enrichment", "player-attack.send-packet", false);
4041
CONFIG_MODULE_PROPERTIES.put("packet_enrichment", "player-chat-open.send-packet", false);

docs/developers/lightweight/protobuf/packet-util.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ static {
3535
// While using the Apollo plugin this would be equivalent to modifying the config.yml
3636
CONFIG_MODULE_PROPERTIES.put("colored_fire", "persist-colors-on-unload", Value.newBuilder().setBoolValue(false).build());
3737
CONFIG_MODULE_PROPERTIES.put("combat", "disable-miss-penalty", Value.newBuilder().setBoolValue(false).build());
38+
CONFIG_MODULE_PROPERTIES.put("combat", "disable-block-miss-penalty", Value.newBuilder().setBoolValue(false).build());
3839
CONFIG_MODULE_PROPERTIES.put("combat", "allow-dig-and-use", Value.newBuilder().setBoolValue(false).build());
3940
CONFIG_MODULE_PROPERTIES.put("packet_enrichment", "player-attack.send-packet", Value.newBuilder().setBoolValue(false).build());
4041
CONFIG_MODULE_PROPERTIES.put("packet_enrichment", "player-chat-open.send-packet", Value.newBuilder().setBoolValue(false).build());

docs/developers/modules/combat.mdx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Callout, Tab, Tabs } from 'nextra-theme-docs'
77
The combat module allows you to modify certain aspects of combat that are usually handled client-sided.
88

99
- Adds the ability to disable the miss penalty, on all versions 1.8 and above.
10+
- Adds the ability to disable the miss penalty when targeting a block, on all versions 1.8 and above.
1011
- Adds the ability to dig and use an item at the same time, like in 1.7, on all versions 1.8 and above.
1112

1213
### Sample Code
@@ -28,6 +29,14 @@ public void setDisableMissPenalty(boolean value) {
2829
}
2930
```
3031

32+
### Toggle Block Miss Penalty
33+
34+
```java
35+
public void setDisableBlockMissPenalty(boolean value) {
36+
this.combatModule.getOptions().set(CombatModule.DISABLE_BLOCK_MISS_PENALTY, value);
37+
}
38+
```
39+
3140
### Toggle Dig and Use
3241

3342
```java
@@ -56,6 +65,18 @@ public void setDisableMissPenalty(boolean value) {
5665
}
5766
```
5867

68+
**Toggle Block Miss Penalty**
69+
70+
```java
71+
public void setDisableBlockMissPenalty(boolean value) {
72+
Map<String, Value> properties = new HashMap<>();
73+
properties.put("disable-block-miss-penalty", Value.newBuilder().setBoolValue(value).build());
74+
75+
ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("combat", properties);
76+
ProtobufPacketUtil.broadcastPacket(settings);
77+
}
78+
```
79+
5980
**Toggle Dig and Use**
6081

6182
```java
@@ -88,6 +109,18 @@ public void setDisableMissPenalty(boolean value) {
88109
}
89110
```
90111

112+
**Toggle Block Miss Penalty**
113+
114+
```java
115+
public void setDisableBlockMissPenalty(boolean value) {
116+
Map<String, Object> properties = new HashMap<>();
117+
properties.put("disable-block-miss-penalty", value);
118+
119+
JsonObject message = JsonUtil.createEnableModuleObjectWithType("combat", properties);
120+
JsonPacketUtil.broadcastPacket(message);
121+
}
122+
```
123+
91124
**Toggle Dig and Use**
92125

93126
```java
@@ -111,6 +144,11 @@ public void setAllowDigAndUse(boolean value) {
111144
- Values
112145
- Type: `Boolean`
113146
- Default: `false`
147+
- __`DISABLE_BLOCK_MISS_PENALTY`__
148+
- Whether the player gets a hit delay for a missed hit while targeting a block. Applies to all versions 1.8 and above. Enabling this option may cause compatibility issues with anti-cheats.
149+
- Values
150+
- Type: `Boolean`
151+
- Default: `false`
114152
- __`ALLOW_DIG_AND_USE`__
115153
- Whether the player can dig and use an item at the same time, like in 1.7. Applies to all versions 1.8 and above. Enabling this option may cause compatibility issues with anti-cheats.
116154
- Values

example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/util/JsonPacketUtil.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public final class JsonPacketUtil {
5353
// While using the Apollo plugin this would be equivalent to modifying the config.yml
5454
CONFIG_MODULE_PROPERTIES.put("colored_fire", "persist-colors-on-unload", false);
5555
CONFIG_MODULE_PROPERTIES.put("combat", "disable-miss-penalty", false);
56+
CONFIG_MODULE_PROPERTIES.put("combat", "disable-block-miss-penalty", false);
5657
CONFIG_MODULE_PROPERTIES.put("combat", "allow-dig-and-use", false);
5758
CONFIG_MODULE_PROPERTIES.put("packet_enrichment", "player-attack.send-packet", false);
5859
CONFIG_MODULE_PROPERTIES.put("packet_enrichment", "player-chat-open.send-packet", false);

example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/util/ProtobufPacketUtil.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public final class ProtobufPacketUtil {
5454
// While using the Apollo plugin this would be equivalent to modifying the config.yml
5555
CONFIG_MODULE_PROPERTIES.put("colored_fire", "persist-colors-on-unload", Value.newBuilder().setBoolValue(false).build());
5656
CONFIG_MODULE_PROPERTIES.put("combat", "disable-miss-penalty", Value.newBuilder().setBoolValue(false).build());
57+
CONFIG_MODULE_PROPERTIES.put("combat", "disable-block-miss-penalty", Value.newBuilder().setBoolValue(false).build());
5758
CONFIG_MODULE_PROPERTIES.put("combat", "allow-dig-and-use", Value.newBuilder().setBoolValue(false).build());
5859
CONFIG_MODULE_PROPERTIES.put("packet_enrichment", "player-attack.send-packet", Value.newBuilder().setBoolValue(false).build());
5960
CONFIG_MODULE_PROPERTIES.put("packet_enrichment", "player-chat-open.send-packet", Value.newBuilder().setBoolValue(false).build());

0 commit comments

Comments
 (0)