Skip to content

Commit

Permalink
Add deprecation message for Dulkir in config
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyvest committed Aug 4, 2024
1 parent 3815fdb commit cf947c9
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod_name = OverflowAnimations
mod_id = overflowanimations
mod_version = 2.2.4
mod_version = 2.2.5
mod_archives_name=OverflowAnimations

# Gradle Configuration -- DO NOT TOUCH THESE VALUES.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import cc.polyfrost.oneconfig.utils.color.ColorUtils;
import cc.polyfrost.oneconfig.utils.gui.GuiUtils;
import cc.polyfrost.oneconfig.utils.gui.OneUIScreen;
import org.polyfrost.overflowanimations.OverflowAnimations;
import org.polyfrost.overflowanimations.config.OldAnimationsSettings;
import org.polyfrost.overflowanimations.hooks.AnimationExportUtils;

public class PleaseMigrateDulkirModGui extends OneUIScreen {
Expand All @@ -31,19 +33,31 @@ public class PleaseMigrateDulkirModGui extends OneUIScreen {
2,
ColorPalette.PRIMARY_DESTRUCTIVE
);
private int ticks = 0;

@Override
public void draw(long vg, float partialTicks, InputHandler inputHandler) {
if (ticks < 10) {
ticks++;
if (ticks == 10) {
markAsViewed();
}
}
if (transferButton.getWidth() == -1) {
transferButton.setWidth((int) (NanoVGHelper.INSTANCE.getTextWidth(vg, TRANSFER, 14f, Fonts.MEDIUM) + 40));
transferButton.setClickAction(AnimationExportUtils::transferDulkirConfig);
transferButton.setClickAction(() -> {
markAsViewed();
AnimationExportUtils.transferDulkirConfig();
GuiUtils.displayScreen(null);
});
}
if (cancelButton.getWidth() == -1) {
cancelButton.setWidth((int) (NanoVGHelper.INSTANCE.getTextWidth(vg, CANCEL, 14f, Fonts.MEDIUM) + 40));
cancelButton.setClickAction(() -> {
cancelButton.setText("Confirm");
cancelButton.setWidth((int) (NanoVGHelper.INSTANCE.getTextWidth(vg, "Confirm", 14f, Fonts.MEDIUM) + 40));
cancelButton.setClickAction(() -> {
markAsViewed();
cancelButton.setText(CANCEL);
cancelButton.setWidth((int) (NanoVGHelper.INSTANCE.getTextWidth(vg, CANCEL, 14f, Fonts.MEDIUM) + 40));
GuiUtils.displayScreen(null);
Expand All @@ -65,4 +79,10 @@ public void draw(long vg, float partialTicks, InputHandler inputHandler) {
transferButton.draw(vg, x + 300 - transferButton.getWidth(), y + 180, inputHandler);
cancelButton.draw(vg, x + 300 + 10, y + 180, inputHandler);
}

private void markAsViewed() {
OverflowAnimations.doTheFunnyDulkirThing = false;
OldAnimationsSettings.didTheFunnyDulkirThingElectricBoogaloo = true;
OldAnimationsSettings.INSTANCE.save();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.polyfrost.overflowanimations.mixin.compat;

import cc.polyfrost.oneconfig.config.Config;
import cc.polyfrost.oneconfig.config.annotations.Exclude;
import cc.polyfrost.oneconfig.config.data.Mod;
import org.spongepowered.asm.mixin.Dynamic;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Pseudo
@Mixin(targets = "dulkirmod.config.DulkirConfig")
public class DulkirConfigMixin extends Config {

@Unique
@Exclude
private static final String overflow$USE_OVERFLOW = "Please use OverflowAnimations' Custom Item Positions instead of Dulkir's, as it is more compatible with old animations and has more features. You can find it in the OneConfig Mods menu. You can use the Dulkir export buttons and import it into OverflowAnimations directly. For more info, please join the Polyfrost Discord server: discord.gg/polyfrost.";

public DulkirConfigMixin(Mod modData, String configFile) {
super(modData, configFile);
}

@Dynamic("DulkirMod")
@Inject(method = "init", at = @At("RETURN"))
private void onInit(CallbackInfo ci) {
addDependency("customAnimations", overflow$USE_OVERFLOW, () -> false);
addDependency("customSize", overflow$USE_OVERFLOW, () -> false);
addDependency("doesScaleSwing", overflow$USE_OVERFLOW, () -> false);
addDependency("customX", overflow$USE_OVERFLOW, () -> false);
addDependency("customY", overflow$USE_OVERFLOW, () -> false);
addDependency("customZ", overflow$USE_OVERFLOW, () -> false);
addDependency("customYaw", overflow$USE_OVERFLOW, () -> false);
addDependency("customPitch", overflow$USE_OVERFLOW, () -> false);
addDependency("customRoll", overflow$USE_OVERFLOW, () -> false);
addDependency("customSpeed", overflow$USE_OVERFLOW, () -> false);
addDependency("ignoreHaste", overflow$USE_OVERFLOW, () -> false);
addDependency("drinkingSelector", overflow$USE_OVERFLOW, () -> false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ object OverflowAnimations {

@JvmField
var isPatcherPresent: Boolean = false
private var doTheFunnyDulkirThing = false
@JvmField
var doTheFunnyDulkirThing = false
@JvmField
var oldDulkirMod: Boolean = false
private var customCrosshair = false
Expand Down Expand Up @@ -100,9 +101,6 @@ object OverflowAnimations {

private fun dulkirTrollage() {
GuiUtils.displayScreen(PleaseMigrateDulkirModGui())
doTheFunnyDulkirThing = false
OldAnimationsSettings.didTheFunnyDulkirThingElectricBoogaloo = true
OldAnimationsSettings.INSTANCE.save()
}

}
1 change: 1 addition & 0 deletions src/main/resources/mixins.overflowanimations.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"RenderItemMixin",
"RenderSnowballMixin",
"RenderSnowballMixin_CustomPositions",
"compat.DulkirConfigMixin",
"compat.ItemCustomizeManagerMixin",
"interfaces.EntityLivingBaseInvoker",
"interfaces.GuiPlayerTabOverlayInvoker",
Expand Down

0 comments on commit cf947c9

Please sign in to comment.