Skip to content

Commit

Permalink
refactor: 优化代码,更改包名(域名)
Browse files Browse the repository at this point in the history
  • Loading branch information
flowerinsnowdh committed Nov 7, 2024
1 parent fd2b09d commit a9be86d
Show file tree
Hide file tree
Showing 33 changed files with 172 additions and 1,041 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up JDK 21
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 21
java-version: 17
distribution: temurin

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Build with Gradle Wrapper
run: |
cd 24w33a-24w45a-fabric/
cd 1.20.1-forge/
chmod +x gradlew
./gradlew build
env:
Expand All @@ -36,4 +36,4 @@ jobs:
- name: Release
uses: softprops/action-gh-release@v2
with:
files: 24w33a-24w45a-fabric/build/libs/*.jar
files: 1.20.1-forge/build/libs/*.jar
23 changes: 6 additions & 17 deletions 1.20.1-forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ repositories() {
}

maven() {
url = 'https://maven.pkg.github.com/flowerinsnow-lights-opensource/GreatScrollableTooltips'
url = 'https://maven.pkg.github.com/flowerinsnowdh/GreatScrollableTooltips'
credentials() {
username = "${System.getenv('GITHUB_USERNAME')}"
password = "${System.getenv('GITHUB_TOKEN')}"
Expand All @@ -144,13 +144,6 @@ repositories() {
name = "CurseMaven"
url = "https://www.cursemaven.com"
}

/*
* AppleSkin
*/
maven() {
url = 'https://maven.ryanliptak.com/'
}
}

