Skip to content

Commit

Permalink
Merge pull request #207 from boholder/1.19-crosshair-target-location-cue
Browse files Browse the repository at this point in the history
Crosshair target location cue
  • Loading branch information
khanshoaib3 committed Dec 2, 2023
2 parents 2746899 + 8ed67f2 commit 1ca55e9
Show file tree
Hide file tree
Showing 40 changed files with 739 additions and 255 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Currently, this mod [has enough features](doc/FAQ.md#is-the-mod-enough-to-play-t

This mod supports:

* Game version `1.19.3`, and subsequent versions start from `1.20.1` (but maybe not every minor version)
* Game version `1.19.3`, `1.20.1`.
* On [Fabric](https://fabricmc.net/use/installer/) and [Forge](https://files.minecraftforge.net/net/minecraftforge/forge/) modding platform
* On Windows and Linux operating system ([Help us on macOS porting](https://github.com/khanshoaib3/minecraft-access/issues/22))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public class OtherConfigsMap {
private boolean actionBarEnabled;
@SerializedName("Speak Harvest Of Fishing")
private boolean fishingHarvestEnabled;
@SerializedName("Report Held Items Count When Changed")
private boolean reportHeldItemsCountWhenChanged = true;
@SerializedName("Enable Menu Fix")
private boolean menuFixEnabled;
@SerializedName("Debug Mode")
Expand Down Expand Up @@ -175,6 +177,14 @@ public void setMultipleClickSpeedInMilliseconds(int multipleClickSpeedInMillisec
this.multipleClickSpeedInMilliseconds = multipleClickSpeedInMilliseconds;
}

public boolean isReportHeldItemsCountWhenChanged() {
return reportHeldItemsCountWhenChanged;
}

public void setReportHeldItemsCountWhenChanged(boolean reportHeldItemsCountWhenChanged) {
this.reportHeldItemsCountWhenChanged = reportHeldItemsCountWhenChanged;
}

public static OtherConfigsMap buildDefault() {
OtherConfigsMap defaultOtherConfigsMap = new OtherConfigsMap();
defaultOtherConfigsMap.setBiomeIndicatorEnabled(true);
Expand All @@ -187,6 +197,7 @@ public static OtherConfigsMap buildDefault() {
defaultOtherConfigsMap.setUse12HourTimeFormat(false);
defaultOtherConfigsMap.setActionBarEnabled(true);
defaultOtherConfigsMap.setFishingHarvestEnabled(true);
defaultOtherConfigsMap.reportHeldItemsCountWhenChanged = true;
defaultOtherConfigsMap.setMenuFixEnabled(true);
defaultOtherConfigsMap.setDebugMode(false);
defaultOtherConfigsMap.setMultipleClickSpeedInMilliseconds(750);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.github.khanshoaib3.minecraft_access.config.config_maps;

import com.github.khanshoaib3.minecraft_access.config.Config;
import com.google.gson.annotations.SerializedName;

public class RCRelativePositionSoundCueConfigMap {
private static RCRelativePositionSoundCueConfigMap instance;

@SerializedName("Enabled")
private boolean enabled = true;
@SerializedName("Min Sound Volume")
private float minSoundVolume = 0.25f;
@SerializedName("Max Sound Volume")
private float maxSoundVolume = 0.4f;

private RCRelativePositionSoundCueConfigMap() {
}

public static RCRelativePositionSoundCueConfigMap buildDefault() {
RCRelativePositionSoundCueConfigMap m = new RCRelativePositionSoundCueConfigMap();
m.enabled = true;
m.minSoundVolume = 0.25f;
m.maxSoundVolume = 0.4f;
setInstance(m);
return m;
}

public static RCRelativePositionSoundCueConfigMap getInstance() {
if (instance == null) Config.getInstance().loadConfig();
return instance;
}

public static void setInstance(RCRelativePositionSoundCueConfigMap map) {
instance = map;
}

public boolean isEnabled() {
return enabled;
}

public void setEnabled(boolean enabled) {
this.enabled = enabled;
}

public float getMinSoundVolume() {
return minSoundVolume;
}

public void setMinSoundVolume(float minSoundVolume) {
this.minSoundVolume = minSoundVolume;
}

public float getMaxSoundVolume() {
return maxSoundVolume;
}

public void setMaxSoundVolume(float maxSoundVolume) {
this.maxSoundVolume = maxSoundVolume;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public class ReadCrosshairConfigMap {
private boolean disableSpeakingConsecutiveBlocks;
@SerializedName("Repeat Speaking Interval (in milliseconds) (0 to disable)")
private long repeatSpeakingInterval;

@SerializedName("Relative Position Sound Cue")
private RCRelativePositionSoundCueConfigMap relativePositionSoundCueConfigMap;
@SerializedName("Partial Speaking")
private RCPartialSpeakingConfigMap partialSpeakingConfigMap;

Expand All @@ -27,9 +28,10 @@ public static ReadCrosshairConfigMap buildDefault() {
ReadCrosshairConfigMap m = new ReadCrosshairConfigMap();
m.setEnabled(true);
m.setSpeakSide(true);
m.setDisableSpeakingConsecutiveBlocks(true);
m.setDisableSpeakingConsecutiveBlocks(false);
m.setRepeatSpeakingInterval(0L);
m.setPartialSpeakingConfigMap(RCPartialSpeakingConfigMap.buildDefault());
m.relativePositionSoundCueConfigMap = RCRelativePositionSoundCueConfigMap.buildDefault();
m.partialSpeakingConfigMap = RCPartialSpeakingConfigMap.buildDefault();

setInstance(m);
return m;
Expand All @@ -41,6 +43,7 @@ public static ReadCrosshairConfigMap getInstance() {
}

public static void setInstance(ReadCrosshairConfigMap map) {
RCRelativePositionSoundCueConfigMap.setInstance(map.relativePositionSoundCueConfigMap);
RCPartialSpeakingConfigMap.setInstance(map.partialSpeakingConfigMap);
instance = map;
}
Expand Down Expand Up @@ -77,13 +80,12 @@ public void setRepeatSpeakingInterval(long repeatSpeakingInterval) {
this.repeatSpeakingInterval = repeatSpeakingInterval;
}

public void setPartialSpeakingConfigMap(RCPartialSpeakingConfigMap partialSpeakingConfigMap) {
this.partialSpeakingConfigMap = partialSpeakingConfigMap;
}

public void resetMissingSectionsToDefault() {
if (Objects.isNull(this.partialSpeakingConfigMap)) {
this.partialSpeakingConfigMap = RCPartialSpeakingConfigMap.buildDefault();
}
if (Objects.isNull(this.relativePositionSoundCueConfigMap)) {
this.relativePositionSoundCueConfigMap = RCRelativePositionSoundCueConfigMap.buildDefault();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,31 @@ protected void init() {
});
this.addDrawableChild(featureToggleButton);

ValueEntryMenu.ValueConfig delay = new ValueEntryMenu.ValueConfig(
() -> AreaMapConfigMap.getInstance().getDelayInMilliseconds(),
(v) -> AreaMapConfigMap.getInstance().setDelayInMilliseconds(Integer.parseInt(v)),
ValueEntryMenu.ValueType.INT);
ButtonWidget delayButton = this.buildButtonWidget(
I18n.translate("minecraft_access.gui.common.button.delay", initMap.getDelayInMilliseconds()),
(button) -> Objects.requireNonNull(this.client).setScreen(new ValueEntryMenu("value_entry_menu", ValueEntryMenu.CONFIG_TYPE.AREA_MAP_DELAY, this)));
(button) -> Objects.requireNonNull(this.client).setScreen(new ValueEntryMenu(delay, this)));
this.addDrawableChild(delayButton);

ValueEntryMenu.CONFIG_TYPE verticalBound = ValueEntryMenu.CONFIG_TYPE.AREA_MAP_VERTICAL_BOUND;
ValueEntryMenu.ValueConfig verticalBound = new ValueEntryMenu.ValueConfig(
() -> AreaMapConfigMap.getInstance().getVerticalBound(),
(v) -> AreaMapConfigMap.getInstance().setVerticalBound(Integer.parseInt(v)),
ValueEntryMenu.ValueType.INT);
ButtonWidget verticalBoundButton = this.buildButtonWidget(
verticalBound.buildButtonText("minecraft_access.gui.area_map_config_menu.button.vertical_bound"),
(button) -> Objects.requireNonNull(this.client).setScreen(new ValueEntryMenu("value_entry_menu", verticalBound, this)));
(button) -> Objects.requireNonNull(this.client).setScreen(new ValueEntryMenu(verticalBound, this)));
this.addDrawableChild(verticalBoundButton);

ValueEntryMenu.CONFIG_TYPE horizontalBound = ValueEntryMenu.CONFIG_TYPE.AREA_MAP_HORIZONTAL_BOUND;
ValueEntryMenu.ValueConfig horizontalBound = new ValueEntryMenu.ValueConfig(
() -> AreaMapConfigMap.getInstance().getHorizontalBound(),
(v) -> AreaMapConfigMap.getInstance().setHorizontalBound(Integer.parseInt(v)),
ValueEntryMenu.ValueType.INT);
ButtonWidget horizontalBoundButton = this.buildButtonWidget(
horizontalBound.buildButtonText("minecraft_access.gui.area_map_config_menu.button.horizontal_bound"),
(button) -> Objects.requireNonNull(this.client).setScreen(new ValueEntryMenu("value_entry_menu", horizontalBound, this)));
(button) -> Objects.requireNonNull(this.client).setScreen(new ValueEntryMenu(horizontalBound, this)));
this.addDrawableChild(horizontalBoundButton);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,34 @@ protected void init() {
});
this.addDrawableChild(featureToggleButton);

ValueEntryMenu.ValueConfig c1 = new ValueEntryMenu.ValueConfig(() -> CameraControlsConfigMap.getInstance().getNormalRotatingAngle(),
(v) -> CameraControlsConfigMap.getInstance().setNormalRotatingAngle(Float.parseFloat(v)),
ValueEntryMenu.ValueType.FLOAT);
ButtonWidget normalRotatingAngleButton = this.buildButtonWidget(
I18n.translate("minecraft_access.gui.common.button.button_with_float_value",
I18n.translate("minecraft_access.gui.camera_controls_config_menu.button.normal_rotating_angle"),
initMap.getNormalRotatingAngle()),
(button) -> this.client.setScreen(new ValueEntryMenu("value_entry_menu", ValueEntryMenu.CONFIG_TYPE.CAMERA_CONTROLS_NORMAL_ROTATING_ANGLE, this)));
(button) -> this.client.setScreen(new ValueEntryMenu(c1, this)));
this.addDrawableChild(normalRotatingAngleButton);

ValueEntryMenu.ValueConfig c2 = new ValueEntryMenu.ValueConfig(() -> CameraControlsConfigMap.getInstance().getModifiedRotatingAngle(),
(v) -> CameraControlsConfigMap.getInstance().setModifiedRotatingAngle(Float.parseFloat(v)),
ValueEntryMenu.ValueType.FLOAT);
ButtonWidget modifiedRotatingAngleButton = this.buildButtonWidget(
I18n.translate("minecraft_access.gui.common.button.button_with_float_value",
I18n.translate("minecraft_access.gui.camera_controls_config_menu.button.modified_rotating_angle"),
initMap.getModifiedRotatingAngle()
),
(button) -> this.client.setScreen(new ValueEntryMenu("value_entry_menu", ValueEntryMenu.CONFIG_TYPE.CAMERA_CONTROLS_MODIFIED_ROTATING_ANGLE, this)));
(button) -> this.client.setScreen(new ValueEntryMenu(c2, this)));
this.addDrawableChild(modifiedRotatingAngleButton);

ValueEntryMenu.ValueConfig c3 = new ValueEntryMenu.ValueConfig(() -> CameraControlsConfigMap.getInstance().getDelayInMilliseconds(),
(v) -> CameraControlsConfigMap.getInstance().setDelayInMilliseconds(Integer.parseInt(v)),
ValueEntryMenu.ValueType.INT);
ButtonWidget delayButton = this.buildButtonWidget(
I18n.translate("minecraft_access.gui.common.button.delay",
initMap.getDelayInMilliseconds()),
(button) -> this.client.setScreen(new ValueEntryMenu("value_entry_menu", ValueEntryMenu.CONFIG_TYPE.CAMERA_CONTROLS_DELAY, this)));
(button) -> this.client.setScreen(new ValueEntryMenu(c3, this)));
this.addDrawableChild(delayButton);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,24 @@ protected void init() {
});
this.addDrawableChild(featureToggleButton);

ValueEntryMenu.ValueConfig c1 = new ValueEntryMenu.ValueConfig(() -> FallDetectorConfigMap.getInstance().getRange(),
(v) -> FallDetectorConfigMap.getInstance().setRange(Integer.parseInt(v)),
ValueEntryMenu.ValueType.INT);
ButtonWidget rangeButton = this.buildButtonWidget(
I18n.translate("minecraft_access.gui.common.button.range",
initMap.getRange()),
(button) -> this.client.setScreen(new ValueEntryMenu("value_entry_menu", ValueEntryMenu.CONFIG_TYPE.FALL_DETECTOR_RANGE, this)));
(button) -> this.client.setScreen(new ValueEntryMenu(c1, this)));
this.addDrawableChild(rangeButton);

ValueEntryMenu.ValueConfig c2 = new ValueEntryMenu.ValueConfig(() -> FallDetectorConfigMap.getInstance().getDepth(),
(v) -> FallDetectorConfigMap.getInstance().setDepth(Integer.parseInt(v)),
ValueEntryMenu.ValueType.INT);
ButtonWidget depthButton = this.buildButtonWidget(
I18n.translate("minecraft_access.gui.common.button.button_with_float_value",
I18n.translate("minecraft_access.gui.fall_detector_config_menu.button.depth_threshold_button"),
initMap.getDepth()
),
(button) -> this.client.setScreen(new ValueEntryMenu("value_entry_menu", ValueEntryMenu.CONFIG_TYPE.FALL_DETECTOR_DEPTH_THRESHOLD, this)));
(button) -> this.client.setScreen(new ValueEntryMenu(c2, this)));
this.addDrawableChild(depthButton);

ButtonWidget playAlternateSoundButton = this.buildButtonWidget(
Expand All @@ -57,14 +63,20 @@ protected void init() {
playAlternateSoundButton.active = false;
this.addDrawableChild(playAlternateSoundButton);

ValueEntryMenu.ValueConfig c3 = new ValueEntryMenu.ValueConfig(() -> FallDetectorConfigMap.getInstance().getVolume(),
(v) -> FallDetectorConfigMap.getInstance().setVolume(Float.parseFloat(v)),
ValueEntryMenu.ValueType.FLOAT);
ButtonWidget volumeButton = this.buildButtonWidget(
I18n.translate("minecraft_access.gui.common.button.volume", initMap.getVolume()),
(button) -> this.client.setScreen(new ValueEntryMenu("value_entry_menu", ValueEntryMenu.CONFIG_TYPE.FALL_DETECTOR_VOLUME, this)));
(button) -> this.client.setScreen(new ValueEntryMenu(c3, this)));
this.addDrawableChild(volumeButton);

ValueEntryMenu.ValueConfig c4 = new ValueEntryMenu.ValueConfig(() -> FallDetectorConfigMap.getInstance().getDelay(),
(v) -> FallDetectorConfigMap.getInstance().setDelay(Integer.parseInt(v)),
ValueEntryMenu.ValueType.INT);
ButtonWidget delayButton = this.buildButtonWidget(
I18n.translate("minecraft_access.gui.common.button.delay", initMap.getDelay()),
(button) -> this.client.setScreen(new ValueEntryMenu("value_entry_menu", ValueEntryMenu.CONFIG_TYPE.FALL_DETECTOR_DELAY, this)));
(button) -> this.client.setScreen(new ValueEntryMenu(c4, this)));
this.addDrawableChild(delayButton);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,25 @@ protected void init() {
});
this.addDrawableChild(autoOpenRecipeBookButton);

ValueEntryMenu.ValueConfig c1 = new ValueEntryMenu.ValueConfig(() -> InventoryControlsConfigMap.getInstance().getRowAndColumnFormat(),
(v) -> InventoryControlsConfigMap.getInstance().setRowAndColumnFormat(v),
ValueEntryMenu.ValueType.STRING);
ButtonWidget rowNColumnButton = this.buildButtonWidget(
I18n.translate("minecraft_access.gui.common.button.button_with_string_value",
I18n.translate("minecraft_access.gui.inventory_controls_config_menu.button.row_and_column_format"),
initMap.getRowAndColumnFormat()
),
(button) -> this.client.setScreen(new ValueEntryMenu("value_entry_menu", ValueEntryMenu.CONFIG_TYPE.INVENTORY_CONTROLS_ROW_N_COLUMN_FORMAT, this)));
(button) -> this.client.setScreen(new ValueEntryMenu(c1, this)));
rowNColumnButton.active = false;
this.addDrawableChild(rowNColumnButton);

ValueEntryMenu.ValueConfig c2 = new ValueEntryMenu.ValueConfig(() -> InventoryControlsConfigMap.getInstance().getDelayInMilliseconds(),
(v) -> InventoryControlsConfigMap.getInstance().setDelayInMilliseconds(Integer.parseInt(v)),
ValueEntryMenu.ValueType.INT);
ButtonWidget delayButton = this.buildButtonWidget(
I18n.translate("minecraft_access.gui.common.button.delay",
initMap.getDelayInMilliseconds()),
(button) -> this.client.setScreen(new ValueEntryMenu("value_entry_menu", ValueEntryMenu.CONFIG_TYPE.INVENTORY_CONTROLS_DELAY, this)));
(button) -> this.client.setScreen(new ValueEntryMenu(c2, this)));
this.addDrawableChild(delayButton);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ protected void init() {
});
this.addDrawableChild(featureToggleButton);

