Skip to content

Commit

Permalink
Merge branch '1.21' into 1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Feb 19, 2025
2 parents cb4b6b2 + d219151 commit dd46afe
Show file tree
Hide file tree
Showing 5 changed files with 276 additions and 186 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import xaeroplus.Globals;
import xaeroplus.XaeroPlus;
import xaeroplus.event.XaeroWorldChangeEvent;
import xaeroplus.settings.Settings;
import xaeroplus.util.ChunkUtils;

import java.io.Closeable;
Expand Down Expand Up @@ -323,7 +322,7 @@ public void handleTick() {
// this does make the update interval setting kind of a lie, but its for the best
int jitter = ThreadLocalRandom.current().nextInt(0, 10);
// only update window on an interval
if (++tickCounter < Settings.REGISTRY.cacheWindowUpdateInterval.getAsInt() + jitter) {
if (++tickCounter < 10 + jitter) {
return;
}
tickCounter = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@


@Mixin(value = ModSettings.class, remap = false)
public class MixinMinimapModSettings {
public abstract class MixinMinimapModSettings {

@Shadow
public int caveMaps;
@Shadow
protected IXaeroMinimap modMain;

@Shadow protected abstract void refreshScreen();

@Inject(method = "<init>", at = @At(value = "RETURN"))
private void init(CallbackInfo ci) {
// don't show cave maps on minimap by default
Expand Down Expand Up @@ -73,6 +75,7 @@ public void getClientBooleanValue(ModOptions o, CallbackInfoReturnable<Boolean>
@Inject(method = "setOptionValue", at = @At("HEAD"))
public void setOptionValue(ModOptions o, Object value, final CallbackInfo ci) {
SettingHooks.setOptionValue(o.getEnumString(), value);
refreshScreen();
}

@Inject(method = "getOptionValue", at = @At("HEAD"), cancellable = true)
Expand All @@ -83,6 +86,7 @@ public void getOptionValue(final ModOptions o, final CallbackInfoReturnable<Obje
@Inject(method = "setOptionDoubleValue", at = @At("HEAD"))
public void setOptionFloatValue(ModOptions o, double f, CallbackInfo ci) {
SettingHooks.setOptionDoubleValue(o.getEnumString(), f);
refreshScreen();
}

@Inject(method = "getOptionDoubleValue", at = @At("HEAD"), cancellable = true)
Expand Down
16 changes: 16 additions & 0 deletions common/src/main/java/xaeroplus/settings/DoubleSetting.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,22 @@ public static DoubleSetting create(String settingName,
);
}

public static DoubleSetting create(String settingName,
String settingNameTranslationKey,
double valueMin,
double valueMax,
double valueStep,
double defaultValue,
BooleanSupplier visibilitySupplier) {
return new DoubleSetting(
SETTING_PREFIX + settingName,
settingNameTranslationKey,
buildTooltipTranslationKey(settingNameTranslationKey),
null,
valueMin, valueMax, valueStep, defaultValue, null, visibilitySupplier
);
}

public static DoubleSetting create(String settingName,
String settingNameTranslationKey,
double valueMin,
Expand Down
Loading

0 comments on commit dd46afe

Please sign in to comment.