dependencies() {
Expand All @@ -175,18 +168,14 @@ dependencies() {
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html

implementation("online.flowerinsnow.greatscrollabletooltips:common:[${version_common_module}]")
jarJar("online.flowerinsnow.greatscrollabletooltips:common:[${version_common_module}]")

annotationProcessor('org.spongepowered:mixin:0.8.5:processor')

// LegendaryTooltips 1.4.5
// https://www.curseforge.com/minecraft/mc-mods/legendary-tooltips/files/4662781
compileOnly(fg.deobf("curse.maven:legendary-tooltips-532127:4662781"))
// Apotheosis v1.20.1-7.4.3
// https://www.curseforge.com/minecraft/mc-mods/apotheosis/files/5753183
compileOnly(fg.deobf("curse.maven:apotheosis-313970:5753183"))
compileOnly(fg.deobf("squeek.appleskin:appleskin-forge:mc1.20.2-2.5.1:api"))

implementation("cn.flowerinsnow.greatscrollabletooltips:common:[${version_common_module}]")
jarJar("cn.flowerinsnow.greatscrollabletooltips:common:[${version_common_module}]")

annotationProcessor('org.spongepowered:mixin:0.8.5:processor')
}

// This block of code expands all declared replace properties in the specified resource targets.
Expand Down
4 changes: 2 additions & 2 deletions 1.20.1-forge/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ mod_name=Great Scrollable Tooltips
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=MPL-2.0
# The mod version. See https://semver.org/
mod_version=15.3.1-beta.1+forge
mod_version=15.3.2+forge
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
Expand All @@ -59,4 +59,4 @@ mod_authors=flowerinsnow
mod_description=Allow scrolling of item tooltips in the inventory.

# Dependencies
version_common_module=1.0.0
version_common_module=1.1.0
2 changes: 1 addition & 1 deletion 1.20.1-forge/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package online.flowerinsnow.greatscrollabletooltips;
package cn.flowerinsnow.greatscrollabletooltips;

import net.minecraft.CrashReport;
import net.minecraft.client.Minecraft;
Expand All @@ -11,14 +11,13 @@
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLLoader;
import net.minecraftforge.fml.loading.FMLPaths;
import online.flowerinsnow.greatscrollabletooltips.config.GreatScrollableTooltipsConfig;
import online.flowerinsnow.greatscrollabletooltips.listener.*;
import online.flowerinsnow.greatscrollabletooltips.manager.KeyBindingManager;
import online.flowerinsnow.greatscrollabletooltips.object.ScrollSession;
import online.flowerinsnow.greatscrollabletooltips.provider.ModEnvironmentProvider;
import online.flowerinsnow.greatscrollabletooltips.screen.ConfigScreen;
import cn.flowerinsnow.greatscrollabletooltips.common.config.GreatScrollableTooltipsConfig;
import cn.flowerinsnow.greatscrollabletooltips.listener.*;
import cn.flowerinsnow.greatscrollabletooltips.manager.KeyBindingManager;
import cn.flowerinsnow.greatscrollabletooltips.common.object.ScrollSession;
import cn.flowerinsnow.greatscrollabletooltips.common.provider.ModEnvironmentProvider;
import cn.flowerinsnow.greatscrollabletooltips.screen.ConfigScreen;

import java.io.InputStream;
import java.nio.file.Path;
Expand Down Expand Up @@ -86,10 +85,6 @@ private void initListeners() {
eventBus.register(new KeyScrollListener());

eventBus.addListener(this::initKeyBindings);

if (FMLLoader.getLoadingModList().getModFileById("appleskin") != null) {
eventBus.register(new AppleSkinListener());
}
}

public void initKeyBindings(RegisterKeyMappingsEvent event) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package online.flowerinsnow.greatscrollabletooltips.event;
package cn.flowerinsnow.greatscrollabletooltips.event;

import net.minecraftforge.eventbus.api.Event;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package online.flowerinsnow.greatscrollabletooltips.event;
package cn.flowerinsnow.greatscrollabletooltips.event;

import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraftforge.api.distmarker.Dist;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package online.flowerinsnow.greatscrollabletooltips.event;
package cn.flowerinsnow.greatscrollabletooltips.event;

import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraftforge.api.distmarker.Dist;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package online.flowerinsnow.greatscrollabletooltips.event;
package cn.flowerinsnow.greatscrollabletooltips.event;

import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package online.flowerinsnow.greatscrollabletooltips.event;
package cn.flowerinsnow.greatscrollabletooltips.event;

import net.minecraft.client.gui.screens.Screen;
import net.minecraftforge.eventbus.api.Event;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package online.flowerinsnow.greatscrollabletooltips.listener;
package cn.flowerinsnow.greatscrollabletooltips.listener;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import online.flowerinsnow.greatscrollabletooltips.event.ClientTickEndEvent;
import online.flowerinsnow.greatscrollabletooltips.event.ScreenCloseEvent;
import cn.flowerinsnow.greatscrollabletooltips.event.ClientTickEndEvent;
import cn.flowerinsnow.greatscrollabletooltips.event.ScreenCloseEvent;

public class EventTriggerListener {
@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package online.flowerinsnow.greatscrollabletooltips.listener;
package cn.flowerinsnow.greatscrollabletooltips.listener;

import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import online.flowerinsnow.greatscrollabletooltips.GreatScrollableTooltips;
import online.flowerinsnow.greatscrollabletooltips.manager.KeyBindingManager;
import online.flowerinsnow.greatscrollabletooltips.event.PreScreenKeyPressedEvent;
import online.flowerinsnow.greatscrollabletooltips.object.ScrollSession;
import cn.flowerinsnow.greatscrollabletooltips.GreatScrollableTooltips;
import cn.flowerinsnow.greatscrollabletooltips.manager.KeyBindingManager;
import cn.flowerinsnow.greatscrollabletooltips.event.PreScreenKeyPressedEvent;
import cn.flowerinsnow.greatscrollabletooltips.common.object.ScrollSession;

@OnlyIn(Dist.CLIENT)
public class KeyScrollListener {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package online.flowerinsnow.greatscrollabletooltips.listener;
package cn.flowerinsnow.greatscrollabletooltips.listener;

import net.minecraft.client.gui.screens.Screen;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import online.flowerinsnow.greatscrollabletooltips.GreatScrollableTooltips;
import online.flowerinsnow.greatscrollabletooltips.event.PreScreenMouseScrollEvent;
import online.flowerinsnow.greatscrollabletooltips.object.ScrollSession;
import cn.flowerinsnow.greatscrollabletooltips.GreatScrollableTooltips;
import cn.flowerinsnow.greatscrollabletooltips.event.PreScreenMouseScrollEvent;
import cn.flowerinsnow.greatscrollabletooltips.common.object.ScrollSession;

import java.util.Objects;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package online.flowerinsnow.greatscrollabletooltips.listener;
package cn.flowerinsnow.greatscrollabletooltips.listener;

import net.minecraft.world.item.ItemStack;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import online.flowerinsnow.greatscrollabletooltips.GreatScrollableTooltips;
import online.flowerinsnow.greatscrollabletooltips.event.RenderTooltipEvent;
import online.flowerinsnow.greatscrollabletooltips.event.ScreenCloseEvent;
import online.flowerinsnow.greatscrollabletooltips.object.ScrollSession;
import cn.flowerinsnow.greatscrollabletooltips.GreatScrollableTooltips;
import cn.flowerinsnow.greatscrollabletooltips.event.RenderTooltipEvent;
import cn.flowerinsnow.greatscrollabletooltips.event.ScreenCloseEvent;
import cn.flowerinsnow.greatscrollabletooltips.common.object.ScrollSession;

import java.util.Objects;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package online.flowerinsnow.greatscrollabletooltips.manager;
package cn.flowerinsnow.greatscrollabletooltips.manager;

import net.minecraft.client.KeyMapping;
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package online.flowerinsnow.greatscrollabletooltips.mixin;
package cn.flowerinsnow.greatscrollabletooltips.mixin;

import net.minecraft.client.gui.components.AbstractSliderButton;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package cn.flowerinsnow.greatscrollabletooltips.mixin;

import net.minecraft.client.gui.GuiGraphics;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import cn.flowerinsnow.greatscrollabletooltips.GreatScrollableTooltips;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;

@Mixin(GuiGraphics.class)
@OnlyIn(Dist.CLIENT)
public class MixinDrawContext {
@ModifyVariable(
method = "renderTooltipInternal",
at = @At(
value = "STORE",
ordinal = 0,
opcode = Opcodes.ISTORE
),
index = 12
)
private int modifyX(int x) {
GreatScrollableTooltips instance = GreatScrollableTooltips.getInstance();
return x + (instance.getScrollSession().getHorizontal() * instance.getConfig().sensitivity);
}

@ModifyVariable(
method = "renderTooltipInternal",
at = @At(
value = "STORE",
ordinal = 0,
opcode = Opcodes.ISTORE
),
index = 13
)
private int modifyY(int y) {
GreatScrollableTooltips instance = GreatScrollableTooltips.getInstance();
return y + (instance.getScrollSession().getVertical() * instance.getConfig().sensitivity);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package online.flowerinsnow.greatscrollabletooltips.mixin;
package cn.flowerinsnow.greatscrollabletooltips.mixin;

import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.Screen;
Expand All @@ -8,9 +8,9 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.MinecraftForge;
import online.flowerinsnow.greatscrollabletooltips.event.PreScreenKeyPressedEvent;
import online.flowerinsnow.greatscrollabletooltips.event.PreScreenMouseScrollEvent;
import online.flowerinsnow.greatscrollabletooltips.event.RenderTooltipEvent;
import cn.flowerinsnow.greatscrollabletooltips.event.PreScreenKeyPressedEvent;
import cn.flowerinsnow.greatscrollabletooltips.event.PreScreenMouseScrollEvent;
import cn.flowerinsnow.greatscrollabletooltips.event.RenderTooltipEvent;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package cn.flowerinsnow.greatscrollabletooltips.mixin.legendarytooltips;

import com.anthonyhilyard.legendarytooltips.LegendaryTooltips;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import cn.flowerinsnow.greatscrollabletooltips.GreatScrollableTooltips;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;

@Mixin(LegendaryTooltips.class)
@OnlyIn(Dist.CLIENT)
public class MixinLegendaryTooltips {
@ModifyArg(
method = "onPostTooltipEvent",
at = @At(
value = "INVOKE",
target = "Lcom/anthonyhilyard/legendarytooltips/tooltip/TooltipDecor;drawShadow(Lcom/mojang/blaze3d/vertex/PoseStack;IIII)V"
),
remap = false,
index = 1
)
private static int modifyDrawShadowX(int x) {
GreatScrollableTooltips instance = GreatScrollableTooltips.getInstance();
return x + instance.getScrollSession().getHorizontal() * instance.getConfig().sensitivity;
}

@ModifyArg(
method = "onPostTooltipEvent",
at = @At(
value = "INVOKE",
target = "Lcom/anthonyhilyard/legendarytooltips/tooltip/TooltipDecor;drawShadow(Lcom/mojang/blaze3d/vertex/PoseStack;IIII)V"
),
remap = false,
index = 2
)
private static int modifyDrawShadowY(int y) {
GreatScrollableTooltips instance = GreatScrollableTooltips.getInstance();
return y + instance.getScrollSession().getVertical() * instance.getConfig().sensitivity;
}

@ModifyArg(
method = "onPostTooltipEvent",
at = @At(
value = "INVOKE",
target = "Lcom/anthonyhilyard/legendarytooltips/tooltip/TooltipDecor;drawBorder(Lcom/mojang/blaze3d/vertex/PoseStack;IIIILnet/minecraft/world/item/ItemStack;Ljava/util/List;Lnet/minecraft/client/gui/Font;Lcom/anthonyhilyard/legendarytooltips/config/LegendaryTooltipsConfig$FrameDefinition;ZI)V"
),
remap = false,
index = 1
)
private static int modifyDrawBorderX(int x) {
GreatScrollableTooltips instance = GreatScrollableTooltips.getInstance();
return x + instance.getScrollSession().getHorizontal() * instance.getConfig().sensitivity;
}

@ModifyArg(
method = "onPostTooltipEvent",
at = @At(
value = "INVOKE",
target = "Lcom/anthonyhilyard/legendarytooltips/tooltip/TooltipDecor;drawBorder(Lcom/mojang/blaze3d/vertex/PoseStack;IIIILnet/minecraft/world/item/ItemStack;Ljava/util/List;Lnet/minecraft/client/gui/Font;Lcom/anthonyhilyard/legendarytooltips/config/LegendaryTooltipsConfig$FrameDefinition;ZI)V"
),
remap = false,
index = 2
)
private static int modifyDrawBorderY(int y) {
GreatScrollableTooltips instance = GreatScrollableTooltips.getInstance();
return y + instance.getScrollSession().getVertical() * instance.getConfig().sensitivity;
}
}
Loading

0 comments on commit a9be86d

Please sign in to comment.