ValueEntryMenu.ValueConfig c1 = new ValueEntryMenu.ValueConfig(() -> MouseSimulationConfigMap.getInstance().getScrollDelayInMilliseconds(),
(v) -> MouseSimulationConfigMap.getInstance().setScrollDelayInMilliseconds(Integer.parseInt(v)),
ValueEntryMenu.ValueType.INT);
ButtonWidget delayButton = this.buildButtonWidget(
I18n.translate("minecraft_access.gui.common.button.delay",
initMap.getScrollDelayInMilliseconds()),
(button) -> this.client.setScreen(new ValueEntryMenu("value_entry_menu", ValueEntryMenu.CONFIG_TYPE.MOUSE_SIMULATION_SCROLL_DELAY, this)));
(button) -> this.client.setScreen(new ValueEntryMenu(c1, this)));
this.addDrawableChild(delayButton);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,20 @@ protected void init() {

FluidDetectorConfigMap initMap = FluidDetectorConfigMap.getInstance();

ValueEntryMenu.ValueConfig c1 = new ValueEntryMenu.ValueConfig(() -> FluidDetectorConfigMap.getInstance().getVolume(),
(v) -> FluidDetectorConfigMap.getInstance().setVolume(Integer.parseInt(v)),
ValueEntryMenu.ValueType.FLOAT);
ButtonWidget volumeButton = this.buildButtonWidget(
I18n.translate("minecraft_access.gui.common.button.volume", initMap.getVolume()),
(button) -> this.client.setScreen(new ValueEntryMenu("value_entry_menu", ValueEntryMenu.CONFIG_TYPE.NARRATOR_MENU_VOLUME, this)));
(button) -> this.client.setScreen(new ValueEntryMenu(c1, this)));
this.addDrawableChild(volumeButton);

ValueEntryMenu.ValueConfig c2 = new ValueEntryMenu.ValueConfig(() -> FluidDetectorConfigMap.getInstance().getRange(),
(v) -> FluidDetectorConfigMap.getInstance().setRange(Integer.parseInt(v)),
ValueEntryMenu.ValueType.INT);
ButtonWidget rangeButton = this.buildButtonWidget(
I18n.translate("minecraft_access.gui.common.button.range", initMap.getRange()),
(button) -> this.client.setScreen(new ValueEntryMenu("value_entry_menu", ValueEntryMenu.CONFIG_TYPE.NARRATOR_MENU_RANGE, this)));
(button) -> this.client.setScreen(new ValueEntryMenu(c2, this)));
this.addDrawableChild(rangeButton);
}
}
Loading

0 comments on commit 1ca55e9

Please sign in to comment.