-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add debug config and a keybind to dump nearby entities (#961)
* Add debug config * Fix indents --------- Co-authored-by: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>
- Loading branch information
1 parent
b0f9efd
commit 135125f
Showing
10 changed files
with
173 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/de/hysky/skyblocker/config/categories/DebugCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package de.hysky.skyblocker.config.categories; | ||
|
||
import de.hysky.skyblocker.config.ConfigUtils; | ||
import de.hysky.skyblocker.config.SkyblockerConfig; | ||
import dev.isxander.yacl3.api.ConfigCategory; | ||
import dev.isxander.yacl3.api.Option; | ||
import dev.isxander.yacl3.api.OptionDescription; | ||
import dev.isxander.yacl3.api.controller.IntegerSliderControllerBuilder; | ||
import net.minecraft.text.Text; | ||
|
||
public class DebugCategory { | ||
public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig config) { | ||
return ConfigCategory.createBuilder() | ||
.name(Text.translatable("skyblocker.config.debug")) | ||
.option(Option.<Integer>createBuilder() | ||
.name(Text.translatable("skyblocker.config.debug.dumpRange")) | ||
.description(OptionDescription.of(Text.translatable("skyblocker.config.debug.dumpRange.@Tooltip"))) | ||
.binding(defaults.debug.dumpRange, | ||
() -> config.debug.dumpRange, | ||
newValue -> config.debug.dumpRange = newValue) | ||
.controller(option -> IntegerSliderControllerBuilder.create(option).range(1, 25).step(1)) | ||
.build()) | ||
.option(Option.<Boolean>createBuilder() | ||
.name(Text.translatable("skyblocker.config.debug.showInvisibleArmorStands")) | ||
.binding(defaults.debug.showInvisibleArmorStands, | ||
() -> config.debug.showInvisibleArmorStands, | ||
newValue -> config.debug.showInvisibleArmorStands = newValue) | ||
.controller(ConfigUtils::createBooleanController) | ||
.build()) | ||
.option(Option.<Boolean>createBuilder() | ||
.name(Text.translatable("skyblocker.config.debug.debugWebSockets")) | ||
.binding(defaults.debug.webSocketDebug, | ||
() -> config.debug.webSocketDebug, | ||
newValue -> config.debug.webSocketDebug = newValue) | ||
.controller(ConfigUtils::createBooleanController) | ||
.build()) | ||
.build(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/de/hysky/skyblocker/config/configs/DebugConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package de.hysky.skyblocker.config.configs; | ||
|
||
import dev.isxander.yacl3.config.v2.api.SerialEntry; | ||
|
||
public class DebugConfig { | ||
@SerialEntry | ||
public int dumpRange = 5; | ||
|
||
@SerialEntry | ||
public boolean showInvisibleArmorStands = false; | ||
|
||
@SerialEntry | ||
public boolean webSocketDebug = false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package de.hysky.skyblocker.mixins; | ||
|
||
import de.hysky.skyblocker.config.SkyblockerConfigManager; | ||
import de.hysky.skyblocker.debug.Debug; | ||
import de.hysky.skyblocker.utils.Utils; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(Entity.class) | ||
public abstract class EntityMixin { | ||
@Shadow | ||
@Final | ||
private EntityType<?> type; | ||
|
||
@Shadow | ||
public abstract boolean isInvisible(); | ||
|
||
@Inject(method = "isInvisibleTo", at = @At("HEAD"), cancellable = true) | ||
public void skyblocker$showInvisibleArmorStands(PlayerEntity player, CallbackInfoReturnable<Boolean> cir) { | ||
if (isInvisible() && Utils.isOnHypixel() && Debug.debugEnabled() && SkyblockerConfigManager.get().debug.showInvisibleArmorStands && type.equals(EntityType.ARMOR_STAND)) cir.setReturnValue(false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
src/main/java/de/hysky/skyblocker/mixins/LivingEntityRendererMixin.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters