parent
f847238ecb
commit
a42f6e87f8
11 changed files with 177 additions and 55 deletions
|
@ -32,8 +32,14 @@ public class HexConfig {
|
||||||
|
|
||||||
boolean ctrlTogglesOffStrokeOrder();
|
boolean ctrlTogglesOffStrokeOrder();
|
||||||
|
|
||||||
|
boolean invertSpellbookScrollDirection();
|
||||||
|
|
||||||
|
boolean invertAbacusScrollDirection();
|
||||||
|
|
||||||
double DEFAULT_PATTERN_POINT_SPEED_MULTIPLIER = 1;
|
double DEFAULT_PATTERN_POINT_SPEED_MULTIPLIER = 1;
|
||||||
boolean DEFAULT_CTRL_TOGGLES_OFF_STROKE_ORDER = false;
|
boolean DEFAULT_CTRL_TOGGLES_OFF_STROKE_ORDER = false;
|
||||||
|
boolean DEFAULT_INVERT_SPELLBOOK_SCROLL = false;
|
||||||
|
boolean DEFAULT_INVERT_ABACUS_SCROLL = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ServerConfigAccess {
|
public interface ServerConfigAccess {
|
||||||
|
|
|
@ -1,30 +1,36 @@
|
||||||
package at.petrak.hexcasting.client;
|
package at.petrak.hexcasting.client;
|
||||||
|
|
||||||
|
import at.petrak.hexcasting.api.mod.HexConfig;
|
||||||
import at.petrak.hexcasting.common.lib.HexItems;
|
import at.petrak.hexcasting.common.lib.HexItems;
|
||||||
import at.petrak.hexcasting.common.network.MsgShiftScrollSyn;
|
import at.petrak.hexcasting.common.network.MsgShiftScrollSyn;
|
||||||
import at.petrak.hexcasting.xplat.IClientXplatAbstractions;
|
import at.petrak.hexcasting.xplat.IClientXplatAbstractions;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.world.InteractionHand;
|
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
|
|
||||||
public class ShiftScrollListener {
|
public class ShiftScrollListener {
|
||||||
public static boolean onScroll(double delta) {
|
private static double mainHandDelta = 0;
|
||||||
|
private static double offHandDelta = 0;
|
||||||
|
|
||||||
|
public static boolean onScrollInGameplay(double delta) {
|
||||||
|
if (Minecraft.getInstance().screen != null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return onScroll(delta, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean onScroll(double delta, boolean needsSneaking) {
|
||||||
LocalPlayer player = Minecraft.getInstance().player;
|
LocalPlayer player = Minecraft.getInstance().player;
|
||||||
// not .isCrouching! that fails for players who are not on the ground
|
// not .isCrouching! that fails for players who are not on the ground
|
||||||
// yes, this does work if you remap your sneak key
|
// yes, this does work if you remap your sneak key
|
||||||
if (player.isShiftKeyDown()) {
|
if (player != null && (player.isShiftKeyDown() || !needsSneaking)) {
|
||||||
InteractionHand hand = null;
|
|
||||||
if (IsScrollableItem(player.getMainHandItem().getItem())) {
|
if (IsScrollableItem(player.getMainHandItem().getItem())) {
|
||||||
hand = InteractionHand.MAIN_HAND;
|
mainHandDelta += delta;
|
||||||
|
return true;
|
||||||
} else if (IsScrollableItem(player.getOffhandItem().getItem())) {
|
} else if (IsScrollableItem(player.getOffhandItem().getItem())) {
|
||||||
hand = InteractionHand.OFF_HAND;
|
offHandDelta += delta;
|
||||||
}
|
|
||||||
|
|
||||||
if (hand != null) {
|
|
||||||
IClientXplatAbstractions.INSTANCE.sendPacketToServer(
|
|
||||||
new MsgShiftScrollSyn(hand, delta, Screen.hasControlDown()));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +38,17 @@ public class ShiftScrollListener {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void clientTickEnd() {
|
||||||
|
if (mainHandDelta != 0 || offHandDelta != 0) {
|
||||||
|
IClientXplatAbstractions.INSTANCE.sendPacketToServer(
|
||||||
|
new MsgShiftScrollSyn(mainHandDelta, offHandDelta, Screen.hasControlDown(),
|
||||||
|
HexConfig.client().invertSpellbookScrollDirection(),
|
||||||
|
HexConfig.client().invertAbacusScrollDirection()));
|
||||||
|
mainHandDelta = 0;
|
||||||
|
offHandDelta = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean IsScrollableItem(Item item) {
|
private static boolean IsScrollableItem(Item item) {
|
||||||
return item == HexItems.SPELLBOOK || item == HexItems.ABACUS;
|
return item == HexItems.SPELLBOOK || item == HexItems.ABACUS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,17 +11,13 @@ import at.petrak.hexcasting.api.spell.math.HexPattern
|
||||||
import at.petrak.hexcasting.api.utils.asTranslatedComponent
|
import at.petrak.hexcasting.api.utils.asTranslatedComponent
|
||||||
import at.petrak.hexcasting.api.utils.gold
|
import at.petrak.hexcasting.api.utils.gold
|
||||||
import at.petrak.hexcasting.api.utils.otherHand
|
import at.petrak.hexcasting.api.utils.otherHand
|
||||||
import at.petrak.hexcasting.client.ClientTickCounter
|
import at.petrak.hexcasting.client.*
|
||||||
import at.petrak.hexcasting.client.drawPatternFromPoints
|
import at.petrak.hexcasting.client.ktxt.accumulatedScroll
|
||||||
import at.petrak.hexcasting.client.drawSpot
|
|
||||||
import at.petrak.hexcasting.client.renderQuad
|
|
||||||
import at.petrak.hexcasting.client.sound.GridSoundInstance
|
import at.petrak.hexcasting.client.sound.GridSoundInstance
|
||||||
import at.petrak.hexcasting.common.items.ItemSpellbook
|
|
||||||
import at.petrak.hexcasting.common.lib.HexIotaTypes
|
import at.petrak.hexcasting.common.lib.HexIotaTypes
|
||||||
import at.petrak.hexcasting.common.lib.HexItems
|
import at.petrak.hexcasting.common.lib.HexItems
|
||||||
import at.petrak.hexcasting.common.lib.HexSounds
|
import at.petrak.hexcasting.common.lib.HexSounds
|
||||||
import at.petrak.hexcasting.common.network.MsgNewSpellPatternSyn
|
import at.petrak.hexcasting.common.network.MsgNewSpellPatternSyn
|
||||||
import at.petrak.hexcasting.common.network.MsgShiftScrollSyn
|
|
||||||
import at.petrak.hexcasting.xplat.IClientXplatAbstractions
|
import at.petrak.hexcasting.xplat.IClientXplatAbstractions
|
||||||
import com.mojang.blaze3d.systems.RenderSystem
|
import com.mojang.blaze3d.systems.RenderSystem
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
@ -273,15 +269,21 @@ class GuiSpellcasting constructor(
|
||||||
override fun mouseScrolled(pMouseX: Double, pMouseY: Double, pDelta: Double): Boolean {
|
override fun mouseScrolled(pMouseX: Double, pMouseY: Double, pDelta: Double): Boolean {
|
||||||
super.mouseScrolled(pMouseX, pMouseY, pDelta)
|
super.mouseScrolled(pMouseX, pMouseY, pDelta)
|
||||||
|
|
||||||
val otherHand = otherHand(this.handOpenedWith)
|
val mouseHandler = Minecraft.getInstance().mouseHandler
|
||||||
if (Minecraft.getInstance().player!!.getItemInHand(otherHand).item is ItemSpellbook)
|
|
||||||
IClientXplatAbstractions.INSTANCE.sendPacketToServer(
|
if (mouseHandler.accumulatedScroll != 0.0 && sign(pDelta) != sign(mouseHandler.accumulatedScroll)) {
|
||||||
MsgShiftScrollSyn(
|
mouseHandler.accumulatedScroll = 0.0
|
||||||
otherHand,
|
}
|
||||||
pDelta,
|
|
||||||
hasControlDown()
|
mouseHandler.accumulatedScroll += pDelta
|
||||||
)
|
val accumulation: Int = mouseHandler.accumulatedScroll.toInt()
|
||||||
)
|
if (accumulation == 0) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
mouseHandler.accumulatedScroll -= accumulation.toDouble()
|
||||||
|
|
||||||
|
ShiftScrollListener.onScroll(pDelta, false)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
@file:JvmName("ClientAccessorWrappers")
|
||||||
|
package at.petrak.hexcasting.client.ktxt
|
||||||
|
|
||||||
|
import at.petrak.hexcasting.mixin.accessor.client.AccessorMouseHandler
|
||||||
|
import net.minecraft.client.MouseHandler
|
||||||
|
|
||||||
|
var MouseHandler.accumulatedScroll: Double
|
||||||
|
get() = (this as AccessorMouseHandler).`hex$getAccumulatedScroll`()
|
||||||
|
set(value) = (this as AccessorMouseHandler).`hex$setAccumulatedScroll`(value)
|
|
@ -25,7 +25,7 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
|
||||||
* Sent client->server when the client shift+scrolls with a shift-scrollable item
|
* Sent client->server when the client shift+scrolls with a shift-scrollable item
|
||||||
* or scrolls in the spellcasting UI.
|
* or scrolls in the spellcasting UI.
|
||||||
*/
|
*/
|
||||||
public record MsgShiftScrollSyn(InteractionHand hand, double scrollDelta, boolean isCtrl) implements IMessage {
|
public record MsgShiftScrollSyn(double mainHandDelta, double offHandDelta, boolean isCtrl, boolean invertSpellbook, boolean invertAbacus) implements IMessage {
|
||||||
public static final ResourceLocation ID = modLoc("scroll");
|
public static final ResourceLocation ID = modLoc("scroll");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,32 +35,47 @@ public record MsgShiftScrollSyn(InteractionHand hand, double scrollDelta, boolea
|
||||||
|
|
||||||
public static MsgShiftScrollSyn deserialize(ByteBuf buffer) {
|
public static MsgShiftScrollSyn deserialize(ByteBuf buffer) {
|
||||||
var buf = new FriendlyByteBuf(buffer);
|
var buf = new FriendlyByteBuf(buffer);
|
||||||
var hand = buf.readEnum(InteractionHand.class);
|
var mainHandDelta = buf.readDouble();
|
||||||
var scrollDelta = buf.readDouble();
|
var offHandDelta = buf.readDouble();
|
||||||
var isCtrl = buf.readBoolean();
|
var isCtrl = buf.readBoolean();
|
||||||
return new MsgShiftScrollSyn(hand, scrollDelta, isCtrl);
|
var invertSpellbook = buf.readBoolean();
|
||||||
|
var invertAbacus = buf.readBoolean();
|
||||||
|
return new MsgShiftScrollSyn(mainHandDelta, offHandDelta, isCtrl, invertSpellbook, invertAbacus);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void serialize(FriendlyByteBuf buf) {
|
public void serialize(FriendlyByteBuf buf) {
|
||||||
buf.writeEnum(this.hand);
|
buf.writeDouble(this.mainHandDelta);
|
||||||
buf.writeDouble(this.scrollDelta);
|
buf.writeDouble(this.offHandDelta);
|
||||||
buf.writeBoolean(this.isCtrl);
|
buf.writeBoolean(this.isCtrl);
|
||||||
|
buf.writeBoolean(this.invertSpellbook);
|
||||||
|
buf.writeBoolean(this.invertAbacus);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handle(MinecraftServer server, ServerPlayer sender) {
|
public void handle(MinecraftServer server, ServerPlayer sender) {
|
||||||
server.execute(() -> {
|
server.execute(() -> {
|
||||||
var stack = sender.getItemInHand(hand);
|
handleForHand(sender, InteractionHand.MAIN_HAND, mainHandDelta);
|
||||||
|
handleForHand(sender, InteractionHand.OFF_HAND, offHandDelta);
|
||||||
if (stack.getItem() == HexItems.SPELLBOOK) {
|
|
||||||
spellbook(sender, stack);
|
|
||||||
} else if (stack.getItem() == HexItems.ABACUS) {
|
|
||||||
abacus(sender, stack);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spellbook(ServerPlayer sender, ItemStack stack) {
|
private void handleForHand(ServerPlayer sender, InteractionHand hand, double delta) {
|
||||||
var newIdx = ItemSpellbook.rotatePageIdx(stack, this.scrollDelta < 0.0);
|
if (delta != 0) {
|
||||||
|
var stack = sender.getItemInHand(hand);
|
||||||
|
|
||||||
|
if (stack.getItem() == HexItems.SPELLBOOK) {
|
||||||
|
spellbook(sender, hand, stack, delta);
|
||||||
|
} else if (stack.getItem() == HexItems.ABACUS) {
|
||||||
|
abacus(sender, hand, stack, delta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void spellbook(ServerPlayer sender, InteractionHand hand, ItemStack stack, double delta) {
|
||||||
|
if (invertSpellbook) {
|
||||||
|
delta = -delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newIdx = ItemSpellbook.rotatePageIdx(stack, delta < 0.0);
|
||||||
|
|
||||||
var len = ItemSpellbook.highestPage(stack);
|
var len = ItemSpellbook.highestPage(stack);
|
||||||
|
|
||||||
|
@ -99,21 +114,27 @@ public record MsgShiftScrollSyn(InteractionHand hand, double scrollDelta, boolea
|
||||||
sender.displayClientMessage(component.withStyle(ChatFormatting.GRAY), true);
|
sender.displayClientMessage(component.withStyle(ChatFormatting.GRAY), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void abacus(ServerPlayer sender, ItemStack stack) {
|
private void abacus(ServerPlayer sender, InteractionHand hand, ItemStack stack, double delta) {
|
||||||
var increase = this.scrollDelta < 0;
|
if (invertAbacus) {
|
||||||
|
delta = -delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
var increase = delta < 0;
|
||||||
double num = NBTHelper.getDouble(stack, ItemAbacus.TAG_VALUE);
|
double num = NBTHelper.getDouble(stack, ItemAbacus.TAG_VALUE);
|
||||||
|
|
||||||
double delta;
|
double shiftDelta;
|
||||||
float pitch;
|
float pitch;
|
||||||
if (this.hand == InteractionHand.MAIN_HAND) {
|
if (hand == InteractionHand.MAIN_HAND) {
|
||||||
delta = this.isCtrl ? 10 : 1;
|
shiftDelta = this.isCtrl ? 10 : 1;
|
||||||
pitch = this.isCtrl ? 0.7f : 0.9f;
|
pitch = this.isCtrl ? 0.7f : 0.9f;
|
||||||
} else {
|
} else {
|
||||||
delta = this.isCtrl ? 0.01 : 0.1;
|
shiftDelta = this.isCtrl ? 0.01 : 0.1;
|
||||||
pitch = this.isCtrl ? 1.3f : 1.0f;
|
pitch = this.isCtrl ? 1.3f : 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
num += delta * (increase ? 1 : -1);
|
int scale = Math.max((int) Math.floor(Math.abs(delta)), 1);
|
||||||
|
|
||||||
|
num += scale * shiftDelta * (increase ? 1 : -1);
|
||||||
NBTHelper.putDouble(stack, ItemAbacus.TAG_VALUE, num);
|
NBTHelper.putDouble(stack, ItemAbacus.TAG_VALUE, num);
|
||||||
|
|
||||||
pitch *= (increase ? 1.05f : 0.95f);
|
pitch *= (increase ? 1.05f : 0.95f);
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package at.petrak.hexcasting.mixin.accessor.client;
|
||||||
|
|
||||||
|
import net.minecraft.client.MouseHandler;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(MouseHandler.class)
|
||||||
|
public interface AccessorMouseHandler {
|
||||||
|
@Accessor("accumulatedScroll")
|
||||||
|
double hex$getAccumulatedScroll();
|
||||||
|
|
||||||
|
@Accessor("accumulatedScroll")
|
||||||
|
void hex$setAccumulatedScroll(double scroll);
|
||||||
|
}
|
|
@ -5,13 +5,23 @@
|
||||||
"refmap": "hexcasting.mixins.refmap.json",
|
"refmap": "hexcasting.mixins.refmap.json",
|
||||||
"package": "at.petrak.hexcasting.mixin",
|
"package": "at.petrak.hexcasting.mixin",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"MixinAbstractVillager", "MixinMob", "MixinRaider", "MixinReloadableServerResources", "MixinVillager", "MixinWitch",
|
"MixinAbstractVillager",
|
||||||
"accessor.AccessorLivingEntity", "accessor.AccessorLootTable", "accessor.AccessorPoiType",
|
"MixinMob",
|
||||||
"accessor.AccessorUseOnContext", "accessor.AccessorVillager", "accessor.CriteriaTriggersAccessor"
|
"MixinRaider",
|
||||||
|
"MixinReloadableServerResources",
|
||||||
|
"MixinVillager",
|
||||||
|
"MixinWitch",
|
||||||
|
"accessor.AccessorLivingEntity",
|
||||||
|
"accessor.AccessorLootTable",
|
||||||
|
"accessor.AccessorPoiType",
|
||||||
|
"accessor.AccessorUseOnContext",
|
||||||
|
"accessor.AccessorVillager",
|
||||||
|
"accessor.CriteriaTriggersAccessor"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"accessor.client.AccessorCompositeRenderType",
|
"accessor.client.AccessorCompositeRenderType",
|
||||||
"accessor.client.AccessorEmptyTextureStateShard",
|
"accessor.client.AccessorEmptyTextureStateShard",
|
||||||
|
"accessor.client.AccessorMouseHandler",
|
||||||
"accessor.client.AccessorRenderStateShard",
|
"accessor.client.AccessorRenderStateShard",
|
||||||
"accessor.client.AccessorRenderType",
|
"accessor.client.AccessorRenderType",
|
||||||
"client.MixinClientLevel"
|
"client.MixinClientLevel"
|
||||||
|
|
|
@ -32,9 +32,12 @@ object FabricHexClientInitializer : ClientModInitializer {
|
||||||
}
|
}
|
||||||
HudRenderCallback.EVENT.register(HexAdditionalRenderers::overlayGui)
|
HudRenderCallback.EVENT.register(HexAdditionalRenderers::overlayGui)
|
||||||
WorldRenderEvents.START.register { ClientTickCounter.renderTickStart(it.tickDelta()) }
|
WorldRenderEvents.START.register { ClientTickCounter.renderTickStart(it.tickDelta()) }
|
||||||
ClientTickEvents.END_CLIENT_TICK.register { ClientTickCounter.clientTickEnd() }
|
ClientTickEvents.END_CLIENT_TICK.register {
|
||||||
|
ClientTickCounter.clientTickEnd()
|
||||||
|
ShiftScrollListener.clientTickEnd()
|
||||||
|
}
|
||||||
|
|
||||||
MouseScrollCallback.EVENT.register(ShiftScrollListener::onScroll)
|
MouseScrollCallback.EVENT.register(ShiftScrollListener::onScrollInGameplay)
|
||||||
|
|
||||||
RegisterClientStuff.init()
|
RegisterClientStuff.init()
|
||||||
RegisterClientStuff.registerParticles()
|
RegisterClientStuff.registerParticles()
|
||||||
|
|
|
@ -128,6 +128,8 @@ public class FabricHexConfig {
|
||||||
private final PropertyMirror<Double> patternPointSpeedMultiplier = PropertyMirror.create(
|
private final PropertyMirror<Double> patternPointSpeedMultiplier = PropertyMirror.create(
|
||||||
ConfigTypes.DOUBLE.withMinimum(0d));
|
ConfigTypes.DOUBLE.withMinimum(0d));
|
||||||
private final PropertyMirror<Boolean> ctrlTogglesOffStrokeOrder = PropertyMirror.create(ConfigTypes.BOOLEAN);
|
private final PropertyMirror<Boolean> ctrlTogglesOffStrokeOrder = PropertyMirror.create(ConfigTypes.BOOLEAN);
|
||||||
|
private final PropertyMirror<Boolean> invertSpellbookScrollDirection = PropertyMirror.create(ConfigTypes.BOOLEAN);
|
||||||
|
private final PropertyMirror<Boolean> invertAbacusScrollDirection = PropertyMirror.create(ConfigTypes.BOOLEAN);
|
||||||
|
|
||||||
public ConfigTree configure(ConfigTreeBuilder bob) {
|
public ConfigTree configure(ConfigTreeBuilder bob) {
|
||||||
bob
|
bob
|
||||||
|
@ -137,7 +139,16 @@ public class FabricHexConfig {
|
||||||
|
|
||||||
.beginValue("ctrlTogglesOffStrokeOrder", ConfigTypes.BOOLEAN, DEFAULT_CTRL_TOGGLES_OFF_STROKE_ORDER)
|
.beginValue("ctrlTogglesOffStrokeOrder", ConfigTypes.BOOLEAN, DEFAULT_CTRL_TOGGLES_OFF_STROKE_ORDER)
|
||||||
.withComment("Whether the ctrl key will instead turn *off* the color gradient on patterns")
|
.withComment("Whether the ctrl key will instead turn *off* the color gradient on patterns")
|
||||||
.finishValue(ctrlTogglesOffStrokeOrder::mirror);
|
.finishValue(ctrlTogglesOffStrokeOrder::mirror)
|
||||||
|
|
||||||
|
.beginValue("invertSpellbookScrollDirection", ConfigTypes.BOOLEAN, DEFAULT_INVERT_SPELLBOOK_SCROLL)
|
||||||
|
.withComment("Whether scrolling up (as opposed to down) will increase the page index of the spellbook, and vice versa")
|
||||||
|
.finishValue(invertSpellbookScrollDirection::mirror)
|
||||||
|
|
||||||
|
.beginValue("invertAbacusScrollDirection", ConfigTypes.BOOLEAN, DEFAULT_INVERT_ABACUS_SCROLL)
|
||||||
|
.withComment("Whether scrolling up (as opposed to down) will increase the value of the abacus, and vice versa")
|
||||||
|
.finishValue(invertAbacusScrollDirection::mirror);
|
||||||
|
|
||||||
|
|
||||||
return bob.build();
|
return bob.build();
|
||||||
}
|
}
|
||||||
|
@ -151,6 +162,16 @@ public class FabricHexConfig {
|
||||||
public boolean ctrlTogglesOffStrokeOrder() {
|
public boolean ctrlTogglesOffStrokeOrder() {
|
||||||
return ctrlTogglesOffStrokeOrder.getValue();
|
return ctrlTogglesOffStrokeOrder.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean invertSpellbookScrollDirection() {
|
||||||
|
return invertSpellbookScrollDirection.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean invertAbacusScrollDirection() {
|
||||||
|
return invertAbacusScrollDirection.getValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class Server implements HexConfig.ServerConfigAccess {
|
private static final class Server implements HexConfig.ServerConfigAccess {
|
||||||
|
|
|
@ -53,11 +53,12 @@ public class ForgeHexClientInitializer {
|
||||||
evBus.addListener((TickEvent.ClientTickEvent e) -> {
|
evBus.addListener((TickEvent.ClientTickEvent e) -> {
|
||||||
if (e.phase == TickEvent.Phase.END) {
|
if (e.phase == TickEvent.Phase.END) {
|
||||||
ClientTickCounter.clientTickEnd();
|
ClientTickCounter.clientTickEnd();
|
||||||
|
ShiftScrollListener.clientTickEnd();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
evBus.addListener((InputEvent.MouseScrollEvent e) -> {
|
evBus.addListener((InputEvent.MouseScrollEvent e) -> {
|
||||||
var cancel = ShiftScrollListener.onScroll(e.getScrollDelta());
|
var cancel = ShiftScrollListener.onScrollInGameplay(e.getScrollDelta());
|
||||||
e.setCanceled(cancel);
|
e.setCanceled(cancel);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,8 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess {
|
||||||
public static class Client implements HexConfig.ClientConfigAccess {
|
public static class Client implements HexConfig.ClientConfigAccess {
|
||||||
private static ForgeConfigSpec.DoubleValue patternPointSpeedMultiplier;
|
private static ForgeConfigSpec.DoubleValue patternPointSpeedMultiplier;
|
||||||
private static ForgeConfigSpec.BooleanValue ctrlTogglesOffStrokeOrder;
|
private static ForgeConfigSpec.BooleanValue ctrlTogglesOffStrokeOrder;
|
||||||
|
private static ForgeConfigSpec.BooleanValue invertSpellbookScrollDirection;
|
||||||
|
private static ForgeConfigSpec.BooleanValue invertAbacusScrollDirection;
|
||||||
|
|
||||||
public Client(ForgeConfigSpec.Builder builder) {
|
public Client(ForgeConfigSpec.Builder builder) {
|
||||||
patternPointSpeedMultiplier = builder.comment(
|
patternPointSpeedMultiplier = builder.comment(
|
||||||
|
@ -61,6 +63,12 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess {
|
||||||
ctrlTogglesOffStrokeOrder = builder.comment(
|
ctrlTogglesOffStrokeOrder = builder.comment(
|
||||||
"Whether the ctrl key will instead turn *off* the color gradient on patterns")
|
"Whether the ctrl key will instead turn *off* the color gradient on patterns")
|
||||||
.define("ctrlTogglesOffStrokeOrder", DEFAULT_CTRL_TOGGLES_OFF_STROKE_ORDER);
|
.define("ctrlTogglesOffStrokeOrder", DEFAULT_CTRL_TOGGLES_OFF_STROKE_ORDER);
|
||||||
|
invertSpellbookScrollDirection = builder.comment(
|
||||||
|
"Whether scrolling up (as opposed to down) will increase the page index of the spellbook, and vice versa")
|
||||||
|
.define("invertSpellbookScrollDirection", DEFAULT_INVERT_SPELLBOOK_SCROLL);
|
||||||
|
invertAbacusScrollDirection = builder.comment(
|
||||||
|
"Whether scrolling up (as opposed to down) will increase the value of the abacus, and vice versa")
|
||||||
|
.define("invertAbacusScrollDirection", DEFAULT_INVERT_ABACUS_SCROLL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -72,6 +80,16 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess {
|
||||||
public boolean ctrlTogglesOffStrokeOrder() {
|
public boolean ctrlTogglesOffStrokeOrder() {
|
||||||
return ctrlTogglesOffStrokeOrder.get();
|
return ctrlTogglesOffStrokeOrder.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean invertSpellbookScrollDirection() {
|
||||||
|
return invertSpellbookScrollDirection.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean invertAbacusScrollDirection() {
|
||||||
|
return invertAbacusScrollDirection.get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Server implements HexConfig.ServerConfigAccess {
|
public static class Server implements HexConfig.ServerConfigAccess {
|
||||||
|
|
Loading…
Reference in a new issue