Skip to content

Commit

Permalink
make it config-based
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandra-Myers committed Aug 29, 2023
1 parent dd705a1 commit 7e974af
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class CombatifyConfigModel {
public boolean sprintCritsEnabled = true;
public boolean saturationHealing = false;
public boolean fastHealing = false;
public boolean letVanillaConnect = false;
public boolean oldSprintFoodRequirement = false;
public boolean projectilesHaveIFrames = false;
public boolean magicHasIFrames = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;

@SuppressWarnings("unused")
@Mixin(GameRenderer.class)
abstract class GameRendererMixin implements ResourceManagerReloadListener/*, AutoCloseable*/ {
@Shadow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@ public NetworkingHandler() {
ServerPlayNetworking.registerGlobalReceiver(modDetectionNetworkChannel,(server, player, handler, buf, responseSender) -> {
});
ServerPlayConnectionEvents.JOIN.register(modDetectionNetworkChannel,(handler, sender, server) -> {
boolean bl = CONFIG.configOnlyWeapons() || CONFIG.defender() || CONFIG.piercer();
boolean bl = CONFIG.configOnlyWeapons() || CONFIG.defender() || CONFIG.piercer() || !CONFIG.letVanillaConnect();
if(!ServerPlayNetworking.canSend(handler.player, modDetectionNetworkChannel)) {
if(bl)
if(bl) {
handler.player.connection.disconnect(Component.literal("Combatify needs to be installed on the client to join this server!"));
return;
}
Combatify.unmoddedPlayers.add(handler.player.getUUID());
Combatify.isPlayerAttacking.put(handler.player.getUUID(), true);
Combatify.finalizingAttack.put(handler.player.getUUID(), true);
} else if (unmoddedPlayers.contains(handler.player.getUUID())) {
unmoddedPlayers.remove(handler.player.getUUID());
isPlayerAttacking.remove(handler.player.getUUID());
finalizingAttack.remove(handler.player.getUUID());
}
});
AttackBlockCallback.EVENT.register(modDetectionNetworkChannel, (player, world, hand, pos, direction) -> {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/combatify/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"text.config.combatify-config.option.sprintCritsEnabled": "Can crit while sprinting",
"text.config.combatify-config.option.saturationHealing": "Healing relies on saturation as a buffer, rather than just taking hunger",
"text.config.combatify-config.option.fastHealing": "Allows for fast healing like in 1.11+ when you have high saturation",
"text.config.combatify-config.option.letVanillaConnect": "Option for servers which allows vanilla clients to connect",
"text.config.combatify-config.option.oldSprintFoodRequirement": "Allows you to sprint until your hunger is empty like in CTS 5",
"text.config.combatify-config.option.projectilesHaveIFrames": "Determines if projectile damage sources have I-Frames",
"text.config.combatify-config.option.magicHasIFrames": "Determines if magic damage sources have I-Frames",
Expand Down

0 comments on commit 7e974af

Please sign in to comment.